diff --git a/dev/resources/sepa/sample-credit-transfer.xml b/dev/resources/sepa/sample-credit-transfer.xml new file mode 100644 index 00000000000..087fd2f57d7 --- /dev/null +++ b/dev/resources/sepa/sample-credit-transfer.xml @@ -0,0 +1,172 @@ + + + + + message-id-001 + 2010-09-28T14:07:00 + 1 + 10.1 + + Bedrijfsnaam + + + + 123456789123456 + + + + + + + minimaal gevuld + TRF + 1 + 10.1 + 2009-11-01 + + Naam + + + + NL44RABO0123456789 + + + + + RABONL2U + + + + + non ref + + + 10.1 + + SLEV + + + ABNANL2A + + + + Naam creditor + + + + NL90ABNA0111111111 + + + + vrije tekst + + + + + maximaal gevuld + TRF + true + 1 + 20.2 + + NORM + + SEPA + + + IDEAL + + + SECU + + + 2009-11-01 + + Naam + + NL + Debtor straat 1 + 9999 XX Plaats debtor + + + + + NL44RABO0123456789 + + + + + RABONL2U + + + + + + + 12345678 + + klantnummer + + klantnummer uitgifte instantie + + + + + SLEV + + + debtor-to-debtor-bank-01 + End-to-end-id-debtor-to-creditor-01 + + + 20.2 + + + + ABNANL2A + + + + Naam creditor + + NL + Straat creditor 1 + 9999 XX Plaats creditor + + + + + NL90ABNA0111111111 + + + + + + + 1969-07-03 + PLAATS + NL + + + + + + CHAR + + + + + + + SCOR + + CUR + + 1234567 + + + + + + + diff --git a/dev/resources/sepa/test.xml b/dev/resources/sepa/sample-direct-debit.xml similarity index 100% rename from dev/resources/sepa/test.xml rename to dev/resources/sepa/sample-direct-debit.xml diff --git a/htdocs/admin/boxes.php b/htdocs/admin/boxes.php index a45208db3b9..15b57a7f8fa 100644 --- a/htdocs/admin/boxes.php +++ b/htdocs/admin/boxes.php @@ -314,7 +314,7 @@ $boxactivated = InfoBox::listBoxes($db, 'activated', -1, null); print "
\n"; print "\n\n".''."\n"; -print load_fiche_titre($langs->trans("BoxesAvailable")); +print load_fiche_titre($langs->trans("BoxesAvailable"), '', ''); print '
'."\n"; print ''."\n"; @@ -377,7 +377,7 @@ print "\n".''."\n"; //var_dump($boxactivated); print "
\n\n"; -print load_fiche_titre($langs->trans("BoxesActivated")); +print load_fiche_titre($langs->trans("BoxesActivated"), '', ''); print '
'; print ''."\n"; @@ -436,7 +436,7 @@ print '
'; // Other parameters print "\n\n".''."\n"; -print load_fiche_titre($langs->trans("Other")); +print load_fiche_titre($langs->trans("Other"), '', ''); print ''; print ''; print ''; diff --git a/htdocs/admin/confexped.php b/htdocs/admin/confexped.php index 620a6fe01ea..d2ea8da6d3f 100644 --- a/htdocs/admin/confexped.php +++ b/htdocs/admin/confexped.php @@ -92,7 +92,7 @@ print load_fiche_titre($langs->trans("SendingsSetup"), $linkback, 'title_setup') print '
'; $head = expedition_admin_prepare_head(); -dol_fiche_head($head, 'general', $langs->trans("Sendings"), -1, 'sending'); +dol_fiche_head($head, 'general', $langs->trans("Sendings"), -1, 'shipment'); // Miscellaneous parameters diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php index 21cb83c356a..46a1be45375 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -184,7 +184,7 @@ print load_fiche_titre($langs->trans("SendingsSetup"), $linkback, 'title_setup') print '
'; $head = expedition_admin_prepare_head(); -dol_fiche_head($head, 'shipment', $langs->trans("Sendings"), -1, 'sending'); +dol_fiche_head($head, 'shipment', $langs->trans("Sendings"), -1, 'shipment'); // Shipment numbering model diff --git a/htdocs/admin/expedition_extrafields.php b/htdocs/admin/expedition_extrafields.php index 6ff8cd42669..e40519f9104 100644 --- a/htdocs/admin/expedition_extrafields.php +++ b/htdocs/admin/expedition_extrafields.php @@ -76,7 +76,7 @@ print "
\n"; $head = expedition_admin_prepare_head(); -dol_fiche_head($head, 'attributes_shipment', $langs->trans("Sendings"), -1, 'sending'); +dol_fiche_head($head, 'attributes_shipment', $langs->trans("Sendings"), -1, 'shipment'); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; diff --git a/htdocs/admin/expeditiondet_extrafields.php b/htdocs/admin/expeditiondet_extrafields.php index 8b27aec895e..03cd140d0ee 100644 --- a/htdocs/admin/expeditiondet_extrafields.php +++ b/htdocs/admin/expeditiondet_extrafields.php @@ -77,7 +77,7 @@ print "
\n"; $head = expedition_admin_prepare_head(); -dol_fiche_head($head, 'attributeslines_shipment', $langs->trans("Sendings"), -1, 'sending'); +dol_fiche_head($head, 'attributeslines_shipment', $langs->trans("Sendings"), -1, 'shipment'); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; diff --git a/htdocs/admin/livraison.php b/htdocs/admin/livraison.php index 66f3a44cdcf..5e0c0ce4784 100644 --- a/htdocs/admin/livraison.php +++ b/htdocs/admin/livraison.php @@ -179,7 +179,7 @@ print load_fiche_titre($langs->trans("SendingsSetup"), $linkback, 'title_setup') print '
'; $head = expedition_admin_prepare_head(); -dol_fiche_head($head, 'receivings', $langs->trans("Receivings"), -1, 'sending'); +dol_fiche_head($head, 'receivings', $langs->trans("Receivings"), -1, 'shipment'); // Delivery numbering model diff --git a/htdocs/admin/livraison_extrafields.php b/htdocs/admin/livraison_extrafields.php index 5594273320f..3b6d03ac98e 100644 --- a/htdocs/admin/livraison_extrafields.php +++ b/htdocs/admin/livraison_extrafields.php @@ -76,7 +76,7 @@ print "
\n"; $head = expedition_admin_prepare_head(); -dol_fiche_head($head, 'attributes_receivings', $langs->trans("Receivings"), -1, 'sending'); +dol_fiche_head($head, 'attributes_receivings', $langs->trans("Receivings"), -1, 'shipment'); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; diff --git a/htdocs/admin/livraisondet_extrafields.php b/htdocs/admin/livraisondet_extrafields.php index 2c9aae6b253..ebed8de9608 100644 --- a/htdocs/admin/livraisondet_extrafields.php +++ b/htdocs/admin/livraisondet_extrafields.php @@ -77,7 +77,7 @@ print "
\n"; $head = expedition_admin_prepare_head(); -dol_fiche_head($head, 'attributeslines_receivings', $langs->trans("Receivings"), -1, 'sending'); +dol_fiche_head($head, 'attributeslines_receivings', $langs->trans("Receivings"), -1, 'shipment'); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; diff --git a/htdocs/admin/menus.php b/htdocs/admin/menus.php index 0b19285a072..ff15bbdcd40 100644 --- a/htdocs/admin/menus.php +++ b/htdocs/admin/menus.php @@ -151,7 +151,7 @@ print ''; print ''; print ''; -dol_fiche_head($head, 'handler', $langs->trans("Menus"), -1); +dol_fiche_head($head, 'handler', '', -1); print ''.$langs->trans("MenusDesc")."
\n"; print "
\n"; diff --git a/htdocs/admin/menus/index.php b/htdocs/admin/menus/index.php index b7305679ce5..095905afe8b 100644 --- a/htdocs/admin/menus/index.php +++ b/htdocs/admin/menus/index.php @@ -229,7 +229,7 @@ $head[$h][1] = $langs->trans("Miscellaneous"); $head[$h][2] = 'misc'; $h++; -dol_fiche_head($head, 'editor', $langs->trans("Menus"), -1); +dol_fiche_head($head, 'editor', '', -1); print ''.$langs->trans("MenusEditorDesc")."
\n"; print "
\n"; diff --git a/htdocs/admin/menus/other.php b/htdocs/admin/menus/other.php index 6d88153611d..2fad8491e7a 100644 --- a/htdocs/admin/menus/other.php +++ b/htdocs/admin/menus/other.php @@ -75,7 +75,7 @@ $head[$h][1] = $langs->trans("Miscellaneous"); $head[$h][2] = 'misc'; $h++; -dol_fiche_head($head, 'misc', $langs->trans("Menus"), -1); +dol_fiche_head($head, 'misc', '', -1); // Other Options diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index c18724c9103..ce6f948aa0a 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -423,7 +423,7 @@ class Facture extends CommonInvoice $this->brouillon = 1; // Multicurrency (test on $this->multicurrency_tx because we should take the default rate only if not using origin rate) - if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code); + if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $this->date); else $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code); if (empty($this->fk_multicurrency)) { diff --git a/htdocs/compta/facture/invoicetemplate_list.php b/htdocs/compta/facture/invoicetemplate_list.php index dfda4a5b16d..218cede3efa 100644 --- a/htdocs/compta/facture/invoicetemplate_list.php +++ b/htdocs/compta/facture/invoicetemplate_list.php @@ -53,6 +53,8 @@ $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'inv $socid = GETPOST('socid', 'int'); +$socid = GETPOST('socid', 'int'); + // Security check $id = (GETPOST('facid', 'int') ?GETPOST('facid', 'int') : GETPOST('id', 'int')); $lineid = GETPOST('lineid', 'int'); @@ -151,6 +153,11 @@ if ($socid > 0) { } +if ($socid > 0) { + $tmpthirdparty = new Societe($db); + $res = $tmpthirdparty->fetch($socid); + if ($res > 0) $search_societe = $tmpthirdparty->name; +} /* * Actions diff --git a/htdocs/compta/paymentbybanktransfer/index.php b/htdocs/compta/paymentbybanktransfer/index.php index 2fc16e3dc06..2f9d7ed127f 100644 --- a/htdocs/compta/paymentbybanktransfer/index.php +++ b/htdocs/compta/paymentbybanktransfer/index.php @@ -94,7 +94,7 @@ print '

