PurchasesController
        
        extends PanelController
    
    
            
            in package
            
        
    
    
            
            Uses
                            DocFilesTrait,                             LogAuditTrait                    
    
        
            Description of PurchasesController
Tags
Table of Contents
- MAIN_VIEW_NAME = 'main'
- MAIN_VIEW_TEMPLATE = 'Tab/PurchasesDocument'
- MODEL_NAMESPACE = '\\FacturaScripts\\Dinamic\\Model\\'
- $active : string
- Indicates the active view.
- $codeModel : CodeModel
- Model to use with select and autocomplete filters.
- $empresa : Empresa
- Selected company.
- $exportManager : ExportManager
- Object to export data.
- $hasData : bool
- Indicates if the main view has data or is empty.
- $multiRequestProtection : MultiRequestProtection
- $permissions : ControllerPermissions
- User permissions on this controller.
- $request : Request
- Request on which we can get data.
- $tabsPosition : string
- Tabs position in page: left, bottom.
- $title : string
- Title of the page.
- $uri : string
- Given uri, default is empty.
- $user : User|false
- User logged in.
- $views : array<string|int, BaseView>
- List of views displayed by the controller.
- $dataBase : DataBase
- It provides direct access to the database.
- $response : Response
- HTTP Response object.
- $className : string
- Name of the class of the controller (although its in inheritance from this class, the name of the final class we will have here)
- $current : string
- Indicates current view, when drawing.
- $logLevels : mixed
- $template : string|false
- Name of the file for the template.
- __construct() : mixed
- Initialize all objects and properties.
- addButton() : BaseView
- Adds a new button to the tab.
- addCustomView() : BaseView
- addExtension() : mixed
- createViewLogAudit() : mixed
- getCurrentView() : BaseView
- getImageUrl() : string
- getMainViewName() : string
- Returns the name assigned to the main view
- getModel() : PurchaseDocument
- getModelClassName() : mixed
- getPageData() : array<string|int, mixed>
- Return the basic data for this page.
- getSettings() : mixed
- Returns the configuration value for the indicated view.
- getTemplate() : string|false
- Return the template to use for this controller.
- getViewModelValue() : mixed
- Return the value for a field in the model of the view.
- listView() : ListView
- loadDataLogAudit() : mixed
- pipe() : mixed
- pipeFalse() : bool
- privateCore() : mixed
- Runs the controller's private logic.
- publicCore() : mixed
- Execute the public part of the controller.
- redirect() : mixed
- Redirect to an url or controller.
- renderPurchasesForm() : string
- run() : void
- series() : array<string|int, mixed>
- setCurrentView() : void
- setSettings() : BaseView
- Set value for setting of a view
- setTabsPosition() : void
- Sets the tabs position, by default is set to 'left', also supported 'bottom', 'top' and 'left-bottom.
- setTemplate() : bool
- Set the template to use for this controller.
- tab() : BaseView
- toolBox() : ToolBox
- url() : string
- Return the URL of the actual controller.
- addEditListView() : EditListView
- Adds a EditList type view to the controller.
- addEditView() : EditView
- Adds an Edit type view to the controller.
- addHtmlView() : HtmlView
- Adds an HTML type view to the controller.
- addListView() : ListView
- Adds a List type view to the controller.
- autocompleteAction() : array<string|int, mixed>
- Run the autocomplete action.
- autocompleteProductAction() : bool
- checkOwnerData() : bool
- Returns true if the active user has permission to view the information of the active record in the informed model.
- createViewDocFiles() : mixed
- createViews() : mixed
- createViewsDoc() : mixed
- datalistAction() : array<string|int, mixed>
- Run the datalist action.
- deleteAction() : bool
- Action to delete data.
- deleteDocAction() : bool
- editAction() : bool
- Runs the data edit action.
- execAfterAction() : mixed
- Run the controller after actions.
- execPreviousAction() : bool
- Run the actions that alter data before reading it.
- exportAction() : mixed
- findProductAction() : bool
- findSupplierAction() : bool
- getAutocompleteValues() : array<string|int, mixed>
- Return values from Widget Values for autocomplete action
- getClassName() : string
- Return the name of the controller.
- insertAction() : bool
- Runs data insert action.
- loadData() : mixed
- recalculateAction() : bool
- requestGet() : array<string|int, mixed>
- Return array with parameters values
- saveDocAction() : bool
- savePaidAction() : bool
- saveStatusAction() : bool
- selectAction() : array<string|int, mixed>
- Run the select action.
- updateNumDocs() : void
- Actualiza el número de adjuntos del documento.
- validateFormToken() : bool
- Check request token. Returns an error if: - the token does not exist - the token is invalid - the token is duplicated
- widgetLibrarySearchAction() : array<string|int, mixed>
- widgetLibraryUploadAction() : array<string|int, mixed>
- widgetVarianteSearchAction() : array<string|int, mixed>
- addFileAction() : bool
- auth() : bool
- checkPhpVersion() : void
- deleteFileAction() : bool
- editFileAction() : bool
- loadDataDocFiles() : mixed
- sendJsonWithLogs() : void
- unlinkFileAction() : bool
- validateFileActionToken() : bool
Constants
MAIN_VIEW_NAME
    public
        mixed
    MAIN_VIEW_NAME
    = 'main'
        
        
    
