Merge pull request #9 from Dolibarr/develop

merge from develop
This commit is contained in:
Tobias Sekan 2020-02-03 09:49:16 +01:00 committed by GitHub
commit 22824026ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
81 changed files with 2937 additions and 2484 deletions

View File

@ -63,10 +63,49 @@ with
if (isset($this->imagekeys)) {
foreach($this->imagekeys as $file) {
// unlink($file);
// DOL CHANGE If we keep this, source image files are physically destroyed
// unlink($file);
}
}
* Replace in tcpdf.php
$preserve = array(
'file_id',
'internal_encoding',
'state',
'bufferlen',
'buffer',
'cached_files',
with
$preserve = array(
'file_id',
'internal_encoding',
'state',
'bufferlen',
'buffer',
'cached_files',
// @CHANGE DOL
'imagekeys',
* Replace in tcpdf.php
if (!@TCPDF_STATIC::file_exists($file)) {
return false;
}
with
if (!@TCPDF_STATIC::file_exists($file)) {
// DOL CHANGE If we keep this, the image is not visible on pages after the first one.
//var_dump($file.' '.(!@TCPDF_STATIC::file_exists($file)));
//return false;
}
* In tecnickcom/tcpdf/include/tcpdf_static, in function fopenLocal, replace
if (strpos($filename, '://') === false) {
@ -102,7 +141,7 @@ In htdocs/includes/tecnickcom/tcpdf/tcpdf.php
+ protected $default_monospaced_font = 'freemono';
TCPDI:
------

View File

@ -144,7 +144,7 @@ dol_fiche_end();
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, ";
$sql .= " bk.subledger_account, bk.numero_compte , bk.label_compte, bk.debit, ";
$sql .= " bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.lettering_code ";
$sql .= " bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.lettering_code, bk.date_validated ";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
$sql .= " WHERE (bk.subledger_account = '" . $object->code_compta_fournisseur . "' AND bk.numero_compte = '" . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . "' )";
if (dol_strlen($search_date_start) || dol_strlen($search_date_end)) {
@ -267,7 +267,7 @@ if ($resql) {
$journaltoshow = (($result > 0)?$accountingjournal->getNomUrl(0, 0, 0, '', 0) : $obj->code_journal);
print '<td class="center">' . $journaltoshow . '</td>';
if (empty($obj->lettering_code)) {
if (empty($obj->lettering_code) && empty($obj->date_validated) ) {
print '<td class="nowrap center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="' . $obj->rowid . '" /></td>';
print '<td><a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num=' . $obj->piece_num . '">';
print img_edit();

View File

@ -76,6 +76,7 @@ class Lettering extends BookKeeping
$sql .= " ) AND (bk.date_lettering ='' OR bk.date_lettering IS NULL) ";
$sql .= " AND (bk.lettering_code != '' OR bk.lettering_code IS NULL) ";
$sql .= ' AND bk.date_validated IS NULL ';
$sql .= $this->db->order('bk.doc_date', 'DESC');
// echo $sql;
@ -253,7 +254,7 @@ class Lettering extends BookKeeping
}
$sql = "SELECT SUM(ABS(debit)) as deb, SUM(ABS(credit)) as cred FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE ";
$sql .= " rowid IN (" . implode(',', $ids) . ") ";
$sql .= " rowid IN (" . implode(',', $ids) . ") AND date_validated IS NULL ";
$result = $this->db->query($sql);
if ($result) {
$obj = $this->db->fetch_object($result);
@ -275,7 +276,7 @@ class Lettering extends BookKeeping
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_bookkeeping SET";
$sql .= " lettering_code='" . $lettre . "'";
$sql .= " , date_lettering = '" . $this->db->idate($now) . "'"; // todo correct date it's false
$sql .= " WHERE rowid IN (" . implode(',', $ids) . ") ";
$sql .= " WHERE rowid IN (" . implode(',', $ids) . ") AND date_validated IS NULL ";
$this->db->begin();
dol_syslog(get_class($this) . "::update sql=" . $sql, LOG_DEBUG);

View File

@ -35,7 +35,7 @@ $endaccountingperiod = dol_print_date(dol_now(), '%Y%m%d');
header('Content-Type: text/csv');
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == "11" && $type_export == "general_ledger") // Specific filename for FEC model export into the general ledger
if ($this->getFormatCode($formatexportset) == "fec" && $type_export == "general_ledger") // Specific filename for FEC model export into the general ledger
{
// FEC format is defined here: https://www.legifrance.gouv.fr/affichCodeArticle.do?idArticle=LEGIARTI000027804775&cidTexte=LEGITEXT000006069583&dateTexte=20130802&oldAction=rechCodeArticle
if (empty($search_date_end))

File diff suppressed because it is too large Load Diff

View File

@ -95,15 +95,15 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha'))
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOM", GETPOST("nom", 'nohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ADDRESS", GETPOST("MAIN_INFO_SOCIETE_ADDRESS", 'nohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TOWN", GETPOST("MAIN_INFO_SOCIETE_TOWN", 'nohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ZIP", GETPOST("MAIN_INFO_SOCIETE_ZIP", 'alpha'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_REGION", GETPOST("region_code", 'alpha'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ZIP", GETPOST("MAIN_INFO_SOCIETE_ZIP", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_REGION", GETPOST("region_code", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MONNAIE", GETPOST("currency", 'aZ09'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TEL", GETPOST("tel", 'alpha'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FAX", GETPOST("fax", 'alpha'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MAIL", GETPOST("mail", 'alpha'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_WEB", GETPOST("web", 'alpha'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TEL", GETPOST("tel", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FAX", GETPOST("fax", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MAIL", GETPOST("mail", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_WEB", GETPOST("web", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOTE", GETPOST("note", 'none'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_GENCOD", GETPOST("barcode", 'alpha'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_GENCOD", GETPOST("barcode", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
$dirforimage = $conf->mycompany->dir_output.'/logos/';

View File

@ -40,7 +40,7 @@ $update=GETPOST('update', 'alpha');
$delete=GETPOST('delete', 'none'); // Do not use alpha here
$debug=GETPOST('debug', 'int');
$consts=GETPOST('const', 'array');
$constname=GETPOST('constname', 'alpha');
$constname=GETPOST('constname', 'alphanohtml');
$constvalue=GETPOST('constvalue', 'none'); // We shoul dbe able to send everything here
$constnote=GETPOST('constnote', 'alpha');

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2017-2018 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2017-2020 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2017-2018 Regis Houssin <regis.houssin@inodbox.com>
*
* This program is free software; you can redistribute it and/or modify
@ -52,15 +52,15 @@ $pagenext = $page + 1;
if (!$sortfield) $sortfield = 'page,param';
if (!$sortorder) $sortorder = 'ASC';
$defaulturl = GETPOST('defaulturl');
$defaultkey = GETPOST('defaultkey', 'alpha');
$defaultvalue = GETPOST('defaultvalue');
$defaulturl = GETPOST('defaulturl', 'alphanohtml');
$defaultkey = GETPOST('defaultkey', 'alphanohtml');
$defaultvalue = GETPOST('defaultvalue', 'none');
$defaulturl = preg_replace('/^\//', '', $defaulturl);
$urlpage = GETPOST('urlpage');
$key = GETPOST('key');
$value = GETPOST('value');
$urlpage = GETPOST('urlpage', 'alphanohtml');
$key = GETPOST('key', 'alphanohtml');
$value = GETPOST('value', 'none');
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('admindefaultvalues', 'globaladmin'));
@ -210,9 +210,9 @@ print load_fiche_titre($langs->trans("DefaultValues"), $enabledisablehtml, 'titl
print '<span class="opacitymedium">'.$langs->trans("DefaultValuesDesc")."</span><br>\n";
print "<br>\n";
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit;
if ($optioncss != '') $param .= '&optioncss='.$optioncss;
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
if ($defaulturl) $param .= '&defaulturl='.urlencode($defaulturl);
if ($defaultkey) $param .= '&defaultkey='.urlencode($defaultkey);
if ($defaultvalue) $param .= '&defaultvalue='.urlencode($defaultvalue);
@ -359,7 +359,7 @@ if ($result)
// Page
print '<td>';
if ($action != 'edit' || GETPOST('rowid') != $obj->rowid) print $obj->page;
if ($action != 'edit' || GETPOST('rowid', 'int') != $obj->rowid) print $obj->page;
else print '<input type="text" name="urlpage" value="'.dol_escape_htmltag($obj->page).'">';
print '</td>'."\n";
@ -378,7 +378,7 @@ if ($result)
print '<input type="hidden" name="const['.$i.'][name]" value="'.$obj->transkey.'">';
print '<input type="text" id="value_'.$i.'" class="flat inputforupdate" size="30" name="const['.$i.'][value]" value="'.dol_escape_htmltag($obj->transvalue).'">';
*/
if ($action != 'edit' || GETPOST('rowid') != $obj->rowid) print $obj->value;
if ($action != 'edit' || GETPOST('rowid') != $obj->rowid) print dol_escape_htmltag($obj->value);
else print '<input type="text" name="value" value="'.dol_escape_htmltag($obj->value).'">';
print '</td>';
}

View File

@ -58,6 +58,7 @@ if ($id == 10 && !empty($user->rights->accounting->chartofaccount)) $allowed = 1
if ($id == 17 && !empty($user->rights->accounting->chartofaccount)) $allowed = 1; // Dictionary with type of expense report and accounting account allowed to manager of chart account
if (!$allowed) accessforbidden();
$acts =array(); $actl =array();
$acts[0] = "activate";
$acts[1] = "disable";
$actl[0] = img_picto($langs->trans("Disabled"), 'switch_off');
@ -76,7 +77,7 @@ $pageprev = $page - 1;
$pagenext = $page + 1;
$search_country_id = GETPOST('search_country_id', 'int');
if ($search_country_id == '' && ($id == 2 || $id == 3 || $id == 10)) // Not a so good idea to force on current country for all dictionaries. Some tables have entries that are for all countries, we must be able to see them, so this is done for dedicated dictionaries only.
if (! GETPOSTISSET('search_country_id') && $search_country_id == '' && ($id == 2 || $id == 3 || $id == 10)) // Not a so good idea to force on current country for all dictionaries. Some tables have entries that are for all countries, we must be able to see them, so this is done for dedicated dictionaries only.
{
$search_country_id = $mysoc->country_id;
}
@ -178,7 +179,7 @@ $tablib[38] = "DictionarySocialNetworks";
$tabsql = array();
$tabsql[1] = "SELECT f.rowid as rowid, f.code, f.libelle, c.code as country_code, c.label as country, f.active FROM ".MAIN_DB_PREFIX."c_forme_juridique as f, ".MAIN_DB_PREFIX."c_country as c WHERE f.fk_pays=c.rowid";
$tabsql[2] = "SELECT d.rowid as rowid, d.code_departement as code, d.nom as libelle, d.fk_region as region_id, r.nom as region, c.code as country_code, c.label as country, d.active FROM ".MAIN_DB_PREFIX."c_departements as d, ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_country as c WHERE d.fk_region=r.code_region and r.fk_pays=c.rowid and r.active=1 and c.active=1";
$tabsql[3] = "SELECT r.rowid as rowid, r.code_region as code, r.nom as libelle, r.fk_pays as country_id, c.code as country_code, c.label as country, r.active FROM ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_country as c WHERE r.fk_pays=c.rowid and c.active=1";
$tabsql[3] = "SELECT r.rowid as rowid, r.code_region as state_code, r.nom as libelle, r.fk_pays as country_id, c.code as country_code, c.label as country, r.active FROM ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_country as c WHERE r.fk_pays=c.rowid and c.active=1";
$tabsql[4] = "SELECT c.rowid as rowid, c.code, c.label, c.active, c.favorite FROM ".MAIN_DB_PREFIX."c_country AS c";
$tabsql[5] = "SELECT c.rowid as rowid, c.code as code, c.label, c.active FROM ".MAIN_DB_PREFIX."c_civility AS c";
$tabsql[6] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.type, a.active, a.module, a.color, a.position FROM ".MAIN_DB_PREFIX."c_actioncomm AS a";
@ -759,12 +760,13 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$_POST[$listfieldvalue[$i]] = getEntity($tabname[$id]);
}
if ($i) $sql .= ",";
if ($listfieldvalue[$i] == 'sortorder') // For column name 'sortorder', we use the field name 'position'
{
$sql .= "'".(int) $db->escape($_POST['position'])."'";
$sql .= "'".(int) $db->escape(GETPOST('position'))."'";
}
elseif ($_POST[$listfieldvalue[$i]] == '' && !($listfieldvalue[$i] == 'code' && $id == 10)) $sql .= "null"; // For vat, we want/accept code = ''
else $sql .= "'".$db->escape($_POST[$listfieldvalue[$i]])."'";
else $sql .= "'".$db->escape(GETPOST($listfieldvalue[$i], 'nohtml'))."'";
$i++;
}
$sql .= ",1)";
@ -1011,6 +1013,7 @@ if ($id)
if ($search_code != '' && $id == 9) $sql .= natural_search("code_iso", $search_code);
elseif ($search_code != '' && $id == 28) $sql .= natural_search("h.code", $search_code);
elseif ($search_code != '' && $id == 32) $sql .= natural_search("a.code", $search_code);
elseif ($search_code != '' && $id == 3) $sql .= natural_search("r.code_region", $search_code);
elseif ($search_code != '' && $id != 9) $sql .= natural_search("code", $search_code);
if ($sortfield)
@ -1146,7 +1149,7 @@ if ($id)
if ($fieldlist[$field] == 'revenuestamp_type') { $valuetoshow = $langs->trans('TypeOfRevenueStamp'); }
if ($fieldlist[$field] == 'use_default') { $valuetoshow = $langs->trans('Default'); }
if ($id == 2) // Special cas for state page
if ($id == 2) // Special case for state page
{
if ($fieldlist[$field] == 'region_id') { $valuetoshow = '&nbsp;'; $showfield = 1; }
if ($fieldlist[$field] == 'region') { $valuetoshow = $langs->trans("Country").'/'.$langs->trans("Region"); $showfield = 1; }
@ -1228,6 +1231,7 @@ if ($id)
// List of available record in database
dol_syslog("htdocs/admin/dict", LOG_DEBUG);
$resql = $db->query($sql);
if ($resql)
{
@ -1620,7 +1624,9 @@ if ($id)
$key = $langs->trans($obj->label);
$valuetoshow = ($obj->label && $key != strtoupper($obj->label) ? $key : $obj->{$fieldlist[$field]});
}
elseif ($fieldlist[$field] == 'code' && $id == 3) {
$valuetoshow = $obj->state_code;
}
$class .= ($class ? ' ' : '').'tddict';
if ($fieldlist[$field] == 'note' && $id == 10) $class .= ' tdoverflowmax200';
if ($fieldlist[$field] == 'tracking') $class .= ' tdoverflowauto';

View File

@ -49,12 +49,15 @@ $tmp=getBrowserInfo($_SERVER["HTTP_USER_AGENT"]);
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td colspan="2">'.$langs->trans("Value").'</td></tr>'."\n";
print '<tr class="oddeven"><td width="300">'.$langs->trans("UserAgent").'</td><td colspan="2">'.$_SERVER['HTTP_USER_AGENT'].'</td></tr>'."\n";
print '<tr class="oddeven"><td width="300">'.$langs->trans("UserAgent").'</td><td colspan="2">'.dol_escape_htmltag($_SERVER['HTTP_USER_AGENT']).'</td></tr>'."\n";
print '<tr class="oddeven"><td width="300">'.$langs->trans("BrowserName").'</td><td colspan="2">'.$tmp['browsername'].'</td></tr>'."\n";
print '<tr class="oddeven"><td width="300">'.$langs->trans("BrowserOS").'</td><td colspan="2">'.$tmp['browseros'].'</td></tr>'."\n";
print '<tr class="oddeven"><td width="300">'.$langs->trans("Version").'</td><td colspan="2">'.$tmp['browserversion'].'</td></tr>'."\n";
print '<tr class="oddeven"><td width="300">'.$langs->trans("Layout").' (phone/tablet/classic)</td><td colspan="2">'.$tmp['layout'].'</td></tr>'."\n";
print '<tr class="oddeven"><td width="300">'.$langs->trans("IPAddress").'</td><td colspan="2">'.$_SERVER['REMOTE_ADDR'].'</td></tr>'."\n";
print '<tr class="oddeven"><td width="300">'.$langs->trans("IPAddress").'</td><td colspan="2">'.dol_escape_htmltag($_SERVER['REMOTE_ADDR']);
if (! empty($_SERVER['HTTP_CLIENT_IP'])) print ' (HTTP_CLIENT_IP='.dol_escape_htmltag($_SERVER['HTTP_CLIENT_IP']).')';
if (! empty($_SERVER['HTTP_X_FORWARDED_FOR'])) print ' (HTTP_X_FORWARDED_FOR='.dol_escape_htmltag($_SERVER['HTTP_X_FORWARDED_FOR']).')';
print '</td></tr>'."\n";
print '<tr class="oddeven"><td width="300">'.$langs->trans("SessionName").'</td><td colspan="2">'.session_name().'</td></tr>'."\n";
print '<tr class="oddeven"><td width="300">'.$langs->trans("SessionId").'</td><td colspan="2">'.session_id().'</td></tr>'."\n";

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2007-2016 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2007-2020 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009-2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2017 Frédéric France <frederic.france@free.fr>
*
@ -35,9 +35,9 @@ if (!$user->admin) accessforbidden();
$id = GETPOST('rowid', 'int');
$action = GETPOST('action', 'alpha');
$langcode = GETPOST('langcode', 'alpha');
$transkey = GETPOST('transkey', 'alpha');
$transvalue = GETPOST('transvalue', 'alpha');
$langcode = GETPOST('langcode', 'alphanohtml');
$transkey = GETPOST('transkey', 'alphanohtml');
$transvalue = GETPOST('transvalue', 'none');
$mode = GETPOST('mode', 'aZ09') ?GETPOST('mode', 'aZ09') : 'overwrite';
@ -190,7 +190,6 @@ if ($action == 'delete')
/*
* View
*/
@ -231,9 +230,9 @@ print '<span class="opacitymedium">'.$form->textwithpicto($langs->trans("Current
print '<br>';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
if ($optioncss != '') $param.='&optioncss='.$optioncss;
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
if ($langcode) $param.='&langcode='.urlencode($langcode);
if ($transkey) $param.='&transkey='.urlencode($transkey);
if ($transvalue) $param.='&transvalue='.urlencode($transvalue);
@ -348,11 +347,11 @@ if ($mode == 'overwrite')
*/
if ($action == 'edit' && $obj->rowid == GETPOST('rowid', 'int'))
{
print '<input type="text" class="quatrevingtpercent" name="transvalue" value="'.$obj->transvalue.'">';
print '<input type="text" class="quatrevingtpercent" name="transvalue" value="'.dol_escape_htmltag($obj->transvalue).'">';
}
else
{
print $obj->transvalue;
print dol_escape_htmltag($obj->transvalue);
}
print '</td>';

View File

@ -53,7 +53,7 @@ class Setup extends DolibarrApi
* @param int $limit Number of items per page
* @param int $page Page number {@min 0}
* @param int $active Payment type is active or not {@min 0} {@max 1}
* @param string $sqlfilters SQL criteria to filter with. Syntax example "(t.code:=:'CHQ')"
* @param string $sqlfilters SQL criteria to filter with. Syntax example "(t.code:=:'OrderByWWW')"
*
* @url GET dictionary/ordering_methods
*

View File

@ -155,6 +155,8 @@ if (empty($reshook))
if (!$error)
{
$lastposition = 0;
$bomline = new BOMLine($db);
$bomline->fk_bom = $id;
$bomline->fk_product = $idprod;
@ -163,6 +165,12 @@ if (empty($reshook))
$bomline->disable_stock_change = (int) $disable_stock_change;
$bomline->efficiency = $efficiency;
// Rang to use
$rangmax = $object->line_max(0);
$ranktouse = $rangmax + 1;
$bomline->position = ($ranktouse + 1);
$result = $bomline->create($user);
if ($result <= 0)
{

View File

@ -1032,7 +1032,7 @@ if ($object->id > 0)
*/
if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
{
$sql = 'SELECT f.rowid as id, f.titre as ref, f.amount';
$sql = 'SELECT f.rowid as id, f.titre as ref';
$sql .= ', f.total as total_ht';
$sql .= ', f.tva as total_tva';
$sql .= ', f.total_ttc';
@ -1045,7 +1045,7 @@ if ($object->id > 0)
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_rec as f";
$sql .= " WHERE f.fk_soc = s.rowid AND s.rowid = ".$object->id;
$sql .= " AND f.entity = ".$conf->entity;
$sql .= ' GROUP BY f.rowid, f.titre, f.amount, f.total, f.tva, f.total_ttc,';
$sql .= ' GROUP BY f.rowid, f.titre, f.total, f.tva, f.total_ttc,';
$sql .= ' f.date_last_gen, f.datec, f.frequency, f.unit_frequency,';
$sql .= ' f.suspended, f.date_when,';
$sql .= ' s.nom, s.rowid';
@ -1140,7 +1140,7 @@ if ($object->id > 0)
*/
if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
{
$sql = 'SELECT f.rowid as facid, f.ref, f.type, f.amount';
$sql = 'SELECT f.rowid as facid, f.ref, f.type';
$sql .= ', f.total as total_ht';
$sql .= ', f.tva as total_tva';
$sql .= ', f.total_ttc';
@ -1151,7 +1151,7 @@ if ($object->id > 0)
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON f.rowid=pf.fk_facture';
$sql .= " WHERE f.fk_soc = s.rowid AND s.rowid = ".$object->id;
$sql .= " AND f.entity IN (".getEntity('invoice').")";
$sql .= ' GROUP BY f.rowid, f.ref, f.type, f.amount, f.total, f.tva, f.total_ttc,';
$sql .= ' GROUP BY f.rowid, f.ref, f.type, f.total, f.tva, f.total_ttc,';
$sql .= ' f.datef, f.datec, f.paye, f.fk_statut,';
$sql .= ' s.nom, s.rowid';
$sql .= " ORDER BY f.datef DESC, f.datec DESC";

View File

@ -3889,7 +3889,7 @@ elseif ($id > 0 || !empty($ref))
}
// Call Hook formConfirm
$parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid);
$parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid, 'remainingtopay' => &$resteapayer);
$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;

View File

@ -71,7 +71,6 @@ class FactureRec extends CommonInvoice
public $number;
public $date;
public $amount;
public $remise;
public $tva;
public $total;
@ -127,7 +126,7 @@ class FactureRec extends CommonInvoice
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>20, 'index'=>1),
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>25),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>30),
'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35),
//'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35),
'remise' =>array('type'=>'double', 'label'=>'Remise', 'enabled'=>1, 'visible'=>-1, 'position'=>40),
'remise_percent' =>array('type'=>'double', 'label'=>'Remise percent', 'enabled'=>1, 'visible'=>-1, 'position'=>45),
'remise_absolue' =>array('type'=>'double', 'label'=>'Remise absolue', 'enabled'=>1, 'visible'=>-1, 'position'=>50),
@ -453,7 +452,7 @@ class FactureRec extends CommonInvoice
*/
public function fetch($rowid, $ref = '', $ref_ext = '', $ref_int = '')
{
$sql = 'SELECT f.rowid, f.entity, f.titre as title, f.suspended, f.fk_soc, f.amount, f.tva, f.localtax1, f.localtax2, f.total, f.total_ttc';
$sql = 'SELECT f.rowid, f.entity, f.titre as title, f.suspended, f.fk_soc, f.tva, f.localtax1, f.localtax2, f.total, f.total_ttc';
$sql .= ', f.remise_percent, f.remise_absolue, f.remise';
$sql .= ', f.date_lim_reglement as dlr';
$sql .= ', f.note_private, f.note_public, f.fk_user_author';
@ -495,7 +494,6 @@ class FactureRec extends CommonInvoice
$this->type = $obj->type;
$this->datep = $obj->dp;
$this->date = $obj->df;
$this->amount = $obj->amount;
$this->remise_percent = $obj->remise_percent;
$this->remise_absolue = $obj->remise_absolue;
$this->remise = $obj->remise;

View File

@ -261,59 +261,59 @@ class Facture extends CommonInvoice
'increment' =>array('type'=>'varchar(10)', 'label'=>'Increment', 'enabled'=>1, 'visible'=>-1, 'position'=>45),
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>50),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
'datef' =>array('type'=>'date', 'label'=>'Datef', 'enabled'=>1, 'visible'=>-1, 'position'=>60),
'datef' =>array('type'=>'date', 'label'=>'DateInvoice', 'enabled'=>1, 'visible'=>-1, 'position'=>60),
'date_valid' =>array('type'=>'date', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
'date_closing' =>array('type'=>'datetime', 'label'=>'Date closing', 'enabled'=>1, 'visible'=>-1, 'position'=>70),
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>75),
'paye' =>array('type'=>'smallint(6)', 'label'=>'Paye', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>80),
'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>85),
'paye' =>array('type'=>'smallint(6)', 'label'=>'InvoicePaidCompletely', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>80),
//'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>85),
'remise_percent' =>array('type'=>'double', 'label'=>'Remise percent', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
'remise_absolue' =>array('type'=>'double', 'label'=>'Remise absolue', 'enabled'=>1, 'visible'=>-1, 'position'=>95),
'remise' =>array('type'=>'double', 'label'=>'Remise', 'enabled'=>1, 'visible'=>-1, 'position'=>100),
'close_code' =>array('type'=>'varchar(16)', 'label'=>'Close code', 'enabled'=>1, 'visible'=>-1, 'position'=>105),
'close_note' =>array('type'=>'varchar(128)', 'label'=>'Close note', 'enabled'=>1, 'visible'=>-1, 'position'=>110),
'tva' =>array('type'=>'double(24,8)', 'label'=>'Tva', 'enabled'=>1, 'visible'=>-1, 'position'=>115, 'isameasure'=>1),
'close_code' =>array('type'=>'varchar(16)', 'label'=>'EarlyClosingReason', 'enabled'=>1, 'visible'=>-1, 'position'=>105),
'close_note' =>array('type'=>'varchar(128)', 'label'=>'EarlyClosingComment', 'enabled'=>1, 'visible'=>-1, 'position'=>110),
'tva' =>array('type'=>'double(24,8)', 'label'=>'TotalVAT', 'enabled'=>1, 'visible'=>-1, 'position'=>115, 'isameasure'=>1),
'localtax1' =>array('type'=>'double(24,8)', 'label'=>'Localtax1', 'enabled'=>1, 'visible'=>-1, 'position'=>120, 'isameasure'=>1),
'localtax2' =>array('type'=>'double(24,8)', 'label'=>'Localtax2', 'enabled'=>1, 'visible'=>-1, 'position'=>125, 'isameasure'=>1),
'revenuestamp' =>array('type'=>'double(24,8)', 'label'=>'Revenuestamp', 'enabled'=>1, 'visible'=>-1, 'position'=>130, 'isameasure'=>1),
'total' =>array('type'=>'double(24,8)', 'label'=>'Total', 'enabled'=>1, 'visible'=>-1, 'position'=>135, 'isameasure'=>1),
'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'Total ttc', 'enabled'=>1, 'visible'=>-1, 'position'=>140, 'isameasure'=>1),
'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Fk statut', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500),
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'position'=>150),
'revenuestamp' =>array('type'=>'double(24,8)', 'label'=>'RevenueStamp', 'enabled'=>1, 'visible'=>-1, 'position'=>130, 'isameasure'=>1),
'total' =>array('type'=>'double(24,8)', 'label'=>'TotalHT', 'enabled'=>1, 'visible'=>-1, 'position'=>135, 'isameasure'=>1),
'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'TotalTTC', 'enabled'=>1, 'visible'=>-1, 'position'=>140, 'isameasure'=>1),
'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Status', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500),
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'position'=>150),
'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>155),
'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>160),
'fk_user_closing' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user closing', 'enabled'=>1, 'visible'=>-1, 'position'=>165),
'fk_facture_source' =>array('type'=>'integer', 'label'=>'Fk facture source', 'enabled'=>1, 'visible'=>-1, 'position'=>170),
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>1, 'visible'=>-1, 'position'=>175),
'fk_user_closing' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserClosing', 'enabled'=>1, 'visible'=>-1, 'position'=>165),
'fk_facture_source' =>array('type'=>'integer', 'label'=>'SourceInvoice', 'enabled'=>1, 'visible'=>-1, 'position'=>170),
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>175),
'fk_account' =>array('type'=>'integer', 'label'=>'Fk account', 'enabled'=>1, 'visible'=>-1, 'position'=>180),
'fk_currency' =>array('type'=>'varchar(3)', 'label'=>'Fk currency', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'Fk cond reglement', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>190),
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'Fk mode reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>195),
'date_lim_reglement' =>array('type'=>'date', 'label'=>'Date lim reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>200),
'fk_currency' =>array('type'=>'varchar(3)', 'label'=>'CurrencyCode', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>190),
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>-1, 'position'=>195),
'date_lim_reglement' =>array('type'=>'date', 'label'=>'DateDue', 'enabled'=>1, 'visible'=>-1, 'position'=>200),
'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>205),
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>210),
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>215),
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>220),
'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>225),
'situation_cycle_ref' =>array('type'=>'smallint(6)', 'label'=>'Situation cycle ref', 'enabled'=>1, 'visible'=>-1, 'position'=>230),
'situation_counter' =>array('type'=>'smallint(6)', 'label'=>'Situation counter', 'enabled'=>1, 'visible'=>-1, 'position'=>235),
'situation_final' =>array('type'=>'smallint(6)', 'label'=>'Situation final', 'enabled'=>1, 'visible'=>-1, 'position'=>240),
'retained_warranty' =>array('type'=>'double', 'label'=>'Retained warranty', 'enabled'=>1, 'visible'=>-1, 'position'=>245),
'retained_warranty_date_limit' =>array('type'=>'date', 'label'=>'Retained warranty date limit', 'enabled'=>1, 'visible'=>-1, 'position'=>250),
'retained_warranty_fk_cond_reglement' =>array('type'=>'integer', 'label'=>'Retained warranty fk cond reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>255),
'fk_incoterms' =>array('type'=>'integer', 'label'=>'Fk incoterms', 'enabled'=>1, 'visible'=>-1, 'position'=>260),
'location_incoterms' =>array('type'=>'varchar(255)', 'label'=>'Location incoterms', 'enabled'=>1, 'visible'=>-1, 'position'=>265),
'date_pointoftax' =>array('type'=>'date', 'label'=>'Date pointoftax', 'enabled'=>1, 'visible'=>-1, 'position'=>270),
'fk_multicurrency' =>array('type'=>'integer', 'label'=>'Fk multicurrency', 'enabled'=>1, 'visible'=>-1, 'position'=>275),
'multicurrency_code' =>array('type'=>'varchar(255)', 'label'=>'Multicurrency code', 'enabled'=>1, 'visible'=>-1, 'position'=>280),
'multicurrency_tx' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency tx', 'enabled'=>1, 'visible'=>-1, 'position'=>285),
'multicurrency_total_ht' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency total ht', 'enabled'=>1, 'visible'=>-1, 'position'=>290),
'multicurrency_total_tva' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency total tva', 'enabled'=>1, 'visible'=>-1, 'position'=>295),
'multicurrency_total_ttc' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency total ttc', 'enabled'=>1, 'visible'=>-1, 'position'=>300),
'fk_fac_rec_source' =>array('type'=>'integer', 'label'=>'Fk fac rec source', 'enabled'=>1, 'visible'=>-1, 'position'=>305),
'situation_cycle_ref' =>array('type'=>'smallint(6)', 'label'=>'Situation cycle ref', 'enabled'=>'$conf->global->INVOICE_USE_SITUATION', 'visible'=>-1, 'position'=>230),
'situation_counter' =>array('type'=>'smallint(6)', 'label'=>'Situation counter', 'enabled'=>'$conf->global->INVOICE_USE_SITUATION', 'visible'=>-1, 'position'=>235),
'situation_final' =>array('type'=>'smallint(6)', 'label'=>'Situation final', 'enabled'=>'empty($conf->global->INVOICE_USE_SITUATION) ? 0 : 1', 'visible'=>-1, 'position'=>240),
'retained_warranty' =>array('type'=>'double', 'label'=>'Retained warranty', 'enabled'=>'$conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY', 'visible'=>-1, 'position'=>245),
'retained_warranty_date_limit' =>array('type'=>'date', 'label'=>'Retained warranty date limit', 'enabled'=>'$conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY', 'visible'=>-1, 'position'=>250),
'retained_warranty_fk_cond_reglement' =>array('type'=>'integer', 'label'=>'Retained warranty fk cond reglement', 'enabled'=>'$conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY', 'visible'=>-1, 'position'=>255),
'fk_incoterms' =>array('type'=>'integer', 'label'=>'IncotermsCode', 'enabled'=>'$conf->incoterm->enabled', 'visible'=>-1, 'position'=>260),
'location_incoterms' =>array('type'=>'varchar(255)', 'label'=>'IncotermsLocation', 'enabled'=>'$conf->incoterm->enabled', 'visible'=>-1, 'position'=>265),
'date_pointoftax' =>array('type'=>'date', 'label'=>'DatePointOfTax', 'enabled'=>'$conf->global->INVOICE_POINTOFTAX_DATE', 'visible'=>-1, 'position'=>270),
'fk_multicurrency' =>array('type'=>'integer', 'label'=>'MulticurrencyID', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>275),
'multicurrency_code' =>array('type'=>'varchar(255)', 'label'=>'MulticurrencyCode', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>280),
'multicurrency_tx' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyRate', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>285),
'multicurrency_total_ht' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency total ht', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>290),
'multicurrency_total_tva' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency total tva', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>295),
'multicurrency_total_ttc' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency total ttc', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>300),
'fk_fac_rec_source' =>array('type'=>'integer', 'label'=>'RecurringInvoiceSource', 'enabled'=>1, 'visible'=>-1, 'position'=>305),
'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'Last main doc', 'enabled'=>1, 'visible'=>-1, 'position'=>310),
'module_source' =>array('type'=>'varchar(32)', 'label'=>'Module source', 'enabled'=>1, 'visible'=>-1, 'position'=>315),
'pos_source' =>array('type'=>'varchar(32)', 'label'=>'Pos source', 'enabled'=>1, 'visible'=>-1, 'position'=>320),
'module_source' =>array('type'=>'varchar(32)', 'label'=>'POSModule', 'enabled'=>1, 'visible'=>-1, 'position'=>315),
'pos_source' =>array('type'=>'varchar(32)', 'label'=>'POSTerminal', 'enabled'=>1, 'visible'=>-1, 'position'=>320),
);
// END MODULEBUILDER PROPERTIES
@ -1451,7 +1451,7 @@ class Facture extends CommonInvoice
if (empty($rowid) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1;
$sql = 'SELECT f.rowid,f.entity,f.ref,f.ref_client,f.ref_ext,f.ref_int,f.type,f.fk_soc,f.amount';
$sql = 'SELECT f.rowid,f.entity,f.ref,f.ref_client,f.ref_ext,f.ref_int,f.type,f.fk_soc';
$sql .= ', f.tva, f.localtax1, f.localtax2, f.total, f.total_ttc, f.revenuestamp';
$sql .= ', f.remise_percent, f.remise_absolue, f.remise';
$sql .= ', f.datef as df, f.date_pointoftax';
@ -2132,7 +2132,7 @@ class Facture extends CommonInvoice
}
}
// If we decrement stock on invoice validation, we increment
// If we decrease stock on invoice validation, we increase back if a warehouse id was provided
if ($this->type != self::TYPE_DEPOSIT && $result >= 0 && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_BILL) && $idwarehouse != -1)
{
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
@ -2743,7 +2743,7 @@ class Facture extends CommonInvoice
$this->oldcopy = clone $this;
}
// Si on decremente le produit principal et ses composants a la validation de facture, on réincrement
// If we decrease stock on invoice validation, we increase back
if ($this->type != self::TYPE_DEPOSIT && $result >= 0 && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_BILL))
{
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';

View File

@ -1061,7 +1061,6 @@ if ($resql)
{
print $facturestatic->getNomUrl(1, '', 200, 0, '', 0, 1);
}
print empty($obj->increment) ? '' : ' ('.$obj->increment.')';
$filename = dol_sanitizeFileName($obj->ref);
$filedir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($obj->ref);

View File

@ -75,6 +75,8 @@ if ($facid > 0)
// Initialize technical object to manage hooks of paiements. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('paiementcard', 'globalcard'));
$formquestion = array();
/*
* Actions
@ -859,7 +861,7 @@ if (!GETPOST('action', 'aZ09'))
if (!$sortorder) $sortorder = 'DESC';
if (!$sortfield) $sortfield = 'p.datep';
$sql = 'SELECT p.datep as dp, p.amount, f.amount as fa_amount, f.ref';
$sql = 'SELECT p.datep as dp, p.amount, f.total_ttc as fa_amount, f.ref';
$sql .= ', f.rowid as facid, c.libelle as paiement_type, p.num_paiement';
$sql .= ' FROM '.MAIN_DB_PREFIX.'paiement as p LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id';
$sql .= ', '.MAIN_DB_PREFIX.'facture as f';
@ -882,10 +884,10 @@ if (!GETPOST('action', 'aZ09'))
print_barre_liste($langs->trans('Payments'), $page, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', $num);
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print_liste_field_titre('Invoice', $_SERVER["PHP_SELF"], 'ref', '', '', '', $sortfield, $sortorder);
print_liste_field_titre('Date', $_SERVER["PHP_SELF"], 'dp', '', '', '', $sortfield, $sortorder);
print_liste_field_titre('Type', $_SERVER["PHP_SELF"], 'libelle', '', '', '', $sortfield, $sortorder);
print_liste_field_titre('Amount', $_SERVER["PHP_SELF"], 'fa_amount', '', '', '', $sortfield, $sortorder, 'right ');
print_liste_field_titre('Invoice', $_SERVER["PHP_SELF"], 'f.ref', '', '', '', $sortfield, $sortorder);
print_liste_field_titre('Date', $_SERVER["PHP_SELF"], 'p.datep', '', '', '', $sortfield, $sortorder);
print_liste_field_titre('Type', $_SERVER["PHP_SELF"], 'c.libelle', '', '', '', $sortfield, $sortorder);
print_liste_field_titre('Amount', $_SERVER["PHP_SELF"], 'p.amount', '', '', '', $sortfield, $sortorder, 'right ');
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch ');
print "</tr>\n";

View File

@ -117,7 +117,7 @@ if ($id > 0)
$TData = array();
$sql = "SELECT s.nom, s.rowid as socid, f.ref, f.amount, f.datef as df,";
$sql = "SELECT s.nom, s.rowid as socid, f.ref, f.total_ttc, f.datef as df,";
$sql .= " f.paye as paye, f.fk_statut as statut, f.rowid as facid,";
$sql .= " u.login, u.rowid as userid";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f,".MAIN_DB_PREFIX."user as u";

View File

@ -72,8 +72,8 @@ class Contact extends CommonObject
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>30, 'index'=>1),
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>35),
'civility' =>array('type'=>'varchar(6)', 'label'=>'Civility', 'enabled'=>1, 'visible'=>-1, 'position'=>40),
'lastname' =>array('type'=>'varchar(50)', 'label'=>'Lastname', 'enabled'=>1, 'visible'=>-1, 'position'=>45),
'firstname' =>array('type'=>'varchar(50)', 'label'=>'Firstname', 'enabled'=>1, 'visible'=>-1, 'position'=>50),
'lastname' =>array('type'=>'varchar(50)', 'label'=>'Lastname', 'enabled'=>1, 'visible'=>-1, 'position'=>45, 'showoncombobox'=>1),
'firstname' =>array('type'=>'varchar(50)', 'label'=>'Firstname', 'enabled'=>1, 'visible'=>-1, 'position'=>50, 'showoncombobox'=>1),
'address' =>array('type'=>'varchar(255)', 'label'=>'Address', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
'zip' =>array('type'=>'varchar(25)', 'label'=>'Zip', 'enabled'=>1, 'visible'=>-1, 'position'=>60),
'town' =>array('type'=>'text', 'label'=>'Town', 'enabled'=>1, 'visible'=>-1, 'position'=>65),

View File

@ -53,8 +53,8 @@ print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"])
// If ok
if ($action == 'firstpingok')
{
// Note: pings are by installation, done on entity 1.
// Once this constant are set, no more ping will be tried (except if we add parameter &forceping=1 on URL). So we can say this are 'first' ping.
// Note: pings are per installed instances / entity.
// Once this constants are set, no more ping will be tried (except if we add parameter &forceping=1 on URL). So we can say this are 'first' ping.
dolibarr_set_const($db, 'MAIN_FIRST_PING_OK_DATE', dol_print_date($now, 'dayhourlog', 'gmt'));
dolibarr_set_const($db, 'MAIN_FIRST_PING_OK_ID', $hash_unique_id);

View File

@ -84,7 +84,7 @@ class box_factures_fourn_imp extends ModeleBoxes
{
$sql = "SELECT s.nom as name, s.rowid as socid,";
$sql.= " f.rowid as facid, f.ref, f.ref_supplier, f.date_lim_reglement as datelimite,";
$sql.= " f.amount, f.datef as df,";
$sql.= " f.datef as df,";
$sql.= " f.total_ht as total_ht,";
$sql.= " f.tva as total_tva,";
$sql.= " f.total_ttc,";

View File

@ -93,7 +93,7 @@ class box_factures_imp extends ModeleBoxes
$sql .= " s.logo,";
$sql .= " f.ref, f.date_lim_reglement as datelimite,";
$sql .= " f.type,";
$sql .= " f.amount, f.datef as df,";
$sql .= " f.datef as df,";
$sql .= " f.total as total_ht,";
$sql .= " f.tva as total_tva,";
$sql .= " f.total_ttc,";
@ -110,7 +110,7 @@ class box_factures_imp extends ModeleBoxes
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
if ($user->socid) $sql .= " AND s.rowid = ".$user->socid;
$sql .= " GROUP BY s.nom, s.rowid, s.email, s.code_client, s.logo, f.ref, f.date_lim_reglement,";
$sql .= " f.type, f.amount, f.datef, f.total, f.tva, f.total_ttc, f.paye, f.fk_statut, f.rowid";
$sql .= " f.type, f.datef, f.total, f.tva, f.total_ttc, f.paye, f.fk_statut, f.rowid";
//$sql.= " ORDER BY f.datef DESC, f.ref DESC ";
$sql .= " ORDER BY datelimite ASC, f.ref ASC ";
$sql .= $this->db->plimit($max, 0);

View File

@ -508,7 +508,7 @@ class CMailFile
$res = false;
if (empty($conf->global->MAIN_DISABLE_ALL_MAILS) || !empty($conf->global->MAIN_MAIL_FORCE_SENDTO))
if (empty($conf->global->MAIN_DISABLE_ALL_MAILS))
{
require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager = new HookManager($db);

View File

@ -2744,10 +2744,13 @@ abstract class CommonObject
public function line_max($fk_parent_line = 0)
{
// phpcs:enable
$positionfield = 'rang';
if ($this->table_element == 'bom') $positionfield = 'position';
// Search the last rang with fk_parent_line
if ($fk_parent_line)
{
$sql = 'SELECT max(rang) FROM '.MAIN_DB_PREFIX.$this->table_element_line;
$sql = 'SELECT max('.$positionfield.') FROM '.MAIN_DB_PREFIX.$this->table_element_line;
$sql .= ' WHERE '.$this->fk_element.' = '.$this->id;
$sql .= ' AND fk_parent_line = '.$fk_parent_line;
@ -2769,7 +2772,7 @@ abstract class CommonObject
// If not, search the last rang of element
else
{
$sql = 'SELECT max(rang) FROM '.MAIN_DB_PREFIX.$this->table_element_line;
$sql = 'SELECT max('.$positionfield.') FROM '.MAIN_DB_PREFIX.$this->table_element_line;
$sql .= ' WHERE '.$this->fk_element.' = '.$this->id;
dol_syslog(get_class($this)."::line_max", LOG_DEBUG);

View File

@ -208,7 +208,7 @@ class ExtraFields
*
* @param string $attrname Code of attribute
* @param string $label label of attribute
* @param int $type Type of attribute ('boolean','int','varchar','text','html','date','datehour','price','phone','mail','password','url','select','checkbox','separate',...)
* @param string $type Type of attribute ('boolean','int','varchar','text','html','date','datehour','price','phone','mail','password','url','select','checkbox','separate',...)
* @param int $pos Position of attribute
* @param string $size Size/length definition of attribute ('5', '24,8', ...). For float, it contains 2 numeric separated with a comma.
* @param string $elementtype Element type. Same value than object->table_element (Example 'member', 'product', 'thirdparty', ...)
@ -232,6 +232,7 @@ class ExtraFields
if (empty($attrname)) return -1;
if (empty($label)) return -1;
if ($type == 'separate') { $unique = 0; $required = 0; } // Force unique and not required if this is a separator field to avoid troubles.
if ($elementtype == 'thirdparty') $elementtype = 'societe';
if ($elementtype == 'contact') $elementtype = 'socpeople';

View File

@ -6497,7 +6497,7 @@ class Form
* @param int $translate Translate and encode value
* @param int $width Force width of select box. May be used only when using jquery couch. Example: 250, 95%
* @param string $moreattrib Add more options on select component. Example: 'disabled'
* @param string $elemtype Type of element we show ('category', ...)
* @param string $elemtype Type of element we show ('category', ...). Will execute a formating function on it. To use in readonly mode if js component support HTML formatting.
* @param string $placeholder String to use as placeholder
* @param int $addjscombo Add js combo
* @return string HTML multiselect string
@ -6552,7 +6552,7 @@ class Form
templateResult: formatResult, /* For 4.0 */
// Specify format function for selected item
formatSelection: formatSelection,
templateResult: formatSelection /* For 4.0 */
templateSelection: formatSelection /* For 4.0 */
});
});'."\n";
}
@ -8034,17 +8034,47 @@ class Form
/**
* Output the component to make advanced search criteries
*
* @param array $arrayofcriterias Array of available search criterias. Example: array($object->element => $object->fields, 'otherfamily' => otherarrayoffields, ...)
* @param array $search_component_params Array of selected search criterias
* @return string HTML component for advanced search
* @param array $arrayofcriterias Array of available search criterias. Example: array($object->element => $object->fields, 'otherfamily' => otherarrayoffields, ...)
* @param array $search_component_params Array of selected search criterias
* @param array $arrayofinputfieldsalreadyoutput Array of input fields already inform. The component will not generate a hidden input field if it is in this list.
* @return string HTML component for advanced search
*/
public function searchComponent($arrayofcriterias, $search_component_params)
public function searchComponent($arrayofcriterias, $search_component_params, $arrayofinputfieldsalreadyoutput = array())
{
global $conf, $langs;
$ret = '';
$ret .= '<div class="nowrap centpercent">';
//$ret .= '<button type="submit" class="liste_titre button_removefilter" name="button_removefilter_x" value="x"><span class="fa fa-remove"></span></button>';
$ret .= '<a href="#" class="dropdownsearch-toggle unsetcolor paddingright">';
$ret .= '<span class="fas fa-filter linkobject boxfilter" title="Filter" id="idsubimgproductdistribution"></span>';
$ret .= $langs->trans("Filters");
$ret .= '</a>';
//$ret .= '<button type="submit" class="liste_titre button_search paddingleftonly" name="button_search_x" value="x"><span class="fa fa-search"></span></button>';
$ret .= '<div name="search_component_params" class="search_component_params inline-block centpercent">';
$ret .= '<input type="text" name="search_component_params_input" class="search_component_params_input" placeholder="'.$langs->trans("Search").'" value="'.GETPOST("search_component_params_input").'">';
$ret .= '</div>';
foreach($arrayofcriterias as $criterias) {
foreach($criterias as $criteriafamilykey => $criteriafamilyval) {
if (in_array('search_'.$criteriafamilykey, $arrayofinputfieldsalreadyoutput)) continue;
if (in_array($criteriafamilykey, array('rowid', 'ref_ext', 'entity', 'extraparams'))) continue;
if (in_array($criteriafamilyval['type'], array('date', 'datetime', 'timestamp'))) {
$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_start">';
$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startyear">';
$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startmonth">';
$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startday">';
$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_end">';
$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endyear">';
$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endmonth">';
$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endday">';
}
else {
$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'">';
}
}
}
$ret .= '</div>';
return $ret;

View File

@ -961,3 +961,69 @@ function monthArray($outputlangs, $short = 0)
return $montharray;
}
/**
* Return array of week numbers.
*
* @param int $month Month number
* @param int $year Year number
* @return array Week numbers
*/
function getWeekNumbersOfMonth($month, $year)
{
$nb_days = cal_days_in_month(CAL_GREGORIAN, $month, $year);
$TWeek = array();
for($day = 1; $day < $nb_days; $day++) {
$week_number = getWeekNumber($day, $month, $year);
$TWeek[$week_number] = $week_number;
}
return $TWeek;
}
/**
* Return array of first day of weeks.
*
* @param array $TWeek array of week numbers
* @param int $year Year number
* @return array First day of week
*/
function getFirstDayOfEachWeek($TWeek, $year)
{
$TFirstDayOfWeek = array();
foreach($TWeek as $weekNb) {
if(in_array('01', $TWeek) && in_array('52', $TWeek) && $weekNb == '01') $year++;//Si on a la 1re semaine et la semaine 52 c'est qu'on change d'année
$TFirstDayOfWeek[$weekNb] = date('d', strtotime($year.'W'.$weekNb));
}
return $TFirstDayOfWeek;
}
/**
* Return array of last day of weeks.
*
* @param array $TWeek array of week numbers
* @param int $year Year number
* @return array Last day of week
*/
function getLastDayOfEachWeek($TWeek, $year)
{
$TLastDayOfWeek = array();
foreach($TWeek as $weekNb) {
$TLastDayOfWeek[$weekNb] = date('d', strtotime($year.'W'.$weekNb.'+6 days'));
}
return $TLastDayOfWeek;
}
/**
* Return week number.
*
* @param int $day Day number
* @param int $month Month number
* @param int $year Year number
* @return int Week number
*/
function getWeekNumber($day, $month, $year)
{
$date = new DateTime($year.'-'.$month.'-'.$day);
$week = $date->format("W");
return $week;
}

