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

This commit is contained in:
Laurent Destailleur 2023-02-27 03:40:12 +01:00
commit b0b1e8d327
22 changed files with 113 additions and 92 deletions

View File

@ -719,7 +719,7 @@ if (count($sqlwhere) > 0) {
// Export into a file with format defined into setup (FEC, CSV, ...)
// Must be after definition of $sql
if ($action == 'export_fileconfirm' && $user->hasRight('accounting', 'mouvements', 'export')) {
// TODO Replace the fetchAll to get all ->line followed by call to ->export(). It consumes too much memory on large export.
// TODO Replace the fetchAll to get all ->line followed by call to ->export(). It currently consumes too much memory on large export.
// Replace this with the query($sql) and loop on each line to export them.
$result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter, 'AND', (empty($conf->global->ACCOUNTING_REEXPORT) ? 0 : 1));
@ -856,6 +856,15 @@ $formconfirm = '';
if ($action == 'export_file') {
$form_question = array();
$form_question['notexportlettering'] = array(
'name' => 'notexportlettering',
'type' => 'other',
'label' => '', // TODO Use Selectmodelcsv and show a select combo
'value' => $langs->trans('Modelcsv').' : <b>'.$listofformat[$formatexportset].'</b>'
);
$form_question['separator0'] = array('name'=>'separator0', 'type'=>'separator');
if (getDolGlobalInt("ACCOUNTING_ENABLE_LETTERING")) {
// If 1, we check by default.
$checked = !empty($conf->global->ACCOUNTING_DEFAULT_NOT_EXPORT_LETTERING) ? 'true' : 'false';
@ -866,7 +875,7 @@ if ($action == 'export_file') {
'value' => $checked,
);
$form_question['separator'] = array('name'=>'separator', 'type'=>'separator');
$form_question['separator1'] = array('name'=>'separator1', 'type'=>'separator');
}
// If 1 or not set, we check by default.
@ -903,7 +912,7 @@ if ($action == 'export_file') {
);
}
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', $langs->trans('ConfirmExportFile'), 'export_fileconfirm', $form_question, '', 1, 400, 600);
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans("ExportFilteredList").'...', $langs->trans('ConfirmExportFile'), 'export_fileconfirm', $form_question, '', 1, 420, 600);
}
//if ($action == 'delbookkeepingyear') {
@ -1362,7 +1371,7 @@ while ($i < min($num, $limit)) {
$accountingjournal = new AccountingJournal($db);
$result = $accountingjournal->fetch('', $line->code_journal);
$journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $line->code_journal);
print '<td class="center">'.$journaltoshow.'</td>';
print '<td class="center tdoverflowmax150">'.$journaltoshow.'</td>';
if (!$i) {
$totalarray['nbfield']++;
}

View File

@ -1177,7 +1177,9 @@ class AccountancyExport
print $line->code_journal . $separator;
// FEC:JournalLib
print dol_string_unaccent($langs->transnoentities($line->journal_label)) . $separator;
$labeljournal = dol_string_unaccent($langs->transnoentities($line->journal_label));
$labeljournal = dol_string_nospecial($labeljournal, ' ');
print $labeljournal . $separator;
// FEC:EcritureNum
print $line->piece_num . $separator;
@ -1308,7 +1310,9 @@ class AccountancyExport
print $line->code_journal . $separator;
// FEC:JournalLib
print dol_string_unaccent($langs->transnoentities($line->journal_label)) . $separator;
$labeljournal = dol_string_unaccent($langs->transnoentities($line->journal_label));
$labeljournal = dol_string_nospecial($labeljournal, ' ');
print $labeljournal . $separator;
// FEC:EcritureNum
print $line->piece_num . $separator;

View File