MAIN_VIEW_TEMPLATE
    public
        mixed
    MAIN_VIEW_TEMPLATE
    = 'Tab/PurchasesDocument'
        
        
    
MODEL_NAMESPACE
    public
        mixed
    MODEL_NAMESPACE
    = '\\FacturaScripts\\Dinamic\\Model\\'
        
        
    
Properties
$active
Indicates the active view.
    public
        string
    $active
    
    
    
    
$codeModel
Model to use with select and autocomplete filters.
    public
        CodeModel
    $codeModel
    
    
    
    
$empresa
Selected company.
    public
        Empresa
    $empresa
    
    
    
    
$exportManager
Object to export data.
    public
        ExportManager
    $exportManager
    
    
    
    
$hasData
Indicates if the main view has data or is empty.
    public
        bool
    $hasData
     = false
    
    
    
$multiRequestProtection
    public
        MultiRequestProtection
    $multiRequestProtection
    
    
    
    
$permissions
User permissions on this controller.
    public
        ControllerPermissions
    $permissions
    
    
    
    
$request
Request on which we can get data.
    public
        Request
    $request
    
    
    
    
$tabsPosition
Tabs position in page: left, bottom.
    public
        string
    $tabsPosition
    
    
    
    
$title
Title of the page.
    public
        string
    $title
    
    
        título de la página.
$uri
Given uri, default is empty.
    public
        string
    $uri
    
    
    
    
$user
User logged in.
    public
        User|false
    $user
     = false
    
    
    
$views
List of views displayed by the controller.
    public
        array<string|int, BaseView>
    $views
     = []
    
    
    
$dataBase
It provides direct access to the database.
    protected
        DataBase
    $dataBase
    
    
    
    
$response
HTTP Response object.
    protected
        Response
    $response
    
    
    
    
$className
Name of the class of the controller (although its in inheritance from this class, the name of the final class we will have here)
    private
        string
    $className
    
    
        CLASS
$current
Indicates current view, when drawing.
    private
        string
    $current
    
    
    
    
$logLevels
    private
        mixed
    $logLevels
     = ['critical', 'error', 'info', 'notice', 'warning']
        
        
    
$template
Name of the file for the template.
    private
        string|false
    $template
    
    
        nombre_archivo.html.twig
Methods
__construct()
Initialize all objects and properties.
    public
                    __construct(string $className[, string $uri = '' ]) : mixed
    
        Parameters
- $className : string
- $uri : string = ''
Return values
mixed —addButton()
Adds a new button to the tab.
    public
                    addButton(string $viewName, array<string|int, mixed> $btnArray) : BaseView
    
        Parameters
- $viewName : string
- $btnArray : array<string|int, mixed>
Return values
BaseView —addCustomView()
    public
                    addCustomView(string $viewName, BaseView $view) : BaseView
    
        Parameters
- $viewName : string
- $view : BaseView
Return values
BaseView —addExtension()
    public
            static        addExtension(mixed $extension) : mixed
    
        Parameters
- $extension : mixed
Return values
mixed —createViewLogAudit()
    public
                    createViewLogAudit([string $viewName = 'ListLogMessage' ]) : mixed
        
        Parameters
- $viewName : string = 'ListLogMessage'
Return values
mixed —getCurrentView()
    public
                    getCurrentView() : BaseView
        
    
    
        Return values
BaseView —getImageUrl()
    public
                    getImageUrl() : string
        
    
    
        Return values
string —getMainViewName()
Returns the name assigned to the main view
    public
                    getMainViewName() : string
    
    
    
        Return values
string —getModel()
    public
                    getModel([bool $reload = false ]) : PurchaseDocument
        
        Parameters
- $reload : bool = false
Return values
PurchaseDocument —getModelClassName()
    public
    abstract                getModelClassName() : mixed
        
    
    
        Return values
mixed —getPageData()
Return the basic data for this page.
    public
                    getPageData() : array<string|int, mixed>
    
    
    
        Return values
array<string|int, mixed> —getSettings()
Returns the configuration value for the indicated view.
    public
                    getSettings(string $viewName, string $property) : mixed
    
        Parameters
- $viewName : string
- $property : string
Return values
mixed —getTemplate()
Return the template to use for this controller.
    public
                    getTemplate() : string|false
    
    
    
        Return values
string|false —getViewModelValue()
Return the value for a field in the model of the view.
    public
                    getViewModelValue(string $viewName, string $fieldName) : mixed
    
        Parameters
- $viewName : string
- $fieldName : string
Return values
mixed —listView()
    public
                    listView(string $viewName) : ListView
        
        Parameters
- $viewName : string
Return values
ListView —loadDataLogAudit()
    public
                    loadDataLogAudit(mixed $view, mixed $model, mixed $modelid) : mixed
        
        Parameters
- $view : mixed
- $model : mixed
- $modelid : mixed
Return values
mixed —pipe()
    public
                    pipe(string $name, array<string|int, mixed> ...$arguments) : mixed
    
        Parameters
- $name : string
- $arguments : array<string|int, mixed>
Return values
mixed —pipeFalse()
    public
                    pipeFalse(string $name, array<string|int, mixed> ...$arguments) : bool
    
        Parameters
- $name : string
- $arguments : array<string|int, mixed>
Return values
bool —privateCore()
Runs the controller's private logic.
    public
                    privateCore(Response &$response, User $user, ControllerPermissions $permissions) : mixed
    
        Parameters
- $response : Response
- $user : User
- $permissions : ControllerPermissions
Return values
mixed —publicCore()
Execute the public part of the controller.
    public
                    publicCore(Response &$response) : mixed
    
        Parameters
- $response : Response
Return values
mixed —redirect()
Redirect to an url or controller.
    public
                    redirect(string $url, int $delay) : mixed
    
        Parameters
- $url : string
- $delay : int
Return values
mixed —renderPurchasesForm()
    public
                    renderPurchasesForm(PurchaseDocument $model, array<string|int, PurchaseDocumentLine> $lines) : string
    
        Parameters
- $model : PurchaseDocument
- $lines : array<string|int, PurchaseDocumentLine>
Return values
string —run()
    public
                    run() : void
        
    
    
        Return values
void —series()
    public
                    series([string $type = '' ]) : array<string|int, mixed>
        
        Parameters
- $type : string = ''
Return values
array<string|int, mixed> —setCurrentView()
    public
                    setCurrentView(string $viewName) : void
        
        Parameters
