Merge remote-tracking branch 'Dolibarr/11.0' into 11

This commit is contained in:
Francis Appels 2020-01-22 15:59:10 +01:00
commit 4372c3567f
19 changed files with 107 additions and 36 deletions

View File

@ -27,6 +27,7 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
// Load translation files required by the page
$langs->loadLangs(array("compta", "bills", "admin", "accountancy", "salaries"));
@ -180,6 +181,7 @@ if (empty($reshook))
*/
$form = new Form($db);
$formaccounting = new FormAccounting($db);
llxHeader('', $langs->trans("ListAccounts"));
@ -198,9 +200,42 @@ if ($db->type == 'pgsql') $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_accou
else $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as a2 ON a2.rowid = aa.account_parent AND a2.entity = ".$conf->entity;
$sql .= " WHERE asy.rowid = ".$pcgver;
//print $sql;
if (strlen(trim($search_account))) $sql .= natural_search("aa.account_number", $search_account);
if (strlen(trim($search_account))) {
$lengthpaddingaccount = 0;
if ($conf->global->ACCOUNTING_LENGTH_GACCOUNT || $conf->global->ACCOUNTING_LENGTH_AACCOUNT) {
$lengthpaddingaccount = max($conf->global->ACCOUNTING_LENGTH_GACCOUNT, $conf->global->ACCOUNTING_LENGTH_AACCOUNT);
}
$search_account_tmp = $search_account;
$weremovedsomezero = 0;
if (strlen($search_account_tmp) <= $lengthpaddingaccount) {
for($i = 0; $i < $lengthpaddingaccount; $i++) {
if (preg_match('/0$/', $search_account_tmp)) {
$weremovedsomezero++;
$search_account_tmp = preg_replace('/0$/', '', $search_account_tmp);
}
}
}
//var_dump($search_account); exit;
if ($search_account_tmp) {
if ($weremovedsomezero) {
$search_account_tmp_clean = $search_account_tmp;
$search_account_clean = $search_account;
$startchar = '%';
if (strpos($search_account_tmp, '^') === 0)
{
$startchar = '';
$search_account_tmp_clean = preg_replace('/^\^/', '', $search_account_tmp);
$search_account_clean = preg_replace('/^\^/', '', $search_account);
}
$sql .= " AND (aa.account_number LIKE '".$startchar.$search_account_tmp_clean."'";
$sql .= " OR aa.account_number LIKE '".$startchar.$search_account_clean."%')";
}
else $sql .= natural_search("aa.account_number", $search_account_tmp);
}
}
if (strlen(trim($search_label))) $sql .= natural_search("aa.label", $search_label);
if (strlen(trim($search_accountparent))) $sql .= natural_search("aa.account_parent", $search_accountparent);
if (strlen(trim($search_accountparent)) && $search_accountparent != '-1') $sql .= natural_search("aa.account_parent", $search_accountparent, 2);
if (strlen(trim($search_pcgtype))) $sql .= natural_search("aa.pcg_type", $search_pcgtype);
if (strlen(trim($search_pcgsubtype))) $sql .= natural_search("aa.pcg_subtype", $search_pcgsubtype);
$sql .= $db->order($sortfield, $sortorder);
@ -232,7 +267,7 @@ if ($resql)
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit;
if ($search_account) $param .= '&search_account='.urlencode($search_account);
if ($search_label) $param .= '&search_label='.urlencode($search_label);
if ($search_accountparent) $param .= '&search_accountparent='.urlencode($search_accountparent);
if ($search_accountparent > 0 || $search_accountparent == '0') $param .= '&search_accountparent='.urlencode($search_accountparent);
if ($search_pcgtype) $param .= '&search_pcgtype='.urlencode($search_pcgtype);
if ($search_pcgsubtype) $param .= '&search_pcgsubtype='.urlencode($search_pcgsubtype);
if ($optioncss != '') $param .= '&optioncss='.$optioncss;
@ -316,8 +351,12 @@ if ($resql)
print '<tr class="liste_titre_filter">';
if (!empty($arrayfields['aa.account_number']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_account" value="'.$search_account.'"></td>';
if (!empty($arrayfields['aa.label']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_label" value="'.$search_label.'"></td>';
if (!empty($arrayfields['aa.account_parent']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_accountparent" value="'.$search_accountparent.'"></td>';
if (!empty($arrayfields['aa.pcg_type']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_pcgtype" value="'.$search_pcgtype.'"></td>';
if (!empty($arrayfields['aa.account_parent']['checked'])) {
print '<td class="liste_titre">';
print $formaccounting->select_account($search_accountparent, 'search_accountparent', 2);
print '</td>';
}
if (!empty($arrayfields['aa.pcg_type']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_pcgtype" value="'.$search_pcgtype.'"></td>';
if (!empty($arrayfields['aa.pcg_subtype']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_pcgsubtype" value="'.$search_pcgsubtype.'"></td>';
if (!empty($arrayfields['aa.active']['checked'])) print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre maxwidthsearch">';
@ -339,6 +378,7 @@ if ($resql)
$accountstatic = new AccountingAccount($db);
$accountparent = new AccountingAccount($db);
$totalarray = array();
$i = 0;
while ($i < min($num, $limit))
{

View File

@ -791,16 +791,16 @@ class ActionComm extends CommonObject
*/
public function fetchResources()
{
$sql = 'SELECT fk_actioncomm, element_type, fk_element, answer_status, mandatory, transparency';
$this->userassigned = array();
$this->socpeopleassigned = array();
$sql = 'SELECT fk_actioncomm, element_type, fk_element, answer_status, mandatory, transparency';
$sql .= ' FROM '.MAIN_DB_PREFIX.'actioncomm_resources';
$sql .= ' WHERE fk_actioncomm = '.$this->id;
$sql .= " AND element_type IN ('user', 'socpeople')";
$resql = $this->db->query($sql);
if ($resql)
{
$this->userassigned = array();
$this->socpeopleassigned = array();
// If owner is known, we must but id first into list
if ($this->userownerid > 0) $this->userassigned[$this->userownerid] = array('id'=>$this->userownerid); // Set first so will be first into list.
@ -1393,7 +1393,11 @@ class ActionComm extends CommonObject
if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips
if ((!$user->rights->agenda->allactions->read && $this->authorid != $user->id) || (!$user->rights->agenda->myactions->read && $this->authorid == $user->id))
$canread = 0;
if ($user->rights->agenda->myactions->read && $this->authorid == $user->id) $canread = 1; // Can read my event
if ($user->rights->agenda->myactions->read && array_key_exists($user->id, $this->userassigned)) $canread = 1; // Can read my event i am assigned
if ($user->rights->agenda->allactions->read) $canread = 1; // Can read all event of other
if (! $canread)
{
$option = 'nolink';
}

View File

@ -1568,13 +1568,12 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
$titletoshow = $daterange;
$titletoshow .= ($titletoshow ? ' ' : '').($event->label ? $event->label : $event->libelle);
if ($event->type_code == 'ICALEVENT') print $titletoshow;
else
{
if ($event->type_code != 'ICALEVENT') {
$savlabel = $event->label ? $event->label : $event->libelle;
$event->label = $titletoshow;
$event->libelle = $titletoshow;
print $event->getNomUrl(0, $maxnbofchar, 'cal_event', '', 0, 0);
// Note: List of users are inside $event->userassigned. Link may be clickable depending on permissions of user.
$titletoshow = $event->getNomUrl(0, $maxnbofchar, 'cal_event', '', 0, 0);
$event->label = $savlabel;
$event->libelle = $savlabel;
}
@ -1595,6 +1594,8 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
$listofusertoshow .= $cacheusers[$tmpid]->getNomUrl(-3, '', 0, 0, 0, 0, '', 'paddingright valigntextbottom');
}
print $titletoshow;
print $listofusertoshow;
if ($event->type_code == 'ICALEVENT') print '<br>('.dol_trunc($event->icalname, $maxnbofchar).')';

View File

@ -554,7 +554,10 @@ if ($resql)
$actionstatic->type_picto = $obj->type_picto;
$actionstatic->label = $obj->label;
$actionstatic->location = $obj->location;
$actionstatic->note = dol_htmlentitiesbr($obj->note);
$actionstatic->note = dol_htmlentitiesbr($obj->note); // deprecated
$actionstatic->note_public = dol_htmlentitiesbr($obj->note);
$actionstatic->fetchResources();
print '<tr class="oddeven">';
@ -656,7 +659,6 @@ if ($resql)
if (!empty($arrayfields['a.fk_contact']['checked'])) {
print '<td>';
$actionstatic->fetchResources();
if (!empty($actionstatic->socpeopleassigned))
{
$contactList = array();

View File

@ -3432,7 +3432,6 @@ class Propal extends CommonObject
$xnbp++;
}
// var_dump($this->lines);exit;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps

View File

@ -5150,6 +5150,7 @@ elseif ($id > 0 || !empty($ref))
// For situation invoice with excess received
if ($object->statut > Facture::STATUS_DRAFT
&& $object->type == Facture::TYPE_SITUATION
&& ($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits) > 0
&& $usercancreate
&& !$objectidnext

View File

@ -6125,7 +6125,7 @@ abstract class CommonObject
$param_list_array = explode(':', $param_list[0]);
$showempty = (($required && $default != '') ? 0 : 1);
$out = $form->selectForForms($param_list[0], $keyprefix.$key.$keysuffix, $value, $showempty, '', '', $morecss, '', 0, empty($val['disabled']) ? 0 : 1);
$out = $form->selectForForms($param_list[0], $keyprefix.$key.$keysuffix, $value, $showempty, '', '', $morecss, $moreparam, 0, empty($val['disabled']) ? 0 : 1);
if (!empty($param_list_array[2])) // If we set to add a create button
{

View File

@ -5169,11 +5169,11 @@ class Form
{
if ($societe_vendeuse->id == $mysoc->id)
{
$return .= '<font class="error">'.$langs->trans("ErrorYourCountryIsNotDefined").'</div>';
$return .= '<font class="error">'.$langs->trans("ErrorYourCountryIsNotDefined").'</font>';
}
else
{
$return .= '<font class="error">'.$langs->trans("ErrorSupplierCountryIsNotDefined").'</div>';
$return .= '<font class="error">'.$langs->trans("ErrorSupplierCountryIsNotDefined").'</font>';
}
return $return;
}
@ -6235,7 +6235,12 @@ class Form
$out .= '<option value="'.$key.'"';
$out .= $style.$disabled;
if ($id != '' && $id == $key && !$disabled) $out .= ' selected'; // To preselect a value
if (is_array($id)) {
if (in_array($key, $id) && !$disabled) $out .= ' selected'; // To preselect a value
} else {
$id = (string) $id; // if $id = 0, then $id = '0'
if ($id != '' && $id == $key && !$disabled) $out .= ' selected'; // To preselect a value
}
if ($nohtmlescape) $out .= ' data-html="'.dol_escape_htmltag($selectOptionValue).'"';
if (is_array($tmpvalue))
{

View File

@ -309,7 +309,7 @@ class FormAccounting extends Form
return -1;
}
$selected = 0;
$selected = $selectid; // selectid can be -1, 0, 123
while ($obj = $this->db->fetch_object($resql))
{
$label = length_accountg($obj->account_number).' - '.$obj->label;

View File

@ -240,17 +240,17 @@ class modMrp extends DolibarrModules
// Add here entries to declare new permissions
/* BEGIN MODULEBUILDER PERMISSIONS */
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
$this->rights[$r][1] = 'Read objects of Mrp'; // Permission label
$this->rights[$r][1] = 'Read Manufacturing Order'; // Permission label
$this->rights[$r][4] = 'read'; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2)
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2)
$r++;
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
$this->rights[$r][1] = 'Create/Update objects of Mrp'; // Permission label
$this->rights[$r][1] = 'Create/Update Manufacturing Order'; // Permission label
$this->rights[$r][4] = 'write'; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2)
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2)
$r++;
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
$this->rights[$r][1] = 'Delete objects of Mrp'; // Permission label
$this->rights[$r][1] = 'Delete Manufacturing Order'; // Permission label
$this->rights[$r][4] = 'delete'; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2)
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2)
$r++;

View File

@ -878,7 +878,7 @@ Permission1251=Run mass imports of external data into database (data load)
Permission1321=Export customer invoices, attributes and payments
Permission1322=Reopen a paid bill
Permission1421=Export sales orders and attributes
Permission2401=Read actions (events or tasks) linked to his user account (if owner of event)
Permission2401=Read actions (events or tasks) linked to his user account (if owner of event or just assigned to)
Permission2402=Create/modify actions (events or tasks) linked to his user account (if owner of event)
Permission2403=Delete actions (events or tasks) linked to his user account (if owner of event)
Permission2411=Read actions (events or tasks) of others

View File

@ -840,9 +840,11 @@ class Product extends CommonObject
$this->height = price2num($this->height);
$this->height_units = trim($this->height_units);
// set unit not defined
if ($this->length_units) { $this->width_units = $this->length_units; // Not used yet
if (is_numeric($this->length_units)) {
$this->width_units = $this->length_units; // Not used yet
}
if ($this->length_units) { $this->height_units = $this->length_units; // Not used yet
if (is_numeric($this->length_units)) {
$this->height_units = $this->length_units; // Not used yet
}
// Automated compute surface and volume if not filled
if (empty($this->surface) && !empty($this->length) && !empty($this->width) && $this->length_units == $this->width_units) {

View File

@ -922,7 +922,10 @@ if ($resql)
// Type
if (!empty($arrayfields['p.fk_product_type']['checked']))
{
print '<td>'.$obj->fk_product_type.'</td>';
print '<td>';
if ($obj->fk_product_type == 0) print $langs->trans("Product");
else print $langs->trans("Service");
print '</td>';
if (!$i) $totalarray['nbfield']++;
}

View File

@ -110,6 +110,9 @@ img.demothumb {
@media only screen and (max-width: 767px)
{
.CTable {
width: 300px;
}
.demobody {
line-height: 150% !important;
font-size: 100% !important;

View File

@ -645,7 +645,7 @@ if ($action == 'charge' && !empty($conf->stripe->enabled))
\Stripe\Stripe::setApiKey($stripearrayofkeysbyenv[$servicestatus]['secret_key']);
try {
if (empty($key)) { // If the Stripe connect account not set, we use common API usage
if (empty($stripeacc)) { // If the Stripe connect account not set, we use common API usage
$paymentintent = \Stripe\PaymentIntent::retrieve($paymentintent_id);
} else {
$paymentintent = \Stripe\PaymentIntent::retrieve($paymentintent_id, array("stripe_account" => $stripeacc));

View File

@ -142,7 +142,11 @@ if (!$rowid)
}
if (! empty($charge->payment_intent)) {
$charge = \Stripe\PaymentIntent::retrieve($charge->payment_intent);
if (empty($stripeacc)) { // If the Stripe connect account not set, we use common API usage
$charge = \Stripe\PaymentIntent::retrieve($charge->payment_intent);
} else {
$charge = \Stripe\PaymentIntent::retrieve($charge->payment_intent, array("stripe_account" => $stripeacc));
}
}
// The metadata FULLTAG is defined by the online payment page

View File

@ -3512,6 +3512,7 @@ div.info {
padding-bottom: 8px;
margin: 1em 0em 1em 0em;
background: #eff8fc;
color: #666;
}
/* Warning message */

View File

@ -64,14 +64,13 @@ llxHeader();
print load_fiche_titre($langs->trans("MenuUsersAndGroups"));
//print '<table class="noborder centpercent notopnoleftnoright">';
//print '<tr><td valign="top" width="30%" class="notopnoleft">';
print '<div class="fichecenter"><div class="fichethirdleft">';
// Search User
print '<form method="post" action="'.DOL_URL_ROOT.'/core/search.php">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<table class="noborder nohover centpercent">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Search").'</td></tr>';
print '<tr><td>';
@ -86,6 +85,7 @@ if ($canreadperms)
print '<tr><td class="center" colspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>';
print "</table><br>\n";
print '</form>';
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
@ -124,6 +124,8 @@ $resql=$db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("LastUsersCreated", min($num, $max)).'</td>';
print '<td class="right"><a class="commonlink" href="'.DOL_URL_ROOT.'/user/list.php?sortfield=u.datec&sortorder=DESC">'.$langs->trans("FullList").'</td>';
@ -204,7 +206,8 @@ if ($resql)
print '</tr>';
$i++;
}
print "</table><br>";
print "</table>";
print "</div><br>";
$db->free($resql);
}
@ -240,6 +243,8 @@ if ($canreadperms)
$colspan=1;
if (! empty($conf->multicompany->enabled)) $colspan++;
$num = $db->num_rows($resql);
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td colspan="'.$colspan.'">'.$langs->trans("LastGroupsCreated", ($num ? $num : $max)).'</td>';
print '<td class="right"><a class="commonlink" href="'.DOL_URL_ROOT.'/user/group/list.php?sortfield=g.datec&sortorder=DESC">'.$langs->trans("FullList").'</td>';
@ -275,7 +280,8 @@ if ($canreadperms)
print "</tr>";
$i++;
}
print "</table><br>";
print "</table>";
print "</div><br>";
$db->free($resql);
}

View File

@ -519,7 +519,7 @@ while ($i < min($num, $limit))
print "<tr>";
if (! empty($arrayfields['u.login']['checked']))
{
print '<td>';
print '<td class="nowraponall">';
print $li;
if (! empty($conf->multicompany->enabled) && $obj->admin && ! $obj->entity)
{