Merge remote-tracking branch 'upstream/develop' into multidiroutput

This commit is contained in:
Frédéric FRANCE 2023-03-09 16:13:19 +01:00
commit 7fe885fefc
34 changed files with 289 additions and 147 deletions

View File

@ -2088,7 +2088,7 @@ class BookKeeping extends CommonObject
* FIXME: This function takes the parent of parent to get the root account !
*
* @param string $account Accounting account
* @return array Array with root account information (max 2 upper level)
* @return array|int Array with root account information (max 2 upper level), <0 if KO
*/
public function getRootAccount($account = null)
{

View File

@ -712,6 +712,7 @@ class Orders extends DolibarrApi
* @throws RestException 401
* @throws RestException 404
* @throws RestException 500 System error
*
*/
public function validate($id, $idwarehouse = 0, $notrigger = 0)
{

View File

@ -2727,7 +2727,7 @@ class Commande extends CommonOrder
* @param int $offset For pagination
* @param string $sortfield Sort criteria
* @param string $sortorder Sort order
* @return int -1 if KO, array with result if OK
* @return int|array -1 if KO, array with result if OK
*/
public function liste_array($shortlist = 0, $draft = 0, $excluser = '', $socid = 0, $limit = 0, $offset = 0, $sortfield = 'c.date_commande', $sortorder = 'DESC')
{

View File

@ -42,6 +42,11 @@ $ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
$type = GETPOST('type');
if (empty($type)) {
$type = 'CHQ';
}
$object = new RemiseCheque($db);
$sortfield = GETPOST('sortfield', 'aZ09comma');
@ -60,6 +65,7 @@ $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$offset = $limit * $page;
$upload_dir = $conf->bank->multidir_output[$object->entity ? $object->entity : $conf->entity]."/checkdeposits";
// filter by dates from / to
$search_date_start_day = GETPOST('search_date_start_day', 'int');
$search_date_start_month = GETPOST('search_date_start_month', 'int');
@ -84,6 +90,10 @@ $usercandelete = $user->rights->banque->cheque;
$permissiontodelete = $user->rights->banque->cheque;
// List of payment mode to support
// Example: BANK_PAYMENT_MODES_FOR_DEPOSIT_MANAGEMENT = 'CHQ','TRA'
$arrayofpaymentmodetomanage = explode(',', getDolGlobalString('BANK_PAYMENT_MODES_FOR_DEPOSIT_MANAGEMENT', 'CHQ'));
/*
* Actions
@ -132,8 +142,11 @@ if ($action == 'setref' && $user->rights->banque->cheque) {
}
if ($action == 'create' && GETPOST("accountid", "int") > 0 && $user->rights->banque->cheque) {
if (is_array(GETPOST('toRemise'))) {
$result = $object->create($user, GETPOST("accountid", "int"), 0, GETPOST('toRemise'));
if (GETPOSTISARRAY('toRemise')) {
$object->type = $type;
$arrayofid = GETPOST('toRemise', 'array:int');
$result = $object->create($user, GETPOST("accountid", "int"), 0, $arrayofid);
if ($result > 0) {
if ($object->statut == 1) { // If statut is validated, we build doc
$object->fetch($object->id); // To force to reload all properties in correct property name
@ -286,7 +299,16 @@ if (GETPOST('removefilter')) {
$filteraccountid = 0;
}
$title = $langs->trans("Cheques")." - ".$langs->trans("Card");
if ($action == 'new') {
$title = $langs->trans("NewChequeDeposit");
} else {
if ($type == 'CHQ') {
$title = $langs->trans("Cheques");
} else {
$title = ($langs->trans("PaymentType".$type) != "PaymentType".$type ? $langs->trans("PaymentType".$type) : $langs->trans("PaymentMode").' '.$type);
}
}
$helpurl = "";
llxHeader("", $title, $helpurl);
@ -302,7 +324,7 @@ if ($action == 'new') {
$hselected = $h;
$h++;
print load_fiche_titre($langs->trans("Cheques"), '', 'bank_account');
print load_fiche_titre($title, '', 'bank_account');
} else {
$result = $object->fetch($id, $ref);
if ($result < 0) {
@ -357,7 +379,12 @@ if ($action == 'new') {
$now = dol_now();
print '<span class="opacitymedium">'.$langs->trans("SelectChequeTransactionAndGenerate").'</span><br><br>'."\n";
$labeltype = ($langs->trans("PaymentType".$type) != "PaymentType".$type ? $langs->trans("PaymentType".$type) : $type);
if ($type == 'CHQ') {
print '<span class="opacitymedium">'.$langs->trans("SelectChequeTransactionAndGenerate").'</span><br><br>'."\n";
} else {
print '<span class="opacitymedium">'.$langs->trans("SelectPaymentTransactionAndGenerate", $labeltype).'</span><br><br>'."\n";
}
print '<form class="nocellnopadd" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">';
@ -366,9 +393,28 @@ if ($action == 'new') {
print dol_get_fiche_head();
print '<table class="border centpercent">';
//print '<tr><td width="30%">'.$langs->trans('Date').'</td><td width="70%">'.dol_print_date($now,'day').'</td></tr>';
// Filter
print '<tr><td class="titlefieldcreate">'.$langs->trans("DateChequeReceived").'</td><td>';
if (count($arrayofpaymentmodetomanage) > 1) {
$arrayoflabels = array();
foreach ($arrayofpaymentmodetomanage as $key => $val) {
$labelval = ($langs->trans("PaymentType".$val) != "PaymentType".$val ? $langs->trans("PaymentType".$val) : $val);
$arrayoflabels[$key] = $labelval;
}
// Type
print '<tr><td>';
print $langs->trans("Type");
print '</td><td>';
print $form->selectarray('type', $arrayoflabels, $type);
print '</td></tr>';
}
// Date
print '<tr><td class="titlefieldcreate">';
if ($type == 'CHQ') {
print $langs->trans("DateChequeReceived");
} else {
print $langs->trans("DatePaymentReceived");
}
print '</td><td>';
// filter by dates from / to
print '<div class="nowrap">';
print $form->selectDate($search_date_start, 'search_date_start_', 0, 0, 1, '', 1, 1, 0, '', '', '', '', 1, '', $langs->trans('From'));
@ -402,7 +448,7 @@ if ($action == 'new') {
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement as p ON p.fk_bank = b.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON (b.fk_account = ba.rowid)";
$sql .= " WHERE b.fk_type = 'CHQ'";
$sql .= " WHERE b.fk_type = '".$db->escape($type)."'";
$sql .= " AND ba.entity IN (".getEntity('bank_account').")";
$sql .= " AND b.fk_bordereau = 0";
$sql .= " AND b.amount > 0";
@ -437,7 +483,11 @@ if ($action == 'new') {
}
if ($i == 0) {
print '<div class="opacitymedium">'.$langs->trans("NoWaitingChecks").'</div><br>';
if ($type == 'CHQ') {
print '<div class="opacitymedium">'.$langs->trans("NoWaitingChecks").'</div><br>';
} else {
print '<div class="opacitymedium">'.$langs->trans("NoWaitingPaymentForDeposit", $labeltype).'</div><br>';
}
}
}
@ -459,9 +509,11 @@ if ($action == 'new') {
';
$num = $db->num_rows($resql);
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="create">';
print '<input type="hidden" name="type" value="'.$type.'">';
print '<input type="hidden" name="accountid" value="'.$bid.'">';
$moreforfilter = '';
@ -469,11 +521,17 @@ if ($action == 'new') {
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("DateChequeReceived").'</td>'."\n";
print '<td>';
if ($type == 'CHQ') {
print $langs->trans("DateChequeReceived");
} else {
print $langs->trans("DatePaymentForDepositReceived", $type);
}
print '</td>'."\n";
print '<td>'.$langs->trans("ChequeNumber")."</td>\n";
print '<td>'.$langs->trans("CheckTransmitter")."</td>\n";
print '<td>'.$langs->trans("Bank")."</td>\n";
print '<td>'.$langs->trans("Amount")."</td>\n";
print '<td class="right">'.$langs->trans("Amount")."</td>\n";
print '<td class="center">'.$langs->trans("Payment")."</td>\n";
print '<td class="center">'.$langs->trans("LineRecord")."</td>\n";
print '<td class="center">'.$langs->trans("Select")."<br>";
@ -541,7 +599,13 @@ if ($action == 'new') {
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/paiement/cheque/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$morehtmlref = '';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
$morehtmlleft = '';
$moreghtmlright = '';
$labelval = ($langs->trans("PaymentType".$object->type) != "PaymentType".$object->type ? $langs->trans("PaymentType".$object->type) : $object->type);
$morehtmlref = '<br><div class="refidno">'.$langs->trans("Type").' : '.$labelval.'</div>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, $morehtmlleft, '', 0, $moreghtmlright);
print '<div class="fichecenter">';
@ -632,7 +696,7 @@ if ($action == 'new') {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON (b.fk_account = ba.rowid)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement as p ON p.fk_bank = b.rowid";
$sql .= " WHERE ba.entity IN (".getEntity('bank_account').")";
$sql .= " AND b.fk_type= 'CHQ'";
$sql .= " AND b.fk_type= '".$db->escape($object->type)."'";
$sql .= " AND b.fk_bordereau = ".((int) $object->id);
$sql .= $db->order($sortfield, $sortorder);
@ -706,9 +770,9 @@ if ($action == 'new') {
$i++;
}
} else {
print '<td colspan="8" class="opacitymedium">';
print '<td colspan="9"><span class="opacitymedium">';
print $langs->trans("None");
print '</td>';
print '</span></td>';
}
print "</table>";

View File

@ -53,6 +53,8 @@ class RemiseCheque extends CommonObject
//! Numero d'erreur Plage 1024-1279
public $errno;
public $type = 'CHQ'; // 'CHQ', 'TRA', ...
public $amount;
public $date_bordereau;
public $account_id;
@ -92,9 +94,9 @@ class RemiseCheque extends CommonObject
{
global $conf;
$sql = "SELECT bc.rowid, bc.datec, bc.fk_user_author, bc.fk_bank_account, bc.amount, bc.ref, bc.statut, bc.nbcheque, bc.ref_ext";
$sql .= ", bc.date_bordereau as date_bordereau";
$sql .= ", ba.label as account_label";
$sql = "SELECT bc.rowid, bc.datec, bc.fk_user_author, bc.fk_bank_account, bc.amount, bc.ref, bc.statut, bc.nbcheque, bc.ref_ext,";
$sql .= " bc.date_bordereau as date_bordereau, bc.type,";
$sql .= " ba.label as account_label";
$sql .= " FROM ".MAIN_DB_PREFIX."bordereau_cheque as bc";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON bc.fk_bank_account = ba.rowid";
$sql .= " WHERE bc.entity = ".$conf->entity;
@ -118,6 +120,7 @@ class RemiseCheque extends CommonObject
$this->nbcheque = $obj->nbcheque;
$this->statut = $obj->statut;
$this->ref_ext = $obj->ref_ext;
$this->type = $obj->type;
if ($this->statut == 0) {
$this->ref = "(PROV".$this->id.")";
@ -154,6 +157,11 @@ class RemiseCheque extends CommonObject
dol_syslog("RemiseCheque::Create start", LOG_DEBUG);
// Clean parameters
if (empty($this->type)) {
$this->type = 'CHQ';
}
$this->db->begin();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bordereau_cheque (";
@ -167,6 +175,7 @@ class RemiseCheque extends CommonObject
$sql .= ", entity";
$sql .= ", nbcheque";
$sql .= ", ref_ext";
$sql .= ", type";
$sql .= ") VALUES (";
$sql .= "'".$this->db->idate($now)."'";
$sql .= ", '".$this->db->idate($now)."'";
@ -178,6 +187,7 @@ class RemiseCheque extends CommonObject
$sql .= ", ".((int) $conf->entity);
$sql .= ", 0";
$sql .= ", ''";
$sql .= ", '".$this->db->escape($this->type)."'";
$sql .= ")";
$resql = $this->db->query($sql);
@ -205,7 +215,7 @@ class RemiseCheque extends CommonObject
if ($this->id > 0 && $this->errno == 0) {
$sql = "SELECT b.rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
$sql .= " WHERE b.fk_type = 'CHQ'";
$sql .= " WHERE b.fk_type = '".$this->db->escape($this->type)."'";
$sql .= " AND b.amount > 0";
$sql .= " AND b.fk_bordereau = 0";
$sql .= " AND b.fk_account = ".((int) $account_id);
@ -278,9 +288,9 @@ class RemiseCheque extends CommonObject
}
/**
* Supprime la remise en base
* Delete deposit from database
*
* @param User $user Utilisateur qui effectue l'operation
* @param User $user User that delete
* @return int
*/
public function delete($user = '')
@ -464,10 +474,11 @@ class RemiseCheque extends CommonObject
/**
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
*
* @param User $user Objet user
* @param User $user Objet user
* @param string $type Type of payment mode deposit ('CHQ', 'TRA', ...)
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
*/
public function load_board($user)
public function load_board($user, $type = 'CHQ')
{
// phpcs:enable
global $conf, $langs;
@ -481,7 +492,7 @@ class RemiseCheque extends CommonObject
$sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
$sql .= " WHERE b.fk_account = ba.rowid";
$sql .= " AND ba.entity IN (".getEntity('bank_account').")";
$sql .= " AND b.fk_type = 'CHQ'";
$sql .= " AND b.fk_type = '".$this->db->escape($type)."'";
$sql .= " AND b.fk_bordereau = 0";
$sql .= " AND b.amount > 0";
@ -518,9 +529,10 @@ class RemiseCheque extends CommonObject
/**
* Charge indicateurs this->nb de tableau de bord
*
* @return int <0 if ko, >0 if ok
* @param string $type Type of payment mode deposit ('CHQ', 'TRA', ...)
* @return int <0 if ko, >0 if ok
*/
public function load_state_board()
public function load_state_board($type = 'CHQ')
{
// phpcs:enable
global $user;
@ -534,7 +546,7 @@ class RemiseCheque extends CommonObject
$sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
$sql .= " WHERE b.fk_account = ba.rowid";
$sql .= " AND ba.entity IN (".getEntity('bank_account').")";
$sql .= " AND b.fk_type = 'CHQ'";
$sql .= " AND b.fk_type = '".$this->db->escape($type)."'";
$sql .= " AND b.amount > 0";
$resql = $this->db->query($sql);
@ -615,7 +627,7 @@ class RemiseCheque extends CommonObject
// We save charset_output to restore it because write_file can change it if needed for
// output format that does not support UTF8.
$sav_charseSupprimert_output = $outputlangs->charset_output;
$sav_charset_output = $outputlangs->charset_output;
$result = $docmodel->write_file($this, $conf->bank->dir_output.'/checkdeposits', $this->ref, $outputlangs);
if ($result > 0) {
@ -664,7 +676,7 @@ class RemiseCheque extends CommonObject
$sql .= " SET amount = ".price2num($total);
$sql .= ", nbcheque = ".((int) $nb);
$sql .= " WHERE rowid = ".((int) $this->id);
$sql .= " AND entity = ".$conf->entity;
$sql .= " AND entity = ".((int) $conf->entity);
$resql = $this->db->query($sql);
if (!$resql) {
@ -813,7 +825,7 @@ class RemiseCheque extends CommonObject
$sql = "SELECT MAX(rowid)";
$sql .= " FROM ".MAIN_DB_PREFIX."bordereau_cheque";
$sql .= " WHERE rowid < ".$this->id;
$sql .= " WHERE rowid < ".((int) $this->id);
$sql .= " AND entity = ".$conf->entity;
$result = $this->db->query($sql);
@ -825,7 +837,7 @@ class RemiseCheque extends CommonObject
$sql = "SELECT MIN(rowid)";
$sql .= " FROM ".MAIN_DB_PREFIX."bordereau_cheque";
$sql .= " WHERE rowid > ".$this->id;
$sql .= " WHERE rowid > ".((int) $this->id);
$sql .= " AND entity = ".$conf->entity;
$result = $this->db->query($sql);

View File

@ -43,6 +43,10 @@ $result = restrictedArea($user, 'banque', '', '');
$usercancreate = $user->hasRight('banque', 'cheque');
// List of payment mode to support
// Example: BANK_PAYMENT_MODES_FOR_DEPOSIT_MANAGEMENT = 'CHQ','TRA'
$arrayofpaymentmodetomanage = explode(',', getDolGlobalString('BANK_PAYMENT_MODES_FOR_DEPOSIT_MANAGEMENT', 'CHQ'));
/*
* Actions
@ -55,47 +59,61 @@ $usercancreate = $user->hasRight('banque', 'cheque');
* View
*/
llxHeader('', $langs->trans("ChequesArea"));
if (getDolGlobalString('BANK_PAYMENT_MODES_FOR_DEPOSIT_MANAGEMENT', 'CHQ') == 'CHQ') {
$title = $langs->trans("ChequesArea");
} else {
$title = $langs->trans("DocumentsDepositArea");
}
llxHeader('', $title);
$newcardbutton = '';
if ($usercancreate) {
$newcardbutton .= dolGetButtonTitle($langs->trans('NewDeposit'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/paiement/cheque/card.php?action=new');
}
print load_fiche_titre($langs->trans("ChequesArea"), $newcardbutton, $checkdepositstatic->picto);
print load_fiche_titre($title, $newcardbutton, $checkdepositstatic->picto);
print '<div class="fichecenter"><div class="fichethirdleft">';
$sql = "SELECT count(b.rowid) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
$sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
$sql .= " WHERE ba.rowid = b.fk_account";
$sql .= " AND ba.entity IN (".getEntity('bank_account').")";
$sql .= " AND b.fk_type = 'CHQ'";
$sql .= " AND b.fk_bordereau = 0";
$sql .= " AND b.amount > 0";
$resql = $db->query($sql);
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<th colspan="2">'.$langs->trans("BankChecks")."</th>\n";
print '<th colspan="2">'.$langs->trans("DocumentsForDeposit")."</th>\n";
print "</tr>\n";
if ($resql) {
$num = '';
if ($obj = $db->fetch_object($resql)) {
$num = $obj->nb;
foreach ($arrayofpaymentmodetomanage as $val) {
$sql = "SELECT count(b.rowid) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
$sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
$sql .= " WHERE ba.rowid = b.fk_account";
$sql .= " AND ba.entity IN (".getEntity('bank_account').")";
$sql .= " AND b.fk_type = '".$db->escape($val)."'";
$sql .= " AND b.fk_bordereau = 0";
$sql .= " AND b.amount > 0";
$resql = $db->query($sql);
if ($resql) {
$num = '';
if ($obj = $db->fetch_object($resql)) {
$num = $obj->nb;
}
print '<tr class="oddeven">';
print '<td>';
if ($val == 'CHQ') {
print $langs->trans("BankChecks");
} else {
print ($langs->trans("PaymentType".$val) != "PaymentType".$val ? $langs->trans("PaymentType".$val) : $langs->trans("PaymentMode").' '.$val);
}
print '</td>';
print '<td class="right">';
print '<a class="badge badge-info" href="'.DOL_URL_ROOT.'/compta/paiement/cheque/card.php?leftmenu=customers_bills_checks&action=new&type='.urlencode($val).'">'.dol_escape_htmltag($num).'</a>';
print '</td></tr>';
} else {
dol_print_error($db);
}
print '<tr class="oddeven">';
print '<td>'.$langs->trans("BankChecksToReceipt").'</td>';
print '<td class="right">';
print '<a class="badge badge-info" href="'.DOL_URL_ROOT.'/compta/paiement/cheque/card.php?leftmenu=customers_bills_checks&action=new">'.$num.'</a>';
print '</td></tr>';
} else {
dol_print_error($db);
}
print "</table></div>\n";
@ -103,64 +121,79 @@ print '</div><div class="fichetwothirdright">';
$max = 10;
$sql = "SELECT bc.rowid, bc.date_bordereau as db, bc.amount, bc.ref as ref,";
$sql .= " bc.statut, bc.nbcheque,";
$sql .= " ba.ref as bref, ba.label, ba.rowid as bid, ba.number, ba.currency_code, ba.account_number, ba.fk_accountancy_journal,";
$sql .= " aj.code";
$sql .= " FROM ".MAIN_DB_PREFIX."bordereau_cheque as bc, ".MAIN_DB_PREFIX."bank_account as ba";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_journal as aj ON aj.rowid = ba.fk_accountancy_journal";
$sql .= " WHERE ba.rowid = bc.fk_bank_account";
$sql .= " AND bc.entity = ".$conf->entity;
$sql .= " ORDER BY bc.date_bordereau DESC, rowid DESC";
$sql .= $db->plimit($max);
foreach ($arrayofpaymentmodetomanage as $val) {
$sql = "SELECT bc.rowid, bc.date_bordereau as db, bc.amount, bc.ref as ref,";
$sql .= " bc.statut, bc.nbcheque, bc.type,";
$sql .= " ba.ref as bref, ba.label, ba.rowid as bid, ba.number, ba.currency_code, ba.account_number, ba.fk_accountancy_journal,";
$sql .= " aj.code";
$sql .= " FROM ".MAIN_DB_PREFIX."bordereau_cheque as bc, ".MAIN_DB_PREFIX."bank_account as ba";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_journal as aj ON aj.rowid = ba.fk_accountancy_journal";
$sql .= " WHERE ba.rowid = bc.fk_bank_account";
$sql .= " AND bc.entity = ".((int) $conf->entity);
$sql .= " AND bc.type = '".$db->escape($val)."'";
$sql .= " ORDER BY bc.date_bordereau DESC, rowid DESC";
$sql .= $db->plimit($max);
$resql = $db->query($sql);
if ($resql) {
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<th>'.$langs->trans("LastCheckReceiptShort", $max).'</th>';
print '<th>'.$langs->trans("Date")."</th>";
print '<th>'.$langs->trans("Account").'</th>';
print '<th class="right">'.$langs->trans("NbOfCheques").'</th>';
print '<th class="right">'.$langs->trans("Amount").'</th>';
print '<th class="right">'.$langs->trans("Status").'</th>';
print "</tr>\n";
$resql = $db->query($sql);
if ($resql) {
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<th>';
if ($val == 'CHQ') {
print $langs->trans("LastCheckReceiptShort", $max);
} else {
$labelpaymentmode = ($langs->trans("PaymentType".$val) != "PaymentType".$val ? $langs->trans("PaymentType".$val) : $val);
print $langs->trans("LastPaymentForDepositShort", $max, $labelpaymentmode);
}
print '</th>';
print '<th>'.$langs->trans("Date")."</th>";
print '<th>'.$langs->trans("Account").'</th>';
print '<th class="right">'.$langs->trans("NbOfCheques").'</th>';
print '<th class="right">'.$langs->trans("Amount").'</th>';
print '<th class="right">'.$langs->trans("Status").'</th>';
print "</tr>\n";
while ($objp = $db->fetch_object($resql)) {
$checkdepositstatic->id = $objp->rowid;
$checkdepositstatic->ref = ($objp->ref ? $objp->ref : $objp->rowid);
$checkdepositstatic->statut = $objp->statut;
$i = 0;
while ($objp = $db->fetch_object($resql)) {
$i++;
$accountstatic->id = $objp->bid;
$accountstatic->ref = $objp->bref;
$accountstatic->label = $objp->label;
$accountstatic->number = $objp->number;
$accountstatic->currency_code = $objp->currency_code;
$accountstatic->account_number = $objp->account_number;
$accountstatic->accountancy_journal = $objp->code;
$accountstatic->fk_accountancy_journal = $objp->fk_accountancy_journal;
$checkdepositstatic->id = $objp->rowid;
$checkdepositstatic->ref = ($objp->ref ? $objp->ref : $objp->rowid);
$checkdepositstatic->statut = $objp->statut;
print '<tr class="oddeven">'."\n";
$accountstatic->id = $objp->bid;
$accountstatic->ref = $objp->bref;
$accountstatic->label = $objp->label;
$accountstatic->number = $objp->number;
$accountstatic->currency_code = $objp->currency_code;
$accountstatic->account_number = $objp->account_number;
$accountstatic->accountancy_journal = $objp->code;
$accountstatic->fk_accountancy_journal = $objp->fk_accountancy_journal;
print '<td class="nowraponall">'.$checkdepositstatic->getNomUrl(1).'</td>';
print '<td>'.dol_print_date($db->jdate($objp->db), 'day').'</td>';
print '<td class="nowraponall">'.$accountstatic->getNomUrl(1).'</td>';
print '<td class="right">'.$objp->nbcheque.'</td>';
print '<td class="right"><span class="amount">'.price($objp->amount).'</span></td>';
print '<td class="right">'.$checkdepositstatic->LibStatut($objp->statut, 3).'</td>';
print '<tr class="oddeven">'."\n";
print '</tr>';
print '<td class="nowraponall">'.$checkdepositstatic->getNomUrl(1).'</td>';
print '<td>'.dol_print_date($db->jdate($objp->db), 'day').'</td>';
print '<td class="nowraponall">'.$accountstatic->getNomUrl(1).'</td>';
print '<td class="right">'.$objp->nbcheque.'</td>';
print '<td class="right"><span class="amount">'.price($objp->amount).'</span></td>';
print '<td class="right">'.$checkdepositstatic->LibStatut($objp->statut, 3).'</td>';
print '</tr>';
}
if ($i == 0) {
print '<tr><td colspan="6"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
}
print "</table>";
print '</div>';
$db->free($resql);
} else {
dol_print_error($db);
}
print "</table>";
print '</div>';
$db->free($resql);
} else {
dol_print_error($db);
}
print '</div></div>';
// End of page

View File

@ -73,6 +73,16 @@ $formother = new FormOther($db);
$checkdepositstatic = new RemiseCheque($db);
$accountstatic = new Account($db);
// List of payment mode to support
// Example: BANK_PAYMENT_MODES_FOR_DEPOSIT_MANAGEMENT = 'CHQ','TRA'
$arrayofpaymentmodetomanage = explode(',', getDolGlobalString('BANK_PAYMENT_MODES_FOR_DEPOSIT_MANAGEMENT', 'CHQ'));
$arrayoflabels = array();
foreach ($arrayofpaymentmodetomanage as $key => $val) {
$labelval = ($langs->trans("PaymentType".$val) != "PaymentType".$val ? $langs->trans("PaymentType".$val) : $val);
$arrayoflabels[$key] = $labelval;
}
/*
* Actions
@ -93,10 +103,10 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
* View
*/
llxHeader('', $langs->trans("ChequesReceipts"));
llxHeader('', $langs->trans("ChequeDeposits"));
$sql = "SELECT bc.rowid, bc.ref, bc.date_bordereau,";
$sql .= " bc.nbcheque, bc.amount, bc.statut,";
$sql .= " bc.nbcheque, bc.amount, bc.statut, bc.type,";
$sql .= " ba.rowid as bid, ba.label";
$sqlfields = $sql; // $sql fields to remove for count total
@ -104,7 +114,7 @@ $sqlfields = $sql; // $sql fields to remove for count total
$sql .= " FROM ".MAIN_DB_PREFIX."bordereau_cheque as bc,";
$sql .= " ".MAIN_DB_PREFIX."bank_account as ba";
$sql .= " WHERE bc.fk_bank_account = ba.rowid";
$sql .= " AND bc.entity = ".$conf->entity;
$sql .= " AND bc.entity = ".((int) $conf->entity);
// Search criteria
if ($search_ref) {
@ -191,10 +201,13 @@ if ($resql) {
// Fields title search
print '<tr class="liste_titre">';
print '<td class="liste_titre" align="left">';
print '<td class="liste_titre">';
print '<input class="flat" type="text" size="4" name="search_ref" value="'.$search_ref.'">';
print '</td>';
print '<td class="liste_titre" align="center">';
// Type
print '<td class="liste_titre">';
print '</td>';
print '<td class="liste_titre center">';
if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) {
print '<input class="flat" type="text" size="1" maxlength="2" name="day" value="'.$day.'">';
}
@ -217,6 +230,7 @@ if ($resql) {
print '<tr class="liste_titre">';
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "bc.ref", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "bc.type", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("DateCreation", $_SERVER["PHP_SELF"], "bc.date_bordereau", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("NbOfCheques", $_SERVER["PHP_SELF"], "bc.nbcheque", "", $param, 'class="right"', $sortfield, $sortorder);
@ -236,6 +250,7 @@ if ($resql) {
$checkdepositstatic->nbcheque = $objp->nbcheque;
$checkdepositstatic->amount = $objp->amount;
$checkdepositstatic->date_bordereau = $objp->date_bordereau;
$checkdepositstatic->type = $objp->type;
$account = new Account($db);
$account->fetch($objp->bid);
@ -257,12 +272,15 @@ if ($resql) {
// Num ref cheque
print '<td>';
print $checkdepositstatic->getNomUrl(1);
print '</td>';
// Type
$labelpaymentmode = ($langs->transnoentitiesnoconv("PaymentType".$checkdepositstatic->type) != "PaymentType".$checkdepositstatic->type ? $langs->transnoentitiesnoconv("PaymentType".$checkdepositstatic->type) : $checkdepositstatic->type);
print '<td>'.dol_escape_htmltag($labelpaymentmode).'</td>';
// Date
print '<td class="center">'.dol_print_date($db->jdate($objp->date_bordereau), 'day').'</td>'; // TODO Use date hour
print '<td class="center">'.dol_print_date($db->jdate($objp->date_bordereau), 'dayhour', 'tzuser').'</td>';
// Bank
print '<td>';

View File

@ -426,6 +426,7 @@ class BonPrelevement extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Set direct debit or credit transfer order to "paid" status.
* Then create the payment for each invoice of the prelemevement_bon.
*
* @param User $user Id of user
* @param int $date date of action

View File

@ -1868,7 +1868,7 @@ class Contact extends CommonObject
* Updates all roles (default contact for companies) according to values inside the ->roles array.
* This is called by update of contact.
*
* @return float|int
* @return int
* @see fetchRoles()
*/
public function updateRoles()
@ -1878,7 +1878,7 @@ class Contact extends CommonObject
$error = 0;
if (!isset($this->roles)) {
return; // Avoid to loose roles when property not set
return 0; // Avoid to loose roles when property not set
}
$this->db->begin();

View File

@ -758,7 +758,7 @@ class Contrat extends CommonObject
*
* @param int $only_services 0=Default, 1=Force only services (depending on setup, we may also have physical products in a contract)
* @param int $loadalsotranslation 0=Default, 1=Load also translations of product descriptions
* @return ContratLigne[] Return array of contract lines
* @return array|int Return array of contract lines
*/
public function fetch_lines($only_services = 0, $loadalsotranslation = 0)
{

View File

@ -62,7 +62,7 @@ class DolRequestDataCollector extends RequestDataCollector
/**
* Return widget settings
*
* @return void
* @return array
*/
public function getWidgets()
{

View File

@ -2375,7 +2375,7 @@ class ExpenseReport extends CommonObject
* Return list of people with permission to validate expense reports.
* Search for permission "approve expense report"
*
* @return array Array of user ids
* @return array|int Array of user ids, <0 if KO
*/
public function fetch_users_approver_expensereport()
{

View File

@ -98,3 +98,5 @@ UPDATE llx_prelevement_demande SET type = 'ban' WHERE ext_payment_id IS NULL AND
ALTER TABLE llx_recruitment_recruitmentcandidature ADD COLUMN fk_user integer;
ALTER TABLE llx_bordereau_cheque ADD COLUMN type VARCHAR(6) DEFAULT 'CHQ';

View File

@ -26,6 +26,7 @@ create table llx_bordereau_cheque
rowid integer AUTO_INCREMENT PRIMARY KEY,
ref varchar(30) NOT NULL, -- ref
ref_ext varchar(255), -- ref_ext
type varchar(6) DEFAULT 'CHQ', -- 'CHQ', 'TRA', ...
datec datetime NOT NULL,
date_bordereau date,
amount double(24,8) NOT NULL,

View File

@ -4222,12 +4222,12 @@ function migrate_delete_old_dir($db, $langs, $conf)
* @param Conf $conf Object conf
* @param array $listofmodule List of modules, like array('MODULE_KEY_NAME'=>', $reloadmode)
* @param int $force 1=Reload module even if not already loaded
* @return int <0 if KO, >0 if OK
* @return int <0 if KO, >0 if OK
*/
function migrate_reload_modules($db, $langs, $conf, $listofmodule = array(), $force = 0)
{
if (count($listofmodule) == 0) {
return;
return 0;
}
dolibarr_install_syslog("upgrade2::migrate_reload_modules force=".$force.", listofmodule=".join(',', array_keys($listofmodule)));

View File

@ -120,6 +120,7 @@ ValidateCheckReceipt=Validate this check receipt?
ConfirmValidateCheckReceipt=Are you sure that you want to submit this check receipt for validation? No changes will be possible once validated.
DeleteCheckReceipt=Delete this check receipt?
ConfirmDeleteCheckReceipt=Are you sure you want to delete this check receipt?
DocumentsForDeposit=Documents to deposit at the bank
BankChecks=Bank checks
BankChecksToReceipt=Checks awaiting deposit
BankChecksToReceiptShort=Checks awaiting deposit
@ -145,6 +146,7 @@ BackToAccount=Back to account
ShowAllAccounts=Show for all accounts
FutureTransaction=Future transaction. Unable to reconcile.
SelectChequeTransactionAndGenerate=Select/filter the checks which are to be included in the check deposit receipt. Then, click on "Create".
SelectPaymentTransactionAndGenerate=Select/filter the documents which are to be included in the %s deposit receipt. Then, click on "Create".
InputReceiptNumber=Choose the bank statement related with the conciliation. Use a sortable numeric value: YYYYMM or YYYYMMDD
EventualyAddCategory=Eventually, specify a category in which to classify the records
ToConciliate=To reconcile?

View File

@ -509,13 +509,14 @@ UseLine=Apply
UseDiscount=Use discount
UseCredit=Use credit
UseCreditNoteInInvoicePayment=Reduce amount to pay with this credit
MenuChequeDeposits=Check Deposits
MenuChequeDeposits=Deposits slips
MenuCheques=Checks
MenuChequesReceipts=Check receipts
NewChequeDeposit=New deposit
ChequesReceipts=Check receipts
ChequesArea=Check deposits area
ChequeDeposits=Check deposits
MenuChequesReceipts=Deposit slips
NewChequeDeposit=New deposit slip
ChequesReceipts=Cheque deposit slips
DocumentsDepositArea=Deposit slip area
ChequesArea=Deposit slips area
ChequeDeposits=Deposit slips
Cheques=Checks
DepositId=Id deposit
NbCheque=Number of checks

View File

@ -130,14 +130,17 @@ SalesTurnoverMinimum=Minimum turnover
ByExpenseIncome=By expenses & incomes
ByThirdParties=By third parties
ByUserAuthorOfInvoice=By invoice author
CheckReceipt=Check deposit
CheckReceiptShort=Check deposit
LastCheckReceiptShort=Latest %s check receipts
CheckReceipt=Deposit slip
CheckReceiptShort=Deposit slip
LastCheckReceiptShort=Latest %s deposit slips
LastPaymentForDepositShort=Latest %s %s deposit slips
NewCheckReceipt=New discount
NewCheckDeposit=New check deposit
NewCheckDeposit=New deposit slip
NewCheckDepositOn=Create receipt for deposit on account: %s
NoWaitingChecks=No checks awaiting deposit.
NoWaitingPaymentForDeposit=No %s payment awaiting deposit.
DateChequeReceived=Check receiving date
DatePaymentReceived=Date of document reception
NbOfCheques=No. of checks
PaySocialContribution=Pay a social/fiscal tax
PayVAT=Pay a VAT declaration

View File

@ -32,6 +32,7 @@ Language_en_AU=English (Australia)
Language_en_CA=English (Canada)
Language_en_GB=English (United Kingdom)
Language_en_IN=English (India)
Language_en_MY=English (Myanmar)
Language_en_NZ=English (New Zealand)
Language_en_SA=English (Saudi Arabia)
Language_en_SG=English (Singapore)

View File

@ -1910,7 +1910,7 @@ if ($dirins && $action == 'confirm_deleteobject' && $objectname) {
setEventMessages($result, null, 'errors');
$error++;
} else {
/* TODO ALI Header reidrect must be at end after actions. Also tab=pemrissions looks strange
/* TODO ALI Header redirect must be at end after actions. Also tab=pemrissions looks strange
header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=permissions&module='.$module);
*/
setEventMessages($langs->trans('WarningModuleNeedRefrech', $langs->transnoentities($module)), null, 'warnings');

View File

@ -882,7 +882,7 @@ class pdf_standard_myobject extends ModelePDFMyObject
* @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output
* @param Translate $outputlangsbis Object lang for output bis
* @return void
* @return float|int
*/
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $outputlangsbis = null)
{

View File

@ -431,7 +431,7 @@ class Productbatch extends CommonObject
* @param int $fk_product_stock id product_stock for objet
* @param int $with_qty 1 = doesn't return line with 0 quantity
* @param int $fk_product If set to a product id, get eatby and sellby from table llx_product_lot
* @return array <0 if KO, array of batch
* @return array|int <0 if KO, array of batch
*/
public static function findAll($dbs, $fk_product_stock, $with_qty = 0, $fk_product = 0)
{

View File

@ -162,7 +162,7 @@ class PriceExpression
/**
* List all price expressions
*
* @return array Array of price expressions
* @return array|int Array of price expressions, <0 if ko
*/
public function list_price_expression()
{

View File

@ -311,7 +311,7 @@ class PriceGlobalVariable
/**
* List all price global variables
*
* @return array Array of price global variables
* @return array|int Array of price global variables, <0 if ko
*/
public function listGlobalVariables()
{

View File

@ -242,7 +242,7 @@ class ProductStockEntrepot extends CommonObject
* @param array $filter filter array
* @param string $filtermode filter mode (AND or OR)
*
* @return int <0 if KO, >0 if OK
* @return int|array <0 if KO, array if OK
*/
public function fetchAll($fk_product = '', $fk_entrepot = '', $sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND')
{

View File

@ -271,6 +271,7 @@ class Tasks extends DolibarrApi
* @return array Array of roles
*
* @url GET {id}/roles
*
*/
public function getRoles($id, $userid = 0)
{

View File

@ -345,8 +345,6 @@ if ($event->type == 'payout.created') {
// TODO LMR Enable this only if this is a payment of a Dolibarr llx_prelevement_demande only
// TODO LMR The payment ID is $event->data->latest_charge. check that payment does not exists (it may have been created by Dolibarr) to avoid to create payment twice.
$paiement = new Paiement($db);
$paiement->datepaye = $now;
$paiement->date = $now;
@ -369,6 +367,10 @@ if ($event->type == 'payout.created') {
$paiement->ext_payment_id = $TRANSACTIONID.':'.$customer_id.'@'.$stripearrayofkeysbyenv[$servicestatus]['publishable_key']; // May be we should store py_... instead of pi_... but we started with pi_... so we continue.
$paiement->ext_payment_site = $service; // 'StripeLive' or 'Stripe' if test
$db->begin();
if (!$errorforinvoice) {
dol_syslog('* Record payment for invoice id ' . $invoice_id . '. It includes closing of invoice and regenerating document');

View File

@ -801,7 +801,7 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio
* @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output
* @param Translate $outputlangsbis Object lang for output bis
* @return void
* @return float|int
*/
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $outputlangsbis = null)
{

View File

@ -77,7 +77,7 @@ class FormResource
* @param int $limit Limit number of answers
* @param string $morecss More css
* @param bool $multiple add [] in the name of element and add 'multiple' attribut
* @return string HTML string with
* @return string|array HTML string with
*/
public function select_resource_list($selected = '', $htmlname = 'fk_resource', $filter = '', $showempty = 0, $showtype = 0, $forcecombo = 0, $event = array(), $filterkey = '', $outputmode = 0, $limit = 20, $morecss = '', $multiple = false)
{

View File

@ -2883,7 +2883,7 @@ class Ticket extends CommonObject
*
* @param User $user Object user
* @param int $mode "opened" for askprice to close, "signed" for proposal to invoice
* @return int <0 if KO, >0 if OK
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
*/
public function load_board($user, $mode)
{

View File

@ -654,7 +654,7 @@ function getOrdersForThirdParty($authentication, $idthirdparty)
*
* @param array $authentication Array of authentication information
* @param array $order Order info
* @return int Id of new order
* @return array array of new order
*/
function createOrder($authentication, $order)
{

View File

@ -185,7 +185,7 @@ function getVersions($authentication)
* @param string $modulepart Properties of document
* @param string $file Relative path
* @param string $refname Ref of object to check permission for external users (autodetect if not provided)
* @return void
* @return array
*/
function getDocument($authentication, $modulepart, $file, $refname = '')
{

View File

@ -235,7 +235,7 @@ $server->register(
*
* @param array $authentication Array of authentication information
* @param array $project Project info
* @return int Id of new order
* @return array array of new order
*/
function createProject($authentication, $project)
{

View File

@ -239,7 +239,7 @@ class Zapier extends DolibarrApi
* Create hook object
*
* @param array $request_data Request datas
* @return int ID of hook
* @return array ID of hook
*
* @url POST /hook/
*/