diff --git a/htdocs/bom/bom_list.php b/htdocs/bom/bom_list.php index b9a279ae943..76f16c838be 100644 --- a/htdocs/bom/bom_list.php +++ b/htdocs/bom/bom_list.php @@ -108,7 +108,7 @@ foreach ($object->fields as $key => $val) { 'checked'=>(($visible < 0) ? 0 : 1), 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)), 'position'=>$val['position'], - 'help'=>$val['help'] + 'help'=> isset($val['help']) ? $val['help'] : '' ); } } diff --git a/htdocs/compta/cashcontrol/cashcontrol_list.php b/htdocs/compta/cashcontrol/cashcontrol_list.php index ec7af37940c..42e53085ea8 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_list.php +++ b/htdocs/compta/cashcontrol/cashcontrol_list.php @@ -131,7 +131,7 @@ foreach ($object->fields as $key => $val) { 'checked'=>(($visible < 0) ? 0 : 1), 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)), 'position'=>$val['position'], - 'help'=>$val['help'] + 'help'=> isset($val['help']) ? $val['help'] : '' ); } } diff --git a/htdocs/core/tpl/commonfields_add.tpl.php b/htdocs/core/tpl/commonfields_add.tpl.php index d1d378e7e60..cd07c0b8191 100644 --- a/htdocs/core/tpl/commonfields_add.tpl.php +++ b/htdocs/core/tpl/commonfields_add.tpl.php @@ -47,7 +47,7 @@ foreach ($object->fields as $key => $val) { print ''; print '\n".'$_SERVER[REQUEST_URI] = '.$_SERVER['REQUEST_URI'].' $_SERVER[REQUEST_METHOD] = '.$_SERVER['REQUEST_METHOD'].' GETPOST(token) = '.GETPOST('token', 'alpha').' $_SESSION[token] = '.$_SESSION['token'], null, 'warnings'); - $savid = ((int) $_POST['id']); + if (isset($_POST['id'])) $savid = ((int) $_POST['id']); unset($_POST); //unset($_POST['action']); unset($_POST['massaction']); //unset($_POST['confirm']); unset($_POST['confirmmassaction']); @@ -517,7 +517,7 @@ if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && !empty($conf->gl unset($_GET['action']); unset($_GET['confirmmassaction']); unset($_GET['massaction']); - $_POST['id'] = ((int) $savid); + if (isset($savid)) $_POST['id'] = ((int) $savid); } // Note: There is another CSRF protection into the filefunc.inc.php @@ -3146,7 +3146,7 @@ if (!function_exists("llxFooter")) { } // Wrapper to add log when clicking on download or preview - if (!empty($conf->blockedlog->enabled) && is_object($object) && $object->id > 0 && $object->statut > 0) { + if (!empty($conf->blockedlog->enabled) && is_object($object) && !empty($object->id) && $object->id > 0 && $object->statut > 0) { if (in_array($object->element, array('facture'))) { // Restrict for the moment to element 'facture' print "\n\n"; ?> diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 0081ec28551..4633a69e6dd 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -165,7 +165,7 @@ foreach ($object->fields as $key => $val) { 'checked'=>(($visible < 0) ? 0 : 1), 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)), 'position'=>$val['position'], - 'help'=>$val['help'] + 'help'=> isset($val['help']) ? $val['help'] : '' ); } } diff --git a/htdocs/mrp/mo_list.php b/htdocs/mrp/mo_list.php index 6b4351bed6c..bac3528e642 100644 --- a/htdocs/mrp/mo_list.php +++ b/htdocs/mrp/mo_list.php @@ -115,7 +115,7 @@ foreach ($object->fields as $key => $val) { 'checked'=>(($visible < 0) ? 0 : 1), 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)), 'position'=>$val['position'], - 'help'=>$val['help'] + 'help'=> isset($val['help']) ? $val['help'] : '' ); } } diff --git a/htdocs/partnership/partnership_list.php b/htdocs/partnership/partnership_list.php index 49d46c652fd..f5b72dca2d2 100644 --- a/htdocs/partnership/partnership_list.php +++ b/htdocs/partnership/partnership_list.php @@ -126,7 +126,7 @@ foreach ($object->fields as $key => $val) { 'checked'=>(($visible < 0) ? 0 : 1), 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)), 'position'=>$val['position'], - 'help'=>$val['help'] + 'help'=> isset($val['help']) ? $val['help'] : '' ); } } diff --git a/htdocs/product/inventory/card.php b/htdocs/product/inventory/card.php index 5ec359e5d8a..067869ba5ba 100644 --- a/htdocs/product/inventory/card.php +++ b/htdocs/product/inventory/card.php @@ -49,7 +49,10 @@ if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { // Initialize technical objects $object = new Inventory($db); $extrafields = new ExtraFields($db); -$diroutputmassaction = $conf->stock->dir_output.'/temp/massgeneration/'.$user->id; +// no inventory docs yet +$includedocgeneration = false; +$diroutputmassaction = null; +// $diroutputmassaction = $conf->stock->dir_output.'/temp/massgeneration/'.$user->id; $hookmanager->initHooks(array('inventorycard', 'globalcard')); // Note that conf->hooks_modules contains array // Fetch optionals attributes and labels @@ -180,7 +183,7 @@ if ($action == 'create') { if ($backtopage) { print ''; } - if ($backtopageforcancel) { + if (!empty($backtopageforcancel)) { print ''; } @@ -261,10 +264,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($action == 'delete') { $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteInventory'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1); } - // Confirmation to delete line - if ($action == 'deleteline') { - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1); - } // Clone confirmation if ($action == 'clone') { @@ -290,7 +289,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } // Call Hook formConfirm - $parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid); + $parameters = array('formConfirm' => $formconfirm); $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if (empty($reshook)) { $formconfirm .= $hookmanager->resPrint; @@ -469,7 +468,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // List of actions on element include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; $formactions = new FormActions($db); - $somethingshown = $formactions->showactions($object, 'inventory', $socid, 1, '', $MAXEVENT, '', $morehtmlright); + $somethingshown = $formactions->showactions($object, 'inventory', 0, 1, '', $MAXEVENT, '', $morehtmlright); print ''; } diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index 89394e56e29..85cd0932f46 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -616,7 +616,7 @@ if ($object->id > 0) { while ($i < $num) { $obj = $db->fetch_object($resql); - if (is_object($cacheOfWarehouses[$obj->fk_warehouse])) { + if (isset($cacheOfWarehouses[$obj->fk_warehouse])) { $warehouse_static = $cacheOfWarehouses[$obj->fk_warehouse]; } else { $warehouse_static = new Entrepot($db); @@ -625,7 +625,7 @@ if ($object->id > 0) { $cacheOfWarehouses[$warehouse_static->id] = $warehouse_static; } - if (is_object($cacheOfProducts[$obj->fk_product])) { + if (isset($cacheOfProducts[$obj->fk_product])) { $product_static = $cacheOfProducts[$obj->fk_product]; } else { $product_static = new Product($db); diff --git a/htdocs/product/inventory/list.php b/htdocs/product/inventory/list.php index 7d792c82ec1..bc2ebdf20b4 100644 --- a/htdocs/product/inventory/list.php +++ b/htdocs/product/inventory/list.php @@ -59,7 +59,9 @@ $pagenext = $page + 1; // Initialize technical objects $object = new Inventory($db); $extrafields = new ExtraFields($db); -$diroutputmassaction = $conf->inventory->dir_output.'/temp/massgeneration/'.$user->id; +// no inventory docs yet +// $diroutputmassaction = $conf->inventory->dir_output.'/temp/massgeneration/'.$user->id; +$diroutputmassaction = null; $hookmanager->initHooks(array('inventorylist')); // Note that conf->hooks_modules contains array // Fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); @@ -106,7 +108,7 @@ foreach ($object->fields as $key => $val) { 'checked'=>(($visible < 0) ? 0 : 1), 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)), 'position'=>$val['position'], - 'help'=>$val['help'] + 'help'=> isset($val['help']) ? $val['help'] : '' ); } } @@ -127,9 +129,9 @@ if ($user->socid > 0) { // Protection if external user accessforbidden(); } if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { - $result = restrictedArea($user, 'stock', $objectid); + $result = restrictedArea($user, 'stock'); } else { - $result = restrictedArea($user, 'stock', $objectid, '', 'inventory_advance'); + $result = restrictedArea($user, 'stock', 0, '', 'inventory_advance'); } @@ -624,7 +626,8 @@ print ''."\n"; print ''."\n"; print ''."\n"; - +// no inventory docs yet +/* if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) { $hidegeneratedfilelistifempty = 1; if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) { @@ -644,7 +647,7 @@ if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $n print $formfile->showdocuments('massfilesarea_mymodule', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); } - +*/ // End of page llxFooter(); $db->close(); diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index 79f74343fb2..b8f998c0ec0 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -123,7 +123,7 @@ foreach ($object->fields as $key => $val) { 'checked'=>(($visible < 0) ? 0 : 1), 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)), 'position'=>$val['position'], - 'help'=>$val['help'] + 'help'=> isset($val['help']) ? $val['help'] : 'help' ); } } diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index ce2db90fa5d..a570e8ed7bb 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -2050,7 +2050,7 @@ class Project extends CommonObject $response->nbtodo++; $project_static->statut = $obj->status; - $project_static->opp_status = $obj->opp_status; + $project_static->opp_status = $obj->fk_opp_status; $project_static->datee = $this->db->jdate($obj->datee); if ($project_static->hasDelay()) { diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index bd25398776e..5e17c92c562 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -2118,7 +2118,7 @@ class Task extends CommonObject $now = dol_now(); - $datetouse = ($this->date_end > 0) ? $this->date_end : ($this->datee > 0 ? $this->datee : 0); + $datetouse = ($this->date_end > 0) ? $this->date_end : ((isset($this->datee) && $this->datee > 0) ? $this->datee : 0); return ($datetouse > 0 && ($datetouse < ($now - $conf->projet->task->warning_delay))); } diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 39a47e969a8..6d7ec7d351e 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -167,7 +167,7 @@ foreach ($object->fields as $key => $val) { 'checked'=>(($visible < 0) ? 0 : 1), 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)), 'position'=>$val['position'], - 'help'=>$val['help'] + 'help'=> isset($val['help']) ? $val['help'] : '' ); } } diff --git a/htdocs/salaries/list.php b/htdocs/salaries/list.php index 690f8df4c8c..7a8b3ebca10 100644 --- a/htdocs/salaries/list.php +++ b/htdocs/salaries/list.php @@ -140,7 +140,7 @@ foreach ($object->fields as $key => $val) { 'checked'=>(($visible < 0) ? 0 : 1), 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)), 'position'=>$val['position'], - 'help'=>$val['help'] + 'help'=> isset($val['help']) ? $val['help'] : '' ); } } diff --git a/htdocs/salaries/payments.php b/htdocs/salaries/payments.php index c2805cfbd93..f129e6304ab 100644 --- a/htdocs/salaries/payments.php +++ b/htdocs/salaries/payments.php @@ -135,7 +135,7 @@ foreach ($object->fields as $key => $val) { 'checked'=>(($visible < 0) ? 0 : 1), 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)), 'position'=>$val['position'], - 'help'=>$val['help'] + 'help'=> isset($val['help']) ? $val['help'] : '' ); } } diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index eb003cdab9e..6d43222bcf2 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -2216,7 +2216,7 @@ class SupplierProposal extends CommonObject $this->nbtodo = $this->nbtodolate = 0; $clause = " WHERE"; - $sql = "SELECT p.rowid, p.ref, p.datec as datec"; + $sql = "SELECT p.rowid, p.ref, p.datec as datec, p.date_cloture as datefin"; $sql .= " FROM ".MAIN_DB_PREFIX."supplier_proposal as p"; if (!$user->rights->societe->client->voir && !$user->socid) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc"; @@ -2239,13 +2239,13 @@ class SupplierProposal extends CommonObject $label = $labelShort = ''; $status = ''; if ($mode == 'opened') { - $delay_warning = $conf->supplier_proposal->cloture->warning_delay; + $delay_warning = !empty($conf->supplier_proposal->cloture->warning_delay) ? $conf->supplier_proposal->cloture->warning_delay : 0; $status = self::STATUS_VALIDATED; $label = $langs->trans("SupplierProposalsToClose"); $labelShort = $langs->trans("ToAcceptRefuse"); } if ($mode == 'signed') { - $delay_warning = $conf->supplier_proposal->facturation->warning_delay; + $delay_warning = !empty($conf->supplier_proposal->facturation->warning_delay) ? $conf->supplier_proposal->facturation->warning_delay : 0; $status = self::STATUS_SIGNED; $label = $langs->trans("SupplierProposalsToProcess"); // May be billed or ordered $labelShort = $langs->trans("ToClose"); diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 0bde31dec50..74137537e74 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -3298,7 +3298,7 @@ class User extends CommonObject $i = 0; $cursor_user = $id_user; $useridfound = array($id_user); - while (!empty($this->parentof[$cursor_user])) { + while (!empty($this->parentof[$cursor_user]) && !empty($this->users[$this->parentof[$cursor_user]])) { if (in_array($this->parentof[$cursor_user], $useridfound)) { dol_syslog("The hierarchy of user has a recursive loop", LOG_WARNING); return -1; // Should not happen. Protection against looping hierarchy