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

This commit is contained in:
Adrien Raze 2022-02-22 14:48:27 +01:00
commit 670dc2f95b
133 changed files with 1805 additions and 635 deletions

View file

@ -1,6 +1,7 @@
README (English)
##################################################
Building PAD files
http://pad.asp-software.org/padgen.php
##################################################
This directory contains files and docs used to build

View file

@ -30,7 +30,7 @@ return "Regis Houssin";
# script_dolibarr_versions()
sub script_dolibarr_versions
{
return ( "12.0.3", "11.0.5", "10.0.7", "9.0.4", "8.0.6", "7.0.5" );
return ( "14.0.5", "13.0.5", "12.0.5", "11.0.5", "10.0.7", "9.0.4", "8.0.6", "7.0.5" );
}
sub script_dolibarr_release
@ -400,6 +400,8 @@ sub script_dolibarr_check_latest
{
local ($ver) = @_;
local @vers = &osdn_package_versions("dolibarr",
$ver >= 14.0 ? "dolibarr\\-(12\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 13.0 ? "dolibarr\\-(12\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 12.0 ? "dolibarr\\-(12\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 11.0 ? "dolibarr\\-(11\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 10.0 ? "dolibarr\\-(10\\.0\\.[0-9\\.]+)\\.tgz" :

View file

@ -166,7 +166,6 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/blockedlog
%_datadir/dolibarr/htdocs/bookmarks
%_datadir/dolibarr/htdocs/bom
%_datadir/dolibarr/htdocs/cashdesk
%_datadir/dolibarr/htdocs/categories
%_datadir/dolibarr/htdocs/collab
%_datadir/dolibarr/htdocs/comm

View file

@ -247,7 +247,6 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/blockedlog
%_datadir/dolibarr/htdocs/bookmarks
%_datadir/dolibarr/htdocs/bom
%_datadir/dolibarr/htdocs/cashdesk
%_datadir/dolibarr/htdocs/categories
%_datadir/dolibarr/htdocs/collab
%_datadir/dolibarr/htdocs/comm

View file

@ -163,7 +163,6 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/blockedlog
%_datadir/dolibarr/htdocs/bookmarks
%_datadir/dolibarr/htdocs/bom
%_datadir/dolibarr/htdocs/cashdesk
%_datadir/dolibarr/htdocs/categories
%_datadir/dolibarr/htdocs/collab
%_datadir/dolibarr/htdocs/comm

View file

@ -174,7 +174,6 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/blockedlog
%_datadir/dolibarr/htdocs/bookmarks
%_datadir/dolibarr/htdocs/bom
%_datadir/dolibarr/htdocs/cashdesk
%_datadir/dolibarr/htdocs/categories
%_datadir/dolibarr/htdocs/collab
%_datadir/dolibarr/htdocs/comm

View file

@ -5,4 +5,4 @@ This directory contains samples of code to use Dolibarr business classes to buil
external interfaces that need to read/update data from/into Dolibarr.
You can also have a look at the Dolibarr doxygen doc that describes all files and classes:
http://www.dolibarr.org/html_doxygen/index.html
https://doxygen.dolibarr.org/

View file

@ -55,8 +55,8 @@ class AccountancyImport
$fieldname = $fieldArr[1];
}
$debit = trim($arrayrecord[11]['val']);
$credit = trim($arrayrecord[12]['val']);
$debit = floatval(trim($arrayrecord[11]['val']));
$credit = floatval(trim($arrayrecord[12]['val']));
if (!empty($debit)) {
$amount = $debit;
} else {
@ -86,7 +86,7 @@ class AccountancyImport
$fieldname = $fieldArr[1];
}
$debit = trim($arrayrecord[11]['val']);
$debit = floatval(trim($arrayrecord[11]['val']));
if (!empty($debit)) {
$sens = 'D';
} else {

View file

@ -331,7 +331,7 @@ class BookKeeping extends CommonObject
if (empty($this->piece_num)) {
$sqlnum = "SELECT MAX(piece_num)+1 as maxpiecenum";
$sqlnum .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
$sqlnum .= " WHERE entity = ".$conf->entity; // Do not use getEntity for accounting features
$sqlnum .= " WHERE entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
$resqlnum = $this->db->query($sqlnum);
if ($resqlnum) {
@ -745,7 +745,7 @@ class BookKeeping extends CommonObject
$sql .= " t.date_validated as date_validation";
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.$mode.' as t';
$sql .= ' WHERE 1 = 1';
$sql .= " AND entity IN (".getEntity('accountancy').")";
$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
if (null !== $ref) {
$sql .= " AND t.ref = '".$this->db->escape($ref)."'";
} else {
@ -890,7 +890,7 @@ class BookKeeping extends CommonObject
}
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
$sql .= ' WHERE 1 = 1';
$sql .= " AND entity IN (".getEntity('accountancy').")";
$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
if (count($sqlwhere) > 0) {
$sql .= " AND ".implode(" ".$filtermode." ", $sqlwhere);
}
@ -1046,7 +1046,7 @@ class BookKeeping extends CommonObject
}
}
}
$sql .= ' WHERE t.entity IN ('.getEntity('accountancy').')';
$sql .= ' WHERE t.entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features
if ($showAlreadyExportMovements == 0) {
$sql .= " AND t.date_export IS NULL";
}
@ -1166,7 +1166,7 @@ class BookKeeping extends CommonObject
}
}
}
$sql .= ' WHERE entity IN ('.getEntity('accountancy').')';
$sql .= ' WHERE entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features
if (count($sqlwhere) > 0) {
$sql .= " AND ".implode(" ".$filtermode." ", $sqlwhere);
}
@ -1464,7 +1464,7 @@ class BookKeeping extends CommonObject
*/
public function deleteByYearAndJournal($delyear = 0, $journal = '', $mode = '', $delmonth = 0)
{
global $langs;
global $conf, $langs;
if (empty($delyear) && empty($journal)) {
$this->error = 'ErrorOneFieldRequired';
@ -1485,7 +1485,7 @@ class BookKeeping extends CommonObject
if (!empty($journal)) {
$sql .= " AND code_journal = '".$this->db->escape($journal)."'";
}
$sql .= " AND entity IN (".getEntity('accountancy').")";
$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
// Exclusion of validated entries at the time of deletion
$sql .= " AND date_validated IS NULL";
@ -1524,7 +1524,7 @@ class BookKeeping extends CommonObject
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
$sql .= " WHERE piece_num = ".(int) $piecenum;
$sql .= " AND date_validated IS NULL"; // For security, exclusion of validated entries at the time of deletion
$sql .= " AND entity IN (".getEntity('accountancy').")";
$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
$resql = $this->db->query($sql);
@ -1646,7 +1646,7 @@ class BookKeeping extends CommonObject
}
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode;
$sql .= " WHERE piece_num = ".((int) $piecenum);
$sql .= " AND entity IN (".getEntity('accountancy').")";
$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
dol_syslog(__METHOD__, LOG_DEBUG);
$result = $this->db->query($sql);
@ -1684,9 +1684,10 @@ class BookKeeping extends CommonObject
global $conf;
$sql = "SELECT MAX(piece_num)+1 as max FROM ".MAIN_DB_PREFIX.$this->table_element.$mode;
$sql .= " WHERE entity IN (".getEntity('accountancy').")";
$sql .= " WHERE entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
dol_syslog(get_class($this)."::getNextNumMvt", LOG_DEBUG);
dol_syslog(get_class($this)."getNextNumMvt", LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
@ -1727,7 +1728,7 @@ class BookKeeping extends CommonObject
}
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode;
$sql .= " WHERE piece_num = ".((int) $piecenum);
$sql .= " AND entity IN (".getEntity('accountancy').")";
$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
dol_syslog(__METHOD__, LOG_DEBUG);
$result = $this->db->query($sql);
@ -1790,7 +1791,7 @@ class BookKeeping extends CommonObject
$sql .= " montant as amount, sens, fk_user_author, import_key, code_journal, piece_num,";
$sql .= " date_validated as date_validation";
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
$sql .= " WHERE entity IN (".getEntity('accountancy').")";
$sql .= " WHERE entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
dol_syslog(get_class($this)."::export_bookkeeping", LOG_DEBUG);
@ -1846,6 +1847,8 @@ class BookKeeping extends CommonObject
*/
public function transformTransaction($direction = 0, $piece_num = '')
{
global $conf;
$error = 0;
$this->db->begin();
@ -1865,14 +1868,14 @@ class BookKeeping extends CommonObject
$sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,';
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, '.((int) $next_piecenum).", '".$this->db->idate($now)."'";
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num);
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
$this->errors[] = 'Error '.$this->db->lasterror();
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
}
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num);
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
@ -1880,7 +1883,7 @@ class BookKeeping extends CommonObject
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
}
} elseif ($direction == 1) {
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num);
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
@ -1895,14 +1898,14 @@ class BookKeeping extends CommonObject
$sql .= ' doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,';
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num';
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE piece_num = '.((int) $piece_num);
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
$this->errors[] = 'Error '.$this->db->lasterror();
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
}
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num);
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
@ -1957,7 +1960,7 @@ class BookKeeping extends CommonObject
$sql .= " AND aa.active = 1";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
$sql .= " AND asy.rowid = ".((int) $pcgver);
$sql .= " AND ab.entity IN (".getEntity('accountancy').")";
$sql .= " AND ab.entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
$sql .= " ORDER BY account_number ASC";
dol_syslog(get_class($this)."::select_account", LOG_DEBUG);
@ -2021,7 +2024,7 @@ class BookKeeping extends CommonObject
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as parent ON aa.account_parent = parent.rowid AND parent.active = 1";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as root ON parent.account_parent = root.rowid AND root.active = 1";
$sql .= " WHERE aa.account_number = '".$this->db->escape($account)."'";
$sql .= " AND aa.entity IN (".getEntity('accountancy').")";
$sql .= " AND aa.entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
dol_syslog(get_class($this)."::select_account", LOG_DEBUG);
$resql = $this->db->query($sql);
@ -2061,7 +2064,7 @@ class BookKeeping extends CommonObject
$sql .= " AND asy.rowid = ".((int) $pcgver);
$sql .= " AND aa.active = 1";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_accounting_category as cat ON aa.fk_accounting_category = cat.rowid";
$sql .= " WHERE aa.entity IN (".getEntity('accountancy').")";
$sql .= " WHERE aa.entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
dol_syslog(get_class($this)."::select_account", LOG_DEBUG);
$resql = $this->db->query($sql);

View file

@ -500,6 +500,7 @@ if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
}
$sql .= " AND aa.account_number IS NOT NULL";
$sql .= " GROUP BY fd.fk_code_ventilation,aa.account_number,aa.label";
$sql .= ' ORDER BY aa.account_number';
dol_syslog('htdocs/accountancy/customer/index.php');
$resql = $db->query($sql);

View file

@ -244,6 +244,7 @@ $sql .= " AND er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseRepo
$sql .= " AND er.entity IN (".getEntity('expensereport', 0).")"; // We don't share object for accountancy
$sql .= " AND aa.account_number IS NULL";
$sql .= " GROUP BY erd.fk_code_ventilation,aa.account_number,aa.label";
$sql .= ' ORDER BY aa.account_number';
dol_syslog('/accountancy/expensereport/index.php:: sql='.$sql);
$resql = $db->query($sql);

View file

@ -374,6 +374,7 @@ $sql .= " AND ffd.product_type <= 2";
$sql .= " AND ff.entity IN (".getEntity('facture_fourn', 0).")"; // We don't share object for accountancy
$sql .= " AND aa.account_number IS NULL";
$sql .= " GROUP BY ffd.fk_code_ventilation,aa.account_number,aa.label";
$sql .= ' ORDER BY aa.account_number';
dol_syslog('htdocs/accountancy/supplier/index.php');
$resql = $db->query($sql);

View file

