Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2023-03-31 01:32:20 +02:00
commit a1194b1359
12 changed files with 105 additions and 43 deletions

View File

@ -221,7 +221,7 @@ if (empty($reshook)) {
} }
} }
$result = $object->createFromClone($user, $socid, (GETPOSTISSET('entity') ? GETPOST('entity', 'int') : null), (GETPOST('update_prices', 'aZ') ? true : false)); $result = $object->createFromClone($user, $socid, (GETPOSTISSET('entity') ? GETPOST('entity', 'int') : null), (GETPOST('update_prices', 'aZ') ? true : false), (GETPOST('update_desc', 'aZ') ? true : false));
if ($result > 0) { if ($result > 0) {
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result); header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
exit(); exit();
@ -2137,7 +2137,8 @@ if ($action == 'create') {
// 'text' => $langs->trans("ConfirmClone"), // 'text' => $langs->trans("ConfirmClone"),
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)', '', 0, 0, null, 0, 'maxwidth300')), array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)', '', 0, 0, null, 0, 'maxwidth300')),
array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans('PuttingPricesUpToDate'), 'value' => (!empty($conf->global->PROPOSAL_CLONE_UPDATE_PRICES) ? 1 : 0)), array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans('PuttingPricesUpToDate'), 'value' => 0),
array('type' => 'checkbox', 'name' => 'update_desc', 'label' => $langs->trans('PuttingDescUpToDate'), 'value' => 0),
); );
if (!empty($conf->global->PROPAL_CLONE_DATE_DELIVERY) && !empty($object->delivery_date)) { if (!empty($conf->global->PROPAL_CLONE_DATE_DELIVERY) && !empty($object->delivery_date)) {
$formquestion[] = array('type' => 'date', 'name' => 'date_delivery', 'label' => $langs->trans("DeliveryDate"), 'value' => $object->delivery_date); $formquestion[] = array('type' => 'date', 'name' => 'date_delivery', 'label' => $langs->trans("DeliveryDate"), 'value' => $object->delivery_date);

View File

@ -1360,9 +1360,10 @@ class Propal extends CommonObject
* @param int $socid Id of thirdparty * @param int $socid Id of thirdparty
* @param int $forceentity Entity id to force * @param int $forceentity Entity id to force
* @param bool $update_prices [=false] Update prices if true * @param bool $update_prices [=false] Update prices if true
* @param bool $update_desc [=false] Update description if true
* @return int New id of clone * @return int New id of clone
*/ */
public function createFromClone(User $user, $socid = 0, $forceentity = null, $update_prices = false) public function createFromClone(User $user, $socid = 0, $forceentity = null, $update_prices = false, $update_desc = false)
{ {
global $conf, $hookmanager, $mysoc; global $conf, $hookmanager, $mysoc;
@ -1413,9 +1414,9 @@ class Propal extends CommonObject
} }
// update prices // update prices
if ($update_prices === true) { if ($update_prices === true || $update_desc === true) {
if ($objsoc->id > 0 && !empty($object->lines)) { if ($objsoc->id > 0 && !empty($object->lines)) {
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { if ($update_prices === true && !empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
// If price per customer // If price per customer
require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php'; require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php';
} }
@ -1425,6 +1426,7 @@ class Propal extends CommonObject
$prod = new Product($this->db); $prod = new Product($this->db);
$res = $prod->fetch($line->fk_product); $res = $prod->fetch($line->fk_product);
if ($res > 0) { if ($res > 0) {
if ($update_prices === true) {
$pu_ht = $prod->price; $pu_ht = $prod->price;
$tva_tx = get_default_tva($mysoc, $objsoc, $prod->id); $tva_tx = get_default_tva($mysoc, $objsoc, $prod->id);
$remise_percent = $objsoc->remise_percent; $remise_percent = $objsoc->remise_percent;
@ -1456,6 +1458,10 @@ class Propal extends CommonObject
$line->tva_tx = $tva_tx; $line->tva_tx = $tva_tx;
$line->remise_percent = $remise_percent; $line->remise_percent = $remise_percent;
} }
if ($update_desc === true) {
$line->desc = $prod->description;
}
}
} }
} }
} }

View File

