* FIX #30044

* Update list.php

* Update list.php

* Update pdf.lib.php

* Update list.php

* Update list.php

* Update list.php

* Update list.php

* Update list.php

* Update list.php

* Update list.php

* Update list.php

* Update list.php

* Update list.php

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
Zephyriony 2024-07-04 21:47:21 +02:00 committed by GitHub
parent d78c045c95
commit e7f694cddf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 23 additions and 8 deletions

View file

@ -363,6 +363,7 @@ if (empty($reshook)) {
$nbOrders = is_array($orders) ? count($orders) : 1;
$currentIndex = 0;
foreach ($orders as $id_order) {
$cmd = new Commande($db);
if ($cmd->fetch($id_order) <= 0) {
@ -373,6 +374,7 @@ if (empty($reshook)) {
$objecttmp = new Facture($db);
if (!empty($createbills_onebythird) && !empty($TFactThird[$cmd->socid])) {
// If option "one bill per third" is set, and an invoice for this thirdparty was already created, we reuse it.
$currentIndex++;
$objecttmp = $TFactThird[$cmd->socid];
} else {
// If we want one invoice per order or if there is no first invoice yet for this thirdparty.
@ -389,6 +391,10 @@ if (empty($reshook)) {
$objecttmp->ref_client = $cmd->ref_client;
}
if (empty($objecttmp->note_public)) {
$objecttmp->note_public = $langs->transnoentities("Orders");
}
$datefacture = dol_mktime(12, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear'));
if (empty($datefacture)) {
$datefacture = dol_now();
@ -553,6 +559,11 @@ if (empty($reshook)) {
}
}
if ($currentIndex <= (getDolGlobalInt("MAXREFONDOC") ? getDolGlobalInt("MAXREFONDOC") : 10)) {
$objecttmp->note_public = dol_concatdesc($objecttmp->note_public, $langs->transnoentities($cmd->ref).(empty($cmd->ref_client) ? '' : ' ('.$cmd->ref_client.')'));
$objecttmp->update($user);
}
//$cmd->classifyBilled($user); // Disabled. This behavior must be set or not using the workflow module.
if (!empty($createbills_onebythird) && empty($TFactThird[$cmd->socid])) {

View file

@ -2500,13 +2500,7 @@ function pdf_getLinkedObjects(&$object, $outputlangs)
} elseif ($objecttype == 'commande' || $objecttype == 'supplier_order') {
$outputlangs->load('orders');
if (count($objects) > 1 && count($objects) <= (getDolGlobalInt("MAXREFONDOC") ? getDolGlobalInt("MAXREFONDOC") : 10)) {
$object->note_public = dol_concatdesc($object->note_public, $outputlangs->transnoentities("RefOrder").' :');
foreach ($objects as $elementobject) {
$object->note_public = dol_concatdesc($object->note_public, $outputlangs->transnoentities($elementobject->ref).(empty($elementobject->ref_client) ? '' : ' ('.$elementobject->ref_client.')').(empty($elementobject->ref_supplier) ? '' : ' ('.$elementobject->ref_supplier.')').' ');
$object->note_public = dol_concatdesc($object->note_public, $outputlangs->transnoentities("OrderDate").' : '.dol_print_date($elementobject->date, 'day', '', $outputlangs));
}
} elseif (count($objects) == 1) {
if (count($objects) == 1) {
$elementobject = array_shift($objects);
$linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder");
$linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref).(!empty($elementobject->ref_client) ? ' ('.$elementobject->ref_client.')' : '').(!empty($elementobject->ref_supplier) ? ' ('.$elementobject->ref_supplier.')' : '');

View file

@ -384,7 +384,7 @@ if (empty($reshook)) {
$db->begin();
$default_ref_supplier = dol_print_date(dol_now(), '%Y%m%d%H%M%S');
$currentIndex = 0;
foreach ($orders as $id_order) {
$cmd = new CommandeFournisseur($db);
if ($cmd->fetch($id_order) <= 0) {
@ -393,6 +393,7 @@ if (empty($reshook)) {
$objecttmp = new FactureFournisseur($db);
if (!empty($createbills_onebythird) && !empty($TFactThird[$cmd->socid])) {
$currentIndex++;
$objecttmp = $TFactThird[$cmd->socid]; // If option "one bill per third" is set, we use already created supplier invoice.
} else {
// Search if the VAT reverse-charge is activated by default in supplier card to resume the information
@ -429,6 +430,10 @@ if (empty($reshook)) {
}
if ($objecttmp->id > 0) {
if (empty($objecttmp->note_public)) {
$objecttmp->note_public = $langs->transnoentities("Orders");
}
$sql = "INSERT INTO ".MAIN_DB_PREFIX."element_element (";
$sql .= "fk_source";
$sql .= ", sourcetype";
@ -549,6 +554,11 @@ if (empty($reshook)) {
}
}
if ($currentIndex <= (getDolGlobalInt("MAXREFONDOC") ? getDolGlobalInt("MAXREFONDOC") : 10)) {
$objecttmp->note_public = dol_concatdesc($objecttmp->note_public, $langs->transnoentities($cmd->ref).(empty($cmd->ref_supplier) ? '' : ' ('.$cmd->ref_supplier.')'));
$objecttmp->update($user);
}
$cmd->classifyBilled($user); // TODO Move this in workflow like done for sales orders
if (!empty($createbills_onebythird) && empty($TFactThird[$cmd->socid])) {