@ -196,6 +196,9 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="updateall">';
// Mains options
print load_fiche_titre($langs->trans("MemberMainOptions"), '', '');
print '<div class="div-table-responsive-no-min">';
@ -286,51 +289,15 @@ print '</div>';
print '</form>';
print '<br>';
/*
* Edit info of model document
*/
$constantes = array(
'ADHERENT_CARD_TYPE',
//'ADHERENT_CARD_BACKGROUND',
'ADHERENT_CARD_HEADER_TEXT',
'ADHERENT_CARD_TEXT',
'ADHERENT_CARD_TEXT_RIGHT',
'ADHERENT_CARD_FOOTER_TEXT'
);
print load_fiche_titre($langs->trans("MembersCards"), '', '');
$helptext = '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
$helptext .= '__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, ';
$helptext .= '__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, ';
$helptext .= '__YEAR__, __MONTH__, __DAY__';
form_constantes($constantes, 0, $helptext);
print '<br>';
/*
* Edit info of model document
*/
$constantes = array('ADHERENT_ETIQUETTE_TYPE', 'ADHERENT_ETIQUETTE_TEXT');
print load_fiche_titre($langs->trans("MembersTickets"), '', '');
$helptext = '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
$helptext .= '__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, ';
$helptext .= '__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, ';
$helptext .= '__YEAR__, __MONTH__, __DAY__';
form_constantes($constantes, 0, $helptext);
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
// Defined model definition table
$def = array();
$sql = "SELECT nom";
$sql = "SELECT nom as name";
$sql .= " FROM ".MAIN_DB_PREFIX."document_model";
$sql .= " WHERE type = '".$db->escape($type)."'";
$sql .= " AND entity = ".$conf->entity;
@ -339,14 +306,15 @@ if ($resql) {
$i = 0;
$num_rows = $db->num_rows($resql);
while ($i < $num_rows) {
$array = $db->fetch_array($resql);
array_push($def, $array[0]);
$obj = $db->fetch_object($resql);
array_push($def, $obj->name);
$i++;
}
} else {
dol_print_error($db);
}
print load_fiche_titre($langs->trans("MembersDocModules"), '', '');
print '<div class="div-table-responsive-no-min">';
@ -460,6 +428,55 @@ foreach ($dirmodels as $reldir) {
print '</table>';
print '</div>';
/*
TODO Use a global form instead of embeded form into table
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="updateall">';
*/
/*
* Edit info of model document
*/
$constantes = array(
'ADHERENT_CARD_TYPE',
//'ADHERENT_CARD_BACKGROUND',
'ADHERENT_CARD_HEADER_TEXT',
'ADHERENT_CARD_TEXT',
'ADHERENT_CARD_TEXT_RIGHT',
'ADHERENT_CARD_FOOTER_TEXT'
);
print load_fiche_titre($langs->trans("MembersCards"), '', '');
$helptext = '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
$helptext .= '__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, ';
$helptext .= '__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, ';
$helptext .= '__YEAR__, __MONTH__, __DAY__';
form_constantes($constantes, 0, $helptext);
print '<br>';
/*
* Edit info of model document
*/
$constantes = array('ADHERENT_ETIQUETTE_TYPE', 'ADHERENT_ETIQUETTE_TEXT');
print load_fiche_titre($langs->trans("MembersTickets"), '', '');
$helptext = '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
$helptext .= '__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, ';
$helptext .= '__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, ';
$helptext .= '__YEAR__, __MONTH__, __DAY__';
form_constantes($constantes, 0, $helptext);
//print '</form>';
print "<br>";
print dol_get_fiche_end();

View file

@ -65,6 +65,9 @@ if (GETPOST('actioncode', 'array')) {
}
$search_agenda_label = GETPOST('search_agenda_label');
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
$objcanvas = null;
// Security check
$result = restrictedArea($user, 'adherent', $id);

View file

@ -55,6 +55,7 @@ $id = GETPOST('id') ?GETPOST('id', 'int') : $rowid;
$typeid = GETPOST('typeid', 'int');
$userid = GETPOST('userid', 'int');
$socid = GETPOST('socid', 'int');
$ref = GETPOST('ref', 'alpha');
if (!empty($conf->mailmanspip->enabled)) {
include_once DOL_DOCUMENT_ROOT.'/mailmanspip/class/mailmanspip.class.php';

View file

@ -1805,6 +1805,7 @@ class Adherent extends CommonObject
$paiement = new Paiement($this->db);
$paiement->datepaye = $paymentdate;
$paiement->amounts = $amounts;
$paiement->paiementcode = $operation;
$paiement->paiementid = dol_getIdFromCode($this->db, $operation, 'c_paiement', 'code', 'id', 1);
$paiement->num_payment = $num_chq;
$paiement->note_public = $label;

View file

@ -40,6 +40,8 @@ require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
$langs->loadLangs(array("companies", "bills", "members", "users", "mails", 'other'));
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
$id = GETPOST('rowid', 'int') ?GETPOST('rowid', 'int') : GETPOST('id', 'int');

View file

@ -267,9 +267,9 @@ class Dolistore
// add image or default ?
if ($product->id_default_image != '') {
$image_url = DOL_URL_ROOT.'/admin/dolistore/ajax/image.php?id_product='.((int) $product->id).'&id_image='.((int) $product->id_default_image);
$images = '<a href="'.urlencode($image_url).'" class="documentpreview" target="_blank" rel="noopener noreferrer" mime="image/png" title="'.dol_escape_htmltag($product->name->language[$this->lang - 1].', '.$langs->trans('Version').' '.$product->module_version).'">';
$images .= '<img src="'.urlencode($image_url).'&quality=home_default" style="max-height:250px;max-width: 210px;" alt="" /></a>';
$image_url = DOL_URL_ROOT.'/admin/dolistore/ajax/image.php?id_product='.urlencode(((int) $product->id)).'&id_image='.urlencode(((int) $product->id_default_image));
$images = '<a href="'.$image_url.'" class="documentpreview" target="_blank" rel="noopener noreferrer" mime="image/png" title="'.dol_escape_htmltag($product->name->language[$this->lang - 1].', '.$langs->trans('Version').' '.$product->module_version).'">';
$images .= '<img src="'.$image_url.'&quality=home_default" style="max-height:250px;max-width: 210px;" alt="" /></a>';
} else {
$images = '<img src="'.DOL_URL_ROOT.'/admin/dolistore/img/NoImageAvailable.png" />';
}
@ -277,11 +277,11 @@ class Dolistore
// free or pay ?
if ($product->price > 0) {
$price = '<h3>'.price(price2num($product->price, 'MT'), 0, $langs, 1, -1, -1, 'EUR').' '.$langs->trans("HT").'</h3>';
$download_link = '<a target="_blank" href="'.urlencode($this->shop_url.$product->id).'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/follow.png" /></a>';
$download_link = '<a target="_blank" href="'.$this->shop_url.urlencode($product->id).'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/follow.png" /></a>';
} else {
$price = '<h3>'.$langs->trans('Free').'</h3>';
$download_link = '<a target="_blank" rel="noopener noreferrer" href="'.urlencode($this->shop_url.$product->id).'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/Download-128.png" /></a>';
$download_link .= '<br><br><a target="_blank" rel="noopener noreferrer" href="'.urlencode($this->shop_url.$product->id).'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/follow.png" /></a>';
$download_link = '<a target="_blank" rel="noopener noreferrer" href="'.$this->shop_url.urlencode($product->id).'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/Download-128.png" /></a>';
$download_link .= '<br><br><a target="_blank" href="'.$this->shop_url.urlencode($product->id).'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/follow.png" /></a>';
}
// Set and check version

View file

@ -143,6 +143,20 @@ if ($action == 'updateMask') {
}
}
if ($action == 'setvarworkflow') {
$param_auto_read = GETPOST('TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND', $param_auto_read, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
$param_auto_assign = GETPOST('TICKET_AUTO_ASSIGN_USER_CREATE', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_AUTO_ASSIGN_USER_CREATE', $param_auto_assign, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
}
if ($action == 'setvarother') {
$param_must_exists = GETPOST('TICKET_EMAIL_MUST_EXISTS', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_EMAIL_MUST_EXISTS', $param_must_exists, 'chaine', 0, '', $conf->entity);
@ -178,8 +192,14 @@ if ($action == 'setvarother') {
$error++;
}
$param_auto_assign = GETPOST('TICKET_AUTO_ASSIGN_USER_CREATE', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_AUTO_ASSIGN_USER_CREATE', $param_auto_assign, 'chaine', 0, '', $conf->entity);
$param_delay_first_response = GETPOST('delay_first_response', 'int');
$res = dolibarr_set_const($db, 'TICKET_DELAY_BEFORE_FIRST_RESPONSE', $param_delay_first_response, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
$param_delay_between_responses = GETPOST('delay_between_responses', 'int');
$res = dolibarr_set_const($db, 'TICKET_DELAY_SINCE_LAST_RESPONSE', $param_delay_between_responses, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
@ -467,7 +487,7 @@ print '</div><br>';
if (!$conf->use_javascript_ajax) {
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="setvarother">';
print '<input type="hidden" name="action" value="setvarworkflow">';
}
print load_fiche_titre($langs->trans("Other"), '', '');
@ -479,8 +499,24 @@ print '<td></td>';
print '<td></td>';
print "</tr>\n";
// Auto mark ticket read when created from backoffice
print '<tr class="oddeven"><td>'.$langs->trans("TicketsAutoReadTicket").'</td>';
print '<td class="left">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND", $arrval, $conf->global->TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND);
}
print '</td>';
print '<td class="center">';
print $form->textwithpicto('', $langs->trans("TicketsAutoReadTicketHelp"), 1, 'help');
print '</td>';
print '</tr>';
// Auto assign ticket at user who created it
print '<tr class="oddeven"><td>'.$langs->trans("TicketsAutoAssignTicket").'</td>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("TicketsAutoAssignTicket").'</td>';
print '<td class="left">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_AUTO_ASSIGN_USER_CREATE');
@ -494,12 +530,41 @@ print $form->textwithpicto('', $langs->trans("TicketsAutoAssignTicketHelp"), 1,
print '</td>';
print '</tr>';
print '</table><br>';
if (!$conf->use_javascript_ajax) {
print '</form>';
}
// Define wanted maximum time elapsed before answers to tickets
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >';
print '<input type="hidden" name="action" value="setvarother">';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("TicketsDelayBeforeFirstAnswer")."</td>";
print '<td class="left">
<input type="number" value="'.$conf->global->TICKET_DELAY_BEFORE_FIRST_RESPONSE.'" name="delay_first_response">
<input type="submit" class="button small" value="'.$langs->trans("Save").'">
</td>';
print '<td class="center">';
print $form->textwithpicto('', $langs->trans("TicketsDelayBeforeFirstAnswerHelp"), 1, 'help');
print '</td>';
print '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("TicketsDelayBetweenAnswers")."</td>";
print '<td class="left">
<input type="number" value="'.$conf->global->TICKET_DELAY_SINCE_LAST_RESPONSE.'" name="delay_between_responses">
<input type="submit" class="button small" value="'.$langs->trans("Save").'">
</td>';
print '<td class="center">';
print $form->textwithpicto('', $langs->trans("TicketsDelayBetweenAnswersHelp"), 1, 'help');
print '</td>';
print '</tr>';
print '</form>';
print '</table><br>';
// Admin var of module
print load_fiche_titre($langs->trans("Notification"), '', '');

View file

@ -553,6 +553,7 @@ print '</form>';
print '</fieldset>';
$title = $langs->trans("BackupZipWizard");
print "<br>\n";
print "<!-- Dump of a server -->\n";
@ -571,7 +572,7 @@ print '</span>';
print '<div id="backupfilesleft" class="fichehalfleft">';
print load_fiche_titre($title ? $title : $langs->trans("BackupZipWizard"));
print load_fiche_titre($title);
print '<label for="zipfilename_template" class="line-height-large paddingbottom">'.$langs->trans("FileNameToGenerate").'</label><br>';
$prefix = 'documents';

View file

@ -239,7 +239,6 @@ class Setup extends DolibarrApi
return $list;
}
/**
* Get the list of states/provinces.
*
@ -252,22 +251,29 @@ class Setup extends DolibarrApi
* @param string $sortorder Sort order
* @param int $limit Number of items per page
* @param int $page Page number (starting from zero)
* @param string $filter To filter the countries by name
* @param int $country To filter on country
* @param string $filter To filter the states by name
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)"
* @return array List of countries
* @return array List of states
*
* @url GET dictionary/states
*
* @throws RestException
*/
public function getListOfStates($sortfield = "code_departement", $sortorder = 'ASC', $limit = 100, $page = 0, $filter = '', $sqlfilters = '')
public function getListOfStates($sortfield = "code_departement", $sortorder = 'ASC', $limit = 100, $page = 0, $country = 0, $filter = '', $sqlfilters = '')
{
$list = array();
// Note: The filter is not applied in the SQL request because it must
// be applied to the translated names, not to the names in database.
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."c_departements as t";
$sql = "SELECT t.rowid FROM ".MAIN_DB_PREFIX."c_departements as t";
if ($country) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as d ON t.fk_region = d.code_region";
}
$sql .= " WHERE 1 = 1";
if ($country) {
$sql .= " AND d.fk_pays = ".((int) $country);
}
// Add sql filters
if ($sqlfilters) {
$errormessage = '';
@ -1053,7 +1059,7 @@ class Setup extends DolibarrApi
* @param int $page Page number (starting from zero)
* @param string $zipcode To filter on zipcode
* @param string $town To filter on city name
* @param int $active Payment term is active or not {@min 0} {@max 1}
* @param int $active Town is active or not {@min 0} {@max 1}
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)"
* @return array List of towns
*
@ -1067,7 +1073,7 @@ class Setup extends DolibarrApi
$sql = "SELECT rowid AS id, zip, town, fk_county, fk_pays AS fk_country";
$sql .= " FROM ".MAIN_DB_PREFIX."c_ziptown as t";
$sql .= " AND t.active = ".((int) $active);
$sql .= " WHERE t.active = ".((int) $active);
if ($zipcode) {
$sql .= " AND t.zip LIKE '%".$this->db->escape($zipcode)."%'";
}
@ -1301,7 +1307,7 @@ class Setup extends DolibarrApi
* @param string $sortorder Sort order
* @param int $limit Number of items per page
* @param int $page Page number (starting from zero)
* @param string $country To filter on country
* @param int $country To filter on country
* @param int $active Lega form is active or not {@min 0} {@max 1}
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)"
* @return array List of legal form
@ -1310,7 +1316,7 @@ class Setup extends DolibarrApi
*
* @throws RestException
*/
public function getListOfLegalForm($sortfield = "rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $country = '', $active = 1, $sqlfilters = '')
public function getListOfLegalForm($sortfield = "rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $country = 0, $active = 1, $sqlfilters = '')
{
$list = array();
@ -1318,7 +1324,7 @@ class Setup extends DolibarrApi
$sql .= " FROM ".MAIN_DB_PREFIX."c_forme_juridique as t";
$sql .= " WHERE t.active = ".((int) $active);
if ($country) {
$sql .= " AND t.fk_pays = '".$this->db->escape($country)."'";
$sql .= " AND t.fk_pays = ".((int) $country);
}
// Add sql filters
if ($sqlfilters) {
@ -1774,7 +1780,7 @@ class Setup extends DolibarrApi
$result = $establishment->fetch($id);
if ($result < 0) {
throw new RestException(503, 'Error when retrieving state : '.$establishment->error);
throw new RestException(503, 'Error when retrieving establishment : '.$establishment->error);
} elseif ($result == 0) {
throw new RestException(404, 'Establishment not found');
}

View file

@ -518,7 +518,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Common attributes
$keyforbreak = 'duration';
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
$object->calculateCosts();
print '<tr><td>'.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCost")).'</td><td>'.price($object->total_cost).'</td></tr>';
print '<tr><td>'.$langs->trans("UnitCost").'</td><td>'.price($object->unit_cost).'</td></tr>';

View file

@ -0,0 +1,328 @@
<?php
/* Copyright (C) 2017-2020 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
*
* 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 <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/bom/bom_net_needs.php
* \ingroup bom
* \brief Page to create/edit/view bom
*/
// Load Dolibarr environment
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php';
require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("mrp", "other"));
// Get parameters
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
$cancel = GETPOST('cancel', 'aZ09');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'bomnet_needs'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha');
// Initialize technical objects
$object = new BOM($db);
$extrafields = new ExtraFields($db);
$diroutputmassaction = $conf->bom->dir_output.'/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('bomnetneeds')); // Note that conf->hooks_modules contains array
// Fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
// Initialize array of search criterias
$search_all = GETPOST("search_all", 'alpha');
$search = array();
foreach ($object->fields as $key => $val) {
if (GETPOST('search_'.$key, 'alpha')) {
$search[$key] = GETPOST('search_'.$key, 'alpha');
}
}
if (empty($action) && empty($id) && empty($ref)) {
$action = 'view';
}
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
if ($object->id > 0) {
$object->calculateCosts();
}
// Security check - Protection if external user
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
$result = restrictedArea($user, 'bom', $object->id, 'bom_bom', '', '', 'rowid', $isdraft);
$permissionnote = $user->rights->bom->write; // Used by the include of actions_setnotes.inc.php
$permissiondellink = $user->rights->bom->write; // Used by the include of actions_dellink.inc.php
$permissiontoadd = $user->rights->bom->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$permissiontodelete = $user->rights->bom->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
$upload_dir = $conf->bom->multidir_output[isset($object->entity) ? $object->entity : 1];
/*
* Actions
*/
$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)) {
$error = 0;
$backurlforlist = DOL_URL_ROOT.'/bom/bom_list.php';
if (empty($backtopage) || ($cancel && empty($id))) {
if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
$backtopage = $backurlforlist;
} else {
$backtopage = DOL_URL_ROOT.'/bom/bom_net_needs.php?id='.($id > 0 ? $id : '__ID__');
}
}
}
if ($action == 'treeview') $object->getNetNeedsTree($TChildBom, 1);
else $object->getNetNeeds($TChildBom, 1);
}
/*
* View
*/
$form = new Form($db);
$formfile = new FormFile($db);
$title = $langs->trans('BOM');
$help_url ='EN:Module_BOM';
llxHeader('', $title, $help_url);
// Part to show record
if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) {
$head = bomPrepareHead($object);
print dol_get_fiche_head($head, 'net_needs', $langs->trans("BillOfMaterials"), -1, 'bom');
$formconfirm = '';
// Call Hook formConfirm
$parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid);
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) {
$formconfirm .= $hookmanager->resPrint;
} elseif ($reshook > 0) {
$formconfirm = $hookmanager->resPrint;
}
// Print form confirm
print $formconfirm;
// Object card
// ------------------------------------------------------------
$linkback = '<a href="'.DOL_URL_ROOT.'/bom/bom_list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref = '<div class="refidno">';
$morehtmlref .= '</div>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">'."\n";
// Common attributes
$keyforbreak = 'duration';
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
print '<tr><td>'.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCost")).'</td><td>'.price($object->total_cost).'</td></tr>';
print '<tr><td>'.$langs->trans("UnitCost").'</td><td>'.price($object->unit_cost).'</td></tr>';
// Other attributes
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
print '</table>';
print '</div>';
print '</div>';
print '<div class="clearboth"></div>';
print dol_get_fiche_end();
$viewlink = dolGetButtonTitle($langs->trans('GroupByProduct'), '', 'fa fa-list-alt imgforviewmode', $_SERVER['PHP_SELF'].'?id='.$object->id.'&token='.newToken(), '', 1, array('morecss' => 'reposition '.($action !== 'treeview' ? 'btnTitleSelected':'')));
$viewlink .= dolGetButtonTitle($langs->trans('TreeStructure'), '', 'fa fa-stream imgforviewmode', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=treeview&token='.newToken(), '', 1, array('morecss' => 'reposition marginleftonly '.($action == 'treeview' ? 'btnTitleSelected':'')));
print load_fiche_titre($langs->trans("BillOfMaterials"), $viewlink, 'cubes');
/*
* Lines
*/
$text_stock_options = $langs->trans("RealStockDesc").'<br>';
$text_stock_options .= $langs->trans("RealStockWillAutomaticallyWhen").'<br>';
$text_stock_options .= (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || ! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE) ? '- '.$langs->trans("DeStockOnShipment").'<br>' : '');
$text_stock_options .= (! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) ? '- '.$langs->trans("DeStockOnValidateOrder").'<br>' : '');
$text_stock_options .= (! empty($conf->global->STOCK_CALCULATE_ON_BILL) ? '- '.$langs->trans("DeStockOnBill").'<br>' : '');
$text_stock_options .= (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) ? '- '.$langs->trans("ReStockOnBill").'<br>' : '');
$text_stock_options .= (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) ? '- '.$langs->trans("ReStockOnValidateOrder").'<br>' : '');
$text_stock_options .= (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) ? '- '.$langs->trans("ReStockOnDispatchOrder").'<br>' : '');
$text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE) ? '- '.$langs->trans("StockOnReception").'<br>' : '');
print '<table id="tablelines" class="noborder noshadow" width="100%">';
print "<thead>\n";
print '<tr class="liste_titre nodrag nodrop">';
print '<td class="linecoldescription">'.$langs->trans('Product');
if (! empty($conf->global->BOM_SUB_BOM) && $action == 'treeview') {
print ' &nbsp; <a id="show_all" href="#">'.img_picto('', 'folder-open', 'class="paddingright"').$langs->trans("ExpandAll").'</a>&nbsp;&nbsp;';
print '<a id="hide_all" href="#">'.img_picto('', 'folder', 'class="paddingright"').$langs->trans("UndoExpandAll").'</a>&nbsp;';
}
print '</td>';
print '<td class="linecolqty">'.$langs->trans('Quantity').'</td>';
print '<td class="linecolstock">'.$form->textwithpicto($langs->trans("PhysicalStock"), $text_stock_options, 1).'</td>';
print '<td class="linecoltheoricalstock">'.$form->textwithpicto($langs->trans("VirtualStock"), $langs->trans("VirtualStockDesc")).'</td>';
print '</tr>';
if (! empty($TChildBom)) {
if ($action == 'treeview') {
foreach ($TChildBom as $fk_bom => $TProduct) {
$repeatChar = '&emsp;';
if (! empty($TProduct['bom'])) {
if ($TProduct['parentid'] != $object->id) print '<tr class="sub_bom_lines oddeven" parentid="'.$TProduct['parentid'].'">';
else print '<tr class="oddeven">';
print '<td class="linecoldescription">'.str_repeat($repeatChar, $TProduct['level']).$TProduct['bom']->getNomUrl(1);
print ' <a class="collapse_bom" id="collapse-'.$fk_bom.'" href="#">';
print img_picto('', 'folder-open');
print '</a>';
print '</td>';
print '<td class="linecolqty">'.$TProduct['qty'].'</td>';
print '<td class="linecolstock"></td>';
print '<td class="linecoltheoricalstock"></td>';
print '</tr>';
}
if (! empty($TProduct['product'])) {
foreach ($TProduct['product'] as $fk_product => $TInfos) {
$prod = new Product($db);
$prod->fetch($fk_product);
$prod->load_virtual_stock();
if (empty($prod->stock_reel)) $prod->stock_reel = 0;
if ($fk_bom != $object->id) print '<tr class="sub_bom_lines oddeven" parentid="'.$fk_bom.'">';
else print '<tr class="oddeven">';
print '<td class="linecoldescription">'.str_repeat($repeatChar, $TInfos['level']).$prod->getNomUrl(1).'</td>';
print '<td class="linecolqty">'.$TInfos['qty'].'</td>';
print '<td class="linecolstock">'.$prod->stock_reel.'</td>';
print '<td class="linecoltheoricalstock">'.$prod->stock_theorique.'</td>';
print '</tr>';
}
}
}
} else {
foreach ($TChildBom as $fk_product => $qty) {
$prod = new Product($db);
$prod->fetch($fk_product);
$prod->load_virtual_stock();
if (empty($prod->stock_reel)) $prod->stock_reel = 0;
print '<tr class="oddeven">';
print '<td class="linecoldescription">'.$prod->getNomUrl(1).'</td>';
print '<td class="linecolqty">'.$qty.'</td>';
print '<td class="linecolstock">'.$prod->stock_reel.'</td>';
print '<td class="linecoltheoricalstock">'.$prod->stock_theorique.'</td>';
print '</tr>';
}
}
}
print '</thead>';
print '</table>';
/*
* ButAction
*/
print '<div class="tabsAction">'."\n";
$parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
print '</div>';
?>
<script type="text/javascript" language="javascript">
$(document).ready(function() {
// When clicking on collapse
$(".collapse_bom").click(function() {
console.log("We click on collapse");
var id_bom_line = $(this).attr('id').replace('collapse-', '');
console.log($(this).html().indexOf('folder-open'));
if($(this).html().indexOf('folder-open') <= 0) {
$('[parentid="'+ id_bom_line +'"]').show();
$(this).html('<?php echo dol_escape_js(img_picto('', 'folder-open')); ?>');
}
else {
$('[parentid="'+ id_bom_line +'"]').hide();
$(this).html('<?php echo dol_escape_js(img_picto('', 'folder')); ?>');
}
return false;
});
// To Show all the sub bom lines
$("#show_all").click(function() {
console.log("We click on show all");
$("[class^=sub_bom_lines]").show();
$("[class^=collapse_bom]").html('<?php echo dol_escape_js(img_picto('', 'folder-open')); ?>');
return false;
});
// To Hide all the sub bom lines
$("#hide_all").click(function() {
console.log("We click on hide all");
$("[class^=sub_bom_lines]").hide();
$("[class^=collapse_bom]").html('<?php echo dol_escape_js(img_picto('', 'folder')); ?>');
return false;
});
});
</script>
<?php
}
// End of page
llxFooter();
$db->close();

