Merge branch '14.0' of git@github.com:Dolibarr/dolibarr.git into develop
Conflicts: htdocs/compta/bank/bankentries_list.php htdocs/compta/bank/info.php htdocs/compta/bank/line.php htdocs/compta/bank/releve.php htdocs/compta/bank/various_payment/card.php htdocs/fourn/class/fournisseur.product.class.php
This commit is contained in:
commit
a887e41600
@ -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
|
||||
*/
|
||||
|
||||
@ -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 '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="action" value="'.($action ? $action : 'search').'">';
|
||||
print '<input type="hidden" name="action" value="'.($action != 'delete' ? $action : 'search').'">';
|
||||
if (!empty($view)) {
|
||||
print '<input type="hidden" name="view" value="'.dol_escape_htmltag($view).'">';
|
||||
}
|
||||
@ -777,7 +778,7 @@ if ($resql) {
|
||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||
print '<input type="hidden" name="ref" value="'.$ref.'">';
|
||||
if (GETPOST('bid')) {
|
||||
print '<input type="hidden" name="bid" value="'.GETPOST("bid").'">';
|
||||
print '<input type="hidden" name="bid" value="'.GETPOST("bid", 'int').'">';
|
||||
}
|
||||
|
||||
// Form to reconcile
|
||||
@ -1667,16 +1668,16 @@ if ($resql) {
|
||||
print '<td class="nowraponall" align="center">';
|
||||
// Transaction reconciliated or edit link
|
||||
if ($objp->conciliated && $bankaccount->canBeConciliated() > 0) { // If line not conciliated and account can be conciliated
|
||||
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/compta/bank/line.php?save_lastsearch_values=1&rowid='.$objp->rowid.'&account='.$objp->bankid.'&page='.$page.'">';
|
||||
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/compta/bank/line.php?save_lastsearch_values=1&rowid='.$objp->rowid.($object->id > 0 ? '&account='.$object->id : '').'&page='.$page.'">';
|
||||
print img_edit();
|
||||
print '</a>';
|
||||
} else {
|
||||
if ($user->rights->banque->modifier || $user->rights->banque->consolidate) {
|
||||
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/compta/bank/line.php?save_lastsearch_values=1&rowid='.$objp->rowid.'&account='.$objp->bankid.'&page='.$page.'">';
|
||||
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/compta/bank/line.php?save_lastsearch_values=1&rowid='.$objp->rowid.($object->id > 0 ? '&account='.$object->id : '').'&page='.$page.'">';
|
||||
print img_edit();
|
||||
print '</a>';
|
||||
} else {
|
||||
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/compta/bank/line.php?save_lastsearch_values=1&rowid='.$objp->rowid.'&account='.$objp->bankid.'&page='.$page.'">';
|
||||
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/compta/bank/line.php?save_lastsearch_values=1&rowid='.$objp->rowid.($object->id > 0 ? '&account='.$object->id : '').'&page='.$page.'">';
|
||||
print img_view();
|
||||
print '</a>';
|
||||
}
|
||||
@ -1686,7 +1687,7 @@ if ($resql) {
|
||||
}
|
||||
}
|
||||
if ($user->rights->banque->modifier) {
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&rowid='.$objp->rowid.'&id='.$objp->bankid.'&page='.$page.'">';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&rowid='.$objp->rowid.'&page='.$page.$param.($sortfield ? '&sortfield='.$sortfield : '').($sortorder ? '&sortorder='.$sortorder : '').'">';
|
||||
print img_delete('', 'class="marginleftonly"');
|
||||
print '</a>';
|
||||
}
|
||||
|
||||
@ -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();
|
||||
}
|
||||
|
||||
|
||||
@ -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 '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<input type="hidden" name="orig_account" value="'.$orig_account.'">';
|
||||
print '<input type="hidden" name="account" value="'.$acct->id.'">';
|
||||
print '<input type="hidden" name="id" value="'.$acct->id.'">';
|
||||
|
||||
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 '<a class="ajaxforbankoperationchange" href="'.$_SERVER['PHP_SELF'].'?action=doprev&id='.$id.'&rowid='.$objp->rowid.'">';
|
||||
print '<a class="ajaxforbankoperationchange" href="'.$_SERVER['PHP_SELF'].'?action=doprev&id='.$objp->fk_account.'&rowid='.$objp->rowid.'&token='.newToken().'">';
|
||||
print img_edit_remove()."</a> ";
|
||||
print '<a class="ajaxforbankoperationchange" href="'.$_SERVER['PHP_SELF'].'?action=donext&id='.$id.'&rowid='.$objp->rowid.'">';
|
||||
print '<a class="ajaxforbankoperationchange" href="'.$_SERVER['PHP_SELF'].'?action=donext&id='.$objp->fk_account.'&rowid='.$objp->rowid.'&token='.newToken().'">';
|
||||
print img_edit_add()."</a>";
|
||||
}
|
||||
print '</td>';
|
||||
@ -515,9 +518,9 @@ if ($result) {
|
||||
print $form->selectDate($db->jdate($objp->dv), 'datev', '', '', '', 'update', 1, 0, $objp->rappro);
|
||||
if (!$objp->rappro) {
|
||||
print ' ';
|
||||
print '<a class="ajaxforbankoperationchange" href="'.$_SERVER['PHP_SELF'].'?action=dvprev&id='.$id.'&rowid='.$objp->rowid.'">';
|
||||
print '<a class="ajaxforbankoperationchange" href="'.$_SERVER['PHP_SELF'].'?action=dvprev&id='.$objp->fk_account.'&rowid='.$objp->rowid.'&token='.newToken().'">';
|
||||
print img_edit_remove()."</a> ";
|
||||
print '<a class="ajaxforbankoperationchange" href="'.$_SERVER['PHP_SELF'].'?action=dvnext&id='.$id.'&rowid='.$objp->rowid.'">';
|
||||
print '<a class="ajaxforbankoperationchange" href="'.$_SERVER['PHP_SELF'].'?action=dvnext&id='.$objp->fk_account.'&rowid='.$objp->rowid.'&token='.newToken().'">';
|
||||
print img_edit_add()."</a>";
|
||||
}
|
||||
print '</td>';
|
||||
@ -658,10 +661,10 @@ if ($result) {
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
print "<tr><td>".$langs->trans("BankLineConciliated")."</td>";
|
||||
print '<tr><td><label for="reconciled">'.$langs->trans("BankLineConciliated").'</label></td>';
|
||||
if ($user->rights->banque->consolidate) {
|
||||
print '<td>';
|
||||
print '<input type="checkbox" name="reconciled" class="flat" '.(GETPOSTISSET("reconciled") ? (GETPOST("reconciled") ? ' checked="checked"' : '') : ($objp->rappro ? ' checked="checked"' : '')).'">';
|
||||
print '<input type="checkbox" id="reconciled" name="reconciled" class="flat" '.(GETPOSTISSET("reconciled") ? (GETPOST("reconciled") ? ' checked="checked"' : '') : ($objp->rappro ? ' checked="checked"' : '')).'">';
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td>'.yn($objp->rappro).'</td>';
|
||||
|
||||
@ -331,8 +331,8 @@ if (empty($numref)) {
|
||||
} else {
|
||||
print '<input type="hidden" name="oldbankreceipt" value="'.$objp->numr.'">';
|
||||
print '<input type="text" name="newbankreceipt" value="'.$objp->numr.'">';
|
||||
print '<input type="submit" class="button" name="actionnewbankreceipt" value="'.$langs->trans("Rename").'">';
|
||||
print '<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '<input type="submit" class="button small" name="actionnewbankreceipt" value="'.$langs->trans("Rename").'">';
|
||||
print '<input type="submit" class="button button-cancel small" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
@ -364,7 +364,7 @@ if (empty($numref)) {
|
||||
|
||||
print '<td class="center">';
|
||||
if ($user->rights->banque->consolidate && $action != 'editbankreceipt') {
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?account='.$object->id.($page > 0 ? '&page='.$page : '').'&action=editbankreceipt&token='.newToken().'&brref='.urlencode($objp->numr).'">'.img_edit().'</a>';
|
||||
print '<a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?account='.$object->id.($page > 0 ? '&page='.$page : '').'&action=editbankreceipt&token='.newToken().'&brref='.urlencode($objp->numr).'">'.img_edit().'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -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 '<tr><td>';
|
||||
print $form->editfieldkey('BankAccount', 'selectaccountid', '', $object, 0, 'string', '', 1).'</td><td>';
|
||||
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 '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
@ -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"];
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user