Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
65fb217432
15 changed files with 235 additions and 42 deletions
|
|
@ -390,11 +390,12 @@ if (empty($reshook)) {
|
|||
$element = $subelement = 'contrat';
|
||||
}
|
||||
|
||||
$object->origin = $origin;
|
||||
$object->origin = $origin; // deprecated
|
||||
$object->origin_type = $origin;
|
||||
$object->origin_id = $originid;
|
||||
|
||||
// Possibility to add external linked objects with hooks
|
||||
$object->linked_objects [$object->origin] = $object->origin_id;
|
||||
$object->linked_objects [$object->origin_type] = $object->origin_id;
|
||||
$other_linked_objects = GETPOST('other_linked_objects', 'array');
|
||||
if (!empty($other_linked_objects)) {
|
||||
$object->linked_objects = array_merge($object->linked_objects, $other_linked_objects);
|
||||
|
|
|
|||
|
|
@ -1794,7 +1794,7 @@ abstract class CommonObject
|
|||
$result = array();
|
||||
$i = 0;
|
||||
// Particular case for shipping
|
||||
if ($this->element == 'shipping' && $this->origin_id != 0) {
|
||||
if (!getDolGlobalInt('SHIPPING_USE_ITS_OWN_CONTACTS') && $this->element == 'shipping' && $this->origin_id != 0) {
|
||||
$id = $this->origin_id;
|
||||
$element = 'commande';
|
||||
} elseif ($this->element == 'reception' && $this->origin_id != 0) {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
/* Copyright (C) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2025 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -48,7 +49,7 @@ function shipping_prepare_head($object)
|
|||
$head[$h][2] = 'shipping';
|
||||
$h++;
|
||||
|
||||
if ($object->statut == Expedition::STATUS_DRAFT) {
|
||||
if ($object->status == Expedition::STATUS_DRAFT) {
|
||||
$head[$h][0] = DOL_URL_ROOT."/expedition/dispatch.php?id=".$object->id;
|
||||
$head[$h][1] = $langs->trans("ShipmentDistribution");
|
||||
$head[$h][2] = 'dispatch';
|
||||
|
|
@ -71,7 +72,7 @@ function shipping_prepare_head($object)
|
|||
|
||||
if (!getDolGlobalString('MAIN_DISABLE_CONTACTS_TAB')) {
|
||||
$objectsrc = $object;
|
||||
if ($object->origin == 'commande' && $object->origin_id > 0) {
|
||||
if (!getDolGlobalInt('SHIPPING_USE_ITS_OWN_CONTACTS') && $object->origin_type == 'commande' && $object->origin_id > 0) {
|
||||
$objectsrc = new Commande($db);
|
||||
$objectsrc->fetch($object->origin_id);
|
||||
}
|
||||
|
|
@ -128,7 +129,7 @@ function shipping_prepare_head($object)
|
|||
/**
|
||||
* Prepare array with list of tabs
|
||||
*
|
||||
* @param Object $object Object related to tabs
|
||||
* @param Delivery $object Object related to tabs
|
||||
* @return array<array{0:string,1:string,2:string}> Array of tabs to show
|
||||
*/
|
||||
function delivery_prepare_head($object)
|
||||
|
|
@ -163,7 +164,7 @@ function delivery_prepare_head($object)
|
|||
|
||||
// Get parent object
|
||||
$tmpobject = null;
|
||||
if ($object->origin) {
|
||||
if ($object->origin_type) {
|
||||
$tmpobject = new Expedition($db);
|
||||
$tmpobject->fetch($object->origin_id);
|
||||
} else {
|
||||
|
|
@ -172,7 +173,7 @@ function delivery_prepare_head($object)
|
|||
|
||||
if (!getDolGlobalString('MAIN_DISABLE_CONTACTS_TAB')) {
|
||||
$objectsrc = $tmpobject;
|
||||
if ($tmpobject->origin == 'commande' && $tmpobject->origin_id > 0) {
|
||||
if ($tmpobject->origin_type == 'commande' && $tmpobject->origin_id > 0) {
|
||||
$objectsrc = new Commande($db);
|
||||
$objectsrc->fetch($tmpobject->origin_id);
|
||||
}
|
||||
|
|
@ -454,6 +455,7 @@ function show_list_sending_receive($origin, $origin_id, $filter = '')
|
|||
}
|
||||
|
||||
if (!empty($receiving)) {
|
||||
/** @var Delivery $receiving */
|
||||
'@phan-var-force Delivery $receiving';
|
||||
// $expedition->fk_elementdet = id of det line of order
|
||||
// $receiving->fk_origin_line = id of det line of order
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ if ($permission) {
|
|||
<div class="tagtd maxwidthonsmartphone">
|
||||
<?php
|
||||
$tmpobject = $object;
|
||||
if (($object->element == 'shipping' || $object->element == 'reception') && is_object($objectsrc)) {
|
||||
if (((!getDolGlobalInt('SHIPPING_USE_ITS_OWN_CONTACTS') && $object->element == 'shipping') || $object->element == 'reception') && is_object($objectsrc)) {
|
||||
$tmpobject = $objectsrc;
|
||||
}
|
||||
$formcompany->selectTypeContact($tmpobject, '', 'type', 'internal', 'position', 0, 'minwidth150imp widthcentpercentminusx maxwidth200'); ?></div>
|
||||
|
|
@ -201,7 +201,7 @@ if ($permission) {
|
|||
<div class="tagtd noborderbottom">
|
||||
<?php
|
||||
$tmpobject = $object;
|
||||
if (($object->element == 'shipping' || $object->element == 'reception') && is_object($objectsrc)) {
|
||||
if (((!getDolGlobalInt('SHIPPING_USE_ITS_OWN_CONTACTS') && $object->element == 'shipping') || $object->element == 'reception') && is_object($objectsrc)) {
|
||||
'@phan-var-force Commande|Facture $objectsrc';
|
||||
$tmpobject = $objectsrc;
|
||||
}
|
||||
|
|
@ -230,7 +230,7 @@ if ($permission) {
|
|||
// TODO: replace this with 1 single direct SQL (for both internal and external string to use $db->sort($sortfield, $sortorder)
|
||||
$list = array();
|
||||
foreach (array('internal', 'external') as $source) {
|
||||
if (($object->element == 'shipping' || $object->element == 'reception') && is_object($objectsrc)) {
|
||||
if (((!getDolGlobalInt('SHIPPING_USE_ITS_OWN_CONTACTS') && $object->element == 'shipping') || $object->element == 'reception') && is_object($objectsrc)) {
|
||||
'@phan-var-force Commande|Facture $objectsrc';
|
||||
$contactlist = $objectsrc->liste_contact(-1, $source);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -517,6 +517,23 @@ class Expedition extends CommonObject
|
|||
}
|
||||
}
|
||||
|
||||
if (!$error && $this->id && getDolGlobalInt('SHIPPING_USE_ITS_OWN_CONTACTS') && getDolGlobalString('MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN') && !empty($this->origin_type) && !empty($this->origin_id)) { // Get contact from origin object
|
||||
$originforcontact = $this->origin_type;
|
||||
$originidforcontact = $this->origin_id;
|
||||
|
||||
$sqlcontact = "SELECT ctc.code, ctc.source, ec.fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc";
|
||||
$sqlcontact .= " WHERE element_id = ".((int) $originidforcontact)." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$this->db->escape($originforcontact)."'";
|
||||
|
||||
$resqlcontact = $this->db->query($sqlcontact);
|
||||
if ($resqlcontact) {
|
||||
while ($objcontact = $this->db->fetch_object($resqlcontact)) {
|
||||
$this->add_contact($objcontact->fk_socpeople, $objcontact->code, $objcontact->source); // May failed because of duplicate key or because code of contact type does not exists for new object
|
||||
}
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
}
|
||||
|
||||
// Actions on extra fields
|
||||
if (!$error) {
|
||||
$result = $this->insertExtraFields();
|
||||
|
|
@ -949,7 +966,7 @@ class Expedition extends CommonObject
|
|||
global $conf;
|
||||
|
||||
if (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY')) {
|
||||
if ($this->statut == self::STATUS_VALIDATED || $this->statut == self::STATUS_CLOSED) {
|
||||
if ($this->status == self::STATUS_VALIDATED || $this->status == self::STATUS_CLOSED) {
|
||||
// Expedition validee
|
||||
include_once DOL_DOCUMENT_ROOT.'/delivery/class/delivery.class.php';
|
||||
$delivery = new Delivery($this->db);
|
||||
|
|
@ -1172,6 +1189,9 @@ class Expedition extends CommonObject
|
|||
if (isset($this->statut)) {
|
||||
$this->statut = (int) $this->statut;
|
||||
}
|
||||
if (isset($this->status)) {
|
||||
$this->status = (int) $this->status;
|
||||
}
|
||||
if (isset($this->trueDepth)) {
|
||||
$this->trueDepth = trim($this->trueDepth);
|
||||
}
|
||||
|
|
@ -1221,7 +1241,7 @@ class Expedition extends CommonObject
|
|||
$sql .= " fk_address = ".(isset($this->fk_delivery_address) ? $this->fk_delivery_address : "null").",";
|
||||
$sql .= " fk_shipping_method = ".((isset($this->shipping_method_id) && $this->shipping_method_id > 0) ? $this->shipping_method_id : "null").",";
|
||||
$sql .= " tracking_number = ".(isset($this->tracking_number) ? "'".$this->db->escape($this->tracking_number)."'" : "null").",";
|
||||
$sql .= " fk_statut = ".(isset($this->statut) ? $this->statut : "null").",";
|
||||
$sql .= " fk_statut = ".(isset($this->status) ? $this->status : "null").",";
|
||||
$sql .= " fk_projet = ".(isset($this->fk_project) ? $this->fk_project : "null").",";
|
||||
$sql .= " height = ".(($this->trueHeight != '') ? $this->trueHeight : "null").",";
|
||||
$sql .= " width = ".(($this->trueWidth != '') ? $this->trueWidth : "null").",";
|
||||
|
|
@ -1312,8 +1332,8 @@ class Expedition extends CommonObject
|
|||
|
||||
// Stock control
|
||||
if (!$error && isModEnabled('stock') &&
|
||||
((getDolGlobalString('STOCK_CALCULATE_ON_SHIPMENT') && $this->statut > self::STATUS_DRAFT) ||
|
||||
(getDolGlobalString('STOCK_CALCULATE_ON_SHIPMENT_CLOSE') && $this->statut == self::STATUS_CLOSED && $also_update_stock))) {
|
||||
((getDolGlobalString('STOCK_CALCULATE_ON_SHIPMENT') && $this->status > self::STATUS_DRAFT) ||
|
||||
(getDolGlobalString('STOCK_CALCULATE_ON_SHIPMENT_CLOSE') && $this->status == self::STATUS_CLOSED && $also_update_stock))) {
|
||||
require_once DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php";
|
||||
|
||||
$langs->load("agenda");
|
||||
|
|
@ -1412,7 +1432,7 @@ class Expedition extends CommonObject
|
|||
$this->fetch_origin();
|
||||
$origin_object = $this->origin_object;
|
||||
'@phan-var-force Facture|Commande $origin_object';
|
||||
if ($origin_object->statut == Commande::STATUS_SHIPMENTONPROCESS) { // If order source of shipment is "shipment in progress"
|
||||
if ($origin_object->status == Commande::STATUS_SHIPMENTONPROCESS) { // If order source of shipment is "shipment in progress"
|
||||
// Check if there is no more shipment. If not, we can move back status of order to "validated" instead of "shipment in progress"
|
||||
$origin_object->loadExpeditions();
|
||||
//var_dump($this->$origin->expeditions);exit;
|
||||
|
|
@ -1511,8 +1531,8 @@ class Expedition extends CommonObject
|
|||
|
||||
// Stock control
|
||||
if (!$error && isModEnabled('stock') &&
|
||||
((getDolGlobalString('STOCK_CALCULATE_ON_SHIPMENT') && $this->statut > self::STATUS_DRAFT) ||
|
||||
(getDolGlobalString('STOCK_CALCULATE_ON_SHIPMENT_CLOSE') && $this->statut == self::STATUS_CLOSED && $also_update_stock))) {
|
||||
((getDolGlobalString('STOCK_CALCULATE_ON_SHIPMENT') && $this->status > self::STATUS_DRAFT) ||
|
||||
(getDolGlobalString('STOCK_CALCULATE_ON_SHIPMENT_CLOSE') && $this->status == self::STATUS_CLOSED && $also_update_stock))) {
|
||||
require_once DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php";
|
||||
|
||||
$langs->load("agenda");
|
||||
|
|
@ -1622,7 +1642,7 @@ class Expedition extends CommonObject
|
|||
$this->fetch_origin();
|
||||
$origin_object = $this->origin_object;
|
||||
'@phan-var-force Facture|Commande $origin_object';
|
||||
if ($origin_object->statut == Commande::STATUS_SHIPMENTONPROCESS) { // If order source of shipment is "shipment in progress"
|
||||
if ($origin_object->status == Commande::STATUS_SHIPMENTONPROCESS) { // If order source of shipment is "shipment in progress"
|
||||
// Check if there is no more shipment. If not, we can move back status of order to "validated" instead of "shipment in progress"
|
||||
$origin_object->loadExpeditions();
|
||||
//var_dump($this->$origin->expeditions);exit;
|
||||
|
|
@ -1905,7 +1925,7 @@ class Expedition extends CommonObject
|
|||
{
|
||||
global $user;
|
||||
|
||||
if ($this->statut == self::STATUS_DRAFT) {
|
||||
if ($this->status == self::STATUS_DRAFT) {
|
||||
$this->db->begin();
|
||||
|
||||
$line = new ExpeditionLigne($this->db);
|
||||
|
|
@ -1945,7 +1965,7 @@ class Expedition extends CommonObject
|
|||
|
||||
$datas = array();
|
||||
$datas['picto'] = img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("Shipment").'</u>';
|
||||
if (isset($this->statut)) {
|
||||
if (isset($this->status)) {
|
||||
$datas['picto'] .= ' '.$this->getLibStatut(5);
|
||||
}
|
||||
$datas['ref'] = '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
|
||||
|
|
@ -2052,7 +2072,7 @@ class Expedition extends CommonObject
|
|||
*/
|
||||
public function getLibStatut($mode = 0)
|
||||
{
|
||||
return $this->LibStatut($this->statut, $mode);
|
||||
return $this->LibStatut($this->status, $mode);
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
|
|
@ -2369,7 +2389,7 @@ class Expedition extends CommonObject
|
|||
$error = 0;
|
||||
|
||||
// Protection. This avoid to move stock later when we should not
|
||||
if ($this->statut == self::STATUS_CLOSED) {
|
||||
if ($this->status == self::STATUS_CLOSED) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -2583,7 +2603,7 @@ class Expedition extends CommonObject
|
|||
public function setDraft($user, $notrigger = 0)
|
||||
{
|
||||
// Protection
|
||||
if ($this->statut <= self::STATUS_DRAFT) {
|
||||
if ($this->status <= self::STATUS_DRAFT) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -2602,7 +2622,7 @@ class Expedition extends CommonObject
|
|||
$error = 0;
|
||||
|
||||
// Protection. This avoid to move stock later when we should not
|
||||
if ($this->statut == self::STATUS_VALIDATED) {
|
||||
if ($this->status == self::STATUS_VALIDATED) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2023 Christian Foellmann <christian@foellmann.de>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
@ -58,6 +58,7 @@ $object = new Expedition($db);
|
|||
if ($id > 0 || !empty($ref)) {
|
||||
$object->fetch($id, $ref);
|
||||
$object->fetch_thirdparty();
|
||||
$objectsrc = clone $object;
|
||||
|
||||
if (!empty($object->origin)) {
|
||||
$typeobject = $object->origin;
|
||||
|
|
@ -66,11 +67,11 @@ if ($id > 0 || !empty($ref)) {
|
|||
}
|
||||
|
||||
// Linked documents
|
||||
if ($typeobject == 'commande' && $object->origin_object->id && isModEnabled('order')) {
|
||||
if (!getDolGlobalInt('SHIPPING_USE_ITS_OWN_CONTACTS') && $typeobject == 'commande' && $object->origin_object->id && isModEnabled('order')) {
|
||||
$objectsrc = new Commande($db);
|
||||
$objectsrc->fetch($object->origin_object->id);
|
||||
}
|
||||
if ($typeobject == 'propal' && $object->origin_object->id && isModEnabled("propal")) {
|
||||
if (!getDolGlobalInt('SHIPPING_USE_ITS_OWN_CONTACTS') && $typeobject == 'propal' && $object->origin_object->id && isModEnabled("propal")) {
|
||||
$objectsrc = new Propal($db);
|
||||
$objectsrc->fetch($object->origin_object->id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
* Copyright (C) 2014 Cedric Gross <c.gross@kreiz-it.fr>
|
||||
* Copyright (C) 2016 Florian Henry <florian.henry@atm-consulting.fr>
|
||||
* Copyright (C) 2017-2022 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2019-2020 Christophe Battarel <christophe@altairis.fr>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
|
|
@ -547,7 +547,7 @@ if ($object->id > 0 || !empty($object->ref)) {
|
|||
print '<br>';
|
||||
$disabled = 0; // This is used to disable or not the bulk selection of target warehouse. No reason to have it disabled so forced to 0.
|
||||
|
||||
if ($object->statut == Expedition::STATUS_DRAFT) {
|
||||
if ($object->status == Expedition::STATUS_DRAFT) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
|
||||
$formproduct = new FormProduct($db);
|
||||
$formproduct->loadWarehouses();
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -258,7 +258,7 @@ if ($resql) {
|
|||
$orderstatic->id = $obj->rowid;
|
||||
$orderstatic->ref = $obj->ref;
|
||||
$orderstatic->ref_customer = $obj->ref_customer;
|
||||
$orderstatic->statut = $obj->status;
|
||||
$orderstatic->status = $obj->status;
|
||||
$orderstatic->billed = $obj->billed;
|
||||
|
||||
$companystatic->name = $obj->name;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2012-2015 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2018-2022 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
|
|
@ -470,7 +470,7 @@ if ($order_id > 0 || !empty($ref)) {
|
|||
print $langs->trans('PaymentConditionsShort');
|
||||
print '</td>';
|
||||
|
||||
if ($action != 'editconditions' && $object->statut == Expedition::STATUS_VALIDATED) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editconditions&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetConditions'),1).'</a></td>';
|
||||
if ($action != 'editconditions' && $object->status == Expedition::STATUS_VALIDATED) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editconditions&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetConditions'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="2">';
|
||||
if ($action == 'editconditions')
|
||||
|
|
@ -488,7 +488,7 @@ if ($order_id > 0 || !empty($ref)) {
|
|||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('PaymentMode');
|
||||
print '</td>';
|
||||
if ($action != 'editmode' && $object->statut == Expedition::STATUS_VALIDATED) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetMode'),1).'</a></td>';
|
||||
if ($action != 'editmode' && $object->status == Expedition::STATUS_VALIDATED) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetMode'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="2">';
|
||||
if ($action == 'editmode')
|
||||
|
|
@ -864,7 +864,7 @@ if ($order_id > 0 || !empty($ref)) {
|
|||
print '<div class="tabsAction">';
|
||||
|
||||
// Bouton expedier sans gestion des stocks
|
||||
if (!isModEnabled('stock') && ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED)) {
|
||||
if (!isModEnabled('stock') && ($object->status > Commande::STATUS_DRAFT && $object->status < Commande::STATUS_CLOSED)) {
|
||||
if ($user->hasRight('expedition', 'creer')) {
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/expedition/card.php?action=create&origin=commande&object_id='.$order_id.'">'.$langs->trans("CreateShipment").'</a>';
|
||||
if ($toBeShippedTotal <= 0) {
|
||||
|
|
@ -880,11 +880,11 @@ if ($order_id > 0 || !empty($ref)) {
|
|||
|
||||
// Button to create a shipment
|
||||
|
||||
if (isModEnabled('stock') && $object->statut == Commande::STATUS_DRAFT) {
|
||||
if (isModEnabled('stock') && $object->status == Commande::STATUS_DRAFT) {
|
||||
print $langs->trans("ValidateOrderFirstBeforeShipment");
|
||||
}
|
||||
|
||||
if (isModEnabled('stock') && ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED)) {
|
||||
if (isModEnabled('stock') && ($object->status > Commande::STATUS_DRAFT && $object->status < Commande::STATUS_CLOSED)) {
|
||||
if ($user->hasRight('expedition', 'creer')) {
|
||||
//print load_fiche_titre($langs->trans("CreateShipment"));
|
||||
print '<div class="tabsAction">';
|
||||
|
|
|
|||
|
|
@ -931,6 +931,7 @@ MassFilesArea=Area for files built by mass actions
|
|||
ShowTempMassFilesArea=Show area of files built by mass actions
|
||||
ConfirmMassDeletion=Bulk Delete confirmation
|
||||
ConfirmMassDeletionQuestion=Are you sure you want to delete the %s selected record(s)?
|
||||
ConfirmMassCancellationQuestion = Are you sure you want to cancel the %s selected record(s)?
|
||||
ConfirmMassClone=Bulk clone confirmation
|
||||
ConfirmMassCloneQuestion=Select project to clone to
|
||||
ConfirmMassCloneToOneProject=Clone to project %s
|
||||
|
|
|
|||
|
|
@ -147,3 +147,21 @@ NoRemainQtyToDispatch=No quantity remaining to divide
|
|||
THMOperatorEstimatedHelp=Estimated cost of operator per hour. Will be used to estimate cost of a BOM using this workstation.
|
||||
THMMachineEstimatedHelp=Estimated cost of machine per hour. Will be used to estimate cost of a BOM using this workstation.
|
||||
BadValueForquantityToConsume=Quantity to consume for a material cannot be 0 or negative
|
||||
NoValidatedStatusMo = Manufacturing order %s cannot be canceled because it is not validated
|
||||
CancelMoValidated = Manufacturing order %s canceled
|
||||
ErrorObjectMustHaveStatusValidatedToBeCanceled = The object %s must have the 'Validated' status to be canceled
|
||||
ErrorObjectMustHaveStatusDraftToModifyDate = The object %s must have the 'Draft' status to be modified
|
||||
MoChangeDateStart = Modify start date
|
||||
MoChangeDateEnd = Modify end date
|
||||
ConfirmMassChangeDateStart = Confirmation of mass modification of the planned start date
|
||||
ConfirmMassChangeDateStartQuestion = Are you sure you want to modify the %s selected record(s)?
|
||||
ConfirmMassChangeDateEndQuestion = Are you sure you want to modify the %s selected record(s)?
|
||||
ModifyDateStart = New planned start date
|
||||
ModifyDateEnd = New planned end date
|
||||
ModifyMoDate = Date modification validated for %s
|
||||
ErrorEmptyChangeDate = Please define a date
|
||||
ConfirmMassChangeDateEnd = Confirmation of mass modification of the planned end date
|
||||
ErrorModifyMoDateStart = You must choose a start date earlier than the current start date. %s
|
||||
ErrorModifyMoDateEnd = You must choose an end date later than the start date. %s
|
||||
ErrorCancelMo=Error updating cancellation
|
||||
ErrorModifyMoDate=Error updating date modification
|
||||
|
|
|
|||
|
|
@ -929,6 +929,7 @@ MassFilesArea=Zone des fichiers générés en masse
|
|||
ShowTempMassFilesArea=Afficher la zone des fichiers générés en masse
|
||||
ConfirmMassDeletion=Confirmation de suppression en masse
|
||||
ConfirmMassDeletionQuestion=Êtes-vous sur de vouloir supprimer les %s enregistrement(s) sélectionné(s) ?
|
||||
ConfirmMassCancellationQuestion=Êtes-vous sûr de vouloir annuler les %s enregistrement(s) sélectionné(s) ?
|
||||
ConfirmMassClone=Confirmation de clonage en masse
|
||||
ConfirmMassCloneQuestion=Sélectionner le projet vers lequel cloner
|
||||
ConfirmMassCloneToOneProject=Cloner vers le projet %s
|
||||
|
|
|
|||
|
|
@ -146,3 +146,22 @@ NoRemainQtyToDispatch=Aucune quantité restant à fractionner
|
|||
THMOperatorEstimatedHelp=Coût estimé de l'opérateur par heure. Sera utilisé pour estimer le coût d'une nomenclature utilisant ce poste de travail.
|
||||
THMMachineEstimatedHelp=Coût estimé de la machine par heure. Sera utilisé pour estimer le coût d'une nomenclature utilisant ce poste de travail.
|
||||
BadValueForquantityToConsume=La quantité à consommer pour un matériau ne peut pas être 0 ou négative
|
||||
NoValidatedStatusMo = Ordre de fabrication %s ne peut être annulé car il n'est pas validé
|
||||
CancelMoValidated = Ordre de fabrication %s annulé
|
||||
ErrorObjectMustHaveStatusValidatedToBeCanceled=L'objet %s doit être au statut 'Validé' pour être annulé
|
||||
ErrorObjectMustHaveStatusDraftToModifyDate=L'objet %s doit être au statut 'Brouillon' pour être modifié
|
||||
MoChangeDateStart = Modifier date de début
|
||||
MoChangeDateEnd = Modifier date de fin
|
||||
ConfirmMassChangeDateStart=Confirmation de modification de la date de début prévue en masse
|
||||
ConfirmMassChangeDateStartQuestion=Êtes-vous sur de vouloir modifier les %s enregistrement(s) sélectionné(s) ?
|
||||
ConfirmMassChangeDateEndQuestion=Êtes-vous sur de vouloir modifier les %s enregistrement(s) sélectionné(s) ?
|
||||
ModifyDateStart=Nouvelle date de début prévue
|
||||
ModifyDateEnd=Nouvelle date de fin prévue
|
||||
ModifyMoDate=Modification de date validé pour %s
|
||||
ErrorEmptyChangeDate= Veuillez définir une date
|
||||
ConfirmMassChangeDateEnd=Confirmation de modification de la date de fin prévue en masse
|
||||
ErrorModifyMoDateStart=Vous devez choisir une date de début inférieur à la date de début. %s
|
||||
ErrorModifyMoDateEnd=Vous devez choisir une date de fin supérieur à la date de début. %s
|
||||
ErrorCancelMo=Erreur lors de la mise à jour de l'annulation
|
||||
ErrorModifyMoDate=Erreur lors de la mise à jour de la modification de la date.
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
|
||||
* Copyright (C) ---Replace with your own copyright and developer email---
|
||||
|
|
|
|||
|
|
@ -66,6 +66,16 @@ $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
|
|||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
|
||||
$also_cancel_consumed_and_produced_lines = (GETPOST('alsoCancelConsumedAndProducedLines', 'alpha') ? 1 : 0);
|
||||
$changeDate = GETPOST('change_date', 'alpha');
|
||||
|
||||
//Data request for date
|
||||
$year = GETPOST('change_dateyear', 'int');
|
||||
$month = GETPOST('change_datemonth', 'int');
|
||||
$day = GETPOST('change_dateday', 'int');
|
||||
$hour = GETPOST('change_datehour', 'int');
|
||||
$min = GETPOST('change_datemin', 'int');
|
||||
|
||||
if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
|
||||
// If $page is not defined, or '' or -1 or if we click on clear filters
|
||||
$page = 0;
|
||||
|
|
@ -207,6 +217,74 @@ if (empty($reshook)) {
|
|||
$objectlabel = 'Mo';
|
||||
$uploaddir = $conf->mrp->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
$objMo = new Mo($db);
|
||||
|
||||
if ($action == 'confirm_cancel' && $confirm == 'yes' && $permissiontoadd) {
|
||||
if (!empty($toselect)) {
|
||||
foreach ($toselect as $key => $idMo) {
|
||||
if ($objMo->fetch($idMo)) {
|
||||
if ($objMo->status == Mo::STATUS_VALIDATED || $objMo->status == Mo::STATUS_INPROGRESS) {
|
||||
if ($also_cancel_consumed_and_produced_lines) {
|
||||
if ($objMo->cancelConsumedAndProducedLines($user, 0, true, 1)) {
|
||||
$objMo->status = Mo::STATUS_CANCELED;
|
||||
}
|
||||
} else {
|
||||
$objMo->status = Mo::STATUS_CANCELED;
|
||||
}
|
||||
if ($objMo->update($user)) {
|
||||
setEventMessages($langs->trans('CancelMoValidated', $objMo->ref), null, 'mesgs');
|
||||
} else {
|
||||
setEventMessages($langs->trans('ErrorCancelMo', $objMo->ref), null, 'errors');
|
||||
}
|
||||
} else {
|
||||
setEventMessages($langs->trans('ErrorObjectMustHaveStatusValidatedToBeCanceled', $objMo->ref), null, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (($action == 'changedatestart_confirm' || $action == 'changedateend_confirm') && $permissiontoadd) {
|
||||
if ($confirm == 'yes') {
|
||||
$newDate = dol_mktime((int) $hour, (int) $min, (int) 0, (int) $month, (int) $day, (int) $year);
|
||||
|
||||
if (!empty($toselect)) {
|
||||
foreach ($toselect as $key => $idMo) {
|
||||
if ($objMo->fetch($idMo)) {
|
||||
if ($objMo->status == Mo::STATUS_DRAFT) {
|
||||
if (!empty($changeDate)) {
|
||||
if ($action == 'changedatestart_confirm') {
|
||||
if ($newDate < $objMo->date_end_planned) {
|
||||
$objMo->date_start_planned = $newDate;
|
||||
} else {
|
||||
setEventMessages($langs->trans('ErrorModifyMoDateStart', $objMo->ref), null, 'errors');
|
||||
break;
|
||||
}
|
||||
} elseif ($action == 'changedateend_confirm') {
|
||||
if ($newDate > $objMo->date_start_planned) {
|
||||
$objMo->date_end_planned = $newDate;
|
||||
} else {
|
||||
setEventMessages($langs->trans('ErrorModifyMoDateEnd', $objMo->ref), null, 'errors');
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($objMo->update($user)) {
|
||||
setEventMessages($langs->trans('ModifyMoDate', $objMo->ref), null, 'mesgs');
|
||||
} else {
|
||||
setEventMessages($langs->trans('ErrorModifyMoDate', $objMo->ref), null, 'errors');
|
||||
}
|
||||
} else {
|
||||
setEventMessages($langs->trans('ErrorEmptyChangeDate'), null, 'errors');
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
setEventMessages($langs->trans('ErrorObjectMustHaveStatusDraftToModifyDate', $objMo->ref), null, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -418,9 +496,12 @@ $param .= $hookmanager->resPrint;
|
|||
|
||||
// List of mass actions available
|
||||
$arrayofmassactions = array(
|
||||
//'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"),
|
||||
//'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
|
||||
//'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
|
||||
'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"),
|
||||
'precancel'=>img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Cancel"),
|
||||
'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
|
||||
'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
|
||||
'predatestart'=>img_picto('', 'object_calendar', 'class="pictofixedwidth"').$langs->trans("MoChangeDateStart"),
|
||||
'predateend'=>img_picto('', 'object_calendar', 'class="pictofixedwidth"').$langs->trans("MoChangeDateEnd"),
|
||||
//'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
|
||||
);
|
||||
if (!empty($permissiontodelete)) {
|
||||
|
|
@ -460,6 +541,55 @@ $objecttmp = new Mo($db);
|
|||
$trackid = 'mo'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||
|
||||
if ($massaction == 'precancel') {
|
||||
$formquestion = array(
|
||||
array(
|
||||
'label' => $langs->trans('MoCancelConsumedAndProducedLines'),
|
||||
'name' => 'alsoCancelConsumedAndProducedLines',
|
||||
'type' => 'checkbox',
|
||||
'value' => 0
|
||||
),
|
||||
);
|
||||
|
||||
print $formconfirm = $form->formconfirm($_SERVER['PHP_SELF'],
|
||||
$langs->trans('CancelMo'),
|
||||
$langs->trans('ConfirmCancelMo'),
|
||||
'confirm_cancel', $formquestion,
|
||||
1, 0, 200, 500, 1);
|
||||
}
|
||||
|
||||
if ($massaction == 'predatestart') {
|
||||
$formquestion = array(
|
||||
array(
|
||||
'type' => 'datetime',
|
||||
'tdclass' => 'fieldrequired',
|
||||
'name' => 'change_date',
|
||||
'label' => $langs->trans('ModifyDateStart'),
|
||||
'value' => -1),
|
||||
);
|
||||
print $form->formconfirm($_SERVER['PHP_SELF'],
|
||||
$langs->trans('ConfirmMassChangeDateStart'),
|
||||
$langs->trans('ConfirmMassChangeDateStartQuestion',
|
||||
count($toselect)), 'changedatestart_confirm', $formquestion,
|
||||
'', 0, 200, 500, 1);
|
||||
}
|
||||
|
||||
if ($massaction == 'predateend') {
|
||||
$formquestion = array(
|
||||
array(
|
||||
'type' => 'datetime',
|
||||
'tdclass' => 'fieldrequired',
|
||||
'name' => 'change_date',
|
||||
'label' => $langs->trans('ModifyDateEnd'),
|
||||
'value' => -1),
|
||||
);
|
||||
print $form->formconfirm($_SERVER['PHP_SELF'],
|
||||
$langs->trans('ConfirmMassChangeDateEnd'),
|
||||
$langs->trans('ConfirmMassChangeDateEndQuestion',
|
||||
count($toselect)), 'changedateend_confirm', $formquestion,
|
||||
'', 0, 200, 500, 1);
|
||||
}
|
||||
|
||||
if ($search_all) {
|
||||
foreach ($fieldstosearchall as $key => $val) {
|
||||
$fieldstosearchall[$key] = $langs->trans($val);
|
||||
|
|
|
|||
Loading…
Reference in a new issue