Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2017-12-08 12:38:33 +01:00
commit acd4e0b083
11 changed files with 34 additions and 23 deletions

View File

@ -2262,10 +2262,10 @@ if ($action == 'create')
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#">' . $langs->trans('Validate') . '</a></div>';
}
// Create event
if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a "workflow" action so should appears somewhere else on page.
/*if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a "workflow" action so should appears somewhere else on page.
{
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid . '">' . $langs->trans("AddAction") . '</a></div>';
}
}*/
// Edit
if ($object->statut == Propal::STATUS_VALIDATED && $user->rights->propal->creer) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=modif">' . $langs->trans('Modify') . '</a></div>';

View File

@ -683,6 +683,7 @@ class Propal extends CommonObject
// Anciens indicateurs: $price, $remise (a ne plus utiliser)
$price = $pu;
$remise = 0;
if ($remise_percent > 0)
{
$remise = round(($pu * $remise_percent / 100), 2);
@ -1983,7 +1984,7 @@ class Propal extends CommonObject
$sql.= " SET fk_availability = '".$id."'";
$sql.= " WHERE rowid = ".$this->id;
dol_syslog(__METHOD__.' availability('.$availability_id.')', LOG_DEBUG);
dol_syslog(__METHOD__.' availability('.$id.')', LOG_DEBUG);
$resql=$this->db->query($sql);
if (!$resql)
{
@ -3103,6 +3104,7 @@ class Propal extends CommonObject
global $langs;
$langs->load("propal");
$statuttrans='';
if ($statut==self::STATUS_DRAFT) $statuttrans='statut0';
if ($statut==self::STATUS_VALIDATED) $statuttrans='statut1';
if ($statut==self::STATUS_SIGNED) $statuttrans='statut3';
@ -3151,6 +3153,9 @@ class Propal extends CommonObject
$langs->load("propal");
$now=dol_now();
$delay_warning = 0;
$statut = 0;
$label = '';
if ($mode == 'opened') {
$delay_warning=$conf->propal->cloture->warning_delay;
$statut = self::STATUS_VALIDATED;
@ -3981,9 +3986,9 @@ class PropaleLigne extends CommonObjectLine
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if ko, >0 if ok
*/
function delete($user=null, $notrigger=0)
function delete(User $user, $notrigger=0)
{
global $conf,$user;
global $conf;
$error=0;
$this->db->begin();

View File

@ -2465,12 +2465,12 @@ if ($action == 'create' && $user->rights->commande->creer)
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?id=' . $object->id . '&amp;action=modif">' . $langs->trans('Modify') . '</a></div>';
}
// Create event
if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a
/*if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a
// "workflow" action so should appears somewhere else on
// page.
{
print '<a class="butAction" href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid . '">' . $langs->trans("AddAction") . '</a>';
}
}*/
// Create intervention
if ($conf->ficheinter->enabled) {

View File

@ -437,8 +437,8 @@ class FactureRec extends CommonInvoice
// Retreive all extrafield for line
// fetch optionals attributes and labels
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
$extrafieldsline=new ExtraFields($line->db);
$extrafieldsline=$extrafieldsline->fetch_name_optionals_label($line->table_element,true);
$extrafieldsline=new ExtraFields($this->db);
$extrafieldsline=$extrafieldsline->fetch_name_optionals_label('facturedet_rec',true);
$sql = 'SELECT l.rowid, l.fk_product, l.product_type, l.label as custom_label, l.description, l.product_type, l.price, l.qty, l.vat_src_code, l.tva_tx, ';
$sql.= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.remise, l.remise_percent, l.subprice,';

View File

@ -319,7 +319,8 @@ abstract class CommonInvoice extends CommonObject
// TODO If there is payment in bookkeeping, check payment is not dispatched in accounting
// ...
if ($this->situation_cycle_ref) {
if ($this->situation_cycle_ref && method_exists($this, 'is_last_in_cycle'))
{
$last = $this->is_last_in_cycle();
if (! $last) return -3;
}

View File

@ -518,10 +518,10 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$langs->load("users");
// Home - dashboard
$newmenu->add("/index.php?mainmenu=home&amp;leftmenu=home", $langs->trans("MyDashboard"), 0, 1, '', $mainmenu, 'home', 0, '', '', '', '<i class="fa fa-bar-chart paddingright"></i>');
$newmenu->add("/index.php?mainmenu=home&amp;leftmenu=home", $langs->trans("MyDashboard"), 0, 1, '', $mainmenu, 'home', 0, '', '', '', '<i class="fa fa-bar-chart fa-fw paddingright"></i>');
// Setup
$newmenu->add("/admin/index.php?mainmenu=home&amp;leftmenu=setup", $langs->trans("Setup"), 0, $user->admin, '', $mainmenu, 'setup');
$newmenu->add("/admin/index.php?mainmenu=home&amp;leftmenu=setup", $langs->trans("Setup"), 0, $user->admin, '', $mainmenu, 'setup', 0, '', '', '', '<i class="fa fa-wrench fa-fw paddingright"></i>');
if ($usemenuhider || empty($leftmenu) || $leftmenu=="setup")
{
$langs->load("admin");
@ -558,7 +558,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
}
// System tools
$newmenu->add("/admin/tools/index.php?mainmenu=home&amp;leftmenu=admintools", $langs->trans("AdminTools"), 0, $user->admin, '', $mainmenu, 'admintools');
$newmenu->add("/admin/tools/index.php?mainmenu=home&amp;leftmenu=admintools", $langs->trans("AdminTools"), 0, $user->admin, '', $mainmenu, 'admintools', 0, '', '', '', '<i class="fa fa-server fa-fw paddingright"></i>');
if ($usemenuhider || empty($leftmenu) || preg_match('/^admintools/',$leftmenu))
{
$langs->load("admin");
@ -591,7 +591,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
}
}
$newmenu->add("/user/home.php?leftmenu=users", $langs->trans("MenuUsersAndGroups"), 0, $user->rights->user->user->lire, '', $mainmenu, 'users');
$newmenu->add("/user/home.php?leftmenu=users", $langs->trans("MenuUsersAndGroups"), 0, $user->rights->user->user->lire, '', $mainmenu, 'users', 0, '', '', '', '<i class="fa fa-users fa-fw paddingright"></i>');
if ($user->rights->user->user->lire)
{
if ($usemenuhider || empty($leftmenu) || $leftmenu=="users")

View File

@ -2186,10 +2186,10 @@ elseif (! empty($object->id))
}
}
// Create event
if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a "workflow" action so should appears somewhere else on page.
/*if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a "workflow" action so should appears somewhere else on page.
{
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid . '">' . $langs->trans("AddAction") . '</a></div>';
}
}*/
// Modify
if ($object->statut == 1)

View File

@ -2832,10 +2832,10 @@ else
}
// Create event
if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a "workflow" action so should appears somewhere else on page.
/*if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a "workflow" action so should appears somewhere else on page.
{
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid . '">' . $langs->trans("AddAction") . '</a></div>';
}
}*/
// Clone
if ($action != 'edit' && $user->rights->fournisseur->facture->creer)

View File

@ -156,6 +156,7 @@ ErrorPriceExpression20=Empty expression
ErrorPriceExpression21=Empty result '%s'
ErrorPriceExpression22=Negative result '%s'
ErrorPriceExpression23=Unknown or non set variable '%s' in %s
ErrorPriceExpression24=Variable '%s' exists but has no value
ErrorPriceExpressionInternal=Internal error '%s'
ErrorPriceExpressionUnknown=Unknown error '%s'
ErrorSrcAndTargetWarehouseMustDiffers=Source and target warehouses must differs

View File

@ -82,6 +82,7 @@ class PriceParser
17, undefined variable '%s'
21, empty result '%s'
22, negative result '%s'
24, variable '%s' exists but has no value
-2 Args
6, wrong number of arguments (%s given, %s expected)
@ -192,9 +193,12 @@ class PriceParser
$expression = str_replace("\n", $this->separator_chr, $expression);
foreach ($values as $key => $value)
{
if ($value === null) $value = "NULL";
$expression = str_replace($this->special_chr.$key.$this->special_chr, strval($value), $expression);
}
if ($value === null && strpos($expression, $key) !== false) {
$this->error_parser = array(24, $key);
return -7;
}
$expression = str_replace($this->special_chr.$key.$this->special_chr, strval($value), $expression);
}
//Check if there is unfilled variable
if (strpos($expression, $this->special_chr) !== false)

View File

@ -1034,12 +1034,12 @@ elseif ($object->id > 0)
{
// Create event
if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a
/*if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a
// "workflow" action so should appears somewhere else on
// page.
{
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid . '&amp;projectid=' . $object->id . '">' . $langs->trans("AddAction") . '</a></div>';
}
}*/
// Modify
if ($object->statut != 2 && $user->rights->projet->creer)