Merge branch '11.0' of github.com:Dolibarr/dolibarr into 11.0_fix_showInputField_checkbox_selection

This commit is contained in:
ATM john 2021-04-30 12:22:31 +02:00
commit 6e4962bb39
11 changed files with 88 additions and 38 deletions

View File

@ -44,14 +44,14 @@ $search_mvt_num = GETPOST('search_mvt_num', 'int');
$search_doc_type = GETPOST("search_doc_type", 'alpha'); $search_doc_type = GETPOST("search_doc_type", 'alpha');
$search_doc_ref = GETPOST("search_doc_ref", 'alpha'); $search_doc_ref = GETPOST("search_doc_ref", 'alpha');
$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int')); $search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int'));
$search_date_end = dol_mktime(0, 0, 0, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int')); $search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int'));
$search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int')); $search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int'));
$search_date_creation_start = dol_mktime(0, 0, 0, GETPOST('date_creation_startmonth', 'int'), GETPOST('date_creation_startday', 'int'), GETPOST('date_creation_startyear', 'int')); $search_date_creation_start = dol_mktime(0, 0, 0, GETPOST('date_creation_startmonth', 'int'), GETPOST('date_creation_startday', 'int'), GETPOST('date_creation_startyear', 'int'));
$search_date_creation_end = dol_mktime(0, 0, 0, GETPOST('date_creation_endmonth', 'int'), GETPOST('date_creation_endday', 'int'), GETPOST('date_creation_endyear', 'int')); $search_date_creation_end = dol_mktime(23, 59, 59, GETPOST('date_creation_endmonth', 'int'), GETPOST('date_creation_endday', 'int'), GETPOST('date_creation_endyear', 'int'));
$search_date_modification_start = dol_mktime(0, 0, 0, GETPOST('date_modification_startmonth', 'int'), GETPOST('date_modification_startday', 'int'), GETPOST('date_modification_startyear', 'int')); $search_date_modification_start = dol_mktime(0, 0, 0, GETPOST('date_modification_startmonth', 'int'), GETPOST('date_modification_startday', 'int'), GETPOST('date_modification_startyear', 'int'));
$search_date_modification_end = dol_mktime(0, 0, 0, GETPOST('date_modification_endmonth', 'int'), GETPOST('date_modification_endday', 'int'), GETPOST('date_modification_endyear', 'int')); $search_date_modification_end = dol_mktime(23, 59, 59, GETPOST('date_modification_endmonth', 'int'), GETPOST('date_modification_endday', 'int'), GETPOST('date_modification_endyear', 'int'));
$search_date_export_start = dol_mktime(0, 0, 0, GETPOST('date_export_startmonth', 'int'), GETPOST('date_export_startday', 'int'), GETPOST('date_export_startyear', 'int')); $search_date_export_start = dol_mktime(0, 0, 0, GETPOST('date_export_startmonth', 'int'), GETPOST('date_export_startday', 'int'), GETPOST('date_export_startyear', 'int'));
$search_date_export_end = dol_mktime(0, 0, 0, GETPOST('date_export_endmonth', 'int'), GETPOST('date_export_endday', 'int'), GETPOST('date_export_endyear', 'int')); $search_date_export_end = dol_mktime(23, 59, 59, GETPOST('date_export_endmonth', 'int'), GETPOST('date_export_endday', 'int'), GETPOST('date_export_endyear', 'int'));
//var_dump($search_date_start);exit; //var_dump($search_date_start);exit;
if (GETPOST("button_delmvt_x") || GETPOST("button_delmvt.x") || GETPOST("button_delmvt")) { if (GETPOST("button_delmvt_x") || GETPOST("button_delmvt.x") || GETPOST("button_delmvt")) {

View File

@ -39,7 +39,7 @@ $langs->loadLangs(array("accountancy"));
$action = GETPOST('action', 'alpha'); $action = GETPOST('action', 'alpha');
$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int')); $search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int'));
$search_date_end = dol_mktime(0, 0, 0, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int')); $search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int'));
$search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int')); $search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int'));
$search_accountancy_code = GETPOST("search_accountancy_code"); $search_accountancy_code = GETPOST("search_accountancy_code");

View File