View file

@ -1085,7 +1085,8 @@ class BOM extends CommonObject
$res = $bom_child->fetch($line->fk_bom_child);
if ($res>0) {
$bom_child->calculateCosts();
$this->total_cost += $bom_child->total_cost;
$line->childBom[] = $bom_child;
$this->total_cost += $bom_child->total_cost * $line->qty;
} else {
$this->error = $bom_child->error;
return -2;
@ -1101,6 +1102,54 @@ class BOM extends CommonObject
}
}
}
/**
* Get Net needs by product
*
* @param array $TNetNeeds Array of ChildBom and infos linked to
* @param int $qty qty needed
* @return void
*/
public function getNetNeeds(&$TNetNeeds = array(), $qty = 0)
{
if (! empty($this->lines)) {
foreach ($this->lines as $line) {
if (! empty($line->childBom)) {
foreach ($line->childBom as $childBom) $childBom->getNetNeeds($TNetNeeds, $line->qty*$qty);
} else {
$TNetNeeds[$line->fk_product] += $line->qty*$qty;
}
}
}
}
/**
* Get Net needs Tree by product or bom
*
* @param array $TNetNeeds Array of ChildBom and infos linked to
* @param int $qty qty needed
* @param int $level level of recursivity
* @return void
*/
public function getNetNeedsTree(&$TNetNeeds = array(), $qty = 0, $level = 0)
{
if (! empty($this->lines)) {
foreach ($this->lines as $line) {
if (! empty($line->childBom)) {
foreach ($line->childBom as $childBom) {
$TNetNeeds[$childBom->id]['bom'] = $childBom;
$TNetNeeds[$childBom->id]['parentid'] = $this->id;
$TNetNeeds[$childBom->id]['qty'] = $line->qty*$qty;
$TNetNeeds[$childBom->id]['level'] = $level;
$childBom->getNetNeedsTree($TNetNeeds, $line->qty*$qty, $level+1);
}
} else {
$TNetNeeds[$this->id]['product'][$line->fk_product]['qty'] += $line->qty * $qty;
$TNetNeeds[$this->id]['product'][$line->fk_product]['level'] = $level;
}
}
}
}
}
@ -1227,6 +1276,11 @@ class BOMLine extends CommonObjectLine
public $unit_cost = 0;
/**
* @var Bom array of Bom in line
*/
public $childBom = array();
/**
* Constructor
*

View file

@ -84,6 +84,11 @@ function bomPrepareHead($object)
$head[$h][2] = 'card';
$h++;
$head[$h][0] = DOL_URL_ROOT."/bom/bom_net_needs.php?id=".$object->id;
$head[$h][1] = $langs->trans("BOMNetNeeds");
$head[$h][2] = 'net_needs';
$h++;
if (isset($object->fields['note_public']) || isset($object->fields['note_private'])) {
$nbNote = 0;
if (!empty($object->note_private)) {

View file

@ -180,6 +180,7 @@ if ($action == 'selectlines') {
print '</tr>';
// Select of all the sub-BOM lines
// From this pont to the end of the file, we only take care of sub-BOM lines
$sql = 'SELECT rowid, fk_bom_child, fk_product, qty FROM '.MAIN_DB_PREFIX.'bom_bomline AS bl';
$sql.= ' WHERE fk_bom ='. (int) $tmpbom->id;
$resql = $object->db->query($sql);
@ -191,7 +192,9 @@ if ($resql) {
$sub_bom_product->fetch($obj->fk_product);
$sub_bom = new BOM($object->db);
$sub_bom->fetch($obj->fk_bom_child);
if (!empty($obj->fk_bom_child)) {
$sub_bom->fetch($obj->fk_bom_child);
}
$sub_bom_line = new BOMLine($object->db);
$sub_bom_line->fetch($obj->rowid);
@ -233,20 +236,23 @@ if ($resql) {
// Efficiency
print '<td class="linecolefficiency nowrap right" id="sub_bom_efficiency_'.$sub_bom_line->id.'">'.$sub_bom_line->efficiency.'</td>';
// Cost price if it's defined
if ($sub_bom_product->cost_price > 0) {
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'">'.price($sub_bom_product->cost_price * $line->qty).'</td>';
$total_cost+= $sub_bom_product->cost_price * $line->qty;
if (!empty($sub_bom->id)) {
$sub_bom->calculateCosts();
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'">'.price($sub_bom->total_cost * $sub_bom_line->qty * $line->qty).'</td>';
$total_cost+= $sub_bom->total_cost * $sub_bom_line->qty * $line->qty;
} elseif ($sub_bom_product->cost_price > 0) {
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'">'.price($sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty).'</td>';
$total_cost+= $sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty;
} elseif ($sub_bom_product->pmp > 0) { // PMP if cost price isn't defined
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'">'.price($sub_bom_product->pmp * $line->qty).'</td>';
$total_cost.= $sub_bom_product->pmp * $line->qty;
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'">'.price($sub_bom_product->pmp * $sub_bom_line->qty * $line->qty).'</td>';
$total_cost.= $sub_bom_product->pmp * $sub_bom_line->qty * $line->qty;
} else { // Minimum purchase price if cost price and PMP aren't defined
$sql_supplier_price = 'SELECT MIN(price) AS min_price, quantity AS qty FROM '.MAIN_DB_PREFIX.'product_fournisseur_price';
$sql_supplier_price.= ' WHERE fk_product = '. (int) $sub_bom_product->id;
$resql_supplier_price = $object->db->query($sql_supplier_price);
if ($resql_supplier_price) {
$obj = $object->db->fetch_object($resql_supplier_price);
$line_cost = $obj->min_price/$obj->qty * $sub_bom_line->qty;
$line_cost = $obj->min_price/$obj->qty * $sub_bom_line->qty * $line->qty;
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'">'.price($line_cost).'</td>';
$total_cost+= $line_cost;

View file

@ -185,7 +185,8 @@ class Categorie extends CommonObject
'contact' => 'socpeople',
'account' => 'bank_account', // old for bank account
'project' => 'projet',
'warehouse'=> 'entrepot'
'warehouse'=> 'entrepot',
'knowledgemanagement' => 'knowledgemanagement_knowledgerecord'
);
/**

View file

@ -178,7 +178,9 @@ print '</td></tr>';
// Parent category
print '<tr><td>'.$langs->trans("In").'</td><td>';
print img_picto('', 'category', 'class="pictofixedwidth"');
print $form->select_all_categories($type, $object->fk_parent, 'parent', 64, $object->id);
print ajax_combobox('parent');
print '</td></tr>';
$parameters = array();

View file

@ -377,7 +377,7 @@ if ($action == 'create') {
// Type
print '<tr><td class="fieldrequired">'.$langs->trans("AccountType").'</td>';
print '<td>';
$formbank->selectTypeOfBankAccount(GETPOSTISSET("type") ? GETPOST('type', 'alpha') : Account::TYPE_CURRENT, 'type');
$formbank->selectTypeOfBankAccount(GETPOSTISSET("type") ? GETPOST('type', 'int') : Account::TYPE_CURRENT, 'type');
print '</td></tr>';
// Currency
@ -490,7 +490,7 @@ if ($action == 'create') {
print '</table>';
print '<br>';
$type = GETPOST('type');
$type = (GETPOSTISSET("type") ? GETPOST('type', 'int') : Account::TYPE_CURRENT); // add default value
if ($type == Account::TYPE_SAVINGS || $type == Account::TYPE_CURRENT) {
print '<table class="border centpercent">';
@ -870,7 +870,7 @@ if ($action == 'create') {
// Type
print '<tr><td class="fieldrequired">'.$langs->trans("AccountType").'</td>';
print '<td class="maxwidth200onsmartphone">';
$formbank->selectTypeOfBankAccount((GETPOSTISSET('type') ? GETPOST('type', 'alpha') : $object->type), 'type');
$formbank->selectTypeOfBankAccount((GETPOSTISSET('type') ? GETPOST('type', 'int') : $object->type), 'type');
print '</td></tr>';
// Currency
@ -1015,7 +1015,8 @@ if ($action == 'create') {
print '</table>';
if (GETPOST("type") == Account::TYPE_SAVINGS || GETPOST("type") == Account::TYPE_CURRENT) {
$type = (GETPOSTISSET('type') ? GETPOST('type', 'int') : $object->type); // add default current value
if ($type == Account::TYPE_SAVINGS || $type == Account::TYPE_CURRENT) {
print '<br>';
//print '<div class="underbanner clearboth"></div>';

View file

@ -613,7 +613,7 @@ class Paiement extends CommonObject
// Insert payment into llx_bank
$bank_line_id = $acc->addline(
$this->datepaye,
$this->paiementid, // Payment mode id or code ("CHQ or VIR for example")
$this->paiementcode ? $this->paiementcode : $this->paiementid, // Payment mode code ('CB', 'CHQ' or 'VIR' for example). Use payment id if not defined for backward compatibility.
$label,
$totalamount, // Sign must be positive when we receive money (customer payment), negative when you give money (supplier invoice or credit note)
$this->num_payment,
@ -1151,7 +1151,7 @@ class Paiement extends CommonObject
*/
public function getNomUrl($withpicto = 0, $option = '', $mode = 'withlistofinvoices', $notooltip = 0, $morecss = '')
{
global $conf, $langs;
global $conf, $langs, $hookmanager;
if (!empty($conf->dol_no_mouse_hover)) {
$notooltip = 1; // Force disable tooltips

View file

@ -238,7 +238,14 @@ if ($id > 0 || $ref) {
$modulepart = 'paymentbybanktransfer';
}
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&amp;modulepart='.$modulepart.'&amp;file='.urlencode($relativepath).'">'.$relativepath.'</a>';
print '</td></tr></table>';
print '</td></tr>';
// Other attributes
$parameters = array();
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</table>';
print '</div>';

View file

@ -455,7 +455,7 @@ if ($modecompta == 'CREANCES-DETTES') {
$_SERVER["PHP_SELF"],
"amount",
"",
$classslink,
$paramslink,
'class="right"',
$sortfield,
$sortorder

View file

@ -2591,7 +2591,6 @@ class ContratLigne extends CommonObjectLine
*/
public $table_element = 'contratdet';
/**
* @var string Name to use for 'features' parameter to check module permissions with restrictedArea()
*/

View file

@ -142,7 +142,7 @@ class box_members_last_subscriptions extends ModeleBoxes
$this->info_box_contents[$line][] = array(
'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"',
'text' => $staticmember->getNomUrl(-1, 32, 'subscription'),
'text' => $staticmember->getNomUrl(-1, 32, 'card'),
'asis' => 1,
);

View file

@ -5310,8 +5310,7 @@ abstract class CommonObject
$sav_charset_output = $outputlangs->charset_output;
if (in_array(get_class($this), array('Adherent'))) {
$arrayofrecords = array(); // The write_file of templates of adherent class need this var
$resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, 'member', 1, $moreparams);
$resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, 'member', 1, 'tmp_cards', $moreparams);
} else {
$resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $moreparams);
}

View file

