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

develop

Conflicts:
	ChangeLog
This commit is contained in:
Florian HENRY 2014-04-28 17:20:40 +02:00
commit 7a46bdfc55
195 changed files with 2364 additions and 1107 deletions

189
.scrutinizer.yml Normal file
View File

@ -0,0 +1,189 @@
# .scrutinizer.yml
imports:
- javascript
- php
filter:
excluded_paths:
- 'build/*'
- 'dev/*'
- 'doc/*'
- 'test/*'
- 'htdocs/includes/*'
paths: { }
tools:
# php_analyzer. Doc on https://scrutinizer-ci.com/docs/tools/php/php-analyzer/
php_analyzer:
enabled: true
extensions:
- php
dependency_paths: { }
filter:
excluded_paths:
- 'build/*'
- 'dev/*'
- 'doc/*'
- 'test/*'
- 'htdocs/includes/*'
paths: { }
config:
parameter_reference_check:
enabled: true
checkstyle:
enabled: false
no_trailing_whitespace: true
naming:
enabled: true
local_variable: ^[a-z][a-zA-Z0-9]*$
abstract_class_name: ^Abstract|Factory$
utility_class_name: Utils?$
constant_name: ^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)*$
property_name: ^[a-z][a-zA-Z0-9]*$
method_name: ^(?:[a-z]|__)[a-zA-Z0-9]*$
parameter_name: ^[a-z][a-zA-Z0-9]*$
interface_name: ^[A-Z][a-zA-Z0-9]*Interface$
type_name: ^[A-Z][a-zA-Z0-9]*$
exception_name: ^[A-Z][a-zA-Z0-9]*Exception$
isser_method_name: ^(?:is|has|should|may|supports)
unreachable_code:
enabled: true
check_access_control:
enabled: true
typo_checks:
enabled: true
check_variables:
enabled: true
check_calls:
enabled: true
too_many_arguments: true
missing_argument: true
argument_type_checks: lenient # Allowed Values: "disabled", "lenient", "strict"
suspicious_code:
enabled: true
overriding_parameter: false
overriding_closure_use: true
parameter_closure_use_conflict: true
parameter_multiple_times: true
non_existent_class_in_instanceof_check: true
non_existent_class_in_catch_clause: true
assignment_of_null_return: true
non_commented_switch_fallthrough: true
non_commented_empty_catch_block: true
overriding_private_members: true
use_statement_alias_conflict: true
precedence_in_condition_assignment: true
dead_assignments:
enabled: true
verify_php_doc_comments:
enabled: false
parameters: true
return: true
suggest_more_specific_types: true
ask_for_return_if_not_inferrable: true
ask_for_param_type_annotation: true
loops_must_use_braces:
enabled: true
check_usage_context:
enabled: true
simplify_boolean_return:
enabled: false
phpunit_checks:
enabled: false
reflection_checks:
enabled: true
# Checks Common Precedence Mistakes
precedence_checks:
enabled: true
assignment_in_condition: true
comparison_of_bit_result: true
basic_semantic_checks:
enabled: true
unused_code:
enabled: true
deprecation_checks:
enabled: true
useless_function_calls:
enabled: true
metrics_lack_of_cohesion_methods:
enabled: true
metrics_coupling:
enabled: true
stable_code:
namespace_prefixes: []
classes: []
doctrine_parameter_binding:
enabled: false
doctrine_entity_manager_injection:
enabled: false
symfony_request_injection:
enabled: false
doc_comment_fixes:
enabled: true
reflection_fixes:
enabled: false
use_statement_fixes:
enabled: true
remove_unused: true
# Whether you would like multiple imports in one USE statement to be preserved, e.g. ``use A, B;``.
preserve_multiple: false
# Whether you would like to preserve blank lines between use statements.
preserve_blanklines: false
order_alphabetically: false
# To use specific config for a specific path, use path_configs: (see example on page https://scrutinizer-ci.com/docs/configuration/tool_config_structure)
# php_depend
php_pdepend:
enabled: false
configuration_file: null
suffixes:
- php
excluded_dirs: { }
filter:
excluded_paths:
- 'build/*'
- 'dev/*'
- 'doc/*'
- 'test/*'
- 'htdocs/includes/*'
paths: { }
# change tracking
php_changetracking:
enabled: false
bug_patterns:
- '\bfix(?:es|ed)?\b'
feature_patterns:
- '\badd(?:s|ed)?\b'
- '\bimplement(?:s|ed)?\b'
filter:
excluded_paths:
- 'build/*'
- 'dev/*'
- 'doc/*'
- 'test/*'
- 'htdocs/includes/*'
paths: { }
# Similar code detection
php_sim:
enabled: false
min_mass: 30
filter:
excluded_paths:
- 'build/*'
- 'dev/*'
- 'doc/*'
- 'test/*'
- 'htdocs/includes/*'
paths: { }
# Coding-Style / Bug Detection
js_hint: false
before_commands: { }
after_commands: { }
artifacts: { }
build_failure_conditions: { }

View File