- $viewName : string
Return values
void —setSettings()
Set value for setting of a view
    public
                    setSettings(string $viewName, string $property, mixed $value) : BaseView
    
        Parameters
- $viewName : string
- $property : string
- $value : mixed
Return values
BaseView —setTabsPosition()
Sets the tabs position, by default is set to 'left', also supported 'bottom', 'top' and 'left-bottom.
    public
                    setTabsPosition(string $position) : void
    
        Parameters
- $position : string
Return values
void —setTemplate()
Set the template to use for this controller.
    public
                    setTemplate(string|false $template) : bool
    
        Parameters
- $template : string|false
Return values
bool —tab()
    public
                    tab(string $viewName) : BaseView
        
        Parameters
- $viewName : string
Return values
BaseView —toolBox()
    public
            static        toolBox() : ToolBox
    
    
    
    Tags
Return values
ToolBox —url()
Return the URL of the actual controller.
    public
                    url() : string
    
    
    
        Return values
string —addEditListView()
Adds a EditList type view to the controller.
    protected
                    addEditListView(string $viewName, string $modelName, string $viewTitle[, string $viewIcon = 'fas fa-bars' ]) : EditListView
    
        Parameters
- $viewName : string
- $modelName : string
- $viewTitle : string
- $viewIcon : string = 'fas fa-bars'
Return values
EditListView —addEditView()
Adds an Edit type view to the controller.
    protected
                    addEditView(string $viewName, string $modelName, string $viewTitle[, string $viewIcon = 'fas fa-edit' ]) : EditView
    
        Parameters
- $viewName : string
- $modelName : string
- $viewTitle : string
- $viewIcon : string = 'fas fa-edit'
Return values
EditView —addHtmlView()
Adds an HTML type view to the controller.
    protected
                    addHtmlView(string $viewName, string $fileName, string $modelName, string $viewTitle[, string $viewIcon = 'fab fa-html5' ]) : HtmlView
    
        Parameters
- $viewName : string
- $fileName : string
- $modelName : string
- $viewTitle : string
- $viewIcon : string = 'fab fa-html5'
Return values
HtmlView —addListView()
Adds a List type view to the controller.
    protected
                    addListView(string $viewName, string $modelName, string $viewTitle[, string $viewIcon = 'fas fa-list' ]) : ListView
    
        Parameters
- $viewName : string
- $modelName : string
- $viewTitle : string
- $viewIcon : string = 'fas fa-list'
Return values
ListView —autocompleteAction()
Run the autocomplete action.
    protected
                    autocompleteAction() : array<string|int, mixed>
        Returns a JSON string for the searched values.
Return values
array<string|int, mixed> —autocompleteProductAction()
    protected
                    autocompleteProductAction() : bool
        
    
    
        Return values
bool —checkOwnerData()
Returns true if the active user has permission to view the information of the active record in the informed model.
    protected
                    checkOwnerData(ModelClass $model) : bool
    
        Parameters
- $model : ModelClass
Return values
bool —createViewDocFiles()
    protected
                    createViewDocFiles([string $viewName = 'docfiles' ][, string $template = 'Tab/DocFiles' ]) : mixed
        
        Parameters
- $viewName : string = 'docfiles'
- $template : string = 'Tab/DocFiles'
Return values
mixed —createViews()
    protected
                    createViews() : mixed
        
    
    
        Return values
mixed —createViewsDoc()
    protected
                    createViewsDoc() : mixed
        
    
    
        Return values
mixed —datalistAction()
Run the datalist action.
    protected
                    datalistAction() : array<string|int, mixed>
        Returns a JSON string for the searched values.
Return values
array<string|int, mixed> —deleteAction()
Action to delete data.
    protected
                    deleteAction() : bool
    
    
    
        Return values
bool —deleteDocAction()
    protected
                    deleteDocAction() : bool
        
    
    
        Return values
bool —editAction()
Runs the data edit action.
    protected
                    editAction() : bool
    
    
    
        Return values
bool —execAfterAction()
Run the controller after actions.
    protected
                    execAfterAction(string $action) : mixed
    
        Parameters
