diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 00000000000..186b20a051d --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,5 @@ +# These are supported funding model platforms + +open_collective: dolibarr +custom: https://wiki.dolibarr.org/index.php/Subscribe +# github: [eldy] \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE/bug_report.md similarity index 78% rename from .github/ISSUE_TEMPLATE.md rename to .github/ISSUE_TEMPLATE/bug_report.md index a105eed20ea..432f30f2332 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,8 +1,16 @@ +--- +name: Bug report +about: Create a report to help us fix something that is broken +title: '' +labels: Bug +assignees: '' + +--- + # Instructions *This is a template to help you report good issues. You may use [Github Markdown](https://help.github.com/articles/getting-started-with-writing-and-formatting-on-github/) syntax to format your issue report.* *Please:* -- *only keep the "Bug" or "Feature Request" section* -- *replace the bracket enclosed texts with meaningful informations* +- *replace the bracket enclosed texts with meaningful information* - *remove any unused sub-section* @@ -25,17 +33,3 @@ ## [Attached files](https://help.github.com/articles/issue-attachments) (Screenshots, screencasts, dolibarr.log, debugging informations…) [*Files*] - - - -# Feature Request -[*Short description*] - -## Use case -[*Verbose description*] - -## Suggested implementation -[*Verbose description*] - -## Suggested steps -[*List of tasks to achieve goal*] diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000000..32e2deff2c1 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,27 @@ +--- +name: Feature request +about: Suggest a new idea for this project +title: '' +labels: Feature request +assignees: '' + +--- + +# Instructions +*This is a template to help you report good issues. You may use [Github Markdown](https://help.github.com/articles/getting-started-with-writing-and-formatting-on-github/) syntax to format your issue report.* +*Please:* +- *replace the bracket enclosed texts with meaningful information* +- *remove any unused sub-section* + + +# Feature Request +[*Short description*] + +## Use case +[*Verbose description*] + +## Suggested implementation +[*Verbose description*] + +## Suggested steps +[*List of tasks to achieve goal*] diff --git a/.travis.yml b/.travis.yml index 1521035578b..7c1552bb2a8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -293,12 +293,12 @@ script: echo - | - echo "Checking coding style" + echo "Checking coding style (excluding Pull Requests builds)" # Ensure we catch errors set -e # Exclusions are defined in the ruleset.xml file #phpcs -s -n -p -d memory_limit=-1 --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 . - phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true . + if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .; fi set +e echo diff --git a/README.md b/README.md index 5d4de0af909..8100cabddbe 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # DOLIBARR ERP & CRM  -[](https://houndci.com) |7|8|9|10|develop| |----------|----------|----------|----------|----------| @@ -138,7 +137,7 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) - Multi-company by adding of an external module. - Very user friendly and easy to use. - Highly customizable: enable only the modules you need, add user personalized fields, choose your skin, several menu managers (can be used by internal users as a back-office with a particular menu, or by external users as a front-office with another one) -- Works with PHP 5.3+ and MariaDB 5.0.3+, MySQL 5.0.3+ or PostgreSQL 8.1.4+ (See requirements on the [Wiki](https://wiki.dolibarr.org/index.php/Prerequisite)) +- Works with PHP 5.5+ and MariaDB 5.0.3+, MySQL 5.0.3+ or PostgreSQL 8.1.4+ (See requirements on the [Wiki](https://wiki.dolibarr.org/index.php/Prerequisite)) - Compatible with all Cloud solutions that match MySQL, PHP or PostgreSQL prerequisites. - APIs. - An easy to understand, maintain and develop code (PHP with no heavy framework; trigger and hook architecture) diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 3a39632d783..0d3980318a4 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -121,10 +121,12 @@ class AdherentType extends CommonObject $this->db->begin(); $sql = "INSERT INTO ".MAIN_DB_PREFIX."adherent_type ("; - $sql.= "libelle"; + $sql.= " morphy"; + $sql.= ", libelle"; $sql.= ", entity"; $sql.= ") VALUES ("; - $sql.= "'".$this->db->escape($this->label)."'"; + $sql.= "'".$this->db->escape($this->morphy)."'"; + $sql.= ", '".$this->db->escape($this->label)."'"; $sql.= ", ".$conf->entity; $sql.= ")"; diff --git a/htdocs/admin/system/perf.php b/htdocs/admin/system/perf.php index fbf6fa3bb14..e17756391f1 100644 --- a/htdocs/admin/system/perf.php +++ b/htdocs/admin/system/perf.php @@ -522,9 +522,9 @@ if ($resql) $nb=$obj->nb; if ($nb > $limitforoptim) { - if (empty($conf->global->THIRDPARTY_DONOTSEARCH_ANYWHERE)) + if (empty($conf->global->COMPANY_DONOTSEARCH_ANYWHERE)) { - print img_picto('', 'warning.png').' '.$langs->trans("YouHaveXObjectUseSearchOptim", $nb, $langs->transnoentitiesnoconv("ThirdParties"), 'THIRDPARTY_DONOTSEARCH_ANYWHERE'); + print img_picto('', 'warning.png').' '.$langs->trans("YouHaveXObjectUseSearchOptim", $nb, $langs->transnoentitiesnoconv("ThirdParties"), 'COMPANY_DONOTSEARCH_ANYWHERE'); } else { diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php index c06314daa9a..e07e7999414 100644 --- a/htdocs/admin/tools/dolibarr_export.php +++ b/htdocs/admin/tools/dolibarr_export.php @@ -50,14 +50,23 @@ if (! $user->admin) if ($action == 'delete') { - $file=$conf->admin->dir_output.'/backup/'.basename(GETPOST('urlfile', 'alpha')); - $ret=dol_delete_file($file, 1); - if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs'); - else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors'); - $action=''; + if (preg_match('/^backup\//', GETPOST('urlfile', 'alpha'))) + { + $file=$conf->admin->dir_output.'/backup/'.basename(GETPOST('urlfile', 'alpha')); + $ret=dol_delete_file($file, 1); + if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs'); + else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors'); + } + else + { + $file=$conf->admin->dir_output.'/documents/'.basename(GETPOST('urlfile', 'alpha')); + $ret=dol_delete_file($file, 1); + if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs'); + else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors'); + } + $action=''; } - /* * View */ diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index a44054cdfd0..031d2c95235 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -240,6 +240,7 @@ if (empty($reshook)) { $datecommande = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); $datelivraison = dol_mktime(12, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year')); + $selectedLines = GETPOST('toselect', 'array'); if ($datecommande == '') { setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('Date')), null, 'errors'); @@ -346,6 +347,8 @@ if (empty($reshook)) for($i = 0; $i < $num; $i ++) { + if(!in_array($lines[$i]->id, $selectedLines)) continue; // Skip unselected lines + $label = (! empty($lines[$i]->label) ? $lines[$i]->label : ''); $desc = (! empty($lines[$i]->desc) ? $lines[$i]->desc : ''); $product_type = (! empty($lines[$i]->product_type) ? $lines[$i]->product_type : 0); @@ -1758,6 +1761,15 @@ if ($action == 'create' && $usercancreate) $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); print $hookmanager->resPrint; if (empty($reshook)) { + if (! empty($conf->global->THIRDPARTY_PROPAGATE_EXTRAFIELDS_TO_ORDER)) { + // copy from thirdparty + $tpExtrafields = new Extrafields($db); + $tpExtrafieldLabels = $tpExtrafields->fetch_name_optionals_label($soc->table_element); + if ($soc->fetch_optionals() > 0) { + $object->array_options = array_merge($object->array_options, $soc->array_options); + } + }; + print $object->showOptionals($extrafields, 'edit'); } @@ -1872,8 +1884,6 @@ if ($action == 'create' && $usercancreate) print ''; print ''; - print ''; - // Show origin lines if (! empty($origin) && ! empty($originid) && is_object($objectsrc)) { $title = $langs->trans('ProductsAndServices'); @@ -1881,10 +1891,12 @@ if ($action == 'create' && $usercancreate) print '
| '; - print $thirdpartystatic->getNomUrl(1, 'customer'); + if ($contextpage == 'poslist') + { + print $thirdpartystatic->name; + } + else + { + print $thirdpartystatic->getNomUrl(1, 'customer'); + } print ' | '; if (! $i) $totalarray['nbfield']++; } @@ -1261,7 +1268,7 @@ if ($resql) // Action column print ''; - if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + if (($massactionbutton || $massaction) && $contextpage != 'poslist') // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined { $selected=0; if (in_array($obj->id, $arrayofselected)) $selected=1; diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 30c31109224..e8fceebb03c 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -539,7 +539,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie $sql = 'SELECT f.rowid as facid, f.ref, f.total_ttc, f.multicurrency_code, f.multicurrency_total_ttc, f.type,'; $sql.= ' f.datef as df, f.fk_soc as socid, f.date_lim_reglement as dlr'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f'; - $sql.= ' WHERE f.entity IN ('.getEntity('invoice', $conf->entity).')'; + $sql.= ' WHERE f.entity IN ('.getEntity('facture').')'; $sql.= ' AND (f.fk_soc = '.$facture->socid; // Can pay invoices of all child of parent company if(!empty($conf->global->FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS) && !empty($facture->thirdparty->parent)) { @@ -597,7 +597,11 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ' | '.$alreadypayedlabel.' | '; print ''.$remaindertopay.' | '; print ''.$langs->trans('PaymentAmount').' | '; - print ''; + + $parameters=array(); + $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters, $facture, $action); // Note that $action and $object may have been modified by hook + + print ' | '; print "\n"; $total=0; @@ -745,7 +749,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ""; $parameters=array(); - $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters, $objp, $action); // Note that $action and $object may have been modified by hook + $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $objp, $action); // Note that $action and $object may have been modified by hook // Warning print ' | '; diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index 0318efb7e1a..9e68e6e79a3 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -710,37 +710,37 @@ if ($id > 0) // Reopen if ($object->paye && $user->rights->tax->charges->creer) { - print "id&action=reopen\">".$langs->trans("ReOpen").""; + print ""; } // Edit if ($object->paye == 0 && $user->rights->tax->charges->creer) { - print "id&action=edit\">".$langs->trans("Modify").""; + print ""; } // Emit payment if ($object->paye == 0 && ((price2num($object->amount) < 0 && price2num($resteapayer, 'MT') < 0) || (price2num($object->amount) > 0 && price2num($resteapayer, 'MT') > 0)) && $user->rights->tax->charges->creer) { - print "id&action=create\">".$langs->trans("DoPayment").""; + print ""; } // Classify 'paid' if ($object->paye == 0 && round($resteapayer) <=0 && $user->rights->tax->charges->creer) { - print "id&action=paid\">".$langs->trans("ClassifyPaid").""; + print ""; } // Clone if ($user->rights->tax->charges->creer) { - print "id&action=clone\">".$langs->trans("ToClone").""; + print ""; } // Delete if ($user->rights->tax->charges->supprimer) { - print "id&action=delete\">".$langs->trans("Delete").""; + print ""; } print ""; diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index 4fd157de9e6..c3914ae79db 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -317,7 +317,7 @@ class ChargeSociales extends CommonObject $sql.= ", date_ech='".$this->db->idate($this->date_ech)."'"; $sql.= ", periode='".$this->db->idate($this->periode)."'"; $sql.= ", amount='".price2num($this->amount, 'MT')."'"; - $sql.= ", fk_projet=".($this->fk_project > 0 ? $this->fk_project : null); + $sql.= ", fk_projet=".($this->fk_project>0?$this->db->escape($this->fk_project):"NULL"); $sql.= ", fk_user_modif=".$user->id; $sql.= " WHERE rowid=".$this->id; diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php index be738b374cf..759ed75df5e 100644 --- a/htdocs/compta/tva/card.php +++ b/htdocs/compta/tva/card.php @@ -385,16 +385,16 @@ if ($id) { if (! empty($user->rights->tax->charges->supprimer)) { - print ''.$langs->trans("Delete").''; + print ''; } else { - print ''.$langs->trans("Delete").''; + print ''; } } else { - print ''.$langs->trans("Delete").''; + print ''; } print ""; } diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index fa26c5ed30b..b0db8b0affb 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -165,8 +165,8 @@ $arrayfields=array( 'p.fax'=>array('label'=>"Fax", 'checked'=>0), 'p.email'=>array('label'=>"EMail", 'checked'=>1), 'p.no_email'=>array('label'=>"No_Email", 'checked'=>0, 'enabled'=>(! empty($conf->mailing->enabled))), - 'p.jabberid'=>array('label'=>"Jabber", 'checked'=>1, 'enabled'=>(! empty($conf->socialnetworks->enabled))), 'p.skype'=>array('label'=>"Skype", 'checked'=>1, 'enabled'=>(! empty($conf->socialnetworks->enabled))), + 'p.jabberid'=>array('label'=>"Jabber", 'checked'=>1, 'enabled'=>(! empty($conf->socialnetworks->enabled))), 'p.twitter'=>array('label'=>"Twitter", 'checked'=>1, 'enabled'=>(! empty($conf->socialnetworks->enabled))), 'p.facebook'=>array('label'=>"Facebook", 'checked'=>1, 'enabled'=>(! empty($conf->socialnetworks->enabled))), 'p.linkedin'=>array('label'=>"LinkedIn", 'checked'=>1, 'enabled'=>(! empty($conf->socialnetworks->enabled))), @@ -427,7 +427,7 @@ if ($search_societe != '') $param.='&search_societe='.urlencode($search_soci if ($search_zip != '') $param.='&search_zip='.urlencode($search_zip); if ($search_town != '') $param.='&search_town='.urlencode($search_town); if ($search_country != '') $param.= "&search_country=".urlencode($search_country); -if ($search_job != '') $param.='&search_job='.urlencode($search_job); +if ($search_poste != '') $param.='&search_poste='.urlencode($search_poste); if ($search_phone_pro != '') $param.='&search_phone_pro='.urlencode($search_phone_pro); if ($search_phone_perso != '') $param.='&search_phone_perso='.urlencode($search_phone_perso); if ($search_phone_mobile != '') $param.='&search_phone_mobile='.urlencode($search_phone_mobile); @@ -629,6 +629,12 @@ if (! empty($arrayfields['p.skype']['checked'])) print ''; print ' | '; } +if (! empty($arrayfields['p.jabberid']['checked'])) +{ + print ''; + print ''; + print ' | '; +} if (! empty($arrayfields['p.twitter']['checked'])) { print '';
@@ -720,6 +726,7 @@ if (! empty($arrayfields['p.fax']['checked'])) print_liste_field
if (! empty($arrayfields['p.email']['checked'])) print_liste_field_titre($arrayfields['p.email']['label'], $_SERVER["PHP_SELF"], "p.email", $begin, $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['p.no_email']['checked'])) print_liste_field_titre($arrayfields['p.no_email']['label'], $_SERVER["PHP_SELF"], "p.no_email", $begin, $param, '', $sortfield, $sortorder, 'center ');
if (! empty($arrayfields['p.skype']['checked'])) print_liste_field_titre($arrayfields['p.skype']['label'], $_SERVER["PHP_SELF"], "p.skype", $begin, $param, '', $sortfield, $sortorder);
+if (! empty($arrayfields['p.jabberid']['checked'])) print_liste_field_titre($arrayfields['p.jabberid']['label'], $_SERVER["PHP_SELF"], "p.jabberid", $begin, $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['p.twitter']['checked'])) print_liste_field_titre($arrayfields['p.twitter']['label'], $_SERVER["PHP_SELF"], "p.twitter", $begin, $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['p.facebook']['checked'])) print_liste_field_titre($arrayfields['p.facebook']['label'], $_SERVER["PHP_SELF"], "p.facebook", $begin, $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['p.linkedin']['checked'])) print_liste_field_titre($arrayfields['p.linkedin']['label'], $_SERVER["PHP_SELF"], "p.linkedin", $begin, $param, '', $sortfield, $sortorder);
diff --git a/htdocs/core/boxes/box_birthdays_members.php b/htdocs/core/boxes/box_birthdays_members.php
new file mode 100644
index 00000000000..6a36bc01ae4
--- /dev/null
+++ b/htdocs/core/boxes/box_birthdays_members.php
@@ -0,0 +1,163 @@
+
+ * Copyright (C) 2004-2010 Laurent Destailleur | '.$langs->trans('Ref').' | ';
@@ -4203,8 +4204,9 @@ abstract class CommonObject
{
print ''.$langs->trans('Unit').' | ';
}
- print ''.$langs->trans('ReductionShort').' | '.$langs->trans('ReductionShort').' | ';
+ print ''.$form->showCheckAddButtons('checkforselect', 1).' | ';
+ print '';
$var = true;
$i = 0;
@@ -4223,7 +4225,7 @@ abstract class CommonObject
}
else
{
- $this->printOriginLine($line, $var, $restrictlist);
+ $this->printOriginLine($line, $var, $restrictlist, '/core/tpl', $selectedLines);
}
$i++;
@@ -4241,9 +4243,10 @@ abstract class CommonObject
* @param string $var Var
* @param string $restrictlist ''=All lines, 'services'=Restrict to services only (strike line if not)
* @param string $defaulttpldir Directory where to find the template
+ * @param array $selectedLines Array of lines id for selected lines
* @return void
*/
- public function printOriginLine($line, $var, $restrictlist = '', $defaulttpldir = '/core/tpl')
+ public function printOriginLine($line, $var, $restrictlist = '', $defaulttpldir = '/core/tpl', $selectedLines = array())
{
global $langs, $conf;
@@ -4267,6 +4270,8 @@ abstract class CommonObject
if ($line->date_fin_reel) $date_end=$line->date_fin_reel;
}
+ $this->tpl['id'] = $line->id;
+
$this->tpl['label'] = '';
if (! empty($line->fk_parent_line)) $this->tpl['label'].= img_picto('', 'rightarrow');
diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php
index 678cfe446a0..5cf7e8cdb7a 100644
--- a/htdocs/core/class/discount.class.php
+++ b/htdocs/core/class/discount.class.php
@@ -629,6 +629,49 @@ class DiscountAbsolute
return -1;
}
}
+ /**
+ * Return amount (with tax) of all converted amount for this credit note
+ *
+ * @param CommonInvoice $invoice Object invoice
+ * @param int $multicurrency Return multicurrency_amount instead of amount
+ * @return int <0 if KO, Sum of credit notes and deposits amount otherwise
+ */
+ public function getSumFromThisCreditNotesNotUsed($invoice, $multicurrency = 0)
+ {
+ dol_syslog(get_class($this)."::getSumCreditNotesUsed", LOG_DEBUG);
+
+ if ($invoice->element == 'facture' || $invoice->element == 'invoice')
+ {
+ $sql = 'SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount';
+ $sql.= ' FROM '.MAIN_DB_PREFIX.'societe_remise_except as rc';
+ $sql.= ' WHERE rc.fk_facture IS NULL AND rc.fk_facture_source = '.$invoice->id;
+ }
+ elseif ($invoice->element == 'invoice_supplier')
+ {
+ $sql = 'SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount';
+ $sql.= ' FROM '.MAIN_DB_PREFIX.'societe_remise_except as rc';
+ $sql.= ' WHERE rc.fk_invoice_supplier IS NULL AND rc.fk_invoice_supplier_source = '.$invoice->id;
+ }
+ else
+ {
+ $this->error=get_class($this)."::getSumCreditNotesUsed was called with a bad object as a first parameter";
+ dol_print_error($this->error);
+ return -1;
+ }
+
+ $resql=$this->db->query($sql);
+ if ($resql)
+ {
+ $obj = $this->db->fetch_object($resql);
+ if ($multicurrency) return $obj->multicurrency_amount;
+ else return $obj->amount;
+ }
+ else
+ {
+ $this->error = $this->db->lasterror();
+ return -1;
+ }
+ }
/**
* Return clickable ref of object (with picto or not)
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 3a69d8e6d42..5ee969a73a0 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -1887,10 +1887,10 @@ class Form
* @param int $forcecombo Force to use combo box
* @param string $morecss Add more css on select
* @param int $hidepriceinlabel 1=Hide prices in label
- * @param string $warehouseStatus warehouse status filter, following comma separated filter options can be used
- * 'warehouseopen' = select products from open warehouses,
- * 'warehouseclosed' = select products from closed warehouses,
- * 'warehouseinternal' = select products from warehouses for internal correct/transfer only
+ * @param string $warehouseStatus Warehouse status filter to count the quantity in stock. Following comma separated filter options can be used
+ * 'warehouseopen' = count products from open warehouses,
+ * 'warehouseclosed' = count products from closed warehouses,
+ * 'warehouseinternal' = count products from warehouses for internal correct/transfer only
* @param array $selected_combinations Selected combinations. Format: array([attrid] => attrval, [...])
* @return void
*/
@@ -2042,10 +2042,10 @@ class Form
* @param int $forcecombo Force to use combo box
* @param string $morecss Add more css on select
* @param int $hidepriceinlabel 1=Hide prices in label
- * @param string $warehouseStatus warehouse status filter, following comma separated filter options can be used
- * 'warehouseopen' = select products from open warehouses,
- * 'warehouseclosed' = select products from closed warehouses,
- * 'warehouseinternal' = select products from warehouses for internal correct/transfer only
+ * @param string $warehouseStatus Warehouse status filter to group/count stock. Following comma separated filter options can be used.
+ * 'warehouseopen' = count products from open warehouses,
+ * 'warehouseclosed' = count products from closed warehouses,
+ * 'warehouseinternal' = count products from warehouses for internal correct/transfer only
* @return array Array of keys for json
*/
public function select_produits_list($selected = '', $htmlname = 'productid', $filtertype = '', $limit = 20, $price_level = 0, $filterkey = '', $status = 1, $finished = 2, $outputmode = 0, $socid = 0, $showempty = '1', $forcecombo = 0, $morecss = '', $hidepriceinlabel = 0, $warehouseStatus = '')
@@ -2075,7 +2075,14 @@ class Form
}
$selectFields = " p.rowid, p.label, p.ref, p.description, p.barcode, p.fk_product_type, p.price, p.price_ttc, p.price_base_type, p.tva_tx, p.duration, p.fk_price_expression";
- (count($warehouseStatusArray)) ? $selectFieldsGrouped = ", sum(ps.reel) as stock" : $selectFieldsGrouped = ", p.stock";
+ if (count($warehouseStatusArray))
+ {
+ $selectFieldsGrouped = ", sum(".$db->ifsql("e.statut IS NULL", "0", "ps.reel").") as stock"; // e.statut is null if there is no record in stock
+ }
+ else
+ {
+ $selectFieldsGrouped = ", p.stock";
+ }
$sql = "SELECT ";
$sql.= $selectFields . $selectFieldsGrouped;
@@ -2126,7 +2133,8 @@ class Form
if (count($warehouseStatusArray))
{
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps on ps.fk_product = p.rowid";
- $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."entrepot as e on ps.fk_entrepot = e.rowid";
+ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (".getEntity('stock').")";
+ $sql.= ' AND e.statut IN ('.$this->db->escape(implode(',', $warehouseStatusArray)).')'; // Return line if product is inside the selected stock. If not, an empty line will be returned so we will count 0.
}
// include search in supplier ref
@@ -2154,10 +2162,6 @@ class Form
}
$sql.= ' WHERE p.entity IN ('.getEntity('product').')';
- if (count($warehouseStatusArray))
- {
- $sql.= ' AND (p.fk_product_type = 1 OR e.statut IN ('.$this->db->escape(implode(',', $warehouseStatusArray)).'))';
- }
if (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD)) {
$sql .= " AND pac.rowid IS NULL";
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index f267e572ee4..6ee6007088b 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -5671,7 +5671,7 @@ function dol_string_is_good_iso($s)
$ok=1;
for($scursor=0;$scursor<$len;$scursor++)
{
- $ordchar=ord($s{$scursor});
+ $ordchar=ord($s[$scursor]);
//print $scursor.'-'.$ordchar.''; if ($ordchar < 32 && $ordchar != 13 && $ordchar != 10) { $ok=0; break; } if ($ordchar > 126 && $ordchar < 160) { $ok=0; break; } diff --git a/htdocs/core/lib/json.lib.php b/htdocs/core/lib/json.lib.php index 4a8f61915b5..423607fb819 100644 --- a/htdocs/core/lib/json.lib.php +++ b/htdocs/core/lib/json.lib.php @@ -119,7 +119,7 @@ function _val($val) */ for ($c = 0; $c < $strlen_var; ++$c) { - $ord_var_c = ord($val{$c}); + $ord_var_c = ord($val[$c]); switch (true) { case $ord_var_c == 0x08: @@ -142,18 +142,18 @@ function _val($val) case $ord_var_c == 0x2F: case $ord_var_c == 0x5C: // double quote, slash, slosh - $ascii .= '\\'.$val{$c}; + $ascii .= '\\'.$val[$c]; break; case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)): // characters U-00000000 - U-0000007F (same as ASCII) - $ascii .= $val{$c}; + $ascii .= $val[$c]; break; case (($ord_var_c & 0xE0) == 0xC0): // characters U-00000080 - U-000007FF, mask 110XXXXX // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - $char = pack('C*', $ord_var_c, ord($val{$c + 1})); + $char = pack('C*', $ord_var_c, ord($val[$c + 1])); $c += 1; $utf16 = utf82utf16($char); $ascii .= sprintf('\u%04s', bin2hex($utf16)); @@ -162,7 +162,7 @@ function _val($val) case (($ord_var_c & 0xF0) == 0xE0): // characters U-00000800 - U-0000FFFF, mask 1110XXXX // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - $char = pack('C*', $ord_var_c, ord($val{$c + 1}), ord($val{$c + 2})); + $char = pack('C*', $ord_var_c, ord($val[$c + 1]), ord($val[$c + 2])); $c += 2; $utf16 = utf82utf16($char); $ascii .= sprintf('\u%04s', bin2hex($utf16)); @@ -171,7 +171,7 @@ function _val($val) case (($ord_var_c & 0xF8) == 0xF0): // characters U-00010000 - U-001FFFFF, mask 11110XXX // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - $char = pack('C*', $ord_var_c, ord($val{$c + 1}), ord($val{$c + 2}), ord($val{$c + 3})); + $char = pack('C*', $ord_var_c, ord($val[$c + 1]), ord($val[$c + 2]), ord($val[$c + 3])); $c += 3; $utf16 = utf82utf16($char); $ascii .= sprintf('\u%04s', bin2hex($utf16)); @@ -180,7 +180,7 @@ function _val($val) case (($ord_var_c & 0xFC) == 0xF8): // characters U-00200000 - U-03FFFFFF, mask 111110XX // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - $char = pack('C*', $ord_var_c, ord($val{$c + 1}), ord($val{$c + 2}), ord($val{$c + 3}), ord($val{$c + 4})); + $char = pack('C*', $ord_var_c, ord($val[$c + 1]), ord($val[$c + 2]), ord($val[$c + 3]), ord($val[$c + 4])); $c += 4; $utf16 = utf82utf16($char); $ascii .= sprintf('\u%04s', bin2hex($utf16)); @@ -189,7 +189,7 @@ function _val($val) case (($ord_var_c & 0xFE) == 0xFC): // characters U-04000000 - U-7FFFFFFF, mask 1111110X // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - $char = pack('C*', $ord_var_c, ord($val{$c + 1}), ord($val{$c + 2}), ord($val{$c + 3}), ord($val{$c + 4}), ord($val{$c + 5})); + $char = pack('C*', $ord_var_c, ord($val[$c + 1]), ord($val[$c + 2]), ord($val[$c + 3]), ord($val[$c + 4]), ord($val[$c + 5])); $c += 5; $utf16 = utf82utf16($char); $ascii .= sprintf('\u%04s', bin2hex($utf16)); diff --git a/htdocs/core/modules/modAdherent.class.php b/htdocs/core/modules/modAdherent.class.php index 827928af6b6..300f071de1e 100644 --- a/htdocs/core/modules/modAdherent.class.php +++ b/htdocs/core/modules/modAdherent.class.php @@ -181,7 +181,10 @@ class modAdherent extends DolibarrModules // Boxes //------- - $this->boxes = array(0=>array('file'=>'box_members.php','enabledbydefaulton'=>'Home')); + $this->boxes = array( + 0=>array('file'=>'box_members.php','enabledbydefaulton'=>'Home'), + 2=>array('file'=>'box_birthdays_members.php','enabledbydefaulton'=>'Home') + ); // Permissions //------------ diff --git a/htdocs/core/modules/oauth/stripelive_oauthcallback.php b/htdocs/core/modules/oauth/stripelive_oauthcallback.php index cf2c2418092..a32223105b9 100644 --- a/htdocs/core/modules/oauth/stripelive_oauthcallback.php +++ b/htdocs/core/modules/oauth/stripelive_oauthcallback.php @@ -17,7 +17,7 @@ */ /** - * \file htdocs/core/modules/oauth/stripe_oauthcallback.php + * \file htdocs/core/modules/oauth/stripelive_oauthcallback.php * \ingroup oauth * \brief Page to get oauth callback */ @@ -45,7 +45,7 @@ $backtourl = GETPOST('backtourl', 'alpha'); $uriFactory = new \OAuth\Common\Http\Uri\UriFactory(); //$currentUri = $uriFactory->createFromSuperGlobalArray($_SERVER); //$currentUri->setQuery(''); -$currentUri = $uriFactory->createFromAbsolute($urlwithroot.'/core/modules/oauth/stripe_oauthcallback.php'); +$currentUri = $uriFactory->createFromAbsolute($urlwithroot.'/core/modules/oauth/stripelive_oauthcallback.php'); /** @@ -65,7 +65,7 @@ $storage = new DoliStorage($db, $conf); // Setup the credentials for the requests $credentials = new Credentials( - $conf->global->OAUTH_STRIPE_TEST_ID, + $conf->global->OAUTH_STRIPE_LIVE_ID, $conf->global->STRIPE_LIVE_SECRET_KEY, $currentUri->getAbsoluteUri() ); diff --git a/htdocs/core/modules/oauth/stripetest_oauthcallback.php b/htdocs/core/modules/oauth/stripetest_oauthcallback.php index eb7463749ae..55b532f231c 100644 --- a/htdocs/core/modules/oauth/stripetest_oauthcallback.php +++ b/htdocs/core/modules/oauth/stripetest_oauthcallback.php @@ -17,7 +17,7 @@ */ /** - * \file htdocs/core/modules/oauth/stripe_oauthcallback.php + * \file htdocs/core/modules/oauth/stripetest_oauthcallback.php * \ingroup oauth * \brief Page to get oauth callback */ @@ -45,7 +45,7 @@ $backtourl = GETPOST('backtourl', 'alpha'); $uriFactory = new \OAuth\Common\Http\Uri\UriFactory(); //$currentUri = $uriFactory->createFromSuperGlobalArray($_SERVER); //$currentUri->setQuery(''); -$currentUri = $uriFactory->createFromAbsolute($urlwithroot.'/core/modules/oauth/stripe_oauthcallback.php'); +$currentUri = $uriFactory->createFromAbsolute($urlwithroot.'/core/modules/oauth/stripetest_oauthcallback.php'); /** diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php index 3830e2bc31a..1f7d403b575 100644 --- a/htdocs/core/tpl/contacts.tpl.php +++ b/htdocs/core/tpl/contacts.tpl.php @@ -69,7 +69,7 @@ $userstatic=new User($db); if ($permission) { ?> |
'; + print '
';
print $langs->trans("Customer").': '.$soc->name;
+
+ $constantforkey = 'CASHDESK_NO_DECREASE_STOCK'.$_SESSION["takeposterminal"];
+ if (! empty($conf->stock->enabled) && $conf->global->$constantforkey != "1")
+ {
+ $constantforkey = 'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"];
+ $warehouse = new Entrepot($db);
+ $warehouse->fetch($conf->global->$constantforkey);
+ print '
'.$langs->trans("Warehouse").': '.$warehouse->ref;
+ }
print '
';
+ print $langs->trans("Member").': ';
+ $adh=new Adherent($db);
+ $result=$adh->fetch('', '', $invoice->socid);
+ if ($result > 0)
+ {
+ $adh->ref=$adh->getFullName($langs);
+ print $adh->getFullName($langs);
+ print '
'.$langs->trans("Type").': '.$adh->type;
+ if ($adh->datefin)
+ {
+ print '
'.$langs->trans("SubscriptionEndDate").': '.dol_print_date($adh->datefin, 'day');
+ if ($adh->hasDelay()) {
+ print " ".img_warning($langs->trans("Late"));
+ }
+ }
+ else
+ {
+ print $langs->trans("SubscriptionNotReceived");
+ if ($adh->statut > 0) print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated
+ }
+ }
+ else
+ {
+ print ''.$langs->trans("ThirdpartyNotLinkedToMember").'';
+ }
+ print '