Skip to content

Commit

Permalink
Merge branch '7.0' of https://github.com/Dolibarr/dolibarr.git into 7…
Browse files Browse the repository at this point in the history
….0_bug
  • Loading branch information
hregis committed Feb 8, 2018
2 parents 8b7f40e + 729cf20 commit 70a65b8
Show file tree
Hide file tree
Showing 18 changed files with 119 additions and 28 deletions.
4 changes: 3 additions & 1 deletion ChangeLog
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/menus/init_menu_auguria.sql
Expand Up @@ -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&amp;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&amp;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&amp;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&amp;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&amp;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&amp;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&amp;leftmenu=bank', 'MenuBankCash', -1, 'banks', '$user->rights->banque->lire || $user->rights->prelevement->bons->lire', '', 0, 52, __ENTITY__);
Expand Down
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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))
Expand Down
53 changes: 53 additions & 0 deletions htdocs/core/modules/expensereport/mod_expensereport_jade.php
Expand Up @@ -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";
Expand Down
38 changes: 28 additions & 10 deletions htdocs/expensereport/card.php
Expand Up @@ -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))
Expand All @@ -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");

Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -1955,7 +1970,7 @@
print '<input type="hidden" name="id" value="'.$object->id.'">';
print '<input type="hidden" name="fk_expensereport" value="'.$object->id.'" />';

print '<div class="div-table-responsive">';
print '<div class="div-table-responsive-no-min">';
print '<table id="tablelines" class="noborder" width="100%">';

if (!empty($object->lines))
Expand Down Expand Up @@ -2014,7 +2029,10 @@
print '</td>';
}
// print '<td style="text-align:center;">'.$langs->trans("TF_".strtoupper(empty($objp->type_fees_libelle)?'OTHER':$objp->type_fees_libelle)).'</td>';
print '<td style="text-align:center;">'.($langs->trans(($line->type_fees_code)) == $line->type_fees_code ? $line->type_fees_libelle : $langs->trans(($line->type_fees_code))).'</td>';
print '<td style="text-align:center;">';
$labeltype = ($langs->trans(($line->type_fees_code)) == $line->type_fees_code ? $line->type_fees_libelle : $langs->trans($line->type_fees_code));
print $labeltype;
print '</td>';
print '<td style="text-align:left;">'.$line->comments.'</td>';
print '<td style="text-align:right;">'.vatrate($line->vatrate,true).'</td>';
print '<td style="text-align:right;">'.price($line->value_unit).'</td>';
Expand Down
2 changes: 1 addition & 1 deletion htdocs/expensereport/class/expensereport.class.php
Expand Up @@ -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;

Expand Down
1 change: 1 addition & 0 deletions htdocs/langs/en_US/products.lang
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions htdocs/langs/en_US/trips.lang
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions htdocs/projet/activity/perday.php
Expand Up @@ -403,7 +403,7 @@

print '<div class="floatright right'.($conf->dol_optimize_smallscreen?' centpercent':'').'">'.$nav.'</div>'; // We move this before the assign to components so, the default submit button is not the assign to.

print '<div class="float valignmiddle">';
print '<div class="colorback float valignmiddle">';
$titleassigntask = $langs->transnoentities("AssignTaskToMe");
if ($usertoprocess->id != $user->id) $titleassigntask = $langs->transnoentities("AssignTaskToUser", $usertoprocess->getFullName($langs));
print '<div class="taskiddiv inline-block">';
Expand Down Expand Up @@ -431,7 +431,7 @@

// If the user can view user other than himself
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('User'). ': ';
$moreforfilter.='<div class="inline-block hideonsmartphone">'.$langs->trans('User'). ' </div>';
$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');
Expand Down
4 changes: 2 additions & 2 deletions htdocs/projet/activity/perweek.php
Expand Up @@ -403,7 +403,7 @@

print '<div class="floatright right'.($conf->dol_optimize_smallscreen?' centpercent':'').'">'.$nav.'</div>'; // We move this before the assign to components so, the default submit button is not the assign to.

print '<div class="float valignmiddle">';
print '<div class="colorback float valignmiddle">';
$titleassigntask = $langs->transnoentities("AssignTaskToMe");
if ($usertoprocess->id != $user->id) $titleassigntask = $langs->transnoentities("AssignTaskToUser", $usertoprocess->getFullName($langs));
print '<div class="taskiddiv inline-block">';
Expand Down Expand Up @@ -432,7 +432,7 @@

// If the user can view user other than himself
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('User'). ': ';
$moreforfilter.='<div class="inline-block hideonsmartphone">'.$langs->trans('User'). ' </div>';
$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');
Expand Down
6 changes: 6 additions & 0 deletions htdocs/theme/eldy/style.css.php
Expand Up @@ -2792,6 +2792,12 @@
{
height: 26px !important;
}
div.colorback
{
background: rgb(<?php echo $colorbacktitle1; ?>);
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(<?php echo $colorbacktitle1; ?>);
Expand Down
6 changes: 6 additions & 0 deletions htdocs/theme/md/style.css.php
Expand Up @@ -2483,6 +2483,12 @@
.ficheaddleft table.noborder {
margin: 0px 0px 0px 0px;
}
div.colorback
{
background: rgb(<?php echo $colorbacktitle1; ?>);
padding: 10px;
margin-top: 5px;
}
.liste_titre_bydiv {
border-right: 1px solid #ccc;
border-left: 1px solid #ccc;
Expand Down
4 changes: 2 additions & 2 deletions htdocs/user/card.php
Expand Up @@ -1231,15 +1231,15 @@
if ($mode == 'employee') // For HRM module development
{
$title = $langs->trans("Employee");
$linkback = '<a href="'.DOL_URL_ROOT.'/hrm/employee/list.php">'.$langs->trans("BackToList").'</a>';
$linkback = '<a href="'.DOL_URL_ROOT.'/hrm/employee/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
}
else
{
$title = $langs->trans("User");
$linkback = '';

if ($user->rights->user->user->lire || $user->admin) {
$linkback = '<a href="'.DOL_URL_ROOT.'/user/index.php">'.$langs->trans("BackToList").'</a>';
$linkback = '<a href="'.DOL_URL_ROOT.'/user/index.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
}
}

Expand Down
1 change: 0 additions & 1 deletion htdocs/user/class/usergroup.class.php
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion htdocs/user/group/card.php
Expand Up @@ -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 = '<a href="'.DOL_URL_ROOT.'/user/group/index.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';

dol_banner_tab($object,'id',$linkback,$user->rights->user->user->lire || $user->admin);

print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
Expand Down
4 changes: 3 additions & 1 deletion htdocs/user/group/ldap.php
Expand Up @@ -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 = '<a href="'.DOL_URL_ROOT.'/user/group/index.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';

dol_banner_tab($object,'id',$linback,$user->rights->user->user->lire || $user->admin);

print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
Expand Down
3 changes: 2 additions & 1 deletion htdocs/user/group/perms.php
Expand Up @@ -191,8 +191,9 @@
dol_print_error($db);
}

$linkback = '<a href="'.DOL_URL_ROOT.'/user/group/index.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';

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 '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
Expand Down
4 changes: 2 additions & 2 deletions htdocs/user/index.php
Expand Up @@ -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 "<tr>";
if (! empty($arrayfields['u.login']['checked']))
Expand Down Expand Up @@ -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"');
Expand Down

0 comments on commit 70a65b8

Please sign in to comment.