diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 47e9d8161fd..5771ead70f1 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -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) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 4dd96ac88aa..797a2a58ddb 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -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); diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index fce09733349..a4c27855a30 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -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'); } } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 19d9c039736..43588ba0d0e 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -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('"', '"', '../'), '', trim($out)); + // keep lines feed $out = dol_string_nohtmltag($out, 0); } break; diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index a908556230d..8f7501e3fce 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -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&leftmenu=admintools', $langs->trans('InfoPHP'), 1); $newmenu->add('/admin/system/database.php?mainmenu=home&leftmenu=admintools', $langs->trans('InfoDatabase'), 1); if (!empty($conf->global->MAIN_FEATURES_LEVEL)) { - $newmenu->add("/admin/system/perf.php?mainmenu=home&leftmenu=admintools", $langs->trans("InfoPerf"),1); - $newmenu->add("/admin/system/security.php?mainmenu=home&leftmenu=admintools", $langs->trans("InfoSecurity"),1); + $newmenu->add("/admin/system/perf.php?mainmenu=home&leftmenu=admintools", $langs->trans("InfoPerf"), 1); + $newmenu->add("/admin/system/security.php?mainmenu=home&leftmenu=admintools", $langs->trans("InfoSecurity"), 1); } $newmenu->add("/admin/tools/dolibarr_export.php?mainmenu=home&leftmenu=admintools", $langs->trans("Backup"), 1); $newmenu->add("/admin/tools/dolibarr_import.php?mainmenu=home&leftmenu=admintools", $langs->trans("Restore"), 1); diff --git a/htdocs/document.php b/htdocs/document.php index 79ed9024a50..c48a0363f78 100644 --- a/htdocs/document.php +++ b/htdocs/document.php @@ -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'); diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index c540d124f6b..611cf72593a 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -1594,7 +1594,10 @@ class ExpenseReport extends CommonObject if ($short) return $url; - $label = img_picto('', $this->picto).' '.$langs->trans("ExpenseReport").''; + $label = img_picto('', $this->picto).' '.$langs->trans("ExpenseReport").''; + if (isset($this->status)) { + $label .= ' '.$this->getLibStatut(5); + } if (!empty($this->ref)) $label .= '
'.$langs->trans('Ref').': '.$this->ref; if (!empty($this->total_ht)) @@ -1603,9 +1606,6 @@ class ExpenseReport extends CommonObject $label .= '
'.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); if (!empty($this->total_ttc)) $label .= '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); - if (isset($this->status)) { - $label .= '
'.$langs->trans("Status").": ".$this->getLibStatut(5); - } if ($moretitle) $label .= ' - '.$moretitle; //if ($option != 'nolink') diff --git a/htdocs/expensereport/index.php b/htdocs/expensereport/index.php index fa0974dedd9..046bde4efa1 100644 --- a/htdocs/expensereport/index.php +++ b/htdocs/expensereport/index.php @@ -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 ''; print ''.$expensereportstatic->getNomUrl(1).''; print ''.$userstatic->getNomUrl(-1).''; @@ -227,7 +231,7 @@ if ($result) print ''.price($obj->total_ttc).''; print ''.dol_print_date($db->jdate($obj->dm), 'day').''; print ''; - print $expensereportstatic->LibStatut($obj->fk_status, 3); + print $expensereportstatic->getLibStatut(3); print ''; print ''; diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 830d391ad9c..e62e2399901 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -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'); diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index acfa9cca3d7..a0f640f0cd3 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -1178,11 +1178,11 @@ class Holiday extends CommonObject $result = ''; - $label = img_picto('', $this->picto).' '.$langs->trans("Holiday").''; - $label .= '
'.$langs->trans('Ref').': '.$this->ref; + $label = img_picto('', $this->picto).' '.$langs->trans("Holiday").''; if (isset($this->statut)) { - $label .= '
'.$langs->trans("Status").": ".$this->getLibStatut(5); + $label .= ' '.$this->getLibStatut(5); } + $label .= '
'.$langs->trans('Ref').': '.$this->ref; $url = DOL_URL_ROOT.'/holiday/card.php?id='.$this->id; diff --git a/htdocs/recruitment/recruitmentcandidature_list.php b/htdocs/recruitment/recruitmentcandidature_list.php index 7442523b7d3..70d3bc3be4d 100644 --- a/htdocs/recruitment/recruitmentcandidature_list.php +++ b/htdocs/recruitment/recruitmentcandidature_list.php @@ -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); diff --git a/htdocs/recruitment/recruitmentjobposition_list.php b/htdocs/recruitment/recruitmentjobposition_list.php index 94ec7a0f54f..72349c94914 100644 --- a/htdocs/recruitment/recruitmentjobposition_list.php +++ b/htdocs/recruitment/recruitmentjobposition_list.php @@ -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); diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index f16779148d3..ea560ae650b 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1288,7 +1288,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) print ''; print ''; print ''; print $form->widgetForTranslation("address", $object, $permissiontoadd, 'textarea', 'alphanohtml', 'quatrevingtpercent'); print ''; @@ -1889,7 +1889,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) // Address print ''.$form->editfieldkey('Address', 'address', '', $object, 0).''; print ''; print $form->widgetForTranslation("address", $object, $permissiontoadd, 'textarea', 'alphanohtml', 'quatrevingtpercent'); print ''; diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index b8b670027ae..2f2c1ee0a86 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -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 ''; - print ''; $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 ''; + print ''; print $holiday->getNomUrl(1); print ''.dol_print_date($db->jdate($objp->date_debut), 'day')."\n"; print ''.$nbopenedday.' '.$langs->trans('DurationDays').''; - print ''.$holiday->LibStatut($objp->statut, 5).''; + print ''.$holiday->LibStatut($objp->status, 5).''; $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 ''; - print ''; $exp->id = $objp->rowid; $exp->ref = $objp->ref; $exp->fk_type = $objp->fk_type; + $exp->status = $objp->status; + print ''; + print ''; print $exp->getNomUrl(1); print ''.dol_print_date($db->jdate($objp->date_debut), 'day')."\n"; print ''.price($objp->total_ttc).''; - print ''.$exp->LibStatut($objp->fk_statut, 5).''; + print ''.$exp->LibStatut($objp->status, 5).''; $i++; } $db->free($resql);