diff --git a/COPYRIGHT b/COPYRIGHT index ea0c6453486..f58095e1558 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -32,7 +32,7 @@ PSR/simple-cache ? Library for cache (used by PHPSp Restler 3.0.0RC6 LGPL-3+ Yes Library to develop REST Web services (+ swagger-ui js lib into dir explorer) Sabre 3.2.2 BSD Yes DAV support Swift Mailer 5.4.2-DEV MIT license Yes Comprehensive mailing tools for PHP -Stripe 6.35 MIT licence Yes Library for Stripe module +Stripe 6.41 MIT licence Yes Library for Stripe module TCPDF 6.2.25 LGPL-3+ Yes PDF generation TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement diff --git a/htdocs/adherents/ldap.php b/htdocs/adherents/ldap.php index f17638a9966..1d890ab580f 100644 --- a/htdocs/adherents/ldap.php +++ b/htdocs/adherents/ldap.php @@ -182,7 +182,7 @@ if ($result > 0) if (empty($dn)) { $langs->load("errors"); - print ''.$langs->trans("ErrorModuleSetupNotComplete").''; + print ''.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Member")).''; } else { diff --git a/htdocs/admin/clicktodial.php b/htdocs/admin/clicktodial.php index 7f4a167edd9..99c6cea7b39 100644 --- a/htdocs/admin/clicktodial.php +++ b/htdocs/admin/clicktodial.php @@ -37,12 +37,12 @@ $action = GETPOST('action', 'aZ09'); /* * Actions */ - + if ($action == 'setvalue' && $user->admin) { - $result=dolibarr_set_const($db, "CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS", GETPOST("CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS"), 'chaine', 0, '', $conf->entity); - $result=dolibarr_set_const($db, "CLICKTODIAL_URL", GETPOST("CLICKTODIAL_URL"), 'chaine', 0, '', $conf->entity); - + $result1=dolibarr_set_const($db, "CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS", GETPOST("CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS"), 'chaine', 0, '', $conf->entity); + $result2=dolibarr_set_const($db, "CLICKTODIAL_URL", GETPOST("CLICKTODIAL_URL"), 'chaine', 0, '', $conf->entity); + if ($result1 >= 0 && $result2 >= 0) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); diff --git a/htdocs/cashdesk/index_verif.php b/htdocs/cashdesk/index_verif.php index 05117f5e7cb..bb0e037bf7d 100644 --- a/htdocs/cashdesk/index_verif.php +++ b/htdocs/cashdesk/index_verif.php @@ -79,16 +79,6 @@ if (! empty($conf->stock->enabled) && empty($conf->global->CASHDESK_NO_DECREASE_ } -/* -if (! empty($_POST['txtUsername']) && ! empty($conf->banque->enabled) && (empty($conf_fkaccount_cash) && empty($conf_fkaccount_cheque) && empty($conf_fkaccount_cb))) -{ - $langs->load("errors"); - $retour=$langs->trans("ErrorModuleSetupNotComplete"); - header('Location: '.DOL_URL_ROOT.'/cashdesk/index.php?err='.urlencode($retour).'&user='.$username.'&socid='.$thirdpartyid.'&warehouseid='.$warehouseid); - exit; -} -*/ - // Check password $auth = new Auth($db); $retour = $auth->verif($username, $password); diff --git a/htdocs/cashdesk/tpl/facturation1.tpl.php b/htdocs/cashdesk/tpl/facturation1.tpl.php index 8da535f20f3..4230227717e 100644 --- a/htdocs/cashdesk/tpl/facturation1.tpl.php +++ b/htdocs/cashdesk/tpl/facturation1.tpl.php @@ -165,7 +165,7 @@ $langs->loadLangs(array("main","bills","cashdesk")); if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CASH']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CASH'] < 0) { $langs->load("errors"); - print ''; + print 'transnoentitiesnoconv("CashDesk"))).'" />'; } else print ''; print ''; @@ -173,7 +173,7 @@ $langs->loadLangs(array("main","bills","cashdesk")); if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CB']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CB'] < 0) { $langs->load("errors"); - print ''; + print 'transnoentitiesnoconv("CashDesk"))).'" />'; } else print ''; print ''; @@ -181,7 +181,7 @@ $langs->loadLangs(array("main","bills","cashdesk")); if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CHEQUE']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CHEQUE'] < 0) { $langs->load("errors"); - print ''; + print 'transnoentitiesnoconv("CashDesk")).'" />'; } else print ''; print ''; diff --git a/htdocs/collab/index.php b/htdocs/collab/index.php index b0f1f5253c2..429e5398c5a 100644 --- a/htdocs/collab/index.php +++ b/htdocs/collab/index.php @@ -168,287 +168,8 @@ if ($action != 'preview' && $action != 'editcontent') $style=' margin-bottom: 5p //var_dump($objectpage);exit; print '
'; -if (count($object->records) > 0) -{ - // ***** Part for web sites - - print '
'; - print $langs->trans("WebSite").': '; - print '
'; - - // List of websites - print '
'; - $out=''; - $out.=''; - $out.=ajax_combobox('website'); - print $out; - print ''; - - if ($website) - { - $virtualurl=''; - $dataroot=DOL_DATA_ROOT.'/collab/'.$website; - if (! empty($object->virtualhost)) $virtualurl=$object->virtualhost; - } - - if ($website && $action == 'preview') - { - $disabled=''; - if (empty($user->rights->websites->write)) $disabled=' disabled="disabled"'; - - print '   '; - - //print ''; - print ''; - print ''; - print ''; - } - - print '
'; - - // Button for websites - print '
'; - - if ($action == 'preview') - { - print '
'; - print ''; - //print ''; - $htmltext=$langs->trans("SetHereVirtualHost", $dataroot); - print $form->textwithpicto('', $htmltext); - print '
'; - - $urlext=$virtualurl; - $urlint=$urlwithroot.'/public/collab/index.php?website='.$website; - //if (! empty($object->virtualhost)) - //{ - print 'transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $dataroot, $urlext)).'">'; - print $form->textwithpicto('', $langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $dataroot, $urlext?$urlext:$langs->trans("VirtualHostUrlNotDefined")), 1, 'preview_ext'); - print ''; - //} - - print 'transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $urlint)).'">'; - print $form->textwithpicto('', $langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $urlint, $dataroot), 1, 'preview'); - print ''; - } - - if (in_array($action, array('editcss','editmenu','create'))) - { - if ($action != 'preview') print ''; - if (preg_match('/^create/', $action)) print ''; - if (preg_match('/^edit/', $action)) print ''; - } - - print '
'; - // ***** Part for pages - - if ($website) - { - print '
'; - - $array=$objectpage->fetchAll($object->id); - if (! is_array($array) && $array < 0) dol_print_error('', $objectpage->error, $objectpage->errors); - $atleastonepage=(is_array($array) && count($array) > 0); - - print '
'; - print '
'; - print $langs->trans("Page").': '; - print '
'; - print '
'; - - if ($action != 'add') - { - $out=''; - $out.=''; - $out.=ajax_combobox('pageid'); - print $out; - } - else - { - print $langs->trans("New"); - } - - print ''; - //print $form->selectarray('page', $array); - - if ($action == 'preview') - { - $disabled=''; - if (empty($user->rights->websites->write)) $disabled=' disabled="disabled"'; - - if ($pageid > 0) - { - print '   '; - - if ($object->fk_default_home > 0 && $pageid == $object->fk_default_home) print ''; - else print ''; - print ''; - print ''; - //print ''.dol_escape_htmltag($langs->trans("EditPageMeta")).''; - //print ''.dol_escape_htmltag($langs->trans("EditPageContent")).''; - print ''; - } - } - - print '
'; - print '
'; - print '
'; - - print '
'; - - if ($website && $pageid > 0 && $action == 'preview') - { - $websitepage = new WebSitePage($db); - $websitepage->fetch($pageid); - - $realpage=$urlwithroot.'/public/collab/index.php?website='.$website.'&page='.$pageid; - $pagealias = $websitepage->pageurl; - - print '
'; - print ''; - //print ''; - $htmltext=$langs->trans("WEBSITE_PAGENAME", $pagealias); - print $form->textwithpicto('', $htmltext); - print '
'; - - if (! empty($object->virtualhost)) - { - $urlext=$virtualurl.'/'.$pagealias.'.php'; - print 'transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $dataroot, $urlext)).'">'; - print $form->textwithpicto('', $langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $dataroot, $urlext?$urlext:$langs->trans("VirtualHostUrlNotDefined")), 1, 'preview_ext'); - print ''; - } - else - { - print ''; - print $form->textwithpicto('', $langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $dataroot, $urlext?$urlext:$langs->trans("VirtualHostUrlNotDefined")), 1, 'preview_ext'); - print ''; - } - - print 'transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $realpage)).'">'; - print $form->textwithpicto('', $langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $realpage, $dataroot), 1, 'preview'); - print ''; // View page in new Tab - //print ''; - - // TODO Add js to save alias like we save virtual host name and use dynamic virtual host for url of id=previewpageext - } - if (! in_array($action, array('editcss','editmenu','create'))) - { - if ($action != 'preview') print ''; - if (preg_match('/^create/', $action)) print ''; - if (preg_match('/^edit/', $action)) print ''; - } - - print '
'; - - if ($action == 'preview') - { - // Adding jquery code to change on the fly url of preview ext - if (! empty($conf->use_javascript_ajax)) - { - print ''; - } - } - } -} -else -{ - print '
'; - $langs->load("errors"); - print $langs->trans("ErrorModuleSetupNotComplete"); - print '
'; - $action=''; -} - - -print '
'; - -$head = array(); - -if ($action == 'editcontent') -{ - /* - * Editing global variables not related to a specific theme - */ - - $csscontent = @file_get_contents($filecss); - - $contentforedit = ''; - /*$contentforedit.=''."\n";*/ - $contentforedit .= $objectpage->content; - - require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor('PAGE_CONTENT', $contentforedit, '', 500, 'Full', '', true, true, true, ROWS_5, '90%'); - $doleditor->Create(0, '', false); -} print "
\n\n"; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index c1dde5e2aa4..5faa94f2d08 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3516,7 +3516,7 @@ class Propal extends CommonObject else { $langs->load("errors"); - print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete"); + print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Proposal")); return ""; } } diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 29688b7d690..0f875b68f22 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2591,7 +2591,7 @@ if ($action == 'create' && $user->rights->commande->creer) } } else { $langs->load("errors"); - print '
' . $langs->trans('CreateShipment') . '
'; + print '
transnoentitiesnoconv("Shipment"))) . '">' . $langs->trans('CreateShipment') . '
'; } } } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 8136f93b47a..c64c42e2971 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3495,7 +3495,7 @@ class Facture extends CommonInvoice else { $langs->load("errors"); - print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete"); + print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Invoice")); return ""; } } diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index d9a912ea50b..26e3f2792d6 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -489,7 +489,7 @@ class RemiseCheque extends CommonObject else { $langs->load("errors"); - print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete"); + print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Bank")); return ""; } } diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index a3c79d23602..614782c519b 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -1141,7 +1141,7 @@ class Paiement extends CommonObject else { $langs->load("errors"); - print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete"); + print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Invoice")); return ""; } } diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 2dfbb5adf9d..eaef92a1abc 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -78,7 +78,7 @@ if (empty($reshook)) // $conf->global->PRELEVEMENT_CODE_BANQUE and $conf->global->PRELEVEMENT_CODE_GUICHET should be empty $bprev = new BonPrelevement($db); $executiondate = dol_mktime(0, 0, 0, GETPOST('remonth'), (GETPOST('reday')+$conf->global->PRELEVEMENT_ADDDAYS), GETPOST('reyear')); - + $result = $bprev->create($conf->global->PRELEVEMENT_CODE_BANQUE, $conf->global->PRELEVEMENT_CODE_GUICHET, $mode, $format, $executiondate); if ($result < 0) { @@ -116,7 +116,7 @@ llxHeader('', $langs->trans("NewStandingOrder")); if (prelevement_check_config() < 0) { $langs->load("errors"); - setEventMessages($langs->trans("ErrorModuleSetupNotComplete"), null, 'errors'); + setEventMessages($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Withdraw")), null, 'errors'); } /*$h=0; diff --git a/htdocs/compta/prelevement/index.php b/htdocs/compta/prelevement/index.php index 4e2c4e2d3a5..1be716f8f61 100644 --- a/htdocs/compta/prelevement/index.php +++ b/htdocs/compta/prelevement/index.php @@ -58,7 +58,7 @@ llxHeader('', $langs->trans("CustomersStandingOrdersArea")); if (prelevement_check_config() < 0) { $langs->load("errors"); - setEventMessages($langs->trans("ErrorModuleSetupNotComplete"), null, 'errors'); + setEventMessages($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Withdraw")), null, 'errors'); } print load_fiche_titre($langs->trans("CustomersStandingOrdersArea")); diff --git a/htdocs/contact/consumption.php b/htdocs/contact/consumption.php index 3f0d0313ee0..9cde6e2df4e 100644 --- a/htdocs/contact/consumption.php +++ b/htdocs/contact/consumption.php @@ -38,7 +38,7 @@ $id = GETPOST('id', 'int'); $result = restrictedArea($user, 'contact', $id, 'socpeople&societe'); $object = new Contact($db); if ($id > 0) $object->fetch($id); -if(empty($object->thirdparty)) $object->fetch_thirdparty(); +if (empty($object->thirdparty)) $object->fetch_thirdparty(); $socid = $object->thirdparty->id; // Sort & Order fields @@ -69,7 +69,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' } // Customer or supplier selected in drop box $thirdTypeSelect = GETPOST("third_select_id"); -$type_element = GETPOST('type_element')?GETPOST('type_element'):''; +$type_element = GETPOSTISSET('type_element')?GETPOST('type_element'):''; // Load translation files required by the page $langs->loadLangs(array("companies", "bills", "orders", "suppliers", "propal", "interventions", "contracts", "products")); @@ -173,13 +173,13 @@ if ($type_element == 'fichinter') $sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, \'1\' as doc_type, f.datec as dateprint, f.fk_statut as status, tc.libelle, '; $tables_from = MAIN_DB_PREFIX.'fichinterdet d'; $tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'fichinter as f ON d.fk_fichinter=f.rowid'; - $tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=f.rowid'; + $tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=f.rowid AND ec.fk_socpeople='.$object->id; $tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX."c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='fichinter' and tc.source='external' and tc.active=1)"; $where = ' WHERE f.entity IN ('.getEntity('ficheinter').')'; $dateprint = 'f.datec'; $doc_number='f.ref'; } -if ($type_element == 'invoice') +elseif ($type_element == 'invoice') { // Customer : show products from invoices require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $documentstatic=new Facture($db); @@ -187,14 +187,14 @@ if ($type_element == 'invoice') $tables_from = MAIN_DB_PREFIX.'facturedet d'; $tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'facture as f ON d.fk_facture=f.rowid'; $tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product p ON d.fk_product=p.rowid'; - $tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=f.rowid'; + $tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=f.rowid AND ec.fk_socpeople='.$object->id; $tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX."c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='facture' and tc.source='external' and tc.active=1)"; $where = " WHERE f.entity IN (".getEntity('invoice').")"; $dateprint = 'f.datef'; $doc_number='f.ref'; $thirdTypeSelect='customer'; } -if ($type_element == 'propal') +elseif ($type_element == 'propal') { require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; $documentstatic=new Propal($db); @@ -202,14 +202,14 @@ if ($type_element == 'propal') $tables_from = MAIN_DB_PREFIX.'propaldet d'; $tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'propal as c ON d.fk_propal=c.rowid'; $tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product p ON d.fk_product=p.rowid'; - $tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=c.rowid'; + $tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=c.rowid AND ec.fk_socpeople='.$object->id; $tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX."c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='propal' and tc.source='external' and tc.active=1)"; $where = ' WHERE c.entity IN ('.getEntity('propal').')'; $datePrint = 'c.datep'; $doc_number='c.ref'; $thirdTypeSelect='customer'; } -if ($type_element == 'order') +elseif ($type_element == 'order') { require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; $documentstatic=new Commande($db); @@ -217,14 +217,14 @@ if ($type_element == 'order') $tables_from = MAIN_DB_PREFIX.'commandedet d'; $tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'commande as c ON d.fk_commande=c.rowid'; $tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product p ON d.fk_product=p.rowid'; - $tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=c.rowid'; + $tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=c.rowid AND ec.fk_socpeople='.$object->id; $tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX."c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='commande' and tc.source='external' and tc.active=1)"; $where = ' WHERE c.entity IN ('.getEntity('order').')'; $dateprint = 'c.date_commande'; $doc_number='c.ref'; $thirdTypeSelect='customer'; } -if ($type_element == 'supplier_invoice') +elseif ($type_element == 'supplier_invoice') { // Supplier : Show products from invoices. require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; $documentstatic=new FactureFournisseur($db); @@ -232,14 +232,14 @@ if ($type_element == 'supplier_invoice') $tables_from = MAIN_DB_PREFIX.'facture_fourn_det d'; $tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'facture_fourn as f ON d.fk_facture_fourn=f.rowid'; $tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product p ON d.fk_product=p.rowid'; - $tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=f.rowid'; + $tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=f.rowid AND ec.fk_socpeople='.$object->id; $tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX."c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='invoice_supplier' and tc.source='external' and tc.active=1)"; $where = ' WHERE f.entity IN ('.getEntity($documentstatic->element).')'; $dateprint = 'f.datef'; $doc_number='f.ref'; $thirdTypeSelect='supplier'; } -//if ($type_element == 'supplier_proposal') +//elseif ($type_element == 'supplier_proposal') //{ // require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php'; // $documentstatic=new SupplierProposal($db); @@ -252,7 +252,7 @@ if ($type_element == 'supplier_invoice') // $doc_number='c.ref'; // $thirdTypeSelect='supplier'; //} -if ($type_element == 'supplier_order') +elseif ($type_element == 'supplier_order') { // Supplier : Show products from orders. require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; $documentstatic=new CommandeFournisseur($db); @@ -260,14 +260,14 @@ if ($type_element == 'supplier_order') $tables_from = MAIN_DB_PREFIX.'commande_fournisseurdet d'; $tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'commande_fournisseur as c ON d.fk_commande=c.rowid'; $tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product p ON d.fk_product=p.rowid'; - $tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=c.rowid'; + $tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=c.rowid AND ec.fk_socpeople='.$object->id; $tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX."c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='order_supplier' and tc.source='external' and tc.active=1)"; $where = ' WHERE c.entity IN ('.getEntity($documentstatic->element).')'; $dateprint = 'c.date_valid'; $doc_number='c.ref'; $thirdTypeSelect='supplier'; } -if ($type_element == 'contract') +elseif ($type_element == 'contract') { // Order require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; $documentstatic=new Contrat($db); @@ -276,7 +276,7 @@ if ($type_element == 'contract') $tables_from = MAIN_DB_PREFIX.'contratdet d'; $tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'contrat as c ON d.fk_contrat=c.rowid'; $tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product p ON d.fk_product=p.rowid'; - $tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=c.rowid'; + $tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=c.rowid AND ec.fk_socpeople='.$object->id; $tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX."c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='contrat' and tc.source='external' and tc.active=1)"; $where = ' WHERE c.entity IN ('.getEntity('contrat').')'; $dateprint = 'c.date_valid'; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 0fb460466ef..e6e9b7f2e4d 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -245,7 +245,7 @@ class Contrat extends CommonObject else { $langs->load("errors"); - print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete"); + print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Contract")); return ""; } } diff --git a/htdocs/core/lib/takepos.lib.php b/htdocs/core/lib/takepos.lib.php index d5e2d3be854..07573db1a11 100644 --- a/htdocs/core/lib/takepos.lib.php +++ b/htdocs/core/lib/takepos.lib.php @@ -38,7 +38,8 @@ function takepos_prepare_head() $head[$h][2] = 'setup'; $h++; - for ($i = 1; $i <= $conf->global->TAKEPOS_NUM_TERMINALS; $i++) + $numterminals = max(1, $conf->global->TAKEPOS_NUM_TERMINALS); + for ($i = 1; $i <= $numterminals; $i++) { $head[$h][0] = DOL_URL_ROOT.'/takepos/admin/terminal.php?terminal='.$i; $head[$h][1] = $langs->trans("Terminal"). " ".$i; diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php index e4d70ff255a..51485a7db5e 100644 --- a/htdocs/fourn/class/paiementfourn.class.php +++ b/htdocs/fourn/class/paiementfourn.class.php @@ -701,7 +701,7 @@ class PaiementFourn extends Paiement else { $langs->load("errors"); - print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete"); + print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Supplier")); return ""; } } diff --git a/htdocs/includes/stripe/CHANGELOG.md b/htdocs/includes/stripe/CHANGELOG.md index 26b449ff039..bed9cff5722 100644 --- a/htdocs/includes/stripe/CHANGELOG.md +++ b/htdocs/includes/stripe/CHANGELOG.md @@ -1,5 +1,45 @@ # Changelog +## 6.41.0 - 2019-07-31 +* [#683](https://github.com/stripe/stripe-php/pull/683) Move the List Balance History API to `/v1/balance_transactions` + +## 6.40.0 - 2019-06-27 +* [#675](https://github.com/stripe/stripe-php/pull/675) Add support for `SetupIntent` resource and APIs + +## 6.39.2 - 2019-06-26 +* [#676](https://github.com/stripe/stripe-php/pull/676) Fix exception message in `CustomerBalanceTransaction::update()` + +## 6.39.1 - 2019-06-25 +* [#674](https://github.com/stripe/stripe-php/pull/674) Add new constants for `collection_method` on `Invoice` + +## 6.39.0 - 2019-06-24 +* [#673](https://github.com/stripe/stripe-php/pull/673) Enable request latency telemetry by default + +## 6.38.0 - 2019-06-17 +* [#649](https://github.com/stripe/stripe-php/pull/649) Add support for `CustomerBalanceTransaction` resource and APIs + +## 6.37.2 - 2019-06-17 +* [#671](https://github.com/stripe/stripe-php/pull/671) Add new PHPDoc +* [#672](https://github.com/stripe/stripe-php/pull/672) Add constants for `submit_type` on Checkout `Session` + +## 6.37.1 - 2019-06-14 +* [#670](https://github.com/stripe/stripe-php/pull/670) Add new PHPDoc + +## 6.37.0 - 2019-05-23 +* [#663](https://github.com/stripe/stripe-php/pull/663) Add support for `radar.early_fraud_warning` resource + +## 6.36.0 - 2019-05-22 +* [#661](https://github.com/stripe/stripe-php/pull/661) Add constants for new TaxId types +* [#662](https://github.com/stripe/stripe-php/pull/662) Add constants for BalanceTransaction types + +## 6.35.2 - 2019-05-20 +* [#655](https://github.com/stripe/stripe-php/pull/655) Add constants for payment intent statuses +* [#659](https://github.com/stripe/stripe-php/pull/659) Fix PHPDoc for various nested Account actions +* [#660](https://github.com/stripe/stripe-php/pull/660) Fix various PHPDoc + +## 6.35.1 - 2019-05-20 +* [#658](https://github.com/stripe/stripe-php/pull/658) Use absolute value when checking timestamp tolerance + ## 6.35.0 - 2019-05-14 * [#651](https://github.com/stripe/stripe-php/pull/651) Add support for the Capability resource and APIs diff --git a/htdocs/includes/stripe/README.md b/htdocs/includes/stripe/README.md index 8dca764d7d1..7d1b681c087 100644 --- a/htdocs/includes/stripe/README.md +++ b/htdocs/includes/stripe/README.md @@ -6,7 +6,11 @@ [![License](https://poser.pugx.org/stripe/stripe-php/license.svg)](https://packagist.org/packages/stripe/stripe-php) [![Code Coverage](https://coveralls.io/repos/stripe/stripe-php/badge.svg?branch=master)](https://coveralls.io/r/stripe/stripe-php?branch=master) -You can sign up for a Stripe account at https://stripe.com. +The Stripe PHP library provides convenient access to the Stripe API from +applications written in the PHP language. It includes a pre-defined set of +classes for API resources that initialize themselves dynamically from API +responses which makes it compatible with a wide range of versions of the Stripe +API. ## Requirements @@ -56,7 +60,7 @@ echo $charge; ## Documentation -Please see https://stripe.com/docs/api for up-to-date documentation. +See the [PHP API docs](https://stripe.com/docs/api/php#intro). ## Legacy Version Support @@ -179,6 +183,17 @@ an intermittent network problem: [Idempotency keys][idempotency-keys] are added to requests to guarantee that retries are safe. +### Request latency telemetry + +By default, the library sends request latency telemetry to Stripe. These +numbers help Stripe improve the overall latency of its API for all users. + +You can disable this behavior if you prefer: + +```php +\Stripe\Stripe::setEnableTelemetry(false); +``` + ## Development Get [Composer][composer]. For example, on Mac OS: diff --git a/htdocs/includes/stripe/VERSION b/htdocs/includes/stripe/VERSION index b22907d080c..08c99ad1b68 100644 --- a/htdocs/includes/stripe/VERSION +++ b/htdocs/includes/stripe/VERSION @@ -1 +1 @@ -6.35.0 +6.41.0 diff --git a/htdocs/includes/stripe/init.php b/htdocs/includes/stripe/init.php index 2f6ccfbf67b..e893cfcda90 100644 --- a/htdocs/includes/stripe/init.php +++ b/htdocs/includes/stripe/init.php @@ -76,6 +76,7 @@ require(dirname(__FILE__) . '/lib/CountrySpec.php'); require(dirname(__FILE__) . '/lib/Coupon.php'); require(dirname(__FILE__) . '/lib/CreditNote.php'); require(dirname(__FILE__) . '/lib/Customer.php'); +require(dirname(__FILE__) . '/lib/CustomerBalanceTransaction.php'); require(dirname(__FILE__) . '/lib/Discount.php'); require(dirname(__FILE__) . '/lib/Dispute.php'); require(dirname(__FILE__) . '/lib/EphemeralKey.php'); @@ -104,6 +105,7 @@ require(dirname(__FILE__) . '/lib/Payout.php'); require(dirname(__FILE__) . '/lib/Person.php'); require(dirname(__FILE__) . '/lib/Plan.php'); require(dirname(__FILE__) . '/lib/Product.php'); +require(dirname(__FILE__) . '/lib/Radar/EarlyFraudWarning.php'); require(dirname(__FILE__) . '/lib/Radar/ValueList.php'); require(dirname(__FILE__) . '/lib/Radar/ValueListItem.php'); require(dirname(__FILE__) . '/lib/Recipient.php'); @@ -112,6 +114,7 @@ require(dirname(__FILE__) . '/lib/Refund.php'); require(dirname(__FILE__) . '/lib/Reporting/ReportRun.php'); require(dirname(__FILE__) . '/lib/Reporting/ReportType.php'); require(dirname(__FILE__) . '/lib/Review.php'); +require(dirname(__FILE__) . '/lib/SetupIntent.php'); require(dirname(__FILE__) . '/lib/SKU.php'); require(dirname(__FILE__) . '/lib/Sigma/ScheduledQueryRun.php'); require(dirname(__FILE__) . '/lib/Source.php'); diff --git a/htdocs/includes/stripe/lib/Account.php b/htdocs/includes/stripe/lib/Account.php index 0e84951dcd0..1adc6b79d53 100644 --- a/htdocs/includes/stripe/lib/Account.php +++ b/htdocs/includes/stripe/lib/Account.php @@ -152,8 +152,8 @@ class Account extends ApiResource /** - * @param string|null $id The ID of the account to which the capability belongs. - * @param string|null $capabilityId The ID of the capability to retrieve. + * @param string $id The ID of the account to which the capability belongs. + * @param string $capabilityId The ID of the capability to retrieve. * @param array|null $params * @param array|string|null $opts * @@ -165,8 +165,8 @@ class Account extends ApiResource } /** - * @param string|null $id The ID of the account to which the capability belongs. - * @param string|null $capabilityId The ID of the capability to update. + * @param string $id The ID of the account to which the capability belongs. + * @param string $capabilityId The ID of the capability to update. * @param array|null $params * @param array|string|null $opts * @@ -178,7 +178,7 @@ class Account extends ApiResource } /** - * @param string|null $id The ID of the account on which to retrieve the capabilities. + * @param string $id The ID of the account on which to retrieve the capabilities. * @param array|null $params * @param array|string|null $opts * @@ -190,7 +190,7 @@ class Account extends ApiResource } /** - * @param string|null $id The ID of the account on which to create the external account. + * @param string $id The ID of the account on which to create the external account. * @param array|null $params * @param array|string|null $opts * @@ -202,8 +202,8 @@ class Account extends ApiResource } /** - * @param string|null $id The ID of the account to which the external account belongs. - * @param array|null $externalAccountId The ID of the external account to retrieve. + * @param string $id The ID of the account to which the external account belongs. + * @param string $externalAccountId The ID of the external account to retrieve. * @param array|null $params * @param array|string|null $opts * @@ -215,8 +215,8 @@ class Account extends ApiResource } /** - * @param string|null $id The ID of the account to which the external account belongs. - * @param array|null $externalAccountId The ID of the external account to update. + * @param string $id The ID of the account to which the external account belongs. + * @param string $externalAccountId The ID of the external account to update. * @param array|null $params * @param array|string|null $opts * @@ -228,8 +228,8 @@ class Account extends ApiResource } /** - * @param string|null $id The ID of the account to which the external account belongs. - * @param array|null $externalAccountId The ID of the external account to delete. + * @param string $id The ID of the account to which the external account belongs. + * @param string $externalAccountId The ID of the external account to delete. * @param array|null $params * @param array|string|null $opts * @@ -241,7 +241,7 @@ class Account extends ApiResource } /** - * @param string|null $id The ID of the account on which to retrieve the external accounts. + * @param string $id The ID of the account on which to retrieve the external accounts. * @param array|null $params * @param array|string|null $opts * @@ -253,7 +253,7 @@ class Account extends ApiResource } /** - * @param string|null $id The ID of the account on which to create the login link. + * @param string $id The ID of the account on which to create the login link. * @param array|null $params * @param array|string|null $opts * @@ -280,7 +280,7 @@ class Account extends ApiResource } /** - * @param string|null $id The ID of the account on which to create the person. + * @param string $id The ID of the account on which to create the person. * @param array|null $params * @param array|string|null $opts * @@ -292,8 +292,8 @@ class Account extends ApiResource } /** - * @param string|null $id The ID of the account to which the person belongs. - * @param string|null $personId The ID of the person to retrieve. + * @param string $id The ID of the account to which the person belongs. + * @param string $personId The ID of the person to retrieve. * @param array|null $params * @param array|string|null $opts * @@ -305,8 +305,8 @@ class Account extends ApiResource } /** - * @param string|null $id The ID of the account to which the person belongs. - * @param string|null $personId The ID of the person to update. + * @param string $id The ID of the account to which the person belongs. + * @param string $personId The ID of the person to update. * @param array|null $params * @param array|string|null $opts * @@ -318,8 +318,8 @@ class Account extends ApiResource } /** - * @param string|null $id The ID of the account to which the person belongs. - * @param string|null $personId The ID of the person to delete. + * @param string $id The ID of the account to which the person belongs. + * @param string $personId The ID of the person to delete. * @param array|null $params * @param array|string|null $opts * @@ -331,7 +331,7 @@ class Account extends ApiResource } /** - * @param string|null $id The ID of the account on which to retrieve the persons. + * @param string $id The ID of the account on which to retrieve the persons. * @param array|null $params * @param array|string|null $opts * diff --git a/htdocs/includes/stripe/lib/BalanceTransaction.php b/htdocs/includes/stripe/lib/BalanceTransaction.php index cd9b79ae675..403c4aa173e 100644 --- a/htdocs/includes/stripe/lib/BalanceTransaction.php +++ b/htdocs/includes/stripe/lib/BalanceTransaction.php @@ -31,11 +31,36 @@ class BalanceTransaction extends ApiResource use ApiOperations\Retrieve; /** - * @return string The class URL for this resource. It needs to be special - * cased because it doesn't fit into the standard resource pattern. + * Possible string representations of the type of balance transaction. + * @link https://stripe.com/docs/api/balance/balance_transaction#balance_transaction_object-type */ - public static function classUrl() - { - return "/v1/balance/history"; - } + const TYPE_ADJUSTMENT = 'adjustment'; + const TYPE_ADVANCE = 'advance'; + const TYPE_ADVANCE_FUNDING = 'advance_funding'; + const TYPE_APPLICATION_FEE = 'application_fee'; + const TYPE_APPLICATION_FEE_REFUND = 'application_fee_refund'; + const TYPE_CHARGE = 'charge'; + const TYPE_CONNECT_COLLECTION_TRANSFER = 'connect_collection_transfer'; + const TYPE_ISSUING_AUTHORIZATION_HOLD = 'issuing_authorization_hold'; + const TYPE_ISSUING_AUTHORIZATION_RELEASE = 'issuing_authorization_release'; + const TYPE_ISSUING_TRANSACTION = 'issuing_transaction'; + const TYPE_PAYMENT = 'payment'; + const TYPE_PAYMENT_FAILURE_REFUND = 'payment_failure_refund'; + const TYPE_PAYMENT_REFUND = 'payment_refund'; + const TYPE_PAYOUT = 'payout'; + const TYPE_PAYOUT_CANCEL = 'payout_cancel'; + const TYPE_PAYOUT_FAILURE = 'payout_failure'; + const TYPE_REFUND = 'refund'; + const TYPE_REFUND_FAILURE = 'refund_failure'; + const TYPE_RESERVE_TRANSACTION = 'reserve_transaction'; + const TYPE_RESERVED_FUNDS = 'reserved_funds'; + const TYPE_STRIPE_FEE = 'stripe_fee'; + const TYPE_STRIPE_FX_FEE = 'stripe_fx_fee'; + const TYPE_TAX_FEE = 'tax_fee'; + const TYPE_TOPUP = 'topup'; + const TYPE_TOPUP_REVERSAL = 'topup_reversal'; + const TYPE_TRANSFER = 'transfer'; + const TYPE_TRANSFER_CANCEL = 'transfer_cancel'; + const TYPE_TRANSFER_FAILURE = 'transfer_failure'; + const TYPE_TRANSFER_REFUND = 'transfer_refund'; } diff --git a/htdocs/includes/stripe/lib/BankAccount.php b/htdocs/includes/stripe/lib/BankAccount.php index 019a4d87cbd..3fdc9188c64 100644 --- a/htdocs/includes/stripe/lib/BankAccount.php +++ b/htdocs/includes/stripe/lib/BankAccount.php @@ -31,6 +31,16 @@ class BankAccount extends ApiResource use ApiOperations\Delete; use ApiOperations\Update; + /** + * Possible string representations of the bank verification status. + * @link https://stripe.com/docs/api/external_account_bank_accounts/object#account_bank_account_object-status + */ + const STATUS_NEW = 'new'; + const STATUS_VALIDATED = 'validated'; + const STATUS_VERIFIED = 'verified'; + const STATUS_VERIFICATION_FAILED = 'verification_failed'; + const STATUS_ERRORED = 'errored'; + /** * @return string The instance URL for this resource. It needs to be special * cased because it doesn't fit into the standard resource pattern. diff --git a/htdocs/includes/stripe/lib/Charge.php b/htdocs/includes/stripe/lib/Charge.php index 832a07c7c04..43274c5559c 100644 --- a/htdocs/includes/stripe/lib/Charge.php +++ b/htdocs/includes/stripe/lib/Charge.php @@ -11,7 +11,9 @@ namespace Stripe; * @property int $amount_refunded * @property string $application * @property string $application_fee + * @property int $application_fee_amount * @property string $balance_transaction + * @property mixed $billing_details * @property bool $captured * @property int $created * @property string $currency @@ -30,6 +32,8 @@ namespace Stripe; * @property mixed $outcome * @property bool $paid * @property string $payment_intent + * @property string $payment_method + * @property mixed $payment_method_details * @property string $receipt_email * @property string $receipt_number * @property string $receipt_url @@ -86,6 +90,7 @@ class Charge extends ApiResource const DECLINED_INVALID_PIN = 'invalid_pin'; const DECLINED_ISSUER_NOT_AVAILABLE = 'issuer_not_available'; const DECLINED_LOST_CARD = 'lost_card'; + const DECLINED_MERCHANT_BLACKLIST = 'merchant_blacklist'; const DECLINED_NEW_ACCOUNT_INFORMATION_AVAILABLE = 'new_account_information_available'; const DECLINED_NO_ACTION_TAKEN = 'no_action_taken'; const DECLINED_NOT_PERMITTED = 'not_permitted'; diff --git a/htdocs/includes/stripe/lib/Checkout/Session.php b/htdocs/includes/stripe/lib/Checkout/Session.php index 968d58cf632..33fc6a08ab2 100644 --- a/htdocs/includes/stripe/lib/Checkout/Session.php +++ b/htdocs/includes/stripe/lib/Checkout/Session.php @@ -15,6 +15,7 @@ namespace Stripe\Checkout; * @property bool $livemode * @property string $payment_intent * @property string[] $payment_method_types + * @property string $submit_type * @property string $subscription * @property string $success_url * @@ -27,4 +28,13 @@ class Session extends \Stripe\ApiResource use \Stripe\ApiOperations\Create; use \Stripe\ApiOperations\Retrieve; + + /** + * Possible string representations of submit type. + * @link https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-submit_type + */ + const SUBMIT_TYPE_AUTO = 'auto'; + const SUBMIT_TYPE_BOOK = 'book'; + const SUBMIT_TYPE_DONATE = 'donate'; + const SUBMIT_TYPE_PAY = 'pay'; } diff --git a/htdocs/includes/stripe/lib/CreditNote.php b/htdocs/includes/stripe/lib/CreditNote.php index 169ed0815c3..66351ffb828 100644 --- a/htdocs/includes/stripe/lib/CreditNote.php +++ b/htdocs/includes/stripe/lib/CreditNote.php @@ -8,6 +8,7 @@ namespace Stripe; * @property string $id * @property string $object * @property int $amount + * @property string $customer_balance_transaction * @property int $created * @property string $currency * @property string $customer diff --git a/htdocs/includes/stripe/lib/Customer.php b/htdocs/includes/stripe/lib/Customer.php index 44f5e6e2f09..6e78f981ee4 100644 --- a/htdocs/includes/stripe/lib/Customer.php +++ b/htdocs/includes/stripe/lib/Customer.php @@ -7,8 +7,8 @@ namespace Stripe; * * @property string $id * @property string $object - * @property int $account_balance * @property mixed $address + * @property int $balance * @property string $created * @property string $currency * @property string $default_source @@ -26,6 +26,7 @@ namespace Stripe; * @property mixed $shipping * @property Collection $sources * @property Collection $subscriptions + * @property string $tax_exempt * @property Collection $tax_ids * * @package Stripe @@ -61,6 +62,7 @@ class Customer extends ApiResource return $savedNestedResources; } + const PATH_BALANCE_TRANSACTIONS = '/balance_transactions'; const PATH_SOURCES = '/sources'; const PATH_TAX_IDS = '/tax_ids'; @@ -264,4 +266,55 @@ class Customer extends ApiResource { return self::_allNestedResources($id, static::PATH_TAX_IDS, $params, $opts); } + + /** + * @param string|null $id The ID of the customer on which to create the balance transaction. + * @param array|null $params + * @param array|string|null $opts + * + * @return ApiResource + */ + public static function createBalanceTransaction($id, $params = null, $opts = null) + { + return self::_createNestedResource($id, static::PATH_BALANCE_TRANSACTIONS, $params, $opts); + } + + /** + * @param string|null $id The ID of the customer to which the balance transaction belongs. + * @param string|null $balanceTransactionId The ID of the balance transaction to retrieve. + * @param array|null $params + * @param array|string|null $opts + * + * @return ApiResource + */ + public static function retrieveBalanceTransaction($id, $balanceTransactionId, $params = null, $opts = null) + { + return self::_retrieveNestedResource($id, static::PATH_BALANCE_TRANSACTIONS, $balanceTransactionId, $params, $opts); + } + + /** + * @param string|null $id The ID of the customer on which to update the balance transaction. + * @param string|null $balanceTransactionId The ID of the balance transaction to update. + * @param array|null $params + * @param array|string|null $opts + * + * + * @return ApiResource + */ + public static function updateBalanceTransaction($id, $balanceTransactionId, $params = null, $opts = null) + { + return self::_updateNestedResource($id, static::PATH_BALANCE_TRANSACTIONS, $balanceTransactionId, $params, $opts); + } + + /** + * @param string|null $id The ID of the customer on which to retrieve the customer balance transactions. + * @param array|null $params + * @param array|string|null $opts + * + * @return Collection The list of customer balance transactions. + */ + public static function allBalanceTransactions($id, $params = null, $opts = null) + { + return self::_allNestedResources($id, static::PATH_BALANCE_TRANSACTIONS, $params, $opts); + } } diff --git a/htdocs/includes/stripe/lib/CustomerBalanceTransaction.php b/htdocs/includes/stripe/lib/CustomerBalanceTransaction.php new file mode 100644 index 00000000000..06cafcd45c6 --- /dev/null +++ b/htdocs/includes/stripe/lib/CustomerBalanceTransaction.php @@ -0,0 +1,88 @@ +instanceUrl() . '/cancel'; + list($response, $opts) = $this->_request('post', $url, $params, $options); + $this->refreshFrom($response, $opts); + return $this; + } + + /** + * @param array|null $params + * @param array|string|null $options + * + * @return SetupIntent The confirmed setup intent. + */ + public function confirm($params = null, $options = null) + { + $url = $this->instanceUrl() . '/confirm'; + list($response, $opts) = $this->_request('post', $url, $params, $options); + $this->refreshFrom($response, $opts); + return $this; + } +} diff --git a/htdocs/includes/stripe/lib/Source.php b/htdocs/includes/stripe/lib/Source.php index 31b7cf77bba..1e2c8c73565 100644 --- a/htdocs/includes/stripe/lib/Source.php +++ b/htdocs/includes/stripe/lib/Source.php @@ -18,6 +18,7 @@ namespace Stripe; * @property mixed $code_verification * @property int $created * @property string $currency + * @property string $customer * @property mixed $eps * @property string $flow * @property mixed $giropay diff --git a/htdocs/includes/stripe/lib/Stripe.php b/htdocs/includes/stripe/lib/Stripe.php index 027f22fd83c..2397ef9c418 100644 --- a/htdocs/includes/stripe/lib/Stripe.php +++ b/htdocs/includes/stripe/lib/Stripe.php @@ -47,7 +47,7 @@ class Stripe public static $maxNetworkRetries = 0; // @var boolean Whether client telemetry is enabled. Defaults to false. - public static $enableTelemetry = false; + public static $enableTelemetry = true; // @var float Maximum delay between retries, in seconds private static $maxNetworkRetryDelay = 2.0; @@ -55,7 +55,7 @@ class Stripe // @var float Initial delay between retries, in seconds private static $initialNetworkRetryDelay = 0.5; - const VERSION = '6.35.0'; + const VERSION = '6.41.0'; /** * @return string The API key used for requests. diff --git a/htdocs/includes/stripe/lib/Subscription.php b/htdocs/includes/stripe/lib/Subscription.php index 8b57d46b625..f5a46171d81 100644 --- a/htdocs/includes/stripe/lib/Subscription.php +++ b/htdocs/includes/stripe/lib/Subscription.php @@ -13,6 +13,7 @@ namespace Stripe; * @property mixed $billing_thresholds * @property bool $cancel_at_period_end * @property int $canceled_at + * @property string $collection_method * @property int $created * @property int $current_period_end * @property int $current_period_start @@ -31,6 +32,7 @@ namespace Stripe; * @property int $quantity * @property SubscriptionSchedule $schedule * @property int $start + * @property int $start_date * @property string $status * @property float $tax_percent * @property int $trial_end diff --git a/htdocs/includes/stripe/lib/TaxId.php b/htdocs/includes/stripe/lib/TaxId.php index 2993e2d1375..0f72a2ac95f 100644 --- a/htdocs/includes/stripe/lib/TaxId.php +++ b/htdocs/includes/stripe/lib/TaxId.php @@ -12,7 +12,6 @@ namespace Stripe; * @property string $country * @property int $created * @property string $customer - * @property bool $deleted * @property bool $livemode * @property string $type * @property string $value @@ -27,10 +26,12 @@ class TaxId extends ApiResource /** * Possible string representations of a tax id's type. - * @link https://stripe.com/docs/api/customers/tax_id_object#tax_id_object-type + * @link https://stripe.com/docs/api/customer_tax_ids/object#tax_id_object-type */ const TYPE_AU_ABN = 'au_abn'; const TYPE_EU_VAT = 'eu_vat'; + const TYPE_IN_GST = 'in_gst'; + const TYPE_NO_VAT = 'no_vat'; const TYPE_NZ_GST = 'nz_gst'; const TYPE_UNKNOWN = 'unknown'; diff --git a/htdocs/includes/stripe/lib/Util/Util.php b/htdocs/includes/stripe/lib/Util/Util.php index e21d45dac16..f9f15440023 100644 --- a/htdocs/includes/stripe/lib/Util/Util.php +++ b/htdocs/includes/stripe/lib/Util/Util.php @@ -88,6 +88,7 @@ abstract class Util \Stripe\Coupon::OBJECT_NAME => 'Stripe\\Coupon', \Stripe\CreditNote::OBJECT_NAME => 'Stripe\\CreditNote', \Stripe\Customer::OBJECT_NAME => 'Stripe\\Customer', + \Stripe\CustomerBalanceTransaction::OBJECT_NAME => 'Stripe\\CustomerBalanceTransaction', \Stripe\Discount::OBJECT_NAME => 'Stripe\\Discount', \Stripe\Dispute::OBJECT_NAME => 'Stripe\\Dispute', \Stripe\EphemeralKey::OBJECT_NAME => 'Stripe\\EphemeralKey', @@ -117,6 +118,7 @@ abstract class Util \Stripe\Person::OBJECT_NAME => 'Stripe\\Person', \Stripe\Plan::OBJECT_NAME => 'Stripe\\Plan', \Stripe\Product::OBJECT_NAME => 'Stripe\\Product', + \Stripe\Radar\EarlyFraudWarning::OBJECT_NAME => 'Stripe\\Radar\\EarlyFraudWarning', \Stripe\Radar\ValueList::OBJECT_NAME => 'Stripe\\Radar\\ValueList', \Stripe\Radar\ValueListItem::OBJECT_NAME => 'Stripe\\Radar\\ValueListItem', \Stripe\Recipient::OBJECT_NAME => 'Stripe\\Recipient', @@ -125,6 +127,7 @@ abstract class Util \Stripe\Reporting\ReportRun::OBJECT_NAME => 'Stripe\\Reporting\\ReportRun', \Stripe\Reporting\ReportType::OBJECT_NAME => 'Stripe\\Reporting\\ReportType', \Stripe\Review::OBJECT_NAME => 'Stripe\\Review', + \Stripe\SetupIntent::OBJECT_NAME => 'Stripe\\SetupIntent', \Stripe\SKU::OBJECT_NAME => 'Stripe\\SKU', \Stripe\Sigma\ScheduledQueryRun::OBJECT_NAME => 'Stripe\\Sigma\\ScheduledQueryRun', \Stripe\Source::OBJECT_NAME => 'Stripe\\Source', diff --git a/htdocs/includes/stripe/lib/Webhook.php b/htdocs/includes/stripe/lib/Webhook.php index e0ab3021a89..45c7dc0f30a 100644 --- a/htdocs/includes/stripe/lib/Webhook.php +++ b/htdocs/includes/stripe/lib/Webhook.php @@ -24,6 +24,8 @@ abstract class Webhook */ public static function constructEvent($payload, $sigHeader, $secret, $tolerance = self::DEFAULT_TOLERANCE) { + WebhookSignature::verifyHeader($payload, $sigHeader, $secret, $tolerance); + $data = json_decode($payload, true); $jsonError = json_last_error(); if ($data === null && $jsonError !== JSON_ERROR_NONE) { @@ -33,8 +35,6 @@ abstract class Webhook } $event = Event::constructFrom($data); - WebhookSignature::verifyHeader($payload, $sigHeader, $secret, $tolerance); - return $event; } } diff --git a/htdocs/includes/stripe/lib/WebhookSignature.php b/htdocs/includes/stripe/lib/WebhookSignature.php index 73e70dbd7de..9f8be8777b3 100644 --- a/htdocs/includes/stripe/lib/WebhookSignature.php +++ b/htdocs/includes/stripe/lib/WebhookSignature.php @@ -60,7 +60,7 @@ abstract class WebhookSignature } // Check if timestamp is within tolerance - if (($tolerance > 0) && ((time() - $timestamp) > $tolerance)) { + if (($tolerance > 0) && (abs(time() - $timestamp) > $tolerance)) { throw new Error\SignatureVerification( "Timestamp outside the tolerance zone", $header, diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 4cf9edaa28e..0f22d42327c 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1931,3 +1931,4 @@ EndPointFor=End point for %s : %s DeleteEmailCollector=Delete email collector ConfirmDeleteEmailCollector=Are you sure you want to delete this email collector? RecipientEmailsWillBeReplacedWithThisValue=Recipient emails will be always replaced with this value +AtLeastOneDefaultBankAccountMandatory=At least 1 default bank account must be defined diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 8e4d42559a8..4c8e761da9a 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -90,7 +90,7 @@ ErrorSpecialCharNotAllowedForField=Special characters are not allowed for field ErrorNumRefModel=A reference exists into database (%s) and is not compatible with this numbering rule. Remove record or renamed reference to activate this module. ErrorQtyTooLowForThisSupplier=Quantity too low for this vendor or no price defined on this product for this vendor ErrorOrdersNotCreatedQtyTooLow=Some orders haven't been created because of too-low quantities -ErrorModuleSetupNotComplete=Setup of module looks to be uncomplete. Go on Home - Setup - Modules to complete. +ErrorModuleSetupNotComplete=Setup of module %s looks to be uncomplete. Go on Home - Setup - Modules to complete. ErrorBadMask=Error on mask ErrorBadMaskFailedToLocatePosOfSequence=Error, mask without sequence number ErrorBadMaskBadRazMonth=Error, bad reset value diff --git a/htdocs/langs/fr_FR/errors.lang b/htdocs/langs/fr_FR/errors.lang index 1cf435379cd..a223f936638 100644 --- a/htdocs/langs/fr_FR/errors.lang +++ b/htdocs/langs/fr_FR/errors.lang @@ -90,7 +90,7 @@ ErrorSpecialCharNotAllowedForField=Les caractères spéciaux ne sont pas admis p ErrorNumRefModel=Une référence existe en base (%s) et est incompatible avec cette numérotation. Supprimez la ligne ou renommez la référence pour activer ce module. ErrorQtyTooLowForThisSupplier=Quantité insuffisante pour ce fournisseur ou aucun tarif défini sur ce produit pour ce fournisseur ErrorOrdersNotCreatedQtyTooLow=Certaines commandes n'ont pas été créées en raison de quantités trop faibles -ErrorModuleSetupNotComplete=La configuration des modules semble incomplète. Aller sur la page Accueil - Configuration - Modules pour corriger. +ErrorModuleSetupNotComplete=La configuration du module '%s' semble incomplète. Aller sur la page Accueil - Configuration - Modules pour corriger. ErrorBadMask=Erreur sur le masque ErrorBadMaskFailedToLocatePosOfSequence=Erreur, masque sans numéro de séquence ErrorBadMaskBadRazMonth=Erreur, mauvais valeur de remise à zéro diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index b682d86ff90..daf77674190 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -1935,7 +1935,8 @@ if (preg_match('/^dopayment/', $action)) // If we choosed/click on the payment // JS Code for Stripe if (empty($stripearrayofkeys['publishable_key'])) { - print info_admin($langs->trans("ErrorModuleSetupNotComplete", "stripe"), 0, 0, 'error'); + $langs->load("errors"); + print info_admin($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Stripe")), 0, 0, 'error'); } else { diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 9ddbed6c9b0..2ee5f5bedf5 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -224,21 +224,25 @@ $object = new Societe($db); * Actions */ -if ($action=="change") +if ($action=="change") // Change customer for TakePOS { $idcustomer = GETPOST('idcustomer', 'int'); $place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant - $sql="UPDATE ".MAIN_DB_PREFIX."facture set fk_soc=".$idcustomer." where ref='(PROV-POS-".$place.")'"; + // @TODO Check if draft invoice already exists, if not create it or return a warning to ask to enter at least one line to have it created automatically + $sql="UPDATE ".MAIN_DB_PREFIX."facture set fk_soc=".$idcustomer." where ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")'"; $resql = $db->query($sql); - ?> - - + + load("errors"); - print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete"); + print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("SupplierProposal")); return ""; } } diff --git a/htdocs/takepos/admin/terminal.php b/htdocs/takepos/admin/terminal.php index 2b29f46120d..0a91e303a53 100644 --- a/htdocs/takepos/admin/terminal.php +++ b/htdocs/takepos/admin/terminal.php @@ -17,7 +17,7 @@ */ /** - * \file htdocs/takepos/admin/setup.php + * \file htdocs/takepos/admin/terminal.php * \ingroup takepos * \brief Setup page for TakePos module */ @@ -125,30 +125,36 @@ print ''; print ''.$langs->trans("Parameters").''.$langs->trans("Value").''; print "\n"; -print ''.$langs->trans("CashDeskThirdPartyForSell").''; -print ''; +print ''.$langs->trans("CashDeskThirdPartyForSell").''; +print ''; print $form->select_company($conf->global->{'CASHDESK_ID_THIRDPARTY'.$terminaltouse}, 'socid', '(s.client IN (1, 3) AND s.status = 1)', 1, 0, 0, array(), 0); print ''; + +$atleastonefound = 0; if (! empty($conf->banque->enabled)) { print ''.$langs->trans("CashDeskBankAccountForSell").''; - print ''; + print ''; $form->select_comptes($conf->global->{'CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse}, 'CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse, 0, "courant=2", 1); + if (! empty($conf->global->{'CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse})) $atleastonefound++; print ''; print ''.$langs->trans("CashDeskBankAccountForCheque").''; - print ''; + print ''; $form->select_comptes($conf->global->{'CASHDESK_ID_BANKACCOUNT_CHEQUE'.$terminaltouse}, 'CASHDESK_ID_BANKACCOUNT_CHEQUE'.$terminaltouse, 0, "courant=1", 1); + if (! empty($conf->global->{'CASHDESK_ID_BANKACCOUNT_CHEQUE'.$terminaltouse})) $atleastonefound++; print ''; print ''.$langs->trans("CashDeskBankAccountForCB").''; - print ''; + print ''; $form->select_comptes($conf->global->{'CASHDESK_ID_BANKACCOUNT_CB'.$terminaltouse}, 'CASHDESK_ID_BANKACCOUNT_CB'.$terminaltouse, 0, "courant=1", 1); + if (! empty($conf->global->{'CASHDESK_ID_BANKACCOUNT_CB'.$terminaltouse})) $atleastonefound++; print ''; foreach($paiements as $modep) { - if (in_array($modep->code, array('LIQ', 'CB', 'CHQ'))) continue; + if (in_array($modep->code, array('LIQ', 'CB', 'CHQ'))) continue; // Already managed before $name="CASHDESK_ID_BANKACCOUNT_".$modep->code.$terminaltouse; print ''.$langs->trans("CashDeskBankAccountFor").' '.$langs->trans($modep->libelle).''; - print ''; + print ''; + if (! empty($conf->global->$name)) $atleastonefound++; $cour=preg_match('/^LIQ.*/', $modep->code)?2:1; $form->select_comptes($conf->global->$name, $name, 0, "courant=".$cour, 1); print ''; @@ -159,7 +165,7 @@ if (! empty($conf->stock->enabled)) { print ''.$langs->trans("CashDeskDoNotDecreaseStock").''; // Force warehouse (this is not a default value) - print ''; + print ''; if (empty($conf->productbatch->enabled)) { print $form->selectyesno('CASHDESK_NO_DECREASE_STOCK'.$terminal, $conf->global->{'CASHDESK_NO_DECREASE_STOCK'.$terminal}, 1); } @@ -177,7 +183,7 @@ if (! empty($conf->stock->enabled)) print ''.$langs->trans("CashDeskIdWareHouse").''; // Force warehouse (this is not a default value) - print ''; + print ''; if (! $disabled) { print $formproduct->selectWarehouses($conf->global->{'CASHDESK_ID_WAREHOUSE'.$terminal}, 'CASHDESK_ID_WAREHOUSE'.$terminal, '', 1, $disabled); @@ -191,6 +197,12 @@ if (! empty($conf->stock->enabled)) } print ''; + +if ($atleastonefound == 0 && ! empty($conf->banque->enabled)) +{ + print info_admin($langs->trans("AtLeastOneDefaultBankAccountMandatory"), 0, 0, 'error'); +} + print '
'; print '
'; diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 48b637ee9fa..dfa058068ad 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -42,7 +42,7 @@ $langs->loadLangs(array("bills", "cashdesk")); $id = GETPOST('id', 'int'); $action = GETPOST('action', 'alpha'); $idproduct = GETPOST('idproduct', 'int'); -$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant +$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Bar or Restaurant if ($conf->global->TAKEPOS_PHONE_BASIC_LAYOUT==1 && $conf->browser->layout == 'phone') { @@ -209,9 +209,21 @@ if (($action=="addline" || $action=="freezone") && $placeid == 0) $invoice->module_source = 'takepos'; $invoice->pos_source = $_SESSION["takeposterminal"]; - $placeid = $invoice->create($user); - $sql="UPDATE ".MAIN_DB_PREFIX."facture set ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")' where rowid=".$placeid; - $db->query($sql); + if ($invoice->socid <= 0) + { + $langs->load('errors'); + dol_htmloutput_errors($langs->trans("ErrorModuleSetupNotComplete", "TakePos"), null, 1); + } + else + { + $placeid = $invoice->create($user); + if ($placeid < 0) + { + dol_htmloutput_errors($invoice->error, $invoice->errors, 1); + } + $sql="UPDATE ".MAIN_DB_PREFIX."facture set ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")' where rowid=".$placeid; + $db->query($sql); + } } if ($action == "addline") diff --git a/htdocs/takepos/takepos.php b/htdocs/takepos/takepos.php index 7e55bbc5936..7260bc81a58 100644 --- a/htdocs/takepos/takepos.php +++ b/htdocs/takepos/takepos.php @@ -17,7 +17,7 @@ */ /** - * \file htdocs/takepos/floors.php + * \file htdocs/takepos/takepos.php * \ingroup takepos * \brief Main TakePOS screen */ @@ -359,7 +359,7 @@ function deleteline() { } function Customer() { - console.log("Open box to select the thirdparty"); + console.log("Open box to select the thirdparty place="+place); $.colorbox({href:"../societe/list.php?contextpage=poslist&nomassaction=1&place="+place, width:"90%", height:"80%", transition:"none", iframe:"true", title:"trans("Customer");?>"}); } @@ -626,6 +626,7 @@ $sql = "SELECT code, libelle FROM ".MAIN_DB_PREFIX."c_paiement"; $sql.= " WHERE entity IN (".getEntity('c_paiement').")"; $sql.= " AND active = 1"; $sql.= " ORDER BY libelle"; + $resql = $db->query($sql); $paiementsModes = array(); if ($resql){ @@ -640,7 +641,8 @@ if ($resql){ } } if (empty($paiementsModes)) { - setEventMessages($langs->trans("ErrorModuleSetupNotComplete"), null, 'errors'); + $langs->load('errors'); + setEventMessages($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("TakePOS")), null, 'errors'); } if (count($maincategories)==0) { setEventMessages($langs->trans("TakeposNeedsCategories"), null, 'errors'); diff --git a/htdocs/ticket/class/api_tickets.class.php b/htdocs/ticket/class/api_tickets.class.php index 1395d8acf2b..78d351a8dae 100644 --- a/htdocs/ticket/class/api_tickets.class.php +++ b/htdocs/ticket/class/api_tickets.class.php @@ -218,17 +218,16 @@ class Tickets extends DolibarrApi * Get a list of tickets * * @param int $socid Filter list with thirdparty ID - * @param string $mode Use this param to filter list * @param string $sortfield Sort field * @param string $sortorder Sort order * @param int $limit Limit for list * @param int $page Page number - * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101') and (t.fk_statut:=:1)" * * @return array Array of ticket objects * */ - public function index($socid = 0, $mode = "", $sortfield = "s.rowid", $sortorder = "ASC", $limit = 0, $page = 0, $sqlfilters = '') + public function index($socid = 0, $sortfield = "t.rowid", $sortorder = "ASC", $limit = 100, $page = 0, $sqlfilters = '') { global $db, $conf; @@ -243,51 +242,25 @@ class Tickets extends DolibarrApi $search_sale = DolibarrApiAccess::$user->id; } - $sql = "SELECT s.rowid"; + $sql = "SELECT t.rowid"; if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) { $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects) } - $sql.= " FROM ".MAIN_DB_PREFIX."ticket as s"; + $sql.= " FROM ".MAIN_DB_PREFIX."ticket as t"; if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) { $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale } - $sql.= ' WHERE s.entity IN ('.getEntity('ticket', 1).')'; + $sql.= ' WHERE t.entity IN ('.getEntity('ticket', 1).')'; if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) { - $sql.= " AND s.fk_soc = sc.fk_soc"; + $sql.= " AND t.fk_soc = sc.fk_soc"; } if ($socid > 0) { - $sql.= " AND s.fk_soc = ".$socid; + $sql.= " AND t.fk_soc = ".$socid; } if ($search_sale > 0) { - $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale - } - - // Example of use $mode - if ($mode == 'new') { - $sql.= " AND s.fk_statut IN (0)"; - } - if ($mode == 'read') { - $sql.= " AND s.fk_statut IN (1)"; - } - if ($mode == 'answered') { - $sql.= " AND s.fk_statut IN (3)"; - } - if ($mode == 'assign') { - $sql.= " AND s.fk_statut IN (4)"; - } - if ($mode == 'inprogress') { - $sql.= " AND s.fk_statut IN (5)"; - } - if ($mode == 'waiting') { - $sql.= " AND s.fk_statut IN (6)"; - } - if ($mode == 'closed') { - $sql.= " AND s.fk_statut IN (8)"; - } - if ($mode == 'deleted') { - $sql.= " AND s.fk_statut IN (9)"; + $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale } // Insert sale filter @@ -344,7 +317,6 @@ class Tickets extends DolibarrApi * * @param array $request_data Request datas * @return int ID of ticket - * */ public function post($request_data = null) { @@ -364,9 +336,11 @@ class Tickets extends DolibarrApi if (empty($this->ticket->track_id)) { $this->ticket->track_id = generate_random_id(16); } - if (! $this->ticket->create(DolibarrApiAccess::$user)) { - throw new RestException(500); + + if ($this->ticket->create(DolibarrApiAccess::$user) < 0) { + throw new RestException(500, "Error creating ticket", array_merge(array($this->ticket->error), $this->ticket->errors)); } + return $this->ticket->id; } @@ -561,8 +535,12 @@ class Tickets extends DolibarrApi "lastname", "firstname", "civility_id", + "canvas", "cache_msgs_ticket", "cache_logs_ticket", + "cache_types_tickets", + "cache_category_tickets", + "regeximgext", "statuts_short", "statuts" ); diff --git a/htdocs/user/clicktodial.php b/htdocs/user/clicktodial.php index 46e42c351c7..2ad328b5a88 100644 --- a/htdocs/user/clicktodial.php +++ b/htdocs/user/clicktodial.php @@ -120,7 +120,7 @@ if ($id > 0) if (empty($conf->global->CLICKTODIAL_URL) && empty($object->clicktodial_url)) { $langs->load("errors"); - print ''.$langs->trans("ErrorModuleSetupNotComplete").''; + print ''.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("ClickToDial")).''; } else { @@ -161,7 +161,7 @@ if ($id > 0) if (empty($url)) { $langs->load("errors"); - print ''.$langs->trans("ErrorModuleSetupNotComplete").''; + print ''.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("ClickToDial")).''; } else {