Merge branch '15.0' of git@github.com:Dolibarr/dolibarr.git into 16.0
This commit is contained in:
commit
73c1efecaf
@ -3633,7 +3633,7 @@ class Facture extends CommonInvoice
|
||||
|
||||
global $mysoc, $conf, $langs;
|
||||
|
||||
dol_syslog(get_class($this)."::addline id=$this->id,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, fk_product=$fk_product,remise_percent=$remise_percent,date_start=$date_start,date_end=$date_end,ventil=$ventil,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type, fk_unit=$fk_unit", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::addline id=$this->id, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, fk_product=$fk_product, remise_percent=$remise_percent, date_start=$date_start, date_end=$date_end, ventil=$ventil, info_bits=$info_bits, fk_remise_except=$fk_remise_except, price_base_type=$price_base_type, pu_ttc=$pu_ttc, type=$type, fk_unit=$fk_unit, desc=".dol_trunc($desc, 25), LOG_DEBUG);
|
||||
|
||||
if ($this->statut == self::STATUS_DRAFT) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||
|
||||
@ -4325,7 +4325,7 @@ abstract class CommonObject
|
||||
* @param int $status Status to set
|
||||
* @param int $elementId Id of element to force (use this->id by default if null)
|
||||
* @param string $elementType Type of element to force (use this->table_element by default)
|
||||
* @param string $trigkey Trigger key to use for trigger. Use '' means automatic but it not recommended and is deprecated.
|
||||
* @param string $trigkey Trigger key to use for trigger. Use '' means automatic but it is not recommended and is deprecated.
|
||||
* @param string $fieldstatus Name of status field in this->table_element
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
@ -4375,41 +4375,49 @@ abstract class CommonObject
|
||||
if ($status == 1 && in_array($elementTable, array('inventory'))) {
|
||||
$sql .= ", date_validation = '".$this->db->idate(dol_now())."'";
|
||||
}
|
||||
$sql .= " WHERE rowid=".((int) $elementId);
|
||||
$sql .= " WHERE rowid = ".((int) $elementId);
|
||||
$sql .= " AND ".$fieldstatus." <> ".((int) $status); // We avoid update if status already correct
|
||||
|
||||
dol_syslog(get_class($this)."::setStatut", LOG_DEBUG);
|
||||
if ($this->db->query($sql)) {
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$error = 0;
|
||||
|
||||
// Try autoset of trigkey
|
||||
if (empty($trigkey)) {
|
||||
if ($this->element == 'supplier_proposal' && $status == 2) {
|
||||
$trigkey = 'SUPPLIER_PROPOSAL_SIGN'; // 2 = SupplierProposal::STATUS_SIGNED. Can't use constant into this generic class
|
||||
}
|
||||
if ($this->element == 'supplier_proposal' && $status == 3) {
|
||||
$trigkey = 'SUPPLIER_PROPOSAL_REFUSE'; // 3 = SupplierProposal::STATUS_REFUSED. Can't use constant into this generic class
|
||||
}
|
||||
if ($this->element == 'supplier_proposal' && $status == 4) {
|
||||
$trigkey = 'SUPPLIER_PROPOSAL_CLOSE'; // 4 = SupplierProposal::STATUS_CLOSED. Can't use constant into this generic class
|
||||
}
|
||||
if ($this->element == 'fichinter' && $status == 3) {
|
||||
$trigkey = 'FICHINTER_CLASSIFY_DONE';
|
||||
}
|
||||
if ($this->element == 'fichinter' && $status == 2) {
|
||||
$trigkey = 'FICHINTER_CLASSIFY_BILLED';
|
||||
}
|
||||
if ($this->element == 'fichinter' && $status == 1) {
|
||||
$trigkey = 'FICHINTER_CLASSIFY_UNBILLED';
|
||||
}
|
||||
}
|
||||
$nb_rows_affected = $this->db->affected_rows($resql); // should be 1 or 0 if status was already correct
|
||||
|
||||
if ($trigkey) {
|
||||
// Call trigger
|
||||
$result = $this->call_trigger($trigkey, $user);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
if ($nb_rows_affected >= 0) {
|
||||
if (empty($trigkey)) {
|
||||
// Try to guess trigkey (for backward compatibility, now we should have trigkey defined into the call of setStatus)
|
||||
if ($this->element == 'supplier_proposal' && $status == 2) {
|
||||
$trigkey = 'SUPPLIER_PROPOSAL_SIGN'; // 2 = SupplierProposal::STATUS_SIGNED. Can't use constant into this generic class
|
||||
}
|
||||
if ($this->element == 'supplier_proposal' && $status == 3) {
|
||||
$trigkey = 'SUPPLIER_PROPOSAL_REFUSE'; // 3 = SupplierProposal::STATUS_REFUSED. Can't use constant into this generic class
|
||||
}
|
||||
if ($this->element == 'supplier_proposal' && $status == 4) {
|
||||
$trigkey = 'SUPPLIER_PROPOSAL_CLOSE'; // 4 = SupplierProposal::STATUS_CLOSED. Can't use constant into this generic class
|
||||
}
|
||||
if ($this->element == 'fichinter' && $status == 3) {
|
||||
$trigkey = 'FICHINTER_CLASSIFY_DONE';
|
||||
}
|
||||
if ($this->element == 'fichinter' && $status == 2) {
|
||||
$trigkey = 'FICHINTER_CLASSIFY_BILLED';
|
||||
}
|
||||
if ($this->element == 'fichinter' && $status == 1) {
|
||||
$trigkey = 'FICHINTER_CLASSIFY_UNBILLED';
|
||||
}
|
||||
}
|
||||
// End call triggers
|
||||
|
||||
if ($trigkey) {
|
||||
// Call trigger
|
||||
$result = $this->call_trigger($trigkey, $user);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
// End call triggers
|
||||
}
|
||||
} else {
|
||||
// The status was probably already good. We do nothing more, no triggers.
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
|
||||
@ -180,7 +180,7 @@ function delivery_prepare_head($object)
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->expedition->dir_output."/sending/".dol_sanitizeFileName($object->ref);
|
||||
$upload_dir = $conf->expedition->dir_output."/sending/".dol_sanitizeFileName($tmpobject->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
|
||||
$nbLinks = Link::count($db, $tmpobject->element, $tmpobject->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/expedition/document.php?id='.$tmpobject->id;
|
||||
|
||||
@ -363,9 +363,9 @@ if ($action == 'create') {
|
||||
}
|
||||
$morehtmlref .= '</div>';
|
||||
|
||||
$morehtmlright = $langs->trans("StatusReceipt").' : '.$object->getLibStatut(6).'<br><br class="small">';
|
||||
$morehtmlstatus = $langs->trans("StatusReceipt").' : '.$object->getLibStatut(6).'<br><br class="small">';
|
||||
|
||||
dol_banner_tab($expedition, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
|
||||
dol_banner_tab($expedition, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', $morehtmlstatus);
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
@ -2152,8 +2152,9 @@ class Expedition extends CommonObject
|
||||
}
|
||||
}
|
||||
if ($shipments_match_order) {
|
||||
dol_syslog("Qty for the ".count($order->lines)." lines of order have same value for shipments with status Expedition::STATUS_CLOSED=".self::STATUS_CLOSED.', so we close order');
|
||||
$order->cloture($user);
|
||||
dol_syslog("Qty for the ".count($order->lines)." lines of the origin order is same than qty for lines in the shipment we close (shipments_match_order is true), with new status Expedition::STATUS_CLOSED=".self::STATUS_CLOSED.', so we close order');
|
||||
// We close the order
|
||||
$order->cloture($user); // Note this may also create an invoice if module workflow ask it
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user