mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-01-05 16:42:53 +01:00
Merge remote-tracking branch 'origin/3.6' into 3.7
Conflicts: ChangeLog htdocs/comm/fiche.php htdocs/core/lib/functions2.lib.php htdocs/fourn/fiche.php htdocs/langs/fr_FR/compta.lang htdocs/projet/element.php htdocs/projet/tasks/contact.php htdocs/projet/tasks/time.php
This commit is contained in:
193
htdocs/core/lib/accounting.lib.php
Normal file
193
htdocs/core/lib/accounting.lib.php
Normal file
@@ -0,0 +1,193 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/lib/account.lib.php
|
||||
* \ingroup Accounting Expert
|
||||
* \brief Library of accountancy functions
|
||||
*/
|
||||
|
||||
/**
|
||||
* Prepare array with list of admin tabs
|
||||
*
|
||||
* @param Object $object Object instance we show card
|
||||
* @return array Array of tabs to show
|
||||
*/
|
||||
function admin_accounting_prepare_head($object=null)
|
||||
{
|
||||
global $langs, $conf;
|
||||
|
||||
$h = 0;
|
||||
$head = array ();
|
||||
|
||||
$head[$h][0] = dol_buildpath('/accountancy/admin/index.php', 1);
|
||||
$head[$h][1] = $langs->trans("Configuration");
|
||||
$head[$h][2] = 'general';
|
||||
$h ++;
|
||||
|
||||
// Show more tabs from modules
|
||||
// Entries must be declared in modules descriptor with line
|
||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||
// $this->tabs = array('entity:-tabname); to remove a tab
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'accounting_admin');
|
||||
|
||||
$head[$h][0] = dol_buildpath('/accountancy/admin/journaux.php', 1);
|
||||
$head[$h][1] = $langs->trans("Journaux");
|
||||
$head[$h][2] = 'journal';
|
||||
$h ++;
|
||||
|
||||
$head[$h][0] = dol_buildpath('/accountancy/admin/export.php', 1);
|
||||
$head[$h][1] = $langs->trans("Export");
|
||||
$head[$h][2] = 'export';
|
||||
$h ++;
|
||||
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'accounting_admin', 'remove');
|
||||
|
||||
return $head;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare array with list of tabs
|
||||
*
|
||||
* @param Object $object Accounting account
|
||||
* @return array Array of tabs to show
|
||||
*/
|
||||
function accounting_prepare_head($object)
|
||||
{
|
||||
global $langs, $conf;
|
||||
|
||||
$h = 0;
|
||||
$head = array ();
|
||||
|
||||
$head[$h][0] = dol_buildpath('/accountancy/admin/card.php', 1) . '?id=' . $object->id;
|
||||
$head[$h][1] = $langs->trans("Card");
|
||||
$head[$h][2] = 'card';
|
||||
$h ++;
|
||||
|
||||
// Show more tabs from modules
|
||||
// Entries must be declared in modules descriptor with line
|
||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||
// $this->tabs = array('entity:-tabname); to remove a tab
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'accounting_account');
|
||||
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'accounting_account', 'remove');
|
||||
|
||||
return $head;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return general accounting account with defined length
|
||||
*
|
||||
* @param string $account General accounting account
|
||||
* @return string String with defined length
|
||||
*/
|
||||
function length_accountg($account)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$g = $conf->global->ACCOUNTING_LENGTH_GACCOUNT;
|
||||
|
||||
if (! empty($g)) {
|
||||
// Clean parameters
|
||||
$i = strlen($account);
|
||||
|
||||
if ($i >= 2) {
|
||||
while ( $i < $g ) {
|
||||
$account .= '0';
|
||||
|
||||
$i ++;
|
||||
}
|
||||
|
||||
return $account;
|
||||
} else {
|
||||
return $account;
|
||||
}
|
||||
} else {
|
||||
return $account;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return auxiliary accounting account with defined length
|
||||
*
|
||||
* @param string $accounta Auxiliary accounting account
|
||||
* @return string String with defined length
|
||||
*/
|
||||
function length_accounta($accounta)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$a = $conf->global->ACCOUNTING_LENGTH_AACCOUNT;
|
||||
|
||||
if (! empty($a)) {
|
||||
// Clean parameters
|
||||
$i = strlen($accounta);
|
||||
|
||||
if ($i >= 2) {
|
||||
while ( $i < $a ) {
|
||||
$accounta .= '0';
|
||||
|
||||
$i ++;
|
||||
}
|
||||
|
||||
return $accounta;
|
||||
} else {
|
||||
return $accounta;
|
||||
}
|
||||
} else {
|
||||
return $accounta;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return accounting account with defined length for Sage Export Software
|
||||
*
|
||||
* @param string $txt Accounting account
|
||||
* @param int $len Length
|
||||
* @param int $end Number of characters
|
||||
*
|
||||
* @return string Formated string
|
||||
*/
|
||||
function length_exportsage($txt, $len, $end)
|
||||
{
|
||||
// $txt = utf8_decode($txt);
|
||||
// problem with this function, but we need to have the number of letter
|
||||
if (strlen($txt) == $len) {
|
||||
$res = $txt;
|
||||
}
|
||||
|
||||
elseif (strlen($txt) > $len) {
|
||||
$res = substr($txt, 0, $len);
|
||||
}
|
||||
|
||||
else {
|
||||
if ($end == 1) {
|
||||
$res = $txt;
|
||||
} else {
|
||||
$res = "";
|
||||
}
|
||||
for($i = strlen($txt); $i <= ($len - 1); $i ++) {
|
||||
$res .= " ";
|
||||
}
|
||||
if ($end == 0) {
|
||||
$res .= $txt;
|
||||
}
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
@@ -70,7 +70,7 @@ function versioncompare($versionarray1,$versionarray2)
|
||||
if ($operande1 < $operande2) { $ret = -$level; break; }
|
||||
if ($operande1 > $operande2) { $ret = $level; break; }
|
||||
}
|
||||
//print join('.',$versionarray1).'('.count($versionarray1).') / '.join('.',$versionarray2).'('.count($versionarray2).') => '.$ret;
|
||||
//print join('.',$versionarray1).'('.count($versionarray1).') / '.join('.',$versionarray2).'('.count($versionarray2).') => '.$ret.'<br>'."\n";
|
||||
return $ret;
|
||||
}
|
||||
|
||||
@@ -215,7 +215,6 @@ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1,$handler='',$oker
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog('Admin.lib::run_sql Failed to get max rowid for '.$table.' '.$db->lasterror().' sql='.$sqlgetrowid, LOG_ERR);
|
||||
if (! $silent) print '<tr><td valign="top" colspan="2">';
|
||||
if (! $silent) print '<div class="error">'.$langs->trans("Failed to get max rowid for ".$table)."</div></td>";
|
||||
if (! $silent) print '</tr>';
|
||||
@@ -226,7 +225,7 @@ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1,$handler='',$oker
|
||||
$from='__+MAX_'.$table.'__';
|
||||
$to='+'.$listofmaxrowid[$table];
|
||||
$newsql=str_replace($from,$to,$newsql);
|
||||
dol_syslog('Admin.lib::run_sql New Request '.($i+1).' (replacing '.$from.' to '.$to.') sql='.$newsql, LOG_DEBUG);
|
||||
dol_syslog('Admin.lib::run_sql New Request '.($i+1).' (replacing '.$from.' to '.$to.')', LOG_DEBUG);
|
||||
|
||||
$arraysql[$i]=$newsql;
|
||||
}
|
||||
@@ -251,7 +250,7 @@ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1,$handler='',$oker
|
||||
|
||||
// Ajout trace sur requete (eventuellement a commenter si beaucoup de requetes)
|
||||
if (! $silent) print '<tr><td valign="top">'.$langs->trans("Request").' '.($i+1)." sql='".dol_htmlentities($newsql,ENT_NOQUOTES)."'</td></tr>\n";
|
||||
dol_syslog('Admin.lib::run_sql Request '.($i+1).' sql='.$newsql, LOG_DEBUG);
|
||||
dol_syslog('Admin.lib::run_sql Request '.($i+1), LOG_DEBUG);
|
||||
$sqlmodified=0;
|
||||
|
||||
// Replace for encrypt data
|
||||
@@ -300,7 +299,7 @@ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1,$handler='',$oker
|
||||
$sqlmodified++;
|
||||
}
|
||||
|
||||
if ($sqlmodified) dol_syslog('Admin.lib::run_sql New Request '.($i+1).' sql='.$newsql, LOG_DEBUG);
|
||||
if ($sqlmodified) dol_syslog('Admin.lib::run_sql New Request '.($i+1), LOG_DEBUG);
|
||||
|
||||
$result=$db->query($newsql,$usesavepoint);
|
||||
if ($result)
|
||||
@@ -393,7 +392,7 @@ function dolibarr_del_const($db, $name, $entity=1)
|
||||
$sql.= ")";
|
||||
if ($entity >= 0) $sql.= " AND entity = ".$entity;
|
||||
|
||||
dol_syslog("admin.lib::dolibarr_del_const sql=".$sql);
|
||||
dol_syslog("admin.lib::dolibarr_del_const", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@@ -427,7 +426,7 @@ function dolibarr_get_const($db, $name, $entity=1)
|
||||
$sql.= " WHERE name = ".$db->encrypt($name,1);
|
||||
$sql.= " AND entity = ".$entity;
|
||||
|
||||
dol_syslog("admin.lib::dolibarr_get_const sql=".$sql);
|
||||
dol_syslog("admin.lib::dolibarr_get_const", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@@ -474,7 +473,7 @@ function dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $not
|
||||
$sql.= " WHERE name = ".$db->encrypt($name,1);
|
||||
if ($entity >= 0) $sql.= " AND entity = ".$entity;
|
||||
|
||||
dol_syslog("admin.lib::dolibarr_set_const sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog("admin.lib::dolibarr_set_const", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
|
||||
if (strcmp($value,'')) // true if different. Must work for $value='0' or $value=0
|
||||
@@ -487,7 +486,7 @@ function dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $not
|
||||
|
||||
//print "sql".$value."-".pg_escape_string($value)."-".$sql;exit;
|
||||
//print "xx".$db->escape($value);
|
||||
dol_syslog("admin.lib::dolibarr_set_const sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog("admin.lib::dolibarr_set_const", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
}
|
||||
|
||||
@@ -500,7 +499,6 @@ function dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $not
|
||||
else
|
||||
{
|
||||
$error=$db->lasterror();
|
||||
dol_syslog("admin.lib::dolibarr_set_const ".$error, LOG_ERR);
|
||||
$db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@@ -510,7 +508,7 @@ function dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $not
|
||||
/**
|
||||
* Prepare array with list of tabs
|
||||
*
|
||||
* @return array Array of tabs to shoc
|
||||
* @return array Array of tabs to show
|
||||
*/
|
||||
function security_prepare_head()
|
||||
{
|
||||
@@ -714,7 +712,7 @@ function activateModule($value,$withdeps=1)
|
||||
// Test if Dolibarr version ok
|
||||
$verdol=versiondolibarrarray();
|
||||
$vermin=isset($objMod->need_dolibarr_version)?$objMod->need_dolibarr_version:0;
|
||||
//print 'eee'.versioncompare($verdol,$vermin).join(',',$verdol).' - '.join(',',$vermin);exit;
|
||||
//print 'eee '.versioncompare($verdol,$vermin).' - '.join(',',$verdol).' - '.join(',',$vermin);exit;
|
||||
if (is_array($vermin) && versioncompare($verdol,$vermin) < 0)
|
||||
{
|
||||
return $langs->trans("ErrorModuleRequireDolibarrVersion",versiontostring($vermin));
|
||||
@@ -855,18 +853,19 @@ function unActivateModule($value, $requiredby=1)
|
||||
*
|
||||
* @param array $taborder Taborder
|
||||
* @param array $tabname Tabname
|
||||
* @param array $tablib Tablib
|
||||
* @param array $tabsql Tabsql
|
||||
* @param array $tabsqlsort Tabsqlsort
|
||||
* @param array $tablib Tablib
|
||||
* @param array $tabsql Tabsql
|
||||
* @param array $tabsqlsort Tabsqlsort
|
||||
* @param array $tabfield Tabfield
|
||||
* @param array $tabfieldvalue Tabfieldvalue
|
||||
* @param array $tabfieldinsert Tabfieldinsert
|
||||
* @param array $tabfieldinsert Tabfieldinsert
|
||||
* @param array $tabrowid Tabrowid
|
||||
* @param array $tabcond Tabcond
|
||||
* @param array $tabhelp Tabhelp
|
||||
* @param array $tabfieldcheck Tabfieldcheck
|
||||
* @return int 1
|
||||
*/
|
||||
function complete_dictionary_with_modules(&$taborder,&$tabname,&$tablib,&$tabsql,&$tabsqlsort,&$tabfield,&$tabfieldvalue,&$tabfieldinsert,&$tabrowid,&$tabcond,&$tabhelp)
|
||||
function complete_dictionary_with_modules(&$taborder,&$tabname,&$tablib,&$tabsql,&$tabsqlsort,&$tabfield,&$tabfieldvalue,&$tabfieldinsert,&$tabrowid,&$tabcond,&$tabhelp,&$tabfieldcheck)
|
||||
{
|
||||
global $db, $modules, $conf, $langs;
|
||||
|
||||
@@ -966,6 +965,7 @@ function complete_dictionary_with_modules(&$taborder,&$tabname,&$tablib,&$tabsql
|
||||
{
|
||||
//var_dump($objMod->dictionaries['tabname']);
|
||||
$taborder[] = 0;
|
||||
$tabfieldcheck[] = array(); $tabhelp[] = array();
|
||||
foreach($objMod->dictionaries['tabname'] as $val)
|
||||
{
|
||||
$taborder[] = count($tabname)+1;
|
||||
@@ -979,6 +979,7 @@ function complete_dictionary_with_modules(&$taborder,&$tabname,&$tablib,&$tabsql
|
||||
foreach($objMod->dictionaries['tabfieldinsert'] as $val) $tabfieldinsert[] = $val;
|
||||
foreach($objMod->dictionaries['tabrowid'] as $val) $tabrowid[] = $val;
|
||||
foreach($objMod->dictionaries['tabcond'] as $val) $tabcond[] = $val;
|
||||
if (! empty($objMod->dictionaries['tabfieldcheck'])) foreach($objMod->dictionaries['tabfieldcheck'] as $val) $tabfieldcheck[] = $val;
|
||||
if (! empty($objMod->dictionaries['tabhelp'])) foreach($objMod->dictionaries['tabhelp'] as $val) $tabhelp[] = $val;
|
||||
//foreach($objMod->dictionaries['tabsqlsort'] as $val) $tablib[] = $val;
|
||||
//$tabname = array_merge ($tabname, $objMod->dictionaries['tabname']);
|
||||
@@ -1043,7 +1044,7 @@ function form_constantes($tableau,$strictw3c=0)
|
||||
$sql.= " ORDER BY name ASC, entity DESC";
|
||||
$result = $db->query($sql);
|
||||
|
||||
dol_syslog("List params sql=".$sql);
|
||||
dol_syslog("List params", LOG_DEBUG);
|
||||
if ($result)
|
||||
{
|
||||
$obj = $db->fetch_object($result); // Take first result of select
|
||||
@@ -1192,7 +1193,7 @@ function showModulesExludedForExternal($modules)
|
||||
$text .= $langs->trans('Module'.$module->numero.'Name');
|
||||
}
|
||||
}
|
||||
return img_picto($langs->trans('InfoAdmin'), 'star').' '.$text;
|
||||
return $text;
|
||||
}
|
||||
|
||||
|
||||
@@ -1217,7 +1218,7 @@ function addDocumentModel($name, $type, $label='', $description='')
|
||||
$sql.= (! empty($description)?"'".$db->escape($description)."'":"null");
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog("admin.lib::addDocumentModel sql=".$sql);
|
||||
dol_syslog("admin.lib::addDocumentModel", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@@ -1250,7 +1251,7 @@ function delDocumentModel($name, $type)
|
||||
$sql.= " AND type = '".$type."'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
|
||||
dol_syslog("admin.lib::delDocumentModel sql=".$sql);
|
||||
dol_syslog("admin.lib::delDocumentModel", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2008-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2008-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
@@ -39,25 +39,30 @@
|
||||
* @param string $filterd Filter of done by user
|
||||
* @param int $pid Product id
|
||||
* @param int $socid Third party id
|
||||
* @param string $action Action string
|
||||
* @param array $showextcals Array with list of external calendars (used to show links to select calendar), or -1 to show no legend
|
||||
* @param string $actioncode Preselected value of actioncode for filter on type
|
||||
* @param int $usergroupid Id of group to filter on users
|
||||
* @return void
|
||||
*/
|
||||
function print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, $filtera, $filtert, $filterd, $pid, $socid, $showextcals=array(), $actioncode='') {
|
||||
|
||||
global $conf, $user, $langs, $db;
|
||||
function print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, $filtera, $filtert, $filterd, $pid, $socid, $action, $showextcals=array(), $actioncode='', $usergroupid='')
|
||||
{
|
||||
global $conf, $user, $langs, $db, $hookmanager;
|
||||
global $begin_h, $end_h, $begin_d, $end_d;
|
||||
|
||||
// Filters
|
||||
print '<form name="listactionsfilter" class="listactionsfilter" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
||||
print '<input type="hidden" name="status" value="' . $status . '">';
|
||||
print '<input type="hidden" name="year" value="' . $year . '">';
|
||||
print '<input type="hidden" name="month" value="' . $month . '">';
|
||||
print '<input type="hidden" name="day" value="' . $day . '">';
|
||||
print '<input type="hidden" name="action" value="' . $action . '">';
|
||||
print '<input type="hidden" name="showbirthday" value="' . $showbirthday . '">';
|
||||
print '<table class="nobordernopadding" width="100%">';
|
||||
|
||||
print '<tr><td class="nowrap">';
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
if (! empty($conf->browser->phone)) print '<div class="fichehalfleft">';
|
||||
else print '<table class="nobordernopadding" width="100%"><tr><td class="nowrap">';
|
||||
|
||||
print '<table class="nobordernopadding">';
|
||||
|
||||
@@ -65,35 +70,38 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td class="nowrap">';
|
||||
print $langs->trans("ActionsAskedBy");
|
||||
print ' </td><td class="nowrap maxwidthonsmartphone">';
|
||||
print $form->select_dolusers($filtera, 'userasked', 1, '', ! $canedit);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr>';
|
||||
print '<td class="nowrap">';
|
||||
print $langs->trans("or") . ' ' . $langs->trans("ActionsToDoBy");
|
||||
print ' </td><td class="nowrap maxwidthonsmartphone">';
|
||||
print $langs->trans("ActionsOwnedBy").' ';
|
||||
print '</td><td class="nowrap maxwidthonsmartphone">';
|
||||
print $form->select_dolusers($filtert, 'usertodo', 1, '', ! $canedit);
|
||||
if (empty($conf->dol_optimize_smallscreen)) print ' '.$langs->trans("or") . ' '.$langs->trans("Group").' ';
|
||||
print $form->select_dolgroups($usergroupid, 'usergroup', 1, '', ! $canedit);
|
||||
print '</td></tr>';
|
||||
|
||||
/*print '<tr>';
|
||||
print '<td class="nowrap">';
|
||||
print $langs->trans("or") . ' ' . $langs->trans("ActionsDoneBy");
|
||||
print ' </td><td class="nowrap maxwidthonsmartphone">';
|
||||
print $form->select_dolusers($filterd, 'userdone', 1, '', ! $canedit);
|
||||
print '</td></tr>';*/
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
|
||||
$formactions=new FormActions($db);
|
||||
|
||||
print '<tr>';
|
||||
print '<td class="nowrap">';
|
||||
print $langs->trans("Type");
|
||||
print ' </td><td class="nowrap maxwidthonsmartphone">';
|
||||
|
||||
print $formactions->select_type_actions($actioncode, "actioncode", '', (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : 0));
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr>';
|
||||
print '<td class="nowrap">';
|
||||
print $langs->trans("Status");
|
||||
print ' </td><td class="nowrap maxwidthonsmartphone">';
|
||||
$formactions->form_select_status_action('formaction',$status,1,'status',1,2);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
if (! empty($conf->societe->enabled) && $user->rights->societe->lire)
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td class="nowrap">';
|
||||
print $langs->trans("ThirdParty").' ';
|
||||
print '</td><td class="nowrap maxwidthonsmartphone">';
|
||||
print $form->select_thirdparty($socid, 'socid');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@@ -110,62 +118,53 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</td>';
|
||||
|
||||
// Buttons
|
||||
print '<td align="center" valign="middle" class="nowrap">';
|
||||
print img_picto($langs->trans("ViewCal"), 'object_calendar', 'class="hideonsmartphone"') . ' <input type="submit" class="button" style="min-width:120px" name="viewcal" value="' . $langs->trans("ViewCal") . '">';
|
||||
print '<br>';
|
||||
print img_picto($langs->trans("ViewWeek"), 'object_calendarweek', 'class="hideonsmartphone"') . ' <input type="submit" class="button" style="min-width:120px" name="viewweek" value="' . $langs->trans("ViewWeek") . '">';
|
||||
print '<br>';
|
||||
print img_picto($langs->trans("ViewDay"), 'object_calendarday', 'class="hideonsmartphone"') . ' <input type="submit" class="button" style="min-width:120px" name="viewday" value="' . $langs->trans("ViewDay") . '">';
|
||||
print '<br>';
|
||||
print img_picto($langs->trans("ViewList"), 'object_list', 'class="hideonsmartphone"') . ' <input type="submit" class="button" style="min-width:120px" name="viewlist" value="' . $langs->trans("ViewList") . '">';
|
||||
print '</td>';
|
||||
|
||||
// Legend
|
||||
if ($conf->use_javascript_ajax && is_array($showextcals))
|
||||
if ($canedit && $action == 'show_peruser')
|
||||
{
|
||||
print '<td align="center" valign="middle" class="nowrap">';
|
||||
print '<script type="text/javascript">' . "\n";
|
||||
print 'jQuery(document).ready(function () {' . "\n";
|
||||
print 'jQuery("#check_mytasks").click(function() { jQuery(".family_mytasks").toggle(); jQuery(".family_other").toggle(); });' . "\n";
|
||||
print 'jQuery("#check_birthday").click(function() { jQuery(".family_birthday").toggle(); });' . "\n";
|
||||
print 'jQuery(".family_birthday").toggle();' . "\n";
|
||||
print '});' . "\n";
|
||||
print '</script>' . "\n";
|
||||
print '<table>';
|
||||
if (! empty($conf->use_javascript_ajax))
|
||||
{
|
||||
if (count($showextcals) > 0)
|
||||
{
|
||||
print '<tr><td><input type="checkbox" id="check_mytasks" name="check_mytasks" checked="true" disabled="disabled"> ' . $langs->trans("LocalAgenda") . '</td></tr>';
|
||||
foreach ($showextcals as $val)
|
||||
{
|
||||
$htmlname = dol_string_nospecial($val['name']);
|
||||
print '<tr><td>';
|
||||
print '<script type="text/javascript">' . "\n";
|
||||
print 'jQuery(document).ready(function () {' . "\n";
|
||||
print ' jQuery("#check_' . $htmlname . '").click(function() {';
|
||||
print ' /* alert("'.$htmlname.'"); */';
|
||||
print ' jQuery(".family_' . $htmlname . '").toggle();';
|
||||
print ' });' . "\n";
|
||||
print '});' . "\n";
|
||||
print '</script>' . "\n";
|
||||
print '<input type="checkbox" id="check_' . $htmlname . '" name="check_' . $htmlname . '" checked="true"> ' . $val ['name'];
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
print '<tr><td>'.$langs->trans("AgendaShowBirthdayEvents").' <input type="checkbox" id="check_birthday" name="check_birthday"></td></tr>';
|
||||
print '</table>';
|
||||
print '</td>';
|
||||
// Filter on hours
|
||||
print '<tr>';
|
||||
print '<td class="nowrap">'.$langs->trans("WorkingTimeRange").'</td>';
|
||||
print "<td class='nowrap maxwidthonsmartphone'>";
|
||||
print '<input type="number" class="short" name="begin_h" value="'.$begin_h.'" min="0" max="23">';
|
||||
if (empty($conf->dol_use_jmobile)) print ' - ';
|
||||
print '<input type="number" class="short" name="end_h" value="'.$end_h.'" min="1" max="24">';
|
||||
if (empty($conf->dol_use_jmobile)) print ' '.$langs->trans("H");
|
||||
print '</td></tr>';
|
||||
|
||||
// Filter on days
|
||||
print '<tr>';
|
||||
print '<td class="nowrap">'.$langs->trans("WorkingDaysRange").'</td>';
|
||||
print "<td class='nowrap maxwidthonsmartphone'>";
|
||||
print '<input type="number" class="short" name="begin_d" value="'.$begin_d.'" min="1" max="7">';
|
||||
if (empty($conf->dol_use_jmobile)) print ' - ';
|
||||
print '<input type="number" class="short" name="end_d" value="'.$end_d.'" min="1" max="7">';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '</tr>';
|
||||
// Hooks
|
||||
$parameters = array('canedit'=>$canedit, 'pid'=>$pid, 'socid'=>$socid);
|
||||
$reshook = $hookmanager->executeHooks('searchAgendaFrom', $parameters, $object, $action); // Note that $action and $object may have been
|
||||
|
||||
print '</table>';
|
||||
|
||||
if (! empty($conf->browser->phone)) print '</div>';
|
||||
else print '</td>';
|
||||
|
||||
if (! empty($conf->browser->phone)) print '<div class="fichehalfright">';
|
||||
else print '<td align="center" valign="middle" class="nowrap">';
|
||||
|
||||
print '<table><tr><td align="center">';
|
||||
print '<div class="formleftzone">';
|
||||
print '<input type="submit" class="button" style="min-width:120px" name="refresh" value="' . $langs->trans("Refresh") . '">';
|
||||
print '</div>';
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
if (! empty($conf->browser->phone)) print '</div>';
|
||||
else print '</td></tr></table>';
|
||||
|
||||
print '</div>'; // Close fichecenter
|
||||
print '<div style="clear:both"></div>';
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
@@ -186,7 +185,7 @@ function show_array_actions_to_do($max=5)
|
||||
include_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
|
||||
|
||||
$sql = "SELECT a.id, a.label, a.datep as dp, a.datep2 as dp2, a.fk_user_author, a.percent,";
|
||||
$sql.= " c.code, c.libelle,";
|
||||
$sql.= " c.code, c.libelle as type_label,";
|
||||
$sql.= " s.nom as sname, s.rowid, s.client";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c LEFT JOIN ";
|
||||
$sql.= " ".MAIN_DB_PREFIX."actioncomm as a ON c.id = a.fk_action";
|
||||
@@ -223,7 +222,7 @@ function show_array_actions_to_do($max=5)
|
||||
print '<tr '.$bc[$var].'>';
|
||||
|
||||
$staticaction->type_code=$obj->code;
|
||||
$staticaction->libelle=$obj->label;
|
||||
$staticaction->label=($obj->label?$obj->label:$obj->type_label);
|
||||
$staticaction->id=$obj->id;
|
||||
print '<td>'.$staticaction->getNomUrl(1,34).'</td>';
|
||||
|
||||
@@ -361,7 +360,7 @@ function show_array_last_actions_done($max=5)
|
||||
/**
|
||||
* Prepare array with list of tabs
|
||||
*
|
||||
* @return array Array of tabs to shoc
|
||||
* @return array Array of tabs to show
|
||||
*/
|
||||
function agenda_prepare_head()
|
||||
{
|
||||
@@ -369,6 +368,11 @@ function agenda_prepare_head()
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/agenda_other.php";
|
||||
$head[$h][1] = $langs->trans("Miscellaneous");
|
||||
$head[$h][2] = 'other';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/agenda.php";
|
||||
$head[$h][1] = $langs->trans("AutoActions");
|
||||
$head[$h][2] = 'autoactions';
|
||||
@@ -384,11 +388,6 @@ function agenda_prepare_head()
|
||||
$head[$h][2] = 'extsites';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/agenda_other.php";
|
||||
$head[$h][1] = $langs->trans("Other");
|
||||
$head[$h][2] = 'other';
|
||||
$h++;
|
||||
|
||||
complete_head_from_modules($conf,$langs,null,$head,$h,'agenda_admin');
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/agenda_extrafields.php";
|
||||
@@ -406,7 +405,7 @@ function agenda_prepare_head()
|
||||
* Prepare array with list of tabs
|
||||
*
|
||||
* @param object $object Object related to tabs
|
||||
* @return array Array of tabs to shoc
|
||||
* @return array Array of tabs to show
|
||||
*/
|
||||
function actions_prepare_head($object)
|
||||
{
|
||||
@@ -415,26 +414,18 @@ function actions_prepare_head($object)
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/action/fiche.php?id='.$object->id;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/action/card.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("CardAction");
|
||||
$head[$h][2] = 'card';
|
||||
$h++;
|
||||
|
||||
if (! empty($conf->global->AGENDA_USE_SEVERAL_CONTACTS))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/action/contact.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Contacts");
|
||||
$head[$h][2] = 'contact';
|
||||
$h++;
|
||||
}
|
||||
|
||||
// Attached files
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
$upload_dir = $conf->agenda->dir_output . "/" . $object->id;
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/action/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Documents");
|
||||
if($nbFiles > 0) $head[$h][1].= ' ('.$nbFiles.')';
|
||||
if ($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
@@ -464,9 +455,31 @@ function calendars_prepare_head($param)
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/action/index.php'.($param?'?'.$param:'');
|
||||
$head[$h][1] = $langs->trans("Agenda");
|
||||
$head[$h][2] = 'card';
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/action/index.php?action=show_month'.($param?'&'.$param:'');
|
||||
$head[$h][1] = $langs->trans("ViewCal");
|
||||
$head[$h][2] = 'cardmonth';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/action/index.php?action=show_week'.($param?'&'.$param:'');
|
||||
$head[$h][1] = $langs->trans("ViewWeek");
|
||||
$head[$h][2] = 'cardweek';
|
||||
$h++;
|
||||
|
||||
//$paramday=$param;
|
||||
//if (preg_match('/&month=\d+/',$paramday) && ! preg_match('/&day=\d+/',$paramday)) $paramday.='&day=1';
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/action/index.php?action=show_day'.($param?'&'.$param:'');
|
||||
$head[$h][1] = $langs->trans("ViewDay");
|
||||
$head[$h][2] = 'cardday';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/action/peruser.php'.($param?'?'.$param:'');
|
||||
$head[$h][1] = $langs->trans("ViewPerUser");
|
||||
$head[$h][2] = 'cardperuser';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/action/listactions.php'.($param?'?'.$param:'');
|
||||
$head[$h][1] = $langs->trans("ViewList");
|
||||
$head[$h][2] = 'cardlist';
|
||||
$h++;
|
||||
|
||||
$object=new stdClass();
|
||||
|
||||
@@ -25,16 +25,17 @@
|
||||
|
||||
|
||||
/**
|
||||
* Get value of an HTML field, do Ajax process and show result.
|
||||
* Generic function that return javascript to add to a page to transform a common input field into an autocomplete field by calling an Ajax page (ex: /societe/ajaxcompanies.php).
|
||||
* The HTML field must be an input text with id=search_$htmlname.
|
||||
* This use the jQuery "autocomplete" function.
|
||||
*
|
||||
* @param string $selected Preselecte value
|
||||
* @param string $htmlname HTML name of input field
|
||||
* @param string $url Url for request: /chemin/fichier.php
|
||||
* @param string $url Url for request: /path/page.php. Must return a json array ('key'=>id, 'value'=>String shown into input field once selected, 'label'=>String shown into combo list)
|
||||
* @param string $urloption More parameters on URL request
|
||||
* @param int $minLength Minimum number of chars to trigger that Ajax search
|
||||
* @param int $autoselect Automatic selection if just one value
|
||||
* @param array $ajaxoptions Multiple options array (Ex: array('update'=>array('field1','field2'...)) will reset field1 and field2 once select done
|
||||
* @param array $ajaxoptions Multiple options array (Ex: array('update'=>array('field1','field2'...)) will reset field1 and field2 once select done)
|
||||
* @return string Script
|
||||
*/
|
||||
function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLength=2, $autoselect=0, $ajaxoptions=array())
|
||||
@@ -97,26 +98,30 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
|
||||
$("input#search_'.$htmlname.'").autocomplete({
|
||||
source: function( request, response ) {
|
||||
$.get("'.$url.($urloption?'?'.$urloption:'').'", { '.$htmlname.': request.term }, function(data){
|
||||
response($.map( data, function( item ) {
|
||||
if (autoselect == 1 && data.length == 1) {
|
||||
$("#search_'.$htmlname.'").val(item.value);
|
||||
$("#'.$htmlname.'").val(item.key).trigger("change");
|
||||
}
|
||||
var label = item.label.toString();
|
||||
var update = {};
|
||||
if (options.update) {
|
||||
$.each(options.update, function(key, value) {
|
||||
update[key] = item[value];
|
||||
});
|
||||
}
|
||||
var textarea = {};
|
||||
if (options.update_textarea) {
|
||||
$.each(options.update_textarea, function(key, value) {
|
||||
textarea[key] = item[value];
|
||||
});
|
||||
}
|
||||
return { label: label, value: item.value, id: item.key, update: update, textarea: textarea, disabled: item.disabled }
|
||||
}));
|
||||
if (data != null)
|
||||
{
|
||||
response($.map( data, function(item) {
|
||||
if (autoselect == 1 && data.length == 1) {
|
||||
$("#search_'.$htmlname.'").val(item.value);
|
||||
$("#'.$htmlname.'").val(item.key).trigger("change");
|
||||
}
|
||||
var label = item.label.toString();
|
||||
var update = {};
|
||||
if (options.update) {
|
||||
$.each(options.update, function(key, value) {
|
||||
update[key] = item[value];
|
||||
});
|
||||
}
|
||||
var textarea = {};
|
||||
if (options.update_textarea) {
|
||||
$.each(options.update_textarea, function(key, value) {
|
||||
textarea[key] = item[value];
|
||||
});
|
||||
}
|
||||
return { label: label, value: item.value, id: item.key, update: update, textarea: textarea, disabled: item.disabled }
|
||||
}));
|
||||
}
|
||||
else console.error("Error: Ajax url '.$url.($urloption?'?'.$urloption:'').' has returned an empty page. Should be an empty json array.");
|
||||
}, "json");
|
||||
},
|
||||
dataType: "json",
|
||||
@@ -168,6 +173,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
|
||||
}
|
||||
$("#search_'.$htmlname.'").trigger("change"); // To tell that input text field was modified
|
||||
}
|
||||
,delay: 500
|
||||
}).data( "autocomplete" )._renderItem = function( ul, item ) {
|
||||
return $( "<li></li>" )
|
||||
.data( "item.autocomplete", item )
|
||||
@@ -182,25 +188,28 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
|
||||
}
|
||||
|
||||
/**
|
||||
* Get value of field, do Ajax process and return result
|
||||
* Generic function that return javascript to add to a page to transform a common input field into an autocomplete field by calling an Ajax page (ex: core/ajax/ziptown.php).
|
||||
* The Ajax page can also returns several values (json format) to fill several input fields.
|
||||
* The HTML field must be an input text with id=$htmlname.
|
||||
* This use the jQuery "autocomplete" function.
|
||||
*
|
||||
* @param string $htmlname Name of field
|
||||
* @param string $fields other fields to autocomplete
|
||||
* @param string $url Chemin du fichier de reponse : /chemin/fichier.php
|
||||
* @param string $htmlname HTML name of input field
|
||||
* @param string $fields Other fields to autocomplete
|
||||
* @param string $url URL for ajax request : /chemin/fichier.php
|
||||
* @param string $option More parameters on URL request
|
||||
* @param int $minLength Minimum number of chars to trigger that Ajax search
|
||||
* @param int $autoselect Automatic selection if just one value
|
||||
* @return string Script
|
||||
*/
|
||||
function ajax_multiautocompleter($htmlname,$fields,$url,$option='',$minLength=2,$autoselect=0)
|
||||
function ajax_multiautocompleter($htmlname, $fields, $url, $option='', $minLength=2, $autoselect=0)
|
||||
{
|
||||
$script = '<!-- Autocomplete -->'."\n";
|
||||
$script.= '<script type="text/javascript">';
|
||||
$script.= 'jQuery(document).ready(function() {
|
||||
var fields = '.json_encode($fields).';
|
||||
var length = fields.length;
|
||||
var nboffields = fields.length;
|
||||
var autoselect = '.$autoselect.';
|
||||
//alert(fields + " " + length);
|
||||
//alert(fields + " " + nboffields);
|
||||
|
||||
jQuery("input#'.$htmlname.'").autocomplete({
|
||||
dataType: "json",
|
||||
@@ -214,7 +223,7 @@ function ajax_multiautocompleter($htmlname,$fields,$url,$option='',$minLength=2,
|
||||
if (item.states) {
|
||||
jQuery("#state_id").html(item.states);
|
||||
}
|
||||
for (i=0;i<length;i++) {
|
||||
for (i=0;i<nboffields;i++) {
|
||||
if (item[fields[i]]) { // If defined
|
||||
//alert(item[fields[i]]);
|
||||
jQuery("#" + fields[i]).val(item[fields[i]]);
|
||||
@@ -226,8 +235,7 @@ function ajax_multiautocompleter($htmlname,$fields,$url,$option='',$minLength=2,
|
||||
});
|
||||
},
|
||||
select: function( event, ui ) {
|
||||
|
||||
for (i=0;i<length;i++) {
|
||||
for (i=0;i<nboffields;i++) {
|
||||
//alert(fields[i] + " = " + ui.item[fields[i]]);
|
||||
if (fields[i]=="selectcountry_id")
|
||||
{
|
||||
@@ -304,7 +312,7 @@ function ajax_dialog($title,$message,$w=350,$h=150)
|
||||
* TODO: It is used when COMPANY_USE_SEARCH_TO_SELECT and CONTACT_USE_SEARCH_TO_SELECT are set by html.formcompany.class.php. Should use ajax_autocompleter instead like done by html.form.class.php for select_produits.
|
||||
*
|
||||
* @param string $htmlname Name of html select field
|
||||
* @param array $events Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
|
||||
* @param array $events More events option. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
|
||||
* @param int $minLengthToAutocomplete Minimum length of input string to start autocomplete
|
||||
* @return string Return html string to convert a select field into a combo
|
||||
*/
|
||||
@@ -313,8 +321,10 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0)
|
||||
global $conf;
|
||||
|
||||
if (! empty($conf->browser->phone)) return ''; // combobox disabled for smartphones (does not works)
|
||||
if (! empty($conf->dol_use_jmobile)) return ''; // combobox with jmobile (does not works)
|
||||
if (! empty($conf->global->MAIN_DISABLE_AJAX_COMBOX)) return '';
|
||||
|
||||
if (empty($conf->use_javascript_ajax)) return '';
|
||||
|
||||
/* Some properties for combobox:
|
||||
minLengthToAutocomplete: 2,
|
||||
comboboxContainerClass: "comboboxContainer",
|
||||
@@ -330,20 +340,20 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0)
|
||||
width: "500px" */
|
||||
|
||||
$msg = '<script type="text/javascript">
|
||||
$(function() {
|
||||
$(document).ready(function() {
|
||||
$("#'.$htmlname.'").combobox({
|
||||
minLengthToAutocomplete : '.$minLengthToAutocomplete.',
|
||||
selected : function(event,ui) {
|
||||
var obj = '.json_encode($events).';
|
||||
$.each(obj, function(key,values) {
|
||||
if (values.method.length) {
|
||||
getMethod(values);
|
||||
runJsCodeForEvent'.$htmlname.'(values);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function getMethod(obj) {
|
||||
function runJsCodeForEvent'.$htmlname.'(obj) {
|
||||
var id = $("#'.$htmlname.'").val();
|
||||
var method = obj.method;
|
||||
var url = obj.url;
|
||||
@@ -375,6 +385,7 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0)
|
||||
} else {
|
||||
$("#inputautocomplete"+htmlname).val("");
|
||||
}
|
||||
$("select#" + htmlname).change(); /* Trigger event change */
|
||||
});
|
||||
}
|
||||
|
||||
@@ -400,46 +411,140 @@ function ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0,
|
||||
|
||||
$entity = ((isset($entity) && is_numeric($entity) && $entity >= 0) ? $entity : $conf->entity);
|
||||
|
||||
$out= "\n<!-- Ajax code to switch constant ".$code." -->".'
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
var input = '.json_encode($input).';
|
||||
var url = \''.DOL_URL_ROOT.'/core/ajax/constantonoff.php\';
|
||||
var code = \''.$code.'\';
|
||||
var entity = \''.$entity.'\';
|
||||
var strict = \''.$strict.'\';
|
||||
var yesButton = "'.dol_escape_js($langs->transnoentities("Yes")).'";
|
||||
var noButton = "'.dol_escape_js($langs->transnoentities("No")).'";
|
||||
if (empty($conf->use_javascript_ajax))
|
||||
{
|
||||
if (empty($conf->global->$code)) print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_'.$code.'&entity='.$entity.'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||
else print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_'.$code.'&entity='.$entity.'">'.img_picto($langs->trans("Enabled"),'on').'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$out= "\n<!-- Ajax code to switch constant ".$code." -->".'
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
var input = '.json_encode($input).';
|
||||
var url = \''.DOL_URL_ROOT.'/core/ajax/constantonoff.php\';
|
||||
var code = \''.$code.'\';
|
||||
var entity = \''.$entity.'\';
|
||||
var strict = \''.$strict.'\';
|
||||
var yesButton = "'.dol_escape_js($langs->transnoentities("Yes")).'";
|
||||
var noButton = "'.dol_escape_js($langs->transnoentities("No")).'";
|
||||
|
||||
// Set constant
|
||||
$("#set_" + code).click(function() {
|
||||
if (input.alert && input.alert.set) {
|
||||
if (input.alert.set.yesButton) yesButton = input.alert.set.yesButton;
|
||||
if (input.alert.set.noButton) noButton = input.alert.set.noButton;
|
||||
confirmConstantAction("set", url, code, input, input.alert.set, entity, yesButton, noButton, strict);
|
||||
} else {
|
||||
setConstant(url, code, input, entity, strict);
|
||||
}
|
||||
// Set constant
|
||||
$("#set_" + code).click(function() {
|
||||
if (input.alert && input.alert.set) {
|
||||
if (input.alert.set.yesButton) yesButton = input.alert.set.yesButton;
|
||||
if (input.alert.set.noButton) noButton = input.alert.set.noButton;
|
||||
confirmConstantAction("set", url, code, input, input.alert.set, entity, yesButton, noButton, strict);
|
||||
} else {
|
||||
setConstant(url, code, input, entity);
|
||||
}
|
||||
});
|
||||
|
||||
// Del constant
|
||||
$("#del_" + code).click(function() {
|
||||
if (input.alert && input.alert.del) {
|
||||
if (input.alert.del.yesButton) yesButton = input.alert.del.yesButton;
|
||||
if (input.alert.del.noButton) noButton = input.alert.del.noButton;
|
||||
confirmConstantAction("del", url, code, input, input.alert.del, entity, yesButton, noButton, strict);
|
||||
} else {
|
||||
delConstant(url, code, input, entity);
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>'."\n";
|
||||
|
||||
// Del constant
|
||||
$("#del_" + code).click(function() {
|
||||
if (input.alert && input.alert.del) {
|
||||
if (input.alert.del.yesButton) yesButton = input.alert.del.yesButton;
|
||||
if (input.alert.del.noButton) noButton = input.alert.del.noButton;
|
||||
confirmConstantAction("del", url, code, input, input.alert.del, entity, yesButton, noButton, strict);
|
||||
} else {
|
||||
delConstant(url, code, input, entity, strict);
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>'."\n";
|
||||
|
||||
$out.= '<div id="confirm_'.$code.'" title="" style="display: none;"></div>';
|
||||
$out.= '<span id="set_'.$code.'" class="linkobject '.(! empty($conf->global->$code)?'hideobject':'').'">'.($revertonoff?img_picto($langs->trans("Enabled"),'switch_on'):img_picto($langs->trans("Disabled"),'switch_off')).'</span>';
|
||||
$out.= '<span id="del_'.$code.'" class="linkobject '.(! empty($conf->global->$code)?'':'hideobject').'">'.($revertonoff?img_picto($langs->trans("Disabled"),'switch_off'):img_picto($langs->trans("Enabled"),'switch_on')).'</span>';
|
||||
$out.="\n";
|
||||
$out.= '<div id="confirm_'.$code.'" title="" style="display: none;"></div>';
|
||||
$out.= '<span id="set_'.$code.'" class="linkobject '.(! empty($conf->global->$code)?'hideobject':'').'">'.($revertonoff?img_picto($langs->trans("Enabled"),'switch_on'):img_picto($langs->trans("Disabled"),'switch_off')).'</span>';
|
||||
$out.= '<span id="del_'.$code.'" class="linkobject '.(! empty($conf->global->$code)?'':'hideobject').'">'.($revertonoff?img_picto($langs->trans("Disabled"),'switch_off'):img_picto($langs->trans("Enabled"),'switch_on')).'</span>';
|
||||
$out.="\n";
|
||||
}
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* On/off button for object
|
||||
*
|
||||
* @param int $object Id product to set
|
||||
* @param string $code Name of constant : status or status_buy for product by example
|
||||
* @param string $field Name of database field : tosell or tobuy for product by example
|
||||
* @param string $text_on Text if on
|
||||
* @param string $text_off Text if off
|
||||
* @param array $input Array of type->list of CSS element to switch. Example: array('disabled'=>array(0=>'cssid'))
|
||||
* @return void
|
||||
*/
|
||||
function ajax_object_onoff($object, $code, $field, $text_on, $text_off, $input=array())
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$out= '<script type="text/javascript">
|
||||
$(function() {
|
||||
var input = '.json_encode($input).';
|
||||
|
||||
// Set constant
|
||||
$("#set_'.$code.'_'.$object->id.'").click(function() {
|
||||
$.get( "'.DOL_URL_ROOT.'/core/ajax/objectonoff.php", {
|
||||
action: \'set\',
|
||||
field: \''.$field.'\',
|
||||
value: \'1\',
|
||||
element: \''.$object->element.'\',
|
||||
id: \''.$object->id.'\'
|
||||
},
|
||||
function() {
|
||||
$("#set_'.$code.'_'.$object->id.'").hide();
|
||||
$("#del_'.$code.'_'.$object->id.'").show();
|
||||
// Enable another element
|
||||
if (input.disabled && input.disabled.length > 0) {
|
||||
$.each(input.disabled, function(key,value) {
|
||||
$("#" + value).removeAttr("disabled");
|
||||
if ($("#" + value).hasClass("butActionRefused") == true) {
|
||||
$("#" + value).removeClass("butActionRefused");
|
||||
$("#" + value).addClass("butAction");
|
||||
}
|
||||
});
|
||||
// Show another element
|
||||
} else if (input.showhide && input.showhide.length > 0) {
|
||||
$.each(input.showhide, function(key,value) {
|
||||
$("#" + value).show();
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Del constant
|
||||
$("#del_'.$code.'_'.$object->id.'").click(function() {
|
||||
$.get( "'.DOL_URL_ROOT.'/core/ajax/objectonoff.php", {
|
||||
action: \'set\',
|
||||
field: \''.$field.'\',
|
||||
value: \'0\',
|
||||
element: \''.$object->element.'\',
|
||||
id: \''.$object->id.'\'
|
||||
},
|
||||
function() {
|
||||
$("#del_'.$code.'_'.$object->id.'").hide();
|
||||
$("#set_'.$code.'_'.$object->id.'").show();
|
||||
// Disable another element
|
||||
if (input.disabled && input.disabled.length > 0) {
|
||||
$.each(input.disabled, function(key,value) {
|
||||
$("#" + value).attr("disabled", true);
|
||||
if ($("#" + value).hasClass("butAction") == true) {
|
||||
$("#" + value).removeClass("butAction");
|
||||
$("#" + value).addClass("butActionRefused");
|
||||
}
|
||||
});
|
||||
// Hide another element
|
||||
} else if (input.showhide && input.showhide.length > 0) {
|
||||
$.each(input.showhide, function(key,value) {
|
||||
$("#" + value).hide();
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
$out.= '<span id="set_'.$code.'_'.$object->id.'" class="linkobject '.($object->$code==1?'hideobject':'').'">'.img_picto($langs->trans($text_off),'switch_off').'</span>';
|
||||
$out.= '<span id="del_'.$code.'_'.$object->id.'" class="linkobject '.($object->$code==1?'':'hideobject').'">'.img_picto($langs->trans($text_on),'switch_on').'</span>';
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
* Prepare array with list of tabs
|
||||
*
|
||||
* @param Object $object Object related to tabs
|
||||
* @return array Array of tabs to shoc
|
||||
* @return array Array of tabs to show
|
||||
*/
|
||||
function bank_prepare_head($object)
|
||||
{
|
||||
@@ -36,7 +36,7 @@ function bank_prepare_head($object)
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT . '/compta/bank/fiche.php?id=' . $object->id;
|
||||
$head[$h][0] = DOL_URL_ROOT . '/compta/bank/card.php?id=' . $object->id;
|
||||
$head[$h][1] = $langs->trans("AccountCard");
|
||||
$head[$h][2] = 'bankname';
|
||||
$h++;
|
||||
|
||||
@@ -52,7 +52,6 @@ if (empty($font_loc)) die('DOL_DEFAULT_TTF_BOLD must de defined with full path t
|
||||
|
||||
if (defined('PHP-BARCODE_PATH_COMMAND')) $genbarcode_loc=constant('PHP-BARCODE_PATH_COMMAND');
|
||||
else $genbarcode_loc = $conf->global->GENBARCODE_LOCATION;
|
||||
//dol_syslog("genbarcode_loc=".$genbarcode_loc." - env_windows=".$_SERVER['WINDIR']);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
*
|
||||
* @param Object $object Object related to tabs
|
||||
* @param string $type Type of category
|
||||
* @return array Array of tabs to shoc
|
||||
* @return array Array of tabs to show
|
||||
*/
|
||||
function categories_prepare_head($object,$type)
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
||||
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Christophe Battarel <contact@altairis.fr>
|
||||
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
*
|
||||
@@ -37,7 +37,7 @@
|
||||
*/
|
||||
function societe_prepare_head($object)
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
global $db, $langs, $conf, $user;
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
@@ -48,7 +48,7 @@ function societe_prepare_head($object)
|
||||
|
||||
if ($object->client==1 || $object->client==2 || $object->client==3)
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/fiche.php?socid='.$object->id;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/card.php?socid='.$object->id;
|
||||
$head[$h][1] = '';
|
||||
if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && ($object->client==2 || $object->client==3)) $head[$h][1] .= $langs->trans("Prospect");
|
||||
if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && $object->client==3) $head[$h][1] .= '/';
|
||||
@@ -58,19 +58,19 @@ function societe_prepare_head($object)
|
||||
}
|
||||
if (! empty($conf->fournisseur->enabled) && $object->fournisseur && ! empty($user->rights->fournisseur->lire))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$object->id;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fourn/card.php?socid='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Supplier");
|
||||
$head[$h][2] = 'supplier';
|
||||
$h++;
|
||||
}
|
||||
|
||||
if (($object->localtax1_assuj || $object->localtax2_assuj) && (isset($conf->global->MAIN_FEATURES_LEVEL) && $conf->global->MAIN_FEATURES_LEVEL > 0) )
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/societe/localtaxes.php?socid='.$object->id;
|
||||
$head[$h][1] = $langs->trans("LocalTaxes");
|
||||
$head[$h][2] = 'localtaxes';
|
||||
$h++;
|
||||
}
|
||||
if (! empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/societe/societecontact.php?socid='.$object->id;
|
||||
$head[$h][1] = $langs->trans("ContactsAddresses");
|
||||
$head[$h][2] = 'contact';
|
||||
$h++;
|
||||
}
|
||||
|
||||
if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
|
||||
{
|
||||
@@ -98,7 +98,7 @@ function societe_prepare_head($object)
|
||||
|
||||
if ($user->societe_id == 0)
|
||||
{
|
||||
if (! empty($conf->commande->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->facture->enabled) || ! empty($conf->fournisseur->enabled))
|
||||
if (! empty($conf->commande->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->facture->enabled) || ! empty($conf->fichinter->enabled) || ! empty($conf->fournisseur->enabled))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/societe/consumption.php?socid='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Referers");
|
||||
@@ -109,8 +109,29 @@ function societe_prepare_head($object)
|
||||
// Notifications
|
||||
if (! empty($conf->notification->enabled))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$object->id;
|
||||
$nbNote = 0;
|
||||
$sql = "SELECT COUNT(n.rowid) as nb";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."notify_def as n";
|
||||
$sql.= " WHERE fk_soc = ".$object->id;
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$nbNote=$obj->nb;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/societe/notify/card.php?socid='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Notifications");
|
||||
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
|
||||
$head[$h][2] = 'notify';
|
||||
$h++;
|
||||
}
|
||||
@@ -121,7 +142,7 @@ function societe_prepare_head($object)
|
||||
if(!empty($object->note_public)) $nbNote++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/societe/note.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Note");
|
||||
if($nbNote > 0) $head[$h][1].= ' ('.$nbNote.')';
|
||||
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
|
||||
$head[$h][2] = 'note';
|
||||
$h++;
|
||||
|
||||
@@ -131,7 +152,7 @@ function societe_prepare_head($object)
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$head[$h][0] = DOL_URL_ROOT.'/societe/document.php?socid='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Documents");
|
||||
if($nbFiles > 0) $head[$h][1].= ' ('.$nbFiles.')';
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
$head[$h][2] = 'document';
|
||||
$h++;
|
||||
}
|
||||
@@ -196,10 +217,9 @@ function societe_prepare_head2($object)
|
||||
/**
|
||||
* Return array head with list of tabs to view object informations.
|
||||
*
|
||||
* @param Object $object Thirdparty
|
||||
* @return array head array with tabs
|
||||
*/
|
||||
function societe_admin_prepare_head($object)
|
||||
function societe_admin_prepare_head()
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
|
||||
@@ -215,7 +235,7 @@ function societe_admin_prepare_head($object)
|
||||
// Entries must be declared in modules descriptor with line
|
||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'company_admin');
|
||||
complete_head_from_modules($conf,$langs,null,$head,$h,'company_admin');
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/societe/admin/societe_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ExtraFieldsThirdParties");
|
||||
@@ -227,7 +247,7 @@ function societe_admin_prepare_head($object)
|
||||
$head[$h][2] = 'attributes_contacts';
|
||||
$h++;
|
||||
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'company_admin','remove');
|
||||
complete_head_from_modules($conf,$langs,null,$head,$h,'company_admin','remove');
|
||||
|
||||
return $head;
|
||||
}
|
||||
@@ -262,19 +282,19 @@ function getCountry($searchkey,$withcode='',$dbtouse=0,$outputlangs='',$entconv=
|
||||
if (! is_object($dbtouse)) $dbtouse=$db;
|
||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||
|
||||
$sql = "SELECT rowid, code, libelle FROM ".MAIN_DB_PREFIX."c_pays";
|
||||
$sql = "SELECT rowid, code, label FROM ".MAIN_DB_PREFIX."c_country";
|
||||
if (is_numeric($searchkey)) $sql.= " WHERE rowid=".$searchkey;
|
||||
elseif (! empty($searchkey)) $sql.= " WHERE code='".$db->escape($searchkey)."'";
|
||||
else $sql.= " WHERE libelle='".$db->escape($searchlabel)."'";
|
||||
else $sql.= " WHERE label='".$db->escape($searchlabel)."'";
|
||||
|
||||
dol_syslog("Company.lib::getCountry sql=".$sql);
|
||||
dol_syslog("Company.lib::getCountry", LOG_DEBUG);
|
||||
$resql=$dbtouse->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $dbtouse->fetch_object($resql);
|
||||
if ($obj)
|
||||
{
|
||||
$label=((! empty($obj->libelle) && $obj->libelle!='-')?$obj->libelle:'');
|
||||
$label=((! empty($obj->label) && $obj->label!='-')?$obj->label:'');
|
||||
if (is_object($outputlangs))
|
||||
{
|
||||
$outputlangs->load("dict");
|
||||
@@ -317,7 +337,7 @@ function getState($id,$withcode='',$dbtouse=0)
|
||||
$sql = "SELECT rowid, code_departement as code, nom as label FROM ".MAIN_DB_PREFIX."c_departements";
|
||||
$sql.= " WHERE rowid=".$id;
|
||||
|
||||
dol_syslog("Company.lib::getState sql=".$sql);
|
||||
dol_syslog("Company.lib::getState", LOG_DEBUG);
|
||||
$resql=$dbtouse->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@@ -394,7 +414,7 @@ function getFormeJuridiqueLabel($code)
|
||||
$sql = "SELECT libelle FROM ".MAIN_DB_PREFIX."c_forme_juridique";
|
||||
$sql.= " WHERE code='$code'";
|
||||
|
||||
dol_syslog("Company.lib::getFormeJuridiqueLabel sql=".$sql);
|
||||
dol_syslog("Company.lib::getFormeJuridiqueLabel", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@@ -440,8 +460,8 @@ function show_projects($conf,$langs,$db,$object,$backtopage='')
|
||||
$buttoncreate='';
|
||||
if (! empty($conf->projet->enabled) && $user->rights->projet->creer)
|
||||
{
|
||||
//$buttoncreate='<a class="butAction" href="'.DOL_URL_ROOT.'/projet/fiche.php?socid='.$object->id.'&action=create&backtopage='.urlencode($backtopage).'">'.$langs->trans("AddProject").'</a>';
|
||||
$buttoncreate='<a class="addnewrecord" href="'.DOL_URL_ROOT.'/projet/fiche.php?socid='.$object->id.'&action=create&backtopage='.urlencode($backtopage).'">'.$langs->trans("AddProject");
|
||||
//$buttoncreate='<a class="butAction" href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$object->id.'&action=create&backtopage='.urlencode($backtopage).'">'.$langs->trans("AddProject").'</a>';
|
||||
$buttoncreate='<a class="addnewrecord" href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$object->id.'&action=create&backtopage='.urlencode($backtopage).'">'.$langs->trans("AddProject");
|
||||
if (empty($conf->dol_optimize_smallscreen)) $buttoncreate.=' '.img_picto($langs->trans("AddProject"),'filenew');
|
||||
$buttoncreate.='</a>'."\n";
|
||||
}
|
||||
@@ -471,7 +491,7 @@ function show_projects($conf,$langs,$db,$object,$backtopage='')
|
||||
$projectstatic = new Project($db);
|
||||
|
||||
$i=0;
|
||||
$var=true;
|
||||
$var=false;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
@@ -486,7 +506,7 @@ function show_projects($conf,$langs,$db,$object,$backtopage='')
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
// Ref
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/projet/fiche.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowProject"),($obj->public?'projectpub':'project'))." ".$obj->ref.'</a></td>';
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowProject"),($obj->public?'projectpub':'project'))." ".$obj->ref.'</a></td>';
|
||||
// Label
|
||||
print '<td>'.$obj->title.'</td>';
|
||||
// Date start
|
||||
@@ -500,8 +520,9 @@ function show_projects($conf,$langs,$db,$object,$backtopage='')
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td colspan="3">'.$langs->trans("None").'</td></tr>';
|
||||
{
|
||||
$var = false;
|
||||
print '<tr '.$bc[$var].'><td colspan="4">'.$langs->trans("None").'</td></tr>';
|
||||
}
|
||||
$db->free($result);
|
||||
}
|
||||
@@ -557,7 +578,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
|
||||
if ($user->rights->societe->contact->creer)
|
||||
{
|
||||
$addcontact = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("AddContact") : $langs->trans("AddContactAddress"));
|
||||
$buttoncreate='<a class="addnewrecord" href="'.DOL_URL_ROOT.'/contact/fiche.php?socid='.$object->id.'&action=create&backtopage='.urlencode($backtopage).'">'.$addcontact;
|
||||
$buttoncreate='<a class="addnewrecord" href="'.DOL_URL_ROOT.'/contact/card.php?socid='.$object->id.'&action=create&backtopage='.urlencode($backtopage).'">'.$addcontact;
|
||||
if (empty($conf->dol_optimize_smallscreen)) $buttoncreate.=' '.img_picto($addcontact,'filenew');
|
||||
$buttoncreate.='</a>'."\n";
|
||||
}
|
||||
@@ -626,7 +647,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
|
||||
|
||||
// Status
|
||||
print '<td class="liste_titre maxwidthonsmartphone">';
|
||||
print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status);
|
||||
print $form->selectarray('search_status', array('-1'=>'','0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status);
|
||||
print '</td>';
|
||||
|
||||
// Copy to clipboard
|
||||
@@ -648,18 +669,18 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
|
||||
|
||||
|
||||
$sql = "SELECT p.rowid, p.lastname, p.firstname, p.fk_pays as country_id, p.poste, p.phone, p.phone_mobile, p.fax, p.email, p.skype, p.statut ";
|
||||
$sql .= ", p.civilite as civility_id, p.address, p.zip, p.town";
|
||||
$sql .= ", p.civility as civility_id, p.address, p.zip, p.town";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p";
|
||||
$sql .= " WHERE p.fk_soc = ".$object->id;
|
||||
if ($search_status!='') $sql .= " AND p.statut = ".$db->escape($search_status);
|
||||
if ($search_status!='' && $search_status != '-1') $sql .= " AND p.statut = ".$db->escape($search_status);
|
||||
if ($search_name) $sql .= " AND (p.lastname LIKE '%".$db->escape($search_name)."%' OR p.firstname LIKE '%".$db->escape($search_name)."%')";
|
||||
$sql.= " ORDER BY $sortfield $sortorder";
|
||||
|
||||
dol_syslog('core/lib/company.lib.php :: show_contacts sql='.$sql,LOG_DEBUG);
|
||||
dol_syslog('core/lib/company.lib.php :: show_contacts', LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
$var=true;
|
||||
$var=false;
|
||||
if ($num)
|
||||
{
|
||||
$i=0;
|
||||
@@ -676,7 +697,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
|
||||
$contactstatic->lastname = $obj->lastname;
|
||||
$contactstatic->firstname = $obj->firstname;
|
||||
$contactstatic->civility_id = $obj->civility_id;
|
||||
print $contactstatic->getNomUrl(1);
|
||||
print $contactstatic->getNomUrl(1,'',0,'&backtopage='.urlencode($backtopage));
|
||||
print '</td>';
|
||||
|
||||
print '<td>'.$obj->poste.'</td>';
|
||||
@@ -741,11 +762,11 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
|
||||
print '<td align="center">';
|
||||
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
||||
{
|
||||
print '<a class="hideonsmartphone" href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&actioncode=AC_RDV&contactid='.$obj->rowid.'&socid='.$object->id.'&backtopage='.urlencode($backtopage).'">';
|
||||
print '<a class="hideonsmartphone" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&actioncode=AC_RDV&contactid='.$obj->rowid.'&socid='.$object->id.'&backtopage='.urlencode($backtopage).'">';
|
||||
print img_object($langs->trans("Rendez-Vous"),"action_rdv");
|
||||
print '</a> ';
|
||||
}
|
||||
print '<a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&actioncode=&contactid='.$obj->rowid.'&socid='.$object->id.'&backtopage='.urlencode($backtopage).'">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&actioncode=&contactid='.$obj->rowid.'&socid='.$object->id.'&backtopage='.urlencode($backtopage).'">';
|
||||
print img_object($langs->trans("Event"),"action");
|
||||
print '</a></td>';
|
||||
}
|
||||
@@ -754,7 +775,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
|
||||
if ($user->rights->societe->contact->creer)
|
||||
{
|
||||
print '<td align="right">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/contact/fiche.php?action=edit&id='.$obj->rowid.'&backtopage='.urlencode($backtopage).'">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/contact/card.php?action=edit&id='.$obj->rowid.'&backtopage='.urlencode($backtopage).'">';
|
||||
print img_edit();
|
||||
print '</a></td>';
|
||||
}
|
||||
@@ -914,22 +935,12 @@ function show_actions_todo($conf,$langs,$db,$object,$objcon='',$noprint=0)
|
||||
if (get_class($object) == 'Societe') $out.='</a>';
|
||||
$out.='</td>';
|
||||
$out.='<td colspan="5" align="right">';
|
||||
$permok=$user->rights->agenda->myactions->create;
|
||||
if (($object->id || $objcon->id) && $permok)
|
||||
{
|
||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create';
|
||||
if (get_class($object) == 'Societe') $out.='&socid='.$object->id;
|
||||
$out.=(! empty($objcon->id)?'&contactid='.$objcon->id:'').'&backtopage=1&percentage=-1">';
|
||||
$out.=$langs->trans("AddAnAction").' ';
|
||||
$out.=img_picto($langs->trans("AddAnAction"),'filenew');
|
||||
$out.="</a>";
|
||||
}
|
||||
$out.='</td>';
|
||||
$out.='</tr>';
|
||||
|
||||
$sql = "SELECT a.id, a.label,";
|
||||
$sql.= " a.datep as dp,";
|
||||
$sql.= " a.datea as da,";
|
||||
$sql.= " a.datep2 as dp2,";
|
||||
$sql.= " a.percent,";
|
||||
$sql.= " a.fk_user_author, a.fk_contact,";
|
||||
$sql.= " a.fk_element, a.elementtype,";
|
||||
@@ -953,7 +964,7 @@ function show_actions_todo($conf,$langs,$db,$object,$objcon='',$noprint=0)
|
||||
$sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))";
|
||||
$sql.= " ORDER BY a.datep DESC, a.id DESC";
|
||||
|
||||
dol_syslog("company.lib::show_actions_todo sql=".$sql);
|
||||
dol_syslog("company.lib::show_actions_todo", LOG_DEBUG);
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@@ -970,10 +981,20 @@ function show_actions_todo($conf,$langs,$db,$object,$objcon='',$noprint=0)
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
$datep=$db->jdate($obj->dp);
|
||||
$datep2=$db->jdate($obj->dp2);
|
||||
|
||||
$out.="<tr ".$bc[$var].">";
|
||||
|
||||
$out.='<td width="120" align="left" class="nowrap">'.dol_print_date($datep,'dayhour')."</td>\n";
|
||||
$out.='<td width="120" align="left" class="nowrap">';
|
||||
$out.=dol_print_date($datep,'dayhour');
|
||||
if ($datep2 && $datep2 != $datep)
|
||||
{
|
||||
$tmpa=dol_getdate($datep,true);
|
||||
$tmpb=dol_getdate($datep2,true);
|
||||
if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) $out.='-'.dol_print_date($datep2,'hour');
|
||||
else $out.='-'.dol_print_date($datep2,'dayhour');
|
||||
}
|
||||
$out.="</td>\n";
|
||||
|
||||
// Picto warning
|
||||
$out.='<td width="16">';
|
||||
@@ -1089,7 +1110,7 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0)
|
||||
$sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))";
|
||||
$sql.= " ORDER BY a.datep DESC, a.id DESC";
|
||||
|
||||
dol_syslog("company.lib::show_actions_done sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog("company.lib::show_actions_done", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@@ -1103,7 +1124,7 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0)
|
||||
'type'=>'action',
|
||||
'id'=>$obj->id,
|
||||
'datestart'=>$db->jdate($obj->dp),
|
||||
'date'=>$db->jdate($obj->dp2),
|
||||
'dateend'=>$db->jdate($obj->dp2),
|
||||
'note'=>$obj->label,
|
||||
'percent'=>$obj->percent,
|
||||
'acode'=>$obj->acode,
|
||||
@@ -1141,7 +1162,7 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0)
|
||||
$sql.= " AND mc.fk_mailing=m.rowid";
|
||||
$sql.= " ORDER BY mc.date_envoi DESC, m.rowid DESC";
|
||||
|
||||
dol_syslog("company.lib::show_actions_done sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog("company.lib::show_actions_done", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@@ -1154,7 +1175,8 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0)
|
||||
$histo[$numaction]=array(
|
||||
'type'=>'mailing',
|
||||
'id'=>$obj->id,
|
||||
'date'=>$db->jdate($obj->da),
|
||||
'datestart'=>$db->jdate($obj->da),
|
||||
'dateend'=>$db->jdate($obj->da),
|
||||
'note'=>$obj->note,
|
||||
'percent'=>$obj->percentage,
|
||||
'acode'=>$obj->acode,
|
||||
@@ -1197,16 +1219,6 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0)
|
||||
if (get_class($object) == 'Societe') $out.='</a>';
|
||||
$out.='</td>';
|
||||
$out.='<td colspan="5" align="right">';
|
||||
$permok=$user->rights->agenda->myactions->create;
|
||||
if ((! empty($object->id) || ! empty($objcon->id)) && $permok)
|
||||
{
|
||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create';
|
||||
if (get_class($object) == 'Societe') $out.='&socid='.$object->id;
|
||||
$out.=(! empty($objcon->id)?'&contactid='.$objcon->id:'').'&backtopage=1&percentage=-1">';
|
||||
$out.=$langs->trans("AddAnAction").' ';
|
||||
$out.=img_picto($langs->trans("AddAnAction"),'filenew');
|
||||
$out.="</a>";
|
||||
}
|
||||
$out.='</td>';
|
||||
$out.='</tr>';
|
||||
|
||||
@@ -1217,8 +1229,14 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0)
|
||||
|
||||
// Champ date
|
||||
$out.='<td width="120" class="nowrap">';
|
||||
if ($histo[$key]['date']) $out.=dol_print_date($histo[$key]['date'],'dayhour');
|
||||
else if ($histo[$key]['datestart']) $out.=dol_print_date($histo[$key]['datestart'],'dayhour');
|
||||
$out.=dol_print_date($histo[$key]['datestart'],'dayhour');
|
||||
if ($histo[$key]['dateend'] && $histo[$key]['dateend'] != $histo[$key]['datestart'])
|
||||
{
|
||||
$tmpa=dol_getdate($histo[$key]['datestart'],true);
|
||||
$tmpb=dol_getdate($histo[$key]['dateend'],true);
|
||||
if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) $out.='-'.dol_print_date($histo[$key]['dateend'],'hour');
|
||||
else $out.='-'.dol_print_date($histo[$key]['dateend'],'dayhour');
|
||||
}
|
||||
$out.="</td>\n";
|
||||
|
||||
// Picto
|
||||
@@ -1238,7 +1256,7 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0)
|
||||
}
|
||||
if (isset($histo[$key]['type']) && $histo[$key]['type']=='mailing')
|
||||
{
|
||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/mailing/fiche.php?id='.$histo[$key]['id'].'">'.img_object($langs->trans("ShowEMailing"),"email").' ';
|
||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/mailing/card.php?id='.$histo[$key]['id'].'">'.img_object($langs->trans("ShowEMailing"),"email").' ';
|
||||
$transcode=$langs->trans("Action".$histo[$key]['acode']);
|
||||
$libelle=($transcode!="Action".$histo[$key]['acode']?$transcode:'Send mass mailing');
|
||||
$out.=dol_trunc($libelle,40);
|
||||
@@ -1251,6 +1269,7 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0)
|
||||
// Objet lie
|
||||
// TODO uniformize
|
||||
$out.='<td>';
|
||||
//var_dump($histo[$key]['elementtype']);
|
||||
if (isset($histo[$key]['elementtype']))
|
||||
{
|
||||
if ($histo[$key]['elementtype'] == 'propal' && ! empty($conf->propal->enabled))
|
||||
@@ -1259,13 +1278,13 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0)
|
||||
$propalstatic->id=$histo[$key]['fk_element'];
|
||||
$out.=$propalstatic->getNomUrl(1);
|
||||
}
|
||||
elseif ($histo[$key]['elementtype'] == 'commande' && ! empty($conf->commande->enabled))
|
||||
elseif (($histo[$key]['elementtype'] == 'order' || $histo[$key]['elementtype'] == 'commande') && ! empty($conf->commande->enabled))
|
||||
{
|
||||
$orderstatic->ref=$langs->trans("Order");
|
||||
$orderstatic->id=$histo[$key]['fk_element'];
|
||||
$out.=$orderstatic->getNomUrl(1);
|
||||
}
|
||||
elseif ($histo[$key]['elementtype'] == 'facture' && ! empty($conf->facture->enabled))
|
||||
elseif (($histo[$key]['elementtype'] == 'invoice' || $histo[$key]['elementtype'] == 'facture') && ! empty($conf->facture->enabled))
|
||||
{
|
||||
$facturestatic->ref=$langs->trans("Invoice");
|
||||
$facturestatic->id=$histo[$key]['fk_element'];
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
* Prepare array with list of tabs
|
||||
*
|
||||
* @param Object $object Object related to tabs
|
||||
* @return array Array of tabs to shoc
|
||||
* @return array Array of tabs to show
|
||||
*/
|
||||
function contact_prepare_head($object)
|
||||
{
|
||||
@@ -35,7 +35,7 @@ function contact_prepare_head($object)
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/contact/fiche.php?id='.$object->id;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/contact/card.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Card");
|
||||
$head[$h][2] = 'card';
|
||||
$h++;
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
* Prepare array with list of tabs
|
||||
*
|
||||
* @param Object $object Object related to tabs
|
||||
* @return array Array of tabs to shoc
|
||||
* @return array Array of tabs to show
|
||||
*/
|
||||
function contract_prepare_head($object)
|
||||
{
|
||||
@@ -34,7 +34,7 @@ function contract_prepare_head($object)
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/contrat/fiche.php?id='.$object->id;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/contrat/card.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("ContractCard");
|
||||
$head[$h][2] = 'card';
|
||||
$h++;
|
||||
@@ -60,7 +60,7 @@ function contract_prepare_head($object)
|
||||
if(!empty($object->note_public)) $nbNote++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/contrat/note.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Notes");
|
||||
if($nbNote > 0) $head[$h][1].= ' ('.$nbNote.')';
|
||||
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
|
||||
$head[$h][2] = 'note';
|
||||
$h++;
|
||||
}
|
||||
@@ -70,7 +70,7 @@ function contract_prepare_head($object)
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$head[$h][0] = DOL_URL_ROOT.'/contrat/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Documents");
|
||||
if($nbFiles > 0) $head[$h][1].= ' ('.$nbFiles.')';
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
|
||||
@@ -131,12 +131,13 @@ function getServerTimeZoneInt($refgmtdate='now')
|
||||
*
|
||||
* @param int $time Date timestamp (or string with format YYYY-MM-DD)
|
||||
* @param int $duration_value Value of delay to add
|
||||
* @param int $duration_unit Unit of added delay (d, m, y, w)
|
||||
* @return int New timestamp
|
||||
* @param int $duration_unit Unit of added delay (d, m, y, w, h)
|
||||
* @return int New timestamp
|
||||
*/
|
||||
function dol_time_plus_duree($time,$duration_value,$duration_unit)
|
||||
{
|
||||
if ($duration_value == 0) return $time;
|
||||
if ($duration_unit == 'h') return $time + (3600*$duration_value);
|
||||
if ($duration_unit == 'w') return $time + (3600*24*7*$duration_value);
|
||||
if ($duration_value > 0) $deltastring="+".abs($duration_value);
|
||||
if ($duration_value < 0) $deltastring="-".abs($duration_value);
|
||||
@@ -442,10 +443,11 @@ function dol_get_next_week($day, $week, $month, $year)
|
||||
* @param mixed $gm False or 0 or 'server' = Return date to compare with server TZ, True or 1 to compare with GM date.
|
||||
* Exemple: dol_get_first_day(1970,1,false) will return -3600 with TZ+1, after a dol_print_date will return 1970-01-01 00:00:00
|
||||
* Exemple: dol_get_first_day(1970,1,true) will return 0 whatever is TZ, after a dol_print_date will return 1970-01-01 00:00:00
|
||||
* @return int Date for first day
|
||||
* @return int Date for first day, '' if error
|
||||
*/
|
||||
function dol_get_first_day($year,$month=1,$gm=false)
|
||||
{
|
||||
if ($year > 9999) return '';
|
||||
return dol_mktime(0,0,0,$month,1,$year,$gm);
|
||||
}
|
||||
|
||||
@@ -455,10 +457,11 @@ function dol_get_first_day($year,$month=1,$gm=false)
|
||||
* @param int $year Year
|
||||
* @param int $month Month
|
||||
* @param boolean $gm False or 0 or 'server' = Return date to compare with server TZ, True or 1 to compare with GM date.
|
||||
* @return int Date for first day
|
||||
* @return int Date for first day, '' if error
|
||||
*/
|
||||
function dol_get_last_day($year,$month=12,$gm=false)
|
||||
{
|
||||
if ($year > 9999) return '';
|
||||
if ($month == 12)
|
||||
{
|
||||
$month = 1;
|
||||
@@ -525,7 +528,7 @@ function dol_get_first_day_week($day,$month,$year,$gm=false)
|
||||
$tmpmonth = $prev_month;
|
||||
$tmpyear = $prev_year;
|
||||
|
||||
//Get first day of next week
|
||||
//Get first day of next week
|
||||
$tmptime=dol_mktime(12,0,0,$month,$tmpday,$year,1,0);
|
||||
$tmptime-=24*60*60*7;
|
||||
$tmparray=dol_getdate($tmptime,true);
|
||||
@@ -662,6 +665,49 @@ function num_public_holiday($timestampStart, $timestampEnd, $countrycode='FR')
|
||||
//Samedi (6) et dimanche (0)
|
||||
}
|
||||
|
||||
if ($countrycode == 'ES')
|
||||
{
|
||||
$countryfound=1;
|
||||
|
||||
// Definition des dates feriees fixes
|
||||
if($jour == 1 && $mois == 1) $ferie=true; // Año nuevo
|
||||
if($jour == 6 && $mois == 1) $ferie=true; // Día Reyes
|
||||
if($jour == 1 && $mois == 5) $ferie=true; // 1 Mayo
|
||||
if($jour == 15 && $mois == 8) $ferie=true; // 15 Agosto
|
||||
if($jour == 12 && $mois == 10) $ferie=true; // Día Hispanidad
|
||||
if($jour == 1 && $mois == 11) $ferie=true; // 1 noviembre
|
||||
if($jour == 6 && $mois == 12) $ferie=true; // Constitución
|
||||
if($jour == 8 && $mois == 12) $ferie=true; // Inmaculada
|
||||
if($jour == 25 && $mois == 12) $ferie=true; // 25 diciembre
|
||||
|
||||
// Calcul día de Pascua
|
||||
$date_paques = easter_date($annee);
|
||||
$jour_paques = date("d", $date_paques);
|
||||
$mois_paques = date("m", $date_paques);
|
||||
if($jour_paques == $jour && $mois_paques == $mois) $ferie=true;
|
||||
// Paques
|
||||
|
||||
// Viernes Santo
|
||||
$date_viernes = mktime(
|
||||
date("H", $date_paques),
|
||||
date("i", $date_paques),
|
||||
date("s", $date_paques),
|
||||
date("m", $date_paques),
|
||||
date("d", $date_paques) -2,
|
||||
date("Y", $date_paques)
|
||||
);
|
||||
$jour_viernes = date("d", $date_viernes);
|
||||
$mois_viernes = date("m", $date_viernes);
|
||||
if($jour_viernes == $jour && $mois_viernes == $mois) $ferie=true;
|
||||
//Viernes Santo
|
||||
|
||||
// Calul des samedis et dimanches
|
||||
$jour_julien = unixtojd($timestampStart);
|
||||
$jour_semaine = jddayofweek($jour_julien, 0);
|
||||
if($jour_semaine == 0 || $jour_semaine == 6) $ferie=true;
|
||||
//Samedi (6) et dimanche (0)
|
||||
}
|
||||
|
||||
// Cas pays non defini
|
||||
if (! $countryfound)
|
||||
{
|
||||
|
||||
@@ -27,11 +27,13 @@
|
||||
* Prepare array with list of different ecm main dashboard
|
||||
*
|
||||
* @param object $object Object related to tabs
|
||||
* @return array Array of tabs to shoc
|
||||
* @return array Array of tabs to show
|
||||
*/
|
||||
function ecm_prepare_dasboard_head($object)
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
global $helptext1, $helptext2;
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
@@ -64,7 +66,7 @@ function ecm_prepare_dasboard_head($object)
|
||||
* Prepare array with list of tabs
|
||||
*
|
||||
* @param object $object Object related to tabs
|
||||
* @return array Array of tabs to shoc
|
||||
* @return array Array of tabs to show
|
||||
*/
|
||||
function ecm_prepare_head($object)
|
||||
{
|
||||
@@ -84,7 +86,7 @@ function ecm_prepare_head($object)
|
||||
* Prepare array with list of tabs
|
||||
*
|
||||
* @param Object $object Object related to tabs
|
||||
* @return array Array of tabs to shoc
|
||||
* @return array Array of tabs to show
|
||||
*/
|
||||
function ecm_file_prepare_head($object)
|
||||
{
|
||||
@@ -104,7 +106,7 @@ function ecm_file_prepare_head($object)
|
||||
* Prepare array with list of tabs
|
||||
*
|
||||
* @param object $object Object related to tabs
|
||||
* @return array Array of tabs to shoc
|
||||
* @return array Array of tabs to show
|
||||
*/
|
||||
function ecm_prepare_head_fm($object)
|
||||
{
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
* Prepare array with list of tabs
|
||||
*
|
||||
* @param Object $object Object related to tabs
|
||||
* @return array Array of tabs to shoc
|
||||
* @return array Array of tabs to show
|
||||
*/
|
||||
function emailing_prepare_head($object)
|
||||
{
|
||||
@@ -34,7 +34,7 @@ function emailing_prepare_head($object)
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/comm/mailing/fiche.php?id=".$object->id;
|
||||
$head[$h][0] = DOL_URL_ROOT."/comm/mailing/card.php?id=".$object->id;
|
||||
$head[$h][1] = $langs->trans("MailCard");
|
||||
$head[$h][2] = 'card';
|
||||
$h++;
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
* Prepare array with list of tabs
|
||||
*
|
||||
* @param Object $object Object related to tabs
|
||||
* @return array Array of tabs to shoc
|
||||
* @return array Array of tabs to show
|
||||
*/
|
||||
function fichinter_prepare_head($object)
|
||||
{
|
||||
@@ -38,7 +38,7 @@ function fichinter_prepare_head($object)
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fichinter/fiche.php?id='.$object->id;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fichinter/card.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Card");
|
||||
$head[$h][2] = 'card';
|
||||
$h++;
|
||||
@@ -72,7 +72,7 @@ function fichinter_prepare_head($object)
|
||||
if(!empty($object->note_public)) $nbNote++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fichinter/note.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Notes');
|
||||
if($nbNote > 0) $head[$h][1].= ' ('.$nbNote.')';
|
||||
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
|
||||
$head[$h][2] = 'note';
|
||||
$h++;
|
||||
}
|
||||
@@ -82,7 +82,7 @@ function fichinter_prepare_head($object)
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fichinter/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Documents");
|
||||
if($nbFiles > 0) $head[$h][1].= ' ('.$nbFiles.')';
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
@@ -126,6 +126,11 @@ function fichinter_admin_prepare_head()
|
||||
$head[$h][2] = 'attributes';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fichinter/admin/fichinterdet_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ExtraFieldsLines");
|
||||
$head[$h][2] = 'attributesdet';
|
||||
$h++;
|
||||
|
||||
|
||||
|
||||
complete_head_from_modules($conf,$langs,null,$head,$h,'fichinter_admin','remove');
|
||||
|
||||
@@ -139,6 +139,7 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil
|
||||
$level1name=(isset($reg[1])?$reg[1]:'');
|
||||
$file_list[] = array(
|
||||
"name" => $file,
|
||||
"path" => $path,
|
||||
"level1name" => $level1name,
|
||||
"fullname" => $path.'/'.$file,
|
||||
"date" => $filedate,
|
||||
@@ -166,6 +167,7 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil
|
||||
$level1name=(isset($reg[1])?$reg[1]:'');
|
||||
$file_list[] = array(
|
||||
"name" => $file,
|
||||
"path" => $path,
|
||||
"level1name" => $level1name,
|
||||
"fullname" => $path.'/'.$file,
|
||||
"date" => $filedate,
|
||||
@@ -807,14 +809,15 @@ function dol_delete_dir($dir,$nophperrors=0)
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a directory $dir and its subdirectories
|
||||
* Remove a directory $dir and its subdirectories (or only files and subdirectories)
|
||||
*
|
||||
* @param string $dir Dir to delete
|
||||
* @param int $count Counter to count nb of deleted elements
|
||||
* @param int $nophperrors Disable all PHP output errors
|
||||
* @param int $onlysub Delete only files and subdir, not main directory
|
||||
* @return int Number of files and directory removed
|
||||
*/
|
||||
function dol_delete_dir_recursive($dir,$count=0,$nophperrors=0)
|
||||
function dol_delete_dir_recursive($dir,$count=0,$nophperrors=0,$onlysub=0)
|
||||
{
|
||||
dol_syslog("functions.lib:dol_delete_dir_recursive ".$dir,LOG_DEBUG);
|
||||
if (dol_is_dir($dir))
|
||||
@@ -841,9 +844,13 @@ function dol_delete_dir_recursive($dir,$count=0,$nophperrors=0)
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
dol_delete_dir($dir,$nophperrors);
|
||||
$count++;
|
||||
//echo "removing $dir<br>\n";
|
||||
|
||||
if (empty($onlysub))
|
||||
{
|
||||
dol_delete_dir($dir,$nophperrors);
|
||||
$count++;
|
||||
//echo "removing $dir<br>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -949,7 +956,7 @@ function dol_meta_create($object)
|
||||
if (is_dir($dir))
|
||||
{
|
||||
$nblignes = count($object->lines);
|
||||
$client = $object->client->nom . " " . $object->client->address . " " . $object->client->zip . " " . $object->client->town;
|
||||
$client = $object->client->name . " " . $object->client->address . " " . $object->client->zip . " " . $object->client->town;
|
||||
$meta = "REFERENCE=\"" . $object->ref . "\"
|
||||
DATE=\"" . dol_print_date($object->date,'') . "\"
|
||||
NB_ITEMS=\"" . $nblignes . "\"
|
||||
@@ -1587,6 +1594,16 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
|
||||
$original_file=$conf->projet->dir_output.'/'.$original_file;
|
||||
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."projet WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity;
|
||||
}
|
||||
// Wrapping for interventions
|
||||
else if ($modulepart == 'fichinter')
|
||||
{
|
||||
if ($fuser->rights->ficheinter->lire || preg_match('/^specimen/i',$original_file))
|
||||
{
|
||||
$accessallowed=1;
|
||||
}
|
||||
$original_file=$conf->ficheinter->dir_output.'/'.$original_file;
|
||||
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."fichinter WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity;
|
||||
}
|
||||
|
||||
// Wrapping pour les commandes fournisseurs
|
||||
else if ($modulepart == 'commande_fournisseur' || $modulepart == 'order_supplier')
|
||||
@@ -1621,14 +1638,14 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
|
||||
else $original_file=$conf->facture->dir_output.'/payments/'.$original_file;
|
||||
}
|
||||
|
||||
// Wrapping pour les exports de compta
|
||||
// Wrapping for accounting exports
|
||||
else if ($modulepart == 'export_compta')
|
||||
{
|
||||
if ($fuser->rights->compta->ventilation->creer || preg_match('/^specimen/i',$original_file))
|
||||
if ($fuser->rights->accounting->ventilation->dispatch || preg_match('/^specimen/i',$original_file))
|
||||
{
|
||||
$accessallowed=1;
|
||||
}
|
||||
$original_file=$conf->compta->dir_output.'/'.$original_file;
|
||||
$original_file=$conf->accounting->dir_output.'/'.$original_file;
|
||||
}
|
||||
|
||||
// Wrapping pour les expedition
|
||||
|
||||
56
htdocs/core/lib/fiscalyear.lib.php
Normal file
56
htdocs/core/lib/fiscalyear.lib.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/* Copyright (C) 2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* or see http://www.gnu.org/
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/lib/fiscalyear.lib.php
|
||||
* \brief Set basic functions for fiscal years
|
||||
*/
|
||||
|
||||
/**
|
||||
* Prepare array with list of tabs
|
||||
*
|
||||
* @param Object $object Object related to tabs
|
||||
* @return array Array of tabs to show
|
||||
*/
|
||||
function fiscalyear_prepare_head($object)
|
||||
{
|
||||
global $langs, $conf;
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT . '/accountancy/admin/fiscalyear_card.php?id=' . $object->id;
|
||||
$head[$h][1] = $langs->trans("Card");
|
||||
$head[$h][2] = 'card';
|
||||
$h++;
|
||||
|
||||
// Show more tabs from modules
|
||||
// Entries must be declared in modules descriptor with line
|
||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||
// $this->tabs = array('entity:-tabname); to remove a tab
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'fiscalyear');
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT . '/accountancy/admin/fiscalyear_info.php?id=' . $object->id;
|
||||
$head[$h][1] = $langs->trans("Info");
|
||||
$head[$h][2] = 'info';
|
||||
$h++;
|
||||
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'fiscalyear','remove');
|
||||
|
||||
return $head;
|
||||
}
|
||||
@@ -29,7 +29,7 @@
|
||||
* Prepare array with list of tabs
|
||||
*
|
||||
* @param Object $object Object related to tabs
|
||||
* @return array Array of tabs to shoc
|
||||
* @return array Array of tabs to show
|
||||
*/
|
||||
function facturefourn_prepare_head($object)
|
||||
{
|
||||
@@ -37,7 +37,7 @@ function facturefourn_prepare_head($object)
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fourn/facture/fiche.php?facid='.$object->id;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fourn/facture/card.php?facid='.$object->id;
|
||||
$head[$h][1] = $langs->trans('CardBill');
|
||||
$head[$h][2] = 'card';
|
||||
$h++;
|
||||
@@ -63,7 +63,7 @@ function facturefourn_prepare_head($object)
|
||||
if(!empty($object->note_public)) $nbNote++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fourn/facture/note.php?facid='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Notes');
|
||||
if($nbNote > 0) $head[$h][1].= ' ('.$nbNote.')';
|
||||
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
|
||||
$head[$h][2] = 'note';
|
||||
$h++;
|
||||
}
|
||||
@@ -73,7 +73,7 @@ function facturefourn_prepare_head($object)
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fourn/facture/document.php?facid='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if($nbFiles > 0) $head[$h][1].= ' ('.$nbFiles.')';
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
@@ -92,7 +92,7 @@ function facturefourn_prepare_head($object)
|
||||
* Prepare array with list of tabs
|
||||
*
|
||||
* @param Object $object Object related to tabs
|
||||
* @return array Array of tabs to shoc
|
||||
* @return array Array of tabs to show
|
||||
*/
|
||||
function ordersupplier_prepare_head($object)
|
||||
{
|
||||
@@ -100,7 +100,7 @@ function ordersupplier_prepare_head($object)
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fourn/commande/fiche.php?id='.$object->id;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fourn/commande/card.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("OrderCard");
|
||||
$head[$h][2] = 'card';
|
||||
$h++;
|
||||
@@ -135,7 +135,7 @@ function ordersupplier_prepare_head($object)
|
||||
if(!empty($object->note_public)) $nbNote++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fourn/commande/note.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Notes");
|
||||
if($nbNote > 0) $head[$h][1].= ' ('.$nbNote.')';
|
||||
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
|
||||
$head[$h][2] = 'note';
|
||||
$h++;
|
||||
}
|
||||
@@ -145,7 +145,7 @@ function ordersupplier_prepare_head($object)
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fourn/commande/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if($nbFiles > 0) $head[$h][1].= ' ('.$nbFiles.')';
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
@@ -160,10 +160,9 @@ function ordersupplier_prepare_head($object)
|
||||
/**
|
||||
* Return array head with list of tabs to view object informations.
|
||||
*
|
||||
* @param Object $object order
|
||||
* @return array head array with tabs
|
||||
*/
|
||||
function supplierorder_admin_prepare_head($object)
|
||||
function supplierorder_admin_prepare_head()
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
|
||||
@@ -180,7 +179,7 @@ function supplierorder_admin_prepare_head($object)
|
||||
$head[$h][2] = 'invoice';
|
||||
$h++;
|
||||
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'supplierorder_admin');
|
||||
complete_head_from_modules($conf,$langs,null,$head,$h,'supplierorder_admin');
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/admin/supplierorder_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ExtraFieldsSupplierOrders");
|
||||
@@ -192,7 +191,7 @@ function supplierorder_admin_prepare_head($object)
|
||||
$head[$h][2] = 'supplierinvoice';
|
||||
$h++;
|
||||
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'supplierorder_admin','remove');
|
||||
complete_head_from_modules($conf,$langs,null,$head,$h,'supplierorder_admin','remove');
|
||||
|
||||
return $head;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,8 @@
|
||||
<?php
|
||||
/* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2008-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2008-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -394,12 +395,12 @@ function isValidMailDomain($mail)
|
||||
* <http[s]> :// [user[:pass]@] hostname [port] [/path] [?getquery] [anchor]
|
||||
*
|
||||
* @param string $url Url
|
||||
* @param int $http 1: verify http, 0: not verify http
|
||||
* @param int $pass 1: verify user and pass, 0: not verify user and pass
|
||||
* @param int $port 1: verify port, 0: not verify port
|
||||
* @param int $path 1: verify path, 0: not verify path
|
||||
* @param int $query 1: verify query, 0: not verify query
|
||||
* @param int $anchor 1: verify anchor, 0: not verify anchor
|
||||
* @param int $http 1: verify http is provided, 0: not verify http
|
||||
* @param int $pass 1: verify user and pass is provided, 0: not verify user and pass
|
||||
* @param int $port 1: verify port is provided, 0: not verify port
|
||||
* @param int $path 1: verify a path is provided "/" or "/..." or "/.../", 0: not verify path
|
||||
* @param int $query 1: verify query is provided, 0: not verify query
|
||||
* @param int $anchor 1: verify anchor is provided, 0: not verify anchor
|
||||
* @return int 1=Check is OK, 0=Check is KO
|
||||
*/
|
||||
function isValidUrl($url,$http=0,$pass=0,$port=0,$path=0,$query=0,$anchor=0)
|
||||
@@ -414,9 +415,9 @@ function isValidUrl($url,$http=0,$pass=0,$port=0,$path=0,$query=0,$anchor=0)
|
||||
if ($pass) $urlregex .= "([a-z0-9+!*(),;?&=\$_.-]+(\:[a-z0-9+!*(),;?&=\$_.-]+)?@)";
|
||||
|
||||
// HOSTNAME OR IP
|
||||
//$urlregex .= "[a-z0-9+\$_-]+(\.[a-z0-9+\$_-]+)*"; // http://x = allowed (ex. http://localhost, http://routerlogin)
|
||||
//$urlregex .= "[a-z0-9+\$_-]+(\.[a-z0-9+\$_-]+)+"; // http://x.x = minimum
|
||||
$urlregex .= "([a-z0-9+\$_-]+\.)*[a-z0-9+\$_-]{2,3}"; // http://x.xx(x) = minimum
|
||||
//$urlregex .= "[a-z0-9+\$_-]+(\.[a-z0-9+\$_-]+)*"; // x allowed (ex. http://localhost, http://routerlogin)
|
||||
//$urlregex .= "[a-z0-9+\$_-]+(\.[a-z0-9+\$_-]+)+"; // x.x
|
||||
$urlregex .= "([a-z0-9+\$_\\\:-])+(\.[a-z0-9+\$_-][a-z0-9+\$_-]+)*"; // x ou x.xx (2 x ou plus)
|
||||
//use only one of the above
|
||||
|
||||
// PORT
|
||||
@@ -433,7 +434,7 @@ function isValidUrl($url,$http=0,$pass=0,$port=0,$path=0,$query=0,$anchor=0)
|
||||
{
|
||||
$ValidUrl = 1;
|
||||
}
|
||||
//print $urlregex.' - '.$url.' - '.$ValidUrl;exit;
|
||||
//print $urlregex.' - '.$url.' - '.$ValidUrl;
|
||||
|
||||
return $ValidUrl;
|
||||
}
|
||||
@@ -478,6 +479,50 @@ function clean_url($url,$http=1)
|
||||
else return $url;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns an email value with obfuscated parts.
|
||||
*
|
||||
* @param string $mail Email
|
||||
* @param string $replace Replacement character (defaul : *)
|
||||
* @param int $nbreplace Number of replacement character (default : 8)
|
||||
* @param int $nbdisplaymail Number of character unchanged (default: 4)
|
||||
* @param int $nbdisplaydomain Number of character unchanged of domain (default: 3)
|
||||
* @param bool $displaytld Display tld (default: true)
|
||||
* @return string Return email with hidden parts or '';
|
||||
*/
|
||||
function dolObfuscateEmail($mail, $replace="*", $nbreplace=8, $nbdisplaymail=4, $nbdisplaydomain=3, $displaytld=true)
|
||||
{
|
||||
if(!isValidEmail($mail))return '';
|
||||
$tab = explode('@', $mail);
|
||||
$tab2 = explode('.',$tab[1]);
|
||||
$string_replace = '';
|
||||
$mail_name = $tab[0];
|
||||
$mail_domaine = $tab2[0];
|
||||
$mail_tld = '';
|
||||
|
||||
for($i=1; $i < count($tab2) && $displaytld ;$i++)
|
||||
{
|
||||
$mail_tld .= '.'.$tab2[$i];
|
||||
}
|
||||
|
||||
for($i=0; $i < $nbreplace; $i++){
|
||||
$string_replace .= $replace;
|
||||
}
|
||||
|
||||
if(strlen($mail_name) > $nbdisplaymail){
|
||||
$mail_name = substr($mail_name, 0, $nbdisplaymail);
|
||||
}
|
||||
|
||||
if(strlen($mail_domaine) > $nbdisplaydomain){
|
||||
$mail_domaine = substr($mail_domaine, strlen($mail_domaine)-$nbdisplaydomain);
|
||||
}
|
||||
|
||||
return $mail_name . $string_replace . $mail_domaine . $mail_tld;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return lines of an html table from an array
|
||||
* Used by array2table function only
|
||||
@@ -528,17 +573,18 @@ function array2table($data,$tableMarkup=1,$tableoptions='',$troptions='',$tdopti
|
||||
/**
|
||||
* Return last or next value for a mask (according to area we should not reset)
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param DoliDB $db Database handler
|
||||
* @param string $mask Mask to use
|
||||
* @param string $table Table containing field with counter
|
||||
* @param string $field Field containing already used values of counter
|
||||
* @param string $where To add a filter on selection (for exemple to filter on invoice types)
|
||||
* @param Societe $objsoc The company that own the object we need a counter for
|
||||
* @param string $date Date to use for the {y},{m},{d} tags.
|
||||
* @param string $mode 'next' for next value or 'last' for last value
|
||||
* @return string New value (numeric) or error message
|
||||
* @param string $mode 'next' for next value or 'last' for last value
|
||||
* @param bool $bentityon Activate the entity filter. Default is true (for modules not compatible with multicompany)
|
||||
* @return string New value (numeric) or error message
|
||||
*/
|
||||
function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$mode='next')
|
||||
function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$mode='next', $bentityon=true)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@@ -738,13 +784,14 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
|
||||
$sql = "SELECT MAX(".$sqlstring.") as val";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.$table;
|
||||
$sql.= " WHERE ".$field." LIKE '".$maskLike."'";
|
||||
$sql.= " AND ".$field." NOT LIKE '(PROV%)'";
|
||||
$sql.= " AND entity IN (".getEntity($table, 1).")";
|
||||
$sql.= " AND ".$field." NOT LIKE '(PROV%)'";
|
||||
if ($bentityon) // only if entity enable
|
||||
$sql.= " AND entity IN (".getEntity($table, 1).")";
|
||||
if ($where) $sql.=$where;
|
||||
if ($sqlwhere) $sql.=' AND '.$sqlwhere;
|
||||
|
||||
//print $sql.'<br>';
|
||||
dol_syslog("functions2::get_next_value mode=".$mode." sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog("functions2::get_next_value mode=".$mode."", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@@ -779,11 +826,12 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.$table;
|
||||
$sql.= " WHERE ".$field." LIKE '".$maskLike."'";
|
||||
$sql.= " AND ".$field." NOT LIKE '%PROV%'";
|
||||
$sql.= " AND entity IN (".getEntity($table, 1).")";
|
||||
if ($bentityon) // only if entity enable
|
||||
$sql.= " AND entity IN (".getEntity($table, 1).")";
|
||||
if ($where) $sql.=$where;
|
||||
if ($sqlwhere) $sql.=' AND '.$sqlwhere;
|
||||
|
||||
dol_syslog("functions2::get_next_value sql=".$sql);
|
||||
dol_syslog("functions2::get_next_value", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@@ -832,12 +880,13 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
|
||||
$maskrefclient_sql.= " FROM ".MAIN_DB_PREFIX.$table;
|
||||
//$sql.= " WHERE ".$field." not like '(%'";
|
||||
$maskrefclient_sql.= " WHERE ".$field." LIKE '".$maskrefclient_maskLike."'";
|
||||
$maskrefclient_sql.= " AND entity IN (".getEntity($table, 1).")";
|
||||
if ($bentityon) // only if entity enable
|
||||
$maskrefclient_sql.= " AND entity IN (".getEntity($table, 1).")";
|
||||
if ($where) $maskrefclient_sql.=$where; //use the same optional where as general mask
|
||||
if ($sqlwhere) $maskrefclient_sql.=' AND '.$sqlwhere; //use the same sqlwhere as general mask
|
||||
$maskrefclient_sql.=' AND (SUBSTRING('.$field.', '.(strpos($maskwithnocode,$maskrefclient)+1).', '.dol_strlen($maskrefclient_maskclientcode).")='".$maskrefclient_clientcode."')";
|
||||
|
||||
dol_syslog("functions2::get_next_value maskrefclient_sql=".$maskrefclient_sql, LOG_DEBUG);
|
||||
dol_syslog("functions2::get_next_value maskrefclient", LOG_DEBUG);
|
||||
$maskrefclient_resql=$db->query($maskrefclient_sql);
|
||||
if ($maskrefclient_resql)
|
||||
{
|
||||
@@ -1142,8 +1191,8 @@ function weight_convert($weight,&$from_unit,$to_unit)
|
||||
*
|
||||
* @param DoliDB $db Handler database
|
||||
* @param Conf $conf Object conf
|
||||
* @param User $user Object user
|
||||
* @param array $tab Tableau (cle=>valeur) des parametres a sauvegarder
|
||||
* @param User $user Object user
|
||||
* @param array $tab Array (key=>value) with all parameters to save
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*
|
||||
* @see dolibarr_get_const, dolibarr_set_const, dolibarr_del_const
|
||||
@@ -1168,7 +1217,7 @@ function dol_set_user_param($db, $conf, &$user, $tab)
|
||||
$i++;
|
||||
}
|
||||
$sql.= ")";
|
||||
dol_syslog("functions2.lib::dol_set_user_param sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog("functions2.lib::dol_set_user_param", LOG_DEBUG);
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if (! $resql)
|
||||
@@ -1187,7 +1236,7 @@ function dol_set_user_param($db, $conf, &$user, $tab)
|
||||
$sql.= " VALUES (".$user->id.",".$conf->entity.",";
|
||||
$sql.= " '".$key."','".$db->escape($value)."')";
|
||||
|
||||
dol_syslog("functions2.lib::dol_set_user_param sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog("functions2.lib::dol_set_user_param", LOG_DEBUG);
|
||||
$result=$db->query($sql);
|
||||
if (! $result)
|
||||
{
|
||||
@@ -1292,8 +1341,9 @@ function getListOfModels($db,$type,$maxfilenamelength=0)
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql.= " WHERE type = '".$type."'";
|
||||
$sql.= " AND entity IN (0,".(! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)?"1,":"").$conf->entity.")";
|
||||
$sql.= " ORDER BY description DESC";
|
||||
|
||||
dol_syslog('/core/lib/function2.lib.php::getListOfModels sql='.$sql, LOG_DEBUG);
|
||||
dol_syslog('/core/lib/function2.lib.php::getListOfModels', LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@@ -1363,20 +1413,24 @@ function getListOfModels($db,$type,$maxfilenamelength=0)
|
||||
/**
|
||||
* This function evaluates a string that should be a valid IPv4
|
||||
*
|
||||
* @param string $ip IP Address
|
||||
* @return It returns 0 if $ip is not a valid IPv4
|
||||
* It returns 1 if $ip is a valid IPv4 and is a public IP
|
||||
* It returns 2 if $ip is a valid IPv4 and is a private lan IP
|
||||
* @param string $ip IP Address
|
||||
* @return int 0 if not valid or reserved range, 1 if valid and public IP, 2 if valid and private range IP
|
||||
*/
|
||||
function is_ip($ip)
|
||||
{
|
||||
if (!preg_match("/^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/", $ip)) return 0;
|
||||
if (sprintf("%u",ip2long($ip)) == sprintf("%u",ip2long('255.255.255.255'))) return 0;
|
||||
if (sprintf("%u",ip2long('10.0.0.0')) <= sprintf("%u",ip2long($ip)) and sprintf("%u",ip2long($ip)) <= sprintf("%u",ip2long('10.255.255.255'))) return 2;
|
||||
if (sprintf("%u",ip2long('172.16.0.0')) <= sprintf("%u",ip2long($ip)) and sprintf("%u",ip2long($ip)) <= sprintf("%u",ip2long('172.31.255.255'))) return 2;
|
||||
if (sprintf("%u",ip2long('192.168.0.0')) <= sprintf("%u",ip2long($ip)) and sprintf("%u",ip2long($ip)) <= sprintf("%u",ip2long('192.168.255.255'))) return 2;
|
||||
if (sprintf("%u",ip2long('169.254.0.0')) <= sprintf("%u",ip2long($ip)) and sprintf("%u",ip2long($ip)) <= sprintf("%u",ip2long('169.254.255.255'))) return 2;
|
||||
return 1;
|
||||
// First we test if it is a valid IPv4
|
||||
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
|
||||
|
||||
// Then we test if it is a private range
|
||||
if (! filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE)) return 2;
|
||||
|
||||
// Then we test if it is a reserved range
|
||||
if (! filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE)) return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1582,7 +1636,6 @@ function cleanCorruptedTree($db, $tabletocleantree, $fieldfkparent)
|
||||
|
||||
// Check loops on each other
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$tabletocleantree." SET ".$fieldfkparent." = 0 WHERE ".$fieldfkparent." = rowid"; // So we update only records linked to themself
|
||||
dol_syslog("sql=".$sql);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@@ -1623,7 +1676,6 @@ function cleanCorruptedTree($db, $tabletocleantree, $fieldfkparent)
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$tabletocleantree;
|
||||
$sql.= " SET ".$fieldfkparent." = 0";
|
||||
$sql.= " WHERE rowid IN (".join(',',$listofidtoclean).")"; // So we update only records detected wrong
|
||||
dol_syslog("sql=".$sql);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@@ -1643,7 +1695,6 @@ function cleanCorruptedTree($db, $tabletocleantree, $fieldfkparent)
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$tabletocleantree;
|
||||
$sql.= " SET ".$fieldfkparent." = 0";
|
||||
$sql.= " WHERE ".$fieldfkparent." NOT IN (".join(',',$listofid).")"; // So we update only records linked to a non existing parent
|
||||
dol_syslog("sql=".$sql);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@@ -1785,3 +1836,42 @@ function fetchObjectByElement($element_id,$element_type) {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert an array with RGB value into hex RGB value
|
||||
*
|
||||
* @param array $arraycolor Array
|
||||
* @param string $colorifnotfound Color code to return if entry not defined
|
||||
* @return string RGB hex value (without # before). For example: FF00FF
|
||||
* @see Make the opposite of colorStringToArray
|
||||
*/
|
||||
function colorArrayToHex($arraycolor,$colorifnotfound='888888')
|
||||
{
|
||||
if (! is_array($arraycolor)) return $colorifnotfound;
|
||||
return dechex($arraycolor[0]).dechex($arraycolor[1]).dechex($arraycolor[2]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert a string RGB value ('FFFFFF', '255,255,255') into an array RGB array(255,255,255)
|
||||
*
|
||||
* @param string $stringcolor String with hex (FFFFFF) or comma RGB ('255,255,255')
|
||||
* @param string $colorifnotfound Color code to return if entry not defined
|
||||
* @return string RGB hex value (without # before). For example: FF00FF
|
||||
* @see Make the opposite of colorArrayToHex
|
||||
*/
|
||||
function colorStringToArray($stringcolor,$colorifnotfound=array(88,88,88))
|
||||
{
|
||||
if (is_array($stringcolor)) return $stringcolor; // If already into correct output format, we return as is
|
||||
$tmp=preg_match('/^([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])$/',$stringcolor,$reg);
|
||||
if (! $tmp)
|
||||
{
|
||||
$tmp=explode(',',$stringcolor);
|
||||
if (count($tmp) < 3) return $colorifnotfound;
|
||||
return $tmp;
|
||||
}
|
||||
return array(hexdec($reg[1]),hexdec($reg[2]),hexdec($reg[3]));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -72,6 +72,13 @@ function getURLContent($url,$postorget='GET',$param='',$followlocation=1,$addhea
|
||||
curl_setopt($ch, CURLOPT_POST, 1); // POST
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $param); // Setting param x=a&y=z as POST fields
|
||||
}
|
||||
else if ($postorget == 'PUT')
|
||||
{
|
||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); // HTTP request is 'PUT'
|
||||
if ( ! is_array($param) )
|
||||
parse_str($param, $array_param);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($array_param)); // Setting param x=a&y=z as PUT fields
|
||||
}
|
||||
else if ($postorget == 'HEAD')
|
||||
{
|
||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'HEAD'); // HTTP request is 'HEAD'
|
||||
|
||||
@@ -34,7 +34,7 @@ function holiday_prepare_head($object)
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT . '/holiday/fiche.php?id='.$object->id;
|
||||
$head[$h][0] = DOL_URL_ROOT . '/holiday/card.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Card");
|
||||
$head[$h][2] = 'card';
|
||||
$h++;
|
||||
@@ -49,4 +49,3 @@ function holiday_prepare_head($object)
|
||||
|
||||
return $head;
|
||||
}
|
||||
|
||||
|
||||
0
htdocs/core/lib/index.html
Normal file
0
htdocs/core/lib/index.html
Normal file
@@ -1 +0,0 @@
|
||||
Url not available
|
||||
@@ -79,7 +79,7 @@ function facture_prepare_head($object)
|
||||
if(!empty($object->note_public)) $nbNote++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/note.php?facid='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Notes');
|
||||
if($nbNote > 0) $head[$h][1].= ' ('.$nbNote.')';
|
||||
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
|
||||
$head[$h][2] = 'note';
|
||||
$h++;
|
||||
}
|
||||
@@ -89,7 +89,7 @@ function facture_prepare_head($object)
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/document.php?facid='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if($nbFiles > 0) $head[$h][1].= ' ('.$nbFiles.')';
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
@@ -106,10 +106,9 @@ function facture_prepare_head($object)
|
||||
/**
|
||||
* Return array head with list of tabs to view object informations.
|
||||
*
|
||||
* @param Object $object Invoice
|
||||
* @return array head array with tabs
|
||||
*/
|
||||
function invoice_admin_prepare_head($object)
|
||||
function invoice_admin_prepare_head()
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
|
||||
@@ -125,7 +124,7 @@ function invoice_admin_prepare_head($object)
|
||||
// Entries must be declared in modules descriptor with line
|
||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'invoice_admin');
|
||||
complete_head_from_modules($conf,$langs,null,$head,$h,'invoice_admin');
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/admin/facture_cust_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ExtraFieldsCustomerInvoices");
|
||||
@@ -137,7 +136,7 @@ function invoice_admin_prepare_head($object)
|
||||
$head[$h][2] = 'attributeslines';
|
||||
$h++;
|
||||
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'invoice_admin','remove');
|
||||
complete_head_from_modules($conf,$langs,null,$head,$h,'invoice_admin','remove');
|
||||
|
||||
return $head;
|
||||
}
|
||||
|
||||
@@ -42,12 +42,13 @@ require_once(DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php');
|
||||
* @param date $paymentdatebefore Payment before date (must includes hour)
|
||||
* @param int $usestdout Add information onto standard output
|
||||
* @param int $regenerate ''=Use existing PDF files, 'nameofpdf'=Regenerate all PDF files using the template
|
||||
* @param string $option Suffix to add into file name of generated PDF
|
||||
* @param string $filesuffix Suffix to add into file name of generated PDF
|
||||
* @param string $paymentbankid Only if payment on this bank account id
|
||||
* @param array $thirdpartiesid List of thirdparties id when using filter excludethirdpartiesid or onlythirdpartiesid
|
||||
* @param string $fileprefix Prefix to add into filename of generated PDF
|
||||
* @return int Error code
|
||||
*/
|
||||
function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filter, $dateafterdate, $datebeforedate, $paymentdateafter, $paymentdatebefore, $usestdout, $regenerate=0, $option='', $paymentbankid='', $thirdpartiesid='')
|
||||
function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filter, $dateafterdate, $datebeforedate, $paymentdateafter, $paymentdatebefore, $usestdout, $regenerate=0, $filesuffix='', $paymentbankid='', $thirdpartiesid='', $fileprefix='mergedpdf')
|
||||
{
|
||||
$sql = "SELECT DISTINCT f.rowid, f.facnumber";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||
@@ -129,7 +130,7 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte
|
||||
if ($sqlorder) $sql.=$sqlorder;
|
||||
|
||||
//print $sql; exit;
|
||||
dol_syslog("scripts/invoices/rebuild_merge.php: sql=".$sql);
|
||||
dol_syslog("scripts/invoices/rebuild_merge.php:", LOG_DEBUG);
|
||||
|
||||
if ($usestdout) print '--- start'."\n";
|
||||
|
||||
@@ -140,7 +141,7 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte
|
||||
$result = 0;
|
||||
$files = array() ; // liste les fichiers
|
||||
|
||||
dol_syslog("scripts/invoices/rebuild_merge.php sql=".$sql);
|
||||
dol_syslog("scripts/invoices/rebuild_merge.php", LOG_DEBUG);
|
||||
if ( $resql=$db->query($sql) )
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
@@ -175,7 +176,7 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte
|
||||
if ($regenerate || ! dol_is_file($filename))
|
||||
{
|
||||
if ($usestdout) print "Build PDF for invoice ".$obj->facnumber." - Lang = ".$outputlangs->defaultlang."\n";
|
||||
$result=facture_pdf_create($db, $fac, $regenerate?$regenerate:$fac->modelpdf, $outputlangs);
|
||||
$result= $fac->generateDocument($regenerate?$regenerate:$fac->modelpdf, $outputlangs);
|
||||
}
|
||||
else {
|
||||
if ($usestdout) print "PDF for invoice ".$obj->facnumber." already exists\n";
|
||||
@@ -221,13 +222,6 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte
|
||||
if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);
|
||||
//$pdf->SetCompression(false);
|
||||
|
||||
|
||||
//$pdf->Open();
|
||||
//$pdf->AddPage();
|
||||
//$title=$langs->trans("BillsCustomersUnpaid");
|
||||
//if ($option=='late') $title=$langs->trans("BillsCustomersUnpaid");
|
||||
//$pdf->MultiCell(100, 3, $title, 0, 'J');
|
||||
|
||||
// Add all others
|
||||
foreach($files as $file)
|
||||
{
|
||||
@@ -249,9 +243,9 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte
|
||||
dol_mkdir($diroutputpdf);
|
||||
|
||||
// Save merged file
|
||||
$filename='mergedpdf';
|
||||
|
||||
if (! empty($option)) $filename.='_'.$option;
|
||||
$filename=$fileprefix;
|
||||
if (empty($filename)) $filename='mergedpdf';
|
||||
if (! empty($filesuffix)) $filename.='_'.$filesuffix;
|
||||
$file=$diroutputpdf.'/'.$filename.'.pdf';
|
||||
|
||||
if (! $error && $pagecount)
|
||||
|
||||
@@ -254,7 +254,7 @@ function dol_json_decode($json, $assoc=false)
|
||||
|
||||
foreach ($array as $key => $value)
|
||||
{
|
||||
$object->{$key} = $value;
|
||||
if ($key) $object->{$key} = $value;
|
||||
}
|
||||
|
||||
return $object;
|
||||
|
||||
@@ -117,7 +117,7 @@ function show_ldap_test_button($butlabel,$testlabel,$key,$dn,$objectclass)
|
||||
/**
|
||||
* Show a LDAP array into an HTML output array.
|
||||
*
|
||||
* @param string $result Array to show. This array is already encoded into charset_output
|
||||
* @param array $result Array to show. This array is already encoded into charset_output
|
||||
* @param int $level Level
|
||||
* @param int $count Count
|
||||
* @param string $var Var
|
||||
|
||||
@@ -34,7 +34,7 @@ function member_prepare_head($object)
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/adherents/fiche.php?rowid='.$object->id;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/adherents/card.php?rowid='.$object->id;
|
||||
$head[$h][1] = $langs->trans("MemberCard");
|
||||
$head[$h][2] = 'general';
|
||||
$h++;
|
||||
@@ -88,7 +88,7 @@ function member_prepare_head($object)
|
||||
$head[$h][0] = DOL_URL_ROOT.'/adherents/note.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Note");
|
||||
$head[$h][2] = 'note';
|
||||
if($nbNote > 0) $head[$h][1].= ' ('.$nbNote.')';
|
||||
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/adherents/document.php?id='.$object->id;
|
||||
@@ -174,7 +174,7 @@ function member_stats_prepare_head($object)
|
||||
$head[$h][1] = $langs->trans("Country");
|
||||
$head[$h][2] = 'statscountry';
|
||||
$h++;
|
||||
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/adherents/stats/geo.php?mode=memberbyregion';
|
||||
$head[$h][1] = $langs->trans("Region");
|
||||
$head[$h][2] = 'statsregion';
|
||||
|
||||
@@ -28,7 +28,7 @@ $shmkeys=array('main'=>1,'admin'=>2,'dict'=>3,'companies'=>4,'suppliers'=>5,'pro
|
||||
'propal'=>13,'boxes'=>14,'banks'=>15,'other'=>16,'errors'=>17,'members'=>18,'ecm'=>19,
|
||||
'orders'=>20,'users'=>21,'help'=>22,'stocks'=>23,'interventions'=>24,
|
||||
'donations'=>25,'contracts'=>26);
|
||||
$shmoffset=100;
|
||||
$shmoffset=1000; // Max number of entries found into a language file. If too low, some entries will be overwritten.
|
||||
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@ function dol_getcache($memoryid)
|
||||
/**
|
||||
* Return shared memory address used to store dataset with key memoryid
|
||||
*
|
||||
* @param string $memoryid Memory id of shared area
|
||||
* @param string $memoryid Memory id of shared area ('main', 'agenda', ...)
|
||||
* @return int <0 if KO, Memoy address of shared memory for key
|
||||
*/
|
||||
function dol_getshmopaddress($memoryid)
|
||||
@@ -187,7 +187,7 @@ function dol_listshmop()
|
||||
/**
|
||||
* Save data into a memory area shared by all users, all sessions on server
|
||||
*
|
||||
* @param int $memoryid Memory id of shared area
|
||||
* @param int $memoryid Memory id of shared area ('main', 'agenda', ...)
|
||||
* @param string $data Data to save
|
||||
* @return int <0 if KO, Nb of bytes written if OK
|
||||
*/
|
||||
@@ -223,7 +223,7 @@ function dol_setshmop($memoryid,$data)
|
||||
/**
|
||||
* Read a memory area shared by all users, all sessions on server
|
||||
*
|
||||
* @param string $memoryid Memory id of shared area
|
||||
* @param string $memoryid Memory id of shared area ('main', 'agenda', ...)
|
||||
* @return int <0 if KO, data if OK
|
||||
*/
|
||||
function dol_getshmop($memoryid)
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
* Prepare array with list of tabs
|
||||
*
|
||||
* @param Object $object Object related to tabs
|
||||
* @return array Array of tabs to shoc
|
||||
* @return array Array of tabs to show
|
||||
*/
|
||||
function commande_prepare_head($object)
|
||||
{
|
||||
@@ -42,7 +42,7 @@ function commande_prepare_head($object)
|
||||
|
||||
if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/commande/fiche.php?id='.$object->id;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/commande/card.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("OrderCard");
|
||||
$head[$h][2] = 'order';
|
||||
$h++;
|
||||
@@ -89,7 +89,7 @@ function commande_prepare_head($object)
|
||||
if(!empty($object->note_public)) $nbNote++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/commande/note.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Notes');
|
||||
if($nbNote > 0) $head[$h][1].= ' ('.$nbNote.')';
|
||||
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
|
||||
$head[$h][2] = 'note';
|
||||
$h++;
|
||||
}
|
||||
@@ -99,7 +99,7 @@ function commande_prepare_head($object)
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$head[$h][0] = DOL_URL_ROOT.'/commande/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if($nbFiles > 0) $head[$h][1].= ' ('.$nbFiles.')';
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
@@ -116,10 +116,9 @@ function commande_prepare_head($object)
|
||||
/**
|
||||
* Return array head with list of tabs to view object informations.
|
||||
*
|
||||
* @param Object $object order
|
||||
* @return array head array with tabs
|
||||
* @return array head array with tabs
|
||||
*/
|
||||
function order_admin_prepare_head($object)
|
||||
function order_admin_prepare_head()
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
|
||||
@@ -131,7 +130,7 @@ function order_admin_prepare_head($object)
|
||||
$head[$h][2] = 'general';
|
||||
$h++;
|
||||
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'order_admin');
|
||||
complete_head_from_modules($conf,$langs,null,$head,$h,'order_admin');
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/admin/order_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ExtraFields");
|
||||
@@ -143,7 +142,7 @@ function order_admin_prepare_head($object)
|
||||
$head[$h][2] = 'attributeslines';
|
||||
$h++;
|
||||
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'order_admin','remove');
|
||||
complete_head_from_modules($conf,$langs,null,$head,$h,'order_admin','remove');
|
||||
|
||||
return $head;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ function payment_prepare_head(Paiement $object) {
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/paiement/fiche.php?id='.$object->id;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/paiement/card.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Card");
|
||||
$head[$h][2] = 'payment';
|
||||
$h++;
|
||||
@@ -67,7 +67,7 @@ function payment_supplier_prepare_head(Paiement $object) {
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fourn/paiement/fiche.php?id='.$object->id;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fourn/paiement/card.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Card");
|
||||
$head[$h][2] = 'payment';
|
||||
$h++;
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
<?php
|
||||
/* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
||||
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
|
||||
/* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
||||
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
|
||||
* Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -166,7 +167,7 @@ function pdf_getInstance($format='',$metric='mm',$pagetype='P')
|
||||
* This class is an enhanced FPDI class that support method writeHTMLCell
|
||||
*/
|
||||
class FPDI_DolExtended extends FPDI
|
||||
{
|
||||
{
|
||||
/**
|
||||
* __call
|
||||
*
|
||||
@@ -269,7 +270,9 @@ function pdf_getPDFFontSize($outputlangs)
|
||||
*/
|
||||
function pdf_getHeightForLogo($logo, $url = false)
|
||||
{
|
||||
$height=22; $maxwidth=130;
|
||||
global $conf;
|
||||
$height=(empty($conf->global->MAIN_DOCUMENTS_LOGO_HEIGHT)?22:$conf->global->MAIN_DOCUMENTS_LOGO_HEIGHT);
|
||||
$maxwidth=130;
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
|
||||
$tmp=dol_getImageSize($logo, $url);
|
||||
if ($tmp['height'])
|
||||
@@ -435,9 +438,9 @@ function pdf_pagehead(&$pdf,$outputlangs,$page_height)
|
||||
// Add a background image on document
|
||||
if (! empty($conf->global->MAIN_USE_BACKGROUND_ON_PDF)) // Warning, this option make TCPDF generation beeing crazy and some content disappeared behin the image
|
||||
{
|
||||
$pdf->SetAutoPageBreak(0,0); // Disable auto pagebreak before adding image
|
||||
$pdf->SetAutoPageBreak(0,0); // Disable auto pagebreak before adding image
|
||||
$pdf->Image($conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_USE_BACKGROUND_ON_PDF, (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_X)?$conf->global->MAIN_USE_BACKGROUND_ON_PDF_X:0), (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y)?$conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y:0), 0, $page_height);
|
||||
$pdf->SetAutoPageBreak(1,0); // Restore pagebreak
|
||||
$pdf->SetAutoPageBreak(1,0); // Restore pagebreak
|
||||
}
|
||||
}
|
||||
|
||||
@@ -489,7 +492,7 @@ function pdf_watermark(&$pdf, $outputlangs, $h, $w, $unit, $text)
|
||||
* @param int $curx X
|
||||
* @param int $cury Y
|
||||
* @param Account $account Bank account object
|
||||
* @param int $onlynumber Output only number
|
||||
* @param int $onlynumber Output only number (bank+desk+key+number according to country, but without name of bank and domiciliation)
|
||||
* @param int $default_font_size Default font size
|
||||
* @return float The Y PDF position
|
||||
*/
|
||||
@@ -499,7 +502,6 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default
|
||||
|
||||
$diffsizetitle=(empty($conf->global->PDF_DIFFSIZE_TITLE)?3:$conf->global->PDF_DIFFSIZE_TITLE);
|
||||
$diffsizecontent=(empty($conf->global->PDF_DIFFSIZE_CONTENT)?4:$conf->global->PDF_DIFFSIZE_CONTENT);
|
||||
|
||||
$pdf->SetXY($curx, $cury);
|
||||
|
||||
if (empty($onlynumber))
|
||||
@@ -511,10 +513,14 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default
|
||||
|
||||
$outputlangs->load("banks");
|
||||
|
||||
// Use correct name of bank id according to country
|
||||
$bickey="BICNumber";
|
||||
if ($account->getCountryCode() == 'IN') $bickey="SWIFT";
|
||||
|
||||
// Get format of bank account according to its country
|
||||
$usedetailedbban=$account->useDetailedBBAN();
|
||||
|
||||
//$onlynumber=0; $usedetailedbban=0; // For tests
|
||||
$onlynumber=0; $usedetailedbban=1; // For tests
|
||||
if ($usedetailedbban)
|
||||
{
|
||||
$savcurx=$curx;
|
||||
@@ -589,7 +595,7 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default
|
||||
}
|
||||
|
||||
$curx=$savcurx;
|
||||
$cury+=10;
|
||||
$cury+=9;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -606,12 +612,6 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default
|
||||
if ($diffsizecontent <= 2) $cury+=1;
|
||||
}
|
||||
|
||||
// Use correct name of bank id according to country
|
||||
$ibankey="IBANNumber";
|
||||
$bickey="BICNumber";
|
||||
if ($account->getCountryCode() == 'IN') $ibankey="IFSC";
|
||||
if ($account->getCountryCode() == 'IN') $bickey="SWIFT";
|
||||
|
||||
$pdf->SetFont('','',$default_font_size - $diffsizecontent);
|
||||
|
||||
if (empty($onlynumber) && ! empty($account->domiciliation))
|
||||
@@ -626,15 +626,29 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default
|
||||
}
|
||||
else if (! $usedetailedbban) $cury+=1;
|
||||
|
||||
// Use correct name of bank id according to country
|
||||
$ibankey="IBANNumber";
|
||||
if ($account->getCountryCode() == 'IN') $ibankey="IFSC";
|
||||
if (! empty($account->iban))
|
||||
{
|
||||
$ibanDisplay_temp = $outputlangs->convToOutputCharset($account->iban);
|
||||
$ibanDisplay = "";
|
||||
|
||||
for($i = 0; $i < dol_strlen($ibanDisplay_temp); $i++)
|
||||
{
|
||||
$ibanDisplay .= $ibanDisplay_temp[$i];
|
||||
if($i%4 == 3 && $i > 0) $ibanDisplay .= " ";
|
||||
}
|
||||
|
||||
$pdf->SetFont('','B',$default_font_size - 3);
|
||||
$pdf->SetXY($curx, $cury);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities($ibankey).': ' . $outputlangs->convToOutputCharset($account->iban), 0, 'L', 0);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities($ibankey).': ' . $ibanDisplay, 0, 'L', 0);
|
||||
$cury+=3;
|
||||
}
|
||||
|
||||
if (! empty($account->bic))
|
||||
{
|
||||
$pdf->SetFont('','B',$default_font_size - 3);
|
||||
$pdf->SetXY($curx, $cury);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities($bickey).': ' . $outputlangs->convToOutputCharset($account->bic), 0, 'L', 0);
|
||||
}
|
||||
@@ -642,7 +656,6 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default
|
||||
return $pdf->getY();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show footer of page for PDF generation
|
||||
*
|
||||
@@ -654,7 +667,7 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default
|
||||
* @param int $marge_gauche Margin left (no more used)
|
||||
* @param int $page_hauteur Page height (no more used)
|
||||
* @param Object $object Object shown in PDF
|
||||
* @param int $showdetails Show company details into footer. This param seems to not be used by standard version.
|
||||
* @param int $showdetails Show company details into footer. This param seems to not be used by standard version. (1=Show address, 2=Show managers, 3=Both)
|
||||
* @param int $hidefreetext 1=Hide free text, 0=Show free text
|
||||
* @return int Return height of bottom margin including footer text
|
||||
*/
|
||||
@@ -672,11 +685,11 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
|
||||
{
|
||||
// Make substitution
|
||||
$substitutionarray=array(
|
||||
'__FROM_NAME__' => $fromcompany->nom,
|
||||
'__FROM_EMAIL__' => $fromcompany->email,
|
||||
'__TOTAL_TTC__' => $object->total_ttc,
|
||||
'__TOTAL_HT__' => $object->total_ht,
|
||||
'__TOTAL_VAT__' => $object->total_vat
|
||||
'__FROM_NAME__' => $fromcompany->name,
|
||||
'__FROM_EMAIL__' => $fromcompany->email,
|
||||
'__TOTAL_TTC__' => $object->total_ttc,
|
||||
'__TOTAL_HT__' => $object->total_ht,
|
||||
'__TOTAL_VAT__' => $object->total_vat
|
||||
);
|
||||
complete_substitutions_array($substitutionarray,$outputlangs,$object);
|
||||
$newfreetext=make_substitutions($conf->global->$paramfreetext,$substitutionarray);
|
||||
@@ -684,10 +697,10 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
|
||||
}
|
||||
|
||||
// First line of company infos
|
||||
$line1=""; $line2=""; $line3=""; $line4="";
|
||||
|
||||
if ($showdetails)
|
||||
if ($showdetails && 1)
|
||||
{
|
||||
$line1="";
|
||||
// Company name
|
||||
if ($fromcompany->name)
|
||||
{
|
||||
@@ -719,7 +732,6 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
|
||||
$line1.=($line1?" - ":"").$outputlangs->transnoentities("Fax").": ".$fromcompany->fax;
|
||||
}
|
||||
|
||||
$line2="";
|
||||
// URL
|
||||
if ($fromcompany->url)
|
||||
{
|
||||
@@ -731,9 +743,16 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
|
||||
$line2.=($line2?" - ":"").$fromcompany->email;
|
||||
}
|
||||
}
|
||||
if (($showdetails && 2) || ($fromcompany->country_code == 'DE'))
|
||||
{
|
||||
// Managers
|
||||
if ($fromcompany->managers)
|
||||
{
|
||||
$line2.=($line2?" - ":"").$fromcompany->managers;
|
||||
}
|
||||
}
|
||||
|
||||
// Line 3 of company infos
|
||||
$line3="";
|
||||
// Juridical status
|
||||
if ($fromcompany->forme_juridique_code)
|
||||
{
|
||||
@@ -742,7 +761,9 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
|
||||
// Capital
|
||||
if ($fromcompany->capital)
|
||||
{
|
||||
$line3.=($line3?" - ":"").$outputlangs->transnoentities("CapitalOf",$fromcompany->capital)." ".$outputlangs->transnoentities("Currency".$conf->currency);
|
||||
$tmpamounttoshow = price2num($fromcompany->capital); // This field is a free string
|
||||
if (is_numeric($tmpamounttoshow) && $tmpamounttoshow > 0) $line3.=($line3?" - ":"").$outputlangs->transnoentities("CapitalOf",price($tmpamounttoshow, 0, $outputlangs, 0, 0, 0, $conf->currency));
|
||||
else $line3.=($line3?" - ":"").$outputlangs->transnoentities("CapitalOf",$tmpamounttoshow,$outputlangs);
|
||||
}
|
||||
// Prof Id 1
|
||||
if ($fromcompany->idprof1 && ($fromcompany->country_code != 'FR' || ! $fromcompany->idprof2))
|
||||
@@ -760,7 +781,6 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
|
||||
}
|
||||
|
||||
// Line 4 of company infos
|
||||
$line4="";
|
||||
// Prof Id 3
|
||||
if ($fromcompany->idprof3)
|
||||
{
|
||||
@@ -1253,7 +1273,7 @@ function pdf_getlineupexcltax($object,$i,$outputlangs,$hidedetails=0)
|
||||
*
|
||||
* @param Object $object Object
|
||||
* @param int $i Current line number
|
||||
* @param Tranlate $outputlangs Object langs for output
|
||||
* @param Translate $outputlangs Object langs for output
|
||||
* @param int $hidedetails Hide value (0 = no, 1 = yes, 2 = just special lines)
|
||||
* @return void
|
||||
*/
|
||||
@@ -1586,11 +1606,22 @@ function pdf_getLinkedObjects($object,$outputlangs)
|
||||
$linkedobjects[$objecttype]['date_value'] = dol_print_date($objects[$i]->date,'day','',$outputlangs);
|
||||
}
|
||||
}
|
||||
else if ($objecttype == 'contrat')
|
||||
{
|
||||
$outputlangs->load('contracts');
|
||||
$num=count($objects);
|
||||
for ($i=0;$i<$num;$i++)
|
||||
{
|
||||
$linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefContract");
|
||||
$linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($objects[$i]->ref);
|
||||
$linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("DateContract");
|
||||
$linkedobjects[$objecttype]['date_value'] = dol_print_date($objects[$i]->date_contrat,'day','',$outputlangs);
|
||||
}
|
||||
}
|
||||
else if ($objecttype == 'shipping')
|
||||
{
|
||||
$outputlangs->load('orders');
|
||||
$outputlangs->load('sendings');
|
||||
|
||||
$num=count($objects);
|
||||
for ($i=0;$i<$num;$i++)
|
||||
{
|
||||
@@ -1605,18 +1636,6 @@ function pdf_getLinkedObjects($object,$outputlangs)
|
||||
$linkedobjects[$objecttype]['date_value'].= ' / ' . dol_print_date($objects[$i]->date_delivery,'day','',$outputlangs);
|
||||
}
|
||||
}
|
||||
else if ($objecttype == 'contrat')
|
||||
{
|
||||
$outputlangs->load('contracts');
|
||||
$num=count($objects);
|
||||
for ($i=0;$i<$num;$i++)
|
||||
{
|
||||
$linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefContract");
|
||||
$linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($objects[$i]->ref);
|
||||
$linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("DateContract");
|
||||
$linkedobjects[$objecttype]['date_value'] = dol_print_date($objects[$i]->date_contrat,'day','',$outputlangs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// For add external linked objects
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
* Prepare array with list of tabs
|
||||
*
|
||||
* @param Object $object Object related to tabs
|
||||
* @return array Array of tabs to shoc
|
||||
* @return array Array of tabs to show
|
||||
*/
|
||||
function prelevement_prepare_head($object)
|
||||
{
|
||||
@@ -39,19 +39,11 @@ function prelevement_prepare_head($object)
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche.php?id='.$object->id;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Card");
|
||||
$head[$h][2] = 'prelevement';
|
||||
$h++;
|
||||
|
||||
if (! empty($conf->global->MAIN_USE_PREVIEW_TABS))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/bon.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Preview");
|
||||
$head[$h][2] = 'preview';
|
||||
$h++;
|
||||
}
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/lignes.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Lines");
|
||||
$head[$h][2] = 'lines';
|
||||
|
||||
@@ -111,7 +111,7 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_tva as cv";
|
||||
$sql.= " WHERE cv.taux = ".$txtva;
|
||||
$sql.= " AND cv.fk_pays = ".$countryid;
|
||||
dol_syslog("calcul_price_total search vat information sql=".$sql);
|
||||
dol_syslog("calcul_price_total search vat information", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
*
|
||||
* @param Object $object Object related to tabs
|
||||
* @param User $user Object user
|
||||
* @return array Array of tabs to shoc
|
||||
* @return array Array of tabs to show
|
||||
*/
|
||||
function product_prepare_head($object, $user)
|
||||
{
|
||||
@@ -39,7 +39,7 @@ function product_prepare_head($object, $user)
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/product/fiche.php?id=".$object->id;
|
||||
$head[$h][0] = DOL_URL_ROOT."/product/card.php?id=".$object->id;
|
||||
$head[$h][1] = $langs->trans("Card");
|
||||
$head[$h][2] = 'card';
|
||||
$h++;
|
||||
@@ -83,13 +83,13 @@ function product_prepare_head($object, $user)
|
||||
// Sub products
|
||||
if (! empty($conf->global->PRODUIT_SOUSPRODUITS))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT."/product/composition/fiche.php?id=".$object->id;
|
||||
$head[$h][0] = DOL_URL_ROOT."/product/composition/card.php?id=".$object->id;
|
||||
$head[$h][1] = $langs->trans('AssociatedProducts');
|
||||
$head[$h][2] = 'subproduct';
|
||||
$h++;
|
||||
}
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/product/stats/fiche.php?id=".$object->id;
|
||||
$head[$h][0] = DOL_URL_ROOT."/product/stats/card.php?id=".$object->id;
|
||||
$head[$h][1] = $langs->trans('Statistics');
|
||||
$head[$h][2] = 'stats';
|
||||
$h++;
|
||||
@@ -147,10 +147,9 @@ function product_prepare_head($object, $user)
|
||||
/**
|
||||
* Return array head with list of tabs to view object informations.
|
||||
*
|
||||
* @param Object $object Product
|
||||
* @return array head array with tabs
|
||||
*/
|
||||
function product_admin_prepare_head($object=null)
|
||||
function product_admin_prepare_head()
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
|
||||
@@ -166,14 +165,14 @@ function product_admin_prepare_head($object=null)
|
||||
// Entries must be declared in modules descriptor with line
|
||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||
// $this->tabs = array('entity:-tabname); to remove a tab
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'product_admin');
|
||||
complete_head_from_modules($conf,$langs,null,$head,$h,'product_admin');
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/product/admin/product_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ExtraFields");
|
||||
$head[$h][2] = 'attributes';
|
||||
$h++;
|
||||
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'product_admin','remove');
|
||||
complete_head_from_modules($conf,$langs,null,$head,$h,'product_admin','remove');
|
||||
|
||||
return $head;
|
||||
}
|
||||
@@ -316,6 +315,7 @@ function measuring_units_string($unit,$measuring_style='')
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$measuring_units=array();
|
||||
if ($measuring_style == 'weight')
|
||||
{
|
||||
$measuring_units[3] = $langs->trans("WeightUnitton");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2006-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2006-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
@@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
* Prepare array with list of tabs
|
||||
*
|
||||
* @param Object $object Object related to tabs
|
||||
* @return array Array of tabs to shoc
|
||||
* @return array Array of tabs to show
|
||||
*/
|
||||
function project_prepare_head($object)
|
||||
{
|
||||
@@ -38,7 +38,7 @@ function project_prepare_head($object)
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/projet/fiche.php?id='.$object->id;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/projet/card.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Project");
|
||||
$head[$h][2] = 'project';
|
||||
$h++;
|
||||
@@ -71,7 +71,7 @@ function project_prepare_head($object)
|
||||
if(!empty($object->note_public)) $nbNote++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/projet/note.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Notes');
|
||||
if($nbNote > 0) $head[$h][1].= ' ('.$nbNote.')';
|
||||
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
|
||||
$head[$h][2] = 'notes';
|
||||
$h++;
|
||||
}
|
||||
@@ -81,7 +81,7 @@ function project_prepare_head($object)
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$head[$h][0] = DOL_URL_ROOT.'/projet/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if($nbFiles > 0) $head[$h][1].= ' ('.$nbFiles.')';
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
$head[$h][2] = 'document';
|
||||
$h++;
|
||||
|
||||
@@ -113,7 +113,7 @@ function project_prepare_head($object)
|
||||
* Prepare array with list of tabs
|
||||
*
|
||||
* @param Object $object Object related to tabs
|
||||
* @return array Array of tabs to shoc
|
||||
* @return array Array of tabs to show
|
||||
*/
|
||||
function task_prepare_head($object)
|
||||
{
|
||||
@@ -149,7 +149,7 @@ function task_prepare_head($object)
|
||||
if(!empty($object->note_public)) $nbNote++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/note.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':'');;
|
||||
$head[$h][1] = $langs->trans('Notes');
|
||||
if($nbNote > 0) $head[$h][1].= ' ('.$nbNote.')';
|
||||
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
|
||||
$head[$h][2] = 'task_notes';
|
||||
$h++;
|
||||
}
|
||||
@@ -170,7 +170,7 @@ function task_prepare_head($object)
|
||||
/**
|
||||
* Prepare array with list of tabs
|
||||
*
|
||||
* @return array Array of tabs to shoc
|
||||
* @return array Array of tabs to show
|
||||
*/
|
||||
function project_admin_prepare_head()
|
||||
{
|
||||
@@ -357,7 +357,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
||||
print '</td>';
|
||||
|
||||
// Planned Workload (in working hours)
|
||||
print '<td align="center">';
|
||||
print '<td align="right">';
|
||||
$fullhour=convertSecondToTime($lines[$i]->planned_workload,'allhourmin');
|
||||
$workingdelay=convertSecondToTime($lines[$i]->planned_workload,'all',86400,7); // TODO Replace 86400 and 7 to take account working hours per day and working day per weeks
|
||||
if ($lines[$i]->planned_workload)
|
||||
@@ -384,10 +384,13 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
||||
else print '</a>';
|
||||
print '</td>';
|
||||
|
||||
// Progress calculated
|
||||
// Note: ->duration is in fact time spent i think
|
||||
// Progress calculated (Note: ->duration is time spent)
|
||||
print '<td align="right">';
|
||||
if ($lines[$i]->planned_workload) print round(100 * $lines[$i]->duration / $lines[$i]->planned_workload,2).' %';
|
||||
if ($lines[$i]->planned_workload || $lines[$i]->duration)
|
||||
{
|
||||
if ($lines[$i]->planned_workload) print round(100 * $lines[$i]->duration / $lines[$i]->planned_workload,2).' %';
|
||||
else print $langs->trans('WorkloadNotDefined');
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Tick to drag and drop
|
||||
@@ -422,7 +425,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td align="center" class="nowrap liste_total">';
|
||||
print '<td align="right" class="nowrap liste_total">';
|
||||
print convertSecondToTime($total_projectlinesa_planned, 'allhourmin');
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
@@ -430,7 +433,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
||||
print convertSecondToTime($total_projectlinesa_spent, 'allhourmin');
|
||||
print '</td>';
|
||||
print '<td align="right" class="nowrap liste_total">';
|
||||
if ($total_projectlinesa_planned) print round(100 * $total_projectlinesa_spent_if_planned / $total_projectlinesa_planned,2).' %';
|
||||
if ($total_projectlinesa_planned) print round(100 * $total_projectlinesa_spent / $total_projectlinesa_planned,2).' %';
|
||||
print '</td>';
|
||||
if ($addordertick) print '<td class="hideonsmartphone"></td>';
|
||||
print '</tr>';
|
||||
@@ -445,7 +448,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
||||
*
|
||||
* @param string $inc ?
|
||||
* @param string $parent ?
|
||||
* @param Object $lines ?
|
||||
* @param Task[] $lines ?
|
||||
* @param int $level ?
|
||||
* @param string $projectsrole ?
|
||||
* @param string $tasksrole ?
|
||||
@@ -455,8 +458,14 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
||||
*/
|
||||
function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask=0)
|
||||
{
|
||||
global $user, $bc, $langs;
|
||||
global $form, $projectstatic, $taskstatic;
|
||||
global $db, $user, $bc, $langs;
|
||||
global $form, $formother, $projectstatic, $taskstatic;
|
||||
|
||||
if (! is_object($formother))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
$formother = new FormOther($db);
|
||||
}
|
||||
|
||||
$lastprojectid=0;
|
||||
|
||||
@@ -526,7 +535,7 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr
|
||||
|
||||
// Progress declared %
|
||||
print '<td align="right">';
|
||||
print $lines[$i]->progress.' %';
|
||||
print $formother->select_percent($lines[$i]->progress, $lines[$i]->id . 'progress');
|
||||
print '</td>';
|
||||
|
||||
// Time spent
|
||||
@@ -556,13 +565,16 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr
|
||||
$disabledtask=1;
|
||||
}
|
||||
|
||||
print '<td class="nowrap">';
|
||||
$s =$form->select_date('',$lines[$i]->id,'','','',"addtime",1,0,1,$disabledtask);
|
||||
// Form to add new time
|
||||
print '<td class="nowrap" align="right">';
|
||||
$s='';
|
||||
$s.=$form->select_date('',$lines[$i]->id,0,0,2,"addtime",1,0,1,$disabledtask);
|
||||
$s.=' ';
|
||||
$s.=$form->select_duration($lines[$i]->id,'',$disabledtask,'text');
|
||||
$s.=$form->select_duration($lines[$i]->id,'',$disabledtask,'text',0,1);
|
||||
$s.=' <input type="submit" class="button"'.($disabledtask?' disabled="disabled"':'').' value="'.$langs->trans("Add").'">';
|
||||
print $s;
|
||||
print '</td>';
|
||||
|
||||
print '<td align="right">';
|
||||
if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("YouAreNotContactOfProject"));
|
||||
else if ($disabledtask) print $form->textwithpicto('',$langs->trans("TaskIsNotAffectedToYou"));
|
||||
@@ -629,9 +641,10 @@ function searchTaskInChild(&$inc, $parent, &$lines, &$taskrole)
|
||||
* @param int $socid Id thirdparty
|
||||
* @param int $projectsListId Id of project i have permission on
|
||||
* @param int $mytasks Limited to task i am contact to
|
||||
* @param int $statut -1=No filter on statut, 0 or 1 = Filter on status
|
||||
* @return void
|
||||
*/
|
||||
function print_projecttasks_array($db, $socid, $projectsListId, $mytasks=0)
|
||||
function print_projecttasks_array($db, $socid, $projectsListId, $mytasks=0, $statut=-1)
|
||||
{
|
||||
global $langs,$conf,$user,$bc;
|
||||
|
||||
@@ -641,10 +654,15 @@ function print_projecttasks_array($db, $socid, $projectsListId, $mytasks=0)
|
||||
|
||||
$sortfield='';
|
||||
$sortorder='';
|
||||
$project_year_filter=0;
|
||||
|
||||
$title=$langs->trans("Project");
|
||||
if ($statut == 0) $title=$langs->trans("ProjectDraft");
|
||||
if ($statut == 1) $title=$langs->trans("Project").' ('.$langs->trans("Validated").')';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Project"),"index.php","","","","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($title,"index.php","","","","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Tasks"),"","","","",'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"),"","","","",'align="right"',$sortfield,$sortorder);
|
||||
print "</tr>\n";
|
||||
@@ -672,6 +690,21 @@ function print_projecttasks_array($db, $socid, $projectsListId, $mytasks=0)
|
||||
$sql.= " AND ctc.element = 'project_task'";
|
||||
$sql.= " AND ec.fk_socpeople = ".$user->id;
|
||||
}
|
||||
if ($statut >= 0)
|
||||
{
|
||||
$sql.= " AND p.fk_statut = ".$statut;
|
||||
}
|
||||
if (!empty($conf->global->PROJECT_LIMIT_YEAR_RANGE)) {
|
||||
$project_year_filter = GETPOST("project_year_filter");
|
||||
//Check if empty or invalid year. Wildcard ignores the sql check
|
||||
if ($project_year_filter != "*") {
|
||||
if (empty($project_year_filter) || !ctype_digit($project_year_filter)) { //
|
||||
$project_year_filter = date("Y");
|
||||
}
|
||||
$sql.= " AND (p.dateo IS NULL OR p.dateo <= ".$db->idate(dol_get_last_day($project_year_filter,12,false)).")";
|
||||
$sql.= " AND (p.datee IS NULL OR p.datee >= ".$db->idate(dol_get_first_day($project_year_filter,1,false)).")";
|
||||
}
|
||||
}
|
||||
$sql.= " GROUP BY p.rowid, p.ref, p.title, p.fk_user_creat, p.public, p.fk_statut";
|
||||
$sql.= " ORDER BY p.title, p.ref";
|
||||
|
||||
@@ -715,6 +748,19 @@ function print_projecttasks_array($db, $socid, $projectsListId, $mytasks=0)
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
if (!empty($conf->global->PROJECT_LIMIT_YEAR_RANGE)) {
|
||||
//Add the year filter input
|
||||
print '<table width="100%">';
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("Year").'</td>';
|
||||
print '<form method="get" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<td style="text-align:right"><input type="text" size="4" class="flat" name="project_year_filter" value="'.$project_year_filter.'"/>';
|
||||
print '</form>';
|
||||
print "</tr>\n";
|
||||
print '</table>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
* Prepare array with list of tabs
|
||||
*
|
||||
* @param object $object Object related to tabs
|
||||
* @return array Array of tabs to shoc
|
||||
* @return array Array of tabs to show
|
||||
*/
|
||||
function propal_prepare_head($object)
|
||||
{
|
||||
@@ -83,7 +83,7 @@ function propal_prepare_head($object)
|
||||
if(!empty($object->note_public)) $nbNote++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/note.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Notes');
|
||||
if($nbNote > 0) $head[$h][1].= ' ('.$nbNote.')';
|
||||
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
|
||||
$head[$h][2] = 'note';
|
||||
$h++;
|
||||
}
|
||||
@@ -93,7 +93,7 @@ function propal_prepare_head($object)
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if($nbFiles > 0) $head[$h][1].= ' ('.$nbFiles.')';
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
$head[$h][2] = 'document';
|
||||
$h++;
|
||||
|
||||
@@ -110,10 +110,9 @@ function propal_prepare_head($object)
|
||||
/**
|
||||
* Return array head with list of tabs to view object informations.
|
||||
*
|
||||
* @param Object $object Propal
|
||||
* @return array head array with tabs
|
||||
*/
|
||||
function propal_admin_prepare_head($object)
|
||||
function propal_admin_prepare_head()
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
|
||||
@@ -129,7 +128,7 @@ function propal_admin_prepare_head($object)
|
||||
// Entries must be declared in modules descriptor with line
|
||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'propal_admin');
|
||||
complete_head_from_modules($conf,$langs,null,$head,$h,'propal_admin');
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/admin/propal_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ExtraFields");
|
||||
@@ -141,7 +140,7 @@ function propal_admin_prepare_head($object)
|
||||
$head[$h][2] = 'attributeslines';
|
||||
$h++;
|
||||
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'propal_admin','remove');
|
||||
complete_head_from_modules($conf,$langs,null,$head,$h,'propal_admin','remove');
|
||||
|
||||
return $head;
|
||||
}
|
||||
|
||||
@@ -26,15 +26,15 @@
|
||||
/**
|
||||
* Show header of a VAT report
|
||||
*
|
||||
* @param string $nom Name of report
|
||||
* @param string $variante Link for alternate report
|
||||
* @param string $period Period of report
|
||||
* @param string $periodlink Link to switch period
|
||||
* @param string $description Description
|
||||
* @param date $builddate Date generation
|
||||
* @param string $exportlink Link for export or ''
|
||||
* @param array $moreparam Array with list of params to add into form
|
||||
* @param string $calcmode Calculation mode
|
||||
* @param string $nom Name of report
|
||||
* @param string $variante Link for alternate report
|
||||
* @param string $period Period of report
|
||||
* @param string $periodlink Link to switch period
|
||||
* @param string $description Description
|
||||
* @param timestamp|integer $builddate Date generation
|
||||
* @param string $exportlink Link for export or ''
|
||||
* @param array $moreparam Array with list of params to add into form
|
||||
* @param string $calcmode Calculation mode
|
||||
* @return void
|
||||
*/
|
||||
function report_header($nom,$variante,$period,$periodlink,$description,$builddate,$exportlink='',$moreparam=array(),$calcmode='')
|
||||
@@ -79,7 +79,7 @@ function report_header($nom,$variante,$period,$periodlink,$description,$builddat
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
// Ligne de la periode d'analyse du rapport
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("ReportPeriod").'</td>';
|
||||
|
||||
@@ -70,11 +70,11 @@ function dol_decode($chain)
|
||||
|
||||
/**
|
||||
* Returns a hash of a string.
|
||||
* If constant MAIN_SECURITY_HASH_ALGO is defined, we use this function as hashing function (md5 by default)
|
||||
* If constant MAIN_SECURITY_SALT is defined, we use it as a salt
|
||||
* If constant MAIN_SECURITY_HASH_ALGO is defined, we use this function as hashing function.
|
||||
* If constant MAIN_SECURITY_SALT is defined, we use it as a salt.
|
||||
*
|
||||
* @param string $chain String to hash
|
||||
* @param int $type Type of hash (0:auto, 1:sha1, 2:sha1+md5)
|
||||
* @param int $type Type of hash (0:auto, 1:sha1, 2:sha1+md5, 3:md5)
|
||||
* @return string Hash of string
|
||||
*/
|
||||
function dol_hash($chain,$type=0)
|
||||
@@ -86,9 +86,12 @@ function dol_hash($chain,$type=0)
|
||||
|
||||
if ($type == 1) return sha1($chain);
|
||||
else if ($type == 2) return sha1(md5($chain));
|
||||
else if ($type == 3) return md5($chain);
|
||||
else if (! empty($conf->global->MAIN_SECURITY_HASH_ALGO) && $conf->global->MAIN_SECURITY_HASH_ALGO == 'sha1') return sha1($chain);
|
||||
else if (! empty($conf->global->MAIN_SECURITY_HASH_ALGO) && $conf->global->MAIN_SECURITY_HASH_ALGO == 'sha1md5') return sha1(md5($chain));
|
||||
else return md5($chain);
|
||||
|
||||
// No enconding defined
|
||||
return md5($chain);
|
||||
}
|
||||
|
||||
|
||||
@@ -100,7 +103,7 @@ function dol_hash($chain,$type=0)
|
||||
* @param string $features Features to check (it must be module name. Examples: 'societe', 'contact', 'produit&service', 'produit|service', ...)
|
||||
* @param int $objectid Object ID if we want to check a particular record (optional) is linked to a owned thirdparty (optional).
|
||||
* @param string $dbtablename 'TableName&SharedElement' with Tablename is table where object is stored. SharedElement is an optional key to define where to check entity. Not used if objectid is null (optional)
|
||||
* @param string $feature2 Feature to check, second level of permission (optional)
|
||||
* @param string $feature2 Feature to check, second level of permission (optional). Can be or check with 'level1|level2'.
|
||||
* @param string $dbt_keyfield Field name for socid foreign key if not fk_soc. Not used if objectid is null (optional)
|
||||
* @param string $dbt_select Field name for select if not rowid. Not used if objectid is null (optional)
|
||||
* @param Canvas $objcanvas Object canvas
|
||||
@@ -140,7 +143,7 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature
|
||||
|
||||
// Check read permission from module
|
||||
$readok=1; $nbko=0;
|
||||
foreach ($featuresarray as $feature)
|
||||
foreach ($featuresarray as $feature) // first we check nb of test ko
|
||||
{
|
||||
if (! empty($user->societe_id) && ! empty($conf->global->MAIN_MODULES_FOR_EXTERNAL) && ! in_array($feature,$listofmodules)) // If limits on modules for external users, module must be into list of modules for external users
|
||||
{
|
||||
@@ -174,7 +177,7 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature
|
||||
}
|
||||
else if (! empty($feature2)) // This should be used for future changes
|
||||
{
|
||||
$tmpreadok=1;
|
||||
$tmpreadok=1;
|
||||
foreach($feature2 as $subfeature)
|
||||
{
|
||||
if (! empty($subfeature) && empty($user->rights->$feature->$subfeature->lire) && empty($user->rights->$feature->$subfeature->read)) { $tmpreadok=0; }
|
||||
@@ -476,7 +479,6 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog("security.lib:restrictedArea sql=".$sql, LOG_ERR);
|
||||
accessforbidden();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -440,7 +440,7 @@ function encodedecode_dbpassconf($level=0)
|
||||
/**
|
||||
* Return a generated password using default module
|
||||
*
|
||||
* @param boolean $generic true=Create generic password (a MD5 string), false=Use the configured password generation module
|
||||
* @param boolean $generic true=Create generic password (use default crypt function), false=Use the configured password generation module
|
||||
* @return string New value for password
|
||||
*/
|
||||
function getRandomPassword($generic=false)
|
||||
|
||||
@@ -29,7 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
|
||||
* Prepare array with list of tabs
|
||||
*
|
||||
* @param Object $object Object related to tabs
|
||||
* @return array Array of tabs to shoc
|
||||
* @return array Array of tabs to show
|
||||
*/
|
||||
function shipping_prepare_head($object)
|
||||
{
|
||||
@@ -41,7 +41,7 @@ function shipping_prepare_head($object)
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/expedition/fiche.php?id=".$object->id;
|
||||
$head[$h][0] = DOL_URL_ROOT."/expedition/card.php?id=".$object->id;
|
||||
$head[$h][1] = $langs->trans("SendingCard");
|
||||
$head[$h][2] = 'shipping';
|
||||
$h++;
|
||||
@@ -52,7 +52,7 @@ function shipping_prepare_head($object)
|
||||
$object->fetchObjectLinked($object->id,$object->element);
|
||||
if (! empty($object->linkedObjectsIds['delivery'][0])) // If there is a delivery
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT."/livraison/fiche.php?id=".$object->linkedObjectsIds['delivery'][0];
|
||||
$head[$h][0] = DOL_URL_ROOT."/livraison/card.php?id=".$object->linkedObjectsIds['delivery'][0];
|
||||
$head[$h][1] = $langs->trans("DeliveryCard");
|
||||
$head[$h][2] = 'delivery';
|
||||
$h++;
|
||||
@@ -85,7 +85,7 @@ function shipping_prepare_head($object)
|
||||
* Prepare array with list of tabs
|
||||
*
|
||||
* @param Object $object Object related to tabs
|
||||
* @return array Array of tabs to shoc
|
||||
* @return array Array of tabs to show
|
||||
*/
|
||||
function delivery_prepare_head($object)
|
||||
{
|
||||
@@ -99,13 +99,13 @@ function delivery_prepare_head($object)
|
||||
|
||||
if ($conf->expedition_bon->enabled && $user->rights->expedition->lire)
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT."/expedition/fiche.php?id=".$object->origin_id;
|
||||
$head[$h][0] = DOL_URL_ROOT."/expedition/card.php?id=".$object->origin_id;
|
||||
$head[$h][1] = $langs->trans("SendingCard");
|
||||
$head[$h][2] = 'shipping';
|
||||
$h++;
|
||||
}
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/livraison/fiche.php?id=".$object->id;
|
||||
$head[$h][0] = DOL_URL_ROOT."/livraison/card.php?id=".$object->id;
|
||||
$head[$h][1] = $langs->trans("DeliveryCard");
|
||||
$head[$h][2] = 'delivery';
|
||||
$h++;
|
||||
@@ -171,7 +171,7 @@ function show_list_sending_receive($origin,$origin_id,$filter='')
|
||||
|
||||
$sql.= " ORDER BY obj.fk_product";
|
||||
|
||||
dol_syslog("show_list_sending_receive sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog("show_list_sending_receive", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@@ -207,7 +207,7 @@ function show_list_sending_receive($origin,$origin_id,$filter='')
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
// Sending id
|
||||
print '<td align="left" class="nowrap"><a href="'.DOL_URL_ROOT.'/expedition/fiche.php?id='.$objp->expedition_id.'">'.img_object($langs->trans("ShowSending"),'sending').' '.$objp->exp_ref.'<a></td>';
|
||||
print '<td align="left" class="nowrap"><a href="'.DOL_URL_ROOT.'/expedition/card.php?id='.$objp->expedition_id.'">'.img_object($langs->trans("ShowSending"),'sending').' '.$objp->exp_ref.'<a></td>';
|
||||
|
||||
// Description
|
||||
if ($objp->fk_product > 0)
|
||||
@@ -310,7 +310,7 @@ function show_list_sending_receive($origin,$origin_id,$filter='')
|
||||
// Ref
|
||||
print '<td>';
|
||||
print $receiving->getNomUrl($db);
|
||||
//print '<a href="'.DOL_URL_ROOT.'/livraison/fiche.php?id='.$livraison_id.'">'.img_object($langs->trans("ShowReceiving"),'sending').' '.$objp->livraison_ref.'<a>';
|
||||
//print '<a href="'.DOL_URL_ROOT.'/livraison/card.php?id='.$livraison_id.'">'.img_object($langs->trans("ShowReceiving"),'sending').' '.$objp->livraison_ref.'<a>';
|
||||
print '</td>';
|
||||
// Qty received
|
||||
//print '<td align="center">';
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
* Prepare array with list of tabs
|
||||
*
|
||||
* @param Object $object Object related to tabs
|
||||
* @return array Array of tabs to shoc
|
||||
* @return array Array of tabs to show
|
||||
*/
|
||||
function stock_prepare_head($object)
|
||||
{
|
||||
@@ -34,7 +34,7 @@ function stock_prepare_head($object)
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/product/stock/fiche.php?id='.$object->id;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/product/stock/card.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("WarehouseCard");
|
||||
$head[$h][2] = 'card';
|
||||
$h++;
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
* Prepare array with list of tabs
|
||||
*
|
||||
* @param Object $object Object related to tabs
|
||||
* @return array Array of tabs to shoc
|
||||
* @return array Array of tabs to show
|
||||
*/
|
||||
function tax_prepare_head($object)
|
||||
{
|
||||
@@ -124,7 +124,7 @@ function vat_by_thirdparty($db, $y, $date_start, $date_end, $modetax, $direction
|
||||
}
|
||||
if (! empty($conf->global->MAIN_MODULE_COMPTABILITE))
|
||||
{
|
||||
$sql = "SELECT s.rowid as socid, s.nom as nom, s.siren as tva_intra, s.tva_assuj as assuj,";
|
||||
$sql = "SELECT s.rowid as socid, s.nom as name, s.siren as tva_intra, s.tva_assuj as assuj,";
|
||||
$sql.= " sum(fd.total_ht) as amount, sum(fd.".$total_tva.") as tva,";
|
||||
$sql.= " sum(fd.".$total_localtax1.") as localtax1,";
|
||||
$sql.= " sum(fd.".$total_localtax2.") as localtax2";
|
||||
@@ -194,7 +194,7 @@ function vat_by_thirdparty($db, $y, $date_start, $date_end, $modetax, $direction
|
||||
if ($sql == 'TODO') return -2;
|
||||
if ($sql != 'TODO')
|
||||
{
|
||||
dol_syslog("Tax.lib:thirdparty sql=".$sql);
|
||||
dol_syslog("Tax.lib:thirdparty", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@@ -366,7 +366,7 @@ function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction,
|
||||
if ($sql == 'TODO') return -2;
|
||||
if ($sql != 'TODO')
|
||||
{
|
||||
dol_syslog("Tax.lib.php::vat_by_date sql=".$sql);
|
||||
dol_syslog("Tax.lib.php::vat_by_date", LOG_DEBUG);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
@@ -531,7 +531,7 @@ function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction,
|
||||
if ($sql == 'TODO') return -2; // -2 = Feature not yet available
|
||||
if ($sql != 'TODO')
|
||||
{
|
||||
dol_syslog("Tax.lib.php::vat_by_date sql=".$sql);
|
||||
dol_syslog("Tax.lib.php::vat_by_date", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
* Prepare array with list of tabs
|
||||
*
|
||||
* @param Object $object Object related to tabs
|
||||
* @return array Array of tabs to shoc
|
||||
* @return array Array of tabs to show
|
||||
*/
|
||||
function trip_prepare_head($object)
|
||||
{
|
||||
@@ -34,7 +34,7 @@ function trip_prepare_head($object)
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT . '/compta/deplacement/fiche.php?id=' . $object->id;
|
||||
$head[$h][0] = DOL_URL_ROOT . '/compta/deplacement/card.php?id=' . $object->id;
|
||||
$head[$h][1] = $langs->trans("Card");
|
||||
$head[$h][2] = 'card';
|
||||
$h++;
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
* Prepare array with list of tabs
|
||||
*
|
||||
* @param Object $object Object related to tabs
|
||||
* @return array Array of tabs to shoc
|
||||
* @return array Array of tabs to show
|
||||
*/
|
||||
function user_prepare_head($object)
|
||||
{
|
||||
@@ -44,7 +44,7 @@ function user_prepare_head($object)
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/user/fiche.php?id='.$object->id;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/user/card.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("UserCard");
|
||||
$head[$h][2] = 'user';
|
||||
$h++;
|
||||
@@ -71,6 +71,14 @@ function user_prepare_head($object)
|
||||
$head[$h][2] = 'guisetup';
|
||||
$h++;
|
||||
|
||||
if (! empty($conf->agenda->enabled))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/user/agenda_extsites.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("ExtSites");
|
||||
$head[$h][2] = 'extsites';
|
||||
$h++;
|
||||
}
|
||||
|
||||
if (! empty($conf->clicktodial->enabled))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/user/clicktodial.php?id='.$object->id;
|
||||
@@ -88,10 +96,24 @@ function user_prepare_head($object)
|
||||
//Info on users is visible only by internal user
|
||||
if (empty($user->societe_id))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/user/note.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Note");
|
||||
$head[$h][2] = 'note';
|
||||
$h++;
|
||||
// Notes
|
||||
$nbNote = 0;
|
||||
if(!empty($object->note)) $nbNote++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/user/note.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Note");
|
||||
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
|
||||
$head[$h][2] = 'note';
|
||||
$h++;
|
||||
|
||||
// Attached files
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
$upload_dir = $conf->user->dir_output . "/" . $object->id;
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$head[$h][0] = DOL_URL_ROOT.'/user/document.php?userid='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Documents");
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
$head[$h][2] = 'document';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/user/info.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Info");
|
||||
@@ -118,7 +140,7 @@ function group_prepare_head($object)
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/user/group/fiche.php?id='.$object->id;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/user/group/card.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("GroupCard");
|
||||
$head[$h][2] = 'group';
|
||||
$h++;
|
||||
@@ -156,7 +178,7 @@ function group_prepare_head($object)
|
||||
/**
|
||||
* Prepare array with list of tabs
|
||||
*
|
||||
* @return array Array of tabs to shoc
|
||||
* @return array Array of tabs to show
|
||||
*/
|
||||
function user_admin_prepare_head()
|
||||
{
|
||||
@@ -173,6 +195,11 @@ function user_admin_prepare_head()
|
||||
$head[$h][0] = DOL_URL_ROOT.'/user/admin/user_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ExtraFields");
|
||||
$head[$h][2] = 'attributes';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/user/admin/group_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ExtraFields")." ".$langs->trans("Groups");
|
||||
$head[$h][2] = 'attributes_group';
|
||||
$h++;
|
||||
|
||||
// Show more tabs from modules
|
||||
@@ -215,9 +242,9 @@ function entity_prepare_head($object, $aEntities)
|
||||
/**
|
||||
* Show list of themes. Show all thumbs of themes
|
||||
*
|
||||
* @param User $fuser User concerned or '' for global theme
|
||||
* @param int $edit 1 to add edit form
|
||||
* @param boolean $foruserprofile Show for user profile view
|
||||
* @param User|null $fuser User concerned or null for global theme
|
||||
* @param int $edit 1 to add edit form
|
||||
* @param boolean $foruserprofile Show for user profile view
|
||||
* @return void
|
||||
*/
|
||||
function show_theme($fuser,$edit=0,$foruserprofile=false)
|
||||
@@ -238,7 +265,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false)
|
||||
|
||||
$selected_theme='';
|
||||
if (empty($foruserprofile)) $selected_theme=$conf->global->MAIN_THEME;
|
||||
else $selected_theme=empty($fuser->conf->MAIN_THEME)?'':$fuser->conf->MAIN_THEME;
|
||||
else $selected_theme=((is_object($fuser) && ! empty($fuser->conf->MAIN_THEME))?$fuser->conf->MAIN_THEME:'');
|
||||
|
||||
$colspan=2;
|
||||
if ($foruserprofile) $colspan=4;
|
||||
|
||||
Reference in New Issue
Block a user