Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2021-05-07 12:25:25 +02:00
commit 0632cf5b81
7 changed files with 58 additions and 22 deletions

View File

@ -11,7 +11,7 @@
* Copyright (C) 2011-2016 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
*
* 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

View File

@ -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;

View File

@ -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);
}
}

View File

@ -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)
{

View File

@ -6,6 +6,7 @@
* Copyright (C) 2012 J. Fernando Lagrange <fernando@demo-tic.org>
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2021 Waël Almoman <info@almoman.com>
*
* 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();
});
});
});
</script>';
@ -561,7 +566,7 @@ if (empty($conf->global->MEMBER_NEWFORM_FORCETYPE)) {
$isempty = 0;
}
print '<tr><td class="titlefield">'.$langs->trans("Type").' <FONT COLOR="red">*</FONT></td><td>';
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 '</td></tr>'."\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 '<tr><td>'.$langs->trans("Subscription").'</td><td class="nowrap">';
if (!empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) {

View File

@ -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 .= '&amp;mode='.urlencode($mode);
}
if ($search_categ > 0) {
$param .= "&amp;search_categ=".urlencode($search_categ);
$param .= '&amp;search_categ='.urlencode($search_categ);
}
if ($search_warehouse > 0) {
$param .= '&amp;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 .= '<div class="divsearchfield">';
$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 .= '</div>';
}
// 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 .= '<div class="divsearchfield">';
$tmptitle = $langs->trans('Warehouse');
$moreforfilter .= img_picto($tmptitle, 'stock', 'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse, 'search_warehouse', '', $tmptitle, 0, 0, $tmptitle);
$moreforfilter .= '</div>';
}

View File

@ -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;