當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Facture::createFromOrder方法代碼示例

本文整理匯總了PHP中Facture::createFromOrder方法的典型用法代碼示例。如果您正苦於以下問題:PHP Facture::createFromOrder方法的具體用法?PHP Facture::createFromOrder怎麽用?PHP Facture::createFromOrder使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Facture的用法示例。


在下文中一共展示了Facture::createFromOrder方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: createBillOnOrderValidate

 /**
  *
  * @param unknown $object
  */
 static function createBillOnOrderValidate(&$object)
 {
     global $conf, $langs, $db, $user;
     if (empty($conf->global->GRAPEFRUIT_ORDER_CREATE_BILL_ON_VALIDATE)) {
         return true;
     }
     dol_include_once('/compta/facture/class/facture.class.php');
     $facture = new Facture($db);
     $res = $facture->createFromOrder($object);
     if ($res > 0) {
         setEventMessage($langs->trans('BillCreated'));
     }
     // Transfert Contact from order to invoice
     return false;
 }
開發者ID:ATM-Consulting,項目名稱:dolibarr_module_grapefruit,代碼行數:19,代碼來源:grapefruit.class.php

示例3: testFactureBuild

 /**
  * testFactureBuild
  *
  * @return int
  */
 public function testFactureBuild()
 {
     global $conf, $user, $langs, $db;
     $conf = $this->savconf;
     $user = $this->savuser;
     $langs = $this->savlangs;
     $db = $this->savdb;
     $conf->facture->dir_output .= '/temp';
     $localobjectcom = new Commande($this->savdb);
     $localobjectcom->initAsSpecimen();
     $localobject = new Facture($this->savdb);
     $localobject->createFromOrder($localobjectcom);
     $localobject->date_lim_reglement = dol_now() + 3600 * 24 * 30;
     // Crabe (english)
     $localobject->modelpdf = 'crabe';
     $result = $localobject->generateDocument($localobject->modelpdf, $langs);
     $this->assertLessThan($result, 0);
     print __METHOD__ . " result=" . $result . "\n";
     // Crabe (japanese)
     $newlangs1 = new Translate("", $conf);
     $newlangs1->setDefaultLang('ja_JP');
     $localobject->modelpdf = 'crabe';
     $result = $localobject->generateDocument($localobject->modelpdf, $newlangs1);
     $this->assertLessThan($result, 0);
     print __METHOD__ . " result=" . $result . "\n";
     // Crabe (saudiarabia)
     $newlangs2a = new Translate("", $conf);
     $newlangs2a->setDefaultLang('sa_SA');
     $localobject->modelpdf = 'crabe';
     $result = $localobject->generateDocument($localobject->modelpdf, $newlangs2a);
     $this->assertLessThan($result, 0);
     print __METHOD__ . " result=" . $result . "\n";
     // Crabe (english_saudiarabia)
     $newlangs2b = new Translate("", $conf);
     $newlangs2b->setDefaultLang('en_SA');
     $localobject->modelpdf = 'crabe';
     $result = $localobject->generateDocument($localobject->modelpdf, $newlangs2b);
     $this->assertLessThan($result, 0);
     print __METHOD__ . " result=" . $result . "\n";
     // Crabe (greek)
     $newlangs3 = new Translate("", $conf);
     $newlangs3->setDefaultLang('el_GR');
     $localobject->modelpdf = 'crabe';
     $result = $localobject->generateDocument($localobject->modelpdf, $newlangs3);
     $this->assertLessThan($result, 0);
     print __METHOD__ . " result=" . $result . "\n";
     // Crabe (chinese)
     $newlangs4 = new Translate("", $conf);
     $newlangs4->setDefaultLang('zh_CN');
     $localobject->modelpdf = 'crabe';
     $result = $localobject->generateDocument($localobject->modelpdf, $newlangs4);
     $this->assertLessThan($result, 0);
     print __METHOD__ . " result=" . $result . "\n";
     // Crabe (russian)
     $newlangs5 = new Translate("", $conf);
     $newlangs5->setDefaultLang('ru_RU');
     $localobject->modelpdf = 'crabe';
     $result = $localobject->generateDocument($localobject->modelpdf, $newlangs5);
     $this->assertLessThan($result, 0);
     print __METHOD__ . " result=" . $result . "\n";
     return 0;
 }
開發者ID:Samara94,項目名稱:dolibarr,代碼行數:67,代碼來源:BuildDocTest.php

示例4: testFactureBuild

    /**
     * testFactureBuild
     *
     * @return int
     */
    public function testFactureBuild()
    {
    	global $conf,$user,$langs,$db;
		$conf=$this->savconf;
		$user=$this->savuser;
		$langs=$this->savlangs;
		$db=$this->savdb;

		$conf->facture->dir_output.='/temp';

		$localobjectcom=new Commande($this->savdb);
		$localobjectcom->initAsSpecimen();

		$localobject=new Facture($this->savdb);
    	$localobject->createFromOrder($localobjectcom);
    	$localobject->date_lim_reglement = dol_now() + 3600 * 24 *30;

    	// Crabe
    	$localobject->modelpdf='crabe';
    	$result=facture_pdf_create($db, $localobject, $localobject->modelpdf, $langs);

		$localobject=new Facture($this->savdb);
		$localobject->initAsSpecimen();

		$this->assertLessThan($result, 0);
    	print __METHOD__." result=".$result."\n";

    	// Oursin
    	$localobject->modelpdf='oursin';
    	$result=facture_pdf_create($db, $localobject, $localobject->modelpdf, $langs);

    	$this->assertLessThan($result, 0);
    	print __METHOD__." result=".$result."\n";

    	return 0;
    }
開發者ID:nrjacker4,項目名稱:crm-php,代碼行數:41,代碼來源:BuildDocTest.php

示例5: 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


注:本文中的Facture::createFromOrder方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。