diff --git a/ChangeLog b/ChangeLog
index 09f19a0890d..fc8b21bc25a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,7 @@ English Dolibarr ChangeLog
***** ChangeLog for 3.2 compared to 3.1 *****
For users:
+- New: show thirdparty barcode on main tab.
- New: Can input note (private and public) during note and expenses creation.
- New: Print ticket show invoice ref into POS module.
- New: Can edit customer discounts from invoice create and edit card.
diff --git a/dev/xdebug/README b/dev/xdebug/README
index cdae9809da0..e0be86d083f 100644
--- a/dev/xdebug/README
+++ b/dev/xdebug/README
@@ -1,4 +1,19 @@
README (English)
--------------------------------
This directory contains information to know how to setup XDebug in Eclipse for
-running PHP scripts with XDebug.
\ No newline at end of file
+running PHP scripts with XDebug.
+
+To setup your PHP, you must add something like this into your php.ini:
+
+zend_extension=/usr/lib/php5/20090626+lfs/xdebug.so
+xdebug.remote_enable=off
+xdebug.remote_handle=dbgp
+xdebug.remote_host=localhost
+xdebug.remote_port=9000
+xdebug.profiler_enable=0
+xdebug.profiler_enable_trigger=1;
+xdebug.show_local_vars=off
+xdebug.profiler_output_dir=/var/tmp
+xdebug.profiler_append=0
+
+Then xdebug profiling can be enabled by adding XDEBUG_PROFILE=1 on URL.
\ No newline at end of file
diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php
index 41da98b8ac9..6d0e2278485 100644
--- a/htdocs/admin/company.php
+++ b/htdocs/admin/company.php
@@ -66,7 +66,7 @@ if ( (isset($_POST["action"]) && $_POST["action"] == 'update' && empty($_POST["c
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MAIL",$_POST["mail"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_WEB",$_POST["web"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOTE",$_POST["note"],'chaine',0,'',$conf->entity);
- dolibarr_set_const($db, "MAIN_INFO_SOCIETE_GENCOD",$_POST["gencod"],'chaine',0,'',$conf->entity);
+ dolibarr_set_const($db, "MAIN_INFO_SOCIETE_GENCOD",$_POST["barcode"],'chaine',0,'',$conf->entity);
if ($_FILES["logo"]["tmp_name"])
{
if (preg_match('/([^\\/:]+)$/i',$_FILES["logo"]["name"],$reg))
@@ -346,7 +346,7 @@ if ((isset($_GET["action"]) && $_GET["action"] == 'edit')
{
$var=!$var;
print '
';
}
// Address
diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php
index e6e62350ec3..24209a51fdc 100644
--- a/htdocs/comm/action/class/actioncomm.class.php
+++ b/htdocs/comm/action/class/actioncomm.class.php
@@ -3,17 +3,17 @@
* Copyright (C) 2004-2011 Laurent Destailleur
* Copyright (C) 2005-2011 Regis Houssin
* Copyright (C) 2011 Juanjo Menent
- *
+ *
* 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 2 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 .
*/
@@ -133,7 +133,7 @@ class ActionComm extends CommonObject
}
else if ($result == 0)
{
- $this->error='Failed to get record with code AC_OTH from dictionnary "type of events"';
+ $this->error='Failed to get record with code '.$this->type_code.' from dictionnary "type of events"';
return -1;
}
else
@@ -864,17 +864,17 @@ class ActionComm extends CommonObject
//print $datestart.'x'; exit;
$dateend=$this->db->jdate($obj->datep2);
$duration=$obj->durationp;
- $event['summary']=$langs->convToOutputCharset($obj->label.($obj->socname?" (".$obj->socname.")":""));
- $event['desc']=$langs->convToOutputCharset($obj->note);
+ $event['summary']=$obj->label.($obj->socname?" (".$obj->socname.")":"");
+ $event['desc']=$obj->note;
$event['startdate']=$datestart;
$event['duration']=$duration; // Not required with type 'journal'
$event['enddate']=$dateend; // Not required with type 'journal'
$event['author']=$obj->firstname.($obj->name?" ".$obj->name:"");
$event['priority']=$obj->priority;
$event['fulldayevent']=$obj->fulldayevent;
- $event['location']=$langs->convToOutputCharset($obj->location);
+ $event['location']=$obj->location;
$event['transparency']='TRANSPARENT'; // OPAQUE (busy) or TRANSPARENT (not busy)
- $event['category']=$langs->convToOutputCharset($obj->libelle); // libelle type action
+ $event['category']=$obj->libelle; // libelle type action
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',$dolibarr_main_url_root);
$url=$urlwithouturlroot.DOL_URL_ROOT.'/comm/action/fiche.php?id='.$obj->id;
$event['url']=$url;
@@ -898,21 +898,21 @@ class ActionComm extends CommonObject
// Define title and desc
$more='';
- if ($login) $more=$langs->transnoentities("User").' '.$langs->convToOutputCharset($login);
- if ($logina) $more=$langs->transnoentities("ActionsAskedBy").' '.$langs->convToOutputCharset($logina);
- if ($logint) $more=$langs->transnoentities("ActionsToDoBy").' '.$langs->convToOutputCharset($logint);
- if ($logind) $more=$langs->transnoentities("ActionsDoneBy").' '.$langs->convToOutputCharset($logind);
+ if ($login) $more=$langs->transnoentities("User").' '.$login;
+ if ($logina) $more=$langs->transnoentities("ActionsAskedBy").' '.$logina;
+ if ($logint) $more=$langs->transnoentities("ActionsToDoBy").' '.$logint;
+ if ($logind) $more=$langs->transnoentities("ActionsDoneBy").' '.$logind;
if ($more)
{
- $title=$langs->convToOutputCharset('Dolibarr actions '.$mysoc->name).' - '.$more;
+ $title='Dolibarr actions '.$mysoc->name.' - '.$more;
$desc=$more;
- $desc.=$langs->convToOutputCharset(' ('.$mysoc->name.' - built by Dolibarr)');
+ $desc.=' ('.$mysoc->name.' - built by Dolibarr)';
}
else
{
- $title=$langs->convToOutputCharset('Dolibarr actions '.$mysoc->name);
+ $title='Dolibarr actions '.$mysoc->name;
$desc=$langs->transnoentities('ListOfActions');
- $desc.=$langs->convToOutputCharset(' ('.$mysoc->name.' - built by Dolibarr)');
+ $desc.=' ('.$mysoc->name.' - built by Dolibarr)';
}
// Create temp file
diff --git a/htdocs/comm/address.php b/htdocs/comm/address.php
index c05429e4536..99a632263b6 100644
--- a/htdocs/comm/address.php
+++ b/htdocs/comm/address.php
@@ -214,7 +214,7 @@ if ($_GET["action"] == 'create' || $_POST["action"] == 'create')
$address->pays = $obj->libelle;
}
- print_titre($langs->trans("NewAddress"));
+ print_titre($langs->trans("AddAddress"));
print " \n";
if ($address->error)
@@ -258,7 +258,7 @@ if ($_GET["action"] == 'create' || $_POST["action"] == 'create')
print '
';
- print '
'.$langs->trans('AddressLabel').'
';
+ print '
'.$langs->trans('Label').'
';
print '
'.$langs->trans('Name').'
';
print '
'.$langs->trans('Address').'
';
- print '
';
- print '
'."\n";
-
print '
'."\n";
+
+ print '
';
+ print '
'."\n";
+
print ''."\n";
}
@@ -411,7 +412,7 @@ else
* Fiche societe en mode visu
*/
$address = new Address($db);
- $result=$address->fetch($socid);
+ $result=$address->fetch_lines($socid);
if ($result < 0)
{
dol_print_error($db,$address->error);
diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php
index 0d88a1a9840..2f83f113c16 100644
--- a/htdocs/comm/propal.php
+++ b/htdocs/comm/propal.php
@@ -1260,7 +1260,7 @@ if ($id > 0 || ! empty($ref))
print '
';
if ($action == 'classify')
diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php
index 6b3337c4625..e83256cddec 100644
--- a/htdocs/core/class/CMailFile.class.php
+++ b/htdocs/core/class/CMailFile.class.php
@@ -81,19 +81,19 @@ class CMailFile
/**
* CMailFile
*
- * @param subject Topic/Subject of mail
- * @param to Recipients emails (RFC 2822: "Nom prenom [, ...]" ou "email[, ...]" ou "[, ...]")
- * @param from Sender email (RFC 2822: "Nom prenom [, ...]" ou "email[, ...]" ou "[, ...]")
- * @param msg Message
- * @param filename_list List of files to attach (full path of filename on file system)
- * @param mimetype_list List of MIME type of attached files
- * @param mimefilename_list List of attached file name in message
- * @param addr_cc Email cc
- * @param addr_bcc Email bcc
- * @param deliveryreceipt Ask a delivery receipt
- * @param msgishtml 1=String IS already html, 0=String IS NOT html, -1=Unknown need autodetection
- * @param errors_to Email errors
- * @param css Css option
+ * @param string $subject Topic/Subject of mail
+ * @param string $to Recipients emails (RFC 2822: "Nom prenom [, ...]" ou "email[, ...]" ou "[, ...]")
+ * @param string $from Sender email (RFC 2822: "Nom prenom [, ...]" ou "email[, ...]" ou "[, ...]")
+ * @param string $msg Message
+ * @param array $filename_list List of files to attach (full path of filename on file system)
+ * @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
*/
function CMailFile($subject,$to,$from,$msg,
$filename_list=array(),$mimetype_list=array(),$mimefilename_list=array(),
@@ -524,8 +524,8 @@ class CMailFile
/**
* Correct an uncomplete html string
*
- * @param $msg
- * @return
+ * @param string $msg String
+ * @return string Completed string
*/
function checkIfHTML($msg)
{
@@ -615,9 +615,9 @@ class CMailFile
/**
* Create header MIME (mode = 'mail')
*
- * @param filename_list
- * @param mimefilename_list
- * @return mime headers
+ * @param array $filename_list Array of filenames
+ * @param array $mimefilename_list Array of mime types
+ * @return array mime headers
*/
function write_mimeheaders($filename_list, $mimefilename_list)
{
@@ -644,7 +644,8 @@ class CMailFile
/**
* Return email content (mode = 'mail')
*
- * @param msgtext
+ * @param string $msgtext Message string
+ * @return string String content
*/
function write_body($msgtext)
{
@@ -675,7 +676,7 @@ class CMailFile
}
// Make RFC821 Compliant, replace bare linefeeds
- $strContent = preg_replace("/(?error = 'Error '.$errno.' - '.$errstr;
+ $this->error = utf8_check('Error '.$errno.' - '.$errstr)?'Error '.$errno.' - '.$errstr:utf8_encode('Error '.$errno.' - '.$errstr);
}
}
return $_retVal;
@@ -823,9 +826,9 @@ class CMailFile
* This function has been modified as provided by SirSir to allow multiline responses when
* using SMTP Extensions.
*
- * @param socket
- * @param response
- * @return boolean
+ * @param Socket $socket Socket
+ * @param string $response Response string
+ * @return boolean true if success
*/
function server_parse($socket, $response)
{
@@ -853,8 +856,8 @@ class CMailFile
/**
* Seearch images into html message and init array this->images_encoded if found
*
- * @param images_dir Location of physical images files
- * @return int >0 if OK, <0 if KO
+ * @param string $images_dir Location of physical images files
+ * @return int >0 if OK, <0 if KO
*/
function findHtmlImages($images_dir)
{
@@ -943,11 +946,11 @@ class CMailFile
/**
* Return an address for SMTP protocol
*
- * @param adresses Example: 'John Doe ' or 'john@doe.com'
- * @param format 0=Auto, 1=emails with <>, 2=emails without <>
- * @param encode 1=Encode name to RFC2822
- * @return string If format 1: '' or 'John Doe '
- * If format 2: 'john@doe.com'
+ * @param string $adresses Example: 'John Doe ' or 'john@doe.com'
+ * @param int $format 0=Auto, 1=emails with <>, 2=emails without <>
+ * @param int $encode 1=Encode name to RFC2822
+ * @return string If format 1: '' or 'John Doe '
+ * If format 2: 'john@doe.com'
*/
function getValidAddress($adresses,$format,$encode='')
{
diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php
index 0a8ae2d18ff..ed49e784dad 100755
--- a/htdocs/core/class/commondocgenerator.class.php
+++ b/htdocs/core/class/commondocgenerator.class.php
@@ -89,7 +89,7 @@ abstract class CommonDocGenerator
'mycompany_web'=>$mysoc->url,
'mycompany_juridicalstatus'=>$mysoc->forme_juridique,
'mycompany_capital'=>$mysoc->capital,
- 'mycompany_barcode'=>$mysoc->gencod,
+ 'mycompany_barcode'=>$mysoc->barcode,
'mycompany_idprof1'=>$mysoc->idprof1,
'mycompany_idprof2'=>$mysoc->idprof2,
'mycompany_idprof3'=>$mysoc->idprof3,
@@ -121,7 +121,7 @@ abstract class CommonDocGenerator
'company_country_code'=>$object->country_code,
'company_country'=>$outputlangs->transnoentitiesnoconv("Country".$object->country_code),
'company_web'=>$object->url,
- 'company_barcode'=>$object->gencod,
+ 'company_barcode'=>$object->barcode,
'company_vatnumber'=>$object->tva_intra,
'company_customercode'=>$object->code_client,
'company_suppliercode'=>$object->code_fournisseur,
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 9af3ec03256..302e3a86286 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -82,7 +82,7 @@ abstract class CommonObject
global $user,$conf,$langs;
$error=0;
-
+
dol_syslog(get_class($this)."::add_contact $fk_socpeople, $type_contact, $source");
// Check parameters
@@ -203,7 +203,7 @@ abstract class CommonObject
global $user,$langs,$conf;
$error=0;
-
+
$sql = "DELETE FROM ".MAIN_DB_PREFIX."element_contact";
$sql.= " WHERE rowid =".$rowid;
@@ -510,6 +510,54 @@ abstract class CommonObject
return $result;
}
+
+ /**
+ * Load data for barcode
+ *
+ * @return int <0 if KO, >=0 if OK
+ */
+ function fetch_barcode()
+ {
+ global $conf;
+
+ dol_syslog(get_class($this).'::fetch_barcode this->element='.$this->element.' this->barcode_type='.$this->barcode_type);
+
+ $idtype=$this->barcode_type;
+ if (! $idtype)
+ {
+ if ($this->element == 'product') $idtype = $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE;
+ else if ($this->element == 'societe') $idtype = $conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY;
+ else dol_print_error('','Call fetch_barcode with barcode_type not defined and cant be guessed');
+ }
+
+ if ($idtype > 0)
+ {
+ if (empty($this->barcode_type) || empty($this->barcode_type_code) || empty($this->barcode_type_label) || empty($this->barcode_type_coder)) // If data not already loaded
+ {
+ $sql = "SELECT rowid, code, libelle as label, coder";
+ $sql.= " FROM ".MAIN_DB_PREFIX."c_barcode_type";
+ $sql.= " WHERE rowid = ".$idtype;
+ dol_syslog(get_class($this).'::fetch_barcode sql='.$sql);
+ $resql = $this->db->query($sql);
+ if ($resql)
+ {
+ $obj = $this->db->fetch_object($resql);
+ $this->barcode_type = $obj->rowid;
+ $this->barcode_type_code = $obj->code;
+ $this->barcode_type_label = $obj->label;
+ $this->barcode_type_coder = $obj->coder;
+ return 1;
+ }
+ else
+ {
+ dol_print_error($this->db);
+ return -1;
+ }
+ }
+ }
+ else return 0;
+ }
+
/**
* Charge le projet d'id $this->fk_project dans this->projet
*
@@ -539,22 +587,6 @@ abstract class CommonObject
return $result;
}
- /**
- * Load delivery adresse id into $this->fk_address
- *
- * @param fk_address Id of address
- * @return int <0 if KO, >0 if OK
- */
- function fetch_address($fk_address)
- {
- $object = new Societe($this->db);
- $result=$object->fetch_address($fk_address);
- $this->deliveryaddress = $object; // TODO obsolete
- $this->adresse = $object; // TODO obsolete
- $this->address = $object;
- return $result;
- }
-
/**
* Read linked origin object
*/
@@ -1699,8 +1731,8 @@ abstract class CommonObject
/**
* Function to check if an object is used by others
*
- * @param id Id of object
- * @return int <0 if KO, 0 if not used, >0 if already used
+ * @param int $id Id of object
+ * @return int <0 if KO, 0 if not used, >0 if already used
*/
function isObjectUsed($id)
{
@@ -1775,8 +1807,7 @@ abstract class CommonObject
/**
- *
- * Enter description here ...
+ * List urls of elemùent
*
* @param unknown_type $objectid
* @param unknown_type $objecttype
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 7953349e9a8..ba5e55398bc 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -1242,7 +1242,7 @@ class Form
}
}
$opt.= '>';
- $opt.= $langs->convToOutputCharset($objp->ref).' - '.$langs->convToOutputCharset(dol_trunc($label,32)).' - ';
+ $opt.= $objp->ref.' - '.dol_trunc($label,32).' - ';
$objRef = $objp->ref;
if ($filterkey && $filterkey != '') $objRef=preg_replace('/('.preg_quote($filterkey).')/i','$1',$objRef,1);
@@ -1365,7 +1365,7 @@ class Form
{
global $langs,$conf;
global $price_level, $status, $finished;
-
+
if ($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)
{
// mode=2 means suppliers products
@@ -1459,9 +1459,9 @@ class Form
$label = $objp->label;
if ($filterkey && $filterkey != '') $label=preg_replace('/('.preg_quote($filterkey).')/i','$1',$label,1);
- $opt.=$langs->convToOutputCharset($objp->ref).' ('.$langs->convToOutputCharset($objp->ref_fourn).') - ';
+ $opt.=$objp->ref.' ('.$objp->ref_fourn.') - ';
$outval.=$objRef.' ('.$objRefFourn.') - ';
- $opt.=$langs->convToOutputCharset(dol_trunc($objp->label,18)).' - ';
+ $opt.=dol_trunc($objp->label,18).' - ';
$outval.=dol_trunc($label,18).' - ';
if ($objp->fprice != '') // Keep != ''
@@ -2230,7 +2230,7 @@ class Form
* @param string $action Action
* @param array $formquestion An array with complementary inputs to add into forms: array(array('label'=> ,'type'=> , ))
* @param string $selectedchoice "" or "no" or "yes"
- * @param int $useajax 0=No, 1=Yes, 2=Yes but submit page with &confirm=no if choice is No
+ * @param int $useajax 0=No, 1=Yes, 2=Yes but submit page with &confirm=no if choice is No, 'xxx'=preoutput confirm box with div id=dialog-confirm-xxx
* @param int $height Force height of box
* @return string 'ajax' if a confirm ajax popup is shown, 'html' if it's an html form
*/
@@ -2313,7 +2313,8 @@ class Form
{
$autoOpen=true;
$dialogconfirm='dialog-confirm';
- if (! is_int($useajax)) {
+ if (! is_int($useajax))
+ {
$button=$useajax;
$useajax=1;
$autoOpen=false;
@@ -2841,14 +2842,15 @@ class Form
}
/**
- * Affiche formulaire de selection de l'adresse
+ * Show form to select addresse
*
- * @param page Page
- * @param selected Id condition pre-selectionne
- * @param htmlname Nom du formulaire select
- * @param origin Origine de l'appel pour pouvoir creer un retour
- * @param originid Id de l'origine
- * @return void
+ * @param page Page
+ * @param selected Id condition pre-selectionne
+ * @param htmlname Nom du formulaire select
+ * @param origin Origine de l'appel pour pouvoir creer un retour
+ * @param originid Id de l'origine
+ * @return void
+ * @deprecated
*/
function form_address($page, $selected='', $socid, $htmlname='address_id', $origin='', $originid='')
{
@@ -3659,13 +3661,39 @@ class Form
}
+ /**
+ * Return HTML code to output a barcode
+ *
+ * @param Object &$object Object containing data to retrieve file name
+ * @param int $width Width of photo
+ * @return string HTML code to output barcode
+ */
+ function showbarcode(&$object,$width=100)
+ {
+ global $conf;
+
+ if (empty($object->barcode)) return '';
+
+ // Complete object if not complete
+ if (empty($object->barcode_type_code) || empty($object->barcode_type_coder))
+ {
+ $object->fetch_barcode();
+ }
+
+ // Barcode image
+ $url=DOL_URL_ROOT.'/viewimage.php?modulepart=barcode&generator='.urlencode($object->barcode_type_coder).'&code='.urlencode($object->barcode).'&encoding='.urlencode($object->barcode_type_code);
+ $out ='';
+ $out.='';
+ return $out;
+ }
+
/**
* Return HTML code to output a photo
*
- * @param modulepart Key to define module concerned ('societe', 'userphoto', 'memberphoto')
- * @param object Object containing data to retrieve file name
- * @param width Width of photo
- * @return string HTML code to output photo
+ * @param string $modulepart Key to define module concerned ('societe', 'userphoto', 'memberphoto')
+ * @param Object $object Object containing data to retrieve file name
+ * @param int $width Width of photo
+ * @return string HTML code to output photo
*/
function showphoto($modulepart,$object,$width=100)
{
diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php
index 1f2483fc91b..862a213ef76 100644
--- a/htdocs/core/class/ldap.class.php
+++ b/htdocs/core/class/ldap.class.php
@@ -1290,12 +1290,13 @@ class Ldap
/**
- * \brief Convert a string into output/memory charset
- * \param str String to convert
- * \param pagecodefrom Page code of src string
- * \return string Converted string
+ * Convert a string into output/memory charset
+ *
+ * @param str String to convert
+ * @param pagecodefrom Page code of src string
+ * @return string Converted string
*/
- function convToOutputCharset($str,$pagecodefrom='UTF-8')
+ private function convToOutputCharset($str,$pagecodefrom='UTF-8')
{
global $conf;
if ($pagecodefrom == 'ISO-8859-1' && $conf->file->character_set_client == 'UTF-8') $str=utf8_encode($str);
@@ -1304,10 +1305,11 @@ class Ldap
}
/**
- * \brief Convert a string from output/memory charset
- * \param str String to convert
- * \param pagecodeto Page code for result string
- * \return string Converted string
+ * Convert a string from output/memory charset
+ *
+ * @param str String to convert
+ * @param pagecodeto Page code for result string
+ * @return string Converted string
*/
function convFromOutputCharset($str,$pagecodeto='UTF-8')
{
@@ -1316,16 +1318,16 @@ class Ldap
if ($pagecodeto == 'UTF-8' && $conf->file->character_set_client == 'ISO-8859-1') $str=utf8_encode($str);
return $str;
}
-
+
/**
- * Return available value of group GID
+ * Return available value of group GID
* @return int gid number
- */
+ */
function getNextGroupGid()
{
global $conf;
-
+
$search='('.$conf->global->LDAP_KEY_GROUPS.'=*)';
$result = $this->search($this->groups,$search);
if($result)
@@ -1337,11 +1339,11 @@ class Ldap
$gids[] = $result[$i]['gidnumber'][0];
}
rsort($gids);
-
+
return $gids[0]+1;
}
-
- return 0;
+
+ return 0;
}
}
diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php
index 626837b3d57..28f97ca8e39 100644
--- a/htdocs/core/class/translate.class.php
+++ b/htdocs/core/class/translate.class.php
@@ -49,8 +49,8 @@ class Translate {
/**
* Constructor
*
- * @param dir Force directory that contains /langs subdirectory (value is sometine '..' like into install/* pages or support/* pages).
- * @param conf Object with Dolibarr configuration
+ * @param string $dir Force directory that contains /langs subdirectory (value is sometine '..' like into install/* pages or support/* pages).
+ * @param Conf $conf Object with Dolibarr configuration
*/
function Translate($dir = "",$conf)
{
@@ -63,7 +63,7 @@ class Translate {
/**
* Set accessor for this->defaultlang
*
- * @param srclang Language to use
+ * @param string $srclang Language to use
*/
function setDefaultLang($srclang='fr_FR')
{
@@ -129,8 +129,8 @@ class Translate {
* Return active language code for current user
* It's an accessor for this->defaultlang
*
- * @param mode 0=Long language code, 1=Short language code
- * @return string Language code used (en_US, en_AU, fr_FR, ...)
+ * @param int $mode 0=Long language code, 1=Short language code
+ * @return string Language code used (en_US, en_AU, fr_FR, ...)
*/
function getDefaultLang($mode=0)
{
@@ -337,8 +337,8 @@ class Translate {
* WARNING: To avoid infinite loop (getLabelFromKey->transnoentities->getTradFromKey), getLabelFromKey must
* not be called with same value than input.
*
- * @param key
- * @return string
+ * @param string $key Key to translate
+ * @return string Translated string
*/
function getTradFromKey($key)
{
@@ -379,13 +379,13 @@ class Translate {
* et si toujours pas trouve, il est retourne tel quel
* Les parametres de cette methode peuvent contenir de balises HTML.
*
- * @param key cle de chaine a traduire
- * @param param1 chaine de param1
- * @param param2 chaine de param2
- * @param param3 chaine de param3
- * @param param4 chaine de param4
- * @param maxsize taille max
- * @return string Chaine traduite et code en HTML
+ * @param string $key Key to translate
+ * @param string $param1 chaine de param1
+ * @param string $param2 chaine de param2
+ * @param string $param3 chaine de param3
+ * @param string $param4 chaine de param4
+ * @param int $maxsize Max length of text
+ * @return string Translated string (encoded into HTML entities and UTF8)
*/
function trans($key, $param1='', $param2='', $param3='', $param4='', $maxsize=0)
{
@@ -400,7 +400,7 @@ class Translate {
// We replace some HTML tags by __xx__ to avoid having them encoded by htmlentities
$str=str_replace(array('<','>','"',),array('__lt__','__gt__','__quot__'),$str);
- $str=$this->convToOutputCharset($str); // Convert string to $this->charset_output
+ //$str=$this->convToOutputCharset($str); // Convert string to $this->charset_output
// Crypt string into HTML
// $str est une chaine stockee en memoire au format $this->charset_output
@@ -412,8 +412,9 @@ class Translate {
}
else // Translation is not available
{
- $str=$this->getTradFromKey($key);
- return $this->convToOutputCharset($str);
+ //$str=$this->getTradFromKey($key);
+ //return $this->convToOutputCharset($str);
+ return $this->getTradFromKey($key);
}
}
@@ -424,25 +425,16 @@ class Translate {
* et si toujours pas trouve, il est retourne tel quel.
* Parameters of this method must not contains any HTML tags.
*
- * @param key key of string to translate
- * @param param1 chaine de param1
- * @param param2 chaine de param2
- * @param param3 chaine de param3
- * @param param4 chaine de param4
- * @return string chaine traduite
+ * @param string $key Key to translate
+ * @param string $param1 chaine de param1
+ * @param string $param2 chaine de param2
+ * @param string $param3 chaine de param3
+ * @param string $param4 chaine de param4
+ * @return string Translated string (encoded into UTF8)
*/
function transnoentities($key, $param1='', $param2='', $param3='', $param4='')
{
- if (! empty($this->tab_translate[$key]))
- {
- // Si la traduction est disponible
- $newstr=sprintf($this->tab_translate[$key],$param1,$param2,$param3,$param4);
- }
- else
- {
- $newstr=$this->getTradFromKey($key);
- }
- return $this->convToOutputCharset($newstr);
+ return $this->convToOutputCharset($this->transnoentitiesnoconv($key, $param1, $param2, $param3, $param4));
}
@@ -453,25 +445,26 @@ class Translate {
* No convert to encoding charset of lang object is done.
* Parameters of this method must not contains any HTML tags.
*
- * @param key key of string to translate
- * @param param1 chaine de param1
- * @param param2 chaine de param1
- * @param param3 chaine de param1
- * @param param4 chaine de param1
- * @return string chaine traduite
+ * @param string $key Key to translate
+ * @param string $param1 chaine de param1
+ * @param string $param2 chaine de param2
+ * @param string $param3 chaine de param3
+ * @param string $param4 chaine de param4
+ * @return string Translated string
*/
function transnoentitiesnoconv($key, $param1='', $param2='', $param3='', $param4='')
{
- if (! empty($this->tab_translate[$key]))
+ if (! empty($this->tab_translate[$key])) // Translation is available
{
- // Si la traduction est disponible
- $newstr=sprintf($this->tab_translate[$key],$param1,$param2,$param3,$param4);
+ $str=$this->tab_translate[$key];
+
+ $str=sprintf($str,$param1,$param2,$param3,$param4);
}
else
{
- $newstr=$this->getTradFromKey($key);
+ $str=$this->getTradFromKey($key);
}
- return $newstr;
+ return $str;
}
@@ -650,7 +643,7 @@ class Translate {
$sql = "SELECT ".$fieldlabel." as label";
$sql.= " FROM ".MAIN_DB_PREFIX.$tablename;
$sql.= " WHERE ".$fieldkey." = '".$key."'";
- dol_syslog('Translate::getLabelFromKey sql='.$sql,LOG_DEBUG);
+ dol_syslog(get_class($this).'::getLabelFromKey sql='.$sql,LOG_DEBUG);
$resql = $db->query($sql);
if ($resql)
{
@@ -664,7 +657,7 @@ class Translate {
else
{
$this->error=$db->lasterror();
- dol_syslog("Translate::getLabelFromKey error=".$this->error,LOG_ERR);
+ dol_syslog(get_class($this).'::getLabelFromKey error='.$this->error,LOG_ERR);
return -1;
}
}
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 2f4793d9df4..e3376356e71 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -199,7 +199,7 @@ function GETPOST($paramname,$check='',$method=0)
if (! empty($check))
{
// Check if numeric
- if ($check == 'int' && ! preg_match('/^[\.,0-9]+$/i',trim($out))) $out='';
+ if ($check == 'int' && ! preg_match('/^[-\.,0-9]+$/i',trim($out))) $out='';
// Check if alpha
//if ($check == 'alpha' && ! preg_match('/^[ =:@#\/\\\(\)\-\._a-z0-9]+$/i',trim($out))) $out='';
// '"' is dangerous because param in url can close the href= or src= and add javascript functions.
@@ -735,34 +735,33 @@ function dolibarr_print_date($time,$format='',$to_gmt=false,$outputlangs='',$enc
/**
* Return a formated address (part address/zip/town/state) according to country rules
*
- * @param outputlangs Output langs object
- * @param object A company or contact object
- * @return string Formated string
+ * @param Object $object A company or contact object
+ * @return string Formated string
*/
-function dol_format_address($outputlangs,$object)
+function dol_format_address($object)
{
$ret='';
$countriesusingstate=array('US','IN');
// Address
- $ret .= $outputlangs->convToOutputCharset($object->address);
+ $ret .= $object->address;
// Zip/Town/State
if (in_array($object->country_code,array('US'))) // US: town, state, zip
{
- $ret .= ($ret ? "\n" : '' ).$outputlangs->convToOutputCharset($object->town);
+ $ret .= ($ret ? "\n" : '' ).$object->town;
if ($object->state && in_array($object->country_code,$countriesusingstate))
{
- $ret.=", ".$outputlangs->convToOutputCharset($object->departement);
+ $ret.=", ".$object->departement;
}
- if ($object->zip) $ret .= ', '.$outputlangs->convToOutputCharset($object->zip);
+ if ($object->zip) $ret .= ', '.$object->zip;
}
else // Other: zip town, state
{
- $ret .= ($ret ? "\n" : '' ).$outputlangs->convToOutputCharset($object->zip);
- $ret .= ' '.$outputlangs->convToOutputCharset($object->town);
+ $ret .= ($ret ? "\n" : '' ).$object->zip;
+ $ret .= ' '.$object->town;
if ($object->state && in_array($object->country_code,$countriesusingstate))
{
- $ret.=", ".$outputlangs->convToOutputCharset($object->state);
+ $ret.=", ".$object->state;
}
}
@@ -1838,11 +1837,11 @@ function img_action($alt = "default", $numaction)
{
global $conf,$langs;
if ($alt=="default") {
- if ($numaction == -1) $alt=$langs->trans("ChangeDoNotContact");
- if ($numaction == 0) $alt=$langs->trans("ChangeNeverContacted");
- if ($numaction == 1) $alt=$langs->trans("ChangeToContact");
- if ($numaction == 2) $alt=$langs->trans("ChangeContactInProcess");
- if ($numaction == 3) $alt=$langs->trans("ChangeContactDone");
+ if ($numaction == -1) $alt=$langs->transnoentitiesnoconv("ChangeDoNotContact");
+ if ($numaction == 0) $alt=$langs->transnoentitiesnoconv("ChangeNeverContacted");
+ if ($numaction == 1) $alt=$langs->transnoentitiesnoconv("ChangeToContact");
+ if ($numaction == 2) $alt=$langs->transnoentitiesnoconv("ChangeContactInProcess");
+ if ($numaction == 3) $alt=$langs->transnoentitiesnoconv("ChangeContactDone");
}
return '';
}
@@ -4418,7 +4417,7 @@ function printCommonFooter($zone='private')
{
global $conf;
global $micro_start_time;
-
+
if ($zone == 'private') print "\n".''."\n";
else print "\n".''."\n";
diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php
index b6f2e291a7f..7ae27328327 100644
--- a/htdocs/core/lib/pdf.lib.php
+++ b/htdocs/core/lib/pdf.lib.php
@@ -190,7 +190,7 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
if ($mode == 'source')
{
- $stringaddress .= ($stringaddress ? "\n" : '' ).dol_format_address($outputlangs,$sourcecompany)."\n";
+ $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($sourcecompany))."\n";
// Tel
if ($sourcecompany->tel) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($sourcecompany->tel);
@@ -207,13 +207,13 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
if ($usecontact)
{
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset($targetcontact->getFullName($outputlangs,1));
- $stringaddress .= ($stringaddress ? "\n" : '' ).dol_format_address($outputlangs,$targetcontact)."\n";
+ $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($targetcontact))."\n";
// Country
if ($targetcontact->pays_code && $targetcontact->pays_code != $sourcecompany->pays_code) $stringaddress.=$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcontact->pays_code))."\n";
}
else
{
- $stringaddress .= ($stringaddress ? "\n" : '' ).dol_format_address($outputlangs,$targetcompany)."\n";
+ $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($targetcompany))."\n";
// Country
if ($targetcompany->pays_code && $targetcompany->pays_code != $sourcecompany->pays_code) $stringaddress.=$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcompany->pays_code))."\n";
}
@@ -250,7 +250,7 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
if ($mode == 'delivery') // for a delivery address (address + phone/fax)
{
- $stringaddress .= ($stringaddress ? "\n" : '' ).dol_format_address($outputlangs,$deliverycompany)."\n";
+ $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($deliverycompany))."\n";
// Tel
if ($deliverycompany->phone) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($deliverycompany->phone);
@@ -1213,7 +1213,7 @@ function pdf_getlinetotalwithtax($object,$i,$outputlangs,$hidedetails=0)
}
else
{
- if (empty($hidedetails) || $hidedetails > 1) return
+ if (empty($hidedetails) || $hidedetails > 1) return
price(($object->lines[$i]->total_ht) + ($object->lines[$i]->total_ht)*($object->lines[$i]->tva_tx)/100);
}
}
diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php
index 5944af367e6..14bd3be67a2 100644
--- a/htdocs/core/lib/product.lib.php
+++ b/htdocs/core/lib/product.lib.php
@@ -64,15 +64,6 @@ function product_prepare_head($object, $user)
$h++;
}
- // Show barcode tab
- if ($conf->global->MAIN_MODULE_BARCODE && $user->rights->barcode->lire)
- {
- $head[$h][0] = DOL_URL_ROOT."/product/barcode.php?id=".$object->id;
- $head[$h][1] = $langs->trans("BarCode");
- $head[$h][2] = 'barcode';
- $h++;
- }
-
// Multilangs
if($conf->global->MAIN_MULTILANGS)
{
diff --git a/htdocs/core/modules/expedition/doc/ModelePdfExpedition.class.php b/htdocs/core/modules/expedition/doc/ModelePdfExpedition.class.php
deleted file mode 100644
index 8b6fea4ae37..00000000000
--- a/htdocs/core/modules/expedition/doc/ModelePdfExpedition.class.php
+++ /dev/null
@@ -1,154 +0,0 @@
-
- * Copyright (C) 2005-2011 Laurent Destailleur
- * Copyright (C) 2005-2011 Regis Houssin
- *
- * 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 2 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 .
- * or see http://www.gnu.org/
- */
-
-/**
- * \file htdocs/core/modules/expedition/doc/ModelePdfExpedition.class.php
- * \ingroup shipping
- * \brief Fichier contenant la classe mere de generation des expeditions
- */
-require_once(DOL_DOCUMENT_ROOT."/core/class/commondocgenerator.class.php");
-
-
-/**
- * \class ModelePdfExpedition
- * \brief Parent class of sending receipts models
- */
-abstract class ModelePdfExpedition extends CommonDocGenerator
-{
- var $error='';
-
-
- /**
- * \brief Return list of active generation modules
- * \param $db Database handler
- */
- function liste_modeles($db)
- {
- global $conf;
-
- $type='shipping';
- $liste=array();
-
- include_once(DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php');
- $liste=getListOfModels($db,$type,'');
-
- return $liste;
- }
-}
-
-
-/**
- * Cree un bon d'expedition sur disque
- * @param db objet base de donnee
- * @param object object expedition
- * @param modele force le modele a utiliser ('' to not force)
- * @param outputlangs objet lang a utiliser pour traduction
- * @return int <=0 if KO, >0 if OK
- */
-function expedition_pdf_create($db, $object, $modele, $outputlangs)
-{
- global $conf,$langs;
-
- $langs->load("sendings");
-
- // Increase limit for PDF build
- $err=error_reporting();
- error_reporting(0);
- @set_time_limit(120);
- error_reporting($err);
-
- $dir = "/core/modules/expedition/";
- $srctemplatepath='';
-
- // Positionne le modele sur le nom du modele a utiliser
- if (! dol_strlen($modele))
- {
- if (! empty($conf->global->EXPEDITION_ADDON_PDF))
- {
- $modele = $conf->global->EXPEDITION_ADDON_PDF;
- }
- else
- {
- $modele = 'rouget';
- }
- }
-
- // If selected modele is a filename template (then $modele="modelname:filename")
- $tmp=explode(':',$modele,2);
- if (! empty($tmp[1]))
- {
- $modele=$tmp[0];
- $srctemplatepath=$tmp[1];
- }
-
- // Search template file
- $file=''; $classname=''; $filefound=0;
- foreach(array('doc','pdf') as $prefix)
- {
- $file = $prefix."_expedition_".$modele.".modules.php";
-
- // On verifie l'emplacement du modele
- $file = dol_buildpath($dir.'doc/'.$file);
-
- if (file_exists($file))
- {
- $filefound=1;
- $classname=$prefix.'_expedition_'.$modele;
- break;
- }
- }
-
- // Charge le modele
- if ($filefound)
- {
- require_once($file);
-
- $obj = new $classname($db);
-
- $result=$object->fetch_origin();
-
- // We save charset_output to restore it because write_file can change it if needed for
- // output format that does not support UTF8.
- $sav_charset_output=$outputlangs->charset_output;
- if ($obj->write_file($object, $outputlangs) > 0)
- {
- $outputlangs->charset_output=$sav_charset_output;
-
- // we delete preview files
- //require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
- //dol_delete_preview($object);
- return 1;
- }
- else
- {
- $outputlangs->charset_output=$sav_charset_output;
- dol_syslog("Erreur dans expedition_pdf_create");
- dol_print_error($db,$obj->error);
- return 0;
- }
- }
- else
- {
- dol_print_error('',$langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$dir.$file));
- return -1;
- }
-}
-
-?>
diff --git a/htdocs/core/modules/expedition/doc/pdf_expedition_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_expedition_merou.modules.php
index 44c0d67a858..8e94f6c1c74 100644
--- a/htdocs/core/modules/expedition/doc/pdf_expedition_merou.modules.php
+++ b/htdocs/core/modules/expedition/doc/pdf_expedition_merou.modules.php
@@ -24,7 +24,7 @@
* \brief Fichier de la classe permettant de generer les bordereaux envoi au modele Merou
*/
-require_once DOL_DOCUMENT_ROOT."/core/modules/expedition/doc/ModelePdfExpedition.class.php";
+require_once DOL_DOCUMENT_ROOT."/core/modules/expedition/modules_expedition.php";
require_once DOL_DOCUMENT_ROOT."/contact/class/contact.class.php";
require_once(DOL_DOCUMENT_ROOT."/core/lib/company.lib.php");
require_once(DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php');
diff --git a/htdocs/core/modules/expedition/doc/pdf_expedition_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_expedition_rouget.modules.php
index cc4e3c716e8..e22e5e49dee 100644
--- a/htdocs/core/modules/expedition/doc/pdf_expedition_rouget.modules.php
+++ b/htdocs/core/modules/expedition/doc/pdf_expedition_rouget.modules.php
@@ -24,7 +24,7 @@
* \brief Fichier de la classe permettant de generer les bordereaux envoi au modele Rouget
*/
-require_once DOL_DOCUMENT_ROOT."/core/modules/expedition/doc/ModelePdfExpedition.class.php";
+require_once DOL_DOCUMENT_ROOT."/core/modules/expedition/expedition/modules_expedition.php";
require_once(DOL_DOCUMENT_ROOT."/core/lib/company.lib.php");
require_once(DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php');
diff --git a/htdocs/core/modules/expedition/modules_expedition.php b/htdocs/core/modules/expedition/modules_expedition.php
old mode 100755
new mode 100644
index c169f90f162..3d4ba8e3e6d
--- a/htdocs/core/modules/expedition/modules_expedition.php
+++ b/htdocs/core/modules/expedition/modules_expedition.php
@@ -5,6 +5,7 @@
* Copyright (C) 2005-2011 Regis Houssin
* Copyright (C) 2006 Andre Cianfarani
* Copyright (C) 2011 Juanjo Menent
+ * Copyright (C) 2011 Philippe Grand
*
* 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
@@ -26,14 +27,47 @@
* \ingroup expedition
* \brief File of class to manage expedition numbering
*/
+ require_once(DOL_DOCUMENT_ROOT."/core/class/commondocgenerator.class.php");
-class ModelNumRefExpedition
+ /**
+ * \class ModelePdfExpedition
+ * \brief Parent class of sending receipts models
+ */
+abstract class ModelePdfExpedition extends CommonDocGenerator
+{
+ var $error='';
+
+
+ /**
+ * \brief Return list of active generation modules
+ * \param $db Database handler
+ */
+ function liste_modeles($db)
+ {
+ global $conf;
+
+ $type='shipping';
+ $liste=array();
+
+ include_once(DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php');
+ $liste=getListOfModels($db,$type,'');
+
+ return $liste;
+ }
+}
+
+
+/**
+ * \class ModelNumRefExpedition
+ * \brief Classe mere des modeles de numerotation des references d expedition
+ */
+abstract class ModelNumRefExpedition
{
var $error='';
- /**
- * Return if a module can be used or not
- * @return boolean true if module can be used
+ /** Return if a module can be used or not
+ *
+ * @return boolean true if module can be used
*/
function isEnabled()
{
@@ -96,4 +130,101 @@ class ModelNumRefExpedition
return $langs->trans("NotAvailable");
}
}
+
+/**
+ * Cree un bon d'expedition sur disque
+ * @param db objet base de donnee
+ * @param object object expedition
+ * @param modele force le modele a utiliser ('' to not force)
+ * @param outputlangs objet lang a utiliser pour traduction
+ * @return int <=0 if KO, >0 if OK
+ */
+function expedition_pdf_create($db, $object, $modele, $outputlangs)
+{
+ global $conf,$langs;
+
+ $langs->load("sendings");
+
+ // Increase limit for PDF build
+ $err=error_reporting();
+ error_reporting(0);
+ @set_time_limit(120);
+ error_reporting($err);
+
+ $dir = "/core/modules/expedition/";
+ $srctemplatepath='';
+
+ // Positionne le modele sur le nom du modele a utiliser
+ if (! dol_strlen($modele))
+ {
+ if (! empty($conf->global->EXPEDITION_ADDON_PDF))
+ {
+ $modele = $conf->global->EXPEDITION_ADDON_PDF;
+ }
+ else
+ {
+ $modele = 'rouget';
+ }
+ }
+
+ // If selected modele is a filename template (then $modele="modelname:filename")
+ $tmp=explode(':',$modele,2);
+ if (! empty($tmp[1]))
+ {
+ $modele=$tmp[0];
+ $srctemplatepath=$tmp[1];
+ }
+
+ // Search template file
+ $file=''; $classname=''; $filefound=0;
+ foreach(array('doc','pdf') as $prefix)
+ {
+ $file = $prefix."_expedition_".$modele.".modules.php";
+
+ // On verifie l'emplacement du modele
+ $file = dol_buildpath($dir.'doc/'.$file);
+
+ if (file_exists($file))
+ {
+ $filefound=1;
+ $classname=$prefix.'_expedition_'.$modele;
+ break;
+ }
+ }
+
+ // Charge le modele
+ if ($filefound)
+ {
+ require_once($file);
+
+ $obj = new $classname($db);
+
+ $result=$object->fetch_origin();
+
+ // We save charset_output to restore it because write_file can change it if needed for
+ // output format that does not support UTF8.
+ $sav_charset_output=$outputlangs->charset_output;
+ if ($obj->write_file($object, $outputlangs) > 0)
+ {
+ $outputlangs->charset_output=$sav_charset_output;
+
+ // we delete preview files
+ //require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
+ //dol_delete_preview($object);
+ return 1;
+ }
+ else
+ {
+ $outputlangs->charset_output=$sav_charset_output;
+ dol_syslog("Erreur dans expedition_pdf_create");
+ dol_print_error($db,$obj->error);
+ return 0;
+ }
+ }
+ else
+ {
+ dol_print_error('',$langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$dir.$file));
+ return -1;
+ }
+}
?>
diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php
index 43946280014..14b6df6195f 100644
--- a/htdocs/core/modules/modSociete.class.php
+++ b/htdocs/core/modules/modSociete.class.php
@@ -268,11 +268,11 @@ class modSociete extends DolibarrModules
$this->import_label[$r]='ImportDataset_company_1';
$this->import_icon[$r]='company';
$this->import_tables_array[$r]=array('s'=>MAIN_DB_PREFIX.'societe'); // List of tables to insert into (insert done in same order)
- $this->import_fields_array[$r]=array('s.nom'=>"Name*",'s.status'=>"Status",'s.client'=>"Customer*",'s.fournisseur'=>"Supplier*",'s.datec'=>"DateCreation",'s.code_client'=>"CustomerCode",'s.code_fournisseur'=>"SupplierCode",'s.address'=>"Address",'s.cp'=>"Zip",'s.ville'=>"Town",'s.tel'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email",'s.siret'=>"IdProf1",'s.siren'=>"IdProf2",'s.ape'=>"IdProf3",'s.idprof4'=>"IdProf4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital",'s.note'=>"Note",'s.fk_typent'=>"ThirdPartyType",'s.fk_effectif'=>"Effectif","s.fk_forme_juridique"=>"JuridicalStatus",'s.fk_prospectlevel'=>'ProspectLevel','s.fk_stcomm'=>'ProspectStatus','s.default_lang'=>'DefaultLanguage','s.gencod'=>'BarCode');
+ $this->import_fields_array[$r]=array('s.nom'=>"Name*",'s.status'=>"Status",'s.client'=>"Customer*",'s.fournisseur'=>"Supplier*",'s.datec'=>"DateCreation",'s.code_client'=>"CustomerCode",'s.code_fournisseur'=>"SupplierCode",'s.address'=>"Address",'s.cp'=>"Zip",'s.ville'=>"Town",'s.tel'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email",'s.siret'=>"IdProf1",'s.siren'=>"IdProf2",'s.ape'=>"IdProf3",'s.idprof4'=>"IdProf4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital",'s.note'=>"Note",'s.fk_typent'=>"ThirdPartyType",'s.fk_effectif'=>"Effectif","s.fk_forme_juridique"=>"JuridicalStatus",'s.fk_prospectlevel'=>'ProspectLevel','s.fk_stcomm'=>'ProspectStatus','s.default_lang'=>'DefaultLanguage','s.barcode'=>'BarCode');
$this->import_entities_array[$r]=array(); // We define here only fields that use another picto
$this->import_regex_array[$r]=array('s.status'=>'^[0|1]','s.client'=>'^[0|1|2|3]','s.fournisseur'=>'^[0|1]');
//$this->import_regex_array[$r]=array('s.status'=>'^[0|1]','s.client'=>'^[0|1|2|3]','s.fournisseur'=>'^[0|1]','s.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','s.fk_typent'=>array('rule'=>'fetchidfromcode','file'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch')));
- $this->import_examplevalues_array[$r]=array('s.nom'=>"MyBigCompany",'s.status'=>"0 (closed) or 1 (active)",'s.client'=>'0 (no customer no prospect)/1 (customer)/2 (prospect)/3 (customer and prospect)','s.fournisseur'=>'0 or 1','s.datec'=>dol_print_date(mktime(),'YYYY-MM-DD'),'s.code_client'=>"CU01-0001",'s.code_fournisseur'=>"SU01-0001",'s.address'=>"61 jump street",'s.cp'=>"123456",'s.ville'=>"Big town",'s.tel'=>"0101010101",'s.fax'=>"0101010102",'s.url'=>"http://mycompany.com",'s.email'=>"test@mycompany.com",'s.siret'=>"",'s.siren'=>"",'s.ape'=>"",'s.idprof4'=>"",'s.tva_intra'=>"FR0123456789",'s.capital'=>"10000",'s.note'=>"This is an example of note for record",'s.fk_typent'=>"2",'s.fk_effectif'=>"3","s.fk_forme_juridique"=>"1",'s.fk_prospectlevel'=>'PL_MEDIUM','s.fk_stcomm'=>'','s.default_lang'=>'en_US','s.gencod'=>'123456789');
+ $this->import_examplevalues_array[$r]=array('s.nom'=>"MyBigCompany",'s.status'=>"0 (closed) or 1 (active)",'s.client'=>'0 (no customer no prospect)/1 (customer)/2 (prospect)/3 (customer and prospect)','s.fournisseur'=>'0 or 1','s.datec'=>dol_print_date(mktime(),'YYYY-MM-DD'),'s.code_client'=>"CU01-0001",'s.code_fournisseur'=>"SU01-0001",'s.address'=>"61 jump street",'s.cp'=>"123456",'s.ville'=>"Big town",'s.tel'=>"0101010101",'s.fax'=>"0101010102",'s.url'=>"http://mycompany.com",'s.email'=>"test@mycompany.com",'s.siret'=>"",'s.siren'=>"",'s.ape'=>"",'s.idprof4'=>"",'s.tva_intra'=>"FR0123456789",'s.capital'=>"10000",'s.note'=>"This is an example of note for record",'s.fk_typent'=>"2",'s.fk_effectif'=>"3","s.fk_forme_juridique"=>"1",'s.fk_prospectlevel'=>'PL_MEDIUM','s.fk_stcomm'=>'','s.default_lang'=>'en_US','s.barcode'=>'123456789');
// Import list of contact and attributes
/* $r++;
diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php
index 99f3faddf0a..8c87face017 100644
--- a/htdocs/expedition/fiche.php
+++ b/htdocs/expedition/fiche.php
@@ -33,7 +33,7 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
require_once(DOL_DOCUMENT_ROOT."/product/class/html.formproduct.class.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/product.lib.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/sendings.lib.php");
-require_once(DOL_DOCUMENT_ROOT."/core/modules/expedition/doc/ModelePdfExpedition.class.php");
+require_once(DOL_DOCUMENT_ROOT."/core/modules/expedition/modules_expedition.php");
if ($conf->product->enabled || $conf->service->enabled) require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");
if ($conf->propal->enabled) require_once(DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php");
if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT."/commande/class/commande.class.php");
diff --git a/htdocs/install/mysql/migration/3.1.0-3.2.0.sql b/htdocs/install/mysql/migration/3.1.0-3.2.0.sql
index a4b7fe38f94..50432e0f64d 100755
--- a/htdocs/install/mysql/migration/3.1.0-3.2.0.sql
+++ b/htdocs/install/mysql/migration/3.1.0-3.2.0.sql
@@ -103,3 +103,6 @@ ALTER TABLE llx_facture MODIFY ref_client varchar(255);
UPDATE llx_societe SET fk_stcomm = 0 WHERE fk_stcomm IS NULL;
ALTER TABLE llx_societe MODIFY COLUMN fk_stcomm integer NOT NULL;
+ALTER TABLE llx_societe CHANGE COLUMN gencod barcode varchar(255);
+ALTER TABLE llx_societe ADD COLUMN fk_barcode_type integer DEFAULT 0;
+
diff --git a/htdocs/install/mysql/tables/llx_societe.sql b/htdocs/install/mysql/tables/llx_societe.sql
index c0dd6594457..84f0e32360c 100644
--- a/htdocs/install/mysql/tables/llx_societe.sql
+++ b/htdocs/install/mysql/tables/llx_societe.sql
@@ -80,7 +80,7 @@ create table llx_societe
tva_assuj tinyint DEFAULT 1, -- assujeti ou non a la TVA
localtax1_assuj tinyint DEFAULT 0, -- assujeti ou non a local tax 1
localtax2_assuj tinyint DEFAULT 0, -- assujeti ou non a local tax 2
- gencod varchar(255), -- barcode
+ barcode varchar(255), -- barcode
price_level integer NULL, -- level of price for multiprices
default_lang varchar(6), -- default language
logo varchar(255),
diff --git a/htdocs/paybox/lib/paybox.lib.php b/htdocs/paybox/lib/paybox.lib.php
index 9182ed82d74..dd1b627a28d 100755
--- a/htdocs/paybox/lib/paybox.lib.php
+++ b/htdocs/paybox/lib/paybox.lib.php
@@ -258,7 +258,7 @@ function html_print_paybox_footer($fromcompany,$langs)
$line1="";
if ($fromcompany->forme_juridique_code)
{
- $line1.=($line1?" - ":"").$langs->convToOutputCharset(getFormeJuridiqueLabel($fromcompany->forme_juridique_code));
+ $line1.=($line1?" - ":"").getFormeJuridiqueLabel($fromcompany->forme_juridique_code);
}
// Capital
if ($fromcompany->capital)
@@ -270,14 +270,14 @@ function html_print_paybox_footer($fromcompany,$langs)
{
$field=$langs->transcountrynoentities("ProfId1",$fromcompany->pays_code);
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
- $line1.=($line1?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof1);
+ $line1.=($line1?" - ":"").$field.": ".$fromcompany->idprof1;
}
// Prof Id 2
if ($fromcompany->idprof2)
{
$field=$langs->transcountrynoentities("ProfId2",$fromcompany->pays_code);
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
- $line1.=($line1?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof2);
+ $line1.=($line1?" - ":"").$field.": ".$fromcompany->idprof2;
}
// Second line of company infos
@@ -287,19 +287,19 @@ function html_print_paybox_footer($fromcompany,$langs)
{
$field=$langs->transcountrynoentities("ProfId3",$fromcompany->pays_code);
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
- $line2.=($line2?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof3);
+ $line2.=($line2?" - ":"").$field.": ".$fromcompany->idprof3;
}
// Prof Id 4
if ($fromcompany->idprof4)
{
$field=$langs->transcountrynoentities("ProfId4",$fromcompany->pays_code);
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
- $line2.=($line2?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof4);
+ $line2.=($line2?" - ":"").$field.": ".$fromcompany->idprof4;
}
// IntraCommunautary VAT
if ($fromcompany->tva_intra != '')
{
- $line2.=($line2?" - ":"").$langs->transnoentities("VATIntraShort").": ".$langs->convToOutputCharset($fromcompany->tva_intra);
+ $line2.=($line2?" - ":"").$langs->transnoentities("VATIntraShort").": ".$fromcompany->tva_intra;
}
print '
'."\n";
diff --git a/htdocs/paypal/lib/paypal.lib.php b/htdocs/paypal/lib/paypal.lib.php
index 0797bbb78d8..06270d06e64 100755
--- a/htdocs/paypal/lib/paypal.lib.php
+++ b/htdocs/paypal/lib/paypal.lib.php
@@ -86,7 +86,7 @@ function html_print_paypal_footer($fromcompany,$langs)
$line1="";
if ($fromcompany->forme_juridique_code)
{
- $line1.=($line1?" - ":"").$langs->convToOutputCharset(getFormeJuridiqueLabel($fromcompany->forme_juridique_code));
+ $line1.=($line1?" - ":"").getFormeJuridiqueLabel($fromcompany->forme_juridique_code);
}
// Capital
if ($fromcompany->capital)
@@ -98,14 +98,14 @@ function html_print_paypal_footer($fromcompany,$langs)
{
$field=$langs->transcountrynoentities("ProfId1",$fromcompany->pays_code);
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
- $line1.=($line1?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof1);
+ $line1.=($line1?" - ":"").$field.": ".$fromcompany->idprof1;
}
// Prof Id 2
if ($fromcompany->idprof2)
{
$field=$langs->transcountrynoentities("ProfId2",$fromcompany->pays_code);
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
- $line1.=($line1?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof2);
+ $line1.=($line1?" - ":"").$field.": ".$fromcompany->idprof2;
}
// Second line of company infos
@@ -115,19 +115,19 @@ function html_print_paypal_footer($fromcompany,$langs)
{
$field=$langs->transcountrynoentities("ProfId3",$fromcompany->pays_code);
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
- $line2.=($line2?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof3);
+ $line2.=($line2?" - ":"").$field.": ".$fromcompany->idprof3;
}
// Prof Id 4
if ($fromcompany->idprof4)
{
$field=$langs->transcountrynoentities("ProfId4",$fromcompany->pays_code);
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
- $line2.=($line2?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof4);
+ $line2.=($line2?" - ":"").$field.": ".$fromcompany->idprof4;
}
// IntraCommunautary VAT
if ($fromcompany->tva_intra != '')
{
- $line2.=($line2?" - ":"").$langs->transnoentities("VATIntraShort").": ".$langs->convToOutputCharset($fromcompany->tva_intra);
+ $line2.=($line2?" - ":"").$langs->transnoentities("VATIntraShort").": ".$fromcompany->tva_intra;
}
print '
'."\n";
@@ -156,7 +156,7 @@ function paypaladmin_prepare_head()
$h++;
$object=(object) array();
-
+
// 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
diff --git a/htdocs/product/barcode.php b/htdocs/product/barcode.php
deleted file mode 100644
index e7aadd55177..00000000000
--- a/htdocs/product/barcode.php
+++ /dev/null
@@ -1,165 +0,0 @@
-
- * Copyright (C) 2004-2011 Laurent Destailleur
- * Copyright (C) 2005-2011 Regis Houssin
- *
- * 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 2 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 .
- */
-
-/**
- * \file htdocs/product/barcode.php
- * \ingroup product
- * \brief Page with bar code informations of product
- */
-
-require("../main.inc.php");
-require_once(DOL_DOCUMENT_ROOT."/core/lib/product.lib.php");
-require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");
-require_once(DOL_DOCUMENT_ROOT."/core/class/html.formbarcode.class.php");
-
-$langs->load("products");
-$langs->load("bills");
-
-$id = GETPOST('id','int');
-$ref = GETPOST('ref','alpha');
-$action = GETPOST('action','alpha');
-
-// Security check
-$fieldvalue = (! empty($id) ? $id : $ref);
-$fieldname = (! empty($ref) ? 'ref' : 'rowid');
-if ($user->societe_id) $socid=$user->societe_id;
-$result=restrictedArea($user,'produit|service&barcode',$fieldvalue,'product','','',$fieldname);
-
-$object = new Product($db);
-
-/*
- * Actions
- */
-
-// Modification du type de code barre
-if ($action == 'setbarcodetype' && $user->rights->barcode->creer)
-{
- $object->fetch($id);
- $object->barcode_type = $_POST['barcodetype_id'];
- $result = $object->update_barcode_type($user);
- Header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
- exit;
-}
-
-// Modification du code barre
-if ($action == 'setbarcode' && $user->rights->barcode->creer)
-{
- $object->fetch($id);
- $object->barcode = $_POST['barcode']; //Todo: ajout verification de la validite du code barre en fonction du type
- $result = $object->update_barcode($user);
- Header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
- exit;
-}
-
-
-/*
- * View
- */
-
-llxHeader("","",$langs->trans("BarCode"));
-
-$form = new Form($db);
-$formbarcode = new FormBarCode($db);
-
-$result = $object->fetch($id,$ref);
-
-$head=product_prepare_head($object, $user);
-$titre=$langs->trans("CardProduct".$object->type);
-$picto=($object->type==1?'service':'product');
-dol_fiche_head($head, 'barcode', $titre, 0, $picto);
-
-
-print '
\n";
-print "\n";
-
-$db->close();
-
-llxFooter();
-?>
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index 8192b4bb9e6..eda21194932 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -37,7 +37,7 @@ class Product extends CommonObject
public $element='product';
public $table_element='product';
public $fk_element='fk_product';
- public $childtables=array('propaldet','commandedet','facturedet','contratdet','product_fournisseur_price');
+ protected $childtables=array('propaldet','commandedet','facturedet','contratdet','product_fournisseur_price');
protected $isnolinkedbythird = 1; // No field fk_soc
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
@@ -105,12 +105,12 @@ class Product extends CommonObject
var $accountancy_code_buy;
var $accountancy_code_sell;
- //! Codes barres
- var $barcode;
- var $barcode_type;
- var $barcode_type_code;
- var $barcode_type_label;
- var $barcode_type_coder;
+ //! barcode
+ var $barcode; // value
+ var $barcode_type; // id
+ var $barcode_type_code; // code (loaded by fetch_barcode)
+ var $barcode_type_label; // label (loaded by fetch_barcode)
+ var $barcode_type_coder; // coder (loaded by fetch_barcode)
var $stats_propale=array();
var $stats_commande=array();
@@ -403,7 +403,7 @@ class Product extends CommonObject
global $langs, $conf;
$error=0;
-
+
// Verification parametres
if (! $this->libelle) $this->libelle = 'MISSING LABEL';
@@ -1100,35 +1100,6 @@ class Product extends CommonObject
// multilangs
if ($conf->global->MAIN_MULTILANGS) $this->getMultiLangs();
- // Barcode
- if ($conf->global->MAIN_MODULE_BARCODE)
- {
- if ($this->barcode_type == 0)
- {
- $this->barcode_type = $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE;
- }
-
- if ($this->barcode_type > 0)
- {
- $sql = "SELECT code, libelle, coder";
- $sql.= " FROM ".MAIN_DB_PREFIX."c_barcode_type";
- $sql.= " WHERE rowid = ".$this->barcode_type;
- $resql = $this->db->query($sql);
- if ($resql)
- {
- $result = $this->db->fetch_array($resql);
- $this->barcode_type_code = $result["code"];
- $this->barcode_type_label = $result["libelle"];
- $this->barcode_type_coder = $result["coder"];
- }
- else
- {
- dol_print_error($this->db);
- return -1;
- }
- }
- }
-
// Load multiprices array
if ($conf->global->PRODUIT_MULTIPRICES)
{
@@ -2547,18 +2518,18 @@ class Product extends CommonObject
/**
- * Show photos of a product (nbmax maximum)
+ * Show photos of a product (nbmax maximum), into several columns
+ * TODO Move this into html.formproduct.class.php
*
- * @param sdir Directory to scan
- * @param size 0=original size, 1 use thumbnail if possible
- * @param nbmax Nombre maximum de photos (0=pas de max)
- * @param nbbyrow Nombre vignettes par ligne (si mode vignette)
- * @param showfilename 1=Show filename
- * @param showaction 1=Show icon with action links (resize, delete)
- * @param maxHeight Max height of image when size=1
- * @param maxWidth Max width of image when size=1
- * @return string Html code to show photo. Number of photos shown is saved in this->nbphoto
- * TODO Move this into html.formproduct.class.php
+ * @param sdir Directory to scan
+ * @param size 0=original size, 1 use thumbnail if possible
+ * @param nbmax Nombre maximum de photos (0=pas de max)
+ * @param nbbyrow Nombre vignettes par ligne (si mode vignette)
+ * @param showfilename 1=Show filename
+ * @param showaction 1=Show icon with action links (resize, delete)
+ * @param maxHeight Max height of image when size=1
+ * @param maxWidth Max width of image when size=1
+ * @return string Html code to show photo. Number of photos shown is saved in this->nbphoto
*/
function show_photos($sdir,$size=0,$nbmax=0,$nbbyrow=5,$showfilename=0,$showaction=0,$maxHeight=120,$maxWidth=160)
{
@@ -2572,7 +2543,6 @@ class Product extends CommonObject
$dirthumb = $dir.'thumbs/';
$pdirthumb = $pdir.'thumbs/';
-
$return =''."\n";
/*$return.="