Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
93a3a03dd2
@ -6,6 +6,7 @@
|
|||||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||||
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@inodbox.com>
|
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@inodbox.com>
|
||||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
* 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
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -30,6 +31,7 @@
|
|||||||
require '../main.inc.php';
|
require '../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.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/rssparser.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';
|
||||||
|
|
||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->load("admin");
|
$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="submit" class="button" value="'.$langs->trans("Add").'">';
|
||||||
print '<input type="hidden" name="action" value="add">';
|
print '<input type="hidden" name="action" value="add">';
|
||||||
print '<input type="hidden" name="norss" value="'.($lastexternalrss + 1).'">';
|
print '<input type="hidden" name="norss" value="'.($lastexternalrss + 1).'">';
|
||||||
print '</div><br><br>';
|
print '</div>';
|
||||||
|
|
||||||
print '</form>';
|
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 = "SELECT rowid, file, note FROM ".MAIN_DB_PREFIX."boxes_def";
|
||||||
$sql .= " WHERE file = 'box_external_rss.php'";
|
$sql .= " WHERE file = 'box_external_rss.php'";
|
||||||
@ -235,6 +241,7 @@ dol_syslog("select rss boxes", LOG_DEBUG);
|
|||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
|
$boxlist = InfoBox::listBoxes($db, 'activated', -1, null);
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
@ -312,6 +319,13 @@ if ($resql)
|
|||||||
print "</tr>";
|
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 '</table>';
|
||||||
|
|
||||||
print "</form>";
|
print "</form>";
|
||||||
@ -327,3 +341,23 @@ else
|
|||||||
// End of page
|
// End of page
|
||||||
llxFooter();
|
llxFooter();
|
||||||
$db->close();
|
$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;
|
||||||
|
}
|
||||||
|
|||||||
@ -1990,3 +1990,5 @@ EmailTemplate=Template for email
|
|||||||
EMailsWillHaveMessageID=Emails will have a tag 'References' matching this syntax
|
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.
|
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.
|
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
|
||||||
|
|||||||
@ -1120,7 +1120,7 @@ class Thirdparties extends DolibarrApi
|
|||||||
* @param int $id ID of thirdparty
|
* @param int $id ID of thirdparty
|
||||||
* @param array $request_data Request data
|
* @param array $request_data Request data
|
||||||
*
|
*
|
||||||
* @return object ID of thirdparty
|
* @return object BankAccount of thirdparty
|
||||||
*
|
*
|
||||||
* @url POST {id}/bankaccounts
|
* @url POST {id}/bankaccounts
|
||||||
*/
|
*/
|
||||||
@ -1129,7 +1129,9 @@ class Thirdparties extends DolibarrApi
|
|||||||
if (!DolibarrApiAccess::$user->rights->societe->creer) {
|
if (!DolibarrApiAccess::$user->rights->societe->creer) {
|
||||||
throw new RestException(401);
|
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 = new CompanyBankAccount($this->db);
|
||||||
|
|
||||||
$account->socid = $id;
|
$account->socid = $id;
|
||||||
@ -1141,11 +1143,17 @@ class Thirdparties extends DolibarrApi
|
|||||||
if ($account->create(DolibarrApiAccess::$user) < 0)
|
if ($account->create(DolibarrApiAccess::$user) < 0)
|
||||||
throw new RestException(500, 'Error creating Company Bank account');
|
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)
|
if ($account->update(DolibarrApiAccess::$user) < 0)
|
||||||
throw new RestException(500, 'Error updating values');
|
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 int $bankaccount_id ID of CompanyBankAccount
|
||||||
* @param array $request_data Request data
|
* @param array $request_data Request data
|
||||||
*
|
*
|
||||||
* @return object ID of thirdparty
|
* @return object BankAccount of thirdparty
|
||||||
*
|
*
|
||||||
* @url PUT {id}/bankaccounts/{bankaccount_id}
|
* @url PUT {id}/bankaccounts/{bankaccount_id}
|
||||||
*/
|
*/
|
||||||
@ -1164,7 +1172,9 @@ class Thirdparties extends DolibarrApi
|
|||||||
if (!DolibarrApiAccess::$user->rights->societe->creer) {
|
if (!DolibarrApiAccess::$user->rights->societe->creer) {
|
||||||
throw new RestException(401);
|
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 = new CompanyBankAccount($this->db);
|
||||||
|
|
||||||
$account->fetch($bankaccount_id, $id, -1, '');
|
$account->fetch($bankaccount_id, $id, -1, '');
|
||||||
@ -1178,10 +1188,17 @@ class Thirdparties extends DolibarrApi
|
|||||||
$account->$field = $value;
|
$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)
|
if ($account->update(DolibarrApiAccess::$user) < 0)
|
||||||
throw new RestException(500, 'Error updating values');
|
throw new RestException(500, 'Error updating values');
|
||||||
|
|
||||||
return $account;
|
return $this->_cleanObjectDatas($account);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user