@ -45,6 +45,11 @@ abstract class CommonObjectLine extends CommonObject
*/
public $rowid;
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/
public $picto = 'line';
/**
* Product/service unit code ('km', 'm', 'p', ...)
* @var string

View file

@ -167,7 +167,7 @@ class Events // extends CommonObject
$sql .= " '".$this->db->escape(getUserRemoteIP())."',";
$sql .= " ".($this->user_agent ? "'".$this->db->escape(dol_trunc($this->user_agent, 250))."'" : 'NULL').",";
$sql .= " '".$this->db->idate($this->dateevent)."',";
$sql .= " ".($user->id ? "'".$this->db->escape($user->id)."'" : 'NULL').",";
$sql .= " ".($user->id > 0 ? ((int) $user->id) : 'NULL').",";
$sql .= " '".$this->db->escape(dol_trunc($this->description, 250))."',";
$sql .= " '".$this->db->escape(dol_getprefix())."'";
$sql .= ")";

View file

@ -1558,7 +1558,7 @@ class ExtraFields
} elseif ($type == 'price') {
//$value = price($value, 0, $langs, 0, 0, -1, $conf->currency);
if ($value || $value == '0') {
$value = price($value, 0, $langs, 0, 0, -1);
$value = price($value, 0, $langs, 0, $conf->global->MAIN_MAX_DECIMALS_TOT, -1).' '.$langs->getCurrencySymbol($conf->currency);
}
} elseif ($type == 'select') {
$valstr = (!empty($param['options'][$value]) ? $param['options'][$value] : '');

View file

@ -8123,12 +8123,9 @@ class Form
$out .= "\n".'<script>'."\n";
if ($addjscombo == 1) {
$tmpplugin = empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) ?constant('REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT;
$out .= 'function formatResult(record) {'."\n";
if ($elemtype == 'category') {
$out .= 'return \'<span><img src="'.DOL_URL_ROOT.'/theme/eldy/img/object_category.png"> \'+record.text+\'</span>\';';
} else {
$out .= 'return record.text;';
}
$out .= 'function formatResult(record, container) {'."\n";
$out .= ' if ($(record.element).attr("data-html") != undefined) return htmlEntityDecodeJs($(record.element).attr("data-html")); // If property html set, we decode html entities and use this'."\n";
$out .= ' return record.text;';
$out .= '};'."\n";
$out .= 'function formatSelection(record) {'."\n";
if ($elemtype == 'category') {
@ -8150,6 +8147,7 @@ class Form
// Specify format function for dropdown item
formatResult: formatResult,
templateResult: formatResult, /* For 4.0 */
escapeMarkup: function (markup) { return markup; }, // let our custom formatter work
// Specify format function for selected item
formatSelection: formatSelection,
templateSelection: formatSelection /* For 4.0 */

View file

@ -1486,58 +1486,6 @@ class FormOther
{
global $langs, $extrafields, $form;
$YYYY = substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1);
$MM = substr($langs->trans("Month"), 0, 1).substr($langs->trans("Month"), 0, 1);
$DD = substr($langs->trans("Day"), 0, 1).substr($langs->trans("Day"), 0, 1);
$HH = substr($langs->trans("Hour"), 0, 1).substr($langs->trans("Hour"), 0, 1);
$MI = substr($langs->trans("Minute"), 0, 1).substr($langs->trans("Minute"), 0, 1);
$SS = substr($langs->trans("Second"), 0, 1).substr($langs->trans("Second"), 0, 1);
foreach ($object->fields as $key => $val) {
if (!$val['isameasure']) {
if (in_array($key, array(
'id', 'ref_int', 'ref_ext', 'rowid', 'entity', 'last_main_doc', 'logo', 'logo_squarred', 'extraparams',
'parent', 'photo', 'socialnetworks', 'webservices_url', 'webservices_key'))) {
continue;
}
if (isset($val['enabled']) && !dol_eval($val['enabled'], 1)) {
continue;
}
if (isset($val['visible']) && !dol_eval($val['visible'], 1)) {
continue;
}
if (preg_match('/^fk_/', $key) && !preg_match('/^fk_statu/', $key)) {
continue;
}
if (preg_match('/^pass/', $key)) {
continue;
}
if (in_array($val['type'], array('html', 'text'))) {
continue;
}
if (in_array($val['type'], array('timestamp', 'date', 'datetime'))) {
$arrayofgroupby['t.'.$key.'-year'] = array('label' => $langs->trans($val['label']).' <span class="opacitymedium">('.$YYYY.')</span>', 'position' => $val['position'].'-y');
$arrayofgroupby['t.'.$key.'-month'] = array('label' => $langs->trans($val['label']).' <span class="opacitymedium">('.$YYYY.'-'.$MM.')</span>', 'position' => $val['position'].'-m');
$arrayofgroupby['t.'.$key.'-day'] = array('label' => $langs->trans($val['label']).' <span class="opacitymedium">('.$YYYY.'-'.$MM.'-'.$DD.')</span>', 'position' => $val['position'].'-d');
} else {
$arrayofgroupby['t.'.$key] = array('label' => $langs->trans($val['label']), 'position' => (int) $val['position']);
}
}
}
// Add extrafields to Group by
if ($object->isextrafieldmanaged) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
if ($extrafields->attributes[$object->table_element]['type'][$key] == 'separate') {
continue;
}
if (!empty($extrafields->attributes[$object->table_element]['totalizable'][$key])) {
continue;
}
$arrayofgroupby['te.'.$key] = array('label' => $langs->trans($extrafields->attributes[$object->table_element]['label'][$key]), 'position' => 1000 + (int) $extrafields->attributes[$object->table_element]['pos'][$key]);
}
}
$arrayofgroupby = dol_sort_array($arrayofgroupby, 'position', 'asc', 0, 0, 1);
$arrayofgroupbylabel = array();
foreach ($arrayofgroupby as $key => $val) {
$arrayofgroupbylabel[$key] = $val['label'];
@ -1558,68 +1506,13 @@ class FormOther
*/
public function selectXAxisField($object, $search_xaxis, &$arrayofxaxis, $showempty = '1')
{
global $langs, $extrafields, $form;
$YYYY = substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1);
$MM = substr($langs->trans("Month"), 0, 1).substr($langs->trans("Month"), 0, 1);
$DD = substr($langs->trans("Day"), 0, 1).substr($langs->trans("Day"), 0, 1);
$HH = substr($langs->trans("Hour"), 0, 1).substr($langs->trans("Hour"), 0, 1);
$MI = substr($langs->trans("Minute"), 0, 1).substr($langs->trans("Minute"), 0, 1);
$SS = substr($langs->trans("Second"), 0, 1).substr($langs->trans("Second"), 0, 1);
foreach ($object->fields as $key => $val) {
if (!$val['measure']) {
if (in_array($key, array(
'id', 'ref_int', 'ref_ext', 'rowid', 'entity', 'last_main_doc', 'logo', 'logo_squarred', 'extraparams',
'parent', 'photo', 'socialnetworks', 'webservices_url', 'webservices_key'))) {
continue;
}
if (isset($val['enabled']) && !dol_eval($val['enabled'], 1)) {
continue;
}
if (isset($val['visible']) && !dol_eval($val['visible'], 1)) {
continue;
}
if (preg_match('/^fk_/', $key) && !preg_match('/^fk_statu/', $key)) {
continue;
}
if (preg_match('/^pass/', $key)) {
continue;
}
if (in_array($val['type'], array('html', 'text'))) {
continue;
}
if (in_array($val['type'], array('timestamp', 'date', 'datetime'))) {
$arrayofxaxis['t.'.$key.'-year'] = array('label' => $langs->trans($val['label']).' <span class="opacitymedium">('.$YYYY.')</span>', 'position' => $val['position'].'-y');
$arrayofxaxis['t.'.$key.'-month'] = array('label' => $langs->trans($val['label']).' <span class="opacitymedium">('.$YYYY.'-'.$MM.')</span>', 'position' => $val['position'].'-m');
$arrayofxaxis['t.'.$key.'-day'] = array('label' => $langs->trans($val['label']).' <span class="opacitymedium">('.$YYYY.'-'.$MM.'-'.$DD.')</span>', 'position' => $val['position'].'-d');
} else {
$arrayofxaxis['t.'.$key] = array('label' => $langs->trans($val['label']), 'position' => (int) $val['position']);
}
}
}
// Add extrafields to X-Axis
if ($object->isextrafieldmanaged) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
if ($extrafields->attributes[$object->table_element]['type'][$key] == 'separate') {
continue;
}
if (!empty($extrafields->attributes[$object->table_element]['totalizable'][$key])) {
continue;
}
$arrayofxaxis['te.'.$key] = array('label' => $langs->trans($extrafields->attributes[$object->table_element]['label'][$key]), 'position' => 1000 + (int) $extrafields->attributes[$object->table_element]['pos'][$key]);
}
}
$arrayofxaxis = dol_sort_array($arrayofxaxis, 'position', 'asc', 0, 0, 1);
global $form;
$arrayofxaxislabel = array();
foreach ($arrayofxaxis as $key => $val) {
$arrayofxaxislabel[$key] = $val['label'];
}
$result = $form->selectarray('search_xaxis', $arrayofxaxislabel, $search_xaxis, $showempty, 0, 0, '', 0, 0, 0, '', 'minwidth250', 1);
$result = $form->selectarray('search_xaxis', $arrayofxaxislabel, $search_xaxis, $showempty, 0, 0, '', 0, 0, 0, '', 'minwidth250 maxwidth500', 1);
return $result;
}

View file

