diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 68e579697d3..c2a54e31a3a 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -11,7 +11,7 @@ * Copyright (C) 2011-2016 Alexandre Spangaro * Copyright (C) 2015 Ferran Marcet * Copyright (C) 2016 Raphaël Doursenaud - * Copyright (C) 2018-2020 Frédéric France + * Copyright (C) 2018-2021 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -339,7 +339,7 @@ if (empty($reshook)) { $sql = "INSERT INTO ".$tabname[$id]." ("; // List of fields $sql .= $tabfieldinsert[$id]; - $sql .= ", active, enabled)"; + $sql .= ", active, enabled)"; $sql .= " VALUES("; // List of values diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 0a094a8ab7b..8c29a9ffc36 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -1693,8 +1693,7 @@ class Account extends CommonObject { $sql = "UPDATE ".MAIN_DB_PREFIX."bank_url SET url_id = ".((int) $dest_id)." WHERE url_id = ".((int) $origin_id)." AND type='company'"; - if (!$db->query($sql)) - { + if (!$db->query($sql)) { //if ($ignoreerrors) return true; // TODO Not enough. If there is A-B on kept thirdarty and B-C on old one, we must get A-B-C after merge. Not A-B. //$this->errors = $db->lasterror(); return false; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 1e97b424b8f..9ce3948efdf 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8385,12 +8385,12 @@ function complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, // No need to make a return $head. Var is modified as a reference if (!empty($hookmanager)) { - $parameters = array('object' => $object, 'mode' => $mode, 'head' => $head); + $parameters = array('object' => $object, 'mode' => $mode, 'head' => &$head); $reshook = $hookmanager->executeHooks('completeTabsHead', $parameters); if ($reshook > 0) { $head = $hookmanager->resArray; - $h = count($head); } + $h = count($head); } } diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index a42e12fd412..77ae16d9d2d 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -101,24 +101,30 @@ class Partnership extends CommonObject * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields=array(); + + /** + * @var int rowid + * @deprecated + * @see id + */ public $rowid; - public $ref; + public $fk_soc; - public $note_public; - public $note_private; - public $date_creation; + public $tms; public $fk_user_creat; public $fk_user_modif; - public $last_main_doc; - public $import_key; - public $model_pdf; + public $status; public $fk_member; public $date_partnership_start; public $date_partnership_end; public $count_last_url_check_error; public $last_check_backlink; + + /** + * @var string reason_decline_or_cancel + */ public $reason_decline_or_cancel; // END MODULEBUILDER PROPERTIES @@ -848,9 +854,10 @@ class Partnership extends CommonObject /** * Set refused status * - * @param User $user Object user that modify - * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers - * @return int <0 if KO, 0=Nothing done, >0 if OK + * @param User $user Object user that modify + * @param string $reasondeclinenote Reason decline + * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers + * @return int <0 if KO, 0=Nothing done, >0 if OK */ public function refused($user, $reasondeclinenote = '', $notrigger = 0) { diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 233bc483d06..71446b58779 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -6,6 +6,7 @@ * Copyright (C) 2012 J. Fernando Lagrange * Copyright (C) 2018-2019 Frédéric France * Copyright (C) 2018 Alexandre Spangaro + * Copyright (C) 2021 Waël Almoman * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -543,6 +544,10 @@ jQuery(document).ready(function () { document.newmember.action.value="create"; document.newmember.submit(); }); + jQuery("#typeid").change(function() { + document.newmember.action.value="create"; + document.newmember.submit(); + }); }); }); '; @@ -561,7 +566,7 @@ if (empty($conf->global->MEMBER_NEWFORM_FORCETYPE)) { $isempty = 0; } print ''.$langs->trans("Type").' *'; - print $form->selectarray("typeid", $adht->liste_array(), GETPOST('typeid') ? GETPOST('typeid') : $defaulttype, $isempty); + print $form->selectarray("typeid", $adht->liste_array(1), GETPOST('typeid') ? GETPOST('typeid') : $defaulttype, $isempty); print ''."\n"; } else { $adht->fetch($conf->global->MEMBER_NEWFORM_FORCETYPE); @@ -704,7 +709,8 @@ if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT) || !empty($conf->global->MEMBER // $conf->global->MEMBER_NEWFORM_SHOWAMOUNT is an amount // Set amount for the subscription - $amount = isset($amount) ? $amount : 0; + $amountbytype = $adht->amountByType(1); + $amount = !empty($amountbytype[GETPOST('typeid', 'int')]) ? $amountbytype[GETPOST('typeid', 'int')] : (isset($amount) ? $amount : 0); if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { $amount = $conf->global->MEMBER_NEWFORM_AMOUNT; @@ -713,6 +719,9 @@ if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT) || !empty($conf->global->MEMBER if (!empty($conf->global->MEMBER_NEWFORM_PAYONLINE)) { $amount = $amount ? $amount : (GETPOST('amount') ? GETPOST('amount') : $conf->global->MEMBER_NEWFORM_AMOUNT); } + + $amount = price2num($amount); + // $conf->global->MEMBER_NEWFORM_PAYONLINE is 'paypal', 'paybox' or 'stripe' print ''.$langs->trans("Subscription").''; if (!empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) { diff --git a/htdocs/user/list.php b/htdocs/user/list.php index afe08969e45..a697fdf96c0 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -154,6 +154,7 @@ $search_email = GETPOST('search_email', 'alpha'); $search_api_key = GETPOST('search_api_key', 'alphanohtml'); $search_statut = GETPOST('search_statut', 'intcomma'); $search_thirdparty = GETPOST('search_thirdparty', 'alpha'); +$search_warehouse = GETPOST('search_warehouse', 'alpha'); $search_supervisor = GETPOST('search_supervisor', 'intcomma'); $optioncss = GETPOST('optioncss', 'alpha'); $search_categ = GETPOST("search_categ", 'int'); @@ -230,6 +231,7 @@ if (empty($reshook)) { $search_email = ""; $search_statut = ""; $search_thirdparty = ""; + $search_warehouse = ""; $search_supervisor = ""; $search_api_key = ""; $search_datelastlogin = ""; @@ -369,6 +371,9 @@ if ($search_supervisor > 0) { if ($search_thirdparty != '') { $sql .= natural_search(array('s.nom'), $search_thirdparty); } +if ($search_warehouse != '') { + $sql .= natural_search(array('u.fk_warehouse'), $search_warehouse); +} if ($search_login != '') { $sql .= natural_search("u.login", $search_login); } @@ -417,6 +422,9 @@ if ($search_categ > 0) { if ($search_categ == -2) { $sql .= " AND cu.fk_categorie IS NULL"; } +if ($search_warehouse > 0) { + $sql .= " AND u.fk_warehouse = ".$db->escape($search_warehouse); +} if ($mode == 'employee' && empty($user->rights->salaries->readall)) { $sql .= " AND u.rowid IN (".$db->sanitize(join(',', $childids)).")"; } @@ -524,7 +532,10 @@ if ($mode != '') { $param .= '&mode='.urlencode($mode); } if ($search_categ > 0) { - $param .= "&search_categ=".urlencode($search_categ); + $param .= '&search_categ='.urlencode($search_categ); +} +if ($search_warehouse > 0) { + $param .= '&search_warehouse='.urlencode($search_warehouse); } // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; @@ -602,8 +613,17 @@ $moreforfilter = ''; // Filter on categories if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) { $moreforfilter .= '
'; - $moreforfilter .= img_picto($langs->trans("Category"), 'category', 'class="paddingright"'); - $moreforfilter .= $formother->select_categories(Categorie::TYPE_USER, $search_categ, 'search_categ', 1); + $tmptitle = $langs->trans('Category'); + $moreforfilter .= img_picto($langs->trans("Category"), 'category', 'class="pictofixedwidth"').$formother->select_categories(Categorie::TYPE_USER, $search_categ, 'search_categ', 1, $tmptitle); + $moreforfilter .= '
'; +} +// Filter on warehouse +if (!empty($conf->stock->enabled) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER)) { + require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; + $formproduct = new FormProduct($db); + $moreforfilter .= '
'; + $tmptitle = $langs->trans('Warehouse'); + $moreforfilter .= img_picto($tmptitle, 'stock', 'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse, 'search_warehouse', '', $tmptitle, 0, 0, $tmptitle); $moreforfilter .= '
'; } diff --git a/test/phpunit/CodingPhpTest.php b/test/phpunit/CodingPhpTest.php index b3250b9e265..37fc7eee703 100644 --- a/test/phpunit/CodingPhpTest.php +++ b/test/phpunit/CodingPhpTest.php @@ -219,7 +219,8 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase 'multicurrency.class.php', 'productbatch.class.php', 'reception.class.php', - 'societe.class.php' + 'societe.class.php' , + 'account.class.php' ))) { // Must must not found $db-> $ok=true;