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

This commit is contained in:
Laurent Destailleur 2020-04-13 13:32:25 +02:00
commit 93a3a03dd2
10 changed files with 90 additions and 37 deletions

View File

@ -37,7 +37,7 @@ $langs->loadLangs(array("users", "admin", "other"));
$action = GETPOST('action', 'aZ09');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'myobjectlist'; // To manage different context of search
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
// Load variable for pagination
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;

View File

@ -6,6 +6,7 @@
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.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
@ -30,6 +31,7 @@
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/rssparser.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';
// Load translation files required by the page
$langs->load("admin");
@ -222,10 +224,14 @@ print '<br><div class="center">';
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="norss" value="'.($lastexternalrss + 1).'">';
print '</div><br><br>';
print '</div>';
print '</form>';
print '<br>'.$langs->trans('RssNote');
print '<br><a href="'.DOL_MAIN_URL_ROOT.'/admin/boxes.php">'.$langs->trans('JumpToBoxes').'<a>';
print '<br><br>';
$sql = "SELECT rowid, file, note FROM ".MAIN_DB_PREFIX."boxes_def";
$sql .= " WHERE file = 'box_external_rss.php'";
@ -235,8 +241,9 @@ dol_syslog("select rss boxes", LOG_DEBUG);
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
$boxlist = InfoBox::listBoxes($db, 'activated', -1, null);
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num)
{
@ -312,6 +319,13 @@ if ($resql)
print "</tr>";
}
// Active
$active = _isInBoxList($idrss, $boxlist) ? 'yes' : 'no';
print '<tr class="oddeven">';
print '<td>'.$langs->trans('WidgetEnabled').'</td>';
print '<td>'.yesno($active).'</td>';
print "</tr>";
print '</table>';
print "</form>";
@ -327,3 +341,23 @@ else
// End of page
llxFooter();
$db->close();
/**
* Check if the given RSS feed if inside the list of boxes/widgets
*
* @param int $idrss The id of the RSS feed
* @param array $boxlist A list with boxes/widgets
* @return bool true if the rss feed is inside the box/widget list, otherwise false
*/
function _isInBoxList($idrss, array $boxlist)
{
foreach($boxlist as $box)
{
if($box->boxcode === "lastrssinfos" && strpos($box->note, $idrss) !== false)
{
return true;
}
}
return false;
}

View File

@ -544,7 +544,7 @@ class Categorie extends CommonObject
}
$sql .= ", visible = '".$this->db->escape($this->visible)."'";
$sql .= ", fk_parent = ".$this->fk_parent;
$sql .= ", fk_user_modif = ". (int) $user->id;
$sql .= ", fk_user_modif = ".(int) $user->id;
$sql .= " WHERE rowid = ".$this->id;
dol_syslog(get_class($this)."::update", LOG_DEBUG);

View File

@ -921,7 +921,7 @@ class ActionComm extends CommonObject
$res = $this->db->query($sql);
if (!$res) {
$this->error=$this->db->lasterror();
$this->error = $this->db->lasterror();
$error++;
}
}

View File