@ -175,7 +175,7 @@ $HH = substr($langs->trans("Hour"), 0, 1).substr($langs->trans("Hour"), 0, 1);
$MI = substr($langs->trans("Minute"), 0, 1).substr($langs->trans("Minute"), 0, 1);
$SS = substr($langs->trans("Second"), 0, 1).substr($langs->trans("Second"), 0, 1);
$arrayofmesures = array('t.count'=>'Count');
$arrayofmesures = array();
$arrayofxaxis = array();
$arrayofgroupby = array();
$arrayofyaxis = array();
@ -411,39 +411,28 @@ print $form->searchComponent(array($object->element => $object->fields), $search
print '</div>';
// Add measures into array
$count = 0;
$arrayofmesures = fillArrayOfMeasures($object, 't', $langs->trans($newarrayoftype[$objecttype]['label']), $arrayofmesures, 0, $count);
//var_dump($arrayofmesures);
print '<div class="divadvancedsearchfield clearboth">';
foreach ($object->fields as $key => $val) {
if (!empty($val['isameasure']) && (!isset($val['enabled']) || dol_eval($val['enabled'], 1))) {
$arrayofmesures['t.'.$key.'-sum'] = $langs->trans($val['label']).' <span class="opacitymedium">('.$langs->trans("Sum").')</span>';
$arrayofmesures['t.'.$key.'-average'] = $langs->trans($val['label']).' <span class="opacitymedium">('.$langs->trans("Average").')</span>';
$arrayofmesures['t.'.$key.'-min'] = $langs->trans($val['label']).' <span class="opacitymedium">('.$langs->trans("Minimum").')</span>';
$arrayofmesures['t.'.$key.'-max'] = $langs->trans($val['label']).' <span class="opacitymedium">('.$langs->trans("Maximum").')</span>';
}
}
// Add extrafields to Measures
if ($object->isextrafieldmanaged) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
if (!empty($extrafields->attributes[$object->table_element]['totalizable'][$key]) && (!isset($extrafields->attributes[$object->table_element]['enabled'][$key]) || dol_eval($extrafields->attributes[$object->table_element]['enabled'][$key], 1))) {
$arrayofmesures['te.'.$key.'-sum'] = $langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' <span class="opacitymedium">('.$langs->trans("Sum").')</span>';
$arrayofmesures['te.'.$key.'-average'] = $langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' <span class="opacitymedium">('.$langs->trans("Average").')</span>';
$arrayofmesures['te.'.$key.'-min'] = $langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' <span class="opacitymedium">('.$langs->trans("Minimum").')</span>';
$arrayofmesures['te.'.$key.'-max'] = $langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' <span class="opacitymedium">('.$langs->trans("Maximum").')</span>';
}
}
}
print '<div class="inline-block"><span class="fas fa-ruler-combined paddingright pictofixedwidth" title="'.dol_escape_htmltag($langs->trans("Measures")).'"></span><span class="fas fa-caret-left caretleftaxis" title="'.dol_escape_htmltag($langs->trans("Measures")).'"></span></div>';
print $form->multiselectarray('search_measures', $arrayofmesures, $search_measures, 0, 0, 'minwidth400', 1, 0, '', '', $langs->trans("Measures")); // Fill the array $arrayofmeasures with possible fields
print '</div>';
// XAxis
$count = 0;
$arrayofxaxis = fillArrayOfXAxis($object, 't', $langs->trans($newarrayoftype[$objecttype]['label']), $arrayofxaxis, 0, $count);
$arrayofxaxis = dol_sort_array($arrayofxaxis, 'position', 'asc', 0, 0, 1);
print '<div class="divadvancedsearchfield">';
print '<div class="inline-block"><span class="fas fa-ruler-combined paddingright pictofixedwidth" title="'.dol_escape_htmltag($langs->trans("XAxis")).'"></span><span class="fas fa-caret-down caretdownaxis" title="'.dol_escape_htmltag($langs->trans("XAxis")).'"></span></div>';
//var_dump($arrayofxaxis);
print $formother->selectXAxisField($object, $search_xaxis, $arrayofxaxis, $langs->trans("XAxis")); // Fill the array $arrayofxaxis with possible fields
print '</div>';
// Group by
$count = 0;
$arrayofgroupby = fillArrayOfGroupBy($object, 't', $langs->trans($newarrayoftype[$objecttype]['label']), $arrayofgroupby, 0, $count);
$arrayofgroupby = dol_sort_array($arrayofgroupby, 'position', 'asc', 0, 0, 1);
print '<div class="divadvancedsearchfield">';
print '<div class="inline-block opacitymedium"><span class="fas fa-ruler-horizontal paddingright pictofixedwidth" title="'.dol_escape_htmltag($langs->trans("GroupBy")).'"></span></div>';
print $formother->selectGroupByField($object, $search_groupby, $arrayofgroupby, 'minwidth200 maxwidth250', $langs->trans("GroupBy")); // Fill the array $arrayofgroupby with possible fields
@ -846,3 +835,276 @@ if (!defined('USE_CUSTOM_REPORT_AS_INCLUDE')) {
llxFooter();
$db->close();
/**
* Fill arrayofmesures for an object
*
* @param mixed $object Any object
* @param string $tablealias Alias of table
* @param string $labelofobject Label of object
* @param array $arrayofmesures Array of mesures already filled
* @param int $level Level
* @param int $count Count
* @return array Array of mesures
*/
function fillArrayOfMeasures($object, $tablealias, $labelofobject, &$arrayofmesures, $level = 0, &$count = 0)
{
global $langs, $extrafields, $db;
if ($level > 10) { // Protection against infinite loop
return $arrayofmesures;
}
if ($level == 0) {
// Add the count of record only for the main/first level object. Parents are necessarly unique for each record.
$arrayofmesures[$tablealias.'.count'] = img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': Count';
}
// Add main fields of object
foreach ($object->fields as $key => $val) {
if (!empty($val['isameasure']) && (!isset($val['enabled']) || dol_eval($val['enabled'], 1))) {
$arrayofmesures[$tablealias.'.'.$key.'-sum'] = img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' <span class="opacitymedium">('.$langs->trans("Sum").')</span>';
$arrayofmesures[$tablealias.'.'.$key.'-average'] = img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' <span class="opacitymedium">('.$langs->trans("Average").')</span>';
$arrayofmesures[$tablealias.'.'.$key.'-min'] = img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' <span class="opacitymedium">('.$langs->trans("Minimum").')</span>';
$arrayofmesures[$tablealias.'.'.$key.'-max'] = img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' <span class="opacitymedium">('.$langs->trans("Maximum").')</span>';
}
}
// Add extrafields to Measures
if ($object->isextrafieldmanaged) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
if (!empty($extrafields->attributes[$object->table_element]['totalizable'][$key]) && (!isset($extrafields->attributes[$object->table_element]['enabled'][$key]) || dol_eval($extrafields->attributes[$object->table_element]['enabled'][$key], 1))) {
$arrayofmesures[$tablealias.'e.'.$key.'-sum'] = img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' <span class="opacitymedium">('.$langs->trans("Sum").')</span>';
$arrayofmesures[$tablealias.'e.'.$key.'-average'] = img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' <span class="opacitymedium">('.$langs->trans("Average").')</span>';
$arrayofmesures[$tablealias.'e.'.$key.'-min'] = img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' <span class="opacitymedium">('.$langs->trans("Minimum").')</span>';
$arrayofmesures[$tablealias.'e.'.$key.'-max'] = img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' <span class="opacitymedium">('.$langs->trans("Maximum").')</span>';
}
}
}
// Add fields for parent objects
foreach ($object->fields as $key => $val) {
if (preg_match('/^[^:]+:[^:]+:/', $val['type'])) {
$tmptype = explode(':', $val['type'], 4);
if ($tmptype[0] = 'integer' && $tmptype[1] && $tmptype[2]) {
$newobject = $tmptype[1];
dol_include_once($tmptype[2]);
if (class_exists($newobject)) {
$tmpobject = new $newobject($db);
/*var_dump($val['label']);
var_dump($tmptype);
var_dump($arrayofmesures);
var_dump('t-'.$key);*/
$count++;
$arrayofmesures = fillArrayOfMeasures($tmpobject, $tablealias.'__'.$key, $langs->trans($val['label']), $arrayofmesures, $level + 1, $count);
} else {
print 'Failed to find '.$newobject.' class for field '.$key.' of object '.$object->element."\n";
}
}
}
}
return $arrayofmesures;
}
/**
* Fill arrayofmesures for an object
*
* @param mixed $object Any object
* @param string $tablealias Alias of table
* @param string $labelofobject Label of object
* @param array $arrayofxaxis Array of xaxis already filled
* @param int $level Level
* @param int $count Count
* @return array Array of xaxis
*/
function fillArrayOfXAxis($object, $tablealias, $labelofobject, &$arrayofxaxis, $level = 0, &$count = 0)
{
global $langs, $extrafields, $db;
if ($level > 10) { // Protection against infinite loop
return $arrayofxaxis;
}
if ($level >= 2) {
return $arrayofxaxis;
}
$YYYY = substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1);
$MM = substr($langs->trans("Month"), 0, 1).substr($langs->trans("Month"), 0, 1);
$DD = substr($langs->trans("Day"), 0, 1).substr($langs->trans("Day"), 0, 1);
$HH = substr($langs->trans("Hour"), 0, 1).substr($langs->trans("Hour"), 0, 1);
$MI = substr($langs->trans("Minute"), 0, 1).substr($langs->trans("Minute"), 0, 1);
$SS = substr($langs->trans("Second"), 0, 1).substr($langs->trans("Second"), 0, 1);
// Add main fields of object
foreach ($object->fields as $key => $val) {
if (empty($val['measure'])) {
if (in_array($key, array(
'id', 'ref_int', 'ref_ext', 'rowid', 'entity', 'last_main_doc', 'logo', 'logo_squarred', 'extraparams',
'parent', 'photo', 'socialnetworks', 'webservices_url', 'webservices_key'))) {
continue;
}
if (isset($val['enabled']) && !dol_eval($val['enabled'], 1)) {
continue;
}
if (isset($val['visible']) && !dol_eval($val['visible'], 1)) {
continue;
}
if (preg_match('/^fk_/', $key) && !preg_match('/^fk_statu/', $key)) {
continue;
}
if (preg_match('/^pass/', $key)) {
continue;
}
if (in_array($val['type'], array('html', 'text'))) {
continue;
}
if (in_array($val['type'], array('timestamp', 'date', 'datetime'))) {
$arrayofxaxis[$tablealias.'.'.$key.'-year'] = array('label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' <span class="opacitymedium">('.$YYYY.')</span>', 'position' => ($val['position']+($count * 100000)).'.1');
$arrayofxaxis[$tablealias.'.'.$key.'-month'] = array('label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' <span class="opacitymedium">('.$YYYY.'-'.$MM.')</span>', 'position' => ($val['position']+($count * 100000)).'.2');
$arrayofxaxis[$tablealias.'.'.$key.'-day'] = array('label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' <span class="opacitymedium">('.$YYYY.'-'.$MM.'-'.$DD.')</span>', 'position' => ($val['position']+($count * 100000)).'.3');
} else {
$arrayofxaxis[$tablealias.'.'.$key] = array('label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']), 'position' => ($val['position']+($count * 100000)));
}
}
}
// Add extrafields to X-Axis
if ($object->isextrafieldmanaged) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
if ($extrafields->attributes[$object->table_element]['type'][$key] == 'separate') {
continue;
}
if (!empty($extrafields->attributes[$object->table_element]['totalizable'][$key])) {
continue;
}
$arrayofxaxis[$tablealias.'e.'.$key] = array('label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($extrafields->attributes[$object->table_element]['label'][$key]), 'position' => 1000 + (int) $extrafields->attributes[$object->table_element]['pos'][$key] + ($count * 100000));
}
}
// Add fields for parent objects
foreach ($object->fields as $key => $val) {
if (preg_match('/^[^:]+:[^:]+:/', $val['type'])) {
$tmptype = explode(':', $val['type'], 4);
if ($tmptype[0] = 'integer' && $tmptype[1] && $tmptype[2]) {
$newobject = $tmptype[1];
dol_include_once($tmptype[2]);
if (class_exists($newobject)) {
$tmpobject = new $newobject($db);
/*var_dump($val['label']);
var_dump($tmptype);
var_dump($arrayofmesures);
var_dump('t-'.$key);*/
$count++;
$arrayofxaxis = fillArrayOfXAxis($tmpobject, $tablealias.'__'.$key, $langs->trans($val['label']), $arrayofxaxis, $level + 1, $count);
} else {
print 'Failed to find '.$newobject.' class for field '.$key.' of object '.$object->element."\n";
}
}
}
}
return $arrayofxaxis;
}
/**
* Fill arrayofgrupby for an object
*
* @param mixed $object Any object
* @param string $tablealias Alias of table
* @param string $labelofobject Label of object
* @param array $arrayofgroupby Array of groupby already filled
* @param int $level Level
* @param int $count Count
* @return array Array of groupby
*/
function fillArrayOfGroupBy($object, $tablealias, $labelofobject, &$arrayofgroupby, $level = 0, &$count = 0)
{
global $langs, $extrafields, $db;
if ($level > 10) { // Protection against infinite loop
return $arrayofgroupby;
}
if ($level >= 2) {
return $arrayofgroupby;
}
$YYYY = substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1);
$MM = substr($langs->trans("Month"), 0, 1).substr($langs->trans("Month"), 0, 1);
$DD = substr($langs->trans("Day"), 0, 1).substr($langs->trans("Day"), 0, 1);
$HH = substr($langs->trans("Hour"), 0, 1).substr($langs->trans("Hour"), 0, 1);
$MI = substr($langs->trans("Minute"), 0, 1).substr($langs->trans("Minute"), 0, 1);
$SS = substr($langs->trans("Second"), 0, 1).substr($langs->trans("Second"), 0, 1);
// Add main fields of object
foreach ($object->fields as $key => $val) {
if (!$val['isameasure']) {
if (in_array($key, array(
'id', 'ref_int', 'ref_ext', 'rowid', 'entity', 'last_main_doc', 'logo', 'logo_squarred', 'extraparams',
'parent', 'photo', 'socialnetworks', 'webservices_url', 'webservices_key'))) {
continue;
}
if (isset($val['enabled']) && !dol_eval($val['enabled'], 1)) {
continue;
}
if (isset($val['visible']) && !dol_eval($val['visible'], 1)) {
continue;
}
if (preg_match('/^fk_/', $key) && !preg_match('/^fk_statu/', $key)) {
continue;
}
if (preg_match('/^pass/', $key)) {
continue;
}
if (in_array($val['type'], array('html', 'text'))) {
continue;
}
if (in_array($val['type'], array('timestamp', 'date', 'datetime'))) {
$arrayofgroupby[$tablealias.'.'.$key.'-year'] = array('label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' <span class="opacitymedium">('.$YYYY.')</span>', 'position' => ($val['position']+($count * 100000)).'.1');
$arrayofgroupby[$tablealias.'.'.$key.'-month'] = array('label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' <span class="opacitymedium">('.$YYYY.'-'.$MM.')</span>', 'position' => ($val['position']+($count * 100000)).'.2');
$arrayofgroupby[$tablealias.'.'.$key.'-day'] = array('label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' <span class="opacitymedium">('.$YYYY.'-'.$MM.'-'.$DD.')</span>', 'position' => ($val['position']+($count * 100000)).'.3');
} else {
$arrayofgroupby[$tablealias.'.'.$key] = array('label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']), 'position' => ($val['position']+($count * 100000)));
}
}
}
// Add extrafields to Group by
if ($object->isextrafieldmanaged) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
if ($extrafields->attributes[$object->table_element]['type'][$key] == 'separate') {
continue;
}
if (!empty($extrafields->attributes[$object->table_element]['totalizable'][$key])) {
continue;
}
$arrayofgroupby[$tablealias.'e.'.$key] = array('label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($extrafields->attributes[$object->table_element]['label'][$key]), 'position' => 1000 + (int) $extrafields->attributes[$object->table_element]['pos'][$key] + ($count * 100000));
}
}
// Add fields for parent objects
foreach ($object->fields as $key => $val) {
if (preg_match('/^[^:]+:[^:]+:/', $val['type'])) {
$tmptype = explode(':', $val['type'], 4);
if ($tmptype[0] = 'integer' && $tmptype[1] && $tmptype[2]) {
$newobject = $tmptype[1];
dol_include_once($tmptype[2]);
if (class_exists($newobject)) {
$tmpobject = new $newobject($db);
/*var_dump($val['label']);
var_dump($tmptype);
var_dump($arrayofmesures);
var_dump('t-'.$key);*/
$count++;
$arrayofgroupby = fillArrayOfGroupBy($tmpobject, $tablealias.'__'.$key, $langs->trans($val['label']), $arrayofgroupby, $level + 1, $count);
} else {
print 'Failed to find '.$newobject.' class for field '.$key.' of object '.$object->element."\n";
}
}
}
}
return $arrayofgroupby;
}

View file

