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

This commit is contained in:
Laurent Destailleur 2011-12-08 09:20:26 +01:00
commit 82717b8db7
44 changed files with 632 additions and 752 deletions

View File

@ -5,6 +5,7 @@ English Dolibarr ChangeLog
***** ChangeLog for 3.2 compared to 3.1 ***** ***** ChangeLog for 3.2 compared to 3.1 *****
For users: For users:
- New: show thirdparty barcode on main tab.
- New: Can input note (private and public) during note and expenses creation. - New: Can input note (private and public) during note and expenses creation.
- New: Print ticket show invoice ref into POS module. - New: Print ticket show invoice ref into POS module.
- New: Can edit customer discounts from invoice create and edit card. - New: Can edit customer discounts from invoice create and edit card.

View File

@ -1,4 +1,19 @@
README (English) README (English)
-------------------------------- --------------------------------
This directory contains information to know how to setup XDebug in Eclipse for This directory contains information to know how to setup XDebug in Eclipse for
running PHP scripts with XDebug. 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.

View File

@ -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_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_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_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 ($_FILES["logo"]["tmp_name"])
{ {
if (preg_match('/([^\\/:]+)$/i',$_FILES["logo"]["name"],$reg)) if (preg_match('/([^\\/:]+)$/i',$_FILES["logo"]["name"],$reg))
@ -346,7 +346,7 @@ if ((isset($_GET["action"]) && $_GET["action"] == 'edit')
{ {
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("Gencod").'</td><td>'; print '<tr '.$bc[$var].'><td>'.$langs->trans("Gencod").'</td><td>';
print '<input name="gencod" size="40" value="'. $conf->global->MAIN_INFO_SOCIETE_GENCOD . '"></td></tr>'; print '<input name="barcode" size="40" value="'. $conf->global->MAIN_INFO_SOCIETE_GENCOD . '"></td></tr>';
print '</td></tr>'; print '</td></tr>';
} }

View File

@ -646,7 +646,7 @@ else
else else
{ {
print '<div class="error">'.$langs->trans("ServerNotAvailableOnIPOrPort",$server,$port); print '<div class="error">'.$langs->trans("ServerNotAvailableOnIPOrPort",$server,$port);
if ($mail->error) print ' - '.$langs->convToOutputCharset($mail->error,'ISO-8859-1'); if ($mail->error) print ' - '.$mail->error;
print '</div>'; print '</div>';
} }
print '<br>'; print '<br>';

View File

@ -306,7 +306,7 @@ else
else else
{ {
print '<div class="error">'.$langs->trans("ServerNotAvailableOnIPOrPort",$server,$port); print '<div class="error">'.$langs->trans("ServerNotAvailableOnIPOrPort",$server,$port);
if ($mail->error) print ' - '.$langs->convToOutputCharset($mail->error,'ISO-8859-1'); if ($mail->error) print ' - '.$mail->error;
print '</div>'; print '</div>';
} }
print '<br>'; print '<br>';

View File

@ -98,7 +98,7 @@ body {
</div> </div>
<div class="infos"> <div class="infos">
<p class="address"><?php echo $mysoc->name; ?><br> <p class="address"><?php echo $mysoc->name; ?><br>
<?php print dol_nl2br(dol_format_address($langs,$mysoc)); ?><br> <?php print dol_nl2br(dol_format_address($mysoc)); ?><br>
</p> </p>
<p class="date_heure"><?php <p class="date_heure"><?php

View File

@ -222,7 +222,7 @@ if ($socid)
if ($conf->global->MAIN_MODULE_BARCODE) if ($conf->global->MAIN_MODULE_BARCODE)
{ {
print '<tr><td>'.$langs->trans('Gencod').'</td><td colspan="3">'.$soc->gencod.'</td></tr>'; print '<tr><td>'.$langs->trans('Gencod').'</td><td colspan="3">'.$soc->barcode.'</td></tr>';
} }
// Address // Address

View File

@ -3,17 +3,17 @@
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
@ -133,7 +133,7 @@ class ActionComm extends CommonObject
} }
else if ($result == 0) 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; return -1;
} }
else else
@ -864,17 +864,17 @@ class ActionComm extends CommonObject
//print $datestart.'x'; exit; //print $datestart.'x'; exit;
$dateend=$this->db->jdate($obj->datep2); $dateend=$this->db->jdate($obj->datep2);
$duration=$obj->durationp; $duration=$obj->durationp;
$event['summary']=$langs->convToOutputCharset($obj->label.($obj->socname?" (".$obj->socname.")":"")); $event['summary']=$obj->label.($obj->socname?" (".$obj->socname.")":"");
$event['desc']=$langs->convToOutputCharset($obj->note); $event['desc']=$obj->note;
$event['startdate']=$datestart; $event['startdate']=$datestart;
$event['duration']=$duration; // Not required with type 'journal' $event['duration']=$duration; // Not required with type 'journal'
$event['enddate']=$dateend; // Not required with type 'journal' $event['enddate']=$dateend; // Not required with type 'journal'
$event['author']=$obj->firstname.($obj->name?" ".$obj->name:""); $event['author']=$obj->firstname.($obj->name?" ".$obj->name:"");
$event['priority']=$obj->priority; $event['priority']=$obj->priority;
$event['fulldayevent']=$obj->fulldayevent; $event['fulldayevent']=$obj->fulldayevent;
$event['location']=$langs->convToOutputCharset($obj->location); $event['location']=$obj->location;
$event['transparency']='TRANSPARENT'; // OPAQUE (busy) or TRANSPARENT (not busy) $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); $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; $url=$urlwithouturlroot.DOL_URL_ROOT.'/comm/action/fiche.php?id='.$obj->id;
$event['url']=$url; $event['url']=$url;
@ -898,21 +898,21 @@ class ActionComm extends CommonObject
// Define title and desc // Define title and desc
$more=''; $more='';
if ($login) $more=$langs->transnoentities("User").' '.$langs->convToOutputCharset($login); if ($login) $more=$langs->transnoentities("User").' '.$login;
if ($logina) $more=$langs->transnoentities("ActionsAskedBy").' '.$langs->convToOutputCharset($logina); if ($logina) $more=$langs->transnoentities("ActionsAskedBy").' '.$logina;
if ($logint) $more=$langs->transnoentities("ActionsToDoBy").' '.$langs->convToOutputCharset($logint); if ($logint) $more=$langs->transnoentities("ActionsToDoBy").' '.$logint;
if ($logind) $more=$langs->transnoentities("ActionsDoneBy").' '.$langs->convToOutputCharset($logind); if ($logind) $more=$langs->transnoentities("ActionsDoneBy").' '.$logind;
if ($more) if ($more)
{ {
$title=$langs->convToOutputCharset('Dolibarr actions '.$mysoc->name).' - '.$more; $title='Dolibarr actions '.$mysoc->name.' - '.$more;
$desc=$more; $desc=$more;
$desc.=$langs->convToOutputCharset(' ('.$mysoc->name.' - built by Dolibarr)'); $desc.=' ('.$mysoc->name.' - built by Dolibarr)';
} }
else else
{ {
$title=$langs->convToOutputCharset('Dolibarr actions '.$mysoc->name); $title='Dolibarr actions '.$mysoc->name;
$desc=$langs->transnoentities('ListOfActions'); $desc=$langs->transnoentities('ListOfActions');
$desc.=$langs->convToOutputCharset(' ('.$mysoc->name.' - built by Dolibarr)'); $desc.=' ('.$mysoc->name.' - built by Dolibarr)';
} }
// Create temp file // Create temp file

View File