- $action : string
Return values
mixed —execPreviousAction()
Run the actions that alter data before reading it.
    protected
                    execPreviousAction(string $action) : bool
    
        Parameters
- $action : string
Return values
bool —exportAction()
    protected
                    exportAction() : mixed
        
    
    
        Return values
mixed —findProductAction()
    protected
                    findProductAction() : bool
        
    
    
        Return values
bool —findSupplierAction()
    protected
                    findSupplierAction() : bool
        
    
    
        Return values
bool —getAutocompleteValues()
Return values from Widget Values for autocomplete action
    protected
                    getAutocompleteValues(string $viewName, string $fieldName) : array<string|int, mixed>
    
        Parameters
- $viewName : string
- $fieldName : string
Return values
array<string|int, mixed> —getClassName()
Return the name of the controller.
    protected
                    getClassName() : string
    
    
    
        Return values
string —insertAction()
Runs data insert action.
    protected
                    insertAction() : bool
    
    
    
        Return values
bool —loadData()
    protected
                    loadData(string $viewName, BaseView $view) : mixed
    
        Parameters
- $viewName : string
- $view : BaseView
Return values
mixed —recalculateAction()
    protected
                    recalculateAction(bool $renderLines) : bool
        
        Parameters
- $renderLines : bool
Return values
bool —requestGet()
Return array with parameters values
    protected
                    requestGet(array<string|int, mixed> $keys) : array<string|int, mixed>
    
        Parameters
- $keys : array<string|int, mixed>
Return values
array<string|int, mixed> —saveDocAction()
    protected
                    saveDocAction() : bool
        
    
    
        Return values
bool —savePaidAction()
    protected
                    savePaidAction() : bool
        
    
    
        Return values
bool —saveStatusAction()
    protected
                    saveStatusAction() : bool
        
    
    
        Return values
bool —selectAction()
Run the select action.
    protected
                    selectAction() : array<string|int, mixed>
        Returns a JSON string for the searched values.
Return values
array<string|int, mixed> —updateNumDocs()
Actualiza el número de adjuntos del documento.
    protected
                    updateNumDocs() : void
    
    
    
        Return values
void —validateFormToken()
Check request token. Returns an error if: - the token does not exist - the token is invalid - the token is duplicated
    protected
                    validateFormToken() : bool
    
    
    
        Return values
bool —widgetLibrarySearchAction()
    protected
                    widgetLibrarySearchAction() : array<string|int, mixed>
        
    
    
        Return values
array<string|int, mixed> —widgetLibraryUploadAction()
    protected
                    widgetLibraryUploadAction() : array<string|int, mixed>
        
    
    
        Return values
array<string|int, mixed> —widgetVarianteSearchAction()
    protected
                    widgetVarianteSearchAction() : array<string|int, mixed>
        
    
    
        Return values
array<string|int, mixed> —addFileAction()
    private
                    addFileAction() : bool
        
    
    
        Return values
bool —auth()
    private
                    auth() : bool
        
    
    
        Return values
bool —checkPhpVersion()
    private
                    checkPhpVersion(float $min) : void
        
        Parameters
- $min : float
Return values
void —deleteFileAction()
    private
                    deleteFileAction() : bool
        
    
    
        Return values
bool —editFileAction()
    private
                    editFileAction() : bool
        
    
    
        Return values
bool —loadDataDocFiles()
    private
                    loadDataDocFiles(BaseView $view, string $model, string $modelid) : mixed
    
        Parameters
- $view : BaseView
- $model : string
- $modelid : string
Return values
mixed —sendJsonWithLogs()
    private
                    sendJsonWithLogs(array<string|int, mixed> $data) : void
        
        Parameters
- $data : array<string|int, mixed>
Return values
void —unlinkFileAction()
    private
                    unlinkFileAction() : bool
        
    
    
        Return values
bool —validateFileActionToken()
    private
                    validateFileActionToken() : bool