From 40f89d138f6c1edad8288462039c714aecc3a869 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Oct 2018 10:52:29 +0200 Subject: [PATCH 01/18] Fix height of confirm popup --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 6f331c42896..0ed036f1d1f 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3635,7 +3635,7 @@ class Form * @param int $disableformtag 1=Disable form tag. Can be used if we are already inside a
section. * @return string HTML ajax code if a confirm ajax popup is required, Pure HTML code if it's an html form */ - function formconfirm($page, $title, $question, $action, $formquestion='', $selectedchoice='', $useajax=0, $height=200, $width=500, $disableformtag=0) + function formconfirm($page, $title, $question, $action, $formquestion='', $selectedchoice='', $useajax=0, $height=210, $width=500, $disableformtag=0) { global $langs,$conf; global $useglobalvars; From 562ee1cb64995c46539fde2b1afbd569f5efbe6c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Oct 2018 12:19:22 +0200 Subject: [PATCH 02/18] FIX checkbox to conciliate not visible if bank receipt nb known --- htdocs/compta/bank/bankentries_list.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 081d674a6a3..fc7a3ac8b56 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -429,7 +429,7 @@ if ($id > 0 || ! empty($ref)) if ($user->rights->banque->consolidate) { $newparam = $param; $newparam = preg_replace('/search_conciliated=\d+/i','',$newparam); - $buttonreconcile = ''.$langs->trans("Conciliate").''; + $buttonreconcile = ''.$langs->trans("Conciliate").''; } else { $buttonreconcile = ''.$langs->trans("Conciliate").''; } @@ -1401,16 +1401,17 @@ if ($resql) if (! empty($arrayfields['b.num_releve']['checked'])) { - print ''; + print ''; // Transaction reconciliated or edit link if ($bankaccount->canBeConciliated() > 0) { - if ($objp->conciliated) // If line not conciliated and account can be conciliated + if ($objp->num_releve) { print ''.$objp->num_releve.''; } - else if ($action == 'reconcile') + if (! $objp->conciliated && $action == 'reconcile') { + if ($objp->num_releve) print ' '; print 'rowid])?' checked':'').'>'; } } From cb29209457b2f2e129862bad5bb8f49dfadcca47 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Oct 2018 12:47:18 +0200 Subject: [PATCH 03/18] NEW Enhancement in process to make manual bank conciliation --- htdocs/compta/bank/bankentries_list.php | 23 ++++++++++++++++++---- htdocs/compta/bank/class/account.class.php | 13 ++++++------ htdocs/langs/en_US/banks.lang | 1 + 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index fc7a3ac8b56..b386340d75e 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -204,12 +204,12 @@ if (empty($reshook)) } // Conciliation -if (GETPOST('confirm_reconcile') && $user->rights->banque->consolidate) +if ((GETPOST('confirm_savestatement','alpha') || GETPOST('confirm_reconcile','alpha')) && $user->rights->banque->consolidate) { $error=0; // Definition, nettoyage parametres - $num_releve=trim(GETPOST("num_releve")); + $num_releve=trim(GETPOST("num_releve","alpha")); if ($num_releve) { @@ -222,7 +222,7 @@ if (GETPOST('confirm_reconcile') && $user->rights->banque->consolidate) { $result=$bankline->fetch($row); $bankline->num_releve=$num_releve; //$_POST["num_releve"]; - $result=$bankline->update_conciliation($user, GETPOST("cat")); + $result=$bankline->update_conciliation($user, GETPOST("cat"), GETPOST('confirm_reconcile','alpha')?1:0); // If we confirm_reconcile, we set flag 'rappro' to 1. if ($result < 0) { setEventMessages($bankline->error, $bankline->errors, 'errors'); @@ -248,7 +248,20 @@ if (GETPOST('confirm_reconcile') && $user->rights->banque->consolidate) if (! $error) { - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); // To avoid to submit twice and allow back + $param='action=reconcile&contextpage=banktransactionlist&id='.$id.'&search_account='.$id; + $param.='&search_conciliated='.urlencode($search_conciliated); + if ($page) $param.='&page='.urlencode($page); + if ($offset) $param.='&offset='.urlencode($offset); + if ($search_thirdparty) $param.='&search_thirdparty='.urlencode($search_thirdparty); + if ($search_num_releve) $param.='&search_num_releve='.urlencode($search_num_releve); + if ($search_start_dt) $param.='&search_start_dt='.urlencode($search_start_dt); + if ($search_end_dt) $param.='&search_end_dt='.urlencode($search_end_dt); + if ($search_start_dv) $param.='&search_start_dv='.urlencode($search_start_dv); + if ($search_end_dv) $param.='&search_end_dv='.urlencode($search_end_dv); + if ($search_type) $param.='&search_type='.urlencode($search_type); + if ($search_debit) $param.='&search_debit='.urlencode($search_debit); + if ($search_credit) $param.='&search_credit='.urlencode($search_credit); + header('Location: '.$_SERVER["PHP_SELF"].'?'.$param); // To avoid to submit twice and allow the back button exit; } } @@ -579,6 +592,8 @@ if ($resql) print Form::selectarray('cat', $options, GETPOST('cat'), 1); } print '
'.$langs->trans("ThenCheckLinesAndConciliate").' '; + print ''; + print ' '.$langs->trans("or").' '; print ''; print ' '.$langs->trans("or").' '; print ''; diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 6edb9a42110..19ffec25aca 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -2006,11 +2006,12 @@ class AccountLine extends CommonObject /** * Update conciliation field * - * @param User $user Objet user making update - * @param int $cat Category id - * @return int <0 if KO, >0 if OK + * @param User $user Objet user making update + * @param int $cat Category id + * @param int $conciliated 1=Set transaction to conciliated, 0=Keep transaction non conciliated + * @return int <0 if KO, >0 if OK */ - function update_conciliation(User $user, $cat) + function update_conciliation(User $user, $cat, $conciliated=1) { // phpcs:enable global $conf,$langs; @@ -2028,9 +2029,9 @@ class AccountLine extends CommonObject } $sql = "UPDATE ".MAIN_DB_PREFIX."bank SET"; - $sql.= " rappro = 1"; + $sql.= " rappro = ".$conciliated; $sql.= ", num_releve = '".$this->db->escape($this->num_releve)."'"; - $sql.= ", fk_user_rappro = ".$user->id; + if ($conciliated) $sql.= ", fk_user_rappro = ".$user->id; $sql.= " WHERE rowid = ".$this->id; dol_syslog(get_class($this)."::update_conciliation", LOG_DEBUG); diff --git a/htdocs/langs/en_US/banks.lang b/htdocs/langs/en_US/banks.lang index 4b9e95877aa..a83b3cd755b 100644 --- a/htdocs/langs/en_US/banks.lang +++ b/htdocs/langs/en_US/banks.lang @@ -76,6 +76,7 @@ TransactionsToConciliate=Entries to reconcile Conciliable=Can be reconciled Conciliate=Reconcile Conciliation=Reconciliation +SaveStatementOnly=Save statement only ReconciliationLate=Reconciliation late IncludeClosedAccount=Include closed accounts OnlyOpenedAccount=Only open accounts From 6446343e1bbb94ba3d492b26d45b41007164e676 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Oct 2018 13:05:19 +0200 Subject: [PATCH 04/18] Fix sort lost --- htdocs/compta/bank/bankentries_list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index b386340d75e..f0c41b1ebb1 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -261,6 +261,7 @@ if ((GETPOST('confirm_savestatement','alpha') || GETPOST('confirm_reconcile','al if ($search_type) $param.='&search_type='.urlencode($search_type); if ($search_debit) $param.='&search_debit='.urlencode($search_debit); if ($search_credit) $param.='&search_credit='.urlencode($search_credit); + $param.='&sortfield='.urlencode($sortfield).'&sortorder='.urlencode($sortorder); header('Location: '.$_SERVER["PHP_SELF"].'?'.$param); // To avoid to submit twice and allow the back button exit; } From eff0e959b344eece9f996c9277a691a1fdd1d0f6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Oct 2018 13:06:54 +0200 Subject: [PATCH 05/18] Fix duplicate column --- htdocs/install/mysql/tables/llx_user.sql | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_user.sql b/htdocs/install/mysql/tables/llx_user.sql index 4cf3ea020a5..56a03f81782 100644 --- a/htdocs/install/mysql/tables/llx_user.sql +++ b/htdocs/install/mysql/tables/llx_user.sql @@ -49,7 +49,6 @@ create table llx_user fk_country integer DEFAULT 0, birth date, -- birthday job varchar(128), - skype varchar(255), office_phone varchar(20), office_fax varchar(20), user_mobile varchar(20), From 1204fb1e7462ea1a64c1b134b67a4ba62ca45b10 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Oct 2018 16:16:17 +0200 Subject: [PATCH 06/18] Fix online payments use id instead of ref into TAG --- htdocs/public/payment/newpayment.php | 6 +++--- htdocs/public/payment/paymentok.php | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index f4163d61d3c..2a2a14a25d7 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -813,7 +813,7 @@ if ($source == 'order') $amount=price2num($amount); } - $fulltag='ORD='.$order->ref.'.CUS='.$order->thirdparty->id; + $fulltag='ORD='.$order->id.'.CUS='.$order->thirdparty->id; //$fulltag.='.NAM='.strtr($order->thirdparty->name,"-"," "); if (! empty($TAG)) { $tag=$TAG; $fulltag.='.TAG='.$TAG; } $fulltag=dol_string_unaccent($fulltag); @@ -933,7 +933,7 @@ if ($source == 'invoice') $amount=price2num($amount); } - $fulltag='INV='.$invoice->ref.'.CUS='.$invoice->thirdparty->id; + $fulltag='INV='.$invoice->id.'.CUS='.$invoice->thirdparty->id; //$fulltag.='.NAM='.strtr($invoice->thirdparty->name,"-"," "); if (! empty($TAG)) { $tag=$TAG; $fulltag.='.TAG='.$TAG; } $fulltag=dol_string_unaccent($fulltag); @@ -1115,7 +1115,7 @@ if ($source == 'contractline') $amount=price2num($amount); } - $fulltag='COL='.$contractline->ref.'.CON='.$contract->ref.'.CUS='.$contract->thirdparty->id.'.DAT='.dol_print_date(dol_now(),'%Y%m%d%H%M'); + $fulltag='COL='.$contractline->id.'.CON='.$contract->id.'.CUS='.$contract->thirdparty->id.'.DAT='.dol_print_date(dol_now(),'%Y%m%d%H%M'); //$fulltag.='.NAM='.strtr($contract->thirdparty->name,"-"," "); if (! empty($TAG)) { $tag=$TAG; $fulltag.='.TAG='.$TAG; } $fulltag=dol_string_unaccent($fulltag); diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 9f6ebaf99b6..9b844d8d8b9 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -313,7 +313,7 @@ if ($ispaymentok) $adht = new AdherentType($db); $object = new Adherent($db); - $result1 = $object->fetch(0, $tmptag['MEM']); + $result1 = $object->fetch($tmptag['MEM']); $result2 = $adht->fetch($object->typeid); if ($result1 > 0 && $result2 > 0) @@ -588,7 +588,7 @@ if ($ispaymentok) // Record payment include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $invoice = new Facture($db); - $result = $invoice->fetch(0, $tmptag['INV']); + $result = $invoice->fetch($tmptag['INV']); if ($result) { $FinalPaymentAmt = $_SESSION["FinalPaymentAmt"]; @@ -776,9 +776,9 @@ if ($ispaymentok) } elseif (in_array('INV', array_keys($tmptag))) { - $url=$urlwithroot."/compta/facture/card.php?ref=".$tmptag['INV']; + $url=$urlwithroot."/compta/facture/card.php?id=".$tmptag['INV']; $content.=''.$companylangs->trans("Payment")."

