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

This commit is contained in:
Laurent Destailleur 2022-06-27 22:36:31 +02:00
commit 748c714b1b
7 changed files with 30 additions and 15 deletions

View File

@ -12,7 +12,7 @@ jobs:
exakat: exakat:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Exakat - name: Exakat
uses: docker://exakat/exakat-ga uses: docker://exakat/exakat-ga
with: with:

View File

@ -2319,8 +2319,11 @@ if ($resql) {
$numlines = count($generic_commande->lines); // Loop on each line of order $numlines = count($generic_commande->lines); // Loop on each line of order
for ($lig = 0; $lig < $numlines; $lig++) { for ($lig = 0; $lig < $numlines; $lig++) {
$reliquat = $generic_commande->lines[$lig]->qty - $generic_commande->expeditions[$generic_commande->lines[$lig]->id]; if (isset($generic_commande->expeditions[$generic_commande->lines[$lig]->id])) {
$reliquat = $generic_commande->lines[$lig]->qty - $generic_commande->expeditions[$generic_commande->lines[$lig]->id];
} else {
$reliquat = $generic_commande->lines[$lig]->qty;
}
if ($generic_commande->lines[$lig]->product_type == 0 && $generic_commande->lines[$lig]->fk_product > 0) { // If line is a product and not a service if ($generic_commande->lines[$lig]->product_type == 0 && $generic_commande->lines[$lig]->fk_product > 0) { // If line is a product and not a service
$nbprod++; // order contains real products $nbprod++; // order contains real products
$generic_product->id = $generic_commande->lines[$lig]->fk_product; $generic_product->id = $generic_commande->lines[$lig]->fk_product;

View File

@ -4312,7 +4312,7 @@ abstract class CommonObject
if ($elementTable == 'commande_fournisseur_dispatch') { if ($elementTable == 'commande_fournisseur_dispatch') {
$fieldstatus = "status"; $fieldstatus = "status";
} }
if (is_array($this->fields) && array_key_exists('status', $this->fields)) { if (isset($this->fields) && is_array($this->fields) && array_key_exists('status', $this->fields)) {
$fieldstatus = 'status'; $fieldstatus = 'status';
} }

View File

@ -1273,10 +1273,12 @@ class ExtraFields
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[$InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1); $data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[$InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1);
$out .= '<option value="0">&nbsp;</option>'; $out .= '<option value="0">&nbsp;</option>';
foreach ($data as $data_key => $data_value) { if (is_array($data)) {
$out .= '<option value="'.$data_key.'"'; foreach ($data as $data_key => $data_value) {
$out .= ($value == $data_key ? ' selected' : ''); $out .= '<option value="'.$data_key.'"';
$out .= '>'.$data_value.'</option>'; $out .= ($value == $data_key ? ' selected' : '');
$out .= '>'.$data_value.'</option>';
}
} }
} }
} }

View File

@ -233,6 +233,12 @@ abstract class Stats
return $data; return $data;
} }
/**
* @param int $year year number
* @return int value
*/
protected abstract function getAverageByMonth($year);
/** /**
* Return average of entity by month for several years * Return average of entity by month for several years
* *

View File

@ -429,10 +429,10 @@ if (empty($reshook)) {
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
$outputlangs = $langs; $outputlangs = $langs;
$newlang = ''; $newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) { if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
$newlang = GETPOST('lang_id', 'aZ09'); $newlang = GETPOST('lang_id', 'aZ09');
} }
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) {
$newlang = $object->thirdparty->default_lang; $newlang = $object->thirdparty->default_lang;
} }
if (!empty($newlang)) { if (!empty($newlang)) {
@ -982,7 +982,7 @@ if ($action == 'create') {
print "</td></tr>\n"; print "</td></tr>\n";
// Other attributes // Other attributes
$parameters = array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"', 'cols' => '3', 'socid' => $socid); $parameters = array('objectsrc' => isset($objectsrc) ? $objectsrc : '', 'colspan' => ' colspan="3"', 'cols' => '3', 'socid' => $socid);
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $expe, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $expe, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
@ -1178,7 +1178,7 @@ if ($action == 'create') {
// Qty already shipped // Qty already shipped
print '<td class="center">'; print '<td class="center">';
$quantityDelivered = $object->expeditions[$line->id]; $quantityDelivered = isset($object->expeditions[$line->id]) ? $object->expeditions[$line->id] : '';
print $quantityDelivered; print $quantityDelivered;
print '<input name="qtydelivered'.$indiceAsked.'" id="qtydelivered'.$indiceAsked.'" type="hidden" value="'.$quantityDelivered.'">'; print '<input name="qtydelivered'.$indiceAsked.'" id="qtydelivered'.$indiceAsked.'" type="hidden" value="'.$quantityDelivered.'">';
print ''.$unit_order.'</td>'; print ''.$unit_order.'</td>';
@ -1188,14 +1188,18 @@ if ($action == 'create') {
if ($line->product_type == 1 && empty($conf->global->STOCK_SUPPORTS_SERVICES)) { if ($line->product_type == 1 && empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
$quantityToBeDelivered = 0; $quantityToBeDelivered = 0;
} else { } else {
$quantityToBeDelivered = $quantityAsked - $quantityDelivered; if (is_numeric($quantityDelivered)) {
$quantityToBeDelivered = $quantityAsked - $quantityDelivered;
} else {
$quantityToBeDelivered = $quantityAsked;
}
} }
$warehouseObject = null; $warehouseObject = null;
if (count($warehousePicking) == 1 || !($line->fk_product > 0) || empty($conf->stock->enabled)) { // If warehouse was already selected or if product is not a predefined, we go into this part with no multiwarehouse selection if (count($warehousePicking) == 1 || !($line->fk_product > 0) || empty($conf->stock->enabled)) { // If warehouse was already selected or if product is not a predefined, we go into this part with no multiwarehouse selection
print '<!-- Case warehouse already known or product not a predefined product -->'; print '<!-- Case warehouse already known or product not a predefined product -->';
//ship from preselected location //ship from preselected location
$stock = + $product->stock_warehouse[$warehouse_id]->real; // Convert to number $stock = + (isset($product->stock_warehouse[$warehouse_id]->real) ? $product->stock_warehouse[$warehouse_id]->real : 0); // Convert to number
$deliverableQty = min($quantityToBeDelivered, $stock); $deliverableQty = min($quantityToBeDelivered, $stock);
if ($deliverableQty < 0) { if ($deliverableQty < 0) {
$deliverableQty = 0; $deliverableQty = 0;

View File

@ -933,7 +933,7 @@ class Expedition extends CommonObject
return -1; return -1;
} }
if ($conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT) { if (!empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT)) {
$product = new Product($this->db); $product = new Product($this->db);
$product->fetch($fk_product); $product->fetch($fk_product);