diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index 502ec7a74da..ac068fb5f6e 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -2259,6 +2259,7 @@ class Facture extends CommonInvoice
else $result=$mouvP->livraison($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarr",$num));
if ($result < 0) {
$error++;
+ $this->error = $mouvP->error;
}
}
}
diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php
index 55a89da8c57..cf37b749b5b 100644
--- a/htdocs/core/lib/security.lib.php
+++ b/htdocs/core/lib/security.lib.php
@@ -243,9 +243,9 @@ function restrictedArea($user, $features, $objectid=0, $tableandshare='', $featu
{
foreach($feature2 as $subfeature)
{
- if (empty($user->rights->$feature->$subfeature->creer)
- && empty($user->rights->$feature->$subfeature->write)
- && empty($user->rights->$feature->$subfeature->create)) { $createok=0; $nbko++; }
+ if (empty($user->rights->$feature->$subfeature->creer)
+ && empty($user->rights->$feature->$subfeature->write)
+ && empty($user->rights->$feature->$subfeature->create)) { $createok=0; $nbko++; }
else { $createok=1; break; } // Break to bypass second test if the first is ok
}
}
@@ -308,6 +308,9 @@ function restrictedArea($user, $features, $objectid=0, $tableandshare='', $featu
else if ($feature == 'ftp')
{
if (! $user->rights->ftp->write) $deleteok=0;
+ }else if ($feature == 'salaries')
+ {
+ if (! $user->rights->salaries->delete) $deleteok=0;
}
else if ($feature == 'salaries')
{
diff --git a/htdocs/index.php b/htdocs/index.php
index 9022966a626..9d2414e35dd 100644
--- a/htdocs/index.php
+++ b/htdocs/index.php
@@ -559,7 +559,7 @@ if (! empty($valid_dashboardlines))
$boxwork.='
| ';
foreach($valid_dashboardlines as $board)
{
- if (empty($boad->nbtodo)) $nbworkboardempty++;
+ if (empty($board->nbtodo)) $nbworkboardempty++;
$textlate = $langs->trans("NActionsLate",$board->nbtodolate);
$textlate.= ' ('.$langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($board->warning_delay) >= 0 ? '+' : '').ceil($board->warning_delay).' '.$langs->trans("days").')';
diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php
index ae24f0dc178..32d8aa1c2aa 100644
--- a/htdocs/loan/card.php
+++ b/htdocs/loan/card.php
@@ -1,5 +1,5 @@
+/* Copyright (C) 2014-2017 Alexandre Spangaro
* Copyright (C) 2015 Frederic France
* Copyright (C) 2017 Laurent Destailleur
*
@@ -18,9 +18,9 @@
*/
/**
- * \file htdocs/loan/card.php
- * \ingroup loan
- * \brief Loan card
+ * \file htdocs/loan/card.php
+ * \ingroup loan
+ * \brief Loan card
*/
require '../main.inc.php';
@@ -61,68 +61,68 @@ $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook))
{
- // Classify paid
- if ($action == 'confirm_paid' && $confirm == 'yes')
- {
- $object->fetch($id);
- $result = $object->set_paid($user);
- if ($result > 0)
- {
- setEventMessages($langs->trans('LoanPaid'), null, 'mesgs');
- }
- else
- {
- setEventMessages($loan->error, null, 'errors');
- }
- }
+ // Classify paid
+ if ($action == 'confirm_paid' && $confirm == 'yes')
+ {
+ $object->fetch($id);
+ $result = $object->set_paid($user);
+ if ($result > 0)
+ {
+ setEventMessages($langs->trans('LoanPaid'), null, 'mesgs');
+ }
+ else
+ {
+ setEventMessages($loan->error, null, 'errors');
+ }
+ }
- // Delete loan
- if ($action == 'confirm_delete' && $confirm == 'yes')
- {
- $object->fetch($id);
- $result=$object->delete($user);
- if ($result > 0)
- {
- setEventMessages($langs->trans('LoanDeleted'), null, 'mesgs');
- header("Location: index.php");
- exit;
- }
- else
- {
- setEventMessages($loan->error, null, 'errors');
- }
- }
+ // Delete loan
+ if ($action == 'confirm_delete' && $confirm == 'yes')
+ {
+ $object->fetch($id);
+ $result=$object->delete($user);
+ if ($result > 0)
+ {
+ setEventMessages($langs->trans('LoanDeleted'), null, 'mesgs');
+ header("Location: index.php");
+ exit;
+ }
+ else
+ {
+ setEventMessages($loan->error, null, 'errors');
+ }
+ }
- // Add loan
- if ($action == 'add' && $user->rights->loan->write)
- {
- if (! $cancel)
- {
- $datestart = dol_mktime(12, 0, 0, GETPOST('startmonth','int'), GETPOST('startday','int'), GETPOST('startyear','int'));
- $dateend = dol_mktime(12, 0, 0, GETPOST('endmonth','int'), GETPOST('endday','int'), GETPOST('endyear','int'));
- $capital = price2num(GETPOST('capital'));
- $rate = GETPOST('rate');
+ // Add loan
+ if ($action == 'add' && $user->rights->loan->write)
+ {
+ if (! $cancel)
+ {
+ $datestart = dol_mktime(12, 0, 0, GETPOST('startmonth','int'), GETPOST('startday','int'), GETPOST('startyear','int'));
+ $dateend = dol_mktime(12, 0, 0, GETPOST('endmonth','int'), GETPOST('endday','int'), GETPOST('endyear','int'));
+ $capital = price2num(GETPOST('capital'));
+ $rate = GETPOST('rate');
- if (! $capital)
- {
- $error++; $action = 'create';
- setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("LoanCapital")), null, 'errors');
- }
- if (! $datestart)
- {
- $error++; $action = 'create';
- setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("DateStart")), null, 'errors');
- }
- if (! $dateend)
- {
- $error++; $action = 'create';
- setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("DateEnd")), null, 'errors');
- }
- if ($rate == '')
- {
- $error++; $action = 'create';
- setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Rate")), null, 'errors');
- }
+ if (! $capital)
+ {
+ $error++; $action = 'create';
+ setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("LoanCapital")), null, 'errors');
+ }
+ if (! $datestart)
+ {
+ $error++; $action = 'create';
+ setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("DateStart")), null, 'errors');
+ }
+ if (! $dateend)
+ {
+ $error++; $action = 'create';
+ setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("DateEnd")), null, 'errors');
+ }
+ if ($rate == '')
+ {
+ $error++; $action = 'create';
+ setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Rate")), null, 'errors');
+ }
if (! $error)
{
@@ -161,29 +161,29 @@ if (empty($reshook))
}
}
- // Update record
- else if ($action == 'update' && $user->rights->loan->write)
- {
- if (! $cancel)
- {
- $result = $object->fetch($id);
+ // Update record
+ else if ($action == 'update' && $user->rights->loan->write)
+ {
+ if (! $cancel)
+ {
+ $result = $object->fetch($id);
- $datestart = dol_mktime(12, 0, 0, GETPOST('startmonth','int'), GETPOST('startday','int'), GETPOST('startyear','int'));
- $dateend = dol_mktime(12, 0, 0, GETPOST('endmonth','int'), GETPOST('endday','int'), GETPOST('endyear','int'));
- $capital = price2num(GETPOST('capital'));
+ $datestart = dol_mktime(12, 0, 0, GETPOST('startmonth','int'), GETPOST('startday','int'), GETPOST('startyear','int'));
+ $dateend = dol_mktime(12, 0, 0, GETPOST('endmonth','int'), GETPOST('endday','int'), GETPOST('endyear','int'));
+ $capital = price2num(GETPOST('capital'));
- if (! $capital)
- {
- setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("LoanCapital")), null, 'errors');
- $action = 'edit';
- }
- else
- {
+ if (! $capital)
+ {
+ setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("LoanCapital")), null, 'errors');
+ $action = 'edit';
+ }
+ else
+ {
$object->datestart = $datestart;
$object->dateend = $dateend;
$object->capital = $capital;
- $object->nbterm = GETPOST("nbterm");
- $object->rate = GETPOST("rate");
+ $object->nbterm = GETPOST("nbterm");
+ $object->rate = GETPOST("rate");
$accountancy_account_capital = GETPOST('accountancy_account_capital');
$accountancy_account_insurance = GETPOST('accountancy_account_insurance');
@@ -192,43 +192,44 @@ if (empty($reshook))
if ($accountancy_account_capital <= 0) { $object->account_capital = ''; } else { $object->account_capital = $accountancy_account_capital; }
if ($accountancy_account_insurance <= 0) { $object->account_insurance = ''; } else { $object->account_insurance = $accountancy_account_insurance; }
if ($accountancy_account_interest <= 0) { $object->account_interest = ''; } else { $object->account_interest = $accountancy_account_interest; }
- }
+ }
- $result = $object->update($user);
+ $result = $object->update($user);
- if ($result > 0)
- {
- header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
- exit;
- }
- else
- {
- setEventMessages($object->error, $object->errors, 'errors');
- }
- }
- else
- {
- header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
- exit;
- }
- }
+ if ($result > 0)
+ {
+ header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
+ exit;
+ }
+ else
+ {
+ $error++;
+ setEventMessages($object->error, $object->errors, 'errors');
+ }
+ }
+ else
+ {
+ header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
+ exit;
+ }
+ }
// Link to a project
if ($action == 'classin' && $user->rights->loan->write)
{
- $object->fetch($id);
- $result = $object->setProject($projectid);
+ $object->fetch($id);
+ $result = $object->setProject($projectid);
if ($result < 0)
- setEventMessages($object->error, $object->errors, 'errors');
+ setEventMessages($object->error, $object->errors, 'errors');
}
- if ($action == 'setlabel' && $user->rights->loan->write)
- {
- $object->fetch($id);
- $result = $object->setValueFrom('label', GETPOST('label'), '', '', 'text', '', $user, 'LOAN_MODIFY');
- if ($result < 0)
- setEventMessages($object->error, $object->errors, 'errors');
- }
+ if ($action == 'setlabel' && $user->rights->loan->write)
+ {
+ $object->fetch($id);
+ $result = $object->setValueFrom('label', GETPOST('label'), '', '', 'text', '', $user, 'LOAN_MODIFY');
+ if ($result < 0)
+ setEventMessages($object->error, $object->errors, 'errors');
+ }
}
@@ -249,19 +250,19 @@ llxHeader("",$title,$help_url);
if ($action == 'create')
{
//WYSIWYG Editor
- require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
+ require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
- print load_fiche_titre($langs->trans("NewLoan"), '', 'title_accountancy.png');
+ print load_fiche_titre($langs->trans("NewLoan"), '', 'title_accountancy.png');
- $datec = dol_mktime(12, 0, 0, GETPOST('remonth','int'), GETPOST('reday','int'), GETPOST('reyear','int'));
+ $datec = dol_mktime(12, 0, 0, GETPOST('remonth','int'), GETPOST('reday','int'), GETPOST('reyear','int'));
- print ' |