diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index fd64155f3d9..18dabbcf980 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -1,13 +1,14 @@ - * Copyright (C) 2004-2010 Laurent Destailleur - * Copyright (C) 2005 Marc Barilley / Ocebo +/* Copyright (C) 2002-2004 Rodolphe Quiedeville + * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2012 Cédric Salvador * Copyright (C) 2014 Raphaël Doursenaud * Copyright (C) 2014 Marcos García * Copyright (C) 2015 Juanjo Menent * Copyright (C) 2018 Ferran Marcet * Copyright (C) 2018 Thibault FOUCART + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -73,16 +74,69 @@ class Paiement extends CommonObject public $author; public $paiementid; // Type de paiement. Stocke dans fk_paiement // de llx_paiement qui est lie aux types de - //paiement de llx_c_paiement - public $num_paiement; // Numero du CHQ, VIR, etc... - public $num_payment; // Numero du CHQ, VIR, etc... - public $payment_id; // Id of external modepayment - public $payment_site; // name of external modepayment - public $bank_account; // Id compte bancaire du paiement - public $bank_line; // Id de la ligne d'ecriture bancaire + //paiement de llx_c_paiement + + /** + * @var string type libelle + */ + public $type_libelle; + + /** + * @var string type code + */ + public $type_code; + + /** + * @var string Numero du CHQ, VIR, etc... + * @deprecated + * @see num_payment + */ + public $numero; + + /** + * @var string Numero du CHQ, VIR, etc... + * @deprecated + * @see num_payment + */ + public $num_paiement; + + /** + * @var string Numero du CHQ, VIR, etc... + */ + public $num_payment; + + /** + * @var string Id of external payment mode + */ + public $ext_payment_id; + + /** + * @var string Name of external payment mode + */ + public $ext_payment_site; + + /** + * @var int bank account id of payment + * @deprecated + */ + public $bank_account; + + /** + * @var int bank account id of payment + */ + public $fk_account; + + /** + * @var int id of payment line in bank account + */ + public $bank_line; + // fk_paiement dans llx_paiement est l'id du type de paiement (7 pour CHQ, ...) - // fk_paiement dans llx_paiement_facture est le rowid du paiement - public $fk_paiement; // Type of paiment + // fk_paiement dans llx_paiement_facture est le rowid du paiement + /** + * @var int payment id + */ + public $fk_paiement; // Type of payment /** @@ -90,7 +144,7 @@ class Paiement extends CommonObject * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { $this->db = $db; } @@ -103,7 +157,7 @@ class Paiement extends CommonObject * @param int $fk_bank Id of bank line associated to payment * @return int <0 if KO, 0 if not found, >0 if OK */ - function fetch($id, $ref='', $fk_bank='') + public function fetch($id, $ref='', $fk_bank='') { $sql = 'SELECT p.rowid, p.ref, p.datep as dp, p.amount, p.statut, p.ext_payment_id, p.ext_payment_site, p.fk_bank,'; $sql.= ' c.code as type_code, c.libelle as type_libelle,'; @@ -138,8 +192,8 @@ class Paiement extends CommonObject $this->type_libelle = $obj->type_libelle; $this->type_code = $obj->type_code; $this->statut = $obj->statut; - $this->payment_id = $obj->ext_payment_id; - $this->payment_site = $obj->ext_payment_site; + $this->ext_payment_id = $obj->ext_payment_id; + $this->ext_payment_site = $obj->ext_payment_site; $this->bank_account = $obj->fk_account; // deprecated $this->fk_account = $obj->fk_account; @@ -235,7 +289,7 @@ class Paiement extends CommonObject $note = ($this->note_public?$this->note_public:$this->note); $sql = "INSERT INTO ".MAIN_DB_PREFIX."paiement (entity, ref, datec, datep, amount, multicurrency_amount, fk_paiement, num_paiement, note, ext_payment_id, ext_payment_site, fk_user_creat)"; - $sql.= " VALUES (".$conf->entity.", '".$this->db->escape($this->ref)."', '". $this->db->idate($now)."', '".$this->db->idate($this->datepaye)."', ".$total.", ".$mtotal.", ".$this->paiementid.", '".$this->db->escape($this->num_paiement)."', '".$this->db->escape($note)."', ".($this->payment_id?"'".$this->db->escape($this->payment_id)."'":"null").", ".($this->payment_site?"'".$this->db->escape($this->payment_site)."'":"null").", ".$user->id.")"; + $sql.= " VALUES (".$conf->entity.", '".$this->db->escape($this->ref)."', '". $this->db->idate($now)."', '".$this->db->idate($this->datepaye)."', ".$total.", ".$mtotal.", ".$this->paiementid.", '".$this->db->escape($this->num_paiement)."', '".$this->db->escape($note)."', ".($this->ext_payment_id?"'".$this->db->escape($this->ext_payment_id)."'":"null").", ".($this->ext_payment_site?"'".$this->db->escape($this->ext_payment_site)."'":"null").", ".$user->id.")"; dol_syslog(get_class($this)."::Create insert paiement", LOG_DEBUG); $resql = $this->db->query($sql); diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 003d9591712..92458831d0b 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -1,10 +1,11 @@ - * Copyright (C) 2004-2010 Laurent Destailleur - * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2015 Marcos García - * Copyright (C) 2016 Charlie Benke +/* Copyright (C) 2003-2005 Rodolphe Quiedeville + * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2004 Eric Seigne + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2015 Marcos García + * Copyright (C) 2016 Charlie Benke + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1017,7 +1018,7 @@ abstract class CommonDocGenerator $parameters=array( 'object' => $object, - 'curY' =>& $curY, + 'curY' => &$curY, 'columnText' => $columnText, 'colKey' => $colKey ); @@ -1030,7 +1031,6 @@ abstract class CommonDocGenerator $colDef = $this->cols[$colKey]; $pdf->MultiCell( $this->getColumnContentWidth($colKey),2, $columnText,'',$colDef['content']['align']); } - } diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index 0a14e50326d..4b11c61b078 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -7,6 +7,7 @@ * Copyright (C) 2012 Cedric Salvador * Copyright (C) 2015 Marcos García * Copyright (C) 2017 Ferran Marcet + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -67,7 +68,7 @@ class pdf_eratosthene extends ModelePDFCommandes public $type; /** - * @var array() Minimum version of PHP required by module. + * @var array Minimum version of PHP required by module. * e.g.: PHP ≥ 5.3 = array(5, 3) */ public $phpmin = array(5, 2); @@ -145,7 +146,8 @@ class pdf_eratosthene extends ModelePDFCommandes $this->atleastonediscount=0; } - /** phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** * Function to build pdf onto disk * * @param Object $object Object to generate @@ -156,7 +158,7 @@ class pdf_eratosthene extends ModelePDFCommandes * @param int $hideref Do not show ref * @return int 1=OK, 0=KO */ - function write_file($object, $outputlangs, $srctemplatepath='', $hidedetails=0, $hidedesc=0, $hideref=0) + public function write_file($object, $outputlangs, $srctemplatepath='', $hidedetails=0, $hidedesc=0, $hideref=0) { // phpcs:enable global $user, $langs, $conf, $mysoc, $db, $hookmanager, $nblignes; @@ -665,16 +667,16 @@ class pdf_eratosthene extends ModelePDFCommandes $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; // Affiche zone infos - $posy=$this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs); + $posy=$this->drawInfoTable($pdf, $object, $bottomlasttab, $outputlangs); // Affiche zone totaux - $posy=$this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs); + $posy=$this->drawTotalTable($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs); // Affiche zone versements /* if ($deja_regle) { - $posy=$this->_tableau_versements($pdf, $object, $posy, $outputlangs); + $posy=$this->drawPaymentsTable($pdf, $object, $posy, $outputlangs); } */ @@ -721,7 +723,7 @@ class pdf_eratosthene extends ModelePDFCommandes * @param Translate $outputlangs Object langs for output * @return int <0 if KO, >0 if OK */ - function _tableau_versements(&$pdf, $object, $posy, $outputlangs) + private function drawPaymentsTable(&$pdf, $object, $posy, $outputlangs) { // phpcs:enable @@ -737,7 +739,7 @@ class pdf_eratosthene extends ModelePDFCommandes * @param Translate $outputlangs Langs object * @return void */ - function _tableau_info(&$pdf, $object, $posy, $outputlangs) + private function drawInfoTable(&$pdf, $object, $posy, $outputlangs) { // phpcs:enable global $conf; @@ -925,7 +927,7 @@ class pdf_eratosthene extends ModelePDFCommandes * @param Translate $outputlangs Objet langs * @return int Position pour suite */ - function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs) + private function drawTotalTable(&$pdf, $object, $deja_regle, $posy, $outputlangs) { // phpcs:enable global $conf,$mysoc; @@ -1189,7 +1191,7 @@ class pdf_eratosthene extends ModelePDFCommandes * @param string $currency Currency code * @return void */ - function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0, $currency='') + private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0, $currency='') { global $conf; @@ -1245,8 +1247,6 @@ class pdf_eratosthene extends ModelePDFCommandes if (empty($hidetop)){ $pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5); // line prend une position y en 2eme param et 4eme param } - - } /** @@ -1259,7 +1259,7 @@ class pdf_eratosthene extends ModelePDFCommandes * @param string $titlekey Translation key to show as title of document * @return void */ - function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey="PdfOrderTitle") + private function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey="PdfOrderTitle") { global $conf,$langs,$hookmanager; @@ -1470,7 +1470,7 @@ class pdf_eratosthene extends ModelePDFCommandes * @param int $hidefreetext 1=Hide free text * @return int Return height of bottom margin including footer text */ - function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0) + private function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0) { global $conf; $showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; @@ -1489,9 +1489,8 @@ class pdf_eratosthene extends ModelePDFCommandes * @param int $hideref Do not show ref * @return null */ - function defineColumnField($object,$outputlangs,$hidedetails=0,$hidedesc=0,$hideref=0) - { - + public function defineColumnField($object,$outputlangs,$hidedetails=0,$hidedesc=0,$hideref=0) + { global $conf, $hookmanager; // Default field style for content @@ -1677,7 +1676,5 @@ class pdf_eratosthene extends ModelePDFCommandes { $this->cols = $hookmanager->resArray; } - } - } diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 2a5aeb3fadd..4032a6c41a5 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -8,6 +8,7 @@ * Copyright (C) 2012-2014 Raphaël Doursenaud * Copyright (C) 2015 Marcos García * Copyright (C) 2017 Ferran Marcet + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -68,7 +69,7 @@ class pdf_sponge extends ModelePDFFactures public $type; /** - * @var array() Minimum version of PHP required by module. + * @var array Minimum version of PHP required by module. * e.g.: PHP ≥ 5.3 = array(5, 3) */ public $phpmin = array(5, 2); @@ -159,7 +160,8 @@ class pdf_sponge extends ModelePDFFactures } - /** phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** * Function to build pdf onto disk * * @param Object $object Object to generate @@ -170,7 +172,7 @@ class pdf_sponge extends ModelePDFFactures * @param int $hideref Do not show ref * @return int 1=OK, 0=KO */ - function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) + public function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) { // phpcs:enable global $user,$langs,$conf,$mysoc,$db,$hookmanager,$nblignes; @@ -801,15 +803,15 @@ class pdf_sponge extends ModelePDFFactures } // Affiche zone infos - $posy=$this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs); + $posy=$this->drawInfoTable($pdf, $object, $bottomlasttab, $outputlangs); // Affiche zone totaux - $posy=$this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs); + $posy=$this->drawTotalTable($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs); // Affiche zone versements if (($deja_regle || $amount_credit_notes_included || $amount_deposits_included) && empty($conf->global->INVOICE_NO_PAYMENT_DETAILS)) { - $posy=$this->_tableau_versements($pdf, $object, $posy, $outputlangs); + $posy=$this->drawPaymentsTable($pdf, $object, $posy, $outputlangs); } // Pied de page @@ -856,7 +858,7 @@ class pdf_sponge extends ModelePDFFactures * @param Translate $outputlangs Object langs for output * @return int <0 if KO, >0 if OK */ - function _tableau_versements(&$pdf, $object, $posy, $outputlangs) + function drawPaymentsTable(&$pdf, $object, $posy, $outputlangs) { // phpcs:enable global $conf; @@ -984,7 +986,6 @@ class pdf_sponge extends ModelePDFFactures $this->error=$this->db->lasterror(); return -1; } - } @@ -997,7 +998,7 @@ class pdf_sponge extends ModelePDFFactures * @param Translate $outputlangs Langs object * @return void */ - function _tableau_info(&$pdf, $object, $posy, $outputlangs) + private function drawInfoTable(&$pdf, $object, $posy, $outputlangs) { // phpcs:enable global $conf; @@ -1156,7 +1157,7 @@ class pdf_sponge extends ModelePDFFactures * @param Translate $outputlangs Objet langs * @return int Position pour suite */ - function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs) + private function drawTotalTable(&$pdf, $object, $deja_regle, $posy, $outputlangs) { // phpcs:enable global $conf,$mysoc; @@ -1536,8 +1537,6 @@ class pdf_sponge extends ModelePDFFactures if (empty($hidetop)){ $pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5); // line prend une position y en 2eme param et 4eme param } - - } /** @@ -1842,9 +1841,8 @@ class pdf_sponge extends ModelePDFFactures * @param int $hideref Do not show ref * @return null */ - function defineColumnField($object,$outputlangs,$hidedetails=0,$hidedesc=0,$hideref=0) - { - + function defineColumnField($object,$outputlangs,$hidedetails=0,$hidedesc=0,$hideref=0) + { global $conf, $hookmanager; // Default field style for content @@ -2031,8 +2029,5 @@ class pdf_sponge extends ModelePDFFactures { $this->cols = $hookmanager->resArray; } - } - - } diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 509173a0aa7..9dcc14bf384 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -7,6 +7,7 @@ * Copyright (C) 2012 Cedric Salvador * Copyright (C) 2015 Marcos García * Copyright (C) 2017 Ferran Marcet + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -40,24 +41,24 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; */ class pdf_cyan extends ModelePDFPropales { - var $db; - var $name; - var $description; - var $update_main_doc_field; // Save the name of generated file as the main doc when generating a doc with this template - var $type; + public $db; + public $name; + public $description; + public $update_main_doc_field; // Save the name of generated file as the main doc when generating a doc with this template + public $type; - var $phpmin = array(4,3,0); // Minimum version of PHP required by module - var $version = 'development'; + public $phpmin = array(4,3,0); // Minimum version of PHP required by module + public $version = 'development'; - var $page_largeur; - var $page_hauteur; - var $format; - var $marge_gauche; - var $marge_droite; - var $marge_haute; - var $marge_basse; + public $page_largeur; + public $page_hauteur; + public $format; + public $marge_gauche; + public $marge_droite; + public $marge_haute; + public $marge_basse; - var $emetteur; // Objet societe qui emet + public $emetteur; // Objet societe qui emet /** @@ -65,7 +66,7 @@ class pdf_cyan extends ModelePDFPropales * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { global $conf,$langs,$mysoc; @@ -117,7 +118,8 @@ class pdf_cyan extends ModelePDFPropales $this->atleastonediscount=0; } - /** phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** * Function to build pdf onto disk * * @param Object $object Object to generate @@ -128,9 +130,9 @@ class pdf_cyan extends ModelePDFPropales * @param int $hideref Do not show ref * @return int 1=OK, 0=KO */ - function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) + public function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) { - // phpcs:enable + // phpcs:enable global $user,$langs,$conf,$mysoc,$db,$hookmanager,$nblignes; if (! is_object($outputlangs)) $outputlangs=$langs; @@ -746,23 +748,23 @@ class pdf_cyan extends ModelePDFPropales } // Affiche zone infos - $posy=$this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs); + $posy=$this->drawInfoTable($pdf, $object, $bottomlasttab, $outputlangs); // Affiche zone totaux - $posy=$this->_tableau_tot($pdf, $object, 0, $bottomlasttab, $outputlangs); + $posy=$this->drawTotalTable($pdf, $object, 0, $bottomlasttab, $outputlangs); // Affiche zone versements /* if ($deja_regle || $amount_credit_notes_included || $amount_deposits_included) { - $posy=$this->_tableau_versements($pdf, $object, $posy, $outputlangs); + $posy=$this->drawPaymentsTable($pdf, $object, $posy, $outputlangs); } */ // Customer signature area if (empty($conf->global->PROPAL_DISABLE_SIGNATURE)) { - $posy=$this->_signature_area($pdf, $object, $posy, $outputlangs); + $posy=$this->drawSignatureArea($pdf, $object, $posy, $outputlangs); } // Pied de page @@ -882,7 +884,7 @@ class pdf_cyan extends ModelePDFPropales * @param Translate $outputlangs Object langs for output * @return int <0 if KO, >0 if OK */ - function _tableau_versements(&$pdf, $object, $posy, $outputlangs) + private function drawPaymentsTable(&$pdf, $object, $posy, $outputlangs) { // phpcs:enable } @@ -897,7 +899,7 @@ class pdf_cyan extends ModelePDFPropales * @param Translate $outputlangs Langs object * @return void */ - function _tableau_info(&$pdf, $object, $posy, $outputlangs) + function drawInfoTable(&$pdf, $object, $posy, $outputlangs) { // phpcs:enable global $conf; @@ -1078,7 +1080,7 @@ class pdf_cyan extends ModelePDFPropales * @param Translate $outputlangs Objet langs * @return int Position pour suite */ - function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs) + private function drawTotalTable(&$pdf, $object, $deja_regle, $posy, $outputlangs) { global $conf,$mysoc; $default_font_size = pdf_getPDFFontSize($outputlangs); @@ -1412,8 +1414,6 @@ class pdf_cyan extends ModelePDFPropales if (empty($hidetop)){ $pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5); // line prend une position y en 2eme param et 4eme param } - - } /** @@ -1666,7 +1666,7 @@ class pdf_cyan extends ModelePDFPropales * @param Translate $outputlangs Objet langs * @return int Position pour suite */ - function _signature_area(&$pdf, $object, $posy, $outputlangs) + private function drawSignatureArea(&$pdf, $object, $posy, $outputlangs) { global $conf; $default_font_size = pdf_getPDFFontSize($outputlangs); @@ -1703,9 +1703,8 @@ class pdf_cyan extends ModelePDFPropales * @param int $hideref Do not show ref * @return null */ - function defineColumnField($object,$outputlangs,$hidedetails=0,$hidedesc=0,$hideref=0) - { - + function defineColumnField($object,$outputlangs,$hidedetails=0,$hidedesc=0,$hideref=0) + { global $conf, $hookmanager; // Default field style for content @@ -1891,7 +1890,5 @@ class pdf_cyan extends ModelePDFPropales { $this->cols = $hookmanager->resArray; } - } - } diff --git a/htdocs/paybox/admin/paybox.php b/htdocs/paybox/admin/paybox.php index dd9676a6813..11329042da4 100644 --- a/htdocs/paybox/admin/paybox.php +++ b/htdocs/paybox/admin/paybox.php @@ -71,6 +71,9 @@ if ($action == 'setvalue' && $user->admin) if (! $result > 0) $error++; $result=dolibarr_set_const($db, "PAYMENT_SECURITY_TOKEN_UNIQUE",GETPOST('PAYMENT_SECURITY_TOKEN_UNIQUE','alpha'),'chaine',0,'',$conf->entity); if (! $result > 0) $error++; + $result=dolibarr_set_const($db, "PAYBOX_HMAC_KEY", dol_encode(GETPOST('PAYBOX_HMAC_KEY','alpha')),'chaine',0,'',$conf->entity); + if (! $result > 0) $error++; + if (! $error) { @@ -145,6 +148,12 @@ print 'trans("Test").')'; print ''; +print ''; +print ''.$langs->trans("PAYBOX_HMAC_KEY").''; +print ''; +print '
'.$langs->trans("Example").': 2 ('.$langs->trans("Test").')'; +print ''; + print ''; print ''.$langs->trans("UsageParameter").''; print ''.$langs->trans("Value").''; diff --git a/htdocs/paybox/lib/paybox.lib.php b/htdocs/paybox/lib/paybox.lib.php index a4106488f53..a904c372099 100644 --- a/htdocs/paybox/lib/paybox.lib.php +++ b/htdocs/paybox/lib/paybox.lib.php @@ -92,16 +92,41 @@ function print_paybox_redirect($PRICE,$CURRENCY,$EMAIL,$urlok,$urlko,$TAG) $IBS_REFUSE=$urlko; $IBS_BKGD="#FFFFFF"; $IBS_WAIT="2000"; - $IBS_LANG="GBR"; // By default GBR=english (FRA, GBR, ESP, ITA et DEU...) - if (preg_match('/^FR/i',$langs->defaultlang)) $IBS_LANG="FRA"; - if (preg_match('/^ES/i',$langs->defaultlang)) $IBS_LANG="ESP"; - if (preg_match('/^IT/i',$langs->defaultlang)) $IBS_LANG="ITA"; - if (preg_match('/^DE/i',$langs->defaultlang)) $IBS_LANG="DEU"; - if (preg_match('/^NL/i',$langs->defaultlang)) $IBS_LANG="NLD"; - if (preg_match('/^SE/i',$langs->defaultlang)) $IBS_LANG="SWE"; - $IBS_OUTPUT='E'; - $PBX_SOURCE='HTML'; - $PBX_TYPEPAIEMENT='CARTE'; + $IBS_LANG="GBR"; // By default GBR=english (FRA, GBR, ESP, ITA et DEU...) + if (preg_match('/^FR/i',$langs->defaultlang)) $IBS_LANG="FRA"; + if (preg_match('/^ES/i',$langs->defaultlang)) $IBS_LANG="ESP"; + if (preg_match('/^IT/i',$langs->defaultlang)) $IBS_LANG="ITA"; + if (preg_match('/^DE/i',$langs->defaultlang)) $IBS_LANG="DEU"; + if (preg_match('/^NL/i',$langs->defaultlang)) $IBS_LANG="NLD"; + if (preg_match('/^SE/i',$langs->defaultlang)) $IBS_LANG="SWE"; + $IBS_OUTPUT='E'; + $PBX_SOURCE='HTML'; + $PBX_TYPEPAIEMENT='CARTE'; + + $msg = "PBX_IDENTIFIANT=".$PBX_IDENTIFIANT. + "&PBX_MODE=".$IBS_MODE. + "&PBX_SITE=".$IBS_SITE. + "&PBX_RANG=".$IBS_RANG. + "&PBX_TOTAL=".$IBS_TOTAL. + "&PBX_DEVISE=".$IBS_DEVISE. + "&PBX_CMD=".$IBS_CMD. + "&PBX_PORTEUR=".$IBS_PORTEUR. + "&PBX_RETOUR=".$IBS_RETOUR. + "&PBX_EFFECTUE=".$IBS_EFFECTUE. + "&PBX_ANNULE=".$IBS_ANNULE. + "&PBX_REFUSE=".$IBS_REFUSE. + "&PBX_TXT=".$IBS_TXT. + "&PBX_BKGD=".$IBS_BKGD. + "&PBX_WAIT=".$IBS_WAIT. + "&PBX_LANGUE=".$IBS_LANG. + "&PBX_OUTPUT=".$IBS_OUTPUT. + "&PBX_SOURCE=".$PBX_SOURCE. + "&PBX_TYPEPAIEMENT=".$PBX_TYPEPAIEMENT; + + $binKey = pack("H*", dol_decode($conf->global->PAYBOX_HMAC_KEY)); + + $hmac = strtoupper(hash_hmac('sha512', $msg, $binKey)); + dol_syslog("Soumission Paybox", LOG_DEBUG); dol_syslog("IBS_MODE: $IBS_MODE", LOG_DEBUG); @@ -157,7 +182,7 @@ function print_paybox_redirect($PRICE,$CURRENCY,$EMAIL,$urlok,$urlko,$TAG) print ''."\n"; print ''."\n"; print ''."\n"; - + print ''."\n"; print ''."\n"; diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 15e77502625..36723658946 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -630,9 +630,9 @@ if ($ispaymentok) $paiement->paiementid = $paymentTypeId; $paiement->num_paiement = ''; $paiement->note_public = 'Online payment '.dol_print_date($now, 'standard').' from '.$ipaddress; - $paiement->payment_id = $TRANSACTIONID; - $paiement->payment_site = $paymentmethod; - + $paiement->ext_payment_id = $TRANSACTIONID; + $paiement->ext_payment_site = $paymentmethod; + if (! $error) { $paiement_id = $paiement->create($user, 1); // This include closing invoices and regenerating documents @@ -653,8 +653,8 @@ if ($ispaymentok) { $bankaccountid = 0; if ($paymentmethod == 'paybox') $bankaccountid = $conf->global->PAYBOX_BANK_ACCOUNT_FOR_PAYMENTS; - if ($paymentmethod == 'paypal') $bankaccountid = $conf->global->PAYPAL_BANK_ACCOUNT_FOR_PAYMENTS; - if ($paymentmethod == 'stripe') $bankaccountid = $conf->global->STRIPE_BANK_ACCOUNT_FOR_PAYMENTS; + elseif ($paymentmethod == 'paypal') $bankaccountid = $conf->global->PAYPAL_BANK_ACCOUNT_FOR_PAYMENTS; + elseif ($paymentmethod == 'stripe') $bankaccountid = $conf->global->STRIPE_BANK_ACCOUNT_FOR_PAYMENTS; if ($bankaccountid > 0) { @@ -873,8 +873,8 @@ else if (! empty($conf->global->PAYMENTONLINE_SENDEMAIL)) $sendemail=$conf->global->PAYMENTONLINE_SENDEMAIL; // TODO Remove local option to keep only the generic one ? if ($paymentmethod == 'paypal' && ! empty($conf->global->PAYPAL_PAYONLINE_SENDEMAIL)) $sendemail=$conf->global->PAYPAL_PAYONLINE_SENDEMAIL; - if ($paymentmethod == 'paybox' && ! empty($conf->global->PAYBOX_PAYONLINE_SENDEMAIL)) $sendemail=$conf->global->PAYBOX_PAYONLINE_SENDEMAIL; - if ($paymentmethod == 'stripe' && ! empty($conf->global->STRIPE_PAYONLINE_SENDEMAIL)) $sendemail=$conf->global->STRIPE_PAYONLINE_SENDEMAIL; + elseif ($paymentmethod == 'paybox' && ! empty($conf->global->PAYBOX_PAYONLINE_SENDEMAIL)) $sendemail=$conf->global->PAYBOX_PAYONLINE_SENDEMAIL; + elseif ($paymentmethod == 'stripe' && ! empty($conf->global->STRIPE_PAYONLINE_SENDEMAIL)) $sendemail=$conf->global->STRIPE_PAYONLINE_SENDEMAIL; // Send an email if ($sendemail) diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index bb43aa0af55..d9ad2a590ac 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -3271,7 +3271,7 @@ ul.noborder li:nth-child(even):not(.liste_titre) { .boxstats130 { width: 158px; height: 48px; - padding: 3px + padding: 3px; } .boxstats { padding: 3px;