'; */ $sql = "SELECT f.ref, f.rowid, f.total_ttc, f.fk_statut, f.paye, f.type,"; $sql .= " pfd.date_demande, pfd.amount,"; -$sql .= " s.nom as name, s.email, s.rowid as socid"; +$sql .= " s.nom as name, s.email, s.rowid as socid, s.tva_intra"; $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f,"; $sql .= " ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -138,13 +138,14 @@ if ($resql) $thirdpartystatic->id = $obj->socid; $thirdpartystatic->name = $obj->name; $thirdpartystatic->email = $obj->email; + $thirdpartystatic->tva_intra = $obj->tva_intra; print ''; print $invoicestatic->getNomUrl(1, 'withdraw'); print ''; print ''; - print $thirdpartystatic->getNomUrl(1, 'customer'); + print $thirdpartystatic->getNomUrl(1, 'supplier'); print ''; print ''; diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index d1a932a7685..5bce8045df9 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -31,10 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.p require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Load translation files required by the page -$langs->loadLangs(array('banks', 'categories', 'bills', 'withdrawals')); - -if (!$user->rights->prelevement->bons->lire) -accessforbidden(); +$langs->loadLangs(array('banks', 'categories', 'bills', 'companies', 'withdrawals')); // Security check if ($user->socid > 0) accessforbidden(); @@ -44,7 +41,6 @@ $action = GETPOST('action', 'alpha'); $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); $socid = GETPOST('socid', 'int'); - $type = GETPOST('type', 'aZ09'); // Load variable for pagination @@ -67,6 +63,13 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ $hookmanager->initHooks(array('directdebitprevcard', 'globalcard', 'directdebitprevlist')); +if (!$user->rights->prelevement->bons->lire && $object->type != 'bank-transfer') { + accessforbidden(); +} +if (!$user->rights->paymentbybanktransfer->read && $object->type == 'bank-transfer') { + accessforbidden(); +} + /* * Actions @@ -174,7 +177,7 @@ if ($id > 0 || $ref) }*/ - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref'); @@ -200,7 +203,7 @@ if ($id > 0 || $ref) print ''.$langs->trans("TransData").''; print dol_print_date($object->date_trans, 'day'); - print ' '.$langs->trans("By").' '.$muser->getFullName($langs).''; + print ' '.$langs->trans("By").' '.$muser->getFullName($langs).''; print ''.$langs->trans("TransMetod").''; print $object->methodes_trans[$object->method_trans]; print ''; @@ -223,7 +226,9 @@ if ($id > 0 || $ref) $result = $acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT); print ''; - print $langs->trans("BankToReceiveWithdraw"); + $labelofbankfield = "BankToReceiveWithdraw"; + if ($object->type == 'bank-transfer') $labelofbankfield = 'BankToPayCreditTransfer'; + print $langs->trans($labelofbankfield); print ''; print ''; if ($acc->id > 0) @@ -232,9 +237,13 @@ if ($id > 0 || $ref) print ''; print ''; - print $langs->trans("WithdrawalFile").''; + $labelfororderfield = 'WithdrawalFile'; + if ($object->type == 'bank-transfer') $labelfororderfield = 'CreditTransferFile'; + print $langs->trans($labelfororderfield).''; $relativepath = 'receipts/'.$object->ref.'.xml'; - print ''.$relativepath.''; + $modulepart = 'prelevement'; + if ($object->type == 'bank-transfer') $modulepart = 'paymentbybanktransfer'; + print ''.$relativepath.''; print ''; print ''; diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index a190873116a..8399485b29b 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -283,6 +283,7 @@ class BonPrelevement extends CommonObject $sql .= ", p.method_trans, p.fk_user_trans"; $sql .= ", p.date_credit as date_credit"; $sql .= ", p.fk_user_credit"; + $sql .= ", p.type"; $sql .= ", p.statut as status"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; $sql .= " WHERE p.entity IN (".getEntity('invoice').")"; @@ -310,6 +311,8 @@ class BonPrelevement extends CommonObject $this->date_credit = $this->db->jdate($obj->date_credit); $this->user_credit = $obj->fk_user_credit; + $this->type = $obj->type; + $this->status = $obj->status; $this->statut = $obj->status; // For backward compatibility @@ -883,14 +886,14 @@ class BonPrelevement extends CommonObject foreach ($factures as $key => $fac) { if ($type != 'bank-transfer') { - $fact = new Facture($this->db); + $tmpinvoice = new Facture($this->db); } else { - $fact = new FactureFournisseur($this->db); + $tmpinvoice = new FactureFournisseur($this->db); } - $resfetch = $fact->fetch($fac[0]); + $resfetch = $tmpinvoice->fetch($fac[0]); if ($resfetch >= 0) // Field 0 of $fac is rowid of invoice { - if ($soc->fetch($fact->socid) >= 0) + if ($soc->fetch($tmpinvoice->socid) >= 0) { $bac = new CompanyBankAccount($this->db); $bac->fetch(0, $soc->id); @@ -914,9 +917,9 @@ class BonPrelevement extends CommonObject $i++; //dol_syslog(__METHOD__."::RIB is ok", LOG_DEBUG); } else { - dol_syslog(__METHOD__."::Check BAN Error on default bank number IBAN/BIC for thirdparty reported by verif() ".$fact->socid." ".$soc->name, LOG_WARNING); - $this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice ".$fact->getNomUrl(0)." for thirdparty ".$soc->getNomUrl(0); - $this->thirdparty_in_error[$soc->id] = "Error on default bank number IBAN/BIC for invoice ".$fact->getNomUrl(0)." for thirdparty ".$soc->getNomUrl(0); + dol_syslog(__METHOD__."::Check BAN Error on default bank number IBAN/BIC for thirdparty reported by verif() ".$tmpinvoice->socid." ".$soc->name, LOG_WARNING); + $this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice ".$tmpinvoice->getNomUrl(0)." for thirdparty ".$soc->getNomUrl(0); + $this->thirdparty_in_error[$soc->id] = "Error on default bank number IBAN/BIC for invoice ".$tmpinvoice->getNomUrl(0)." for thirdparty ".$soc->getNomUrl(0); } } else { dol_syslog(__METHOD__."::Check BAN Failed to read company", LOG_WARNING); @@ -1081,7 +1084,7 @@ class BonPrelevement extends CommonObject * Create file of direct debit order or credit transfer into a XML file */ - dol_syslog(__METHOD__."::Init direct debit file for ".count($factures_prev)." invoices", LOG_DEBUG); + dol_syslog(__METHOD__."::Init direct debit or credit transfer file for ".count($factures_prev)." invoices", LOG_DEBUG); if (count($factures_prev) > 0) { @@ -1107,8 +1110,8 @@ class BonPrelevement extends CommonObject $this->factures = $factures_prev_id; $this->context['factures_prev'] = $factures_prev; - // Generation of SEPA file $this->filename - // This also the the property $this->total that is included into file + // Generation of direct debit or credti transfer file $this->filename (May be a SEPA file for european countries) + // This also set the property $this->total with amount that is included into file $result = $this->generate($format, $executiondate, $type); } dol_syslog(__METHOD__."::End withdraw receipt, file ".$this->filename, LOG_DEBUG); @@ -1425,8 +1428,110 @@ class BonPrelevement extends CommonObject $found++; if ($type == 'bank-transfer') { - print 'TODO'; - exit; + /** + * SECTION CREATION FICHIER SEPA - CREDIT TRANSFER + */ + // SEPA Initialisation + $CrLf = "\n"; + + $now = dol_now(); + + $dateTime_ECMA = dol_print_date($now, '%Y-%m-%dT%H:%M:%S'); + + $date_actu = $now; + if (!empty($executiondate)) $date_actu = $executiondate; + + $dateTime_YMD = dol_print_date($date_actu, '%Y%m%d'); + $dateTime_YMDHMS = dol_print_date($date_actu, '%Y%m%d%H%M%S'); + $fileCrediteurSection = ''; + $fileEmetteurSection = ''; + $i = 0; + + /* + * Section Creditor (sepa Crediteurs bloc lines) + */ + + $sql = "SELECT soc.code_client as code, soc.address, soc.zip, soc.town, c.code as country_code,"; + $sql .= " pl.client_nom as nom, pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,"; + $sql .= " f.ref as fac, pf.fk_facture as idfac, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, rib.rum, rib.date_rum"; + $sql .= " FROM"; + $sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,"; + $sql .= " ".MAIN_DB_PREFIX."facture_fourn as f,"; + $sql .= " ".MAIN_DB_PREFIX."prelevement_facture as pf,"; + $sql .= " ".MAIN_DB_PREFIX."societe as soc,"; + $sql .= " ".MAIN_DB_PREFIX."c_country as c,"; + $sql .= " ".MAIN_DB_PREFIX."societe_rib as rib"; + $sql .= " WHERE pl.fk_prelevement_bons = ".$this->id; + $sql .= " AND pl.rowid = pf.fk_prelevement_lignes"; + $sql .= " AND pf.fk_facture_fourn = f.rowid"; + $sql .= " AND soc.fk_pays = c.rowid"; + $sql .= " AND soc.rowid = f.fk_soc"; + $sql .= " AND rib.fk_soc = f.fk_soc"; + $sql .= " AND rib.default_rib = 1"; + $sql .= " AND rib.type = 'ban'"; + //print $sql; + + // Define $fileCrediteurSection. One section DrctDbtTxInf per invoice. + $resql = $this->db->query($sql); + if ($resql) + { + $num = $this->db->num_rows($resql); + while ($i < $num) + { + $obj = $this->db->fetch_object($resql); + $daterum = (!empty($obj->date_rum)) ? $this->db->jdate($obj->date_rum) : $this->db->jdate($obj->datec); + $fileCrediteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $obj->fac, $obj->idfac, $obj->iban, $obj->bic, $daterum, $obj->drum, $obj->rum); + $this->total = $this->total + $obj->somme; + $i++; + } + $nbtotalDrctDbtTxInf = $i; + } + else + { + fputs($this->file, 'ERROR CREDITOR '.$sql.$CrLf); // CREDITORS = Suppliers + $result = -2; + } + + // Define $fileEmetteurSection. Start of bloc PmtInf. Will contains all $nbtotalDrctDbtTxInf + if ($result != -2) + { + $fileEmetteurSection .= $this->EnregEmetteurSEPA($conf, $date_actu, $nbtotalDrctDbtTxInf, $this->total, $CrLf, $format); + } + + /** + * SECTION CREATION SEPA FILE - CREDTI TRANSFER - ISO200022 + */ + // SEPA File Header + fputs($this->file, '<'.'?xml version="1.0" encoding="UTF-8" standalone="yes"?'.'>'.$CrLf); + fputs($this->file, ''.$CrLf); + fputs($this->file, ' '.$CrLf); + // SEPA Group header + fputs($this->file, ' '.$CrLf); + fputs($this->file, ' '.('CREDTRANS'.$dateTime_YMD.'/REF'.$this->id).''.$CrLf); + fputs($this->file, ' '.$dateTime_ECMA.''.$CrLf); + fputs($this->file, ' '.$i.''.$CrLf); + fputs($this->file, ' '.$this->total.''.$CrLf); + fputs($this->file, ' '.$CrLf); + fputs($this->file, ' '.strtoupper(dol_string_unaccent($this->raison_sociale)).''.$CrLf); + fputs($this->file, ' '.$CrLf); + fputs($this->file, ' '.$CrLf); + fputs($this->file, ' '.$CrLf); + fputs($this->file, ' '.$conf->global->PRELEVEMENT_ICS.''.$CrLf); + fputs($this->file, ' '.$CrLf); + fputs($this->file, ' '.$CrLf); + fputs($this->file, ' '.$CrLf); + fputs($this->file, ' '.$CrLf); + fputs($this->file, ' '.$CrLf); + // SEPA File Emetteur (mycompany) + if ($result != -2) + { fputs($this-> file, $fileEmetteurSection); } + // SEPA File Creditors + if ($result != -2) + { fputs($this-> file, $fileCrediteurSection); } + // SEPA FILE FOOTER + fputs($this->file, ' '.$CrLf); + fputs($this->file, ' '.$CrLf); + fputs($this->file, ''.$CrLf); } else { /** * SECTION CREATION FICHIER SEPA @@ -1490,16 +1595,14 @@ class BonPrelevement extends CommonObject $result = -2; } - // Define $fileEmetteurSection. Start of bloc PmtInf. Will contains all DrctDbtTxInf + // Define $fileEmetteurSection. Start of bloc PmtInf. Will contains all $nbtotalDrctDbtTxInf if ($result != -2) { $fileEmetteurSection .= $this->EnregEmetteurSEPA($conf, $date_actu, $nbtotalDrctDbtTxInf, $this->total, $CrLf, $format); - } else { - fputs($this->file, 'ERROR CREDITOR'.$CrLf); // CREDITOR = My company } /** - * SECTION CREATION SEPA FILE + * SECTION CREATION SEPA FILE - ISO200022 */ // SEPA File Header fputs($this->file, '<'.'?xml version="1.0" encoding="UTF-8" standalone="yes"?'.'>'.$CrLf); diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index ed08c5b4575..0be8dfc9e52 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -101,7 +101,11 @@ if (empty($reshook)) $mesg .= ''.$val."
\n"; } } else { - setEventMessages($langs->trans("DirectDebitOrderCreated", $bprev->getNomUrl(1)), null); + if ($type != 'bank-transfer') { + setEventMessages($langs->trans("DirectDebitOrderCreated", $bprev->getNomUrl(1)), null); + } else { + setEventMessages($langs->trans("CreditTransferOrderCreated", $bprev->getNomUrl(1)), null); + } header("Location: ".DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$bprev->id); exit; diff --git a/htdocs/compta/prelevement/demandes.php b/htdocs/compta/prelevement/demandes.php index 3bbc5c8b2bc..feda7f0771d 100644 --- a/htdocs/compta/prelevement/demandes.php +++ b/htdocs/compta/prelevement/demandes.php @@ -190,6 +190,14 @@ print ''; $param = ''; +$label = 'NewStandingOrder'; +$typefilter = ''; +if ($type == 'bank-transfer') { + $label = 'NewPaymentByBankTransfer'; + $typefilter = 'type='.$type; +} +$newcardbutton .= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/prelevement/create.php'.($typefilter ? '?'.$typefilter : '')); + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'generic', 0, $newcardbutton, '', $limit); print ''; diff --git a/htdocs/compta/prelevement/factures.php b/htdocs/compta/prelevement/factures.php index 452e1bf8be7..300bc6b8301 100644 --- a/htdocs/compta/prelevement/factures.php +++ b/htdocs/compta/prelevement/factures.php @@ -32,21 +32,21 @@ require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Load translation files required by the page -$langs->loadLangs(array('banks', 'categories', 'companies', 'withdrawals', 'bills')); +$langs->loadLangs(array('banks', 'categories', 'bills', 'companies', 'withdrawals')); // Securite acces client if ($user->socid > 0) accessforbidden(); // Get supervariables $id = GETPOST('id', 'int'); -$socid = GETPOST('socid', 'int'); $ref = GETPOST('ref', 'alpha'); - +$socid = GETPOST('socid', 'int'); $type = GETPOST('type', 'aZ09'); +// Load variable for pagination $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; -$sortfield = GETPOST("sortfield", 'alpha'); -$sortorder = GETPOST("sortorder", 'alpha'); +$sortfield = GETPOST('sortfield', 'alpha'); +$sortorder = GETPOST('sortorder', 'alpha'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 $offset = $limit * $page; @@ -57,6 +57,17 @@ if (!$sortorder) $sortorder = 'DESC'; $object = new BonPrelevement($db); +// Load object +include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals + +$hookmanager->initHooks(array('directdebitprevcard', 'globalcard', 'directdebitprevlist')); + +if (!$user->rights->prelevement->bons->lire && $object->type != 'bank-transfer') { + accessforbidden(); +} +if (!$user->rights->paymentbybanktransfer->read && $object->type == 'bank-transfer') { + accessforbidden(); +} /* @@ -75,19 +86,17 @@ if ($id > 0 || $ref) $head = prelevement_prepare_head($object); dol_fiche_head($head, 'invoices', $langs->trans("WithdrawalsReceipts"), -1, 'payment'); - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref'); print '
'; print '
'; - print '
'; + print '
'."\n"; //print ''; print ''; print ''; - // Status - //print ''; if ($object->date_trans <> 0) { @@ -119,7 +128,9 @@ if ($id > 0 || $ref) $result = $acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT); print ''; print ''; print '
'.$langs->trans("Ref").''.$object->getNomUrl(1).'
'.$langs->trans("Date").''.dol_print_date($object->datec, 'day').'
'.$langs->trans("Amount").''.price($object->amount).'
'.$langs->trans('Status').''.$object->getLibStatut(1).'
'; - print $langs->trans("BankToReceiveWithdraw"); + $labelofbankfield = "BankToReceiveWithdraw"; + if ($object->type == 'bank-transfer') $labelofbankfield = 'BankToPayCreditTransfer'; + print $langs->trans($labelofbankfield); print ''; if ($acc->id > 0) @@ -128,9 +139,13 @@ if ($id > 0 || $ref) print '
'; - print $langs->trans("WithdrawalFile").''; + $labelfororderfield = 'WithdrawalFile'; + if ($object->type == 'bank-transfer') $labelfororderfield = 'CreditTransferFile'; + print $langs->trans($labelfororderfield).''; $relativepath = 'receipts/'.$object->ref.'.xml'; - print ''.$relativepath.''; + $modulepart = 'prelevement'; + if ($object->type == 'bank-transfer') $modulepart = 'paymentbybanktransfer'; + print ''.$relativepath.''; print '
'; print ''; @@ -149,13 +164,25 @@ $sql .= " s.rowid as socid, s.nom as name, pl.statut, pl.amount as amount_reques $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; $sql .= ", ".MAIN_DB_PREFIX."prelevement_lignes as pl"; $sql .= ", ".MAIN_DB_PREFIX."prelevement_facture as pf"; -$sql .= ", ".MAIN_DB_PREFIX."facture as f"; +if ($object->type != 'bank-transfer') { + $sql .= ", ".MAIN_DB_PREFIX."facture as f"; +} else { + $sql .= ", ".MAIN_DB_PREFIX."facture_fourn as f"; +} $sql .= ", ".MAIN_DB_PREFIX."societe as s"; $sql .= " WHERE pf.fk_prelevement_lignes = pl.rowid"; $sql .= " AND pl.fk_prelevement_bons = p.rowid"; $sql .= " AND f.fk_soc = s.rowid"; -$sql .= " AND pf.fk_facture = f.rowid"; -$sql .= " AND f.entity IN (".getEntity('invoice').")"; +if ($object->type != 'bank-transfer') { + $sql .= " AND pf.fk_facture = f.rowid"; +} else { + $sql .= " AND pf.fk_facture_fourn = f.rowid"; +} +if ($object->type != 'bank-transfer') { + $sql .= " AND f.entity IN (".getEntity('invoice').")"; +} else { + $sql .= " AND f.entity IN (".getEntity('supplier_invoice').")"; +} if ($object->id > 0) $sql .= " AND p.rowid=".$object->id; if ($socid) $sql .= " AND s.rowid = ".$socid; $sql .= $db->order($sortfield, $sortorder); diff --git a/htdocs/compta/prelevement/fiche-rejet.php b/htdocs/compta/prelevement/fiche-rejet.php index b8665e822cf..dc13a666573 100644 --- a/htdocs/compta/prelevement/fiche-rejet.php +++ b/htdocs/compta/prelevement/fiche-rejet.php @@ -21,7 +21,7 @@ /** * \file htdocs/compta/prelevement/fiche-rejet.php * \ingroup prelevement - * \brief Withdraw reject + * \brief Debit order or credit transfer reject */ require '../../main.inc.php'; @@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Load translation files required by the page $langs->loadLangs(array("banks", "categories", 'withdrawals', 'bills')); -// Securite acces client +// Security check if ($user->socid > 0) accessforbidden(); // Get supervariables @@ -55,6 +55,15 @@ $pagenext = $page + 1; $object = new BonPrelevement($db); +// Load object +include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals + +if (!$user->rights->prelevement->bons->lire && $object->type != 'bank-transfer') { + accessforbidden(); +} +if (!$user->rights->paymentbybanktransfer->read && $object->type == 'bank-transfer') { + accessforbidden(); +} @@ -71,7 +80,7 @@ if ($prev_id > 0 || $ref) $head = prelevement_prepare_head($object); dol_fiche_head($head, 'rejects', $langs->trans("WithdrawalsReceipts"), -1, 'payment'); - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref'); @@ -83,13 +92,6 @@ if ($prev_id > 0 || $ref) print ''.$langs->trans("Date").''.dol_print_date($object->datec, 'day').''; print ''.$langs->trans("Amount").''.price($object->amount).''; - // Status - /* - print ''.$langs->trans('Status').''; - print ''.$object->getLibStatut(1).''; - print ''; - */ - if ($object->date_trans <> 0) { $muser = new User($db); @@ -120,7 +122,9 @@ if ($prev_id > 0 || $ref) $result = $acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT); print ''; - print $langs->trans("BankToReceiveWithdraw"); + $labelofbankfield = "BankToReceiveWithdraw"; + if ($object->type == 'bank-transfer') $labelofbankfield = 'BankToPayCreditTransfer'; + print $langs->trans($labelofbankfield); print ''; print ''; if ($acc->id > 0) @@ -129,9 +133,13 @@ if ($prev_id > 0 || $ref) print ''; print ''; - print $langs->trans("WithdrawalFile").''; + $labelfororderfield = 'WithdrawalFile'; + if ($object->type == 'bank-transfer') $labelfororderfield = 'CreditTransferFile'; + print $langs->trans($labelfororderfield).''; $relativepath = 'receipts/'.$object->ref.'.xml'; - print ''.$relativepath.''; + $modulepart = 'prelevement'; + if ($object->type == 'bank-transfer') $modulepart = 'paymentbybanktransfer'; + print ''.$relativepath.''; print ''; print ''; @@ -142,6 +150,7 @@ if ($prev_id > 0 || $ref) } } + $rej = new RejetPrelevement($db, $user); /* diff --git a/htdocs/compta/prelevement/fiche-stat.php b/htdocs/compta/prelevement/fiche-stat.php index 0b1d9744b20..3e6d85e9b42 100644 --- a/htdocs/compta/prelevement/fiche-stat.php +++ b/htdocs/compta/prelevement/fiche-stat.php @@ -20,7 +20,7 @@ /** * \file htdocs/compta/prelevement/fiche-stat.php * \ingroup prelevement - * \brief Prelevement statistics + * \brief Debit order or credit transfer statistics */ require '../../main.inc.php'; @@ -54,6 +54,17 @@ $pagenext = $page + 1; $object = new BonPrelevement($db); +// Load object +include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals + +if (!$user->rights->prelevement->bons->lire && $object->type != 'bank-transfer') { + accessforbidden(); +} +if (!$user->rights->paymentbybanktransfer->read && $object->type == 'bank-transfer') { + accessforbidden(); +} + + /* * View @@ -68,7 +79,7 @@ if ($prev_id > 0 || $ref) $head = prelevement_prepare_head($object); dol_fiche_head($head, 'statistics', $langs->trans("WithdrawalsReceipts"), -1, 'payment'); - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref'); @@ -80,13 +91,6 @@ if ($prev_id > 0 || $ref) print ''.$langs->trans("Date").''.dol_print_date($object->datec, 'day').''; print ''.$langs->trans("Amount").''.price($object->amount).''; - // Status - /* - print ''.$langs->trans('Status').''; - print ''.$object->getLibStatut(1).''; - print ''; - */ - if ($object->date_trans <> 0) { $muser = new User($db); @@ -117,7 +121,9 @@ if ($prev_id > 0 || $ref) $result = $acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT); print ''; - print $langs->trans("BankToReceiveWithdraw"); + $labelofbankfield = "BankToReceiveWithdraw"; + if ($object->type == 'bank-transfer') $labelofbankfield = 'BankToPayCreditTransfer'; + print $langs->trans($labelofbankfield); print ''; print ''; if ($acc->id > 0) @@ -126,23 +132,26 @@ if ($prev_id > 0 || $ref) print ''; print ''; - print $langs->trans("WithdrawalFile").''; + $labelfororderfield = 'WithdrawalFile'; + if ($object->type == 'bank-transfer') $labelfororderfield = 'CreditTransferFile'; + print $langs->trans($labelfororderfield).''; $relativepath = 'receipts/'.$object->ref.'.xml'; - print ''.$relativepath.''; + $modulepart = 'prelevement'; + if ($object->type == 'bank-transfer') $modulepart = 'paymentbybanktransfer'; + print ''.$relativepath.''; print ''; print ''; dol_fiche_end(); } else { - $langs->load("errors"); - print $langs->trans("Error"); + dol_print_error($db); } /* * Stats */ - $ligne = new LignePrelevement($db); + $line = new LignePrelevement($db); $sql = "SELECT sum(pl.amount), pl.statut"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl"; @@ -168,7 +177,7 @@ if ($prev_id > 0 || $ref) print ''; - print $ligne->LibStatut($row[1], 1); + print $line->LibStatut($row[1], 1); print ''; print price($row[0]); diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 0b8b99bd395..f610e6bb952 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -1072,7 +1072,8 @@ abstract class CommonDocGenerator $parameters = array( 'curY' => &$curY, 'columnText' => $columnText, - 'colKey' => $colKey + 'colKey' => $colKey, + 'pdf' => &$pdf, ); $reshook = $hookmanager->executeHooks('printStdColumnContent', $parameters, $this); // Note that $action and $object may have been modified by hook if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 9ab2e1807bd..3f33016d7e5 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -177,6 +177,8 @@ class DoliDBPgsql extends DoliDB if ($type == 'dml') { + $reg = array(); + $line = preg_replace('/\s/', ' ', $line); // Replace tabulation with space // we are inside create table statement so lets process datatypes diff --git a/htdocs/core/lib/prelevement.lib.php b/htdocs/core/lib/prelevement.lib.php index a404e19184e..8008c9fd51f 100644 --- a/htdocs/core/lib/prelevement.lib.php +++ b/htdocs/core/lib/prelevement.lib.php @@ -39,8 +39,13 @@ function prelevement_prepare_head(BonPrelevement $object) $h = 0; $head = array(); + $titleoftab = "WithdrawalsReceipts"; + if ($object->type == 'bank-transfer') { + $titleoftab = "BankTransferReceipts"; + } + $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$object->id; - $head[$h][1] = $langs->trans("WithdrawalsReceipts"); + $head[$h][1] = $langs->trans($titleoftab); $head[$h][2] = 'prelevement'; $h++; diff --git a/htdocs/core/lib/price.lib.php b/htdocs/core/lib/price.lib.php index 7def1ec85fa..ea80732ae41 100644 --- a/htdocs/core/lib/price.lib.php +++ b/htdocs/core/lib/price.lib.php @@ -40,8 +40,8 @@ * @param float $pu Unit price (HT or TTC selon price_base_type) * @param float $remise_percent_ligne Discount for line * @param float $txtva 0=do not apply VAT tax, VAT rate=apply (this is VAT rate only without text code, we don't need text code because we alreaydy have all tax info into $localtaxes_array) - * @param float $uselocaltax1_rate 0=do not use this localtax, >0=apply and get value from localtaxes_array (or database if empty), -1=autodetect according to seller if we must apply, get value from localtaxes_array (or database if empty). Try to always use -1. - * @param float $uselocaltax2_rate 0=do not use this localtax, >0=apply and get value from localtaxes_array (or database if empty), -1=autodetect according to seller if we must apply, get value from localtaxes_array (or database if empty). Try to always use -1. + * @param float $uselocaltax1_rate 0=do not use localtax1, >0=apply and get value from localtaxes_array (or database if empty), -1=autodetect according to seller if we must apply, get value from localtaxes_array (or database if empty). Try to always use -1. + * @param float $uselocaltax2_rate 0=do not use localtax2, >0=apply and get value from localtaxes_array (or database if empty), -1=autodetect according to seller if we must apply, get value from localtaxes_array (or database if empty). Try to always use -1. * @param float $remise_percent_global 0 * @param string $price_base_type HT=Unit price parameter is HT, TTC=Unit price parameter is TTC * @param int $info_bits Miscellaneous informations on line diff --git a/htdocs/core/tpl/card_presend.tpl.php b/htdocs/core/tpl/card_presend.tpl.php index bca04a3f534..ba759eded31 100644 --- a/htdocs/core/tpl/card_presend.tpl.php +++ b/htdocs/core/tpl/card_presend.tpl.php @@ -127,7 +127,24 @@ if ($action == 'presend') { $formmail->fromid = $user->id; } - $formmail->trackid = $trackid; + + if ($object->element === 'facture' && !empty($conf->global->INVOICE_EMAIL_SENDER)) { + $formmail->frommail = $conf->global->INVOICE_EMAIL_SENDER; + $formmail->fromname = ''; + $formmail->fromtype = 'special'; + } + if ($object->element === 'shipping' && !empty($conf->global->SHIPPING_EMAIL_SENDER)) { + $formmail->frommail = $conf->global->SHIPPING_EMAIL_SENDER; + $formmail->fromname = ''; + $formmail->fromtype = 'special'; + } + if ($object->element === 'commande' && !empty($conf->global->COMMANDE_EMAIL_SENDER)) { + $formmail->frommail = $conf->global->COMMANDE_EMAIL_SENDER; + $formmail->fromname = ''; + $formmail->fromtype = 'special'; + } + + $formmail->trackid=$trackid; if (!empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set { include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; diff --git a/htdocs/core/tpl/extrafields_list_print_fields.tpl.php b/htdocs/core/tpl/extrafields_list_print_fields.tpl.php index f80ae568071..95ac0d6d5ce 100644 --- a/htdocs/core/tpl/extrafields_list_print_fields.tpl.php +++ b/htdocs/core/tpl/extrafields_list_print_fields.tpl.php @@ -58,7 +58,7 @@ if (!empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_e // we keep position for the first line $totalarray['totalizable'][$key]['pos'] = $totalarray['nbfield']; } - $totalarray['totalizable'][$key]['total'] += $obj->$tmpkey; + if (is_numeric($obj->$tmpkey)) $totalarray['totalizable'][$key]['total'] += $obj->$tmpkey; } if (!empty($val['isameasure'])) { diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 12503c36869..929e7ecafd0 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1865,7 +1865,7 @@ if ($action == 'create') print '
'; print '
'; - print ''; + print '
'; // Sending method print ''; $out .= ''; foreach ($productFournLogList as $productFournLog) { - $out .= ''; + $out .= ''; $out .= ''; //$out.= ''; $out .= ''; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 384359ae92f..80301dcdc43 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2016 Laurent Destailleur + * Copyright (C) 2004-2020 Laurent Destailleur * Copyright (C) 2004 Christophe Combelles * Copyright (C) 2005 Marc Barilley * Copyright (C) 2005-2013 Regis Houssin diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php index 51145fb1f42..0e83d68509d 100644 --- a/htdocs/holiday/define_holiday.php +++ b/htdocs/holiday/define_holiday.php @@ -264,7 +264,7 @@ if (count($typeleaves) == 0) print ''; // Action column - print ''; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 7ab6c7e164f..36098ab54c1 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1688,7 +1688,7 @@ AGENDA_SHOW_LINKED_OBJECT=Show linked object into agenda view ##### Clicktodial ##### ClickToDialSetup=Click To Dial module setup ClickToDialUrlDesc=Url called when a click on phone picto is done. In URL, you can use tags
__PHONETO__ that will be replaced with the phone number of person to call
__PHONEFROM__ that will be replaced with phone number of calling person (yours)
__LOGIN__ that will be replaced with clicktodial login (defined on user card)
__PASS__ that will be replaced with clicktodial password (defined on user card). -ClickToDialDesc=This module makea phone numbers clickable links. A click on the icon will make your phone call the number. This can be used to call a call-center system from Dolibarr that can call the phone number on a SIP system for example. +ClickToDialDesc=This module change phone numbers, when using a desktop computer, into clickable links. A click will call the number. This can be used to start the phone call when using a soft phone on your desktop or when using a CTI system based on SIP protocol for example. Note: When using a smartphone, phone numbers are always clickable. ClickToDialUseTelLink=Use just a link "tel:" on phone numbers ClickToDialUseTelLinkDesc=Use this method if your users have a softphone or a software interface installed on the same computer as the browser, and called when you click on a link in your browser that starts with "tel:". If you need a full server solution (no need of local software installation), you must set this to "No" and fill next field. ##### Point Of Sale (CashDesk) ##### diff --git a/htdocs/langs/en_US/withdrawals.lang b/htdocs/langs/en_US/withdrawals.lang index 841a9c2d480..662c587108a 100644 --- a/htdocs/langs/en_US/withdrawals.lang +++ b/htdocs/langs/en_US/withdrawals.lang @@ -77,12 +77,12 @@ StatusMotif8=Other reason CreateForSepaFRST=Create direct debit file (SEPA FRST) CreateForSepaRCUR=Create direct debit file (SEPA RCUR) CreateAll=Create direct debit file (all) -CreateFileForPaymentByBankTransfer=Create credit transfer (all) +CreateFileForPaymentByBankTransfer=Create file for credit transfer (all) CreateSepaFileForPaymentByBankTransfer=Create credit transfer file (SEPA) CreateGuichet=Only office CreateBanque=Only bank OrderWaiting=Waiting for treatment -NotifyTransmision=Withdrawal Transmission +NotifyTransmision=File transmission NotifyCredit=Withdrawal Credit NumeroNationalEmetter=National Transmitter Number WithBankUsingRIB=For bank accounts using RIB @@ -95,7 +95,8 @@ ShowWithdraw=Show Direct Debit Order IfInvoiceNeedOnWithdrawPaymentWontBeClosed=However, if invoice has at least one direct debit payment order not yet processed, it won't be set as paid to allow prior withdrawal management. DoStandingOrdersBeforePayments=This tab allows you to request a direct debit payment order. Once done, go into menu Bank->Payment by direct debit to generate and manage the direct debit order. When direct debit order is closed, payment on invoices will be automatically recorded, and invoices closed if remainder to pay is null. DoCreditTransferBeforePayments=This tab allows you to request a credit transfer order. Once done, go into menu Bank->Payment by credit transfer to generate and manage the credit transfer order. When credit transfer order is closed, payment on invoices will be automatically recorded, and invoices closed if remainder to pay is null. -WithdrawalFile=Withdrawal file +WithdrawalFile=Debit order file +CreditTransferFile=Credit transfer file SetToStatusSent=Set to status "File Sent" ThisWillAlsoAddPaymentOnInvoice=This will also record payments on invoices and will classify them as "Paid" if remain to pay is null StatisticsByLineStatus=Statistics by status of lines @@ -121,6 +122,7 @@ SEPAFrstOrRecur=Type of payment ModeRECUR=Recurring payment ModeFRST=One-off payment PleaseCheckOne=Please check one only +CreditTransferOrderCreated=Credit transfer order %s created DirectDebitOrderCreated=Direct debit order %s created AmountRequested=Amount requested SEPARCUR=SEPA CUR diff --git a/htdocs/multicurrency/class/multicurrency.class.php b/htdocs/multicurrency/class/multicurrency.class.php index 05d0f3f8a7c..8acd4430e47 100644 --- a/htdocs/multicurrency/class/multicurrency.class.php +++ b/htdocs/multicurrency/class/multicurrency.class.php @@ -517,6 +517,7 @@ class MultiCurrency extends CommonObject global $conf; $sql1 = 'SELECT m.rowid, mc.rate FROM '.MAIN_DB_PREFIX.'multicurrency m'; + $sql1 .= ' LEFT JOIN '.MAIN_DB_PREFIX.'multicurrency_rate mc ON (m.rowid = mc.fk_multicurrency)'; $sql1 .= " WHERE m.code = '".$db->escape($code)."'"; $sql1 .= " AND m.entity IN (".getEntity('multicurrency').")"; @@ -525,7 +526,7 @@ class MultiCurrency extends CommonObject $tmparray = dol_getdate($date_document); $sql2 .= " AND mc.date_sync <= '".$db->idate(dol_mktime(23, 59, 59, $tmparray['mon'], $tmparray['mday'], $tmparray['year'], true))."'"; } - $sql3 .= ' ORDER BY mc.date_sync DESC LIMIT 1'; + $sql3 = ' ORDER BY mc.date_sync DESC LIMIT 1'; dol_syslog(__METHOD__, LOG_DEBUG); $resql = $db->query($sql1.$sql2.$sql3); diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 52de4d190d1..c73020ae7ab 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1990,7 +1990,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) print ''; } print ''; - if ($conf->browser->layout == 'phone') print ''; + print ''; print '
'; diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index c7cb8025d62..e7803ea4d0f 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1244,11 +1244,15 @@ class CommandeFournisseur extends CommonOrder $error = 0; $now = dol_now(); + // $date_commande is deprecated + $date = ($this->date_commande ? $this->date_commande : $this->date); // in case of date is set + if(empty($date)) $date = $now; + // Clean parameters if (empty($this->source)) $this->source = 0; // Multicurrency (test on $this->multicurrency_tx because we should take the default rate only if not using origin rate) - if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code); + if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $date); else $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code); if (empty($this->fk_multicurrency)) { diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 9949c4d3253..48ecb3de70f 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -359,7 +359,7 @@ class FactureFournisseur extends CommonInvoice $remise = $this->remise; // Multicurrency (test on $this->multicurrency_tx because we should take the default rate only if not using origin rate) - if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code); + if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $this->date); else $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code); if (empty($this->fk_multicurrency)) { @@ -485,7 +485,7 @@ class FactureFournisseur extends CommonInvoice $idligne, $this->lines[$i]->description, $this->lines[$i]->pu_ht, - $this->lines[$i]->tva_tx, + $this->lines[$i]->tva_tx.($this->lines[$i]->vat_src_code ? ' ('.$this->lines[$i]->vat_src_code.')' : ''), $this->lines[$i]->localtax1_tx, $this->lines[$i]->localtax2_tx, $this->lines[$i]->qty, @@ -1885,6 +1885,8 @@ class FactureFournisseur extends CommonInvoice $localtaxes_type = getLocalTaxesFromRate($vatrate, 0, $mysoc, $this->thirdparty); + $reg = array(); + // Clean vat code $vat_src_code = ''; if (preg_match('/\((.*)\)/', $vatrate, $reg)) @@ -2570,6 +2572,8 @@ class FactureFournisseur extends CommonInvoice $object->id = 0; $object->statut = self::STATUS_DRAFT; + $object->fetch_thirdparty(); // We need it to recalculate VAT localtaxes according to main sale taxes and vendor + // Clear fields $object->ref_supplier = (empty($this->ref_supplier) ? $langs->trans("CopyOf").' '.$object->ref_supplier : $this->ref_supplier); $object->author = $user->id; diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index a2ed4b6c0aa..b3c4514f5ff 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -995,7 +995,7 @@ class ProductFournisseur extends Product //$out .= ''.$langs->trans("QtyMin").''.$langs->trans("User").'
'.dol_print_date($this->db->jdate($productFournLog['datec']), 'dayhour', 'tzuser').'
'.dol_print_date($productFournLog['datec'], 'dayhour', 'tzuser').''.price($productFournLog['price']).''.$productFournLog['quantity'].''.$productFournLog['lastname'].'
'; + print ''; $searchpicto = $form->showFilterButtons(); print $searchpicto; print '
'.$form->editfieldkey($langs->transcountry("LocalTax2IsUsed", $mysoc->country_code), 'localtax2assuj_value', '', $object, 0).''; print $form->selectyesno('localtax2assuj_value', $object->localtax2_assuj, 1); if (!isOnlyOneLocalTax(2)) diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 907a741c288..9d6ce02c8ee 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -869,7 +869,7 @@ class SupplierProposal extends CommonObject } // Multicurrency - if (!empty($this->multicurrency_code)) list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code); + if (!empty($this->multicurrency_code)) list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $now); if (empty($this->fk_multicurrency)) { $this->multicurrency_code = $conf->currency; diff --git a/htdocs/theme/eldy/info-box.inc.php b/htdocs/theme/eldy/info-box.inc.php index cceb8af9bf7..b995b551f43 100644 --- a/htdocs/theme/eldy/info-box.inc.php +++ b/htdocs/theme/eldy/info-box.inc.php @@ -398,12 +398,18 @@ if (GETPOSTISSET('THEME_SATURATE_RATIO')) $conf->global->THEME_SATURATE_RATIO = height: 0; } +.info-box-title { + width: calc(100% - 20px); +} .info-box-module { min-width: 350px; max-width: 350px; } -.info-box-title { - width: calc(100% - 20px); +@media only screen and (max-width: 1740px) { + .info-box-module { + min-width: 315px; + max-width: 315px; + } } @media only screen and (max-width: 767px) { .info-box-module { diff --git a/htdocs/theme/md/info-box.inc.php b/htdocs/theme/md/info-box.inc.php index 949c8218e0a..e53f5d1f914 100644 --- a/htdocs/theme/md/info-box.inc.php +++ b/htdocs/theme/md/info-box.inc.php @@ -455,6 +455,18 @@ if (GETPOSTISSET('THEME_SATURATE_RATIO')) $conf->global->THEME_SATURATE_RATIO = min-width: 350px; max-width: 350px; } +@media only screen and (max-width: 1740px) { + .info-box-module { + min-width: 315px; + max-width: 315px; + } +} +@media only screen and (max-width: 767px) { + .info-box-module { + min-width: 260px; + } +} + .info-box-module .info-box-content { height: 6.3em; } diff --git a/test/phpunit/CodingSqlTest.php b/test/phpunit/CodingSqlTest.php index 56b0d001a81..245a7869811 100644 --- a/test/phpunit/CodingSqlTest.php +++ b/test/phpunit/CodingSqlTest.php @@ -164,7 +164,10 @@ class CodingSqlTest extends PHPUnit\Framework\TestCase continue; print 'Check sql file '.$file."\n"; - $filecontent=file_get_contents($dir.'/'.$file); + $filecontent = file_get_contents($dir.'/'.$file); + + // Allow ` for 'rank' column name + $filecontent = str_replace('`rank`', '_rank_', $filecontent); $result=strpos($filecontent, '`'); print __METHOD__." Result for checking we don't have back quote = ".$result."\n";