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

This commit is contained in:
Laurent Destailleur 2022-09-21 01:30:40 +02:00
commit 6fb9a4713c
25 changed files with 132 additions and 88 deletions

View File

@ -28,8 +28,8 @@ Following changes may create regressions for some external modules, but were nec
For users: For users:
--------------- ---------------
NEW: PHP 8.1 compatibility: NEW: PHP 8.0 and 8.1 compatibility (with mysql):
Warning!! Application works correctly with PHP8 and 8.1 but you will experience a lot of PHP warnings into the PHP server Warning!! Application works correctly with PHP 8.0 and 8.1 but you will experience a lot of PHP warnings into the PHP server
log files (depending on your PHP setup). Removal of all PHP warnings on server side is planned for v17. log files (depending on your PHP setup). Removal of all PHP warnings on server side is planned for v17.
NEW: Support for recurring purchase invoices. NEW: Support for recurring purchase invoices.
NEW: #20292 Include German public holidays NEW: #20292 Include German public holidays

View File

@ -169,6 +169,16 @@ class BookKeeping extends CommonObject
*/ */
public $piece_num; public $piece_num;
/**
* @var integer|string date of movement validated & lock
*/
public $date_validation;
/**
* @var integer|string date of movement who are noticed like exported
*/
public $date_export;
/** /**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/ */
@ -788,8 +798,7 @@ class BookKeeping extends CommonObject
$this->piece_num = $obj->piece_num; $this->piece_num = $obj->piece_num;
$this->date_creation = $this->db->jdate($obj->date_creation); $this->date_creation = $this->db->jdate($obj->date_creation);
$this->date_export = $this->db->jdate($obj->date_export); $this->date_export = $this->db->jdate($obj->date_export);
$this->date_validation = $this->db->jdate($obj->date_validated); $this->date_validation = isset($obj->date_validated) ? $this->db->jdate($obj->date_validated) : '';
$this->date_validation = $this->db->jdate($obj->date_validation);
} }
$this->db->free($resql); $this->db->free($resql);

View File

