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

This commit is contained in:
Laurent Destailleur 2016-03-04 16:24:03 +01:00
commit 6e8b176d8d
21 changed files with 200 additions and 120 deletions

View File

@ -21,7 +21,7 @@
/** /**
* \file htdocs/accountancy/customer/list.php * \file htdocs/accountancy/customer/list.php
* \ingroup Accountancy * \ingroup Advanced accountancy
* \brief Ventilation page from customers invoices * \brief Ventilation page from customers invoices
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
// Langs // Langs
$langs->load("compta"); $langs->load("compta");
@ -128,7 +129,6 @@ print '<script type="text/javascript">
/* /*
* Action * Action
*/ */
if ($action == 'ventil' && ! empty($btn_ventil)) { if ($action == 'ventil' && ! empty($btn_ventil)) {
print '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>'; print '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>';
if (! empty($codeventil) && ! empty($mesCasesCochees)) { if (! empty($codeventil) && ! empty($mesCasesCochees)) {
@ -146,11 +146,14 @@ if ($action == 'ventil' && ! empty($btn_ventil)) {
$sql .= " SET fk_code_ventilation = " . $monCompte; $sql .= " SET fk_code_ventilation = " . $monCompte;
$sql .= " WHERE rowid = " . $monId; $sql .= " WHERE rowid = " . $monId;
$accountventilated = new AccountingAccount($db);
$accountventilated->fetch($monCompte, '');
dol_syslog("/accountancy/customer/list.php sql=" . $sql, LOG_DEBUG); dol_syslog("/accountancy/customer/list.php sql=" . $sql, LOG_DEBUG);
if ($db->query($sql)) { if ($db->query($sql)) {
print '<div><font color="green">' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' ' . $langs->trans("VentilatedinAccount") . ' : ' . $monCompte . '</font></div>'; print '<div><font color="green">' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("VentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '</font></div>';
} else { } else {
print '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' ' . $langs->trans("NotVentilatedinAccount") . ' : ' . $monCompte . '<br/> <pre>' . $sql . '</pre></font></div>'; print '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("NotVentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '<br/> <pre>' . $sql . '</pre></font></div>';
} }
$cpt ++; $cpt ++;
@ -164,7 +167,6 @@ if ($action == 'ventil' && ! empty($btn_ventil)) {
/* /*
* Customer Invoice lines * Customer Invoice lines
*/ */
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) { if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION; $limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
} else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) { } else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) {
@ -227,9 +229,6 @@ if ($result) {
print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines); print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines);
print '<br><b>' . $langs->trans("DescVentilTodoCustomer") . '</b></br>'; print '<br><b>' . $langs->trans("DescVentilTodoCustomer") . '</b></br>';
print_liste_field_titre($langs->trans("Date"), $_SERVER["PHP_SELF"], "f.datef", "", $param, '', $sortfield, $sortorder);
print '&nbsp;&nbsp;';
print_liste_field_titre($langs->trans("RowId"), $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">' . "\n"; print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">' . "\n";
print '<input type="hidden" name="action" value="ventil">'; print '<input type="hidden" name="action" value="ventil">';
@ -249,14 +248,13 @@ if ($result) {
print '</tr>'; print '</tr>';
// We add search filter // We add search filter
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_invoice" value="' . $search_invoice . '"></td>'; print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_invoice" value="' . $search_invoice . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_ref" value="' . $search_ref . '"></td>'; print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_ref" value="' . $search_ref . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_label" value="' . $search_label . '"></td>'; print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_label" value="' . $search_label . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_desc" value="' . $search_desc . '"></td>'; print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_desc" value="' . $search_desc . '"></td>';
print '<td class="liste_titre" align="right"><input type="text" class="flat" size="10" name="search_amount" value="' . $search_amount . '"></td>'; print '<td class="liste_titre" align="right"><input type="text" class="flat" size="10" name="search_amount" value="' . $search_amount . '"></td>';
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="5" name="search_vat" value="' . $search_vat . '">%</td>'; print '<td class="liste_titre" align="center"><input type="text" class="flat" size="3" name="search_vat" value="' . $search_vat . '">%</td>';
print '<td align="right" class="liste_titre" colspan="4">'; print '<td align="right" class="liste_titre" colspan="4">';
print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" name="button_search" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">'; print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" name="button_search" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
print '&nbsp;'; print '&nbsp;';
@ -339,7 +337,7 @@ if ($result) {
if ($objp->code_sell_l == $objp->code_sell_p) { if ($objp->code_sell_l == $objp->code_sell_p) {
print $objp->code_sell_l; print $objp->code_sell_l;
} else { } else {
print $langs->trans("Purchase") . ' = ' . $objp->code_sell_l . '<br />' . $langs->trans("Sell") . ' = ' . $objp->code_sell_p; print $langs->trans("Buy") . ' = ' . $objp->code_sell_l . '<br />' . $langs->trans("Sell") . ' = ' . $objp->code_sell_p;
} }
print '</td>'; print '</td>';

View File

@ -21,7 +21,7 @@
/** /**
* \file htdocs/accountancy/supplier/list.php * \file htdocs/accountancy/supplier/list.php
* \ingroup Accountancy * \ingroup Advanced accountancy
* \brief Ventilation page from suppliers invoices * \brief Ventilation page from suppliers invoices
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.product.class.php'; require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.product.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
// Langs // Langs
$langs->load("compta"); $langs->load("compta");
@ -129,10 +130,10 @@ print '<script type="text/javascript">
}); });
}); });
</script>'; </script>';
/* /*
* Action * Action
*/ */
if ($action == 'ventil' && ! empty($btn_ventil)) { if ($action == 'ventil' && ! empty($btn_ventil)) {
print '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>'; print '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>';
if ($_POST['codeventil'] && $_POST["mesCasesCochees"]) { if ($_POST['codeventil'] && $_POST["mesCasesCochees"]) {
@ -151,11 +152,14 @@ if ($action == 'ventil' && ! empty($btn_ventil)) {
$sql .= " SET fk_code_ventilation = " . $monCompte; $sql .= " SET fk_code_ventilation = " . $monCompte;
$sql .= " WHERE rowid = " . $monId; $sql .= " WHERE rowid = " . $monId;
$accountventilated = new AccountingAccount($db);
$accountventilated->fetch($monCompte, '');
dol_syslog('accountancy/supplier/list.php:: sql=' . $sql, LOG_DEBUG); dol_syslog('accountancy/supplier/list.php:: sql=' . $sql, LOG_DEBUG);
if ($db->query($sql)) { if ($db->query($sql)) {
print '<div><font color="green">' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' ' . $langs->trans("VentilatedinAccount") . ' : ' . $monCompte . '</font></div>'; print '<div><font color="green">' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("VentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '</font></div>';
} else { } else {
print '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' ' . $langs->trans("NotVentilatedinAccount") . ' : ' . $monCompte . '<br/> <pre>' . $sql . '</pre></font></div>'; print '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("NotVentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '<br/> <pre>' . $sql . '</pre></font></div>';
} }
$cpt ++; $cpt ++;
@ -169,7 +173,6 @@ if ($action == 'ventil' && ! empty($btn_ventil)) {
/* /*
* Supplier Invoice Lines * Supplier Invoice Lines
*/ */
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) { if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION; $limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
} else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) { } else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) {
@ -255,7 +258,7 @@ if ($result) {
print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_label" value="' . $search_label . '"></td>'; print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_label" value="' . $search_label . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_desc" value="' . $search_desc . '"></td>'; print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_desc" value="' . $search_desc . '"></td>';
print '<td class="liste_titre" align="right"><input type="text" class="flat" size="10" name="search_amount" value="' . $search_amount . '"></td>'; print '<td class="liste_titre" align="right"><input type="text" class="flat" size="10" name="search_amount" value="' . $search_amount . '"></td>';
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="5" name="search_vat" value="' . $search_vat . '">%</td>'; print '<td class="liste_titre" align="center"><input type="text" class="flat" size="3" name="search_vat" value="' . $search_vat . '">%</td>';
print '<td class="liste_titre" align="center">&nbsp;</td>'; print '<td class="liste_titre" align="center">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
print '<td align="right" colspan="2" class="liste_titre">'; print '<td align="right" colspan="2" class="liste_titre">';

View File

@ -1044,6 +1044,19 @@ if (empty($reshook))
unset($_POST['product_desc']); unset($_POST['product_desc']);
unset($_POST['fournprice']); unset($_POST['fournprice']);
unset($_POST['buying_price']); unset($_POST['buying_price']);
unset($_POST['date_starthour']);
unset($_POST['date_startmin']);
unset($_POST['date_startsec']);
unset($_POST['date_startday']);
unset($_POST['date_startmonth']);
unset($_POST['date_startyear']);
unset($_POST['date_endhour']);
unset($_POST['date_endmin']);
unset($_POST['date_endsec']);
unset($_POST['date_endday']);
unset($_POST['date_endmonth']);
unset($_POST['date_endyear']);
} else { } else {
$db->rollback(); $db->rollback();

View File

@ -969,6 +969,19 @@ if (empty($reshook))
unset($_POST['product_desc']); unset($_POST['product_desc']);
unset($_POST['fournprice']); unset($_POST['fournprice']);
unset($_POST['buying_price']); unset($_POST['buying_price']);
unset($_POST['date_starthour']);
unset($_POST['date_startmin']);
unset($_POST['date_startsec']);
unset($_POST['date_startday']);
unset($_POST['date_startmonth']);
unset($_POST['date_startyear']);
unset($_POST['date_endhour']);
unset($_POST['date_endmin']);
unset($_POST['date_endsec']);
unset($_POST['date_endday']);
unset($_POST['date_endmonth']);
unset($_POST['date_endyear']);
} else { } else {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }

View File

@ -489,7 +489,7 @@ if ($id > 0 || ! empty($ref))
$form->select_date($dateop,'op',0,0,0,'transaction'); $form->select_date($dateop,'op',0,0,0,'transaction');
print '</td>'; print '</td>';
print '<td class="nowrap">'; print '<td class="nowrap">';
$form->select_types_paiements((GETPOST('operation')?GETPOST('operation'):($object->courant == 2 ? 'LIQ' : '')),'operation','1,2',2,1); $form->select_types_paiements((GETPOST('operation')?GETPOST('operation'):($object->courant == Account::TYPE_CASH ? 'LIQ' : '')),'operation','1,2',2,1);
print '</td><td>'; print '</td><td>';
print '<input name="num_chq" class="flat" type="text" size="4" value="'.GETPOST("num_chq").'"></td>'; print '<input name="num_chq" class="flat" type="text" size="4" value="'.GETPOST("num_chq").'"></td>';
print '<td colspan="2">'; print '<td colspan="2">';

View File

@ -302,7 +302,7 @@ if ($action == 'create')
// Status // Status
print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td>'; print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
print $form->selectarray("clos",array(0=>$account->status[0],1=>$account->status[1]),(isset($_POST["clos"])?$_POST["clos"]:$account->clos)); print $form->selectarray("clos", $account->status,(isset($_POST["clos"])?$_POST["clos"]:$account->clos));
print '</td></tr>'; print '</td></tr>';
// Country // Country
@ -643,7 +643,7 @@ else
print '<br>'; print '<br>';
if ($account->type == 0 || $account->type == 1) if ($account->type == Account::TYPE_SAVINGS || $account->type == Account::TYPE_CURRENT)
{ {
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
@ -861,7 +861,7 @@ else
// Status // Status
print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td>'; print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
print $form->selectarray("clos",array(0=>$account->status[0],1=>$account->status[1]),(isset($_POST["clos"])?$_POST["clos"]:$account->clos)); print $form->selectarray("clos", $account->status,(isset($_POST["clos"])?$_POST["clos"]:$account->clos));
print '</td></tr>'; print '</td></tr>';
// Country // Country

View File

@ -139,7 +139,19 @@ class Account extends CommonObject
public $state_code; public $state_code;
public $state; public $state;
public $type_lib=array(); /**
* Variable containing all account types with their respective translated label.
* Defined in __construct
* @var array
*/
public $type_lib = array();
/**
* Variable containing all account statuses with their respective translated label.
* Defined in __construct
* @var array
*/
public $status = array();
/** /**
* Accountancy code * Accountancy code
@ -205,7 +217,6 @@ class Account extends CommonObject
$this->db = $db; $this->db = $db;
$this->clos = 0;
$this->solde = 0; $this->solde = 0;
$this->type_lib = array( $this->type_lib = array(
@ -231,7 +242,7 @@ class Account extends CommonObject
global $conf; global $conf;
if (empty($this->rappro)) return -1; if (empty($this->rappro)) return -1;
if ($this->courant == 2 && empty($conf->global->BANK_CAN_RECONCILIATE_CASHACCOUNT)) return -2; if ($this->courant == Account::TYPE_CASH && empty($conf->global->BANK_CAN_RECONCILIATE_CASHACCOUNT)) return -2;
if ($this->clos) return -3; if ($this->clos) return -3;
return 1; return 1;
} }
@ -388,7 +399,7 @@ class Account extends CommonObject
$this->error="this->rowid not defined"; $this->error="this->rowid not defined";
return -2; return -2;
} }
if ($this->courant == 2 && $oper != 'LIQ') if ($this->courant == Account::TYPE_CASH && $oper != 'LIQ')
{ {
$this->error="ErrorCashAccountAcceptsOnlyCashMoney"; $this->error="ErrorCashAccountAcceptsOnlyCashMoney";
return -3; return -3;
@ -1229,8 +1240,8 @@ class Account extends CommonObject
$this->ref = 'MBA'; $this->ref = 'MBA';
$this->label = 'My Bank account'; $this->label = 'My Bank account';
$this->bank = 'MyBank'; $this->bank = 'MyBank';
$this->courant = 1; $this->courant = Account::TYPE_CURRENT;
$this->clos = 0; $this->clos = Account::STATUS_OPEN;
$this->code_banque = '123'; $this->code_banque = '123';
$this->code_guichet = '456'; $this->code_guichet = '456';
$this->number = 'ABC12345'; $this->number = 'ABC12345';

View File

@ -102,7 +102,7 @@ if ($user->rights->banque->modifier && $action == "update")
$ac = new Account($db); $ac = new Account($db);
$ac->fetch($id); $ac->fetch($id);
if ($ac->courant == 2 && $_POST['value'] != 'LIQ') if ($ac->courant == Account::TYPE_CASH && $_POST['value'] != 'LIQ')
{ {
setEventMessages($langs->trans("ErrorCashAccountAcceptsOnlyCashMoney"), null, 'errors'); setEventMessages($langs->trans("ErrorCashAccountAcceptsOnlyCashMoney"), null, 'errors');
$error++; $error++;

View File

@ -93,7 +93,7 @@ if ($action == 'add')
// By default, electronic transfert from bank to bank // By default, electronic transfert from bank to bank
$typefrom='PRE'; $typefrom='PRE';
$typeto='VIR'; $typeto='VIR';
if ($accountto->courant == 2 || $accountfrom->courant == 2) if ($accountto->courant == Account::TYPE_CASH || $accountfrom->courant == Account::TYPE_CASH)
{ {
// This is transfert of change // This is transfert of change
$typefrom='LIQ'; $typefrom='LIQ';

View File

@ -49,32 +49,11 @@ class FormBank
* @param string $htmlname Nom champ formulaire * @param string $htmlname Nom champ formulaire
* @return void * @return void
*/ */
function select_type_comptes_financiers($selected=1,$htmlname='type') public function select_type_comptes_financiers($selected = Account::TYPE_CURRENT, $htmlname = 'type')
{ {
global $langs; $account = new Account($this->db);
$langs->load("banks");
$type_available=array(0,1,2); print Form::selectarray($htmlname, $account->type_lib, $selected);
print '<select id="select'.$htmlname.'" class="flat" name="'.$htmlname.'">';
$num = count($type_available);
$i = 0;
if ($num)
{
while ($i < $num)
{
if ($selected == $type_available[$i])
{
print '<option value="'.$type_available[$i].'" selected>'.$langs->trans("BankType".$type_available[$i]).'</option>';
}
else
{
print '<option value="'.$type_available[$i].'">'.$langs->trans("BankType".$type_available[$i]).'</option>';
}
$i++;
}
}
print '</select>';
} }
} }

View File

@ -109,7 +109,10 @@ class FormFile
$max=$conf->global->MAIN_UPLOAD_DOC; // En Kb $max=$conf->global->MAIN_UPLOAD_DOC; // En Kb
$maxphp=@ini_get('upload_max_filesize'); // En inconnu $maxphp=@ini_get('upload_max_filesize'); // En inconnu
if (preg_match('/k$/i',$maxphp)) $maxphp=$maxphp*1;
if (preg_match('/m$/i',$maxphp)) $maxphp=$maxphp*1024; if (preg_match('/m$/i',$maxphp)) $maxphp=$maxphp*1024;
if (preg_match('/g$/i',$maxphp)) $maxphp=$maxphp*1024*1024;
if (preg_match('/t$/i',$maxphp)) $maxphp=$maxphp*1024*1024*1024;
// Now $max and $maxphp are in Kb // Now $max and $maxphp are in Kb
if ($maxphp > 0) $max=min($max,$maxphp); if ($maxphp > 0) $max=min($max,$maxphp);

View File

@ -64,7 +64,7 @@ function bank_prepare_head(Account $object)
$head[$h][2] = 'graph'; $head[$h][2] = 'graph';
$h++; $h++;
if ($object->courant != 2) if ($object->courant != Account::TYPE_CASH)
{ {
$head[$h][0] = DOL_URL_ROOT."/compta/bank/releve.php?account=".$object->id; $head[$h][0] = DOL_URL_ROOT."/compta/bank/releve.php?account=".$object->id;
$head[$h][1] = $langs->trans("AccountStatements"); $head[$h][1] = $langs->trans("AccountStatements");

View File

@ -281,7 +281,7 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM
{ {
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);
$newmenu->add('/compta/bank/card.php?id='.$objp->rowid,$objp->label,1,$user->rights->banque->lire); $newmenu->add('/compta/bank/card.php?id='.$objp->rowid,$objp->label,1,$user->rights->banque->lire);
if ($objp->rappro && $objp->courant != 2 && empty($objp->clos)) // If not cash account and not closed and can be reconciliate if ($objp->rappro && $objp->courant != Account::TYPE_CASH && empty($objp->clos)) // If not cash account and not closed and can be reconciliate
{ {
$newmenu->add('/compta/bank/rappro.php?account='.$objp->rowid,$langs->trans("Conciliate"),2,$user->rights->banque->consolidate); $newmenu->add('/compta/bank/rappro.php?account='.$objp->rowid,$langs->trans("Conciliate"),2,$user->rights->banque->consolidate);
} }

View File

@ -1342,7 +1342,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
{ {
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);
$newmenu->add('/compta/bank/card.php?id='.$objp->rowid,$objp->label,1,$user->rights->banque->lire); $newmenu->add('/compta/bank/card.php?id='.$objp->rowid,$objp->label,1,$user->rights->banque->lire);
if ($objp->rappro && $objp->courant != 2 && empty($objp->clos)) // If not cash account and not closed and can be reconciliate if ($objp->rappro && $objp->courant != Account::TYPE_CASH && empty($objp->clos)) // If not cash account and not closed and can be reconciliate
{ {
$newmenu->add('/compta/bank/rappro.php?account='.$objp->rowid,$langs->trans("Conciliate"),2,$user->rights->banque->consolidate); $newmenu->add('/compta/bank/rappro.php?account='.$objp->rowid,$langs->trans("Conciliate"),2,$user->rights->banque->consolidate);
} }

View File

@ -563,6 +563,19 @@ if (empty($reshook))
unset($localtax1_tx); unset($localtax1_tx);
unset($localtax2_tx); unset($localtax2_tx);
unset($_POST['date_starthour']);
unset($_POST['date_startmin']);
unset($_POST['date_startsec']);
unset($_POST['date_startday']);
unset($_POST['date_startmonth']);
unset($_POST['date_startyear']);
unset($_POST['date_endhour']);
unset($_POST['date_endmin']);
unset($_POST['date_endsec']);
unset($_POST['date_endday']);
unset($_POST['date_endmonth']);
unset($_POST['date_endyear']);
if ($result >= 0) if ($result >= 0)
{ {
// Define output language // Define output language
@ -2755,6 +2768,11 @@ elseif (! empty($object->id))
print '</a>'; print '</a>';
} }
} }
// 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.
{
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 // Modify
if ($object->statut == 1) if ($object->statut == 1)

View File

@ -620,6 +620,19 @@ if (empty($reshook))
if ($result >= 0) if ($result >= 0)
{ {
unset($_POST['label']); unset($_POST['label']);
unset($_POST['date_starthour']);
unset($_POST['date_startmin']);
unset($_POST['date_startsec']);
unset($_POST['date_startday']);
unset($_POST['date_startmonth']);
unset($_POST['date_startyear']);
unset($_POST['date_endhour']);
unset($_POST['date_endmin']);
unset($_POST['date_endsec']);
unset($_POST['date_endday']);
unset($_POST['date_endmonth']);
unset($_POST['date_endyear']);
$db->commit(); $db->commit();
} }
else else
@ -2322,6 +2335,12 @@ 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.
{
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 // Clone
if ($action != 'edit' && $user->rights->fournisseur->facture->creer) if ($action != 'edit' && $user->rights->fournisseur->facture->creer)
{ {

View File

@ -789,6 +789,7 @@ Permission2403=Delete actions (events or tasks) linked to his account
Permission2411=Read actions (events or tasks) of others Permission2411=Read actions (events or tasks) of others
Permission2412=Create/modify actions (events or tasks) of others Permission2412=Create/modify actions (events or tasks) of others
Permission2413=Delete actions (events or tasks) of others Permission2413=Delete actions (events or tasks) of others
Permission2414=Export actions/tasks of others
Permission2501=Read/Download documents Permission2501=Read/Download documents
Permission2502=Download documents Permission2502=Download documents
Permission2503=Submit or delete documents Permission2503=Submit or delete documents

View File

@ -229,6 +229,7 @@ if (empty($reshook))
{ {
//Check the expression validity by parsing it //Check the expression validity by parsing it
$priceparser = new PriceParser($db); $priceparser = new PriceParser($db);
$object->fk_supplier_price_expression = $price_expression;
$price_result = $priceparser->parseProductSupplier($object); $price_result = $priceparser->parseProductSupplier($object);
if ($price_result < 0) { //Expression is not valid if ($price_result < 0) { //Expression is not valid
$error++; $error++;
@ -470,7 +471,7 @@ if ($id > 0 || $ref)
on_change(); on_change();
} }
function on_click() { function on_click() {
window.location = "'.DOL_URL_ROOT.'/product/dynamic_price/editor.php?id='.$id.'&tab=fournisseurs&eid=" + $("#eid").attr("value"); window.location = "'.DOL_URL_ROOT.'/product/dynamic_price/editor.php?id='.$id.'&tab=fournisseurs&eid=" + $("#eid").val();
} }
function on_change() { function on_change() {
if ($("#eid").val() == 0) { if ($("#eid").val() == 0) {

View File

@ -46,16 +46,14 @@ class CompanyBankAccount extends Account
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
*/ */
function __construct($db) public function __construct(DoliDB $db)
{ {
$this->db = $db; $this->db = $db;
$this->socid = 0; $this->socid = 0;
$this->clos = 0;
$this->solde = 0; $this->solde = 0;
$this->error_number = 0; $this->error_number = 0;
$this->default_rib = 0; $this->default_rib = 0;
return 1;
} }

View File

@ -729,6 +729,18 @@ if (empty($reshook))
unset($_POST['dp_desc']); unset($_POST['dp_desc']);
unset($_POST['idprod']); unset($_POST['idprod']);
unset($_POST['date_starthour']);
unset($_POST['date_startmin']);
unset($_POST['date_startsec']);
unset($_POST['date_startday']);
unset($_POST['date_startmonth']);
unset($_POST['date_startyear']);
unset($_POST['date_endhour']);
unset($_POST['date_endmin']);
unset($_POST['date_endsec']);
unset($_POST['date_endday']);
unset($_POST['date_endmonth']);
unset($_POST['date_endyear']);
} else { } else {
$db->rollback(); $db->rollback();
@ -836,6 +848,19 @@ if (empty($reshook))
unset($_POST['product_desc']); unset($_POST['product_desc']);
unset($_POST['fournprice']); unset($_POST['fournprice']);
unset($_POST['buying_price']); unset($_POST['buying_price']);
unset($_POST['date_starthour']);
unset($_POST['date_startmin']);
unset($_POST['date_startsec']);
unset($_POST['date_startday']);
unset($_POST['date_startmonth']);
unset($_POST['date_startyear']);
unset($_POST['date_endhour']);
unset($_POST['date_endmin']);
unset($_POST['date_endsec']);
unset($_POST['date_endday']);
unset($_POST['date_endmonth']);
unset($_POST['date_endyear']);
} else { } else {
$db->rollback(); $db->rollback();

View File

@ -44,15 +44,13 @@ class UserBankAccount extends Account
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
*/ */
function __construct($db) public function __construct(DoliDB $db)
{ {
$this->db = $db; $this->db = $db;
$this->socid = 0; $this->socid = 0;
$this->clos = 0;
$this->solde = 0; $this->solde = 0;
$this->error_number = 0; $this->error_number = 0;
return 1;
} }