Merge remote-tracking branch 'upstream/develop' into zapieruser

This commit is contained in:
Frédéric FRANCE 2020-11-05 08:29:35 +01:00
commit b534dd57d9
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
14 changed files with 73 additions and 57 deletions

View File

@ -347,7 +347,7 @@ class FactureRec extends CommonInvoice
{
// Extrafields
if (method_exists($facsrc->lines[$i], 'fetch_optionals')) {
$facsrc->lines[$i]->fetch_optionals($facsrc->lines[$i]->id);
$facsrc->lines[$i]->fetch_optionals($facsrc->lines[$i]->rowid);
$objectline->array_options = $facsrc->lines[$i]->array_options;
}
@ -360,8 +360,8 @@ class FactureRec extends CommonInvoice
}
}
if (!empty($this->linkedObjectsIds) && empty($this->linked_objects)) {
// To use new linkedObjectsIds instead of old linked_objects
if (!empty($this->linkedObjectsIds) && empty($this->linked_objects)) // To use new linkedObjectsIds instead of old linked_objects
{
$this->linked_objects = $this->linkedObjectsIds; // TODO Replace linked_objects with linkedObjectsIds
}
@ -381,8 +381,8 @@ class FactureRec extends CommonInvoice
$error++;
}
}
} else {
// Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1))
} else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1))
{
$origin_id = $tmp_origin_id;
$ret = $this->add_object_linked($origin, $origin_id);
if (!$ret)

View File

@ -1553,7 +1553,6 @@ class Facture extends CommonInvoice
$this->ref = $obj->ref;
$this->ref_client = $obj->ref_client;
$this->ref_ext = $obj->ref_ext;
$this->ref_int = $obj->ref_int;
$this->type = $obj->type;
$this->date = $this->db->jdate($obj->df);
$this->date_pointoftax = $this->db->jdate($obj->date_pointoftax);

View File

@ -30,8 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsocialcontrib.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
if (!empty($conf->projet->enabled))
{
if (!empty($conf->projet->enabled)) {
include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
}
@ -124,8 +123,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes')
{
$object->fetch($id);
$result = $object->delete($user);
if ($result > 0)
{
if ($result > 0) {
header("Location: list.php");
exit;
} else {
@ -137,7 +135,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes')
// Add social contribution
if ($action == 'add' && $user->rights->tax->charges->creer)
{
$amount = price2num(GETPOST('amount'));
$amount = price2num(GETPOST('amount'), 'MT');
if (!$dateech)
{
@ -155,23 +153,21 @@ if ($action == 'add' && $user->rights->tax->charges->creer)
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount")), null, 'errors');
$action = 'create';
} elseif (!is_numeric($amount))
{
} elseif (!is_numeric($amount)) {
setEventMessages($langs->trans("ErrorFieldMustBeANumeric", $langs->transnoentities("Amount")), null, 'errors');
$action = 'create';
} else {
$object->type = $actioncode;
$object->label = GETPOST('label', 'alpha');
$object->date_ech = $dateech;
$object->periode = $dateperiod;
$object->amount = $amount;
$object->mode_reglement_id = GETPOST('mode_reglement_id');
$object->fk_account = GETPOST('fk_account', 'int');
$object->fk_project = GETPOST('fk_project');
$object->periode = $dateperiod;
$object->amount = $amount;
$object->mode_reglement_id = (int) GETPOST('mode_reglement_id', 'int');
$object->fk_account = (int) GETPOST('fk_account', 'int');
$object->fk_project = (int) GETPOST('fk_project', 'int');
$id = $object->create($user);
if ($id <= 0)
{
if ($id <= 0) {
setEventMessages($object->error, $object->errors, 'errors');
$action = 'create';
}
@ -181,7 +177,7 @@ if ($action == 'add' && $user->rights->tax->charges->creer)
if ($action == 'update' && !$_POST["cancel"] && $user->rights->tax->charges->creer)
{
$amount = price2num(GETPOST('amount'));
$amount = price2num(GETPOST('amount'), 'MT');
if (!$dateech)
{
@ -203,12 +199,11 @@ if ($action == 'update' && !$_POST["cancel"] && $user->rights->tax->charges->cre
$result = $object->fetch($id);
$object->date_ech = $dateech;
$object->periode = $dateperiod;
$object->amount = price2num($amount);
$object->periode = $dateperiod;
$object->amount = $amount;
$result = $object->update($user);
if ($result <= 0)
{
if ($result <= 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
}

View File

@ -659,11 +659,11 @@ function checkVal($out = '', $check = 'alphanohtml', $filter = null, $options =
break;
case 'alpha': // No html and no " and no ../
case 'alphanohtml': // Recommended for most scalar parameters and search parameters
if (!is_array($out))
{
if (!is_array($out)) {
// '"' is dangerous because param in url can close the href= or src= and add javascript functions.
// '../' is dangerous because it allows dir transversals
$out = str_replace(array('&quot;', '"', '../'), '', trim($out));
// keep lines feed
$out = dol_string_nohtmltag($out, 0);
}
break;

View File

@ -765,8 +765,8 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
$newmenu->add('/admin/system/phpinfo.php?mainmenu=home&amp;leftmenu=admintools', $langs->trans('InfoPHP'), 1);
$newmenu->add('/admin/system/database.php?mainmenu=home&amp;leftmenu=admintools', $langs->trans('InfoDatabase'), 1);
if (!empty($conf->global->MAIN_FEATURES_LEVEL)) {
$newmenu->add("/admin/system/perf.php?mainmenu=home&amp;leftmenu=admintools", $langs->trans("InfoPerf"),1);
$newmenu->add("/admin/system/security.php?mainmenu=home&amp;leftmenu=admintools", $langs->trans("InfoSecurity"),1);
$newmenu->add("/admin/system/perf.php?mainmenu=home&amp;leftmenu=admintools", $langs->trans("InfoPerf"), 1);
$newmenu->add("/admin/system/security.php?mainmenu=home&amp;leftmenu=admintools", $langs->trans("InfoSecurity"), 1);
}
$newmenu->add("/admin/tools/dolibarr_export.php?mainmenu=home&amp;leftmenu=admintools", $langs->trans("Backup"), 1);
$newmenu->add("/admin/tools/dolibarr_import.php?mainmenu=home&amp;leftmenu=admintools", $langs->trans("Restore"), 1);

View File

@ -243,6 +243,23 @@ if (!file_exists($fullpath_original_file_osencoded))
exit;
}
// Hooks
if (!is_object($hookmanager)) {
include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
$hookmanager = new HookManager($this->db);
}
$hookmanager->initHooks(array('document'));
$parameters = array('ecmfile' => $ecmfile, 'modulepart' => $modulepart, 'original_file' => $original_file,
'entity' => $entity, 'refname' => $refname, 'fullpath_original_file' => $fullpath_original_file,
'filename' => $filename, 'fullpath_original_file_osencoded' => $fullpath_original_file_osencoded);
$reshook = $hookmanager->executeHooks('downloadDocument', $parameters); // Note that $action and $object may have been
if ($reshook < 0) {
$errors = $hookmanager->error . (is_array($hookmanager->errors) ? (!empty($hookmanager->error) ? ', ' : '') . join($separator, $hookmanager->errors) : '');
dol_syslog("document.php - Errors when executing the hook 'downloadDocument' : " . $errors);
print "ErrorDownloadDocumentHooks: " . $errors;
exit;
}
// Permissions are ok and file found, so we return it
top_httphead($type);
header('Content-Description: File Transfer');

View File

@ -1594,7 +1594,10 @@ class ExpenseReport extends CommonObject
if ($short) return $url;
$label = img_picto('', $this->picto).' <u>'.$langs->trans("ExpenseReport").'</u>';
$label = img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("ExpenseReport").'</u>';
if (isset($this->status)) {
$label .= ' '.$this->getLibStatut(5);
}
if (!empty($this->ref))
$label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
if (!empty($this->total_ht))
@ -1603,9 +1606,6 @@ class ExpenseReport extends CommonObject
$label .= '<br><b>'.$langs->trans('VAT').':</b> '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
if (!empty($this->total_ttc))
$label .= '<br><b>'.$langs->trans('AmountTTC').':</b> '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
if (isset($this->status)) {
$label .= '<br><b>'.$langs->trans("Status").":</b> ".$this->getLibStatut(5);
}
if ($moretitle) $label .= ' - '.$moretitle;
//if ($option != 'nolink')

View File

@ -165,8 +165,8 @@ $max = 10;
$langs->load("boxes");
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.statut, u.photo, u.email, u.admin";
$sql .= ", d.rowid, d.ref, d.date_debut as dated, d.date_fin as datef, d.date_create as dm, d.total_ht, d.total_ttc, d.fk_statut as fk_status";
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.statut as user_status, u.photo, u.email, u.admin,";
$sql .= " d.rowid, d.ref, d.date_debut as dated, d.date_fin as datef, d.date_create as dm, d.total_ht, d.total_ttc, d.fk_statut as status";
$sql .= " FROM ".MAIN_DB_PREFIX."expensereport as d, ".MAIN_DB_PREFIX."user as u";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " WHERE u.rowid = d.fk_user_author";
@ -210,16 +210,20 @@ if ($result)
while ($i < $num && $i < $max)
{
$obj = $db->fetch_object($result);
$expensereportstatic->id = $obj->rowid;
$expensereportstatic->ref = $obj->ref;
$expensereportstatic->status = $obj->status;
$userstatic->id = $obj->uid;
$userstatic->admin = $obj->admin;
$userstatic->email = $obj->email;
$userstatic->lastname = $obj->lastname;
$userstatic->firstname = $obj->firstname;
$userstatic->login = $obj->login;
$userstatic->statut = $obj->statut;
$userstatic->statut = $obj->user_status;
$userstatic->photo = $obj->photo;
print '<tr class="oddeven">';
print '<td>'.$expensereportstatic->getNomUrl(1).'</td>';
print '<td>'.$userstatic->getNomUrl(-1).'</td>';
@ -227,7 +231,7 @@ if ($result)
print '<td class="right">'.price($obj->total_ttc).'</td>';
print '<td class="right">'.dol_print_date($db->jdate($obj->dm), 'day').'</td>';
print '<td class="right">';
print $expensereportstatic->LibStatut($obj->fk_status, 3);
print $expensereportstatic->getLibStatut(3);
print '</td>';
print '</tr>';

View File

@ -93,7 +93,6 @@ $search_btn = GETPOST('button_search', 'alpha');
$search_remove_btn = GETPOST('button_removefilter', 'alpha');
$status = GETPOST('statut', 'alpha');
$search_status = GETPOST('search_status');
// Security check
$orderid = GETPOST('orderid', 'int');

View File

@ -1178,11 +1178,11 @@ class Holiday extends CommonObject
$result = '';
$label = img_picto('', $this->picto).' <u>'.$langs->trans("Holiday").'</u>';
$label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
$label = img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("Holiday").'</u>';
if (isset($this->statut)) {
$label .= '<br><b>'.$langs->trans("Status").":</b> ".$this->getLibStatut(5);
$label .= ' '.$this->getLibStatut(5);
}
$label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
$url = DOL_URL_ROOT.'/holiday/card.php?id='.$this->id;

View File

@ -267,7 +267,7 @@ $sql .= $hookmanager->resPrint;
/* If a group by is required
$sql.= " GROUP BY ";
foreach($object->fields as $key => $val)
foreach ($object->fields as $key => $val)
{
$sql.='t.'.$key.', ';
}
@ -277,9 +277,9 @@ if (! empty($extrafields->attributes[$object->table_element]['label'])) {
}
// Add where from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $object may have been modified by hook
$reshook=$hookmanager->executeHooks('printFieldListGroupBy', $parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
$sql=preg_replace('/,\s*$/','', $sql);
$sql=preg_replace('/,\s*$/', '', $sql);
*/
$sql .= $db->order($sortfield, $sortorder);

View File

@ -270,7 +270,7 @@ $sql .= $hookmanager->resPrint;
/* If a group by is required */
$sql.= " GROUP BY ";
foreach($object->fields as $key => $val)
foreach ($object->fields as $key => $val)
{
$sql.='t.'.$key.', ';
}
@ -280,9 +280,9 @@ if (! empty($extrafields->attributes[$object->table_element]['label'])) {
}
// Add where from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $object may have been modified by hook
$reshook=$hookmanager->executeHooks('printFieldListGroupBy', $parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
$sql=preg_replace('/,\s*$/','', $sql);
$sql=preg_replace('/,\s*$/', '', $sql);
$sql .= $db->order($sortfield, $sortorder);

View File

@ -1288,7 +1288,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
print '</td>';
print '<td colspan="3">';
print '<textarea name="address" id="address" class="quatrevingtpercent" rows="'.ROWS_2.'" wrap="soft">';
print dol_escape_htmltag($object->address);
print dol_escape_htmltag($object->address, 0, 1);
print '</textarea>';
print $form->widgetForTranslation("address", $object, $permissiontoadd, 'textarea', 'alphanohtml', 'quatrevingtpercent');
print '</td></tr>';
@ -1889,7 +1889,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
// Address
print '<tr><td class="tdtop">'.$form->editfieldkey('Address', 'address', '', $object, 0).'</td>';
print '<td colspan="3"><textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
print dol_escape_htmltag($object->address);
print dol_escape_htmltag($object->address, 0, 1);
print '</textarea>';
print $form->widgetForTranslation("address", $object, $permissiontoadd, 'textarea', 'alphanohtml', 'quatrevingtpercent');
print '</td></tr>';

View File

@ -396,7 +396,7 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco
{
$holiday = new Holiday($db);
$sql = "SELECT h.rowid, h.statut, h.fk_type, h.date_debut, h.date_fin, h.halfday";
$sql = "SELECT h.rowid, h.statut as status, h.fk_type, h.date_debut, h.date_fin, h.halfday";
$sql .= " FROM ".MAIN_DB_PREFIX."holiday as h";
$sql .= " WHERE h.fk_user = ".$object->id;
$sql .= " AND h.entity = ".$conf->entity;
@ -419,17 +419,18 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco
{
$objp = $db->fetch_object($resql);
print '<tr class="oddeven">';
print '<td class="nowrap">';
$holiday->id = $objp->rowid;
$holiday->ref = $objp->rowid;
$holiday->fk_type = $objp->fk_type;
$holiday->statut = $objp->status;
$nbopenedday = num_open_day($db->jdate($objp->date_debut), $db->jdate($objp->date_fin), 0, 1, $objp->halfday);
print '<tr class="oddeven">';
print '<td class="nowrap">';
print $holiday->getNomUrl(1);
print '</td><td class="right" width="80px">'.dol_print_date($db->jdate($objp->date_debut), 'day')."</td>\n";
print '<td class="right" style="min-width: 60px">'.$nbopenedday.' '.$langs->trans('DurationDays').'</td>';
print '<td class="right" style="min-width: 60px" class="nowrap">'.$holiday->LibStatut($objp->statut, 5).'</td></tr>';
print '<td class="right" style="min-width: 60px" class="nowrap">'.$holiday->LibStatut($objp->status, 5).'</td></tr>';
$i++;
}
$db->free($resql);
@ -450,7 +451,7 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco
{
$exp = new ExpenseReport($db);
$sql = "SELECT e.rowid, e.ref, e.fk_statut, e.date_debut, e.total_ttc";
$sql = "SELECT e.rowid, e.ref, e.fk_statut as status, e.date_debut, e.total_ttc";
$sql .= " FROM ".MAIN_DB_PREFIX."expensereport as e";
$sql .= " WHERE e.fk_user_author = ".$object->id;
$sql .= " AND e.entity = ".$conf->entity;
@ -473,16 +474,17 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco
{
$objp = $db->fetch_object($resql);
print '<tr class="oddeven">';
print '<td class="nowrap">';
$exp->id = $objp->rowid;
$exp->ref = $objp->ref;
$exp->fk_type = $objp->fk_type;
$exp->status = $objp->status;
print '<tr class="oddeven">';
print '<td class="nowrap">';
print $exp->getNomUrl(1);
print '</td><td class="right" width="80px">'.dol_print_date($db->jdate($objp->date_debut), 'day')."</td>\n";
print '<td class="right" style="min-width: 60px">'.price($objp->total_ttc).'</td>';
print '<td class="right nowrap" style="min-width: 60px">'.$exp->LibStatut($objp->fk_statut, 5).'</td></tr>';
print '<td class="right nowrap" style="min-width: 60px">'.$exp->LibStatut($objp->status, 5).'</td></tr>';
$i++;
}
$db->free($resql);