@ -43,9 +43,15 @@ For users:
- New: Can define custom fields for categories.
- New: Prepare generation of SEPA files into module withdrawal.
- New: Can filter on status for supplier order.
- New: Add option FACTURE_SENDBYEMAIL_FOR_ALL_STATUS to allow to send invoice by email
whatever is its status.
- New: Add filter date in bank writing list page.
- New: Extrafields can be used as substitution key %EXTRA_XXX% into emails texts for members.
- Fix: Project Task numbering customs rule works.
- Fix: Add actions events not implemented.
- New: Add filter date in bank writing list page
- Fix: Price min of composition is not supplier price min by quantity
- Fix: [ bug #1356 ] Bank accountancy number is limited to 8 numbers
- New: Add categories translation
- New: Enable option "clone target emailing"
TODO

View File

@ -369,6 +369,7 @@ if ($nboftargetok) {
$ret=`rm -fr $BUILDROOT/$PROJECT/.git*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/.project`;
$ret=`rm -fr $BUILDROOT/$PROJECT/.settings`;
$ret=`rm -fr $BUILDROOT/$PROJECT/.scrutinizer.yml`;
$ret=`rm -fr $BUILDROOT/$PROJECT/.travis.yml`;
$ret=`rm -fr $BUILDROOT/$PROJECT/.tx`;
$ret=`rm -f $BUILDROOT/$PROJECT/build.xml`;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 194 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 174 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 210 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 156 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 163 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 131 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 161 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 KiB

View File

@ -368,7 +368,7 @@ abstract class ActionsAdherentCardCommon
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
$login=dol_buildlogin($this->object->lastname, $this->object->firstname);
$generated_password=getRandomPassword('');
$generated_password=getRandomPassword(false);
$password=$generated_password;
// Create a form array

View File

@ -169,7 +169,7 @@ class Adherent extends CommonObject
/**
* Make substitution
* Make substitution of tags into text with value of current object.
*
* @param string $text Text to make substitution to
* @return string Value of input text string with substitutions done
@ -230,6 +230,12 @@ class Adherent extends CommonObject
'%VILLE%'=>$msgishtml?dol_htmlentitiesbr($this->town):$this->town,
'%PAYS%'=>$msgishtml?dol_htmlentitiesbr($this->country):$this->country,
);
// Add extrafields as substitution key %EXTRA_XXX%
foreach($this->array_options as $key => $val)
{
$keyshort=preg_replace('/^(options|extra)_/','',$key);
$substitutionarray['%EXTRA_'.$keyshort.'%']=$val;
}
complete_substitutions_array($substitutionarray, $langs);
@ -819,7 +825,7 @@ class Adherent extends CommonObject
if (! $password)
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
$password=getRandomPassword('');
$password=getRandomPassword(false);
}
// Cryptage mot de passe

View File

@ -34,6 +34,8 @@ class Cotisation extends CommonObject
public $table_element='cotisation';
var $id;
var $ref;
var $datec;
var $datem;
var $dateh; // Subscription start date

View File

@ -812,7 +812,7 @@ else
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
$generated_password=getRandomPassword('');
$generated_password=getRandomPassword(false);
print '<tr><td><span class="fieldrequired">'.$langs->trans("Password").'</span></td><td>';
print '<input size="30" maxsize="32" type="text" name="password" value="'.$generated_password.'">';
print '</td></tr>';

View File

@ -38,7 +38,7 @@ $action=GETPOST('action','alpha');
$update=GETPOST('update','alpha');
$delete=GETPOST('delete'); // Do not use alpha here
$debug=GETPOST('debug','int');
$consts=GETPOST('const');
$consts=GETPOST('const','array');
$constname=GETPOST('constname','alpha');
$constvalue=GETPOST('constvalue');
$constnote=GETPOST('constnote','alpha');

View File

@ -270,7 +270,7 @@ print '<div class="tagtable">';
print ' <div class="tagtr">';
print ' <div class="tagtd" style="overflow: hidden; white-space: nowrap; max-width: 300px;">';
print $langs->trans("DescADHERENT_ETIQUETTE_TYPE").' &nbsp; ';
print '</div><div class="tagtd" style="overflow: hidden; white-space: nowrap; max-width: 300px;">';
print '</div><div class="tagtd maxwidthonsmartphone" style="overflow: hidden; white-space: nowrap;">';
// List of possible labels (defined into $_Avery_Labels variable set into format_cards.lib.php)
$arrayoflabels=array();
foreach(array_keys($_Avery_Labels) as $codecards)
@ -284,7 +284,7 @@ print '</div></div>';
print ' <div class="tagtr">';
print ' <div class="tagtd" style="overflow: hidden; white-space: nowrap; max-width: 300px;">';
print $langs->trans("NumberOfStickers").' &nbsp; ';
print '</div><div class="tagtd" style="overflow: hidden; white-space: nowrap; max-width: 300px;">';
print '</div><div class="tagtd maxwidthonsmartphone" style="overflow: hidden; white-space: nowrap;">';
print '<input size="4" type="text" name="numberofsticker" value="'.(GETPOST('numberofsticker')?GETPOST('numberofsticker','int'):10).'">';
print '</div></div>';

View File

@ -103,11 +103,14 @@ class Categorie extends CommonObject
$this->visible = $res['visible'];
$this->type = $res['type'];
$this->entity = $res['entity'];
$this->fetch_optionals($this->id,$extralabels);
$this->db->free($resql);
// multilangs
if (! empty($conf->global->MAIN_MULTILANGS)) $this->getMultiLangs();
return 1;
}
else
@ -191,7 +194,7 @@ class Categorie extends CommonObject
if ($id > 0)
{
$this->id = $id;
// Actions on extra fields (by external module or standard code)
// FIXME le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('HookModuleNamedao'));
@ -278,7 +281,7 @@ class Categorie extends CommonObject
dol_syslog(get_class($this)."::update sql=".$sql);
if ($this->db->query($sql))
{
// Actions on extra fields (by external module or standard code)
// FIXME le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('HookCategorydao'));
@ -296,10 +299,10 @@ class Categorie extends CommonObject
}
}
else if ($reshook < 0) $error++;
$this->db->commit();
// Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db);
@ -337,7 +340,7 @@ class Categorie extends CommonObject
if (! $error)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."categorie";
$sql.= " SET fk_parent = ".$this->fk_parent;
$sql.= " SET fk_parent = ".$this->fk_parent;
$sql.= " WHERE fk_parent = ".$this->id;
if (!$this->db->query($sql))
@ -767,14 +770,21 @@ class Categorie extends CommonObject
*/
function get_full_arbo($type,$markafterid=0)
{
global $langs;
$this->cats = array();
// Init this->motherof that is array(id_son=>id_parent, ...)
$this->load_motherof();
$current_lang = $langs->getDefaultLang();
// Init $this->cats array
$sql = "SELECT DISTINCT c.rowid, c.label, c.description, c.fk_parent"; // Distinct reduce pb with old tables with duplicates
if (! empty($conf->global->MAIN_MULTILANGS))
$sql.= ", t.label as label_trans, t.description as description_trans";
$sql.= " FROM ".MAIN_DB_PREFIX."categorie as c";
if (! empty($conf->global->MAIN_MULTILANGS))
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_lang as t ON t.fk_category=c.rowid AND t.lang='".$current_lang."'";
$sql.= " WHERE c.entity IN (".getEntity('category',1).")";
$sql.= " AND c.type = ".$type;
@ -788,8 +798,8 @@ class Categorie extends CommonObject
$this->cats[$obj->rowid]['rowid'] = $obj->rowid;
$this->cats[$obj->rowid]['id'] = $obj->rowid;
$this->cats[$obj->rowid]['fk_parent'] = $obj->fk_parent;
$this->cats[$obj->rowid]['label'] = $obj->label;
$this->cats[$obj->rowid]['description'] = $obj->description;
$this->cats[$obj->rowid]['label'] = ! empty($obj->label_trans) ? $obj->label_trans : $obj->label;
$this->cats[$obj->rowid]['description'] = ! empty($obj->description_trans) ? $obj->description_trans : $obj->description;
$i++;
}
}
@ -1045,63 +1055,6 @@ class Categorie extends CommonObject
}
/**
* Affiche le chemin le plus court pour se rendre a un produit
*
* @param int $id Id of category
* @param string $type Type of category
* @return void
* @deprecated function not used ?
*/
function get_primary_way($id, $type="")
{
$primary_way = array("taille" => -1, "chemin" => array());
$meres = $this->containing($id,$type);
foreach ($meres as $mere)
{
foreach ($mere->get_all_ways() as $way)
{
if(count($way) < $primary_way["taille"] || $primary_way["taille"] < 0)
{
$primary_way["taille"] = count($way);
$primary_way["chemin"] = $way;
}
}
}
return $primary_way["chemin"];
}
/**
* Affiche le chemin le plus court pour se rendre a un produit
*
* @param int $id Id of category
* @param string $sep Separator
* @param string $url Url
* @param string $type Type
* @return void
* @deprecated function not used ?
*/
function print_primary_way($id, $sep= " &gt;&gt; ", $url="", $type="")
{
$primary_way = array();
$way = $this->get_primary_way($id,$type);
$w = array();
foreach ($way as $cat)
{
if ($url == '')
{
$w[] = "<a href='".DOL_URL_ROOT."/categories/viewcat.php?id=".$cat->id."'>".$cat->label."</a>";
}
else
{
$w[] = "<a href='".DOL_URL_ROOT."/".$url."?catid=".$cat->id."'>".$cat->label."</a>";
}
}
return implode($sep, $w);
}
/**
* Retourne un tableau contenant la liste des categories meres
*
@ -1458,6 +1411,118 @@ class Categorie extends CommonObject
$this->imgHeight = $infoImg[1]; // Hauteur de l'image
}
/**
* Update ou cree les traductions des infos produits
*
* @return int <0 if KO, >0 if OK
*/
function setMultiLangs()
{
global $langs;
$langs_available = $langs->get_available_languages();
$current_lang = $langs->getDefaultLang();
foreach ($langs_available as $key => $value)
{
$sql = "SELECT rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."categorie_lang";
$sql.= " WHERE fk_category=".$this->id;
$sql.= " AND lang='".$key."'";
$result = $this->db->query($sql);
if ($key == $current_lang)
{
if ($this->db->num_rows($result)) // si aucune ligne dans la base
{
$sql2 = "UPDATE ".MAIN_DB_PREFIX."categorie_lang";
$sql2.= " SET label='".$this->db->escape($this->label)."',";
$sql2.= " description='".$this->db->escape($this->description)."'";
$sql2.= " WHERE fk_category=".$this->id." AND lang='".$key."'";
}
else
{
$sql2 = "INSERT INTO ".MAIN_DB_PREFIX."categorie_lang (fk_category, lang, label, description)";
$sql2.= " VALUES(".$this->id.",'".$key."','". $this->db->escape($this->label);
$sql2.= "','".$this->db->escape($this->multilangs["$key"]["description"])."')";
}
dol_syslog(get_class($this).'::setMultiLangs sql='.$sql2);
if (! $this->db->query($sql2))
{
$this->error=$this->db->lasterror();
dol_syslog(get_class($this).'::setMultiLangs error='.$this->error, LOG_ERR);
return -1;
}
}
else if (isset($this->multilangs["$key"]))
{
if ($this->db->num_rows($result)) // si aucune ligne dans la base
{
$sql2 = "UPDATE ".MAIN_DB_PREFIX."categorie_lang";
$sql2.= " SET label='".$this->db->escape($this->multilangs["$key"]["label"])."',";
$sql2.= " description='".$this->db->escape($this->multilangs["$key"]["description"])."'";
$sql2.= " WHERE fk_category=".$this->id." AND lang='".$key."'";
}
else
{
$sql2 = "INSERT INTO ".MAIN_DB_PREFIX."categorie_lang (fk_category, lang, label, description)";
$sql2.= " VALUES(".$this->id.",'".$key."','". $this->db->escape($this->multilangs["$key"]["label"]);
$sql2.= "','".$this->db->escape($this->multilangs["$key"]["description"])."')";
}
// on ne sauvegarde pas des champs vides
if ( $this->multilangs["$key"]["label"] || $this->multilangs["$key"]["description"] || $this->multilangs["$key"]["note"] )
dol_syslog(get_class($this).'::setMultiLangs sql='.$sql2);
if (! $this->db->query($sql2))
{
$this->error=$this->db->lasterror();
dol_syslog(get_class($this).'::setMultiLangs error='.$this->error, LOG_ERR);
return -1;
}
}
}
return 1;
}
/**
* Load array this->multilangs
*
* @return int <0 if KO, >0 if OK
*/
function getMultiLangs()
{
global $langs;
$current_lang = $langs->getDefaultLang();
$sql = "SELECT lang, label, description";
$sql.= " FROM ".MAIN_DB_PREFIX."categorie_lang";
$sql.= " WHERE fk_category=".$this->id;
$result = $this->db->query($sql);
if ($result)
{
while ( $obj = $this->db->fetch_object($result) )
{
//print 'lang='.$obj->lang.' current='.$current_lang.'<br>';
if( $obj->lang == $current_lang ) // si on a les traduct. dans la langue courante on les charge en infos principales.
{
$this->label = $obj->label;
$this->description = $obj->description;
}
$this->multilangs["$obj->lang"]["label"] = $obj->label;
$this->multilangs["$obj->lang"]["description"] = $obj->description;
}
return 1;
}
else
{
$this->error=$langs->trans("Error")." : ".$this->db->error()." - ".$sql;
return -1;
}
}
/**
* Initialise an instance with random values.

View File

@ -31,9 +31,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$langs->load("categories");
$extrafields = new ExtraFields($db);
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
// Security check
$socid=GETPOST('socid','int');
if (!$user->rights->categorie->lire) accessforbidden();
@ -64,6 +61,9 @@ if ($catorigin && $type == 0) $idCatOrigin = $catorigin;
$object = new Categorie($db);
$extrafields = new ExtraFields($db);
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
/*
* Actions
*/
@ -244,7 +244,7 @@ if ($user->rights->categorie->creer)
print '<tr><td>'.$langs->trans("AddIn").'</td><td>';
print $form->select_all_categories($type, $catorigin);
print '</td></tr>';
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook))
{

View File

@ -0,0 +1,284 @@
<?php
/* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2010-2012 Destailleur Laurent <eldy@users.sourceforge.net>
*
* 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/product/traduction.php
* \ingroup product
* \brief Page de traduction des produits
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/categories.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
$langs->load("categories");
$langs->load("languages");
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
$action=GETPOST('action','alpha');
$cancel=GETPOST('cancel','alpha');
$type=GETPOST('type');
// Security check
$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : ''));
$fieldtype = (! empty($ref) ? 'ref' : 'rowid');
if ($id == "")
{
dol_print_error('','Missing parameter id');
exit();
}
// Security check
$result = restrictedArea($user, 'categorie', $id, '&category');
$object = new Categorie($db);
/*
* Actions
*/
// retour a l'affichage des traduction si annulation
if ($cancel == $langs->trans("Cancel"))
{
$action = '';
}
// Validation de l'ajout
if ($action == 'vadd' &&
$cancel != $langs->trans("Cancel") &&
($user->rights->categorie->creer ))
{
$object->fetch($id);
$current_lang = $langs->getDefaultLang();
// update de l'objet
if ( $_POST["forcelangprod"] == $current_lang )
{
$object->label = $_POST["libelle"];
$object->description = dol_htmlcleanlastbr($_POST["desc"]);
}
else
{
$object->multilangs[$_POST["forcelangprod"]]["label"] = $_POST["libelle"];
$object->multilangs[$_POST["forcelangprod"]]["description"] = dol_htmlcleanlastbr($_POST["desc"]);
}
// sauvegarde en base
if ( $object->setMultiLangs() > 0 )
{
$action = '';
}
else
{
$action = 'add';
$mesg = '<div class="error">'.$object->error.'</div>';
}
}
// Validation de l'edition
if ($action == 'vedit' &&
$cancel != $langs->trans("Cancel") &&
($user->rights->categorie->creer))
{
$object->fetch($id);
$current_lang = $langs->getDefaultLang();
foreach ( $object->multilangs as $key => $value ) // enregistrement des nouvelles valeurs dans l'objet
{
if ( $key == $current_lang )
{
$object->label = $_POST["libelle-".$key];
$object->description = dol_htmlcleanlastbr($_POST["desc-".$key]);
}
else
{
$object->multilangs[$key]["label"] = $_POST["libelle-".$key];
$object->multilangs[$key]["description"] = dol_htmlcleanlastbr($_POST["desc-".$key]);
}
}
if ( $object->setMultiLangs() > 0 )
{
$action = '';
}
else
{
$action = 'edit';
$mesg = '<div class="error">'.$object->error.'</div>';
}
}
$result = $object->fetch($id,$ref);
/*
* View
*/
llxHeader("","",$langs->trans("Translation"));
$form = new Form($db);
$formadmin=new FormAdmin($db);
if ($type == 0) $title=$langs->trans("ProductsCategoryShort");
elseif ($type == 1) $title=$langs->trans("SuppliersCategoryShort");
elseif ($type == 2) $title=$langs->trans("CustomersCategoryShort");
elseif ($type == 3) $title=$langs->trans("MembersCategoryShort");
elseif ($type == 4) $title=$langs->trans("ContactCategoriesShort");
else $title=$langs->trans("Category");
$head = categories_prepare_head($object,$type);
dol_fiche_head($head, 'translation', $title, 0, 'category');
if (! empty($mesg)) {
dol_htmloutput_mesg($mesg);
}
print '<table class="border" width="100%">';
// Reference
print '<tr>';
print '<td width="15%">'.$langs->trans("Ref").'</td><td colspan="2">';
print $object->label;
print '</td>';
print '</tr>';
print '</table>';
if ($action == 'edit')
{
//WYSIWYG Editor
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="vedit">';
print '<input type="hidden" name="id" value="'.$object->id.'">';
if (! empty($object->multilangs))
{
foreach ($object->multilangs as $key => $value)
{
print "<br><b><u>".$langs->trans('Language_'.$key)." :</u></b><br>";
print '<table class="border" width="100%">';
print '<tr><td valign="top" width="15%" class="fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle-'.$key.'" size="40" value="'.$object->multilangs[$key]["label"].'"></td></tr>';
print '<tr><td valign="top" width="15%">'.$langs->trans('Description').'</td><td>';
$doleditor = new DolEditor("desc-$key", $object->multilangs[$key]["description"], '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 3, 80);
$doleditor->Create();
print '</td></tr>';
print '</tr>';
print '</table>';
}
}
print '<br /><center>';
print '<input type="submit" class="button" value="'.$langs->trans("Save").'"> &nbsp; &nbsp; ';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></center>';
print '</form>';
}
else
{
$cnt_trans = 0;
if (! empty($object->multilangs))
{
foreach ($object->multilangs as $key => $value)
{
$cnt_trans++;
$s=picto_from_langcode($key);
print "<br>".($s?$s.' ':'')." <b>".$langs->trans('Language_'.$key).":</b><br>";
print '<table class="border" width="100%">';
print '<tr><td width="15%">'.$langs->trans('Label').'</td><td>'.$object->multilangs[$key]["label"].'</td></tr>';
print '<tr><td width="15%">'.$langs->trans('Description').'</td><td>'.$object->multilangs[$key]["description"].'</td></tr>';
print '<tr><td width="15%">'.$langs->trans('Note').'</td><td>'.$object->multilangs[$key]["note"].'</td></tr>';
print '</table>';
}
}
if (! $cnt_trans) print '<br>'. $langs->trans('NoTranslation');
}
print "</div>\n";
/* ************************************************************************** */
/* */
/* Barre d'action */
/* */
/* ************************************************************************** */
print "\n<div class=\"tabsAction\">\n";
if ($action == '')
if ($user->rights->produit->creer || $user->rights->service->creer)
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=add&id='.$object->id.'">'.$langs->trans("Add").'</a>';
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&id='.$object->id.'">'.$langs->trans("Update").'</a>';
}
print "\n</div>\n";
/*
* Form to add a new translation
*/
if ($action == 'add' && ($user->rights->produit->creer || $user->rights->service->creer))
{
//WYSIWYG Editor
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
print '<br>';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="vadd">';
print '<input type="hidden" name="id" value="'.$_GET["id"].'">';
print '<table class="border" width="100%">';
print '<tr><td valign="top" width="15%" class="fieldrequired">'.$langs->trans('Translation').'</td><td>';
print $formadmin->select_language('','forcelangprod',0,$object->multilangs);
print '</td></tr>';
print '<tr><td valign="top" width="15%" class="fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle" size="40"></td></tr>';
print '<tr><td valign="top" width="15%">'.$langs->trans('Description').'</td><td>';
$doleditor = new DolEditor('desc', '', '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 3, 80);
$doleditor->Create();
print '</td></tr>';
print '</tr>';
print '</table>';
print '<br><center>';
print '<input type="submit" class="button" value="'.$langs->trans("Save").'"> &nbsp; &nbsp; ';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></center>';
print '</form>';
print '<br>';
}
llxFooter();
$db->close();
?>

View File

@ -1803,10 +1803,13 @@ if ($action == 'create') {
if ($action != 'editline') {
$var = true;
if ($conf->global->MAIN_FEATURES_LEVEL > 1) {
if ($conf->global->MAIN_FEATURES_LEVEL > 1)
{
// Add free or predefined products/services
$object->formAddObjectLine(1, $mysoc, $soc);
} else {
}
else
{
// Add free products/services
$object->formAddFreeProduct(1, $mysoc, $soc);

View File

@ -200,7 +200,7 @@ class Propal extends CommonObject
$line->remise_percent=$remise_percent;
$line->tva_tx=$tva_tx;
$this->products[]=$line;
$this->lines[]=$line;
}
}
@ -1302,9 +1302,6 @@ class Propal extends CommonObject
$soc = new Societe($this->db);
$soc->fetch($this->socid);
// Class of company linked to propal
$result=$soc->set_as_client();
// Define new ref
if (! $error && (preg_match('/^[\(]?PROV/i', $this->ref)))
{

View File

@ -2102,10 +2102,13 @@ if ($action == 'create' && $user->rights->commande->creer) {
if ($action != 'editline') {
$var = true;
if ($conf->global->MAIN_FEATURES_LEVEL > 1) {
if ($conf->global->MAIN_FEATURES_LEVEL > 1)
{
// Add free or predefined products/services
$object->formAddObjectLine(1, $mysoc, $soc);
} else {
}
else
{
// Add free products/services
$object->formAddFreeProduct(1, $mysoc, $soc);

View File

@ -3307,10 +3307,13 @@ if ($action == 'create')
if ($object->statut == 0 && $user->rights->facture->creer && $action != 'valid' && $action != 'editline') {
$var = true;
if ($conf->global->MAIN_FEATURES_LEVEL > 1) {
if ($conf->global->MAIN_FEATURES_LEVEL > 1)
{
// Add free or predefined products/services
$object->formAddObjectLine(1, $mysoc, $soc);
} else {
}
else
{
// Add free products/services
$object->formAddFreeProduct(1, $mysoc, $soc);
@ -3332,9 +3335,11 @@ if ($action == 'create')
dol_fiche_end();
// Boutons actions
if ($action != 'prerelance' && $action != 'presend' && $action != 'valid' && $action != 'editline') {
// Actions buttons
if ($action != 'prerelance' && $action != 'presend' && $action != 'valid' && $action != 'editline')
{
print '<div class="tabsAction">';
$parameters = array();
@ -3382,7 +3387,7 @@ if ($action == 'create')
}
// Send by mail
if (($object->statut == 1 || $object->statut == 2)) {
if (($object->statut == 1 || $object->statut == 2) || ! empty($conf->global->FACTURE_SENDBYEMAIL_FOR_ALL_STATUS)) {
if ($objectidnext) {
print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("DisabledBecauseReplacedInvoice") . '">' . $langs->trans('SendByMail') . '</span></div>';
} else {

View File

@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
$langs->load('users');
$langs->load('holidays');
$langs->load('tripss');
$langs->load('trips');
// Protection if external user
if ($user->societe_id > 0) accessforbidden();
@ -61,7 +61,7 @@ $holidaystatic=new Holiday($db);
llxHeader(array(),$langs->trans('HRMArea'));
print_fiche_titre($langs->trans("HRMArea"));
print '<div class="fichecenter"><div class="fichethirdleft">';
@ -106,11 +106,11 @@ if (! empty($conf->deplacement->enabled) && $user->rights->deplacement->lire)
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
$max=10;
$langs->load("boxes");
// Last trips
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, d.rowid, d.dated as date, d.tms as dm, d.km, d.fk_statut";
$sql.= " FROM ".MAIN_DB_PREFIX."deplacement as d, ".MAIN_DB_PREFIX."user as u";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc";

View File

@ -179,8 +179,8 @@ $dolibarr_main_authentication='dolibarr';
// Parameters used to setup LDAP authentication.
// Uncomment them if dolibarr_main_authentication = 'ldap'
//
// $dolibarr_main_auth_ldap_host='127.0.0.1';
// $dolibarr_main_auth_ldap_port='389';
// $dolibarr_main_auth_ldap_host='127.0.0.1'; // You can define several servers here separated with a comma.
// $dolibarr_main_auth_ldap_port='389'; // Port
// $dolibarr_main_auth_ldap_version='3';
// $dolibarr_main_auth_ldap_servertype='openldap'; // openldap, activedirectory or egroupware
// $dolibarr_main_auth_ldap_login_attribute='loginfield'; // Ex: uid or samaccountname for active directory

View File

@ -400,7 +400,7 @@ abstract class ActionsContactCardCommon
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
$login=dol_buildlogin($this->object->lastname, $this->object->firstname);
$generated_password=getRandomPassword('');
$generated_password=getRandomPassword(false);
$password=$generated_password;
// Create a form array

View File

@ -749,7 +749,7 @@ else
$doleditor = new DolEditor('note_public', $object->note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
print $doleditor->Create(1);
print '</td></tr>';
// Note Private
print '<tr><td valign="top">'.$langs->trans("NotePrivate").'</td><td colspan="3">';
$doleditor = new DolEditor('note_private', $object->note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
@ -843,7 +843,7 @@ else
if (! $ldap_sid) // TODO ldap_sid ?
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
$generated_password=getRandomPassword('');
$generated_password=getRandomPassword(false);
}
$password=$generated_password;
@ -971,7 +971,7 @@ else
print '<tr><td valign="top">'.$langs->trans("NotePublic").'</td><td colspan="3">';
print nl2br($object->note_public);
print '</td></tr>';
// Note Private
print '<tr><td valign="top">'.$langs->trans("NotePrivate").'</td><td colspan="3">';
print nl2br($object->note_private);
@ -1067,9 +1067,9 @@ else
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=disable&amp;id='.$object->id.'">'.$langs->trans("DisableUser").'</a>';
}
}
print "</div><br>";
print load_fiche_titre($langs->trans("TasksHistoryForThisContact"),'','');
print show_actions_todo($conf,$langs,$db,$objsoc,$object);

View File

@ -1140,8 +1140,7 @@ else
print '<td width="50" align="right">'.$langs->trans("PriceUHT").'</td>';
print '<td width="30" align="center">'.$langs->trans("Qty").'</td>';
print '<td width="50" align="right">'.$langs->trans("ReductionShort").'</td>';
if ($conf->margin->enabled)
print '<td width="50" align="right">'.$langs->trans("BuyingPrice").'</td>';
if (! empty($conf->margin->enabled) && ! empty($conf->global->MARGIN_SHOW_ON_CONTRACT)) print '<td width="50" align="right">'.$langs->trans("BuyingPrice").'</td>';
print '<td width="30">&nbsp;</td>';
print "</tr>\n";
@ -1186,8 +1185,8 @@ else
print '<td>&nbsp;</td>';
}
if ($conf->margin->enabled)
print '<td align="right" class="nowrap">'.price($objp->pa_ht).'</td>';
// Margin
if (! empty($conf->margin->enabled) && ! empty($conf->global->MARGIN_SHOW_ON_CONTRACT)) print '<td align="right" class="nowrap">'.price($objp->pa_ht).'</td>';
// Icon move, update et delete (statut contrat 0=brouillon,1=valide,2=ferme)
print '<td align="right" class="nowrap">';
@ -1292,9 +1291,13 @@ else
print '<td align="center" rowspan="2" valign="middle"><input type="submit" class="button" name="save" value="'.$langs->trans("Modify").'">';
print '<br><input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</td>';
$colspan=5;
if (! empty($conf->margin->enabled) && ! empty($conf->global->MARGIN_SHOW_ON_CONTRACT)) $colspan++;
// Ligne dates prevues
print "<tr ".$bc[$var].">";
print '<td colspan="'.($conf->margin->enabled?6:5).'">';
print '<td colspan="'.$colspan.'">';
print $langs->trans("DateStartPlanned").' ';
$form->select_date($db->jdate($objp->date_debut),"date_start_update",$usehm,$usehm,($db->jdate($objp->date_debut)>0?0:1),"update");
print '<br>'.$langs->trans("DateEndPlanned").' ';
@ -1644,9 +1647,9 @@ else
}
print "</div>";
print '<br>';
}
print '<table width="100%"><tr><td width="50%" valign="top">';
/*

View File

@ -60,7 +60,7 @@ if ((isset($_POST['roworder']) && ! empty($_POST['roworder'])) && (isset($_POST[
$row->table_element_line = $table_element_line;
$row->fk_element = $fk_element;
$row->id = $element_id;
$result=$row->line_ajaxorder($newrowordertab);
$row->line_ajaxorder($newrowordertab);
// Reorder line to have position of chilren lines sharing same counter than parent lines
// This should be useless because there is no need to have children sharing same counter that parent.

View File

@ -64,7 +64,7 @@ class box_factures_fourn extends ModeleBoxes
if ($user->rights->fournisseur->facture->lire)
{
$sql = "SELECT s.nom, s.rowid as socid,";
$sql.= " f.rowid as facid, f.ref_supplier, f.amount,";
$sql.= " f.rowid as facid, f.ref, f.ref_supplier, f.amount,";
$sql.= " f.paye, f.fk_statut,";
$sql.= ' f.datef as df,';
$sql.= ' f.datec as datec,';
@ -102,25 +102,29 @@ class box_factures_fourn extends ModeleBoxes
'url' => DOL_URL_ROOT."/fourn/facture/fiche.php?facid=".$objp->facid);
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
'text' => $objp->ref_supplier,
'text' => ($objp->ref?$objp->ref:$objp->facid),
'text2'=> $late,
'url' => DOL_URL_ROOT."/fourn/facture/fiche.php?facid=".$objp->facid);
$this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"',
$this->info_box_contents[$i][2] = array('td' => 'align="left"',
'text' => $objp->ref_supplier,
'url' => DOL_URL_ROOT."/fourn/facture/fiche.php?facid=".$objp->facid);
$this->info_box_contents[$i][3] = array('td' => 'align="left" width="16"',
'logo' => 'company',
'url' => DOL_URL_ROOT."/fourn/fiche.php?socid=".$objp->socid);
$this->info_box_contents[$i][3] = array('td' => 'align="left"',
$this->info_box_contents[$i][4] = array('td' => 'align="left"',
'text' => $objp->nom,
'url' => DOL_URL_ROOT."/fourn/fiche.php?socid=".$objp->socid);
$this->info_box_contents[$i][4] = array('td' => 'align="right"',
$this->info_box_contents[$i][5] = array('td' => 'align="right"',
'text' => dol_print_date($datec,'day'));
$fac = new FactureFournisseur($db);
$fac->fetch($objp->facid);
$alreadypaid=$fac->getSommePaiement();
$this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"',
$this->info_box_contents[$i][6] = array('td' => 'align="right" width="18"',
'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3,$alreadypaid,$objp->type));
$i++;

View File

@ -61,7 +61,7 @@ class box_factures_fourn_imp extends ModeleBoxes
if ($user->rights->fournisseur->facture->lire)
{
$sql = "SELECT s.nom, s.rowid as socid,";
$sql.= " f.rowid as facid, f.ref_supplier, f.date_lim_reglement as datelimite,";
$sql.= " f.rowid as facid, f.ref, f.ref_supplier, f.date_lim_reglement as datelimite,";
$sql.= " f.amount, f.datef as df,";
$sql.= " f.paye, f.fk_statut, f.type";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
@ -98,25 +98,29 @@ class box_factures_fourn_imp extends ModeleBoxes
'url' => DOL_URL_ROOT."/fourn/facture/fiche.php?facid=".$objp->facid);
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
'text' => $objp->ref_supplier,
'text' => ($objp->ref?$objp->ref:$objp->facid),
'text2'=> $late,
'url' => DOL_URL_ROOT."/fourn/facture/fiche.php?facid=".$objp->facid);
$this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"',
$this->info_box_contents[$i][2] = array('td' => 'align="left"',
'text' => $objp->ref_supplier,
'url' => DOL_URL_ROOT."/fourn/facture/fiche.php?facid=".$objp->facid);
$this->info_box_contents[$i][3] = array('td' => 'align="left" width="16"',
'logo' => 'company',
'url' => DOL_URL_ROOT."/fourn/fiche.php?socid=".$objp->socid);
$this->info_box_contents[$i][3] = array('td' => 'align="left"',
$this->info_box_contents[$i][4] = array('td' => 'align="left"',
'text' => $objp->nom,
'url' => DOL_URL_ROOT."/fourn/fiche.php?socid=".$objp->socid);
$this->info_box_contents[$i][4] = array('td' => 'align="right"',
$this->info_box_contents[$i][5] = array('td' => 'align="right"',
'text' => dol_print_date($datelimite,'day'));
$fac = new FactureFournisseur($db);
$fac->fetch($objp->facid);
$alreadypaid=$fac->getSommePaiement();
$this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"',
$this->info_box_contents[$i][6] = array('td' => 'align="right" width="18"',
'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3,$alreadypaid,$objp->type));
$i++;

View File

@ -92,11 +92,11 @@ class CMailFile
* @param array $mimetype_list List of MIME type of attached files
* @param array $mimefilename_list List of attached file name in message
* @param string $addr_cc Email cc
* @param string $addr_bcc Email bcc
* @param int $deliveryreceipt Ask a delivery receipt
* @param int $msgishtml 1=String IS already html, 0=String IS NOT html, -1=Unknown need autodetection
* @param string $errors_to Email errors
* @param string $css Css option
* @param string $addr_bcc Email bcc (Note: This is autocompleted with MAIN_MAIL_AUTOCOPY_TO if defined)
* @param int $deliveryreceipt Ask a delivery receipt
* @param int $msgishtml 1=String IS already html, 0=String IS NOT html, -1=Unknown make autodetection (with fast mode, not reliable)
* @param string $errors_to Email errors
* @param string $css Css option
*/
function __construct($subject,$to,$from,$msg,
$filename_list=array(),$mimetype_list=array(),$mimefilename_list=array(),

View File

@ -62,7 +62,7 @@ abstract class CommonDocGenerator
'myuser_fax'=>$user->office_fax,
'myuser_mobile'=>$user->user_mobile,
'myuser_email'=>$user->email,
'myuser_logo'=>$logotouse,
'myuser_logo'=>$user->photo,
'myuser_web'=>'' // url not exist in $user object
);
}
@ -139,7 +139,7 @@ abstract class CommonDocGenerator
{
$object->country=$outputlangs->transnoentitiesnoconv("Country".$object->country_code);
}
if (empty($mysoc->state) && ! empty($mysoc->state_code))
if (empty($object->state) && ! empty($object->state_code))
{
$object->state=getState($object->state_code,0);
}
@ -418,7 +418,7 @@ abstract class CommonDocGenerator
* @param Object $object Object with extrafields (must have $object->array_options filled)
* @param array $array_to_fill Substitution array
* @param Extrafields $extrafields Extrafields object
* @param array_key $array_key Name of the key for return array
* @param string $array_key Name of the key for return array
* @param Translate $outputlangs Lang object to use for output
* @return array Substitution array
*/

View File

@ -253,6 +253,7 @@ abstract class CommonInvoice extends CommonObject
}
if ($mode == 4)
{
$prefix='';
if (! $paye)
{
if ($status == 0) return img_picto($langs->trans('BillStatusDraft'),'statut0').' '.$langs->trans('BillStatusDraft');

View File

@ -47,8 +47,8 @@ abstract class CommonObject
public $array_options=array();
public $linkedObjectsIds;
public $linkedObjects;
public $linkedObjectsIds; // Loaded by ->fetchObjectLinked
public $linkedObjects; // Loaded by ->fetchObjectLinked
// No constructor as it is an abstract class
@ -83,10 +83,10 @@ abstract class CommonObject
if (empty($firstname)) $firstname=$this->firstname;
$ret='';
if ($option && $this->civilite_id)
if ($option && $this->civility_id)
{
if ($langs->transnoentitiesnoconv("Civility".$this->civilite_id)!="Civility".$this->civilite_id) $ret.=$langs->transnoentitiesnoconv("Civility".$this->civilite_id).' ';
else $ret.=$this->civilite_id.' ';
if ($langs->transnoentitiesnoconv("Civility".$this->civility_id)!="Civility".$this->civility_id) $ret.=$langs->transnoentitiesnoconv("Civility".$this->civility_id).' ';
else $ret.=$this->civility_id.' ';
}
$ret.=dolGetFirstLastname($firstname, $lastname, $nameorder);
@ -241,8 +241,8 @@ abstract class CommonObject
/**
* Copy contact from one element to current
*
* @param int $objFrom Source element
* @param int $source Nature of contact ('internal' or 'external')
* @param CommonObject $objFrom Source element
* @param string $source Nature of contact ('internal' or 'external')
* @return int >0 if OK, <0 if KO
*/
function copy_linked_contact($objFrom, $source='internal')
@ -1718,10 +1718,10 @@ abstract class CommonObject
* @param string $sourcetype Object source type
* @param int $targetid Object target id
* @param string $targettype Object target type
* @param string $clause OR, AND clause
* @param string $clause 'OR' or 'AND' clause used when both source id and target id are provided
* @return void
*/
function fetchObjectLinked($sourceid='',$sourcetype='',$targetid='',$targettype='',$clause='OR')
function fetchObjectLinked($sourceid='',$sourcetype='',$targetid='',$targettype='',$clause='OR')
{
global $conf;
@ -2278,7 +2278,7 @@ abstract class CommonObject
*/
function showOptionals($extrafields, $mode='view', $params=0, $keyprefix='')
{
global $_POST;
global $_POST, $conf;
$out = '';
@ -2392,7 +2392,8 @@ abstract class CommonObject
/**
* Function to check if an object is used by others
* Function to check if an object is used by others.
* Check is done into this->childtables. There is no check into llx_element_element.
*
* @param int $id Id of object
* @return int <0 if KO, 0 if not used, >0 if already used
@ -2482,7 +2483,7 @@ abstract class CommonObject
$i=0;
while ($i < $num)
{
$obj = $this->db->fetch_object($query);
$obj = $this->db->fetch_object($resql);
$pu_ht = $obj->pu_ht;
$qty= $obj->qty;
@ -2692,13 +2693,12 @@ abstract class CommonObject
/**
* Show add free products/services form
* TODO Edit templates to use global variables and include them directly in controller call
* But for the moment we don't know if it'st possible as we keep a method available on overloaded objects.
* But for the moment we don't know if it's possible as we keep a method available on overloaded objects.
*
* @param int $dateSelector 1=Show also date range input fields
* @param int $dateSelector 1=Show also date range input fields (start and end date)
* @param Societe $seller Object thirdparty who sell
* @param Societe $buyer Object thirdparty who buy
* @return void
* @deprecated
*/
function formAddFreeProduct($dateSelector,$seller,$buyer)
{

View File

@ -119,6 +119,8 @@ class Conf
*/
function setValues($db)
{
global $conf;
dol_syslog(get_class($this)."::setValues");
/*
@ -223,22 +225,6 @@ class Conf
if ($ret) $mc = new ActionsMulticompany($db);
}
// Second or others levels object
$this->propal->cloture = new stdClass();
$this->propal->facturation = new stdClass();
$this->commande->client = new stdClass();
$this->commande->fournisseur = new stdClass();
$this->facture->client = new stdClass();
$this->facture->fournisseur = new stdClass();
$this->fournisseur->commande = new stdClass();
$this->fournisseur->facture = new stdClass();
$this->contrat->services = new stdClass();
$this->contrat->services->inactifs = new stdClass();
$this->contrat->services->expires = new stdClass();
$this->adherent->cotisation = new stdClass();
$this->bank->rappro = new stdClass();
$this->bank->cheque = new stdClass();
// Clean some variables
if (empty($this->global->MAIN_MENU_STANDARD)) $this->global->MAIN_MENU_STANDARD="eldy_menu.php";
if (empty($this->global->MAIN_MENUFRONT_STANDARD)) $this->global->MAIN_MENUFRONT_STANDARD="eldy_menu.php";

View File

@ -34,7 +34,7 @@ class DolCookie
var $myExpire;
var $myPath;
var $myDomain;
var $mySsecure;
var $mySecure;
var $cookiearray;
var $cookie;
@ -80,7 +80,7 @@ class DolCookie
/**
* Decrypt the cookie
*
* @return void
* @return string
*/
function decryptCookie()
{
@ -144,4 +144,4 @@ class DolCookie
}
?>
?>

View File

@ -188,7 +188,7 @@ class DiscountAbsolute
// Check if we can remove the discount
if ($this->fk_facture_source)
{
$sql.="SELECT COUNT(rowid) as nb";
$sql="SELECT COUNT(rowid) as nb";
$sql.=" FROM ".MAIN_DB_PREFIX."societe_remise_except";
$sql.=" WHERE (fk_facture_line IS NOT NULL"; // Not used as absolute simple discount
$sql.=" OR fk_facture IS NOT NULL)"; // Not used as credit note and not used as deposit

View File

@ -126,7 +126,7 @@ class dolprintIPP
*/
function list_jobs($module)
{
global $conf,$db;
global $conf, $db, $bc;
include_once DOL_DOCUMENT_ROOT.'/includes/printipp/CupsPrintIPP.php';
$ipp = new CupsPrintIPP();
$ipp->setLog(DOL_DATA_ROOT.'/printipp.log','file',3); // logging very verbose

View File

@ -207,16 +207,16 @@ class ExtraFields
/**
* Add description of a new optional attribute
*
* @param string $attrname code of attribute
* @param string $label label of attribute
* @param int $type Type of attribute ('int', 'text', 'varchar', 'date', 'datehour', 'float')
* @param int $pos Position of attribute
* @param int $size Size/length of attribute
* @param string $elementtype Element type ('member', 'product', 'company', ...)
* @param int $unique Is field unique or not
* @param int $required Is field required or not
* @param array $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) )
* @return int <=0 if KO, >0 if OK
* @param string $attrname code of attribute
* @param string $label label of attribute
* @param int $type Type of attribute ('int', 'text', 'varchar', 'date', 'datehour', 'float')
* @param int $pos Position of attribute
* @param int $size Size/length of attribute
* @param string $elementtype Element type ('member', 'product', 'company', ...)
* @param int $unique Is field unique or not
* @param int $required Is field required or not
* @param array||string $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) )
* @return int <=0 if KO, >0 if OK
*/
private function create_label($attrname, $label='', $type='', $pos=0, $size=0, $elementtype='member', $unique=0, $required=0, $param='')
{
@ -581,7 +581,7 @@ class ExtraFields
*/
function showInputField($key,$value,$moreparam='',$keyprefix='')
{
global $conf,$langs;
global $conf,$langs,$db;
$label=$this->attribute_label[$key];
$type =$this->attribute_type[$key];

View File

@ -558,7 +558,8 @@ class FileUpload
isset($_SERVER['HTTP_X_FILE_NAME']) ? $_SERVER['HTTP_X_FILE_NAME'] : (isset($upload['name']) ? $upload['name'] : null),
isset($_SERVER['HTTP_X_FILE_SIZE']) ? $_SERVER['HTTP_X_FILE_SIZE'] : (isset($upload['size']) ? $upload['size'] : null),
isset($_SERVER['HTTP_X_FILE_TYPE']) ? $_SERVER['HTTP_X_FILE_TYPE'] : (isset($upload['type']) ? $upload['type'] : null),
isset($upload['error']) ? $upload['error'] : null
isset($upload['error']) ? $upload['error'] : null,
0
);
}
header('Vary: Accept');

View File

@ -3160,7 +3160,7 @@ class Form
*/
function form_contacts($page, $societe, $selected='', $htmlname='contactidp')
{
global $langs;
global $langs, $conf;
if ($htmlname != "none")
{

View File

@ -199,9 +199,9 @@ class FormAdmin
/**
* Return combo list of available menu families
*
* @param string $selected Menu pre-selected
* @param string $htmlname Name of html select
* @param string $dirmenuarray Directories to scan
* @param string $selected Menu pre-selected
* @param string $htmlname Name of html select
* @param string[] $dirmenuarray Directories to scan
* @return void
*/
function select_menu_families($selected, $htmlname, $dirmenuarray)

View File

@ -257,8 +257,7 @@ class FormFile
*/
function showdocuments($modulepart,$modulesubdir,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$allowgenifempty=1,$forcenomultilang=0,$iconPDF=0,$maxfilenamelength=28,$noform=0,$param='',$title='',$buttonlabel='',$codelang='',$morepicto='')
{
global $langs,$conf,$hookmanager;
global $bc;
global $langs,$conf,$hookmanager,$user,$bc;
// filedir = $conf->...->dir_ouput."/".get_exdir(id)
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';

View File

@ -58,7 +58,8 @@ class FormMail
var $withreplytoreadonly;
var $withtoreadonly;
var $withtoccreadonly;
var $withtopicreadonly;
var $withtocccreadonly;
var $withtopicreadonly;
var $withfilereadonly;
var $withdeliveryreceipt;
var $withcancel;
@ -95,6 +96,7 @@ class FormMail
$this->withreplytoreadonly=1;
$this->withtoreadonly=0;
$this->withtoccreadonly=0;
$this->withtocccreadonly=0;
$this->witherrorstoreadonly=0;
$this->withtopicreadonly=0;
$this->withfilereadonly=0;

View File

@ -391,7 +391,7 @@ class FormOther
$moreinfo=0;
if (! empty($conf->global->MAIN_SHOW_LOGIN))
{
$out.=($moreinfo?' - ':' (').$obj->login;
$moreforfilter.=($moreinfo?' - ':' (').$obj_usr->login;
$moreinfo++;
}
if ($showstatus >= 0)
@ -424,16 +424,17 @@ class FormOther
/**
* Return list of project and tasks
*
* @param int $selectedtask Pre-selected task
* @param int $projectid Project id
* @param string $htmlname Name of html select
* @param int $modeproject 1 to restrict on projects owned by user
* @param int $modetask 1 to restrict on tasks associated to user
* @param int $mode 0=Return list of tasks and their projects, 1=Return projects and tasks if exists
* @param int $useempty 0=Allow empty values
* @param int $selectedtask Pre-selected task
* @param int $projectid Project id
* @param string $htmlname Name of html select
* @param int $modeproject 1 to restrict on projects owned by user
* @param int $modetask 1 to restrict on tasks associated to user
* @param int $mode 0=Return list of tasks and their projects, 1=Return projects and tasks if exists
* @param int $useempty 0=Allow empty values
* @param int $disablechildoftaskid 1=Disable task that are child of the provided task id
* @return void
*/
function selectProjectTasks($selectedtask='', $projectid=0, $htmlname='task_parent', $modeproject=0, $modetask=0, $mode=0, $useempty=0)
function selectProjectTasks($selectedtask='', $projectid=0, $htmlname='task_parent', $modeproject=0, $modetask=0, $mode=0, $useempty=0, $disablechildoftaskid=0)
{
global $user, $langs;
@ -448,7 +449,7 @@ class FormOther
if ($useempty) print '<option value="0">&nbsp;</option>';
$j=0;
$level=0;
$this->_pLineSelect($j, 0, $tasksarray, $level, $selectedtask, $projectid);
$this->_pLineSelect($j, 0, $tasksarray, $level, $selectedtask, $projectid, $disablechildoftaskid);
print '</select>';
}
else
@ -458,17 +459,18 @@ class FormOther
}
/**
* Write all lines of a project (if parent = 0)
* Write lines of a project (all lines of a project if parent = 0)
*
* @param int &$inc Cursor counter
* @param int $parent Id parent
* @param Object $lines Line object
* @param int $parent Id of parent task we want to see
* @param array $lines Array of task lines
* @param int $level Level
* @param int $selectedtask Id selected task
* @param int $selectedproject Id selected project
* @param int $disablechildoftaskid 1=Disable task that are child of the provided task id
* @return void
*/
private function _pLineSelect(&$inc, $parent, $lines, $level=0, $selectedtask=0, $selectedproject=0)
private function _pLineSelect(&$inc, $parent, $lines, $level=0, $selectedtask=0, $selectedproject=0, $disablechildoftaskid=0)
{
global $langs, $user, $conf;
@ -481,12 +483,12 @@ class FormOther
{
$var = !$var;
//var_dump($selectedtask."--".$selectedtask."--".$lines[$i]->fk_project."_".$lines[$i]->id);
//var_dump($selectedproject."--".$selectedtask."--".$lines[$i]->fk_project."_".$lines[$i]->id);
// Break on a new project
if ($parent == 0)
if ($parent == 0) // We are on a task at first level
{
if ($lines[$i]->fk_project != $lastprojectid)
if ($lines[$i]->fk_project != $lastprojectid) // Break found on project
{
if ($i > 0 && $conf->browser->firefox) print '<option value="0" disabled="disabled">----------</option>';
print '<option value="'.$lines[$i]->fk_project.'_0"';
@ -509,11 +511,22 @@ class FormOther
}
}
$newdisablechildoftaskid=$disablechildoftaskid;
// Print task
if ($lines[$i]->id >= 0)
{
// Check if we must disable entry
$disabled=0;
if ($disablechildoftaskid && (($lines[$i]->id == $disablechildoftaskid || $lines[$i]->fk_parent == $disablechildoftaskid)))
{
$disabled++;
if ($lines[$i]->fk_parent == $disablechildoftaskid) $newdisablechildoftaskid=$lines[$i]->id; // If task is child of a disabled parent, we will propagate id to disable next child too
}
print '<option value="'.$lines[$i]->fk_project.'_'.$lines[$i]->id.'"';
if (($lines[$i]->id == $selectedtask) || ($lines[$i]->fk_project.'_'.$lines[$i]->id == $selectedtask)) print ' selected="selected"';
if ($disabled) print ' disabled="disabled"';
print '>';
print $langs->trans("Project").' '.$lines[$i]->projectref;
if (empty($lines[$i]->public))
@ -534,7 +547,7 @@ class FormOther
}
$level++;
if ($lines[$i]->id) $this->_pLineSelect($inc, $lines[$i]->id, $lines, $level, $selectedtask, $selectedproject);
if ($lines[$i]->id) $this->_pLineSelect($inc, $lines[$i]->id, $lines, $level, $selectedtask, $selectedproject, $newdisablechildoftaskid);
$level--;
}
}
@ -1042,7 +1055,7 @@ class FormOther
$emptybox->showBox(array(),array());
}
print "</div>\n";
print "<!-- End box container -->\n";
print "<!-- End box left container -->\n";
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
@ -1073,7 +1086,7 @@ class FormOther
$emptybox->showBox(array(),array());
}
print "</div>\n";
print "<!-- End box container -->\n";
print "<!-- End box right container -->\n";
print '</div></div>';
print "\n";
@ -1095,9 +1108,10 @@ class FormOther
* @param string $labelfield Label field
* @param string $selected Selected value
* @param int $useempty 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries.
* @param string $moreattrib More attributes on HTML select tag
* @return void
*/
function select_dictionary($htmlname,$dictionarytable,$keyfield='code',$labelfield='label',$selected='',$useempty=0)
function select_dictionary($htmlname,$dictionarytable,$keyfield='code',$labelfield='label',$selected='',$useempty=0,$moreattrib='')
{
global $langs, $conf;

View File

@ -213,6 +213,7 @@ function limitChars(textarea, limit, infodiv)
else
{
dol_syslog("Warning: The SMS sending method has not been defined into MAIN_SMS_SENDMODE", LOG_WARNING);
$resultsender=array();
$resultsender[0]->number=$this->fromsms;
}

View File

@ -201,7 +201,7 @@ class InfoBox
$tab[$confuserzone]=1;
if (dol_set_user_param($db, $conf, $user, $tab) < 0)
{
$this->error=$db->lasterror();
$error=$db->lasterror();
$db->rollback();
return -3;
}

View File

@ -128,7 +128,7 @@ class Ldap
$this->attr_firstname = $conf->global->LDAP_FIELD_FIRSTNAME;
$this->attr_mail = $conf->global->LDAP_FIELD_MAIL;
$this->attr_phone = $conf->global->LDAP_FIELD_PHONE;
$this->attr_skype = $conf->global->LDAP_FIELD_SKYPE;
$this->attr_skype = $conf->global->LDAP_FIELD_SKYPE;
$this->attr_fax = $conf->global->LDAP_FIELD_FAX;
$this->attr_mobile = $conf->global->LDAP_FIELD_MOBILE;
}
@ -151,9 +151,19 @@ class Ldap
$connected=0;
$this->bind=0;
// Check parameters
if (count($this->server) == 0 || empty($this->server[0]))
{
$this->error='LDAP setup (file conf.php) is not complete';
$return=-1;
dol_syslog(get_class($this)."::connect_bind ".$this->error, LOG_WARNING);
}
// Loop on each ldap server
foreach ($this->server as $key => $host)
{
if ($connected) break;
if (empty($host)) continue;
if (preg_match('/^ldap/',$host))
{
@ -171,7 +181,7 @@ class Ldap
if ($this->serverType == "activedirectory")
{
$result=$this->setReferrals();
dol_syslog(get_class($this)."::connect_bind try bindauth for activedirectory on ".$host." user=".$this->searchUser,LOG_DEBUG);
dol_syslog(get_class($this)."::connect_bind try bindauth for activedirectory on ".$host." user=".$this->searchUser." password=".preg_replace('/./','*',$this->searchPassword),LOG_DEBUG);
$this->result=$this->bindauth($this->searchUser,$this->searchPassword);
if ($this->result)
{
@ -189,7 +199,7 @@ class Ldap
// Try in auth mode
if ($this->searchUser && $this->searchPassword)
{
dol_syslog(get_class($this)."::connect_bind try bindauth on ".$host." user=".$this->searchUser,LOG_DEBUG);
dol_syslog(get_class($this)."::connect_bind try bindauth on ".$host." user=".$this->searchUser." password=".preg_replace('/./','*',$this->searchPassword),LOG_DEBUG);
$this->result=$this->bindauth($this->searchUser,$this->searchPassword);
if ($this->result)
{
@ -359,10 +369,10 @@ class Ldap
* Add a LDAP entry
* Ldap object connect and bind must have been done
*
* @param string $dn DN entry key
* @param string $info Attributes array
* @param User $user Objet user that create
* @return int <0 if KO, >0 if OK
* @param string $dn DN entry key
* @param string[] $info Attributes array
* @param User $user Objet user that create
* @return int <0 if KO, >0 if OK
*/
function add($dn, $info, $user)
{
@ -413,7 +423,7 @@ class Ldap
* Ldap object connect and bind must have been done
*
* @param string $dn DN entry key
* @param string $info Attributes array
* @param string[] $info Attributes array
* @param string $user Objet user that modify
* @return int <0 if KO, >0 if OK
*/
@ -465,7 +475,7 @@ class Ldap
* Ldap object connect and bind must have been done
*
* @param string $dn DN entry key
* @param string $info Attributes array
* @param string[] $info Attributes array
* @param User $user Objet user that update
* @param string $olddn Old DN entry key (before update)
* @return int <0 if KO, >0 if OK
@ -552,9 +562,9 @@ class Ldap
/**
* Build a LDAP message
*
* @param string $dn DN entry key
* @param string $info Attributes array
* @return string Content of file
* @param string $dn DN entry key
* @param string[] $info Attributes array
* @return string Content of file
*/
function dump_content($dn, $info)
{
@ -594,9 +604,9 @@ class Ldap
/**
* Dump a LDAP message to ldapinput.in file
*
* @param string $dn DN entry key
* @param string $info Attributes array
* @return int <0 if KO, >0 if OK
* @param string $dn DN entry key
* @param string[] $info Attributes array
* @return int <0 if KO, >0 if OK
*/
function dump($dn, $info)
{
@ -631,10 +641,10 @@ class Ldap
* Add a LDAP attribute in entry
* Ldap object connect and bind must have been done
*
* @param string $dn DN entry key
* @param string $info Attributes array
* @param User $user Objet user that create
* @return int <0 if KO, >0 if OK
* @param string $dn DN entry key
* @param string[] $info Attributes array
* @param User $user Objet user that create
* @return int <0 if KO, >0 if OK
*/
function addAttribute($dn, $info, $user)
{
@ -683,10 +693,10 @@ class Ldap
* Update a LDAP attribute in entry
* Ldap object connect and bind must have been done
*
* @param string $dn DN entry key
* @param string $info Attributes array
* @param User $user Objet user that create
* @return int <0 if KO, >0 if OK
* @param string $dn DN entry key
* @param string[] $info Attributes array
* @param User $user Objet user that create
* @return int <0 if KO, >0 if OK
*/
function updateAttribute($dn, $info, $user)
{
@ -735,10 +745,10 @@ class Ldap
* Delete a LDAP attribute in entry
* Ldap object connect and bind must have been done
*
* @param string $dn DN entry key
* @param string $info Attributes array
* @param User $user Objet user that create
* @return int <0 if KO, >0 if OK
* @param string $dn DN entry key
* @param string[] $info Attributes array
* @param User $user Objet user that create
* @return int <0 if KO, >0 if OK
*/
function deleteAttribute($dn, $info, $user)
{
@ -1370,4 +1380,4 @@ class Ldap
}
?>
?>

View File

@ -266,7 +266,7 @@ class Link extends CommonObject
{
while ($obj = $this->db->fetch_object($resql))
{
$link = new Link($db);
$link = new Link($this->db);
$link->id = $obj->rowid;
$link->entity = $obj->entity;
$link->datea = $this->db->jdate($obj->datea);

View File

@ -403,13 +403,13 @@ class Menubase
/**
* Load entries found from database in this->newmenu array.
*
* @param array $newmenu Menu array to complete (in most cases, it's empty, may be already initialized with some menu manager like eldy)
* @param Menu $newmenu Menu array to complete (in most cases, it's empty, may be already initialized with some menu manager like eldy)
* @param string $mymainmenu Value for mainmenu to filter menu to load (often $_SESSION["mainmenu"])
* @param string $myleftmenu Value for leftmenu to filter menu to load (always '')
* @param int $type_user 0=Menu for backoffice, 1=Menu for front office
* @param string $menu_handler Filter on name of menu_handler used (auguria, eldy...)
* @param array &$tabMenu Array with menu entries already loaded
* @return array Menu array for particular mainmenu value or full tabArray
* @return Menu Menu array for particular mainmenu value or full tabArray
*/
function menuLeftCharger($newmenu, $mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)
{

View File

@ -174,7 +174,7 @@ class RssParser
* @param string $urlRSS Url to parse
* @param int $maxNb Max nb of records to get (0 for no limit)
* @param int $cachedelay 0=No cache, nb of seconds we accept cache files (cachedir must also be defined)
* @param strnig $cachedir Directory where to save cache file
* @param string $cachedir Directory where to save cache file
* @return int <0 if KO, >0 if OK
*/
public function parser($urlRSS, $maxNb=0, $cachedelay=60, $cachedir='')
@ -722,7 +722,7 @@ class RssParser
/**
* Function to convert an XML object into an array
*
* @param string $xml Xml
* @param SimpleXMLElement $xml Xml
* @return void
*/
function xml2php($xml)
@ -775,4 +775,4 @@ function xml2php($xml)
}
?>
?>

View File

@ -491,9 +491,10 @@ abstract class Stats
*
* @param int $year Year
* @param string $sql SQL
* @return array
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is a number
* @return array
*/
function _getAverageByMonth($year, $sql)
function _getAverageByMonth($year, $sql, $format=0)
{
$result=array();
$res=array();

View File

@ -703,7 +703,7 @@ class Translate
*/
function getCurrencyAmount($currency_code, $amount)
{
$symbol=$this->getCurrencSymbol($currency_code);
$symbol=$this->getCurrencySymbol($currency_code);
if (in_array($currency_code, array('USD'))) return $symbol.$amount;
else return $amount.$symbol;

View File

@ -125,6 +125,71 @@ abstract class DoliDB implements Database
}
}
/**
* Validate a database transaction
*
* @param string $log Add more log to default log line
* @return int 1 if validation is OK or transaction level no started, 0 if ERROR
*/
function commit($log='')
{
dol_syslog('',0,-1);
if ($this->transaction_opened<=1)
{
$ret=$this->query("COMMIT");
if ($ret)
{
$this->transaction_opened=0;
dol_syslog("COMMIT Transaction".($log?' '.$log:''),LOG_DEBUG);
}
return $ret;
}
else
{
$this->transaction_opened--;
return 1;
}
}
/**
* Annulation d'une transaction et retour aux anciennes valeurs
*
* @param string $log Add more log to default log line
* @return int 1 si annulation ok ou transaction non ouverte, 0 en cas d'erreur
*/
function rollback($log='')
{
dol_syslog('',0,-1);
if ($this->transaction_opened<=1)
{
$ret=$this->query("ROLLBACK");
$this->transaction_opened=0;
dol_syslog("ROLLBACK Transaction".($log?' '.$log:''),LOG_DEBUG);
return $ret;
}
else
{
$this->transaction_opened--;
return 1;
}
}
/**
* Define limits and offset of request
*
* @param int $limit Maximum number of lines returned (-1=conf->liste_limit, 0=no limit)
* @param int $offset Numero of line from where starting fetch
* @return string String with SQL syntax to add a limit and offset
*/
function plimit($limit=0,$offset=0)
{
global $conf;
if (empty($limit)) return "";
if ($limit < 0) $limit=$conf->liste_limit;
if ($offset > 0) return " LIMIT $offset,$limit ";
else return " LIMIT $limit ";
}
/**
* Return version of database server into an array
*

View File

@ -466,24 +466,6 @@ class DoliDBMssql extends DoliDB
if (is_resource($resultset)) mssql_free_result($resultset);
}
/**
* Define limits and offset of request
*
* @param int $limit Maximum number of lines returned (-1=conf->liste_limit, 0=no limit)
* @param int $offset Numero of line from where starting fetch
* @return string String with SQL syntax to add a limit and offset
*/
function plimit($limit=0,$offset=0)
{
global $conf;
if (empty($limit)) return "";
if ($limit < 0) $limit=$conf->liste_limit;
if ($offset > 0) return " LIMIT $offset,$limit ";
else return " LIMIT $limit ";
}
/**
* Escape a string to insert data
*

View File

@ -239,55 +239,6 @@ class DoliDBMysql extends DoliDB
return false;
}
/**
* Validate a database transaction
*
* @param string $log Add more log to default log line
* @return int 1 if validation is OK or transaction level no started, 0 if ERROR
*/
function commit($log='')
{
dol_syslog('',0,-1);
if ($this->transaction_opened<=1)
{
$ret=$this->query("COMMIT");
if ($ret)
{
$this->transaction_opened=0;
dol_syslog("COMMIT Transaction".($log?' '.$log:''),LOG_DEBUG);
}
return $ret;
}
else
{
$this->transaction_opened--;
return 1;
}
}
/**
* Annulation d'une transaction et retour aux anciennes valeurs
*
* @param string $log Add more log to default log line
* @return int 1 si annulation ok ou transaction non ouverte, 0 en cas d'erreur
*/
function rollback($log='')
{
dol_syslog('',0,-1);
if ($this->transaction_opened<=1)
{
$ret=$this->query("ROLLBACK");
$this->transaction_opened=0;
dol_syslog("ROLLBACK Transaction".($log?' '.$log:''),LOG_DEBUG);
return $ret;
}
else
{
$this->transaction_opened--;
return 1;
}
}
/**
* Execute a SQL request and return the resultset
*
@ -414,24 +365,6 @@ class DoliDBMysql extends DoliDB
if (is_resource($resultset)) mysql_free_result($resultset);
}
/**
* Define limits and offset of request
*
* @param int $limit Maximum number of lines returned (-1=conf->liste_limit, 0=no limit)
* @param int $offset Numero of line from where starting fetch
* @return string String with SQL syntax to add a limit and offset
*/
function plimit($limit=0,$offset=0)
{
global $conf;
if (empty($limit)) return "";
if ($limit < 0) $limit=$conf->liste_limit;
if ($offset > 0) return " LIMIT $offset,$limit ";
else return " LIMIT $limit ";
}
/**
* Escape a string to insert data
*

View File

@ -243,55 +243,6 @@ class DoliDBMysqli extends DoliDB
return false;
}
/**
* Validate a database transaction
*
* @param string $log Add more log to default log line
* @return int 1 if validation is OK or transaction level no started, 0 if ERROR
*/
function commit($log='')
{
dol_syslog('',0,-1);
if ($this->transaction_opened<=1)
{
$ret=$this->query("COMMIT");
if ($ret)
{
$this->transaction_opened=0;
dol_syslog("COMMIT Transaction".($log?' '.$log:''),LOG_DEBUG);
}
return $ret;
}
else
{
$this->transaction_opened--;
return 1;
}
}
/**
* Annulation d'une transaction et retour aux anciennes valeurs
*
* @param string $log Add more log to default log line
* @return int 1 si annulation ok ou transaction non ouverte, 0 en cas d'erreur
*/
function rollback($log='')
{
dol_syslog('',0,-1);
if ($this->transaction_opened<=1)
{
$ret=$this->query("ROLLBACK");
$this->transaction_opened=0;
dol_syslog("ROLLBACK Transaction".($log?' '.$log:''),LOG_DEBUG);
return $ret;
}
else
{
$this->transaction_opened--;
return 1;
}
}
/**
* Execute a SQL request and return the resultset
*
@ -425,24 +376,6 @@ class DoliDBMysqli extends DoliDB
if (is_object($resultset)) mysqli_free_result($resultset);
}
/**
* Define limits and offset of request
*
* @param int $limit Maximum number of lines returned (-1=conf->liste_limit, 0=no limit)
* @param int $offset Numero of line from where starting fetch
* @return string String with SQL syntax to add a limit and offset
*/
function plimit($limit=0,$offset=0)
{
global $conf;
if (empty($limit)) return "";
if ($limit < 0) $limit=$conf->liste_limit;
if ($offset > 0) return " LIMIT $offset,$limit ";
else return " LIMIT $limit ";
}
/**
* Escape a string to insert data
*

View File

@ -448,82 +448,6 @@ class DoliDBPgsql extends DoliDB
return false;
}
/**
* Start transaction
*
* @return int 1 if transaction successfuly opened or already opened, 0 if error
*/
function begin()
{
if (! $this->transaction_opened)
{
$ret=$this->query("BEGIN;");
if ($ret)
{
$this->transaction_opened++;
dol_syslog("BEGIN Transaction",LOG_DEBUG);
dol_syslog('',0,1);
}
return $ret;
}
else
{
$this->transaction_opened++;
dol_syslog('',0,1);
return 1;
}
}
/**
* Validate a database transaction
*
* @param string $log Add more log to default log line
* @return int 1 if validation is OK or transaction level no started, 0 if ERROR
*/
function commit($log='')
{
dol_syslog('',0,-1);
if ($this->transaction_opened<=1)
{
$ret=$this->query("COMMIT;");
if ($ret)
{
$this->transaction_opened=0;
dol_syslog("COMMIT Transaction",LOG_DEBUG);
}
return $ret;
}
else
{
$this->transaction_opened--;
return 1;
}
}
/**
* Annulation d'une transaction et retour aux anciennes valeurs
*
* @param string $log Add more log to default log line
* @return int 1 si annulation ok ou transaction non ouverte, 0 en cas d'erreur
*/
function rollback($log='')
{
dol_syslog('',0,-1);
if ($this->transaction_opened<=1)
{
$ret=$this->query("ROLLBACK;");
$this->transaction_opened=0;
dol_syslog("ROLLBACK Transaction".($log?' '.$log:''),LOG_DEBUG);
return $ret;
}
else
{
$this->transaction_opened--;
return 1;
}
}
/**
* Convert request to PostgreSQL syntax, execute it and return the resultset
*

View File

@ -368,55 +368,6 @@ class DoliDBSqlite extends DoliDB
return false;
}
/**
* Validate a database transaction
*
* @param string $log Add more log to default log line
* @return int 1 if validation is OK or transaction level no started, 0 if ERROR
*/
function commit($log='')
{
dol_syslog('',0,-1);
if ($this->transaction_opened<=1)
{
$ret=$this->query("COMMIT");
if ($ret)
{
$this->transaction_opened=0;
dol_syslog("COMMIT Transaction".($log?' '.$log:''),LOG_DEBUG);
}
return $ret;
}
else
{
$this->transaction_opened--;
return 1;
}
}
/**
* Annulation d'une transaction et retour aux anciennes valeurs
*
* @param string $log Add more log to default log line
* @return int 1 si annulation ok ou transaction non ouverte, 0 en cas d'erreur
*/
function rollback($log='')
{
dol_syslog('',0,-1);
if ($this->transaction_opened<=1)
{
$ret=$this->query("ROLLBACK");
$this->transaction_opened=0;
dol_syslog("ROLLBACK Transaction".($log?' '.$log:''),LOG_DEBUG);
return $ret;
}
else
{
$this->transaction_opened--;
return 1;
}
}
/**
* Execute a SQL request and return the resultset
*
@ -559,24 +510,6 @@ class DoliDBSqlite extends DoliDB
if (is_object($resultset)) $resultset->closeCursor();
}
/**
* Define limits and offset of request
*
* @param int $limit Maximum number of lines returned (-1=conf->liste_limit, 0=no limit)
* @param int $offset Numero of line from where starting fetch
* @return string String with SQL syntax to add a limit and offset
*/
function plimit($limit=0,$offset=0)
{
global $conf;
if (empty($limit)) return "";
if ($limit < 0) $limit=$conf->liste_limit;
if ($offset > 0) return " LIMIT $offset,$limit ";
else return " LIMIT $limit ";
}
/**
* Escape a string to insert data
*

View File

@ -51,7 +51,7 @@ function RemoveFromEnd($sourceString, $charToRemove)
/**
* FindBadUtf8
*
* @param unknown_type $string String
* @param string $string String
* @return boolean
*/
function FindBadUtf8($string)

View File

@ -1,4 +1,4 @@
// Copyright (C) 2005-2013 Laurent Destailleur <eldy@users.sourceforge.net>
// Copyright (C) 2005-2014 Laurent Destailleur <eldy@users.sourceforge.net>
// Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
//
// This program is free software; you can redistribute it and/or modify
@ -554,7 +554,9 @@ function newpopup(url,title) {
tmp=url;
var l = (argc > 2) ? argv[2] : 600;
var h = (argc > 3) ? argv[3] : 400;
var wfeatures="directories=0,menubar=0,status=0,resizable=0,scrollbars=1,toolbar=0,width="+l+",height="+h+",left=" + eval("(screen.width - l)/2") + ",top=" + eval("(screen.height - h)/2");
var left = (screen.width - l)/2;
var top = (screen.height - h)/2;
var wfeatures = "directories=0,menubar=0,status=0,resizable=0,scrollbars=1,toolbar=0,width=" + l +",height=" + h + ",left=" + left + ",top=" + top;
fen=window.open(tmp,title,wfeatures);
return false;
}
@ -922,6 +924,7 @@ function copyToClipboard(text,text2)
*
* TODO Who use this ?
*/
/*
(function($){
$.widget("ui.onDelayedKeyup", {
_init : function() {
@ -940,4 +943,4 @@ function copyToClipboard(text,text2)
}
});
})(jQuery);
*/

View File

@ -386,14 +386,14 @@ function agenda_prepare_head()
$head[$h][2] = 'other';
$h++;
complete_head_from_modules($conf,$langs,$object,$head,$h,'agenda_admin');
complete_head_from_modules($conf,$langs,null,$head,$h,'agenda_admin');
$head[$h][0] = DOL_URL_ROOT."/admin/agenda_extrafields.php";
$head[$h][1] = $langs->trans("ExtraFields");
$head[$h][2] = 'attributes';
$h++;
complete_head_from_modules($conf,$langs,$object,$head,$h,'agenda_admin','remove');
complete_head_from_modules($conf,$langs,null,$head,$h,'agenda_admin','remove');
return $head;

View File

@ -59,7 +59,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
$("#'.$htmlname.'").trigger("change");
});
// Check when keyup
$("input#search_'.$htmlname.'").onDelayedKeyup({ handler: function() {
$("input#search_'.$htmlname.'").keyup(function() {
//console.log(\'keyup\');
if ($(this).val().length == 0)
{
@ -93,7 +93,6 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
});
}
}
}
});
$("input#search_'.$htmlname.'").autocomplete({
source: function( request, response ) {
@ -272,7 +271,7 @@ function ajax_dialog($title,$message,$w=350,$h=150)
{
global $langs;
$msg.= '<div id="dialog-info" title="'.dol_escape_htmltag($title).'">';
$msg= '<div id="dialog-info" title="'.dol_escape_htmltag($title).'">';
$msg.= $message;
$msg.= '</div>'."\n";
$msg.= '<script type="text/javascript">
@ -366,7 +365,7 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0)
$("select#" + htmlname).html(response.value);
});
}
});'."\n";
$msg.= "</script>\n";

View File

@ -47,6 +47,11 @@ function categories_prepare_head($object,$type)
$head[$h][1] = $langs->trans("Photos");
$head[$h][2] = 'photos';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/categories/traduction.php?id='.$object->id.'&amp;type='.$type;
$head[$h][1] = $langs->trans("Translation");
$head[$h][2] = 'translation';
$h++;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
@ -88,12 +93,12 @@ function categoriesadmin_prepare_head()
// 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,'categoriesadmin');
complete_head_from_modules($conf,$langs,null,$head,$h,'categoriesadmin');
complete_head_from_modules($conf,$langs,$object,$head,$h,'categoriesadmin','remove');
complete_head_from_modules($conf,$langs,null,$head,$h,'categoriesadmin','remove');
return $head;
}
?>
?>

View File

@ -178,7 +178,7 @@ function societe_prepare_head2($object)
if (empty($conf->global->SOCIETE_DISABLE_BANKACCOUNT))
{
$head[$h][0] = DOL_URL_ROOT .'/societe/rib.php?socid='.$object->id;
$head[$h][1] = $langs->trans("BankAccount")." $account->number";
$head[$h][1] = $langs->trans("BankAccount");
$head[$h][2] = 'rib';
$h++;
}
@ -659,10 +659,10 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
$result = $db->query($sql);
$num = $db->num_rows($result);
if ($num)
$var=true;
if ($num)
{
$i=0;
$var=true;
while ($i < $num)
{

View File

@ -105,7 +105,7 @@ function contract_admin_prepare_head()
// 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,'contract_admin');
complete_head_from_modules($conf,$langs,null,$head,$h,'contract_admin');
$head[$h][0] = DOL_URL_ROOT.'/contrat/admin/contract_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFields");
@ -114,9 +114,9 @@ function contract_admin_prepare_head()
complete_head_from_modules($conf,$langs,$object,$head,$h,'contract_admin','remove');
complete_head_from_modules($conf,$langs,null,$head,$h,'contract_admin','remove');
return $head;
}
?>
?>

View File

@ -39,9 +39,9 @@ function cronadmin_prepare_head()
$head[$h][2] = 'setup';
$h++;
complete_head_from_modules($conf, $langs, $object, $head, $h, 'cronadmin');
complete_head_from_modules($conf, $langs, null, $head, $h, 'cronadmin');
complete_head_from_modules($conf, $langs, $object, $head, $h, 'cronadmin', 'remove');
complete_head_from_modules($conf, $langs, null, $head, $h, 'cronadmin', 'remove');
return $head;

View File

@ -442,7 +442,7 @@ 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 timestamp Date for first day
* @return int Date for first day
*/
function dol_get_first_day($year,$month=1,$gm=false)
{
@ -455,7 +455,7 @@ 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 timestamp Date for first day
* @return int Date for first day
*/
function dol_get_last_day($year,$month=12,$gm=false)
{
@ -551,8 +551,8 @@ function dol_get_first_day_week($day,$month,$year,$gm=false)
* Fonction retournant le nombre de jour feries, samedis et dimanches entre 2 dates entrees en timestamp. Dates must be UTC with hour, day, min to 0
* Called by function num_open_day
*
* @param timestamp $timestampStart Timestamp de debut
* @param timestamp $timestampEnd Timestamp de fin
* @param int $timestampStart Timestamp de debut
* @param int $timestampEnd Timestamp de fin
* @param string $countrycode Country code
* @return int Nombre de jours feries
*/
@ -685,8 +685,8 @@ function num_public_holiday($timestampStart, $timestampEnd, $countrycode='FR')
* Function to return number of days between two dates (date must be UTC date !)
* Example: 2012-01-01 2012-01-02 => 1 if lastday=0, 2 if lastday=1
*
* @param timestamp $timestampStart Timestamp start UTC
* @param timestamp $timestampEnd Timestamp end UTC
* @param int $timestampStart Timestamp start UTC
* @param int $timestampEnd Timestamp end UTC
* @param int $lastday Last day is included, 0: non, 1:oui
* @return int Number of days
*/
@ -711,8 +711,8 @@ function num_between_day($timestampStart, $timestampEnd, $lastday=0)
/**
* Function to return number of working days (and text of units) between two dates (working days)
*
* @param timestamp $timestampStart Timestamp for start date (date must be UTC to avoid calculation errors)
* @param timestamp $timestampEnd Timestamp for end date (date must be UTC to avoid calculation errors)
* @param int $timestampStart Timestamp for start date (date must be UTC to avoid calculation errors)
* @param int $timestampEnd Timestamp for end date (date must be UTC to avoid calculation errors)
* @param int $inhour 0: return number of days, 1: return number of hours
* @param int $lastday We include last day, 0: no, 1:yes
* @param int $halfday Tag to define half day when holiday start and end

View File

@ -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>
*
* 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
@ -23,6 +23,43 @@
*/
/**
* Prepare array with list of different ecm main dashboard
*
* @param object $object Object related to tabs
* @return array Array of tabs to shoc
*/
function ecm_prepare_dasboard_head($object)
{
global $langs, $conf, $user;
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/ecm/index.php';
$head[$h][1] = $langs->trans("ECMSectionsManual").img_help(1,$helptext1);
$head[$h][2] = 'index';
$h++;
if (! empty($conf->global->ECM_AUTO_TREE_ENABLED))
{
$head[$h][0] = DOL_URL_ROOT.'/ecm/index_auto.php';
$head[$h][1] = $langs->trans("ECMSectionsAuto").img_help(1,$helptext2);
$head[$h][2] = 'index_auto';
$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:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'ecm');
complete_head_from_modules($conf,$langs,$object,$head,$h,'ecm','remove');
return $head;
}
/**
* Prepare array with list of tabs
*

View File

@ -119,7 +119,7 @@ function fichinter_admin_prepare_head()
// 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,'fichinter_admin');
complete_head_from_modules($conf,$langs,null,$head,$h,'fichinter_admin');
$head[$h][0] = DOL_URL_ROOT.'/fichinter/admin/fichinter_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFields");
@ -128,7 +128,7 @@ function fichinter_admin_prepare_head()
complete_head_from_modules($conf,$langs,$object,$head,$h,'fichinter_admin','remove');
complete_head_from_modules($conf,$langs,null,$head,$h,'fichinter_admin','remove');
return $head;
}

View File

@ -39,16 +39,16 @@ function dol_basename($pathfile)
* Scan a directory and return a list of files/directories.
* Content for string is UTF8 and dir separator is "/".
*
* @param string $path Starting path from which to search
* @param string $types Can be "directories", "files", or "all"
* @param int $recursive Determines whether subdirectories are searched
* @param string $filter Regex filter to restrict list. This regex value must be escaped for '/', since this char is used for preg_match function
* @param string $excludefilter Array of Regex for exclude filter (example: array('\.meta$','^\.'))
* @param string $sortcriteria Sort criteria ("","fullname","name","date","size")
* @param string $sortorder Sort order (SORT_ASC, SORT_DESC)
* @param int $mode 0=Return array minimum keys loaded (faster), 1=Force all keys like date and size to be loaded (slower), 2=Force load of date only, 3=Force load of size only
* @param int $nohook Disable all hooks
* @return array Array of array('name'=>'xxx','fullname'=>'/abc/xxx','date'=>'yyy','size'=>99,'type'=>'dir|file')
* @param string $path Starting path from which to search
* @param string $types Can be "directories", "files", or "all"
* @param int $recursive Determines whether subdirectories are searched
* @param string $filter Regex filter to restrict list. This regex value must be escaped for '/', since this char is used for preg_match function
* @param string[] $excludefilter Array of Regex for exclude filter (example: array('\.meta$','^\.'))
* @param string $sortcriteria Sort criteria ("","fullname","name","date","size")
* @param string $sortorder Sort order (SORT_ASC, SORT_DESC)
* @param int $mode 0=Return array minimum keys loaded (faster), 1=Force all keys like date and size to be loaded (slower), 2=Force load of date only, 3=Force load of size only
* @param int $nohook Disable all hooks
* @return array Array of array('name'=>'xxx','fullname'=>'/abc/xxx','date'=>'yyy','size'=>99,'type'=>'dir|file')
*/
function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter="", $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=false)
{
@ -879,7 +879,7 @@ function dol_delete_preview($object)
{
if ( ! dol_delete_file($file,1) )
{
$this->error=$langs->trans("ErrorFailedToOpenFile",$file);
$object->error=$langs->trans("ErrorFailedToOpenFile",$file);
return 0;
}
}
@ -893,7 +893,7 @@ function dol_delete_preview($object)
{
if ( ! dol_delete_file($preview,1) )
{
$this->error=$langs->trans("ErrorFailedToOpenFile",$preview);
$object->error=$langs->trans("ErrorFailedToOpenFile",$preview);
return 0;
}
}
@ -1279,11 +1279,11 @@ function dol_uncompress($inputfile,$outputdir)
/**
* Return file(s) into a directory (by default most recent)
*
* @param string $dir Directory to scan
* @param string $regexfilter Regex filter to restrict list. This regex value must be escaped for '/', since this char is used for preg_match function
* @param string $excludefilter Array of Regex for exclude filter (example: array('\.meta$','^\.')). This regex value must be escaped for '/', since this char is used for preg_match function
* @param int $nohook Disable all hooks
* @return string Full path to most recent file
* @param string $dir Directory to scan
* @param string $regexfilter Regex filter to restrict list. This regex value must be escaped for '/', since this char is used for preg_match function
* @param string[] $excludefilter Array of Regex for exclude filter (example: array('\.meta$','^\.')). This regex value must be escaped for '/', since this char is used for preg_match function
* @param int $nohook Disable all hooks
* @return string Full path to most recent file
*/
function dol_most_recent_file($dir,$regexfilter='',$excludefilter=array('\.meta$','^\.'),$nohook=false)
{
@ -1755,7 +1755,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
{
$accessallowed=1;
$dir='files';
if ($type == 'application/x-bittorrent') $dir='torrents';
if (dol_mimetype($original_file) == 'application/x-bittorrent') $dir='torrents';
$original_file=$conf->bittorrent->dir_output.'/'.$dir.'/'.$original_file;
}

View File

@ -174,7 +174,7 @@ function dol_shutdown()
* @param string $paramname Name of parameter to found
* @param string $check Type of check (''=no check, 'int'=check it's numeric, 'alpha'=check it's text and sign, 'az'=check it's a-z only, 'array'=check it's array)
* @param int $method Type of method (0 = get then post, 1 = only get, 2 = only post, 3 = post then get, 4 = post then get then cookie)
* @return string Value found, or '' if check fails
* @return string||string[] Value found, or '' if check fails
*/
function GETPOST($paramname,$check='',$method=0)
{
@ -581,7 +581,7 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename='
* @param array $links Array of tabs
* @param string $active Active tab name (document', 'info', 'ldap', ....)
* @param string $title Title
* @param int $notab 0=Add tab header, 1=no tab header
* @param int $notab 0=Add tab header, 1=no tab header. If you set this to 1, using dol_fiche_end() to close tab is not required.
* @param string $picto Add a picto on tab title
* @param int $pictoisfullpath If 1, image path is a full path. If you set this to 1, you can use url returned by dol_buildpath('/mymodyle/img/myimg.png',1) for $picto.
* @return void
@ -597,7 +597,7 @@ function dol_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto
* @param array $links Array of tabs
* @param int $active Active tab name
* @param string $title Title
* @param int $notab 0=Add tab header, 1=no tab header
* @param int $notab 0=Add tab header, 1=no tab header. If you set this to 1, using dol_fiche_end() to close tab is not required.
* @param string $picto Add a picto on tab title
* @param int $pictoisfullpath If 1, image path is a full path. If you set this to 1, you can use url returned by dol_buildpath('/mymodyle/img/myimg.png',1) for $picto.
* @return void
@ -715,6 +715,8 @@ function dol_bc($var,$moreclass='')
*/
function dol_format_address($object,$withcountry=0,$sep="\n")
{
global $conf;
$ret='';
$countriesusingstate=array('AU','US','IN','GB','ES','UK','TR');
@ -1428,7 +1430,7 @@ function dol_print_address($address, $htmlid, $mode, $id)
{
if ($hookmanager) {
$parameters = array('element' => $mode, 'id' => $id);
$reshook = $hookmanager->executeHooks('printAddress', $parameters, $address, $action);
$reshook = $hookmanager->executeHooks('printAddress', $parameters, $address);
print $hookmanager->resPrint;
}
if (empty($reshook)) {
@ -4331,6 +4333,7 @@ function picto_from_langcode($codelang)
* 'group' to add a tab in group view
* 'member' to add a tab in fundation member view
* 'categories_x' to add a tab in category view ('x': type of category (0=product, 1=supplier, 2=customer, 3=member)
* 'ecm' to add a tab for another ecm view
* @param string $mode 'add' to complete head, 'remove' to remove entries
* @return void
*/

View File

@ -1532,3 +1532,126 @@ function dolGetElementUrl($objectid,$objecttype,$withpicto=0,$option='')
}
return $ret;
}
/**
* Clean corrupted tree (orphelins linked to a not existing parent), record linked to themself and child-parent loop
*
* @param DoliDB $db Database handler
* @param string $tabletocleantree Table to clean
* @param string $fieldfkparent Field name that contains id of parent
* @return int Nb of records fixed/deleted
*/
function cleanCorruptedTree($db, $tabletocleantree, $fieldfkparent)
{
$totalnb=0;
$listofid=array();
$listofparentid=array();
// Get list of all id in array listofid and all parents in array listofparentid
$sql='SELECT rowid, '.$fieldfkparent.' as parent_id FROM '.MAIN_DB_PREFIX.$tabletocleantree;
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$obj = $db->fetch_object($resql);
$listofid[]=$obj->rowid;
if ($obj->parent_id > 0) $listofparentid[$obj->rowid]=$obj->parent_id;
$i++;
}
}
else
{
dol_print_error($db);
}
if (count($listofid))
{
print 'Code requested to clean tree (may be to solve data corruption), so we check/clean orphelins and loops.'."<br>\n";
// 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)
{
$nb=$db->affected_rows($sql);
if ($nb > 0)
{
print '<br>Some record that were parent of themself were cleaned.';
}
$totalnb+=$nb;
}
//else dol_print_error($db);
// Check other loops
$listofidtoclean=array();
foreach($listofparentid as $id => $pid)
{
// Check depth
//print 'Analyse record id='.$id.' with parent '.$pid.'<br>';
$cursor=$id; $arrayidparsed=array(); // We start from child $id
while ($cursor > 0)
{
$arrayidparsed[$cursor]=1;
if ($arrayidparsed[$listofparentid[$cursor]]) // We detect a loop. A record with a parent that was already into child
{
print 'Found a loop between id '.$id.' - '.$cursor.'<br>';
unset($arrayidparsed);
$listofidtoclean[$cursor]=$id;
break;
}
$cursor=$listofparentid[$cursor];
}
if (count($listofidtoclean)) break;
}
$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)
{
$nb=$db->affected_rows($sql);
if ($nb > 0)
{
// Removed orphelins records
print '<br>Some records were detected to have parent that is a child, we set them as root record for id: ';
print join(',',$listofidtoclean);
}
$totalnb+=$nb;
}
//else dol_print_error($db);
// Check and clean orphelins
$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)
{
$nb=$db->affected_rows($sql);
if ($nb > 0)
{
// Removed orphelins records
print '<br>Some orphelins were found and modified to be parent so records are visible again for id: ';
print join(',',$listofid);
}
$totalnb+=$nb;
}
//else dol_print_error($db);
print '<br>We fixed '.$totalnb.' record(s). Some records may still be corrupted. New check may be required.';
return $totalnb;
}
}

View File

@ -658,7 +658,7 @@ function moneyMeter($actualValue=0, $pendingValue=0, $intentValue=0)
// actual
$sectionHeight = round(($actualValue / $maximumValue) * $height);
$totalHeight = $totalHeight + $sectionHeight;
$totalHeight = $sectionHeight;
if ( $sectionHeight > 0 )
{
$section = $formSection;
@ -669,7 +669,7 @@ function moneyMeter($actualValue=0, $pendingValue=0, $intentValue=0)
// pending
$sectionHeight = round(($pendingValue / $maximumValue) * $height);
$totalHeight = $totalHeight + $sectionHeight;
$totalHeight += $sectionHeight;
if ( $sectionHeight > 0 )
{
$section = $formSection;
@ -680,7 +680,7 @@ function moneyMeter($actualValue=0, $pendingValue=0, $intentValue=0)
// intent
$sectionHeight = round(($intentValue / $maximumValue) * $height);
$totalHeight = $totalHeight + $sectionHeight;
$totalHeight += $sectionHeight;
if ( $sectionHeight > 0 )
{
$section = $formSection;

View File

@ -490,7 +490,7 @@ function pdf_watermark(&$pdf, $outputlangs, $h, $w, $unit, $text)
* @param Account $account Bank account object
* @param int $onlynumber Output only number
* @param int $default_font_size Default font size
* @return void
* @return float The Y PDF position
*/
function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default_font_size=10)
{
@ -863,7 +863,7 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
* @param float $h Cell minimum height. The cell extends automatically if needed.
* @param int $align Align
* @param string $default_font_size Font size
* @return void
* @return float The Y PDF position
*/
function pdf_writeLinkedObjects(&$pdf,$object,$outputlangs,$posx,$posy,$w,$h,$align,$default_font_size)
{
@ -1186,7 +1186,7 @@ function pdf_getlineref_supplier($object,$i,$outputlangs,$hidedetails=0)
* @param int $i Current line number
* @param Translate $outputlangs Object langs for output
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
* @return void
* @return string
*/
function pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails=0)
{
@ -1213,7 +1213,7 @@ function pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails=0)
* @param int $i Current line number
* @param Translate $outputlangs Object langs for output
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
* @return void
* @return string
*/
function pdf_getlineupexcltax($object,$i,$outputlangs,$hidedetails=0)
{
@ -1271,7 +1271,7 @@ function pdf_getlineupwithtax($object,$i,$outputlangs,$hidedetails=0)
* @param int $i Current line number
* @param Translate $outputlangs Object langs for output
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
* @return void
* @return string
*/
function pdf_getlineqty($object,$i,$outputlangs,$hidedetails=0)
{
@ -1301,7 +1301,7 @@ function pdf_getlineqty($object,$i,$outputlangs,$hidedetails=0)
* @param int $i Current line number
* @param Translate $outputlangs Object langs for output
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
* @return void
* @return string
*/
function pdf_getlineqty_asked($object,$i,$outputlangs,$hidedetails=0)
{
@ -1331,7 +1331,7 @@ function pdf_getlineqty_asked($object,$i,$outputlangs,$hidedetails=0)
* @param int $i Current line number
* @param Translate $outputlangs Object langs for output
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
* @return void
* @return string
*/
function pdf_getlineqty_shipped($object,$i,$outputlangs,$hidedetails=0)
{
@ -1391,7 +1391,7 @@ function pdf_getlineqty_keeptoship($object,$i,$outputlangs,$hidedetails=0)
* @param int $i Current line number
* @param Translate $outputlangs Object langs for output
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
* @return void
* @return string
*/
function pdf_getlineremisepercent($object,$i,$outputlangs,$hidedetails=0)
{

View File

@ -45,7 +45,7 @@
* @param string $price_base_type HT=on calcule sur le HT, TTC=on calcule sur le TTC
* @param int $info_bits Miscellaneous informations on line
* @param int $type 0/1=Product/service
* @param string $seller Thirdparty seller (we need $seller->country_id property). Provided only if seller is the supplier, otherwise $seller will be $mysoc.
* @param Societe $seller Thirdparty seller (we need $seller->country_id property). Provided only if seller is the supplier, otherwise $seller will be $mysoc.
* @param array $localtaxes_array Array with localtaxes info (loaded by getLocalTaxesFromRate function).
* @return result[ 0=total_ht,
* 1=total_vat,

View File

@ -179,7 +179,7 @@ function project_admin_prepare_head()
$head[$h][2] = 'project';
$h++;
complete_head_from_modules($conf,$langs,$object,$head,$h,'project_admin');
complete_head_from_modules($conf,$langs,null,$head,$h,'project_admin');
$head[$h][0] = DOL_URL_ROOT."/projet/admin/project_extrafields.php";
$head[$h][1] = $langs->trans("ExtraFieldsProject");
@ -191,7 +191,7 @@ function project_admin_prepare_head()
$head[$h][2] = 'attributes_task';
$h++;
complete_head_from_modules($conf,$langs,$object,$head,$h,'project_admin','remove');
complete_head_from_modules($conf,$langs,null,$head,$h,'project_admin','remove');
return $head;
}

View File

@ -179,9 +179,9 @@ function user_admin_prepare_head()
// 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,'useradmin');
complete_head_from_modules($conf,$langs,null,$head,$h,'useradmin');
complete_head_from_modules($conf,$langs,$object,$head,$h,'useradmin','remove');
complete_head_from_modules($conf,$langs,null,$head,$h,'useradmin','remove');
return $head;
}

View File

@ -73,7 +73,7 @@ function check_user_password_ldap($usertotest,$passwordtotest,$entitytotest)
require_once DOL_DOCUMENT_ROOT.'/core/class/ldap.class.php';
$ldap=new Ldap();
$ldap->server=array($ldaphost);
$ldap->server=explode(',',$ldaphost);
$ldap->serverPort=$ldapport;
$ldap->ldapProtocolVersion=$ldapversion;
$ldap->serverType=$ldapservertype;
@ -140,7 +140,7 @@ function check_user_password_ldap($usertotest,$passwordtotest,$entitytotest)
$result=$ldap->connect_bind();
if ($result > 0)
{
if ($result == 2)
if ($result == 2) // Connection is ok for user/pass into LDAP
{
dol_syslog("functions_ldap::check_user_password_ldap Authentification ok");
$login=$usertotest;
@ -168,22 +168,22 @@ function check_user_password_ldap($usertotest,$passwordtotest,$entitytotest)
{
dol_syslog("functions_ldap::check_user_password_ldap Sync user found id=".$user->id);
// On verifie si le login a change et on met a jour les attributs dolibarr
if ($conf->multicompany->enabled) {
global $mc;
global $mc;
$ret=$mc->checkRight($user->id, $entitytotest);
if ($ret < 0) $login=false; // provoque l'echec de l'identification
}
if ($user->login != $ldap->login && $ldap->login)
{
$user->login = $ldap->login;
$user->update($user);
// TODO Que faire si update echoue car on update avec un login deja existant.
}
//$resultUpdate = $user->update_ldap2dolibarr($ldap);
}
}
@ -212,12 +212,13 @@ function check_user_password_ldap($usertotest,$passwordtotest,$entitytotest)
{
$ldap->ldapErrorCode = ldap_errno($ldap->connection);
$ldap->ldapErrorText = ldap_error($ldap->connection);
dol_syslog("functions_ldap::check_user_password_ldap ".$ldap->ldapErrorText);
dol_syslog("functions_ldap::check_user_password_ldap ".$ldap->ldapErrorCode." ".$ldap->ldapErrorText);
}
sleep(1);
$langs->load('main');
$langs->load('other');
$_SESSION["dol_loginmesg"]=$langs->trans("ErrorBadLoginPassword");
$langs->load('errors');
$_SESSION["dol_loginmesg"]=($ldap->error?$ldap->error:$langs->trans("ErrorBadLoginPassword"));
}
$ldap->close();

View File

@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php';
* @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
* @param array &$menu Object Menu to return back list of menu entries
* @param int $noout Disable output (Initialise &$menu only).
* @return void
* @return int 0
*/
function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0)
{
@ -97,6 +97,8 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0)
if (empty($noout)) print_end_menu_array_auguria();
print "\n";
return 0;
}
@ -202,11 +204,11 @@ function print_end_menu_array_auguria()
* @param array $menu_array_before Table of menu entries to show before entries of menu handler
* @param array $menu_array_after Table of menu entries to show after entries of menu handler
* @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
* @param array &$menu Object Menu to return back list of menu entries
* @param Menu &$menu Object Menu to return back list of menu entries
* @param int $noout Disable output (Initialise &$menu only).
* @param string $forcemainmenu 'x'=Force mainmenu to mainmenu='x'
* @param string $forceleftmenu 'all'=Force leftmenu to '' (= all)
* @return void
* @return int Nb of entries
*/
function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabMenu,&$menu,$noout=0,$forcemainmenu='',$forceleftmenu='')
{

View File

@ -158,7 +158,7 @@ class MenuManager
* Show menu
*
* @param string $mode 'top', 'left', 'jmobile'
* @return int Number of menu entries shown
* @return void
*/
function showmenu($mode)
{
@ -172,16 +172,14 @@ class MenuManager
$conf->global->MAIN_SEARCHFORM_CONTACT=0;
}
$res='ErrorBadParameterForMode';
require_once DOL_DOCUMENT_ROOT.'/core/class/menu.class.php';
$this->menu=new Menu();
if ($mode == 'top') $res=print_auguria_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,0);
if ($mode == 'left') $res=print_left_auguria_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$this->menu,0);
if ($mode == 'top') print_auguria_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,0);
if ($mode == 'left') print_left_auguria_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$this->menu,0);
if ($mode == 'jmobile')
{
$res=print_auguria_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,1);
print_auguria_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,1);
print '<!-- Generate menu list from menu handler '.$this->name.' -->'."\n";
foreach($this->menu->liste as $key => $val) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'
@ -199,7 +197,7 @@ class MenuManager
$tmpmainmenu=$val['mainmenu'];
$tmpleftmenu='all';
$submenu=new Menu();
$res=print_left_auguria_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$submenu,1,$tmpmainmenu,$tmpleftmenu);
print_left_auguria_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$submenu,1,$tmpmainmenu,$tmpleftmenu);
$nexturl=dol_buildpath($submenu->liste[0]['url'],1);
$canonrelurl=preg_replace('/\?.*$/','',$relurl);
@ -248,8 +246,6 @@ class MenuManager
}
unset($this->menu);
return $res;
}
}

View File

@ -30,12 +30,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php';
* Core function to output top menu eldy
*
* @param DoliDB $db Database handler
* @param string $atarget Target
* @param string $atarget Target (Example: '' or '_top')
* @param int $type_user 0=Menu for backoffice, 1=Menu for front office
* @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
* @param array &$menu Object Menu to return back list of menu entries
* @param int $noout Disable output (Initialise &$menu only).
* @return void
* @return int 0
*/
function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0)
{
@ -322,6 +322,8 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0)
if (empty($noout)) print_end_menu_entry($showmode);
if (empty($noout)) print_end_menu_array();
return 0;
}
@ -427,11 +429,11 @@ function print_end_menu_array()
* @param array $menu_array_before Table of menu entries to show before entries of menu handler (menu->liste filled with menu->add)
* @param array $menu_array_after Table of menu entries to show after entries of menu handler (menu->liste filled with menu->add)
* @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
* @param array &$menu Object Menu to return back list of menu entries
* @param Menu &$menu Object Menu to return back list of menu entries
* @param int $noout Disable output (Initialise &$menu only).
* @param string $forcemainmenu 'x'=Force mainmenu to mainmenu='x'
* @param string $forceleftmenu 'all'=Force leftmenu to '' (= all)
* @return void
* @return int nb of menu entries
*/
function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu,&$menu,$noout=0,$forcemainmenu='',$forceleftmenu='')
{
@ -443,7 +445,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$leftmenu=($forceleftmenu?'':(empty($_SESSION["leftmenu"])?'none':$_SESSION["leftmenu"]));
// Show logo company
if (empty($noout) && ! empty($conf->global->MAIN_SHOW_LOGO))
if (empty($conf->global->MAIN_MENU_INVERT) && empty($noout) && ! empty($conf->global->MAIN_SHOW_LOGO))
{
$mysoc->logo_mini=$conf->global->MAIN_INFO_SOCIETE_LOGO_MINI;
if (! empty($mysoc->logo_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini))
@ -1253,6 +1255,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
if (! is_array($menu_array)) return 0;
// Show menu
$invert=empty($conf->global->MAIN_MENU_INVERT)?"":"invert";
if (empty($noout))
{
$alt=0; $blockvmenuopened=false;
@ -1268,11 +1271,11 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$blockvmenuopened=true;
if (($alt%2==0))
{
print '<div class="blockvmenuimpair">'."\n";
print '<div class="blockvmenuimpair'.$invert.'">'."\n";
}
else
{
print '<div class="blockvmenupair">'."\n";
print '<div class="blockvmenupair'.$invert.'">'."\n";
}
}

View File

@ -112,7 +112,7 @@ class MenuManager
* Show menu
*
* @param string $mode 'top', 'left', 'jmobile'
* @return int Number of menu entries shown
* @return void
*/
function showmenu($mode)
{
@ -126,16 +126,24 @@ class MenuManager
$conf->global->MAIN_SEARCHFORM_CONTACT=0;
}
$res='ErrorBadParameterForMode';
require_once DOL_DOCUMENT_ROOT.'/core/class/menu.class.php';
$this->menu=new Menu();
if ($mode == 'top') $res=print_eldy_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,0);
if ($mode == 'left') $res=print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$this->menu,0);
if (empty($conf->global->MAIN_MENU_INVERT))
{
if ($mode == 'top') print_eldy_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,0);
if ($mode == 'left') print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$this->menu,0);
}
else
{
$conf->global->MAIN_SHOW_LOGO=0;
if ($mode == 'top') print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$this->menu,0);
if ($mode == 'left') print_eldy_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,0);
}
if ($mode == 'jmobile')
{
$res=print_eldy_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,1);
print_eldy_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,1);
print '<!-- Generate menu list from menu handler '.$this->name.' -->'."\n";
foreach($this->menu->liste as $key => $val) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'
@ -153,7 +161,7 @@ class MenuManager
$tmpmainmenu=$val['mainmenu'];
$tmpleftmenu='all';
$submenu=new Menu();
$res=print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$submenu,1,$tmpmainmenu,$tmpleftmenu);
print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$submenu,1,$tmpmainmenu,$tmpleftmenu);
$nexturl=dol_buildpath($submenu->liste[0]['url'],1);
$canonrelurl=preg_replace('/\?.*$/','',$relurl);
@ -167,7 +175,7 @@ class MenuManager
// We add sub entry
print str_pad('',1).'<li data-role="list-dividerxxx" class="lilevel1 ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic
print '<a href="'.$relurl.'"';
//print ' data-ajax="false"';
//print ' data-ajax="false"';
print '>';
print str_pad('',12,'&nbsp;');
if ($langs->trans(ucfirst($val['mainmenu'])."Dashboard") == ucfirst($val['mainmenu'])."Dashboard") print $langs->trans("Access"); // No translation
@ -185,10 +193,10 @@ class MenuManager
if (in_array($canonurl2,array('/admin/index.php','/admin/tools/index.php','/core/tools.php'))) $relurl2='';
if ($val2['level']==0) print str_pad('',$val2['level']+1).'<li'.($val2['level']==0?' data-role="list-dividerxxx"':'').' class="lilevel'.($val2['level']+1).' ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic
else print str_pad('',$val2['level']+1).'<li class="lilevel'.($val2['level']+1).'">'; // ui-btn to highlight on clic
if ($relurl2)
if ($relurl2)
{
print '<a href="'.$relurl2.'"';
//print ' data-ajax="false"';
//print ' data-ajax="false"';
print '>';
}
print str_pad('',($val2['level']+1)*12,'&nbsp;');
@ -211,7 +219,6 @@ class MenuManager
unset($this->menu);
//print 'xx'.$mode;
return $res;
}
}

View File

@ -300,7 +300,7 @@ function print_start_menu_entry_empty($idsel,$classname,$showmode)
*/
function print_text_menu_entry_empty($text, $showmode, $url, $id, $idsel, $classname, $atarget)
{
global $conf;
global $conf,$langs;
if ($showmode == 1)
{

View File

@ -165,6 +165,8 @@ class CommActionRapport
*/
function _pages(&$pdf, $outputlangs)
{
global $conf;
$height=3; // height for text separation
$pagenb=1;

View File

@ -62,7 +62,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
/** Return description of module
*
* @param string $langs Object langs
* @param Translate $langs Object langs
* @return string Description of module
*/
function info($langs)
@ -104,7 +104,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
* Return an example of result returned by getNextValue
*
* @param Translate $langs Object langs
* @param product $objproduct Object product
* @param Product $objproduct Object product
* @return string Return string example
*/
function getExample($langs,$objproduct=0)

View File

@ -66,7 +66,7 @@ class mod_commande_marbre extends ModeleNumRefCommandes
*/
function canBeActivated()
{
global $conf,$langs;
global $conf,$langs,$db;
$coyymm=''; $max='';

View File

@ -237,7 +237,7 @@ function commande_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($db);
$result=$interface->run_triggers('ORDER_BUILDDOC',$object,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
if ($result < 0) { $error++; $obj->errors=$interface->errors; }
// Fin appel triggers
return 1;

View File

@ -96,13 +96,13 @@ class pdf_strato extends ModelePDFContract
/**
* Function to build pdf onto disk
*
* @param int $object Id of object to generate
* @param object $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @return int 1=OK, 0=KO
* @param CommonObject $object Id of object to generate
* @param object $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @return int 1=OK, 0=KO
*/
function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0)
{
@ -253,6 +253,7 @@ class pdf_strato extends ModelePDFContract
$valide = $objectligne->id ? $objectligne->fetch($objectligne->id) : 0;
if ($valide > 0 || $object->specimen)
{
$curX = $this->posxdesc-1;
$curY = $nexY;
$pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage
$pdf->SetTextColor(0,0,0);

View File

@ -64,7 +64,7 @@ class mod_contract_serpis extends ModelNumRefContracts
*/
function canBeActivated()
{
global $conf,$langs;
global $conf,$langs,$db;
$coyymm=''; $max='';

View File

@ -231,7 +231,7 @@ function contract_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($db);
$result=$interface->run_triggers('CONTRACT_BUILDDOC',$object,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
if ($result < 0) { $error++; $obj->errors=$interface->errors; }
// Fin appel triggers
return 1;

View File

@ -147,9 +147,12 @@ abstract class ModeleNumRefDons
* @param string $message Message
* @param string $modele Force le modele a utiliser ('' par defaut)
* @param Translate $outputlangs Object langs
* @param int $hidedetails Hide details of lines
* @param int $hidedesc Hide description
* @param int $hideref Hide ref
* @return int 0 if KO, 1 if OK
*/
function don_create($db, $id, $message, $modele, $outputlangs)
function don_create($db, $id, $message, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
{
global $conf, $langs;
$langs->load("bills");
@ -241,7 +244,7 @@ function don_create($db, $id, $message, $modele, $outputlangs)
}
else
{
print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$dir.$file);
print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file);
return 0;
}
}

View File

@ -431,7 +431,7 @@ class pdf_merou extends ModelePdfExpedition
*/
function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
global $conf, $langs;
global $conf, $langs,$hookmanager;
$default_font_size = pdf_getPDFFontSize($outputlangs);

View File

@ -64,7 +64,7 @@ class mod_expedition_safor extends ModelNumRefExpedition
*/
function canBeActivated()
{
global $conf,$langs;
global $conf,$langs,$db;
$coyymm=''; $max='';

View File

@ -227,7 +227,7 @@ function expedition_pdf_create($db, $object, $modele, $outputlangs)
$interface=new Interfaces($db);
$result=$interface->run_triggers('SHIPPING_BUILDDOC',$object,$user,$langs,$conf);
if ($result < 0) {
$error++; $this->errors=$interface->errors;
$error++; $obj->errors=$interface->errors;
}
// End calls triggers
@ -254,4 +254,4 @@ function expedition_pdf_create($db, $object, $modele, $outputlangs)
return 0;
}
}
?>
?>

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