@ -1627,6 +1627,7 @@ function form_constantes($tableau, $strictw3c = 0, $helptext = '', $text = 'Valu
if (empty($strictw3c)) {
print "\n".'<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="page_y" value="'.newToken().'">';
}
print '<tr class="oddeven">';
@ -1733,7 +1734,7 @@ function form_constantes($tableau, $strictw3c = 0, $helptext = '', $text = 'Valu
// Submit
if (empty($strictw3c)) {
print '<td class="center">';
print '<input type="submit" class="button" value="'.$langs->trans("Update").'" name="Button">';
print '<input type="submit" class="button small reposition" value="'.$langs->trans("Update").'" name="update">';
print "</td>";
}
@ -1748,7 +1749,7 @@ function form_constantes($tableau, $strictw3c = 0, $helptext = '', $text = 'Valu
print '</div>';
if (!empty($strictw3c) && $strictw3c == 1) {
print '<div align="center"><input type="submit" class="button" value="'.$langs->trans("Update").'" name="update"></div>';
print '<div align="center"><input type="submit" class="button small reposition" value="'.$langs->trans("Update").'" name="update"></div>';
print "</form>\n";
}
}

View file

@ -665,16 +665,16 @@ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null
}
// Sanitizing for special parameters.
// Note: There is no reason to allow the backtopage, backtolist or backtourl parameter to contains an external URL.
// Note: There is no reason to allow the backtopage, backtolist or backtourl parameter to contains an external URL. Only relative URLs are allowed.
if ($paramname == 'backtopage' || $paramname == 'backtolist' || $paramname == 'backtourl') {
$out = str_replace('\\', '/', $out); // Can be before the loop because only 1 char is replaced. No risk to get it after other replacements.
$out = str_replace(array(':', ';', '@'), '', $out); // Can be before the loop because only 1 char is replaced. No risk to get it after other replacements.
$out = str_replace('\\', '/', $out); // Can be before the loop because only 1 char is replaced. No risk to get it after other replacements.
$out = str_replace(array(':', ';', '@', "\t", ' '), '', $out); // Can be before the loop because only 1 char is replaced. No risk to retreive it after other replacements.
do {
$oldstringtoclean = $out;
$out = str_ireplace(array('javascript', 'vbscript', '&colon', '&#'), '', $out);
$out = preg_replace(array('/^[^\?]*%/'), '', $out); // We remove any % chars before the ?. Example in url: '/product/stock/card.php?action=create&backtopage=%2Fdolibarr_dev%2Fhtdocs%2Fpro%25duct%2Fcard.php%3Fid%3Dabc'
$out = preg_replace(array('/^[a-z]*\/\s*\/+/i'), '', $out); // We remove schema*// to remove external URL
} while ($oldstringtoclean != $out);
$out = preg_replace(array('/^[a-z]*\/\/+/i'), '', $out); // We remove schema*// to remove external URL
}
// Code for search criteria persistence.
@ -870,31 +870,32 @@ if (!function_exists('dol_getprefix')) {
* Return a prefix to use for this Dolibarr instance, for session/cookie names or email id.
* The prefix is unique for instance and avoid conflict between multi-instances, even when having two instances with same root dir
* or two instances in same virtual servers.
* This function must not use dol_hash (that is used for password hash) and need to have all context $conf loaded.
*
* @param string $mode '' (prefix for session name) or 'email' (prefix for email id)
* @return string A calculated prefix
*/
function dol_getprefix($mode = '')
{
// If prefix is for email (we need to have $conf alreayd loaded for this case)
// If prefix is for email (we need to have $conf already loaded for this case)
if ($mode == 'email') {
global $conf;
if (!empty($conf->global->MAIL_PREFIX_FOR_EMAIL_ID)) { // If MAIL_PREFIX_FOR_EMAIL_ID is set (a value initialized with a random value is recommended)
if (!empty($conf->global->MAIL_PREFIX_FOR_EMAIL_ID)) { // If MAIL_PREFIX_FOR_EMAIL_ID is set
if ($conf->global->MAIL_PREFIX_FOR_EMAIL_ID != 'SERVER_NAME') {
return $conf->global->MAIL_PREFIX_FOR_EMAIL_ID;
} elseif (isset($_SERVER["SERVER_NAME"])) {
} elseif (isset($_SERVER["SERVER_NAME"])) { // If MAIL_PREFIX_FOR_EMAIL_ID is set to 'SERVER_NAME'
return $_SERVER["SERVER_NAME"];
}
}
// The recommended value (may be not defined for old versions)
// The recommended value if MAIL_PREFIX_FOR_EMAIL_ID is not defined (may be not defined for old versions)
if (!empty($conf->file->instance_unique_id)) {
return $conf->file->instance_unique_id;
return sha1('dolibarr'.$conf->file->instance_unique_id);
}
// For backward compatibility
return dol_hash(DOL_DOCUMENT_ROOT.DOL_URL_ROOT, '3');
// For backward compatibility when instance_unique_id is not set
return sha1(DOL_DOCUMENT_ROOT.DOL_URL_ROOT);
}
// If prefix is for session (no need to have $conf loaded)
@ -903,15 +904,15 @@ if (!function_exists('dol_getprefix')) {
// The recommended value (may be not defined for old versions)
if (!empty($tmp_instance_unique_id)) {
return $tmp_instance_unique_id;
return sha1('dolibarr'.$tmp_instance_unique_id);
}
// For backward compatibility
// For backward compatibility when instance_unique_id is not set
if (isset($_SERVER["SERVER_NAME"]) && isset($_SERVER["DOCUMENT_ROOT"])) {
return dol_hash($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_URL_ROOT, '3');
return sha1($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_URL_ROOT);
} else {
return sha1(DOL_DOCUMENT_ROOT.DOL_URL_ROOT);
}
return dol_hash(DOL_DOCUMENT_ROOT.DOL_URL_ROOT, '3');
}
}
@ -2020,7 +2021,6 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
}
if (empty($phototoshow)) { // Show No photo link (picto of object)
$morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref">';
if ($object->element == 'action') {
$width = 80;
$cssclass = 'photorefcenter';
@ -2042,8 +2042,6 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
$morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref">';
$morehtmlleft .= $nophoto;
$morehtmlleft .= '</div></div>';
$morehtmlleft .= '</div>';
}
}
}
@ -3733,7 +3731,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'generate', 'globe', 'globe-americas', 'graph', 'grip', 'grip_title', 'group',
'help', 'holiday',
'images', 'incoterm', 'info', 'intervention', 'inventory', 'intracommreport', 'knowledgemanagement',
'label', 'language', 'link', 'list', 'list-alt', 'listlight', 'loan', 'lot', 'long-arrow-alt-right',
'label', 'language', 'line', 'link', 'list', 'list-alt', 'listlight', 'loan', 'lot', 'long-arrow-alt-right',
'margin', 'map-marker-alt', 'member', 'meeting', 'money-bill-alt', 'movement', 'mrp', 'note', 'next',
'off', 'on', 'order',
'paiment', 'paragraph', 'play', 'pdf', 'phone', 'phoning', 'phoning_mobile', 'phoning_fax', 'playdisabled', 'previous', 'poll', 'pos', 'printer', 'product', 'propal', 'puce',
@ -3778,7 +3776,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'email'=>'at', 'establishment'=>'building', 'edit'=>'pencil-alt', 'entity'=>'globe',
'graph'=>'chart-line', 'grip_title'=>'arrows-alt', 'grip'=>'arrows-alt', 'help'=>'question-circle',
'generic'=>'file', 'holiday'=>'umbrella-beach',
'info'=>'info-circle', 'inventory'=>'boxes', 'intracommreport'=>'globe-europe', 'knowledgemanagement'=>'ticket-alt', 'label'=>'layer-group', 'loan'=>'money-bill-alt',
'info'=>'info-circle', 'inventory'=>'boxes', 'intracommreport'=>'globe-europe', 'knowledgemanagement'=>'ticket-alt', 'label'=>'layer-group', 'line'=>'bars', 'loan'=>'money-bill-alt',
'member'=>'user-alt', 'meeting'=>'chalkboard-teacher', 'mrp'=>'cubes', 'next'=>'arrow-alt-circle-right',
'trip'=>'wallet', 'expensereport'=>'wallet', 'group'=>'users', 'movement'=>'people-carry',
'sign-out'=>'sign-out-alt',
@ -10504,6 +10502,7 @@ function newToken()
/**
* Return the value of token currently saved into session with name 'token'.
* For ajax call, you must use this token as a parameter of the call into the js calling script (the called ajax php page must also set constant NOTOKENRENEWAL).
*
* @return string
*/

View file

@ -187,7 +187,8 @@ if (!function_exists('dol_loginfunction')) {
$template_dir = DOL_DOCUMENT_ROOT."/core/tpl/";
}
// Set cookie for timeout management
// Set cookie for timeout management. We set it as a cookie so we will be able to use it to set timeout on next page before the session start
// and the conf file is loaded.
$prefix = dol_getprefix('');
$sessiontimeout = 'DOLSESSTIMEOUT_'.$prefix;
if (!empty($conf->global->MAIN_SESSION_TIMEOUT)) {

View file

@ -114,6 +114,11 @@ function stock_admin_prepare_head()
$head[$h][2] = 'stockMouvementAttributes';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/product/admin/inventory_extrafields.php';
$head[$h][1] = $langs->trans("InventoryExtraFields");
$head[$h][2] = 'inventoryAttributes';
$h++;
complete_head_from_modules($conf, $langs, null, $head, $h, 'stock_admin', 'remove');
return $head;

View file

@ -476,7 +476,7 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
if ($sql) { // May not be defined if module Agenda is not enabled and mailing module disabled too
$sql .= $db->order($sortfield_new, $sortorder);
dol_syslog("company.lib::show_actions_done", LOG_DEBUG);
dol_syslog("ticket.lib::show_ticket_messaging", LOG_DEBUG);
$resql = $db->query($sql);
if ($resql) {
$i = 0;
@ -491,7 +491,7 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
$result = $contactaction->fetchResources();
if ($result < 0) {
dol_print_error($db);
setEventMessage("company.lib::show_actions_done Error fetch ressource", 'errors');
setEventMessage("ticket.lib::show_ticket_messaging Error fetch ressource", 'errors');
}
//if ($donetodo == 'todo') $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))";

View file

@ -467,7 +467,7 @@ function redirectToContainer($containerref, $containeraliasalt = '', $containeri
if ($permanent) {
header("Status: 301 Moved Permanently", false, 301);
}
header("Location: ".$newurl);
header("Location: ".$newurl.(empty($_SERVER["QUERY_STRING"]) ? '' : '?'.$_SERVER["QUERY_STRING"]));
exit;
} else {
print "Error, page contains a redirect to the alias page '".$containerref."' that does not exists in web site (".$website->id." / ".$website->ref.")";

View file

@ -601,3 +601,59 @@ function showWebsiteTemplates(Website $website)
print '</td></tr>';
print '</table>';
}
/**
* checkPHPCode
*
* @param string $phpfullcodestringold PHP old string
* @param string $phpfullcodestring PHP new string
* @return int Error or not
*/
function checkPHPCode($phpfullcodestringold, $phpfullcodestring)
{
global $conf, $langs, $user;
$error = 0;
if (empty($phpfullcodestringold) && empty($phpfullcodestring)) {
return 0;
}
// First check forbidden commands
$forbiddenphpcommands = array();
if (empty($conf->global->WEBSITE_PHP_ALLOW_EXEC)) { // If option is not on, we disallow functions to execute commands
$forbiddenphpcommands = array("exec", "passthru", "shell_exec", "system", "proc_open", "popen", "eval", "dol_eval", "executeCLI");
}
if (empty($conf->global->WEBSITE_PHP_ALLOW_WRITE)) { // If option is not on, we disallow functions to write files
$forbiddenphpcommands = array_merge($forbiddenphpcommands, array("fopen", "file_put_contents", "fputs", "fputscsv", "fwrite", "fpassthru", "unlink", "mkdir", "rmdir", "symlink", "touch", "umask"));
}
foreach ($forbiddenphpcommands as $forbiddenphpcommand) {
if (preg_match('/'.$forbiddenphpcommand.'\s*\(/ms', $phpfullcodestring)) {
$error++;
setEventMessages($langs->trans("DynamicPHPCodeContainsAForbiddenInstruction", $forbiddenphpcommand), null, 'errors');
break;
}
}
// This char can be used to execute RCE for example using with echo `ls`
$forbiddenphpchars = array();
if (empty($conf->global->WEBSITE_PHP_ALLOW_DANGEROUS_CHARS)) { // If option is not on, we disallow functions to execute commands
$forbiddenphpchars = array("`");
}
foreach ($forbiddenphpchars as $forbiddenphpchar) {
if (preg_match('/'.$forbiddenphpchar.'/ms', $phpfullcodestring)) {
$error++;
setEventMessages($langs->trans("DynamicPHPCodeContainsAForbiddenInstruction", $forbiddenphpchar), null, 'errors');
break;
}
}
if (!$error && empty($user->rights->website->writephp)) {
if ($phpfullcodestringold != $phpfullcodestring) {
$error++;
setEventMessages($langs->trans("NotAllowedToAddDynamicContent"), null, 'errors');
}
}
return $error;
}

View file

@ -109,7 +109,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
//$texte.= '<tr><td>'.$langs->trans("Mask").' ('.$langs->trans("BarCodeModel").'):</td>';
$texte .= '<tr><td>'.$langs->trans("Mask").':</td>';
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="value1" value="'.(!empty($conf->global->BARCODE_STANDARD_PRODUCT_MASK) ? $conf->global->BARCODE_STANDARD_PRODUCT_MASK : '').'"'.$disabled.'>', $tooltip, 1, 1).'</td>';
$texte .= '<td class="left" rowspan="2">&nbsp; <input type="submit" class="button button-edit reposition" name="Button" value="'.$langs->trans("Modify").'"'.$disabled.'></td>';
$texte .= '<td class="left" rowspan="2">&nbsp; <input type="submit" class="button button-edit reposition" name="modify" value="'.$langs->trans("Modify").'"'.$disabled.'></td>';
$texte .= '</tr>';
$texte .= '</table>';

View file

@ -152,7 +152,7 @@ class doc_generic_bom_odt extends ModelePDFBom
$texte .= $conf->global->BOM_ADDON_PDF_ODT_PATH;
$texte .= '</textarea>';
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
$texte .= '<input type="submit" class="button small reposition" name="Button" value="'.$langs->trans("Modify").'">';
$texte .= '<input type="submit" class="button small reposition" name="modify" value="'.$langs->trans("Modify").'">';
$texte .= '<br></div></div>';
// Scan directories

View file

@ -160,7 +160,7 @@ class doc_generic_order_odt extends ModelePDFCommandes
$texte .= $conf->global->COMMANDE_ADDON_PDF_ODT_PATH;
$texte .= '</textarea>';
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
$texte .= '<input type="submit" class="button small reposition" name="Button" value="'.$langs->trans("Modify").'">';
$texte .= '<input type="submit" class="button small reposition" name="modify" value="'.$langs->trans("Modify").'">';
$texte .= '<br></div></div>';
// Scan directories

View file

@ -160,7 +160,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
$texte .= $conf->global->EXPEDITION_ADDON_PDF_ODT_PATH;
$texte .= '</textarea>';
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
$texte .= '<input type="submit" class="button button-edit reposition" name="Button" value="'.$langs->trans("Modify").'">';
$texte .= '<input type="submit" class="button button-edit reposition" name="modify" value="'.$langs->trans("Modify").'">';
$texte .= '<br></div></div>';
// Scan directories

View file

@ -159,7 +159,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures
$texte .= $conf->global->FACTURE_ADDON_PDF_ODT_PATH;
$texte .= '</textarea>';
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
$texte .= '<input type="submit" class="button small reposition" name="Button"value="'.$langs->trans("Modify").'">';
$texte .= '<input type="submit" class="button small reposition" name="modify"value="'.$langs->trans("Modify").'">';
$texte .= '<br></div></div>';
// Scan directories

View file

@ -366,7 +366,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
$pdf->SetSubject($outputlangs->transnoentities("PdfInvoiceTitle"));
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetAuthor($mysoc->name.($user->id > 0 ? ' - '.$outputlangs->convToOutputCharset($user->getFullName($outputlangs)) : ''));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfInvoiceTitle")." ".$outputlangs->convToOutputCharset($object->thirdparty->name));
if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) {
$pdf->SetCompression(false);
@ -374,10 +374,14 @@ class pdf_crabe extends ModelePDFFactures
// Set certificate
$cert = empty($user->conf->CERTIFICATE_CRT) ? '' : $user->conf->CERTIFICATE_CRT;
$certprivate = empty($user->conf->CERTIFICATE_CRT_PRIVATE) ? '' : $user->conf->CERTIFICATE_CRT_PRIVATE;
// If user has no certificate, we try to take the company one
if (!$cert) {
$cert = empty($conf->global->CERTIFICATE_CRT) ? '' : $conf->global->CERTIFICATE_CRT;
}
if (!$certprivate) {
$certprivate = empty($conf->global->CERTIFICATE_CRT_PRIVATE) ? '' : $conf->global->CERTIFICATE_CRT_PRIVATE;
}
// If a certificate is found
if ($cert) {
$info = array(
@ -386,7 +390,7 @@ class pdf_crabe extends ModelePDFFactures
'Reason' => 'INVOICE',
'ContactInfo' => $this->emetteur->email
);
$pdf->setSignature($cert, $cert, $this->emetteur->name, '', 2, $info);
$pdf->setSignature($cert, $certprivate, $this->emetteur->name, '', 2, $info);
}
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
@ -814,6 +818,7 @@ class pdf_crabe extends ModelePDFFactures
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code);
$bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
}
dol_syslog("bottomlasttab=".$bottomlasttab." this->page_hauteur=".$this->page_hauteur." heightforinfotot=".$heightforinfotot." heightforfreetext=".$heightforfreetext." heightforfooter=".$heightforfooter);
// Display info area
$posy = $this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs, $outputlangsbis);
@ -1176,9 +1181,9 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetXY($this->marge_gauche, $posy);
$pdf->writeHTMLCell(80, 5, '', '', dol_htmlentitiesbr($linktopay), 0, 1);
}
$posy = $pdf->GetY() + 1;
$posy = $pdf->GetY() + 1;
}
}
// Show payment mode CHQ

View file

@ -367,7 +367,7 @@ class pdf_sponge extends ModelePDFFactures
$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
$pdf->SetSubject($outputlangs->transnoentities("PdfInvoiceTitle"));
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetAuthor($mysoc->name.($user->id > 0 ? ' - '.$outputlangs->convToOutputCharset($user->getFullName($outputlangs)) : ''));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfInvoiceTitle")." ".$outputlangs->convToOutputCharset($object->thirdparty->name));
if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) {
$pdf->SetCompression(false);
@ -375,10 +375,14 @@ class pdf_sponge extends ModelePDFFactures
// Set certificate
$cert = empty($user->conf->CERTIFICATE_CRT) ? '' : $user->conf->CERTIFICATE_CRT;
$certprivate = empty($user->conf->CERTIFICATE_CRT_PRIVATE) ? '' : $user->conf->CERTIFICATE_CRT_PRIVATE;
// If user has no certificate, we try to take the company one
if (!$cert) {
$cert = empty($conf->global->CERTIFICATE_CRT) ? '' : $conf->global->CERTIFICATE_CRT;
}
if (!$certprivate) {
$certprivate = empty($conf->global->CERTIFICATE_CRT_PRIVATE) ? '' : $conf->global->CERTIFICATE_CRT_PRIVATE;
}
// If a certificate is found
if ($cert) {
$info = array(
@ -387,7 +391,7 @@ class pdf_sponge extends ModelePDFFactures
'Reason' => 'INVOICE',
'ContactInfo' => $this->emetteur->email
);
$pdf->setSignature($cert, $cert, $this->emetteur->name, '', 2, $info);
$pdf->setSignature($cert, $certprivate, $this->emetteur->name, '', 2, $info);
}
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
@ -1255,9 +1259,9 @@ class pdf_sponge extends ModelePDFFactures
$pdf->SetXY($this->marge_gauche, $posy);
$pdf->writeHTMLCell(80, 5, '', '', dol_htmlentitiesbr($linktopay), 0, 1);
}
$posy = $pdf->GetY() + 1;
$posy = $pdf->GetY() + 1;
}
}
// Show payment mode CHQ

View file

