diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php
index c585217dfda..04f2288ae08 100644
--- a/htdocs/categories/index.php
+++ b/htdocs/categories/index.php
@@ -35,10 +35,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
// Load translation files required by the page
$langs->load("categories");
-if (!$user->rights->categorie->lire) {
- accessforbidden();
-}
-
$id = GETPOST('id', 'int');
$type = (GETPOST('type', 'aZ09') ? GETPOST('type', 'aZ09') : Categorie::TYPE_PRODUCT);
$catname = GETPOST('catname', 'alpha');
@@ -52,6 +48,11 @@ if (is_numeric($type)) {
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('categoryindex'));
+if (!$user->rights->categorie->lire) {
+ accessforbidden();
+}
+
+
/*
* View
*/
diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php
index b0de5f5807f..d428426107d 100644
--- a/htdocs/compta/bank/bankentries_list.php
+++ b/htdocs/compta/bank/bankentries_list.php
@@ -65,6 +65,7 @@ $cancel = GETPOST('cancel', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
$contextpage = 'banktransactionlist'.(empty($object->ref) ? '' : '-'.$object->id);
$massaction = GETPOST('massaction', 'alpha');
+$optioncss = GETPOST('optioncss', 'aZ09');
// Security check
$fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : ''));
@@ -268,7 +269,7 @@ if ((GETPOST('confirm_savestatement', 'alpha') || GETPOST('confirm_reconcile', '
}
if (!$error) {
- $param = 'action=reconcile&contextpage=banktransactionlist&id='.$id.'&search_account='.$id;
+ $param = 'action=reconcile&contextpage=banktransactionlist&id='.((int) $id).'&search_account='.((int) $id);
if ($page) {
$param .= '&page='.urlencode($page);
}
@@ -452,7 +453,7 @@ if (!empty($search_debit)) {
if (!empty($search_credit)) {
$param .= '&search_credit='.urlencode($search_credit);
}
-if (!empty($search_account)) {
+if ($search_account > 0) {
$param .= '&search_account='.urlencode($search_account);
}
if (!empty($search_num_releve)) {
@@ -767,7 +768,7 @@ if ($resql) {
}
print '';
print '';
- print '';
+ print '';
if (!empty($view)) {
print '';
}
@@ -777,7 +778,7 @@ if ($resql) {
print '';
print '';
if (GETPOST('bid')) {
- print '';
+ print '';
}
// Form to reconcile
@@ -1667,16 +1668,16 @@ if ($resql) {
print '
';
// Transaction reconciliated or edit link
if ($objp->conciliated && $bankaccount->canBeConciliated() > 0) { // If line not conciliated and account can be conciliated
- print '';
+ print '';
print img_edit();
print '';
} else {
if ($user->rights->banque->modifier || $user->rights->banque->consolidate) {
- print '';
+ print '';
print img_edit();
print '';
} else {
- print '';
+ print '';
print img_view();
print '';
}
@@ -1686,7 +1687,7 @@ if ($resql) {
}
}
if ($user->rights->banque->modifier) {
- print 'rowid.'&id='.$objp->bankid.'&page='.$page.'">';
+ print 'rowid.'&page='.$page.$param.($sortfield ? '&sortfield='.$sortfield : '').($sortorder ? '&sortorder='.$sortorder : '').'">';
print img_delete('', 'class="marginleftonly"');
print '';
}
diff --git a/htdocs/compta/bank/info.php b/htdocs/compta/bank/info.php
index efce1a103b0..1bbab933e7b 100644
--- a/htdocs/compta/bank/info.php
+++ b/htdocs/compta/bank/info.php
@@ -30,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$langs->loadLangs(array('banks', 'categories', 'companies'));
$id = GETPOST("rowid", 'int');
+$accountid = (GETPOST('id', 'int') ? GETPOST('id', 'int') : GETPOST('account', 'int'));
$ref = GETPOST('ref', 'alpha');
// Security check
@@ -40,8 +41,8 @@ if ($user->socid) {
$socid = $user->socid;
}
-$result = restrictedArea($user, 'banque', $fieldvalue, 'bank_account', '', '', $fieldtype);
-if (empty($user->rights->banque->lire) && !$user->rights->banque->consolidate) {
+$result = restrictedArea($user, 'banque', $accountid, 'bank_account');
+if (empty($user->rights->banque->lire) && empty($user->rights->banque->consolidate)) {
accessforbidden();
}
diff --git a/htdocs/compta/bank/line.php b/htdocs/compta/bank/line.php
index 4db87213d5d..bc70d27ba70 100644
--- a/htdocs/compta/bank/line.php
+++ b/htdocs/compta/bank/line.php
@@ -51,7 +51,8 @@ if (!empty($conf->salaries->enabled)) {
}
-$id = (GETPOST('rowid', 'int') ? GETPOST('rowid', 'int') : GETPOST('account', 'int'));
+$id = GETPOST('rowid', 'int');
+$accountid = (GETPOST('id', 'int') ? GETPOST('id', 'int') : GETPOST('account', 'int'));
$ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
@@ -68,8 +69,8 @@ if ($user->socid) {
$socid = $user->socid;
}
-$result = restrictedArea($user, 'banque', $fieldvalue, 'bank_account', '', '', $fieldtype);
-if (empty($user->rights->banque->lire) && !$user->rights->banque->consolidate) {
+$result = restrictedArea($user, 'banque', $accountid, 'bank_account');
+if (empty($user->rights->banque->lire) && empty($user->rights->banque->consolidate)) {
accessforbidden();
}
@@ -79,6 +80,7 @@ $hookmanager->initHooks(array('bankline'));
/*
* Actions
*/
+
$parameters = array('socid' => $socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
@@ -270,7 +272,7 @@ if (is_array($cats)) {
$head = bankline_prepare_head($rowid);
-$sql = "SELECT b.rowid,b.dateo as do,b.datev as dv, b.amount, b.label, b.rappro,";
+$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro,";
$sql .= " b.num_releve, b.fk_user_author, b.num_chq, b.fk_type, b.fk_account, b.fk_bordereau as receiptid,";
$sql .= " b.emetteur,b.banque";
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
@@ -304,6 +306,7 @@ if ($result) {
print '';
print '';
print '';
+ print '';
print '';
print dol_get_fiche_head($head, 'bankline', $langs->trans('LineRecord'), 0, 'accountline', 0);
@@ -495,9 +498,9 @@ if ($result) {
print $form->selectDate($db->jdate($objp->do), 'dateo', '', '', '', 'update', 1, 0, $objp->rappro);
if (!$objp->rappro) {
print ' ';
- print '';
+ print '';
print img_edit_remove()." ";
- print '';
+ print '';
print img_edit_add()."";
}
print ' | ';
@@ -515,9 +518,9 @@ if ($result) {
print $form->selectDate($db->jdate($objp->dv), 'datev', '', '', '', 'update', 1, 0, $objp->rappro);
if (!$objp->rappro) {
print ' ';
- print '';
+ print '';
print img_edit_remove()." ";
- print '';
+ print '';
print img_edit_add()."";
}
print '';
@@ -658,10 +661,10 @@ if ($result) {
}
print '';
- print "| ".$langs->trans("BankLineConciliated")." | ";
+ print '
| ';
if ($user->rights->banque->consolidate) {
print '';
- print 'rappro ? ' checked="checked"' : '')).'">';
+ print 'rappro ? ' checked="checked"' : '')).'">';
print ' | ';
} else {
print ''.yn($objp->rappro).' | ';
diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php
index 269282f6eb7..87fd36c498f 100644
--- a/htdocs/compta/bank/releve.php
+++ b/htdocs/compta/bank/releve.php
@@ -331,8 +331,8 @@ if (empty($numref)) {
} else {
print '';
print '';
- print '';
- print '';
+ print '';
+ print '';
}
print '';
@@ -364,7 +364,7 @@ if (empty($numref)) {
print '';
if ($user->rights->banque->consolidate && $action != 'editbankreceipt') {
- print 'id.($page > 0 ? '&page='.$page : '').'&action=editbankreceipt&token='.newToken().'&brref='.urlencode($objp->numr).'">'.img_edit().'';
+ print 'id.($page > 0 ? '&page='.$page : '').'&action=editbankreceipt&token='.newToken().'&brref='.urlencode($objp->numr).'">'.img_edit().'';
}
print ' | ';
@@ -669,6 +669,7 @@ if (empty($numref)) {
var current = $(this);
current.click(function()
{
+ console.log("We click on ajaxforbankoperationchange");
var url = "'.$urlajax.'&"+current.attr("href").split("?")[1];
$.get(url, function(data)
{
diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php
index 72188cdbb4a..0003570fd02 100644
--- a/htdocs/compta/bank/various_payment/card.php
+++ b/htdocs/compta/bank/various_payment/card.php
@@ -334,11 +334,7 @@ foreach ($bankcateg->fetchAll() as $bankcategory) {
$options[$bankcategory->id] = $bankcategory->label;
}
-/* ************************************************************************** */
-/* */
-/* Create mode */
-/* */
-/* ************************************************************************** */
+// Create mode
if ($action == 'create') {
// Update fields properties in realtime
if (!empty($conf->use_javascript_ajax)) {
@@ -350,6 +346,7 @@ if ($action == 'create') {
});
function setPaymentType()
{
+ console.log("setPaymentType");
var code = $("#selectpaymenttype option:selected").val();
if (code == \'CHQ\' || code == \'VIR\')
{
@@ -415,7 +412,8 @@ if ($action == 'create') {
if (!empty($conf->banque->enabled)) {
print '
| ';
print $form->editfieldkey('BankAccount', 'selectaccountid', '', $object, 0, 'string', '', 1).' | ';
- print img_picto('', 'bank_account', 'class="pictofixedwidth"').$form->select_comptes($accountid, "accountid", 0, '', 2, '', 0, '', 1); // Affiche liste des comptes courant
+ print img_picto('', 'bank_account', 'class="pictofixedwidth"');
+ print $form->select_comptes($accountid, "accountid", 0, '', 2, '', 0, '', 1); // Show list of main accounts (comptes courants)
print ' |
';
}
diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php
index 6809d610587..e20add0bb9d 100644
--- a/htdocs/fourn/class/fournisseur.product.class.php
+++ b/htdocs/fourn/class/fournisseur.product.class.php
@@ -92,6 +92,7 @@ class ProductFournisseur extends Product
public $fk_availability;
public $fourn_unitprice;
+ public $fourn_unitprice_with_discount; // not saved into database
public $fourn_tva_tx;
public $fourn_tva_npr;
@@ -819,6 +820,7 @@ class ProductFournisseur extends Product
$fourn_price = $record["price"];
// calculate unit price for quantity 1
$fourn_unitprice = $record["unitprice"];
+ $fourn_unitprice_with_discount = $record["unitprice"] * (1 - $record["remise_percent"] / 100);
if (!empty($conf->dynamicprices->enabled) && !empty($record["fk_supplier_price_expression"])) {
$prod_supplier = new ProductFournisseur($this->db);
@@ -836,6 +838,7 @@ class ProductFournisseur extends Product
} else {
$fourn_unitprice = $fourn_price;
}
+ $fourn_unitprice_with_discount = $fourn_unitprice * (1 - $record["remise_percent"] / 100);
}
}
if ($fourn_unitprice < $min || $min == -1) {
@@ -848,6 +851,7 @@ class ProductFournisseur extends Product
$this->fourn_remise_percent = $record["remise_percent"];
$this->fourn_remise = $record["remise"];
$this->fourn_unitprice = $fourn_unitprice;
+ $this->fourn_unitprice_with_discount = $fourn_unitprice_with_discount;
$this->fourn_charges = $record["charges"]; // deprecated
$this->fourn_tva_tx = $record["tva_tx"];
$this->fourn_id = $record["fourn_id"];
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index 23cb14faae1..ba889ec41e3 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -756,7 +756,7 @@ Permission106=Export sendings
Permission109=Delete sendings
Permission111=Read financial accounts
Permission112=Create/modify/delete and compare transactions
-Permission113=Setup financial accounts (create, manage categories)
+Permission113=Setup financial accounts (create, manage categories of bank transactions)
Permission114=Reconcile transactions
Permission115=Export transactions and account statements
Permission116=Transfers between accounts