diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index f5a5a8933d0..4a3db45ba03 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -639,7 +639,7 @@ class AdherentType extends CommonObject $sql .= ' AND ('.$excludefilter.')'; } - dol_syslog(get_class($this)."::listUsersForGroup", LOG_DEBUG); + dol_syslog(get_class($this)."::listMembersForMemberType", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { while ($obj = $this->db->fetch_object($resql)) { diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index 93d0768b004..3901e18bac4 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2017-2023 Laurent Destailleur * Copyright (C) 2019 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -275,302 +275,303 @@ if (empty($reshook)) { $object->calculateCosts(); } } +} +/* + * View + */ - /* - * View - */ - - $form = new Form($db); - $formfile = new FormFile($db); +$form = new Form($db); +$formfile = new FormFile($db); - $title = $langs->trans('BOM'); - $help_url ='EN:Module_BOM'; - llxHeader('', $title, $help_url); +$title = $langs->trans('BOM'); +$help_url ='EN:Module_BOM'; +llxHeader('', $title, $help_url); - // Part to create - if ($action == 'create') { - print load_fiche_titre($langs->trans("NewBOM"), '', 'bom'); +// Part to create +if ($action == 'create') { + print load_fiche_titre($langs->trans("NewBOM"), '', 'bom'); - print '
'; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; - print dol_get_fiche_head(array(), ''); + print dol_get_fiche_head(array(), ''); - print ''."\n"; + print '
'."\n"; - // Common attributes - include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php'; + // Common attributes + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php'; - // Other attributes - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; + // Other attributes + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; - print '
'."\n"; + print ''."\n"; - print dol_get_fiche_end(); + print dol_get_fiche_end(); - print $form->buttonsSaveCancel("Create"); + print $form->buttonsSaveCancel("Create"); - print '
'; + print ''; +} + +// Part to edit record +if (($id || $ref) && $action == 'edit') { + print load_fiche_titre($langs->trans("BillOfMaterials"), '', 'cubes'); + + print '
'; + print ''; + print ''; + print ''; + print ''; + + print dol_get_fiche_head(); + + //$object->fields['keyfield']['disabled'] = 1; + + print ''."\n"; + + // Common attributes + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php'; + + // Other attributes + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php'; + + print '
'; + + print dol_get_fiche_end(); + + print $form->buttonsSaveCancel("Create"); + + print '
'; +} + +// Part to show record +if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) { + $head = bomPrepareHead($object); + print dol_get_fiche_head($head, 'card', $langs->trans("BillOfMaterials"), -1, 'bom'); + + $formconfirm = ''; + + // Confirmation to delete + if ($action == 'delete') { + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteBillOfMaterials'), $langs->trans('ConfirmDeleteBillOfMaterials'), '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); } - // Part to edit record - if (($id || $ref) && $action == 'edit') { - print load_fiche_titre($langs->trans("BillOfMaterials"), '', 'cubes'); - - print '
'; - print ''; - print ''; - print ''; - print ''; - - print dol_get_fiche_head(); - - //$object->fields['keyfield']['disabled'] = 1; - - print ''."\n"; - - // Common attributes - include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php'; - - // Other attributes - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php'; - - print '
'; - - print dol_get_fiche_end(); - - print $form->buttonsSaveCancel("Create"); - - print '
'; - } - - // Part to show record - if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) { - $head = bomPrepareHead($object); - print dol_get_fiche_head($head, 'card', $langs->trans("BillOfMaterials"), -1, 'bom'); - - $formconfirm = ''; - - // Confirmation to delete - if ($action == 'delete') { - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteBillOfMaterials'), $langs->trans('ConfirmDeleteBillOfMaterials'), '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); - } - - // Confirmation of validation - if ($action == 'validate') { - // We check that object has a temporary ref - $ref = substr($object->ref, 1, 4); - if ($ref == 'PROV') { - $object->fetch_product(); - $numref = $object->getNextNumRef($object->product); - } else { - $numref = $object->ref; - } - - $text = $langs->trans('ConfirmValidateBom', $numref); - /*if (isModEnabled('notification')) - { - require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php'; - $notify = new Notify($db); - $text .= '
'; - $text .= $notify->confirmMessage('BOM_VALIDATE', $object->socid, $object); - }*/ - - $formquestion = array(); - if (isModEnabled('bom')) { - $langs->load("mrp"); - $forcecombo = 0; - if ($conf->browser->name == 'ie') { - $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy - } - $formquestion = array( - // 'text' => $langs->trans("ConfirmClone"), - // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), - // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), - ); - } - - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('Validate'), $text, 'confirm_validate', $formquestion, 0, 1, 220); - } - - // Confirmation of closing - if ($action == 'close') { - $text = $langs->trans('ConfirmCloseBom', $object->ref); - /*if (isModEnabled('notification')) - { - require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php'; - $notify = new Notify($db); - $text .= '
'; - $text .= $notify->confirmMessage('BOM_CLOSE', $object->socid, $object); - }*/ - - $formquestion = array(); - if (isModEnabled('bom')) { - $langs->load("mrp"); - $forcecombo = 0; - if ($conf->browser->name == 'ie') { - $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy - } - $formquestion = array( - // 'text' => $langs->trans("ConfirmClone"), - // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), - // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), - ); - } - - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('Close'), $text, 'confirm_close', $formquestion, 0, 1, 220); - } - - // Confirmation of reopen - if ($action == 'reopen') { - $text = $langs->trans('ConfirmReopenBom', $object->ref); - /*if (isModEnabled('notification')) - { - require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php'; - $notify = new Notify($db); - $text .= '
'; - $text .= $notify->confirmMessage('BOM_CLOSE', $object->socid, $object); - }*/ - - $formquestion = array(); - if (isModEnabled('bom')) { - $langs->load("mrp"); - require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php'; - $forcecombo = 0; - if ($conf->browser->name == 'ie') { - $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy - } - $formquestion = array( - // 'text' => $langs->trans("ConfirmClone"), - // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), - // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), - ); - } - - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ReOpen'), $text, 'confirm_reopen', $formquestion, 0, 1, 220); - } - - // Clone confirmation - if ($action == 'clone') { - // Create an array for form - $formquestion = array(); - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneBillOfMaterials', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); - } - - // Confirmation of action xxxx - if ($action == 'setdraft') { - $text = $langs->trans('ConfirmSetToDraft', $object->ref); - - $formquestion = array(); - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('SetToDraft'), $text, 'confirm_setdraft', $formquestion, 0, 1, 220); - } - - // Call Hook formConfirm - $parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid); - $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - if (empty($reshook)) { - $formconfirm .= $hookmanager->resPrint; - } elseif ($reshook > 0) { - $formconfirm = $hookmanager->resPrint; - } - - // Print form confirm - print $formconfirm; - - - // Object card - // ------------------------------------------------------------ - $linkback = '' . $langs->trans("BackToList") . ''; - - $morehtmlref = '
'; - /* - // Ref bis - $morehtmlref.=$form->editfieldkey("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->bom->creer, 'string', '', 0, 1); - $morehtmlref.=$form->editfieldval("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->bom->creer, 'string', '', null, null, '', 1); - // Thirdparty - $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1); - // Project - if (isModEnabled('project')) - { - $langs->load("projects"); - $morehtmlref.='
'.$langs->trans('Project') . ' '; - if ($permissiontoadd) - { - if ($action != 'classify') - $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref.='
'; - $morehtmlref.=''; - $morehtmlref.=''; - $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref.=''; - $morehtmlref.='
'; - } else { - $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); - } + // Confirmation of validation + if ($action == 'validate') { + // We check that object has a temporary ref + $ref = substr($object->ref, 1, 4); + if ($ref == 'PROV') { + $object->fetch_product(); + $numref = $object->getNextNumRef($object->product); } else { - if (! empty($object->fk_project)) { - $proj = new Project($db); - $proj->fetch($object->fk_project); - $morehtmlref.=$proj->getNomUrl(); - } else { - $morehtmlref.=''; + $numref = $object->ref; + } + + $text = $langs->trans('ConfirmValidateBom', $numref); + /*if (isModEnabled('notification')) + { + require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php'; + $notify = new Notify($db); + $text .= '
'; + $text .= $notify->confirmMessage('BOM_VALIDATE', $object->socid, $object); + }*/ + + $formquestion = array(); + if (isModEnabled('bom')) { + $langs->load("mrp"); + $forcecombo = 0; + if ($conf->browser->name == 'ie') { + $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy } + $formquestion = array( + // 'text' => $langs->trans("ConfirmClone"), + // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), + // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), + ); } + + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('Validate'), $text, 'confirm_validate', $formquestion, 0, 1, 220); + } + + // Confirmation of closing + if ($action == 'close') { + $text = $langs->trans('ConfirmCloseBom', $object->ref); + /*if (isModEnabled('notification')) + { + require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php'; + $notify = new Notify($db); + $text .= '
'; + $text .= $notify->confirmMessage('BOM_CLOSE', $object->socid, $object); + }*/ + + $formquestion = array(); + if (isModEnabled('bom')) { + $langs->load("mrp"); + $forcecombo = 0; + if ($conf->browser->name == 'ie') { + $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy + } + $formquestion = array( + // 'text' => $langs->trans("ConfirmClone"), + // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), + // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), + ); } - */ - $morehtmlref .= '
'; + + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('Close'), $text, 'confirm_close', $formquestion, 0, 1, 220); + } + + // Confirmation of reopen + if ($action == 'reopen') { + $text = $langs->trans('ConfirmReopenBom', $object->ref); + /*if (isModEnabled('notification')) + { + require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php'; + $notify = new Notify($db); + $text .= '
'; + $text .= $notify->confirmMessage('BOM_CLOSE', $object->socid, $object); + }*/ + + $formquestion = array(); + if (isModEnabled('bom')) { + $langs->load("mrp"); + require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; + $forcecombo = 0; + if ($conf->browser->name == 'ie') { + $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy + } + $formquestion = array( + // 'text' => $langs->trans("ConfirmClone"), + // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), + // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), + ); + } + + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ReOpen'), $text, 'confirm_reopen', $formquestion, 0, 1, 220); + } + + // Clone confirmation + if ($action == 'clone') { + // Create an array for form + $formquestion = array(); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneBillOfMaterials', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); + } + + // Confirmation of action xxxx + if ($action == 'setdraft') { + $text = $langs->trans('ConfirmSetToDraft', $object->ref); + + $formquestion = array(); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('SetToDraft'), $text, 'confirm_setdraft', $formquestion, 0, 1, 220); + } + + // Call Hook formConfirm + $parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid); + $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if (empty($reshook)) { + $formconfirm .= $hookmanager->resPrint; + } elseif ($reshook > 0) { + $formconfirm = $hookmanager->resPrint; + } + + // Print form confirm + print $formconfirm; - dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + // Object card + // ------------------------------------------------------------ + $linkback = ''.$langs->trans("BackToList").''; + + $morehtmlref = '
'; + /* + // Ref bis + $morehtmlref.=$form->editfieldkey("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->bom->creer, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->bom->creer, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1); + // Project + if (isModEnabled('project')) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($permissiontoadd) + { + if ($action != 'classify') + $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=$proj->getNomUrl(); + } else { + $morehtmlref.=''; + } + } + } + */ + $morehtmlref .= '
'; - print '
'; - print '
'; - print '
'; - print '' . "\n"; + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); - // Common attributes - $keyforbreak = 'duration'; - include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php'; + + print '
'; + print '
'; + print '
'; + print '
'."\n"; + + // Common attributes + $keyforbreak = 'duration'; + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; + $object->calculateCosts(); + print ''; + print ''; + + // Other attributes + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; + + print '
'.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCost")).''.price($object->total_cost).'
'.$langs->trans("UnitCost").''.price($object->unit_cost).'
'; + print '
'; + print '
'; + + print '
'; + + print dol_get_fiche_end(); + + + + /* + * Lines + */ + + if (!empty($object->table_element_line)) { + // Products + $res = $object->fetchLinesbytypeproduct(0); $object->calculateCosts(); - print '' . $form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCost")) . '' . price($object->total_cost) . ''; - print '' . $langs->trans("UnitCost") . '' . price($object->unit_cost) . ''; - // Other attributes - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + print ($res == 0 && $object->status >= $object::STATUS_VALIDATED) ? '' : load_fiche_titre($langs->trans('BOMProductsList'), '', 'product'); - print ''; - print ''; - print ''; - - print '
'; - - print dol_get_fiche_end(); - - - /* - * Lines - */ - - if (!empty($object->table_element_line)) { - //Products - $res = $object->fetchLinesbytypeproduct(0); - $object->calculateCosts(); - - print ($res == 0 && $object->status >= $object::STATUS_VALIDATED) ? '' : load_fiche_titre($langs->trans('BOMProductsList'), '', 'product'); - - print '
+ print ' @@ -578,78 +579,30 @@ if (empty($reshook)) { '; - if (!empty($conf->use_javascript_ajax) && $object->status == 0) { - include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php'; - } + if (!empty($conf->use_javascript_ajax) && $object->status == 0) { + include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; + } - print '
'; - if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) { - print ''; - } + print '
'; + if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) { + print '
'; + } - if (!empty($object->lines)) { - $object->printObjectLines($action, $mysoc, null, GETPOST('lineid', 'int'), 1, '/bom/tpl'); - } + if (!empty($object->lines)) { + $object->printObjectLines($action, $mysoc, null, GETPOST('lineid', 'int'), 1, '/bom/tpl'); + } - // Form to add new line - if ($object->status == 0 && $permissiontoadd && $action != 'selectlines') { - if ($action != 'editline') { - // Add products/services form + // Form to add new line + if ($object->status == 0 && $permissiontoadd && $action != 'selectlines') { + if ($action != 'editline') { + // Add products/services form - $parameters = array(); - $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - if (empty($reshook)) - $object->formAddObjectLine(1, $mysoc, null, '/bom/tpl'); - } - } - - if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) { - print '
'; - } - print '
'; - - print "
\n"; - - //Services - $filtertype = 1; - $res = $object->fetchLinesbytypeproduct(1); - $object->calculateCosts(); - - print ($res == 0 && $object->status >= $object::STATUS_VALIDATED) ? '' : load_fiche_titre($langs->trans('BOMServicesList'), '', 'service'); - - print '
- - - - - '; - - if (!empty($conf->use_javascript_ajax) && $object->status == 0) { - $tagidfortablednd = 'tablelinesservice'; - include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php'; - } - - print '
'; - if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) { - print ''; - } - - if (!empty($object->lines)) { - $object->printObjectLines($action, $mysoc, null, GETPOST('lineid', 'int'), 1, '/bom/tpl'); - } - - // Form to add new line - if ($object->status == 0 && $permissiontoadd && $action != 'selectlines') { - if ($action != 'editline') { - // Add services form - $parameters = array(); - $reshook = $hookmanager->executeHooks('formAddObjectServiceLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - if (empty($reshook)) - $object->formAddObjectLine(1, $mysoc, null, '/bom/tpl'); - } + $parameters = array(); + $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + if (empty($reshook)) + $object->formAddObjectLine(1, $mysoc, null, '/bom/tpl'); } } @@ -660,149 +613,199 @@ if (empty($reshook)) { print "\n"; - mrpCollapseBomManagement(); + // Services + $filtertype = 1; + $res = $object->fetchLinesbytypeproduct(1); + $object->calculateCosts(); - $res = $object->fetchLines(); + print ($res == 0 && $object->status >= $object::STATUS_VALIDATED) ? '' : load_fiche_titre($langs->trans('BOMServicesList'), '', 'service'); - // Buttons for actions + print ' + + + + + '; - if ($action != 'presend' && $action != 'editline') { - print '
' . "\n"; - $parameters = array(); - $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - if ($reshook < 0) { - setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + if (!empty($conf->use_javascript_ajax) && $object->status == 0) { + $tagidfortablednd = 'tablelinesservice'; + include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php'; + } + + print '
'; + if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) { + print '
'; + } + + if (!empty($object->lines)) { + $object->printObjectLines($action, $mysoc, null, GETPOST('lineid', 'int'), 1, '/bom/tpl'); + } + + // Form to add new line + if ($object->status == 0 && $permissiontoadd && $action != 'selectlines') { + if ($action != 'editline') { + // Add services form + $parameters = array(); + $reshook = $hookmanager->executeHooks('formAddObjectServiceLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + if (empty($reshook)) + $object->formAddObjectLine(1, $mysoc, null, '/bom/tpl'); } + } + } - if (empty($reshook)) { - // Send - //if (empty($user->socid)) { - // print '' . $langs->trans('SendMail') . ''."\n"; + if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) { + print '
'; + } + print '
'; + + print "\n"; + + + mrpCollapseBomManagement(); + + + $res = $object->fetchLines(); + + // Buttons for actions + + if ($action != 'presend' && $action != 'editline') { + print '
'."\n"; + $parameters = array(); + $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + } + + if (empty($reshook)) { + // Send + //if (empty($user->socid)) { + // print '' . $langs->trans('SendMail') . ''."\n"; //} // Back to draft - if ($object->status == $object::STATUS_VALIDATED) { - if ($permissiontoadd) { - print '' . $langs->trans("SetToDraft") . '' . "\n"; - } + if ($object->status == $object::STATUS_VALIDATED) { + if ($permissiontoadd) { + print ''.$langs->trans("SetToDraft").''."\n"; } + } // Modify - if ($object->status == $object::STATUS_DRAFT) { - if ($permissiontoadd) { - print '' . $langs->trans("Modify") . '' . "\n"; - } else { - print '' . $langs->trans('Modify') . '' . "\n"; - } + if ($object->status == $object::STATUS_DRAFT) { + if ($permissiontoadd) { + print ''.$langs->trans("Modify").''."\n"; + } else { + print ''.$langs->trans('Modify').''."\n"; } + } // Validate - if ($object->status == $object::STATUS_DRAFT) { - if ($permissiontoadd) { - if (is_array($object->lines) && count($object->lines) > 0) { - print '' . $langs->trans("Validate") . '' . "\n"; - } else { - $langs->load("errors"); - print '' . $langs->trans("Validate") . '' . "\n"; - } + if ($object->status == $object::STATUS_DRAFT) { + if ($permissiontoadd) { + if (is_array($object->lines) && count($object->lines) > 0) { + print ''.$langs->trans("Validate").''."\n"; + } else { + $langs->load("errors"); + print ''.$langs->trans("Validate").''."\n"; } } + } // Re-open - if ($permissiontoadd && $object->status == $object::STATUS_CANCELED) { - print '' . $langs->trans("ReOpen") . '' . "\n"; - } + if ($permissiontoadd && $object->status == $object::STATUS_CANCELED) { + print ''.$langs->trans("ReOpen").''."\n"; + } // Create MO - if (isModEnabled('mrp')) { - if ($object->status == $object::STATUS_VALIDATED && !empty($user->rights->mrp->write)) { - print '' . $langs->trans("CreateMO") . '' . "\n"; - } + if (isModEnabled('mrp')) { + if ($object->status == $object::STATUS_VALIDATED && !empty($user->rights->mrp->write)) { + print ''.$langs->trans("CreateMO").''."\n"; } + } // Clone - if ($permissiontoadd) { - print dolGetButtonAction($langs->trans("ToClone"), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . (!empty($object->socid) ? '&socid=' . $object->socid : "") . '&action=clone&object=bom', 'clone', $permissiontoadd); - } + if ($permissiontoadd) { + print dolGetButtonAction($langs->trans("ToClone"), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.(!empty($object->socid) ? '&socid='.$object->socid : "").'&action=clone&object=bom', 'clone', $permissiontoadd); + } // Close / Cancel - if ($permissiontoadd && $object->status == $object::STATUS_VALIDATED) { - print '' . $langs->trans("Disable") . '' . "\n"; - } + if ($permissiontoadd && $object->status == $object::STATUS_VALIDATED) { + print ''.$langs->trans("Disable").''."\n"; + } /* - if ($user->rights->bom->write) - { - if ($object->status == 1) - { - print ''.$langs->trans("Disable").''."\n"; - } - else - { - print ''.$langs->trans("Enable").''."\n"; - } - } - */ + if ($user->rights->bom->write) + { + if ($object->status == 1) + { + print ''.$langs->trans("Disable").''."\n"; + } + else + { + print ''.$langs->trans("Enable").''."\n"; + } + } + */ // Delete - print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=delete&token=' . newToken(), 'delete', $permissiontodelete); - } - print '
' . "\n"; + print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete); } - - - // Select mail models is same action as presend - if (GETPOST('modelselected')) { - $action = 'presend'; - } - - if ($action != 'presend') { - print '
'; - print ''; // ancre - - // Documents - $objref = dol_sanitizeFileName($object->ref); - $relativepath = $objref . '/' . $objref . '.pdf'; - $filedir = $conf->bom->dir_output . '/' . $objref; - $urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id; - $genallowed = $user->rights->bom->read; // If you can read, you can build the PDF to read content - $delallowed = $user->rights->bom->write; // If you can create/edit, you can remove a file on card - print $formfile->showdocuments('bom', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang); - - // Show links to link elements - $linktoelem = $form->showLinkToObjectBlock($object, null, array('bom')); - $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); - - - print '
'; - - $MAXEVENT = 10; - - $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT . '/bom/bom_agenda.php?id=' . $object->id); - - // List of actions on element - include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; - $formactions = new FormActions($db); - $somethingshown = $formactions->showactions($object, $object->element, 0, 1, '', $MAXEVENT, '', $morehtmlcenter); - - print '
'; - } - - //Select mail models is same action as presend - if (GETPOST('modelselected')) { - $action = 'presend'; - } - - // Presend form - $modelmail = 'bom'; - $defaulttopic = 'InformationMessage'; - $diroutput = $conf->bom->dir_output; - $trackid = 'bom' . $object->id; - - include DOL_DOCUMENT_ROOT . '/core/tpl/card_presend.tpl.php'; + print ''."\n"; } + + + // Select mail models is same action as presend + if (GETPOST('modelselected')) { + $action = 'presend'; + } + + if ($action != 'presend') { + print '
'; + print ''; // ancre + + // Documents + $objref = dol_sanitizeFileName($object->ref); + $relativepath = $objref.'/'.$objref.'.pdf'; + $filedir = $conf->bom->dir_output.'/'.$objref; + $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; + $genallowed = $user->rights->bom->read; // If you can read, you can build the PDF to read content + $delallowed = $user->rights->bom->write; // If you can create/edit, you can remove a file on card + print $formfile->showdocuments('bom', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang); + + // Show links to link elements + $linktoelem = $form->showLinkToObjectBlock($object, null, array('bom')); + $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); + + + print '
'; + + $MAXEVENT = 10; + + $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/bom/bom_agenda.php?id='.$object->id); + + // List of actions on element + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; + $formactions = new FormActions($db); + $somethingshown = $formactions->showactions($object, $object->element, 0, 1, '', $MAXEVENT, '', $morehtmlcenter); + + print '
'; + } + + //Select mail models is same action as presend + if (GETPOST('modelselected')) { + $action = 'presend'; + } + + // Presend form + $modelmail = 'bom'; + $defaulttopic = 'InformationMessage'; + $diroutput = $conf->bom->dir_output; + $trackid = 'bom'.$object->id; + + include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; } + // End of page llxFooter(); $db->close(); diff --git a/htdocs/bom/bom_net_needs.php b/htdocs/bom/bom_net_needs.php index 1b8afa91e52..60736d085da 100644 --- a/htdocs/bom/bom_net_needs.php +++ b/htdocs/bom/bom_net_needs.php @@ -187,8 +187,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print dol_get_fiche_end(); - $viewlink = dolGetButtonTitle($langs->trans('GroupByProduct'), '', 'fa fa-bars imgforviewmode', $_SERVER['PHP_SELF'].'?id='.$object->id.'&token='.newToken(), '', 1, array('morecss' => 'reposition '.($action !== 'treeview' ? 'btnTitleSelected':''))); - $viewlink .= dolGetButtonTitle($langs->trans('TreeStructure'), '', 'fa fa-stream imgforviewmode', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=treeview&token='.newToken(), '', 1, array('morecss' => 'reposition marginleftonly '.($action == 'treeview' ? 'btnTitleSelected':''))); + $viewlink = dolGetButtonTitle($langs->trans('GroupByX', $langs->transnoentitiesnoconv("Products")), '', 'fa fa-bars imgforviewmode', $_SERVER['PHP_SELF'].'?id='.$object->id.'&token='.newToken(), '', 1, array('morecss' => 'reposition '.($action !== 'treeview' ? 'btnTitleSelected':''))); + $viewlink .= dolGetButtonTitle($langs->trans('TreeView'), '', 'fa fa-stream imgforviewmode', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=treeview&token='.newToken(), '', 1, array('morecss' => 'reposition marginleftonly '.($action == 'treeview' ? 'btnTitleSelected':''))); print load_fiche_titre($langs->trans("BOMNetNeeds"), $viewlink, ''); diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index d7982a44069..84bae509ebd 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -102,9 +102,9 @@ class BOM extends CommonObject 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>1, 'searchall'=>1, 'showoncombobox'=>'2', 'autofocusoncreate'=>1, 'css'=>'minwidth300 maxwidth400', 'csslist'=>'tdoverflowmax200'), 'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>1, 'position'=>33, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing', 1=>'Disassemble'), 'css'=>'minwidth175', 'csslist'=>'minwidth175 center'), //'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>-1, 'position'=>32, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing')), - 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1:(finished IS NULL or finished <> 0)', 'label'=>'Product', 'picto'=>'product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp', 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax100'), + 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1:((finished:is:null) or (finished:!=:0))', 'label'=>'Product', 'picto'=>'product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp', 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax100'), 'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,), - 'qty' => array('type'=>'real', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>55, 'notnull'=>1, 'isameasure'=>'1', 'css'=>'maxwidth75imp'), + 'qty' => array('type'=>'real', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>55, 'notnull'=>1, 'isameasure'=>'1', 'css'=>'maxwidth50imp right'), //'efficiency' => array('type'=>'real', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>-1, 'default'=>1, 'position'=>100, 'notnull'=>0, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLossForProductProduced'), 'duration' => array('type'=>'duration', 'label'=>'EstimatedDuration', 'enabled'=>1, 'visible'=>-1, 'position'=>101, 'notnull'=>-1, 'css'=>'maxwidth50imp', 'help'=>'EstimatedDurationDesc'), 'fk_warehouse' => array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php:0', 'label'=>'WarehouseForProduction', 'picto'=>'stock', 'enabled'=>1, 'visible'=>-1, 'position'=>102, 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax100'), diff --git a/htdocs/bom/tpl/objectline_create.tpl.php b/htdocs/bom/tpl/objectline_create.tpl.php index 96a179b93f3..e87d526302b 100644 --- a/htdocs/bom/tpl/objectline_create.tpl.php +++ b/htdocs/bom/tpl/objectline_create.tpl.php @@ -107,7 +107,7 @@ print ''; if (isModEnabled("product") || isModEnabled("service")) { if ($filtertype == 1) { print $langs->trans("Service"); - } elseif (!empty($conf->global->BOM_SUB_BOM)) { + } else { print $langs->trans("Product"); } echo ''; diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 1ae651dae6d..340efbf30a8 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -948,26 +948,6 @@ while ($currentdaytoshow < $lastdaytoshow) { $usernames[] = $tmpuser; } - /* - if ($filtert > 0) - { - $tmpuser = new User($db); - $tmpuser->fetch($filtert); - $usernames[] = $tmpuser; - } - else if ($usergroup) - { - $tmpgroup = new UserGroup($db); - $tmpgroup->fetch($usergroup); - $usernames = $tmpgroup->listUsersForGroup(); - } - else - { - $tmpgroup = new UserGroup($db); - //$tmpgroup->fetch($usergroup); No fetch, we want all users for all groups - $usernames = $tmpgroup->listUsersForGroup(); - }*/ - // Load array of colors by type $colorsbytype = array(); $labelbytype = array(); diff --git a/htdocs/compta/ajaxpayment.php b/htdocs/compta/ajaxpayment.php index b566f77bcde..a0c45ff0ed0 100644 --- a/htdocs/compta/ajaxpayment.php +++ b/htdocs/compta/ajaxpayment.php @@ -72,6 +72,10 @@ if (is_array($remains)) { unset($remains[$key]); } } +} elseif ($remains) { + $remains = array(price2num($remains)); +} else { + $remains = array(); } // Treatment diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 9d18fccf423..da529e33d0e 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -443,7 +443,7 @@ abstract class CommonDocGenerator } } - $date = ($object->element == 'contrat' ? $object->date_contrat : $object->date); + $date = (isset($object->element) && $object->element == 'contrat' && isset($object->date_contrat)) ? $object->date_contrat : (isset($object->date) ? $object->date : null); $resarray = array( $array_key.'_id'=>$object->id, @@ -452,7 +452,7 @@ abstract class CommonDocGenerator $array_key.'_ref_ext' => (property_exists($object, 'ref_ext') ? $object->ref_ext : ''), $array_key.'_ref_customer'=>(!empty($object->ref_client) ? $object->ref_client : (empty($object->ref_customer) ? '' : $object->ref_customer)), $array_key.'_ref_supplier'=>(!empty($object->ref_fournisseur) ? $object->ref_fournisseur : (empty($object->ref_supplier) ? '' : $object->ref_supplier)), - $array_key.'_source_invoice_ref'=>$invoice_source->ref, + $array_key.'_source_invoice_ref'=>((empty($invoice_source) || empty($invoice_source->ref)) ? '' : $invoice_source->ref), // Dates $array_key.'_hour'=>dol_print_date($date, 'hour'), $array_key.'_date'=>dol_print_date($date, 'day'), diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 01742ace308..c6cf71fbe44 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -7821,6 +7821,7 @@ class Form $tmpescaped = $tmp[2]; $regbis = array(); + if (preg_match('/^\'(.*)\'$/', $tmpescaped, $regbis)) { $tmpescaped = "'".$db->escape($regbis[1])."'"; } else { diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index e9d38796589..dc82e3bf4cf 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -39,6 +39,9 @@ class FormProjets */ public $error = ''; + public $errors = array(); + + public $nboftasks; @@ -622,6 +625,8 @@ class FormProjets if ($resql) { $num = $this->db->num_rows($resql); $i = 0; + $sellist = ''; + if ($num > 0) { $sellist = ''; + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; } - print ''; - } - foreach ($object->fields as $key => $val) { - $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); - if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { - $cssforfield .= ($cssforfield ? ' ' : '').'center'; - } elseif ($key == 'status') { - $cssforfield .= ($cssforfield ? ' ' : '').'center'; + // Output Kanban + print $object->getKanbanView(''); + if ($i == ($imaxinloop - 1)) { + print '
'; + print ''; } - - if (in_array($val['type'], array('timestamp'))) { - $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } elseif ($key == 'ref') { - $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } - - if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) { - $cssforfield .= ($cssforfield ? ' ' : '').'right'; - } - //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; - - if (!empty($arrayfields['t.'.$key]['checked'])) { - print ''; - if ($key == 'status') { - print $object->getLibStatut(5); - } elseif ($key == 'ref') { - print $object->getNomUrl(1, 0, '', (($projectid > 0)?'withproject':'')); - } else { - print $object->showOutputField($val, $key, $object->$key, ''); + } else { + // Show here line of result + $j = 0; + print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($object->id, $arrayofselected)) { + $selected = 1; + } + print ''; } print ''; if (!$i) { $totalarray['nbfield']++; } - if (!empty($val['isameasure']) && $val['isameasure'] == 1) { - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key; - } - if (!isset($totalarray['val'])) { - $totalarray['val'] = array(); - } - if (!isset($totalarray['val']['t.'.$key])) { - $totalarray['val']['t.'.$key] = 0; - } - $totalarray['val']['t.'.$key] += $object->$key; - } } - } - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - // Action column - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($object->id, $arrayofselected)) { - $selected = 1; + foreach ($object->fields as $key => $val) { + $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); + if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { + $cssforfield .= ($cssforfield ? ' ' : '').'center'; + } elseif ($key == 'status') { + $cssforfield .= ($cssforfield ? ' ' : '').'center'; } - print ''; - } - print ''; - } - if (!$i) { - $totalarray['nbfield']++; - } - print ''."\n"; + if (in_array($val['type'], array('timestamp'))) { + $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + } elseif ($key == 'ref') { + $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + } + + if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'ref', 'status')) && empty($val['arrayofkeyval'])) { + $cssforfield .= ($cssforfield ? ' ' : '').'right'; + } + //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; + + if (!empty($arrayfields['t.'.$key]['checked'])) { + print ''; + if ($key == 'status') { + print $object->getLibStatut(5); + } elseif ($key == 'ref') { + print $object->getNomUrl(1, 0, '', (($projectid > 0)?'withproject':'')); + } else { + print $object->showOutputField($val, $key, $object->$key, ''); + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + if (!empty($val['isameasure']) && $val['isameasure'] == 1) { + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key; + } + if (!isset($totalarray['val'])) { + $totalarray['val'] = array(); + } + if (!isset($totalarray['val']['t.'.$key])) { + $totalarray['val']['t.'.$key] = 0; + } + $totalarray['val']['t.'.$key] += $object->$key; + } + } + } + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($object->id, $arrayofselected)) { + $selected = 1; + } + print ''; + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + print ''."\n"; + } $i++; } diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 340686668e6..42c64613933 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -607,7 +607,7 @@ if ($resql) { } print ''; - print $form->select_dolusers($search_employee, "search_employee", 1, "", $disabled, $include, '', 0, 0, 0, $morefilter, 0, '', 'maxwidth150'); + print $form->select_dolusers($search_employee, "search_employee", 1, "", $disabled, $include, '', 0, 0, 0, $morefilter, 0, '', 'maxwidth125'); print ''; } @@ -622,7 +622,7 @@ if ($resql) { foreach ($valideurobjects as $val) { $valideurarray[$val->id] = $val->id; } - print $form->select_dolusers($search_valideur, "search_valideur", 1, "", 0, $valideurarray, '', 0, 0, 0, $morefilter, 0, '', 'maxwidth150'); + print $form->select_dolusers($search_valideur, "search_valideur", 1, "", 0, $valideurarray, '', 0, 0, 0, $morefilter, 0, '', 'maxwidth125'); print ''; } else { print ' '; @@ -642,7 +642,7 @@ if ($resql) { //$labeltoshow .= ($val['delay'] > 0 ? ' ('.$langs->trans("NoticePeriod").': '.$val['delay'].' '.$langs->trans("days").')':''); $arraytypeleaves[$val['rowid']] = $labeltoshow; } - print $form->selectarray('search_type', $arraytypeleaves, $search_type, 1, 0, 0, '', 0, 0, 0, '', '', 1); + print $form->selectarray('search_type', $arraytypeleaves, $search_type, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100', 1); } print ''; } diff --git a/htdocs/holiday/month_report.php b/htdocs/holiday/month_report.php index fe2d33ff78a..9b611c18852 100644 --- a/htdocs/holiday/month_report.php +++ b/htdocs/holiday/month_report.php @@ -118,16 +118,16 @@ if (empty($reshook)) { } $arrayfields = array( - 'cp.ref'=>array('label' => 'Ref', 'checked'=>1), - 'cp.fk_user'=>array('label' => 'Employee', 'checked'=>1), - 'cp.fk_type'=>array('label' => 'Type', 'checked'=>1), - 'cp.date_debut'=>array('label' => 'DateDebCP', 'checked'=>1), - 'cp.date_fin'=>array('label' => 'DateFinCP', 'checked'=>1), - 'used_days'=>array('label' => 'NbUseDaysCPShort', 'checked'=>1), - 'date_start_month'=>array('label' => 'DateStartInMonth', 'checked'=>1), - 'date_end_month'=>array('label' => 'DateEndInMonth', 'checked'=>1), - 'used_days_month'=>array('label' => 'NbUseDaysCPShortInMonth', 'checked'=>1), - 'cp.description'=>array('label' => 'DescCP', 'checked'=>1), + 'cp.ref'=>array('label' => 'Ref', 'checked'=>1, 'position'=>5), + 'cp.fk_type'=>array('label' => 'Type', 'checked'=>1, 'position'=>10), + 'cp.fk_user'=>array('label' => 'Employee', 'checked'=>1, 'position'=>20), + 'cp.date_debut'=>array('label' => 'DateDebCP', 'checked'=>1, 'position'=>30), + 'cp.date_fin'=>array('label' => 'DateFinCP', 'checked'=>1, 'position'=>32), + 'used_days'=>array('label' => 'NbUseDaysCPShort', 'checked'=>1, 'position'=>34), + 'date_start_month'=>array('label' => 'DateStartInMonth', 'checked'=>1, 'position'=>50), + 'date_end_month'=>array('label' => 'DateEndInMonth', 'checked'=>1, 'position'=>52), + 'used_days_month'=>array('label' => 'NbUseDaysCPShortInMonth', 'checked'=>1, 'position'=>54), + 'cp.description'=>array('label' => 'DescCP', 'checked'=>-1, 'position'=>800), ); @@ -149,7 +149,7 @@ $search_month = GETPOST("remonth", 'int') ?GETPOST("remonth", 'int') : date("m", $search_year = GETPOST("reyear", 'int') ?GETPOST("reyear", 'int') : date("Y", time()); $year_month = sprintf("%04d", $search_year).'-'.sprintf("%02d", $search_month); -$sql = "SELECT cp.rowid, cp.ref, cp.fk_user, cp.date_debut, cp.date_fin, cp.fk_type, cp.description, cp.halfday"; +$sql = "SELECT cp.rowid, cp.ref, cp.fk_user, cp.date_debut, cp.date_fin, cp.fk_type, cp.description, cp.halfday, cp.statut as status"; $sql .= " FROM ".MAIN_DB_PREFIX."holiday cp"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user u ON cp.fk_user = u.rowid"; $sql .= " WHERE cp.rowid > 0"; @@ -250,13 +250,6 @@ if (!empty($arrayfields['cp.ref']['checked'])) { print ''; } -// Filter: Employee -if (!empty($arrayfields['cp.fk_user']['checked'])) { - print ''; - print $form->select_dolusers($search_employee, "search_employee", 1, null, 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth100'); - print ''; -} - // Filter: Type if (!empty($arrayfields['cp.fk_type']['checked'])) { $typeleaves = $holidaystatic->getTypes(1, -1); @@ -267,7 +260,14 @@ if (!empty($arrayfields['cp.fk_type']['checked'])) { } print ''; - print $form->selectarray('search_type', $arraytypeleaves, $search_type, 1, 0, 0, '', 0, 0, 0, '', '', 1); + print $form->selectarray('search_type', $arraytypeleaves, $search_type, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100', 1); + print ''; +} + +// Filter: Employee +if (!empty($arrayfields['cp.fk_user']['checked'])) { + print ''; + print $form->select_dolusers($search_employee, "search_employee", 1, null, 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth100'); print ''; } @@ -313,12 +313,12 @@ if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { if (!empty($arrayfields['cp.ref']['checked'])) { print_liste_field_titre($arrayfields['cp.ref']['label'], $_SERVER["PHP_SELF"], 'cp.ref', '', '', '', $sortfield, $sortorder); } -if (!empty($arrayfields['cp.fk_user']['checked'])) { - print_liste_field_titre($arrayfields['cp.fk_user']['label'], $_SERVER["PHP_SELF"], 'cp.fk_user', '', '', '', $sortfield, $sortorder); -} if (!empty($arrayfields['cp.fk_type']['checked'])) { print_liste_field_titre($arrayfields['cp.fk_type']['label'], $_SERVER["PHP_SELF"], 'cp.fk_type', '', '', '', $sortfield, $sortorder); } +if (!empty($arrayfields['cp.fk_user']['checked'])) { + print_liste_field_titre($arrayfields['cp.fk_user']['label'], $_SERVER["PHP_SELF"], 'cp.fk_user', '', '', '', $sortfield, $sortorder); +} if (!empty($arrayfields['ct.label']['checked'])) { print_liste_field_titre($arrayfields['ct.label']['label'], $_SERVER["PHP_SELF"], 'ct.label', '', '', '', $sortfield, $sortorder); } @@ -398,6 +398,15 @@ if ($num == 0) { // Leave request $holidaystatic->id = $obj->rowid; $holidaystatic->ref = $obj->ref; + $holidaystatic->statut = $obj->status; + $holidaystatic->status = $obj->status; + $holidaystatic->fk_user = $obj->fk_user; + $holidaystatic->fk_type = $obj->fk_type; + $holidaystatic->description = $obj->description; + $holidaystatic->halfday = $obj->halfday; + $holidaystatic->date_debut = $db->jdate($obj->date_debut); + $holidaystatic->date_fin = $db->jdate($obj->date_fin); + print ''; // Action column @@ -408,12 +417,12 @@ if ($num == 0) { if (!empty($arrayfields['cp.ref']['checked'])) { print ''.$holidaystatic->getNomUrl(1, 1).''; } - if (!empty($arrayfields['cp.fk_user']['checked'])) { - print ''.$user->getFullName($langs).''; - } if (!empty($arrayfields['cp.fk_type']['checked'])) { print ''.$arraytypeleaves[$obj->fk_type].''; } + if (!empty($arrayfields['cp.fk_user']['checked'])) { + print ''.$user->getFullName($langs).''; + } if (!empty($arrayfields['cp.date_debut']['checked'])) { print ''.dol_print_date($db->jdate($obj->date_debut), 'day'); @@ -447,7 +456,11 @@ if ($num == 0) { print ''.num_open_day($date_start_inmonth, $date_end_inmonth, 0, 1, $halfdayinmonth).''; } if (!empty($arrayfields['cp.description']['checked'])) { - print ''.dolGetFirstLineOfText(dol_string_nohtmltag($obj->description, 1)).''; + print ''; + print '
'; + print dolGetFirstLineOfText(dol_string_nohtmltag($obj->description, 1)); + print '
'; + print ''; } // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { diff --git a/htdocs/holiday/view_log.php b/htdocs/holiday/view_log.php index 9bd55252a43..4235b7261eb 100644 --- a/htdocs/holiday/view_log.php +++ b/htdocs/holiday/view_log.php @@ -333,9 +333,8 @@ if (!empty($arrayfields['cpl.date_action']['checked'])) { if (!empty($arrayfields['cpl.fk_user_action']['checked'])) { $validator = new UserGroup($db); $excludefilter = $user->admin ? '' : 'u.rowid <> '.$user->id; - $valideurobjects = $validator->listUsersForGroup($excludefilter); + $valideurobjects = $validator->listUsersForGroup($excludefilter, 1); $valideurarray = array(); - foreach ($valideurobjects as $val) { $valideurarray[$val->id] = $val->id; } diff --git a/htdocs/includes/webklex/php-imap/vendor/autoload.php b/htdocs/includes/webklex/php-imap/vendor/autoload.php index f4e36963c6a..298bedf9b9c 100644 --- a/htdocs/includes/webklex/php-imap/vendor/autoload.php +++ b/htdocs/includes/webklex/php-imap/vendor/autoload.php @@ -13,10 +13,23 @@ require_once __DIR__ . '/composer/autoload_real.php'; return ComposerAutoloaderInit4da13270269c89a28e472e1f7324e6d1::getLoader(); */ + +// Add class/method of PHP8 for compatibility with older versions of PHP +require_once(__DIR__.'/symfony/polyfill-php80/bootstrap.php'); + + spl_autoload_register(function ($class_name) { // Enable this to detect what we need for require_once //var_dump($class_name); + + $preg_match = preg_match('/^Symfony\\\Polyfill\\\Php80\\\/', $class_name); + if (1 === $preg_match) { + $class_name = preg_replace('/\\\/', '/', $class_name); + $class_name = preg_replace('/^Symfony\\/Polyfill\\/Php80\\//', '', $class_name); + require_once __DIR__ . '/symfony/polyfill-php80/' . $class_name . '.php'; + } + $preg_match = preg_match('/^Webklex\\\PHPIMAP\\\/', $class_name); if (1 === $preg_match) { $class_name = preg_replace('/\\\/', '/', $class_name); diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 27153f61568..4c4d79398b2 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -923,6 +923,7 @@ NotAllExportedMovementsCouldBeRecordedAsExported=Not all exported movements coul Miscellaneous=Miscellaneous Calendar=Calendar GroupBy=Group by... +GroupByX=Group by %s ViewFlatList=View flat list ViewAccountList=View ledger ViewSubAccountList=View subaccount ledger @@ -1222,4 +1223,5 @@ AddToContacts=Add address to my contacts LastAccess=Last access UploadAnImageToSeeAPhotoHere=Upload an image from the tab %s to see a photo here LastPasswordChangeDate=Last password change date -PublicVirtualCardUrl=Public virtual user card \ No newline at end of file +PublicVirtualCardUrl=Public virtual user card +TreeView=Tree view diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 8a4efc8466b..b439ec70133 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -2023,11 +2023,11 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead $logouthtmltext .= $langs->trans("Logout").'
'; $logouttext .= ''; - $logouttext .= img_picto($langs->trans('Logout'), 'sign-out', '', false, 0, 0, '', 'atoplogin'); + $logouttext .= img_picto($langs->trans('Logout'), 'sign-out', '', false, 0, 0, '', 'atoplogin valignmiddle'); $logouttext .= ''; } else { $logouthtmltext .= $langs->trans("NoLogoutProcessWithAuthMode", $_SESSION["dol_authmode"]); - $logouttext .= img_picto($langs->trans('Logout'), 'sign-out', '', false, 0, 0, '', 'atoplogin opacitymedium'); + $logouttext .= img_picto($langs->trans('Logout'), 'sign-out', '', false, 0, 0, '', 'atoplogin valignmiddle opacitymedium'); } } diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index c988da72b3f..cbac98b693c 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -81,7 +81,7 @@ class MyObject extends CommonObject * 'date', 'datetime', 'timestamp', 'duration', * 'boolean', 'checkbox', 'radio', 'array', * 'mail', 'phone', 'url', 'password', 'ip' - * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" + * Note: Filter must be a Dolibarr filter syntax string. Example: "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.status:!=:0) or (t.nature:is:NULL)" * 'label' the translation key. * 'picto' is code of a picto to show before value in forms * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM' or 'isModEnabled("multicurrency")' ...) diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 3dc116d9931..0d2724ff3bb 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -1304,7 +1304,7 @@ if ($action == 'create' && $user->rights->projet->creer) { // Budget print ''.$langs->trans("Budget").''; - if (strcmp($object->budget_amount, '')) { + if (!is_null($object->budget_amount) && strcmp($object->budget_amount, '')) { print ''.price($object->budget_amount, 0, $langs, 1, 0, 0, $conf->currency).''; } print ''; @@ -1448,9 +1448,11 @@ if ($action == 'create' && $user->rights->projet->creer) { '; } + /* * Actions Buttons */ + print '
'; $parameters = array(); $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been diff --git a/htdocs/projet/comment.php b/htdocs/projet/comment.php index 024dce3abc9..7103916cdb4 100644 --- a/htdocs/projet/comment.php +++ b/htdocs/projet/comment.php @@ -136,7 +136,7 @@ print ''; // Budget print ''.$langs->trans("Budget").''; -if (strcmp($object->budget_amount, '')) { +if (!is_null($object->budget_amount) && strcmp($object->budget_amount, '')) { print price($object->budget_amount, '', $langs, 1, 0, 0, $conf->currency); } print ''; diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index f6827fc19b3..2174a02c347 100644 --- a/htdocs/projet/contact.php +++ b/htdocs/projet/contact.php @@ -387,7 +387,7 @@ if ($id > 0 || !empty($ref)) { // Budget print ''.$langs->trans("Budget").''; - if (strcmp($object->budget_amount, '')) { + if (!is_null($object->budget_amount) && strcmp($object->budget_amount, '')) { print ''.price($object->budget_amount, '', $langs, 0, 0, 0, $conf->currency).''; } print ''; diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 7bad7fd493d..8f548685631 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -291,14 +291,14 @@ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { // Opportunity percent print ''.$langs->trans("OpportunityProbability").''; - if (strcmp($object->opp_percent, '')) { + if (!is_null($object->opp_percent) && strcmp($object->opp_percent, '')) { print price($object->opp_percent, '', $langs, 1, 0).' %'; } print ''; // Opportunity Amount print ''.$langs->trans("OpportunityAmount").''; - if (strcmp($object->opp_amount, '')) { + if (!is_null($object->opp_amount) && strcmp($object->opp_amount, '')) { print ''.price($object->opp_amount, '', $langs, 1, 0, 0, $conf->currency).''; if (strcmp($object->opp_percent, '')) { print '       '.$langs->trans("Weighted").': '.price($object->opp_amount * $object->opp_percent / 100, 0, $langs, 1, 0, -1, $conf->currency).''; @@ -309,7 +309,7 @@ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { // Budget print ''.$langs->trans("Budget").''; -if (strcmp($object->budget_amount, '')) { +if (!is_null($object->budget_amount) && strcmp($object->budget_amount, '')) { print ''.price($object->budget_amount, '', $langs, 1, 0, 0, $conf->currency).''; } print ''; @@ -657,7 +657,6 @@ if (!empty($conf->global->PROJECT_ELEMENTS_FOR_MINUS_MARGIN)) { } - $parameters = array('listofreferent'=>$listofreferent); $resHook = $hookmanager->executeHooks('completeListOfReferent', $parameters, $object, $action); @@ -693,7 +692,7 @@ if (!$showdatefilter) { print '
'; print '
'; print ''; - print ''; + print ''; print ''; print '
'; print $form->selectDate($dates, 'dates', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From")); @@ -730,7 +729,7 @@ $tooltiponprofitplus = $tooltiponprofitminus = ''; foreach ($listofreferent as $key => $value) { $name = $langs->trans($value['name']); $qualified = $value['test']; - $margin = $value['margin']; + $margin = empty($value['margin']) ? 0 : $value['margin']; if ($qualified && isset($margin)) { // If this element must be included into profit calculation ($margin is 'minus' or 'add') if ($margin == 'add') { $tooltiponprofitplus .= ' > '.$name." (+)
\n"; @@ -777,8 +776,8 @@ foreach ($listofreferent as $key => $value) { $tablename = $value['table']; $datefieldname = $value['datefieldname']; $qualified = $value['test']; - $margin = $value['margin']; - $project_field = $value['project_field']; + $margin = empty($value['margin']) ? 0 : $value['margin']; + $project_field = empty($value['project_field']) ? '' : $value['project_field']; if ($qualified && isset($margin)) { // If this element must be included into profit calculation ($margin is 'minus' or 'add') $element = new $classname($db); @@ -990,11 +989,11 @@ foreach ($listofreferent as $key => $value) { $tablename = $value['table']; $datefieldname = $value['datefieldname']; $qualified = $value['test']; - $langtoload = $value['lang']; - $urlnew = $value['urlnew']; - $buttonnew = $value['buttonnew']; - $testnew = $value['testnew']; - $project_field = $value['project_field']; + $langtoload = empty($value['lang']) ? '' : $value['lang']; + $urlnew = empty($value['urlnew']) ? '' : $value['urlnew']; + $buttonnew = empty($value['buttonnew']) ? '' : $value['buttonnew']; + $testnew = empty($value['testnew']) ? '' : $value['testnew']; + $project_field = empty($value['project_field']) ? '' : $value['project_field']; $exclude_select_element = array('payment_various'); if (!empty($value['exclude_select_element'])) { diff --git a/htdocs/projet/ganttview.php b/htdocs/projet/ganttview.php index 07ff2bd38c9..47f7cb0a9ef 100644 --- a/htdocs/projet/ganttview.php +++ b/htdocs/projet/ganttview.php @@ -181,7 +181,7 @@ if (($id > 0 && is_numeric($id)) || !empty($ref)) { // Budget print ''.$langs->trans("Budget").''; - if (strcmp($object->budget_amount, '')) { + if (!is_null($object->budget_amount) && strcmp($object->budget_amount, '')) { print price($object->budget_amount, '', $langs, 1, 0, 0, $conf->currency); } print ''; diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 877cd910311..ec10af0f884 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -637,7 +637,7 @@ if ($id > 0 || !empty($ref)) { // Budget print ''.$langs->trans("Budget").''; - if (strcmp($object->budget_amount, '')) { + if (!is_null($object->budget_amount) && strcmp($object->budget_amount, '')) { print ''.price($object->budget_amount, '', $langs, 1, 0, 0, $conf->currency).''; } print ''; diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index fccf9d2ffe1..dfa26202a2d 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -632,7 +632,7 @@ if ($id > 0 || !empty($ref)) { // Budget print ''.$langs->trans("Budget").''; - if (strcmp($object->budget_amount, '')) { + if (!is_null($object->budget_amount) && strcmp($object->budget_amount, '')) { print ''.price($object->budget_amount, 0, $langs, 1, 0, 0, $conf->currency).''; } print ''; diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 3c8597cd862..df2dd77175f 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -1012,7 +1012,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser // Budget print ''.$langs->trans("Budget").''; - if (strcmp($projectstatic->budget_amount, '')) { + if (!is_null($projectstatic->budget_amount) && strcmp($projectstatic->budget_amount, '')) { print ''.price($projectstatic->budget_amount, '', $langs, 1, 0, 0, $conf->currency).''; } print ''; @@ -2669,7 +2669,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser if (!count($tasks)) { $totalnboffields = 1; foreach ($arrayfields as $value) { - if ($value['checked']) { + if (!empty($value['checked'])) { $totalnboffields++; } } diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index e3df53d52cb..027305965ed 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -156,6 +156,7 @@ th.liste_titre a div div:hover, th.liste_titre_sel a div div:hover { text-decora tr.liste_titre th.liste_titre_sel:not(.maxwidthsearch), tr.liste_titre td.liste_titre_sel:not(.maxwidthsearch), tr.liste_titre th.liste_titre:not(.maxwidthsearch), tr.liste_titre td.liste_titre:not(.maxwidthsearch) { opacity: 0.8; } /* th.liste_titre_sel a, th.liste_titre a, td.liste_titre_sel a, td.liste_titre a { color: #766; } */ +tr.liste_titre_filter th.liste_titre { text-align: unset; } input { font-size: unset; @@ -3839,12 +3840,12 @@ table.liste, table.noborder, table.formdoc, div.noborder { box-shadow: 1px 1px 5px #ddd; */ } -#tablelines { +#tablelines, #tablelinesservice { border-bottom-width: 1px; border-bottom-color: var(--colortopbordertitle1); border-bottom-style: solid; } -table.liste tr:last-of-type td, table.noborder:not(#tablelines) tr:last-of-type td, table.formdoc tr:last-of-type td, div.noborder tr:last-of-type td { +table.liste tr:last-of-type td, table.noborder:not(#tablelines):not(#tablelinesservice) tr:last-of-type td, table.formdoc tr:last-of-type td, div.noborder tr:last-of-type td { border-bottom-width: 1px; border-bottom-color: var(--colortopbordertitle1); border-bottom-style: solid; @@ -4397,10 +4398,10 @@ div.tabBar .noborder { box-shadow: 0px 0px 0px #DDD !important; } -#tablelines tr.liste_titre td, .paymenttable tr.liste_titre td, .margintable tr.liste_titre td, .tableforservicepart1 tr.liste_titre td { +#tablelines tr.liste_titre td, #tablelinesservice tr.liste_titre td, .paymenttable tr.liste_titre td, .margintable tr.liste_titre td, .tableforservicepart1 tr.liste_titre td { border-bottom: 1px solid var(--colortopbordertitle1) !important; } -#tablelines tr td { +#tablelines tr td, #tablelinesservice tr td { height: unset; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 429940fd537..2493afa058b 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -3136,11 +3136,11 @@ div.login_block { } div.login_block a { - color: var(--colortextbackhmenu); + color: var(--colortexthmenu); display: inline-block; } div.login_block span.aversion { - color: var(--colortextbackhmenu); + color: var(--colortexthmenu); filter: contrast(0.7); } div.login_block table { @@ -3152,10 +3152,10 @@ div.login { float: right; } div.login a { - color: var(--colortextbackvmenu); + color: var(--colortextvmenu); } div.login a:hover { - color: var(--colortextbackvmenu); + color: var(--colortextvmenu); text-decoration:underline; } div.login_block_user, div.login_block_other { clear: both; } @@ -3177,10 +3177,14 @@ div.login_block_other { padding-top: 15px; } max-width: 200px; } +.login_block_other .login_block_elem { + height: 25px; + line-height: 25px; +} .login_block_elem { float: right; - vertical-align: top; - padding: 0px 0px 0px 2px !important; + vertical-align: middle; + padding: 0px 3px 0px 3px !important; height: 18px; } .login_block_elem_name { @@ -3195,7 +3199,7 @@ a.aversion { } .atoplogin, .atoplogin:hover { - color: var(--colortextbackhmenu) !important; + color: var(--colortexthmenu) !important; } .alogin, .alogin:hover { color: #888 !important; @@ -4415,6 +4419,7 @@ tr.liste_titre:last-child th.liste_titre, tr.liste_titre:last-child th.liste_tit /* border-bottom: 1px solid var(--colortopbordertitle1); */ border-bottom: none; } +tr.liste_titre_filter th.liste_titre { text-align: unset; } div.liste_titre { padding-left: 3px; @@ -4498,10 +4503,10 @@ div .tdtop:not(.tagtdnote) { padding-bottom: 0px !important; } -#tablelines tr.liste_titre td, .paymenttable tr.liste_titre td, .margintable tr.liste_titre td, .tableforservicepart1 tr.liste_titre td { +#tablelines tr.liste_titre td, #tablelinesservice tr.liste_titre td, .paymenttable tr.liste_titre td, .margintable tr.liste_titre td, .tableforservicepart1 tr.liste_titre td { border-bottom: 1px solid #AAA !important; } -#tablelines tr td { +#tablelines tr td, #tablelinesservice tr td { height: unset; } diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index e0f880264f9..be035f7ea46 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -294,7 +294,7 @@ class Ticket extends CommonObject 'email_msgid' => array('type'=>'varchar(255)', 'label'=>'EmailMsgID', 'visible'=>-2, 'enabled'=>1, 'position'=>540, 'notnull'=>-1, 'help'=>'EmailMsgIDDesc', 'csslist'=>'tdoverflowmax100'), 'email_date' => array('type'=>'datetime', 'label'=>'EmailDate', 'visible'=>-2, 'enabled'=>1, 'position'=>541), 'progress' => array('type'=>'integer', 'label'=>'Progression', 'visible'=>-1, 'enabled'=>1, 'position'=>540, 'notnull'=>-1, 'css'=>'right', 'help'=>"", 'isameasure'=>2, 'csslist'=>'width50'), - 'resolution' => array('type'=>'integer', 'label'=>'Resolution', 'visible'=>-1, 'enabled'=>'$conf->global->TICKET_ENABLE_RESOLUTION', 'position'=>550, 'notnull'=>1), + 'resolution' => array('type'=>'integer', 'label'=>'Resolution', 'visible'=>-1, 'enabled'=>'getDolGlobalString("TICKET_ENABLE_RESOLUTION")', 'position'=>550, 'notnull'=>1), 'fk_statut' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>600, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array(0 => 'Unread', 1 => 'Read', 3 => 'Answered', 4 => 'Assigned', 5 => 'InProgress', 6 => 'Waiting', 8 => 'SolvedClosed', 9 => 'Deleted')), 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>900), ); diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 089e082fae3..f8610a7ff85 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -694,6 +694,7 @@ class User extends CommonObject global $conf; // For compatibility with bad naming permissions on module $moduletomoduletouse = array( + 'compta' => 'comptabilite', 'contract' => 'contrat', 'member' => 'adherent', 'mo' => 'mrp', @@ -721,7 +722,8 @@ class User extends CommonObject $moduleRightsMapping = array( 'product' => 'produit', // We must check $user->rights->produit... - 'margin' => 'margins' + 'margin' => 'margins', + 'comptabilite' => 'compta' ); $rightsPath = $module; @@ -743,8 +745,10 @@ class User extends CommonObject // In $conf->modules, we have 'accounting', 'product', 'facture', ... // In $user->rights, we have 'accounting', 'produit', 'facture', ... //var_dump($module); + //var_dump($rightsPath); //var_dump($this->rights->$rightsPath); //var_dump($conf->modules); + //var_dump($module.' '.isModEnabled($module).' '.$rightsPath.' '.$permlevel1.' '.$permlevel2); if (!isModEnabled($module)) { return 0; } @@ -761,6 +765,7 @@ class User extends CommonObject } //var_dump($this->rights); + //var_dump($rightsPath.' '.$permlevel1.' '.$permlevel2); if (empty($rightsPath) || empty($this->rights) || empty($this->rights->$rightsPath) || empty($permlevel1)) { return 0; }