@ -294,9 +294,7 @@ if ($action == 'writebookkeeping') {
$companystatic->id = $tabcompany[$key]['id']; $companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name']; $companystatic->name = $tabcompany[$key]['name'];
$companystatic->code_compta = $tabcompany[$key]['code_compta'];
$companystatic->code_compta_fournisseur = $tabcompany[$key]['code_compta_fournisseur']; $companystatic->code_compta_fournisseur = $tabcompany[$key]['code_compta_fournisseur'];
$companystatic->code_client = $tabcompany[$key]['code_client'];
$companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur']; $companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur'];
$companystatic->fournisseur = 1; $companystatic->fournisseur = 1;
@ -636,9 +634,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
foreach ($tabfac as $key => $val) { foreach ($tabfac as $key => $val) {
$companystatic->id = $tabcompany[$key]['id']; $companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name']; $companystatic->name = $tabcompany[$key]['name'];
$companystatic->code_compta = $tabcompany[$key]['code_compta'];
$companystatic->code_compta_fournisseur = $tabcompany[$key]['code_compta_fournisseur']; $companystatic->code_compta_fournisseur = $tabcompany[$key]['code_compta_fournisseur'];
$companystatic->code_client = $tabcompany[$key]['code_client'];
$companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur']; $companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur'];
$companystatic->fournisseur = 1; $companystatic->fournisseur = 1;
@ -767,7 +763,7 @@ if (empty($action) || $action == 'view') {
$periodlink = ''; $periodlink = '';
$exportlink = ''; $exportlink = '';
$builddate = dol_now(); $builddate = dol_now();
$description .= $langs->trans("DescJournalOnlyBindedVisible").'<br>'; $description = $langs->trans("DescJournalOnlyBindedVisible").'<br>';
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$description .= $langs->trans("DepositsAreNotIncluded"); $description .= $langs->trans("DepositsAreNotIncluded");
} else { } else {
@ -847,9 +843,7 @@ if (empty($action) || $action == 'view') {
foreach ($tabfac as $key => $val) { foreach ($tabfac as $key => $val) {
$companystatic->id = $tabcompany[$key]['id']; $companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name']; $companystatic->name = $tabcompany[$key]['name'];
$companystatic->code_compta = $tabcompany[$key]['code_compta'];
$companystatic->code_compta_fournisseur = $tabcompany[$key]['code_compta_fournisseur']; $companystatic->code_compta_fournisseur = $tabcompany[$key]['code_compta_fournisseur'];
$companystatic->code_client = $tabcompany[$key]['code_client'];
$companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur']; $companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur'];
$companystatic->fournisseur = 1; $companystatic->fournisseur = 1;

View File

@ -311,9 +311,7 @@ if ($action == 'writebookkeeping') {
$companystatic->id = $tabcompany[$key]['id']; $companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name']; $companystatic->name = $tabcompany[$key]['name'];
$companystatic->code_compta = $tabcompany[$key]['code_compta']; $companystatic->code_compta = $tabcompany[$key]['code_compta'];
$companystatic->code_compta_fournisseur = $tabcompany[$key]['code_compta_fournisseur'];
$companystatic->code_client = $tabcompany[$key]['code_client']; $companystatic->code_client = $tabcompany[$key]['code_client'];
$companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur'];
$companystatic->client = 3; $companystatic->client = 3;
$invoicestatic->id = $key; $invoicestatic->id = $key;
@ -601,9 +599,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
$companystatic->id = $tabcompany[$key]['id']; $companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name']; $companystatic->name = $tabcompany[$key]['name'];
$companystatic->code_compta = $tabcompany[$key]['code_compta']; $companystatic->code_compta = $tabcompany[$key]['code_compta'];
$companystatic->code_compta_fournisseur = $tabcompany[$key]['code_compta_fournisseur'];
$companystatic->code_client = $tabcompany[$key]['code_client']; $companystatic->code_client = $tabcompany[$key]['code_client'];
$companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur'];
$companystatic->client = 3; $companystatic->client = 3;
$invoicestatic->id = $key; $invoicestatic->id = $key;
@ -791,9 +787,7 @@ if (empty($action) || $action == 'view') {
$companystatic->id = $tabcompany[$key]['id']; $companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name']; $companystatic->name = $tabcompany[$key]['name'];
$companystatic->code_compta = $tabcompany[$key]['code_compta']; $companystatic->code_compta = $tabcompany[$key]['code_compta'];
$companystatic->code_compta_fournisseur = $tabcompany[$key]['code_compta_fournisseur'];
$companystatic->code_client = $tabcompany[$key]['code_client']; $companystatic->code_client = $tabcompany[$key]['code_client'];
$companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur'];
$companystatic->client = 3; $companystatic->client = 3;
$invoicestatic->id = $key; $invoicestatic->id = $key;

View File

@ -163,6 +163,7 @@ class DolibarrApi
unset($object->statuts_short); unset($object->statuts_short);
unset($object->statuts_logo); unset($object->statuts_logo);
unset($object->statuts_long); unset($object->statuts_long);
//unset($object->labelStatus); //unset($object->labelStatus);
//unset($object->labelStatusShort); //unset($object->labelStatusShort);
@ -184,6 +185,7 @@ class DolibarrApi
unset($object->picto); unset($object->picto);
unset($object->fieldsforcombobox); unset($object->fieldsforcombobox);
unset($object->regeximgext);
unset($object->skip_update_total); unset($object->skip_update_total);
unset($object->context); unset($object->context);
@ -259,6 +261,11 @@ class DolibarrApi
if (!empty($object->thirdparty) && is_object($object->thirdparty)) { if (!empty($object->thirdparty) && is_object($object->thirdparty)) {
$this->_cleanObjectDatas($object->thirdparty); $this->_cleanObjectDatas($object->thirdparty);
} }
if (!empty($object->product) && is_object($object->product)) {
$this->_cleanObjectDatas($object->product);
}
return $object; return $object;
} }

View File

@ -1320,12 +1320,19 @@ class BOM extends CommonObject
*/ */
public function calculateCosts() public function calculateCosts()
{ {
global $conf; global $conf, $hookmanager;
include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
$this->unit_cost = 0; $this->unit_cost = 0;
$this->total_cost = 0; $this->total_cost = 0;
$parameters=array();
$reshook = $hookmanager->executeHooks('calculateCostsBom', $parameters, $this); // Note that $action and $object may have been modified by hook
if ($reshook > 0) {
return $hookmanager->resPrint;
}
if (is_array($this->lines) && count($this->lines)) { if (is_array($this->lines) && count($this->lines)) {
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
$productFournisseur = new ProductFournisseur($this->db); $productFournisseur = new ProductFournisseur($this->db);

View File

@ -1262,7 +1262,7 @@ class Propal extends CommonObject
break; break;
} }
// Defined the new fk_parent_line // Defined the new fk_parent_line
if ($result > 0) { if ($result > 0 && $line->product_type == 9) {
$fk_parent_line = $result; $fk_parent_line = $result;
} }
} }

View File

@ -435,7 +435,7 @@ if (empty($reshook)) {
} }
// Defined the new fk_parent_line // Defined the new fk_parent_line
if ($result > 0) { if ($result > 0 && $lines[$i]->product_type == 9) {
$fk_parent_line = $result; $fk_parent_line = $result;
} }
} }

View File

@ -1073,7 +1073,7 @@ class Commande extends CommonOrder
return -1; return -1;
} }
// Defined the new fk_parent_line // Defined the new fk_parent_line
if ($result > 0) { if ($result > 0 && $line->product_type == 9) {
$fk_parent_line = $result; $fk_parent_line = $result;
} }
} }