@ -736,6 +736,29 @@ class ImportCsv extends ModeleImports
$tmp = explode('-', $val, 2);
$listfields[] = preg_replace('/^'.preg_quote($alias, '/').'\./', '', $key);
$listvalues[] = "'".$this->db->escape($tmp[1])."'";
} elseif (preg_match('/^rule-/', $val)) {
$fieldname = $key;
if (!empty($objimport->array_import_convertvalue[0][$fieldname])) {
if ($objimport->array_import_convertvalue[0][$fieldname]['rule'] == 'compute') {
$file = (empty($objimport->array_import_convertvalue[0][$fieldname]['classfile']) ? $objimport->array_import_convertvalue[0][$fieldname]['file'] : $objimport->array_import_convertvalue[0][$fieldname]['classfile']);
$class = $objimport->array_import_convertvalue[0][$fieldname]['class'];
$method = $objimport->array_import_convertvalue[0][$fieldname]['method'];
$resultload = dol_include_once($file);
if (empty($resultload)) {
dol_print_error('', 'Error trying to call file=' . $file . ', class=' . $class . ', method=' . $method);
break;
}
$classinstance = new $class($this->db);
$res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord, $fieldname, &$listfields, &$listvalues));
if ($res < 0) {
if (!empty($objimport->array_import_convertvalue[0][$fieldname]['dict'])) $this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', $key, end($listvalues), 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$fieldname]['dict']));
else $this->errors[$error]['lib'] = 'ErrorFieldValueNotIn';
$this->errors[$error]['type'] = 'FOREIGNKEY';
$errorforthistable++;
$error++;
}
}
}
} else {
$this->errors[$error]['lib'] = 'Bad value of profile setup '.$val.' for array_import_fieldshidden';
$this->errors[$error]['type'] = 'Import profile setup';

View file

@ -776,7 +776,30 @@ class ImportXlsx extends ModeleImports
} elseif (preg_match('/^const-/', $val)) {
$tmp = explode('-', $val, 2);
$listfields[] = preg_replace('/^' . preg_quote($alias, '/') . '\./', '', $key);
$listvalues[] = "'" . $this->db->escape($tmp[1]) . "'";
$listvalues[] = "'".$this->db->escape($tmp[1])."'";
} elseif (preg_match('/^rule-/', $val)) {
$fieldname = $key;
if (!empty($objimport->array_import_convertvalue[0][$fieldname])) {
if ($objimport->array_import_convertvalue[0][$fieldname]['rule'] == 'compute') {
$file = (empty($objimport->array_import_convertvalue[0][$fieldname]['classfile']) ? $objimport->array_import_convertvalue[0][$fieldname]['file'] : $objimport->array_import_convertvalue[0][$fieldname]['classfile']);
$class = $objimport->array_import_convertvalue[0][$fieldname]['class'];
$method = $objimport->array_import_convertvalue[0][$fieldname]['method'];
$resultload = dol_include_once($file);
if (empty($resultload)) {
dol_print_error('', 'Error trying to call file=' . $file . ', class=' . $class . ', method=' . $method);
break;
}
$classinstance = new $class($this->db);
$res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord, $fieldname, &$listfields, &$listvalues));
if ($res < 0) {
if (!empty($objimport->array_import_convertvalue[0][$fieldname]['dict'])) $this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', $key, end($listvalues), 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$fieldname]['dict']));
else $this->errors[$error]['lib'] = 'ErrorFieldValueNotIn';
$this->errors[$error]['type'] = 'FOREIGNKEY';
$errorforthistable++;
$error++;
}
}
}
} else {
$this->errors[$error]['lib'] = 'Bad value of profile setup ' . $val . ' for array_import_fieldshidden';
$this->errors[$error]['type'] = 'Import profile setup';

View file

@ -155,7 +155,7 @@ class doc_generic_member_odt extends ModelePDFMember
$texte .= $conf->global->MEMBER_ADDON_PDF_ODT_PATH;
$texte .= '</textarea>';
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
$texte .= '<input type="submit" class="button small reposition" name="Button" value="'.$langs->trans("Modify").'">';
$texte .= '<input type="submit" class="button small reposition" name="modify" value="'.$langs->trans("Modify").'">';
$texte .= '<br></div></div>';
// Scan directories

View file

@ -33,6 +33,32 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonstickergenerator.class.php';
*/
class pdf_standard extends CommonStickerGenerator
{
/**
* Dolibarr version of the loaded document
* @var string
*/
public $version = 'dolibarr';
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
public function __construct($db)
{
global $conf, $langs, $mysoc;
// Translations
$langs->loadLangs(array("main", "admin"));
$this->db = $db;
$this->name = "standard";
$this->description = $langs->trans('TemplateforBusinessCards');
//$this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template
$this->type = 'pdf-various-sizes';
}
/**
* Output a sticker on page at position _COUNTX, _COUNTY (_COUNTX and _COUNTY start from 0)

View file

@ -106,7 +106,10 @@ class modTicket extends DolibarrModules
$this->const = array(
1 => array('TICKET_ENABLE_PUBLIC_INTERFACE', 'chaine', '0', 'Enable ticket public interface', 0),
2 => array('TICKET_ADDON', 'chaine', 'mod_ticket_simple', 'Ticket ref module', 0),
3 => array('TICKET_ADDON_PDF_ODT_PATH', 'chaine', 'DOL_DATA_ROOT/doctemplates/tickets', 'Ticket templates ODT/ODS directory for templates', 0)
3 => array('TICKET_ADDON_PDF_ODT_PATH', 'chaine', 'DOL_DATA_ROOT/doctemplates/tickets', 'Ticket templates ODT/ODS directory for templates', 0),
4 => array('TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND', 'chaine', 0, 'Automatically mark ticket as read when created from backend', 0),
5 => array('TICKET_DELAY_BEFORE_FIRST_RESPONSE', 'chaine', '0', 'Maximum wanted elapsed time before a first answer to a ticket (in hours). Display a warning in tickets list if not respected.', 0),
6 => array('TICKET_DELAY_SINCE_LAST_RESPONSE', 'chaine', '0', 'Maximum wanted elapsed time between two answers on the same ticket (in hours). Display a warning in tickets list if not respected.', 0)
);
@ -320,6 +323,11 @@ class modTicket extends DolibarrModules
{
global $conf, $langs;
$result = $this->_load_tables('/install/mysql/tables/', 'ticket');
if ($result < 0) {
return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
}
// Permissions
$this->remove($options);

View file

@ -159,7 +159,7 @@ class doc_generic_mo_odt extends ModelePDFMo
$texte .= $conf->global->MRP_MO_ADDON_PDF_ODT_PATH;
$texte .= '</textarea>';
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
$texte .= '<input type="submit" class="button small reposition" name="Button" value="'.$langs->trans("Modify").'">';
$texte .= '<input type="submit" class="button small reposition" name="modify" value="'.$langs->trans("Modify").'">';
$texte .= '<br></div></div>';
// Scan directories

View file

@ -157,7 +157,7 @@ class doc_generic_product_odt extends ModelePDFProduct
$texte .= $conf->global->PRODUCT_ADDON_PDF_ODT_PATH;
$texte .= '</textarea>';
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
$texte .= '<input type="submit" class="button small reposition" name="Button" value="'.$langs->trans("Modify").'">';
$texte .= '<input type="submit" class="button small reposition" name="modify" value="'.$langs->trans("Modify").'">';
$texte .= '<br></div></div>';
// Scan directories

View file

@ -119,7 +119,7 @@ class mod_codeproduct_elephant extends ModeleProductCode
$texte .= '<tr><td>'.$langs->trans("Mask").' ('.$langs->trans("ProductCodeModel").'):</td>';
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="value1" value="'.(!empty($conf->global->PRODUCT_ELEPHANT_MASK_PRODUCT) ? $conf->global->PRODUCT_ELEPHANT_MASK_PRODUCT : '').'"'.$disabled.'>', $tooltip, 1, 1).'</td>';
$texte .= '<td class="left" rowspan="2">&nbsp; <input type="submit" class="button small reposition" name="Button" value="'.$langs->trans("Modify").'"'.$disabled.'></td>';
$texte .= '<td class="left" rowspan="2">&nbsp; <input type="submit" class="button small reposition" name="modify" value="'.$langs->trans("Modify").'"'.$disabled.'></td>';
$texte .= '</tr>';

View file

@ -450,7 +450,7 @@ class doc_generic_project_odt extends ModelePDFProjects
$texte .= $conf->global->PROJECT_ADDON_PDF_ODT_PATH;
$texte .= '</textarea>';
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
$texte .= '<input type="submit" class="button small reposition" name="Button" value="'.$langs->trans("Modify").'">';
$texte .= '<input type="submit" class="button small reposition" name="modify" value="'.$langs->trans("Modify").'">';
$texte .= '<br></div></div>';
// Scan directories

View file

@ -417,7 +417,7 @@ class doc_generic_task_odt extends ModelePDFTask
$texte .= $conf->global->PROJECT_TASK_ADDON_PDF_ODT_PATH;
$texte .= '</textarea>';
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
$texte .= '<input type="submit" class="button small reposition" name="Button" value="'.$langs->trans("Modify").'">';
$texte .= '<input type="submit" class="button small reposition" name="modify" value="'.$langs->trans("Modify").'">';
$texte .= '<br></div></div>';
// Scan directories

View file

@ -161,7 +161,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales
$texte .= $conf->global->PROPALE_ADDON_PDF_ODT_PATH;
$texte .= '</textarea>';
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
$texte .= '<input type="submit" class="button small reposition" name="Button" value="'.$langs->trans("Modify").'">';
$texte .= '<input type="submit" class="button small reposition" name="modify" value="'.$langs->trans("Modify").'">';
$texte .= '<br></div></div>';
// Scan directories

View file

@ -153,7 +153,7 @@ class doc_generic_reception_odt extends ModelePdfReception
$texte .= $conf->global->RECEPTION_ADDON_PDF_ODT_PATH;
$texte .= '</textarea>';
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
$texte .= '<input type="submit" class="button button-edit small reposition" name="Button" value="'.$langs->trans("Modify").'">';
$texte .= '<input type="submit" class="button button-edit small reposition" name="modify" value="'.$langs->trans("Modify").'">';
$texte .= '<br></div></div>';
// Scan directories

View file

@ -143,7 +143,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc
$texte .= '</textarea>';
$texte .= '</td>';
$texte .= '<td class="center">&nbsp; ';
$texte .= '<input type="submit" class="button small reposition" name="Button" value="'.$langs->trans("Modify").'">';
$texte .= '<input type="submit" class="button small reposition" name="modify" value="'.$langs->trans("Modify").'">';
$texte .= '</td>';
$texte .= '</tr>';
$texte .= '</table>';

View file

@ -135,7 +135,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
$texte .= '<tr><td>'.$langs->trans("Mask").' ('.$langs->trans("CustomerCodeModel").'):</td>';
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="value1" value="'.getDolGlobalString('COMPANY_ELEPHANT_MASK_CUSTOMER').'"'.$disabled.'>', $tooltip, 1, 1).'</td>';
$texte .= '<td class="left" rowspan="2">&nbsp; <input type="submit" class="button button-edit reposition" name="Button" value="'.$langs->trans("Modify").'"'.$disabled.'></td>';
$texte .= '<td class="left" rowspan="2">&nbsp; <input type="submit" class="button button-edit reposition" name="modify" value="'.$langs->trans("Modify").'"'.$disabled.'></td>';
$texte .= '</tr>';

View file

@ -103,7 +103,7 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode
$texte .= $langs->trans('COMPANY_AQUARIUM_CLEAN_REGEX').' = '.$conf->global->COMPANY_AQUARIUM_CLEAN_REGEX."<br>\n";
}
$texte .= '</td>';
$texte .= '<td class="right"><input type="submit" class="button button-edit reposition" name="Button" value="'.$langs->trans("Modify").'"></td>';
$texte .= '<td class="right"><input type="submit" class="button button-edit reposition" name="modify" value="'.$langs->trans("Modify").'"></td>';
$texte .= '</tr></table>';
$texte .= '</form>';

View file

@ -126,7 +126,7 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode
$texte .= $langs->trans('COMPANY_DIGITARIA_UNIQUE_CODE').' = '.yn(1)."<br>\n";
}
$texte .= '</td>';
$texte .= '<td class="right"><input type="submit" class="button button-edit reposition" name="Button" value="'.$langs->trans("Modify").'"></td>';
$texte .= '<td class="right"><input type="submit" class="button button-edit reposition" name="modify" value="'.$langs->trans("Modify").'"></td>';
$texte .= '</tr></table>';
$texte .= '</form>';

View file

@ -156,7 +156,7 @@ class doc_generic_stock_odt extends ModelePDFStock
$texte .= $conf->global->STOCK_ADDON_PDF_ODT_PATH;
$texte .= '</textarea>';
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
$texte .= '<input type="submit" class="button small reposition" name="Button" value="'.$langs->trans("Modify").'">';
$texte .= '<input type="submit" class="button small reposition" name="modify" value="'.$langs->trans("Modify").'">';
$texte .= '<br></div></div>';
// Scan directories

View file

@ -160,7 +160,7 @@ class doc_generic_supplier_order_odt extends ModelePDFSuppliersOrders
$texte .= $conf->global->SUPPLIER_ORDER_ADDON_PDF_ODT_PATH;
$texte .= '</textarea>';
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
$texte .= '<input type="submit" class="button small reposition" name="Button" value="'.$langs->trans("Modify").'">';
$texte .= '<input type="submit" class="button small reposition" name="modify" value="'.$langs->trans("Modify").'">';
$texte .= '<br></div></div>';
// Scan directories

View file

@ -163,7 +163,7 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal
$texte .= $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_PATH;
$texte .= '</textarea>';
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
$texte .= '<input type="submit" class="button small reposition" name="Button" value="'.$langs->trans("Modify").'">';
$texte .= '<input type="submit" class="button small reposition" name="modify" value="'.$langs->trans("Modify").'">';
$texte .= '<br></div></div>';
// Scan directories

View file

@ -151,7 +151,7 @@ class doc_generic_ticket_odt extends ModelePDFTicket
$texte .= $conf->global->TICKET_ADDON_PDF_ODT_PATH;
$texte .= '</textarea>';
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
$texte .= '<input type="submit" class="button small reposition" name="Button" value="'.$langs->trans("Modify").'">';
$texte .= '<input type="submit" class="button small reposition" name="modify" value="'.$langs->trans("Modify").'">';
$texte .= '<br></div></div>';
// Scan directories

View file

@ -160,7 +160,7 @@ class doc_generic_user_odt extends ModelePDFUser
$texte .= $conf->global->USER_ADDON_PDF_ODT_PATH;
$texte .= '</textarea>';
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
$texte .= '<input type="submit" class="button small reposition" name="Button" value="'.$langs->trans("Modify").'">';
$texte .= '<input type="submit" class="button small reposition" name="modify" value="'.$langs->trans("Modify").'">';
$texte .= '<br></div></div>';
// Scan directories

View file

@ -163,7 +163,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup
$texte .= $conf->global->USERGROUP_ADDON_PDF_ODT_PATH;
$texte .= '</textarea>';
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
$texte .= '<input type="submit" class="button small reposition" name="Button" value="'.$langs->trans("Modify").'">';
$texte .= '<input type="submit" class="button small reposition" name="modify" value="'.$langs->trans("Modify").'">';
$texte .= '<br></div></div>';
// Scan directories

View file

@ -31,7 +31,7 @@ if (empty($conf) || !is_object($conf)) {
}
// DDOS protection
$size = (int) $_SERVER['CONTENT_LENGTH'];
$size = (empty($_SERVER['CONTENT_LENGTH']) ? 0 : (int) $_SERVER['CONTENT_LENGTH']);
if ($size > 10000) {
http_response_code(413);
$langs->loadLangs(array("errors", "install"));

View file

@ -3132,18 +3132,19 @@ class CommandeFournisseur extends CommonOrder
$outputlangs->load("products");
if (!dol_strlen($modele)) {
$modele = 'muscadet';
$modele = '';
if ($this->model_pdf) {
$modele = $this->model_pdf;
} elseif (!empty($conf->global->COMMANDE_SUPPLIER_ADDON_PDF)) {
$modele = $conf->global->COMMANDE_SUPPLIER_ADDON_PDF;
}
}
$modelpath = "core/modules/supplier_order/doc/";
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
if (empty($modele)) {
return 0;
} else {
$modelpath = "core/modules/supplier_order/doc/";
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
}
}
/**

View file

@ -1532,9 +1532,7 @@ if ($resql) {
$projectstatic = new Project($db);
$i = 0;
$totalarray = array();
$totalarray['nbfield'] = 0;
$totalarray['val'] = array();
$totalarray = array('nbfield' => 0, 'val' => array(), 'pos' => array());
$totalarray['val']['cf.total_ht'] = 0;
$totalarray['val']['cf.total_ttc'] = 0;
while ($i < min($num, $limit)) {

View file

@ -109,7 +109,7 @@ class Position extends CommonObject
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,),
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>'1', 'position'=>501, 'notnull'=>0, 'visible'=>-2,),
'fk_contrat' => array('type'=>'integer:Contrat:contrat/class/contrat.class.php', 'label'=>'fk_contrat', 'enabled'=>'1', 'position'=>50, 'notnull'=>0, 'visible'=>0,),
'fk_user' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Employee', 'enabled'=>'1', 'position'=>55, 'notnull'=>0, 'visible'=>1,),
'fk_user' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Employee', 'enabled'=>'1', 'position'=>55, 'notnull'=>1, 'visible'=>1, 'default'=>0),
'fk_job' => array('type'=>'integer:Job:/hrm/class/job.class.php', 'label'=>'Job', 'enabled'=>'1', 'position'=>56, 'notnull'=>1, 'visible'=>1,),
'date_start' => array('type'=>'date', 'label'=>'DateStart', 'enabled'=>'1', 'position'=>51, 'notnull'=>1, 'visible'=>1,),
'date_end' => array('type'=>'date', 'label'=>'DateEnd', 'enabled'=>'1', 'position'=>52, 'notnull'=>0, 'visible'=>1,),
@ -843,6 +843,77 @@ class Position extends CommonObject
}
/**
* Return HTML string to put an input field into a page
* Code very similar with showInputField of extra fields
*
* @param array $val Array of properties for field to show
* @param string $key Key of attribute
* @param string $value Preselected value to show (for date type it must be in timestamp format, for amount or price it must be a php numeric value)
* @param string $moreparam To add more parameters on html input tag
* @param string $keysuffix Prefix string to add into name and id of field (can be used to avoid duplicate names)
* @param string $keyprefix Suffix string to add into name and id of field (can be used to avoid duplicate names)
* @param string|int $morecss Value for css to define style/length of field. May also be a numeric.
* @param int $nonewbutton Do not show new button
* @return string
*/
public function showInputField($val, $key, $value, $moreparam = '', $keysuffix = '', $keyprefix = '', $morecss = 0, $nonewbutton = 0)
{
global $langs;
if ($key == 'fk_user') {
$vacantId = $keyprefix.$key.'vacant'.$keysuffix;
$out = parent::showInputField($val, $key, $value, $moreparam, $keysuffix, $keyprefix, $morecss);
$out .= '<label class="nowrap position-fk-user classfortooltip" title="'.dol_escape_js($langs->trans('VacantCheckboxHelper')).'"><input type="checkbox" id="'.$vacantId.'" name="'.$vacantId.'" />&nbsp;'.$langs->trans("Vacant").'</label>';
?>
<script type="text/javascript">
$(document).ready(function () {
var checkbox = $('#<?php print $vacantId; ?>');
var searchfkuser = $('#<?php print $keyprefix.$key.$keysuffix; ?>');
checkbox.click(function () {
if (checkbox.prop('checked')) {
searchfkuser.val(0).trigger('change');
searchfkuser.prop('disabled', 1);
} else {
searchfkuser.prop('disabled', 0);
}
});
});
</script>
<?php
} else {
$out = parent::showInputField($val, $key, $value, $moreparam, $keysuffix, $keyprefix, $morecss);
}
return $out;
}
/**
* Return HTML string to show a field into a page
* Code very similar with showOutputField of extra fields
*
* @param array $val Array of properties of field to show
* @param string $key Key of attribute
* @param string $value Preselected value to show (for date type it must be in timestamp format, for amount or price it must be a php numeric value)
* @param string $moreparam To add more parametes on html input tag
* @param string $keysuffix Prefix string to add into name and id of field (can be used to avoid duplicate names)
* @param string $keyprefix Suffix string to add into name and id of field (can be used to avoid duplicate names)
* @param mixed $morecss Value for css to define size. May also be a numeric.
* @return string
*/
public function showOutputField($val, $key, $value, $moreparam = '', $keysuffix = '', $keyprefix = '', $morecss = '')
{
global $langs;
if ($key == 'fk_user' && $this->fk_user == 0) {
return $langs->trans("VacantPosition");
}
return parent::showOutputField($val, $key, $value, $moreparam, $keysuffix, $keyprefix, $morecss);
}
/**
* Load the info information in the object
*
* @param int $id Id of object
@ -1072,7 +1143,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/commonobjectline.class.php';
class PositionLine extends CommonObjectLine
{
// To complete with content of an object PositionLine
// We should have a field rowid, fk_position and position
// We should have a field rowid , fk_position and position
/**
* @var int Does object support extrafields ? 0=No, 1=Yes

View file

@ -853,7 +853,7 @@ class Skill extends CommonObject
//if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
global $action, $hookmanager;
$hookmanager->initHooks(array('jobdao'));
$hookmanager->initHooks(array('skilldao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {

View file

@ -270,6 +270,10 @@ foreach ($search as $key => $val) {
}
}
}
$vacant = GETPOST('search_fk_uservacant', 'alphanohtml') === 'on';
if ($vacant) {
$sql .= ' AND t.fk_user = 0';
}
if ($search_all) {
$sql .= natural_search(array_keys($fieldstosearchall), $search_all);
}

View file

@ -141,6 +141,7 @@ $endatlinenb = (GETPOST('endatlinenb') ? GETPOST('endatlinenb') : '');
$updatekeys = (GETPOST('updatekeys', 'array') ? GETPOST('updatekeys', 'array') : array());
$separator = (GETPOST('separator', 'nohtml') ? GETPOST('separator', 'nohtml') : (!empty($conf->global->IMPORT_CSV_SEPARATOR_TO_USE) ? $conf->global->IMPORT_CSV_SEPARATOR_TO_USE : ','));
$enclosure = (GETPOST('enclosure', 'nohtml') ? GETPOST('enclosure', 'nohtml') : '"');
$separator_used = str_replace('\t', "\t", $separator);
$objimport = new Import($db);
$objimport->load_arrays($user, ($step == 1 ? '' : $datatoimport));
@ -773,7 +774,7 @@ if ($step == 4 && $datatoimport) {
require_once $dir.$file;
$obj = new $classname($db, $datatoimport);
if ($model == 'csv') {
$obj->separator = $separator;
$obj->separator = $separator_used;
$obj->enclosure = $enclosure;
}
if ($model == 'xlsx') {
@ -1334,7 +1335,7 @@ if ($step == 5 && $datatoimport) {
require_once $dir.$file;
$obj = new $classname($db, $datatoimport);
if ($model == 'csv') {
$obj->separator = $separator;
$obj->separator = $separator_used;
$obj->enclosure = $enclosure;
}
@ -1783,7 +1784,7 @@ if ($step == 6 && $datatoimport) {
require_once $dir.$file;
$obj = new $classname($db, $datatoimport);
if ($model == 'csv') {
$obj->separator = $separator;
$obj->separator = $separator_used;
$obj->enclosure = $enclosure;
}

View file

@ -302,12 +302,25 @@ INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (152,
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (152, '15210', 'Mauritius Trusts', 1);
-- Mexique
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15401', 'Sociedad en nombre colectivo', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15402', 'Sociedad en comandita simple', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15403', 'Sociedad de responsabilidad limitada', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15404', 'Sociedad anónima', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15405', 'Sociedad en comandita por acciones', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15406', 'Sociedad cooperativa', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15401', '601 - General de Ley Personas Morales', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15402', '603 - Personas Morales con Fines no Lucrativos', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15403', '605 - Sueldos y Salarios e Ingresos Asimilados a Salarios', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15404', '606 - Arrendamiento', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15405', '607 - Régimen de Enajenación o Adquisición de Bienes', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15406', '608 - Demás ingresos', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15407', '610 - Residentes en el Extranjero sin Establecimiento Permanente en México', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15408', '611 - Ingresos por Dividendos (socios y accionistas)', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15409', '612 - Personas Físicas con Actividades Empresariales y Profesionales', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15410', '614 - Ingresos por intereses', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15411', '615 - Régimen de los ingresos por obtención de premios', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15412', '616 - Sin obligaciones fiscales', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15413', '620 - Sociedades Cooperativas de Producción que optan por diferir sus ingresos', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15414', '621 - Incorporación Fiscal', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15415', '622 - Actividades Agrícolas, Ganaderas, Silvícolas y Pesqueras', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15416', '623 - Opcional para Grupos de Sociedades', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15417', '624 - Coordinados', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15418', '625 - Régimen de las Actividades Empresariales con ingresos a través de Plataformas Tecnológicas', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15419', '626 - Régimen Simplificado de Confianza', 1);
-- Luxembourg
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (140, '14001', 'Entreprise individuelle', 1);

View file

@ -36,6 +36,7 @@ INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'flickr', 'Flickr', '{socialid}', 'fa-flickr', 0);
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'gifycat', 'Gificat', '{socialid}', '', 0);
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'giphy', 'Giphy', '{socialid}', '', 0);
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'github', 'GitHub', 'https://www.github.com/{socialid}', '', 0);
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'googleplus', 'GooglePlus', 'https://www.googleplus.com/{socialid}', 'fa-google-plus-g', 0);
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'instagram', 'Instagram', 'https://www.instagram.com/{socialid}', 'fa-instagram', 1);
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'linkedin', 'LinkedIn', 'https://www.linkedin.com/{socialid}', 'fa-linkedin', 1);

View file

@ -506,3 +506,26 @@ INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) value
INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_APPROVE','Holiday aprouved','Executed when a holiday is aprouved','holiday',803);
INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_CANCEL','Holiday canceled','Executed when a holiday is canceled','holiday',802);
INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_DELETE','Holiday deleted','Executed when a holiday is deleted','holiday',804);
-- We do not delete old mexican legal forms because they may have been used. User will have to insert the new one manually not inserted because of conflict if he need them.
--DELETE FROM llx_c_forme_juridique WHERE code IN ('15401', '15402', '15403', '15404', '15405', '15406');
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15401', '601 - General de Ley Personas Morales', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15402', '603 - Personas Morales con Fines no Lucrativos', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15403', '605 - Sueldos y Salarios e Ingresos Asimilados a Salarios', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15404', '606 - Arrendamiento', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15405', '607 - Régimen de Enajenación o Adquisición de Bienes', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15406', '608 - Demás ingresos', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15407', '610 - Residentes en el Extranjero sin Establecimiento Permanente en México', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15408', '611 - Ingresos por Dividendos (socios y accionistas)', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15409', '612 - Personas Físicas con Actividades Empresariales y Profesionales', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15410', '614 - Ingresos por intereses', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15411', '615 - Régimen de los ingresos por obtención de premios', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15412', '616 - Sin obligaciones fiscales', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15413', '620 - Sociedades Cooperativas de Producción que optan por diferir sus ingresos', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15414', '621 - Incorporación Fiscal', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15415', '622 - Actividades Agrícolas, Ganaderas, Silvícolas y Pesqueras', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15416', '623 - Opcional para Grupos de Sociedades', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15417', '624 - Coordinados', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15418', '625 - Régimen de las Actividades Empresariales con ingresos a través de Plataformas Tecnológicas', 1);
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15419', '626 - Régimen Simplificado de Confianza', 1);

View file

@ -239,4 +239,11 @@ ALTER TABLE llx_mailing ADD UNIQUE uk_mailing(titre, entity);
ALTER TABLE llx_inventory ADD COLUMN include_sub_warehouse boolean DEFAULT FALSE;
create table llx_inventory_extrafields
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
fk_object integer NOT NULL,
import_key varchar(14) -- import key
) ENGINE=innodb;
ALTER TABLE llx_inventory_extrafields ADD INDEX idx_inventory_extrafields (fk_object);

View file

@ -16,10 +16,8 @@
-- ============================================================================
ALTER TABLE llx_facture_fourn_rec ADD UNIQUE INDEX uk_facture_fourn_rec_ref (ref, entity);
ALTER TABLE llx_facture_fourn_rec ADD UNIQUE INDEX uk_facture_fourn_rec_ref_supplier (ref_supplier, fk_soc, entity);
ALTER TABLE llx_facture_fourn_rec ADD UNIQUE INDEX uk_facture_fourn_rec_ref (titre, entity);
ALTER TABLE llx_facture_fourn_rec ADD INDEX idx_facture_fourn_rec_date_lim_reglement (date_lim_reglement);
ALTER TABLE llx_facture_fourn_rec ADD INDEX idx_facture_fourn_rec_fk_soc (fk_soc);
ALTER TABLE llx_facture_fourn_rec ADD INDEX idx_facture_fourn_rec_fk_user_author (fk_user_author);
ALTER TABLE llx_facture_fourn_rec ADD INDEX idx_facture_fourn_rec_fk_projet (fk_projet);

View file

@ -0,0 +1,21 @@
-- ===================================================================
-- Copyright (C) 2022 Laurent Destailleur <eldy@users.sourceforge.net>
-- Copyright (C) 2022 ATM Consulting <support@atm-consulting.fr>
--
-- 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 <https://www.gnu.org/licenses/>.
--
-- ===================================================================
ALTER TABLE llx_inventory_extrafields ADD INDEX idx_inventory_extrafields (fk_object);

View file

@ -0,0 +1,27 @@
-- ========================================================================
-- Copyright (C) 2022 Laurent Destailleur <eldy@users.sourceforge.net>
-- Copyright (C) 2022 ATM Consulting <support@atm-consulting.fr>
-- 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 <https://www.gnu.org/licenses/>.
--
-- ========================================================================
create table llx_inventory_extrafields
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
fk_object integer NOT NULL,
import_key varchar(14) -- import key
) ENGINE=innodb;

View file

@ -34,6 +34,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/knowledgemanagement/class/knowledgerecord.class.php';
// for other modules
if (!empty($conf->categorie->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
}
//dol_include_once('/othermodule/class/otherobject.class.php');
// Load translation files required by the page
@ -51,6 +54,13 @@ $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always ''
$id = GETPOST('id', 'int');
$searchCategoryKnowledgemanagementList = GETPOST('search_category_knowledgemanagement_list', 'array');
$searchCategoryKnowledgemanagementOperator = 0;
if (GETPOSTISSET('formfilteraction')) {
$searchCategoryKnowledgemanagementOperator = GETPOST('search_category_knowledgemanagement_operator', 'int');
} elseif (!empty($conf->global->MAIN_SEARCH_CAT_OR_BY_DEFAULT)) {
$searchCategoryKnowledgemanagementOperator = $conf->global->MAIN_SEARCH_CAT_OR_BY_DEFAULT;
}
// Load variable for pagination
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
@ -186,6 +196,10 @@ if (empty($reshook)) {
|| GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) {
$massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
}
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
$searchCategoryKnowledgemanagementOperator = 0;
$searchCategoryKnowledgemanagementList = array();
}
// Mass actions
$objectclass = 'KnowledgeRecord';
@ -229,9 +243,12 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $obje
$sql .= preg_replace('/^,/', ',', $hookmanager->resPrint);
$sql = preg_replace('/,\s*$/', '', $sql);
$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
}
if (!empty($searchCategoryKnowledgemanagementList) || !empty($catid)) {
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_knowledgemanagement as ck ON t.rowid = ck.fk_knowledgemanagement"; // We'll need this table joined to the select in order to filter by categ
}
// Add table from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
@ -270,6 +287,32 @@ foreach ($search as $key => $val) {
}
}
}
//Search for tag/category
$searchCategoryKnowledgemanagementSqlList = array();
if ($searchCategoryKnowledgemanagementOperator == 1) {
foreach ($searchCategoryKnowledgemanagementList as $searchCategoryKnowledgemanagement) {
if (intval($searchCategoryKnowledgemanagement) == -2) {
$searchCategoryKnowledgemanagementSqlList[] = "ck.fk_categorie IS NULL";
} elseif (intval($searchCategoryKnowledgemanagement) > 0) {
$searchCategoryKnowledgemanagementSqlList[] = "ck.fk_categorie = ".$db->escape($searchCategoryKnowledgemanagement);
}
}
if (!empty($searchCategoryKnowledgemanagementSqlList)) {
$sql .= " AND (".implode(' OR ', $searchCategoryKnowledgemanagementSqlList).")";
}
} else {
foreach ($searchCategoryKnowledgemanagementList as $searchCategoryKnowledgemanagement) {
if (intval($searchCategoryKnowledgemanagement) == -2) {
$searchCategoryKnowledgemanagementSqlList[] = "ck.fk_categorie IS NULL";
} elseif (intval($searchCategoryKnowledgemanagement) > 0) {
$searchCategoryKnowledgemanagementSqlList[] = "t.rowid IN (SELECT fk_knowledgemanagement FROM ".MAIN_DB_PREFIX."categorie_knowledgemanagement WHERE fk_categorie = ".((int) $searchCategoryKnowledgemanagement).")";
}
}
if (!empty($searchCategoryKnowledgemanagementSqlList)) {
$sql .= " AND (".implode(' AND ', $searchCategoryKnowledgemanagementSqlList).")";
}
}
if ($search_all) {
$sql .= natural_search(array_keys($fieldstosearchall), $search_all);
}
@ -379,6 +422,11 @@ $arrayofmassactions = array(
if ($permissiontodelete) {
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
}
if ($user->rights->knowledgemanagement->knowledgerecord->write) {
$arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag");
}
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
$arrayofmassactions = array();
}
@ -418,6 +466,18 @@ $moreforfilter = '';
$moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
$moreforfilter.= '</div>';*/
// Filter on categories
$moreforfilter = '';
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= img_picto($langs->trans('Categories'), 'category', 'class="pictofixedwidth"');
$categoriesKnowledgeArr = $form->select_all_categories(Categorie::TYPE_KNOWLEDGEMANAGEMENT, '', '', 64, 0, 1);
$categoriesKnowledgeArr[-2] = '- '.$langs->trans('NotCategorized').' -';
$moreforfilter .= Form::multiselectarray('search_category_knowledgemanagement_list', $categoriesKnowledgeArr, $searchCategoryKnowledgemanagementList, 0, 0, 'minwidth300');
$moreforfilter .= ' <input type="checkbox" class="valignmiddle" id="search_category_knowledgemanagement_operator" name="search_category_knowledgemanagement_operator" value="1"'.($searchCategoryKnowledgemanagementOperator == 1 ? ' checked="checked"' : '').'/><label class="none valignmiddle" for="search_category_knowledgemanagement_operator">'.$langs->trans('UseOrOperatorForCategories').'</label>';
$moreforfilter .= '</div>';
}
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
if (empty($reshook)) {
@ -547,6 +607,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
// Show here line of result
print '<tr class="oddeven">';
$totalarray['nbfield'] = 0;
foreach ($object->fields as $key => $val) {
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {

View file

@ -2221,4 +2221,6 @@ API_DISABLE_COMPRESSION=Disable compression of API responses
EachTerminalHasItsOwnCounter=Each terminal use its own counter.
FillAndSaveAccountIdAndSecret=Fill and save account ID and secret first
PreviousHash=Previous hash
LateWarningAfter="Late" warning after
LateWarningAfter="Late" warning after
TemplateforBusinessCards=Template for a business card in different size
InventorySetup= Inventory Setup

View file

@ -79,3 +79,6 @@ NoEval=No evaluation done for this employee
HowManyUserWithThisMaxNote=Number of users with this rank
HighestRank=Highest rank
SkillComparison=Skill comparison
ActionsOnJob=Events on this job
VacantPosition=job vacancy
VacantCheckboxHelper=Checking this option will show unfilled positions (job vacancy)

View file

@ -517,6 +517,7 @@ or=or
Other=Other
Others=Others
OtherInformations=Other information
Workflow=Workflow
Quantity=Quantity
Qty=Qty
ChangedBy=Changed by

View file

@ -159,7 +159,7 @@ HTPasswordExport=htpassword file generation
NoThirdPartyAssociatedToMember=No third party associated with this member
MembersAndSubscriptions=Members and Contributions
MoreActions=Complementary action on recording
MoreActionsOnSubscription=Complementary action, suggested by default when recording a contribution
MoreActionsOnSubscription=Complementary action suggested by default when recording a contribution, also done automatially on online payment of a contribution
MoreActionBankDirect=Create a direct entry on bank account
MoreActionBankViaInvoice=Create an invoice, and a payment on bank account
MoreActionInvoiceOnly=Create an invoice with no payment

Some files were not shown because too many files have changed in this diff Show more