@ -857,7 +857,7 @@ while ($i < min($num, $limit))
else else
{ {
print '<td class="nowrap left">'; print '<td class="nowrap left">';
if ($obj->subscription == 'yes') if (!empty($obj->subscription))
{ {
print $langs->trans("SubscriptionNotReceived"); print $langs->trans("SubscriptionNotReceived");
if ($obj->statut > 0) print " ".img_warning(); if ($obj->statut > 0) print " ".img_warning();

View File

@ -511,7 +511,7 @@ if ($rowid > 0)
$sql .= " AND t.rowid = ".$object->id; $sql .= " AND t.rowid = ".$object->id;
if ($sall) if ($sall)
{ {
$sql .= natural_search(array("f.firstname", "d.lastname", "d.societe", "d.email", "d.login", "d.address", "d.town", "d.note_public", "d.note_private"), $sall); $sql .= natural_search(array("d.firstname", "d.lastname", "d.societe", "d.email", "d.login", "d.address", "d.town", "d.note_public", "d.note_private"), $sall);
} }
if ($status != '') if ($status != '')
{ {
@ -710,7 +710,7 @@ if ($rowid > 0)
else else
{ {
print '<td class="nowrap left">'; print '<td class="nowrap left">';
if ($objp->subscription == 'yes') if (!empty($objp->subscription))
{ {
print $langs->trans("SubscriptionNotReceived"); print $langs->trans("SubscriptionNotReceived");
if ($objp->statut > 0) print " ".img_warning(); if ($objp->statut > 0) print " ".img_warning();

View File

@ -640,6 +640,10 @@ class AdvanceTargetingMailing extends CommonObject
if ($arrayquery['options_'.$key]!=''){ if ($arrayquery['options_'.$key]!=''){
$sqlwhere[]= " (te.".$key." = ".$arrayquery['options_'.$key].")"; $sqlwhere[]= " (te.".$key." = ".$arrayquery['options_'.$key].")";
} }
} elseif ($extrafields->attributes[$elementtype]['type'][$key] == 'link') {
if ($arrayquery['options_'.$key] > 0) {
$sqlwhere[]= " (te.".$key." = ".((int) $arrayquery['options_'.$key]).")";
}
} else { } else {
if (is_array($arrayquery['options_'.$key])) { if (is_array($arrayquery['options_'.$key])) {
$sqlwhere[]= " (te.".$key." IN ('".implode("','", $arrayquery['options_'.$key])."'))"; $sqlwhere[]= " (te.".$key." IN ('".implode("','", $arrayquery['options_'.$key])."'))";
@ -666,7 +670,6 @@ class AdvanceTargetingMailing extends CommonObject
while ($i < $num) while ($i < $num)
{ {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$this->thirdparty_lines[$i] = $obj->rowid; $this->thirdparty_lines[$i] = $obj->rowid;
$i++; $i++;

View File

@ -109,28 +109,70 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->facture->
$object->fetch($id); $object->fetch($id);
if ($object->valide($user) > 0) if ($object->valide($user) > 0)
{ {
$db->commit();
// Loop on each invoice linked to this payment to rebuild PDF // Loop on each invoice linked to this payment to rebuild PDF
$factures = array(); if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
foreach ($factures as $id) $outputlangs = $langs;
{ if (!empty($_REQUEST['lang_id']))
$fac = new Facture($db); {
$fac->fetch($id); $outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
}
$outputlangs = $langs; $hidedetails = ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0;
if (!empty($_REQUEST['lang_id'])) $hidedesc = ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0;
{ $hideref = !empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0;
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $sql = 'SELECT f.rowid as facid';
} $sql .= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf,'.MAIN_DB_PREFIX.'facture as f,'.MAIN_DB_PREFIX.'societe as s';
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { $sql .= ' WHERE pf.fk_facture = f.rowid';
$fac->generateDocument($fac->modelpdf, $outputlangs); $sql .= ' AND f.fk_soc = s.rowid';
} $sql .= ' AND f.entity IN ('.getEntity('invoice').')';
$sql .= ' AND pf.fk_paiement = '.$object->id;
$resql = $db->query($sql);
if ($resql)
{
$i = 0;
$num = $db->num_rows($resql);
if ($num > 0)
{
while ($i < $num)
{
$objp = $db->fetch_object($resql);
$invoice = new Facture($db);
if ($invoice->fetch($objp->facid) <= 0) {
$errors++;
setEventMessage($invoice->error, $invoice->errors, 'errors');
break;
}
if ($invoice->generateDocument($invoice->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref) < 0) {
$errors++;
setEventMessage($invoice->error, $invoice->errors, 'errors');
break;
}
$i++;
}
}
$db->free($resql);
}
else
{
$errors++;
setEventMessage($db->error, $db->errors, 'errors');
}
} }
header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id); if (! $errors) {
exit; $db->commit();
header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id);
exit;
}
} }
else else
{ {

View File

@ -440,8 +440,13 @@ class Paiement extends CommonObject
$outputlangs = new Translate("", $conf); $outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
} }
$hidedetails = ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0;
$hidedesc = ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0;
$hideref = !empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0;
$ret = $invoice->fetch($facid); // Reload to get new records $ret = $invoice->fetch($facid); // Reload to get new records
$result = $invoice->generateDocument($invoice->modelpdf, $outputlangs); $result = $invoice->generateDocument($invoice->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result < 0) { if ($result < 0) {
setEventMessages($invoice->error, $invoice->errors, 'errors'); setEventMessages($invoice->error, $invoice->errors, 'errors');
$error++; $error++;

View File

@ -16,7 +16,7 @@
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2012-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2012-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2014 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2014 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2018-2021 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com> * Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2018 Christophe Battarel <christophe@altairis.fr> * Copyright (C) 2018 Christophe Battarel <christophe@altairis.fr>
@ -7020,7 +7020,7 @@ class Form
print '<input type="radio" name="idtolinkto" value='.$objp->rowid.'>'; print '<input type="radio" name="idtolinkto" value='.$objp->rowid.'>';
print '</td>'; print '</td>';
print '<td class="center">'.$objp->ref.'</td>'; print '<td class="center">'.$objp->ref.'</td>';
print '<td>'.$objp->ref_client.'</td>'; print '<td>'.(!empty($objp->ref_client)?$objp->ref_client:$objp->ref_supplier).'</td>';
print '<td class="right">'.price($objp->total_ht).'</td>'; print '<td class="right">'.price($objp->total_ht).'</td>';
print '<td>'.$objp->name.'</td>'; print '<td>'.$objp->name.'</td>';
print '</tr>'; print '</tr>';

View File

@ -902,11 +902,11 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '')
't.email', 't.email',
); );
//Social media //Social media
foreach ($socialnetworks as $key => $value) { // foreach ($socialnetworks as $key => $value) {
if ($value['active']) { // if ($value['active']) {
$searchAddressPhoneDBFields['t.'.$key] = "t.socialnetworks->'$.".$key."'"; // $searchAddressPhoneDBFields['t.'.$key] = "t.socialnetworks->'$.".$key."'";
} // }
} // }
if (!$sortorder) $sortorder = "ASC"; if (!$sortorder) $sortorder = "ASC";
if (!$sortfield) $sortfield = "t.lastname"; if (!$sortfield) $sortfield = "t.lastname";

View File

@ -289,9 +289,9 @@ if (! empty($_SESSION['dol_loginmesg']))
if (!empty($conf->global->MAIN_EASTER_EGG_COMMITSTRIP)) { if (!empty($conf->global->MAIN_EASTER_EGG_COMMITSTRIP)) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
if (substr($langs->defaultlang, 0, 2)=='fr') { if (substr($langs->defaultlang, 0, 2)=='fr') {
$resgetcommitstrip = getURLContent("http://www.commitstrip.com/fr/feed/"); $resgetcommitstrip = getURLContent("https://www.commitstrip.com/fr/feed/");
} else { } else {
$resgetcommitstrip = getURLContent("http://www.commitstrip.com/en/feed/"); $resgetcommitstrip = getURLContent("https://www.commitstrip.com/en/feed/");
} }
if ($resgetcommitstrip && $resgetcommitstrip['http_code'] == '200') if ($resgetcommitstrip && $resgetcommitstrip['http_code'] == '200')
{ {

View File

@ -331,7 +331,7 @@ if ($id > 0 || ! empty($ref))
else else
{ {
print '<td class="left nowrap">'; print '<td class="left nowrap">';
if ($objp->subscription == 'yes') if (!empty($objp->subscription))
{ {
print $langs->trans("SubscriptionNotReceived"); print $langs->trans("SubscriptionNotReceived");
if ($objp->statut > 0) print " ".img_warning(); if ($objp->statut > 0) print " ".img_warning();