View File

@ -1251,7 +1251,7 @@ if (empty($reshook)) {
$object->lines[] = $line; // insert new line in current object $object->lines[] = $line; // insert new line in current object
// Defined the new fk_parent_line // Defined the new fk_parent_line
if ($result > 0) { if ($result > 0 && $line->product_type == 9) {
$fk_parent_line = $result; $fk_parent_line = $result;
} }
} }
@ -1772,7 +1772,7 @@ if (empty($reshook)) {
} }
// Defined the new fk_parent_line // Defined the new fk_parent_line
if ($result > 0) { if ($result > 0 && $lines[$i]->product_type == 9) {
$fk_parent_line = $result; $fk_parent_line = $result;
} }
} }

View File

@ -872,7 +872,7 @@ class Facture extends CommonInvoice
); );
// Defined the new fk_parent_line // Defined the new fk_parent_line
if ($result > 0) { if ($result > 0 && $newinvoiceline->product_type == 9) {
$fk_parent_line = $result; $fk_parent_line = $result;
} }
} }

View File

@ -454,9 +454,6 @@ class BonPrelevement extends CommonObject
dol_syslog(get_class($this)."::set_infocredit AddPaymentToBank Error ".$this->error); dol_syslog(get_class($this)."::set_infocredit AddPaymentToBank Error ".$this->error);
} }
} }
//var_dump($paiement->amounts);
//var_dump($thirdpartyid);
//var_dump($cursoramounts);
} }
// Update withdrawal line // Update withdrawal line
@ -1057,9 +1054,9 @@ class BonPrelevement extends CommonObject
$this->emetteur_iban = $account->iban; $this->emetteur_iban = $account->iban;
$this->emetteur_bic = $account->bic; $this->emetteur_bic = $account->bic;
$this->emetteur_ics = ($type == 'bank-transfer' ? $account->ics_transfer : $account->ics); $this->emetteur_ics = ($type == 'bank-transfer' ? $account->ics_transfer : $account->ics);
$this->raison_sociale = $account->proprio; $this->raison_sociale = $account->proprio;
} }
$this->factures = $factures_prev_id; $this->factures = $factures_prev_id;
@ -2208,7 +2205,8 @@ class BonPrelevement extends CommonObject
$XML_SEPA_INFO .= ' </CdtrSchmeId>'.$CrLf;*/ $XML_SEPA_INFO .= ' </CdtrSchmeId>'.$CrLf;*/
} }
} else { } else {
fputs($this->file, 'INCORRECT EMETTEUR '.$XML_SEPA_INFO.$CrLf); fputs($this->file, 'INCORRECT EMETTEUR '.$this->raison_sociale.$CrLf);
$XML_SEPA_INFO = '';
} }
return $XML_SEPA_INFO; return $XML_SEPA_INFO;
} }

View File