@ -1192,7 +1192,7 @@ if ($action == 'create') {
print '<input type="hidden" name="donotclearsession" value="1">';
print '<input type="hidden" name="page_y" value="">';
if ($backtopage) {
print '<input type="hidden" name="backtopage" value="'.($backtopage != '1' ? $backtopage : dol_htmlentities($_SERVER["HTTP_REFERER"])).'">';
print '<input type="hidden" name="backtopage" value="'.($backtopage != '1' ? $backtopage : '').'">';
}
if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
print '<input type="hidden" name="actioncode" value="'.dol_getIdFromCode($db, 'AC_OTH', 'c_actioncomm').'">';
@ -1722,7 +1722,7 @@ if ($id > 0) {
print '<input type="hidden" name="ref_ext" value="'.$object->ref_ext.'">';
print '<input type="hidden" name="page_y" value="">';
if ($backtopage) {
print '<input type="hidden" name="backtopage" value="'.($backtopage != '1' ? $backtopage : dol_htmlentities($_SERVER["HTTP_REFERER"])).'">';
print '<input type="hidden" name="backtopage" value="'.($backtopage != '1' ? $backtopage : '').'">';
}
if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && ! preg_match('/^TICKET_MSG_PRIVATE/', $object->code)) {
print '<input type="hidden" name="actioncode" value="'.$object->type_code.'">';

View File

@ -548,7 +548,7 @@ if ($object->fetch($id) >= 0) {
$massactionbutton = '';
print_barre_liste($langs->trans("MailSelectedRecipients"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $morehtmlcenter, $num, $nbtotalofrecords, 'generic', 0, '', '', $limit);
print_barre_liste($langs->trans("MailSelectedRecipients"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $morehtmlcenter, $num, $nbtotalofrecords, 'generic', 0, '', '', $limit, 0, 0, 1);
print '</form>';

View File

@ -1396,6 +1396,9 @@ if (empty($reshook)) {
$date_end = dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));
$remise_percent = price2num(GETPOST('remise_percent'), '', 2);
if (empty($remise_percent)) {
$remise_percent = 0;
}
// Prepare a price equivalent for minimum price check
$pu_equivalent = $pu_ht;

View File

@ -190,7 +190,7 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO
$tmparray[] = trim(GETPOST('sendto', 'alphawithlgt'));
}
if (trim($_POST['tomail'])) {
if (isset($_POST['tomail']) && trim($_POST['tomail'])) {
// Recipients are provided into free hidden text field
$tmparray[] = trim(GETPOST('tomail', 'alphawithlgt'));
}

View File

@ -80,7 +80,7 @@ class box_members_by_type extends ModeleBoxes
public function loadBox($max = 5)
{
global $user, $langs, $conf;
$langs->load("boxes");
$langs->loadLangs(array("boxes", "members"));
$this->max = $max;
@ -284,7 +284,7 @@ class box_members_by_type extends ModeleBoxes
if ($num == 0) {
$this->info_box_contents[$line][0] = array(
'td' => 'class="center"',
'td' => 'colspan="7" class="center"',
'text' => $langs->trans("NoRecordedMembersByType")
);
} else {

View File

@ -79,7 +79,7 @@ class box_members_subscriptions_by_year extends ModeleBoxes
public function loadBox($max = 5)
{
global $user, $langs, $conf;
$langs->load("boxes");
$langs->loadLangs(array("boxes", "members"));
$this->max = $max;
@ -191,7 +191,7 @@ class box_members_subscriptions_by_year extends ModeleBoxes
if ($num == 0) {
$this->info_box_contents[$line][0] = array(
'td' => 'class="left" colspan="4"',
'td' => 'colspan="4"',
'text' => $langs->trans("NoRecordedMembers"),
);
} else {

View File

@ -5168,7 +5168,7 @@ class Form
$formquestion[] = array('name'=>$input['name'].'year');
$formquestion[] = array('name'=>$input['name'].'hour');
$formquestion[] = array('name'=>$input['name'].'min');
} elseif ($input['type'] == 'other') {
} elseif ($input['type'] == 'other') { // can be 1 column or 2 depending if label is set or not
$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">';
if (!empty($input['label'])) {
$more .= $input['label'].'</div><div class="tagtd">';

View File

@ -2590,54 +2590,54 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
$original_file = $conf->adherent->dir_output.'/'.$original_file;
} elseif ($modulepart == 'apercufacture' && !empty($conf->facture->multidir_output[$entity])) {
// Wrapping for invoices (user need permission to read invoices)
if ($fuser->rights->facture->{$lire}) {
if ($fuser->hasRight('facture', $lire)) {
$accessallowed = 1;
}
$original_file = $conf->facture->multidir_output[$entity].'/'.$original_file;
} elseif ($modulepart == 'apercupropal' && !empty($conf->propal->multidir_output[$entity])) {
// Wrapping pour les apercu propal
if ($fuser->rights->propal->{$lire}) {
if ($fuser->hasRight('propal', $lire)) {
$accessallowed = 1;
}
$original_file = $conf->propal->multidir_output[$entity].'/'.$original_file;
} elseif ($modulepart == 'apercucommande' && !empty($conf->commande->multidir_output[$entity])) {
// Wrapping pour les apercu commande
if ($fuser->rights->commande->{$lire}) {
if ($fuser->hasRight('commande', $lire)) {
$accessallowed = 1;
}
$original_file = $conf->commande->multidir_output[$entity].'/'.$original_file;
} elseif (($modulepart == 'apercufichinter' || $modulepart == 'apercuficheinter') && !empty($conf->ficheinter->dir_output)) {
// Wrapping pour les apercu intervention
if ($fuser->rights->ficheinter->{$lire}) {
if ($fuser->hasRight('ficheinter', $lire)) {
$accessallowed = 1;
}
$original_file = $conf->ficheinter->dir_output.'/'.$original_file;
} elseif (($modulepart == 'apercucontract') && !empty($conf->contrat->multidir_output[$entity])) {
// Wrapping pour les apercu contrat
if ($fuser->rights->contrat->{$lire}) {
if ($fuser->hasRight('contrat', $lire)) {
$accessallowed = 1;
}
$original_file = $conf->contrat->multidir_output[$entity].'/'.$original_file;
} elseif (($modulepart == 'apercusupplier_proposal' || $modulepart == 'apercusupplier_proposal') && !empty($conf->supplier_proposal->dir_output)) {
// Wrapping pour les apercu supplier proposal
if ($fuser->rights->supplier_proposal->{$lire}) {
if ($fuser->hasRight('supplier_proposal', $lire)) {
$accessallowed = 1;
}
$original_file = $conf->supplier_proposal->dir_output.'/'.$original_file;
} elseif (($modulepart == 'apercusupplier_order' || $modulepart == 'apercusupplier_order') && !empty($conf->fournisseur->commande->dir_output)) {
// Wrapping pour les apercu supplier order
if ($fuser->rights->fournisseur->commande->{$lire}) {
if ($fuser->hasRight('fournisseur', 'commande', $lire)) {
$accessallowed = 1;
}
$original_file = $conf->fournisseur->commande->dir_output.'/'.$original_file;
} elseif (($modulepart == 'apercusupplier_invoice' || $modulepart == 'apercusupplier_invoice') && !empty($conf->fournisseur->facture->dir_output)) {
// Wrapping pour les apercu supplier invoice
if ($fuser->rights->fournisseur->facture->{$lire}) {
if ($fuser->hasRight('fournisseur', $lire)) {
$accessallowed = 1;
}
$original_file = $conf->fournisseur->facture->dir_output.'/'.$original_file;
} elseif (($modulepart == 'holiday') && !empty($conf->holiday->dir_output)) {
if ($fuser->rights->holiday->{$read} || !empty($fuser->rights->holiday->readall) || preg_match('/^specimen/i', $original_file)) {
if ($fuser->hasRight('holiday', $read) || !empty($fuser->rights->holiday->readall) || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1;
// If we known $id of holiday, call checkUserAccessToObject to check permission on properties and hierarchy of leave request
if ($refname && empty($fuser->rights->holiday->readall) && !preg_match('/^specimen/i', $original_file)) {
@ -2649,7 +2649,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
}
$original_file = $conf->holiday->dir_output.'/'.$original_file;
} elseif (($modulepart == 'expensereport') && !empty($conf->expensereport->dir_output)) {
if ($fuser->rights->expensereport->{$lire} || !empty($fuser->rights->expensereport->readall) || preg_match('/^specimen/i', $original_file)) {
if ($fuser->hasRight('expensereport', $lire) || !empty($fuser->rights->expensereport->readall) || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1;
// If we known $id of expensereport, call checkUserAccessToObject to check permission on properties and hierarchy of expense report
if ($refname && empty($fuser->rights->expensereport->readall) && !preg_match('/^specimen/i', $original_file)) {
@ -2662,72 +2662,72 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
$original_file = $conf->expensereport->dir_output.'/'.$original_file;
} elseif (($modulepart == 'apercuexpensereport') && !empty($conf->expensereport->dir_output)) {
// Wrapping pour les apercu expense report
if ($fuser->rights->expensereport->{$lire}) {
if ($fuser->hasRight('expensereport', $lire)) {
$accessallowed = 1;
}
$original_file = $conf->expensereport->dir_output.'/'.$original_file;
} elseif ($modulepart == 'propalstats' && !empty($conf->propal->multidir_temp[$entity])) {
// Wrapping pour les images des stats propales
if ($fuser->rights->propal->{$lire}) {
if ($fuser->hasRight('propal', $lire)) {
$accessallowed = 1;
}
$original_file = $conf->propal->multidir_temp[$entity].'/'.$original_file;
} elseif ($modulepart == 'orderstats' && !empty($conf->commande->dir_temp)) {
// Wrapping pour les images des stats commandes
if ($fuser->rights->commande->{$lire}) {
if ($fuser->hasRight('commande', $lire)) {
$accessallowed = 1;
}
$original_file = $conf->commande->dir_temp.'/'.$original_file;
} elseif ($modulepart == 'orderstatssupplier' && !empty($conf->fournisseur->dir_output)) {
if ($fuser->rights->fournisseur->commande->{$lire}) {
if ($fuser->hasRight('fournisseur', 'commande', $lire)) {
$accessallowed = 1;
}
$original_file = $conf->fournisseur->commande->dir_temp.'/'.$original_file;
} elseif ($modulepart == 'billstats' && !empty($conf->facture->dir_temp)) {
// Wrapping pour les images des stats factures
if ($fuser->rights->facture->{$lire}) {
if ($fuser->hasRight('facture', $lire)) {
$accessallowed = 1;
}
$original_file = $conf->facture->dir_temp.'/'.$original_file;
} elseif ($modulepart == 'billstatssupplier' && !empty($conf->fournisseur->dir_output)) {
if ($fuser->rights->fournisseur->facture->{$lire}) {
if ($fuser->hasRight('fournisseur', 'facture', $lire)) {
$accessallowed = 1;
}
$original_file = $conf->fournisseur->facture->dir_temp.'/'.$original_file;
} elseif ($modulepart == 'expeditionstats' && !empty($conf->expedition->dir_temp)) {
// Wrapping pour les images des stats expeditions
if ($fuser->rights->expedition->{$lire}) {
if ($fuser->hasRight('expedition', $lire)) {
$accessallowed = 1;
}
$original_file = $conf->expedition->dir_temp.'/'.$original_file;
} elseif ($modulepart == 'tripsexpensesstats' && !empty($conf->deplacement->dir_temp)) {
// Wrapping pour les images des stats expeditions
if ($fuser->rights->deplacement->{$lire}) {
if ($fuser->hasRight('deplacement', $lire)) {
$accessallowed = 1;
}
$original_file = $conf->deplacement->dir_temp.'/'.$original_file;
} elseif ($modulepart == 'memberstats' && !empty($conf->adherent->dir_temp)) {
// Wrapping pour les images des stats expeditions
if ($fuser->rights->adherent->{$lire}) {
if ($fuser->hasRight('adherent', $lire)) {
$accessallowed = 1;
}
$original_file = $conf->adherent->dir_temp.'/'.$original_file;
} elseif (preg_match('/^productstats_/i', $modulepart) && !empty($conf->product->dir_temp)) {
// Wrapping pour les images des stats produits
if ($fuser->rights->produit->{$lire} || $fuser->rights->service->{$lire}) {
if ($fuser->hasRight('produit', $lire) || $fuser->hasRight('service', $lire)) {
$accessallowed = 1;
}
$original_file = (!empty($conf->product->multidir_temp[$entity]) ? $conf->product->multidir_temp[$entity] : $conf->service->multidir_temp[$entity]).'/'.$original_file;
} elseif (in_array($modulepart, array('tax', 'tax-vat', 'tva')) && !empty($conf->tax->dir_output)) {
// Wrapping for taxes
if ($fuser->rights->tax->charges->{$lire}) {
if ($fuser->hasRight('tax', 'charges', $lire)) {
$accessallowed = 1;
}
$modulepartsuffix = str_replace('tax-', '', $modulepart);
$original_file = $conf->tax->dir_output.'/'.($modulepartsuffix != 'tax' ? $modulepartsuffix.'/' : '').$original_file;
} elseif ($modulepart == 'actions' && !empty($conf->agenda->dir_output)) {
// Wrapping for events
if ($fuser->rights->agenda->myactions->{$read}) {
if ($fuser->hasRight('agenda', 'myactions', $read)) {
$accessallowed = 1;
// If we known $id of project, call checkUserAccessToObject to check permission on the given agenda event on properties and assigned users
if ($refname && !preg_match('/^specimen/i', $original_file)) {
@ -2811,85 +2811,85 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
if (empty($entity) || empty($conf->societe->multidir_output[$entity])) {
return array('accessallowed'=>0, 'error'=>'Value entity must be provided');
}
if ($fuser->rights->societe->{$lire}) {
if ($fuser->hasRight('societe', $lire)) {
$accessallowed = 1;
}
$original_file = $conf->societe->multidir_output[$entity].'/contact/'.$original_file;
} elseif (($modulepart == 'facture' || $modulepart == 'invoice') && !empty($conf->facture->multidir_output[$entity])) {
// Wrapping for invoices
if ($fuser->rights->facture->{$lire} || preg_match('/^specimen/i', $original_file)) {
if ($fuser->hasRight('facture', $lire) || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1;
}
$original_file = $conf->facture->multidir_output[$entity].'/'.$original_file;
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."facture WHERE ref='".$db->escape($refname)."' AND entity IN (".getEntity('invoice').")";
} elseif ($modulepart == 'massfilesarea_proposals' && !empty($conf->propal->multidir_output[$entity])) {
// Wrapping for mass actions
if ($fuser->rights->propal->{$lire} || preg_match('/^specimen/i', $original_file)) {
if ($fuser->hasRight('propal', $lire) || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1;
}
$original_file = $conf->propal->multidir_output[$entity].'/temp/massgeneration/'.$user->id.'/'.$original_file;
} elseif ($modulepart == 'massfilesarea_orders') {
if ($fuser->rights->commande->{$lire} || preg_match('/^specimen/i', $original_file)) {
if ($fuser->hasRight('commande', $lire) || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1;
}
$original_file = $conf->commande->multidir_output[$entity].'/temp/massgeneration/'.$user->id.'/'.$original_file;
} elseif ($modulepart == 'massfilesarea_sendings') {
if ($fuser->rights->expedition->{$lire} || preg_match('/^specimen/i', $original_file)) {
if ($fuser->hasRight('expedition', $lire) || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1;
}
$original_file = $conf->expedition->dir_output.'/sending/temp/massgeneration/'.$user->id.'/'.$original_file;
} elseif ($modulepart == 'massfilesarea_invoices') {
if ($fuser->rights->facture->{$lire} || preg_match('/^specimen/i', $original_file)) {
if ($fuser->hasRight('facture', $lire) || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1;
}
$original_file = $conf->facture->multidir_output[$entity].'/temp/massgeneration/'.$user->id.'/'.$original_file;
} elseif ($modulepart == 'massfilesarea_expensereport') {
if ($fuser->rights->facture->{$lire} || preg_match('/^specimen/i', $original_file)) {
if ($fuser->hasRight('facture', $lire) || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1;
}
$original_file = $conf->expensereport->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file;
} elseif ($modulepart == 'massfilesarea_interventions') {
if ($fuser->rights->ficheinter->{$lire} || preg_match('/^specimen/i', $original_file)) {
if ($fuser->hasRight('ficheinter', $lire) || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1;
}
$original_file = $conf->ficheinter->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file;
} elseif ($modulepart == 'massfilesarea_supplier_proposal' && !empty($conf->supplier_proposal->dir_output)) {
if ($fuser->rights->supplier_proposal->{$lire} || preg_match('/^specimen/i', $original_file)) {
if ($fuser->hasRight('supplier_proposal', $lire) || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1;
}
$original_file = $conf->supplier_proposal->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file;
} elseif ($modulepart == 'massfilesarea_supplier_order') {
if ($fuser->rights->fournisseur->commande->{$lire} || preg_match('/^specimen/i', $original_file)) {
if ($fuser->hasRight('fournisseur', 'commande', $lire) || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1;
}
$original_file = $conf->fournisseur->commande->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file;
} elseif ($modulepart == 'massfilesarea_supplier_invoice') {
if ($fuser->rights->fournisseur->facture->{$lire} || preg_match('/^specimen/i', $original_file)) {
if ($fuser->hasRight('fournisseur', 'facture', $lire) || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1;
}
$original_file = $conf->fournisseur->facture->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file;
} elseif ($modulepart == 'massfilesarea_contract' && !empty($conf->contrat->dir_output)) {
if ($fuser->rights->contrat->{$lire} || preg_match('/^specimen/i', $original_file)) {
if ($fuser->hasRight('contrat', $lire) || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1;
}
$original_file = $conf->contrat->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file;
} elseif (($modulepart == 'fichinter' || $modulepart == 'ficheinter') && !empty($conf->ficheinter->dir_output)) {
// Wrapping for interventions
if ($fuser->rights->ficheinter->{$lire} || preg_match('/^specimen/i', $original_file)) {
if ($fuser->hasRight('ficheinter', $lire) || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1;
}
$original_file = $conf->ficheinter->dir_output.'/'.$original_file;
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."fichinter WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity;
} elseif ($modulepart == 'deplacement' && !empty($conf->deplacement->dir_output)) {
// Wrapping pour les deplacements et notes de frais
if ($fuser->rights->deplacement->{$lire} || preg_match('/^specimen/i', $original_file)) {
if ($fuser->hasRight('deplacement', $lire) || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1;
}
$original_file = $conf->deplacement->dir_output.'/'.$original_file;
//$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."fichinter WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity;
} elseif (($modulepart == 'propal' || $modulepart == 'propale') && !empty($conf->propal->multidir_output[$entity])) {
} elseif (($modulepart == 'propal' || $modulepart == 'propale') && isset($conf->propal->multidir_output[$entity])) {
// Wrapping pour les propales
if ($fuser->rights->propal->{$lire} || preg_match('/^specimen/i', $original_file)) {
if ($fuser->hasRight('propal', $lire) || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1;
}
$original_file = $conf->propal->multidir_output[$entity].'/'.$original_file;
@ -2903,7 +2903,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."commande WHERE ref='".$db->escape($refname)."' AND entity IN (".getEntity('order').")";
} elseif ($modulepart == 'project' && !empty($conf->project->dir_output)) {
// Wrapping pour les projets
if ($fuser->rights->projet->{$lire} || preg_match('/^specimen/i', $original_file)) {
if ($fuser->hasRight('projet', $lire) || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1;
// If we known $id of project, call checkUserAccessToObject to check permission on properties and contact of project
if ($refname && !preg_match('/^specimen/i', $original_file)) {
@ -2916,7 +2916,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
$original_file = $conf->project->dir_output.'/'.$original_file;
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."projet WHERE ref='".$db->escape($refname)."' AND entity IN (".getEntity('project').")";
} elseif ($modulepart == 'project_task' && !empty($conf->project->dir_output)) {
if ($fuser->rights->projet->{$lire} || preg_match('/^specimen/i', $original_file)) {
if ($fuser->hasRight('projet', $lire) || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1;
// If we known $id of project, call checkUserAccessToObject to check permission on properties and contact of project
if ($refname && !preg_match('/^specimen/i', $original_file)) {
@ -2951,7 +2951,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."paiementfournisseur WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity;
} elseif ($modulepart == 'facture_paiement' && !empty($conf->facture->dir_output)) {
// Wrapping pour les rapport de paiements
if ($fuser->rights->facture->{$lire} || preg_match('/^specimen/i', $original_file)) {
if ($fuser->hasRight('facture', $lire) || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1;
}
if ($fuser->socid > 0) {
@ -2967,26 +2967,26 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
$original_file = $conf->accounting->dir_output.'/'.$original_file;
} elseif (($modulepart == 'expedition' || $modulepart == 'shipment') && !empty($conf->expedition->dir_output)) {
// Wrapping pour les expedition
if ($fuser->rights->expedition->{$lire} || preg_match('/^specimen/i', $original_file)) {
if ($fuser->hasRight('expedition', $lire) || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1;
}
$original_file = $conf->expedition->dir_output."/".(strpos('sending/', $original_file) === 0 ? '' : 'sending/').$original_file;
//$original_file = $conf->expedition->dir_output."/".$original_file;
} elseif (($modulepart == 'livraison' || $modulepart == 'delivery') && !empty($conf->expedition->dir_output)) {
// Delivery Note Wrapping
if ($fuser->rights->expedition->delivery->{$lire} || preg_match('/^specimen/i', $original_file)) {
if ($fuser->hasRight('expedition', 'delivery', $lire) || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1;
}
$original_file = $conf->expedition->dir_output."/".(strpos('receipt/', $original_file) === 0 ? '' : 'receipt/').$original_file;
} elseif ($modulepart == 'actions' && !empty($conf->agenda->dir_output)) {
// Wrapping pour les actions
if ($fuser->rights->agenda->myactions->{$read} || preg_match('/^specimen/i', $original_file)) {
if ($fuser->hasRight('agenda', 'myactions', $read) || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1;
}
$original_file = $conf->agenda->dir_output.'/'.$original_file;
} elseif ($modulepart == 'actionsreport' && !empty($conf->agenda->dir_temp)) {
// Wrapping pour les actions
if ($fuser->rights->agenda->allactions->{$read} || preg_match('/^specimen/i', $original_file)) {
if ($fuser->hasRight('agenda', 'allactions', $read) || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1;
}
$original_file = $conf->agenda->dir_temp."/".$original_file;
@ -2995,7 +2995,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
if (empty($entity) || (empty($conf->product->multidir_output[$entity]) && empty($conf->service->multidir_output[$entity]))) {
return array('accessallowed'=>0, 'error'=>'Value entity must be provided');
}
if (($fuser->rights->produit->{$lire} || $fuser->rights->service->{$lire}) || preg_match('/^specimen/i', $original_file)) {
if (($fuser->hasRight('produit', $lire) || $fuser->hasRight('service', $lire)) || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1;
}
if (isModEnabled("product")) {
@ -3008,7 +3008,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
if (empty($entity) || (empty($conf->productbatch->multidir_output[$entity]))) {
return array('accessallowed'=>0, 'error'=>'Value entity must be provided');
}
if (($fuser->rights->produit->{$lire} ) || preg_match('/^specimen/i', $original_file)) {
if (($fuser->hasRight('produit', $lire)) || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1;
}
if (isModEnabled('productbatch')) {
@ -3019,7 +3019,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
if (empty($entity) || empty($conf->stock->multidir_output[$entity])) {
return array('accessallowed'=>0, 'error'=>'Value entity must be provided');
}
if (($fuser->rights->stock->{$lire} || $fuser->rights->stock->movement->{$lire} || $fuser->rights->stock->mouvement->{$lire}) || preg_match('/^specimen/i', $original_file)) {
if (($fuser->hasRight('stock', $lire) || $fuser->hasRight('stock', 'movement', $lire) || $fuser->hasRight('stock', 'mouvement', $lire)) || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1;
}
if (isModEnabled('stock')) {
@ -3034,26 +3034,26 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."contrat WHERE ref='".$db->escape($refname)."' AND entity IN (".getEntity('contract').")";
} elseif ($modulepart == 'donation' && !empty($conf->don->dir_output)) {
// Wrapping pour les dons
if ($fuser->rights->don->{$lire} || preg_match('/^specimen/i', $original_file)) {
if ($fuser->hasRight('don', $lire) || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1;
}
$original_file = $conf->don->dir_output.'/'.$original_file;
} elseif ($modulepart == 'dolresource' && !empty($conf->resource->dir_output)) {
// Wrapping pour les dons
if ($fuser->rights->resource->{$read} || preg_match('/^specimen/i', $original_file)) {
if ($fuser->hasRight('resource', $read) || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1;
}
$original_file = $conf->resource->dir_output.'/'.$original_file;
} elseif (($modulepart == 'remisecheque' || $modulepart == 'chequereceipt') && !empty($conf->bank->dir_output)) {
// Wrapping pour les remises de cheques
if ($fuser->rights->banque->{$lire} || preg_match('/^specimen/i', $original_file)) {
if ($fuser->hasRight('banque', $lire) || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1;
}
$original_file = $conf->bank->dir_output.'/checkdeposits/'.$original_file; // original_file should contains relative path so include the get_exdir result
} elseif (($modulepart == 'banque' || $modulepart == 'bank') && !empty($conf->bank->dir_output)) {
// Wrapping for bank
if ($fuser->rights->banque->{$lire}) {
if ($fuser->hasRight('banque', $lire)) {
$accessallowed = 1;
}
$original_file = $conf->bank->dir_output.'/'.$original_file;
@ -3096,7 +3096,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
$original_file = $conf->bittorrent->dir_output.'/'.$dir.'/'.$original_file;
} elseif ($modulepart == 'member' && !empty($conf->adherent->dir_output)) {
// Wrapping pour Foundation module
if ($fuser->rights->adherent->{$lire} || preg_match('/^specimen/i', $original_file)) {
if ($fuser->hasRight('adherent', $lire) || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1;
}
$original_file = $conf->adherent->dir_output.'/'.$original_file;

View File

@ -11605,7 +11605,7 @@ function forgeSQLFromUniversalSearchCriteria($filter, &$error = '')
return '1 = 3'; // Bad syntax of the search string, we force a SQL not found
}
return " AND (".preg_replace_callback('/'.$regexstring.'/', 'dolForgeCriteriaCallback', $filter).")";
return " AND (".preg_replace_callback('/'.$regexstring.'/i', 'dolForgeCriteriaCallback', $filter).")";
}
/**

View File

@ -2510,6 +2510,8 @@ function pdf_getSizeForImage($realpath)
$maxheight = (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_HEIGHT) ? 32 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_HEIGHT);
include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
$tmp = dol_getImageSize($realpath);
$width = 0;
$height = 0;
if ($tmp['height']) {
$width = (int) round($maxheight * $tmp['width'] / $tmp['height']); // I try to use maxheight
if ($width > $maxwidth) { // Pb with maxheight, so i use maxwidth

View File

@ -104,7 +104,7 @@ class modProduct extends DolibarrModules
// Boxes
$this->boxes = array(
0=>array('file'=>'box_produits.php', 'enabledbydefaulton'=>'Home'),
1=>array('file'=>'box_produits_alerte_stock.php', 'enabledbydefaulton'=>''),
1=>array('file'=>'box_produits_alerte_stock.php', 'enabledbydefaulton'=>'Home'),
2=>array('file'=>'box_graph_product_distribution.php', 'enabledbydefaulton'=>'Home')
);

View File

@ -1793,8 +1793,8 @@ class FichinterLigne extends CommonObjectLine
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter";
$sql .= " SET duree = ".((int) $total_duration);
$sql .= " , dateo = ".(!empty($obj->dateo) ? "'".$this->db->idate($obj->dateo)."'" : "null");
$sql .= " , datee = ".(!empty($obj->datee) ? "'".$this->db->idate($obj->datee)."'" : "null");
$sql .= " , dateo = ".(!empty($obj->dateo) ? "'".$this->db->escape($obj->dateo)."'" : "null");
$sql .= " , datee = ".(!empty($obj->datee) ? "'".$this->db->escape($obj->datee)."'" : "null");
$sql .= " WHERE rowid = ".((int) $this->fk_fichinter);
dol_syslog("FichinterLigne::update_total", LOG_DEBUG);

View File

@ -167,9 +167,9 @@ ACCOUNTANCY_COMBO_FOR_AUX=Enable combo list for subsidiary account (may be slow
ACCOUNTING_DATE_START_BINDING=Define a date to start binding & transfer in accountancy. Below this date, the transactions will not be transferred to accounting.
ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER=On accountancy transfer, what is the period selected by default
ACCOUNTING_SELL_JOURNAL=Sales journal (sales and returns)
ACCOUNTING_PURCHASE_JOURNAL=Purchase journal (purchase and returns)
ACCOUNTING_BANK_JOURNAL=Cash journal (receipts and disbursements)
ACCOUNTING_SELL_JOURNAL=Sales journal - sales and returns
ACCOUNTING_PURCHASE_JOURNAL=Purchase journal - purchase and returns
ACCOUNTING_BANK_JOURNAL=Cash journal - receipts and disbursements
ACCOUNTING_EXPENSEREPORT_JOURNAL=Expense report journal
ACCOUNTING_MISCELLANEOUS_JOURNAL=General journal
ACCOUNTING_HAS_NEW_JOURNAL=Has new Journal
@ -238,6 +238,7 @@ ConfirmDeleteMvt=This will delete all lines in accountancy for the year/month an
ConfirmDeleteMvtPartial=This will delete the transaction from the accounting (all lines related to the same transaction will be deleted)
FinanceJournal=Finance journal
ExpenseReportsJournal=Expense reports journal
InventoryJournal=Inventory journal
DescFinanceJournal=Finance journal including all the types of payments by bank account
DescJournalOnlyBindedVisible=This is a view of record that are bound to an accounting account and can be recorded into the Journals and Ledger.
VATAccountNotDefined=Account for VAT not defined

View File

@ -4,6 +4,8 @@ MemberCard=Member card
SubscriptionCard=Subscription card
Member=Member
Members=Members
NoRecordedMembers=No recorded members
NoRecordedMembersByType=No recorded members
ShowMember=Show member card
UserNotLinkedToMember=User not linked to a member
ThirdpartyNotLinkedToMember=Third party not linked to a member

View File

@ -422,7 +422,7 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $
// Output page
// --------------------------------------------------------------------
llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist');
llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist'); // Can use also classforhorizontalscrolloftabs instead of bodyforlist for no horizontal scroll
// Example : Adding jquery code
// print '<script type="text/javascript">

View File

@ -373,7 +373,7 @@ class Partnership extends CommonObject
$sql = 'SELECT p.rowid, p.ref, p.fk_type, p.fk_soc, p.fk_member, p.status';
$sql .= ', p.entity, p.date_partnership_start, p.date_partnership_end, p.date_creation';
$sql .= ', p.fk_user_creat, p.tms, p.fk_user_modif, p.fk_user_modif';
$sql .= ', p.note_private, p.note_public';
$sql .= ', p.note_private, p.note_public, p.url_to_check';
$sql .= ', p.last_main_doc, p.count_last_url_check_error, p.last_check_backlink, p.reason_decline_or_cancel';
$sql .= ', p.import_key, p.model_pdf';
$sql .= ', pt.code as type_code, pt.label as type_label';
@ -381,7 +381,7 @@ class Partnership extends CommonObject
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_partnership_type as pt ON p.fk_type = pt.rowid';
if ($id) {
$sql .= " WHERE p.rowid=".((int) $id);
$sql .= " WHERE p.rowid = ".((int) $id);
} else {
$sql .= " WHERE p.entity IN (0,".getEntity('partnership').")"; // Dont't use entity if you use rowid
}
@ -428,6 +428,7 @@ class Partnership extends CommonObject
$this->reason_decline_or_cancel = $obj->reason_decline_or_cancel;
$this->import_key = $obj->import_key;
$this->model_pdf = $obj->model_pdf;
$this->url_to_check = $obj->url_to_check;
// Retrieve all extrafield
// fetch optionals attributes and labels

View File

@ -564,9 +564,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle');
}
if ($object->status == $object::STATUS_DRAFT) {
print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd);
}
print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd);
// Back to draft
if ($object->status != $object::STATUS_DRAFT) {

View File

@ -467,7 +467,7 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $
// Output page
// --------------------------------------------------------------------
llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'classforhorizontalscrolloftabs');
llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', '');
if ($managedfor == "member") {
if ($memberid > 0 && $user->hasRight('adherent', 'lire')) {

View File

@ -1575,11 +1575,12 @@ table[summary="list_of_modules"] .fa-cog {
height: 100px;
}
.maxscreenheightless200 {
max-height: <?php echo isset($_SESSION['dol_screenheight']) ? max(500, $_SESSION['dol_screenheight'] - 200) : 700; ?>px; /* we guarantee height of 500 */
.ls -alrt
vi {
max-height: <?php echo isset($_SESSION['dol_screenheight']) ? max(500, (int) $_SESSION['dol_screenheight'] - 200) : 700; ?>px; /* we guarantee height of 500 */
}
.maxscreenheightless300 {
max-height: <?php echo isset($_SESSION['dol_screenheight']) ? max(400, $_SESSION['dol_screenheight'] - 300) : 700; ?>px; /* we guarantee height of 500 */
max-height: <?php echo isset($_SESSION['dol_screenheight']) ? max(400, (int) $_SESSION['dol_screenheight'] - 300) : 700; ?>px; /* we guarantee height of 500 */
}
@ -4557,13 +4558,13 @@ ul.noborder li:nth-child(even):not(.liste_titre) {
.thumbstat {
flex: 1 1 110px;
margin-bottom: 8px;
min-width: <?php echo isset($_SESSION['dol_screenwidth']) ?min(160, round($_SESSION['dol_screenwidth'] / 2 - 20)) : 150; ?>px; /* on screen < 320, we guaranty to have 2 columns */
min-width: <?php echo isset($_SESSION['dol_screenwidth']) ?min(160, round((int) $_SESSION['dol_screenwidth'] / 2 - 20)) : 150; ?>px; /* on screen < 320, we guaranty to have 2 columns */
}
.thumbstat150 {
flex: 1 1 110px;
margin-bottom: 8px;
min-width: <?php echo isset($_SESSION['dol_screenwidth']) ?min(160, round($_SESSION['dol_screenwidth'] / 2 - 20)) : 160; ?>px; /* on screen < 320, we guaranty to have 2 columns */
max-width: <?php echo isset($_SESSION['dol_screenwidth']) ?min(161, round($_SESSION['dol_screenwidth'] / 2 - 20)) : 161; ?>px; /* on screen < 320, we guaranty to have 2 columns */
min-width: <?php echo isset($_SESSION['dol_screenwidth']) ?min(160, round((int) $_SESSION['dol_screenwidth'] / 2 - 20)) : 160; ?>px; /* on screen < 320, we guaranty to have 2 columns */
max-width: <?php echo isset($_SESSION['dol_screenwidth']) ?min(161, round((int) $_SESSION['dol_screenwidth'] / 2 - 20)) : 161; ?>px; /* on screen < 320, we guaranty to have 2 columns */
/* width: ...px; If I use with, there is trouble on size of flex boxes solved with min + (max that is a little bit higer than min) */
}
.dashboardlineindicator {
@ -5897,7 +5898,7 @@ pre#editfilecontentaceeditorid {
/* ============================================================================== */
div.scroll2 {
width: <?php print isset($_SESSION['dol_screenwidth']) ?max($_SESSION['dol_screenwidth'] - 830, 450) : '450'; ?>px !important;
width: <?php print isset($_SESSION['dol_screenwidth']) ?max((int) $_SESSION['dol_screenwidth'] - 830, 450) : '450'; ?>px !important;
}
div#GanttChartDIVglisthead, div#GanttChartDIVgcharthead {

View File

@ -1799,10 +1799,10 @@ table[summary="list_of_modules"] .fa-cog {
}
.maxscreenheightless200 {
max-height: <?php echo isset($_SESSION['dol_screenheight']) ? max(500, $_SESSION['dol_screenheight'] - 200) : 700; ?>px; /* we guarantee height of 500 */
max-height: <?php echo isset($_SESSION['dol_screenheight']) ? max(500, (int) $_SESSION['dol_screenheight'] - 200) : 700; ?>px; /* we guarantee height of 500 */
}
.maxscreenheightless300 {
max-height: <?php echo isset($_SESSION['dol_screenheight']) ? max(400, $_SESSION['dol_screenheight'] - 300) : 700; ?>px; /* we guarantee height of 500 */
max-height: <?php echo isset($_SESSION['dol_screenheight']) ? max(400, (int) $_SESSION['dol_screenheight'] - 300) : 700; ?>px; /* we guarantee height of 500 */
}
tr.nobottom td {
@ -5877,7 +5877,7 @@ pre#editfilecontentaceeditorid {
/* ============================================================================== */
div.scroll2 {
width: <?php print isset($_SESSION['dol_screenwidth']) ?max($_SESSION['dol_screenwidth'] - 830, 450) : '450'; ?>px !important;
width: <?php print isset($_SESSION['dol_screenwidth']) ?max((int) $_SESSION['dol_screenwidth'] - 830, 450) : '450'; ?>px !important;
}
div#GanttChartDIVglisthead, div#GanttChartDIVgcharthead {