diff --git a/ChangeLog b/ChangeLog index 2cf9f178a161f..3a5fa7d4f371b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -277,7 +277,9 @@ Following changes may create regressions for some external modules, but were nec * Jquery plugin tableDnd updated. You now need to use decodeURI on the return value of tableDnDSerialize() and add 'td.' to the beginning of the dragHandle match string. * IE8 and earlier and Firefox 12 and earlier (< 2012) are no more supported. - +* The module ExpenseReport use numbering rules that you can setup (like other modules do). If you need to + keep the hard coded numbering rule of expenses report used in 6.0, just add constant + EXPENSEREPORT_USE_OLD_NUMBERING_RULE to 1. * If you use the external module "multicompany", you must also upgrade the module. Multicompany module for Dolibarr v7 is required because with Dolibarr v7, payment modes and payment conditions are management as data that are dedicated to each company. If you keep your old version of multicompany module, mode and diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index aba48811091db..28eb9fa044af3 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -10,7 +10,7 @@ delete from llx_menu where menu_handler=__HANDLER__ and entity=__ENTITY__; -- insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '1', 1__+MAX_llx_menu__, __HANDLER__, 'top', 'home', '', 0, '/index.php?mainmenu=home&leftmenu=', 'Home', -1, '', '', '', 2, 10, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('societe|fournisseur', '( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)', 2__+MAX_llx_menu__, __HANDLER__, 'top', 'companies', '', 0, '/societe/index.php?mainmenu=companies&leftmenu=', 'ThirdParties', -1, 'companies', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 20, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('product|service', '$conf->product->enabled || $conf->service->enabled', 3__+MAX_llx_menu__, __HANDLER__, 'top', 'products', '', 0, '/product/index.php?mainmenu=products&leftmenu=', 'Products/Services', -1, 'products', '$user->rights->produit->lire||$user->rights->service->lire', '', 0, 30, __ENTITY__); +insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('product|service', '$conf->product->enabled || $conf->service->enabled', 3__+MAX_llx_menu__, __HANDLER__, 'top', 'products', '', 0, '/product/index.php?mainmenu=products&leftmenu=', 'ProductsPipeServices', -1, 'products', '$user->rights->produit->lire||$user->rights->service->lire', '', 0, 30, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('propal|commande|fournisseur|contrat|ficheinter', '$conf->propal->enabled || $conf->commande->enabled || $conf->supplier_order->enabled || $conf->contrat->enabled || $conf->ficheinter->enabled', 5__+MAX_llx_menu__, __HANDLER__, 'top', 'commercial', '', 0, '/comm/index.php?mainmenu=commercial&leftmenu=', 'Commercial', -1, 'commercial', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 40, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('facture|don|tax|salaries|loan|banque', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->don->enabled || $conf->tax->enabled || $conf->salaries->enabled || $conf->supplier_invoice->enabled || $conf->loan->enabled || $conf->banque->enabled', 6__+MAX_llx_menu__, __HANDLER__, 'top', 'billing', '', 0, '/compta/index.php?mainmenu=billing&leftmenu=', 'MenuFinancial', -1, 'compta', '$user->rights->facture->lire|| $user->rights->don->lire || $user->rights->tax->charges->lire || $user->rights->salaries->read || $user->rights->loan->read || $user->rights->banque->lire', '', 2, 50, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('banque|prelevement', '$conf->banque->enabled || $conf->prelevement->enabled', 14__+MAX_llx_menu__, __HANDLER__, 'top', 'bank', '', 0, '/compta/bank/list.php?mainmenu=bank&leftmenu=bank', 'MenuBankCash', -1, 'banks', '$user->rights->banque->lire || $user->rights->prelevement->bons->lire', '', 0, 52, __ENTITY__); diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index 90746afed0e20..15d48694277c0 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -108,8 +108,8 @@ function __construct($db) $this->posxdate=88; $this->posxtype=107; $this->posxprojet=120; - $this->posxtva=136; - $this->posxup=152; + $this->posxtva=138; + $this->posxup=154; $this->posxqty=168; $this->postotalttc=178; if (empty($conf->projet->enabled)) { @@ -328,7 +328,7 @@ function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hid $nextColumnPosX = $this->posxprojet; } - $pdf->MultiCell($nextColumnPosX-$this->posxtype-0.8, 4, dol_trunc($outputlangs->transnoentities($object->lines[$i]->type_fees_code), 12), 0, 'C'); + $pdf->MultiCell($nextColumnPosX-$this->posxtype-0.8, 4, dol_trunc($outputlangs->transnoentities($object->lines[$i]->type_fees_code), 10), 0, 'C'); // Project if (! empty($conf->projet->enabled)) diff --git a/htdocs/core/modules/expensereport/mod_expensereport_jade.php b/htdocs/core/modules/expensereport/mod_expensereport_jade.php index c85625cabf8f0..c6153d422eb65 100644 --- a/htdocs/core/modules/expensereport/mod_expensereport_jade.php +++ b/htdocs/core/modules/expensereport/mod_expensereport_jade.php @@ -101,6 +101,59 @@ function getNextValue($object) { global $db,$conf; + // For backward compatibility and restore old behavior to get ref of expense report + if ($conf->global->EXPENSEREPORT_USE_OLD_NUMBERING_RULE) + { + $fuser = null; + if ($object->fk_user_author > 0) + { + $fuser=new User($db); + $fuser->fetch($object->fk_user_author); + } + + $expld_car = (empty($conf->global->NDF_EXPLODE_CHAR))?"-":$conf->global->NDF_EXPLODE_CHAR; + $num_car = (empty($conf->global->NDF_NUM_CAR_REF))?"5":$conf->global->NDF_NUM_CAR_REF; + + $sql = 'SELECT MAX(de.ref_number_int) as max'; + $sql.= ' FROM '.MAIN_DB_PREFIX.'expensereport de'; + + $result = $db->query($sql); + + if($db->num_rows($result) > 0): + $objp = $db->fetch_object($result); + $newref = $objp->max; + $newref++; + while(strlen($newref) < $num_car): + $newref = "0".$newref; + endwhile; + else: + $newref = 1; + while(strlen($newref) < $num_car): + $newref = "0".$newref; + endwhile; + endif; + + $ref_number_int = ($newref+1)-1; + $update_number_int = true; + + $user_author_infos = dolGetFirstLastname($fuser->firstname, $fuser->lastname); + + $prefix="ER"; + if (! empty($conf->global->EXPENSE_REPORT_PREFIX)) $prefix=$conf->global->EXPENSE_REPORT_PREFIX; + $newref = str_replace(' ','_', $user_author_infos).$expld_car.$prefix.$newref.$expld_car.dol_print_date($object->date_debut,'%y%m%d'); + + $sqlbis = 'UPDATE '.MAIN_DB_PREFIX.'expensereport SET ref_number_int = '.$ref_number_int.' WHERE rowid = '.$object->id; + $resqlbis = $db->query($sqlbis); + if (! $resqlbis) + { + dol_print_error($resqlbis); + exit; + } + + dol_syslog("mod_expensereport_jade::getNextValue return ".$newref); + return $newref; + } + // D'abord on recupere la valeur max $posindice=8; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 29bc181a358db..6d989e6efc09e 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -315,11 +315,16 @@ if ($action == "confirm_validate" && GETPOST("confirm") == "yes" && $id > 0 && $user->rights->expensereport->creer) { + $error = 0; + + $db->begin(); + $object = new ExpenseReport($db); $object->fetch($id); + $result = $object->setValidate($user); - if ($result > 0) + if ($result >= 0) { // Define output language if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) @@ -338,8 +343,13 @@ $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); } } + else + { + setEventMessages($object->error, $object->errors, 'errors'); + $error++; + } - if ($result > 0 && $object->fk_user_validator > 0) + if (! $error && $result > 0 && $object->fk_user_validator > 0) { $langs->load("mails"); @@ -387,8 +397,6 @@ { $mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($emailFrom,2),$mailfile->getValidAddress($emailTo,2)); setEventMessages($mesg, null, 'mesgs'); - header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); - exit; } else { @@ -418,10 +426,17 @@ $action=''; } } - else - { - setEventMessages($object->error, $object->errors, 'errors'); - } + + if (! $error) + { + $db->commit(); + header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); + exit; + } + else + { + $db->rollback(); + } } if ($action == "confirm_save_from_refuse" && GETPOST("confirm") == "yes" && $id > 0 && $user->rights->expensereport->creer) @@ -1955,7 +1970,7 @@ print ''; print ''; - print '
'; + print '
'; print ''; if (!empty($object->lines)) @@ -2014,7 +2029,10 @@ print ''; } // print ''; - print ''; + print ''; print ''; print ''; print ''; diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 2052b63fe0c0d..b1523f3bbf917 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -1091,7 +1091,7 @@ function setValidate($fuser, $notrigger=0) { $num = $this->ref; } - if (empty($num)) return -1; + if (empty($num) || $num < 0) return -1; $this->newref = $num; diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 179175041b8f4..1ff1fb0e4273b 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -27,6 +27,7 @@ ProductAccountancySellExportCode=Accounting code (sale export) ProductOrService=Product or Service ProductsAndServices=Products and Services ProductsOrServices=Products or Services +ProductsPipeServices=Products | Services ProductsOnSaleOnly=Products for sale only ProductsOnPurchaseOnly=Products for purchase only ProductsNotOnSell=Products not for sale and not for purchase diff --git a/htdocs/langs/en_US/trips.lang b/htdocs/langs/en_US/trips.lang index ad4f7217d6fa6..a5ab097aa0e38 100644 --- a/htdocs/langs/en_US/trips.lang +++ b/htdocs/langs/en_US/trips.lang @@ -74,6 +74,7 @@ EX_CAM_VP=PV maintenance and repair DefaultCategoryCar=Default transportation mode DefaultRangeNumber=Default range number +Error_EXPENSEREPORT_ADDON_NotDefined=Error, the rule for expense report numbering ref was not defined into setup of module 'Expense Report' ErrorDoubleDeclaration=You have declared another expense report into a similar date range. AucuneLigne=There is no expense report declared yet diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index 3227c3cd5f505..f30b0ac47571a 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -403,7 +403,7 @@ print '
'.$nav.'
'; // We move this before the assign to components so, the default submit button is not the assign to. -print '
'; +print '
'; $titleassigntask = $langs->transnoentities("AssignTaskToMe"); if ($usertoprocess->id != $user->id) $titleassigntask = $langs->transnoentities("AssignTaskToUser", $usertoprocess->getFullName($langs)); print '
'; @@ -431,7 +431,7 @@ // If the user can view user other than himself $moreforfilter.='
'; -$moreforfilter.=$langs->trans('User'). ': '; +$moreforfilter.='
'.$langs->trans('User'). '
'; $includeonly='hierachyme'; if (empty($user->rights->user->user->lire)) $includeonly=array($user->id); $moreforfilter.=$form->select_dolusers($search_usertoprocessid?$search_usertoprocessid:$usertoprocess->id, 'search_usertoprocessid', $user->rights->user->user->lire?0:0, null, 0, $includeonly, null, 0, 0, 0, '', 0, '', 'maxwidth200'); diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index 482d59d85b9e0..a3c8c9ebe545e 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -403,7 +403,7 @@ print '
'.$nav.'
'; // We move this before the assign to components so, the default submit button is not the assign to. -print '
'; +print '
'; $titleassigntask = $langs->transnoentities("AssignTaskToMe"); if ($usertoprocess->id != $user->id) $titleassigntask = $langs->transnoentities("AssignTaskToUser", $usertoprocess->getFullName($langs)); print '
'; @@ -432,7 +432,7 @@ // If the user can view user other than himself $moreforfilter.='
'; -$moreforfilter.=$langs->trans('User'). ': '; +$moreforfilter.='
'.$langs->trans('User'). '
'; $includeonly='hierachyme'; if (empty($user->rights->user->user->lire)) $includeonly=array($user->id); $moreforfilter.=$form->select_dolusers($search_usertoprocessid?$search_usertoprocessid:$usertoprocess->id, 'search_usertoprocessid', $user->rights->user->user->lire?0:0, null, 0, $includeonly, null, 0, 0, 0, '', 0, '', 'maxwidth200'); diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index ad5dd90306467..0b905a0e22b69 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -2792,6 +2792,12 @@ { height: 26px !important; } +div.colorback +{ + background: rgb(); + padding: 10px; + margin-top: 5px; +} div.liste_titre_bydiv, .liste_titre div.tagtr, tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.liste_titre_sel, table.dataTable thead tr { background: rgb(); diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index d9b89ab2b405a..02c9cd9ee741c 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -2483,6 +2483,12 @@ .ficheaddleft table.noborder { margin: 0px 0px 0px 0px; } +div.colorback +{ + background: rgb(); + padding: 10px; + margin-top: 5px; +} .liste_titre_bydiv { border-right: 1px solid #ccc; border-left: 1px solid #ccc; diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 84665839c6bfa..ba327e7c9f193 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1231,7 +1231,7 @@ if ($mode == 'employee') // For HRM module development { $title = $langs->trans("Employee"); - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; } else { @@ -1239,7 +1239,7 @@ $linkback = ''; if ($user->rights->user->user->lire || $user->admin) { - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; } } diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index efb0beceafd32..2e0cd0376c60b 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -796,7 +796,6 @@ function LibStatut($statut,$mode=0) * @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto, -1=Include photo into link, -2=Only picto photo, -3=Only photo very small) * @param string $option On what the link point to ('nolink', ) * @param integer $notooltip 1=Disable tooltip on picto and name - * @param string $mode ''=Show firstname and lastname, 'firstname'=Show only firstname, 'login'=Show login * @param string $morecss Add more css on link * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @return string String with URL diff --git a/htdocs/user/group/card.php b/htdocs/user/group/card.php index 5a68dd1391b6c..8f99fa1bb81b1 100644 --- a/htdocs/user/group/card.php +++ b/htdocs/user/group/card.php @@ -330,7 +330,9 @@ { dol_fiche_head($head, 'group', $title, -1, 'group'); - dol_banner_tab($object,'id','',$user->rights->user->user->lire || $user->admin); + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object,'id',$linkback,$user->rights->user->user->lire || $user->admin); print '
'; print '
'; diff --git a/htdocs/user/group/ldap.php b/htdocs/user/group/ldap.php index ae0d974be9a5b..baf30a023997e 100644 --- a/htdocs/user/group/ldap.php +++ b/htdocs/user/group/ldap.php @@ -105,7 +105,9 @@ dol_fiche_head($head, 'ldap', $langs->trans("Group"), -1, 'group'); -dol_banner_tab($object,'id','',$user->rights->user->user->lire || $user->admin); +$linkback = ''.$langs->trans("BackToList").''; + +dol_banner_tab($object,'id',$linback,$user->rights->user->user->lire || $user->admin); print '
'; print '
'; diff --git a/htdocs/user/group/perms.php b/htdocs/user/group/perms.php index 3b6d7037229b5..740b106c728d6 100644 --- a/htdocs/user/group/perms.php +++ b/htdocs/user/group/perms.php @@ -191,8 +191,9 @@ dol_print_error($db); } + $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($object,'id','',$user->rights->user->user->lire || $user->admin); + dol_banner_tab($object,'id',$linkback,$user->rights->user->user->lire || $user->admin); print '
'; print '
'; diff --git a/htdocs/user/index.php b/htdocs/user/index.php index b2cdd9e3dc670..6f9ac1f638aa8 100644 --- a/htdocs/user/index.php +++ b/htdocs/user/index.php @@ -435,7 +435,7 @@ $userstatic->employee=$obj->employee; $userstatic->photo=$obj->photo; - $li=$userstatic->getNomUrl(-1,'',0,0,24,1,'login'); + $li=$userstatic->getNomUrl(-1,'',0,0,24,1,'login','',1); print "
"; if (! empty($arrayfields['u.login']['checked'])) @@ -541,7 +541,7 @@ $user2->admin=$obj->admin2; $user2->email=$obj->email2; $user2->socid=$obj->fk_soc2; - print $user2->getNomUrl(-1,'',0,0,24,0,''); + print $user2->getNomUrl(-1,'',0,0,24,0,'','',1); if (! empty($conf->multicompany->enabled) && $obj->admin2 && ! $obj->entity2) { print img_picto($langs->trans("SuperAdministrator"), 'redstar', 'class="valignmiddle paddingleft"');
'.$langs->trans("TF_".strtoupper(empty($objp->type_fees_libelle)?'OTHER':$objp->type_fees_libelle)).''.($langs->trans(($line->type_fees_code)) == $line->type_fees_code ? $line->type_fees_libelle : $langs->trans(($line->type_fees_code))).''; + $labeltype = ($langs->trans(($line->type_fees_code)) == $line->type_fees_code ? $line->type_fees_libelle : $langs->trans($line->type_fees_code)); + print $labeltype; + print ''.$line->comments.''.vatrate($line->vatrate,true).''.price($line->value_unit).'