2
0
forked from Wavyzz/dolibarr

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

This commit is contained in:
Laurent Destailleur
2022-02-28 22:36:31 +01:00
9 changed files with 59 additions and 43 deletions

View File

@@ -765,8 +765,8 @@ if (empty($reshook)) {
// Define special_code for special lines // Define special_code for special lines
$special_code = GETPOST('special_code', 'int'); $special_code = GETPOST('special_code', 'int');
if (!GETPOST('qty', 'alpha')) { if ($special_code == 3) {
$special_code = 3; $special_code = 0; // Options should not exists on invoices
} }
/*$line = new FactureLigne($db); /*$line = new FactureLigne($db);

View File

@@ -2397,9 +2397,9 @@ if (empty($reshook)) {
} }
// Define special_code for special lines // Define special_code for special lines
$special_code = GETPOST('special_code'); $special_code = GETPOST('special_code', 'int');
if (!GETPOST('qty')) { if ($special_code == 3) {
$special_code = 3; $special_code = 0; // Options should not exists on invoices
} }
$line = new FactureLigne($db); $line = new FactureLigne($db);
@@ -2925,6 +2925,9 @@ if ($action == 'create') {
if (empty($mode_reglement_id)) { if (empty($mode_reglement_id)) {
$mode_reglement_id = $soc->mode_reglement_id; $mode_reglement_id = $soc->mode_reglement_id;
} }
if (empty($fk_account)) {
$fk_account = $soc->fk_account;
}
if (!$remise_percent) { if (!$remise_percent) {
$remise_percent = $soc->remise_percent; $remise_percent = $soc->remise_percent;
} }
@@ -3032,6 +3035,9 @@ if ($action == 'create') {
$mode_reglement_id = GETPOST("mode_reglement_id", 'int'); $mode_reglement_id = GETPOST("mode_reglement_id", 'int');
} }
// when bank account is empty (means not override by payment mode form a other object, like third-party), try to use default value
$fk_account = GETPOSTISSET("fk_account") ? GETPOST("fk_account", 'int') : $fk_account;
if (!empty($soc->id)) { if (!empty($soc->id)) {
$absolute_discount = $soc->getAvailableDiscounts(); $absolute_discount = $soc->getAvailableDiscounts();
} }
@@ -3638,8 +3644,8 @@ if ($action == 'create') {
// Bank Account // Bank Account
if (!empty($conf->banque->enabled)) { if (!empty($conf->banque->enabled)) {
print '<tr><td>'.$langs->trans('BankAccount').'</td><td colspan="2">'; print '<tr><td>'.$langs->trans('BankAccount').'</td><td colspan="2">';
$fk_account = GETPOSTISSET('fk_account') ? GETPOST('fk_account', 'int') : $fk_account; print img_picto('', 'bank_account', 'class="pictofixedwidth"');
print img_picto('', 'bank_account', 'class="pictofixedwidth"').$form->select_comptes(($fk_account < 0 ? '' : $fk_account), 'fk_account', 0, '', 1, '', 0, 'maxwidth200 widthcentpercentminusx', 1); print $form->select_comptes(($fk_account < 0 ? '' : $fk_account), 'fk_account', 0, '', 1, '', 0, 'maxwidth200 widthcentpercentminusx', 1);
print '</td></tr>'; print '</td></tr>';
} }

View File

@@ -10817,6 +10817,9 @@ function dolForgeCriteriaCallback($matches)
$operand = preg_replace('/[^a-z0-9\._]/i', '', trim($tmp[0])); $operand = preg_replace('/[^a-z0-9\._]/i', '', trim($tmp[0]));
$operator = strtoupper(preg_replace('/[^a-z<>=]/i', '', trim($tmp[1]))); $operator = strtoupper(preg_replace('/[^a-z<>=]/i', '', trim($tmp[1])));
if ($operator == 'NOTLIKE') {
$operator = 'NOT LIKE';
}
$tmpescaped = trim($tmp[2]); $tmpescaped = trim($tmp[2]);
$regbis = array(); $regbis = array();

View File

@@ -546,31 +546,30 @@ class pdf_cornas extends ModelePDFSuppliersOrders
$posYAfterDescription = 0; $posYAfterDescription = 0;
// We start with Photo of product line // We start with Photo of product line
if (!empty($imglinesize['width']) && !empty($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // If photo too high, we moved completely on new page if ($this->getColumnStatus('photo')) {
$pdf->AddPage('', '', true); // We start with Photo of product line
if (!empty($tplidx)) { if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // If photo too high, we moved completely on new page
$pdf->useTemplate($tplidx); $pdf->AddPage('', '', true);
} if (!empty($tplidx)) {
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { $pdf->useTemplate($tplidx);
$this->_pagehead($pdf, $object, 0, $outputlangs); }
} $pdf->setPage($pageposbefore + 1);
$pdf->setPage($pageposbefore + 1);
$curY = $tab_top_newpage; $curY = $tab_top_newpage;
// Allows data in the first page if description is long enough to break in multiples pages // Allows data in the first page if description is long enough to break in multiples pages
if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) { if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) {
$showpricebeforepagebreak = 1; $showpricebeforepagebreak = 1;
} else { } else {
$showpricebeforepagebreak = 0; $showpricebeforepagebreak = 0;
}
} }
}
if (!empty($imglinesize['width']) && !empty($imglinesize['height'])) { if (!empty($this->cols['photo']) && isset($imglinesize['width']) && isset($imglinesize['height'])) {
$curX = $this->posxpicture - 1; $pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi
$pdf->Image($realpatharray[$i], $curX + (($this->posxtva - $this->posxpicture - $imglinesize['width']) / 2), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi // $pdf->Image does not increase value return by getY, so we save it manually
// $pdf->Image does not increase value return by getY, so we save it manually $posYAfterImage = $curY + $imglinesize['height'];
$posYAfterImage = $curY + $imglinesize['height']; }
} }
// Description of product line // Description of product line
$curX = $this->posxdesc - 1; $curX = $this->posxdesc - 1;

View File

@@ -18,15 +18,14 @@ if (!empty($extrafieldsobjectkey)) { // $extrafieldsobject is the $object->table
if (empty($extrafieldsobjectprefix)) { if (empty($extrafieldsobjectprefix)) {
$extrafieldsobjectprefix = 'ef.'; $extrafieldsobjectprefix = 'ef.';
} }
foreach ($extrafields->attributes[$extrafieldsobjectkey]['label'] as $key => $val) { foreach ($extrafields->attributes[$extrafieldsobjectkey]['label'] as $key => $val) {
if (!empty($extrafields->attributes[$extrafieldsobjectkey]['list'][$key])) { if (!empty($extrafields->attributes[$extrafieldsobjectkey]['list'][$key])) {
$arrayfields[$extrafieldsobjectprefix.$key] = array( $arrayfields[$extrafieldsobjectprefix.$key] = array(
'label' => $extrafields->attributes[$extrafieldsobjectkey]['label'][$key], 'label' => $extrafields->attributes[$extrafieldsobjectkey]['label'][$key],
'type' => $extrafields->attributes[$extrafieldsobjectkey]['type'][$key], 'type' => $extrafields->attributes[$extrafieldsobjectkey]['type'][$key],
'checked' => (($extrafields->attributes[$extrafieldsobjectkey]['list'][$key] < 0) ? 0 : 1), 'checked' => ((dol_eval($extrafields->attributes[$extrafieldsobjectkey]['list'][$key], 1) <= 0) ? 0 : 1),
'position' => $extrafields->attributes[$extrafieldsobjectkey]['pos'][$key], 'position' => $extrafields->attributes[$extrafieldsobjectkey]['pos'][$key],
'enabled' => (abs((int) $extrafields->attributes[$extrafieldsobjectkey]['list'][$key]) != 3 && $extrafields->attributes[$extrafieldsobjectkey]['perms'][$key]), 'enabled' => (abs((int) $extrafields->attributes[$extrafieldsobjectkey]['list'][$key]) != 3 && dol_eval($extrafields->attributes[$extrafieldsobjectkey]['perms'][$key], 1)),
'langfile' => $extrafields->attributes[$extrafieldsobjectkey]['langfile'][$key], 'langfile' => $extrafields->attributes[$extrafieldsobjectkey]['langfile'][$key],
'help' => $extrafields->attributes[$extrafieldsobjectkey]['help'][$key], 'help' => $extrafields->attributes[$extrafieldsobjectkey]['help'][$key],
); );

View File

@@ -116,7 +116,7 @@ $fieldstosearchall = array(
'e.ref'=>"Ref", 'e.ref'=>"Ref",
's.nom'=>"ThirdParty", 's.nom'=>"ThirdParty",
'e.note_public'=>'NotePublic', 'e.note_public'=>'NotePublic',
'e.shipping_method_id'=>'SendingMethod', //'e.fk_shipping_method'=>'SendingMethod', // TODO fix this, does not work
'e.tracking_number'=>"TrackingNumber", 'e.tracking_number'=>"TrackingNumber",
); );
if (empty($user->socid)) { if (empty($user->socid)) {
@@ -134,7 +134,7 @@ $arrayfields = array(
'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0, 'position'=>7), 'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0, 'position'=>7),
'typent.code'=>array('label'=>$langs->trans("ThirdPartyType"), 'checked'=>$checkedtypetiers, 'position'=>8), 'typent.code'=>array('label'=>$langs->trans("ThirdPartyType"), 'checked'=>$checkedtypetiers, 'position'=>8),
'e.date_delivery'=>array('label'=>$langs->trans("DateDeliveryPlanned"), 'checked'=>1, 'position'=>9), 'e.date_delivery'=>array('label'=>$langs->trans("DateDeliveryPlanned"), 'checked'=>1, 'position'=>9),
'e.shipping_method_id'=>array('label'=>$langs->trans('SendingMethod'), 'checked'=>1, 'position'=>10), 'e.fk_shipping_method'=>array('label'=>$langs->trans('SendingMethod'), 'checked'=>1, 'position'=>10),
'e.tracking_number'=>array('label'=>$langs->trans("TrackingNumber"), 'checked'=>1, 'position'=>11), 'e.tracking_number'=>array('label'=>$langs->trans("TrackingNumber"), 'checked'=>1, 'position'=>11),
'e.weight'=>array('label'=>$langs->trans("Weight"), 'checked'=>0, 'position'=>12), 'e.weight'=>array('label'=>$langs->trans("Weight"), 'checked'=>0, 'position'=>12),
'e.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), 'e.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
@@ -654,7 +654,7 @@ if (!empty($arrayfields['e.date_delivery']['checked'])) {
print '</div>'; print '</div>';
print '</td>'; print '</td>';
} }
if (!empty($arrayfields['e.shipping_method_id']['checked'])) { if (!empty($arrayfields['e.fk_shipping_method']['checked'])) {
// Delivery method // Delivery method
print '<td class="liste_titre center">'; print '<td class="liste_titre center">';
$shipment->fetch_delivery_methods(); $shipment->fetch_delivery_methods();
@@ -751,8 +751,8 @@ if (!empty($arrayfields['e.weight']['checked'])) {
if (!empty($arrayfields['e.date_delivery']['checked'])) { if (!empty($arrayfields['e.date_delivery']['checked'])) {
print_liste_field_titre($arrayfields['e.date_delivery']['label'], $_SERVER["PHP_SELF"], "e.date_delivery", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre($arrayfields['e.date_delivery']['label'], $_SERVER["PHP_SELF"], "e.date_delivery", "", $param, '', $sortfield, $sortorder, 'center ');
} }
if (!empty($arrayfields['e.shipping_method_id']['checked'])) { if (!empty($arrayfields['e.fk_shipping_method']['checked'])) {
print_liste_field_titre($arrayfields['e.shipping_method_id']['label'], $_SERVER["PHP_SELF"], "e.fk_shipping_method", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre($arrayfields['e.fk_shipping_method']['label'], $_SERVER["PHP_SELF"], "e.fk_shipping_method", "", $param, '', $sortfield, $sortorder, 'center ');
} }
if (!empty($arrayfields['e.tracking_number']['checked'])) { if (!empty($arrayfields['e.tracking_number']['checked'])) {
print_liste_field_titre($arrayfields['e.tracking_number']['label'], $_SERVER["PHP_SELF"], "e.tracking_number", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre($arrayfields['e.tracking_number']['label'], $_SERVER["PHP_SELF"], "e.tracking_number", "", $param, '', $sortfield, $sortorder, 'center ');
@@ -901,7 +901,7 @@ while ($i < min($num, $limit)) {
print dol_print_date($db->jdate($obj->delivery_date), "dayhour"); print dol_print_date($db->jdate($obj->delivery_date), "dayhour");
print "</td>\n"; print "</td>\n";
} }
if (!empty($arrayfields['e.shipping_method_id']['checked'])) { if (!empty($arrayfields['e.fk_shipping_method']['checked'])) {
// Get code using getLabelFromKey // Get code using getLabelFromKey
$code=$langs->getLabelFromKey($db, $shipment->shipping_method_id, 'c_shipment_mode', 'rowid', 'code'); $code=$langs->getLabelFromKey($db, $shipment->shipping_method_id, 'c_shipment_mode', 'rowid', 'code');
print '<td class="center">'; print '<td class="center">';

View File

@@ -254,7 +254,7 @@ ReOpen=Reopen
ConfirmFinish=Do you confirm the closing of the inventory ? This will generate all stock movements to update your stock to the real qty you entered into the inventory. ConfirmFinish=Do you confirm the closing of the inventory ? This will generate all stock movements to update your stock to the real qty you entered into the inventory.
ObjectNotFound=%s not found ObjectNotFound=%s not found
MakeMovementsAndClose=Generate movements and close MakeMovementsAndClose=Generate movements and close
AutofillWithExpected=Replace real quantity with expected quantity AutofillWithExpected=Fill real quantity with expected quantity
ShowAllBatchByDefault=By default, show batch details on product "stock" tab ShowAllBatchByDefault=By default, show batch details on product "stock" tab
CollapseBatchDetailHelp=You can set batch detail default display in stocks module configuration CollapseBatchDetailHelp=You can set batch detail default display in stocks module configuration
ErrorWrongBarcodemode=Unknown Barcode mode ErrorWrongBarcodemode=Unknown Barcode mode
@@ -270,4 +270,5 @@ ErrorOnElementsInventory=Operation canceled for the following reason:
ErrorCantFindCodeInInventory=Can't find the following code in inventory ErrorCantFindCodeInInventory=Can't find the following code in inventory
QtyWasAddedToTheScannedBarcode=Success !! The quantity was added to all the requested barcode. You can close the Scanner tool. QtyWasAddedToTheScannedBarcode=Success !! The quantity was added to all the requested barcode. You can close the Scanner tool.
StockChangeDisabled=Change on stock disabled StockChangeDisabled=Change on stock disabled
NoWarehouseDefinedForTerminal=No warehouse defined for terminal NoWarehouseDefinedForTerminal=No warehouse defined for terminal
ClearQtys=Clear all quantities

View File

@@ -491,12 +491,10 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."delivery as l ON l.rowid = ee.fk_target";
if (empty($user->rights->societe->client->voir) && !$socid) { // Internal user with no permission to see all if (empty($user->rights->societe->client->voir) && !$socid) { // Internal user with no permission to see all
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
} }
// Add joins from hooks // Add joins from hooks
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint; $sql .= $hookmanager->resPrint;
$sql .= " WHERE e.entity IN (".getEntity('reception').")"; $sql .= " WHERE e.entity IN (".getEntity('reception').")";
if (empty($user->rights->societe->client->voir) && !$socid) { // Internal user with no permission to see all if (empty($user->rights->societe->client->voir) && !$socid) { // Internal user with no permission to see all
$sql .= " AND e.fk_soc = sc.fk_soc"; $sql .= " AND e.fk_soc = sc.fk_soc";
@@ -983,6 +981,9 @@ while ($i < min($num, $limit)) {
{ {
}*/ }*/
print "</td>\n"; print "</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
} }
if (!empty($arrayfields['l.ref']['checked']) || !empty($arrayfields['l.date_delivery']['checked'])) { if (!empty($arrayfields['l.ref']['checked']) || !empty($arrayfields['l.date_delivery']['checked'])) {
@@ -1078,6 +1079,13 @@ if ($num == 0) {
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>'; print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
} }
// Show total line
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print "</table>"; print "</table>";
print "</div>"; print "</div>";
print '</form>'; print '</form>';

View File

@@ -239,7 +239,7 @@ if (empty($modulepart)) {
accessforbidden('Bad value for parameter modulepart', 0, 0, 1); accessforbidden('Bad value for parameter modulepart', 0, 0, 1);
} }
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, $refname); $check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, $user, $refname);
$accessallowed = $check_access['accessallowed']; $accessallowed = $check_access['accessallowed'];
$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals']; $sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals'];
$fullpath_original_file = $check_access['original_file']; // $fullpath_original_file is now a full path name $fullpath_original_file = $check_access['original_file']; // $fullpath_original_file is now a full path name