\n"; - $content.=$companylangs->trans("Invoice").': '.$tmptag['INV']."
\n"; + $content.=$companylangs->trans("InvoiceId").': '.$tmptag['INV']."
\n"; //$content.=$companylangs->trans("ThirdPartyId").': '.$tmptag['CUS']."
\n"; $content.=$companylangs->trans("Link").': '.$url.''."
\n"; } From fcf62744d78127873bd645d25e777b38420e835e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Oct 2018 16:23:00 +0200 Subject: [PATCH 07/18] Add ref in description --- htdocs/public/payment/newpayment.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 2a2a14a25d7..a03c0a719c6 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -477,12 +477,12 @@ if ($action == 'charge' && ! empty($conf->stripe->enabled)) 'amount' => price2num($amountstripe, 'MU'), 'currency' => $currency, 'capture' => true, // Charge immediatly - 'description' => 'Stripe payment: '.$FULLTAG, + 'description' => 'Stripe payment: '.$FULLTAG.' ref='.$ref, 'metadata' => $metadata, 'customer' => $customer->id, 'source' => $card, 'statement_descriptor' => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 6, 'right', 'UTF-8', 1).' '.$FULLTAG, 22, 'right', 'UTF-8', 1) // 22 chars that appears on bank receipt - ),array("idempotency_key" => "$ref","stripe_account" => "$stripeacc")); + ),array("idempotency_key" => "$ref", "stripe_account" => "$stripeacc")); // Return $charge = array('id'=>'ch_XXXX', 'status'=>'succeeded|pending|failed', 'failure_code'=>, 'failure_message'=>...) if (empty($charge)) { @@ -517,10 +517,10 @@ if ($action == 'charge' && ! empty($conf->stripe->enabled)) 'amount' => price2num($amountstripe, 'MU'), 'currency' => $currency, 'capture' => true, // Charge immediatly - 'description' => 'Stripe payment: '.$FULLTAG, + 'description' => 'Stripe payment: '.$FULLTAG.' ref='.$ref, 'metadata' => $metadata, 'statement_descriptor' => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 6, 'right', 'UTF-8', 1).' '.$FULLTAG, 22, 'right', 'UTF-8', 1) // 22 chars that appears on bank receipt - ),array("idempotency_key" => "$ref","stripe_account" => "$stripeacc")); + ),array("idempotency_key" => "$ref", "stripe_account" => "$stripeacc")); // Return $charge = array('id'=>'ch_XXXX', 'status'=>'succeeded|pending|failed', 'failure_code'=>, 'failure_message'=>...) if (empty($charge)) { From 62a6af32884ff20253c7221356dfd4c5934fa800 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Oct 2018 17:02:35 +0200 Subject: [PATCH 08/18] phpcs --- htdocs/accountancy/journal/bankjournal.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 7cd98743480..4e52481b287 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -371,7 +371,7 @@ if ($result) { $tabpay[$obj->rowid]["paymentloanid"] = $paymentloanstatic->id; //$tabtp[$obj->rowid][$account_pay_loan] += $obj->amount; } else if ($links[$key]['type'] == 'banktransfert') { - $accountLinestatic->fetch($links[$key]['url_id']); + $accountLinestatic->fetch($links[$key]['url_id']); $tabpay[$obj->rowid]["lib"] .= ' '.$langs->trans("BankTransfer").'- ' .$accountLinestatic ->getNomUrl(1); $tabtp[$obj->rowid][$account_transfer] += $obj->amount; $bankaccountstatic->fetch($tabpay[$obj->rowid]['fk_bank_account']); From 82e06eda755171514b602bc91a31f5ff84f3de78 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Oct 2018 18:33:32 +0200 Subject: [PATCH 09/18] FIX save search criteria when going on receipt from bank transaction --- htdocs/compta/bank/bankentries_list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index f0c41b1ebb1..5eb8e48e68e 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -1423,7 +1423,7 @@ if ($resql) { if ($objp->num_releve) { - print ''.$objp->num_releve.''; + print ''.$objp->num_releve.''; } if (! $objp->conciliated && $action == 'reconcile') { From 7f1aa217a6345bb1d879bd067d06b8b64d6a2136 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Oct 2018 18:38:53 +0200 Subject: [PATCH 10/18] Fix link --- htdocs/compta/bank/bankentries_list.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 5eb8e48e68e..31eaa9e8f6d 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -1452,7 +1452,7 @@ if ($resql) // 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 ''; } @@ -1460,13 +1460,13 @@ if ($resql) { if ($user->rights->banque->modifier || $user->rights->banque->consolidate) { - print ''; + print ''; print img_edit(); print ''; } else { - print ''; + print ''; print img_view(); print ''; } From 619ac9c7cfb7f6a436048b590c6489ca6cf9bd2a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Oct 2018 18:42:53 +0200 Subject: [PATCH 11/18] Fix help --- htdocs/langs/en_US/compta.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang index 32ea8dbaa52..3a18ae3e376 100644 --- a/htdocs/langs/en_US/compta.lang +++ b/htdocs/langs/en_US/compta.lang @@ -111,7 +111,7 @@ Refund=Refund SocialContributionsPayments=Social/fiscal taxes payments ShowVatPayment=Show VAT payment TotalToPay=Total to pay -BalanceVisibilityDependsOnSortAndFilters=Balance is visible in this list only if table is sorted ascending on %s and filtered for 1 bank account +BalanceVisibilityDependsOnSortAndFilters=Balance is visible in this list only if table is sorted on %s and filtered for 1 bank account CustomerAccountancyCode=Customer accounting code SupplierAccountancyCode=Vendor accounting code CustomerAccountancyCodeShort=Cust. account. code From b13088849bc8f9fe1257632cb56dedefa0223fd0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Oct 2018 18:58:28 +0200 Subject: [PATCH 12/18] CSS --- htdocs/accountancy/customer/lines.php | 2 +- htdocs/accountancy/customer/list.php | 2 +- htdocs/accountancy/supplier/lines.php | 2 +- htdocs/accountancy/supplier/list.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index ba935a51a1e..62e70496203 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -367,7 +367,7 @@ if ($result) { print '' . $objp->rowid . ''; // Ref Invoice - print '' . $facture_static->getNomUrl(1) . ''; + print '' . $facture_static->getNomUrl(1) . ''; print '' . dol_print_date($db->jdate($objp->datef), 'day') . ''; diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 53674d4cbcb..74944b8f823 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -466,7 +466,7 @@ if ($result) { print '' . $objp->rowid . ''; // Ref Invoice - print '' . $facture_static->getNomUrl(1) . ''; + print '' . $facture_static->getNomUrl(1) . ''; print '' . dol_print_date($db->jdate($objp->datef), 'day') . ''; diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index b2df1231a4e..71fac322756 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -374,7 +374,7 @@ if ($result) { print '' . $objp->rowid . ''; // Ref Invoice - print '' . $facturefournisseur_static->getNomUrl(1) . ''; + print '' . $facturefournisseur_static->getNomUrl(1) . ''; print ''; print $objp->invoice_label; diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 53dcc4b1270..5ac90068ffb 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -469,7 +469,7 @@ if ($result) { print '' . $objp->rowid . ''; // Ref Invoice - print '' . $facturefourn_static->getNomUrl(1) . ''; + print '' . $facturefourn_static->getNomUrl(1) . ''; print ''; print $objp->invoice_label; From 9f4cee5fb71524f95405c431e55e14aa534f2b97 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Oct 2018 19:11:37 +0200 Subject: [PATCH 13/18] css --- htdocs/accountancy/customer/lines.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 62e70496203..ef5d1cbc8df 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -333,7 +333,7 @@ if ($result) { print ''; print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "fd.rowid", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.facnumber", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.facnumber, fd.rowid", "", $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.facnumber, fd.rowid", "", $param, 'class="nowraponall center"', $sortfield, $sortorder); print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); //print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "fd.description", "", $param, '', $sortfield, $sortorder); From 5cb111e3391fc14401d9077b9966b055b7ff76ff Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Oct 2018 19:13:00 +0200 Subject: [PATCH 14/18] css --- htdocs/accountancy/customer/lines.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index ef5d1cbc8df..1a93ef0b604 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -309,7 +309,7 @@ if ($result) { print ''; print ''; print ''; - print ''; + print ''; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; print ''; $formother->select_year($search_year,'search_year',1, 20, 5); @@ -333,7 +333,7 @@ if ($result) { print ''; print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "fd.rowid", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.facnumber", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.facnumber, fd.rowid", "", $param, 'class="nowraponall center"', $sortfield, $sortorder); + print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.facnumber, fd.rowid", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); //print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "fd.description", "", $param, '', $sortfield, $sortorder); From 4a80a4d9e7911b6b06ef2930f1a20086faa0ef8e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Oct 2018 19:18:33 +0200 Subject: [PATCH 15/18] css --- htdocs/accountancy/customer/lines.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 1a93ef0b604..af80d70f043 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -310,8 +310,8 @@ if ($result) { print ''; print ''; print ''; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; + if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; + print ''; $formother->select_year($search_year,'search_year',1, 20, 5); print ''; print ''; From 8d9f6aad3f83c039eba9f69adec9715ce336e4cf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Oct 2018 19:20:10 +0200 Subject: [PATCH 16/18] css --- htdocs/accountancy/supplier/lines.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 71fac322756..580cf4c407c 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -313,9 +313,9 @@ if ($result) { print ''; print ''; print ''; - print ''; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; + print ''; + if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; + print ''; $formother->select_year($search_year,'search_year',1, 20, 5); print ''; print ''; From 6c55bfc0f75e3f2fb0312cf9b3a1a76aba7fc1e2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Oct 2018 19:45:26 +0200 Subject: [PATCH 17/18] Fix export and remove duplicate csv export. --- htdocs/accountancy/admin/export.php | 5 ++- htdocs/accountancy/bookkeeping/balance.php | 21 ++++++----- .../class/accountancyexport.class.php | 35 ++++++++++--------- htdocs/langs/en_US/accountancy.lang | 2 +- 4 files changed, 37 insertions(+), 26 deletions(-) diff --git a/htdocs/accountancy/admin/export.php b/htdocs/accountancy/admin/export.php index 3be285674b5..eccb9b0c06f 100644 --- a/htdocs/accountancy/admin/export.php +++ b/htdocs/accountancy/admin/export.php @@ -79,6 +79,7 @@ $model_option = array ( /* * Actions */ + if ($action == 'update') { $error = 0; @@ -124,6 +125,8 @@ if ($action == 'update') { } } + + /* * View */ @@ -267,7 +270,7 @@ if ($num2) { } else { print ''; } - + print ''; } diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index e3290f1e542..2b263ca166c 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -130,11 +130,6 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x', $filter = array(); } - -/* - * View - */ - if ($action == 'export_csv') { $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; @@ -156,13 +151,23 @@ if ($action == 'export_csv') { print price($line->credit - $line->debit) . $sep; print "\n"; } + + exit; } -else { - $title_page = $langs->trans("AccountBalance"); - llxHeader('', $title_page); +/* + * View + */ + +$title_page = $langs->trans("AccountBalance"); + +llxHeader('', $title_page); + + +if ($action != 'export_csv') +{ // List $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 39954743251..ca040c2d51a 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -44,7 +44,8 @@ class AccountancyExport /** * @var Type of export. Defined by $conf->global->ACCOUNTING_EXPORT_MODELCSV */ - public static $EXPORT_TYPE_NORMAL = 1; // Classic CSV + public static $EXPORT_TYPE_NORMAL = 1; // CSV + public static $EXPORT_TYPE_CONFIGURABLE = 10; // CSV public static $EXPORT_TYPE_CEGID = 2; public static $EXPORT_TYPE_COALA = 3; public static $EXPORT_TYPE_BOB50 = 4; @@ -53,7 +54,6 @@ class AccountancyExport public static $EXPORT_TYPE_EBP = 7; public static $EXPORT_TYPE_COGILOG = 8; public static $EXPORT_TYPE_AGIRIS = 9; - public static $EXPORT_TYPE_CONFIGURABLE = 10; public static $EXPORT_TYPE_FEC = 11; @@ -98,7 +98,8 @@ class AccountancyExport global $langs; return array ( - self::$EXPORT_TYPE_NORMAL => $langs->trans('Modelcsv_normal'), + //self::$EXPORT_TYPE_NORMAL => $langs->trans('Modelcsv_normal'), + self::$EXPORT_TYPE_CONFIGURABLE => $langs->trans('Modelcsv_configurable'), self::$EXPORT_TYPE_CEGID => $langs->trans('Modelcsv_CEGID'), self::$EXPORT_TYPE_COALA => $langs->trans('Modelcsv_COALA'), self::$EXPORT_TYPE_BOB50 => $langs->trans('Modelcsv_bob50'), @@ -107,7 +108,6 @@ class AccountancyExport self::$EXPORT_TYPE_EBP => $langs->trans('Modelcsv_ebp'), self::$EXPORT_TYPE_COGILOG => $langs->trans('Modelcsv_cogilog'), self::$EXPORT_TYPE_AGIRIS => $langs->trans('Modelcsv_agiris'), - self::$EXPORT_TYPE_CONFIGURABLE => $langs->trans('Modelcsv_configurable'), self::$EXPORT_TYPE_FEC => $langs->trans('Modelcsv_FEC'), ); } @@ -123,13 +123,13 @@ class AccountancyExport return array ( 'param' => array( - self::$EXPORT_TYPE_NORMAL => array( + /*self::$EXPORT_TYPE_NORMAL => array( 'label' => $langs->trans('Modelcsv_normal'), 'ACCOUNTING_EXPORT_FORMAT' => empty($conf->global->ACCOUNTING_EXPORT_FORMAT)?'txt':$conf->global->ACCOUNTING_EXPORT_FORMAT, 'ACCOUNTING_EXPORT_SEPARATORCSV' => empty($conf->global->ACCOUNTING_EXPORT_SEPARATORCSV)?',':$conf->global->ACCOUNTING_EXPORT_SEPARATORCSV, 'ACCOUNTING_EXPORT_ENDLINE' => empty($conf->global->ACCOUNTING_EXPORT_ENDLINE)?1:$conf->global->ACCOUNTING_EXPORT_ENDLINE, 'ACCOUNTING_EXPORT_DATE' => empty($conf->global->ACCOUNTING_EXPORT_DATE)?'%d%m%Y':$conf->global->ACCOUNTING_EXPORT_DATE, - ), + ),*/ self::$EXPORT_TYPE_CEGID => array( 'label' => $langs->trans('Modelcsv_CEGID'), ), @@ -205,8 +205,12 @@ class AccountancyExport switch ($conf->global->ACCOUNTING_EXPORT_MODELCSV) { case self::$EXPORT_TYPE_NORMAL : - $this->exportNormal($TData); + /*$this->exportNormal($TData); + break;*/ + case self::$EXPORT_TYPE_CONFIGURABLE : + $this->exportConfigurable($TData); break; + case self::$EXPORT_TYPE_NORMAL : case self::$EXPORT_TYPE_CEGID : $this->exportCegid($TData); break; @@ -231,9 +235,6 @@ class AccountancyExport case self::$EXPORT_TYPE_AGIRIS : $this->exportAgiris($TData); break; - case self::$EXPORT_TYPE_CONFIGURABLE : - $this->exportConfigurable($TData); - break; case self::$EXPORT_TYPE_FEC : $this->exportFEC($TData); break; @@ -250,6 +251,7 @@ class AccountancyExport * * @return void */ + /* Use $EXPORT_TYPE_CONFIGURABLE instead public function exportNormal($objectLines) { global $conf; @@ -267,6 +269,7 @@ class AccountancyExport print $this->end_line; } } + */ /** * Export format : CEGID @@ -610,12 +613,12 @@ class AccountancyExport $tab[] = $date; $tab[] = $line->doc_ref; $tab[] = $line->label_operation; - $tab[] = length_accountg($line->numero_compte); - $tab[] = length_accounta($line->subledger_account); - $tab[] = price($line->debit); - $tab[] = price($line->credit); - $tab[] = price($line->montant); - $tab[] = $line->code_journal; + $tab[] = length_accountg($line->numero_compte); + $tab[] = length_accounta($line->subledger_account); + $tab[] = price($line->debit); + $tab[] = price($line->credit); + $tab[] = price($line->montant); + $tab[] = $line->code_journal; $separator = $this->separator; print implode($separator, $tab) . $this->end_line; diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 83608fb4be8..7475c1640e6 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -266,7 +266,7 @@ Modelcsv_quadratus=Export towards Quadratus QuadraCompta Modelcsv_ebp=Export towards EBP Modelcsv_cogilog=Export towards Cogilog Modelcsv_agiris=Export towards Agiris -Modelcsv_configurable=Export Configurable +Modelcsv_configurable=Export CSV Configurable Modelcsv_FEC=Export FEC (Art. L47 A) (Test) ChartofaccountsId=Chart of accounts Id From cf88de05e2b463891b965da6991d33ddac1aef9b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Oct 2018 20:01:01 +0200 Subject: [PATCH 18/18] NEW Add format code into exported filename --- .../class/accountancyexport.class.php | 41 +++++++++++++------ .../journal/expensereportsjournal.php | 2 + 2 files changed, 31 insertions(+), 12 deletions(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index ca040c2d51a..060efab591c 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -112,6 +112,31 @@ class AccountancyExport ); } + /** + * Return string to summarize the format (Used to generated export filename) + * + * @param int $type Format id + * @return string Format code + */ + private static function getFormatCode($type) + { + $formatcode = array ( + //self::$EXPORT_TYPE_NORMAL => 'csv', + self::$EXPORT_TYPE_CONFIGURABLE => 'csv', + self::$EXPORT_TYPE_CEGID => 'cegid', + self::$EXPORT_TYPE_COALA => 'coala', + self::$EXPORT_TYPE_BOB50 => 'bob50', + self::$EXPORT_TYPE_CIEL => 'ciel', + self::$EXPORT_TYPE_QUADRATUS => 'quadratus', + self::$EXPORT_TYPE_EBP => 'ebp', + self::$EXPORT_TYPE_COGILOG => 'cogilog', + self::$EXPORT_TYPE_AGIRIS => 'agiris', + self::$EXPORT_TYPE_FEC => 'fec', + ); + + return $formatcode[$type]; + } + /** * Array with all export type available (key + label) and parameters for config * @@ -179,17 +204,6 @@ class AccountancyExport ); } - /** - * Download the export - * - * @return void - */ - public static function downloadFile() - { - global $conf; - $filename = 'general_ledger'; - include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php'; - } /** * Function who chose which export to use with the default config @@ -201,7 +215,10 @@ class AccountancyExport { global $conf, $langs; - self::downloadFile(); + + $filename = 'general_ledger-'.$this->getFormatCode($conf->global->ACCOUNTING_EXPORT_MODELCSV); + include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php'; + switch ($conf->global->ACCOUNTING_EXPORT_MODELCSV) { case self::$EXPORT_TYPE_NORMAL : diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index c39a750af1a..ef21557932b 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -400,11 +400,13 @@ if ($action == 'writebookkeeping') { $param.='&date_endmonth='.$date_endmonth; $param.='&date_endyear='.$date_endyear; $param.='&in_bookkeeping='.$in_bookkeeping; + header("Location: ".$_SERVER['PHP_SELF'].($param?'?'.$param:'')); exit; } } + /* * View */