View File

@ -224,7 +224,54 @@ function dol_shutdown()
*/
function GETPOSTISSET($paramname)
{
return (isset($_POST[$paramname]) || isset($_GET[$paramname]));
$isset = 0;
$relativepathstring = $_SERVER["PHP_SELF"];
// Clean $relativepathstring
if (constant('DOL_URL_ROOT')) $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_URL_ROOT'), '/').'/', '', $relativepathstring);
$relativepathstring = preg_replace('/^\//', '', $relativepathstring);
$relativepathstring = preg_replace('/^custom\//', '', $relativepathstring);
//var_dump($relativepathstring);
//var_dump($user->default_values);
// Code for search criteria persistence.
// Retrieve values if restore_lastsearch_values
if (!empty($_GET['restore_lastsearch_values'])) // Use $_GET here and not GETPOST
{
if (!empty($_SESSION['lastsearch_values_'.$relativepathstring])) // If there is saved values
{
$tmp = json_decode($_SESSION['lastsearch_values_'.$relativepathstring], true);
if (is_array($tmp))
{
foreach ($tmp as $key => $val)
{
if ($key == $paramname) // We are on the requested parameter
{
$isset = 1;
break;
}
}
}
}
// If there is saved contextpage, page or limit
if ($paramname == 'contextpage' && !empty($_SESSION['lastsearch_contextpage_'.$relativepathstring]))
{
$isset = 1;
}
elseif ($paramname == 'page' && !empty($_SESSION['lastsearch_page_'.$relativepathstring]))
{
$isset = 1;
}
elseif ($paramname == 'limit' && !empty($_SESSION['lastsearch_limit_'.$relativepathstring]))
{
$isset = 1;
}
}
else {
$isset = (isset($_POST[$paramname]) || isset($_GET[$paramname]));
}
return $isset;
}
/**
@ -1058,10 +1105,13 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename =
'ip' => false
);
// This is when server run behind a reverse proxy
if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) $data['ip'] = $_SERVER['HTTP_X_FORWARDED_FOR'].(empty($_SERVER["REMOTE_ADDR"]) ? '' : '->'.$_SERVER['REMOTE_ADDR']);
// This is when server run normally on a server
elseif (!empty($_SERVER["REMOTE_ADDR"])) $data['ip'] = $_SERVER['REMOTE_ADDR'];
$remoteip = getUserRemoteIP(); // Get ip when page run on a web server
if (! empty($remoteip)) {
$data['ip'] = $remoteip;
// This is when server run behind a reverse proxy
if (!empty($_SERVER['HTTP_X_FORWARDED_FOR']) && $_SERVER['HTTP_X_FORWARDED_FOR'] != $remoteip) $data['ip'] = $_SERVER['HTTP_X_FORWARDED_FOR'].' -> '.$data['ip'];
elseif (!empty($_SERVER['HTTP_CLIENT_IP']) && $_SERVER['HTTP_CLIENT_IP'] != $remoteip) $data['ip'] = $_SERVER['HTTP_CLIENT_IP'].' -> '.$data['ip'];
}
// This is when PHP session is ran inside a web server but not inside a client request (example: init code of apache)
elseif (!empty($_SERVER['SERVER_ADDR'])) $data['ip'] = $_SERVER['SERVER_ADDR'];
// This is when PHP session is ran outside a web server, like from Windows command line (Not always defined, but useful if OS defined it).

View File

@ -44,94 +44,107 @@ function dol_convertToWord($num, $langs, $currency = false, $centimes = false)
if ($centimes && strlen($num) == 1) {
$num = $num*10;
}
$TNum = explode('.', $num);
$num = (int) $TNum[0];
$words = array();
$list1 = array(
'',
$langs->transnoentitiesnoconv('one'),
$langs->transnoentitiesnoconv('two'),
$langs->transnoentitiesnoconv('three'),
$langs->transnoentitiesnoconv('four'),
$langs->transnoentitiesnoconv('five'),
$langs->transnoentitiesnoconv('six'),
$langs->transnoentitiesnoconv('seven'),
$langs->transnoentitiesnoconv('eight'),
$langs->transnoentitiesnoconv('nine'),
$langs->transnoentitiesnoconv('ten'),
$langs->transnoentitiesnoconv('eleven'),
$langs->transnoentitiesnoconv('twelve'),
$langs->transnoentitiesnoconv('thirteen'),
$langs->transnoentitiesnoconv('fourteen'),
$langs->transnoentitiesnoconv('fifteen'),
$langs->transnoentitiesnoconv('sixteen'),
$langs->transnoentitiesnoconv('seventeen'),
$langs->transnoentitiesnoconv('eighteen'),
$langs->transnoentitiesnoconv('nineteen')
);
$list2 = array(
'',
$langs->transnoentitiesnoconv('ten'),
$langs->transnoentitiesnoconv('twenty'),
$langs->transnoentitiesnoconv('thirty'),
$langs->transnoentitiesnoconv('forty'),
$langs->transnoentitiesnoconv('fifty'),
$langs->transnoentitiesnoconv('sixty'),
$langs->transnoentitiesnoconv('seventy'),
$langs->transnoentitiesnoconv('eighty'),
$langs->transnoentitiesnoconv('ninety'),
$langs->transnoentitiesnoconv('hundred')
);
$list3 = array(
'',
$langs->transnoentitiesnoconv('thousand'),
$langs->transnoentitiesnoconv('million'),
$langs->transnoentitiesnoconv('billion'),
$langs->transnoentitiesnoconv('trillion'),
$langs->transnoentitiesnoconv('quadrillion')
);
if (! empty($conf->global->MAIN_MODULE_NUMBERWORDS)) {
if ($currency == true) {
$type = 1;
}else{
$type = 0;
}
$num_length = strlen($num);
$levels = (int) (($num_length + 2) / 3);
$max_length = $levels * 3;
$num = substr('00' . $num, -$max_length);
$num_levels = str_split($num, 3);
$nboflevels = count($num_levels);
for ($i = 0; $i < $nboflevels; $i++) {
$levels--;
$hundreds = (int) ($num_levels[$i] / 100);
$hundreds = ($hundreds ? ' ' . $list1[$hundreds] . ' '.$langs->transnoentities('hundred') . ( $hundreds == 1 ? '' : 's' ) . ' ': '');
$tens = (int) ($num_levels[$i] % 100);
$singles = '';
if ( $tens < 20 ) {
$tens = ($tens ? ' ' . $list1[$tens] . ' ' : '' );
} else {
$tens = (int) ($tens / 10);
$tens = ' ' . $list2[$tens] . ' ';
$singles = (int) ($num_levels[$i] % 10);
$singles = ' ' . $list1[$singles] . ' ';
}
$words[] = $hundreds . $tens . $singles . ( ( $levels && ( int ) ( $num_levels[$i] ) ) ? ' ' . $list3[$levels] . ' ' : '' );
} //end for loop
$commas = count($words);
if ($commas > 1) {
$commas = $commas - 1;
}
$concatWords = implode(' ', $words);
// Delete multi whitespaces
$concatWords = trim(preg_replace('/[ ]+/', ' ', $concatWords));
$concatWords = $langs->getLabelFromNumber($num, $type);
return $concatWords;
if(!empty($currency)) {
$concatWords .= ' '.$currency;
}else{
$TNum = explode('.', $num);
$num = (int) $TNum[0];
$words = array();
$list1 = array(
'',
$langs->transnoentitiesnoconv('one'),
$langs->transnoentitiesnoconv('two'),
$langs->transnoentitiesnoconv('three'),
$langs->transnoentitiesnoconv('four'),
$langs->transnoentitiesnoconv('five'),
$langs->transnoentitiesnoconv('six'),
$langs->transnoentitiesnoconv('seven'),
$langs->transnoentitiesnoconv('eight'),
$langs->transnoentitiesnoconv('nine'),
$langs->transnoentitiesnoconv('ten'),
$langs->transnoentitiesnoconv('eleven'),
$langs->transnoentitiesnoconv('twelve'),
$langs->transnoentitiesnoconv('thirteen'),
$langs->transnoentitiesnoconv('fourteen'),
$langs->transnoentitiesnoconv('fifteen'),
$langs->transnoentitiesnoconv('sixteen'),
$langs->transnoentitiesnoconv('seventeen'),
$langs->transnoentitiesnoconv('eighteen'),
$langs->transnoentitiesnoconv('nineteen')
);
$list2 = array(
'',
$langs->transnoentitiesnoconv('ten'),
$langs->transnoentitiesnoconv('twenty'),
$langs->transnoentitiesnoconv('thirty'),
$langs->transnoentitiesnoconv('forty'),
$langs->transnoentitiesnoconv('fifty'),
$langs->transnoentitiesnoconv('sixty'),
$langs->transnoentitiesnoconv('seventy'),
$langs->transnoentitiesnoconv('eighty'),
$langs->transnoentitiesnoconv('ninety'),
$langs->transnoentitiesnoconv('hundred')
);
$list3 = array(
'',
$langs->transnoentitiesnoconv('thousand'),
$langs->transnoentitiesnoconv('million'),
$langs->transnoentitiesnoconv('billion'),
$langs->transnoentitiesnoconv('trillion'),
$langs->transnoentitiesnoconv('quadrillion')
);
$num_length = strlen($num);
$levels = (int) (($num_length + 2) / 3);
$max_length = $levels * 3;
$num = substr('00' . $num, -$max_length);
$num_levels = str_split($num, 3);
$nboflevels = count($num_levels);
for ($i = 0; $i < $nboflevels; $i++) {
$levels--;
$hundreds = (int) ($num_levels[$i] / 100);
$hundreds = ($hundreds ? ' ' . $list1[$hundreds] . ' '.$langs->transnoentities('hundred') . ( $hundreds == 1 ? '' : 's' ) . ' ': '');
$tens = (int) ($num_levels[$i] % 100);
$singles = '';
if ( $tens < 20 ) {
$tens = ($tens ? ' ' . $list1[$tens] . ' ' : '' );
} else {
$tens = (int) ($tens / 10);
$tens = ' ' . $list2[$tens] . ' ';
$singles = (int) ($num_levels[$i] % 10);
$singles = ' ' . $list1[$singles] . ' ';
}
$words[] = $hundreds . $tens . $singles . ( ( $levels && ( int ) ( $num_levels[$i] ) ) ? ' ' . $list3[$levels] . ' ' : '' );
} //end for loop
$commas = count($words);
if ($commas > 1) {
$commas = $commas - 1;
}
$concatWords = implode(' ', $words);
// Delete multi whitespaces
$concatWords = trim(preg_replace('/[ ]+/', ' ', $concatWords));
if(!empty($currency)) {
$concatWords .= ' '.$currency;
}
// If we need to write cents call again this function for cents
if(!empty($TNum[1])) {
if(!empty($currency)) $concatWords .= ' '.$langs->transnoentities('and');
$concatWords .= ' '.dol_convertToWord($TNum[1], $langs, $currency, true);
if(!empty($currency)) $concatWords .= ' '.$langs->transnoentities('centimes');
}
return $concatWords;
}
// If we need to write cents call again this function for cents
if(!empty($TNum[1])) {
if(!empty($currency)) $concatWords .= ' '.$langs->transnoentities('and');
$concatWords .= ' '.dol_convertToWord($TNum[1], $langs, $currency, true);
if(!empty($currency)) $concatWords .= ' '.$langs->transnoentities('centimes');
}
return $concatWords;
}

View File

@ -137,13 +137,6 @@ function invoice_admin_prepare_head()
$head[$h][2] = 'payment';
$h++;
if ($conf->global->INVOICE_USE_SITUATION || $conf->global->MAIN_FEATURES_LEVEL >= 1) {
$head[$h][0] = DOL_URL_ROOT.'/admin/facture_situation.php';
$head[$h][1] = $langs->trans("InvoiceSituation");
$head[$h][2] = 'situation';
$h++;
}
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
@ -170,6 +163,11 @@ function invoice_admin_prepare_head()
$head[$h][2] = 'attributeslinesrec';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/admin/facture_situation.php';
$head[$h][1] = $langs->trans("InvoiceSituation");
$head[$h][2] = 'situation';
$h++;
complete_head_from_modules($conf, $langs, null, $head, $h, 'invoice_admin', 'remove');
return $head;

View File

@ -1388,7 +1388,7 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0,
if (!empty($libelleproduitservice) && !empty($ref_prodserv)) $ref_prodserv .= " - ";
}
if (!empty($ref_prodserv) && !empty($conf->global->ADD_HTML_FORMATING_INTO_DESC_DOC)) { $ref_prodserv = '<b>'.$ref_prodserv.'</b>'; }
if (!empty($ref_prodserv) && !empty($conf->global->PDF_BOLD_PRODUCT_REF_AND_PERIOD)) { $ref_prodserv = '<b>'.$ref_prodserv.'</b>'; }
$libelleproduitservice = $prefix_prodserv.$ref_prodserv.$libelleproduitservice;
// Add an additional description for the category products
@ -1425,7 +1425,7 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0,
$period = '('.$outputlangs->transnoentitiesnoconv('DateUntil', dol_print_date($object->lines[$i]->date_end, $format, false, $outputlangs)).')';
}
//print '>'.$outputlangs->charset_output.','.$period;
if (!empty($conf->global->ADD_HTML_FORMATING_INTO_DESC_DOC)) {
if (!empty($conf->global->PDF_BOLD_PRODUCT_REF_AND_PERIOD)) {
$libelleproduitservice .= '<b style="color:#333666;" ><em>'."__N__</b> ".$period.'</em>';
} else {
$libelleproduitservice .= "__N__".$period;

View File

@ -263,6 +263,14 @@ function project_timesheet_prepare_head($mode, $fuser = null)
$param .= ($mode ? '&mode='.$mode : '');
if (is_object($fuser) && $fuser->id > 0 && $fuser->id != $user->id) $param .= '&search_usertoprocessid='.$fuser->id;
if (empty($conf->global->PROJECT_DISABLE_TIMESHEET_PERMONTH))
{
$head[$h][0] = DOL_URL_ROOT."/projet/activity/permonth.php".($param?'?'.$param:'');
$head[$h][1] = $langs->trans("InputPerMonth");
$head[$h][2] = 'inputpermonth';
$h++;
}
if (empty($conf->global->PROJECT_DISABLE_TIMESHEET_PERWEEK))
{
$head[$h][0] = DOL_URL_ROOT."/projet/activity/perweek.php".($param ? '?'.$param : '');
@ -1141,7 +1149,7 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
if ($oldprojectforbreak != -1) $oldprojectforbreak = $projectstatic->id;
print '<tr class="oddeven">'."\n";
print '<tr class="oddeven" data-taskid="'.$lines[$i]->id.'">'."\n";
// User
/*
@ -1520,7 +1528,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
if ($oldprojectforbreak != -1) $oldprojectforbreak = $projectstatic->id;
print '<tr class="oddeven">'."\n";
print '<tr class="oddeven" data-taskid="'.$lines[$i]->id.'">'."\n";
// User
/*
@ -1704,6 +1712,271 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
return $totalforeachday;
}
/**
* Output a task line into a perday intput mode
*
* @param string $inc Line output identificator (start to 0, then increased by recursive call)
* @param int $firstdaytoshow First day to show
* @param User|null $fuser Restrict list to user if defined
* @param string $parent Id of parent task to show (0 to show all)
* @param Task[] $lines Array of lines (list of tasks but we will show only if we have a specific role on task)
* @param int $level Level (start to 0, then increased/decrease by recursive call)
* @param string $projectsrole Array of roles user has on project
* @param string $tasksrole Array of roles user has on task
* @param string $mine Show only task lines I am assigned to
* @param int $restricteditformytask 0=No restriction, 1=Enable add time only if task is a task i am affected to
* @param array $isavailable Array with data that say if user is available for several days for morning and afternoon
* @param int $oldprojectforbreak Old project id of last project break
* @param array $TWeek Array of week numbers
* @return array Array with time spent for $fuser for each day of week on tasks in $lines and substasks
*/
function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, &$isavailable, $oldprojectforbreak = 0, $TWeek = array())
{
global $conf, $db, $user, $bc, $langs;
global $form, $formother, $projectstatic, $taskstatic, $thirdpartystatic;
$numlines=count($lines);
$lastprojectid=0;
$workloadforid=array();
$totalforeachweek=array();
$lineswithoutlevel0=array();
// Create a smaller array with sublevels only to be used later. This increase dramatically performances.
if ($parent == 0) // Always and only if at first level
{
for ($i = 0 ; $i < $numlines ; $i++)
{
if ($lines[$i]->fk_task_parent) $lineswithoutlevel0[]=$lines[$i];
}
}
//dol_syslog('projectLinesPerWeek inc='.$inc.' firstdaytoshow='.$firstdaytoshow.' task parent id='.$parent.' level='.$level." count(lines)=".$numlines." count(lineswithoutlevel0)=".count($lineswithoutlevel0));
if (empty($oldprojectforbreak))
{
$oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)?0:-1); // 0 = start break, -1 = never break
}
for ($i = 0 ; $i < $numlines ; $i++)
{
if ($parent == 0) $level = 0;
if ($lines[$i]->fk_task_parent == $parent)
{
// If we want all or we have a role on task, we show it
if (empty($mine) || ! empty($tasksrole[$lines[$i]->id]))
{
//dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project);
// Break on a new project
if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid)
{
$lastprojectid=$lines[$i]->fk_project;
$projectstatic->id = $lines[$i]->fk_project;
}
//var_dump('--- '.$level.' '.$firstdaytoshow.' '.$fuser->id.' '.$projectstatic->id.' '.$workloadforid[$projectstatic->id]);
//var_dump($projectstatic->weekWorkLoadPerTask);
if (empty($workloadforid[$projectstatic->id]))
{
$projectstatic->loadTimeSpentMonth($firstdaytoshow, 0, $fuser->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week
$workloadforid[$projectstatic->id]=1;
}
//var_dump($projectstatic->weekWorkLoadPerTask);
//var_dump('--- '.$projectstatic->id.' '.$workloadforid[$projectstatic->id]);
$projectstatic->id=$lines[$i]->fk_project;
$projectstatic->ref=$lines[$i]->projectref;
$projectstatic->title=$lines[$i]->projectlabel;
$projectstatic->public=$lines[$i]->public;
$projectstatic->thirdparty_name=$lines[$i]->thirdparty_name;
$taskstatic->id=$lines[$i]->id;
$taskstatic->ref=($lines[$i]->ref?$lines[$i]->ref:$lines[$i]->id);
$taskstatic->label=$lines[$i]->label;
$taskstatic->date_start=$lines[$i]->date_start;
$taskstatic->date_end=$lines[$i]->date_end;
$thirdpartystatic->id=$lines[$i]->thirdparty_id;
$thirdpartystatic->name=$lines[$i]->thirdparty_name;
$thirdpartystatic->email=$lines[$i]->thirdparty_email;
if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id))
{
print '<tr class="oddeven trforbreak">'."\n";
print '<td colspan="'.(6+count($TWeek)).'">';
print $projectstatic->getNomUrl(1, '', 0, '<strong>'.$langs->transnoentitiesnoconv("YourRole").':</strong> '.$projectsrole[$lines[$i]->fk_project]);
if ($thirdpartystatic->id > 0) print ' - '.$thirdpartystatic->getNomUrl(1);
if ($projectstatic->title)
{
print ' - ';
print '<span class="secondary">'.$projectstatic->title.'</span>';
}
print '</td>';
print '</tr>';
}
if ($oldprojectforbreak != -1) $oldprojectforbreak = $projectstatic->id;
print '<tr class="oddeven" data-taskid="'.$lines[$i]->id.'">'."\n";
// User
/*
print '<td class="nowrap">';
print $fuser->getNomUrl(1, 'withproject', 'time');
print '</td>';
*/
// Project
/*print '<td class="nowrap">';
if ($oldprojectforbreak == -1) print $projectstatic->getNomUrl(1,'',0,$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]);
print "</td>";*/
// Thirdparty
/*print '<td class="tdoverflowmax100">';
if ($thirdpartystatic->id > 0) print $thirdpartystatic->getNomUrl(1, 'project');
print '</td>';*/
// Ref
print '<td class="nowrap">';
print '<!-- Task id = '.$lines[$i]->id.' -->';
for ($k = 0 ; $k < $level ; $k++) print "&nbsp;&nbsp;&nbsp;";
print $taskstatic->getNomUrl(1, 'withproject', 'time');
// Label task
print '<br>';
for ($k = 0 ; $k < $level ; $k++) print "&nbsp;&nbsp;&nbsp;";
//print $taskstatic->getNomUrl(0, 'withproject', 'time');
print $taskstatic->label;
//print "<br>";
//for ($k = 0 ; $k < $level ; $k++) print "&nbsp;&nbsp;&nbsp;";
//print get_date_range($lines[$i]->date_start,$lines[$i]->date_end,'',$langs,0);
print "</td>\n";
// Planned Workload
print '<td class="leftborder plannedworkload right">';
if ($lines[$i]->planned_workload) print convertSecondToTime($lines[$i]->planned_workload, 'allhourmin');
else print '--:--';
print '</td>';
// Progress declared %
print '<td class="right">';
print $formother->select_percent($lines[$i]->progress, $lines[$i]->id . 'progress');
print '</td>';
// Time spent by everybody
print '<td class="right">';
// $lines[$i]->duration is a denormalised field = summ of time spent by everybody for task. What we need is time consummed by user
if ($lines[$i]->duration)
{
print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$lines[$i]->id.'">';
print convertSecondToTime($lines[$i]->duration, 'allhourmin');
print '</a>';
}
else print '--:--';
print "</td>\n";
// Time spent by user
print '<td class="right">';
$tmptimespent=$taskstatic->getSummaryOfTimeSpent($fuser->id);
if ($tmptimespent['total_duration']) print convertSecondToTime($tmptimespent['total_duration'], 'allhourmin');
else print '--:--';
print "</td>\n";
$disabledproject=1;$disabledtask=1;
//print "x".$lines[$i]->fk_project;
//var_dump($lines[$i]);
//var_dump($projectsrole[$lines[$i]->fk_project]);
// If at least one role for project
if ($lines[$i]->public || ! empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer)
{
$disabledproject=0;
$disabledtask=0;
}
// If $restricteditformytask is on and I have no role on task, i disable edit
if ($restricteditformytask && empty($tasksrole[$lines[$i]->id]))
{
$disabledtask=1;
}
//var_dump($projectstatic->weekWorkLoadPerTask);
//TODO
// Fields to show current time
$tableCell=''; $modeinput='hours';
$TFirstDay = getFirstDayOfEachWeek($TWeek, date('Y', $firstdaytoshow));
$TFirstDay[reset($TWeek)] = 1;
foreach($TFirstDay as &$fday) {
$fday--;
}
foreach ($TWeek as $weekNb)
{
$weekWorkLoad = $projectstatic->monthWorkLoadPerTask[$weekNb][$lines[$i]->id];
$totalforeachweek[$weekNb]+=$weekWorkLoad;
$alreadyspent='';
if ($weekWorkLoad > 0) $alreadyspent=convertSecondToTime($weekWorkLoad, 'allhourmin');
$alttitle=$langs->trans("AddHereTimeSpentForWeek", $weekNb);
$tableCell ='<td align="center" class="hide">';
$placeholder='';
if ($alreadyspent)
{
$tableCell.='<span class="timesheetalreadyrecorded" title="texttoreplace"><input type="text" class="center smallpadd" size="2" disabled id="timespent['.$inc.']['.$weekNb.']" name="task['.$lines[$i]->id.']['.$weekNb.']" value="'.$alreadyspent.'"></span>';
//$placeholder=' placeholder="00:00"';
//$tableCell.='+';
}
$tableCell.='<input type="text" alt="'.($disabledtask?'':$alttitle).'" title="'.($disabledtask?'':$alttitle).'" '.($disabledtask?'disabled':$placeholder).' class="center smallpadd" size="2" id="timeadded['.$inc.']['.$TFirstDay[$weekNb].']" name="task['.$lines[$i]->id.']['.$TFirstDay[$weekNb].']" value="" cols="2" maxlength="5"';
$tableCell.=' onkeypress="return regexEvent(this,event,\'timeChar\')"';
$tableCell.=' onkeyup="updateTotal('.$weekNb.',\''.$modeinput.'\')"';
$tableCell.=' onblur="regexEvent(this,event,\''.$modeinput.'\'); updateTotal('.$weekNb.',\''.$modeinput.'\')" />';
$tableCell.='</td>';
print $tableCell;
}
// Warning
print '<td class="right">';
if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('', $langs->trans("UserIsNotContactOfProject"));
elseif ($disabledtask)
{
$titleassigntask = $langs->trans("AssignTaskToMe");
if ($fuser->id != $user->id) $titleassigntask = $langs->trans("AssignTaskToUser", '...');
print $form->textwithpicto('', $langs->trans("TaskIsNotAssignedToUser", $titleassigntask));
}
print '</td>';
print "</tr>\n";
}
// Call to show task with a lower level (task under the current task)
$inc++;
$level++;
if ($lines[$i]->id > 0)
{
//var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level);
//var_dump($totalforeachday);
$ret = projectLinesPerMonth($inc, $firstdaytoshow, $fuser, $lines[$i]->id, ($parent == 0 ? $lineswithoutlevel0 : $lines), $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $isavailable, $oldprojectforbreak, $TWeek);
//var_dump('ret with parent='.$lines[$i]->id.' level='.$level);
//var_dump($ret);
foreach($ret as $key => $val)
{
$totalforeachweek[$key]+=$val;
}
//var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level.' + subtasks');
//var_dump($totalforeachday);
}
$level--;
}
else
{
//$level--;
}
}
return $totalforeachweek;
}
/**
* Search in task lines with a particular parent if there is a task for a particular user (in taskrole)

View File

@ -171,7 +171,7 @@ function dol_verifyHash($chain, $hash, $type = '0')
* @param string $features Features to check (it must be module name. Examples: 'societe', 'contact', 'produit&service', 'produit|service', ...)
* @param int $objectid Object ID if we want to check a particular record (optional) is linked to a owned thirdparty (optional).
* @param string $tableandshare 'TableName&SharedElement' with Tablename is table where object is stored. SharedElement is an optional key to define where to check entity for multicompany modume. Param not used if objectid is null (optional).
* @param string $feature2 Feature to check, second level of permission (optional). Can be a 'or' check with 'level1|level2'.
* @param string $feature2 Feature to check, second level of permission (optional). Can be a 'or' check with 'sublevela|sublevelb'.
* @param string $dbt_keyfield Field name for socid foreign key if not fk_soc. Not used if objectid is null (optional)
* @param string $dbt_select Field name for select if not rowid. Not used if objectid is null (optional)
* @param int $isdraft 1=The object with id=$objectid is a draft

View File

@ -104,7 +104,7 @@ function checkLoginPassEntity($usertotest, $passwordtotest, $entitytotest, $auth
}
else
{
dol_syslog("Authentification ko - failed to load file '".$authfile."'", LOG_ERR);
dol_syslog("Authentication KO - failed to load file '".$authfile."'", LOG_ERR);
sleep(1);
// Load translation files required by the page
$langs->loadLangs(array('other', 'main', 'errors'));

View File

@ -110,7 +110,7 @@ function check_user_password_dolibarr($usertotest, $passwordtotest, $entitytotes
else
{
sleep(2); // Anti brut force protection
dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentification ko bad password for '".$usertotest."', cryptType=".$cryptType);
dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentication KO bad password for '".$usertotest."', cryptType=".$cryptType, LOG_NOTICE);
// Load translation files required by the page
$langs->loadLangs(array('main', 'errors'));
@ -129,7 +129,7 @@ function check_user_password_dolibarr($usertotest, $passwordtotest, $entitytotes
$ret = $mc->checkRight($obj->rowid, $entitytotest);
if ($ret < 0)
{
dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentification ko entity '" . $entitytotest . "' not allowed for user '" . $obj->rowid . "'");
dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentication KO entity '" . $entitytotest . "' not allowed for user '" . $obj->rowid . "'", LOG_NOTICE);
$login = ''; // force authentication failure
}
}
@ -137,7 +137,7 @@ function check_user_password_dolibarr($usertotest, $passwordtotest, $entitytotes
}
else
{
dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentification ko user not found for '".$usertotest."'");
dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentication KO user not found for '".$usertotest."'", LOG_NOTICE);
sleep(1);
// Load translation files required by the page
@ -148,7 +148,7 @@ function check_user_password_dolibarr($usertotest, $passwordtotest, $entitytotes
}
else
{
dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentification ko db error for '".$usertotest."' error=".$db->lasterror());
dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentication KO db error for '".$usertotest."' error=".$db->lasterror(), LOG_ERR);
sleep(1);
$_SESSION["dol_loginmesg"]=$db->lasterror();
}

View File

@ -52,7 +52,7 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest)
if (! function_exists("ldap_connect"))
{
dol_syslog("functions_ldap::check_user_password_ldap Authentification ko failed to connect to LDAP. LDAP functions are disabled on this PHP");
dol_syslog("functions_ldap::check_user_password_ldap Authentication KO failed to connect to LDAP. LDAP functions are disabled on this PHP", LOG_ERR);
sleep(1);
// Load translation files required by the page
@ -202,7 +202,7 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest)
$ret=$mc->checkRight($usertmp->id, $entitytotest);
if ($ret < 0)
{
dol_syslog("functions_ldap::check_user_password_ldap Authentification ko entity '".$entitytotest."' not allowed for user '".$usertmp->id."'");
dol_syslog("functions_ldap::check_user_password_ldap Authentication KO entity '".$entitytotest."' not allowed for user '".$usertmp->id."'", LOG_NOTICE);
$login=''; // force authentication failure
}
unset($usertmp);
@ -210,7 +210,7 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest)
}
if ($result == 1)
{
dol_syslog("functions_ldap::check_user_password_ldap Authentification ko bad user/password for '".$usertotest."'");
dol_syslog("functions_ldap::check_user_password_ldap Authentication KO bad user/password for '".$usertotest."'", LOG_NOTICE);
sleep(1);
// Load translation files required by the page
@ -229,7 +229,7 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest)
** 49 - Wrong password
** 53 - Account inactive (manually locked out by administrator)
*/
dol_syslog("functions_ldap::check_user_password_ldap Authentification ko failed to connect to LDAP for '".$usertotest."'");
dol_syslog("functions_ldap::check_user_password_ldap Authentication KO failed to connect to LDAP for '".$usertotest."'", LOG_NOTICE);
if (is_resource($ldap->connection)) // If connection ok but bind ko
{
$ldap->ldapErrorCode = ldap_errno($ldap->connection);

View File

@ -239,11 +239,20 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
!empty($user->rights->contrat->lire) ||
!empty($user->rights->ficheinter->lire)
),
'module'=>'propal|commande|supplier_order|contrat|ficheinter'
'module'=>'propal|commande|supplier_order|supplier_proposal|contrat|ficheinter'
);
$onlysupplierorder = ! empty($user->rights->fournisseur->commande->lire) &&
empty($user->rights->propal->lire) &&
empty($user->rights->commande->lire) &&
empty($user->rights->supplier_order->lire) &&
empty($user->rights->supplier_proposal->lire) &&
empty($user->rights->contrat->lire) &&
empty($user->rights->ficheinter->lire);
$menu_arr[] = array(
'name' => 'Commercial',
'link' => '/comm/index.php?mainmenu=commercial&amp;leftmenu=',
'link' => ($onlysupplierorder ? '/fourn/commande/index.php?mainmenu=commercial&amp;leftmenu=' : '/comm/index.php?mainmenu=commercial&amp;leftmenu='),
'title' => "Commercial",
'level' => 0,
'enabled' => $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal),

View File

@ -901,6 +901,8 @@ class pdf_crabe extends ModelePDFFactures
$i++;
}
return $tab3_top + $y + 3;
}
else
{

View File

@ -1029,6 +1029,8 @@ class pdf_sponge extends ModelePDFFactures
$i++;
}
return $tab3_top + $y + 3;
}
else
{

View File

@ -47,7 +47,7 @@ class modLabel extends DolibarrModules
$this->module_position = '75';
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i', '', get_class($this));
$this->description = "Gestion des etiquettes";
$this->description = "Management of stickers";
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
$this->version = 'development';
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
@ -77,17 +77,17 @@ class modLabel extends DolibarrModules
$this->rights_class = 'label';
$this->rights[1][0] = 601; // id de la permission
$this->rights[1][1] = 'Lire les etiquettes'; // libelle de la permission
$this->rights[1][1] = 'Read stickers';
$this->rights[1][3] = 1; // La permission est-elle une permission par defaut
$this->rights[1][4] = 'lire';
$this->rights[2][0] = 602; // id de la permission
$this->rights[2][1] = 'Creer/modifier les etiquettes'; // libelle de la permission
$this->rights[2][1] = 'Create/modify stickers';
$this->rights[2][3] = 0; // La permission est-elle une permission par defaut
$this->rights[2][4] = 'creer';
$this->rights[4][0] = 609; // id de la permission
$this->rights[4][1] = 'Supprimer les etiquettes'; // libelle de la permission
$this->rights[4][1] = 'Delete stickers';
$this->rights[4][3] = 0; // La permission est-elle une permission par defaut
$this->rights[4][4] = 'supprimer';
}

View File

@ -45,6 +45,7 @@ class modModuleBuilder extends DolibarrModules
// Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
// It is used to group modules in module setup page
$this->family = "technic";
$this->module_position = '90';
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i', '', get_class($this));
$this->description = "A RAD (Rapid Application Development) tool to help developers to build their own module.";
@ -82,6 +83,21 @@ class modModuleBuilder extends DolibarrModules
//------
$this->boxes = array();
// Permissions
//------------
$this->rights = array(); // Permission array used by this module
$this->rights_class = 'modulebuilder';
$r=0;
$r++;
$this->rights[$r][0] = 3301;
$this->rights[$r][1] = 'Generate new modules';
$this->rights[$r][2] = 'a';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'run';
// Main menu entries
//------------------
$this->menu = array();

View File

@ -348,6 +348,7 @@ class modStock extends DolibarrModules
$this->import_examplevalues_array[$r]=array(
'ps.fk_product'=>"PREF123456",'ps.fk_entrepot'=>"ALM001",'ps.reel'=>"10"
);
$this->import_updatekeys_array[$r]=array('ps.fk_product'=>'Product', 'ps.fk_entrepot'=>"Warehouse");
$this->import_run_sql_after_array[$r]=array( // Because we may change data that are denormalized, we must update dernormalized data after.
'UPDATE '.MAIN_DB_PREFIX.'product p SET p.stock= (SELECT SUM(ps.reel) FROM '.MAIN_DB_PREFIX.'product_stock ps WHERE ps.fk_product = p.rowid);'
);

View File

@ -370,7 +370,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
$dateinvoice = ($datefacture == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : '') : $datefacture);
$sql = 'SELECT s.nom as name, s.rowid as socid,';
$sql .= ' f.rowid, f.ref, f.ref_supplier, f.amount, f.total_ttc as total, f.fk_mode_reglement, f.fk_account';
$sql .= ' f.rowid, f.ref, f.ref_supplier, f.total_ttc as total, f.fk_mode_reglement, f.fk_account';
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user ";
$sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'facture_fourn as f';
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -821,7 +821,7 @@ if (empty($action) || $action == 'list')
$sql .= ' c.code as paiement_type, c.libelle as paiement_libelle,';
$sql .= ' ba.rowid as bid, ba.label,';
if (!$user->rights->societe->client->voir) $sql .= ' sc.fk_soc, sc.fk_user,';
$sql .= ' SUM(f.amount)';
$sql .= ' SUM(pf.amount)';
$sql .= ' FROM '.MAIN_DB_PREFIX.'paiementfourn AS p';
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn AS pf ON p.rowid=pf.fk_paiementfourn';
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'facture_fourn AS f ON f.rowid=pf.fk_facturefourn';
@ -1013,9 +1013,9 @@ if (empty($action) || $action == 'list')
// Amount
print '<td class="right">'.price($objp->pamount).'</td>';
if (!$i) $totalarray['nbfield']++;
$totalarray['pos'][7] = 'amount';
$totalarray['pos'][$totalarray['nbfield']] = 'amount';
$totalarray['val']['amount'] += $objp->pamount;
if (!$i) $totalarray['nbfield']++;
// Ref invoice
/*$invoicesupplierstatic->ref=$objp->ref_supplier;

View File

@ -72,7 +72,7 @@ if ($socid > 0)
print '<table class="noborder tagtable liste centpercent">';
$sql = "SELECT s.nom, s.rowid as socid, f.ref_supplier, f.amount, f.datef as df,";
$sql = "SELECT s.nom, s.rowid as socid, f.ref_supplier, f.datef as df,";
$sql .= " f.paye as paye, f.fk_statut as statut, f.rowid as facid,";
$sql .= " u.login, u.rowid as userid";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_fourn as f,".MAIN_DB_PREFIX."user as u";

View File

@ -6878,7 +6878,9 @@ class TCPDF {
}
// check if file exist and it is valid
if (!@TCPDF_STATIC::file_exists($file)) {
return false;
// DOL CHANGE If we keep this, the image is not visible on pages after the first one.
//var_dump($file.' '.(!@TCPDF_STATIC::file_exists($file)));
//return false;
}
if (($imsize = @getimagesize($file)) === FALSE) {
if (in_array($file, $this->imagekeys)) {
@ -7810,6 +7812,8 @@ class TCPDF {
'bufferlen',
'buffer',
'cached_files',
// @CHANGE DOL
// 'imagekeys',
'sign',
'signature_data',
'signature_max_length',

View File

@ -285,7 +285,7 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
DOL_URL_ROOT.'/don/list.php?leftmenu=donations'
);
// Translation lang files
$langfile=array(
$langfile = array(
"users",
"companies",
"prospects",
@ -359,89 +359,89 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
$dashboardlines = array();
// Do not include sections without management permission
require_once DOL_DOCUMENT_ROOT . '/core/class/workboardresponse.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/workboardresponse.class.php';
// Number of actions to do (late)
if (!empty($conf->agenda->enabled) && $user->rights->agenda->myactions->read) {
include_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php';
include_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
$board = new ActionComm($db);
$dashboardlines[$board->element] = $board->load_board($user);
}
// Number of project opened
if (!empty($conf->projet->enabled) && $user->rights->projet->lire) {
include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
$board = new Project($db);
$dashboardlines[$board->element] = $board->load_board($user);
}
// Number of tasks to do (late)
if (!empty($conf->projet->enabled) && empty($conf->global->PROJECT_HIDE_TASKS) && $user->rights->projet->lire) {
include_once DOL_DOCUMENT_ROOT . '/projet/class/task.class.php';
include_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
$board = new Task($db);
$dashboardlines[$board->element] = $board->load_board($user);
}
// Number of commercial proposals opened (expired)
if (!empty($conf->propal->enabled) && $user->rights->propale->lire) {
include_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php';
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
$board = new Propal($db);
$dashboardlines[$board->element . '_opened'] = $board->load_board($user, "opened");
$dashboardlines[$board->element.'_opened'] = $board->load_board($user, "opened");
// Number of commercial proposals CLOSED signed (billed)
$dashboardlines[$board->element . '_signed'] = $board->load_board($user, "signed");
$dashboardlines[$board->element.'_signed'] = $board->load_board($user, "signed");
}
// Number of commercial proposals opened (expired)
if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire) {
include_once DOL_DOCUMENT_ROOT . '/supplier_proposal/class/supplier_proposal.class.php';
include_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php';
$board = new SupplierProposal($db);
$dashboardlines[$board->element . '_opened'] = $board->load_board($user, "opened");
$dashboardlines[$board->element.'_opened'] = $board->load_board($user, "opened");
// Number of commercial proposals CLOSED signed (billed)
$dashboardlines[$board->element . '_signed'] = $board->load_board($user, "signed");
$dashboardlines[$board->element.'_signed'] = $board->load_board($user, "signed");
}
// Number of customer orders a deal
if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
include_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php';
include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
$board = new Commande($db);
$dashboardlines[$board->element] = $board->load_board($user);
}
// Number of suppliers orders a deal
if (!empty($conf->supplier_order->enabled) && $user->rights->fournisseur->commande->lire) {
include_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.commande.class.php';
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
$board = new CommandeFournisseur($db);
$dashboardlines[$board->element . '_opened'] = $board->load_board($user, "opened");
$dashboardlines[$board->element . '_awaiting'] = $board->load_board($user, 'awaiting');
$dashboardlines[$board->element.'_opened'] = $board->load_board($user, "opened");
$dashboardlines[$board->element.'_awaiting'] = $board->load_board($user, 'awaiting');
}
// Number of services enabled (delayed)
if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire) {
include_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php';
include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
$board = new Contrat($db);
$dashboardlines[$board->element . '_inactive'] = $board->load_board($user, "inactive");
$dashboardlines[$board->element.'_inactive'] = $board->load_board($user, "inactive");
// Number of active services (expired)
$dashboardlines[$board->element . '_active'] = $board->load_board($user, "active");
$dashboardlines[$board->element.'_active'] = $board->load_board($user, "active");
}
// Number of invoices customers (has paid)
if (!empty($conf->facture->enabled) && $user->rights->facture->lire) {
include_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$board = new Facture($db);
$dashboardlines[$board->element] = $board->load_board($user);
}
// Number of supplier invoices (has paid)
if (!empty($conf->supplier_invoice->enabled) && !empty($user->rights->fournisseur->facture->lire)) {
include_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
$board = new FactureFournisseur($db);
$dashboardlines[$board->element] = $board->load_board($user);
}
// Number of transactions to conciliate
if (!empty($conf->banque->enabled) && $user->rights->banque->lire && !$user->socid) {
include_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$board = new Account($db);
$nb = $board::countAccountToReconcile(); // Get nb of account to reconciliate
$nb = $board::countAccountToReconcile(); // Get nb of account to reconciliate
if ($nb > 0) {
$dashboardlines[$board->element] = $board->load_board($user);
}
@ -449,36 +449,36 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
// Number of cheque to send
if (!empty($conf->banque->enabled) && $user->rights->banque->lire && !$user->socid && empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT)) {
include_once DOL_DOCUMENT_ROOT . '/compta/paiement/cheque/class/remisecheque.class.php';
include_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php';
$board = new RemiseCheque($db);
$dashboardlines['RemiseCheque'] = $board->load_board($user);
}
// Number of foundation members
if (!empty($conf->adherent->enabled) && $user->rights->adherent->lire && !$user->socid) {
include_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$board = new Adherent($db);
$dashboardlines[$board->element . '_shift'] = $board->load_board($user, 'shift');
$dashboardlines[$board->element . '_expired'] = $board->load_board($user, 'expired');
$dashboardlines[$board->element.'_shift'] = $board->load_board($user, 'shift');
$dashboardlines[$board->element.'_expired'] = $board->load_board($user, 'expired');
}
// Number of expense reports to approve
if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->approve) {
include_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php';
include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
$board = new ExpenseReport($db);
$dashboardlines['ExpenseReport'] = $board->load_board($user, 'toapprove');
}
// Number of expense reports to pay
if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->to_paid) {
include_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php';
include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
$board = new ExpenseReport($db);
$dashboardlines['ExpenseReport'] = $board->load_board($user, 'topay');
}
// Number of holidays to approve
if (!empty($conf->holiday->enabled) && $user->rights->holiday->approve) {
include_once DOL_DOCUMENT_ROOT . '/holiday/class/holiday.class.php';
include_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
$board = new Holiday($db);
$dashboardlines['Holiday'] = $board->load_board($user);
}
@ -877,23 +877,23 @@ print '<div class="fichecenter fichecenterbis">';
* Show boxes
*/
$boxlist.='<div class="twocolumns">';
$boxlist .= '<div class="twocolumns">';
$boxlist.='<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
if(!empty($nbworkboardcount))
$boxlist .= '<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
if (!empty($nbworkboardcount))
{
$boxlist.=$boxwork;
$boxlist .= $boxwork;
}
$boxlist.=$resultboxes['boxlista'];
$boxlist .= $resultboxes['boxlista'];
$boxlist.= '</div>';
$boxlist .= '</div>';
if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
{
// Remove allready present info in new dash board
if(!empty($conf->global->MAIN_INCLUDE_GLOBAL_STATS_IN_OPENED_DASHBOARD) && is_array($boxstatItems) && count($boxstatItems) > 0){
if (!empty($conf->global->MAIN_INCLUDE_GLOBAL_STATS_IN_OPENED_DASHBOARD) && is_array($boxstatItems) && count($boxstatItems) > 0) {
foreach ($boxstatItems as $boxstatItemKey => $boxstatItemHtml) {
if (in_array($boxstatItemKey, $globalStatInTopOpenedDashBoard)) {
unset($boxstatItems[$boxstatItemKey]);

View File

@ -45,6 +45,8 @@ INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUE
INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 1, 'PCG99-BASE', 'The base accountancy french plan', 1);
-- Description of chart of account FR PCG14-DEV
INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 1, 'PCG14-DEV', 'The developed accountancy french plan 2014', 1);
-- Description of chart of account FR PCG18-ASSOC
INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 1, 'PCG18-ASSOC', 'French foundation chart of accounts 2018', 1);
-- Description of chart of account BE PCMN-BASE
INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 2, 'PCMN-BASE', 'The base accountancy belgium plan', 1);

View File

@ -28,6 +28,7 @@
-- ID 0 - 438
-- ID 1501 - 5999
-- ID 7000 - 7208
-- ADD 100000 to rowid # Do no remove this comment --
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1401,'PCG99-ABREGE','CAPIT', 'XXXXXX', '1', '0', 'Fonds propres, provisions pour risques et charges et dettes à plus d''un an', 1);
@ -1466,3 +1467,133 @@ INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 5964,'PCG14-DEV','INCOME','XXXXXX','791',5963,'Transferts de charges d''exploitation','1');
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 5965,'PCG14-DEV','INCOME','XXXXXX','796',5963,'Transferts de charges financières','1');
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 5966,'PCG14-DEV','INCOME','XXXXXX','797',5963,'Transferts de charges exceptionnelles','1');
--
-- Descriptif des plans comptables FR PCG18-ASSOC
--
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7201,'PCG18-ASSOC','CAPIT', 'CAPITAL', '1', '0', 'Fonds propres, emprunts et dettes assimilésFonds propres, provisions pour risques et charges et dettes à plus d''un an', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7202,'PCG18-ASSOC','IMMO', 'XXXXXX', '2', '0', 'Frais d''établissement. Actifs immobilisés et créances à plus d''un an', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7203,'PCG18-ASSOC','STOCK', 'XXXXXX', '3', '0', 'Stock et commandes en cours d''exécution', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7204,'PCG18-ASSOC','THIRDPARTY', 'XXXXXX', '4', '0', 'Créances et dettes à un an au plus', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7205,'PCG18-ASSOC','FINAN', 'XXXXXX', '5', '0', 'Placement de trésorerie et de valeurs disponibles', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7206,'PCG18-ASSOC','EXPENSE', 'XXXXXX', '6', '0', 'Charges', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7207,'PCG18-ASSOC','INCOME', 'XXXXXX', '7', '0', 'Produits', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7208,'PCG18-ASSOC','SPECIAL', 'XXXXXX', '8', '0', 'Comptes spéciaux', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7000,'PCG18-ASSOC','CAPIT', 'XXXXXX', '10', '7201', 'Fonds propres et réserves', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7001,'PCG18-ASSOC','CAPIT', 'XXXXXX', '102', '7000', 'Fonds propres sans droit de reprise', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7002,'PCG18-ASSOC','CAPIT', 'XXXXXX', '1021', '7001', 'Première situation nette établie', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7003,'PCG18-ASSOC','CAPIT', 'XXXXXX', '1022', '7001', 'Fonds statutaires (à subdiviser en fonction des statuts)', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7004,'PCG18-ASSOC','CAPIT', 'XXXXXX', '1023', '7001', 'Dotations non consomptibles', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7005,'PCG18-ASSOC','CAPIT', 'XXXXXX','10231', '7004', 'Dotations non consomptibles initiales', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7006,'PCG18-ASSOC','CAPIT', 'XXXXXX','10232', '7004', 'Dotations non consomptibles complémentaires', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7007,'PCG18-ASSOC','CAPIT', 'XXXXXX', '1024', '7001', 'Autres fonds propres sans droit de reprise', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7008,'PCG18-ASSOC','CAPIT', 'XXXXXX', '103', '7000', 'Fonds propres avec droit de reprise', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7009,'PCG18-ASSOC','CAPIT', 'XXXXXX', '1032', '7008', 'Fonds statutaires (à subdiviser en fonction des statuts)', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7010,'PCG18-ASSOC','CAPIT', 'XXXXXX', '1034', '7008', 'Autres fonds propres avec droit de reprise', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7011,'PCG18-ASSOC','CAPIT', 'XXXXXX', '105', '7000', 'Ecarts de réévaluation', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7012,'PCG18-ASSOC','CAPIT', 'XXXXXX', '1051', '7011', 'Ecarts de réévaluation sur des biens sans droit de reprise', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7013,'PCG18-ASSOC','CAPIT', 'XXXXXX', '1052', '7011', 'Ecarts de réévaluation sur des biens avec droit de reprise', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7014,'PCG18-ASSOC','CAPIT', 'XXXXXX', '106', '7000', 'Réserves', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7015,'PCG18-ASSOC','CAPIT', 'XXXXXX', '1068', '7014', 'Réserves pour projet de lentité', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7016,'PCG18-ASSOC','CAPIT', 'XXXXXX', '108', '7000', 'Dotations consomptibles', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7017,'PCG18-ASSOC','CAPIT', 'XXXXXX', '1081', '7016', 'Dotations consomptibles', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7018,'PCG18-ASSOC','CAPIT', 'XXXXXX', '1089', '7016', 'Dotations consomptibles inscrites au compte de résultat', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7019,'PCG18-ASSOC','CAPIT', 'XXXXXX', '15', '7201', 'Provisions', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7020,'PCG18-ASSOC','CAPIT', 'XXXXXX', '152', '7019', 'Provisions pour charges sur legs ou donations', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7021,'PCG18-ASSOC','CAPIT', 'XXXXXX', '16', '7201', 'Emprunts et dettes assimilées', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7022,'PCG18-ASSOC','CAPIT', 'XXXXXX', '163', '7021', 'Autres emprunts obligataires', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7023,'PCG18-ASSOC','CAPIT', 'XXXXXX', '1631', '7022', 'Titres associatifs et assimilés', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7024,'PCG18-ASSOC','CAPIT', 'XXXXXX', '19', '7201', 'Fonds dédiés ou reportés', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7025,'PCG18-ASSOC','CAPIT', 'XXXXXX', '191', '7024', 'Fonds reportés liés aux legs ou donations', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7026,'PCG18-ASSOC','CAPIT', 'XXXXXX', '1911', '7025', 'Legs ou donations', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7027,'PCG18-ASSOC','CAPIT', 'XXXXXX', '1912', '7025', 'Donations temporaires dusufruit', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7028,'PCG18-ASSOC','CAPIT', 'XXXXXX', '194', '7024', 'Fonds dédiés sur subventions dexploitation', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7029,'PCG18-ASSOC','CAPIT', 'XXXXXX', '195', '7024', 'Fonds dédiés sur contributions financières dautres organismes', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7030,'PCG18-ASSOC','CAPIT', 'XXXXXX', '196', '7024', 'Fonds dédiés sur ressources liées à la générosité du public', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7031,'PCG18-ASSOC', 'IMMO', 'XXXXXX', '20', '7202', 'Immobilisations incorporelles', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7032,'PCG18-ASSOC', 'IMMO', 'XXXXXX', '204', '7031', 'Donations temporaires dusufruit', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7033,'PCG18-ASSOC', 'IMMO', 'XXXXXX', '24', '7202', 'Biens reçus par legs ou donations destinés à être cédés', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7034,'PCG18-ASSOC', 'IMMO', 'XXXXXX', '27', '7202', 'Autres immobilisations financières', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7035,'PCG18-ASSOC', 'IMMO', 'XXXXXX', '2742', '7034', 'Prêts aux partenaires', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7036,'PCG18-ASSOC', 'IMMO', 'XXXXXX', '28', '7202', 'Amortissements des immobilisations', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7037,'PCG18-ASSOC', 'IMMO', 'XXXXXX', '280', '7036', 'Amortissements des immobilisations incorporelles', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7038,'PCG18-ASSOC', 'IMMO', 'XXXXXX', '2804', '7037', 'Donations temporaires dusufruit', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7039,'PCG18-ASSOC', 'IMMO', 'XXXXXX', '29', '7202', 'Dépréciations des immobilisations', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7040,'PCG18-ASSOC', 'IMMO', 'XXXXXX', '294', '7039', 'Dépréciationsdes biens reçus par legs ou donations destinés à être cédés', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7041,'PCG18-ASSOC','THIRDPARTY','CUSTOMER', '41', '7204', 'Clients, adhérents, usagers et comptes rattachés', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7042,'PCG18-ASSOC','THIRDPARTY', 'XXXXXX', '45', '7204', 'Confédération, fédération, union, entités affiliées', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7043,'PCG18-ASSOC','THIRDPARTY', 'XXXXXX', '455', '7042', 'Partenaires - comptes courants', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7044,'PCG18-ASSOC','THIRDPARTY', 'XXXXXX', '46', '7204', 'Débiteurs et créditeurs divers', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7045,'PCG18-ASSOC','THIRDPARTY', 'XXXXXX', '461', '7044', 'Créances reçues par legs ou donations', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7046,'PCG18-ASSOC','THIRDPARTY', 'XXXXXX', '466', '7044', 'Dettes des legs ou donations', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7047,'PCG18-ASSOC','THIRDPARTY', 'XXXXXX', '468', '7044', 'Divers charges à payer et produits à recevoir', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7048,'PCG18-ASSOC','THIRDPARTY', 'XXXXXX', '4681', '7047', 'Frais des bénévoles', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7049,'PCG18-ASSOC','EXPENSE', 'XXXXXX', '62', '7206', 'Autres services extérieurs', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7050,'PCG18-ASSOC','EXPENSE', 'XXXXXX', '622', '7049', 'Rémunérations dintermédiaires et honoraires', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7051,'PCG18-ASSOC','EXPENSE', 'XXXXXX', '6226', '7050', 'Honoraires', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7052,'PCG18-ASSOC','EXPENSE', 'XXXXXX','62264', '7051', 'Honoraires sur legs ou donations destinés à être cédés', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7053,'PCG18-ASSOC','EXPENSE', 'XXXXXX', '65', '7206', 'Autres charges de gestion courante', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7054,'PCG18-ASSOC','EXPENSE', 'XXXXXX', '653', '7053', 'Charges de la générosité du public', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7055,'PCG18-ASSOC','EXPENSE', 'XXXXXX', '6531', '7054', 'Autres charges sur legs ou donations', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7056,'PCG18-ASSOC','EXPENSE', 'XXXXXX', '657', '7053', 'Aides financières', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7057,'PCG18-ASSOC','EXPENSE', 'XXXXXX', '67', '7206', 'Charges exceptionnelles', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7058,'PCG18-ASSOC','EXPENSE', 'XXXXXX', '673', '7057', 'Apports ou affectations en numéraire', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7059,'PCG18-ASSOC','EXPENSE', 'XXXXXX', '675', '7057', 'Valeurs comptables des éléments dactifs cédés', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7060,'PCG18-ASSOC','EXPENSE', 'XXXXXX', '6754', '7059', 'Immobilisations reçues par legs ou donations', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7061,'PCG18-ASSOC','EXPENSE', 'XXXXXX', '68', '7206', 'Dotations aux amortissements, provisions et engagements', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7062,'PCG18-ASSOC','EXPENSE', 'XXXXXX', '6816', '7061', 'Dotations pour dépréciations des immobilisations incorporelles et corporelles', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7063,'PCG18-ASSOC','EXPENSE', 'XXXXXX','68164', '7062', 'Dotations pour dépréciation dactifs reçus par legs ou donations destinés à être cédés', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7064,'PCG18-ASSOC','EXPENSE', 'XXXXXX', '689', '7061', 'Reports en fonds dédiés', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7065,'PCG18-ASSOC','EXPENSE', 'XXXXXX', '6891', '7064', 'Reports en fonds reportés', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7066,'PCG18-ASSOC','EXPENSE', 'XXXXXX', '6894', '7064', 'Reports en fonds dédiés sur subventions dexploitation', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7067,'PCG18-ASSOC','EXPENSE', 'XXXXXX', '6895', '7064', 'Reports en fonds dédiés sur contributions financières dautres organismes', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7068,'PCG18-ASSOC','EXPENSE', 'XXXXXX', '6896', '7064', 'Reports en fonds dédiés sur ressources liées à la générosité du public', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7069,'PCG18-ASSOC','INCOME', 'XXXXXX', '70', '7207', 'Ventes de produits fabriqués, prestations de services, marchandises', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7070,'PCG18-ASSOC','INCOME', 'SERVICE', '706', '7069', 'Ventes de prestations de services', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7071,'PCG18-ASSOC','INCOME', 'SERVICE', '7063', '7070', 'Parrainages', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7072,'PCG18-ASSOC','INCOME', 'PRODUCT', '707', '7069', 'Ventes de marchandises', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7073,'PCG18-ASSOC','INCOME', 'PRODUCT', '7073', '7073', 'Ventes de dons en nature', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7074,'PCG18-ASSOC','INCOME', 'XXXXXX', '73', '7207', 'Concours publics', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7075,'PCG18-ASSOC','INCOME', 'XXXXXX', '75', '7207', 'Autres produits de gestion courante', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7076,'PCG18-ASSOC','INCOME', 'XXXXXX', '753', '7075', 'Versements des fondateurs ou consommation de la dotation', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7077,'PCG18-ASSOC','INCOME', 'XXXXXX', '7531', '7076', 'Versements des fondateurs', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7078,'PCG18-ASSOC','INCOME', 'XXXXXX', '7532', '7076', 'Quotes-parts de dotation consomptible virée au compte de résultat', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7079,'PCG18-ASSOC','INCOME', 'XXXXXX', '754', '7075', 'Ressources liées à la générosité du public', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7080,'PCG18-ASSOC','INCOME', 'XXXXXX', '7541', '7079', 'Dons manuels', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7081,'PCG18-ASSOC','INCOME', 'XXXXXX','75411', '7080', 'Dons manuels', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7082,'PCG18-ASSOC','INCOME', 'XXXXXX','75412', '7080', 'Abandons de frais par les bénévoles', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7083,'PCG18-ASSOC','INCOME', 'XXXXXX', '7542', '7079', 'Mécénats', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7084,'PCG18-ASSOC','INCOME', 'XXXXXX', '7543', '7079', 'Legs, donations et assurances-vie', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7085,'PCG18-ASSOC','INCOME', 'XXXXXX','75431', '7084', 'Assurances-vie', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7086,'PCG18-ASSOC','INCOME', 'XXXXXX','75432', '7084', 'Legs ou donations', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7087,'PCG18-ASSOC','INCOME', 'XXXXXX','75433', '7084', 'Autres produits sur legs ou donations', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7088,'PCG18-ASSOC','INCOME', 'XXXXXX', '755', '7075', 'Contributions financières', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7089,'PCG18-ASSOC','INCOME', 'XXXXXX', '7551', '7088', 'Contributions financières dautres organismes', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7090,'PCG18-ASSOC','INCOME', 'XXXXXX', '7552', '7088', 'Quotes-parts de générosité reçues', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7091,'PCG18-ASSOC','INCOME', 'XXXXXX', '756', '7075', 'Cotisations', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7092,'PCG18-ASSOC','INCOME', 'XXXXXX', '7561', '7091', 'Cotisations sans contrepartie', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7093,'PCG18-ASSOC','INCOME', 'XXXXXX', '7562', '7091', 'Cotisations avec contrepartie', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7094,'PCG18-ASSOC','INCOME', 'XXXXXX', '757', '7075', 'Gains de change sur créances et dettes dexploitation', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7095,'PCG18-ASSOC','INCOME', 'XXXXXX', '77', '7207', 'Produits exceptionnels', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7096,'PCG18-ASSOC','INCOME', 'XXXXXX', '775', '7095', 'Produits des cessions déléments dactifs', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7097,'PCG18-ASSOC','INCOME', 'XXXXXX', '7754', '7096', 'Immobilisations reçues en legs ou donations destinées à être cédées', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7098,'PCG18-ASSOC','INCOME', 'XXXXXX', '78', '7207', 'Reprises sur amortissements, dépréciations et provisions', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7099,'PCG18-ASSOC','INCOME', 'XXXXXX', '781', '7098', 'Reprises sur amortissements des immobilisations dépréciations et provisions (à inscrire dans les produits dexploitation)', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7100,'PCG18-ASSOC','INCOME', 'XXXXXX', '7816', '7099', 'Reprises sur dépréciations des immobilisations incorporelles et corporelles', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7101,'PCG18-ASSOC','INCOME', 'XXXXXX','78164', '7100', 'Reprises sur dépréciations dactifs reçus par legs ou donations destinés à être cédés', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7102,'PCG18-ASSOC','INCOME', 'XXXXXX', '789', '7098', 'Utilisations de fonds reportés et de fonds dédiés', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7103,'PCG18-ASSOC','INCOME', 'XXXXXX', '7891', '7102', 'Utilisations de fonds reportés', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7104,'PCG18-ASSOC','INCOME', 'XXXXXX', '7894', '7102', 'Utilisations des fonds dédiés sur subventions dexploitation', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7105,'PCG18-ASSOC','INCOME', 'XXXXXX', '7895', '7102', 'Utilisations des fonds dédiés sur contributions financières dautres organismes', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7106,'PCG18-ASSOC','INCOME', 'XXXXXX', '7896', '7102', 'Utilisations des fonds dédiés sur ressources liées à la générosité du public', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7107,'PCG18-ASSOC','INCOME', 'XXXXXX', '86', '7208', 'Emplois des contributions volontaires en nature', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7108,'PCG18-ASSOC','INCOME', 'XXXXXX', '860', '7107', 'Secours en nature', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7109,'PCG18-ASSOC','INCOME', 'XXXXXX', '861', '7107', 'Mises à disposition gratuite de biens', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7110,'PCG18-ASSOC','INCOME', 'XXXXXX', '862', '7107', 'Prestations', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7111,'PCG18-ASSOC','INCOME', 'XXXXXX', '864', '7107', 'Personnel bénévole', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7112,'PCG18-ASSOC','INCOME', 'XXXXXX', '87', '7208', 'Contributions volontaires en nature', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7113,'PCG18-ASSOC','INCOME', 'XXXXXX', '870', '7112', 'Dons en nature', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7114,'PCG18-ASSOC','INCOME', 'XXXXXX', '871', '7112', 'Prestations en nature', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7115,'PCG18-ASSOC','INCOME', 'XXXXXX', '875', '7112', 'Bénévolat', 1);

View File

@ -206,7 +206,9 @@ ALTER TABLE llx_societe_contacts ADD CONSTRAINT fk_societe_contacts_fk_c_type_co
ALTER TABLE llx_societe_contacts ADD CONSTRAINT fk_societe_contacts_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe(rowid);
ALTER TABLE llx_societe_contacts ADD CONSTRAINT fk_societe_contacts_fk_socpeople FOREIGN KEY (fk_socpeople) REFERENCES llx_socpeople(rowid);
ALTER TABLE llx_accounting_account MODIFY COLUMN rowid bigint AUTO_INCREMENT;
-- VMYSQL4.3 ALTER TABLE llx_accounting_account MODIFY COLUMN rowid bigint AUTO_INCREMENT;
-- VPGSQL8.2 ALTER TABLE llx_accounting_account MODIFY COLUMN rowid bigint;
ALTER TABLE llx_supplier_proposaldet ADD COLUMN date_start datetime DEFAULT NULL;

View File

@ -129,3 +129,4 @@ UPDATE llx_c_forme_juridique set libelle = 'SRL - Société à responsabilité l
ALTER TABLE llx_c_country ADD COLUMN eec integer;
UPDATE llx_c_country SET eec = 1 WHERE code IN ('AT','BE','BG','CY','CZ','DE','DK','EE','ES','FI','FR','GB','GR','HR','NL','HU','IE','IM','IT','LT','LU','LV','MC','MT','PL','PT','RO','SE','SK','SI','UK');
INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 1, 'PCG18-ASSOC', 'French foundation chart of accounts 2018', 1);

View File

@ -34,7 +34,6 @@ create table llx_facture
ref_client varchar(255), -- reference for customer
type smallint DEFAULT 0 NOT NULL, -- type of invoice
increment varchar(10),
fk_soc integer NOT NULL,
datec datetime, -- date de creation de la facture
datef date, -- date invoice
@ -43,7 +42,7 @@ create table llx_facture
tms timestamp, -- date creation/modification
date_closing datetime, -- date de cloture
paye smallint DEFAULT 0 NOT NULL,
amount double(24,8) DEFAULT 0 NOT NULL,
--amount double(24,8) DEFAULT 0 NOT NULL,
remise_percent real DEFAULT 0, -- remise relative
remise_absolue real DEFAULT 0, -- remise absolue
remise real DEFAULT 0, -- remise totale calculee
@ -70,6 +69,7 @@ create table llx_facture
fk_fac_rec_source integer, -- facture rec source
fk_facture_source integer, -- facture origin if credit notes or replacement invoice
fk_projet integer DEFAULT NULL, -- project invoice is linked to
increment varchar(10), -- Numero of generation if generated from recurring template invoice
fk_account integer, -- bank account
fk_currency varchar(3), -- currency code

View File

@ -4978,16 +4978,16 @@ function migrate_users_socialnetworks()
$db->begin();
print '<tr><td colspan="4">';
$sql = 'SELECT rowid, socialnetworks';
$sql .= ', skype, twitter, facebook, linkedin, instagram, snapchat, googleplus, youtube, whatsapp FROM '.MAIN_DB_PREFIX.'user WHERE ';
$sql .= ' skype IS NOT NULL OR skype !=""';
$sql .= ' OR twitter IS NOT NULL OR twitter !=""';
$sql .= ' OR facebook IS NOT NULL OR facebook!=""';
$sql .= ' OR linkedin IS NOT NULL OR linkedin!=""';
$sql .= ' OR instagram IS NOT NULL OR instagram!=""';
$sql .= ' OR snapchat IS NOT NULL OR snapchat!=""';
$sql .= ' OR googleplus IS NOT NULL OR googleplus!=""';
$sql .= ' OR youtube IS NOT NULL OR youtube!=""';
$sql .= ' OR whatsapp IS NOT NULL OR whatsapp!=""';
$sql .= ', skype, twitter, facebook, linkedin, instagram, snapchat, googleplus, youtube, whatsapp FROM '.MAIN_DB_PREFIX.'user WHERE';
$sql .= " skype IS NOT NULL OR skype <> ''";
$sql .= " OR twitter IS NOT NULL OR twitter <> ''";
$sql .= " OR facebook IS NOT NULL OR facebook <> ''";
$sql .= " OR linkedin IS NOT NULL OR linkedin <> ''";
$sql .= " OR instagram IS NOT NULL OR instagram <> ''";
$sql .= " OR snapchat IS NOT NULL OR snapchat <> ''";
$sql .= " OR googleplus IS NOT NULL OR googleplus <> ''";
$sql .= " OR youtube IS NOT NULL OR youtube <> ''";
$sql .= " OR whatsapp IS NOT NULL OR whatsapp <> ''";
//print $sql;
$resql = $db->query($sql);
if ($resql) {

View File

@ -545,6 +545,8 @@ Module58Name=ClickToDial
Module58Desc=Integration of a ClickToDial system (Asterisk, ...)
Module59Name=Bookmark4u
Module59Desc=Add function to generate Bookmark4u account from a Dolibarr account
Module60Name=Stickers
Module60Desc=Management of stickers
Module70Name=Interventions
Module70Desc=Intervention management
Module75Name=Expense and trip notes

View File

@ -37,7 +37,7 @@ FormatedExportDesc3=When data to export are selected, you can choose the format
Sheet=Sheet
NoImportableData=No importable data (no module with definitions to allow data imports)
FileSuccessfullyBuilt=File generated
SQLUsedForExport=SQL Request used to build export file
SQLUsedForExport=SQL Request used to extract data
LineId=Id of line
LineLabel=Label of line
LineDescription=Description of line

View File

@ -1015,4 +1015,8 @@ ContactAddedAutomatically=Contact added from contact thirdparty roles
More=More
ShowDetails=Show details
CustomReports=Custom reports
SelectYourGraphOptionsFirst=Select your graph options to build a graph
StatisticsOn=Statistics on
SelectYourGraphOptionsFirst=Select your graph options to build a graph
Measures=Measures
XAxis=X-Axis
YAxis=Y-Axis

View File

@ -69,6 +69,7 @@ NewTask=New task
AddTask=Create task
AddTimeSpent=Create time spent
AddHereTimeSpentForDay=Add here time spent for this day/task
AddHereTimeSpentForWeek=Add here time spent for this week/task
Activity=Activity
Activities=Tasks/activities
MyActivities=My tasks/activities
@ -187,6 +188,7 @@ ProjectMustBeValidatedFirst=Project must be validated first
FirstAddRessourceToAllocateTime=Assign a user resource to task to allocate time
InputPerDay=Input per day
InputPerWeek=Input per week
InputPerMonth=Input per month
InputDetail=Input detail
TimeAlreadyRecorded=This is time spent already recorded for this task/day and user %s
ProjectsWithThisUserAsContact=Projects with this user as contact

View File

@ -69,6 +69,7 @@ NewTask=Nouvelle tâche
AddTask=Créer tâche
AddTimeSpent=Saisir temps consommé
AddHereTimeSpentForDay=Ajoutez ici le temps passé pour cette journée/tâche
AddHereTimeSpentForWeek=Ajoutez ici le temps passé pour cette semaine/tâche
Activity=Activité
Activities=Tâches/activités
MyActivities=Mes tâches/activités
@ -187,6 +188,7 @@ ProjectMustBeValidatedFirst=Le projet doit être validé d'abord
FirstAddRessourceToAllocateTime=Affecter un utilisateur pour saisir des temps
InputPerDay=Saisie par jour
InputPerWeek=Saisie par semaine
InputPerMonth=Saisie par mois
InputDetail=Saisir le détail
TimeAlreadyRecorded=C'est le temps passé déjà enregistré pour cette tâche/jour et pour l'utilisateur %s
ProjectsWithThisUserAsContact=Projets avec cet utilisateur comme contact

View File

@ -556,7 +556,7 @@ class Loan extends CommonObject
$table = 'payment_loan';
$field = 'fk_loan';
$sql = 'SELECT sum(amount) as amount';
$sql = 'SELECT sum(amount_capital) as amount';
$sql .= ' FROM '.MAIN_DB_PREFIX.$table;
$sql .= ' WHERE '.$field.' = '.$this->id;

View File

@ -957,7 +957,7 @@ if (!defined('NOLOGIN'))
{
// If not active, we refuse the user
$langs->load("other");
dol_syslog("Authentification ko as login is disabled");
dol_syslog("Authentication KO as login is disabled", LOG_NOTICE);
accessforbidden($langs->trans("ErrorLoginDisabled"));
exit;
}
@ -2553,72 +2553,80 @@ if (!function_exists("llxFooter"))
// Add code for the asynchronous anonymous first ping (for telemetry)
// You can use &forceping=1 in parameters to force the ping if the ping was already sent.
if (($_SERVER["PHP_SELF"] == DOL_URL_ROOT.'/index.php') || GETPOST('forceping', 'alpha'))
$forceping = GETPOST('forceping', 'alpha');
if (($_SERVER["PHP_SELF"] == DOL_URL_ROOT.'/index.php') || $forceping)
{
//print '<!-- instance_unique_id='.$conf->file->instance_unique_id.' MAIN_FIRST_PING_OK_ID='.$conf->global->MAIN_FIRST_PING_OK_ID.' -->';
$hash_unique_id = md5('dolibarr'.$conf->file->instance_unique_id);
if (empty($conf->global->MAIN_FIRST_PING_OK_DATE)
|| (!empty($conf->file->instance_unique_id) && ($hash_unique_id != $conf->global->MAIN_FIRST_PING_OK_ID) && ($conf->global->MAIN_FIRST_PING_OK_ID != 'disabled'))
|| GETPOST('forceping', 'alpha'))
|| $forceping)
{
if (strpos('alpha', DOL_VERSION) > 0) {
// No ping done if we are into an alpha version
if (strpos('alpha', DOL_VERSION) > 0 && ! $forceping) {
print "\n<!-- NO JS CODE TO ENABLE the anonymous Ping. It is an alpha version -->\n";
}
elseif (empty($_COOKIE['DOLINSTALLNOPING_'.$hash_unique_id])) // Cookie is set when we uncheck the checkbox in the installation wizard.
elseif (empty($_COOKIE['DOLINSTALLNOPING_'.$hash_unique_id]) || $forceping) // Cookie is set when we uncheck the checkbox in the installation wizard.
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
// MAIN_LAST_PING_KO_DATE
// Disable ping if MAIN_LAST_PING_KO_DATE is set and is recent
if (! empty($conf->global->MAIN_LAST_PING_KO_DATE) && substr($conf->global->MAIN_LAST_PING_KO_DATE, 0, 6) == dol_print_date(dol_now(), '%Y%m') && ! $forceping) {
print "\n<!-- NO JS CODE TO ENABLE the anonymous Ping. An error already occured this month, we will try later. -->\n";
} else {
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
print "\n".'<!-- Includes JS for Ping of Dolibarr MAIN_FIRST_PING_OK_DATE = '.$conf->global->MAIN_FIRST_PING_OK_DATE.' MAIN_FIRST_PING_OK_ID = '.$conf->global->MAIN_FIRST_PING_OK_ID.' -->'."\n";
print "\n<!-- JS CODE TO ENABLE the anonymous Ping -->\n";
$url_for_ping = (empty($conf->global->MAIN_URL_FOR_PING) ? "https://ping.dolibarr.org/" : $conf->global->MAIN_URL_FOR_PING);
// Try to guess the distrib used
$distrib = 'standard';
if ($_SERVER["SERVER_ADMIN"] == 'doliwamp@localhost') $distrib = 'doliwamp';
if (! empty($dolibarr_distrib)) $distrib = $dolibarr_distrib;
?>
<script>
jQuery(document).ready(function (tmp) {
$.ajax({
method: "POST",
url: "<?php echo $url_for_ping ?>",
timeout: 500, // timeout milliseconds
cache: false,
data: {
hash_algo: "md5",
hash_unique_id: "<?php echo dol_escape_js($hash_unique_id); ?>",
action: "dolibarrping",
version: "<?php echo (float) DOL_VERSION; ?>",
entity: "<?php echo (int) $conf->entity; ?>",
dbtype: "<?php echo dol_escape_js($db->type); ?>",
country_code: "<?php echo dol_escape_js($mysoc->country_code); ?>",
php_version: "<?php echo phpversion(); ?>",
os_version: "<?php echo version_os('smr'); ?>",
distrib: "<?php echo $distrib ? $distrib : 'unknown'; ?>"
},
success: function (data, status, xhr) { // success callback function (data contains body of response)
console.log("Ping ok");
$.ajax({
method: "GET",
url: "<?php echo DOL_URL_ROOT.'/core/ajax/pingresult.php'; ?>",
timeout: 500, // timeout milliseconds
cache: false,
data: { hash_algo: "md5", hash_unique_id: "<?php echo dol_escape_js($hash_unique_id); ?>", action: "firstpingok" }, // to update
});
},
error: function (data,status,xhr) { // error callback function
console.log("Ping ko: " + data);
$.ajax({
method: "GET",
url: "<?php echo DOL_URL_ROOT.'/core/ajax/pingresult.php'; ?>",
timeout: 500, // timeout milliseconds
cache: false,
data: { hash_algo: "md5", hash_unique_id: "<?php echo dol_escape_js($hash_unique_id); ?>", action: "firstpingko" },
});
}
});
});
</script>
<?php
print "\n".'<!-- Includes JS for Ping of Dolibarr forceping='.$forceping.' MAIN_FIRST_PING_OK_DATE='.$conf->global->MAIN_FIRST_PING_OK_DATE.' MAIN_FIRST_PING_OK_ID='.$conf->global->MAIN_FIRST_PING_OK_ID.' MAIN_LAST_PING_KO_DATE='.$conf->global->MAIN_LAST_PING_KO_DATE.' -->'."\n";
print "\n<!-- JS CODE TO ENABLE the anonymous Ping -->\n";
$url_for_ping = (empty($conf->global->MAIN_URL_FOR_PING) ? "https://ping.dolibarr.org/" : $conf->global->MAIN_URL_FOR_PING);
// Try to guess the distrib used
$distrib = 'standard';
if ($_SERVER["SERVER_ADMIN"] == 'doliwamp@localhost') $distrib = 'doliwamp';
if (! empty($dolibarr_distrib)) $distrib = $dolibarr_distrib;
?>
<script>
jQuery(document).ready(function (tmp) {
$.ajax({
method: "POST",
url: "<?php echo $url_for_ping ?>",
timeout: 500, // timeout milliseconds
cache: false,
data: {
hash_algo: "md5",
hash_unique_id: "<?php echo dol_escape_js($hash_unique_id); ?>",
action: "dolibarrping",
version: "<?php echo (float) DOL_VERSION; ?>",
entity: "<?php echo (int) $conf->entity; ?>",
dbtype: "<?php echo dol_escape_js($db->type); ?>",
country_code: "<?php echo dol_escape_js($mysoc->country_code); ?>",
php_version: "<?php echo phpversion(); ?>",
os_version: "<?php echo version_os('smr'); ?>",
distrib: "<?php echo $distrib ? $distrib : 'unknown'; ?>"
},
success: function (data, status, xhr) { // success callback function (data contains body of response)
console.log("Ping ok");
$.ajax({
method: "GET",
url: "<?php echo DOL_URL_ROOT.'/core/ajax/pingresult.php'; ?>",
timeout: 500, // timeout milliseconds
cache: false,
data: { hash_algo: "md5", hash_unique_id: "<?php echo dol_escape_js($hash_unique_id); ?>", action: "firstpingok" }, // to update
});
},
error: function (data,status,xhr) { // error callback function
console.log("Ping ko: " + data);
$.ajax({
method: "GET",
url: "<?php echo DOL_URL_ROOT.'/core/ajax/pingresult.php'; ?>",
timeout: 500, // timeout milliseconds
cache: false,
data: { hash_algo: "md5", hash_unique_id: "<?php echo dol_escape_js($hash_unique_id); ?>", action: "firstpingko" },
});
}
});
});
</script>
<?php
}
}
else
{

View File

@ -90,6 +90,9 @@ if (empty($newmask)) // This should no happen
$newmask = '0664';
}
$result = restrictedArea($user, 'modulebuilder', null);
/*
* Actions

View File

@ -67,7 +67,7 @@ class MyObject extends CommonObject
* 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password')
* Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)"
* 'label' the translation key.
* 'enabled' is a condition when the field must be managed.
* 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM)
* 'position' is the sort order of field.
* 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
* 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing)

View File

@ -40,7 +40,7 @@ if ($type == '' && !$user->rights->service->lire) $type = '0'; // Force global p
// Security check
if ($type == '0') $result = restrictedArea($user, 'produit');
elseif ($type == '1') $result = restrictedArea($user, 'service');
else $result = restrictedArea($user, 'produit|service');
else $result = restrictedArea($user, 'produit|service|expedition');
// Load translation files required by the page
$langs->loadLangs(array('products', 'stocks'));
@ -117,77 +117,80 @@ if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is useles
/*
* Number of products and/or services
*/
$prodser = array();
$prodser[0][0] = $prodser[0][1] = $prodser[0][2] = $prodser[0][3] = 0;
$prodser[1][0] = $prodser[1][1] = $prodser[1][2] = $prodser[1][3] = 0;
$sql = "SELECT COUNT(p.rowid) as total, p.fk_product_type, p.tosell, p.tobuy";
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
$sql .= ' WHERE p.entity IN ('.getEntity($product_static->element, 1).')';
// Add where from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= " GROUP BY p.fk_product_type, p.tosell, p.tobuy";
$result = $db->query($sql);
while ($objp = $db->fetch_object($result))
if ((!empty($conf->product->enabled) || !empty($conf->service->enabled)) && ($user->rights->produit->lire || $user->rights->service->lire))
{
$status = 3; // On sale + On purchase
if (!$objp->tosell && !$objp->tobuy) $status = 0; // Not on sale, not on purchase
if ($objp->tosell && !$objp->tobuy) $status = 1; // On sale only
if (!$objp->tosell && $objp->tobuy) $status = 2; // On purchase only
$prodser[$objp->fk_product_type][$status] = $objp->total;
if ($objp->tosell) $prodser[$objp->fk_product_type]['sell'] += $objp->total;
if ($objp->tobuy) $prodser[$objp->fk_product_type]['buy'] += $objp->total;
if (!$objp->tosell && !$objp->tobuy) $prodser[$objp->fk_product_type]['none'] += $objp->total;
}
$prodser = array();
$prodser[0][0] = $prodser[0][1] = $prodser[0][2] = $prodser[0][3] = 0;
$prodser[1][0] = $prodser[1][1] = $prodser[1][2] = $prodser[1][3] = 0;
if ($conf->use_javascript_ajax)
{
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").'</th></tr>';
print '<tr><td class="center" colspan="2">';
$SommeA = $prodser[0]['sell'];
$SommeB = $prodser[0]['buy'];
$SommeC = $prodser[0]['none'];
$SommeD = $prodser[1]['sell'];
$SommeE = $prodser[1]['buy'];
$SommeF = $prodser[1]['none'];
$total = 0;
$dataval = array();
$datalabels = array();
$i = 0;
$total = $SommeA + $SommeB + $SommeC + $SommeD + $SommeE + $SommeF;
$dataseries = array();
if (!empty($conf->product->enabled))
$sql = "SELECT COUNT(p.rowid) as total, p.fk_product_type, p.tosell, p.tobuy";
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
$sql .= ' WHERE p.entity IN ('.getEntity($product_static->element, 1).')';
// Add where from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= " GROUP BY p.fk_product_type, p.tosell, p.tobuy";
$result = $db->query($sql);
while ($objp = $db->fetch_object($result))
{
$dataseries[] = array($langs->trans("ProductsOnSale"), round($SommeA));
$dataseries[] = array($langs->trans("ProductsOnPurchase"), round($SommeB));
$dataseries[] = array($langs->trans("ProductsNotOnSell"), round($SommeC));
}
if (!empty($conf->service->enabled))
{
$dataseries[] = array($langs->trans("ServicesOnSale"), round($SommeD));
$dataseries[] = array($langs->trans("ServicesOnPurchase"), round($SommeE));
$dataseries[] = array($langs->trans("ServicesNotOnSell"), round($SommeF));
$status = 3; // On sale + On purchase
if (!$objp->tosell && !$objp->tobuy) $status = 0; // Not on sale, not on purchase
if ($objp->tosell && !$objp->tobuy) $status = 1; // On sale only
if (!$objp->tosell && $objp->tobuy) $status = 2; // On purchase only
$prodser[$objp->fk_product_type][$status] = $objp->total;
if ($objp->tosell) $prodser[$objp->fk_product_type]['sell'] += $objp->total;
if ($objp->tobuy) $prodser[$objp->fk_product_type]['buy'] += $objp->total;
if (!$objp->tosell && !$objp->tobuy) $prodser[$objp->fk_product_type]['none'] += $objp->total;
}
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
$dolgraph = new DolGraph();
$dolgraph->SetData($dataseries);
$dolgraph->setShowLegend(1);
$dolgraph->setShowPercent(0);
$dolgraph->SetType(array('pie'));
$dolgraph->setWidth('100%');
$dolgraph->draw('idgraphstatus');
print $dolgraph->show($total ? 0 : 1);
if ($conf->use_javascript_ajax)
{
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").'</th></tr>';
print '<tr><td class="center" colspan="2">';
print '</td></tr>';
print '</table>';
print '</div>';
$SommeA = $prodser[0]['sell'];
$SommeB = $prodser[0]['buy'];
$SommeC = $prodser[0]['none'];
$SommeD = $prodser[1]['sell'];
$SommeE = $prodser[1]['buy'];
$SommeF = $prodser[1]['none'];
$total = 0;
$dataval = array();
$datalabels = array();
$i = 0;
$total = $SommeA + $SommeB + $SommeC + $SommeD + $SommeE + $SommeF;
$dataseries = array();
if (!empty($conf->product->enabled))
{
$dataseries[] = array($langs->trans("ProductsOnSale"), round($SommeA));
$dataseries[] = array($langs->trans("ProductsOnPurchase"), round($SommeB));
$dataseries[] = array($langs->trans("ProductsNotOnSell"), round($SommeC));
}
if (!empty($conf->service->enabled))
{
$dataseries[] = array($langs->trans("ServicesOnSale"), round($SommeD));
$dataseries[] = array($langs->trans("ServicesOnPurchase"), round($SommeE));
$dataseries[] = array($langs->trans("ServicesNotOnSell"), round($SommeF));
}
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
$dolgraph = new DolGraph();
$dolgraph->SetData($dataseries);
$dolgraph->setShowLegend(1);
$dolgraph->setShowPercent(0);
$dolgraph->SetType(array('pie'));
$dolgraph->setWidth('100%');
$dolgraph->draw('idgraphstatus');
print $dolgraph->show($total ? 0 : 1);
print '</td></tr>';
print '</table>';
print '</div>';
}
}
@ -270,120 +273,123 @@ print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
/*
* Latest modified products
*/
$max = 15;
$sql = "SELECT p.rowid, p.label, p.price, p.ref, p.fk_product_type, p.tosell, p.tobuy, p.tobatch, p.fk_price_expression,";
$sql .= " p.entity,";
$sql .= " p.tms as datem";
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
$sql .= " WHERE p.entity IN (".getEntity($product_static->element, 1).")";
if ($type != '') $sql .= " AND p.fk_product_type = ".$type;
// Add where from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= $db->order("p.tms", "DESC");
$sql .= $db->plimit($max, 0);
//print $sql;
$result = $db->query($sql);
if ($result)
if ((!empty($conf->product->enabled) || !empty($conf->service->enabled)) && ($user->rights->produit->lire || $user->rights->service->lire))
{
$num = $db->num_rows($result);
$max = 15;
$sql = "SELECT p.rowid, p.label, p.price, p.ref, p.fk_product_type, p.tosell, p.tobuy, p.tobatch, p.fk_price_expression,";
$sql .= " p.entity,";
$sql .= " p.tms as datem";
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
$sql .= " WHERE p.entity IN (".getEntity($product_static->element, 1).")";
if ($type != '') $sql .= " AND p.fk_product_type = ".$type;
// Add where from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= $db->order("p.tms", "DESC");
$sql .= $db->plimit($max, 0);
$i = 0;
if ($num > 0)
//print $sql;
$result = $db->query($sql);
if ($result)
{
$transRecordedType = $langs->trans("LastModifiedProductsAndServices", $max);
if (isset($_GET["type"]) && $_GET["type"] == 0) $transRecordedType = $langs->trans("LastRecordedProducts", $max);
if (isset($_GET["type"]) && $_GET["type"] == 1) $transRecordedType = $langs->trans("LastRecordedServices", $max);
$num = $db->num_rows($result);
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
$i = 0;
$colnb = 2;
if (empty($conf->global->PRODUIT_MULTIPRICES)) $colnb++;
print '<tr class="liste_titre"><th colspan="'.$colnb.'">'.$transRecordedType.'</th>';
print '<th class="right" colspan="3"><a href="'.DOL_URL_ROOT.'/product/list.php?sortfield=p.tms&sortorder=DESC">'.$langs->trans("FullList").'</td>';
print '</tr>';
while ($i < $num)
if ($num > 0)
{
$objp = $db->fetch_object($result);
$transRecordedType = $langs->trans("LastModifiedProductsAndServices", $max);
if (isset($_GET["type"]) && $_GET["type"] == 0) $transRecordedType = $langs->trans("LastRecordedProducts", $max);
if (isset($_GET["type"]) && $_GET["type"] == 1) $transRecordedType = $langs->trans("LastRecordedServices", $max);
$product_static->id = $objp->rowid;
$product_static->ref = $objp->ref;
$product_static->label = $objp->label;
$product_static->type = $objp->fk_product_type;
$product_static->entity = $objp->entity;
$product_static->status = $objp->tosell;
$product_static->status_buy = $objp->tobuy;
$product_static->status_batch = $objp->tobatch;
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
//Multilangs
if (!empty($conf->global->MAIN_MULTILANGS))
$colnb = 2;
if (empty($conf->global->PRODUIT_MULTIPRICES)) $colnb++;
print '<tr class="liste_titre"><th colspan="'.$colnb.'">'.$transRecordedType.'</th>';
print '<th class="right" colspan="3"><a href="'.DOL_URL_ROOT.'/product/list.php?sortfield=p.tms&sortorder=DESC">'.$langs->trans("FullList").'</td>';
print '</tr>';
while ($i < $num)
{
$sql = "SELECT label";
$sql .= " FROM ".MAIN_DB_PREFIX."product_lang";
$sql .= " WHERE fk_product=".$objp->rowid;
$sql .= " AND lang='".$langs->getDefaultLang()."'";
$objp = $db->fetch_object($result);
$resultd = $db->query($sql);
if ($resultd)
$product_static->id = $objp->rowid;
$product_static->ref = $objp->ref;
$product_static->label = $objp->label;
$product_static->type = $objp->fk_product_type;
$product_static->entity = $objp->entity;
$product_static->status = $objp->tosell;
$product_static->status_buy = $objp->tobuy;
$product_static->status_batch = $objp->tobatch;
//Multilangs
if (!empty($conf->global->MAIN_MULTILANGS))
{
$objtp = $db->fetch_object($resultd);
if ($objtp && $objtp->label != '') $objp->label = $objtp->label;
$sql = "SELECT label";
$sql .= " FROM ".MAIN_DB_PREFIX."product_lang";
$sql .= " WHERE fk_product=".$objp->rowid;
$sql .= " AND lang='".$langs->getDefaultLang()."'";
$resultd = $db->query($sql);
if ($resultd)
{
$objtp = $db->fetch_object($resultd);
if ($objtp && $objtp->label != '') $objp->label = $objtp->label;
}
}
}
print '<tr class="oddeven">';
print '<td class="nowrap">';
print $product_static->getNomUrl(1, '', 16);
print "</td>\n";
print '<td>'.dol_trunc($objp->label, 32).'</td>';
print "<td>";
print dol_print_date($db->jdate($objp->datem), 'day');
print "</td>";
// Sell price
if (empty($conf->global->PRODUIT_MULTIPRICES))
{
if (!empty($conf->dynamicprices->enabled) && !empty($objp->fk_price_expression))
{
$product = new Product($db);
$product->fetch($objp->rowid);
$priceparser = new PriceParser($db);
$price_result = $priceparser->parseProduct($product);
if ($price_result >= 0) {
$objp->price = $price_result;
}
}
print '<td class="nowrap right">';
if (isset($objp->price_base_type) && $objp->price_base_type == 'TTC') print price($objp->price_ttc).' '.$langs->trans("TTC");
else print price($objp->price).' '.$langs->trans("HT");
print '</td>';
print '<tr class="oddeven">';
print '<td class="nowrap">';
print $product_static->getNomUrl(1, '', 16);
print "</td>\n";
print '<td>'.dol_trunc($objp->label, 32).'</td>';
print "<td>";
print dol_print_date($db->jdate($objp->datem), 'day');
print "</td>";
// Sell price
if (empty($conf->global->PRODUIT_MULTIPRICES))
{
if (!empty($conf->dynamicprices->enabled) && !empty($objp->fk_price_expression))
{
$product = new Product($db);
$product->fetch($objp->rowid);
$priceparser = new PriceParser($db);
$price_result = $priceparser->parseProduct($product);
if ($price_result >= 0) {
$objp->price = $price_result;
}
}
print '<td class="nowrap right">';
if (isset($objp->price_base_type) && $objp->price_base_type == 'TTC') print price($objp->price_ttc).' '.$langs->trans("TTC");
else print price($objp->price).' '.$langs->trans("HT");
print '</td>';
}
print '<td class="right nowrap width25"><span class="statusrefsell">';
print $product_static->LibStatut($objp->tosell, 3, 0);
print "</span></td>";
print '<td class="right nowrap width25"><span class="statusrefbuy">';
print $product_static->LibStatut($objp->tobuy, 3, 1);
print "</span></td>";
print "</tr>\n";
$i++;
}
print '<td class="right nowrap width25"><span class="statusrefsell">';
print $product_static->LibStatut($objp->tosell, 3, 0);
print "</span></td>";
print '<td class="right nowrap width25"><span class="statusrefbuy">';
print $product_static->LibStatut($objp->tobuy, 3, 1);
print "</span></td>";
print "</tr>\n";
$i++;
$db->free($result);
print "</table>";
print '</div>';
print '<br>';
}
$db->free($result);
print "</table>";
print '</div>';
print '<br>';
}
}
else
{
dol_print_error($db);
else
{
dol_print_error($db);
}
}

View File

@ -146,7 +146,9 @@ $search_array_options_task = $extrafields->getOptionalsFromPost($object->table_e
/*
* Actions
*/
$parameters = array('id' => $id, 'taskid' => $taskid, 'projectid' => $projectid);
$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');
// Purge criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
{

View File

@ -0,0 +1,655 @@
<?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010 François Legastelois <flegastelois@teclib.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/projet/activity/permonth.php
* \ingroup projet
* \brief List activities of tasks (per week entry)
*/
require "../../main.inc.php";
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
// Load translation files required by the page
$langs->loadLangs(array('projects','users','companies'));
$hookmanager->initHooks(array('timesheetpermonthcard'));
$action=GETPOST('action', 'aZ09');
$mode=GETPOST("mode", 'alpha');
$id=GETPOST('id', 'int');
$taskid=GETPOST('taskid', 'int');
$mine=0;
if ($mode == 'mine') $mine=1;
$projectid='';
$projectid=isset($_GET["id"])?$_GET["id"]:$_POST["projectid"];
// Security check
$socid=0;
// For external user, no check is done on company because readability is managed by public status of project and assignement.
// if ($user->societe_id > 0) $socid=$user->societe_id;
$result = restrictedArea($user, 'projet', $projectid);
$now=dol_now();
$nowtmp=dol_getdate($now);
$nowday=$nowtmp['mday'];
$nowmonth=$nowtmp['mon'];
$nowyear=$nowtmp['year'];
$year=GETPOST('reyear')?GETPOST('reyear', 'int'):(GETPOST("year")?GETPOST("year", "int"):date("Y"));
$month=GETPOST('remonth')?GETPOST('remonth', 'int'):(GETPOST("month")?GETPOST("month", "int"):date("m"));
$day=GETPOST('reday')?GETPOST('reday', 'int'):(GETPOST("day")?GETPOST("day", "int"):date("d"));
$day = (int) $day;
$week=GETPOST("week", "int")?GETPOST("week", "int"):date("W");
$search_categ=GETPOST("search_categ", 'alpha');
$search_usertoprocessid=GETPOST('search_usertoprocessid', 'int');
$search_task_ref=GETPOST('search_task_ref', 'alpha');
$search_task_label=GETPOST('search_task_label', 'alpha');
$search_project_ref=GETPOST('search_project_ref', 'alpha');
$search_thirdparty=GETPOST('search_thirdparty', 'alpha');
$search_declared_progress=GETPOST('search_declared_progress', 'alpha');
$startdayarray=dol_get_prev_month($month, $year);
$prev = $startdayarray;
$prev_year = $prev['year'];
$prev_month = $prev['month'];
$prev_day = 1;
$next = dol_get_next_month($month, $year);
$next_year = $next['year'];
$next_month = $next['month'];
$next_day = 1;
$TWeek = getWeekNumbersOfMonth($month, $year);
$firstdaytoshow = dol_mktime(0, 0, 0, $month, 1, $year);
$TFirstDays = getFirstDayOfEachWeek($TWeek, $year);
$TFirstDays[reset($TWeek)] = '01'; //first day of month
$TLastDays = getLastDayOfEachWeek($TWeek, $year);
$TLastDays[end($TWeek)] = date("t", strtotime($year.'-'.$month.'-'.$day)); //last day of month
if (empty($search_usertoprocessid) || $search_usertoprocessid == $user->id)
{
$usertoprocess=$user;
$search_usertoprocessid=$usertoprocess->id;
}
elseif ($search_usertoprocessid > 0)
{
$usertoprocess=new User($db);
$usertoprocess->fetch($search_usertoprocessid);
$search_usertoprocessid=$usertoprocess->id;
}
else
{
$usertoprocess=new User($db);
}
$object=new Task($db);
/*
* Actions
*/
$parameters = array('id' => $id, 'taskid' => $taskid, 'projectid' => $projectid, 'TWeek' => $TWeek, 'TFirstDays' => $TFirstDays, 'TLastDays' => $TLastDays);
$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');
// Purge criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
{
$action = '';
$search_categ='';
$search_usertoprocessid = $user->id;
$search_task_ref = '';
$search_task_label = '';
$search_project_ref = '';
$search_thirdparty = '';
$search_declared_progress = '';
}
if (GETPOST("button_search_x", 'alpha') || GETPOST("button_search.x", 'alpha') || GETPOST("button_search", 'alpha'))
{
$action = '';
}
if (GETPOST('submitdateselect'))
{
$daytoparse = dol_mktime(0, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
$action = '';
}
if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('assigntask'))
{
$action = 'assigntask';
if ($taskid > 0)
{
$result = $object->fetch($taskid, $ref);
if ($result < 0) $error++;
}
else
{
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("Task")), '', 'errors');
$error++;
}
if (! GETPOST('type'))
{
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), '', 'errors');
$error++;
}
if (! $error)
{
$idfortaskuser=$usertoprocess->id;
$result = $object->add_contact($idfortaskuser, GETPOST("type"), 'internal');
if ($result >= 0 || $result == -2) // Contact add ok or already contact of task
{
// Test if we are already contact of the project (should be rare but sometimes we can add as task contact without being contact of project, like when admin user has been removed from contact of project)
$sql='SELECT ec.rowid FROM '.MAIN_DB_PREFIX.'element_contact as ec, '.MAIN_DB_PREFIX.'c_type_contact as tc WHERE tc.rowid = ec.fk_c_type_contact';
$sql.=' AND ec.fk_socpeople = '.$idfortaskuser." AND ec.element_id = '.$object->fk_project.' AND tc.element = 'project' AND source = 'internal'";
$resql=$db->query($sql);
if ($resql)
{
$obj=$db->fetch_object($resql);
if (! $obj) // User is not already linked to project, so we will create link to first type
{
$project = new Project($db);
$project->fetch($object->fk_project);
// Get type
$listofprojcontact=$project->liste_type_contact('internal');
if (count($listofprojcontact))
{
$typeforprojectcontact=reset(array_keys($listofprojcontact));
$result = $project->add_contact($idfortaskuser, $typeforprojectcontact, 'internal');
}
}
}
else
{
dol_print_error($db);
}
}
}
if ($result < 0)
{
$error++;
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
{
$langs->load("errors");
setEventMessages($langs->trans("ErrorTaskAlreadyAssigned"), null, 'warnings');
}
else
{
setEventMessages($object->error, $object->errors, 'errors');
}
}
if (! $error)
{
setEventMessages("TaskAssignedToEnterTime", null);
$taskid=0;
}
$action='';
}
if ($action == 'addtime' && $user->rights->projet->lire)
{
$timetoadd=$_POST['task'];
if (empty($timetoadd))
{
setEventMessages($langs->trans("ErrorTimeSpentIsEmpty"), null, 'errors');
}
else
{
foreach($timetoadd as $taskid => $value) // Loop on each task
{
$updateoftaskdone=0;
foreach($value as $key => $val) // Loop on each day
{
$amountoadd=$timetoadd[$taskid][$key];
if (! empty($amountoadd))
{
$tmpduration=explode(':', $amountoadd);
$newduration=0;
if (! empty($tmpduration[0])) $newduration+=($tmpduration[0] * 3600);
if (! empty($tmpduration[1])) $newduration+=($tmpduration[1] * 60);
if (! empty($tmpduration[2])) $newduration+=($tmpduration[2]);
if ($newduration > 0)
{
$object->fetch($taskid);
$object->progress = GETPOST($taskid . 'progress', 'int');
$object->timespent_duration = $newduration;
$object->timespent_fk_user = $usertoprocess->id;
$object->timespent_date = dol_time_plus_duree($firstdaytoshow, $key, 'd');
$object->timespent_datehour = $object->timespent_date;
$result=$object->addTimeSpent($user);
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
$error++;
break;
}
$updateoftaskdone++;
}
}
}
if (! $updateoftaskdone) // Check to update progress if no update were done on task.
{
$object->fetch($taskid);
//var_dump($object->progress);var_dump(GETPOST($taskid . 'progress', 'int')); exit;
if ($object->progress != GETPOST($taskid . 'progress', 'int'))
{
$object->progress = GETPOST($taskid . 'progress', 'int');
$result=$object->update($user);
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
$error++;
break;
}
}
}
}
if (! $error)
{
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
$param='';
$param.=($mode?'&mode='.$mode:'');
$param.=($projectid?'id='.$projectid:'');
$param.=($search_usertoprocessid?'&search_usertoprocessid='.$search_usertoprocessid:'');
$param.=($day?'&day='.$day:'').($month?'&month='.$month:'').($year?'&year='.$year:'');
$param.=($search_project_ref?'&search_project_ref='.$search_project_ref:'');
$param.=($search_usertoprocessid > 0?'&search_usertoprocessid='.$search_usertoprocessid:'');
$param.=($search_thirdparty?'&search_thirdparty='.$search_thirdparty:'');
$param.=($search_declared_progress?'&search_declared_progress='.$search_declared_progress:'');
$param.=($search_task_ref?'&search_task_ref='.$search_task_ref:'');
$param.=($search_task_label?'&search_task_label='.$search_task_label:'');
// Redirect to avoid submit twice on back
header('Location: '.$_SERVER["PHP_SELF"].'?'.$param);
exit;
}
}
}
/*
* View
*/
$form=new Form($db);
$formother=new FormOther($db);
$formcompany=new FormCompany($db);
$formproject=new FormProjets($db);
$projectstatic=new Project($db);
$project = new Project($db);
$taskstatic = new Task($db);
$thirdpartystatic = new Societe($db);
$holiday = new Holiday($db);
$title=$langs->trans("TimeSpent");
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($usertoprocess, (empty($usertoprocess->id)?2:0), 1); // Return all project i have permission on (assigned to me+public). I want my tasks and some of my task may be on a public projet that is not my project
//var_dump($projectsListId);
if ($id)
{
$project->fetch($id);
$project->fetch_thirdparty();
}
$onlyopenedproject=1; // or -1
$morewherefilter='';
if ($search_project_ref) $morewherefilter.=natural_search(array("p.ref", "p.title"), $search_project_ref);
if ($search_task_ref) $morewherefilter.=natural_search("t.ref", $search_task_ref);
if ($search_task_label) $morewherefilter.=natural_search(array("t.ref", "t.label"), $search_task_label);
if ($search_thirdparty) $morewherefilter.=natural_search("s.nom", $search_thirdparty);
if ($search_declared_progress) $morewherefilter.=natural_search("t.progress", $search_declared_progress, 1);
$tasksarray=$taskstatic->getTasksArray(0, 0, ($project->id?$project->id:0), $socid, 0, $search_project_ref, $onlyopenedproject, $morewherefilter, ($search_usertoprocessid?$search_usertoprocessid:0)); // We want to see all tasks of open project i am allowed to see and that match filter, not only my tasks. Later only mine will be editable later.
if ($morewherefilter) // Get all task without any filter, so we can show total of time spent for not visible tasks
{
$tasksarraywithoutfilter=$taskstatic->getTasksArray(0, 0, ($project->id?$project->id:0), $socid, 0, '', $onlyopenedproject, '', ($search_usertoprocessid?$search_usertoprocessid:0)); // We want to see all tasks of open project i am allowed to see and that match filter, not only my tasks. Later only mine will be editable later.
}
$projectsrole=$taskstatic->getUserRolesForProjectsOrTasks($usertoprocess, 0, ($project->id?$project->id:0), 0, $onlyopenedproject);
$tasksrole=$taskstatic->getUserRolesForProjectsOrTasks(0, $usertoprocess, ($project->id?$project->id:0), 0, $onlyopenedproject);
//var_dump($tasksarray);
//var_dump($projectsrole);
//var_dump($taskrole);
llxHeader("", $title, "", '', '', '', array('/core/js/timesheet.js'));
//print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num, '', 'title_project');
$param='';
$param.=($mode?'&mode='.$mode:'');
$param.=($search_project_ref?'&search_project_ref='.$search_project_ref:'');
$param.=($search_usertoprocessid > 0?'&search_usertoprocessid='.$search_usertoprocessid:'');
$param.=($search_thirdparty?'&search_thirdparty='.$search_thirdparty:'');
$param.=($search_task_ref?'&search_task_ref='.$search_task_ref:'');
$param.=($search_task_label?'&search_task_label='.$search_task_label:'');
// Show navigation bar
$nav ='<a class="inline-block valignmiddle" href="?year='.$prev_year."&month=".$prev_month."&day=".$prev_day.$param.'">'.img_previous($langs->trans("Previous"))."</a>\n";
$nav.=" <span id=\"month_name\">".dol_print_date(dol_mktime(0, 0, 0, $month, 1, $year), "%Y").", ".$langs->trans(date('F', mktime(0, 0, 0, $month, 10)))." </span>\n";
$nav.='<a class="inline-block valignmiddle" href="?year='.$next_year."&month=".$next_month."&day=".$next_day.$param.'">'.img_next($langs->trans("Next"))."</a>\n";
$nav.=" &nbsp; (<a href=\"?year=".$nowyear."&month=".$nowmonth."&day=".$nowday.$param."\">".$langs->trans("Today")."</a>)";
$nav.='<br>'.$form->select_date(-1, '', 0, 0, 2, "addtime", 1, 0, 1).' ';
$nav.=' <input type="submit" name="submitdateselect" class="button" value="'.$langs->trans("Refresh").'">';
$picto='calendarweek';
print '<form name="addtime" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="addtime">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
print '<input type="hidden" name="day" value="'.$day.'">';
print '<input type="hidden" name="month" value="'.$month.'">';
print '<input type="hidden" name="year" value="'.$year.'">';
$head=project_timesheet_prepare_head($mode, $usertoprocess);
dol_fiche_head($head, 'inputpermonth', $langs->trans('TimeSpent'), -1, 'task');
// Show description of content
print '<div class="hideonsmartphone opacitymedium">';
if ($mine || ($usertoprocess->id == $user->id)) print $langs->trans("MyTasksDesc").'.'.($onlyopenedproject?' '.$langs->trans("OnlyOpenedProject"):'').'<br>';
else
{
if (empty($usertoprocess->id) || $usertoprocess->id < 0)
{
if ($user->rights->projet->all->lire && ! $socid) print $langs->trans("ProjectsDesc").'.'.($onlyopenedproject?' '.$langs->trans("OnlyOpenedProject"):'').'<br>';
else print $langs->trans("ProjectsPublicTaskDesc").'.'.($onlyopenedproject?' '.$langs->trans("OnlyOpenedProject"):'').'<br>';
}
}
if ($mine || ($usertoprocess->id == $user->id))
{
print $langs->trans("OnlyYourTaskAreVisible").'<br>';
}
else
{
print $langs->trans("AllTaskVisibleButEditIfYouAreAssigned").'<br>';
}
print '</div>';
dol_fiche_end();
print '<div class="floatright right'.($conf->dol_optimize_smallscreen?' centpercent':'').'">'.$nav.'</div>'; // We move this before the assign to components so, the default submit button is not the assign to.
print '<div class="colorback float valignmiddle">';
$titleassigntask = $langs->transnoentities("AssignTaskToMe");
if ($usertoprocess->id != $user->id) $titleassigntask = $langs->transnoentities("AssignTaskToUser", $usertoprocess->getFullName($langs));
print '<div class="taskiddiv inline-block">';
$formproject->selectTasks($socid?$socid:-1, $taskid, 'taskid', 32, 0, 1, 1);
print '</div>';
print ' ';
print $formcompany->selectTypeContact($object, '', 'type', 'internal', 'rowid', 0, 'maxwidth150onsmartphone');
print '<input type="submit" class="button valignmiddle" name="assigntask" value="'.dol_escape_htmltag($titleassigntask).'">';
print '</div>';
print '<div class="clearboth" style="padding-bottom: 8px;"></div>';
$moreforfilter='';
// Filter on categories
/*
if (! empty($conf->categorie->enabled))
{
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('ProjectCategories'). ': ';
$moreforfilter.=$formother->select_categories('project', $search_categ, 'search_categ', 1, 1, 'maxwidth300');
$moreforfilter.='</div>';
}*/
// If the user can view user other than himself
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.='<div class="inline-block hideonsmartphone">'.$langs->trans('User'). ' </div>';
$includeonly='hierachyme';
if (empty($user->rights->user->user->lire)) $includeonly=array($user->id);
$moreforfilter.=$form->select_dolusers($search_usertoprocessid?$search_usertoprocessid:$usertoprocess->id, 'search_usertoprocessid', $user->rights->user->user->lire?0:0, null, 0, $includeonly, null, 0, 0, 0, '', 0, '', 'maxwidth200');
$moreforfilter.='</div>';
if (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT))
{
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.='<div class="inline-block">'.$langs->trans('Project'). ' </div>';
$moreforfilter.='<input type="text" size="4" name="search_project_ref" class="marginleftonly" value="'.dol_escape_htmltag($search_project_ref).'">';
$moreforfilter.='</div>';
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.='<div class="inline-block">'.$langs->trans('ThirdParty'). ' </div>';
$moreforfilter.='<input type="text" size="4" name="search_thirdparty" class="marginleftonly" value="'.dol_escape_htmltag($search_thirdparty).'">';
$moreforfilter.='</div>';
}
if (! empty($moreforfilter))
{
print '<div class="liste_titre liste_titre_bydiv centpercent">';
print $moreforfilter;
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</div>';
}
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'" id="tablelines3">'."\n";
print '<tr class="liste_titre_filter">';
if (! empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) print '<td class="liste_titre"><input type="text" size="4" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).'"></td>';
if (! empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) print '<td class="liste_titre"><input type="text" size="4" name="search_thirdparty" value="'.dol_escape_htmltag($search_thirdparty).'"></td>';
print '<td class="liste_titre"><input type="text" size="4" name="search_task_label" value="'.dol_escape_htmltag($search_task_label).'"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre right"><input type="text" size="4" name="search_declared_progress" value="'.dol_escape_htmltag($search_declared_progress).'"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
$countWeek = count($TWeek);
for ($idw=0;$idw<$countWeek;$idw++)
{
print '<td class="liste_titre"></td>';
}
// Action column
print '<td class="liste_titre nowrap" align="right">';
$searchpicto=$form->showFilterAndCheckAddButtons(0);
print $searchpicto;
print '</td>';
print "</tr>\n";
print '<tr class="liste_titre">';
if (! empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) print '<td>'.$langs->trans("Project").'</td>';
if (! empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) print '<td>'.$langs->trans("ThirdParty").'</td>';
print '<td>'.$langs->trans("Task").'</td>';
print '<td align="right" class="leftborder plannedworkload maxwidth75">'.$langs->trans("PlannedWorkload").'</td>';
print '<td align="right" class="maxwidth75">'.$langs->trans("ProgressDeclared").'</td>';
/*print '<td align="right" class="maxwidth75">'.$langs->trans("TimeSpent").'</td>';
if ($usertoprocess->id == $user->id) print '<td align="right" class="maxwidth75">'.$langs->trans("TimeSpentByYou").'</td>';
else print '<td align="right" class="maxwidth75">'.$langs->trans("TimeSpentByUser").'</td>';*/
print '<td align="right" class="maxwidth75">'.$langs->trans("TimeSpent").'<br>('.$langs->trans("Everybody").')</td>';
print '<td align="right" class="maxwidth75">'.$langs->trans("TimeSpent").($usertoprocess->firstname ? '<br>('.dol_trunc($usertoprocess->firstname, 10).')' : '').'</td>';
foreach ($TWeek as $week_number)
{
print '<td width="6%" align="center" class="bold hide">'.$langs->trans("Week").' '.$week_number.'<br>('.$TFirstDays[$week_number].'...'.$TLastDays[$week_number].')</td>';
}
print '<td></td>';
print "</tr>\n";
$colspan=5;
// By default, we can edit only tasks we are assigned to
$restrictviewformytask=(empty($conf->global->PROJECT_TIME_SHOW_TASK_NOT_ASSIGNED)?1:0);
if (count($tasksarray) > 0)
{
//var_dump($tasksarray); // contains only selected tasks
//var_dump($tasksarraywithoutfilter); // contains all tasks (if there is a filter, not defined if no filter)
//var_dump($tasksrole);
$j=0;
$level=0;
$totalforvisibletasks = projectLinesPerMonth($j, $firstdaytoshow, $usertoprocess, 0, $tasksarray, $level, $projectsrole, $tasksrole, $mine, $restrictviewformytask, $isavailable, 0, $TWeek);
//var_dump($totalforvisibletasks);
// Show total for all other tasks
// Calculate total for all tasks
$listofdistinctprojectid=array(); // List of all distinct projects
if (is_array($tasksarraywithoutfilter) && count($tasksarraywithoutfilter))
{
foreach($tasksarraywithoutfilter as $tmptask)
{
$listofdistinctprojectid[$tmptask->fk_project]=$tmptask->fk_project;
}
}
//var_dump($listofdistinctprojectid);
$totalforeachweek=array();
foreach($listofdistinctprojectid as $tmpprojectid)
{
$projectstatic->id=$tmpprojectid;
$projectstatic->loadTimeSpentMonth($firstdaytoshow, 0, $usertoprocess->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week
foreach($TWeek as $weekNb)
{
$totalforeachweek[$weekNb]+=$projectstatic->monthWorkLoad[$weekNb];
}
}
//var_dump($totalforeachday);
//var_dump($totalforvisibletasks);
// Is there a diff between selected/filtered tasks and all tasks ?
$isdiff = 0;
if (count($totalforeachweek))
{
foreach($TWeek as $weekNb)
{
$timeonothertasks=($totalforeachweek[$weekNb] - $totalforvisibletasks[$weekNb]);
if ($timeonothertasks)
{
$isdiff=1;
break;
}
}
}
// There is a diff between total shown on screen and total spent by user, so we add a line with all other cumulated time of user
if ($isdiff)
{
print '<tr class="oddeven othertaskwithtime">';
print '<td colspan="'.$colspan.'" class="opacitymedium">';
print $langs->trans("OtherFilteredTasks");
print '</td>';
foreach ($TWeek as $weekNb)
{
print '<td class="center hide">';
$timeonothertasks=($totalforeachweek[$weekNb] - $totalforvisibletasks[$weekNb]);
if ($timeonothertasks)
{
print '<span class="timesheetalreadyrecorded" title="texttoreplace"><input type="text" class="center smallpadd" size="2" disabled="" id="timespent[-1]['.$weekNb.']" name="task[-1]['.$weekNb.']" value="';
print convertSecondToTime($timeonothertasks, 'allhourmin');
print '"></span>';
}
print '</td>';
}
print ' <td class="liste_total"></td>';
print '</tr>';
}
if ($conf->use_javascript_ajax)
{
print '<tr class="liste_total">
<td class="liste_total" colspan="'.$colspan.'">';
print $langs->trans("Total");
print '<span class="opacitymediumbycolor"> - '.$langs->trans("ExpectedWorkedHours").': <strong>'.price($usertoprocess->weeklyhours, 1, $langs, 0, 0).'</strong></span>';
print '</td>';
foreach ($TWeek as $weekNb)
{
print '<td class="liste_total hide'.$weekNb.'" align="center"><div class="totalDay'.$weekNb.'">'. convertSecondToTime($totalforvisibletasks[$weekNb], 'allhourmin').'</div></td>';
}
print '<td class="liste_total center"><div class="totalDayAll">&nbsp;</div></td>
</tr>';
}
}
else
{
print '<tr><td colspan="15"><span class="opacitymedium">'.$langs->trans("NoAssignedTasks").'</span></td></tr>';
}
print "</table>";
print '</div>';
print '<input type="hidden" id="numberOfLines" name="numberOfLines" value="'.count($tasksarray).'"/>'."\n";
print '<div class="center">';
print '<input type="submit" class="button" name="save" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
print '</div>';
print '</form>'."\n\n";
$modeinput='hours';
if ($conf->use_javascript_ajax)
{
print "\n<!-- JS CODE TO ENABLE Tooltips on all object with class classfortooltip -->\n";
print '<script type="text/javascript">'."\n";
print "jQuery(document).ready(function () {\n";
print ' jQuery(".timesheetalreadyrecorded").tooltip({
show: { collision: "flipfit", effect:\'toggle\', delay:50 },
hide: { effect:\'toggle\', delay: 50 },
tooltipClass: "mytooltip",
content: function () {
return \''.dol_escape_js($langs->trans("TimeAlreadyRecorded", $usertoprocess->getFullName($langs))).'\';
}
});'."\n";
$idw=0;
while ($idw < 7)
{
print ' updateTotal('.$idw.',\''.$modeinput.'\');';
$idw++;
}
print "\n});\n";
print '</script>';
}
llxFooter();
$db->close();

View File

@ -162,7 +162,9 @@ $search_array_options_task = $extrafields->getOptionalsFromPost('projet_task', '
/*
* Actions
*/
$parameters = array('id' => $id, 'taskid' => $taskid, 'projectid' => $projectid);
$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');
// Purge criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
{

View File

@ -607,18 +607,29 @@ class Project extends CommonObject
{
$sql = 'SELECT ms.rowid, ms.fk_user_author as fk_user FROM '.MAIN_DB_PREFIX."stock_mouvement as ms, ".MAIN_DB_PREFIX."entrepot as e WHERE e.rowid = ms.fk_entrepot AND e.entity IN (".getEntity('stock').") AND ms.origintype = 'project' AND ms.fk_origin IN (".$ids.") AND ms.type_mouvement = 1";
}
elseif ($type == 'loan')
{
$sql = 'SELECT l.rowid, l.fk_user_author as fk_user FROM '.MAIN_DB_PREFIX."loan as l WHERE l.entity IN (".getEntity('loan').")";
}
else
{
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX.$tablename." WHERE ".$projectkey." IN (".$ids.") AND entity IN (".getEntity($type).")";
}
if ($dates > 0 && ($type != 'project_task')) // For table project_taks, we want the filter on date apply on project_time_spent table
if($dates > 0 && $type == 'loan'){
$sql .= " AND (dateend > '".$this->db->idate($dates)."' OR dateend IS NULL)";
}
elseif ($dates > 0 && ($type != 'project_task')) // For table project_taks, we want the filter on date apply on project_time_spent table
{
if (empty($datefieldname) && !empty($this->table_element_date)) $datefieldname = $this->table_element_date;
if (empty($datefieldname)) return 'Error this object has no date field defined';
$sql .= " AND (".$datefieldname." >= '".$this->db->idate($dates)."' OR ".$datefieldname." IS NULL)";
}
if ($datee > 0 && ($type != 'project_task')) // For table project_taks, we want the filter on date apply on project_time_spent table
if($datee > 0 && $type == 'loan'){
$sql .= " AND (datestart < '".$this->db->idate($datee)."' OR datestart IS NULL)";
}
elseif ($datee > 0 && ($type != 'project_task')) // For table project_taks, we want the filter on date apply on project_time_spent table
{
if (empty($datefieldname) && !empty($this->table_element_date)) $datefieldname = $this->table_element_date;
if (empty($datefieldname)) return 'Error this object has no date field defined';
@ -1211,7 +1222,7 @@ class Project extends CommonObject
* Return array of projects a user has permission on, is affected to, or all projects
*
* @param User $user User object
* @param int $mode 0=All project I have permission on (assigned to me and public), 1=Projects assigned to me only, 2=Will return list of all projects with no test on contacts
* @param int $mode 0=All project I have permission on (assigned to me or public), 1=Projects assigned to me only, 2=Will return list of all projects with no test on contacts
* @param int $list 0=Return array, 1=Return string list
* @param int $socid 0=No filter on third party, id of third party
* @param string $filter additionnal filter on project (statut, ref, ...)
@ -1224,9 +1235,17 @@ class Project extends CommonObject
$sql = "SELECT ".(($mode == 0 || $mode == 1) ? "DISTINCT " : "")."p.rowid, p.ref";
$sql.= " FROM " . MAIN_DB_PREFIX . "projet as p";
if ($mode == 0 || $mode == 1)
if ($mode == 0)
{
$sql.= ", " . MAIN_DB_PREFIX . "element_contact as ec";
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "element_contact as ec ON ec.element_id = p.rowid";
}
elseif ($mode == 1)
{
$sql.= ", " . MAIN_DB_PREFIX . "element_contact as ec";
}
elseif ($mode == 2)
{
// No filter. Use this if user has permission to see all project
}
$sql.= " WHERE p.entity IN (".getEntity('project').")";
// Internal users must see project he is contact to even if project linked to a third party he can't see.
@ -1251,13 +1270,12 @@ class Project extends CommonObject
if ($mode == 0)
{
$sql.= " AND ec.element_id = p.rowid";
$sql.= " AND ( p.public = 1";
$sql.= " OR ( ec.fk_c_type_contact IN (".join(',', array_keys($listofprojectcontacttype)).")";
$sql.= " AND ec.fk_socpeople = ".$user->id.")";
$sql.= " )";
}
if ($mode == 1)
elseif ($mode == 1)
{
$sql.= " AND ec.element_id = p.rowid";
$sql.= " AND (";
@ -1265,7 +1283,7 @@ class Project extends CommonObject
$sql.= " AND ec.fk_socpeople = ".$user->id.")";
$sql.= " )";
}
if ($mode == 2)
elseif ($mode == 2)
{
// No filter. Use this if user has permission to see all project
}
@ -1797,6 +1815,72 @@ class Project extends CommonObject
return -1;
}
}
/**
* Load time spent into this->weekWorkLoad and this->weekWorkLoadPerTask for all day of a week of project.
* Note: array weekWorkLoad and weekWorkLoadPerTask are reset and filled at each call.
*
* @param int $datestart First day of week (use dol_get_first_day to find this date)
* @param int $taskid Filter on a task id
* @param int $userid Time spent by a particular user
* @return int <0 if OK, >0 if KO
*/
public function loadTimeSpentMonth($datestart, $taskid = 0, $userid = 0)
{
$error=0;
$this->monthWorkLoad=array();
$this->monthWorkLoadPerTask=array();
if (empty($datestart)) dol_print_error('', 'Error datestart parameter is empty');
$sql = "SELECT ptt.rowid as taskid, ptt.task_duration, ptt.task_date, ptt.task_datehour, ptt.fk_task";
$sql.= " FROM ".MAIN_DB_PREFIX."projet_task_time AS ptt, ".MAIN_DB_PREFIX."projet_task as pt";
$sql.= " WHERE ptt.fk_task = pt.rowid";
$sql.= " AND pt.fk_projet = ".$this->id;
$sql.= " AND (ptt.task_date >= '".$this->db->idate($datestart)."' ";
$sql.= " AND ptt.task_date <= '".$this->db->idate(dol_time_plus_duree($datestart, 1, 'm') - 1)."')";
if ($task_id) $sql.= " AND ptt.fk_task=".$taskid;
if (is_numeric($userid)) $sql.= " AND ptt.fk_user=".$userid;
//print $sql;
$resql=$this->db->query($sql);
if ($resql)
{
$weekalreadyfound=array();
$num = $this->db->num_rows($resql);
$i = 0;
// Loop on each record found, so each couple (project id, task id)
while ($i < $num)
{
$obj=$this->db->fetch_object($resql);
if(!empty($obj->task_date)) {
$date = explode('-', $obj->task_date);
$week_number = getWeekNumber($date[2], $date[1], $date[0]);
}
if (empty($weekalreadyfound[$week_number]))
{
$this->monthWorkLoad[$week_number] = $obj->task_duration;
$this->monthWorkLoadPerTask[$week_number][$obj->fk_task] = $obj->task_duration;
}
else
{
$this->monthWorkLoad[$week_number] += $obj->task_duration;
$this->monthWorkLoadPerTask[$week_number][$obj->fk_task] += $obj->task_duration;
}
$weekalreadyfound[$week_number]=1;
$i++;
}
$this->db->free($resql);
return 1;
}
else
{
$this->error="Error ".$this->db->lasterror();
dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR);
return -1;
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps

View File

@ -49,6 +49,7 @@ if (! empty($conf->expensereport->enabled)) require_once DOL_DOCUMENT_ROOT.'/exp
if (! empty($conf->agenda->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
if (! empty($conf->don->enabled)) require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
if (! empty($conf->loan->enabled)) require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php';
if (! empty($conf->loan->enabled)) require_once DOL_DOCUMENT_ROOT.'/loan/class/loanschedule.class.php';
if (! empty($conf->stock->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
if (! empty($conf->tax->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
if (! empty($conf->banque->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php';
@ -56,32 +57,32 @@ if (! empty($conf->salaries->enabled)) require_once DOL_DOCUMENT_ROOT.'/salarie
// Load translation files required by the page
$langs->loadLangs(array('projects', 'companies', 'suppliers', 'compta'));
if (! empty($conf->facture->enabled)) $langs->load("bills");
if (! empty($conf->commande->enabled)) $langs->load("orders");
if (! empty($conf->propal->enabled)) $langs->load("propal");
if (! empty($conf->ficheinter->enabled)) $langs->load("interventions");
if (! empty($conf->deplacement->enabled)) $langs->load("trips");
if (! empty($conf->expensereport->enabled)) $langs->load("trips");
if (! empty($conf->don->enabled)) $langs->load("donations");
if (! empty($conf->loan->enabled)) $langs->load("loan");
if (! empty($conf->salaries->enabled)) $langs->load("salaries");
if (!empty($conf->facture->enabled)) $langs->load("bills");
if (!empty($conf->commande->enabled)) $langs->load("orders");
if (!empty($conf->propal->enabled)) $langs->load("propal");
if (!empty($conf->ficheinter->enabled)) $langs->load("interventions");
if (!empty($conf->deplacement->enabled)) $langs->load("trips");
if (!empty($conf->expensereport->enabled)) $langs->load("trips");
if (!empty($conf->don->enabled)) $langs->load("donations");
if (!empty($conf->loan->enabled)) $langs->load("loan");
if (!empty($conf->salaries->enabled)) $langs->load("salaries");
$id=GETPOST('id', 'int');
$ref=GETPOST('ref', 'alpha');
$action=GETPOST('action', 'alpha');
$datesrfc=GETPOST('datesrfc');
$dateerfc=GETPOST('dateerfc');
$dates=dol_mktime(0, 0, 0, GETPOST('datesmonth'), GETPOST('datesday'), GETPOST('datesyear'));
$datee=dol_mktime(23, 59, 59, GETPOST('dateemonth'), GETPOST('dateeday'), GETPOST('dateeyear'));
if (empty($dates) && ! empty($datesrfc)) $dates=dol_stringtotime($datesrfc);
if (empty($datee) && ! empty($dateerfc)) $datee=dol_stringtotime($dateerfc);
if (! isset($_POST['datesrfc']) && ! isset($_POST['datesday']) && ! empty($conf->global->PROJECT_LINKED_ELEMENT_DEFAULT_FILTER_YEAR))
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'alpha');
$datesrfc = GETPOST('datesrfc');
$dateerfc = GETPOST('dateerfc');
$dates = dol_mktime(0, 0, 0, GETPOST('datesmonth'), GETPOST('datesday'), GETPOST('datesyear'));
$datee = dol_mktime(23, 59, 59, GETPOST('dateemonth'), GETPOST('dateeday'), GETPOST('dateeyear'));
if (empty($dates) && !empty($datesrfc)) $dates = dol_stringtotime($datesrfc);
if (empty($datee) && !empty($dateerfc)) $datee = dol_stringtotime($dateerfc);
if (!isset($_POST['datesrfc']) && !isset($_POST['datesday']) && !empty($conf->global->PROJECT_LINKED_ELEMENT_DEFAULT_FILTER_YEAR))
{
$new=dol_now();
$tmp=dol_getdate($new);
$new = dol_now();
$tmp = dol_getdate($new);
//$datee=$now
//$dates=dol_time_plus_duree($datee, -1, 'y');
$dates=dol_get_first_day($tmp['year'], 1);
$dates = dol_get_first_day($tmp['year'], 1);
}
if ($id == '' && $ref == '')
{
@ -90,18 +91,18 @@ if ($id == '' && $ref == '')
exit();
}
$mine = $_REQUEST['mode']=='mine' ? 1 : 0;
$mine = $_REQUEST['mode'] == 'mine' ? 1 : 0;
//if (! $user->rights->projet->all->lire) $mine=1; // Special for projects
$object = new Project($db);
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments();
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments();
// Security check
$socid=$object->socid;
$socid = $object->socid;
//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement.
$result = restrictedArea($user, 'projet', $object->id, 'projet&project');
$result = restrictedArea($user, 'projet', $object->id, 'projet&project');
$hookmanager->initHooks(array('projectOverview'));
@ -163,23 +164,23 @@ print '<tr><td class="tdtop">';
print $langs->trans("Usage");
print '</td>';
print '<td>';
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
{
print '<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET('usage_opportunity') ? (GETPOST('usage_opportunity', 'alpha')!=''?' checked="checked"':'') : ($object->usage_opportunity ? ' checked="checked"' : '')).'"> ';
print '<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET('usage_opportunity') ? (GETPOST('usage_opportunity', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_opportunity ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectFollowOpportunity");
print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext);
print '<br>';
}
if (empty($conf->global->PROJECT_HIDE_TASKS))
{
print '<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha')!=''?' checked="checked"':'') : ($object->usage_task ? ' checked="checked"' : '')).'"> ';
print '<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_task ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectFollowTasks");
print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
print '<br>';
}
if (! empty($conf->global->PROJECT_BILL_TIME_SPENT))
if (!empty($conf->global->PROJECT_BILL_TIME_SPENT))
{
print '<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha')!=''?' checked="checked"':'') : ($object->usage_bill_time ? ' checked="checked"' : '')).'"> ';
print '<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_bill_time ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectBillTimeDescription");
print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
print '<br>';
@ -510,19 +511,19 @@ $listofreferent = array(
*/
);
$parameters=array('listofreferent'=>$listofreferent);
$parameters = array('listofreferent'=>$listofreferent);
$resHook = $hookmanager->executeHooks('completeListOfReferent', $parameters, $object, $action);
if(!empty($hookmanager->resArray)) {
if (!empty($hookmanager->resArray)) {
$listofreferent = array_merge($listofreferent, $hookmanager->resArray);
}
if ($action=="addelement")
if ($action == "addelement")
{
$tablename = GETPOST("tablename");
$elementselectid = GETPOST("elementselect");
$result=$object->update_element($tablename, $elementselectid);
if ($result<0)
$result = $object->update_element($tablename, $elementselectid);
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
}
@ -549,7 +550,7 @@ $showdatefilter = 0;
if (!$showdatefilter)
{
print '<div class="center centpercent">';
print '<form action="'.$_SERVER["PHP_SELF"].'?id=' . $object->id . '" method="post">';
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION["newtoken"].'">';
print '<input type="hidden" name="tablename" value="'.$tablename.'">';
print '<input type="hidden" name="action" value="view">';
@ -590,53 +591,53 @@ print '</tr>';
foreach ($listofreferent as $key => $value)
{
$name=$langs->trans($value['name']);
$title=$value['title'];
$classname=$value['class'];
$tablename=$value['table'];
$datefieldname=$value['datefieldname'];
$qualified=$value['test'];
$name = $langs->trans($value['name']);
$title = $value['title'];
$classname = $value['class'];
$tablename = $value['table'];
$datefieldname = $value['datefieldname'];
$qualified = $value['test'];
$margin = $value['margin'];
$project_field = $value['project_field'];
if ($qualified && isset($margin)) // If this element must be included into profit calculation ($margin is 'minus' or 'plus')
{
$element = new $classname($db);
$elementarray = $object->get_element_list($key, $tablename, $datefieldname, $dates, $datee, !empty($project_field)?$project_field:'fk_projet');
$elementarray = $object->get_element_list($key, $tablename, $datefieldname, $dates, $datee, !empty($project_field) ? $project_field : 'fk_projet');
if (count($elementarray)>0 && is_array($elementarray))
if (count($elementarray) > 0 && is_array($elementarray))
{
$total_ht = 0;
$total_ttc = 0;
$num=count($elementarray);
$num = count($elementarray);
for ($i = 0; $i < $num; $i++)
{
$tmp=explode('_', $elementarray[$i]);
$idofelement=$tmp[0];
$idofelementuser=$tmp[1];
$tmp = explode('_', $elementarray[$i]);
$idofelement = $tmp[0];
$idofelementuser = $tmp[1];
$element->fetch($idofelement);
if ($idofelementuser) $elementuser->fetch($idofelementuser);
// Define if record must be used for total or not
$qualifiedfortotal=true;
$qualifiedfortotal = true;
if ($key == 'invoice')
{
if (! empty($element->close_code) && $element->close_code == 'replaced') $qualifiedfortotal=false; // Replacement invoice, do not include into total
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS) && $element->type == Facture::TYPE_DEPOSIT) $qualifiedfortotal=false; // If hidden option to use deposits as payment (deprecated, not recommended to use this), deposits are not included
if (!empty($element->close_code) && $element->close_code == 'replaced') $qualifiedfortotal = false; // Replacement invoice, do not include into total
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS) && $element->type == Facture::TYPE_DEPOSIT) $qualifiedfortotal = false; // If hidden option to use deposits as payment (deprecated, not recommended to use this), deposits are not included
}
if ($key == 'propal')
{
if ($element->statut == Propal::STATUS_NOTSIGNED) $qualifiedfortotal=false; // Refused proposal must not be included in total
if ($element->statut == Propal::STATUS_NOTSIGNED) $qualifiedfortotal = false; // Refused proposal must not be included in total
}
if ($tablename != 'expensereport_det' && method_exists($element, 'fetch_thirdparty')) $element->fetch_thirdparty();
// Define $total_ht_by_line
if ($tablename == 'don' || $tablename == 'chargesociales' || $tablename == 'payment_various' || $tablename == 'payment_salary') $total_ht_by_line=$element->amount;
elseif ($tablename == 'fichinter') $total_ht_by_line=$element->getAmount();
elseif ($tablename == 'stock_mouvement') $total_ht_by_line=$element->price*abs($element->qty);
if ($tablename == 'don' || $tablename == 'chargesociales' || $tablename == 'payment_various' || $tablename == 'payment_salary') $total_ht_by_line = $element->amount;
elseif ($tablename == 'fichinter') $total_ht_by_line = $element->getAmount();
elseif ($tablename == 'stock_mouvement') $total_ht_by_line = $element->price * abs($element->qty);
elseif ($tablename == 'projet_task')
{
if ($idofelementuser)
@ -650,6 +651,31 @@ foreach ($listofreferent as $key => $value)
$total_ht_by_line = price2num($tmp['amount'], 'MT');
}
}
elseif ($key == 'loan'){
if((empty($dates) && empty($datee)) || (intval($dates) <= $element->datestart && intval($datee) >= $element->dateend)){
// Get total loan
$total_ht_by_line = -$element->capital;
}
else{
// Get loan schedule according to date filter
$total_ht_by_line = 0;
$loanScheduleStatic = new LoanSchedule($element->db);
$loanScheduleStatic->fetchAll($element->id);
if(!empty($loanScheduleStatic->lines)){
foreach($loanScheduleStatic->lines as $loanSchedule){
/**
* @var $loanSchedule LoanSchedule
*/
if( ($loanSchedule->datep >= $dates && $loanSchedule->datep <= $datee) // dates filter is defined
|| !empty($dates) && empty($datee) && $loanSchedule->datep >= $dates && $loanSchedule->datep <= dol_now()
|| empty($dates) && !empty($datee) && $loanSchedule->datep <= $datee
){
$total_ht_by_line = -$loanSchedule->amount_capital;
}
}
}
}
}
else $total_ht_by_line = $element->total_ht;
// Define $total_ttc_by_line
@ -661,6 +687,9 @@ foreach ($listofreferent as $key => $value)
$defaultvat = get_default_tva($mysoc, $mysoc);
$total_ttc_by_line = price2num($total_ht_by_line * (1 + ($defaultvat / 100)), 'MT');
}
elseif ($key == 'loan'){
$total_ttc_by_line = $total_ht_by_line; // For loan there is actually no taxe managed in Dolibarr
}
else $total_ttc_by_line = $element->total_ttc;
// Change sign of $total_ht_by_line and $total_ttc_by_line for some cases
@ -759,49 +788,49 @@ foreach ($listofreferent as $key => $value)
$element = new $classname($db);
$addform='';
$addform = '';
$idtofilterthirdparty=0;
$idtofilterthirdparty = 0;
$array_of_element_linkable_with_different_thirdparty = array('facture_fourn', 'commande_fournisseur');
if (! in_array($tablename, $array_of_element_linkable_with_different_thirdparty))
if (!in_array($tablename, $array_of_element_linkable_with_different_thirdparty))
{
$idtofilterthirdparty=$object->thirdparty->id;
if (! empty($conf->global->PROJECT_OTHER_THIRDPARTY_ID_TO_ADD_ELEMENTS)) $idtofilterthirdparty.=','.$conf->global->PROJECT_OTHER_THIRDPARTY_ID_TO_ADD_ELEMENTS;
$idtofilterthirdparty = $object->thirdparty->id;
if (!empty($conf->global->PROJECT_OTHER_THIRDPARTY_ID_TO_ADD_ELEMENTS)) $idtofilterthirdparty .= ','.$conf->global->PROJECT_OTHER_THIRDPARTY_ID_TO_ADD_ELEMENTS;
}
if (empty($conf->global->PROJECT_LINK_ON_OVERWIEW_DISABLED) && $idtofilterthirdparty && !in_array($tablename, $exclude_select_element))
{
$selectList=$formproject->select_element($tablename, $idtofilterthirdparty, 'minwidth300', -2, !empty($project_field)?$project_field:'fk_projet');
if ($selectList<0)
$selectList = $formproject->select_element($tablename, $idtofilterthirdparty, 'minwidth300', -2, !empty($project_field) ? $project_field : 'fk_projet');
if ($selectList < 0)
{
setEventMessages($formproject->error, $formproject->errors, 'errors');
}
elseif($selectList)
elseif ($selectList)
{
// Define form with the combo list of elements to link
$addform.='<div class="inline-block valignmiddle">';
$addform.='<form action="'.$_SERVER["PHP_SELF"].'?id=' . $object->id . '" method="post">';
$addform.='<input type="hidden" name="token" value="'.$_SESSION["newtoken"].'">';
$addform.='<input type="hidden" name="tablename" value="'.$tablename.'">';
$addform.='<input type="hidden" name="action" value="addelement">';
$addform.='<input type="hidden" name="datesrfc" value="'.dol_print_date($dates, 'dayhourrfc').'">';
$addform.='<input type="hidden" name="dateerfc" value="'.dol_print_date($datee, 'dayhourrfc').'">';
$addform.='<table><tr><td>'.$langs->trans("SelectElement").'</td>';
$addform.='<td>'.$selectList.'</td>';
$addform.='<td><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("AddElement")).'"></td>';
$addform.='</tr></table>';
$addform.='</form>';
$addform.='</div>';
$addform .= '<div class="inline-block valignmiddle">';
$addform .= '<form action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
$addform .= '<input type="hidden" name="token" value="'.$_SESSION["newtoken"].'">';
$addform .= '<input type="hidden" name="tablename" value="'.$tablename.'">';
$addform .= '<input type="hidden" name="action" value="addelement">';
$addform .= '<input type="hidden" name="datesrfc" value="'.dol_print_date($dates, 'dayhourrfc').'">';
$addform .= '<input type="hidden" name="dateerfc" value="'.dol_print_date($datee, 'dayhourrfc').'">';
$addform .= '<table><tr><td>'.$langs->trans("SelectElement").'</td>';
$addform .= '<td>'.$selectList.'</td>';
$addform .= '<td><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("AddElement")).'"></td>';
$addform .= '</tr></table>';
$addform .= '</form>';
$addform .= '</div>';
}
}
if (empty($conf->global->PROJECT_CREATE_ON_OVERVIEW_DISABLED) && $urlnew)
{
$addform.='<div class="inline-block valignmiddle">';
if ($testnew) $addform.='<a class="buttonxxx" href="'.$urlnew.'"><span class="valignmiddle text-plus-circle">'.($buttonnew?$langs->trans($buttonnew):$langs->trans("Create")).'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a>';
$addform .= '<div class="inline-block valignmiddle">';
if ($testnew) $addform .= '<a class="buttonxxx" href="'.$urlnew.'"><span class="valignmiddle text-plus-circle">'.($buttonnew ? $langs->trans($buttonnew) : $langs->trans("Create")).'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a>';
elseif (empty($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED)) {
$addform.='<a class="buttonxxx buttonRefused" disabled="disabled" href="#"><span class="valignmiddle text-plus-circle">'.($buttonnew?$langs->trans($buttonnew):$langs->trans("Create")).'</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
$addform .= '<a class="buttonxxx buttonRefused" disabled="disabled" href="#"><span class="valignmiddle text-plus-circle">'.($buttonnew ? $langs->trans($buttonnew) : $langs->trans("Create")).'</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
}
$addform.='<div>';
$addform .= '<div>';
}
print load_fiche_titre($langs->trans($title), $addform, '');
@ -827,7 +856,7 @@ foreach ($listofreferent as $key => $value)
else print $langs->trans("ThirdParty");
print '</td>';
// Duration of intervention
if($tablename == 'fichinter')
if ($tablename == 'fichinter')
{
print '<td>';
print $langs->trans("TotalDuration");
@ -837,11 +866,13 @@ foreach ($listofreferent as $key => $value)
// Amount HT
//if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print '<td class="right" width="120">'.$langs->trans("AmountHT").'</td>';
//elseif (empty($value['disableamount']) && in_array($tablename, array('projet_task'))) print '<td class="right" width="120">'.$langs->trans("Amount").'</td>';
if (empty($value['disableamount'])) print '<td class="right" width="120">'.$langs->trans("AmountHT").'</td>';
if ($key == 'loan') print '<td class="right" width="120">'.$langs->trans("LoanCapital").'</td>';
elseif (empty($value['disableamount'])) print '<td class="right" width="120">'.$langs->trans("AmountHT").'</td>';
else print '<td width="120"></td>';
// Amount TTC
//if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print '<td class="right" width="120">'.$langs->trans("AmountTTC").'</td>';
if (empty($value['disableamount'])) print '<td class="right" width="120">'.$langs->trans("AmountTTC").'</td>';
if ($key == 'loan') print '<td class="right" width="120">'.$langs->trans("RemainderToPay").'</td>';
elseif (empty($value['disableamount'])) print '<td class="right" width="120">'.$langs->trans("AmountTTC").'</td>';
else print '<td width="120"></td>';
// Status
if (in_array($tablename, array('projet_task'))) print '<td class="right" width="200">'.$langs->trans("ProgressDeclared").'</td>';
@ -915,7 +946,7 @@ foreach ($listofreferent as $key => $value)
{
if (empty($conf->global->PROJECT_DISABLE_UNLINK_FROM_OVERVIEW) || $user->admin) // PROJECT_DISABLE_UNLINK_FROM_OVERVIEW is empty by defaut, so this test true
{
print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=unlink&tablename=' . $tablename . '&elementselect=' . $element->id . ($project_field ? '&projectfield=' . $project_field : '') . '" class="reposition">';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=unlink&tablename='.$tablename.'&elementselect='.$element->id.($project_field ? '&projectfield='.$project_field : '').'" class="reposition">';
print img_picto($langs->trans('Unlink'), 'unlink');
print '</a>';
}
@ -936,6 +967,10 @@ foreach ($listofreferent as $key => $value)
print $element->getNomUrl(1, 'withproject', 'time');
print ' - '.dol_trunc($element->label, 48);
}
elseif ($key == 'loan'){
print $element->getNomUrl(1);
print ' - '.dol_trunc($element->label, 48);
}
else print $element->getNomUrl(1);
$element_doc = $element->element;
@ -985,6 +1020,10 @@ foreach ($listofreferent as $key => $value)
if (empty($date)) $date = $element->datev;
}
}
elseif ($key == 'loan'){
$date = $element->datestart;
}
print '<td class="center">';
if ($tablename == 'actioncomm')
{
@ -1033,7 +1072,7 @@ foreach ($listofreferent as $key => $value)
print '</td>';
// Add duration and store it in counter for fichinter
if($tablename == 'fichinter')
if ($tablename == 'fichinter')
{
print '<td>';
print convertSecondToTime($element->duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY);
@ -1067,6 +1106,7 @@ foreach ($listofreferent as $key => $value)
$othermessage = $form->textwithpicto($langs->trans("NotAvailable"), $langs->trans("ModuleSalaryToDefineHourlyRateMustBeEnabled"));
}
}
elseif ($key == 'loan') $total_ht_by_line = $element->capital;
else
{
$total_ht_by_line = $element->total_ht;
@ -1085,9 +1125,9 @@ foreach ($listofreferent as $key => $value)
if ($othermessage) print $othermessage;
if (isset($total_ht_by_line))
{
if (! $qualifiedfortotal) print '<strike>';
if (!$qualifiedfortotal) print '<strike>';
print price($total_ht_by_line);
if (! $qualifiedfortotal) print '</strike>';
if (!$qualifiedfortotal) print '</strike>';
}
if ($warning) print ' '.img_warning($warning);
print '</td>';
@ -1114,6 +1154,7 @@ foreach ($listofreferent as $key => $value)
$othermessage = $form->textwithpicto($langs->trans("NotAvailable"), $langs->trans("ModuleSalaryToDefineHourlyRateMustBeEnabled"));
}
}
elseif ($key == 'loan') $total_ttc_by_line = $element->capital - $element->getSumPayment();
else
{
$total_ttc_by_line = $element->total_ttc;
@ -1132,9 +1173,9 @@ foreach ($listofreferent as $key => $value)
if ($othermessage) print $othermessage;
if (isset($total_ttc_by_line))
{
if (! $qualifiedfortotal) print '<strike>';
if (!$qualifiedfortotal) print '<strike>';
print price($total_ttc_by_line);
if (! $qualifiedfortotal) print '</strike>';
if (!$qualifiedfortotal) print '</strike>';
}
if ($warning) print ' '.img_warning($warning);
print '</td>';
@ -1219,11 +1260,12 @@ foreach ($listofreferent as $key => $value)
//if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print '<td class="right" width="100">'.$langs->trans("TotalHT").' : '.price($total_ht).'</td>';
//elseif (empty($value['disableamount']) && in_array($tablename, array('projet_task'))) print '<td class="right" width="100">'.$langs->trans("Total").' : '.price($total_ht).'</td>';
// If fichinter add the total_duration
if($tablename == 'fichinter') print '<td class="left">'.convertSecondToTime($total_duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY).'</td>';
if ($tablename == 'fichinter') print '<td class="left">'.convertSecondToTime($total_duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY).'</td>';
print '<td class="right">';
if (empty($value['disableamount']))
{
if ($tablename != 'projet_task' || !empty($conf->salaries->enabled)) print ''.$langs->trans("TotalHT").' : '.price($total_ht);
if ($key == 'loan') print $langs->trans("Total").' '.$langs->trans("LoanCapital").' : '.price($total_ttc);
elseif ($tablename != 'projet_task' || !empty($conf->salaries->enabled)) print ''.$langs->trans("TotalHT").' : '.price($total_ht);
}
print '</td>';
//if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print '<td class="right" width="100">'.$langs->trans("TotalTTC").' : '.price($total_ttc).'</td>';
@ -1231,7 +1273,8 @@ foreach ($listofreferent as $key => $value)
print '<td class="right">';
if (empty($value['disableamount']))
{
if ($tablename != 'projet_task' || !empty($conf->salaries->enabled)) print $langs->trans("TotalTTC").' : '.price($total_ttc);
if ($key == 'loan') print $langs->trans("Total").' '.$langs->trans("RemainderToPay").' : '.price($total_ttc);
elseif ($tablename != 'projet_task' || !empty($conf->salaries->enabled)) print $langs->trans("TotalTTC").' : '.price($total_ttc);
}
print '</td>';
print '<td>&nbsp;</td>';

View File

@ -948,7 +948,7 @@ class Dolresource extends CommonObject
*/
public function getNomUrl($withpicto = 0, $option = '', $get_params = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
{
global $langs;
global $conf, $langs;
$result = '';
$label = '<u>'.$langs->trans("ShowResource").'</u>';

View File

@ -128,7 +128,7 @@ class Societe extends CommonObject
public $fields = array(
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'),
'nom' =>array('type'=>'varchar(128)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
'name_alias' =>array('type'=>'varchar(128)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
'name_alias' =>array('type'=>'varchar(128)', 'label'=>'AliasNames', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>20),
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>60),
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>61),
@ -3779,6 +3779,7 @@ class Societe extends CommonObject
/**
* Check if we must use revenue stamps feature or not according to country (country of $mysocin most cases).
* Table c_revenuestamp contains the country and value of stamp per invoice.
*
* @return boolean true or false
*/

View File

@ -139,7 +139,8 @@ class Stripe extends CommonObject
/**
* Get the Stripe customer of a thirdparty (with option to create it if not linked yet)
* Get the Stripe customer of a thirdparty (with option to create it if not linked yet).
* Search on site_account = 0 or = $stripearrayofkeysbyenv[$status]['publishable_key']
*
* @param Societe $object Object thirdparty to check, or create on stripe (create on stripe also update the stripe_account table for current entity)
* @param string $key ''=Use common API. If not '', it is the Stripe connect account 'acc_....' to use Stripe connect

File diff suppressed because it is too large Load Diff

View File

@ -23,6 +23,22 @@ background: #f9f9f9;
margin: 5px 5px;
}
.center {
text-align: center;
}
.centpercent {
width: 100%;
}
.valignmiddle {
vertical-align: middle;
}
inline-block {
display: inline-block;
}
div.titre {
padding: 5px 5px 5px 5px;
margin: 0 0 0 0;
@ -147,10 +163,10 @@ padding: 4px 4px 4px 4px;
tr.title
{
background: #DDDFDD;
background: #EEEEEE;
}
table.login { border: 1px solid #C0C0C0; background: #FFF; }
table.login { border: 1px solid #E0E0E0; background: #FFF; }
.tablesupport {
padding: 6px;

View File

@ -223,15 +223,12 @@ function pHeader($soutitre, $next, $action = 'none')
print '<title>'.$langs->trans("DolibarrHelpCenter").'</title>'."\n";
print '</head>'."\n";
print '<body>'."\n";
print '<body class="center">'."\n";
print '<table class="noborder" summary="helpcentertitle"><tr valign="middle">';
print '<td width="20">';
print '<img src="helpcenter.png" alt="logohelpcenter">';
print '</td>';
print '<td>';
print '<span class="titre">'.$soutitre.'</span>'."\n";
print '</td></tr></table>';
print '<div class="noborder centpercent center valignmiddle inline-block">';
print '<img src="helpcenter.png" alt="logohelpcenter" class="inline-block"><br><br>';
print '<span class="titre inline-block">'.$soutitre.'</span>'."\n";
print '</div><br>';
}
/**

View File

@ -38,14 +38,6 @@ select.vmenusearchselectcombo {
background-color: unset;
}
input.select2-input {
border-bottom: none ! important;
}
.select2-choice {
border: none;
border-bottom: solid 1px rgba(0,0,0,.2) !important; /* required to avoid to lose bottom line when focus is lost on select2. */
}
.liste_titre input[name=month_date_when], .liste_titre input[name=monthvalid], .liste_titre input[name=search_ordermonth], .liste_titre input[name=search_deliverymonth],
.liste_titre input[name=search_smonth], .liste_titre input[name=search_month], .liste_titre input[name=search_emonth], .liste_titre input[name=smonth], .liste_titre input[name=month], .liste_titre select[name=month],
.liste_titre input[name=month_lim], .liste_titre input[name=month_start], .liste_titre input[name=month_end], .liste_titre input[name=month_create],
@ -235,9 +227,6 @@ select.flat, form.flat select {
.optionblue {
color: rgb(<?php echo $colortextlink; ?>);
}
.select2-results .select2-highlighted.optionblue {
color: #FFF !important;
}
.optiongrey, .opacitymedium {
opacity: 0.4;
}
@ -481,6 +470,18 @@ textarea.centpercent {
.paddingright2 {
padding-<?php print $right; ?>: 2px;
}
.paddingtop {
padding-bottom: 4px;
}
.paddingtop2 {
padding-bottom: 2px;
}
.paddingbottom {
padding-bottom: 4px;
}
.paddingbottom2 {
padding-bottom: 2px;
}
.marginleft2 {
margin-<?php print $left; ?>: 2px;
}
@ -534,14 +535,20 @@ body[class*="colorblind-"] .text-success{
color: rgb(<?php echo $colortexttitle; ?>) !important;
}
.floatnone {
float: none !important;
}
.fa-toggle-on, .fa-toggle-off { font-size: 2em; }
.websiteselectionsection .fa-toggle-on, .websiteselectionsection .fa-toggle-off,
.asetresetmodule .fa-toggle-on, .asetresetmodule .fa-toggle-off {
font-size: 1.5em; vertical-align: text-bottom;
}
/* Themes for badges */
<?php include dol_buildpath($path.'/theme/'.$theme.'/badges.inc.php', 0); ?>
<?php include dol_buildpath($path.'/theme/'.$theme.'/badges.inc.php', 0); ?>
.borderrightlight
{
@ -574,6 +581,31 @@ div.divsearchfield {
padding-bottom: 5px;
opacity: 0.6;
}
.divadvancedsearchfield:first-child {
margin-top: 3px;
}
.divadvancedsearchfield {
float: left;
padding-left: 15px;
padding-bottom: 2px;
padding-top: 2px;
}
.divadvancedsearchfield span.select2.select2-container.select2-container--default {
padding-bottom: 4px;
}
.search_component_params {
/*display: flex; */
-webkit-flex-flow: row wrap;
flex-flow: row wrap;
background: #fff;
padding: 3px;
}
.search_component_params_input, .search_component_params_input:focus {
border-bottom: none;
width: auto;
margin: 0 !important;
padding: 3px;
}
<?php
// Add a nowrap on smartphone, so long list of field used for filter are overflowed with clip
if ($conf->browser->layout == 'phone') {
@ -2573,6 +2605,15 @@ tr.nocellnopadd td.nobordernopadding, tr.nocellnopadd td.nocellnopadd
border: 0px;
}
.unsetcolor {
color: unset !important;
}
.nopaddingleft {
padding-<?php print $left; ?>: 0px;
}
.nopaddingright {
padding-<?php print $right; ?>: 0px;
}
.notopnoleft {
border-collapse: collapse;
border: 0px;
@ -4772,6 +4813,28 @@ div.dataTables_length select {
/* Select2 */
/* ============================================================================== */
span.select2.select2-container.select2-container--default {
border-left: none;
border-top: none;
border-right: none;
}
input.select2-input {
border-bottom: none ! important;
}
.select2-choice {
border: none;
border-bottom: solid 1px rgba(0,0,0,.2) !important; /* required to avoid to lose bottom line when focus is lost on select2. */
}
.select2-results .select2-highlighted.optionblue {
color: #FFF !important;
}
.select2-container .select2-selection--multiple {
min-height: 30px !important;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice {
margin-top: 5px !important;
border: none;
}
.select2-container--focus span.select2-selection.select2-selection--single {
border-bottom: 1px solid #666 !important;
}
@ -4839,8 +4902,16 @@ div.dataTables_length select {
box-shadow: none !important;
border-radius: 0 !important;
}
.select2-container--default.select2-container--focus .select2-selection--multiple {
border-top: none;
border-left: none;
border-right: none;
}
.select2-container--default .select2-selection--multiple {
border: solid 1px rgba(0,0,0,.2);
border-bottom: solid 1px rgba(0,0,0,.2);
border-top: none;
border-left: none;
border-right: none;
border-radius: 0 !important;
}
.select2-search__field
@ -4933,7 +5004,7 @@ a span.select2-chosen
opacity: 0.4;
}
.select2-container-multi .select2-choices .select2-search-choice {
margin-bottom: 3px;
margin-bottom: 3px;
}
.select2-dropdown-open.select2-drop-above .select2-choice, .select2-dropdown-open.select2-drop-above .select2-choices, .select2-container-multi .select2-choices,
.select2-container-multi.select2-container-active .select2-choices
@ -5830,11 +5901,6 @@ div.tabsElem a.tab {
border-right: none;
border-left: none;
}
.box-flex-container {
margin: 0 0 0 -8px !important;
}
}
@media only screen and (max-width: 1024px)

View File

@ -299,7 +299,7 @@ if (GETPOSTISSET('THEME_AGRESSIVENESS_RATIO')) $conf->global->THEME_AGRESSIVENES
flex-direction: row;
flex-wrap: wrap;
width: 100%;
margin: 0 0 0 -15px;
margin: 0 0 0 -8px;
/*justify-content: space-between;*/
}
@ -309,7 +309,7 @@ if (GETPOSTISSET('THEME_AGRESSIVENESS_RATIO')) $conf->global->THEME_AGRESSIVENES
flex-basis: auto;
width: 280px;
margin: 5px 0px 0px 15px;
margin: 5px 8px 0px 8px;
}
.box-flex-item.filler{
margin: 0px 0px 0px 15px !important;
@ -321,3 +321,10 @@ if (GETPOSTISSET('THEME_AGRESSIVENESS_RATIO')) $conf->global->THEME_AGRESSIVENES
overflow: visible;
}
*/
@media only screen and (max-width: 767px)
{
.box-flex-container {
margin: 0 0 0 -8px !important;
}
}

View File

@ -269,13 +269,6 @@ textarea:focus, button:focus {
input:focus, textarea:focus, button:focus, select:focus {
border-bottom: 1px solid #666;
}
input.select2-input {
border-bottom: none ! important;
}
.select2-choice {
border: none;
border-bottom: 1px solid #ccc !important;
}
textarea.cke_source:focus
{
@ -453,9 +446,6 @@ select.flat, form.flat select {
.optionblue {
color: rgb(<?php echo $colortextlink; ?>);
}
.select2-results .select2-highlighted.optionblue {
color: #FFF !important;
}
.optiongrey, .opacitymedium {
opacity: 0.5;
}
@ -763,6 +753,10 @@ body[class*="colorblind-"] .text-success{
font-size: 1.5em; vertical-align: text-bottom;
}
.floatnone {
float: none !important;
}
/* Themes for badges */
<?php include dol_buildpath($path.'/theme/'.$theme.'/badges.inc.php', 0); ?>
@ -2749,6 +2743,15 @@ tr.nocellnopadd td.nobordernopadding, tr.nocellnopadd td.nocellnopadd
border: 0px;
}
.unsetcolor {
color: unset !important;
}
.nopaddingleft {
padding-<?php print $left; ?>: 0px;
}
.nopaddingright {
padding-<?php print $right; ?>: 0px;
}
.notopnoleft {
border-collapse: collapse;
border: 0px;
@ -4910,6 +4913,17 @@ div.dataTables_length select {
/* Select2 */
/* ============================================================================== */
input.select2-input {
border-bottom: none ! important;
}
.select2-choice {
border: none;
border-bottom: 1px solid #ccc !important;
}
.select2-results .select2-highlighted.optionblue {
color: #FFF !important;
}
.blockvmenusearch .select2-container--default .select2-selection--single,
.blockvmenubookmarks .select2-container--default .select2-selection--single
{
@ -4971,8 +4985,16 @@ div.dataTables_length select {
box-shadow: none !important;
border-radius: 0 !important;
}
.select2-container--default.select2-container--focus .select2-selection--multiple {
border-top: none;
border-left: none;
border-right: none;
}
.select2-container--default .select2-selection--multiple {
border: solid 1px rgba(0,0,0,.2);
border-bottom: solid 1px rgba(0,0,0,.2);
border-top: none;
border-left: none;
border-right: none;
border-radius: 0 !important;
}
.select2-search__field

View File

@ -132,15 +132,15 @@ class Users extends DolibarrApi
/**
* Get properties of an user object
*
* Return an array with user informations
*
* @param int $id ID of user
* @param int $id ID of user
* @param int $includepermissions Set this to 1 to have the array of permissions loaded (not done by default for performance purpose)
* @return array|mixed data without useless information
*
* @throws RestException
*/
public function get($id)
public function get($id, $includepermissions = 0)
{
//if (!DolibarrApiAccess::$user->rights->user->user->lire) {
//throw new RestException(401);
@ -157,6 +157,10 @@ class Users extends DolibarrApi
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
if ($includepermissions) {
$this->useraccount->getRights();
}
return $this->_cleanObjectDatas($this->useraccount);
}
@ -544,6 +548,12 @@ class Users extends DolibarrApi
unset($object->clicktodial_password);
unset($object->openid);
unset($object->lines);
unset($object->modelpdf);
unset($object->skype);
unset($object->twitter);
unset($object->facebook);
unset($object->linkedin);
$canreadsalary = ((!empty($conf->salaries->enabled) && !empty(DolibarrApiAccess::$user->rights->salaries->read))
|| (!empty($conf->hrm->enabled) && !empty(DolibarrApiAccess::$user->rights->hrm->employee->read)));

View File

@ -1420,16 +1420,16 @@ class User extends CommonObject
$result = $this->create($user);
if ($result > 0)
{
if (! empty($this->pass)) { // If a clear password was received (this situation should not happen anymore now), we use it to save it into database
if (!empty($this->pass)) { // If a clear password was received (this situation should not happen anymore now), we use it to save it into database
$newpass = $this->setPassword($user, $this->pass);
if (is_numeric($newpass) && $newpass < 0) $result = -2;
} elseif (! empty($this->pass_crypted)) { // If a crypted password is already known, we save it directly into database because the previous create did not save it.
} elseif (!empty($this->pass_crypted)) { // If a crypted password is already known, we save it directly into database because the previous create did not save it.
$sql = "UPDATE ".MAIN_DB_PREFIX."user";
$sql .= " SET pass_crypted = '".$this->db->escape($this->pass_crypted)."'";
$sql .= " WHERE rowid=".$this->id;
$resql = $this->db->query($sql);
if (! $resql)
if (!$resql)
{
$result = -1;
}

View File

@ -89,9 +89,13 @@ if (empty($reshook)) {
if ($action == 'addrights' && $caneditperms) {
$edituser = new User($db);
$edituser->fetch($object->id);
$edituser->addrights($rights, $module, '', $entity);
$result = $edituser->addrights($rights, $module, '', $entity);
if ($result < 0)
{
setEventMessages($edituser->error, $edituser->errors, 'errors');
}
// Si on a touche a ses propres droits, on recharge
// If we are changing our own permissions, we reload
if ($object->id == $user->id) {
$user->clearrights();
$user->getrights();
@ -105,9 +109,13 @@ if (empty($reshook)) {
if ($action == 'delrights' && $caneditperms) {
$edituser = new User($db);
$edituser->fetch($object->id);
$edituser->delrights($rights, $module, '', $entity);
$result = $edituser->delrights($rights, $module, '', $entity);
if ($result < 0)
{
setEventMessages($edituser->error, $edituser->errors, 'errors');
}
// Si on a touche a ses propres droits, on recharge
// If we are changing our own permissions, we reload
if ($object->id == $user->id) {
$user->clearrights();
$user->getrights();