@ -591,8 +591,6 @@ class Facture extends CommonInvoice
// We do not add link to template invoice or next invoice will be linked to all generated invoices // We do not add link to template invoice or next invoice will be linked to all generated invoices
//$this->linked_objects['facturerec'][0] = $this->fac_rec; //$this->linked_objects['facturerec'][0] = $this->fac_rec;
$forceduedate = $this->calculate_date_lim_reglement();
// For recurring invoices, update date and number of last generation of recurring template invoice, before inserting new invoice // For recurring invoices, update date and number of last generation of recurring template invoice, before inserting new invoice
if ($_facrec->frequency > 0) { if ($_facrec->frequency > 0) {
dol_syslog("This is a recurring invoice so we set date_last_gen and next date_when"); dol_syslog("This is a recurring invoice so we set date_last_gen and next date_when");

View File

@ -79,7 +79,7 @@ top_httphead();
$html = ''; $html = '';
if (is_object($object)) { if (is_object($object)) {
if ($object->id > 0) { if ($object->id > 0 || !empty($object->ref)) {
$html = $object->getTooltipContent($params); $html = $object->getTooltipContent($params);
} elseif ($res == 0) { } elseif ($res == 0) {
$html = $langs->trans('Deleted'); $html = $langs->trans('Deleted');

View File

@ -391,6 +391,22 @@ abstract class CommonObject
*/ */
public $shipping_method_id; public $shipping_method_id;
/**
* @var string Shipping method label
* @see setShippingMethod()
*/
public $shipping_method;
/**
* @var string multicurrency code
*/
public $multicurrency_code;
/**
* @var string multicurrency tx
*/
public $multicurrency_tx;
/** /**
* @var string * @var string
* @see SetDocModel() * @see SetDocModel()

View File

@ -8064,14 +8064,6 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
$substitutionarray['__ONLINE_PAYMENT_TEXT_AND_URL__'] = ($paymenturl ?str_replace('\n', "\n", $outputlangs->trans("PredefinedMailContentLink", $paymenturl)) : ''); $substitutionarray['__ONLINE_PAYMENT_TEXT_AND_URL__'] = ($paymenturl ?str_replace('\n', "\n", $outputlangs->trans("PredefinedMailContentLink", $paymenturl)) : '');
$substitutionarray['__ONLINE_PAYMENT_URL__'] = $paymenturl; $substitutionarray['__ONLINE_PAYMENT_URL__'] = $paymenturl;
if (is_object($object) && $object->element == 'propal') {
require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php';
$substitutionarray['__ONLINE_SIGN_URL__'] = getOnlineSignatureUrl(0, 'proposal', $object->ref);
}
if (is_object($object) && $object->element == 'fichinter') {
require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php';
$substitutionarray['__ONLINE_SIGN_FICHINTER_URL__'] = getOnlineSignatureUrl(0, 'fichinter', $object->ref);
}
if (!empty($conf->global->PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD) && is_object($object) && $object->element == 'propal') { if (!empty($conf->global->PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD) && is_object($object) && $object->element == 'propal') {
$substitutionarray['__DIRECTDOWNLOAD_URL_PROPOSAL__'] = $object->getLastMainDocLink($object->element); $substitutionarray['__DIRECTDOWNLOAD_URL_PROPOSAL__'] = $object->getLastMainDocLink($object->element);
} else { } else {
@ -8105,6 +8097,8 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
if (is_object($object) && $object->element == 'propal') { if (is_object($object) && $object->element == 'propal') {
$substitutionarray['__URL_PROPOSAL__'] = DOL_MAIN_URL_ROOT."/comm/propal/card.php?id=".$object->id; $substitutionarray['__URL_PROPOSAL__'] = DOL_MAIN_URL_ROOT."/comm/propal/card.php?id=".$object->id;
require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php';
$substitutionarray['__ONLINE_SIGN_URL__'] = getOnlineSignatureUrl(0, 'proposal', $object->ref);
} }
if (is_object($object) && $object->element == 'commande') { if (is_object($object) && $object->element == 'commande') {
$substitutionarray['__URL_ORDER__'] = DOL_MAIN_URL_ROOT."/commande/card.php?id=".$object->id; $substitutionarray['__URL_ORDER__'] = DOL_MAIN_URL_ROOT."/commande/card.php?id=".$object->id;
@ -8114,9 +8108,13 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
} }
if (is_object($object) && $object->element == 'contrat') { if (is_object($object) && $object->element == 'contrat') {
$substitutionarray['__URL_CONTRACT__'] = DOL_MAIN_URL_ROOT."/contrat/card.php?id=".$object->id; $substitutionarray['__URL_CONTRACT__'] = DOL_MAIN_URL_ROOT."/contrat/card.php?id=".$object->id;
require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php';
$substitutionarray['__ONLINE_SIGN_URL__'] = getOnlineSignatureUrl(0, 'contract', $object->ref);
} }
if (is_object($object) && $object->element == 'fichinter') { if (is_object($object) && $object->element == 'fichinter') {
$substitutionarray['__URL_FICHINTER__'] = DOL_MAIN_URL_ROOT."/fichinter/card.php?id=".$object->id; $substitutionarray['__URL_FICHINTER__'] = DOL_MAIN_URL_ROOT."/fichinter/card.php?id=".$object->id;
require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php';
$substitutionarray['__ONLINE_SIGN_FICHINTER_URL__'] = getOnlineSignatureUrl(0, 'fichinter', $object->ref);
} }
if (is_object($object) && $object->element == 'supplier_proposal') { if (is_object($object) && $object->element == 'supplier_proposal') {
$substitutionarray['__URL_SUPPLIER_PROPOSAL__'] = DOL_MAIN_URL_ROOT."/supplier_proposal/card.php?id=".$object->id; $substitutionarray['__URL_SUPPLIER_PROPOSAL__'] = DOL_MAIN_URL_ROOT."/supplier_proposal/card.php?id=".$object->id;
@ -11285,6 +11283,11 @@ function getElementProperties($element_type)
$subelement = 'commande'; $subelement = 'commande';
} elseif ($element_type == 'propal') { } elseif ($element_type == 'propal') {
$classpath = 'comm/propal/class'; $classpath = 'comm/propal/class';
} elseif ($element_type == 'shipping') {
$classpath = 'expedition/class';
$classfile = 'expedition';
$classname = 'Expedition';
$module = 'expedition';
} elseif ($element_type == 'supplier_proposal') { } elseif ($element_type == 'supplier_proposal') {
$classpath = 'supplier_proposal/class'; $classpath = 'supplier_proposal/class';
$module = 'supplier_proposal'; $module = 'supplier_proposal';
@ -11323,6 +11326,10 @@ function getElementProperties($element_type)
$classpath = 'comm/propal/class'; $classpath = 'comm/propal/class';
$module = 'propal'; $module = 'propal';
$subelement = 'propaleligne'; $subelement = 'propaleligne';
} elseif ($element_type == 'opensurvey_sondage') {
$classpath = 'opensurvey/class';
$module = 'opensurvey';
$subelement = 'opensurveysondage';
} elseif ($element_type == 'order_supplier') { } elseif ($element_type == 'order_supplier') {
$classpath = 'fourn/class'; $classpath = 'fourn/class';
$module = 'fournisseur'; $module = 'fournisseur';
@ -11340,7 +11347,7 @@ function getElementProperties($element_type)
} elseif ($element_type == "service") { } elseif ($element_type == "service") {
$classpath = 'product/class'; $classpath = 'product/class';
$subelement = 'product'; $subelement = 'product';
} elseif ($objecttype == 'salary') { } elseif ($element_type == 'salary') {
$classpath = 'salaries/class'; $classpath = 'salaries/class';
$module = 'salaries'; $module = 'salaries';
} }

View File

@ -212,7 +212,7 @@ if (empty($reshook) && isset($extrafields->attributes[$object->table_element]['l
$html_id = !empty($object->id) ? $object->element.'_extras_'.$tmpkeyextra.'_'.$object->id : ''; $html_id = !empty($object->id) ? $object->element.'_extras_'.$tmpkeyextra.'_'.$object->id : '';
print '<td id="'.$html_id.'" class="valuefield '.$object->element.'_extras_'.$tmpkeyextra.' wordbreak"'.(!empty($cols) ? ' colspan="'.$cols.'"' : '').'>'; print '<td id="' . $html_id . '" class="valuefield ' . $object->element . '_extras_' . $tmpkeyextra . ' wordbreakimp"' . (!empty($cols) ? ' colspan="' . $cols . '"' : '') . '>';
// Convert date into timestamp format // Convert date into timestamp format
if (in_array($extrafields->attributes[$object->table_element]['type'][$tmpkeyextra], array('date'))) { if (in_array($extrafields->attributes[$object->table_element]['type'][$tmpkeyextra], array('date'))) {

View File

@ -1834,7 +1834,8 @@ class Expedition extends CommonObject
{ {
global $conf, $langs; global $conf, $langs;
$langs->load('shipping'); $langs->load('sendings');
$nofetch = !empty($params['nofetch']); $nofetch = !empty($params['nofetch']);
$datas = array(); $datas = array();
@ -1844,6 +1845,13 @@ class Expedition extends CommonObject
} }
$datas['ref'] = '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref; $datas['ref'] = '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
$datas['refcustomer'] = '<br><b>'.$langs->trans('RefCustomer').':</b> '.($this->ref_customer ? $this->ref_customer : $this->ref_client); $datas['refcustomer'] = '<br><b>'.$langs->trans('RefCustomer').':</b> '.($this->ref_customer ? $this->ref_customer : $this->ref_client);
if (!$nofetch) {
$langs->load('companies');
if (empty($this->thirdparty)) {
$this->fetch_thirdparty();
}
$datas['customer'] = '<br><b>'.$langs->trans('Customer').':</b> '.$this->thirdparty->getNomUrl(1, '', 0, 1);
}
return $datas; return $datas;
} }

View File

@ -380,3 +380,6 @@ ALTER TABLE llx_product_lot ADD COLUMN last_main_doc varchar(255) AFTER model_pd
ALTER TABLE llx_product_fournisseur_price ADD COLUMN status integer DEFAULT 1; ALTER TABLE llx_product_fournisseur_price ADD COLUMN status integer DEFAULT 1;
ALTER TABLE llx_product_fournisseur_price_log ADD INDEX idx_product_fournisseur_price_log_fk_product_fournisseur (fk_product_fournisseur);
ALTER TABLE llx_product_fournisseur_price_log ADD INDEX idx_product_fournisseur_price_log_fk_user (fk_user);
--ALTER TABLE llx_product_fournisseur_price_log ADD INDEX idx_product_fournisseur_price_log_fk_multicurrency (fk_multicurrency);

View File

@ -0,0 +1,21 @@
-- ============================================================================
-- Copyright (C) 2023 Frédéric France <frederic.france@netlogic.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
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <https://www.gnu.org/licenses/>.
--
-- ============================================================================
ALTER TABLE llx_product_fournisseur_price_log ADD INDEX idx_product_fournisseur_price_log_fk_product_fournisseur (fk_product_fournisseur);
ALTER TABLE llx_product_fournisseur_price_log ADD INDEX idx_product_fournisseur_price_log_fk_user (fk_user);
--ALTER TABLE llx_product_fournisseur_price_log ADD INDEX idx_product_fournisseur_price_log_fk_multicurrency (fk_multicurrency);

View File

@ -55,6 +55,7 @@ CopyPropalFrom=Create commercial proposal by copying existing proposal
CreateEmptyPropal=Create empty commercial proposal or from list of products/services CreateEmptyPropal=Create empty commercial proposal or from list of products/services
DefaultProposalDurationValidity=Default commercial proposal validity duration (in days) DefaultProposalDurationValidity=Default commercial proposal validity duration (in days)
DefaultPuttingPricesUpToDate=By default update prices with current known prices on cloning a proposal DefaultPuttingPricesUpToDate=By default update prices with current known prices on cloning a proposal
DefaultPuttingDescUpToDate=By default update descriptions with current known descriptions on cloning a proposal
UseCustomerContactAsPropalRecipientIfExist=Use contact/address with type 'Contact following-up proposal' if defined instead of third party address as proposal recipient address UseCustomerContactAsPropalRecipientIfExist=Use contact/address with type 'Contact following-up proposal' if defined instead of third party address as proposal recipient address
ConfirmClonePropal=Are you sure you want to clone the commercial proposal <b>%s</b>? ConfirmClonePropal=Are you sure you want to clone the commercial proposal <b>%s</b>?
ConfirmReOpenProp=Are you sure you want to open back the commercial proposal <b>%s</b>? ConfirmReOpenProp=Are you sure you want to open back the commercial proposal <b>%s</b>?

View File

@ -55,6 +55,7 @@ CopyPropalFrom=Créer proposition/devis par recopie d'un proposition existante
CreateEmptyPropal=Créer proposition/devis vierge ou avec la liste des produits/services CreateEmptyPropal=Créer proposition/devis vierge ou avec la liste des produits/services
DefaultProposalDurationValidity=Délai de validité par défaut (en jours) DefaultProposalDurationValidity=Délai de validité par défaut (en jours)
DefaultPuttingPricesUpToDate=Par défaut, mettre à jour les prix avec les prix connus actuels lors du clonage d'une proposition DefaultPuttingPricesUpToDate=Par défaut, mettre à jour les prix avec les prix connus actuels lors du clonage d'une proposition
DefaultPuttingDescUpToDate=Par défaut, mettre à jour les descriptions lors de clonage d'une proposition commerciale
UseCustomerContactAsPropalRecipientIfExist=Utiliser l'adresse de 'contact suivi client' si définie plutôt que l'adresse du tiers comme destinataire des propositions UseCustomerContactAsPropalRecipientIfExist=Utiliser l'adresse de 'contact suivi client' si définie plutôt que l'adresse du tiers comme destinataire des propositions
ConfirmClonePropal=Êtes-vous sûr de vouloir cloner la proposition commerciale <b>%s</b> ? ConfirmClonePropal=Êtes-vous sûr de vouloir cloner la proposition commerciale <b>%s</b> ?
ConfirmReOpenProp=Êtes-vous sûr de vouloir réouvrir la proposition commerciale <b>%s</b> ? ConfirmReOpenProp=Êtes-vous sûr de vouloir réouvrir la proposition commerciale <b>%s</b> ?