Skip to content

Commit

Permalink
Merge branch '18.0' of https://github.com/Dolibarr/dolibarr into 18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
FHenry committed Feb 22, 2024
2 parents ed6146f + 9874d00 commit b9bd615
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 17 deletions.
8 changes: 4 additions & 4 deletions htdocs/compta/resultat/result.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@
print '<th class="liste_titre right">'.$langs->trans("PreviousPeriod").'</th>';
print '<th class="liste_titre right">'.$langs->trans("SelectedPeriod").'</th>';
foreach ($months as $k => $v) {
if (($k + 1) >= $date_startmonth) {
if (($k + 1) >= $date_startmonth && $k < $date_endmonth) {
print '<th class="liste_titre right width50">'.$langs->trans('MonthShort'.sprintf("%02s", ($k + 1))).'</th>';
}
}
Expand Down Expand Up @@ -392,7 +392,7 @@

// Detail by month
foreach ($months as $k => $v) {
if (($k + 1) >= $date_startmonth) {
if (($k + 1) >= $date_startmonth && $k < $date_endmonth) {
foreach ($sommes as $code => $det) {
$vars[$code] = empty($det['M'][$k]) ? 0 : $det['M'][$k];
}
Expand Down Expand Up @@ -591,7 +591,7 @@

// Each month
foreach ($totCat['M'] as $k => $v) {
if (($k + 1) >= $date_startmonth) {
if (($k + 1) >= $date_startmonth && $k < $date_endmonth) {
print '<td class="right nowraponall"><span class="amount">'.price($v).'</span></td>';
}
}
Expand Down Expand Up @@ -632,7 +632,7 @@

// Make one call for each month
foreach ($months as $k => $v) {
if (($k + 1) >= $date_startmonth) {
if (($k + 1) >= $date_startmonth && $k < $date_endmonth) {
if (isset($cpt['account_number'])) {
$resultM = $totPerAccount[$cpt['account_number']]['M'][$k];
} else {
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/customreports.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
// Objects available by default
$arrayoftype = array(
'thirdparty' => array('langs'=>'companies', 'label' => 'ThirdParties', 'picto'=>'company', 'ObjectClassName' => 'Societe', 'enabled' => isModEnabled('societe'), 'ClassPath' => "/societe/class/societe.class.php"),
'contact' => array('label' => 'Contacts', 'picto'=>'contact', 'ObjectClassName' => 'Contact', 'enabled' => isModEnabled('societ'), 'ClassPath' => "/contact/class/contact.class.php"),
'contact' => array('label' => 'Contacts', 'picto'=>'contact', 'ObjectClassName' => 'Contact', 'enabled' => isModEnabled('societe'), 'ClassPath' => "/contact/class/contact.class.php"),
'proposal' => array('label' => 'Proposals', 'picto'=>'proposal', 'ObjectClassName' => 'Propal', 'enabled' => isModEnabled('propal'), 'ClassPath' => "/comm/propal/class/propal.class.php"),
'order' => array('label' => 'Orders', 'picto'=>'order', 'ObjectClassName' => 'Commande', 'enabled' => isModEnabled('commande'), 'ClassPath' => "/commande/class/commande.class.php"),
'invoice' => array('langs'=>'facture', 'label' => 'Invoices', 'picto'=>'bill', 'ObjectClassName' => 'Facture', 'enabled' => isModEnabled('facture'), 'ClassPath' => "/compta/facture/class/facture.class.php"),
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/lib/files.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -2605,7 +2605,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
// Find the subdirectory name as the reference. For example original_file='10/myfile.pdf' -> refname='10'
if (empty($refname)) {
$refname = basename(dirname($original_file)."/");
if ($refname == 'thumbs') {
if ($refname == 'thumbs' || $refname == 'temp') {
// If we get the thumbs directory, we must go one step higher. For example original_file='10/thumbs/myfile_small.jpg' -> refname='10'
$refname = basename(dirname(dirname($original_file))."/");
}
Expand Down
4 changes: 4 additions & 0 deletions htdocs/core/menus/init_menu_auguria.sql
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,10 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '(isModEnabled("takepos") || isModEnabled("cashdesk"))', __HANDLER__, 'left', 6100__+MAX_llx_menu__, 'bank', 'cashcontrol', 14__+MAX_llx_menu__, '/compta/cashcontrol/cashcontrol_list.php?mainmenu=bank&amp;action=list', 'CashControl', 0, 'cashdesk', '$user->hasRight("cashdesk", "run")|| $user->hasRight("takepos", "run")', '', 2, 6, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '(isModEnabled("takepos") || isModEnabled("cashdesk") && $leftmenu=="cashcontrol")', __HANDLER__, 'left', 6101__+MAX_llx_menu__, 'bank', 'cashcontrol', 6100__+MAX_llx_menu__, '/compta/cashcontrol/cashcontrol_card.php?mainmenu=bank&amp;action=create', 'NewCashFence', 1, 'cashdesk', '$user->hasRight("cashdesk", "run")|| $user->hasRight("takepos", "run")', '', 2, 6, __ENTITY__);

-- Bank - Cash control POS
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '(isModEnabled("takepos") || isModEnabled("cashdesk"))', __HANDLER__, 'left', 6100__+MAX_llx_menu__, 'bank', 'cashcontrol', 14__+MAX_llx_menu__, '/compta/cashcontrol/cashcontrol_list.php?mainmenu=bank&amp;action=list', 'CashControl', 0, 'cashdesk', '$user->hasRight("cashdesk", "run")|| $user->hasRight("takepos", "run")', '', 2, 6, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '(isModEnabled("takepos") || isModEnabled("cashdesk") && $leftmenu=="cashcontrol")', __HANDLER__, 'left', 6101__+MAX_llx_menu__, 'bank', 'cashcontrol', 6100__+MAX_llx_menu__, '/compta/cashcontrol/cashcontrol_card.php?mainmenu=bank&amp;action=create', 'NewCashFence', 1, 'cashdesk', '$user->hasRight("cashdesk", "run")|| $user->hasRight("takepos", "run")', '', 2, 6, __ENTITY__);


-- Project
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("project")', __HANDLER__, 'left', 3600__+MAX_llx_menu__, 'project', 'projects', 7__+MAX_llx_menu__, '/projet/index.php?mainmenu=project&amp;leftmenu=projects', 'LeadsOrProjects', 0, 'projects', '$user->hasRight("projet","lire")', '', 2, 0, __ENTITY__);
Expand Down
11 changes: 5 additions & 6 deletions htdocs/document.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,20 +209,17 @@ function llxFooter()
$original_file = str_replace('..\\', '/', $original_file);


// Find the subdirectory name as the reference
$refname = basename(dirname($original_file)."/");

// Security check
if (empty($modulepart)) {
accessforbidden('Bad value for parameter modulepart');
}

// Check security and set return info with full path of file
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, $user, $refname);
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, $user, '');
$accessallowed = $check_access['accessallowed'];
$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals'];
$fullpath_original_file = $check_access['original_file']; // $fullpath_original_file is now a full path name
//var_dump($fullpath_original_file.' '.$original_file.' '.$refname.' '.$accessallowed);exit;
//var_dump($fullpath_original_file.' '.$original_file.' '.$accessallowed);exit;

if (!empty($hashp)) {
$accessallowed = 1; // When using hashp, link is public so we force $accessallowed
Expand Down Expand Up @@ -282,7 +279,7 @@ function llxFooter()
// Hooks
$hookmanager->initHooks(array('document'));
$parameters = array('ecmfile' => $ecmfile, 'modulepart' => $modulepart, 'original_file' => $original_file,
'entity' => $entity, 'refname' => $refname, 'fullpath_original_file' => $fullpath_original_file,
'entity' => $entity, 'fullpath_original_file' => $fullpath_original_file,
'filename' => $filename, 'fullpath_original_file_osencoded' => $fullpath_original_file_osencoded);
$object = new stdClass();
$reshook = $hookmanager->executeHooks('downloadDocument', $parameters, $object, $action); // Note that $action and $object may have been
Expand All @@ -293,13 +290,15 @@ function llxFooter()
exit;
}


// Permissions are ok and file found, so we return it
top_httphead($type);
header('Content-Description: File Transfer');
if ($encoding) {
header('Content-Encoding: '.$encoding);
}
// Add MIME Content-Disposition from RFC 2183 (inline=automatically displayed, attachment=need user action to open)

if ($attachment) {
header('Content-Disposition: attachment; filename="'.$filename.'"');
} else {
Expand Down
5 changes: 3 additions & 2 deletions htdocs/fichinter/class/fichinter.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,8 @@ public function setValid($user, $notrigger = 0)
$sql .= ", date_valid = '".$this->db->idate($now)."'";
$sql .= ", fk_user_valid = ".($user->id > 0 ? (int) $user->id : "null");
$sql .= " WHERE rowid = ".((int) $this->id);
$sql .= " AND entity = ".((int) $conf->entity);
$sql .= " AND entity = ".((int) $this->entity);

$sql .= " AND fk_statut = 0";

dol_syslog(get_class($this)."::setValid", LOG_DEBUG);
Expand Down Expand Up @@ -620,7 +621,7 @@ public function setValid($user, $notrigger = 0)

// Now we rename also files into index
$sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filename = CONCAT('".$this->db->escape($this->newref)."', SUBSTR(filename, ".(strlen($this->ref) + 1).")), filepath = 'ficheinter/".$this->db->escape($this->newref)."'";
$sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'ficheinter/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
$sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'ficheinter/".$this->db->escape($this->ref)."' and entity = ".((int) $this->entity);
$resql = $this->db->query($sql);
if (!$resql) {
$error++; $this->error = $this->db->lasterror();
Expand Down
5 changes: 3 additions & 2 deletions htdocs/product/stock/replenish.php
Original file line number Diff line number Diff line change
Expand Up @@ -939,15 +939,16 @@
print '<td class="right"><a href="replenishorders.php?search_product='.$prod->id.'">'.$ordered.'</a> '.$picto.'</td>';

// To order
print '<td class="right"><input type="text" size="4" name="tobuy'.$i.'" value="'.((!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE) && $fk_entrepot > 0) > 0 ? $stocktobuywarehouse : $stocktobuy).'"></td>';
$tobuy = (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE) && $fk_entrepot > 0) > 0 ? $stocktobuywarehouse : $stocktobuy;
print '<td class="right"><input type="text" size="4" name="tobuy'.$i.'" value="'.$tobuy.'"></td>';

// Supplier
print '<td class="right">';
print $form->select_product_fourn_price($prod->id, 'fourn'.$i, $fk_supplier);
print '</td>';

// Fields from hook
$parameters = array('objp'=>$objp);
$parameters = array('objp'=>$objp, 'i'=>$i, 'tobuy'=>$tobuy);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;

Expand Down
2 changes: 1 addition & 1 deletion htdocs/societe/card.php
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@
}
$object->entity = (GETPOSTISSET('entity') ? GETPOST('entity', 'int') : $conf->entity);
$object->name_alias = GETPOST('name_alias', 'alphanohtml');
$object->parent = GETPOST('parent_company_id', 'int');
$object->parent = GETPOSTISSET('parent_company_id') ? GETPOST('parent_company_id', 'int') : $object->parent;
$object->address = GETPOST('address', 'alphanohtml');
$object->zip = GETPOST('zipcode', 'alphanohtml');
$object->town = GETPOST('town', 'alphanohtml');
Expand Down

0 comments on commit b9bd615

Please sign in to comment.