@ -243,7 +243,7 @@ class Account 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(
public $fields = array(
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
'ref' =>array('type'=>'varchar(12)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>25),
'label' =>array('type'=>'varchar(30)', 'label'=>'Label', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>30),

View File

@ -1990,3 +1990,5 @@ EmailTemplate=Template for email
EMailsWillHaveMessageID=Emails will have a tag 'References' matching this syntax
PDF_USE_ALSO_LANGUAGE_CODE=If you want to have some texts in your PDF duplicated in 2 different languages in the same generated PDF, you must set here this second language so generated PDF will contains 2 different languages in same page, the one chosen when generating PDF and this one (only few PDF templates support this). Keep empty for 1 language per PDF.
FafaIconSocialNetworksDesc=Enter here the code of a FontAwesome icon. If you don't know what is FontAwesome, you can use the generic value fa-address-book.
RssNote=Note: Each RSS feed must be separate activate as a widget to show it for a user.
JumpToBoxes=Jump to Setup -> Widgets

View File

@ -1120,7 +1120,7 @@ class Thirdparties extends DolibarrApi
* @param int $id ID of thirdparty
* @param array $request_data Request data
*
* @return object ID of thirdparty
* @return object BankAccount of thirdparty
*
* @url POST {id}/bankaccounts
*/
@ -1129,7 +1129,9 @@ class Thirdparties extends DolibarrApi
if (!DolibarrApiAccess::$user->rights->societe->creer) {
throw new RestException(401);
}
if ($this->company->fetch($id) <= 0) {
throw new RestException(404, 'Error creating Company Bank account, Company doesn\'t exists');
}
$account = new CompanyBankAccount($this->db);
$account->socid = $id;
@ -1141,11 +1143,17 @@ class Thirdparties extends DolibarrApi
if ($account->create(DolibarrApiAccess::$user) < 0)
throw new RestException(500, 'Error creating Company Bank account');
if (empty($account->rum)) {
require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
$prelevement = new BonPrelevement($this->db);
$account->rum = $prelevement->buildRumNumber($this->company->code_client, $account->datec, $account->id);
$account->date_rum = dol_now();
}
if ($account->update(DolibarrApiAccess::$user) < 0)
throw new RestException(500, 'Error updating values');
return $account;
return $this->_cleanObjectDatas($account);
}
/**
@ -1155,7 +1163,7 @@ class Thirdparties extends DolibarrApi
* @param int $bankaccount_id ID of CompanyBankAccount
* @param array $request_data Request data
*
* @return object ID of thirdparty
* @return object BankAccount of thirdparty
*
* @url PUT {id}/bankaccounts/{bankaccount_id}
*/
@ -1164,7 +1172,9 @@ class Thirdparties extends DolibarrApi
if (!DolibarrApiAccess::$user->rights->societe->creer) {
throw new RestException(401);
}
if ($this->company->fetch($id) <= 0) {
throw new RestException(404, 'Error creating Company Bank account, Company doesn\'t exists');
}
$account = new CompanyBankAccount($this->db);
$account->fetch($bankaccount_id, $id, -1, '');
@ -1178,10 +1188,17 @@ class Thirdparties extends DolibarrApi
$account->$field = $value;
}
if (empty($account->rum)) {
require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
$prelevement = new BonPrelevement($this->db);
$account->rum = $prelevement->buildRumNumber($this->company->code_client, $account->datec, $account->id);
$account->date_rum = dol_now();
}
if ($account->update(DolibarrApiAccess::$user) < 0)
throw new RestException(500, 'Error updating values');
return $account;
return $this->_cleanObjectDatas($account);
}
/**

View File

@ -536,13 +536,13 @@ if ($action == "order" and $placeid != 0)
}
if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter" && $linestoprint > 0) {
$invoice->fetch($placeid); //Reload object before send to printer
$printer->orderprinter=1;
$printer->orderprinter = 1;
$ret = $printer->sendToPrinter($invoice, $conf->global->{'TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS'.$_SESSION["takeposterminal"]}, $conf->global->{'TAKEPOS_ORDER_PRINTER1_TO_USE'.$_SESSION["takeposterminal"]}); // PRINT TO PRINTER 1
}
$sql = "UPDATE ".MAIN_DB_PREFIX."facturedet set special_code='4' where special_code='1' and fk_facture=".$invoice->id; // Set as printed
$db->query($sql);
$invoice->fetch($placeid); //Reload object after set lines as printed
$linestoprint=0;
$linestoprint = 0;
foreach ($invoice->lines as $line)
{
@ -564,7 +564,7 @@ if ($action == "order" and $placeid != 0)
}
if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter" && $linestoprint > 0) {
$invoice->fetch($placeid); //Reload object before send to printer
$printer->orderprinter=2;
$printer->orderprinter = 2;
$ret = $printer->sendToPrinter($invoice, $conf->global->{'TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS'.$_SESSION["takeposterminal"]}, $conf->global->{'TAKEPOS_ORDER_PRINTER2_TO_USE'.$_SESSION["takeposterminal"]}); // PRINT TO PRINTER 2
}
$sql = "UPDATE ".MAIN_DB_PREFIX."facturedet set special_code='4' where special_code='2' and fk_facture=".$invoice->id; // Set as printed
@ -712,8 +712,8 @@ function TakeposPrinting(id){
function TakeposConnector(id){
var invoice='<?php
$data=json_encode($invoice);
$data=base64_encode($data);
$data = json_encode($invoice);
$data = base64_encode($data);
echo $data;
?>';
$.ajax({

View File

@ -378,7 +378,7 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco
$morehtmlright = '';
if ($account->id == 0) {
$morehtmlright = dolGetButtonTitle($langs->trans('Add'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=create');
$morehtmlright = dolGetButtonTitle($langs->trans('Add'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=create');
}
print load_fiche_titre($langs->trans("BankAccounts"), $morehtmlright, 'bank_account');
@ -395,49 +395,49 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch ');
print "</tr>\n";
if($account->id > 0) {
if ($account->id > 0) {
print '<tr class="oddeven">';
// Label
print '<td>' . $account->label . '</td>';
print '<td>'.$account->label.'</td>';
// Bank name
print '<td>' . $account->bank . '</td>';
print '<td>'.$account->bank.'</td>';
// Account number
print '<td>';
$string = '';
foreach ($account->getFieldsToShow() as $val) {
if ($val == 'BankCode') {
$string .= $account->code_banque . ' ';
$string .= $account->code_banque.' ';
} elseif ($val == 'BankAccountNumber') {
$string .= $account->number . ' ';
$string .= $account->number.' ';
} elseif ($val == 'DeskCode') {
$string .= $account->code_guichet . ' ';
$string .= $account->code_guichet.' ';
} elseif ($val == 'BankAccountNumberKey') {
$string .= $account->cle_rib . ' ';
$string .= $account->cle_rib.' ';
}
}
if (!empty($account->label) && $account->number) {
if (!checkBanForAccount($account)) {
$string .= ' ' . img_picto($langs->trans("ValueIsNotValid"), 'warning');
$string .= ' '.img_picto($langs->trans("ValueIsNotValid"), 'warning');
} else {
$string .= ' ' . img_picto($langs->trans("ValueIsValid"), 'info');
$string .= ' '.img_picto($langs->trans("ValueIsValid"), 'info');
}
}
print $string;
print '</td>';
// IBAN
print '<td>' . $account->iban;
print '<td>'.$account->iban;
if (!empty($account->iban)) {
if (!checkIbanForAccount($account)) {
print ' ' . img_picto($langs->trans("IbanNotValid"), 'warning');
print ' '.img_picto($langs->trans("IbanNotValid"), 'warning');
}
}
print '</td>';
// BIC
print '<td>' . $account->bic;
print '<td>'.$account->bic;
if (!empty($account->bic)) {
if (!checkSwiftForAccount($account)) {
print ' ' . img_picto($langs->trans("SwiftNotValid"), 'warning');
print ' '.img_picto($langs->trans("SwiftNotValid"), 'warning');
}
}
print '</td>';
@ -445,7 +445,7 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco
// Edit/Delete
print '<td class="right nowraponall">';
if ($user->rights->hrm->employee->write || $user->rights->user->creer) {
print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&bankid=' . $account->id . '&action=edit">';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&bankid='.$account->id.'&action=edit">';
print img_picto($langs->trans("Modify"), 'edit');
print '</a>';
}

View File

@ -360,7 +360,7 @@ if ($action == 'unsetshowsubcontainers')
exit;
}
if (($action == 'replacesite' || $action == 'replacesiteconfirm') && ! $searchkey)
if (($action == 'replacesite' || $action == 'replacesiteconfirm') && !$searchkey)
{
$action = 'replacesite';
}
@ -373,13 +373,13 @@ if ($massaction == 'replace' && GETPOST('confirmmassaction', 'alpha'))
if (empty($user->rights->website->writephp)) {
setEventMessages("NotAllowedToAddDynamicContent", null, 'errors');
}
elseif (! $replacestring) {
elseif (!$replacestring) {
setEventMessages("ErrorReplaceStringEmpty", null, 'errors');
}
else {
$nbreplacement = 0;
foreach($toselect as $keyselected) {
foreach ($toselect as $keyselected) {
$objectpage = $listofpages['list'][$keyselected];
if ($objectpage->pageurl) {
dol_syslog("Replace string into page ".$objectpage->pageurl);
@ -3543,7 +3543,7 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm' || $massaction =
$massactionbutton .= '<div class="massactionother hidden">';
$massactionbutton .= $langs->trans("ReplaceString");
$massactionbutton .= '<input type="text" name="replacestring" value="'.dol_escape_htmltag(GETPOST('replacestring', 'none')).'">';
$massactionbutton .='</div>';
$massactionbutton .= '</div>';
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
//$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields