Merge branch 'develop' into new_convert_setup_to_new_setup
@ -17,14 +17,14 @@ fi
|
||||
# To detec
|
||||
if [ "x$1" = "xlist" ]
|
||||
then
|
||||
find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" -o -iname "*.pml" \) -exec file "{}" + | grep -v 'documents\/website' | grep -v 'documents\/mdedias' | grep CRLF
|
||||
# find . \( -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep -v 'documents\/website' | grep -v 'documents\/mdedias' | grep -v 'htdocs\/includes' | grep CRLF
|
||||
find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" -o -iname "*.pml" \) -exec file "{}" + | grep -v 'custom\/' | grep -v 'documents\/website' | grep -v 'documents\/medias' | grep -v 'documents\/sellyoursaas' | grep CRLF
|
||||
# find . \( -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep -v 'custom\/' | grep -v 'documents\/website' | grep -v 'documents\/medias' | grep -v 'documents\/sellyoursaas' | grep -v 'htdocs\/includes' | grep CRLF
|
||||
fi
|
||||
|
||||
# To convert
|
||||
if [ "x$1" = "xfix" ]
|
||||
then
|
||||
for fic in `find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" -o -iname "*.pml" \) -exec file "{}" + | grep -v 'documents\/website' | grep -v 'documents\/mdedias' | grep CRLF | awk -F':' '{ print $1 }' `
|
||||
for fic in `find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" -o -iname "*.pml" \) -exec file "{}" + | grep -v 'custom\/' | grep -v 'documents\/website' | grep -v 'documents\/medias' | grep -v 'documents\/sellyoursaas' | grep CRLF | awk -F':' '{ print $1 }' `
|
||||
do
|
||||
echo "Fix file $fic"
|
||||
dos2unix "$fic"
|
||||
|
||||
@ -14,7 +14,8 @@ max_output_size=0
|
||||
usage()
|
||||
{
|
||||
cat <<EO
|
||||
Usage: $PROGNAME [options]
|
||||
Usage: $PROGNAME (list|fix) [options]
|
||||
Example: optimize_images.sh (list|fix) -i dirtoscan
|
||||
|
||||
Script to optimize JPG and PNG images in a directory.
|
||||
|
||||
@ -183,8 +184,8 @@ ARGS=$(getopt -s bash --options $SHORTOPTS --longoptions $LONGOPTS --name $PROGN
|
||||
# Syntax
|
||||
if [ "x$1" != "xlist" -a "x$1" != "xfix" ]
|
||||
then
|
||||
echo "Usage: optimize_images.sh (list|fix) -i dirtoscan"
|
||||
exit
|
||||
usage
|
||||
exit 0
|
||||
fi
|
||||
|
||||
eval set -- "$ARGS"
|
||||
|
||||
|
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 338 B |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 549 B |
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 946 B |
|
Before Width: | Height: | Size: 172 KiB After Width: | Height: | Size: 163 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 8.3 KiB |
BIN
doc/images/dolibarr_logo.png
Executable file → Normal file
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 66 KiB |
|
Before Width: | Height: | Size: 219 KiB After Width: | Height: | Size: 211 KiB |
|
Before Width: | Height: | Size: 143 KiB After Width: | Height: | Size: 138 KiB |
|
Before Width: | Height: | Size: 281 KiB After Width: | Height: | Size: 272 KiB |
|
Before Width: | Height: | Size: 164 KiB After Width: | Height: | Size: 156 KiB |
|
Before Width: | Height: | Size: 114 KiB After Width: | Height: | Size: 129 KiB |
|
Before Width: | Height: | Size: 135 KiB After Width: | Height: | Size: 132 KiB |
|
Before Width: | Height: | Size: 63 KiB After Width: | Height: | Size: 54 KiB |
@ -168,7 +168,7 @@ class AccountingAccount extends CommonObject
|
||||
global $conf;
|
||||
|
||||
$this->db = $db;
|
||||
$this->next_prev_filter = "fk_pcg_version IN (SELECT pcg_version FROM ".MAIN_DB_PREFIX."accounting_system WHERE rowid=".((int) $conf->global->CHARTOFACCOUNTS).")"; // Used to add a filter in Form::showrefnav method
|
||||
$this->next_prev_filter = "fk_pcg_version IN (SELECT pcg_version FROM ".MAIN_DB_PREFIX."accounting_system WHERE rowid = ".((int) $conf->global->CHARTOFACCOUNTS).")"; // Used to add a filter in Form::showrefnav method
|
||||
}
|
||||
|
||||
/**
|
||||
@ -197,7 +197,7 @@ class AccountingAccount extends CommonObject
|
||||
$sql .= " AND a.entity = ".$conf->entity;
|
||||
}
|
||||
if (!empty($limittocurrentchart)) {
|
||||
$sql .= ' AND a.fk_pcg_version IN (SELECT pcg_version FROM '.MAIN_DB_PREFIX.'accounting_system WHERE rowid='.$this->db->escape($conf->global->CHARTOFACCOUNTS).')';
|
||||
$sql .= ' AND a.fk_pcg_version IN (SELECT pcg_version FROM '.MAIN_DB_PREFIX.'accounting_system WHERE rowid = '.((int) $conf->global->CHARTOFACCOUNTS).')';
|
||||
}
|
||||
if (!empty($limittoachartaccount)) {
|
||||
$sql .= " AND a.fk_pcg_version = '".$this->db->escape($limittoachartaccount)."'";
|
||||
|
||||
@ -74,7 +74,7 @@ class AdherentStats extends Stats
|
||||
if ($this->memberid) {
|
||||
$this->where .= " AND m.rowid = ".((int) $this->memberid);
|
||||
}
|
||||
//if ($this->userid > 0) $this->where.=' AND fk_user_author = '.$this->userid;
|
||||
//if ($this->userid > 0) $this->where .= " AND fk_user_author = ".((int) $this->userid);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -153,7 +153,7 @@ if ($id > 0) {
|
||||
|
||||
// Login
|
||||
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$object->login.' </td></tr>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.dol_escape_htmltag($object->login).'</td></tr>';
|
||||
}
|
||||
|
||||
// Type
|
||||
@ -167,7 +167,7 @@ if ($id > 0) {
|
||||
print '</tr>';
|
||||
|
||||
// Company
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$object->company.'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.dol_escape_htmltag($object->company).'</td></tr>';
|
||||
|
||||
// Civility
|
||||
print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$object->getCivilityLabel().' </td>';
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011-2019 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2011-2021 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2011 Remy Younes <ryounes@gmail.com>
|
||||
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@ltairis.fr>
|
||||
@ -1967,6 +1967,7 @@ if ($id) {
|
||||
$class = "center";
|
||||
} elseif ($value == 'accountancy_code' || $value == 'accountancy_code_sell' || $value == 'accountancy_code_buy') {
|
||||
if (!empty($conf->accounting->enabled)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
|
||||
$tmpaccountingaccount = new AccountingAccount($db);
|
||||
$tmpaccountingaccount->fetch(0, $valuetoshow, 1);
|
||||
$titletoshow = $langs->transnoentitiesnoconv("Pcgtype").': '.$tmpaccountingaccount->pcg_type;
|
||||
|
||||
@ -75,6 +75,7 @@ print dol_get_fiche_head($head, 'setup', $langs->trans("ImportArea"), -1, "techn
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="page_y" value="">';
|
||||
print '<input type="hidden" name="action" value="setModuleOptions">';
|
||||
print '<input type="hidden" name="param" value="IMPORT_CSV_SEPARATOR_TO_USE">';
|
||||
|
||||
@ -87,7 +88,7 @@ print '<td class="center" width="100"></td>'."\n";
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("ImportCsvSeparator").' ('.$langs->trans("ByDefault").')</td>';
|
||||
print '<td width="60" align="center">'."<input size=\"3\" class=\"flat\" type=\"text\" name=\"value\" value=\"".(empty($conf->global->IMPORT_CSV_SEPARATOR_TO_USE) ? ',' : $conf->global->IMPORT_CSV_SEPARATOR_TO_USE)."\"></td>";
|
||||
print '<td class="right"><input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'"></td>';
|
||||
print '<td class="right"><input type="submit" class="button button-edit reposition" value="'.$langs->trans("Modify").'"></td>';
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -319,7 +319,7 @@ if ($conf->global->USER_PASSWORD_GENERATED == "Perso") {
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("NoAmbiCaracAutoGeneration")."</td>";
|
||||
print '<td><input type="checkbox" id="NoAmbiCaracAutoGeneration" '.($tabConf[5] ? "checked" : "").' min="0"> <span id="textcheckbox">'.($tabConf[5] ? $langs->trans("Activated") : $langs->trans("Disabled")).'</span></td>';
|
||||
print '<td><input type="checkbox" id="NoAmbiCaracAutoGeneration" '.($tabConf[5] ? "checked" : "").' min="0"> <label for="NoAmbiCaracAutoGeneration" id="textcheckbox">'.($tabConf[5] ? $langs->trans("Activated") : $langs->trans("Disabled")).'</label></td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -73,42 +73,49 @@ $optioncss = GETPOST("optioncss", "aZ"); // Option for the css output (always ''
|
||||
$now = dol_now();
|
||||
$nowarray = dol_getdate($now);
|
||||
|
||||
if (!GETPOSTISSET("date_startmonth")) {
|
||||
$date_start = dol_get_first_day($nowarray['year'], $nowarray['mon'], 'tzuserrel');
|
||||
} elseif (GETPOST("date_startmonth") > 0) {
|
||||
if (GETPOST("date_startmonth", 'int') > 0) {
|
||||
$date_start = dol_mktime(0, 0, 0, GETPOST("date_startmonth", 'int'), GETPOST("date_startday", 'int'), GETPOST("date_startyear", 'int'), 'tzuserrel');
|
||||
} else {
|
||||
$date_start = -1;
|
||||
$date_start = '';
|
||||
}
|
||||
if (!GETPOSTISSET("date_endmonth")) {
|
||||
$date_end = dol_get_last_hour(dol_now('gmt'), 'tzuserrel');
|
||||
} elseif (GETPOST("date_endmonth") > 0) {
|
||||
if (GETPOST("date_endmonth", 'int') > 0) {
|
||||
$date_end = dol_get_last_hour(dol_mktime(23, 59, 59, GETPOST("date_endmonth", 'int'), GETPOST("date_endday", 'int'), GETPOST("date_endyear", 'int'), 'tzuserrel'), 'tzuserrel');
|
||||
} else {
|
||||
$date_end = -1;
|
||||
$date_end = '';
|
||||
}
|
||||
|
||||
// checks:if date_start>date_end then date_end=date_start + 24 hours
|
||||
if ($date_start > 0 && $date_end > 0 && $date_start > $date_end) {
|
||||
if ($date_start !== '' && $date_end !== '' && $date_start > $date_end) {
|
||||
$date_end = $date_start + 86400;
|
||||
}
|
||||
|
||||
|
||||
if (empty($date_start)) { // We define date_start and date_end
|
||||
$date_start = dol_get_first_day($nowarray['year'], $nowarray['mon'], false);
|
||||
if (!GETPOSTISSET('pageplusoneold') && !GETPOSTISSET('page') && $date_start === '') { // We define date_start and date_end
|
||||
$date_start = dol_get_first_day($nowarray['year'], $nowarray['mon'], 'tzuserrel');
|
||||
}
|
||||
if (empty($date_end)) {
|
||||
$date_end = dol_mktime(23, 59, 59, $nowarray['mon'], $nowarray['mday'], $nowarray['year']);
|
||||
if (!GETPOSTISSET('pageplusoneold') && !GETPOSTISSET('page') && $date_end === '') {
|
||||
$date_end = dol_get_last_day($nowarray['year'], $nowarray['mon'], 'tzuserrel');
|
||||
}
|
||||
|
||||
// Set $date_startmonth...
|
||||
$tmp = dol_getdate($date_start);
|
||||
$date_startday = $tmp['mday'];
|
||||
$date_startmonth = $tmp['mon'];
|
||||
$date_startyear = $tmp['year'];
|
||||
$tmp = dol_getdate($date_end);
|
||||
$date_endday = $tmp['mday'];
|
||||
$date_endmonth = $tmp['mon'];
|
||||
$date_endyear = $tmp['year'];
|
||||
$date_startday = '';
|
||||
$date_startmonth = '';
|
||||
$date_startyear = '';
|
||||
$date_endday = '';
|
||||
$date_endmonth = '';
|
||||
$date_endyear = '';
|
||||
if ($date_start !== '') {
|
||||
$tmp = dol_getdate($date_start);
|
||||
$date_startday = $tmp['mday'];
|
||||
$date_startmonth = $tmp['mon'];
|
||||
$date_startyear = $tmp['year'];
|
||||
}
|
||||
if ($date_end !== '') {
|
||||
$tmp = dol_getdate($date_end);
|
||||
$date_endday = $tmp['mday'];
|
||||
$date_endmonth = $tmp['mon'];
|
||||
$date_endyear = $tmp['year'];
|
||||
}
|
||||
|
||||
// Add prefix session
|
||||
$arrayfields = array(
|
||||
@ -120,6 +127,7 @@ $arrayfields = array(
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
@ -128,8 +136,14 @@ $now = dol_now();
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
|
||||
$date_start = -1;
|
||||
$date_end = -1;
|
||||
$date_start = '';
|
||||
$date_end = '';
|
||||
$date_startday = '';
|
||||
$date_endday = '';
|
||||
$date_startmonth = '';
|
||||
$date_endmonth = '';
|
||||
$date_startyear = '';
|
||||
$date_endyear = '';
|
||||
$search_code = '';
|
||||
$search_ip = '';
|
||||
$search_user = '';
|
||||
@ -193,10 +207,10 @@ $sql .= " u.login, u.admin, u.entity, u.firstname, u.lastname, u.statut as statu
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."events as e";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = e.fk_user";
|
||||
$sql .= " WHERE e.entity IN (".getEntity('event').")";
|
||||
if ($date_start > 0) {
|
||||
if ($date_start !== '') {
|
||||
$sql .= " AND e.dateevent >= '".$db->idate($date_start)."'";
|
||||
}
|
||||
if ($date_end > 0) {
|
||||
if ($date_end !== '' ) {
|
||||
$sql .= " AND e.dateevent <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
if ($search_code) {
|
||||
@ -232,8 +246,8 @@ $nbtotalofrecords = '';
|
||||
}
|
||||
}*/
|
||||
|
||||
$sql .= $db->plimit($conf->liste_limit + 1, $offset);
|
||||
//print $sql;
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
@ -322,8 +336,8 @@ if ($result) {
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
print '<td class="liste_titre" width="15%">';
|
||||
print $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzuserrel');
|
||||
print $form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzuserrel');
|
||||
print $form->selectDate($date_start === '' ? -1 : $date_start, 'date_start', 0, 0, 0, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzuserrel');
|
||||
print $form->selectDate($date_end === '' ? -1 : $date_end, 'date_end', 0, 0, 0, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzuserrel');
|
||||
print '</td>';
|
||||
|
||||
print '<td class="liste_titre left">';
|
||||
@ -455,9 +469,9 @@ if ($result) {
|
||||
|
||||
if ($num == 0) {
|
||||
if ($usefilter) {
|
||||
print '<tr><td colspan="6">'.$langs->trans("NoEventFoundWithCriteria").'</td></tr>';
|
||||
print '<tr><td colspan="7"><span class="opacitymedium">'.$langs->trans("NoEventFoundWithCriteria").'</span></td></tr>';
|
||||
} else {
|
||||
print '<tr><td colspan="6">'.$langs->trans("NoEventOrNoAuditSetup").'</td></tr>';
|
||||
print '<tr><td colspan="7"><span class="opacitymedium">'.$langs->trans("NoEventOrNoAuditSetup").'</span></td></tr>';
|
||||
}
|
||||
}
|
||||
print "</table>";
|
||||
|
||||
0
htdocs/admin/workstation.php
Executable file → Normal file
@ -302,49 +302,13 @@ class DolibarrApi
|
||||
{
|
||||
// phpcs:enable
|
||||
|
||||
//$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
//$tmp=preg_replace_all('/'.$regexstring.'/', '', $sqlfilters);
|
||||
$tmp = trim($sqlfilters);
|
||||
|
||||
$i = 0; $nb = strlen($tmp);
|
||||
|
||||
if ($nb > 0 && $tmp[0] != '(') {
|
||||
$error = "Bad sqlfilters (first and last characters must be open and closing parenthesis) = ".$sqlfilters;
|
||||
dol_syslog($error, LOG_WARNING);
|
||||
return false;
|
||||
}
|
||||
|
||||
$counter = 0;
|
||||
while ($i < $nb) {
|
||||
if ($tmp[$i] == '(') {
|
||||
$counter++;
|
||||
}
|
||||
if ($tmp[$i] == ')') {
|
||||
$counter--;
|
||||
|
||||
// TODO: After a closing ), only a " or " or " and " or end of string is allowed.
|
||||
}
|
||||
if ($counter < 0) {
|
||||
$error = "Bad sqlfilters (too many closing parenthesis) = ".$sqlfilters;
|
||||
dol_syslog($error, LOG_WARNING);
|
||||
return false;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
if ($counter > 0) {
|
||||
$error = "Bad sqlfilters (too many opening parenthesis) = ".$sqlfilters;
|
||||
dol_syslog($error, LOG_WARNING);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return dolCheckFilters($sqlfilters, $error);
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
||||
/**
|
||||
* Function to forge a SQL criteria
|
||||
* Function to forge a SQL criteria from a Generic filter string
|
||||
*
|
||||
* @param array $matches Array of found string by regex search.
|
||||
* Each entry is 1 and only 1 criteria.
|
||||
@ -353,51 +317,6 @@ class DolibarrApi
|
||||
*/
|
||||
protected static function _forge_criteria_callback($matches)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $db;
|
||||
|
||||
//dol_syslog("Convert matches ".$matches[1]);
|
||||
if (empty($matches[1])) {
|
||||
return '';
|
||||
}
|
||||
$tmp = explode(':', $matches[1], 3);
|
||||
|
||||
if (count($tmp) < 3) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// Sanitize operand
|
||||
$operand = preg_replace('/[^a-z0-9\._]/i', '', trim($tmp[0]));
|
||||
|
||||
// Sanitize operator
|
||||
$operator = strtoupper(preg_replace('/[^a-z<>=]/i', '', trim($tmp[1])));
|
||||
// Only some operators are allowed.
|
||||
if (! in_array($operator, array('LIKE', 'ULIKE', '<', '>', '<=', '>=', '=', '<>', 'IS', 'ISNOT', 'IN'))) {
|
||||
return '';
|
||||
}
|
||||
if ($operator == 'ISNOT') {
|
||||
$operator = 'IS NOT';
|
||||
}
|
||||
|
||||
// Sanitize value
|
||||
$tmpescaped = trim($tmp[2]);
|
||||
$regbis = array();
|
||||
if ($operator == 'IN') {
|
||||
$tmpescaped = "(".$db->sanitize($tmpescaped, 1).")";
|
||||
} elseif (in_array($operator, array('<', '>', '<=', '>=', '=', '<>'))) {
|
||||
if (preg_match('/^\'(.*)\'$/', $tmpescaped, $regbis)) { // If 'YYYY-MM-DD HH:MM:SS+X'
|
||||
$tmpescaped = "'".$db->escape($regbis[1])."'";
|
||||
} else {
|
||||
$tmpescaped = ((float) $tmpescaped);
|
||||
}
|
||||
} else {
|
||||
if (preg_match('/^\'(.*)\'$/', $tmpescaped, $regbis)) {
|
||||
$tmpescaped = "'".$db->escape($regbis[1])."'";
|
||||
} else {
|
||||
$tmpescaped = "'".$db->escape($tmpescaped)."'";
|
||||
}
|
||||
}
|
||||
|
||||
return $db->escape($operand).' '.$db->escape($operator)." ".$tmpescaped;
|
||||
return dolForgeCriteriaCallback($matches);
|
||||
}
|
||||
}
|
||||
|
||||
@ -107,9 +107,9 @@ if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) {
|
||||
echo '</span>';
|
||||
}
|
||||
if (!empty($conf->global->BOM_SUB_BOM)) {
|
||||
print '<br>'.$langs->trans("or").' '.$langs->trans("BOM");
|
||||
print '<br><span class="opacitymedium">'.$langs->trans("or").'</span><br>'.$langs->trans("BOM");
|
||||
// TODO Add component to select a BOM
|
||||
print '<select id="bom_select" name="bom_select"><options value="-1"></options></select>';
|
||||
print '<select id="bom_select" name="bom_select"><option value="-1">TODO</option></select>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
||||
@ -86,7 +86,7 @@ if ($action == 'delete') {
|
||||
* View
|
||||
*/
|
||||
|
||||
$userstatic = new User($db);
|
||||
$form = new Form($db);
|
||||
|
||||
$title = $langs->trans("ListOfBookmarks");
|
||||
|
||||
|
||||
@ -1355,7 +1355,7 @@ class Categorie extends CommonObject
|
||||
* @param string $addpicto Add picto into link
|
||||
* @return array
|
||||
*/
|
||||
public function print_all_ways($sep = ' >> ', $url = '', $nocolor = 0, $addpicto = 0)
|
||||
public function print_all_ways($sep = '>>', $url = '', $nocolor = 0, $addpicto = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
$ways = array();
|
||||
@ -1369,8 +1369,8 @@ class Categorie extends CommonObject
|
||||
$i++;
|
||||
|
||||
if (empty($nocolor)) {
|
||||
$forced_color = 'toreplace';
|
||||
if ($i == count($way)) {
|
||||
$forced_color = 'colortoreplace';
|
||||
if ($i == count($way)) { // Last category in hierarchy
|
||||
// Check contrast with background and correct text color
|
||||
$forced_color = 'categtextwhite';
|
||||
if ($cat->color) {
|
||||
@ -1384,16 +1384,16 @@ class Categorie extends CommonObject
|
||||
if ($url == '') {
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$cat->id.'&type='.$cat->type.'" class="'.$forced_color.'">';
|
||||
$linkend = '</a>';
|
||||
$w[] = $link.($addpicto ? img_object('', 'category', 'class="paddingright"') : '').$cat->label.$linkend;
|
||||
$w[] = $link.(($addpicto && $i == 1) ? img_object('', 'category', 'class="paddingright"') : '').$cat->label.$linkend;
|
||||
} elseif ($url == 'none') {
|
||||
$link = '<span class="'.$forced_color.'">';
|
||||
$linkend = '</span>';
|
||||
$w[] = $link.($addpicto ? img_object('', 'category', 'class="paddingright"') : '').$cat->label.$linkend;
|
||||
$w[] = $link.(($addpicto && $i == 1) ? img_object('', 'category', 'class="paddingright"') : '').$cat->label.$linkend;
|
||||
} else {
|
||||
$w[] = '<a class="'.$forced_color.'" href="'.DOL_URL_ROOT.'/'.$url.'?catid='.$cat->id.'">'.($addpicto ? img_object('', 'category') : '').$cat->label.'</a>';
|
||||
}
|
||||
}
|
||||
$newcategwithpath = preg_replace('/toreplace/', $forced_color, implode($sep, $w));
|
||||
$newcategwithpath = preg_replace('/colortoreplace/', $forced_color, implode('<span class="inline-block valignmiddle paddingleft paddingright '.$forced_color.'">'.$sep.'</span>', $w));
|
||||
|
||||
$ways[] = $newcategwithpath;
|
||||
}
|
||||
|
||||
@ -1315,7 +1315,7 @@ if ($action == 'create') {
|
||||
//checkbox create reminder
|
||||
print '<hr>';
|
||||
print '<br>';
|
||||
print '<label for="addreminder">'.$langs->trans("AddReminder").'</label> <input type="checkbox" id="addreminder" name="addreminder"><br><br>';
|
||||
print '<label for="addreminder">'.img_picto('', 'bell', 'class="pictofixedwidth"').$langs->trans("AddReminder").'</label> <input type="checkbox" id="addreminder" name="addreminder"><br><br>';
|
||||
|
||||
print '<div class="reminderparameters" style="display: none;">';
|
||||
|
||||
@ -1332,7 +1332,7 @@ if ($action == 'create') {
|
||||
|
||||
//Reminder Type
|
||||
print '<tr><td class="titlefieldcreate nowrap">'.$langs->trans("ReminderType").'</td><td colspan="3">';
|
||||
print $form->selectarray('selectremindertype', $TRemindTypes, '', 0, 0, 0, '', 0, 0, 0, '', 'mimnwidth200', 1);
|
||||
print $form->selectarray('selectremindertype', $TRemindTypes, '', 0, 0, 0, '', 0, 0, 0, '', 'minwidth200 maxwidth500', 1);
|
||||
print '</td></tr>';
|
||||
|
||||
//Mail Model
|
||||
@ -1347,14 +1347,20 @@ if ($action == 'create') {
|
||||
print "\n".'<script type="text/javascript">';
|
||||
print '$(document).ready(function () {
|
||||
$("#addreminder").click(function(){
|
||||
console.log("Click on addreminder");
|
||||
if (this.checked) {
|
||||
$(".reminderparameters").show();
|
||||
$(".reminderparameters").show();
|
||||
} else {
|
||||
$(".reminderparameters").hide();
|
||||
$(".reminderparameters").hide();
|
||||
}
|
||||
$("#selectremindertype").select2("destroy");
|
||||
$("#selectremindertype").select2();
|
||||
$("#select_offsetunittype_duration").select2("destroy");
|
||||
$("#select_offsetunittype_duration").select2();
|
||||
});
|
||||
|
||||
$("#selectremindertype").change(function(){
|
||||
console.log("Change on selectremindertype");
|
||||
var selected_option = $("#selectremindertype option:selected").val();
|
||||
if(selected_option == "email") {
|
||||
$("#select_actioncommsendmodel_mail").closest("tr").show();
|
||||
@ -1862,24 +1868,34 @@ if ($id > 0) {
|
||||
|
||||
$linkback = '';
|
||||
// Link to other agenda views
|
||||
$linkback .= img_picto($langs->trans("BackToList"), 'object_list', 'class="hideonsmartphone pictoactionview"');
|
||||
$linkback .= '<a href="'.DOL_URL_ROOT.'/comm/action/list.php?mode=show_list&restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
$linkback .= '<a href="'.DOL_URL_ROOT.'/comm/action/list.php?mode=show_list&restore_lastsearch_values=1">';
|
||||
$linkback .= img_picto($langs->trans("BackToList"), 'object_list', 'class="pictoactionview pictofixedwidth"');
|
||||
$linkback .= '<span class="hideonsmartphone">'.$langs->trans("BackToList").'</span>';
|
||||
$linkback .= '</a>';
|
||||
$linkback .= '</li>';
|
||||
$linkback .= '<li class="noborder litext">';
|
||||
$linkback .= img_picto($langs->trans("ViewCal"), 'object_calendar', 'class="hideonsmartphone pictoactionview"');
|
||||
$linkback .= '<a href="'.DOL_URL_ROOT.'/comm/action/index.php?mode=show_month&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').'">'.$langs->trans("ViewCal").'</a>';
|
||||
$linkback .= '<a href="'.DOL_URL_ROOT.'/comm/action/index.php?mode=show_month&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').'">';
|
||||
$linkback .= img_picto($langs->trans("ViewCal"), 'object_calendar', 'class="pictoactionview pictofixedwidth"');
|
||||
$linkback .= '<span class="hideonsmartphone">'.$langs->trans("ViewCal").'</span>';
|
||||
$linkback .= '</a>';
|
||||
$linkback .= '</li>';
|
||||
$linkback .= '<li class="noborder litext">';
|
||||
$linkback .= img_picto($langs->trans("ViewWeek"), 'object_calendarweek', 'class="hideonsmartphone pictoactionview"');
|
||||
$linkback .= '<a href="'.DOL_URL_ROOT.'/comm/action/index.php?mode=show_week&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').'">'.$langs->trans("ViewWeek").'</a>';
|
||||
$linkback .= '<a href="'.DOL_URL_ROOT.'/comm/action/index.php?mode=show_week&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').'">';
|
||||
$linkback .= img_picto($langs->trans("ViewWeek"), 'object_calendarweek', 'class="pictoactionview pictofixedwidth"');
|
||||
$linkback .= '<span class="hideonsmartphone">'.$langs->trans("ViewWeek").'</span>';
|
||||
$linkback .= '</a>';
|
||||
$linkback .= '</li>';
|
||||
$linkback .= '<li class="noborder litext">';
|
||||
$linkback .= img_picto($langs->trans("ViewDay"), 'object_calendarday', 'class="hideonsmartphone pictoactionview"');
|
||||
$linkback .= '<a href="'.DOL_URL_ROOT.'/comm/action/index.php?mode=show_day&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').'">'.$langs->trans("ViewDay").'</a>';
|
||||
$linkback .= '<a href="'.DOL_URL_ROOT.'/comm/action/index.php?mode=show_day&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').'">';
|
||||
$linkback .= img_picto($langs->trans("ViewDay"), 'object_calendarday', 'class="pictoactionview pictofixedwidth"');
|
||||
$linkback .= '<span class="hideonsmartphone">'.$langs->trans("ViewDay").'</span>';
|
||||
$linkback .= '</a>';
|
||||
$linkback .= '</li>';
|
||||
$linkback .= '<li class="noborder litext">';
|
||||
$linkback .= img_picto($langs->trans("ViewPerUser"), 'object_calendarperuser', 'class="hideonsmartphone pictoactionview"');
|
||||
$linkback .= '<a href="'.DOL_URL_ROOT.'/comm/action/peruser.php?mode=show_peruser&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').'">'.$langs->trans("ViewPerUser").'</a>';
|
||||
$linkback .= '<a href="'.DOL_URL_ROOT.'/comm/action/peruser.php?mode=show_peruser&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').'">';
|
||||
$linkback .= img_picto($langs->trans("ViewPerUser"), 'object_calendarperuser', 'class="pictoactionview pictofixedwidth"');
|
||||
$linkback .= '<span class="hideonsmartphone">'.$langs->trans("ViewPerUser").'</span>';
|
||||
$linkback .= '</a>';
|
||||
|
||||
//$linkback.=$out;
|
||||
|
||||
|
||||
@ -459,7 +459,7 @@ if ($mode == 'show_day') {
|
||||
|
||||
$nav .= $form->selectDate($dateselect, 'dateselect', 0, 0, 1, '', 1, 0);
|
||||
//$nav .= ' <input type="submit" class="button button-save" name="submitdateselect" value="'.$langs->trans("Refresh").'">';
|
||||
$nav .= '<button type="submit" class="liste_titre button_search" name="button_search_x" value="x"><span class="fa fa-search"></span></button>';
|
||||
$nav .= '<button type="submit" class="liste_titre button_search valignmiddle" name="button_search_x" value="x"><span class="fa fa-search"></span></button>';
|
||||
|
||||
// Must be after the nav definition
|
||||
$paramnodate = $param;
|
||||
@ -581,7 +581,7 @@ if (!empty($conf->use_javascript_ajax)) { // If javascript on
|
||||
$s .= '<div class="nowrap inline-block minheight30"><input type="checkbox" id="check_mytasks" name="check_mytasks" checked disabled> '.$langs->trans("LocalAgenda").' </div>';
|
||||
|
||||
// Holiday calendar
|
||||
$s .= '<div class="nowrap inline-block"><input type="checkbox" id="check_holiday" name="check_holiday" class="check_holiday"><label for="check_holiday"> <span class="check_holiday_text">'.$langs->trans("Holidays").'</span></label> </div>';
|
||||
$s .= '<div class="nowrap inline-block minheight30"><input type="checkbox" id="check_holiday" name="check_holiday" class="check_holiday"><label for="check_holiday"> <span class="check_holiday_text">'.$langs->trans("Holidays").'</span></label> </div>';
|
||||
|
||||
// External calendars
|
||||
if (is_array($showextcals) && count($showextcals) > 0) {
|
||||
@ -612,12 +612,12 @@ if (!empty($conf->use_javascript_ajax)) { // If javascript on
|
||||
$default = '';
|
||||
}
|
||||
|
||||
$s .= '<div class="nowrap inline-block"><input type="checkbox" id="check_ext'.$htmlname.'" name="check_ext'.$htmlname.'" '.$default.'> <label for="check_ext'.$htmlname.'">'.$val['name'].'</label> </div>';
|
||||
$s .= '<div class="nowrap inline-block minheight30"><input type="checkbox" id="check_ext'.$htmlname.'" name="check_ext'.$htmlname.'" '.$default.'> <label for="check_ext'.$htmlname.'">'.$val['name'].'</label> </div>';
|
||||
}
|
||||
}
|
||||
|
||||
// Birthdays
|
||||
$s .= '<div class="nowrap inline-block"><input type="checkbox" id="check_birthday" name="check_birthday" class="check_birthday"><label for="check_birthday"> <span class="check_birthday_text">'.$langs->trans("AgendaShowBirthdayEvents").'</span></label> </div>';
|
||||
$s .= '<div class="nowrap inline-block minheight30"><input type="checkbox" id="check_birthday" name="check_birthday" class="check_birthday"><label for="check_birthday"> <span class="check_birthday_text">'.$langs->trans("AgendaShowBirthdayEvents").'</span></label> </div>';
|
||||
|
||||
// Calendars from hooks
|
||||
$parameters = array(); $object = null;
|
||||
@ -629,8 +629,7 @@ if (!empty($conf->use_javascript_ajax)) { // If javascript on
|
||||
}
|
||||
|
||||
$s .= "\n".'<!-- End div to calendars selectors -->'."\n";
|
||||
} else // If javascript off
|
||||
{
|
||||
} else { // If javascript off
|
||||
$newparam = $param; // newparam is for birthday links
|
||||
$newparam = preg_replace('/showbirthday=[0-1]/i', 'showbirthday='.(empty($showbirthday) ? 1 : 0), $newparam);
|
||||
if (!preg_match('/showbirthday=/i', $newparam)) {
|
||||
@ -722,7 +721,7 @@ if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= " AND (a.fk_soc IS NULL OR sc.fk_user = ".((int) $user->id).")";
|
||||
}
|
||||
if ($socid > 0) {
|
||||
$sql .= ' AND a.fk_soc = '.$socid;
|
||||
$sql .= " AND a.fk_soc = ".((int) $socid);
|
||||
}
|
||||
// We must filter on assignement table
|
||||
if ($filtert > 0 || $usergroup > 0) {
|
||||
|
||||
@ -287,17 +287,17 @@ if ((GETPOST('confirm_savestatement', 'alpha') || GETPOST('confirm_reconcile', '
|
||||
if ($search_description) {
|
||||
$param .= '&search_description='.urlencode($search_description);
|
||||
}
|
||||
if ($search_start_dt) {
|
||||
$param .= '&search_start_dt='.urlencode($search_start_dt);
|
||||
if (dol_strlen($search_dt_start) > 0) {
|
||||
$param .= '&search_start_dtmonth='.GETPOST('search_start_dtmonth', 'int').'&search_start_dtday='.GETPOST('search_start_dtday', 'int').'&search_start_dtyear='.GETPOST('search_start_dtyear', 'int');
|
||||
}
|
||||
if ($search_end_dt) {
|
||||
$param .= '&search_end_dt='.urlencode($search_end_dt);
|
||||
if (dol_strlen($search_dt_end) > 0) {
|
||||
$param .= '&search_end_dtmonth='.GETPOST('search_end_dtmonth', 'int').'&search_end_dtday='.GETPOST('search_end_dtday', 'int').'&search_end_dtyear='.GETPOST('search_end_dtyear', 'int');
|
||||
}
|
||||
if ($search_start_dv) {
|
||||
$param .= '&search_start_dv='.urlencode($search_start_dv);
|
||||
if (dol_strlen($search_dv_start) > 0) {
|
||||
$param .= '&search_start_dvmonth='.GETPOST('search_start_dvmonth', 'int').'&search_start_dvday='.GETPOST('search_start_dvday', 'int').'&search_start_dvyear='.GETPOST('search_start_dvyear', 'int');
|
||||
}
|
||||
if ($search_end_dv) {
|
||||
$param .= '&search_end_dv='.urlencode($search_end_dv);
|
||||
if (dol_strlen($search_dv_end) > 0) {
|
||||
$param .= '&search_end_dvmonth='.GETPOST('search_end_dvmonth', 'int').'&search_end_dvday='.GETPOST('search_end_dvday', 'int').'&search_end_dvyear='.GETPOST('search_end_dvyear', 'int');
|
||||
}
|
||||
if ($search_type) {
|
||||
$param .= '&search_type='.urlencode($search_type);
|
||||
@ -622,14 +622,14 @@ if ($search_thirdparty_user) {
|
||||
$sql.= " ( SELECT bu.fk_bank FROM ".MAIN_DB_PREFIX."bank_url AS bu";
|
||||
$sql.= " JOIN ".MAIN_DB_PREFIX."bank AS b2 ON b2.rowid = bu.fk_bank";
|
||||
$sql.= " JOIN ".MAIN_DB_PREFIX."user AS subUser ON (bu.type = 'user' AND bu.url_id = subUser.rowid)";
|
||||
$sql.= " WHERE ". natural_search(array("subUser.firstname", "subUser.lastname"), $search_thirdparty_user, '', 1)."))";
|
||||
$sql.= " WHERE ". natural_search(array("subUser.firstname", "subUser.lastname"), $search_thirdparty_user, '', 1).")";
|
||||
|
||||
$sql.= " OR b.rowid IN ";
|
||||
$sql.= " ( SELECT bu.fk_bank FROM ".MAIN_DB_PREFIX."bank_url AS bu";
|
||||
$sql.= " JOIN ".MAIN_DB_PREFIX."bank AS b2 ON b2.rowid = bu.fk_bank";
|
||||
$sql.= " JOIN ".MAIN_DB_PREFIX."societe AS subSoc ON (bu.type = 'company' AND bu.url_id = subSoc.rowid)";
|
||||
$sql.= " WHERE ". natural_search(array("subSoc.nom"), $search_thirdparty_user, '', 1);
|
||||
$sql.= ")";
|
||||
$sql.= "))";
|
||||
}
|
||||
if ($search_description) {
|
||||
$search_description_to_use = $search_description;
|
||||
|
||||
@ -347,7 +347,7 @@ if (empty($numref)) {
|
||||
$balancestart[$objp->numr] = $obj->amount;
|
||||
$db->free($resql);
|
||||
}
|
||||
print '<td class="right"><span class="amount">'.price($balancestart[$objp->numr], '', $langs, 1, -1, -1, $conf->currency).'</span></td>';
|
||||
print '<td class="right"><span class="amount">'.price($balancestart[$objp->numr], '', $langs, 1, -1, -1, empty($object->currency_code)?$conf->currency:$object->currency_code).'</span></td>';
|
||||
|
||||
// Calculate end amount
|
||||
$sql = "SELECT sum(b.amount) as amount";
|
||||
@ -360,7 +360,7 @@ if (empty($numref)) {
|
||||
$content[$objp->numr] = $obj->amount;
|
||||
$db->free($resql);
|
||||
}
|
||||
print '<td class="right"><span class="amount">'.price(($balancestart[$objp->numr] + $content[$objp->numr]), '', $langs, 1, -1, -1, $conf->currency).'</span></td>';
|
||||
print '<td class="right"><span class="amount">'.price(($balancestart[$objp->numr] + $content[$objp->numr]), '', $langs, 1, -1, -1, empty($object->currency_code)?$conf->currency:$object->currency_code).'</span></td>';
|
||||
|
||||
print '<td class="center">';
|
||||
if ($user->rights->banque->consolidate && $action != 'editbankreceipt') {
|
||||
|
||||
@ -4104,10 +4104,10 @@ if ($action == 'create') {
|
||||
}
|
||||
|
||||
// Confirmation du classement paye
|
||||
if ($action == 'paid' && ($resteapayer <= 0 || (!empty($conf->global->INVOICE_CAN_ADD_PAYMENT_EVEN_IF_ALREADY_PAID) && $resteapayer == $object->total_ttc))) {
|
||||
if ($action == 'paid' && ($resteapayer <= 0 || (!empty($conf->global->INVOICE_CAN_SET_PAID_EVEN_IF_PARTIALLY_PAID) && $resteapayer == $object->total_ttc))) {
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id, $langs->trans('ClassifyPaid'), $langs->trans('ConfirmClassifyPaidBill', $object->ref), 'confirm_paid', '', "yes", 1);
|
||||
}
|
||||
if ($action == 'paid' && $resteapayer > 0 && (empty($conf->global->INVOICE_CAN_ADD_PAYMENT_EVEN_IF_ALREADY_PAID) || $resteapayer != $object->total_ttc)) {
|
||||
if ($action == 'paid' && $resteapayer > 0 && (empty($conf->global->INVOICE_CAN_SET_PAID_EVEN_IF_PARTIALLY_PAID) || $resteapayer != $object->total_ttc)) {
|
||||
$close = array();
|
||||
// Code
|
||||
$i = 0;
|
||||
@ -5436,7 +5436,8 @@ if ($action == 'create') {
|
||||
}
|
||||
}
|
||||
|
||||
$sumofpayment = $object->getSommePaiement();
|
||||
$sumofpayment = $totalpaye;
|
||||
$sumofpaymentall = $totalpaye + $totalcreditnotes + $totaldeposits;
|
||||
|
||||
// Reverse back money or convert to reduction
|
||||
if ($object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_SITUATION) {
|
||||
@ -5460,8 +5461,8 @@ if ($action == 'create') {
|
||||
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=converttoreduc" title="'.dol_escape_htmltag($langs->trans("ConfirmConvertToReduc2")).'">'.$langs->trans('ConvertToReduc').'</a>';
|
||||
}
|
||||
// For deposit invoice
|
||||
if ($object->type == Facture::TYPE_DEPOSIT && $usercancreate && $object->statut > 0 && empty($discount->id)) {
|
||||
if (price2num($object->total_ttc, 'MT') == price2num($sumofpayment, 'MT')) {
|
||||
if ($object->type == Facture::TYPE_DEPOSIT && $usercancreate && $object->statut > Facture::STATUS_DRAFT && empty($discount->id)) {
|
||||
if (price2num($object->total_ttc, 'MT') == price2num($sumofpaymentall, 'MT')) {
|
||||
// We can close a down payment only if paid amount is same than amount of down payment (by definition)
|
||||
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=converttoreduc">'.$langs->trans('ConvertToReduc').'</a>';
|
||||
} else {
|
||||
@ -5472,12 +5473,12 @@ if ($action == 'create') {
|
||||
|
||||
// Classify paid
|
||||
if ($object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $usercanissuepayment && (
|
||||
($object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT && ($resteapayer <= 0 || (!empty($conf->global->INVOICE_CAN_ADD_PAYMENT_EVEN_IF_ALREADY_PAID) && $object->total_ttc == $resteapayer))) ||
|
||||
($object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT && ($resteapayer <= 0 || (!empty($conf->global->INVOICE_CAN_SET_PAID_EVEN_IF_PARTIALLY_PAID) && $object->total_ttc == $resteapayer))) ||
|
||||
($object->type == Facture::TYPE_CREDIT_NOTE && $resteapayer >= 0) ||
|
||||
($object->type == Facture::TYPE_DEPOSIT && $object->total_ttc > 0)
|
||||
)
|
||||
) {
|
||||
if ($object->type == Facture::TYPE_DEPOSIT && price2num($object->total_ttc, 'MT') != price2num($sumofpayment, 'MT')) {
|
||||
if ($object->type == Facture::TYPE_DEPOSIT && price2num($object->total_ttc, 'MT') != price2num($sumofpaymentall, 'MT')) {
|
||||
// We can close a down payment only if paid amount is same than amount of down payment (by definition)
|
||||
print '<span class="butActionRefused" title="'.$langs->trans("AmountPaidMustMatchAmountOfDownPayment").'">'.$langs->trans('ClassifyPaid').'</span>';
|
||||
} else {
|
||||
@ -5486,7 +5487,7 @@ if ($action == 'create') {
|
||||
}
|
||||
|
||||
// Classify 'closed not completely paid' (possible if validated and not yet filed paid)
|
||||
if ($object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $resteapayer > 0 && (empty($conf->global->INVOICE_CAN_ADD_PAYMENT_EVEN_IF_ALREADY_PAID) || $resteapayer != $object->total_ttc) && $usercanissuepayment) {
|
||||
if ($object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $resteapayer > 0 && (empty($conf->global->INVOICE_CAN_SET_PAID_EVEN_IF_PARTIALLY_PAID) || $resteapayer != $object->total_ttc) && $usercanissuepayment) {
|
||||
if ($totalpaye > 0 || $totalcreditnotes > 0) {
|
||||
// If one payment or one credit note was linked to this invoice
|
||||
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=paid">'.$langs->trans('ClassifyPaidPartially').'</a>';
|
||||
|
||||
@ -3147,7 +3147,7 @@ class Facture extends CommonInvoice
|
||||
$fk_remise_except = '',
|
||||
$price_base_type = 'HT',
|
||||
$pu_ttc = 0,
|
||||
$type = self::TYPE_STANDARD,
|
||||
$type = 0,
|
||||
$rang = -1,
|
||||
$special_code = 0,
|
||||
$origin = '',
|
||||
|
||||
0
htdocs/compta/tva/card.php
Executable file → Normal file
@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/societe/consumption.php
|
||||
* \file htdocs/contact/consumption.php
|
||||
* \ingroup societe
|
||||
* \brief Add a tab on thirpdarty view to list all products/services bought or sells by thirdparty
|
||||
*/
|
||||
@ -32,10 +32,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
|
||||
// Security check
|
||||
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
|
||||
|
||||
$id = GETPOST('id', 'int');
|
||||
|
||||
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
|
||||
$object = new Contact($db);
|
||||
if ($id > 0) {
|
||||
$object->fetch($id);
|
||||
@ -86,6 +86,8 @@ $langs->loadLangs(array("companies", "bills", "orders", "suppliers", "propal", "
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('consumptioncontact'));
|
||||
|
||||
$result = restrictedArea($user, 'contact', $object->id, 'socpeople&societe');
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -196,7 +198,7 @@ if ($type_element == 'fichinter') { // Customer : show products from invoices
|
||||
$sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, \'1\' as doc_type, f.datec as dateprint, f.fk_statut as status, tc.libelle as type_contact_label, ';
|
||||
$tables_from = MAIN_DB_PREFIX.'fichinterdet d';
|
||||
$tables_from .= ' LEFT JOIN '.MAIN_DB_PREFIX.'fichinter as f ON d.fk_fichinter=f.rowid';
|
||||
$tables_from .= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=f.rowid AND ec.fk_socpeople='.$object->id;
|
||||
$tables_from .= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=f.rowid AND ec.fk_socpeople = '.((int) $object->id);
|
||||
$tables_from .= ' INNER JOIN '.MAIN_DB_PREFIX."c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='fichinter' and tc.source='external' and tc.active=1)";
|
||||
$where = ' WHERE f.entity IN ('.getEntity('ficheinter').')';
|
||||
$dateprint = 'f.datec';
|
||||
@ -208,7 +210,7 @@ if ($type_element == 'fichinter') { // Customer : show products from invoices
|
||||
$tables_from = MAIN_DB_PREFIX.'facturedet d';
|
||||
$tables_from .= ' LEFT JOIN '.MAIN_DB_PREFIX.'facture as f ON d.fk_facture=f.rowid';
|
||||
$tables_from .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product p ON d.fk_product=p.rowid';
|
||||
$tables_from .= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=f.rowid AND ec.fk_socpeople='.$object->id;
|
||||
$tables_from .= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=f.rowid AND ec.fk_socpeople = '.((int) $object->id);
|
||||
$tables_from .= ' INNER JOIN '.MAIN_DB_PREFIX."c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='facture' and tc.source='external' and tc.active=1)";
|
||||
$where = " WHERE f.entity IN (".getEntity('invoice').")";
|
||||
$dateprint = 'f.datef';
|
||||
@ -221,7 +223,7 @@ if ($type_element == 'fichinter') { // Customer : show products from invoices
|
||||
$tables_from = MAIN_DB_PREFIX.'propaldet d';
|
||||
$tables_from .= ' LEFT JOIN '.MAIN_DB_PREFIX.'propal as c ON d.fk_propal=c.rowid';
|
||||
$tables_from .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product p ON d.fk_product=p.rowid';
|
||||
$tables_from .= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=c.rowid AND ec.fk_socpeople='.$object->id;
|
||||
$tables_from .= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=c.rowid AND ec.fk_socpeople = '.((int) $object->id);
|
||||
$tables_from .= ' INNER JOIN '.MAIN_DB_PREFIX."c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='propal' and tc.source='external' and tc.active=1)";
|
||||
$where = ' WHERE c.entity IN ('.getEntity('propal').')';
|
||||
$datePrint = 'c.datep';
|
||||
@ -234,7 +236,7 @@ if ($type_element == 'fichinter') { // Customer : show products from invoices
|
||||
$tables_from = MAIN_DB_PREFIX.'commandedet d';
|
||||
$tables_from .= ' LEFT JOIN '.MAIN_DB_PREFIX.'commande as c ON d.fk_commande=c.rowid';
|
||||
$tables_from .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product p ON d.fk_product=p.rowid';
|
||||
$tables_from .= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=c.rowid AND ec.fk_socpeople='.$object->id;
|
||||
$tables_from .= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=c.rowid AND ec.fk_socpeople = '.((int) $object->id);
|
||||
$tables_from .= ' INNER JOIN '.MAIN_DB_PREFIX."c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='commande' and tc.source='external' and tc.active=1)";
|
||||
$where = ' WHERE c.entity IN ('.getEntity('order').')';
|
||||
$dateprint = 'c.date_commande';
|
||||
@ -247,7 +249,7 @@ if ($type_element == 'fichinter') { // Customer : show products from invoices
|
||||
$tables_from = MAIN_DB_PREFIX.'facture_fourn_det d';
|
||||
$tables_from .= ' LEFT JOIN '.MAIN_DB_PREFIX.'facture_fourn as f ON d.fk_facture_fourn=f.rowid';
|
||||
$tables_from .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product p ON d.fk_product=p.rowid';
|
||||
$tables_from .= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=f.rowid AND ec.fk_socpeople='.$object->id;
|
||||
$tables_from .= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=f.rowid AND ec.fk_socpeople = '.((int) $object->id);
|
||||
$tables_from .= ' INNER JOIN '.MAIN_DB_PREFIX."c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='invoice_supplier' and tc.source='external' and tc.active=1)";
|
||||
$where = ' WHERE f.entity IN ('.getEntity($documentstatic->element).')';
|
||||
$dateprint = 'f.datef';
|
||||
@ -272,7 +274,7 @@ if ($type_element == 'fichinter') { // Customer : show products from invoices
|
||||
$tables_from = MAIN_DB_PREFIX.'commande_fournisseurdet d';
|
||||
$tables_from .= ' LEFT JOIN '.MAIN_DB_PREFIX.'commande_fournisseur as c ON d.fk_commande=c.rowid';
|
||||
$tables_from .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product p ON d.fk_product=p.rowid';
|
||||
$tables_from .= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=c.rowid AND ec.fk_socpeople='.$object->id;
|
||||
$tables_from .= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=c.rowid AND ec.fk_socpeople = '.((int) $object->id);
|
||||
$tables_from .= ' INNER JOIN '.MAIN_DB_PREFIX."c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='order_supplier' and tc.source='external' and tc.active=1)";
|
||||
$where = ' WHERE c.entity IN ('.getEntity($documentstatic->element).')';
|
||||
$dateprint = 'c.date_valid';
|
||||
@ -286,7 +288,7 @@ if ($type_element == 'fichinter') { // Customer : show products from invoices
|
||||
$tables_from = MAIN_DB_PREFIX.'contratdet d';
|
||||
$tables_from .= ' LEFT JOIN '.MAIN_DB_PREFIX.'contrat as c ON d.fk_contrat=c.rowid';
|
||||
$tables_from .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product p ON d.fk_product=p.rowid';
|
||||
$tables_from .= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=c.rowid AND ec.fk_socpeople='.$object->id;
|
||||
$tables_from .= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=c.rowid AND ec.fk_socpeople = '.((int) $object->id);
|
||||
$tables_from .= ' INNER JOIN '.MAIN_DB_PREFIX."c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='contrat' and tc.source='external' and tc.active=1)";
|
||||
$where = ' WHERE c.entity IN ('.getEntity('contrat').')';
|
||||
$dateprint = 'c.date_valid';
|
||||
|
||||
@ -1537,11 +1537,11 @@ if ($action == 'create') {
|
||||
|
||||
// Margin
|
||||
if (!empty($conf->margin->enabled) && !empty($conf->global->MARGIN_SHOW_ON_CONTRACT)) {
|
||||
print '<td class="right nowrap">'.price($objp->pa_ht).'</td>';
|
||||
print '<td class="right nowraponall">'.price($objp->pa_ht).'</td>';
|
||||
}
|
||||
|
||||
// Icon move, update et delete (statut contrat 0=brouillon,1=valide,2=ferme)
|
||||
print '<td class="nowrap right">';
|
||||
print '<td class="nowraponall right">';
|
||||
if ($user->rights->contrat->creer && count($arrayothercontracts) && ($object->statut >= 0)) {
|
||||
print '<!-- link to move service line into another contract -->';
|
||||
print '<a class="reposition marginrightonly" style="padding-left: 5px;" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=move&token='.newToken().'&rowid='.$objp->rowid.'">';
|
||||
|
||||
@ -657,8 +657,8 @@ if ($massaction == 'confirm_createbills') { // Create bills from orders.
|
||||
// If we want one invoice per order or if there is no first invoice yet for this thirdparty.
|
||||
$objecttmp->socid = $cmd->socid;
|
||||
$objecttmp->type = $objecttmp::TYPE_STANDARD;
|
||||
$objecttmp->cond_reglement_id = ($cmd->cond_reglement_id || $cmd->thirdparty->cond_reglement_id);
|
||||
$objecttmp->mode_reglement_id = ($cmd->mode_reglement_id || $cmd->thirdparty->mode_reglement_id);
|
||||
$objecttmp->cond_reglement_id = !empty($cmd->cond_reglement_id) ? $cmd->cond_reglement_id : $cmd->thirdparty->cond_reglement_id;
|
||||
$objecttmp->mode_reglement_id = !empty($cmd->mode_reglement_id) ? $cmd->mode_reglement_id : $cmd->thirdparty->mode_reglement_id;
|
||||
|
||||
$objecttmp->fk_project = $cmd->fk_project;
|
||||
$objecttmp->multicurrency_code = $cmd->multicurrency_code;
|
||||
|
||||
@ -134,7 +134,7 @@ class box_accountancy_last_manual_entries extends ModeleBoxes
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="nowraponall right"',
|
||||
'td' => 'class="nowraponall right amount"',
|
||||
'text' => price($amount, 0, $langs, 0, -1, -1, $conf->currency),
|
||||
);
|
||||
|
||||
|
||||
@ -174,7 +174,7 @@ class box_activity extends ModeleBoxes
|
||||
$totalnb += $data[$j]->nb;
|
||||
|
||||
$this->info_box_contents[$line][3] = array(
|
||||
'td' => 'class="nowraponall right"',
|
||||
'td' => 'class="nowraponall right amount"',
|
||||
'text' => price($data[$j]->Mnttot, 1, $langs, 0, 0, -1, $conf->currency),
|
||||
);
|
||||
$this->info_box_contents[$line][4] = array(
|
||||
@ -262,7 +262,7 @@ class box_activity extends ModeleBoxes
|
||||
$totalnb += $data[$j]->nb;
|
||||
|
||||
$this->info_box_contents[$line][3] = array(
|
||||
'td' => 'class="nowraponall right"',
|
||||
'td' => 'class="nowraponall right amount"',
|
||||
'text' => price($data[$j]->Mnttot, 1, $langs, 0, 0, -1, $conf->currency),
|
||||
);
|
||||
$this->info_box_contents[$line][4] = array(
|
||||
@ -350,7 +350,7 @@ class box_activity extends ModeleBoxes
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][3] = array(
|
||||
'td' => 'class="nowraponall right"',
|
||||
'td' => 'class="nowraponall right amount"',
|
||||
'text' => price($data[$j]->Mnttot, 1, $langs, 0, 0, -1, $conf->currency)
|
||||
);
|
||||
|
||||
@ -433,7 +433,7 @@ class box_activity extends ModeleBoxes
|
||||
);
|
||||
$totalnb += $data[$j]->nb;
|
||||
$this->info_box_contents[$line][3] = array(
|
||||
'td' => 'class="nowraponall right"',
|
||||
'td' => 'class="nowraponall right amount"',
|
||||
'text' => price($data[$j]->Mnttot, 1, $langs, 0, 0, -1, $conf->currency),
|
||||
);
|
||||
$this->info_box_contents[$line][4] = array(
|
||||
|
||||
@ -163,7 +163,7 @@ class box_commandes extends ModeleBoxes
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="nowraponall right"',
|
||||
'td' => 'class="nowraponall right amount"',
|
||||
'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency),
|
||||
);
|
||||
|
||||
|
||||
@ -141,8 +141,11 @@ class box_comptes extends ModeleBoxes
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right nowraponall"',
|
||||
'text' => price($solde, 0, $langs, 1, -1, -1, $objp->currency_code)
|
||||
'td' => 'class="nowraponall right amount"',
|
||||
'text' => '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?id='.$account_static->id.'">'
|
||||
.price($solde, 0, $langs, 1, -1, -1, $objp->currency_code)
|
||||
.'</a>',
|
||||
'asis' => 1,
|
||||
);
|
||||
|
||||
$line++;
|
||||
@ -161,7 +164,7 @@ class box_comptes extends ModeleBoxes
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="liste_total right nowraponall"',
|
||||
'td' => 'class="liste_total nowraponall right amount"',
|
||||
'text' => price($solde, 0, $langs, 0, -1, -1, $key)
|
||||
);
|
||||
$line++;
|
||||
|
||||
@ -105,7 +105,8 @@ class box_dolibarr_state_board extends ModeleBoxes
|
||||
'supplier_invoices',
|
||||
'contracts',
|
||||
'interventions',
|
||||
'ticket'
|
||||
'ticket',
|
||||
'dolresource'
|
||||
);
|
||||
$conditions = array(
|
||||
'users' => $user->rights->user->user->lire,
|
||||
@ -132,7 +133,8 @@ class box_dolibarr_state_board extends ModeleBoxes
|
||||
'projects' => !empty($conf->projet->enabled) && $user->rights->projet->lire,
|
||||
'expensereports' => !empty($conf->expensereport->enabled) && $user->rights->expensereport->lire,
|
||||
'holidays' => !empty($conf->holiday->enabled) && $user->rights->holiday->read,
|
||||
'ticket' => !empty($conf->ticket->enabled) && $user->rights->ticket->read
|
||||
'ticket' => !empty($conf->ticket->enabled) && $user->rights->ticket->read,
|
||||
'dolresource' => !empty($conf->resource->enabled) && $user->rights->resource->read
|
||||
);
|
||||
$classes = array(
|
||||
'users' => 'User',
|
||||
@ -156,6 +158,7 @@ class box_dolibarr_state_board extends ModeleBoxes
|
||||
'expensereports' => 'ExpenseReport',
|
||||
'holidays' => 'Holiday',
|
||||
'ticket' => 'Ticket',
|
||||
'dolresource' => 'Dolresource'
|
||||
);
|
||||
$includes = array(
|
||||
'users' => DOL_DOCUMENT_ROOT . "/user/class/user.class.php",
|
||||
@ -178,7 +181,8 @@ class box_dolibarr_state_board extends ModeleBoxes
|
||||
'projects' => DOL_DOCUMENT_ROOT . "/projet/class/project.class.php",
|
||||
'expensereports' => DOL_DOCUMENT_ROOT . "/expensereport/class/expensereport.class.php",
|
||||
'holidays' => DOL_DOCUMENT_ROOT . "/holiday/class/holiday.class.php",
|
||||
'ticket' => DOL_DOCUMENT_ROOT . "/ticket/class/ticket.class.php"
|
||||
'ticket' => DOL_DOCUMENT_ROOT . "/ticket/class/ticket.class.php",
|
||||
'dolresource' => DOL_DOCUMENT_ROOT . "/resource/class/dolresource.class.php"
|
||||
);
|
||||
$links = array(
|
||||
'users' => DOL_URL_ROOT . '/user/list.php',
|
||||
@ -201,7 +205,8 @@ class box_dolibarr_state_board extends ModeleBoxes
|
||||
'projects' => DOL_URL_ROOT . '/projet/list.php?mainmenu=project',
|
||||
'expensereports' => DOL_URL_ROOT . '/expensereport/list.php?mainmenu=hrm&leftmenu=expensereport',
|
||||
'holidays' => DOL_URL_ROOT . '/holiday/list.php?mainmenu=hrm&leftmenu=holiday',
|
||||
'ticket' => DOL_URL_ROOT . '/ticket/list.php?leftmenu=ticket'
|
||||
'ticket' => DOL_URL_ROOT . '/ticket/list.php?leftmenu=ticket',
|
||||
'dolresource' => DOL_URL_ROOT . '/resource/list.php?mainmenu=tools',
|
||||
);
|
||||
$titres = array(
|
||||
'users' => "Users",
|
||||
@ -225,6 +230,7 @@ class box_dolibarr_state_board extends ModeleBoxes
|
||||
'expensereports' => "ExpenseReports",
|
||||
'holidays' => "Holidays",
|
||||
'ticket' => "Ticket",
|
||||
'dolresource' => "Resources",
|
||||
);
|
||||
$langfile = array(
|
||||
'customers' => "companies",
|
||||
|
||||
@ -183,7 +183,7 @@ class box_factures_fourn extends ModeleBoxes
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right nowraponall"',
|
||||
'td' => 'class="nowraponall right amount"',
|
||||
'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency),
|
||||
);
|
||||
|
||||
|
||||
@ -170,7 +170,7 @@ class box_factures_fourn_imp extends ModeleBoxes
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="nowraponall right"',
|
||||
'td' => 'class="nowraponall right amount"',
|
||||
'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency),
|
||||
);
|
||||
|
||||
|
||||
@ -219,7 +219,7 @@ class box_funnel_of_prospection extends ModeleBoxes
|
||||
if (!$conf->use_javascript_ajax) {
|
||||
$stringtoprint .= '<tr class="oddeven">';
|
||||
$stringtoprint .= '<td>'.$labelStatus.'</td>';
|
||||
$stringtoprint .= '<td class="right"><a href="list.php?statut='.$status.'">'.price((isset($valsamount[$status]) ? (float) $valsamount[$status] : 0), 0, '', 1, -1, -1, $conf->currency).'</a></td>';
|
||||
$stringtoprint .= '<td class="nowraponall right amount"><a href="list.php?statut='.$status.'">'.price((isset($valsamount[$status]) ? (float) $valsamount[$status] : 0), 0, '', 1, -1, -1, $conf->currency).'</a></td>';
|
||||
$stringtoprint .= "</tr>\n";
|
||||
}
|
||||
}
|
||||
@ -277,7 +277,7 @@ class box_funnel_of_prospection extends ModeleBoxes
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'tr' => 'class="oddeven"',
|
||||
'td' => 'class="right "',
|
||||
'td' => 'class="nowraponall right amount"',
|
||||
'maxlength' => 500,
|
||||
'text' => price($totalamount, 0, '', 1, -1, -1, $conf->currency)
|
||||
);
|
||||
@ -290,7 +290,7 @@ class box_funnel_of_prospection extends ModeleBoxes
|
||||
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right "',
|
||||
'td' => 'class="nowraponall right amount"',
|
||||
'maxlength' => 500,
|
||||
'text' => price(price2num($ponderated_opp_amount, 'MT'), 0, '', 1, -1, -1, $conf->currency)
|
||||
);
|
||||
|
||||
@ -152,8 +152,8 @@ class box_members_last_subscriptions extends ModeleBoxes
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right" width="18"',
|
||||
'text' => '<span class="amount">'.price($obj->subscription).'</span>',
|
||||
'td' => 'class="nowraponall right amount" width="18"',
|
||||
'text' => price($obj->subscription),
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
|
||||
@ -179,12 +179,12 @@ class box_members_subscriptions_by_year extends ModeleBoxes
|
||||
'text' => $Number[$key],
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => '<span class="amount">'.price($value).'</span>',
|
||||
'td' => 'class="nowraponall right amount"',
|
||||
'text' => price($value),
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => '<span class="amount">'.price(price2num($value / $Number[$key], 'MT')).'</span>',
|
||||
'td' => 'class="nowraponall right amount"',
|
||||
'text' => price(price2num($value / $Number[$key], 'MT')),
|
||||
);
|
||||
$line++;
|
||||
}
|
||||
@ -204,12 +204,12 @@ class box_members_subscriptions_by_year extends ModeleBoxes
|
||||
'text' => $numb,
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="liste_total right"',
|
||||
'text' => '<span class="amount">'.price($tot).'</span>',
|
||||
'td' => 'class="liste_total nowraponall right amount"',
|
||||
'text' => price($tot),
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="liste_total right"',
|
||||
'text' => '<span class="amount">'.price(price2num($numb > 0 ? ($tot / $numb) : 0, 'MT')).'</span>',
|
||||
'td' => 'class="liste_total nowraponall right amount"',
|
||||
'text' => price(price2num($numb > 0 ? ($tot / $numb) : 0, 'MT')),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -180,7 +180,7 @@ class box_produits extends ModeleBoxes
|
||||
}
|
||||
}
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'td' => 'class="nowraponall right amount"',
|
||||
'text' => $price,
|
||||
);
|
||||
|
||||
|
||||
@ -187,7 +187,7 @@ class box_produits_alerte_stock extends ModeleBoxes
|
||||
}
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right nowraponall"',
|
||||
'td' => 'class="nowraponall right amount"',
|
||||
'text' => $price,
|
||||
);
|
||||
|
||||
@ -210,7 +210,7 @@ class box_produits_alerte_stock extends ModeleBoxes
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right" width="18"',
|
||||
'text' => '<span class="statusrefbuy">'.$productstatic->LibStatut($objp->tobuy, 3, 0).'</span>',
|
||||
'text' => '<span class="statusrefbuy">'.$productstatic->LibStatut($objp->tobuy, 3, 1).'</span>',
|
||||
'asis' => 1
|
||||
);
|
||||
|
||||
|
||||
@ -160,7 +160,7 @@ class box_propales extends ModeleBoxes
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right nowraponall"',
|
||||
'td' => 'class="nowraponall right amount"',
|
||||
'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency),
|
||||
);
|
||||
|
||||
|
||||
@ -147,7 +147,7 @@ class box_supplier_orders extends ModeleBoxes
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right nowraponall"',
|
||||
'td' => 'class="nowraponall right amount"',
|
||||
'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency),
|
||||
);
|
||||
|
||||
|
||||
@ -151,7 +151,7 @@ class box_supplier_orders_awaiting_reception extends ModeleBoxes
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right nowraponall"',
|
||||
'td' => 'class="nowraponall right amount"',
|
||||
'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency),
|
||||
);
|
||||
|
||||
|
||||
@ -7615,7 +7615,7 @@ abstract class CommonObject
|
||||
$selectkey = $InfoFieldList[2];
|
||||
}
|
||||
|
||||
if (!isInDb($value_arr, $InfoFieldList[0], $selectkey)) {
|
||||
if (!$validate->isInDb($value_arr, $InfoFieldList[0], $selectkey)) {
|
||||
$this->setFieldError($fieldKey, $validate->error);
|
||||
return false;
|
||||
} else { return true; }
|
||||
@ -8100,7 +8100,7 @@ abstract class CommonObject
|
||||
* @param string $sdir Directory to scan (full absolute path)
|
||||
* @param int $size 0=original size, 1='small' use thumbnail if possible
|
||||
* @param int $nbmax Nombre maximum de photos (0=pas de max)
|
||||
* @param int $nbbyrow Number of image per line or -1 to use div. Used only if size=1.
|
||||
* @param int $nbbyrow Number of image per line or -1 to use div separator or 0 to use no separator. Used only if size=1 or 'small'.
|
||||
* @param int $showfilename 1=Show filename
|
||||
* @param int $showaction 1=Show icon with action links (resize, delete)
|
||||
* @param int $maxHeight Max height of original image when size='small' (so we can use original even if small requested). If 0, always use 'small' thumb image.
|
||||
@ -8219,26 +8219,28 @@ abstract class CommonObject
|
||||
$alt = '';
|
||||
}
|
||||
|
||||
$addphotorefcss = 1;
|
||||
|
||||
if ($usesharelink) {
|
||||
if ($val['share']) {
|
||||
if (empty($maxHeight) || $photo_vignette && $imgarray['height'] > $maxHeight) {
|
||||
$return .= '<!-- Show original file (thumb not yet available with shared links) -->';
|
||||
$return .= '<img class="photo photowithmargin" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?hashp='.urlencode($val['share']).'" title="'.dol_escape_htmltag($alt).'">';
|
||||
$return .= '<img class="photo photowithmargin'.($addphotorefcss ? ' photoref' : '').'" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?hashp='.urlencode($val['share']).'" title="'.dol_escape_htmltag($alt).'">';
|
||||
} else {
|
||||
$return .= '<!-- Show original file -->';
|
||||
$return .= '<img class="photo photowithmargin" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?hashp='.urlencode($val['share']).'" title="'.dol_escape_htmltag($alt).'">';
|
||||
$return .= '<img class="photo photowithmargin'.($addphotorefcss ? ' photoref' : '').'" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?hashp='.urlencode($val['share']).'" title="'.dol_escape_htmltag($alt).'">';
|
||||
}
|
||||
} else {
|
||||
$return .= '<!-- Show nophoto file (because file is not shared) -->';
|
||||
$return .= '<img class="photo photowithmargin" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png" title="'.dol_escape_htmltag($alt).'">';
|
||||
$return .= '<img class="photo photowithmargin'.($addphotorefcss ? ' photoref' : '').'" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png" title="'.dol_escape_htmltag($alt).'">';
|
||||
}
|
||||
} else {
|
||||
if (empty($maxHeight) || $photo_vignette && $imgarray['height'] > $maxHeight) {
|
||||
$return .= '<!-- Show thumb -->';
|
||||
$return .= '<img class="photo photowithmargin maxwidth150onsmartphone maxwidth200" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$this->entity.'&file='.urlencode($pdirthumb.$photo_vignette).'" title="'.dol_escape_htmltag($alt).'">';
|
||||
$return .= '<img class="photo photowithmargin'.($addphotorefcss ? ' photoref' : '').' maxwidth150onsmartphone maxwidth200" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$this->entity.'&file='.urlencode($pdirthumb.$photo_vignette).'" title="'.dol_escape_htmltag($alt).'">';
|
||||
} else {
|
||||
$return .= '<!-- Show original file -->';
|
||||
$return .= '<img class="photo photowithmargin" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$this->entity.'&file='.urlencode($pdir.$photo).'" title="'.dol_escape_htmltag($alt).'">';
|
||||
$return .= '<img class="photo photowithmargin'.($addphotorefcss ? ' photoref' : '').'" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$this->entity.'&file='.urlencode($pdir.$photo).'" title="'.dol_escape_htmltag($alt).'">';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -156,7 +156,7 @@ class DolEditor
|
||||
$skin = 'moono-lisa'; // default with ckeditor 4.6 : moono-lisa
|
||||
}
|
||||
|
||||
$pluginstodisable = 'flash';
|
||||
$pluginstodisable = 'elementspath,save,flash';
|
||||
if (!empty($conf->dol_optimize_smallscreen)) {
|
||||
$pluginstodisable .= ',scayt,wsc,find,undo';
|
||||
}
|
||||
|
||||
@ -6565,7 +6565,7 @@ class Form
|
||||
unset($TDurationTypes[$value]);
|
||||
}
|
||||
|
||||
$retstring = '<select class="flat" id="select_'.$prefix.'type_duration" name="'.$prefix.'type_duration">';
|
||||
$retstring = '<select class="flat minwidth75 maxwidth100" id="select_'.$prefix.'type_duration" name="'.$prefix.'type_duration">';
|
||||
foreach ($TDurationTypes as $key => $typeduration) {
|
||||
$retstring .= '<option value="'.$key.'"';
|
||||
if ($key == $selected) {
|
||||
@ -8229,7 +8229,7 @@ class Form
|
||||
$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #bbb"').'>'.$way.'</li>';
|
||||
}
|
||||
}
|
||||
return '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>';
|
||||
return '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>';
|
||||
}
|
||||
|
||||
if ($rendermode == 0) {
|
||||
@ -9667,9 +9667,10 @@ class Form
|
||||
* @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.
|
||||
* @param string $search_component_params_hidden String with $search_component_params criterias
|
||||
* @return string HTML component for advanced search
|
||||
*/
|
||||
public function searchComponent($arrayofcriterias, $search_component_params, $arrayofinputfieldsalreadyoutput = array())
|
||||
public function searchComponent($arrayofcriterias, $search_component_params, $arrayofinputfieldsalreadyoutput = array(), $search_component_params_hidden = '')
|
||||
{
|
||||
global $langs;
|
||||
|
||||
@ -9687,7 +9688,12 @@ class Form
|
||||
|
||||
$ret .= '<div class="search_component inline-block valignmiddle">'.$texttoshow.'</div>';
|
||||
$ret .= '</div>';
|
||||
$ret .= '<input type="hidden" name="search_component_params_hidden" class="search_component_params_hidden" value="'.GETPOST("search_component_params_hidden").'">';
|
||||
$ret .= "<!-- Syntax of Generic filter string: t.ref:like:'SO-%', t.date_creation:<:'20160101', t.date_creation:<:'2016-01-01 12:30:00', t.nature:is:NULL, t.field2:isnot:NULL -->\n";
|
||||
if (GETPOST('show_search_component_params_hidden', 'int')) {
|
||||
$ret .= '<input type="hidden" name="show_search_component_params_hidden" value="1">';
|
||||
}
|
||||
$ret .= '<input type="'.(GETPOST('show_search_component_params_hidden', 'int') ? 'text' : 'hidden').'" name="search_component_params_hidden" class="search_component_params_hidden marginleftonly" value="'.$search_component_params_hidden.'">';
|
||||
|
||||
// For compatibility with forms that show themself the search criteria in addition of this component, we output the fields
|
||||
foreach ($arrayofcriterias as $criterias) {
|
||||
foreach ($criterias as $criteriafamilykey => $criteriafamilyval) {
|
||||
|
||||
@ -844,6 +844,7 @@ class FormOther
|
||||
$out .= '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jpicker/jpicker-1.1.6.js"></script>';
|
||||
$out .= '<script type="text/javascript">
|
||||
jQuery(document).ready(function(){
|
||||
var originalhex = null;
|
||||
$(\'#colorpicker'.$prefix.'\').jPicker( {
|
||||
window: {
|
||||
title: \''.dol_escape_js($langs->trans("SelectAColor")).'\', /* any title for the jPicker window itself - displays "Drag Markers To Pick A Color" if left null */
|
||||
@ -873,18 +874,33 @@ class FormOther
|
||||
title: \''.dol_escape_js($langs->trans("SelectAColor")).'\',
|
||||
newColor: \''.dol_escape_js($langs->trans("New")).'\',
|
||||
currentColor: \''.dol_escape_js($langs->trans("Current")).'\',
|
||||
ok: \''.dol_escape_js($langs->trans("Save")).'\',
|
||||
ok: \''.dol_escape_js($langs->trans("Validate")).'\',
|
||||
cancel: \''.dol_escape_js($langs->trans("Cancel")).'\'
|
||||
}
|
||||
}
|
||||
},
|
||||
function(color, context) { console.log("close"); },
|
||||
function(color, context) { console.log("close color selector"); },
|
||||
function(color, context) { var hex = color.val(\'hex\'); console.log("new color selected in jpicker "+hex+" setpropertyonselect='.dol_escape_js($setpropertyonselect).'");';
|
||||
if ($setpropertyonselect) {
|
||||
$out .= ' if (hex != null) document.documentElement.style.setProperty(\'--'.dol_escape_js($setpropertyonselect).'\', \'#\'+hex);';
|
||||
$out .= 'if (originalhex == null) {';
|
||||
$out .= ' originalhex = getComputedStyle(document.querySelector(":root")).getPropertyValue(\'--'.dol_escape_js($setpropertyonselect).'\');';
|
||||
$out .= ' console.log("original color is saved into originalhex = "+originalhex);';
|
||||
$out .= '}';
|
||||
$out .= 'if (hex != null) {';
|
||||
$out .= ' document.documentElement.style.setProperty(\'--'.dol_escape_js($setpropertyonselect).'\', \'#\'+hex);';
|
||||
$out .= '}';
|
||||
}
|
||||
$out .= '},
|
||||
function(color, context) { console.log("cancel"); }
|
||||
$out .= '},
|
||||
function(color, context) {
|
||||
console.log("cancel selection of color");';
|
||||
if ($setpropertyonselect) {
|
||||
$out .= 'if (originalhex != null) {
|
||||
console.log("Restore old color "+originalhex);
|
||||
document.documentElement.style.setProperty(\'--'.dol_escape_js($setpropertyonselect).'\', originalhex);
|
||||
}';
|
||||
}
|
||||
$out .= '
|
||||
}
|
||||
);
|
||||
});
|
||||
</script>';
|
||||
@ -922,11 +938,11 @@ class FormOther
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Creation d'un icone de couleur
|
||||
* Creae an image for color
|
||||
*
|
||||
* @param string $color Couleur de l'image
|
||||
* @param string $module Nom du module
|
||||
* @param string $name Nom de l'image
|
||||
* @param string $color Color of image
|
||||
* @param string $module Name of module
|
||||
* @param string $name Name of image
|
||||
* @param int $x Largeur de l'image en pixels
|
||||
* @param int $y Hauteur de l'image en pixels
|
||||
* @return void
|
||||
|
||||
@ -502,9 +502,10 @@ class FormProjets
|
||||
* @param string $morecss More CSS
|
||||
* @param int $limitonstatus Add filters to limit length of list to opened status (for example to avoid ERR_RESPONSE_HEADERS_TOO_BIG on project/element.php page). TODO To implement
|
||||
* @param string $projectkey Equivalent key to fk_projet for actual table_element
|
||||
* @param string $placeholder Placeholder
|
||||
* @return int|string The HTML select list of element or '' if nothing or -1 if KO
|
||||
*/
|
||||
public function select_element($table_element, $socid = 0, $morecss = '', $limitonstatus = -2, $projectkey = "fk_projet")
|
||||
public function select_element($table_element, $socid = 0, $morecss = '', $limitonstatus = -2, $projectkey = "fk_projet", $placeholder = '')
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf, $langs;
|
||||
@ -612,7 +613,7 @@ class FormProjets
|
||||
$i = 0;
|
||||
if ($num > 0) {
|
||||
$sellist = '<select class="flat elementselect css'.$table_element.($morecss ? ' '.$morecss : '').'" name="elementselect">';
|
||||
$sellist .= '<option value="-1"></option>';
|
||||
$sellist .= '<option value="-1"'.($placeholder ? ' class="optiongrey"' : '').'>'.$placeholder.'</option>';
|
||||
while ($i < $num) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$ref = $obj->ref ? $obj->ref : $obj->rowid;
|
||||
|
||||
@ -1322,6 +1322,7 @@ class FormTicket
|
||||
|
||||
// Print recipient list
|
||||
if (is_array($sendto) && count($sendto) > 0) {
|
||||
print img_picto('', 'email', 'class="pictofixedwidth"');
|
||||
print implode(', ', $sendto);
|
||||
} else {
|
||||
print '<div class="warning">'.$langs->trans('WarningNoEMailsAdded').' '.$langs->trans('TicketGoIntoContactTab').'</div>';
|
||||
|
||||
@ -579,7 +579,7 @@ class Translate
|
||||
$newstr = $this->getLabelFromKey($db, $reg[1], 'c_currencies', 'code_iso', 'label');
|
||||
} elseif (preg_match('/^SendingMethod([0-9A-Z]+)$/i', $key, $reg)) {
|
||||
$newstr = $this->getLabelFromKey($db, $reg[1], 'c_shipment_mode', 'code', 'libelle');
|
||||
} elseif (preg_match('/^PaymentTypeShort([0-9A-Z]+)$/i', $key, $reg)) {
|
||||
} elseif (preg_match('/^PaymentType(?:Short)?([0-9A-Z]+)$/i', $key, $reg)) {
|
||||
$newstr = $this->getLabelFromKey($db, $reg[1], 'c_paiement', 'code', 'libelle', '', 1);
|
||||
} elseif (preg_match('/^OppStatus([0-9A-Z]+)$/i', $key, $reg)) {
|
||||
$newstr = $this->getLabelFromKey($db, $reg[1], 'c_lead_status', 'code', 'label');
|
||||
|
||||
@ -61,6 +61,11 @@ class Validate
|
||||
$this->outputLang = $outputLang;
|
||||
}
|
||||
|
||||
if (!is_object($this->outputLang) || !method_exists($outputLang, 'load')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @var Translate $outputLang */
|
||||
$outputLang->load('validate');
|
||||
|
||||
$this->db = $db;
|
||||
@ -212,7 +217,7 @@ class Validate
|
||||
/**
|
||||
* Check Duration validity
|
||||
*
|
||||
* @param string $duration to validate
|
||||
* @param mixed $duration to validate
|
||||
* @return boolean Validity is ok or not
|
||||
*/
|
||||
public function isDuration($duration)
|
||||
|
||||
@ -40,7 +40,6 @@ if (!defined('USE_CUSTOM_REPORT_AS_INCLUDE')) {
|
||||
$objecttype = 'thirdparty';
|
||||
}
|
||||
|
||||
$search_filters = GETPOST('search_filters', 'array');
|
||||
$search_measures = GETPOST('search_measures', 'array');
|
||||
|
||||
//$search_xaxis = GETPOST('search_xaxis', 'array');
|
||||
@ -158,6 +157,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
|
||||
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
||||
|
||||
$search_component_params = array('');
|
||||
$search_component_params_hidden = GETPOST('search_component_params_hidden', 'alphanohtml');
|
||||
|
||||
$MAXUNIQUEVALFORGROUP = 20;
|
||||
$MAXMEASURESINBARGRAPH = 20;
|
||||
@ -175,14 +175,16 @@ $arrayofgroupby = array();
|
||||
$arrayofyaxis = array();
|
||||
$arrayofvaluesforgroupby = array();
|
||||
|
||||
$result = restrictedArea($user, $object->element, 0, '');
|
||||
restrictedArea($user, $object->element, 0, '');
|
||||
|
||||
$error = 0;
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
|
||||
// None
|
||||
|
||||
|
||||
|
||||
@ -245,8 +247,19 @@ if (is_array($search_groupby) && count($search_groupby)) {
|
||||
} else {
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$object->table_element.' as t';
|
||||
}
|
||||
// TODO Add the where here
|
||||
// ...
|
||||
|
||||
// Add the where here
|
||||
/*
|
||||
$sqlfilters = GETPOST('search_component_params_hidden', 'alphanohtml');
|
||||
if ($sqlfilters) {
|
||||
$errormessage = '';
|
||||
if (dolCheckFilters($sqlfilters, $errormessage)) {
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " WHERE (".preg_replace_callback('/'.$regexstring.'/', 'dolForgeCriteriaCallback', $sqlfilters).")";
|
||||
} else {
|
||||
print $errormessage;
|
||||
}
|
||||
}*/
|
||||
|
||||
$sql .= ' LIMIT '.($MAXUNIQUEVALFORGROUP + 1);
|
||||
|
||||
@ -333,6 +346,24 @@ print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="viewgraph">';
|
||||
print '<input type="hidden" name="tabfamily" value="'.$tabfamily.'">';
|
||||
|
||||
$viewmode = '';
|
||||
|
||||
$viewmode .= '<div class="divadvancedsearchfield">';
|
||||
$arrayofgraphs = array('bars' => 'Bars', 'lines' => 'Lines'); // also 'pies'
|
||||
$viewmode .= '<div class="inline-block opacitymedium"><span class="fas fa-chart-area paddingright" title="'.$langs->trans("Graph").'"></span>'.$langs->trans("Graph").'</div> ';
|
||||
$viewmode .= $form->selectarray('search_graph', $arrayofgraphs, $search_graph, 0, 0, 0, 'minwidth100', 1);
|
||||
$viewmode .= '</div>';
|
||||
|
||||
$num = 0;
|
||||
$massactionbutton = '';
|
||||
$nav = '';
|
||||
$newcardbutton = '';
|
||||
$limit = 0;
|
||||
|
||||
print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, -1, 'object_action', 0, $nav.'<span class="marginleftonly"></span>'.$newcardbutton, '', $limit, 1, 0, 1, $viewmode);
|
||||
|
||||
|
||||
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
|
||||
// Select object
|
||||
@ -349,22 +380,23 @@ foreach ($arrayoftype as $key => $val) {
|
||||
}
|
||||
print $form->selectarray('objecttype', $newarrayoftype, $objecttype, 0, 0, 0, '', 1, 0, 0, '', 'minwidth200', 1);
|
||||
if (empty($conf->use_javascript_ajax)) {
|
||||
print '<input type="submit" class="button buttongen button-save" name="changeobjecttype" value="'.$langs->trans("Refresh").'">';
|
||||
print '<input type="submit" class="button buttongen button-save nomargintop" name="changeobjecttype" value="'.$langs->trans("Refresh").'">';
|
||||
} else {
|
||||
print '<script type="text/javascript">
|
||||
print '<!-- js code to reload page with good object type -->
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function() {
|
||||
jQuery("#objecttype").change(function() {
|
||||
console.log("Reload for "+jQuery("#objecttype").val());
|
||||
location.href = "'.$_SERVER["PHP_SELF"].'?objecttype="+jQuery("#objecttype").val()+"'.($tabfamily ? '&tabfamily='.$tabfamily : '').'";
|
||||
location.href = "'.$_SERVER["PHP_SELF"].'?objecttype="+jQuery("#objecttype").val()+"'.($tabfamily ? '&tabfamily='.urlencode($tabfamily) : '').(GETPOST('show_search_component_params_hidden', 'int') ? '&show_search_component_params_hidden='.((int) GETPOST('show_search_component_params_hidden', 'int')) : '').'";
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
print '</div><div class="clearboth"></div>';
|
||||
|
||||
// Add Filter
|
||||
// Add Filter (you can use param &show_search_component_params_hidden=1 for debug)
|
||||
print '<div class="divadvancedsearchfield quatrevingtpercent">';
|
||||
print $form->searchComponent(array($object->element => $object->fields), $search_component_params);
|
||||
print $form->searchComponent(array($object->element => $object->fields), $search_component_params, array(), $search_component_params_hidden);
|
||||
print '</div>';
|
||||
|
||||
// Add measures into array
|
||||
@ -393,13 +425,6 @@ print $form->multiselectarray('search_measures', $arrayofmesures, $search_measur
|
||||
print '</div>';
|
||||
|
||||
|
||||
// Group by
|
||||
print '<div class="divadvancedsearchfield">';
|
||||
print '<div class="inline-block opacitymedium"><span class="fas fa-ruler-horizontal paddingright" title="'.$langs->trans("GroupBy").'"></span>'.$langs->trans("GroupBy").'</div> ';
|
||||
print $formother->selectGroupByField($object, $search_groupby, $arrayofgroupby);
|
||||
print '</div>';
|
||||
|
||||
|
||||
// XAxis
|
||||
print '<div class="divadvancedsearchfield">';
|
||||
print '<div class="inline-block"><span class="fas fa-ruler-horizontal paddingright" title="'.$langs->trans("XAxis").'"></span>'.$langs->trans("XAxis").'</div> ';
|
||||
@ -407,6 +432,13 @@ print $formother->selectXAxisField($object, $search_xaxis, $arrayofxaxis);
|
||||
print '</div>';
|
||||
|
||||
|
||||
// Group by
|
||||
print '<div class="divadvancedsearchfield">';
|
||||
print '<div class="inline-block opacitymedium"><span class="fas fa-ruler-horizontal paddingright" title="'.$langs->trans("GroupBy").'"></span>'.$langs->trans("GroupBy").'</div> ';
|
||||
print $formother->selectGroupByField($object, $search_groupby, $arrayofgroupby);
|
||||
print '</div>';
|
||||
|
||||
|
||||
if ($mode == 'grid') {
|
||||
// YAxis
|
||||
print '<div class="divadvancedsearchfield">';
|
||||
@ -449,14 +481,11 @@ if ($mode == 'grid') {
|
||||
}
|
||||
|
||||
if ($mode == 'graph') {
|
||||
print '<div class="divadvancedsearchfield">';
|
||||
$arrayofgraphs = array('bars' => 'Bars', 'lines' => 'Lines'); // also 'pies'
|
||||
print '<div class="inline-block opacitymedium"><span class="fas fa-chart-area paddingright" title="'.$langs->trans("Graph").'"></span>'.$langs->trans("Graph").'</div> ';
|
||||
print $form->selectarray('search_graph', $arrayofgraphs, $search_graph, 0, 0, 0, 'minwidth100', 1);
|
||||
print '</div>';
|
||||
//
|
||||
}
|
||||
|
||||
print '<div class="divadvancedsearchfield">';
|
||||
print '<input type="submit" class="button buttongen button-save" value="'.$langs->trans("Refresh").'">';
|
||||
print '<input type="submit" class="button buttongen button-save nomargintop" value="'.$langs->trans("Refresh").'">';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
print '</form>';
|
||||
@ -531,8 +560,16 @@ if (!empty($search_measures) && !empty($search_xaxis)) {
|
||||
if ($object->ismultientitymanaged == 1) {
|
||||
$sql .= ' AND entity IN ('.getEntity($object->element).')';
|
||||
}
|
||||
foreach ($search_filters as $key => $val) {
|
||||
// TODO Add the where here
|
||||
// Add the where here
|
||||
$sqlfilters = GETPOST('search_component_params_hidden', 'alphanohtml');
|
||||
if ($sqlfilters) {
|
||||
$errormessage = '';
|
||||
if (dolCheckFilters($sqlfilters, $errormessage)) {
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'dolForgeCriteriaCallback', $sqlfilters).")";
|
||||
} else {
|
||||
print $errormessage;
|
||||
}
|
||||
}
|
||||
$sql .= ' GROUP BY ';
|
||||
foreach ($search_xaxis as $key => $val) {
|
||||
|
||||
@ -33,7 +33,7 @@ if (!defined('NOCSRFCHECK')) {
|
||||
if (!defined('NOTOKENRENEWAL')) {
|
||||
define('NOTOKENRENEWAL', 1);
|
||||
}
|
||||
//if (! defined('NOLOGIN')) define('NOLOGIN',1); // Not disabled cause need to load personalized language
|
||||
//if (! defined('NOLOGIN')) define('NOLOGIN',1); // Not disabled cause need to load personalized language and need security layer
|
||||
if (!defined('NOREQUIREMENU')) {
|
||||
define('NOREQUIREMENU', 1);
|
||||
}
|
||||
@ -56,8 +56,8 @@ $left = ($langs->trans("DIRECTION") == 'rtl' ? 'right' : 'left');
|
||||
|
||||
$title = $langs->trans("Info");
|
||||
|
||||
// URL http://mydolibarr/core/search_page?dol_use_jmobile=1 can be used for tests
|
||||
$head = '<!-- Quick access -->'."\n";
|
||||
// URL http://mydolibarr/core/get_info.php?dol_use_jmobile=1 can be used for tests
|
||||
$head = '<!-- Info user page -->'."\n";
|
||||
$arrayofjs = array();
|
||||
$arrayofcss = array();
|
||||
top_htmlhead($head, $title, 0, 0, $arrayofjs, $arrayofcss);
|
||||
@ -93,7 +93,7 @@ if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
|
||||
if ($_SESSION["dol_authmode"] != 'forceuser' && $_SESSION["dol_authmode"] != 'http') {
|
||||
$logouthtmltext .= $langs->trans("Logout").'<br>';
|
||||
|
||||
$logouttext .= '<a href="'.DOL_URL_ROOT.'/user/logout.php">';
|
||||
$logouttext .= '<a href="'.DOL_URL_ROOT.'/user/logout.php?token='.newToken().'">';
|
||||
//$logouttext .= img_picto($langs->trans('Logout').":".$langs->trans('Logout'), 'logout_top.png', 'class="login"', 0, 0, 1);
|
||||
$logouttext .= '<span class="fa fa-sign-out atoplogin"></span>';
|
||||
$logouttext .= '</a>';
|
||||
|
||||
@ -32,12 +32,40 @@ function updateCoords(c)
|
||||
{
|
||||
//alert(parseInt(jQuery("#ratioforcrop").val()));
|
||||
ratio=1;
|
||||
if (parseInt(jQuery("#ratioforcrop").val()) > 0) ratio = parseInt(jQuery("#ratioforcrop").val());
|
||||
imagewidth=0;
|
||||
imageheight=0;
|
||||
|
||||
console.log(c);
|
||||
|
||||
if (parseInt(jQuery("#ratioforcrop").val()) > 1) {
|
||||
ratio = parseInt(jQuery("#ratioforcrop").val());
|
||||
if (parseInt(jQuery("#imagewidth").val()) > 0) imagewidth = parseInt(jQuery("#imagewidth").val());
|
||||
if (parseInt(jQuery("#imageheight").val()) > 0) imageheight = parseInt(jQuery("#imageheight").val());
|
||||
}
|
||||
|
||||
x = Math.floor(c.x * ratio);
|
||||
y = Math.floor(c.y * ratio);
|
||||
x2 = Math.ceil(c.x2 * ratio);
|
||||
y2 = Math.ceil(c.y2 * ratio);
|
||||
console.log("x="+x+" y="+y+" x2="+x2+" y2="+y2+" imageheight="+imageheight+" ratio="+ratio);
|
||||
if (imagewidth > 0 && x > imagewidth) {
|
||||
x = imagewidth;
|
||||
}
|
||||
if (imageheight > 0 && y > imageheight) {
|
||||
y = imageheight;
|
||||
}
|
||||
if (imagewidth > 0 && x2 > imagewidth) {
|
||||
x2 = imagewidth;
|
||||
}
|
||||
if (imageheight > 0 && y2 > imageheight) {
|
||||
y2 = imageheight;
|
||||
}
|
||||
|
||||
//console.log(ratio);
|
||||
jQuery('#x').val(Math.ceil(c.x * ratio));
|
||||
jQuery('#y').val(Math.ceil(c.y * ratio));
|
||||
jQuery('#x2').val(Math.ceil(c.x2 * ratio));
|
||||
jQuery('#y2').val(Math.ceil(c.y2 * ratio));
|
||||
jQuery('#w').val(Math.ceil(c.w * ratio));
|
||||
jQuery('#h').val(Math.ceil(c.h * ratio));
|
||||
jQuery('#x').val(x);
|
||||
jQuery('#y').val(y);
|
||||
jQuery('#x2').val(x2);
|
||||
jQuery('#y2').val(y2);
|
||||
jQuery('#w').val(x2-x);
|
||||
jQuery('#h').val(y2-y);
|
||||
};
|
||||
|
||||
@ -3627,7 +3627,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
if (empty($srconly) && in_array($pictowithouttext, array(
|
||||
'1downarrow', '1uparrow', '1leftarrow', '1rightarrow', '1uparrow_selected', '1downarrow_selected', '1leftarrow_selected', '1rightarrow_selected',
|
||||
'accountancy', 'accounting_account', 'account', 'accountline', 'action', 'add', 'address', 'angle-double-down', 'angle-double-up', 'asset',
|
||||
'bank_account', 'barcode', 'bank', 'bill', 'billa', 'billr', 'billd', 'bookmark', 'bom', 'bug', 'building',
|
||||
'bank_account', 'barcode', 'bank', 'bell', 'bill', 'billa', 'billr', 'billd', 'bookmark', 'bom', 'bug', 'building',
|
||||
'calendar', 'calendarmonth', 'calendarweek', 'calendarday', 'calendarperuser', 'calendarpertype',
|
||||
'cash-register', 'category', 'chart', 'check', 'clock', 'close_title', 'cog', 'collab', 'company', 'contact', 'country', 'contract', 'conversation', 'cron', 'cubes',
|
||||
'multicurrency',
|
||||
@ -3659,7 +3659,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
$facolor = '';
|
||||
$fasize = '';
|
||||
$fa = 'fas';
|
||||
if (in_array($pictowithouttext, array('clock', 'establishment', 'generic', 'minus-square', 'object_generic', 'pdf', 'plus-square', 'timespent', 'note', 'off', 'on', 'object_bookmark', 'bookmark', 'vcard'))) {
|
||||
if (in_array($pictowithouttext, array('bell', 'clock', 'establishment', 'generic', 'minus-square', 'object_generic', 'pdf', 'plus-square', 'timespent', 'note', 'off', 'on', 'object_bookmark', 'bookmark', 'vcard'))) {
|
||||
$fa = 'far';
|
||||
}
|
||||
if (in_array($pictowithouttext, array('black-tie', 'github', 'skype', 'twitter', 'facebook', 'linkedin', 'instagram', 'snapchat', 'stripe', 'stripe-s', 'youtube', 'google-plus-g', 'whatsapp'))) {
|
||||
@ -10597,3 +10597,90 @@ function jsonOrUnserialize($stringtodecode)
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Return if a $sqlfilters parameter is valid and will pass the preg_replace_callback() to replace Generic filter string with SQL filter string
|
||||
* Example of usage:
|
||||
* if ($sqlfilters) {
|
||||
* $errormessage = '';
|
||||
* if (dolCheckFilters($sqlfilters, $errormessage)) {
|
||||
* $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
* $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'dolForgeCriteriaCallback', $sqlfilters).")";
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* @param string $sqlfilters sqlfilter string
|
||||
* @param string $error Error message
|
||||
* @return boolean True if valid, False if not valid ($error is filled with the reason in such a case)
|
||||
*/
|
||||
function dolCheckFilters($sqlfilters, &$error = '')
|
||||
{
|
||||
//$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
//$tmp=preg_replace_all('/'.$regexstring.'/', '', $sqlfilters);
|
||||
$tmp = $sqlfilters;
|
||||
$i = 0; $nb = strlen($tmp);
|
||||
$counter = 0;
|
||||
while ($i < $nb) {
|
||||
if ($tmp[$i] == '(') {
|
||||
$counter++;
|
||||
}
|
||||
if ($tmp[$i] == ')') {
|
||||
$counter--;
|
||||
}
|
||||
if ($counter < 0) {
|
||||
$error = "Bad sqlfilters=".$sqlfilters;
|
||||
dol_syslog($error, LOG_WARNING);
|
||||
return false;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to forge a SQL criteria from a Generic filter string.
|
||||
* Example of usage:
|
||||
* if ($sqlfilters) {
|
||||
* $errormessage = '';
|
||||
* if (dolCheckFilters($sqlfilters, $errormessage)) {
|
||||
* $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
* $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'dolForgeCriteriaCallback', $sqlfilters).")";
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* @param array $matches Array of found string by regex search.
|
||||
* Example: "t.ref:like:'SO-%'" or "t.date_creation:<:'20160101'" or "t.date_creation:<:'2016-01-01 12:30:00'" or "t.nature:is:NULL"
|
||||
* @return string Forged criteria. Example: "t.field like 'abc%'"
|
||||
*/
|
||||
function dolForgeCriteriaCallback($matches)
|
||||
{
|
||||
global $db;
|
||||
|
||||
//dol_syslog("Convert matches ".$matches[1]);
|
||||
if (empty($matches[1])) {
|
||||
return '';
|
||||
}
|
||||
$tmp = explode(':', $matches[1], 3);
|
||||
|
||||
if (count($tmp) < 3) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$operand = preg_replace('/[^a-z0-9\._]/i', '', trim($tmp[0]));
|
||||
|
||||
$operator = strtoupper(preg_replace('/[^a-z<>=]/i', '', trim($tmp[1])));
|
||||
|
||||
$tmpescaped = trim($tmp[2]);
|
||||
$regbis = array();
|
||||
if ($operator == 'IN') {
|
||||
$tmpescaped = "(".$db->sanitize($tmpescaped, 1).")";
|
||||
} elseif (preg_match('/^\'(.*)\'$/', $tmpescaped, $regbis)) {
|
||||
$tmpescaped = "'".$db->escape($regbis[1])."'";
|
||||
} else {
|
||||
$tmpescaped = $db->sanitize($db->escape($tmpescaped));
|
||||
}
|
||||
|
||||
return $db->escape($operand).' '.$db->escape($operator)." ".$tmpescaped;
|
||||
}
|
||||
|
||||
@ -388,7 +388,7 @@ function dolRotateImage($file_path)
|
||||
* Add exif orientation correction for image
|
||||
*
|
||||
* @param string $fileSource Full path to source image to rotate
|
||||
* @param string $fileDest string : Full path to image to rotate | false return gd img | null the raw image stream will be outputted directly
|
||||
* @param string|bool $fileDest string : Full path to image to rotate | false return gd img | null the raw image stream will be outputted directly
|
||||
* @param int $quality output image quality
|
||||
* @return bool : true on success or false on failure or gd img if $fileDest is false.
|
||||
*/
|
||||
@ -630,7 +630,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
|
||||
}
|
||||
|
||||
// replace image with good orientation
|
||||
if (!empty($rotated)) {
|
||||
if (!empty($rotated) && isset($trueImgWidth) && isset($trueImgHeight)) {
|
||||
$img = $rotated;
|
||||
$imgWidth = $trueImgWidth;
|
||||
$imgHeight = $trueImgHeight;
|
||||
|
||||
@ -509,12 +509,14 @@ function getNumberInvoicesPieChart($mode)
|
||||
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
/*$dataseries = array(array($langs->trans('InvoiceLate30Days'), $obj->nblate30)
|
||||
/*
|
||||
$dataseries = array(array($langs->trans('InvoiceLate30Days'), $obj->nblate30)
|
||||
,array($langs->trans('InvoiceLate15Days'), $obj->nblate15 - $obj->nblate30)
|
||||
,array($langs->trans('InvoiceLateMinus15Days'), $obj->nblatenow - $obj->nblate15)
|
||||
,array($langs->trans('InvoiceNotLate'), $obj->nbnotlatenow - $obj->nbnotlate15)
|
||||
,array($langs->trans('InvoiceNotLate15Days'), $obj->nbnotlate15 - $obj->nbnotlate30)
|
||||
,array($langs->trans('InvoiceNotLate30Days'), $obj->nbnotlate30));*/
|
||||
,array($langs->trans('InvoiceNotLate30Days'), $obj->nbnotlate30));
|
||||
*/
|
||||
$dataseries[$i]=array($langs->trans('NbOfOpenInvoices'), $obj->nblate30, $obj->nblate15 - $obj->nblate30, $obj->nblatenow - $obj->nblate15, $obj->nbnotlatenow - $obj->nbnotlate15, $obj->nbnotlate15 - $obj->nbnotlate30, $obj->nbnotlate30);
|
||||
$i++;
|
||||
}
|
||||
@ -561,8 +563,9 @@ function getNumberInvoicesPieChart($mode)
|
||||
$dolgraph->setShowLegend(2);
|
||||
$dolgraph->setShowPercent(1);
|
||||
$dolgraph->SetType(array('bars', 'bars', 'bars', 'bars', 'bars', 'bars'));
|
||||
$dolgraph->setHeight('160');
|
||||
$dolgraph->setWidth('400');
|
||||
//$dolgraph->SetType(array('pie'));
|
||||
$dolgraph->setHeight('160'); /* 160 min is required to show the 6 lines of legend */
|
||||
$dolgraph->setWidth('450');
|
||||
$dolgraph->setHideXValues(true);
|
||||
if ($mode == 'customers') {
|
||||
$dolgraph->draw('idgraphcustomerinvoices');
|
||||
|
||||
@ -348,8 +348,10 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
|
||||
*/
|
||||
public $hidden = false;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @var string url to check for module update
|
||||
*/
|
||||
public $url_last_version;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -92,6 +92,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
|
||||
$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
|
||||
$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
$texte .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$texte .= '<input type="hidden" name="page_y" value="">';
|
||||
$texte .= '<input type="hidden" name="action" value="setModuleOptions">';
|
||||
$texte .= '<input type="hidden" name="param1" value="BARCODE_STANDARD_PRODUCT_MASK">';
|
||||
$texte .= '<table class="nobordernopadding" width="100%">';
|
||||
@ -108,7 +109,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
|
||||
//$texte.= '<tr><td>'.$langs->trans("Mask").' ('.$langs->trans("BarCodeModel").'):</td>';
|
||||
$texte .= '<tr><td>'.$langs->trans("Mask").':</td>';
|
||||
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="value1" value="'.(!empty($conf->global->BARCODE_STANDARD_PRODUCT_MASK) ? $conf->global->BARCODE_STANDARD_PRODUCT_MASK : '').'"'.$disabled.'>', $tooltip, 1, 1).'</td>';
|
||||
$texte .= '<td class="left" rowspan="2"> <input type="submit" class="button button-edit" name="Button"value="'.$langs->trans("Modify").'"'.$disabled.'></td>';
|
||||
$texte .= '<td class="left" rowspan="2"> <input type="submit" class="button button-edit reposition" name="Button" value="'.$langs->trans("Modify").'"'.$disabled.'></td>';
|
||||
$texte .= '</tr>';
|
||||
|
||||
$texte .= '</table>';
|
||||
|
||||
@ -115,6 +115,7 @@ class doc_generic_bom_odt extends ModelePDFBom
|
||||
$texte = $this->description.".<br>\n";
|
||||
$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
$texte .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$texte .= '<input type="hidden" name="page_y" value="">';
|
||||
$texte .= '<input type="hidden" name="action" value="setModuleOptions">';
|
||||
$texte .= '<input type="hidden" name="param1" value="BOM_ADDON_PDF_ODT_PATH">';
|
||||
$texte .= '<table class="nobordernopadding" width="100%">';
|
||||
@ -151,7 +152,7 @@ class doc_generic_bom_odt extends ModelePDFBom
|
||||
$texte .= $conf->global->BOM_ADDON_PDF_ODT_PATH;
|
||||
$texte .= '</textarea>';
|
||||
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
|
||||
$texte .= '<input type="submit" class="button small" name="Button"value="'.$langs->trans("Modify").'">';
|
||||
$texte .= '<input type="submit" class="button small reposition" name="Button" value="'.$langs->trans("Modify").'">';
|
||||
$texte .= '<br></div></div>';
|
||||
|
||||
// Scan directories
|
||||
|
||||
@ -123,6 +123,7 @@ class doc_generic_order_odt extends ModelePDFCommandes
|
||||
$texte = $this->description.".<br>\n";
|
||||
$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" enctype="multipart/form-data">';
|
||||
$texte .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$texte .= '<input type="hidden" name="page_y" value="">';
|
||||
$texte .= '<input type="hidden" name="action" value="setModuleOptions">';
|
||||
$texte .= '<input type="hidden" name="param1" value="COMMANDE_ADDON_PDF_ODT_PATH">';
|
||||
$texte .= '<table class="nobordernopadding" width="100%">';
|
||||
@ -159,7 +160,7 @@ class doc_generic_order_odt extends ModelePDFCommandes
|
||||
$texte .= $conf->global->COMMANDE_ADDON_PDF_ODT_PATH;
|
||||
$texte .= '</textarea>';
|
||||
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
|
||||
$texte .= '<input type="submit" class="button small" name="Button"value="'.$langs->trans("Modify").'">';
|
||||
$texte .= '<input type="submit" class="button small reposition" name="Button" value="'.$langs->trans("Modify").'">';
|
||||
$texte .= '<br></div></div>';
|
||||
|
||||
// Scan directories
|
||||
@ -183,7 +184,7 @@ class doc_generic_order_odt extends ModelePDFCommandes
|
||||
// Add input to upload a new template file.
|
||||
$texte .= '<div>'.$langs->trans("UploadNewTemplate").' <input type="file" name="uploadfile">';
|
||||
$texte .= '<input type="hidden" value="COMMANDE_ADDON_PDF_ODT_PATH" name="keyforuploaddir">';
|
||||
$texte .= '<input type="submit" class="button small" value="'.dol_escape_htmltag($langs->trans("Upload")).'" name="upload">';
|
||||
$texte .= '<input type="submit" class="button small reposition" value="'.dol_escape_htmltag($langs->trans("Upload")).'" name="upload">';
|
||||
$texte .= '</div>';
|
||||
|
||||
$texte .= '</td>';
|
||||
|
||||
@ -121,6 +121,7 @@ class doc_generic_contract_odt extends ModelePDFContract
|
||||
$texte = $this->description.".<br>\n";
|
||||
$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" enctype="multipart/form-data">';
|
||||
$texte .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$texte .= '<input type="hidden" name="page_y" value="">';
|
||||
$texte .= '<input type="hidden" name="action" value="setModuleOptions">';
|
||||
$texte .= '<input type="hidden" name="param1" value="CONTRACT_ADDON_PDF_ODT_PATH">';
|
||||
$texte .= '<table class="nobordernopadding" width="100%">';
|
||||
@ -157,7 +158,7 @@ class doc_generic_contract_odt extends ModelePDFContract
|
||||
$texte .= $conf->global->CONTRACT_ADDON_PDF_ODT_PATH;
|
||||
$texte .= '</textarea>';
|
||||
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
|
||||
$texte .= '<input type="submit" class="button small" value="'.dol_escape_htmltag($langs->trans("Modify")).'" name="Button">';
|
||||
$texte .= '<input type="submit" class="button small reposition" value="'.dol_escape_htmltag($langs->trans("Modify")).'" name="Button">';
|
||||
$texte .= '<br></div></div>';
|
||||
|
||||
// Scan directories
|
||||
@ -168,7 +169,7 @@ class doc_generic_contract_odt extends ModelePDFContract
|
||||
// Add input to upload a new template file.
|
||||
$texte .= '<div>'.$langs->trans("UploadNewTemplate").' <input type="file" name="uploadfile">';
|
||||
$texte .= '<input type="hidden" value="CONTRACT_ADDON_PDF_ODT_PATH" name="keyforuploaddir">';
|
||||
$texte .= '<input type="submit" class="button small" value="'.dol_escape_htmltag($langs->trans("Upload")).'" name="upload">';
|
||||
$texte .= '<input type="submit" class="button small reposition" value="'.dol_escape_htmltag($langs->trans("Upload")).'" name="upload">';
|
||||
$texte .= '</div>';
|
||||
|
||||
$texte .= '</td>';
|
||||
|
||||
@ -123,6 +123,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
|
||||
$texte = $this->description.".<br>\n";
|
||||
$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" enctype="multipart/form-data">';
|
||||
$texte .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$texte .= '<input type="hidden" name="page_y" value="">';
|
||||
$texte .= '<input type="hidden" name="action" value="setModuleOptions">';
|
||||
$texte .= '<input type="hidden" name="param1" value="EXPEDITION_ADDON_PDF_ODT_PATH">';
|
||||
$texte .= '<table class="nobordernopadding" width="100%">';
|
||||
@ -159,7 +160,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
|
||||
$texte .= $conf->global->EXPEDITION_ADDON_PDF_ODT_PATH;
|
||||
$texte .= '</textarea>';
|
||||
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
|
||||
$texte .= '<input type="submit" class="button button-edit" name="Button"value="'.$langs->trans("Modify").'">';
|
||||
$texte .= '<input type="submit" class="button button-edit reposition" name="Button" value="'.$langs->trans("Modify").'">';
|
||||
$texte .= '<br></div></div>';
|
||||
|
||||
// Scan directories
|
||||
@ -182,7 +183,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
|
||||
// Add input to upload a new template file.
|
||||
$texte .= '<div>'.$langs->trans("UploadNewTemplate").' <input type="file" name="uploadfile">';
|
||||
$texte .= '<input type="hidden" value="EXPEDITION_ADDON_PDF_ODT_PATH" name="keyforuploaddir">';
|
||||
$texte .= '<input type="submit" class="button small" value="'.dol_escape_htmltag($langs->trans("Upload")).'" name="upload">';
|
||||
$texte .= '<input type="submit" class="button small reposition" value="'.dol_escape_htmltag($langs->trans("Upload")).'" name="upload">';
|
||||
$texte .= '</div>';
|
||||
$texte .= '</td>';
|
||||
|
||||
|
||||
@ -122,6 +122,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures
|
||||
$texte = $this->description.".<br>\n";
|
||||
$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" enctype="multipart/form-data">';
|
||||
$texte .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$texte .= '<input type="hidden" name="page_y" value="">';
|
||||
$texte .= '<input type="hidden" name="action" value="setModuleOptions">';
|
||||
$texte .= '<input type="hidden" name="param1" value="FACTURE_ADDON_PDF_ODT_PATH">';
|
||||
$texte .= '<table class="nobordernopadding" width="100%">';
|
||||
@ -158,7 +159,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures
|
||||
$texte .= $conf->global->FACTURE_ADDON_PDF_ODT_PATH;
|
||||
$texte .= '</textarea>';
|
||||
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
|
||||
$texte .= '<input type="submit" class="button small" name="Button"value="'.$langs->trans("Modify").'">';
|
||||
$texte .= '<input type="submit" class="button small reposition" name="Button"value="'.$langs->trans("Modify").'">';
|
||||
$texte .= '<br></div></div>';
|
||||
|
||||
// Scan directories
|
||||
@ -181,7 +182,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures
|
||||
// Add input to upload a new template file.
|
||||
$texte .= '<div>'.$langs->trans("UploadNewTemplate").' <input type="file" name="uploadfile">';
|
||||
$texte .= '<input type="hidden" value="FACTURE_ADDON_PDF_ODT_PATH" name="keyforuploaddir">';
|
||||
$texte .= '<input type="submit" class="button small" value="'.dol_escape_htmltag($langs->trans("Upload")).'" name="upload">';
|
||||
$texte .= '<input type="submit" class="button small reposition" value="'.dol_escape_htmltag($langs->trans("Upload")).'" name="upload">';
|
||||
$texte .= '</div>';
|
||||
$texte .= '</td>';
|
||||
|
||||
|
||||
@ -118,6 +118,7 @@ class doc_generic_member_odt extends ModelePDFMember
|
||||
$texte = $this->description.".<br>\n";
|
||||
$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" enctype="multipart/form-data">';
|
||||
$texte .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$texte .= '<input type="hidden" name="page_y" value="">';
|
||||
$texte .= '<input type="hidden" name="action" value="setModuleOptions">';
|
||||
$texte .= '<input type="hidden" name="param1" value="MEMBER_ADDON_PDF_ODT_PATH">';
|
||||
$texte .= '<table class="nobordernopadding" width="100%">';
|
||||
@ -154,7 +155,7 @@ class doc_generic_member_odt extends ModelePDFMember
|
||||
$texte .= $conf->global->MEMBER_ADDON_PDF_ODT_PATH;
|
||||
$texte .= '</textarea>';
|
||||
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
|
||||
$texte .= '<input type="submit" class="button small" name="Button"value="'.$langs->trans("Modify").'">';
|
||||
$texte .= '<input type="submit" class="button small reposition" name="Button" value="'.$langs->trans("Modify").'">';
|
||||
$texte .= '<br></div></div>';
|
||||
|
||||
// Scan directories
|
||||
@ -171,7 +172,7 @@ class doc_generic_member_odt extends ModelePDFMember
|
||||
// Add input to upload a new template file.
|
||||
$texte .= '<div>'.$langs->trans("UploadNewTemplate").' <input type="file" name="uploadfile">';
|
||||
$texte .= '<input type="hidden" value="MEMBER_ADDON_PDF_ODT_PATH" name="keyforuploaddir">';
|
||||
$texte .= '<input type="submit" class="button small" value="'.dol_escape_htmltag($langs->trans("Upload")).'" name="upload">';
|
||||
$texte .= '<input type="submit" class="button small reposition" value="'.dol_escape_htmltag($langs->trans("Upload")).'" name="upload">';
|
||||
$texte .= '</div>';
|
||||
$texte .= '</td>';
|
||||
|
||||
|
||||
@ -322,7 +322,7 @@ class modCommande extends DolibarrModules
|
||||
|
||||
// Add extra fields
|
||||
$import_extrafield_sample = array();
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'commande' AND entity IN (0, ".$conf->entity.")";
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type <> 'separate' AND elementtype = 'commande' AND entity IN (0, ".$conf->entity.")";
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
if ($resql) {
|
||||
@ -403,7 +403,7 @@ class modCommande extends DolibarrModules
|
||||
}
|
||||
|
||||
// Add extra fields
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'commandedet' AND entity IN (0, ".$conf->entity.")";
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type <> 'separate' AND elementtype = 'commandedet' AND entity IN (0, ".$conf->entity.")";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
|
||||
@ -541,7 +541,7 @@ class modFournisseur extends DolibarrModules
|
||||
}
|
||||
// Add extra fields
|
||||
$import_extrafield_sample = array();
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture_fourn' AND entity IN (0, ".$conf->entity.")";
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type <> 'separate' AND elementtype = 'facture_fourn' AND entity IN (0, ".$conf->entity.")";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
@ -628,7 +628,7 @@ class modFournisseur extends DolibarrModules
|
||||
}
|
||||
// Add extra fields
|
||||
$import_extrafield_sample = array();
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture_fourn_det' AND entity IN (0, ".$conf->entity.")";
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type <> 'separate' AND elementtype = 'facture_fourn_det' AND entity IN (0, ".$conf->entity.")";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
@ -717,7 +717,7 @@ class modFournisseur extends DolibarrModules
|
||||
|
||||
// Add extra fields
|
||||
$import_extrafield_sample = array();
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'commande_fournisseur' AND entity IN (0, ".$conf->entity.")";
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type <> 'separate' AND elementtype = 'commande_fournisseur' AND entity IN (0, ".$conf->entity.")";
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
if ($resql) {
|
||||
@ -793,7 +793,7 @@ class modFournisseur extends DolibarrModules
|
||||
}
|
||||
|
||||
// Add extra fields
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'commande_fournisseurdet' AND entity IN (0, ".$conf->entity.")";
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type <> 'separate' AND elementtype = 'commande_fournisseurdet' AND entity IN (0, ".$conf->entity.")";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
|
||||
@ -799,7 +799,7 @@ class modProduct extends DolibarrModules
|
||||
|
||||
// Add extra fields
|
||||
$import_extrafield_sample = array();
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'product_fournisseur_price' AND entity IN (0, ".$conf->entity.")";
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type <> 'separate' AND elementtype = 'product_fournisseur_price' AND entity IN (0, ".$conf->entity.")";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) { // This can fail when class is used on old database (during migration for example)
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
|
||||
@ -302,7 +302,7 @@ class modPropale extends DolibarrModules
|
||||
}
|
||||
// Add extra fields
|
||||
$import_extrafield_sample = array();
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'propal' AND entity IN (0, ".$conf->entity.")";
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type <> 'separate' AND elementtype = 'propal' AND entity IN (0, ".$conf->entity.")";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
@ -386,7 +386,7 @@ class modPropale extends DolibarrModules
|
||||
}
|
||||
// Add extra fields
|
||||
$import_extrafield_sample = array();
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'propaldet' AND entity IN (0, ".$conf->entity.")";
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type <> 'separate' AND elementtype = 'propaldet' AND entity IN (0, ".$conf->entity.")";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
|
||||
2
htdocs/core/modules/modWorkstation.class.php
Executable file → Normal file
@ -62,7 +62,7 @@ class modWorkstation extends DolibarrModules
|
||||
// Used only if file README.md and README-LL.md not found.
|
||||
$this->descriptionlong = "WorkstationsDescription";
|
||||
// Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'
|
||||
$this->version = 'development';
|
||||
$this->version = 'experimental';
|
||||
// Url to the file with your last numberversion of this module
|
||||
//$this->url_last_version = 'http://www.example.com/versionmodule.txt';
|
||||
|
||||
|
||||
@ -122,6 +122,7 @@ class doc_generic_mo_odt extends ModelePDFMo
|
||||
$texte = $this->description.".<br>\n";
|
||||
$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
$texte .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$texte .= '<input type="hidden" name="page_y" value="">';
|
||||
$texte .= '<input type="hidden" name="action" value="setModuleOptions">';
|
||||
$texte .= '<input type="hidden" name="param1" value="MRP_MO_ADDON_PDF_ODT_PATH">';
|
||||
$texte .= '<table class="nobordernopadding" width="100%">';
|
||||
@ -158,7 +159,7 @@ class doc_generic_mo_odt extends ModelePDFMo
|
||||
$texte .= $conf->global->MRP_MO_ADDON_PDF_ODT_PATH;
|
||||
$texte .= '</textarea>';
|
||||
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
|
||||
$texte .= '<input type="submit" class="button small" name="Button"value="'.$langs->trans("Modify").'">';
|
||||
$texte .= '<input type="submit" class="button small reposition" name="Button" value="'.$langs->trans("Modify").'">';
|
||||
$texte .= '<br></div></div>';
|
||||
|
||||
// Scan directories
|
||||
|
||||
@ -120,6 +120,7 @@ class doc_generic_product_odt extends ModelePDFProduct
|
||||
$texte = $this->description.".<br>\n";
|
||||
$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" enctype="multipart/form-data">';
|
||||
$texte .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$texte .= '<input type="hidden" name="page_y" value="">';
|
||||
$texte .= '<input type="hidden" name="action" value="setModuleOptions">';
|
||||
$texte .= '<input type="hidden" name="param1" value="PRODUCT_ADDON_PDF_ODT_PATH">';
|
||||
$texte .= '<table class="nobordernopadding" width="100%">';
|
||||
@ -156,7 +157,7 @@ class doc_generic_product_odt extends ModelePDFProduct
|
||||
$texte .= $conf->global->PRODUCT_ADDON_PDF_ODT_PATH;
|
||||
$texte .= '</textarea>';
|
||||
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
|
||||
$texte .= '<input type="submit" class="button small" name="Button"value="'.$langs->trans("Modify").'">';
|
||||
$texte .= '<input type="submit" class="button small reposition" name="Button" value="'.$langs->trans("Modify").'">';
|
||||
$texte .= '<br></div></div>';
|
||||
|
||||
// Scan directories
|
||||
@ -176,7 +177,7 @@ class doc_generic_product_odt extends ModelePDFProduct
|
||||
// Add input to upload a new template file.
|
||||
$texte .= '<div>'.$langs->trans("UploadNewTemplate").' <input type="file" name="uploadfile">';
|
||||
$texte .= '<input type="hidden" value="PRODUCT_ADDON_PDF_ODT_PATH" name="keyforuploaddir">';
|
||||
$texte .= '<input type="submit" class="button small" value="'.dol_escape_htmltag($langs->trans("Upload")).'" name="upload">';
|
||||
$texte .= '<input type="submit" class="button small reposition" value="'.dol_escape_htmltag($langs->trans("Upload")).'" name="upload">';
|
||||
$texte .= '</div>';
|
||||
|
||||
$texte .= '</td>';
|
||||
|
||||
@ -293,18 +293,21 @@ class pdf_standard extends ModelePDFProduct
|
||||
$pdf->writeHTMLCell(190, 3, $this->marge_gauche, $nexY, $texttoshow, 0, 1);
|
||||
$nexY = $pdf->GetY();
|
||||
}
|
||||
if ($object->weight) {
|
||||
$texttoshow = $langs->trans("Length").' x '.$langs->trans("Width").' x '.$langs->trans("Height").': '.($object->length != '' ? $object->length : '?').' x '.($object->width != '' ? $object->width : '?').' x '.($object->height != '' ? $object->height : '?');
|
||||
if ($object->length) {
|
||||
$texttoshow = $langs->trans("Length") . ' x ' . $langs->trans("Width") . ' x ' . $langs->trans("Height") . ': ' . ($object->length != '' ? $object->length : '?') . ' x ' . ($object->width != '' ? $object->width : '?') . ' x ' . ($object->height != '' ? $object->height : '?');
|
||||
$texttoshow .= ' ' . measuringUnitString(0, "size", $object->length_units);
|
||||
$pdf->writeHTMLCell(190, 3, $this->marge_gauche, $nexY, $texttoshow, 0, 1);
|
||||
$nexY = $pdf->GetY();
|
||||
}
|
||||
if ($object->surface) {
|
||||
$texttoshow = $langs->trans("Area").': '.dol_htmlentitiesbr($object->surface);
|
||||
$texttoshow = $langs->trans("Surface") . ': ' . dol_htmlentitiesbr($object->surface);
|
||||
$texttoshow .= ' ' . measuringUnitString(0, "surface", $object->surface_units);
|
||||
$pdf->writeHTMLCell(190, 3, $this->marge_gauche, $nexY, $texttoshow, 0, 1);
|
||||
$nexY = $pdf->GetY();
|
||||
}
|
||||
if ($object->volume) {
|
||||
$texttoshow = $langs->trans("Volume").': '.dol_htmlentitiesbr($object->volume);
|
||||
$texttoshow = $langs->trans("Volume") . ': ' . dol_htmlentitiesbr($object->volume);
|
||||
$texttoshow .= ' ' . measuringUnitString(0, "volume", $object->volume_units);
|
||||
$pdf->writeHTMLCell(190, 3, $this->marge_gauche, $nexY, $texttoshow, 0, 1);
|
||||
$nexY = $pdf->GetY();
|
||||
}
|
||||
|
||||
@ -104,6 +104,7 @@ class mod_codeproduct_elephant extends ModeleProductCode
|
||||
$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
|
||||
$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
$texte .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$texte .= '<input type="hidden" name="page_y" value="">';
|
||||
$texte .= '<input type="hidden" name="action" value="setModuleOptions">';
|
||||
$texte .= '<input type="hidden" name="param1" value="PRODUCT_ELEPHANT_MASK_PRODUCT">';
|
||||
$texte .= '<input type="hidden" name="param2" value="PRODUCT_ELEPHANT_MASK_SERVICE">';
|
||||
@ -118,7 +119,7 @@ class mod_codeproduct_elephant extends ModeleProductCode
|
||||
$texte .= '<tr><td>'.$langs->trans("Mask").' ('.$langs->trans("ProductCodeModel").'):</td>';
|
||||
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="value1" value="'.(!empty($conf->global->PRODUCT_ELEPHANT_MASK_PRODUCT) ? $conf->global->PRODUCT_ELEPHANT_MASK_PRODUCT : '').'"'.$disabled.'>', $tooltip, 1, 1).'</td>';
|
||||
|
||||
$texte .= '<td class="left" rowspan="2"> <input type="submit" class="button small" name="Button"value="'.$langs->trans("Modify").'"'.$disabled.'></td>';
|
||||
$texte .= '<td class="left" rowspan="2"> <input type="submit" class="button small reposition" name="Button" value="'.$langs->trans("Modify").'"'.$disabled.'></td>';
|
||||
|
||||
$texte .= '</tr>';
|
||||
|
||||
|
||||
@ -413,6 +413,7 @@ class doc_generic_project_odt extends ModelePDFProjects
|
||||
$texte = $this->description.".<br>\n";
|
||||
$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
$texte .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$texte .= '<input type="hidden" name="page_y" value="">';
|
||||
$texte .= '<input type="hidden" name="action" value="setModuleOptions">';
|
||||
$texte .= '<input type="hidden" name="param1" value="PROJECT_ADDON_PDF_ODT_PATH">';
|
||||
$texte .= '<table class="nobordernopadding" width="100%">';
|
||||
@ -449,7 +450,7 @@ class doc_generic_project_odt extends ModelePDFProjects
|
||||
$texte .= $conf->global->PROJECT_ADDON_PDF_ODT_PATH;
|
||||
$texte .= '</textarea>';
|
||||
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
|
||||
$texte .= '<input type="submit" class="button small" name="Button"value="'.$langs->trans("Modify").'">';
|
||||
$texte .= '<input type="submit" class="button small reposition" name="Button" value="'.$langs->trans("Modify").'">';
|
||||
$texte .= '<br></div></div>';
|
||||
|
||||
// Scan directories
|
||||
|
||||
@ -380,6 +380,7 @@ class doc_generic_task_odt extends ModelePDFTask
|
||||
$texte = $this->description.".<br>\n";
|
||||
$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
$texte .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$texte .= '<input type="hidden" name="page_y" value="">';
|
||||
$texte .= '<input type="hidden" name="action" value="setModuleOptions">';
|
||||
$texte .= '<input type="hidden" name="param1" value="PROJECT_TASK_ADDON_PDF_ODT_PATH">';
|
||||
$texte .= '<table class="nobordernopadding" width="100%">';
|
||||
@ -416,7 +417,7 @@ class doc_generic_task_odt extends ModelePDFTask
|
||||
$texte .= $conf->global->PROJECT_TASK_ADDON_PDF_ODT_PATH;
|
||||
$texte .= '</textarea>';
|
||||
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
|
||||
$texte .= '<input type="submit" class="button small" name="Button"value="'.$langs->trans("Modify").'">';
|
||||
$texte .= '<input type="submit" class="button small reposition" name="Button" value="'.$langs->trans("Modify").'">';
|
||||
$texte .= '<br></div></div>';
|
||||
|
||||
// Scan directories
|
||||
|
||||
@ -119,6 +119,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales
|
||||
$texte = $this->description.".<br>\n";
|
||||
$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" enctype="multipart/form-data">';
|
||||
$texte .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$texte .= '<input type="hidden" name="page_y" value="">';
|
||||
$texte .= '<input type="hidden" name="action" value="setModuleOptions">';
|
||||
$texte .= '<input type="hidden" name="param1" value="PROPALE_ADDON_PDF_ODT_PATH">';
|
||||
if ($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT > 0) {
|
||||
@ -126,7 +127,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales
|
||||
$texte .= '<input type="hidden" name="param3" value="PROPALE_ADDON_PDF_ODT_TOBILL">';
|
||||
$texte .= '<input type="hidden" name="param4" value="PROPALE_ADDON_PDF_ODT_CLOSED">';
|
||||
}
|
||||
$texte .= '<table class="nobordernopadding" width="100%">';
|
||||
$texte .= '<table class="nobordernopadding centpercent">';
|
||||
|
||||
// List of directories area
|
||||
$texte .= '<tr><td>';
|
||||
@ -160,7 +161,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales
|
||||
$texte .= $conf->global->PROPALE_ADDON_PDF_ODT_PATH;
|
||||
$texte .= '</textarea>';
|
||||
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
|
||||
$texte .= '<input type="submit" class="button small" name="Button"value="'.$langs->trans("Modify").'">';
|
||||
$texte .= '<input type="submit" class="button small reposition" name="Button" value="'.$langs->trans("Modify").'">';
|
||||
$texte .= '<br></div></div>';
|
||||
|
||||
// Scan directories
|
||||
@ -209,7 +210,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales
|
||||
// Add input to upload a new template file.
|
||||
$texte .= '<div>'.$langs->trans("UploadNewTemplate").' <input type="file" name="uploadfile">';
|
||||
$texte .= '<input type="hidden" value="PROPALE_ADDON_PDF_ODT_PATH" name="keyforuploaddir">';
|
||||
$texte .= '<input type="submit" class="button small" value="'.dol_escape_htmltag($langs->trans("Upload")).'" name="upload">';
|
||||
$texte .= '<input type="submit" class="button small reposition" value="'.dol_escape_htmltag($langs->trans("Upload")).'" name="upload">';
|
||||
$texte .= '</div>';
|
||||
$texte .= '</td>';
|
||||
|
||||
|
||||
@ -116,9 +116,10 @@ class doc_generic_reception_odt extends ModelePdfReception
|
||||
$texte = $this->description.".<br>\n";
|
||||
$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
$texte .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$texte .= '<input type="hidden" name="page_y" value="">';
|
||||
$texte .= '<input type="hidden" name="action" value="setModuleOptions">';
|
||||
$texte .= '<input type="hidden" name="param1" value="RECEPTION_ADDON_PDF_ODT_PATH">';
|
||||
$texte .= '<table class="nobordernopadding" width="100%">';
|
||||
$texte .= '<table class="nobordernopadding centpercent">';
|
||||
|
||||
// List of directories area
|
||||
$texte .= '<tr><td>';
|
||||
@ -152,7 +153,7 @@ class doc_generic_reception_odt extends ModelePdfReception
|
||||
$texte .= $conf->global->RECEPTION_ADDON_PDF_ODT_PATH;
|
||||
$texte .= '</textarea>';
|
||||
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
|
||||
$texte .= '<input type="submit" class="button button-edit small" name="Button" value="'.$langs->trans("Modify").'">';
|
||||
$texte .= '<input type="submit" class="button button-edit small reposition" name="Button" value="'.$langs->trans("Modify").'">';
|
||||
$texte .= '<br></div></div>';
|
||||
|
||||
// Scan directories
|
||||
@ -175,7 +176,7 @@ class doc_generic_reception_odt extends ModelePdfReception
|
||||
// Add input to upload a new template file.
|
||||
$texte .= '<div>'.$langs->trans("UploadNewTemplate").' <input type="file" name="uploadfile">';
|
||||
$texte .= '<input type="hidden" value="RECEPTION_ADDON_PDF_ODT_PATH" name="keyforuploaddir">';
|
||||
$texte .= '<input type="submit" class="button small" value="'.dol_escape_htmltag($langs->trans("Upload")).'" name="upload">';
|
||||
$texte .= '<input type="submit" class="button small reposition" value="'.dol_escape_htmltag($langs->trans("Upload")).'" name="upload">';
|
||||
$texte .= '</div>';
|
||||
|
||||
$texte .= '</td>';
|
||||
|
||||
@ -4,8 +4,7 @@ Adding your own password generator module
|
||||
------------------------------------
|
||||
|
||||
|
||||
If you want to add your own password generator module. This is steps to follow
|
||||
to add you own password generator:
|
||||
If you want to add your own password generator module. This is steps to follow to add your own password generator:
|
||||
|
||||
|
||||
***** STEP 1 *****
|
||||
@ -13,18 +12,16 @@ to add you own password generator:
|
||||
Copy file
|
||||
htdocs/core/modules/security/modGeneratePassNone.class.php
|
||||
into
|
||||
htdocs/core/modules/mailings/modMyGenerator.class.php
|
||||
htdocs/core/modules/mailings/modGeneratePassMygenerator.class.php
|
||||
|
||||
You can choose value of your choice instead of "myGenerator" in name
|
||||
of new file.
|
||||
You can choose value of your choice instead of "Mygenerator" in name of new file.
|
||||
|
||||
|
||||
***** STEP 2 *****
|
||||
|
||||
Edit this file modMyGenerator.class.php and change following text:
|
||||
Edit this file modGeneratePassMygenerator.class.php and change following text:
|
||||
|
||||
"class modGeneratePassNone" into "class modMyGenerator"
|
||||
"function modGeneratePassNone" into "function modMyGenerator"
|
||||
"class modGeneratePassNone" into "class modGeneratePassMygenerator"
|
||||
|
||||
Then add code inside the "getDecription" function.
|
||||
Then add code inside the "getExample" function.
|
||||
|
||||
@ -26,8 +26,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/security/generate/modules_genpassw
|
||||
|
||||
|
||||
/**
|
||||
* \class modGeneratePassNone
|
||||
* \brief Class to generate a password according to rule 'no password'
|
||||
* Class to generate a password according to rule 'no password'
|
||||
*/
|
||||
class modGeneratePassNone extends ModeleGenPassword
|
||||
{
|
||||
@ -36,8 +35,20 @@ class modGeneratePassNone extends ModeleGenPassword
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* Minimum length (text visible by end user)
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $length;
|
||||
|
||||
/**
|
||||
* Minimum length in number of characters
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
public $length2;
|
||||
|
||||
/**
|
||||
* @var DoliDB Database handler.
|
||||
*/
|
||||
@ -60,6 +71,7 @@ class modGeneratePassNone extends ModeleGenPassword
|
||||
{
|
||||
$this->id = "none";
|
||||
$this->length = 0;
|
||||
$this->length2 = 0;
|
||||
|
||||
$this->db = $db;
|
||||
$this->conf = $conf;
|
||||
@ -99,10 +111,11 @@ class modGeneratePassNone extends ModeleGenPassword
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate a password
|
||||
* Validate a password.
|
||||
* This function is called by User->setPassword() and internally to validate that the password matches the constraints.
|
||||
*
|
||||
* @param string $password Password to check
|
||||
* @return int 0 if KO, >0 if OK
|
||||
* @param string $password Password to check
|
||||
* @return int 0 if KO, >0 if OK
|
||||
*/
|
||||
public function validatePassword($password)
|
||||
{
|
||||
|
||||
@ -28,8 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/security/generate/modules_genpassw
|
||||
|
||||
|
||||
/**
|
||||
* \class modGeneratePassPerso
|
||||
* \brief Class to generate a password according to personal rules
|
||||
* Class to generate a password according to personal rules
|
||||
*/
|
||||
class modGeneratePassPerso extends ModeleGenPassword
|
||||
{
|
||||
@ -38,13 +37,31 @@ class modGeneratePassPerso extends ModeleGenPassword
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* Minimum length (text visible by end user)
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $length;
|
||||
public $length2; // didn't overright display
|
||||
|
||||
/**
|
||||
* Minimum length in number of characters
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
public $length2;
|
||||
|
||||
public $NbMaj;
|
||||
public $NbNum;
|
||||
public $NbSpe;
|
||||
public $NbRepeat;
|
||||
public $WithoutAmbi;
|
||||
|
||||
/**
|
||||
* Flag to 1 if we must clean ambiguous charaters for the autogeneration of password (List of ambiguous char is in $this->Ambi)
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
public $WithoutAmbi = 0;
|
||||
|
||||
/**
|
||||
* @var DoliDB Database handler.
|
||||
@ -81,7 +98,7 @@ class modGeneratePassPerso extends ModeleGenPassword
|
||||
$this->user = $user;
|
||||
|
||||
if (empty($conf->global->USER_PASSWORD_PATTERN)) {
|
||||
// default value (10carac, 1maj, 1digit, 1spe, 3 repeat, no ambi at auto generation.
|
||||
// default value at auto generation (12 chars, 1 upercase, 1 digit, 1 special char, 3 repeat, exclude ambiguous characters).
|
||||
dolibarr_set_const($db, "USER_PASSWORD_PATTERN", '12;1;1;1;3;1', 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
|
||||
@ -98,7 +115,15 @@ class modGeneratePassPerso extends ModeleGenPassword
|
||||
$this->NbSpe = $tabConf[3];
|
||||
$this->NbRepeat = $tabConf[4];
|
||||
$this->WithoutAmbi = $tabConf[5];
|
||||
}
|
||||
|
||||
/**
|
||||
* Init the property ->All and clean ->Maj, ->Min, ->Nb and ->Spe with list of valid chars
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function initAll()
|
||||
{
|
||||
if ($this->WithoutAmbi) {
|
||||
$this->Maj = str_replace($this->Ambi, "", $this->Maj);
|
||||
$this->Min = str_replace($this->Ambi, "", $this->Min);
|
||||
@ -108,16 +133,12 @@ class modGeneratePassPerso extends ModeleGenPassword
|
||||
|
||||
$pattern = $this->Min.(!empty($this->NbMaj) ? $this->Maj : '').(!empty($this->NbNum) ? $this->Nb : '').(!empty($this->NbSpe) ? $this->Spe : '');
|
||||
$this->All = str_shuffle($pattern);
|
||||
|
||||
//$this->All = str_shuffle($this->Maj. $this->Min. $this->Nb. $this->Spe);
|
||||
//$this->All = $this->Maj. $this->Min. $this->Nb. $this->Spe;
|
||||
//$this->All = $this->Spe;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return description of module
|
||||
* Return description of module
|
||||
*
|
||||
* @return string Description of text
|
||||
* @return string Description of text
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
@ -126,9 +147,9 @@ class modGeneratePassPerso extends ModeleGenPassword
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an example of password generated by this module
|
||||
* Return an example of password generated by this module
|
||||
*
|
||||
* @return string Example of password
|
||||
* @return string Example of password
|
||||
*/
|
||||
public function getExample()
|
||||
{
|
||||
@ -142,6 +163,8 @@ class modGeneratePassPerso extends ModeleGenPassword
|
||||
*/
|
||||
public function getNewGeneratedPassword()
|
||||
{
|
||||
$this->initAll();
|
||||
|
||||
$pass = "";
|
||||
for ($i = 0; $i < $this->NbMaj; $i++) {
|
||||
// Y
|
||||
@ -169,67 +192,95 @@ class modGeneratePassPerso extends ModeleGenPassword
|
||||
return $pass;
|
||||
}
|
||||
|
||||
return $this->getNewGeneratedPassword();
|
||||
return $this->getNewGeneratedPassword(); // warning, may generate infinite loop if conditions are not possible
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate a password
|
||||
* Validate a password.
|
||||
* This function is called by User->setPassword() and internally to validate that the password matches the constraints.
|
||||
*
|
||||
* @param string $password Password to check
|
||||
* @return bool false if KO, true if OK
|
||||
* @return int 0 if KO, >0 if OK
|
||||
*/
|
||||
public function validatePassword($password)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$this->initAll(); // For the case this method is called alone
|
||||
|
||||
$password_a = preg_split('//u', $password, null, PREG_SPLIT_NO_EMPTY);
|
||||
$maj = preg_split('//u', $this->Maj, null, PREG_SPLIT_NO_EMPTY);
|
||||
$num = preg_split('//u', $this->Nb, null, PREG_SPLIT_NO_EMPTY);;
|
||||
$spe = preg_split('//u', $this->Spe, null, PREG_SPLIT_NO_EMPTY);
|
||||
/*
|
||||
$password_a = str_split($password);
|
||||
$maj = str_split($this->Maj);
|
||||
$num = str_split($this->Nb);
|
||||
$spe = str_split($this->Spe);
|
||||
*/
|
||||
|
||||
if (dol_strlen($password) < $this->length2) {
|
||||
$langs->load("other");
|
||||
$this->error = $langs->trans("YourPasswordMustHaveAtLeastXChars", $this->length2);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (count(array_intersect($password_a, $maj)) < $this->NbMaj) {
|
||||
return false;
|
||||
$langs->load("other");
|
||||
$this->error = $langs->trans('PasswordNeedAtLeastXUpperCaseChars', $this->NbMaj);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (count(array_intersect($password_a, $num)) < $this->NbNum) {
|
||||
return false;
|
||||
$langs->load("other");
|
||||
$this->error = $langs->trans('PasswordNeedAtLeastXDigitChars', $this->NbNum);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (count(array_intersect($password_a, $spe)) < $this->NbSpe) {
|
||||
return false;
|
||||
$langs->load("other");
|
||||
$this->error = $langs->trans('PasswordNeedAtLeastXSpecialChars', $this->NbSpe);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!$this->consecutiveInterationSameCharacter($password)) {
|
||||
return false;
|
||||
if (!$this->consecutiveIterationSameCharacter($password)) {
|
||||
$langs->load("other");
|
||||
$this->error = $langs->trans('PasswordNeedNoXConsecutiveChars', $this->NbRepeat);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return true;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the consecutive iterations of the same character. Return false if the number doesn't match the maximum consecutive value allowed.
|
||||
* Check the consecutive iterations of the same character.
|
||||
*
|
||||
* @param string $password Password to check
|
||||
* @return bool
|
||||
* @return bool False if the number doesn't match the maximum consecutive value allowed.
|
||||
*/
|
||||
private function consecutiveInterationSameCharacter($password)
|
||||
public function consecutiveIterationSameCharacter($password)
|
||||
{
|
||||
$last = "";
|
||||
$this->initAll();
|
||||
|
||||
if (empty($this->NbRepeat)) {
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
$count = 0;
|
||||
$char = str_split($password);
|
||||
$char = preg_split('//u', $password, null, PREG_SPLIT_NO_EMPTY);
|
||||
|
||||
$last = "";
|
||||
$count = 0;
|
||||
foreach ($char as $c) {
|
||||
if ($c != $last) {
|
||||
$last = $c;
|
||||
$count = 0;
|
||||
|
||||
$count = 1;
|
||||
//print "Char $c - count = $count\n";
|
||||
continue;
|
||||
}
|
||||
|
||||
$count++;
|
||||
//print "Char $c - count = $count\n";
|
||||
|
||||
if ($count > $this->NbRepeat) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -26,8 +26,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/security/generate/modules_genpassw
|
||||
|
||||
|
||||
/**
|
||||
* \class modGeneratePassStandard
|
||||
* \brief Class to generate a password according to a dolibarr standard rule (8 random chars)
|
||||
* Class to generate a password according to a dolibarr standard rule (12 random chars)
|
||||
*/
|
||||
class modGeneratePassStandard extends ModeleGenPassword
|
||||
{
|
||||
@ -36,8 +35,20 @@ class modGeneratePassStandard extends ModeleGenPassword
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* Minimum length (text visible by end user)
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $length;
|
||||
|
||||
/**
|
||||
* Minimum length in number of characters
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
public $length2;
|
||||
|
||||
/**
|
||||
* @var DoliDB Database handler.
|
||||
*/
|
||||
@ -60,6 +71,7 @@ class modGeneratePassStandard extends ModeleGenPassword
|
||||
{
|
||||
$this->id = "standard";
|
||||
$this->length = 12;
|
||||
$this->length2 = 12;
|
||||
|
||||
$this->db = $db;
|
||||
$this->conf = $conf;
|
||||
@ -125,15 +137,21 @@ class modGeneratePassStandard extends ModeleGenPassword
|
||||
|
||||
/**
|
||||
* Validate a password
|
||||
* This function is called by User->setPassword() and internally to validate that the password matches the constraints.
|
||||
*
|
||||
* @param string $password Password to check
|
||||
* @return int 0 if KO, >0 if OK
|
||||
*/
|
||||
public function validatePassword($password)
|
||||
{
|
||||
if (dol_strlen($password) < $this->length) {
|
||||
global $langs;
|
||||
|
||||
if (dol_strlen($password) < $this->length2) {
|
||||
$langs->load("other");
|
||||
$this->error = $langs->trans("YourPasswordMustHaveAtLeastXChars", $this->length2);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,11 +25,17 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
|
||||
|
||||
|
||||
/**
|
||||
* \class ModeleGenPassword
|
||||
* \brief Parent class for password rules/management modules
|
||||
* Parent class for password rules/management modules
|
||||
*/
|
||||
abstract class ModeleGenPassword
|
||||
{
|
||||
/**
|
||||
* Flag to 1 if we must clean ambiguous charaters for the autogeneration of password (List of ambiguous char is in $this->Ambi)
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
public $WithoutAmbi = 0;
|
||||
|
||||
/**
|
||||
* @var string Error code (or message)
|
||||
*/
|
||||
@ -80,10 +86,11 @@ abstract class ModeleGenPassword
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate a password
|
||||
* Validate a password.
|
||||
* This function is called by User->setPassword() and internally to validate that the password matches the constraints.
|
||||
*
|
||||
* @param string $password Password to check
|
||||
* @return int 0 if KO, >0 if OK
|
||||
* @param string $password Password to check
|
||||
* @return int 0 if KO, >0 if OK
|
||||
*/
|
||||
public function validatePassword($password)
|
||||
{
|
||||
|
||||
@ -104,6 +104,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc
|
||||
$texte = $this->description.".<br>\n";
|
||||
$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" enctype="multipart/form-data">';
|
||||
$texte .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$texte .= '<input type="hidden" name="page_y" value="">';
|
||||
$texte .= '<input type="hidden" name="action" value="setModuleOptions">';
|
||||
$texte .= '<input type="hidden" name="param1" value="COMPANY_ADDON_PDF_ODT_PATH">';
|
||||
$texte .= '<table class="nobordernopadding" width="100%">';
|
||||
@ -141,7 +142,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc
|
||||
$texte .= '</textarea>';
|
||||
$texte .= '</td>';
|
||||
$texte .= '<td class="center"> ';
|
||||
$texte .= '<input type="submit" class="button small" name="Button"value="'.$langs->trans("Modify").'">';
|
||||
$texte .= '<input type="submit" class="button small reposition" name="Button" value="'.$langs->trans("Modify").'">';
|
||||
$texte .= '</td>';
|
||||
$texte .= '</tr>';
|
||||
$texte .= '</table>';
|
||||
@ -167,7 +168,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc
|
||||
// Add input to upload a new template file.
|
||||
$texte .= '<div>'.$langs->trans("UploadNewTemplate").' <input type="file" name="uploadfile">';
|
||||
$texte .= '<input type="hidden" value="COMPANY_ADDON_PDF_ODT_PATH" name="keyforuploaddir">';
|
||||
$texte .= '<input type="submit" class="button small" value="'.dol_escape_htmltag($langs->trans("Upload")).'" name="upload">';
|
||||
$texte .= '<input type="submit" class="button small reposition" value="'.dol_escape_htmltag($langs->trans("Upload")).'" name="upload">';
|
||||
$texte .= '</div>';
|
||||
$texte .= '</td>';
|
||||
|
||||
|
||||
@ -119,6 +119,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
|
||||
$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
|
||||
$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
$texte .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$texte .= '<input type="hidden" name="page_y" value="">';
|
||||
$texte .= '<input type="hidden" name="action" value="setModuleOptions">';
|
||||
$texte .= '<input type="hidden" name="param1" value="COMPANY_ELEPHANT_MASK_CUSTOMER">';
|
||||
$texte .= '<input type="hidden" name="param2" value="COMPANY_ELEPHANT_MASK_SUPPLIER">';
|
||||
@ -134,7 +135,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
|
||||
$texte .= '<tr><td>'.$langs->trans("Mask").' ('.$langs->trans("CustomerCodeModel").'):</td>';
|
||||
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="value1" value="'.getDolGlobalString('COMPANY_ELEPHANT_MASK_CUSTOMER').'"'.$disabled.'>', $tooltip, 1, 1).'</td>';
|
||||
|
||||
$texte .= '<td class="left" rowspan="2"> <input type="submit" class="button button-edit" name="Button"value="'.$langs->trans("Modify").'"'.$disabled.'></td>';
|
||||
$texte .= '<td class="left" rowspan="2"> <input type="submit" class="button button-edit reposition" name="Button" value="'.$langs->trans("Modify").'"'.$disabled.'></td>';
|
||||
|
||||
$texte .= '</tr>';
|
||||
|
||||
|
||||
@ -82,6 +82,7 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode
|
||||
$tooltip = '';
|
||||
$texte = '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
$texte .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$texte .= '<input type="hidden" name="page_y" value="">';
|
||||
$texte .= '<input type="hidden" name="action" value="setModuleOptions">';
|
||||
$texte .= '<input type="hidden" name="param1" value="COMPANY_AQUARIUM_MASK_SUPPLIER">';
|
||||
$texte .= '<input type="hidden" name="param2" value="COMPANY_AQUARIUM_MASK_CUSTOMER">';
|
||||
@ -102,7 +103,7 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode
|
||||
$texte .= $langs->trans('COMPANY_AQUARIUM_CLEAN_REGEX').' = '.$conf->global->COMPANY_AQUARIUM_CLEAN_REGEX."<br>\n";
|
||||
}
|
||||
$texte .= '</td>';
|
||||
$texte .= '<td class="right"><input type="submit" class="button button-edit" name="Button"value="'.$langs->trans("Modify").'"></td>';
|
||||
$texte .= '<td class="right"><input type="submit" class="button button-edit reposition" name="Button" value="'.$langs->trans("Modify").'"></td>';
|
||||
$texte .= '</tr></table>';
|
||||
$texte .= '</form>';
|
||||
|
||||
|
||||