@ -214,7 +214,7 @@ if ($_GET["action"] == 'create' || $_POST["action"] == 'create')
$address->pays = $obj->libelle; $address->pays = $obj->libelle;
} }
print_titre($langs->trans("NewAddress")); print_titre($langs->trans("AddAddress"));
print "<br>\n"; print "<br>\n";
if ($address->error) if ($address->error)
@ -258,7 +258,7 @@ if ($_GET["action"] == 'create' || $_POST["action"] == 'create')
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td class="fieldrequired">'.$langs->trans('AddressLabel').'</td><td><input type="text" size="30" name="label" id="label" value="'.($address->label?$address->label:$langs->trans('RequiredField')).'"></td></tr>'; print '<tr><td class="fieldrequired">'.$langs->trans('Label').'</td><td><input type="text" size="30" name="label" id="label" value="'.($address->label?$address->label:$langs->trans('RequiredField')).'"></td></tr>';
print '<tr><td class="fieldrequired">'.$langs->trans('Name').'</td><td><input type="text" size="30" name="name" id="name" value="'.($address->name?$address->name:$langs->trans('RequiredField')).'"></td></tr>'; print '<tr><td class="fieldrequired">'.$langs->trans('Name').'</td><td><input type="text" size="30" name="name" id="name" value="'.($address->name?$address->name:$langs->trans('RequiredField')).'"></td></tr>';
print '<tr><td valign="top">'.$langs->trans('Address').'</td><td colspan="3"><textarea name="address" cols="40" rows="3" wrap="soft">'; print '<tr><td valign="top">'.$langs->trans('Address').'</td><td colspan="3"><textarea name="address" cols="40" rows="3" wrap="soft">';
@ -287,10 +287,11 @@ if ($_GET["action"] == 'create' || $_POST["action"] == 'create')
print $address->note; print $address->note;
print '</textarea></td></tr>'; print '</textarea></td></tr>';
print '<tr><td colspan="4" align="center">';
print '<input type="submit" class="button" value="'.$langs->trans('AddAddress').'"></td></tr>'."\n";
print '</table>'."\n"; print '</table>'."\n";
print '<br><center>';
print '<input type="submit" class="button" value="'.$langs->trans('AddAddress').'"></center>'."\n";
print '</form>'."\n"; print '</form>'."\n";
} }
@ -411,7 +412,7 @@ else
* Fiche societe en mode visu * Fiche societe en mode visu
*/ */
$address = new Address($db); $address = new Address($db);
$result=$address->fetch($socid); $result=$address->fetch_lines($socid);
if ($result < 0) if ($result < 0)
{ {
dol_print_error($db,$address->error); dol_print_error($db,$address->error);

View File

@ -1260,7 +1260,7 @@ if ($id > 0 || ! empty($ref))
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('PaymentConditionsShort'); print $langs->trans('PaymentConditionsShort');
print '</td>'; print '</td>';
if ($action != 'editconditions' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editconditions&amp;id='.$object->id.'">'.img_edit($langs->trans('SetConditions'),1).'</a></td>'; if ($action != 'editconditions' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editconditions&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetConditions'),1).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="3">'; print '</td><td colspan="3">';
if ($action == 'editconditions') if ($action == 'editconditions')
@ -1280,7 +1280,7 @@ if ($id > 0 || ! empty($ref))
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('DeliveryDate'); print $langs->trans('DeliveryDate');
print '</td>'; print '</td>';
if ($action != 'editdate_livraison' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdate_livraison&amp;id='.$object->id.'">'.img_edit($langs->trans('SetDeliveryDate'),1).'</a></td>'; if ($action != 'editdate_livraison' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdate_livraison&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetDeliveryDate'),1).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="3">'; print '</td><td colspan="3">';
if ($action == 'editdate_livraison') if ($action == 'editdate_livraison')
@ -1307,7 +1307,7 @@ if ($id > 0 || ! empty($ref))
print $langs->trans('DeliveryAddress'); print $langs->trans('DeliveryAddress');
print '</td>'; print '</td>';
if ($action != 'editdelivery_address' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdelivery_address&amp;socid='.$object->socid.'&amp;id='.$object->id.'">'.img_edit($langs->trans('SetDeliveryAddress'),1).'</a></td>'; if ($action != 'editdelivery_address' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdelivery_address&amp;socid='.$object->socid.'&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetDeliveryAddress'),1).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="3">'; print '</td><td colspan="3">';
@ -1328,7 +1328,7 @@ if ($id > 0 || ! empty($ref))
print $langs->trans('AvailabilityPeriod'); print $langs->trans('AvailabilityPeriod');
if ($conf->commande->enabled) print ' ('.$langs->trans('AfterOrder').')'; if ($conf->commande->enabled) print ' ('.$langs->trans('AfterOrder').')';
print '</td>'; print '</td>';
if ($action != 'editavailability' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editavailability&amp;id='.$object->id.'">'.img_edit($langs->trans('SetAvailability'),1).'</a></td>'; if ($action != 'editavailability' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editavailability&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetAvailability'),1).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="3">'; print '</td><td colspan="3">';
if ($action == 'editavailability') if ($action == 'editavailability')
@ -1348,7 +1348,7 @@ if ($id > 0 || ! empty($ref))
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('Source'); print $langs->trans('Source');
print '</td>'; print '</td>';
if ($action != 'editdemandreason' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdemandreason&amp;id='.$object->id.'">'.img_edit($langs->trans('SetDemandReason'),1).'</a></td>'; if ($action != 'editdemandreason' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdemandreason&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetDemandReason'),1).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="3">'; print '</td><td colspan="3">';
//print $object->demand_reason_id; //print $object->demand_reason_id;
@ -1370,7 +1370,7 @@ if ($id > 0 || ! empty($ref))
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('PaymentMode'); print $langs->trans('PaymentMode');
print '</td>'; print '</td>';
if ($action != 'editmode' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editmode&amp;id='.$object->id.'">'.img_edit($langs->trans('SetMode'),1).'</a></td>'; if ($action != 'editmode' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editmode&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetMode'),1).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="3">'; print '</td><td colspan="3">';
if ($action == 'editmode') if ($action == 'editmode')
@ -1392,7 +1392,7 @@ if ($id > 0 || ! empty($ref))
print $langs->trans('Project').'</td>'; print $langs->trans('Project').'</td>';
if ($user->rights->propale->creer) if ($user->rights->propale->creer)
{ {
if ($action != 'classify') print '<td align="right"><a href="'.$_SERVER['PHP_SELF'].'?action=classify&amp;id='.$object->id.'">'.img_edit($langs->trans('SetProject')).'</a></td>'; if ($action != 'classify') print '<td align="right"><a href="'.$_SERVER['PHP_SELF'].'?action=classify&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="3">'; print '</td><td colspan="3">';
if ($action == 'classify') if ($action == 'classify')

View File

@ -81,19 +81,19 @@ class CMailFile
/** /**
* CMailFile * CMailFile
* *
* @param subject Topic/Subject of mail * @param string $subject Topic/Subject of mail
* @param to Recipients emails (RFC 2822: "Nom prenom <email>[, ...]" ou "email[, ...]" ou "<email>[, ...]") * @param string $to Recipients emails (RFC 2822: "Nom prenom <email>[, ...]" ou "email[, ...]" ou "<email>[, ...]")
* @param from Sender email (RFC 2822: "Nom prenom <email>[, ...]" ou "email[, ...]" ou "<email>[, ...]") * @param string $from Sender email (RFC 2822: "Nom prenom <email>[, ...]" ou "email[, ...]" ou "<email>[, ...]")
* @param msg Message * @param string $msg Message
* @param filename_list List of files to attach (full path of filename on file system) * @param array $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 array $mimetype_list List of MIME type of attached files
* @param mimefilename_list List of attached file name in message * @param array $mimefilename_list List of attached file name in message
* @param addr_cc Email cc * @param string $addr_cc Email cc
* @param addr_bcc Email bcc * @param string $addr_bcc Email bcc
* @param deliveryreceipt Ask a delivery receipt * @param int $deliveryreceipt Ask a delivery receipt
* @param msgishtml 1=String IS already html, 0=String IS NOT html, -1=Unknown need autodetection * @param int $msgishtml 1=String IS already html, 0=String IS NOT html, -1=Unknown need autodetection
* @param errors_to Email errors * @param string $errors_to Email errors
* @param css Css option * @param string $css Css option
*/ */
function CMailFile($subject,$to,$from,$msg, function CMailFile($subject,$to,$from,$msg,
$filename_list=array(),$mimetype_list=array(),$mimefilename_list=array(), $filename_list=array(),$mimetype_list=array(),$mimefilename_list=array(),
@ -524,8 +524,8 @@ class CMailFile
/** /**
* Correct an uncomplete html string * Correct an uncomplete html string
* *
* @param $msg * @param string $msg String
* @return * @return string Completed string
*/ */
function checkIfHTML($msg) function checkIfHTML($msg)
{ {
@ -615,9 +615,9 @@ class CMailFile
/** /**
* Create header MIME (mode = 'mail') * Create header MIME (mode = 'mail')
* *
* @param filename_list * @param array $filename_list Array of filenames
* @param mimefilename_list * @param array $mimefilename_list Array of mime types
* @return mime headers * @return array mime headers
*/ */
function write_mimeheaders($filename_list, $mimefilename_list) function write_mimeheaders($filename_list, $mimefilename_list)
{ {
@ -644,7 +644,8 @@ class CMailFile
/** /**
* Return email content (mode = 'mail') * Return email content (mode = 'mail')
* *
* @param msgtext * @param string $msgtext Message string
* @return string String content
*/ */
function write_body($msgtext) function write_body($msgtext)
{ {
@ -675,7 +676,7 @@ class CMailFile
} }
// Make RFC821 Compliant, replace bare linefeeds // Make RFC821 Compliant, replace bare linefeeds
$strContent = preg_replace("/(?<!\r)\n/si", "\r\n", $strContent ); $strContent = preg_replace("/(?<!\r)\n/si", "\r\n", $strContent);
//$strContent = rtrim(chunk_split($strContent)); // Function chunck_split seems bugged //$strContent = rtrim(chunk_split($strContent)); // Function chunck_split seems bugged
$strContent = rtrim(wordwrap($strContent)); $strContent = rtrim(wordwrap($strContent));
@ -708,10 +709,10 @@ class CMailFile
/** /**
* Attach file to email (mode = 'mail') * Attach file to email (mode = 'mail')
* *
* @param filename_list Tableau * @param array $filename_list Tableau
* @param mimetype_list Tableau * @param array $mimetype_list Tableau
* @param mimefilename_list Tableau * @param array $mimefilename_list Tableau
* @return out Chaine fichiers encodes * @return string Chaine fichiers encodes
*/ */
function write_files($filename_list,$mimetype_list,$mimefilename_list) function write_files($filename_list,$mimetype_list,$mimefilename_list)
{ {
@ -753,8 +754,8 @@ class CMailFile
/** /**
* Attach an image to email (mode = 'mail') * Attach an image to email (mode = 'mail')
* *
* @param images_list Tableau * @param array $images_list Tableau
* @return out Chaine images encodees * @return string Chaine images encodees
*/ */
function write_images($images_list) function write_images($images_list)
{ {
@ -784,9 +785,9 @@ class CMailFile
/** /**
* Try to create a socket connection * Try to create a socket connection
* *
* @param $host Add ssl:// for SSL/TLS. * @param string $host Add ssl:// for SSL/TLS.
* @param $port Example: 25, 465 * @param int $port Example: 25, 465
* @return Socket id if ok, 0 if KO * @return int Socket id if ok, 0 if KO
*/ */
function check_server_port($host,$port) function check_server_port($host,$port)
{ {
@ -797,11 +798,13 @@ class CMailFile
{ {
dol_syslog("Try socket connection to host=".$host." port=".$port); dol_syslog("Try socket connection to host=".$host." port=".$port);
//See if we can connect to the SMTP server //See if we can connect to the SMTP server
if ( $socket = @fsockopen($host, // Host to test, IP or domain. Add ssl:// for SSL/TLS. if ($socket = @fsockopen(
$port, // which Port number to use $host, // Host to test, IP or domain. Add ssl:// for SSL/TLS.
$errno, // actual system level error $port, // which Port number to use
$errstr, // and any text that goes with the error $errno, // actual system level error
$timeout) ) // timeout for reading/writing data over the socket $errstr, // and any text that goes with the error
$timeout
)) // timeout for reading/writing data over the socket
{ {
// Windows still does not have support for this timeout function // Windows still does not have support for this timeout function
if (function_exists('stream_set_timeout')) stream_set_timeout($socket, $timeout, 0); if (function_exists('stream_set_timeout')) stream_set_timeout($socket, $timeout, 0);
@ -813,7 +816,7 @@ class CMailFile
} }
else else
{ {
$this->error = 'Error '.$errno.' - '.$errstr; $this->error = utf8_check('Error '.$errno.' - '.$errstr)?'Error '.$errno.' - '.$errstr:utf8_encode('Error '.$errno.' - '.$errstr);
} }
} }
return $_retVal; return $_retVal;
@ -823,9 +826,9 @@ class CMailFile
* This function has been modified as provided by SirSir to allow multiline responses when * This function has been modified as provided by SirSir to allow multiline responses when
* using SMTP Extensions. * using SMTP Extensions.
* *
* @param socket * @param Socket $socket Socket
* @param response * @param string $response Response string
* @return boolean * @return boolean true if success
*/ */
function server_parse($socket, $response) function server_parse($socket, $response)
{ {
@ -853,8 +856,8 @@ class CMailFile
/** /**
* Seearch images into html message and init array this->images_encoded if found * Seearch images into html message and init array this->images_encoded if found
* *
* @param images_dir Location of physical images files * @param string $images_dir Location of physical images files
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
*/ */
function findHtmlImages($images_dir) function findHtmlImages($images_dir)
{ {
@ -943,11 +946,11 @@ class CMailFile
/** /**
* Return an address for SMTP protocol * Return an address for SMTP protocol
* *
* @param adresses Example: 'John Doe <john@doe.com>' or 'john@doe.com' * @param string $adresses Example: 'John Doe <john@doe.com>' or 'john@doe.com'
* @param format 0=Auto, 1=emails with <>, 2=emails without <> * @param int $format 0=Auto, 1=emails with <>, 2=emails without <>
* @param encode 1=Encode name to RFC2822 * @param int $encode 1=Encode name to RFC2822
* @return string If format 1: '<john@doe.com>' or 'John Doe <john@doe.com>' * @return string If format 1: '<john@doe.com>' or 'John Doe <john@doe.com>'
* If format 2: 'john@doe.com' * If format 2: 'john@doe.com'
*/ */
function getValidAddress($adresses,$format,$encode='') function getValidAddress($adresses,$format,$encode='')
{ {

View File

@ -89,7 +89,7 @@ abstract class CommonDocGenerator
'mycompany_web'=>$mysoc->url, 'mycompany_web'=>$mysoc->url,
'mycompany_juridicalstatus'=>$mysoc->forme_juridique, 'mycompany_juridicalstatus'=>$mysoc->forme_juridique,
'mycompany_capital'=>$mysoc->capital, 'mycompany_capital'=>$mysoc->capital,
'mycompany_barcode'=>$mysoc->gencod, 'mycompany_barcode'=>$mysoc->barcode,
'mycompany_idprof1'=>$mysoc->idprof1, 'mycompany_idprof1'=>$mysoc->idprof1,
'mycompany_idprof2'=>$mysoc->idprof2, 'mycompany_idprof2'=>$mysoc->idprof2,
'mycompany_idprof3'=>$mysoc->idprof3, 'mycompany_idprof3'=>$mysoc->idprof3,
@ -121,7 +121,7 @@ abstract class CommonDocGenerator
'company_country_code'=>$object->country_code, 'company_country_code'=>$object->country_code,
'company_country'=>$outputlangs->transnoentitiesnoconv("Country".$object->country_code), 'company_country'=>$outputlangs->transnoentitiesnoconv("Country".$object->country_code),
'company_web'=>$object->url, 'company_web'=>$object->url,
'company_barcode'=>$object->gencod, 'company_barcode'=>$object->barcode,
'company_vatnumber'=>$object->tva_intra, 'company_vatnumber'=>$object->tva_intra,
'company_customercode'=>$object->code_client, 'company_customercode'=>$object->code_client,
'company_suppliercode'=>$object->code_fournisseur, 'company_suppliercode'=>$object->code_fournisseur,

View File

@ -82,7 +82,7 @@ abstract class CommonObject
global $user,$conf,$langs; global $user,$conf,$langs;
$error=0; $error=0;
dol_syslog(get_class($this)."::add_contact $fk_socpeople, $type_contact, $source"); dol_syslog(get_class($this)."::add_contact $fk_socpeople, $type_contact, $source");
// Check parameters // Check parameters
@ -203,7 +203,7 @@ abstract class CommonObject
global $user,$langs,$conf; global $user,$langs,$conf;
$error=0; $error=0;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."element_contact"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."element_contact";
$sql.= " WHERE rowid =".$rowid; $sql.= " WHERE rowid =".$rowid;
@ -510,6 +510,54 @@ abstract class CommonObject
return $result; 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 * Charge le projet d'id $this->fk_project dans this->projet
* *
@ -539,22 +587,6 @@ abstract class CommonObject
return $result; 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 * Read linked origin object
*/ */
@ -1699,8 +1731,8 @@ abstract class CommonObject
/** /**
* Function to check if an object is used by others * Function to check if an object is used by others
* *
* @param id Id of object * @param int $id Id of object
* @return int <0 if KO, 0 if not used, >0 if already used * @return int <0 if KO, 0 if not used, >0 if already used
*/ */
function isObjectUsed($id) function isObjectUsed($id)
{ {
@ -1775,8 +1807,7 @@ abstract class CommonObject
/** /**
* * List urls of elemùent
* Enter description here ...
* *
* @param unknown_type $objectid * @param unknown_type $objectid
* @param unknown_type $objecttype * @param unknown_type $objecttype

View File

@ -1242,7 +1242,7 @@ class Form
} }
} }
$opt.= '>'; $opt.= '>';
$opt.= $langs->convToOutputCharset($objp->ref).' - '.$langs->convToOutputCharset(dol_trunc($label,32)).' - '; $opt.= $objp->ref.' - '.dol_trunc($label,32).' - ';
$objRef = $objp->ref; $objRef = $objp->ref;
if ($filterkey && $filterkey != '') $objRef=preg_replace('/('.preg_quote($filterkey).')/i','<strong>$1</strong>',$objRef,1); if ($filterkey && $filterkey != '') $objRef=preg_replace('/('.preg_quote($filterkey).')/i','<strong>$1</strong>',$objRef,1);
@ -1365,7 +1365,7 @@ class Form
{ {
global $langs,$conf; global $langs,$conf;
global $price_level, $status, $finished; global $price_level, $status, $finished;
if ($conf->global->PRODUIT_USE_SEARCH_TO_SELECT) if ($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)
{ {
// mode=2 means suppliers products // mode=2 means suppliers products
@ -1459,9 +1459,9 @@ class Form
$label = $objp->label; $label = $objp->label;
if ($filterkey && $filterkey != '') $label=preg_replace('/('.preg_quote($filterkey).')/i','<strong>$1</strong>',$label,1); if ($filterkey && $filterkey != '') $label=preg_replace('/('.preg_quote($filterkey).')/i','<strong>$1</strong>',$label,1);
$opt.=$langs->convToOutputCharset($objp->ref).' ('.$langs->convToOutputCharset($objp->ref_fourn).') - '; $opt.=$objp->ref.' ('.$objp->ref_fourn.') - ';
$outval.=$objRef.' ('.$objRefFourn.') - '; $outval.=$objRef.' ('.$objRefFourn.') - ';
$opt.=$langs->convToOutputCharset(dol_trunc($objp->label,18)).' - '; $opt.=dol_trunc($objp->label,18).' - ';
$outval.=dol_trunc($label,18).' - '; $outval.=dol_trunc($label,18).' - ';
if ($objp->fprice != '') // Keep != '' if ($objp->fprice != '') // Keep != ''
@ -2230,7 +2230,7 @@ class Form
* @param string $action Action * @param string $action Action
* @param array $formquestion An array with complementary inputs to add into forms: array(array('label'=> ,'type'=> , )) * @param array $formquestion An array with complementary inputs to add into forms: array(array('label'=> ,'type'=> , ))
* @param string $selectedchoice "" or "no" or "yes" * @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 * @param int $height Force height of box
* @return string 'ajax' if a confirm ajax popup is shown, 'html' if it's an html form * @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; $autoOpen=true;
$dialogconfirm='dialog-confirm'; $dialogconfirm='dialog-confirm';
if (! is_int($useajax)) { if (! is_int($useajax))
{
$button=$useajax; $button=$useajax;
$useajax=1; $useajax=1;
$autoOpen=false; $autoOpen=false;
@ -2841,14 +2842,15 @@ class Form
} }
/** /**
* Affiche formulaire de selection de l'adresse * Show form to select addresse
* *
* @param page Page * @param page Page
* @param selected Id condition pre-selectionne * @param selected Id condition pre-selectionne
* @param htmlname Nom du formulaire select * @param htmlname Nom du formulaire select
* @param origin Origine de l'appel pour pouvoir creer un retour * @param origin Origine de l'appel pour pouvoir creer un retour
* @param originid Id de l'origine * @param originid Id de l'origine
* @return void * @return void
* @deprecated
*/ */
function form_address($page, $selected='', $socid, $htmlname='address_id', $origin='', $originid='') 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 ='<!-- url barcode = '.$url.' -->';
$out.='<img src="'.$url.'">';
return $out;
}
/** /**
* Return HTML code to output a photo * Return HTML code to output a photo
* *
* @param modulepart Key to define module concerned ('societe', 'userphoto', 'memberphoto') * @param string $modulepart Key to define module concerned ('societe', 'userphoto', 'memberphoto')
* @param object Object containing data to retrieve file name * @param Object $object Object containing data to retrieve file name
* @param width Width of photo * @param int $width Width of photo
* @return string HTML code to output photo * @return string HTML code to output photo
*/ */
function showphoto($modulepart,$object,$width=100) function showphoto($modulepart,$object,$width=100)
{ {

View File

@ -1290,12 +1290,13 @@ class Ldap
/** /**
* \brief Convert a string into output/memory charset * Convert a string into output/memory charset
* \param str String to convert *
* \param pagecodefrom Page code of src string * @param str String to convert
* \return string Converted string * @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; global $conf;
if ($pagecodefrom == 'ISO-8859-1' && $conf->file->character_set_client == 'UTF-8') $str=utf8_encode($str); 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 * Convert a string from output/memory charset
* \param str String to convert *
* \param pagecodeto Page code for result string * @param str String to convert
* \return string Converted string * @param pagecodeto Page code for result string
* @return string Converted string
*/ */
function convFromOutputCharset($str,$pagecodeto='UTF-8') 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); if ($pagecodeto == 'UTF-8' && $conf->file->character_set_client == 'ISO-8859-1') $str=utf8_encode($str);
return $str; return $str;
} }
/** /**
* Return available value of group GID * Return available value of group GID
* @return int gid number * @return int gid number
*/ */
function getNextGroupGid() function getNextGroupGid()
{ {
global $conf; global $conf;
$search='('.$conf->global->LDAP_KEY_GROUPS.'=*)'; $search='('.$conf->global->LDAP_KEY_GROUPS.'=*)';
$result = $this->search($this->groups,$search); $result = $this->search($this->groups,$search);
if($result) if($result)
@ -1337,11 +1339,11 @@ class Ldap
$gids[] = $result[$i]['gidnumber'][0]; $gids[] = $result[$i]['gidnumber'][0];
} }
rsort($gids); rsort($gids);
return $gids[0]+1; return $gids[0]+1;
} }
return 0; return 0;
} }
} }

View File

@ -49,8 +49,8 @@ class Translate {
/** /**
* Constructor * Constructor
* *
* @param dir Force directory that contains /langs subdirectory (value is sometine '..' like into install/* pages or support/* pages). * @param string $dir Force directory that contains /langs subdirectory (value is sometine '..' like into install/* pages or support/* pages).
* @param conf Object with Dolibarr configuration * @param Conf $conf Object with Dolibarr configuration
*/ */
function Translate($dir = "",$conf) function Translate($dir = "",$conf)
{ {
@ -63,7 +63,7 @@ class Translate {
/** /**
* Set accessor for this->defaultlang * Set accessor for this->defaultlang
* *
* @param srclang Language to use * @param string $srclang Language to use
*/ */
function setDefaultLang($srclang='fr_FR') function setDefaultLang($srclang='fr_FR')
{ {
@ -129,8 +129,8 @@ class Translate {
* Return active language code for current user * Return active language code for current user
* It's an accessor for this->defaultlang * It's an accessor for this->defaultlang
* *
* @param mode 0=Long language code, 1=Short language code * @param int $mode 0=Long language code, 1=Short language code
* @return string Language code used (en_US, en_AU, fr_FR, ...) * @return string Language code used (en_US, en_AU, fr_FR, ...)
*/ */
function getDefaultLang($mode=0) function getDefaultLang($mode=0)
{ {
@ -337,8 +337,8 @@ class Translate {
* WARNING: To avoid infinite loop (getLabelFromKey->transnoentities->getTradFromKey), getLabelFromKey must * WARNING: To avoid infinite loop (getLabelFromKey->transnoentities->getTradFromKey), getLabelFromKey must
* not be called with same value than input. * not be called with same value than input.
* *
* @param key * @param string $key Key to translate
* @return string * @return string Translated string
*/ */
function getTradFromKey($key) function getTradFromKey($key)
{ {
@ -379,13 +379,13 @@ class Translate {
* et si toujours pas trouve, il est retourne tel quel * et si toujours pas trouve, il est retourne tel quel
* Les parametres de cette methode peuvent contenir de balises HTML. * Les parametres de cette methode peuvent contenir de balises HTML.
* *
* @param key cle de chaine a traduire * @param string $key Key to translate
* @param param1 chaine de param1 * @param string $param1 chaine de param1
* @param param2 chaine de param2 * @param string $param2 chaine de param2
* @param param3 chaine de param3 * @param string $param3 chaine de param3
* @param param4 chaine de param4 * @param string $param4 chaine de param4
* @param maxsize taille max * @param int $maxsize Max length of text
* @return string Chaine traduite et code en HTML * @return string Translated string (encoded into HTML entities and UTF8)
*/ */
function trans($key, $param1='', $param2='', $param3='', $param4='', $maxsize=0) 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 // We replace some HTML tags by __xx__ to avoid having them encoded by htmlentities
$str=str_replace(array('<','>','"',),array('__lt__','__gt__','__quot__'),$str); $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 // Crypt string into HTML
// $str est une chaine stockee en memoire au format $this->charset_output // $str est une chaine stockee en memoire au format $this->charset_output
@ -412,8 +412,9 @@ class Translate {
} }
else // Translation is not available else // Translation is not available
{ {
$str=$this->getTradFromKey($key); //$str=$this->getTradFromKey($key);
return $this->convToOutputCharset($str); //return $this->convToOutputCharset($str);
return $this->getTradFromKey($key);
} }
} }
@ -424,25 +425,16 @@ class Translate {
* et si toujours pas trouve, il est retourne tel quel. * et si toujours pas trouve, il est retourne tel quel.
* Parameters of this method must not contains any HTML tags. * Parameters of this method must not contains any HTML tags.
* *
* @param key key of string to translate * @param string $key Key to translate
* @param param1 chaine de param1 * @param string $param1 chaine de param1
* @param param2 chaine de param2 * @param string $param2 chaine de param2
* @param param3 chaine de param3 * @param string $param3 chaine de param3
* @param param4 chaine de param4 * @param string $param4 chaine de param4
* @return string chaine traduite * @return string Translated string (encoded into UTF8)
*/ */
function transnoentities($key, $param1='', $param2='', $param3='', $param4='') function transnoentities($key, $param1='', $param2='', $param3='', $param4='')
{ {
if (! empty($this->tab_translate[$key])) return $this->convToOutputCharset($this->transnoentitiesnoconv($key, $param1, $param2, $param3, $param4));
{
// Si la traduction est disponible
$newstr=sprintf($this->tab_translate[$key],$param1,$param2,$param3,$param4);
}
else
{
$newstr=$this->getTradFromKey($key);
}
return $this->convToOutputCharset($newstr);
} }
@ -453,25 +445,26 @@ class Translate {
* No convert to encoding charset of lang object is done. * No convert to encoding charset of lang object is done.
* Parameters of this method must not contains any HTML tags. * Parameters of this method must not contains any HTML tags.
* *
* @param key key of string to translate * @param string $key Key to translate
* @param param1 chaine de param1 * @param string $param1 chaine de param1
* @param param2 chaine de param1 * @param string $param2 chaine de param2
* @param param3 chaine de param1 * @param string $param3 chaine de param3
* @param param4 chaine de param1 * @param string $param4 chaine de param4
* @return string chaine traduite * @return string Translated string
*/ */
function transnoentitiesnoconv($key, $param1='', $param2='', $param3='', $param4='') 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 $str=$this->tab_translate[$key];
$newstr=sprintf($this->tab_translate[$key],$param1,$param2,$param3,$param4);
$str=sprintf($str,$param1,$param2,$param3,$param4);
} }
else 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 = "SELECT ".$fieldlabel." as label";
$sql.= " FROM ".MAIN_DB_PREFIX.$tablename; $sql.= " FROM ".MAIN_DB_PREFIX.$tablename;
$sql.= " WHERE ".$fieldkey." = '".$key."'"; $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); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
@ -664,7 +657,7 @@ class Translate {
else else
{ {
$this->error=$db->lasterror(); $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; return -1;
} }
} }

View File

@ -199,7 +199,7 @@ function GETPOST($paramname,$check='',$method=0)
if (! empty($check)) if (! empty($check))
{ {
// Check if numeric // 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 // Check if alpha
//if ($check == 'alpha' && ! preg_match('/^[ =:@#\/\\\(\)\-\._a-z0-9]+$/i',trim($out))) $out=''; //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. // '"' 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 * Return a formated address (part address/zip/town/state) according to country rules
* *
* @param outputlangs Output langs object * @param Object $object A company or contact object
* @param object A company or contact object * @return string Formated string
* @return string Formated string
*/ */
function dol_format_address($outputlangs,$object) function dol_format_address($object)
{ {
$ret=''; $ret='';
$countriesusingstate=array('US','IN'); $countriesusingstate=array('US','IN');
// Address // Address
$ret .= $outputlangs->convToOutputCharset($object->address); $ret .= $object->address;
// Zip/Town/State // Zip/Town/State
if (in_array($object->country_code,array('US'))) // US: town, state, zip 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)) 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 else // Other: zip town, state
{ {
$ret .= ($ret ? "\n" : '' ).$outputlangs->convToOutputCharset($object->zip); $ret .= ($ret ? "\n" : '' ).$object->zip;
$ret .= ' '.$outputlangs->convToOutputCharset($object->town); $ret .= ' '.$object->town;
if ($object->state && in_array($object->country_code,$countriesusingstate)) 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; global $conf,$langs;
if ($alt=="default") { if ($alt=="default") {
if ($numaction == -1) $alt=$langs->trans("ChangeDoNotContact"); if ($numaction == -1) $alt=$langs->transnoentitiesnoconv("ChangeDoNotContact");
if ($numaction == 0) $alt=$langs->trans("ChangeNeverContacted"); if ($numaction == 0) $alt=$langs->transnoentitiesnoconv("ChangeNeverContacted");
if ($numaction == 1) $alt=$langs->trans("ChangeToContact"); if ($numaction == 1) $alt=$langs->transnoentitiesnoconv("ChangeToContact");
if ($numaction == 2) $alt=$langs->trans("ChangeContactInProcess"); if ($numaction == 2) $alt=$langs->transnoentitiesnoconv("ChangeContactInProcess");
if ($numaction == 3) $alt=$langs->trans("ChangeContactDone"); if ($numaction == 3) $alt=$langs->transnoentitiesnoconv("ChangeContactDone");
} }
return '<img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/stcomm'.$numaction.'.png" border="0" alt="'.dol_escape_htmltag($alt).'" title="'.dol_escape_htmltag($alt).'">'; return '<img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/stcomm'.$numaction.'.png" border="0" alt="'.dol_escape_htmltag($alt).'" title="'.dol_escape_htmltag($alt).'">';
} }
@ -4418,7 +4417,7 @@ function printCommonFooter($zone='private')
{ {
global $conf; global $conf;
global $micro_start_time; global $micro_start_time;
if ($zone == 'private') print "\n".'<!-- Common footer for private page -->'."\n"; if ($zone == 'private') print "\n".'<!-- Common footer for private page -->'."\n";
else print "\n".'<!-- Common footer for public page -->'."\n"; else print "\n".'<!-- Common footer for public page -->'."\n";

View File

@ -190,7 +190,7 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
if ($mode == 'source') if ($mode == 'source')
{ {
$stringaddress .= ($stringaddress ? "\n" : '' ).dol_format_address($outputlangs,$sourcecompany)."\n"; $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($sourcecompany))."\n";
// Tel // Tel
if ($sourcecompany->tel) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($sourcecompany->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) if ($usecontact)
{ {
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset($targetcontact->getFullName($outputlangs,1)); $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 // Country
if ($targetcontact->pays_code && $targetcontact->pays_code != $sourcecompany->pays_code) $stringaddress.=$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcontact->pays_code))."\n"; if ($targetcontact->pays_code && $targetcontact->pays_code != $sourcecompany->pays_code) $stringaddress.=$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcontact->pays_code))."\n";
} }
else else
{ {
$stringaddress .= ($stringaddress ? "\n" : '' ).dol_format_address($outputlangs,$targetcompany)."\n"; $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($targetcompany))."\n";
// Country // Country
if ($targetcompany->pays_code && $targetcompany->pays_code != $sourcecompany->pays_code) $stringaddress.=$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcompany->pays_code))."\n"; 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) 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 // Tel
if ($deliverycompany->phone) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($deliverycompany->phone); 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 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); price(($object->lines[$i]->total_ht) + ($object->lines[$i]->total_ht)*($object->lines[$i]->tva_tx)/100);
} }
} }

View File

@ -64,15 +64,6 @@ function product_prepare_head($object, $user)
$h++; $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 // Multilangs
if($conf->global->MAIN_MULTILANGS) if($conf->global->MAIN_MULTILANGS)
{ {

View File

@ -1,154 +0,0 @@
<?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
*
* 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 <http://www.gnu.org/licenses/>.
* 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;
}
}
?>

View File

@ -24,7 +24,7 @@
* \brief Fichier de la classe permettant de generer les bordereaux envoi au modele Merou * \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."/contact/class/contact.class.php";
require_once(DOL_DOCUMENT_ROOT."/core/lib/company.lib.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/company.lib.php");
require_once(DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'); require_once(DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php');

View File

@ -24,7 +24,7 @@
* \brief Fichier de la classe permettant de generer les bordereaux envoi au modele Rouget * \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/company.lib.php");
require_once(DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'); require_once(DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php');

139
htdocs/core/modules/expedition/modules_expedition.php Executable file → Normal file
View File

@ -5,6 +5,7 @@
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -26,14 +27,47 @@
* \ingroup expedition * \ingroup expedition
* \brief File of class to manage expedition numbering * \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=''; var $error='';
/** /** Return if a module can be used or not
* Return if a module can be used or not *
* @return boolean true if module can be used * @return boolean true if module can be used
*/ */
function isEnabled() function isEnabled()
{ {
@ -96,4 +130,101 @@ class ModelNumRefExpedition
return $langs->trans("NotAvailable"); 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;
}
}
?> ?>

View File

@ -268,11 +268,11 @@ class modSociete extends DolibarrModules
$this->import_label[$r]='ImportDataset_company_1'; $this->import_label[$r]='ImportDataset_company_1';
$this->import_icon[$r]='company'; $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_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_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]');
//$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_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 // Import list of contact and attributes
/* $r++; /* $r++;

View File

@ -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."/product/class/html.formproduct.class.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/product.lib.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/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->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->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"); if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT."/commande/class/commande.class.php");

View File

@ -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; 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 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;

View File

@ -80,7 +80,7 @@ create table llx_societe
tva_assuj tinyint DEFAULT 1, -- assujeti ou non a la TVA tva_assuj tinyint DEFAULT 1, -- assujeti ou non a la TVA
localtax1_assuj tinyint DEFAULT 0, -- assujeti ou non a local tax 1 localtax1_assuj tinyint DEFAULT 0, -- assujeti ou non a local tax 1
localtax2_assuj tinyint DEFAULT 0, -- assujeti ou non a local tax 2 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 price_level integer NULL, -- level of price for multiprices
default_lang varchar(6), -- default language default_lang varchar(6), -- default language
logo varchar(255), logo varchar(255),

View File

@ -258,7 +258,7 @@ function html_print_paybox_footer($fromcompany,$langs)
$line1=""; $line1="";
if ($fromcompany->forme_juridique_code) if ($fromcompany->forme_juridique_code)
{ {
$line1.=($line1?" - ":"").$langs->convToOutputCharset(getFormeJuridiqueLabel($fromcompany->forme_juridique_code)); $line1.=($line1?" - ":"").getFormeJuridiqueLabel($fromcompany->forme_juridique_code);
} }
// Capital // Capital
if ($fromcompany->capital) if ($fromcompany->capital)
@ -270,14 +270,14 @@ function html_print_paybox_footer($fromcompany,$langs)
{ {
$field=$langs->transcountrynoentities("ProfId1",$fromcompany->pays_code); $field=$langs->transcountrynoentities("ProfId1",$fromcompany->pays_code);
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
$line1.=($line1?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof1); $line1.=($line1?" - ":"").$field.": ".$fromcompany->idprof1;
} }
// Prof Id 2 // Prof Id 2
if ($fromcompany->idprof2) if ($fromcompany->idprof2)
{ {
$field=$langs->transcountrynoentities("ProfId2",$fromcompany->pays_code); $field=$langs->transcountrynoentities("ProfId2",$fromcompany->pays_code);
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; 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 // Second line of company infos
@ -287,19 +287,19 @@ function html_print_paybox_footer($fromcompany,$langs)
{ {
$field=$langs->transcountrynoentities("ProfId3",$fromcompany->pays_code); $field=$langs->transcountrynoentities("ProfId3",$fromcompany->pays_code);
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
$line2.=($line2?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof3); $line2.=($line2?" - ":"").$field.": ".$fromcompany->idprof3;
} }
// Prof Id 4 // Prof Id 4
if ($fromcompany->idprof4) if ($fromcompany->idprof4)
{ {
$field=$langs->transcountrynoentities("ProfId4",$fromcompany->pays_code); $field=$langs->transcountrynoentities("ProfId4",$fromcompany->pays_code);
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
$line2.=($line2?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof4); $line2.=($line2?" - ":"").$field.": ".$fromcompany->idprof4;
} }
// IntraCommunautary VAT // IntraCommunautary VAT
if ($fromcompany->tva_intra != '') if ($fromcompany->tva_intra != '')
{ {
$line2.=($line2?" - ":"").$langs->transnoentities("VATIntraShort").": ".$langs->convToOutputCharset($fromcompany->tva_intra); $line2.=($line2?" - ":"").$langs->transnoentities("VATIntraShort").": ".$fromcompany->tva_intra;
} }
print '<br><br><hr>'."\n"; print '<br><br><hr>'."\n";

View File

@ -86,7 +86,7 @@ function html_print_paypal_footer($fromcompany,$langs)
$line1=""; $line1="";
if ($fromcompany->forme_juridique_code) if ($fromcompany->forme_juridique_code)
{ {
$line1.=($line1?" - ":"").$langs->convToOutputCharset(getFormeJuridiqueLabel($fromcompany->forme_juridique_code)); $line1.=($line1?" - ":"").getFormeJuridiqueLabel($fromcompany->forme_juridique_code);
} }
// Capital // Capital
if ($fromcompany->capital) if ($fromcompany->capital)
@ -98,14 +98,14 @@ function html_print_paypal_footer($fromcompany,$langs)
{ {
$field=$langs->transcountrynoentities("ProfId1",$fromcompany->pays_code); $field=$langs->transcountrynoentities("ProfId1",$fromcompany->pays_code);
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
$line1.=($line1?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof1); $line1.=($line1?" - ":"").$field.": ".$fromcompany->idprof1;
} }
// Prof Id 2 // Prof Id 2
if ($fromcompany->idprof2) if ($fromcompany->idprof2)
{ {
$field=$langs->transcountrynoentities("ProfId2",$fromcompany->pays_code); $field=$langs->transcountrynoentities("ProfId2",$fromcompany->pays_code);
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; 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 // Second line of company infos
@ -115,19 +115,19 @@ function html_print_paypal_footer($fromcompany,$langs)
{ {
$field=$langs->transcountrynoentities("ProfId3",$fromcompany->pays_code); $field=$langs->transcountrynoentities("ProfId3",$fromcompany->pays_code);
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
$line2.=($line2?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof3); $line2.=($line2?" - ":"").$field.": ".$fromcompany->idprof3;
} }
// Prof Id 4 // Prof Id 4
if ($fromcompany->idprof4) if ($fromcompany->idprof4)
{ {
$field=$langs->transcountrynoentities("ProfId4",$fromcompany->pays_code); $field=$langs->transcountrynoentities("ProfId4",$fromcompany->pays_code);
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
$line2.=($line2?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof4); $line2.=($line2?" - ":"").$field.": ".$fromcompany->idprof4;
} }
// IntraCommunautary VAT // IntraCommunautary VAT
if ($fromcompany->tva_intra != '') if ($fromcompany->tva_intra != '')
{ {
$line2.=($line2?" - ":"").$langs->transnoentities("VATIntraShort").": ".$langs->convToOutputCharset($fromcompany->tva_intra); $line2.=($line2?" - ":"").$langs->transnoentities("VATIntraShort").": ".$fromcompany->tva_intra;
} }
print '<br><br><hr>'."\n"; print '<br><br><hr>'."\n";
@ -156,7 +156,7 @@ function paypaladmin_prepare_head()
$h++; $h++;
$object=(object) array(); $object=(object) array();
// Show more tabs from modules // Show more tabs from modules
// Entries must be declared in modules descriptor with line // 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 add new tab

View File

@ -1,165 +0,0 @@
<?php
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
*
* 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 <http://www.gnu.org/licenses/>.
*/
/**
* \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 '<table class="border" width="100%">'."\n";
// Reference
print '<tr>';
print '<td width="15%">'.$langs->trans("Ref").'</td><td colspan="3">';
print $form->showrefnav($object,'ref','',1,'ref');
print '</td>';
print '</tr>'."\n";
// Libelle
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="2">'.$object->libelle.'</td>';
// 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);
print '<td width="300" align="center" rowspan="5">';
print '<!-- url barcode = '.$url.' -->';
print '<img src="'.$url.'">';
print '</td>';
print '</tr>'."\n";
// Status (to sell)
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Sell").')'.'</td><td>';
print $object->getLibStatut(2,0);
print '</td></tr>';
// Status (to buy)
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Buy").')'.'</td><td>';
print $object->getLibStatut(2,1);
print '</td></tr>';
// Barcode type
print '<tr><td nowrap>';
print '<table width="100%" class="nobordernopadding"><tr><td nowrap>';
print $langs->trans("BarcodeType");
print '<td>';
if (($_GET['action'] != 'editbarcodetype') && $user->rights->barcode->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbarcodetype&amp;id='.$object->id.'">'.img_edit($langs->trans('SetBarcodeType'),1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="2">';
if ($_GET['action'] == 'editbarcodetype')
{
$formbarcode->form_barcode_type($_SERVER['PHP_SELF'].'?id='.$object->id,$object->barcode_type,'barcodetype_id');
}
else
{
print $object->barcode_type_label?$object->barcode_type_label:'<div class="warning">'.$langs->trans("SetDefaultBarcodeType").'<div>';
}
print '</td></tr>'."\n";
// Barcode value
print '<tr><td nowrap>';
print '<table width="100%" class="nobordernopadding"><tr><td nowrap>';
print $langs->trans("BarcodeValue");
print '<td>';
if (($_GET['action'] != 'editbarcode') && $user->rights->barcode->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbarcode&amp;id='.$object->id.'">'.img_edit($langs->trans('SetBarcode'),1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="2">';
if ($_GET['action'] == 'editbarcode')
{
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="setbarcode">';
print '<input size="40" type="text" name="barcode" value="'.$object->barcode.'">';
print '&nbsp;<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
}
else
{
print $object->barcode;
}
print '</td></tr>'."\n";
print "</table>\n";
print "</div>\n";
$db->close();
llxFooter();
?>

View File

@ -37,7 +37,7 @@ class Product extends CommonObject
public $element='product'; public $element='product';
public $table_element='product'; public $table_element='product';
public $fk_element='fk_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 $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 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_buy;
var $accountancy_code_sell; var $accountancy_code_sell;
//! Codes barres //! barcode
var $barcode; var $barcode; // value
var $barcode_type; var $barcode_type; // id
var $barcode_type_code; var $barcode_type_code; // code (loaded by fetch_barcode)
var $barcode_type_label; var $barcode_type_label; // label (loaded by fetch_barcode)
var $barcode_type_coder; var $barcode_type_coder; // coder (loaded by fetch_barcode)
var $stats_propale=array(); var $stats_propale=array();
var $stats_commande=array(); var $stats_commande=array();
@ -403,7 +403,7 @@ class Product extends CommonObject
global $langs, $conf; global $langs, $conf;
$error=0; $error=0;
// Verification parametres // Verification parametres
if (! $this->libelle) $this->libelle = 'MISSING LABEL'; if (! $this->libelle) $this->libelle = 'MISSING LABEL';
@ -1100,35 +1100,6 @@ class Product extends CommonObject
// multilangs // multilangs
if ($conf->global->MAIN_MULTILANGS) $this->getMultiLangs(); 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 // Load multiprices array
if ($conf->global->PRODUIT_MULTIPRICES) 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 sdir Directory to scan
* @param size 0=original size, 1 use thumbnail if possible * @param size 0=original size, 1 use thumbnail if possible
* @param nbmax Nombre maximum de photos (0=pas de max) * @param nbmax Nombre maximum de photos (0=pas de max)
* @param nbbyrow Nombre vignettes par ligne (si mode vignette) * @param nbbyrow Nombre vignettes par ligne (si mode vignette)
* @param showfilename 1=Show filename * @param showfilename 1=Show filename
* @param showaction 1=Show icon with action links (resize, delete) * @param showaction 1=Show icon with action links (resize, delete)
* @param maxHeight Max height of image when size=1 * @param maxHeight Max height of image when size=1
* @param maxWidth Max width 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 * @return string Html code to show photo. Number of photos shown is saved in this->nbphoto
* TODO Move this into html.formproduct.class.php
*/ */
function show_photos($sdir,$size=0,$nbmax=0,$nbbyrow=5,$showfilename=0,$showaction=0,$maxHeight=120,$maxWidth=160) 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/'; $dirthumb = $dir.'thumbs/';
$pdirthumb = $pdir.'thumbs/'; $pdirthumb = $pdir.'thumbs/';
$return ='<!-- Photo -->'."\n"; $return ='<!-- Photo -->'."\n";
/*$return.="<script type=\"text/javascript\"> /*$return.="<script type=\"text/javascript\">
jQuery(function() { jQuery(function() {
@ -2715,6 +2685,7 @@ class Product extends CommonObject
return $return; return $return;
} }
/** /**
* Retourne tableau de toutes les photos du produit * Retourne tableau de toutes les photos du produit
* *

View File

@ -87,6 +87,26 @@ $error=$hookmanager->error; $errors=$hookmanager->errors;
if (empty($reshook)) if (empty($reshook))
{ {
// Barcode type
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;
}
// Barcode value
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;
}
if ($action == 'setproductaccountancycodebuy') if ($action == 'setproductaccountancycodebuy')
{ {
$product = new Product($db); $product = new Product($db);
@ -629,6 +649,7 @@ llxHeader('',$langs->trans("CardProduct".$_GET["type"]),$helpurl);
$form = new Form($db); $form = new Form($db);
$formproduct = new FormProduct($db); $formproduct = new FormProduct($db);
if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
{ {
// ----------------------------------------- // -----------------------------------------
@ -981,13 +1002,14 @@ else
if ($ret == 'html') print '<br>'; if ($ret == 'html') print '<br>';
} }
$isphoto=$object->is_photo_available($conf->product->dir_output); $showphoto=$object->is_photo_available($conf->product->dir_output);
$showbarcode=$conf->barcode->enabled && $user->rights->barcode->lire;
// En mode visu // En mode visu
print '<table class="border" width="100%"><tr>'; print '<table class="border" width="100%"><tr>';
// Ref // Ref
print '<td width="15%">'.$langs->trans("Ref").'</td><td colspan="'.(2+($isphoto?1:0)).'">'; print '<td width="15%">'.$langs->trans("Ref").'</td><td colspan="'.(2+(($showphoto||$showbarcode)?1:0)).'">';
print $form->showrefnav($object,'ref','',1,'ref'); print $form->showrefnav($object,'ref','',1,'ref');
print '</td>'; print '</td>';
@ -1000,17 +1022,66 @@ else
if ($object->type!=1) $nblignes++; if ($object->type!=1) $nblignes++;
if ($object->isservice()) $nblignes++; if ($object->isservice()) $nblignes++;
else $nblignes+=4; else $nblignes+=4;
if ($showbarcode) $nblignes+=2;
// Photo // Photo
if ($isphoto) if ($showphoto || $showbarcode)
{ {
print '<td valign="middle" align="center" width="25%" rowspan="'.$nblignes.'">'; print '<td valign="middle" align="center" width="25%" rowspan="'.$nblignes.'">';
print $object->show_photos($conf->product->dir_output,1,1,0,0,0,80); if ($showphoto) print $object->show_photos($conf->product->dir_output,1,1,0,0,0,80);
if ($showphoto && $showbarcode) print '<br><br>';
if ($showbarcode) print $form->showbarcode($object);
print '</td>'; print '</td>';
} }
print '</tr>'; print '</tr>';
if ($showbarcode)
{
// Barcode type
print '<tr><td nowrap>';
print '<table width="100%" class="nobordernopadding"><tr><td nowrap>';
print $langs->trans("BarcodeType");
print '<td>';
if (($_GET['action'] != 'editbarcodetype') && $user->rights->barcode->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbarcodetype&amp;id='.$object->id.'">'.img_edit($langs->trans('SetBarcodeType'),1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="2">';
if ($_GET['action'] == 'editbarcodetype')
{
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formbarcode.class.php");
$formbarcode = new FormBarCode($db);
$formbarcode->form_barcode_type($_SERVER['PHP_SELF'].'?id='.$object->id,$object->barcode_type,'barcodetype_id');
}
else
{
$object->fetch_barcode();
print $object->barcode_type_label?$object->barcode_type_label:'<div class="warning">'.$langs->trans("SetDefaultBarcodeType").'<div>';
}
print '</td></tr>'."\n";
// Barcode value
print '<tr><td nowrap>';
print '<table width="100%" class="nobordernopadding"><tr><td nowrap>';
print $langs->trans("BarcodeValue");
print '<td>';
if (($_GET['action'] != 'editbarcode') && $user->rights->barcode->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbarcode&amp;id='.$object->id.'">'.img_edit($langs->trans('SetBarcode'),1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="2">';
if ($_GET['action'] == 'editbarcode')
{
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="setbarcode">';
print '<input size="40" type="text" name="barcode" value="'.$object->barcode.'">';
print '&nbsp;<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
}
else
{
print $object->barcode;
}
print '</td></tr>'."\n";
}
// Accountancy sell code // Accountancy sell code
print '<tr><td>'.$form->editfieldkey("ProductAccountancySellCode",'productaccountancycodesell',$object->accountancy_code_sell,$object,$user->rights->produit->creer|$user->rights->service->creer).'</td><td colspan="2">'; print '<tr><td>'.$form->editfieldkey("ProductAccountancySellCode",'productaccountancycodesell',$object->accountancy_code_sell,$object,$user->rights->produit->creer|$user->rights->service->creer).'</td><td colspan="2">';
print $form->editfieldval("ProductAccountancySellCode",'productaccountancycodesell',$object->accountancy_code_sell,$object,$user->rights->produit->creer|$user->rights->service->creer); print $form->editfieldval("ProductAccountancySellCode",'productaccountancycodesell',$object->accountancy_code_sell,$object,$user->rights->produit->creer|$user->rights->service->creer);

View File

@ -107,7 +107,7 @@ if ($_GET["socid"])
if ($conf->global->MAIN_MODULE_BARCODE) if ($conf->global->MAIN_MODULE_BARCODE)
{ {
print '<tr><td>'.$langs->trans('Gencod').'</td><td colspan="3">'.$soc->gencod.'</td></tr>'; print '<tr><td>'.$langs->trans('Gencod').'</td><td colspan="3">'.$soc->barcode.'</td></tr>';
} }
print "<tr><td valign=\"top\">".$langs->trans('Address')."</td><td colspan=\"3\">"; print "<tr><td valign=\"top\">".$langs->trans('Address')."</td><td colspan=\"3\">";

View File

@ -153,7 +153,7 @@ abstract class ActionsCardCommon
$this->object->code_client = $_POST["code_client"]; $this->object->code_client = $_POST["code_client"];
$this->object->code_fournisseur = $_POST["code_fournisseur"]; $this->object->code_fournisseur = $_POST["code_fournisseur"];
$this->object->capital = $_POST["capital"]; $this->object->capital = $_POST["capital"];
$this->object->gencod = $_POST["gencod"]; $this->object->barcode = $_POST["barcode"];
$this->object->canvas = GETPOST("canvas"); $this->object->canvas = GETPOST("canvas");
$this->object->tva_assuj = $_POST["assujtva_value"]; $this->object->tva_assuj = $_POST["assujtva_value"];
@ -686,7 +686,7 @@ abstract class ActionsCardCommon
$this->object->idprof4 = $_POST["idprof4"]; $this->object->idprof4 = $_POST["idprof4"];
$this->object->typent_id = $_POST["typent_id"]; $this->object->typent_id = $_POST["typent_id"];
$this->object->effectif_id = $_POST["effectif_id"]; $this->object->effectif_id = $_POST["effectif_id"];
$this->object->gencod = $_POST["gencod"]; $this->object->barcode = $_POST["barcode"];
$this->object->forme_juridique_code = $_POST["forme_juridique_code"]; $this->object->forme_juridique_code = $_POST["forme_juridique_code"];
$this->object->default_lang = $_POST["default_lang"]; $this->object->default_lang = $_POST["default_lang"];
$this->object->commercial_id = $_POST["commercial_id"]; $this->object->commercial_id = $_POST["commercial_id"];

View File

@ -98,7 +98,7 @@
<?php if ($conf->global->MAIN_MODULE_BARCODE) { ?> <?php if ($conf->global->MAIN_MODULE_BARCODE) { ?>
<tr> <tr>
<td><?php echo $langs->trans('Gencod'); ?></td> <td><?php echo $langs->trans('Gencod'); ?></td>
<td colspan="3"><input type="text" name="gencod" value="<?php echo $this->control->tpl['gencod']; ?>"></td> <td colspan="3"><input type="text" name="barcode" value="<?php echo $this->control->tpl['barcode']; ?>"></td>
</tr> </tr>
<?php } ?> <?php } ?>

View File

@ -115,7 +115,7 @@ if ($this->control->tpl['fournisseur']) {
<?php if ($conf->global->MAIN_MODULE_BARCODE) { ?> <?php if ($conf->global->MAIN_MODULE_BARCODE) { ?>
<tr> <tr>
<td><?php echo $langs->trans('Gencod'); ?></td> <td><?php echo $langs->trans('Gencod'); ?></td>
<td colspan="3"><input type="text" name="gencod" value="<?php echo $this->control->tpl['gencod']; ?>"></td> <td colspan="3"><input type="text" name="barcode" value="<?php echo $this->control->tpl['barcode']; ?>"></td>
</tr> </tr>
<?php } ?> <?php } ?>

View File

@ -72,7 +72,7 @@ dol_fiche_head($head, 'card', $langs->trans("ThirdParty"),0,'company');
<?php if ($conf->global->MAIN_MODULE_BARCODE) { ?> <?php if ($conf->global->MAIN_MODULE_BARCODE) { ?>
<tr> <tr>
<td><?php echo $langs->trans('Gencod'); ?></td> <td><?php echo $langs->trans('Gencod'); ?></td>
<td colspan="3"><?php echo $this->control->tpl['gencod']; ?></td> <td colspan="3"><?php echo $this->control->tpl['barcode']; ?></td>
</tr> </tr>
<?php } ?> <?php } ?>

View File

@ -110,7 +110,7 @@ dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors']
<?php if ($conf->global->MAIN_MODULE_BARCODE) { ?> <?php if ($conf->global->MAIN_MODULE_BARCODE) { ?>
<tr> <tr>
<td><?php echo $langs->trans('Gencod'); ?></td> <td><?php echo $langs->trans('Gencod'); ?></td>
<td colspan="3"><input type="text" name="gencod" value="<?php echo $this->control->tpl['gencod']; ?>"></td> <td colspan="3"><input type="text" name="barcode" value="<?php echo $this->control->tpl['barcode']; ?>"></td>
</tr> </tr>
<?php } ?> <?php } ?>

View File

@ -112,7 +112,7 @@ if ($this->control->tpl['fournisseur']) {
<?php if ($conf->global->MAIN_MODULE_BARCODE) { ?> <?php if ($conf->global->MAIN_MODULE_BARCODE) { ?>
<tr> <tr>
<td><?php echo $langs->trans('Gencod'); ?></td> <td><?php echo $langs->trans('Gencod'); ?></td>
<td colspan="3"><input type="text" name="gencod" value="<?php echo $this->control->tpl['gencod']; ?>"></td> <td colspan="3"><input type="text" name="barcode" value="<?php echo $this->control->tpl['barcode']; ?>"></td>
</tr> </tr>
<?php } ?> <?php } ?>

View File

@ -71,7 +71,7 @@ dol_fiche_head($head, 'card', $langs->trans("ThirdParty"),0,'company');
<?php if ($conf->global->MAIN_MODULE_BARCODE) { ?> <?php if ($conf->global->MAIN_MODULE_BARCODE) { ?>
<tr> <tr>
<td><?php echo $langs->trans('Gencod'); ?></td> <td><?php echo $langs->trans('Gencod'); ?></td>
<td colspan="3"><?php echo $this->control->tpl['gencod']; ?></td> <td colspan="3"><?php echo $this->control->tpl['barcode']; ?></td>
</tr> </tr>
<?php } ?> <?php } ?>

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -48,18 +48,13 @@ class Address
/** /**
* \brief Constructeur de la classe * Constructeur de la classe
* \param DB handler acces base de donnees *
* \param id id societe (0 par defaut) * @param DoliDB $db handler acces base de donnees
*/ */
function Address($DB, $id=0) function Address($db)
{ {
global $conf; $this->db = $db;
$this->db = $DB;
$this->id = $id;
return 1; return 1;
} }
@ -242,12 +237,13 @@ class Address
} }
/** /**
* \brief Charge depuis la base toutes les adresses d'une societe * Charge depuis la base toutes les adresses d'une societe
* \param socid Id de la societe a charger en memoire *
* \param user Objet de l'utilisateur * @param int $socid Id de la societe a charger en memoire
* \return int >0 si ok, <0 si ko * @param User $user Objet de l'utilisateur
* @return int >0 si ok, <0 si ko
*/ */
function fetch($socid, $user=0) function fetch_lines($socid, $user=0)
{ {
global $langs, $conf; global $langs, $conf;
@ -337,10 +333,11 @@ class Address
} }
/** /**
* \brief Charge depuis la base l'objet adresse * Charge depuis la base l'objet adresse
* \param id Id de l'adresse a charger en memoire *
* \param user Objet de l'utilisateur * @param int $id Id de l'adresse a charger en memoire
* \return int >0 si ok, <0 si ko * @param User $user Objet de l'utilisateur
* @return int >0 si ok, <0 si ko
*/ */
function fetch_address($id, $user=0) function fetch_address($id, $user=0)
{ {

View File

@ -39,7 +39,7 @@ class Societe extends CommonObject
public $element='societe'; public $element='societe';
public $table_element = 'societe'; public $table_element = 'societe';
public $fk_element='fk_soc'; public $fk_element='fk_soc';
public $childtables=array("propal","commande","facture","contrat","facture_fourn","commande_fournisseur"); protected $childtables=array("propal","commande","facture","contrat","facture_fourn","commande_fournisseur");
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $id; var $id;
@ -74,7 +74,13 @@ class Societe extends CommonObject
var $fax; var $fax;
var $email; var $email;
var $url; var $url;
var $gencod;
//! 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)
// 4 identifiants professionnels (leur utilisation depend du pays) // 4 identifiants professionnels (leur utilisation depend du pays)
var $siren; // IdProf1 - Deprecated var $siren; // IdProf1 - Deprecated
@ -142,13 +148,13 @@ class Societe extends CommonObject
/** /**
* Constructor * Constructor
* *
* @param DoliDB $DB Database handler * @param DoliDB $db Database handler
*/ */
public function Societe($DB) public function Societe($db)
{ {
global $conf; global $conf;
$this->db = $DB; $this->db = $db;
$this->client = 0; $this->client = 0;
$this->prospect = 0; $this->prospect = 0;
@ -168,15 +174,15 @@ class Societe extends CommonObject
/** /**
* Create third party in database * Create third party in database
* *
* @param user Object of user that ask creation * @param User $user Object of user that ask creation
* @return int >= 0 if OK, < 0 if KO * @return int >= 0 if OK, < 0 if KO
*/ */
function create($user='') function create($user='')
{ {
global $langs,$conf; global $langs,$conf;
$error=0; $error=0;
// Clean parameters // Clean parameters
if (empty($this->status)) $this->status=0; if (empty($this->status)) $this->status=0;
$this->name=$this->name?trim($this->name):trim($this->nom); $this->name=$this->name?trim($this->name):trim($this->nom);
@ -365,13 +371,13 @@ class Societe extends CommonObject
/** /**
* Update parameters of third party * Update parameters of third party
* *
* @param id id societe * @param int $id id societe
* @param user Utilisateur qui demande la mise a jour * @param User $user Utilisateur qui demande la mise a jour
* @param call_trigger 0=non, 1=oui * @param int $call_trigger 0=non, 1=oui
* @param allowmodcodeclient Inclut modif code client et code compta * @param int $allowmodcodeclient Inclut modif code client et code compta
* @param allowmodcodefournisseur Inclut modif code fournisseur et code compta fournisseur * @param int $allowmodcodefournisseur Inclut modif code fournisseur et code compta fournisseur
* @param action 'create' or 'update' * @param string $action 'create' or 'update'
* @return int <0 if KO, >=0 if OK * @return int <0 if KO, >=0 if OK
*/ */
function update($id, $user='', $call_trigger=1, $allowmodcodeclient=0, $allowmodcodefournisseur=0, $action='update') function update($id, $user='', $call_trigger=1, $allowmodcodeclient=0, $allowmodcodefournisseur=0, $action='update')
{ {
@ -437,7 +443,7 @@ class Societe extends CommonObject
$this->forme_juridique_code=trim($this->forme_juridique_code); $this->forme_juridique_code=trim($this->forme_juridique_code);
//Gencod //Gencod
$this->gencod=trim($this->gencod); $this->barcode=trim($this->barcode);
// For automatic creation // For automatic creation
if ($this->code_client == -1) $this->get_codeclient($this->prefix_comm,0); if ($this->code_client == -1) $this->get_codeclient($this->prefix_comm,0);
@ -505,7 +511,7 @@ class Societe extends CommonObject
$sql .= ",client = " . ($this->client?$this->client:0); $sql .= ",client = " . ($this->client?$this->client:0);
$sql .= ",fournisseur = " . ($this->fournisseur?$this->fournisseur:0); $sql .= ",fournisseur = " . ($this->fournisseur?$this->fournisseur:0);
$sql .= ",gencod = ".($this->gencod?"'".$this->gencod."'":"null"); $sql .= ",barcode = ".($this->barcode?"'".$this->barcode."'":"null");
$sql .= ",default_lang = ".($this->default_lang?"'".$this->default_lang."'":"null"); $sql .= ",default_lang = ".($this->default_lang?"'".$this->default_lang."'":"null");
$sql .= ",logo = ".($this->logo?"'".$this->logo."'":"null"); $sql .= ",logo = ".($this->logo?"'".$this->logo."'":"null");
@ -610,6 +616,7 @@ class Societe extends CommonObject
/** /**
* Load a third party from database into memory * Load a third party from database into memory
*
* @param rowid Id of third party to load * @param rowid Id of third party to load
* @param ref Reference of third party, name (Warning, this can return several records) * @param ref Reference of third party, name (Warning, this can return several records)
* @param ref_ext External reference of third party (Warning, this information is a free field not provided by Dolibarr) * @param ref_ext External reference of third party (Warning, this information is a free field not provided by Dolibarr)
@ -637,7 +644,7 @@ class Societe extends CommonObject
$sql .= ', s.fk_typent as typent_id'; $sql .= ', s.fk_typent as typent_id';
$sql .= ', s.fk_effectif as effectif_id'; $sql .= ', s.fk_effectif as effectif_id';
$sql .= ', s.fk_forme_juridique as forme_juridique_code'; $sql .= ', s.fk_forme_juridique as forme_juridique_code';
$sql .= ', s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur, s.parent, s.gencod'; $sql .= ', s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur, s.parent, s.barcode';
$sql .= ', s.fk_departement, s.fk_pays, s.fk_stcomm, s.remise_client, s.mode_reglement, s.cond_reglement, s.tva_assuj'; $sql .= ', s.fk_departement, s.fk_pays, s.fk_stcomm, s.remise_client, s.mode_reglement, s.cond_reglement, s.tva_assuj';
$sql .= ', s.localtax1_assuj, s.localtax2_assuj, s.fk_prospectlevel, s.default_lang, s.logo'; $sql .= ', s.localtax1_assuj, s.localtax2_assuj, s.fk_prospectlevel, s.default_lang, s.logo';
$sql .= ', s.import_key'; $sql .= ', s.import_key';
@ -736,7 +743,7 @@ class Societe extends CommonObject
$this->code_compta = $obj->code_compta; $this->code_compta = $obj->code_compta;
$this->code_compta_fournisseur = $obj->code_compta_fournisseur; $this->code_compta_fournisseur = $obj->code_compta_fournisseur;
$this->gencod = $obj->gencod; $this->barcode = $obj->barcode;
$this->tva_assuj = $obj->tva_assuj; $this->tva_assuj = $obj->tva_assuj;
$this->tva_intra = $obj->tva_intra; $this->tva_intra = $obj->tva_intra;
@ -803,65 +810,12 @@ class Societe extends CommonObject
return $result; return $result;
} }
/**
* Lit une adresse
* TODO: utiliser la classe address
*/
function fetch_address($id)
{
global $conf,$langs;
$sql = "SELECT l.rowid, l.label, l.fk_soc, l.name, l.address, l.cp";
$sql .= ", l.tms as dm, l.datec as dc";
$sql .= ", l.ville, l.fk_pays, l.note, l.tel, l.fax";
$sql .= ", p.libelle as pays, p.code as pays_code";
$sql .= " FROM ".MAIN_DB_PREFIX."societe_address as l";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_pays as p ON l.fk_pays = p.rowid";
$sql .= " WHERE l.rowid = ".$id;
$result = $this->db->query($sql);
if ( $result )
{
$obj = $this->db->fetch_object($result);
$this->id = $obj->rowid;
$this->datec = $this->db->jdate($obj->dc);
$this->datem = $this->db->jdate($obj->dm);
$this->label = $obj->label;
$this->socid = $obj->fk_soc;
$this->name = $obj->name;
$this->address = $obj->address;
$this->cp = $obj->cp; // TODO deprecated
$this->zip = $obj->cp;
$this->ville = $obj->ville; // TODO deprecated
$this->town = $obj->ville;
$this->pays_id = $obj->fk_pays;
$this->pays_code = $obj->fk_pays?$obj->pays_code:'';
$this->pays = $obj->fk_pays?($langs->trans('Country'.$obj->pays_code)!='Country'.$obj->pays_code?$langs->trans('Country'.$obj->pays_code):$obj->pays):''; // TODO deprecated
$this->country = $obj->fk_pays?($langs->trans('Country'.$obj->pays_code)!='Country'.$obj->pays_code?$langs->trans('Country'.$obj->pays_code):$obj->pays):'';
$this->tel = $obj->tel; // TODO deprecated
$this->phone = $obj->tel;
$this->fax = $obj->fax;
$this->note = $obj->note;
$this->db->free($result);
return 1;
}
else
{
$this->error=$this->db->error();
return -1;
}
}
/** /**
* Delete a third party from database and all its dependencies (contacts, rib...) * Delete a third party from database and all its dependencies (contacts, rib...)
* *
* @param id id of third party to delete * @param int $id Id of third party to delete
* @return int <0 if KO, 0 if nothing done, >0 if OK * @return int <0 if KO, 0 if nothing done, >0 if OK
*/ */
function delete($id) function delete($id)
{ {
@ -2357,7 +2311,7 @@ class Societe extends CommonObject
/** /**
* Create a third party into database from a member object * Create a third party into database from a member object
* *
* @param member Object member * @param member Object member
* @param socname Name of third party to force * @param socname Name of third party to force
* @return int <0 if KO, id of created account if OK * @return int <0 if KO, id of created account if OK

View File

@ -135,7 +135,7 @@ if (empty($reshook))
$object->code_client = $_POST["code_client"]; $object->code_client = $_POST["code_client"];
$object->code_fournisseur = $_POST["code_fournisseur"]; $object->code_fournisseur = $_POST["code_fournisseur"];
$object->capital = $_POST["capital"]; $object->capital = $_POST["capital"];
$object->gencod = $_POST["gencod"]; $object->barcode = $_POST["barcode"];
$object->tva_intra = $_POST["tva_intra"]; $object->tva_intra = $_POST["tva_intra"];
$object->tva_assuj = $_POST["assujtva_value"]; $object->tva_assuj = $_POST["assujtva_value"];
@ -535,7 +535,7 @@ else
$object->email = $_POST["email"]; $object->email = $_POST["email"];
$object->url = $_POST["url"]; $object->url = $_POST["url"];
$object->capital = $_POST["capital"]; $object->capital = $_POST["capital"];
$object->gencod = $_POST["gencod"]; $object->barcode = $_POST["barcode"];
$object->idprof1 = $_POST["idprof1"]; $object->idprof1 = $_POST["idprof1"];
$object->idprof2 = $_POST["idprof2"]; $object->idprof2 = $_POST["idprof2"];
$object->idprof3 = $_POST["idprof3"]; $object->idprof3 = $_POST["idprof3"];
@ -757,7 +757,7 @@ else
// Barcode // Barcode
if ($conf->global->MAIN_MODULE_BARCODE) if ($conf->global->MAIN_MODULE_BARCODE)
{ {
print '<tr><td>'.$langs->trans('Gencod').'</td><td colspan="3"><input type="text" name="gencod" value="'.$object->gencod.'">'; print '<tr><td>'.$langs->trans('Gencod').'</td><td colspan="3"><input type="text" name="barcode" value="'.$object->barcode.'">';
print '</td></tr>'; print '</td></tr>';
} }
@ -1040,7 +1040,7 @@ else
$object->idprof4=$_POST["idprof4"]; $object->idprof4=$_POST["idprof4"];
$object->typent_id=$_POST["typent_id"]; $object->typent_id=$_POST["typent_id"];
$object->effectif_id=$_POST["effectif_id"]; $object->effectif_id=$_POST["effectif_id"];
$object->gencod=$_POST["gencod"]; $object->barcode=$_POST["barcode"];
$object->forme_juridique_code=$_POST["forme_juridique_code"]; $object->forme_juridique_code=$_POST["forme_juridique_code"];
$object->default_lang=$_POST["default_lang"]; $object->default_lang=$_POST["default_lang"];
@ -1193,18 +1193,18 @@ else
} }
} }
// Barcode
if ($conf->global->MAIN_MODULE_BARCODE)
{
print '<tr><td valign="top">'.$langs->trans('Gencod').'</td><td colspan="3"><input type="text" name="barcode" value="'.$object->barcode.'">';
print '</td></tr>';
}
// Status // Status
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">'; print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">';
print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$object->status); print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$object->status);
print '</td></tr>'; print '</td></tr>';
// Barcode
if ($conf->global->MAIN_MODULE_BARCODE)
{
print '<tr><td valign="top">'.$langs->trans('Gencod').'</td><td colspan="3"><input type="text" name="gencod" value="'.$object->gencod.'">';
print '</td></tr>';
}
// Address // Address
print '<tr><td valign="top">'.$langs->trans('Address').'</td><td colspan="3"><textarea name="adresse" cols="40" rows="3" wrap="soft">'; print '<tr><td valign="top">'.$langs->trans('Address').'</td><td colspan="3"><textarea name="adresse" cols="40" rows="3" wrap="soft">';
print $object->address; print $object->address;
@ -1442,6 +1442,9 @@ else
dol_htmloutput_errors($error,$errors); dol_htmloutput_errors($error,$errors);
$showlogo=$object->logo;
$showbarcode=($conf->barcode->enabled && $user->rights->barcode->lire);
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Ref // Ref
@ -1460,84 +1463,89 @@ else
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
// Logo // Logo+barcode
$rowspan=4; $rowspan=4;
if (! empty($conf->global->SOCIETE_USEPREFIX)) $rowspan++; if (! empty($conf->global->SOCIETE_USEPREFIX)) $rowspan++;
if ($object->client) $rowspan++; if ($object->client) $rowspan++;
if ($conf->fournisseur->enabled && $object->fournisseur && ! empty($user->rights->fournisseur->lire)) $rowspan++; if ($conf->fournisseur->enabled && $object->fournisseur && ! empty($user->rights->fournisseur->lire)) $rowspan++;
if ($conf->global->MAIN_MODULE_BARCODE) $rowspan++; if ($conf->global->MAIN_MODULE_BARCODE) $rowspan++;
if (empty($conf->global->SOCIETE_DISABLE_STATE)) $rowspan++; if (empty($conf->global->SOCIETE_DISABLE_STATE)) $rowspan++;
$showlogo=''; $htmllogobar='';
if ($object->logo) if ($showlogo || $showbarcode)
{ {
$showlogo.='<td rowspan="'.$rowspan.'" style="text-align: center;" width="25%">'; $htmllogobar.='<td rowspan="'.$rowspan.'" style="text-align: center;" width="25%">';
$showlogo.=$form->showphoto('societe',$object,50); if ($showlogo) $htmllogobar.=$form->showphoto('societe',$object,50);
$showlogo.='</td>'; if ($showlogo && $showbarcode) $htmllogobar.='<br><br>';
if ($showbarcode) $htmllogobar.=$form->showbarcode($object,50);
$htmllogobar.='</td>';
} }
// Prefix
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
{ {
print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="'.(2+($object->logo?0:1)).'">'.$object->prefix_comm.'</td>'; print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="'.(2+(($showlogo || $showbarcode)?0:1)).'">'.$object->prefix_comm.'</td>';
print $showlogo; $showlogo=''; print $htmllogobar; $htmllogobar='';
print '</tr>'; print '</tr>';
} }
// Customer code
if ($object->client) if ($object->client)
{ {
print '<tr><td>'; print '<tr><td>';
print $langs->trans('CustomerCode').'</td><td colspan="'.(2+($object->logo?0:1)).'">'; print $langs->trans('CustomerCode').'</td><td colspan="'.(2+(($showlogo || $showbarcode)?0:1)).'">';
print $object->code_client; print $object->code_client;
if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>'; if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
print '</td>'; print '</td>';
print $showlogo; $showlogo=''; print $htmllogobar; $htmllogobar='';
print '</tr>'; print '</tr>';
} }
// Supplier code
if ($conf->fournisseur->enabled && $object->fournisseur && ! empty($user->rights->fournisseur->lire)) if ($conf->fournisseur->enabled && $object->fournisseur && ! empty($user->rights->fournisseur->lire))
{ {
print '<tr><td>'; print '<tr><td>';
print $langs->trans('SupplierCode').'</td><td colspan="'.(2+($object->logo?0:1)).'">'; print $langs->trans('SupplierCode').'</td><td colspan="'.(2+(($showlogo || $showbarcode)?0:1)).'">';
print $object->code_fournisseur; print $object->code_fournisseur;
if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>'; if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
print '</td>'; print '</td>';
print $showlogo; $showlogo=''; print $htmllogobar; $htmllogobar='';
print '</tr>'; print '</tr>';
} }
// Status
print '<tr><td>'.$langs->trans("Status").'</td>';
print '<td colspan="'.(2+($object->logo?0:1)).'">';
print $object->getLibStatut(2);
print '</td>';
print $showlogo; $showlogo='';
print '</tr>';
// Barcode // Barcode
if ($conf->global->MAIN_MODULE_BARCODE) if ($conf->global->MAIN_MODULE_BARCODE)
{ {
print '<tr><td>'.$langs->trans('Gencod').'</td><td colspan="'.(2+($object->logo?0:1)).'">'.$object->gencod.'</td></tr>'; print '<tr><td>'.$langs->trans('Gencod').'</td><td colspan="'.(2+(($showlogo || $showbarcode)?0:1)).'">'.$object->barcode.'</td></tr>';
} }
// Status
print '<tr><td>'.$langs->trans("Status").'</td>';
print '<td colspan="'.(2+(($showlogo || $showbarcode)?0:1)).'">';
print $object->getLibStatut(2);
print '</td>';
print $htmllogobar; $htmllogobar='';
print '</tr>';
// Address // Address
print "<tr><td valign=\"top\">".$langs->trans('Address').'</td><td colspan="'.(2+($object->logo?0:1)).'">'; print "<tr><td valign=\"top\">".$langs->trans('Address').'</td><td colspan="'.(2+(($showlogo || $showbarcode)?0:1)).'">';
dol_print_address($object->address,'gmap','thirdparty',$object->id); dol_print_address($object->address,'gmap','thirdparty',$object->id);
print "</td></tr>"; print "</td></tr>";
// Zip / Town // Zip / Town
print '<tr><td width="25%">'.$langs->trans('Zip').' / '.$langs->trans("Town").'</td><td colspan="'.(2+($object->logo?0:1)).'">'; print '<tr><td width="25%">'.$langs->trans('Zip').' / '.$langs->trans("Town").'</td><td colspan="'.(2+(($showlogo || $showbarcode)?0:1)).'">';
print $object->cp.($object->cp && $object->ville?" / ":"").$object->ville; print $object->cp.($object->cp && $object->ville?" / ":"").$object->ville;
print "</td>"; print "</td>";
print '</tr>'; print '</tr>';
// Country // Country
print '<tr><td>'.$langs->trans("Country").'</td><td colspan="'.(2+($object->logo?0:1)).'" nowrap="nowrap">'; print '<tr><td>'.$langs->trans("Country").'</td><td colspan="'.(2+(($showlogo || $showbarcode)?0:1)).'" nowrap="nowrap">';
$img=picto_from_langcode($object->pays_code); $img=picto_from_langcode($object->pays_code);
if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->pays,$langs->trans("CountryIsInEEC"),1,0); if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->pays,$langs->trans("CountryIsInEEC"),1,0);
else print ($img?$img.' ':'').$object->pays; else print ($img?$img.' ':'').$object->pays;
print '</td></tr>'; print '</td></tr>';
// State // State
if (empty($conf->global->SOCIETE_DISABLE_STATE)) print '<tr><td>'.$langs->trans('State').'</td><td colspan="'.(2+($object->logo?0:1)).'">'.$object->state.'</td>'; if (empty($conf->global->SOCIETE_DISABLE_STATE)) print '<tr><td>'.$langs->trans('State').'</td><td colspan="'.(2+(($showlogo || $showbarcode)?0:1)).'">'.$object->state.'</td>';
print '<tr><td>'.$langs->trans('Phone').'</td><td style="min-width: 25%;">'.dol_print_phone($object->tel,$object->pays_code,0,$object->id,'AC_TEL').'</td>'; print '<tr><td>'.$langs->trans('Phone').'</td><td style="min-width: 25%;">'.dol_print_phone($object->tel,$object->pays_code,0,$object->id,'AC_TEL').'</td>';
print '<td>'.$langs->trans('Fax').'</td><td style="min-width: 25%;">'.dol_print_phone($object->fax,$object->pays_code,0,$object->id,'AC_FAX').'</td></tr>'; print '<td>'.$langs->trans('Fax').'</td><td style="min-width: 25%;">'.dol_print_phone($object->fax,$object->pays_code,0,$object->id,'AC_FAX').'</td></tr>';

View File

@ -1,2 +1,2 @@
"Name* (s.nom)";"Status (s.status)";"Customer* (s.client)";"Supplier* (s.fournisseur)";"DateCreation (s.datec)";"CustomerCode (s.code_client)";"SupplierCode (s.code_fournisseur)";"Address (s.address)";"Zip (s.cp)";"Town (s.ville)";"Phone (s.tel)";"Fax (s.fax)";"Url (s.url)";"Email (s.email)";"IdProf1 (s.siret)";"IdProf2 (s.siren)";"IdProf3 (s.ape)";"IdProf4 (s.idprof4)";"VATIntraShort (s.tva_intra)";"Capital (s.capital)";"Note (s.note)";"ThirdPartyType (s.fk_typent)";"Effectif (s.fk_effectif)";"JuridicalStatus (s.fk_forme_juridique)";"ProspectLevel (s.fk_prospectlevel)";"ProspectStatus (s.fk_stcomm)";"DefaultLanguage (s.default_lang)";"BarCode (s.gencod)" "Name* (s.nom)";"Status (s.status)";"Customer* (s.client)";"Supplier* (s.fournisseur)";"DateCreation (s.datec)";"CustomerCode (s.code_client)";"SupplierCode (s.code_fournisseur)";"Address (s.address)";"Zip (s.cp)";"Town (s.ville)";"Phone (s.tel)";"Fax (s.fax)";"Url (s.url)";"Email (s.email)";"IdProf1 (s.siret)";"IdProf2 (s.siren)";"IdProf3 (s.ape)";"IdProf4 (s.idprof4)";"VATIntraShort (s.tva_intra)";"Capital (s.capital)";"Note (s.note)";"ThirdPartyType (s.fk_typent)";"Effectif (s.fk_effectif)";"JuridicalStatus (s.fk_forme_juridique)";"ProspectLevel (s.fk_prospectlevel)";"ProspectStatus (s.fk_stcomm)";"DefaultLanguage (s.default_lang)";"BarCode (s.barcode)"
"MyBigCompanyImport1";1;3;1;01/01/00;"CU01-0001";"SU01-0001";"61 jump street";123456;"Big town";101010101;101010102;"http://mycompany.com";"test@mycompany.com";;;;;"FR0123456789";10000;"This is an example of note for record";2;3;1;"PL_MEDIUM";1;"en_US";123456789 "MyBigCompanyImport1";1;3;1;01/01/00;"CU01-0001";"SU01-0001";"61 jump street";123456;"Big town";101010101;101010102;"http://mycompany.com";"test@mycompany.com";;;;;"FR0123456789";10000;"This is an example of note for record";2;3;1;"PL_MEDIUM";1;"en_US";123456789

1 Name* (s.nom) Status (s.status) Customer* (s.client) Supplier* (s.fournisseur) DateCreation (s.datec) CustomerCode (s.code_client) SupplierCode (s.code_fournisseur) Address (s.address) Zip (s.cp) Town (s.ville) Phone (s.tel) Fax (s.fax) Url (s.url) Email (s.email) IdProf1 (s.siret) IdProf2 (s.siren) IdProf3 (s.ape) IdProf4 (s.idprof4) VATIntraShort (s.tva_intra) Capital (s.capital) Note (s.note) ThirdPartyType (s.fk_typent) Effectif (s.fk_effectif) JuridicalStatus (s.fk_forme_juridique) ProspectLevel (s.fk_prospectlevel) ProspectStatus (s.fk_stcomm) DefaultLanguage (s.default_lang) BarCode (s.gencod) BarCode (s.barcode)
2 MyBigCompanyImport1 1 3 1 01/01/00 CU01-0001 SU01-0001 61 jump street 123456 Big town 101010101 101010102 http://mycompany.com test@mycompany.com FR0123456789 10000 This is an example of note for record 2 3 1 PL_MEDIUM 1 en_US 123456789 123456789