@ -270,8 +270,8 @@ if ($result) {
$i = 0; $i = 0;
while ($i < $num) { while ($i < $num) {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
$cum_ht[$obj->dm] = !empty($obj->amount) ? $obj->amount : 0; $cum_ht[$obj->dm] = empty($obj->amount) ? 0 : $obj->amount;
$cum[$obj->dm] = $obj->amount_ttc; $cum[$obj->dm] = empty($obj->amount_ttc) ? 0 : $obj->amount_ttc;
if ($obj->amount_ttc) { if ($obj->amount_ttc) {
$minyearmonth = ($minyearmonth ? min($minyearmonth, $obj->dm) : $obj->dm); $minyearmonth = ($minyearmonth ? min($minyearmonth, $obj->dm) : $obj->dm);
$maxyearmonth = max($maxyearmonth, $obj->dm); $maxyearmonth = max($maxyearmonth, $obj->dm);
@ -303,7 +303,11 @@ if ($modecompta == 'RECETTES-DEPENSES') {
$i = 0; $i = 0;
while ($i < $num) { while ($i < $num) {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
$cum[$obj->dm] += $obj->amount_ttc; if (empty($cum[$obj->dm])) {
$cum[$obj->dm] = $obj->amount_ttc;
} else {
$cum[$obj->dm] += $obj->amount_ttc;
}
if ($obj->amount_ttc) { if ($obj->amount_ttc) {
$minyearmonth = ($minyearmonth ?min($minyearmonth, $obj->dm) : $obj->dm); $minyearmonth = ($minyearmonth ?min($minyearmonth, $obj->dm) : $obj->dm);
$maxyearmonth = max($maxyearmonth, $obj->dm); $maxyearmonth = max($maxyearmonth, $obj->dm);
@ -405,12 +409,6 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) {
$case = dol_print_date(dol_mktime(1, 1, 1, $mois_modulo, 1, $annee_decalage), "%Y-%m"); $case = dol_print_date(dol_mktime(1, 1, 1, $mois_modulo, 1, $annee_decalage), "%Y-%m");
$caseprev = dol_print_date(dol_mktime(1, 1, 1, $mois_modulo, 1, $annee_decalage - 1), "%Y-%m"); $caseprev = dol_print_date(dol_mktime(1, 1, 1, $mois_modulo, 1, $annee_decalage - 1), "%Y-%m");
$total_ht[$annee]=0;
$total[$annee]=0;
$cum_ht[$case]=0;
$cum[$case]=0;
if ($annee >= $year_start) { // We ignore $annee < $year_start, we loop on it to be able to make delta, nothing is output. if ($annee >= $year_start) { // We ignore $annee < $year_start, we loop on it to be able to make delta, nothing is output.
if ($modecompta == 'CREANCES-DETTES') { if ($modecompta == 'CREANCES-DETTES') {
// Value turnover of month w/o VAT // Value turnover of month w/o VAT
@ -453,7 +451,7 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) {
print "</td>"; print "</td>";
// Percentage of month // Percentage of month
print '<td class="borderrightlight right">'; print '<td class="borderrightlight right"><span class="opacitymedium">';
//var_dump($annee.' '.$year_end.' '.$mois.' '.$month_end); //var_dump($annee.' '.$year_end.' '.$mois.' '.$month_end);
if ($annee < $year_end || ($annee == $year_end && $mois <= $month_end)) { if ($annee < $year_end || ($annee == $year_end && $mois <= $month_end)) {
if ($annee_decalage > $minyear && $case <= $casenow) { if ($annee_decalage > $minyear && $case <= $casenow) {
@ -483,7 +481,7 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) {
} }
} }
} }
print '</td>'; print '</span></td>';
if ($annee_decalage < $year_end || ($annee_decalage == $year_end && $mois > 12 && $annee < $year_end)) { if ($annee_decalage < $year_end || ($annee_decalage == $year_end && $mois > 12 && $annee < $year_end)) {
print '<td width="15">&nbsp;</td>'; print '<td width="15">&nbsp;</td>';

View File

@ -274,6 +274,9 @@ function getDefaultDatesForTransfer()
{ {
global $db, $conf; global $db, $conf;
$pastmonth = 0;
$pastmonthyear = 0;
// Period by default on transfer (0: previous month | 1: current month | 2: fiscal year) // Period by default on transfer (0: previous month | 1: current month | 2: fiscal year)
$periodbydefaultontransfer = (empty($conf->global->ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER) ? 0 : $conf->global->ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER); $periodbydefaultontransfer = (empty($conf->global->ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER) ? 0 : $conf->global->ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER);
if ($periodbydefaultontransfer == 2) { if ($periodbydefaultontransfer == 2) {

View File

@ -2992,10 +2992,10 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
// Wrapping for import module // Wrapping for import module
$accessallowed = $user->rights->import->run; $accessallowed = $user->rights->import->run;
$original_file = $conf->import->dir_temp.'/'.$original_file; $original_file = $conf->import->dir_temp.'/'.$original_file;
} elseif ($modulepart == 'recruitment' && !empty($conf->recruitment->dir_temp)) { } elseif ($modulepart == 'recruitment' && !empty($conf->recruitment->dir_output)) {
// Wrapping for recruitment module // Wrapping for recruitment module
$accessallowed = $user->rights->$modulepart->recruitmentjobposition->read; $accessallowed = $user->rights->recruitment->recruitmentjobposition->read;
$original_file = $conf->recruitment->dir_output .'/'. $original_file; $original_file = $conf->recruitment->dir_output.'/'.$original_file;
} elseif ($modulepart == 'editor' && !empty($conf->fckeditor->dir_output)) { } elseif ($modulepart == 'editor' && !empty($conf->fckeditor->dir_output)) {
// Wrapping for wysiwyg editor // Wrapping for wysiwyg editor
$accessallowed = 1; $accessallowed = 1;

View File

@ -2655,7 +2655,7 @@ function getModuleDirForApiClass($moduleobject)
$moduledirforclass = 'fichinter'; $moduledirforclass = 'fichinter';
} elseif ($moduleobject == 'mos') { } elseif ($moduleobject == 'mos') {
$moduledirforclass = 'mrp'; $moduledirforclass = 'mrp';
} elseif (in_array($moduleobject, array('products', 'expensereports', 'users', 'tickets', 'boms'))) { } elseif (in_array($moduleobject, array('products', 'expensereports', 'users', 'tickets', 'boms', 'receptions'))) {
$moduledirforclass = preg_replace('/s$/', '', $moduleobject); $moduledirforclass = preg_replace('/s$/', '', $moduleobject);
} }

View File

@ -1195,7 +1195,7 @@ class pdf_crabe extends ModelePDFFactures
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
global $langs; global $langs;
$langs->loadLangs(array('payment', 'paybox')); $langs->loadLangs(array('payment', 'paybox', 'stripe'));
$servicename = $langs->transnoentities('Online'); $servicename = $langs->transnoentities('Online');
$paiement_url = getOnlinePaymentUrl('', 'invoice', $object->ref, '', '', ''); $paiement_url = getOnlinePaymentUrl('', 'invoice', $object->ref, '', '', '');
$linktopay = $langs->trans("ToOfferALinkForOnlinePayment", $servicename).' <a href="'.$paiement_url.'">'.$outputlangs->transnoentities("ClickHere").'</a>'; $linktopay = $langs->trans("ToOfferALinkForOnlinePayment", $servicename).' <a href="'.$paiement_url.'">'.$outputlangs->transnoentities("ClickHere").'</a>';

View File

@ -217,11 +217,11 @@ class Expedition extends CommonObject
$this->statuts[2] = 'StatusSendingProcessed'; $this->statuts[2] = 'StatusSendingProcessed';
// List of short language codes for status // List of short language codes for status
$this->statutshorts = array(); $this->statuts_short = array();
$this->statutshorts[-1] = 'StatusSendingCanceledShort'; $this->statuts_short[-1] = 'StatusSendingCanceledShort';
$this->statutshorts[0] = 'StatusSendingDraftShort'; $this->statuts_short[0] = 'StatusSendingDraftShort';
$this->statutshorts[1] = 'StatusSendingValidatedShort'; $this->statuts_short[1] = 'StatusSendingValidatedShort';
$this->statutshorts[2] = 'StatusSendingProcessedShort'; $this->statuts_short[2] = 'StatusSendingProcessedShort';
} }
/** /**
@ -1884,7 +1884,7 @@ class Expedition extends CommonObject
global $langs; global $langs;
$labelStatus = $langs->transnoentitiesnoconv($this->statuts[$status]); $labelStatus = $langs->transnoentitiesnoconv($this->statuts[$status]);
$labelStatusShort = $langs->transnoentitiesnoconv($this->statutshorts[$status]); $labelStatusShort = $langs->transnoentitiesnoconv($this->statuts_short[$status]);
$statusType = 'status'.$status; $statusType = 'status'.$status;
if ($status == self::STATUS_VALIDATED) { if ($status == self::STATUS_VALIDATED) {

View File

@ -751,7 +751,7 @@ class CommandeFournisseur extends CommonOrder
// phpcs:enable // phpcs:enable
global $conf, $langs, $hookmanager; global $conf, $langs, $hookmanager;
if (empty($this->statuts) || empty($this->statutshort)) { if (empty($this->statuts) || empty($this->statuts_short)) {
$langs->load('orders'); $langs->load('orders');
$this->statuts[0] = 'StatusSupplierOrderDraft'; $this->statuts[0] = 'StatusSupplierOrderDraft';
@ -769,15 +769,15 @@ class CommandeFournisseur extends CommonOrder
$this->statuts[9] = 'StatusSupplierOrderRefused'; $this->statuts[9] = 'StatusSupplierOrderRefused';
// List of language codes for status // List of language codes for status
$this->statutshort[0] = 'StatusSupplierOrderDraftShort'; $this->statuts_short[0] = 'StatusSupplierOrderDraftShort';
$this->statutshort[1] = 'StatusSupplierOrderValidatedShort'; $this->statuts_short[1] = 'StatusSupplierOrderValidatedShort';
$this->statutshort[2] = 'StatusSupplierOrderApprovedShort'; $this->statuts_short[2] = 'StatusSupplierOrderApprovedShort';
$this->statutshort[3] = 'StatusSupplierOrderOnProcessShort'; $this->statuts_short[3] = 'StatusSupplierOrderOnProcessShort';
$this->statutshort[4] = 'StatusSupplierOrderReceivedPartiallyShort'; $this->statuts_short[4] = 'StatusSupplierOrderReceivedPartiallyShort';
$this->statutshort[5] = 'StatusSupplierOrderReceivedAllShort'; $this->statuts_short[5] = 'StatusSupplierOrderReceivedAllShort';
$this->statutshort[6] = 'StatusSupplierOrderCanceledShort'; $this->statuts_short[6] = 'StatusSupplierOrderCanceledShort';
$this->statutshort[7] = 'StatusSupplierOrderCanceledShort'; $this->statuts_short[7] = 'StatusSupplierOrderCanceledShort';
$this->statutshort[9] = 'StatusSupplierOrderRefusedShort'; $this->statuts_short[9] = 'StatusSupplierOrderRefusedShort';
} }
$statustrans = array( $statustrans = array(
@ -806,7 +806,7 @@ class CommandeFournisseur extends CommonOrder
} }
$statusLong = $langs->transnoentitiesnoconv($this->statuts[$status]).$billedtext; $statusLong = $langs->transnoentitiesnoconv($this->statuts[$status]).$billedtext;
$statusShort = $langs->transnoentitiesnoconv($this->statutshort[$status]); $statusShort = $langs->transnoentitiesnoconv($this->statuts_short[$status]);
$parameters = array('status' => $status, 'mode' => $mode, 'billed' => $billed); $parameters = array('status' => $status, 'mode' => $mode, 'billed' => $billed);
$reshook = $hookmanager->executeHooks('LibStatut', $parameters, $this); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('LibStatut', $parameters, $this); // Note that $action and $object may have been modified by hook

View File

@ -131,9 +131,9 @@ class CommandeFournisseurDispatch extends CommonObjectLine
$this->statuts[0] = 'Received'; $this->statuts[0] = 'Received';
$this->statuts[1] = 'Verified'; $this->statuts[1] = 'Verified';
$this->statuts[2] = 'Denied'; $this->statuts[2] = 'Denied';
$this->statutshort[0] = 'Received'; $this->statuts_short[0] = 'Received';
$this->statutshort[1] = 'Verified'; $this->statuts_short[1] = 'Verified';
$this->statutshort[2] = 'Denied'; $this->statuts_short[2] = 'Denied';
} }
@ -580,7 +580,7 @@ class CommandeFournisseurDispatch extends CommonObjectLine
if ($mode == 0) { if ($mode == 0) {
return $langs->trans($this->statuts[$status]); return $langs->trans($this->statuts[$status]);
} elseif ($mode == 1) { } elseif ($mode == 1) {
return $langs->trans($this->statutshort[$status]); return $langs->trans($this->statuts_short[$status]);
} elseif ($mode == 2) { } elseif ($mode == 2) {
return $langs->trans($this->statuts[$status]); return $langs->trans($this->statuts[$status]);
} elseif ($mode == 3) { } elseif ($mode == 3) {
@ -601,11 +601,11 @@ class CommandeFournisseurDispatch extends CommonObjectLine
} }
} elseif ($mode == 5) { } elseif ($mode == 5) {
if ($status == 0) { if ($status == 0) {
return '<span class="hideonsmartphone">'.$langs->trans($this->statutshort[$status]).' </span>'.img_picto($langs->trans($this->statuts[$status]), 'statut0'); return '<span class="hideonsmartphone">'.$langs->trans($this->statuts_short[$status]).' </span>'.img_picto($langs->trans($this->statuts[$status]), 'statut0');
} elseif ($status == 1) { } elseif ($status == 1) {
return '<span class="hideonsmartphone">'.$langs->trans($this->statutshort[$status]).' </span>'.img_picto($langs->trans($this->statuts[$status]), 'statut4'); return '<span class="hideonsmartphone">'.$langs->trans($this->statuts_short[$status]).' </span>'.img_picto($langs->trans($this->statuts[$status]), 'statut4');
} elseif ($status == 2) { } elseif ($status == 2) {
return '<span class="hideonsmartphone">'.$langs->trans($this->statutshort[$status]).' </span>'.img_picto($langs->trans($this->statuts[$status]), 'statut8'); return '<span class="hideonsmartphone">'.$langs->trans($this->statuts_short[$status]).' </span>'.img_picto($langs->trans($this->statuts[$status]), 'statut8');
} }
} }
} }

View File

@ -1027,6 +1027,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$disable = 'disabled'; $disable = 'disabled';
} }
// input hidden with fk_product of line
print '<input type="hidden" name="product-'.$line->id.'-'.$i.'" value="'.$line->fk_product.'">';
// Qty // Qty
print '<td class="right"><input type="text" class="width50 right" id="qtytoconsume-'.$line->id.'-'.$i.'" name="qty-'.$line->id.'-'.$i.'" value="'.$preselected.'" '.$disable.'></td>'; print '<td class="right"><input type="text" class="width50 right" id="qtytoconsume-'.$line->id.'-'.$i.'" name="qty-'.$line->id.'-'.$i.'" value="'.$preselected.'" '.$disable.'></td>';

View File

@ -4830,7 +4830,7 @@ class Product extends CommonObject
$sql .= " AND pa.fk_product_fils <> ".((int) $id); // This should not happens, it is to avoid infinite loop if it happens $sql .= " AND pa.fk_product_fils <> ".((int) $id); // This should not happens, it is to avoid infinite loop if it happens
$sql.= " ORDER BY pa.rang"; $sql.= " ORDER BY pa.rang";
dol_syslog(get_class($this).'::getChildsArbo id='.$id.' level='.$level. ' parents='.$parents, LOG_DEBUG); dol_syslog(get_class($this).'::getChildsArbo id='.$id.' level='.$level. ' parents='.implode(',', $parents), LOG_DEBUG);
if ($level == 1) { if ($level == 1) {
$alreadyfound = array($id=>1); // We init array of found object to start of tree, so if we found it later (should not happened), we stop immediatly $alreadyfound = array($id=>1); // We init array of found object to start of tree, so if we found it later (should not happened), we stop immediatly

View File

@ -71,8 +71,8 @@ if (!$user->rights->projet->lire) {
$diroutputmassaction = $conf->project->dir_output.'/temp/massgeneration/'.$user->id; $diroutputmassaction = $conf->project->dir_output.'/temp/massgeneration/'.$user->id;
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", "aZ09comma"); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { 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 // If $page is not defined, or '' or -1 or if we click on clear filters
@ -229,7 +229,8 @@ $arrayfields = dol_sort_array($arrayfields, 'position');
*/ */
if (GETPOST('cancel', 'alpha')) { if (GETPOST('cancel', 'alpha')) {
$action = 'list'; $massaction = ''; $action = 'list';
$massaction = '';
} }
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
$massaction = ''; $massaction = '';
@ -356,13 +357,22 @@ if (empty($reshook)) {
* View * View
*/ */
$companystatic = new Societe($db);
$form = new Form($db); $form = new Form($db);
$companystatic = new Societe($db);
$formother = new FormOther($db); $formother = new FormOther($db);
$formproject = new FormProjets($db); $formproject = new FormProjets($db);
$help_url = "EN:Module_Projects|FR:Module_Projets|ES:M&oacute;dulo_Proyectos"; $help_url = "EN:Module_Projects|FR:Module_Projets|ES:M&oacute;dulo_Proyectos";
$title = $langs->trans("Projects"); $title = $langs->trans("LeadsOrProjects");
if (empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
$title = $langs->trans("Projects");
}
if (isset($conf->global->PROJECT_USE_OPPORTUNITIES) && $conf->global->PROJECT_USE_OPPORTUNITIES == 2) { // 2 = leads only
$title = $langs->trans("Leads");
}
$morejs = array();
$morecss = array();
// Get list of project id allowed to user (in a string list separated by comma) // Get list of project id allowed to user (in a string list separated by comma)
@ -1190,8 +1200,12 @@ $totalarray = array(
'nbfield' => 0, 'nbfield' => 0,
'val' => array(), 'val' => array(),
); );
while ($i < min($num, $limit)) { $imaxinloop = ($limit ? min($num, $limit) : $num);
while ($i < $imaxinloop) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
if (empty($obj)) {
break; // Should not happen
}
$object->id = $obj->id; $object->id = $obj->id;
$object->user_author_id = $obj->fk_user_creat; $object->user_author_id = $obj->fk_user_creat;
@ -1648,14 +1662,26 @@ while ($i < min($num, $limit)) {
// Show total line // Show total line
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
// If no record found
if ($num == 0) {
$colspan = 1;
foreach ($arrayfields as $key => $val) {
if (!empty($val['checked'])) {
$colspan++;
}
}
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
}
$db->free($resql); $db->free($resql);
$parameters = array('sql' => $sql); $parameters = array('arrayfields'=>$arrayfields, 'sql' => $sql);
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
print "</table>\n"; print "</table>\n";
print '</div>'; print '</div>';
print "</form>\n"; print "</form>\n";
// End of page // End of page

View File

@ -149,11 +149,11 @@ class Reception extends CommonObject
$this->statuts[2] = 'StatusReceptionProcessed'; $this->statuts[2] = 'StatusReceptionProcessed';
// List of short language codes for status // List of short language codes for status
$this->statutshorts = array(); $this->statuts_short = array();
$this->statutshorts[-1] = 'StatusReceptionCanceledShort'; $this->statuts_short[-1] = 'StatusReceptionCanceledShort';
$this->statutshorts[0] = 'StatusReceptionDraftShort'; $this->statuts_short[0] = 'StatusReceptionDraftShort';
$this->statutshorts[1] = 'StatusReceptionValidatedShort'; $this->statuts_short[1] = 'StatusReceptionValidatedShort';
$this->statutshorts[2] = 'StatusReceptionProcessedShort'; $this->statuts_short[2] = 'StatusReceptionProcessedShort';
} }
/** /**
@ -456,8 +456,8 @@ class Reception extends CommonObject
$this->brouillon = 1; $this->brouillon = 1;
} }
$file = $conf->reception->dir_output."/".get_exdir($this->id, 2, 0, 0, $this, 'reception')."/".$this->id.".pdf"; //$file = $conf->reception->dir_output."/".get_exdir(0, 0, 0, 1, $this, 'reception')."/".$this->id.".pdf";
$this->pdf_filename = $file; //$this->pdf_filename = $file;
// Tracking url // Tracking url
$this->getUrlTrackingStatus($obj->tracking_number); $this->getUrlTrackingStatus($obj->tracking_number);
@ -1177,6 +1177,8 @@ class Reception extends CommonObject
$line = new CommandeFournisseurDispatch($this->db); $line = new CommandeFournisseurDispatch($this->db);
$line->fetch($obj->rowid); $line->fetch($obj->rowid);
// TODO Remove or keep this ?
$line->fetch_product(); $line->fetch_product();
$sql_commfourndet = 'SELECT qty, ref, label, description, tva_tx, vat_src_code, subprice, multicurrency_subprice, remise_percent'; $sql_commfourndet = 'SELECT qty, ref, label, description, tva_tx, vat_src_code, subprice, multicurrency_subprice, remise_percent';
@ -1304,7 +1306,7 @@ class Reception extends CommonObject
global $langs; global $langs;
$labelStatus = $langs->transnoentitiesnoconv($this->statuts[$status]); $labelStatus = $langs->transnoentitiesnoconv($this->statuts[$status]);
$labelStatusShort = $langs->transnoentitiesnoconv($this->statutshorts[$status]); $labelStatusShort = $langs->transnoentitiesnoconv($this->statuts_short[$status]);
$statusType = 'status'.$status; $statusType = 'status'.$status;
if ($status == self::STATUS_VALIDATED) { if ($status == self::STATUS_VALIDATED) {

View File

@ -744,6 +744,9 @@ class User extends CommonObject
// If module is abc@module, we check permission user->rights->module->abc->permlevel1 // If module is abc@module, we check permission user->rights->module->abc->permlevel1
$tmp = explode('@', $rightsPath, 2); $tmp = explode('@', $rightsPath, 2);
if (!empty($tmp[1])) { if (!empty($tmp[1])) {
if (strpos($module, '@') !== false) {
$module = $tmp[1];
}
$rightsPath = $tmp[1]; $rightsPath = $tmp[1];
$permlevel2 = $permlevel1; $permlevel2 = $permlevel1;
$permlevel1 = $tmp[0]; $permlevel1 = $tmp[0];