当前位置: 首页>>代码示例>>PHP>>正文


PHP Commande::createFromProposal方法代码示例

本文整理汇总了PHP中Commande::createFromProposal方法的典型用法代码示例。如果您正苦于以下问题:PHP Commande::createFromProposal方法的具体用法?PHP Commande::createFromProposal怎么用?PHP Commande::createFromProposal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Commande的用法示例。


在下文中一共展示了Commande::createFromProposal方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: runTrigger

 /**
  * Function called when a Dolibarrr business event is done.
  * All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared)
  *
  * @param string		$action		Event action code
  * @param Object		$object     Object
  * @param User		    $user       Object user
  * @param Translate 	$langs      Object langs
  * @param conf		    $conf       Object conf
  * @return int         				<0 if KO, 0 if no triggered ran, >0 if OK
  */
 public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
 {
     if (empty($conf->workflow->enabled)) {
         return 0;
     }
     // Module not active, we do nothing
     // Proposals to order
     if ($action == 'PROPAL_CLOSE_SIGNED') {
         dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
         if (!empty($conf->commande->enabled) && !empty($conf->global->WORKFLOW_PROPAL_AUTOCREATE_ORDER)) {
             include_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php';
             $newobject = new Commande($this->db);
             $newobject->context['createfrompropal'] = 'createfrompropal';
             $newobject->context['origin'] = $object->element;
             $newobject->context['origin_id'] = $object->id;
             $ret = $newobject->createFromProposal($object);
             if ($ret < 0) {
                 $this->error = $newobject->error;
                 $this->errors[] = $newobject->error;
             }
             return $ret;
         }
     }
     // Order to invoice
     if ($action == 'ORDER_CLOSE') {
         dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
         if (!empty($conf->facture->enabled) && !empty($conf->global->WORKFLOW_ORDER_AUTOCREATE_INVOICE)) {
             include_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
             $newobject = new Facture($this->db);
             $newobject->context['createfromorder'] = 'createfromorder';
             $newobject->context['origin'] = $object->element;
             $newobject->context['origin_id'] = $object->id;
             $ret = $newobject->createFromOrder($object);
             if ($ret < 0) {
                 $this->error = $newobject->error;
                 $this->errors[] = $newobject->error;
             }
             return $ret;
         }
     }
     // Order classify billed proposal
     if ($action == 'ORDER_CLASSIFY_BILLED') {
         dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
         if (!empty($conf->propal->enabled) && !empty($conf->global->WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL)) {
             $object->fetchObjectLinked('', 'propal', $object->id, $object->element);
             if (!empty($object->linkedObjects)) {
                 foreach ($object->linkedObjects['propal'] as $element) {
                     $ret = $element->classifyBilled();
                 }
             }
             return $ret;
         }
     }
     // Invoice classify billed order
     if ($action == 'BILL_PAYED') {
         dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
         if (!empty($conf->commande->enabled) && !empty($conf->global->WORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER)) {
             $object->fetchObjectLinked('', 'commande', $object->id, $object->element);
             if (!empty($object->linkedObjects)) {
                 foreach ($object->linkedObjects['commande'] as $element) {
                     $ret = $element->classifyBilled();
                 }
             }
             return $ret;
         }
     }
     // classify billed order
     if ($action == 'BILL_VALIDATE') {
         dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
         if (!empty($conf->commande->enabled) && !empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER)) {
             $object->fetchObjectLinked('', 'commande', $object->id, $object->element);
             if (!empty($object->linkedObjects)) {
                 foreach ($object->linkedObjects['commande'] as $element) {
                     $ret = $element->classifyBilled();
                 }
             }
             return $ret;
         }
     }
     return 0;
 }
开发者ID:Samara94,项目名称:dolibarr,代码行数:92,代码来源:interface_20_modWorkflow_WorkflowManager.class.php

示例2: Commande

    /**
     *      Function called when a Dolibarrr business event is done.
     *      All functions "run_trigger" are triggered if file is inside directory htdocs/includes/triggers
     *      @param      action      Event code (COMPANY_CREATE, PROPAL_VALIDATE, ...)
     *      @param      object      Object action is done on
     *      @param      user        Object user
     *      @param      langs       Object langs
     *      @param      conf        Object conf
     *      @return     int         <0 if KO, 0 if no action are done, >0 if OK
     */
	function run_trigger($action,$object,$user,$langs,$conf)
    {
        if (empty($conf->workflow->enabled)) return 0;     // Module not active, we do nothing

        // Proposals to order
        if ($action == 'PROPAL_CLOSE_SIGNED')
        {
        	dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
            if (! empty($conf->commande->enabled) && ! empty($conf->global->WORKFLOW_PROPAL_AUTOCREATE_ORDER))
            {
                include_once(DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php');
                $order = new Commande($this->db);
                $ret=$order->createFromProposal($object,0);
                if ($ret < 0) { $this->error=$invoice->error; $this->errors[]=$invoice->error; }
                return $ret;
            }
        }

        // Order to invoice
        if ($action == 'ORDER_CLOSE')
        {
            dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
            if (! empty($conf->facture->enabled) && ! empty($conf->global->WORKFLOW_ORDER_AUTOCREATE_INVOICE))
            {
                include_once(DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php');
                $invoice = new Facture($this->db);
                $ret=$invoice->createFromOrder($object,0);
                if ($ret < 0) { $this->error=$invoice->error; $this->errors[]=$invoice->error; }
                return $ret;
            }
        }

        return 0;
    }
开发者ID:remyyounes,项目名称:dolibarr,代码行数:44,代码来源:interface_modWorkflow_WorkflowManager.class.php


注:本文中的Commande::createFromProposal方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。