diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php index 2c647d82575..3af9319c7fa 100644 --- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php +++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php @@ -130,7 +130,8 @@ class InterfaceWorkflowManager extends DolibarrTriggers if ($action == 'BILL_VALIDATE') { dol_syslog( "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id ); - + $ret = 0; + // First classify billed the order to allow the proposal classify process if (! empty($conf->commande->enabled) && ! empty($conf->workflow->enabled) && ! empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER)) { @@ -151,7 +152,6 @@ class InterfaceWorkflowManager extends DolibarrTriggers } } } - return $ret; } // Second classify billed the proposal. @@ -174,8 +174,9 @@ class InterfaceWorkflowManager extends DolibarrTriggers } } } - return $ret; } + + return $ret; } // classify billed order & billed propososal diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 14e86c49cb6..e2d1b29772d 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -1017,6 +1017,34 @@ if (empty($reshook)) } } + if ($action == 'set_unpaid' && $id > 0 && $user->rights->expensereport->to_paid) + { + $object = new ExpenseReport($db); + $object->fetch($id); + + $result = $object->set_unpaid($user); + + if ($result > 0) + { + // Define output language + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; + if (! empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + $model=$object->modelpdf; + $ret = $object->fetch($id); // Reload to get new records + + $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); + } + } + } + if ($action == 'set_paid' && $id > 0 && $user->rights->expensereport->to_paid) { $object = new ExpenseReport($db); diff --git a/htdocs/livraison/card.php b/htdocs/livraison/card.php index aec52404bd1..2889cbfe5a9 100644 --- a/htdocs/livraison/card.php +++ b/htdocs/livraison/card.php @@ -568,7 +568,7 @@ else } // Other attributes - if ($action = 'create_delivery') { + if ($action == 'create_delivery') { // copy from expedition $expeditionExtrafields = new Extrafields($db); $expeditionExtrafieldLabels = $expeditionExtrafields->fetch_name_optionals_label($expedition->table_element); @@ -681,7 +681,7 @@ else $mode = ($object->statut == 0) ? 'edit' : 'view'; $line = new LivraisonLigne($db); $line->fetch_optionals($object->lines[$i]->id); - if ($action = 'create_delivery') { + if ($action == 'create_delivery') { $srcLine = new ExpeditionLigne($db); $expeditionLineExtrafields = new Extrafields($db); $expeditionLineExtrafieldLabels = $expeditionLineExtrafields->fetch_name_optionals_label($srcLine->table_element);