Merge remote-tracking branch 'upstream/develop' into zapieruser
This commit is contained in:
commit
be4a4cb54b
@ -17,8 +17,10 @@ filter:
|
|||||||
- build/*
|
- build/*
|
||||||
- dev/*
|
- dev/*
|
||||||
- doc/*
|
- doc/*
|
||||||
- test/*
|
- documents/*
|
||||||
- htdocs/includes/*
|
- htdocs/includes/*
|
||||||
|
- node_modules/*
|
||||||
|
- test/*
|
||||||
paths:
|
paths:
|
||||||
- htdocs/*
|
- htdocs/*
|
||||||
- scripts/*
|
- scripts/*
|
||||||
|
|||||||
@ -15,6 +15,7 @@ NEW: Accountancy - Add options to disable binding on sales, purchases & expense
|
|||||||
NEW: Accountancy balance - Add a input to show subtotal by group
|
NEW: Accountancy balance - Add a input to show subtotal by group
|
||||||
NEW: Accountancy - Move to real ledger, real journals, menu disposition
|
NEW: Accountancy - Move to real ledger, real journals, menu disposition
|
||||||
NEW: Accountancy - On transfers, select the periodicity by default
|
NEW: Accountancy - On transfers, select the periodicity by default
|
||||||
|
NEW: New currency rate editor.
|
||||||
NEW: Add 2 rules for emailcollector: Message send/not sent from Dolibarr
|
NEW: Add 2 rules for emailcollector: Message send/not sent from Dolibarr
|
||||||
NEW: Add a counter of number of words of pages in website module
|
NEW: Add a counter of number of words of pages in website module
|
||||||
NEW: add alert before change thirdparty in takepos
|
NEW: add alert before change thirdparty in takepos
|
||||||
|
|||||||
@ -400,9 +400,9 @@ $moreforfilter .= '<div class="divsearchfield">';
|
|||||||
$moreforfilter .= $langs->trans('AccountAccounting').': ';
|
$moreforfilter .= $langs->trans('AccountAccounting').': ';
|
||||||
$moreforfilter .= '<div class="nowrap inline-block">';
|
$moreforfilter .= '<div class="nowrap inline-block">';
|
||||||
$moreforfilter .= $langs->trans('From').' ';
|
$moreforfilter .= $langs->trans('From').' ';
|
||||||
$moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_start, 'search_accountancy_code_start', 1, array(), 1, 1, 'maxwidth200');
|
$moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_start, 'search_accountancy_code_start', 1, 'maxwidth200');
|
||||||
$moreforfilter .= ' '.$langs->trans('to').' ';
|
$moreforfilter .= ' '.$langs->trans('to').' ';
|
||||||
$moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_end, 'search_accountancy_code_end', 1, array(), 1, 1, 'maxwidth200');
|
$moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_end, 'search_accountancy_code_end', 1, 'maxwidth200');
|
||||||
$moreforfilter .= '</div>';
|
$moreforfilter .= '</div>';
|
||||||
$moreforfilter .= '</div>';
|
$moreforfilter .= '</div>';
|
||||||
|
|
||||||
|
|||||||
@ -707,7 +707,7 @@ class AdherentType extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public function initAsSpecimen()
|
public function initAsSpecimen()
|
||||||
{
|
{
|
||||||
global $conf, $user, $langs;
|
global $user;
|
||||||
|
|
||||||
// Initialise parametres
|
// Initialise parametres
|
||||||
$this->id = 0;
|
$this->id = 0;
|
||||||
@ -735,46 +735,10 @@ class AdherentType extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public function getMailOnValid()
|
public function getMailOnValid()
|
||||||
{
|
{
|
||||||
global $conf;
|
|
||||||
|
|
||||||
if (!empty($this->mail_valid) && trim(dol_htmlentitiesbr_decode($this->mail_valid))) {
|
if (!empty($this->mail_valid) && trim(dol_htmlentitiesbr_decode($this->mail_valid))) {
|
||||||
return $this->mail_valid;
|
return $this->mail_valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* getMailOnSubscription
|
|
||||||
*
|
|
||||||
* @return string Return mail content of type or empty
|
|
||||||
*/
|
|
||||||
public function getMailOnSubscription()
|
|
||||||
{
|
|
||||||
global $conf;
|
|
||||||
|
|
||||||
// mail_subscription not defined so never used
|
|
||||||
if (!empty($this->mail_subscription) && trim(dol_htmlentitiesbr_decode($this->mail_subscription))) { // Property not yet defined
|
|
||||||
return $this->mail_subscription;
|
|
||||||
}
|
|
||||||
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* getMailOnResiliate
|
|
||||||
*
|
|
||||||
* @return string Return mail model content of type or empty
|
|
||||||
*/
|
|
||||||
public function getMailOnResiliate()
|
|
||||||
{
|
|
||||||
global $conf;
|
|
||||||
|
|
||||||
// NOTE mail_resiliate not defined so never used
|
|
||||||
if (!empty($this->mail_resiliate) && trim(dol_htmlentitiesbr_decode($this->mail_resiliate))) { // Property not yet defined
|
|
||||||
return $this->mail_resiliate;
|
|
||||||
}
|
|
||||||
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -221,6 +221,62 @@ class DolibarrApi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($object->thirdparty) && is_object($object->thirdparty))
|
||||||
|
{
|
||||||
|
$this->_cleanObjectDatas($object->thirdparty);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove the $oldcopy property because it is not supported by the JSON
|
||||||
|
// encoder. The following error is generated when trying to serialize
|
||||||
|
// it: "Error encoding/decoding JSON: Type is not supported"
|
||||||
|
// Note: Event if this property was correctly handled by the JSON
|
||||||
|
// encoder, it should be ignored because keeping it would let the API
|
||||||
|
// have a very strange behavior: calling PUT and then GET on the same
|
||||||
|
// resource would give different results:
|
||||||
|
// PUT /objects/{id} -> returns object with oldcopy = previous version of the object
|
||||||
|
// GET /objects/{id} -> returns object with oldcopy empty
|
||||||
|
unset($object->oldcopy);
|
||||||
|
|
||||||
|
// If object has lines, remove $db property
|
||||||
|
if (isset($object->lines) && is_array($object->lines) && count($object->lines) > 0) {
|
||||||
|
$nboflines = count($object->lines);
|
||||||
|
for ($i = 0; $i < $nboflines; $i++)
|
||||||
|
{
|
||||||
|
$this->_cleanObjectDatas($object->lines[$i]);
|
||||||
|
|
||||||
|
unset($object->lines[$i]->contact);
|
||||||
|
unset($object->lines[$i]->contact_id);
|
||||||
|
unset($object->lines[$i]->country);
|
||||||
|
unset($object->lines[$i]->country_id);
|
||||||
|
unset($object->lines[$i]->country_code);
|
||||||
|
unset($object->lines[$i]->mode_reglement_id);
|
||||||
|
unset($object->lines[$i]->mode_reglement_code);
|
||||||
|
unset($object->lines[$i]->mode_reglement);
|
||||||
|
unset($object->lines[$i]->cond_reglement_id);
|
||||||
|
unset($object->lines[$i]->cond_reglement_code);
|
||||||
|
unset($object->lines[$i]->cond_reglement);
|
||||||
|
unset($object->lines[$i]->fk_delivery_address);
|
||||||
|
unset($object->lines[$i]->fk_projet);
|
||||||
|
unset($object->lines[$i]->fk_project);
|
||||||
|
unset($object->lines[$i]->thirdparty);
|
||||||
|
unset($object->lines[$i]->user);
|
||||||
|
unset($object->lines[$i]->model_pdf);
|
||||||
|
unset($object->lines[$i]->modelpdf);
|
||||||
|
unset($object->lines[$i]->note_public);
|
||||||
|
unset($object->lines[$i]->note_private);
|
||||||
|
unset($object->lines[$i]->fk_incoterms);
|
||||||
|
unset($object->lines[$i]->label_incoterms);
|
||||||
|
unset($object->lines[$i]->location_incoterms);
|
||||||
|
unset($object->lines[$i]->name);
|
||||||
|
unset($object->lines[$i]->lastname);
|
||||||
|
unset($object->lines[$i]->firstname);
|
||||||
|
unset($object->lines[$i]->civility_id);
|
||||||
|
unset($object->lines[$i]->fk_multicurrency);
|
||||||
|
unset($object->lines[$i]->multicurrency_code);
|
||||||
|
unset($object->lines[$i]->shipping_method_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($object->thirdparty) && is_object($object->thirdparty))
|
if (!empty($object->thirdparty) && is_object($object->thirdparty))
|
||||||
{
|
{
|
||||||
$this->_cleanObjectDatas($object->thirdparty);
|
$this->_cleanObjectDatas($object->thirdparty);
|
||||||
|
|||||||
@ -130,9 +130,6 @@ class Asset extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public $description;
|
public $description;
|
||||||
|
|
||||||
public $note_public;
|
|
||||||
public $note_private;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var integer|string date_creation
|
* @var integer|string date_creation
|
||||||
*/
|
*/
|
||||||
@ -151,6 +148,9 @@ class Asset extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public $fk_user_modif;
|
public $fk_user_modif;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string import key
|
||||||
|
*/
|
||||||
public $import_key;
|
public $import_key;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -13,7 +13,7 @@
|
|||||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||||
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
|
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
|
||||||
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
|
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -214,8 +214,6 @@ class Propal extends CommonObject
|
|||||||
public $labelStatus = array();
|
public $labelStatus = array();
|
||||||
public $labelStatusShort = array();
|
public $labelStatusShort = array();
|
||||||
|
|
||||||
public $specimen;
|
|
||||||
|
|
||||||
// Multicurrency
|
// Multicurrency
|
||||||
/**
|
/**
|
||||||
* @var int ID
|
* @var int ID
|
||||||
|
|||||||
@ -95,6 +95,9 @@ class Facture extends CommonInvoice
|
|||||||
*/
|
*/
|
||||||
protected $table_ref_field = 'ref';
|
protected $table_ref_field = 'ref';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int thirdparty ID
|
||||||
|
*/
|
||||||
public $socid;
|
public $socid;
|
||||||
|
|
||||||
public $author;
|
public $author;
|
||||||
@ -111,6 +114,10 @@ class Facture extends CommonInvoice
|
|||||||
|
|
||||||
public $date; // Date invoice
|
public $date; // Date invoice
|
||||||
public $datem;
|
public $datem;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string customer ref
|
||||||
|
*/
|
||||||
public $ref_client;
|
public $ref_client;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -169,7 +176,6 @@ class Facture extends CommonInvoice
|
|||||||
|
|
||||||
public $line;
|
public $line;
|
||||||
public $extraparams = array();
|
public $extraparams = array();
|
||||||
public $specimen;
|
|
||||||
|
|
||||||
public $fac_rec;
|
public $fac_rec;
|
||||||
|
|
||||||
|
|||||||
@ -12,7 +12,7 @@
|
|||||||
* Copyright (C) 2017 ATM Consulting <support@atm-consulting.fr>
|
* Copyright (C) 2017 ATM Consulting <support@atm-consulting.fr>
|
||||||
* Copyright (C) 2017-2019 Nicolas ZABOURI <info@inovea-conseil.com>
|
* Copyright (C) 2017-2019 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||||
* Copyright (C) 2017 Rui Strecht <rui.strecht@aliartalentos.com>
|
* Copyright (C) 2017 Rui Strecht <rui.strecht@aliartalentos.com>
|
||||||
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
|
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
|
||||||
* Copyright (C) 2018 Josep Lluís Amador <joseplluis@lliuretic.cat>
|
* Copyright (C) 2018 Josep Lluís Amador <joseplluis@lliuretic.cat>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -334,6 +334,13 @@ abstract class CommonObject
|
|||||||
*/
|
*/
|
||||||
public $last_main_doc;
|
public $last_main_doc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int Bank account ID
|
||||||
|
* @deprecated
|
||||||
|
* @see $fk_account
|
||||||
|
*/
|
||||||
|
public $fk_bank;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int Bank account ID
|
* @var int Bank account ID
|
||||||
* @see SetBankAccount()
|
* @see SetBankAccount()
|
||||||
@ -437,6 +444,11 @@ abstract class CommonObject
|
|||||||
|
|
||||||
public $next_prev_filter;
|
public $next_prev_filter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int 1 if object is specimen
|
||||||
|
*/
|
||||||
|
public $specimen = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array List of child tables. To test if we can delete object.
|
* @var array List of child tables. To test if we can delete object.
|
||||||
*/
|
*/
|
||||||
@ -6306,7 +6318,8 @@ abstract class CommonObject
|
|||||||
$param_list = array_keys($param['options']); // $param_list='ObjectName:classPath[:AddCreateButtonOrNot[:Filter]]'
|
$param_list = array_keys($param['options']); // $param_list='ObjectName:classPath[:AddCreateButtonOrNot[:Filter]]'
|
||||||
$param_list_array = explode(':', $param_list[0]);
|
$param_list_array = explode(':', $param_list[0]);
|
||||||
$showempty = (($required && $default != '') ? 0 : 1);
|
$showempty = (($required && $default != '') ? 0 : 1);
|
||||||
if (!empty($param_list_array[2])) { // If the entry into $fields is set to add a create button
|
|
||||||
|
if (!preg_match('/search_/', $keyprefix) && !empty($param_list_array[2])) { // If the entry into $fields is set to add a create button
|
||||||
$morecss .= ' widthcentpercentminusx';
|
$morecss .= ' widthcentpercentminusx';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -5048,9 +5048,11 @@ class Form
|
|||||||
* @param string $selected preselected currency code
|
* @param string $selected preselected currency code
|
||||||
* @param string $htmlname name of HTML select list
|
* @param string $htmlname name of HTML select list
|
||||||
* @param integer $useempty 1=Add empty line
|
* @param integer $useempty 1=Add empty line
|
||||||
|
* @param string $filter Optional filters criteras (example: 'code <> x', ' in (1,3)')
|
||||||
|
* @param bool $excludeConfCurrency false = If company current currency not in table, we add it into list. Should always be available. true = we are in currency_rate update , we don't want to see conf->currency in select
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function selectMultiCurrency($selected = '', $htmlname = 'multicurrency_code', $useempty = 0)
|
public function selectMultiCurrency($selected = '', $htmlname = 'multicurrency_code', $useempty = 0, $filter = '', $excludeConfCurrency = false)
|
||||||
{
|
{
|
||||||
global $db, $conf, $langs, $user;
|
global $db, $conf, $langs, $user;
|
||||||
|
|
||||||
@ -5060,6 +5062,7 @@ class Form
|
|||||||
|
|
||||||
$sql = 'SELECT code FROM '.MAIN_DB_PREFIX.'multicurrency';
|
$sql = 'SELECT code FROM '.MAIN_DB_PREFIX.'multicurrency';
|
||||||
$sql .= " WHERE entity IN ('".getEntity('mutlicurrency')."')";
|
$sql .= " WHERE entity IN ('".getEntity('mutlicurrency')."')";
|
||||||
|
if ($filter) $sql .= " AND ".$filter;
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
@ -5070,7 +5073,7 @@ class Form
|
|||||||
$out .= '<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'">';
|
$out .= '<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'">';
|
||||||
if ($useempty) $out .= '<option value=""> </option>';
|
if ($useempty) $out .= '<option value=""> </option>';
|
||||||
// If company current currency not in table, we add it into list. Should always be available.
|
// If company current currency not in table, we add it into list. Should always be available.
|
||||||
if (!in_array($conf->currency, $TCurrency))
|
if (!in_array($conf->currency, $TCurrency) && !$excludeConfCurrency)
|
||||||
{
|
{
|
||||||
$TCurrency[$conf->currency] = $conf->currency;
|
$TCurrency[$conf->currency] = $conf->currency;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -42,7 +42,6 @@ abstract class Stats
|
|||||||
* @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month
|
* @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month
|
||||||
* @param int $startmonth month of the fiscal year start min 1 max 12 ; if 1 = january
|
* @param int $startmonth month of the fiscal year start min 1 max 12 ; if 1 = january
|
||||||
* @return array Array of values
|
* @return array Array of values
|
||||||
|
|
||||||
*/
|
*/
|
||||||
public function getNbByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0, $format = 0, $startmonth = 1)
|
public function getNbByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0, $format = 0, $startmonth = 1)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -943,7 +943,6 @@ function monthArray($outputlangs, $short = 0)
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Return array of week numbers.
|
* Return array of week numbers.
|
||||||
|
|
||||||
*
|
*
|
||||||
* @param int $month Month number
|
* @param int $month Month number
|
||||||
* @param int $year Year number
|
* @param int $year Year number
|
||||||
@ -961,7 +960,6 @@ function getWeekNumbersOfMonth($month, $year)
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Return array of first day of weeks.
|
* Return array of first day of weeks.
|
||||||
|
|
||||||
*
|
*
|
||||||
* @param array $TWeek array of week numbers
|
* @param array $TWeek array of week numbers
|
||||||
* @param int $year Year number
|
* @param int $year Year number
|
||||||
@ -978,7 +976,6 @@ function getFirstDayOfEachWeek($TWeek, $year)
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Return array of last day of weeks.
|
* Return array of last day of weeks.
|
||||||
|
|
||||||
*
|
*
|
||||||
* @param array $TWeek array of week numbers
|
* @param array $TWeek array of week numbers
|
||||||
* @param int $year Year number
|
* @param int $year Year number
|
||||||
@ -994,7 +991,6 @@ function getLastDayOfEachWeek($TWeek, $year)
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Return week number.
|
* Return week number.
|
||||||
|
|
||||||
*
|
*
|
||||||
* @param int $day Day number
|
* @param int $day Day number
|
||||||
* @param int $month Month number
|
* @param int $month Month number
|
||||||
|
|||||||
@ -5662,11 +5662,12 @@ function picto_required()
|
|||||||
* @param integer $removelinefeed 1=Replace all new lines by 1 space, 0=Only ending new lines are removed others are replaced with \n, 2=Ending new lines are removed but others are kept with a same number of \n than nb of <br> when there is both "...<br>\n..."
|
* @param integer $removelinefeed 1=Replace all new lines by 1 space, 0=Only ending new lines are removed others are replaced with \n, 2=Ending new lines are removed but others are kept with a same number of \n than nb of <br> when there is both "...<br>\n..."
|
||||||
* @param string $pagecodeto Encoding of input/output string
|
* @param string $pagecodeto Encoding of input/output string
|
||||||
* @param integer $strip_tags 0=Use internal strip, 1=Use strip_tags() php function (bugged when text contains a < char that is not for a html tag)
|
* @param integer $strip_tags 0=Use internal strip, 1=Use strip_tags() php function (bugged when text contains a < char that is not for a html tag)
|
||||||
|
* @param integer $removedoublespaces Replace double space into one space
|
||||||
* @return string String cleaned
|
* @return string String cleaned
|
||||||
*
|
*
|
||||||
* @see dol_escape_htmltag() strip_tags() dol_string_onlythesehtmltags() dol_string_neverthesehtmltags(), dolStripPhpCode()
|
* @see dol_escape_htmltag() strip_tags() dol_string_onlythesehtmltags() dol_string_neverthesehtmltags(), dolStripPhpCode()
|
||||||
*/
|
*/
|
||||||
function dol_string_nohtmltag($stringtoclean, $removelinefeed = 1, $pagecodeto = 'UTF-8', $strip_tags = 0)
|
function dol_string_nohtmltag($stringtoclean, $removelinefeed = 1, $pagecodeto = 'UTF-8', $strip_tags = 0, $removedoublespaces = 1)
|
||||||
{
|
{
|
||||||
if ($removelinefeed == 2) $stringtoclean = preg_replace('/<br[^>]*>(\n|\r)+/ims', '<br>', $stringtoclean);
|
if ($removelinefeed == 2) $stringtoclean = preg_replace('/<br[^>]*>(\n|\r)+/ims', '<br>', $stringtoclean);
|
||||||
$temp = preg_replace('/<br[^>]*>/i', "\n", $stringtoclean);
|
$temp = preg_replace('/<br[^>]*>/i', "\n", $stringtoclean);
|
||||||
@ -5685,14 +5686,17 @@ function dol_string_nohtmltag($stringtoclean, $removelinefeed = 1, $pagecodeto =
|
|||||||
// $temp after pass 2: 0000-021
|
// $temp after pass 2: 0000-021
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove also CR LF
|
$temp = dol_html_entity_decode($temp, ENT_COMPAT, $pagecodeto);
|
||||||
|
|
||||||
|
// Remove also carriage returns
|
||||||
if ($removelinefeed == 1) $temp = str_replace(array("\r\n", "\r", "\n"), " ", $temp);
|
if ($removelinefeed == 1) $temp = str_replace(array("\r\n", "\r", "\n"), " ", $temp);
|
||||||
|
|
||||||
// and double spaces
|
// And double quotes
|
||||||
while (strpos($temp, " "))
|
if ($removedoublespaces) {
|
||||||
{
|
while (strpos($temp, " ")) {
|
||||||
$temp = str_replace(" ", " ", $temp);
|
$temp = str_replace(" ", " ", $temp);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return trim($temp);
|
return trim($temp);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -40,6 +40,11 @@ function multicurrencyAdminPrepareHead()
|
|||||||
$head[$h][2] = 'settings';
|
$head[$h][2] = 'settings';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
|
$head[$h][0] = dol_buildpath("/multicurrency/multicurrency_rate.php", 1);
|
||||||
|
$head[$h][1] = $langs->trans("TabTitleMulticurrencyRate");
|
||||||
|
$head[$h][2] = 'ratelist';
|
||||||
|
$h++;
|
||||||
|
|
||||||
complete_head_from_modules($conf, $langs, null, $head, $h, 'multicurrency');
|
complete_head_from_modules($conf, $langs, null, $head, $h, 'multicurrency');
|
||||||
|
|
||||||
complete_head_from_modules($conf, $langs, null, $head, $h, 'multicurrency', 'remove');
|
complete_head_from_modules($conf, $langs, null, $head, $h, 'multicurrency', 'remove');
|
||||||
|
|||||||
@ -80,6 +80,7 @@ class InterfaceZapierTriggers extends DolibarrTriggers
|
|||||||
$actions = explode('_', $action);
|
$actions = explode('_', $action);
|
||||||
$sql = 'SELECT rowid, url FROM '.MAIN_DB_PREFIX.'zapier_hook';
|
$sql = 'SELECT rowid, url FROM '.MAIN_DB_PREFIX.'zapier_hook';
|
||||||
$sql .= ' WHERE module="'.$this->db->escape(strtolower($actions[0])).'" AND action="'.$this->db->escape(strtolower($actions[1])).'"';
|
$sql .= ' WHERE module="'.$this->db->escape(strtolower($actions[0])).'" AND action="'.$this->db->escape(strtolower($actions[1])).'"';
|
||||||
|
//setEventMessages($sql, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
@ -130,6 +131,7 @@ class InterfaceZapierTriggers extends DolibarrTriggers
|
|||||||
$json = json_encode($cleaned);
|
$json = json_encode($cleaned);
|
||||||
// call the zapierPostWebhook() function
|
// call the zapierPostWebhook() function
|
||||||
zapierPostWebhook($obj['url'], $json);
|
zapierPostWebhook($obj['url'], $json);
|
||||||
|
//setEventMessages($obj['url'], null);
|
||||||
}
|
}
|
||||||
$logtriggeraction = true;
|
$logtriggeraction = true;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -577,3 +577,6 @@ UnitPriceXQtyLessDiscount=Unit price x Qty - Discount
|
|||||||
CustomersInvoicesArea=Customer billing area
|
CustomersInvoicesArea=Customer billing area
|
||||||
SupplierInvoicesArea=Supplier billing area
|
SupplierInvoicesArea=Supplier billing area
|
||||||
FacParentLine=Invoice Line Parent
|
FacParentLine=Invoice Line Parent
|
||||||
|
SituationTotalRayToRest=Remainder to pay without taxe
|
||||||
|
PDFSituationTitle=Situation n° %d
|
||||||
|
SituationTotalProgress=Total progress %d %%
|
||||||
|
|||||||
@ -20,3 +20,19 @@ MulticurrencyPaymentAmount=Payment amount, original currency
|
|||||||
AmountToOthercurrency=Amount To (in currency of receiving account)
|
AmountToOthercurrency=Amount To (in currency of receiving account)
|
||||||
CurrencyRateSyncSucceed=Currency rate synchronization done successfuly
|
CurrencyRateSyncSucceed=Currency rate synchronization done successfuly
|
||||||
MULTICURRENCY_USE_CURRENCY_ON_DOCUMENT=Use the currency of the document for online payments
|
MULTICURRENCY_USE_CURRENCY_ON_DOCUMENT=Use the currency of the document for online payments
|
||||||
|
TabTitleMulticurrencyRate=Rate list
|
||||||
|
ListCurrencyRate=List of exchange rates for the currency
|
||||||
|
CreateRate=Create a rate
|
||||||
|
FormCreateRate=Rate creation
|
||||||
|
FormUpdateRate=Rate modification
|
||||||
|
successRateCreate=Rate for currency %s has been added to the database
|
||||||
|
ConfirmDeleteLineRate=Are you sure you want to remove the %s rate for currency %s on %s date?
|
||||||
|
DeleteLineRate=Clear rate
|
||||||
|
successRateDelete=Rate deleted
|
||||||
|
errorRateDelete=Error when deleting the rate
|
||||||
|
successUpdateRate=Modification made
|
||||||
|
ErrorUpdateRate=Error when changing the rate
|
||||||
|
Codemulticurrency=currency code
|
||||||
|
UpdateRate=change the rate
|
||||||
|
CancelUpdate=cancel
|
||||||
|
NoEmptyRate=The rate field must not be empty
|
||||||
|
|||||||
@ -575,3 +575,6 @@ BILL_SUPPLIER_DELETEInDolibarr=Facture fournisseur supprimée
|
|||||||
UnitPriceXQtyLessDiscount=Prix unitaire x Qté - Remise
|
UnitPriceXQtyLessDiscount=Prix unitaire x Qté - Remise
|
||||||
CustomersInvoicesArea=Zone de facturation client
|
CustomersInvoicesArea=Zone de facturation client
|
||||||
SupplierInvoicesArea=Zone de facturation fournisseur
|
SupplierInvoicesArea=Zone de facturation fournisseur
|
||||||
|
SituationTotalRayToRest=Reste à payer total HT
|
||||||
|
PDFSituationTitle=Situation n° %d
|
||||||
|
SituationTotalProgress=Total progression %d %%
|
||||||
|
|||||||
@ -447,7 +447,7 @@ foreach ($object->fields as $key => $val)
|
|||||||
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
|
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
|
||||||
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
|
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
|
||||||
elseif (strpos($val['type'], 'integer:') === 0) {
|
elseif (strpos($val['type'], 'integer:') === 0) {
|
||||||
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
|
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth125', 1);
|
||||||
} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
|
} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -102,12 +102,12 @@ class Mo extends CommonObject
|
|||||||
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>42, 'notnull'=>-1, 'searchall'=>1, 'showoncombobox'=>'1',),
|
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>42, 'notnull'=>-1, 'searchall'=>1, 'showoncombobox'=>'1',),
|
||||||
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'css'=>'maxwidth300'),
|
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'css'=>'maxwidth300'),
|
||||||
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>51, 'notnull'=>-1, 'index'=>1,),
|
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>51, 'notnull'=>-1, 'index'=>1,),
|
||||||
'fk_warehouse' => array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php:0', 'label'=>'WarehouseForProduction', 'enabled'=>1, 'visible'=>-1, 'position'=>52, 'css'=>'maxwidth300'),
|
'fk_warehouse' => array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php:0', 'label'=>'WarehouseForProduction', 'enabled'=>1, 'visible'=>1, 'position'=>52, 'css'=>'maxwidth300'),
|
||||||
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61, 'notnull'=>-1,),
|
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61, 'notnull'=>-1,),
|
||||||
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>62, 'notnull'=>-1,),
|
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>62, 'notnull'=>-1,),
|
||||||
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>500, 'notnull'=>1,),
|
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>500, 'notnull'=>1,),
|
||||||
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'position'=>501, 'notnull'=>-1,),
|
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'position'=>501, 'notnull'=>-1,),
|
||||||
'date_valid' => array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>2, 'position'=>502,),
|
'date_valid' => array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>502,),
|
||||||
'fk_user_creat' => array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'position'=>510, 'notnull'=>1, 'foreignkey'=>'user.rowid',),
|
'fk_user_creat' => array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'position'=>510, 'notnull'=>1, 'foreignkey'=>'user.rowid',),
|
||||||
'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'position'=>511, 'notnull'=>-1,),
|
'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'position'=>511, 'notnull'=>-1,),
|
||||||
'date_start_planned' => array('type'=>'datetime', 'label'=>'DateStartPlannedMo', 'enabled'=>1, 'visible'=>1, 'position'=>55, 'notnull'=>-1, 'index'=>1, 'help'=>'KeepEmptyForAsap'),
|
'date_start_planned' => array('type'=>'datetime', 'label'=>'DateStartPlannedMo', 'enabled'=>1, 'visible'=>1, 'position'=>55, 'notnull'=>-1, 'index'=>1, 'help'=>'KeepEmptyForAsap'),
|
||||||
|
|||||||
@ -394,7 +394,7 @@ foreach ($object->fields as $key => $val)
|
|||||||
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
|
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
|
||||||
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
|
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
|
||||||
elseif (strpos($val['type'], 'integer:') === 0) {
|
elseif (strpos($val['type'], 'integer:') === 0) {
|
||||||
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
|
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth125', 1);
|
||||||
} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
|
} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -105,21 +105,21 @@ $objectlist = new MouvementStock($db);
|
|||||||
|
|
||||||
// Definition of fields for list
|
// Definition of fields for list
|
||||||
$arrayfields = array(
|
$arrayfields = array(
|
||||||
'm.rowid'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
|
'm.rowid'=>array('label'=>$langs->trans("Ref"), 'checked'=>1, 'position'=>1),
|
||||||
'm.datem'=>array('label'=>$langs->trans("Date"), 'checked'=>1),
|
'm.datem'=>array('label'=>$langs->trans("Date"), 'checked'=>1, 'position'=>2),
|
||||||
'p.ref'=>array('label'=>$langs->trans("ProductRef"), 'checked'=>1, 'css'=>'maxwidth100'),
|
'p.ref'=>array('label'=>$langs->trans("ProductRef"), 'checked'=>1, 'css'=>'maxwidth100', 'position'=>10),
|
||||||
'p.label'=>array('label'=>$langs->trans("ProductLabel"), 'checked'=>1),
|
'p.label'=>array('label'=>$langs->trans("ProductLabel"), 'checked'=>1, 'position'=>15),
|
||||||
'm.batch'=>array('label'=>$langs->trans("BatchNumberShort"), 'checked'=>1, 'enabled'=>(!empty($conf->productbatch->enabled))),
|
'm.batch'=>array('label'=>$langs->trans("BatchNumberShort"), 'checked'=>1, 'enabled'=>(!empty($conf->productbatch->enabled)), 'position'=>20),
|
||||||
'pl.eatby'=>array('label'=>$langs->trans("EatByDate"), 'checked'=>0, 'position'=>10, 'enabled'=>(!empty($conf->productbatch->enabled))),
|
'pl.eatby'=>array('label'=>$langs->trans("EatByDate"), 'checked'=>0, 'position'=>10, 'enabled'=>(!empty($conf->productbatch->enabled)), 'position'=>21),
|
||||||
'pl.sellby'=>array('label'=>$langs->trans("SellByDate"), 'checked'=>0, 'position'=>10, 'enabled'=>(!empty($conf->productbatch->enabled))),
|
'pl.sellby'=>array('label'=>$langs->trans("SellByDate"), 'checked'=>0, 'position'=>10, 'enabled'=>(!empty($conf->productbatch->enabled)), 'position'=>22),
|
||||||
'e.ref'=>array('label'=>$langs->trans("Warehouse"), 'checked'=>1),
|
'e.ref'=>array('label'=>$langs->trans("Warehouse"), 'checked'=>1, 'position'=>30),
|
||||||
'm.fk_user_author'=>array('label'=>$langs->trans("Author"), 'checked'=>0),
|
'm.fk_user_author'=>array('label'=>$langs->trans("Author"), 'checked'=>0, 'position'=>40),
|
||||||
'm.inventorycode'=>array('label'=>$langs->trans("InventoryCodeShort"), 'checked'=>1),
|
'm.inventorycode'=>array('label'=>$langs->trans("InventoryCodeShort"), 'checked'=>1, 'position'=>42),
|
||||||
'm.label'=>array('label'=>$langs->trans("MovementLabel"), 'checked'=>1),
|
'm.label'=>array('label'=>$langs->trans("MovementLabel"), 'checked'=>1, 'position'=>45),
|
||||||
'm.type_mouvement'=>array('label'=>$langs->trans("TypeMovement"), 'checked'=>1),
|
'm.type_mouvement'=>array('label'=>$langs->trans("TypeMovement"), 'checked'=>1, 'position'=>48),
|
||||||
'origin'=>array('label'=>$langs->trans("Origin"), 'enabled'=>0, 'checked'=>0),
|
'origin'=>array('label'=>$langs->trans("Origin"), 'enabled'=>0, 'checked'=>0, 'position'=>50),
|
||||||
'm.value'=>array('label'=>$langs->trans("Qty"), 'checked'=>1),
|
'm.value'=>array('label'=>$langs->trans("Qty"), 'checked'=>1, 'position'=>60),
|
||||||
'm.price'=>array('label'=>$langs->trans("UnitPurchaseValue"), 'enabled'=>0, 'checked'=>0),
|
'm.price'=>array('label'=>$langs->trans("UnitPurchaseValue"), 'enabled'=>0, 'checked'=>0, 'position'=>62),
|
||||||
//'m.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
//'m.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
||||||
//'m.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500)
|
//'m.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500)
|
||||||
);
|
);
|
||||||
|
|||||||
@ -687,6 +687,7 @@ class MultiCurrency extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class CurrencyRate
|
* Class CurrencyRate
|
||||||
*/
|
*/
|
||||||
@ -727,6 +728,7 @@ class CurrencyRate extends CommonObjectLine
|
|||||||
*/
|
*/
|
||||||
public $entity;
|
public $entity;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
@ -744,7 +746,6 @@ class CurrencyRate extends CommonObjectLine
|
|||||||
*
|
*
|
||||||
* @param int $fk_multicurrency Id of currency
|
* @param int $fk_multicurrency Id of currency
|
||||||
* @param bool $trigger true=launch triggers after, false=disable triggers
|
* @param bool $trigger true=launch triggers after, false=disable triggers
|
||||||
*
|
|
||||||
* @return int <0 if KO, Id of created object if OK
|
* @return int <0 if KO, Id of created object if OK
|
||||||
*/
|
*/
|
||||||
public function create($fk_multicurrency, $trigger = true)
|
public function create($fk_multicurrency, $trigger = true)
|
||||||
@ -756,7 +757,7 @@ class CurrencyRate extends CommonObjectLine
|
|||||||
$error = 0;
|
$error = 0;
|
||||||
$this->rate = price2num($this->rate);
|
$this->rate = price2num($this->rate);
|
||||||
if (empty($this->entity) || $this->entity <= 0) $this->entity = $conf->entity;
|
if (empty($this->entity) || $this->entity <= 0) $this->entity = $conf->entity;
|
||||||
$now = date('Y-m-d H:i:s');
|
$now = empty($this->date_sync) ? dol_now() : $this->date_sync;
|
||||||
|
|
||||||
// Insert request
|
// Insert request
|
||||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.$this->table_element.'(';
|
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.$this->table_element.'(';
|
||||||
@ -766,9 +767,9 @@ class CurrencyRate extends CommonObjectLine
|
|||||||
$sql .= ' entity';
|
$sql .= ' entity';
|
||||||
$sql .= ') VALUES (';
|
$sql .= ') VALUES (';
|
||||||
$sql .= ' '.$this->rate.',';
|
$sql .= ' '.$this->rate.',';
|
||||||
$sql .= ' \''.$now.'\',';
|
$sql .= " '".$this->db->idate($now)."',";
|
||||||
$sql .= ' \''.$fk_multicurrency.'\',';
|
$sql .= " ".((int) $fk_multicurrency).",";
|
||||||
$sql .= ' \''.$this->entity.'\'';
|
$sql .= " ".((int) $this->entity);
|
||||||
$sql .= ')';
|
$sql .= ')';
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
@ -807,7 +808,6 @@ class CurrencyRate extends CommonObjectLine
|
|||||||
* Load object in memory from the database
|
* Load object in memory from the database
|
||||||
*
|
*
|
||||||
* @param int $id Id object
|
* @param int $id Id object
|
||||||
*
|
|
||||||
* @return int <0 if KO, 0 if not found, >0 if OK
|
* @return int <0 if KO, 0 if not found, >0 if OK
|
||||||
*/
|
*/
|
||||||
public function fetch($id)
|
public function fetch($id)
|
||||||
@ -827,7 +827,7 @@ class CurrencyRate extends CommonObjectLine
|
|||||||
|
|
||||||
$this->id = $obj->rowid;
|
$this->id = $obj->rowid;
|
||||||
$this->rate = $obj->rate;
|
$this->rate = $obj->rate;
|
||||||
$this->date_sync = $obj->date_sync;
|
$this->date_sync = $this->db->jdate($obj->date_sync);
|
||||||
$this->fk_multicurrency = $obj->fk_multicurrency;
|
$this->fk_multicurrency = $obj->fk_multicurrency;
|
||||||
$this->entity = $obj->entity;
|
$this->entity = $obj->entity;
|
||||||
}
|
}
|
||||||
@ -850,7 +850,6 @@ class CurrencyRate extends CommonObjectLine
|
|||||||
* Update object into database
|
* Update object into database
|
||||||
*
|
*
|
||||||
* @param bool $trigger true=launch triggers after, false=disable triggers
|
* @param bool $trigger true=launch triggers after, false=disable triggers
|
||||||
*
|
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
public function update($trigger = true)
|
public function update($trigger = true)
|
||||||
@ -866,6 +865,8 @@ class CurrencyRate extends CommonObjectLine
|
|||||||
// Update request
|
// Update request
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' SET';
|
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' SET';
|
||||||
$sql .= ' rate='.$this->rate;
|
$sql .= ' rate='.$this->rate;
|
||||||
|
if (!empty($this->date_sync)) $sql .= ", date_sync='".$this->db->idate($this->date_sync)."'";
|
||||||
|
if (!empty($this->fk_multicurrency)) $sql .= ', fk_multicurrency='.$this->fk_multicurrency;
|
||||||
$sql .= ' WHERE rowid='.$this->id;
|
$sql .= ' WHERE rowid='.$this->id;
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
@ -899,7 +900,6 @@ class CurrencyRate extends CommonObjectLine
|
|||||||
* Delete object in database
|
* Delete object in database
|
||||||
*
|
*
|
||||||
* @param bool $trigger true=launch triggers after, false=disable triggers
|
* @param bool $trigger true=launch triggers after, false=disable triggers
|
||||||
*
|
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
public function delete($trigger = true)
|
public function delete($trigger = true)
|
||||||
|
|||||||
548
htdocs/multicurrency/multicurrency_rate.php
Normal file
548
htdocs/multicurrency/multicurrency_rate.php
Normal file
@ -0,0 +1,548 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
* Copyright (C) 2004-2018 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
|
* Copyright (C) 2012-2016 Marcos García <marcosgdf@gmail.com>
|
||||||
|
* Copyright (C) 2013-2019 Juanjo Menent <jmenent@2byte.es>
|
||||||
|
* Copyright (C) 2013-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||||
|
* Copyright (C) 2013 Jean Heimburger <jean@tiaris.info>
|
||||||
|
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||||
|
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||||
|
* Copyright (C) 2013 Adolfo segura <adolfo.segura@gmail.com>
|
||||||
|
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||||
|
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/multicurrency/multicurrency_rate.php
|
||||||
|
* \ingroup multicurrency
|
||||||
|
* \brief Page to list multicurrency rate
|
||||||
|
*/
|
||||||
|
|
||||||
|
require '../main.inc.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/multicurrency.lib.php';
|
||||||
|
|
||||||
|
// Load translation files required by the page
|
||||||
|
$langs->loadLangs(array('multicurrency'));
|
||||||
|
|
||||||
|
$action = GETPOST('action', 'alpha');
|
||||||
|
$massaction = GETPOST('massaction', 'alpha');
|
||||||
|
$show_files = GETPOST('show_files', 'int');
|
||||||
|
$confirm = GETPOST('confirm', 'alpha');
|
||||||
|
$toselect = GETPOST('toselect', 'array');
|
||||||
|
$id_rate_selected = GETPOST('id_rate', 'int');
|
||||||
|
$sall = trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
|
||||||
|
$search_date_sync = GETPOST('search_date_sync', 'alpha');
|
||||||
|
$search_rate = GETPOST('search_rate', 'alpha');
|
||||||
|
$search_code = GETPOST('search_code', 'alpha');
|
||||||
|
$multicurrency_code = GETPOST('multicurrency_code', 'alpha');
|
||||||
|
$dateinput = dol_mktime(0, 0, 0, GETPOST('dateinputmonth', 'int'), GETPOST('dateinputday', 'int'), GETPOST('dateinputyear', 'int'));
|
||||||
|
$rateinput = price2num(GETPOST('rateinput', 'alpha'));
|
||||||
|
$optioncss = GETPOST('optioncss', 'alpha');
|
||||||
|
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||||
|
$sortfield = GETPOST("sortfield", 'alpha');
|
||||||
|
$sortorder = GETPOST("sortorder", 'alpha');
|
||||||
|
$page = (GETPOST("page", 'int')?GETPOST("page", 'int'):0);
|
||||||
|
|
||||||
|
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||||
|
$offset = $limit * $page;
|
||||||
|
$pageprev = $page - 1;
|
||||||
|
$pagenext = $page + 1;
|
||||||
|
if (! $sortfield) $sortfield="cr.date_sync";
|
||||||
|
if (! $sortorder) $sortorder="ASC";
|
||||||
|
|
||||||
|
|
||||||
|
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array of hooks
|
||||||
|
$object=new CurrencyRate($db);
|
||||||
|
|
||||||
|
$extrafields = new ExtraFields($db);
|
||||||
|
$form=new Form($db);
|
||||||
|
|
||||||
|
$hookmanager->initHooks(array('EditorRatelist', 'globallist'));
|
||||||
|
|
||||||
|
if (empty($action)) $action='list';
|
||||||
|
|
||||||
|
// List of fields to search into when doing a "search in all"
|
||||||
|
$fieldstosearchall = array(
|
||||||
|
'cr.date_sync'=>"date_sync",
|
||||||
|
'cr.rate'=>"rate",
|
||||||
|
'm.code'=>"code",
|
||||||
|
);
|
||||||
|
|
||||||
|
// Definition of fields for lists
|
||||||
|
$arrayfields=array(
|
||||||
|
'cr.date_sync'=>array('label'=>'Date', 'checked'=>1),
|
||||||
|
'cr.rate'=>array('label'=>'Rate', 'checked'=>1),
|
||||||
|
'm.code'=>array('label'=>'Code', 'checked'=>1),
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
$object->fields = dol_sort_array($object->fields, 'position');
|
||||||
|
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Actions
|
||||||
|
*/
|
||||||
|
if ($action == "create"){
|
||||||
|
if (!empty($rateinput)) {
|
||||||
|
$currencyRate_static = new CurrencyRate($db);
|
||||||
|
$currency_static = new MultiCurrency($db);
|
||||||
|
$fk_currency = $currency_static->getIdFromCode($db, $multicurrency_code);
|
||||||
|
|
||||||
|
$currencyRate_static->fk_multicurrency = $fk_currency;
|
||||||
|
$currencyRate_static->entity = $conf->entity;
|
||||||
|
$currencyRate_static->date_sync = $dateinput;
|
||||||
|
$currencyRate_static->rate = $rateinput;
|
||||||
|
|
||||||
|
$result = $currencyRate_static->create(intval($fk_currency));
|
||||||
|
if ($result > 0) {
|
||||||
|
setEventMessages($langs->trans('successRateCreate', $multicurrency_code), null);
|
||||||
|
} else {
|
||||||
|
dol_syslog("currencyRate:createRate", LOG_WARNING);
|
||||||
|
setEventMessages($currencyRate_static->error, $currencyRate_static->errors, 'errors');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
setEventMessages($langs->trans('NoEmptyRate'), null, "errors");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($action == 'update'){
|
||||||
|
$currencyRate = new CurrencyRate($db);
|
||||||
|
$result = $currencyRate->fetch($id_rate_selected);
|
||||||
|
if ( $result > 0){
|
||||||
|
$currency_static = new MultiCurrency($db);
|
||||||
|
$fk_currency = $currency_static->getIdFromCode($db, $multicurrency_code);
|
||||||
|
$currencyRate->date_sync = $dateinput;
|
||||||
|
$currencyRate->fk_multicurrency = $fk_currency;
|
||||||
|
$currencyRate->rate = $rateinput;
|
||||||
|
$res = $currencyRate->update();
|
||||||
|
if ($res){
|
||||||
|
setEventMessages($langs->trans('successUpdateRate'), null);
|
||||||
|
}else {
|
||||||
|
setEventMessages($currencyRate->error, $currencyRate->errors, "errors");
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
setEventMessages($langs->trans('Error'), null, "warnings");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($action == "deleteRate"){
|
||||||
|
$current_rate = new CurrencyRate($db);
|
||||||
|
$current_rate->fetch(intval($id_rate_selected));
|
||||||
|
|
||||||
|
if ($current_rate){
|
||||||
|
$current_currency = new MultiCurrency($db);
|
||||||
|
$current_currency->fetch($current_rate->fk_multicurrency);
|
||||||
|
if ($current_currency){
|
||||||
|
$delayedhtmlcontent = $form->formconfirm(
|
||||||
|
$_SERVER["PHP_SELF"].'?id_rate='.$id_rate_selected,
|
||||||
|
$langs->trans('DeleteLineRate'),
|
||||||
|
$langs->trans('ConfirmDeleteLineRate', $current_rate->rate, $current_currency->name, $current_rate->date_sync),
|
||||||
|
'confirm_delete',
|
||||||
|
'',
|
||||||
|
0,
|
||||||
|
1
|
||||||
|
);
|
||||||
|
}else {
|
||||||
|
dol_syslog("Multicurrency::fetch", LOG_WARNING);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
setEventMessage($langs->trans('NoCurrencyRateSelected'), "warnings");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($action == "confirm_delete"){
|
||||||
|
$current_rate = new CurrencyRate($db);
|
||||||
|
$current_rate->fetch(intval($id_rate_selected));
|
||||||
|
if ($current_rate){
|
||||||
|
$result = $current_rate->delete();
|
||||||
|
if ($result){
|
||||||
|
setEventMessages($langs->trans('successRateDelete'), null);
|
||||||
|
}else {
|
||||||
|
setEventMessages($current_rate->error, $current_rate->errors, 'errors');
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
setEventMessages($langs->trans('NoCurrencyRateSelected'), null, "warnings");
|
||||||
|
dol_syslog($langs->trans('NoCurrencyRateSelected'), LOG_WARNING);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (GETPOST('cancel', 'alpha')) { $action='list'; $massaction=''; }
|
||||||
|
if (! GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; }
|
||||||
|
|
||||||
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
if (empty($reshook))
|
||||||
|
{
|
||||||
|
// Selection of new fields
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
|
|
||||||
|
// Purge search criteria
|
||||||
|
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
|
||||||
|
{
|
||||||
|
$sall="";
|
||||||
|
$search_date_sync="";
|
||||||
|
$search_rate="";
|
||||||
|
$search_code="";
|
||||||
|
$search_array_options=array();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mass actions
|
||||||
|
$objectclass="CurrencyRate";
|
||||||
|
$uploaddir = $conf->multicurrency->multidir_output; // define only because core/actions_massactions.inc.php want it
|
||||||
|
$permtoread = $user->admin;
|
||||||
|
$permtodelete = $user->admin;
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
|
$htmlother=new FormOther($db);
|
||||||
|
|
||||||
|
$title=$langs->trans("CurrencyRate");
|
||||||
|
$page_name = "ListCurrencyRate";
|
||||||
|
|
||||||
|
llxHeader('', $title, $helpurl, '');
|
||||||
|
// Subheader
|
||||||
|
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||||
|
print load_fiche_titre($langs->trans($page_name), $linkback);
|
||||||
|
|
||||||
|
// Configuration header
|
||||||
|
$head = multicurrencyAdminPrepareHead();
|
||||||
|
dol_fiche_head($head, 'ratelist', $langs->trans("ModuleSetup"), -1, "multicurrency");
|
||||||
|
|
||||||
|
// ACTION
|
||||||
|
|
||||||
|
if ($action!= "updateRate" && $action!= "deleteRate" ) {
|
||||||
|
print '<table class="noborder centpercent">';
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td>'.$langs->trans("FormCreateRate").'</td>'."\n";
|
||||||
|
print '</tr></table>';
|
||||||
|
|
||||||
|
$form = new Form($db);
|
||||||
|
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post" name="formulaire">';
|
||||||
|
print '<table><tr>';
|
||||||
|
|
||||||
|
print ' <td>' . $langs->trans('Date') . '</td>';
|
||||||
|
print ' <td>';
|
||||||
|
print $form->selectDate($dateinput, 'dateinput');
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
print '<td> ' . $langs->trans('Currency') . '</td>';
|
||||||
|
print '<td>' . $form->selectMultiCurrency((GETPOSTISSET('multicurrency_code') ? GETPOST('multicurrency_code', 'alpha') : $multicurrency_code), 'multicurrency_code', 0, " code != '".$conf->currency."'", true) . '</td>';
|
||||||
|
|
||||||
|
print ' <td>' . $langs->trans('Rate') . '</td>';
|
||||||
|
print ' <td><input type="number" min ="0" step="any" class="minwidth200" name="rateinput" value="' . dol_escape_htmltag($rateinput) . '"></td>';
|
||||||
|
|
||||||
|
print '<td>';
|
||||||
|
print '<input type="hidden" name="action" value="create">';
|
||||||
|
print '<input type="submit" class="butAction" name="btnCreateCurrencyRate" value="' . $langs->trans('CreateRate') . '">';
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
print '</tr></table>';
|
||||||
|
print '</form>';
|
||||||
|
|
||||||
|
print '<br>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($action == "updateRate"){
|
||||||
|
$current_rate = new CurrencyRate($db);
|
||||||
|
$current_rate->fetch(intval($id_rate_selected));
|
||||||
|
|
||||||
|
if ($current_rate) {
|
||||||
|
$curr = new MultiCurrency($db);
|
||||||
|
$resultcurrentCurrency = $curr->fetch($current_rate->fk_multicurrency);
|
||||||
|
|
||||||
|
if ($resultcurrentCurrency){
|
||||||
|
$currency_code = $curr->code;
|
||||||
|
}else {
|
||||||
|
$currency_code = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
print '<table class="noborder centpercent">';
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td>' . $langs->trans("FormUpdateRate") . '</td>' . "\n";
|
||||||
|
print '</tr></table>';
|
||||||
|
|
||||||
|
$form = new Form($db);
|
||||||
|
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post" name="formtoupdaterate">';
|
||||||
|
print '<table><tr>';
|
||||||
|
print ' <td>' . $langs->trans('Date') . '</td>';
|
||||||
|
print '<td>';
|
||||||
|
print $form->selectDate($current_rate->date_sync, 'dateinput');
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
print '<td> ' . $langs->trans('Currency') . '</td>';
|
||||||
|
print '<td>' . $form->selectMultiCurrency($currency_code, 'multicurrency_code', 0, " code != '".$conf->currency."'", true) . '</td>';
|
||||||
|
|
||||||
|
print '<td>' . $langs->trans('Rate') . '</td>';
|
||||||
|
print '<td><input class="minwidth200" name="rateinput" value="' . dol_escape_htmltag($current_rate->rate) . '" type="text"></td>';
|
||||||
|
|
||||||
|
print '<td>';
|
||||||
|
print '<input type="hidden" name="action" value="update">';
|
||||||
|
print '<input type="hidden" name="id_rate" value="'.$current_rate->id.'">';
|
||||||
|
print '<input type="submit" class="butAction" name="btnupdateCurrencyRate" value="' . $langs->trans('UpdateRate') . '">';
|
||||||
|
print '<a href="'.$_SERVER["PHP_SELF"].'" class="butAction">' .$langs->trans('CancelUpdate') . '</a>';
|
||||||
|
|
||||||
|
print '</td>';
|
||||||
|
print '</tr></table>';
|
||||||
|
print '</form>';
|
||||||
|
}else {
|
||||||
|
dol_syslog("currency_rate:list:update", LOG_WARNING);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$sql = 'SELECT cr.rowid, cr.date_sync, cr.rate, cr.entity, m.code, m.name ';
|
||||||
|
// Add fields from hooks
|
||||||
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
|
||||||
|
$sql.=$hookmanager->resPrint;
|
||||||
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'multicurrency_rate as cr ';
|
||||||
|
$sql .=" INNER JOIN ".MAIN_DB_PREFIX."multicurrency AS m ON cr.fk_multicurrency = m.rowid";
|
||||||
|
if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall);
|
||||||
|
if ($search_date_sync) $sql .= natural_search('cr.date_sync', $search_date_sync);
|
||||||
|
if ($search_rate) $sql .= natural_search('cr.rate', $search_rate);
|
||||||
|
if ($search_code) $sql .= natural_search('m.code', $search_code);
|
||||||
|
$sql.= " WHERE m.code <> '".$db->escape($conf->currency)."'";
|
||||||
|
|
||||||
|
// Add where from hooks
|
||||||
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
|
||||||
|
$sql.=$hookmanager->resPrint;
|
||||||
|
$sql.= " GROUP BY cr.rowid, cr.date_sync, cr.rate, m.code, cr.entity, m.code, m.name";
|
||||||
|
|
||||||
|
// Add fields from hooks
|
||||||
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldSelect', $parameters); // Note that $action and $object may have been modified by hook
|
||||||
|
$sql.=$hookmanager->resPrint;
|
||||||
|
|
||||||
|
$sql.= $db->order($sortfield, $sortorder);
|
||||||
|
|
||||||
|
|
||||||
|
$nbtotalofrecords = '';
|
||||||
|
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||||
|
{
|
||||||
|
$result = $db->query($sql);
|
||||||
|
|
||||||
|
if ($result){
|
||||||
|
$nbtotalofrecords = $db->num_rows($result);
|
||||||
|
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||||
|
{
|
||||||
|
$page = 0;
|
||||||
|
$offset = 0;
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
setEventMessage($langs->trans('No_record_on_multicurrency_rate'), 'warnings');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql.= $db->plimit($limit + 1, $offset);
|
||||||
|
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$num = $db->num_rows($resql);
|
||||||
|
$arrayofselected=is_array($toselect)?$toselect:array();
|
||||||
|
|
||||||
|
$param='';
|
||||||
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
|
||||||
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
||||||
|
if ($sall) $param.="&sall=".urlencode($sall);
|
||||||
|
|
||||||
|
if ($search_date_sync) $param="&search_date_sync=".urlencode($search_date_sync);
|
||||||
|
if ($search_rate) $param="&search_rate=".urlencode($search_rate);
|
||||||
|
if ($search_code != '') $param.="&search_code=".urlencode($search_code);
|
||||||
|
|
||||||
|
// Add $param from extra fields
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||||
|
|
||||||
|
if ($user->admin) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
||||||
|
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||||
|
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||||
|
|
||||||
|
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formulaire">';
|
||||||
|
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||||
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
|
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||||
|
print '<input type="hidden" name="action" value="list">';
|
||||||
|
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||||
|
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||||
|
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||||
|
print '<input type="hidden" name="type" value="'.$type.'">';
|
||||||
|
|
||||||
|
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_currency.png', 0, $newcardbutton, '', $limit);
|
||||||
|
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||||
|
|
||||||
|
if ($sall)
|
||||||
|
{
|
||||||
|
foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
||||||
|
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall) . join(', ', $fieldstosearchall).'</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filter on categories
|
||||||
|
$moreforfilter='';
|
||||||
|
|
||||||
|
|
||||||
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
||||||
|
if (empty($reshook)) $moreforfilter.=$hookmanager->resPrint;
|
||||||
|
else $moreforfilter=$hookmanager->resPrint;
|
||||||
|
|
||||||
|
if ($moreforfilter)
|
||||||
|
{
|
||||||
|
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||||
|
print $moreforfilter;
|
||||||
|
print '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||||
|
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||||
|
if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1);
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive">';
|
||||||
|
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||||
|
|
||||||
|
// Lines with input filters
|
||||||
|
print '<tr class="liste_titre_filter">';
|
||||||
|
|
||||||
|
// date
|
||||||
|
if (! empty($arrayfields['cr.date_sync']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="liste_titre" align="left">';
|
||||||
|
print '<input class="flat" type="text" name="search_date_sync" size="8" value="'.dol_escape_htmltag($search_date_sync).'">';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
// code
|
||||||
|
if (! empty($arrayfields['m.code']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="liste_titre" align="left">';
|
||||||
|
print '<input class="flat" type="text" name="search_code" size="12" value="'.dol_escape_htmltag($search_code).'">';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
// rate
|
||||||
|
if (! empty($arrayfields['cr.rate']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="liste_titre" align="left">';
|
||||||
|
print '<input class="flat" type="text" name="search_rate" size="8" value="'.dol_escape_htmltag($search_rate).'">';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fields from hook
|
||||||
|
$parameters=array('arrayfields'=>$arrayfields);
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
|
||||||
|
print $hookmanager->resPrint;
|
||||||
|
|
||||||
|
print '<td class="liste_titre" align="middle">';
|
||||||
|
$searchpicto=$form->showFilterButtons();
|
||||||
|
print $searchpicto;
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
if (! empty($arrayfields['cr.date_sync']['checked'])) print_liste_field_titre($arrayfields['cr.date_sync']['label'], $_SERVER["PHP_SELF"], "cr.date_sync", "", $param, "", $sortfield, $sortorder);
|
||||||
|
if (! empty($arrayfields['m.code']['checked'])) print_liste_field_titre($arrayfields['m.code']['label'], $_SERVER["PHP_SELF"], "m.code", "", $param, "", $sortfield, $sortorder);
|
||||||
|
if (! empty($arrayfields['cr.rate']['checked'])) print_liste_field_titre($arrayfields['cr.rate']['label'], $_SERVER["PHP_SELF"], "cr.rate", "", $param, "", $sortfield, $sortorder);
|
||||||
|
|
||||||
|
// Hook fields
|
||||||
|
$parameters=array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
||||||
|
print $hookmanager->resPrint;
|
||||||
|
|
||||||
|
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
|
$totalarray=array();
|
||||||
|
while ($i < min($num, $limit))
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object($resql);
|
||||||
|
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
|
||||||
|
// date_sync
|
||||||
|
if (! empty($arrayfields['cr.date_sync']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="tdoverflowmax200">';
|
||||||
|
print $obj->date_sync;
|
||||||
|
print "</td>\n";
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// code
|
||||||
|
if (! empty($arrayfields['m.code']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="tdoverflowmax200">';
|
||||||
|
print $obj->code ." ". $obj->name;
|
||||||
|
print "</td>\n";
|
||||||
|
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// rate
|
||||||
|
if (! empty($arrayfields['cr.rate']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="tdoverflowmax200">';
|
||||||
|
print $obj->rate;
|
||||||
|
print "</td>\n";
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fields from hook
|
||||||
|
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
|
||||||
|
print $hookmanager->resPrint;
|
||||||
|
|
||||||
|
// Action
|
||||||
|
print '<td class="nowrap" align="center">';
|
||||||
|
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||||
|
{
|
||||||
|
$selected=0;
|
||||||
|
if (in_array($obj->rowid, $arrayofselected)) $selected=1;
|
||||||
|
print '<a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=updateRate&id_rate='.$obj->rowid.'" class="like-link " style="margin-right:15px;important">' . img_picto('edit', 'edit') . '</a>';
|
||||||
|
print '<a href="'.$_SERVER["PHP_SELF"].'?action=deleteRate&id_rate='.$obj->rowid.'" class="like-link" style="margin-right:45px;important">' . img_picto('delete', 'delete') . '</a>';
|
||||||
|
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>';
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
|
||||||
|
print "</tr>\n";
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$db->free($resql);
|
||||||
|
|
||||||
|
print "</table>";
|
||||||
|
print "</div>";
|
||||||
|
|
||||||
|
print '</form>';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
@ -1374,7 +1374,7 @@ class Thirdparties extends DolibarrApi
|
|||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
if ($result->num_rows == 0) {
|
if ($result && $this->db->num_rows($result) == 0) {
|
||||||
throw new RestException(404, 'Bank account not found');
|
throw new RestException(404, 'Bank account not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1443,7 +1443,7 @@ class Thirdparties extends DolibarrApi
|
|||||||
|
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
|
|
||||||
if ($result->num_rows == 0) {
|
if ($result && $this->db->num_rows($result) == 0) {
|
||||||
throw new RestException(404, 'This thirdparty does not have any gateway attached or does not exist.');
|
throw new RestException(404, 'This thirdparty does not have any gateway attached or does not exist.');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1514,7 +1514,7 @@ class Thirdparties extends DolibarrApi
|
|||||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe_account WHERE fk_soc = ".$id." AND site = '".$this->db->escape($request_data['site'])."'";
|
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe_account WHERE fk_soc = ".$id." AND site = '".$this->db->escape($request_data['site'])."'";
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
|
|
||||||
if ($result->num_rows == 0) {
|
if ($result && $this->db->num_rows($result) == 0) {
|
||||||
$account = new SocieteAccount($this->db);
|
$account = new SocieteAccount($this->db);
|
||||||
if (!isset($request_data['login'])) {
|
if (!isset($request_data['login'])) {
|
||||||
$account->login = "";
|
$account->login = "";
|
||||||
@ -1570,7 +1570,7 @@ class Thirdparties extends DolibarrApi
|
|||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
|
|
||||||
// We do not found an existing SocieteAccount entity for this fk_soc and site ; we then create a new one.
|
// We do not found an existing SocieteAccount entity for this fk_soc and site ; we then create a new one.
|
||||||
if ($result->num_rows == 0) {
|
if ($result && $this->db->num_rows == 0) {
|
||||||
if (!isset($request_data['key_account'])) {
|
if (!isset($request_data['key_account'])) {
|
||||||
throw new RestException(422, 'Unprocessable Entity: You must pass the key_account attribute in your request data !');
|
throw new RestException(422, 'Unprocessable Entity: You must pass the key_account attribute in your request data !');
|
||||||
}
|
}
|
||||||
@ -1595,7 +1595,7 @@ class Thirdparties extends DolibarrApi
|
|||||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe_account WHERE fk_soc = ".$id." AND site = '".$this->db->escape($request_data['site'])."' ";
|
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe_account WHERE fk_soc = ".$id." AND site = '".$this->db->escape($request_data['site'])."' ";
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
|
|
||||||
if ($result->num_rows !== 0) {
|
if ($result && $this->db->num_rows($result) !== 0) {
|
||||||
throw new RestException(409, "You are trying to update this thirdparty SocieteAccount (gateway record) from $site to ".$request_data['site']." but another SocieteAccount entity already exists with this site key.");
|
throw new RestException(409, "You are trying to update this thirdparty SocieteAccount (gateway record) from $site to ".$request_data['site']." but another SocieteAccount entity already exists with this site key.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1652,7 +1652,7 @@ class Thirdparties extends DolibarrApi
|
|||||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe_account WHERE fk_soc = $id AND site = '$site' ";
|
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe_account WHERE fk_soc = $id AND site = '$site' ";
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
|
|
||||||
if ($result->num_rows == 0) {
|
if ($result && $this->db->num_rows($result) == 0) {
|
||||||
throw new RestException(404, "This thirdparty does not have $site gateway attached or does not exist.");
|
throw new RestException(404, "This thirdparty does not have $site gateway attached or does not exist.");
|
||||||
} else {
|
} else {
|
||||||
// If the user tries to edit the site member, we check first if
|
// If the user tries to edit the site member, we check first if
|
||||||
@ -1660,7 +1660,7 @@ class Thirdparties extends DolibarrApi
|
|||||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe_account WHERE fk_soc = ".$id." AND site = '".$this->db->escape($request_data['site'])."' ";
|
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe_account WHERE fk_soc = ".$id." AND site = '".$this->db->escape($request_data['site'])."' ";
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
|
|
||||||
if ($result->num_rows !== 0)
|
if ($result && $this->db->num_rows($result) !== 0)
|
||||||
throw new RestException(409, "You are trying to update this thirdparty SocieteAccount (gateway record) site member from $site to ".$request_data['site']." but another SocieteAccount entity already exists for this thirdparty with this site key.");
|
throw new RestException(409, "You are trying to update this thirdparty SocieteAccount (gateway record) site member from $site to ".$request_data['site']." but another SocieteAccount entity already exists for this thirdparty with this site key.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1705,7 +1705,7 @@ class Thirdparties extends DolibarrApi
|
|||||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe_account WHERE fk_soc = $id AND site = '".$this->db->escape($site)."'";
|
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe_account WHERE fk_soc = $id AND site = '".$this->db->escape($site)."'";
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
|
|
||||||
if ($result->num_rows == 0) {
|
if ($result && $this->db->num_rows($result) == 0) {
|
||||||
throw new RestException(404);
|
throw new RestException(404);
|
||||||
} else {
|
} else {
|
||||||
$obj = $this->db->fetch_object($result);
|
$obj = $this->db->fetch_object($result);
|
||||||
@ -1724,9 +1724,9 @@ class Thirdparties extends DolibarrApi
|
|||||||
* @param int $id ID of thirdparty
|
* @param int $id ID of thirdparty
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @throws RestException(401) Unauthorized: User does not have permission to delete thirdparties gateways
|
* @throws RestException 401 Unauthorized: User does not have permission to delete thirdparties gateways
|
||||||
* @throws RestException(404) Not Found: Specified thirdparty ID does not belongs to an existing thirdparty
|
* @throws RestException 404 Not Found: Specified thirdparty ID does not belongs to an existing thirdparty
|
||||||
* @throws RestException(500) Internal Server Error: Error deleting SocieteAccount entity
|
* @throws RestException 500 Internal Server Error: Error deleting SocieteAccount entity
|
||||||
*
|
*
|
||||||
* @url DELETE {id}/gateways
|
* @url DELETE {id}/gateways
|
||||||
*/
|
*/
|
||||||
@ -1747,7 +1747,7 @@ class Thirdparties extends DolibarrApi
|
|||||||
|
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
|
|
||||||
if ($result->num_rows == 0) {
|
if ($result && $this->db->num_rows($result) == 0) {
|
||||||
throw new RestException(404, 'This third party does not have any gateway attached or does not exist.');
|
throw new RestException(404, 'This third party does not have any gateway attached or does not exist.');
|
||||||
} else {
|
} else {
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|||||||
@ -501,9 +501,6 @@ class Societe extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public $user_creation;
|
public $user_creation;
|
||||||
|
|
||||||
|
|
||||||
public $specimen;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 0=no customer, 1=customer, 2=prospect, 3=customer and prospect
|
* 0=no customer, 1=customer, 2=prospect, 3=customer and prospect
|
||||||
* @var int
|
* @var int
|
||||||
|
|||||||
@ -13,7 +13,7 @@
|
|||||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
|
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
|
||||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||||
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
* Copyright (C) 2019-2020 Frédéric France <frederic.france@netlogic.fr>
|
||||||
* Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
|
* 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
|
||||||
@ -177,8 +177,6 @@ class SupplierProposal extends CommonObject
|
|||||||
public $nbtodo;
|
public $nbtodo;
|
||||||
public $nbtodolate;
|
public $nbtodolate;
|
||||||
|
|
||||||
public $specimen;
|
|
||||||
|
|
||||||
// Multicurrency
|
// Multicurrency
|
||||||
/**
|
/**
|
||||||
* @var int ID
|
* @var int ID
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user