HEX
Server: nginx/1.22.1
System: Linux VM-16-9-centos 3.10.0-1160.99.1.el7.x86_64 #1 SMP Wed Sep 13 14:19:20 UTC 2023 x86_64
User: www (1001)
PHP: 7.3.31
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot/oa.sanjiangapp.com/framework/model.class.php
<?php
/**
 * model类从baseModel类继承而来,每个模块的model对象从model类集成。
 * 您可以对baseModel类进行扩展,扩展的逻辑可以定义在这个文件中。
 *
 * This model class extends from the baseModel class and extened by every module's model. 
 * You can extend the baseModel class by change this file.
 *
 * @package framework
 *
 * The author disclaims copyright to this source code.  In place of
 * a legal notice, here is a blessing:
 * 
 *  May you do good and not evil.
 *  May you find forgiveness for yourself and forgive others.
 *  May you share freely, never taking more than you give.
 */
include FRAME_ROOT . '/base/model.class.php';
class model extends baseModel
{
    /**
     * Delete one record.
     * 
     * @param  string    $table  the table name
     * @param  string    $id     the id value of the record to be deleted
     * @access public
     * @return void
     */
    public function delete($table, $id)
    {
        $this->dao->update($table)->set('deleted')->eq(1)->where('id')->eq($id)->exec();
        $object = trim(substr($table, strrpos($table, '_') + 1), '`');
        $this->loadModel('action')->create($object, $id, 'deleted', '', $extra = ACTIONMODEL::CAN_UNDELETED);
    }

    /**
     * Process status of an object according to its subStatus.
     *
     * @param  string $module   order | contract | purchasecontract | customer | provider | contact | leads | product | invoice | feedback
     * @param  object $record   a record of above modules.
     * @access public
     * @return string
     */
    public function processStatus($module, $record)
    {
        if(!$this->app->isBiz or empty($record->subStatus)) return zget($this->lang->$module->statusList, $record->status);

        return $this->loadModel('workflowfield', 'flow')->processSubStatus($module, $record);
    }

    /**
     * Get flow extend fields.
     *
     * @access public
     * @return array
     */
    public function getFlowExtendFields()
    {
        if(!$this->app->isBiz) return array();

        return $this->loadModel('flow')->getExtendFields($this->app->getModuleName(), $this->app->getMethodName());
    }

    /**
     * Check flow rule.
     *
     * @param  object $field
     * @param  string $value
     * @access public
     * @return bool | string
     */
    public function checkFlowRule($field, $value)
    {
        if(!$this->app->isBiz) return false;

        return $this->loadModel('flow')->checkRule($field, $value);
    }

    /**
     * Execute Hooks.
     *
     * @param  int    $objectID
     * @access public
     * @return void
     */
    public function executeHooks($objectID)
    {
        if(!$this->app->isBiz) return false;

        $moduleName = $this->app->getModuleName();
        $methodName = $this->app->getMethodName();

        $action = $this->loadModel('workflowaction', 'flow')->getByModuleAndAction($moduleName, $methodName);
        if(empty($action) or $action->extensionType == 'none') return false;

        $flow = $this->loadModel('workflow', 'flow')->getByModule($moduleName);
        if($flow && $action) $this->loadModel('workflowhook', 'flow')->execute($flow, $action, $objectID);
    }
}