mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-13 19:25:22 +01:00
Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
@@ -5,6 +5,7 @@ English Dolibarr ChangeLog
|
||||
***** ChangeLog for 3.2 compared to 3.1 *****
|
||||
|
||||
For users:
|
||||
- New: show thirdparty barcode on main tab.
|
||||
- New: Can input note (private and public) during note and expenses creation.
|
||||
- New: Print ticket show invoice ref into POS module.
|
||||
- New: Can edit customer discounts from invoice create and edit card.
|
||||
|
||||
@@ -1,4 +1,19 @@
|
||||
README (English)
|
||||
--------------------------------
|
||||
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.
|
||||
@@ -66,7 +66,7 @@ if ( (isset($_POST["action"]) && $_POST["action"] == 'update' && empty($_POST["c
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MAIL",$_POST["mail"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_WEB",$_POST["web"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOTE",$_POST["note"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_GENCOD",$_POST["gencod"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_GENCOD",$_POST["barcode"],'chaine',0,'',$conf->entity);
|
||||
if ($_FILES["logo"]["tmp_name"])
|
||||
{
|
||||
if (preg_match('/([^\\/:]+)$/i',$_FILES["logo"]["name"],$reg))
|
||||
@@ -346,7 +346,7 @@ if ((isset($_GET["action"]) && $_GET["action"] == 'edit')
|
||||
{
|
||||
$var=!$var;
|
||||
print '<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>';
|
||||
}
|
||||
|
||||
|
||||
@@ -646,7 +646,7 @@ else
|
||||
else
|
||||
{
|
||||
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 '<br>';
|
||||
|
||||
@@ -306,7 +306,7 @@ else
|
||||
else
|
||||
{
|
||||
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 '<br>';
|
||||
|
||||
@@ -98,7 +98,7 @@ body {
|
||||
</div>
|
||||
<div class="infos">
|
||||
<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 class="date_heure"><?php
|
||||
|
||||
@@ -222,7 +222,7 @@ if ($socid)
|
||||
|
||||
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
|
||||
|
||||
@@ -3,17 +3,17 @@
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
@@ -133,7 +133,7 @@ class ActionComm extends CommonObject
|
||||
}
|
||||
else if ($result == 0)
|
||||
{
|
||||
$this->error='Failed to get record with code AC_OTH from dictionnary "type of events"';
|
||||
$this->error='Failed to get record with code '.$this->type_code.' from dictionnary "type of events"';
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
@@ -864,17 +864,17 @@ class ActionComm extends CommonObject
|
||||
//print $datestart.'x'; exit;
|
||||
$dateend=$this->db->jdate($obj->datep2);
|
||||
$duration=$obj->durationp;
|
||||
$event['summary']=$langs->convToOutputCharset($obj->label.($obj->socname?" (".$obj->socname.")":""));
|
||||
$event['desc']=$langs->convToOutputCharset($obj->note);
|
||||
$event['summary']=$obj->label.($obj->socname?" (".$obj->socname.")":"");
|
||||
$event['desc']=$obj->note;
|
||||
$event['startdate']=$datestart;
|
||||
$event['duration']=$duration; // Not required with type 'journal'
|
||||
$event['enddate']=$dateend; // Not required with type 'journal'
|
||||
$event['author']=$obj->firstname.($obj->name?" ".$obj->name:"");
|
||||
$event['priority']=$obj->priority;
|
||||
$event['fulldayevent']=$obj->fulldayevent;
|
||||
$event['location']=$langs->convToOutputCharset($obj->location);
|
||||
$event['location']=$obj->location;
|
||||
$event['transparency']='TRANSPARENT'; // OPAQUE (busy) or TRANSPARENT (not busy)
|
||||
$event['category']=$langs->convToOutputCharset($obj->libelle); // libelle type action
|
||||
$event['category']=$obj->libelle; // libelle type action
|
||||
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',$dolibarr_main_url_root);
|
||||
$url=$urlwithouturlroot.DOL_URL_ROOT.'/comm/action/fiche.php?id='.$obj->id;
|
||||
$event['url']=$url;
|
||||
@@ -898,21 +898,21 @@ class ActionComm extends CommonObject
|
||||
|
||||
// Define title and desc
|
||||
$more='';
|
||||
if ($login) $more=$langs->transnoentities("User").' '.$langs->convToOutputCharset($login);
|
||||
if ($logina) $more=$langs->transnoentities("ActionsAskedBy").' '.$langs->convToOutputCharset($logina);
|
||||
if ($logint) $more=$langs->transnoentities("ActionsToDoBy").' '.$langs->convToOutputCharset($logint);
|
||||
if ($logind) $more=$langs->transnoentities("ActionsDoneBy").' '.$langs->convToOutputCharset($logind);
|
||||
if ($login) $more=$langs->transnoentities("User").' '.$login;
|
||||
if ($logina) $more=$langs->transnoentities("ActionsAskedBy").' '.$logina;
|
||||
if ($logint) $more=$langs->transnoentities("ActionsToDoBy").' '.$logint;
|
||||
if ($logind) $more=$langs->transnoentities("ActionsDoneBy").' '.$logind;
|
||||
if ($more)
|
||||
{
|
||||
$title=$langs->convToOutputCharset('Dolibarr actions '.$mysoc->name).' - '.$more;
|
||||
$title='Dolibarr actions '.$mysoc->name.' - '.$more;
|
||||
$desc=$more;
|
||||
$desc.=$langs->convToOutputCharset(' ('.$mysoc->name.' - built by Dolibarr)');
|
||||
$desc.=' ('.$mysoc->name.' - built by Dolibarr)';
|
||||
}
|
||||
else
|
||||
{
|
||||
$title=$langs->convToOutputCharset('Dolibarr actions '.$mysoc->name);
|
||||
$title='Dolibarr actions '.$mysoc->name;
|
||||
$desc=$langs->transnoentities('ListOfActions');
|
||||
$desc.=$langs->convToOutputCharset(' ('.$mysoc->name.' - built by Dolibarr)');
|
||||
$desc.=' ('.$mysoc->name.' - built by Dolibarr)';
|
||||
}
|
||||
|
||||
// Create temp file
|
||||
|
||||
@@ -214,7 +214,7 @@ if ($_GET["action"] == 'create' || $_POST["action"] == 'create')
|
||||
$address->pays = $obj->libelle;
|
||||
}
|
||||
|
||||
print_titre($langs->trans("NewAddress"));
|
||||
print_titre($langs->trans("AddAddress"));
|
||||
print "<br>\n";
|
||||
|
||||
if ($address->error)
|
||||
@@ -258,7 +258,7 @@ if ($_GET["action"] == 'create' || $_POST["action"] == 'create')
|
||||
|
||||
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 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 '</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 '<br><center>';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans('AddAddress').'"></center>'."\n";
|
||||
|
||||
print '</form>'."\n";
|
||||
|
||||
}
|
||||
@@ -411,7 +412,7 @@ else
|
||||
* Fiche societe en mode visu
|
||||
*/
|
||||
$address = new Address($db);
|
||||
$result=$address->fetch($socid);
|
||||
$result=$address->fetch_lines($socid);
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_print_error($db,$address->error);
|
||||
|
||||
@@ -1260,7 +1260,7 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('PaymentConditionsShort');
|
||||
print '</td>';
|
||||
if ($action != 'editconditions' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editconditions&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&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetConditions'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($action == 'editconditions')
|
||||
@@ -1280,7 +1280,7 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('DeliveryDate');
|
||||
print '</td>';
|
||||
if ($action != 'editdate_livraison' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdate_livraison&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&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetDeliveryDate'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($action == 'editdate_livraison')
|
||||
@@ -1307,7 +1307,7 @@ if ($id > 0 || ! empty($ref))
|
||||
print $langs->trans('DeliveryAddress');
|
||||
print '</td>';
|
||||
|
||||
if ($action != 'editdelivery_address' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdelivery_address&socid='.$object->socid.'&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&socid='.$object->socid.'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetDeliveryAddress'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
|
||||
@@ -1328,7 +1328,7 @@ if ($id > 0 || ! empty($ref))
|
||||
print $langs->trans('AvailabilityPeriod');
|
||||
if ($conf->commande->enabled) print ' ('.$langs->trans('AfterOrder').')';
|
||||
print '</td>';
|
||||
if ($action != 'editavailability' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editavailability&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&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetAvailability'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($action == 'editavailability')
|
||||
@@ -1348,7 +1348,7 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('Source');
|
||||
print '</td>';
|
||||
if ($action != 'editdemandreason' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdemandreason&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&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetDemandReason'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
//print $object->demand_reason_id;
|
||||
@@ -1370,7 +1370,7 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('PaymentMode');
|
||||
print '</td>';
|
||||
if ($action != 'editmode' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editmode&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&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetMode'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($action == 'editmode')
|
||||
@@ -1392,7 +1392,7 @@ if ($id > 0 || ! empty($ref))
|
||||
print $langs->trans('Project').'</td>';
|
||||
if ($user->rights->propale->creer)
|
||||
{
|
||||
if ($action != 'classify') print '<td align="right"><a href="'.$_SERVER['PHP_SELF'].'?action=classify&id='.$object->id.'">'.img_edit($langs->trans('SetProject')).'</a></td>';
|
||||
if ($action != 'classify') print '<td align="right"><a href="'.$_SERVER['PHP_SELF'].'?action=classify&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($action == 'classify')
|
||||
|
||||
@@ -81,19 +81,19 @@ class CMailFile
|
||||
/**
|
||||
* CMailFile
|
||||
*
|
||||
* @param subject Topic/Subject of mail
|
||||
* @param 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 msg Message
|
||||
* @param filename_list List of files to attach (full path of filename on file system)
|
||||
* @param mimetype_list List of MIME type of attached files
|
||||
* @param mimefilename_list List of attached file name in message
|
||||
* @param addr_cc Email cc
|
||||
* @param addr_bcc Email bcc
|
||||
* @param deliveryreceipt Ask a delivery receipt
|
||||
* @param msgishtml 1=String IS already html, 0=String IS NOT html, -1=Unknown need autodetection
|
||||
* @param errors_to Email errors
|
||||
* @param css Css option
|
||||
* @param string $subject Topic/Subject of mail
|
||||
* @param string $to Recipients emails (RFC 2822: "Nom prenom <email>[, ...]" ou "email[, ...]" ou "<email>[, ...]")
|
||||
* @param string $from Sender email (RFC 2822: "Nom prenom <email>[, ...]" ou "email[, ...]" ou "<email>[, ...]")
|
||||
* @param string $msg Message
|
||||
* @param array $filename_list List of files to attach (full path of filename on file system)
|
||||
* @param array $mimetype_list List of MIME type of attached files
|
||||
* @param array $mimefilename_list List of attached file name in message
|
||||
* @param string $addr_cc Email cc
|
||||
* @param string $addr_bcc Email bcc
|
||||
* @param int $deliveryreceipt Ask a delivery receipt
|
||||
* @param int $msgishtml 1=String IS already html, 0=String IS NOT html, -1=Unknown need autodetection
|
||||
* @param string $errors_to Email errors
|
||||
* @param string $css Css option
|
||||
*/
|
||||
function CMailFile($subject,$to,$from,$msg,
|
||||
$filename_list=array(),$mimetype_list=array(),$mimefilename_list=array(),
|
||||
@@ -524,8 +524,8 @@ class CMailFile
|
||||
/**
|
||||
* Correct an uncomplete html string
|
||||
*
|
||||
* @param $msg
|
||||
* @return
|
||||
* @param string $msg String
|
||||
* @return string Completed string
|
||||
*/
|
||||
function checkIfHTML($msg)
|
||||
{
|
||||
@@ -615,9 +615,9 @@ class CMailFile
|
||||
/**
|
||||
* Create header MIME (mode = 'mail')
|
||||
*
|
||||
* @param filename_list
|
||||
* @param mimefilename_list
|
||||
* @return mime headers
|
||||
* @param array $filename_list Array of filenames
|
||||
* @param array $mimefilename_list Array of mime types
|
||||
* @return array mime headers
|
||||
*/
|
||||
function write_mimeheaders($filename_list, $mimefilename_list)
|
||||
{
|
||||
@@ -644,7 +644,8 @@ class CMailFile
|
||||
/**
|
||||
* Return email content (mode = 'mail')
|
||||
*
|
||||
* @param msgtext
|
||||
* @param string $msgtext Message string
|
||||
* @return string String content
|
||||
*/
|
||||
function write_body($msgtext)
|
||||
{
|
||||
@@ -675,7 +676,7 @@ class CMailFile
|
||||
}
|
||||
|
||||
// Make RFC821 Compliant, replace bare linefeeds
|
||||
$strContent = preg_replace("/(?<!\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(wordwrap($strContent));
|
||||
@@ -708,10 +709,10 @@ class CMailFile
|
||||
/**
|
||||
* Attach file to email (mode = 'mail')
|
||||
*
|
||||
* @param filename_list Tableau
|
||||
* @param mimetype_list Tableau
|
||||
* @param mimefilename_list Tableau
|
||||
* @return out Chaine fichiers encodes
|
||||
* @param array $filename_list Tableau
|
||||
* @param array $mimetype_list Tableau
|
||||
* @param array $mimefilename_list Tableau
|
||||
* @return string Chaine fichiers encodes
|
||||
*/
|
||||
function write_files($filename_list,$mimetype_list,$mimefilename_list)
|
||||
{
|
||||
@@ -753,8 +754,8 @@ class CMailFile
|
||||
/**
|
||||
* Attach an image to email (mode = 'mail')
|
||||
*
|
||||
* @param images_list Tableau
|
||||
* @return out Chaine images encodees
|
||||
* @param array $images_list Tableau
|
||||
* @return string Chaine images encodees
|
||||
*/
|
||||
function write_images($images_list)
|
||||
{
|
||||
@@ -784,9 +785,9 @@ class CMailFile
|
||||
/**
|
||||
* Try to create a socket connection
|
||||
*
|
||||
* @param $host Add ssl:// for SSL/TLS.
|
||||
* @param $port Example: 25, 465
|
||||
* @return Socket id if ok, 0 if KO
|
||||
* @param string $host Add ssl:// for SSL/TLS.
|
||||
* @param int $port Example: 25, 465
|
||||
* @return int Socket id if ok, 0 if KO
|
||||
*/
|
||||
function check_server_port($host,$port)
|
||||
{
|
||||
@@ -797,11 +798,13 @@ class CMailFile
|
||||
{
|
||||
dol_syslog("Try socket connection to host=".$host." port=".$port);
|
||||
//See if we can connect to the SMTP server
|
||||
if ( $socket = @fsockopen($host, // Host to test, IP or domain. Add ssl:// for SSL/TLS.
|
||||
$port, // which Port number to use
|
||||
$errno, // actual system level error
|
||||
$errstr, // and any text that goes with the error
|
||||
$timeout) ) // timeout for reading/writing data over the socket
|
||||
if ($socket = @fsockopen(
|
||||
$host, // Host to test, IP or domain. Add ssl:// for SSL/TLS.
|
||||
$port, // which Port number to use
|
||||
$errno, // actual system level error
|
||||
$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
|
||||
if (function_exists('stream_set_timeout')) stream_set_timeout($socket, $timeout, 0);
|
||||
@@ -813,7 +816,7 @@ class CMailFile
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error = 'Error '.$errno.' - '.$errstr;
|
||||
$this->error = utf8_check('Error '.$errno.' - '.$errstr)?'Error '.$errno.' - '.$errstr:utf8_encode('Error '.$errno.' - '.$errstr);
|
||||
}
|
||||
}
|
||||
return $_retVal;
|
||||
@@ -823,9 +826,9 @@ class CMailFile
|
||||
* This function has been modified as provided by SirSir to allow multiline responses when
|
||||
* using SMTP Extensions.
|
||||
*
|
||||
* @param socket
|
||||
* @param response
|
||||
* @return boolean
|
||||
* @param Socket $socket Socket
|
||||
* @param string $response Response string
|
||||
* @return boolean true if success
|
||||
*/
|
||||
function server_parse($socket, $response)
|
||||
{
|
||||
@@ -853,8 +856,8 @@ class CMailFile
|
||||
/**
|
||||
* Seearch images into html message and init array this->images_encoded if found
|
||||
*
|
||||
* @param images_dir Location of physical images files
|
||||
* @return int >0 if OK, <0 if KO
|
||||
* @param string $images_dir Location of physical images files
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
function findHtmlImages($images_dir)
|
||||
{
|
||||
@@ -943,11 +946,11 @@ class CMailFile
|
||||
/**
|
||||
* Return an address for SMTP protocol
|
||||
*
|
||||
* @param adresses Example: 'John Doe <john@doe.com>' or 'john@doe.com'
|
||||
* @param format 0=Auto, 1=emails with <>, 2=emails without <>
|
||||
* @param encode 1=Encode name to RFC2822
|
||||
* @return string If format 1: '<john@doe.com>' or 'John Doe <john@doe.com>'
|
||||
* If format 2: 'john@doe.com'
|
||||
* @param string $adresses Example: 'John Doe <john@doe.com>' or 'john@doe.com'
|
||||
* @param int $format 0=Auto, 1=emails with <>, 2=emails without <>
|
||||
* @param int $encode 1=Encode name to RFC2822
|
||||
* @return string If format 1: '<john@doe.com>' or 'John Doe <john@doe.com>'
|
||||
* If format 2: 'john@doe.com'
|
||||
*/
|
||||
function getValidAddress($adresses,$format,$encode='')
|
||||
{
|
||||
|
||||
@@ -89,7 +89,7 @@ abstract class CommonDocGenerator
|
||||
'mycompany_web'=>$mysoc->url,
|
||||
'mycompany_juridicalstatus'=>$mysoc->forme_juridique,
|
||||
'mycompany_capital'=>$mysoc->capital,
|
||||
'mycompany_barcode'=>$mysoc->gencod,
|
||||
'mycompany_barcode'=>$mysoc->barcode,
|
||||
'mycompany_idprof1'=>$mysoc->idprof1,
|
||||
'mycompany_idprof2'=>$mysoc->idprof2,
|
||||
'mycompany_idprof3'=>$mysoc->idprof3,
|
||||
@@ -121,7 +121,7 @@ abstract class CommonDocGenerator
|
||||
'company_country_code'=>$object->country_code,
|
||||
'company_country'=>$outputlangs->transnoentitiesnoconv("Country".$object->country_code),
|
||||
'company_web'=>$object->url,
|
||||
'company_barcode'=>$object->gencod,
|
||||
'company_barcode'=>$object->barcode,
|
||||
'company_vatnumber'=>$object->tva_intra,
|
||||
'company_customercode'=>$object->code_client,
|
||||
'company_suppliercode'=>$object->code_fournisseur,
|
||||
|
||||
@@ -82,7 +82,7 @@ abstract class CommonObject
|
||||
global $user,$conf,$langs;
|
||||
|
||||
$error=0;
|
||||
|
||||
|
||||
dol_syslog(get_class($this)."::add_contact $fk_socpeople, $type_contact, $source");
|
||||
|
||||
// Check parameters
|
||||
@@ -203,7 +203,7 @@ abstract class CommonObject
|
||||
global $user,$langs,$conf;
|
||||
|
||||
$error=0;
|
||||
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."element_contact";
|
||||
$sql.= " WHERE rowid =".$rowid;
|
||||
|
||||
@@ -510,6 +510,54 @@ abstract class CommonObject
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load data for barcode
|
||||
*
|
||||
* @return int <0 if KO, >=0 if OK
|
||||
*/
|
||||
function fetch_barcode()
|
||||
{
|
||||
global $conf;
|
||||
|
||||
dol_syslog(get_class($this).'::fetch_barcode this->element='.$this->element.' this->barcode_type='.$this->barcode_type);
|
||||
|
||||
$idtype=$this->barcode_type;
|
||||
if (! $idtype)
|
||||
{
|
||||
if ($this->element == 'product') $idtype = $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE;
|
||||
else if ($this->element == 'societe') $idtype = $conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY;
|
||||
else dol_print_error('','Call fetch_barcode with barcode_type not defined and cant be guessed');
|
||||
}
|
||||
|
||||
if ($idtype > 0)
|
||||
{
|
||||
if (empty($this->barcode_type) || empty($this->barcode_type_code) || empty($this->barcode_type_label) || empty($this->barcode_type_coder)) // If data not already loaded
|
||||
{
|
||||
$sql = "SELECT rowid, code, libelle as label, coder";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_barcode_type";
|
||||
$sql.= " WHERE rowid = ".$idtype;
|
||||
dol_syslog(get_class($this).'::fetch_barcode sql='.$sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$this->barcode_type = $obj->rowid;
|
||||
$this->barcode_type_code = $obj->code;
|
||||
$this->barcode_type_label = $obj->label;
|
||||
$this->barcode_type_coder = $obj->coder;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Charge le projet d'id $this->fk_project dans this->projet
|
||||
*
|
||||
@@ -539,22 +587,6 @@ abstract class CommonObject
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load delivery adresse id into $this->fk_address
|
||||
*
|
||||
* @param fk_address Id of address
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetch_address($fk_address)
|
||||
{
|
||||
$object = new Societe($this->db);
|
||||
$result=$object->fetch_address($fk_address);
|
||||
$this->deliveryaddress = $object; // TODO obsolete
|
||||
$this->adresse = $object; // TODO obsolete
|
||||
$this->address = $object;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read linked origin object
|
||||
*/
|
||||
@@ -1699,8 +1731,8 @@ abstract class CommonObject
|
||||
/**
|
||||
* Function to check if an object is used by others
|
||||
*
|
||||
* @param id Id of object
|
||||
* @return int <0 if KO, 0 if not used, >0 if already used
|
||||
* @param int $id Id of object
|
||||
* @return int <0 if KO, 0 if not used, >0 if already used
|
||||
*/
|
||||
function isObjectUsed($id)
|
||||
{
|
||||
@@ -1775,8 +1807,7 @@ abstract class CommonObject
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Enter description here ...
|
||||
* List urls of elemùent
|
||||
*
|
||||
* @param unknown_type $objectid
|
||||
* @param unknown_type $objecttype
|
||||
|
||||
@@ -1242,7 +1242,7 @@ class Form
|
||||
}
|
||||
}
|
||||
$opt.= '>';
|
||||
$opt.= $langs->convToOutputCharset($objp->ref).' - '.$langs->convToOutputCharset(dol_trunc($label,32)).' - ';
|
||||
$opt.= $objp->ref.' - '.dol_trunc($label,32).' - ';
|
||||
|
||||
$objRef = $objp->ref;
|
||||
if ($filterkey && $filterkey != '') $objRef=preg_replace('/('.preg_quote($filterkey).')/i','<strong>$1</strong>',$objRef,1);
|
||||
@@ -1365,7 +1365,7 @@ class Form
|
||||
{
|
||||
global $langs,$conf;
|
||||
global $price_level, $status, $finished;
|
||||
|
||||
|
||||
if ($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)
|
||||
{
|
||||
// mode=2 means suppliers products
|
||||
@@ -1459,9 +1459,9 @@ class Form
|
||||
$label = $objp->label;
|
||||
if ($filterkey && $filterkey != '') $label=preg_replace('/('.preg_quote($filterkey).')/i','<strong>$1</strong>',$label,1);
|
||||
|
||||
$opt.=$langs->convToOutputCharset($objp->ref).' ('.$langs->convToOutputCharset($objp->ref_fourn).') - ';
|
||||
$opt.=$objp->ref.' ('.$objp->ref_fourn.') - ';
|
||||
$outval.=$objRef.' ('.$objRefFourn.') - ';
|
||||
$opt.=$langs->convToOutputCharset(dol_trunc($objp->label,18)).' - ';
|
||||
$opt.=dol_trunc($objp->label,18).' - ';
|
||||
$outval.=dol_trunc($label,18).' - ';
|
||||
|
||||
if ($objp->fprice != '') // Keep != ''
|
||||
@@ -2230,7 +2230,7 @@ class Form
|
||||
* @param string $action Action
|
||||
* @param array $formquestion An array with complementary inputs to add into forms: array(array('label'=> ,'type'=> , ))
|
||||
* @param string $selectedchoice "" or "no" or "yes"
|
||||
* @param int $useajax 0=No, 1=Yes, 2=Yes but submit page with &confirm=no if choice is No
|
||||
* @param int $useajax 0=No, 1=Yes, 2=Yes but submit page with &confirm=no if choice is No, 'xxx'=preoutput confirm box with div id=dialog-confirm-xxx
|
||||
* @param int $height Force height of box
|
||||
* @return string 'ajax' if a confirm ajax popup is shown, 'html' if it's an html form
|
||||
*/
|
||||
@@ -2313,7 +2313,8 @@ class Form
|
||||
{
|
||||
$autoOpen=true;
|
||||
$dialogconfirm='dialog-confirm';
|
||||
if (! is_int($useajax)) {
|
||||
if (! is_int($useajax))
|
||||
{
|
||||
$button=$useajax;
|
||||
$useajax=1;
|
||||
$autoOpen=false;
|
||||
@@ -2841,14 +2842,15 @@ class Form
|
||||
}
|
||||
|
||||
/**
|
||||
* Affiche formulaire de selection de l'adresse
|
||||
* Show form to select addresse
|
||||
*
|
||||
* @param page Page
|
||||
* @param selected Id condition pre-selectionne
|
||||
* @param htmlname Nom du formulaire select
|
||||
* @param origin Origine de l'appel pour pouvoir creer un retour
|
||||
* @param originid Id de l'origine
|
||||
* @return void
|
||||
* @param page Page
|
||||
* @param selected Id condition pre-selectionne
|
||||
* @param htmlname Nom du formulaire select
|
||||
* @param origin Origine de l'appel pour pouvoir creer un retour
|
||||
* @param originid Id de l'origine
|
||||
* @return void
|
||||
* @deprecated
|
||||
*/
|
||||
function form_address($page, $selected='', $socid, $htmlname='address_id', $origin='', $originid='')
|
||||
{
|
||||
@@ -3659,13 +3661,39 @@ class Form
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return HTML code to output a barcode
|
||||
*
|
||||
* @param Object &$object Object containing data to retrieve file name
|
||||
* @param int $width Width of photo
|
||||
* @return string HTML code to output barcode
|
||||
*/
|
||||
function showbarcode(&$object,$width=100)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
if (empty($object->barcode)) return '';
|
||||
|
||||
// Complete object if not complete
|
||||
if (empty($object->barcode_type_code) || empty($object->barcode_type_coder))
|
||||
{
|
||||
$object->fetch_barcode();
|
||||
}
|
||||
|
||||
// Barcode image
|
||||
$url=DOL_URL_ROOT.'/viewimage.php?modulepart=barcode&generator='.urlencode($object->barcode_type_coder).'&code='.urlencode($object->barcode).'&encoding='.urlencode($object->barcode_type_code);
|
||||
$out ='<!-- url barcode = '.$url.' -->';
|
||||
$out.='<img src="'.$url.'">';
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return HTML code to output a photo
|
||||
*
|
||||
* @param modulepart Key to define module concerned ('societe', 'userphoto', 'memberphoto')
|
||||
* @param object Object containing data to retrieve file name
|
||||
* @param width Width of photo
|
||||
* @return string HTML code to output photo
|
||||
* @param string $modulepart Key to define module concerned ('societe', 'userphoto', 'memberphoto')
|
||||
* @param Object $object Object containing data to retrieve file name
|
||||
* @param int $width Width of photo
|
||||
* @return string HTML code to output photo
|
||||
*/
|
||||
function showphoto($modulepart,$object,$width=100)
|
||||
{
|
||||
|
||||
@@ -1290,12 +1290,13 @@ class Ldap
|
||||
|
||||
|
||||
/**
|
||||
* \brief Convert a string into output/memory charset
|
||||
* \param str String to convert
|
||||
* \param pagecodefrom Page code of src string
|
||||
* \return string Converted string
|
||||
* Convert a string into output/memory charset
|
||||
*
|
||||
* @param str String to convert
|
||||
* @param pagecodefrom Page code of src string
|
||||
* @return string Converted string
|
||||
*/
|
||||
function convToOutputCharset($str,$pagecodefrom='UTF-8')
|
||||
private function convToOutputCharset($str,$pagecodefrom='UTF-8')
|
||||
{
|
||||
global $conf;
|
||||
if ($pagecodefrom == 'ISO-8859-1' && $conf->file->character_set_client == 'UTF-8') $str=utf8_encode($str);
|
||||
@@ -1304,10 +1305,11 @@ class Ldap
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Convert a string from output/memory charset
|
||||
* \param str String to convert
|
||||
* \param pagecodeto Page code for result string
|
||||
* \return string Converted string
|
||||
* Convert a string from output/memory charset
|
||||
*
|
||||
* @param str String to convert
|
||||
* @param pagecodeto Page code for result string
|
||||
* @return string Converted string
|
||||
*/
|
||||
function convFromOutputCharset($str,$pagecodeto='UTF-8')
|
||||
{
|
||||
@@ -1316,16 +1318,16 @@ class Ldap
|
||||
if ($pagecodeto == 'UTF-8' && $conf->file->character_set_client == 'ISO-8859-1') $str=utf8_encode($str);
|
||||
return $str;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Return available value of group GID
|
||||
* Return available value of group GID
|
||||
* @return int gid number
|
||||
*/
|
||||
*/
|
||||
function getNextGroupGid()
|
||||
{
|
||||
global $conf;
|
||||
|
||||
|
||||
$search='('.$conf->global->LDAP_KEY_GROUPS.'=*)';
|
||||
$result = $this->search($this->groups,$search);
|
||||
if($result)
|
||||
@@ -1337,11 +1339,11 @@ class Ldap
|
||||
$gids[] = $result[$i]['gidnumber'][0];
|
||||
}
|
||||
rsort($gids);
|
||||
|
||||
|
||||
return $gids[0]+1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -49,8 +49,8 @@ class Translate {
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param dir Force directory that contains /langs subdirectory (value is sometine '..' like into install/* pages or support/* pages).
|
||||
* @param conf Object with Dolibarr configuration
|
||||
* @param string $dir Force directory that contains /langs subdirectory (value is sometine '..' like into install/* pages or support/* pages).
|
||||
* @param Conf $conf Object with Dolibarr configuration
|
||||
*/
|
||||
function Translate($dir = "",$conf)
|
||||
{
|
||||
@@ -63,7 +63,7 @@ class Translate {
|
||||
/**
|
||||
* Set accessor for this->defaultlang
|
||||
*
|
||||
* @param srclang Language to use
|
||||
* @param string $srclang Language to use
|
||||
*/
|
||||
function setDefaultLang($srclang='fr_FR')
|
||||
{
|
||||
@@ -129,8 +129,8 @@ class Translate {
|
||||
* Return active language code for current user
|
||||
* It's an accessor for this->defaultlang
|
||||
*
|
||||
* @param mode 0=Long language code, 1=Short language code
|
||||
* @return string Language code used (en_US, en_AU, fr_FR, ...)
|
||||
* @param int $mode 0=Long language code, 1=Short language code
|
||||
* @return string Language code used (en_US, en_AU, fr_FR, ...)
|
||||
*/
|
||||
function getDefaultLang($mode=0)
|
||||
{
|
||||
@@ -337,8 +337,8 @@ class Translate {
|
||||
* WARNING: To avoid infinite loop (getLabelFromKey->transnoentities->getTradFromKey), getLabelFromKey must
|
||||
* not be called with same value than input.
|
||||
*
|
||||
* @param key
|
||||
* @return string
|
||||
* @param string $key Key to translate
|
||||
* @return string Translated string
|
||||
*/
|
||||
function getTradFromKey($key)
|
||||
{
|
||||
@@ -379,13 +379,13 @@ class Translate {
|
||||
* et si toujours pas trouve, il est retourne tel quel
|
||||
* Les parametres de cette methode peuvent contenir de balises HTML.
|
||||
*
|
||||
* @param key cle de chaine a traduire
|
||||
* @param param1 chaine de param1
|
||||
* @param param2 chaine de param2
|
||||
* @param param3 chaine de param3
|
||||
* @param param4 chaine de param4
|
||||
* @param maxsize taille max
|
||||
* @return string Chaine traduite et code en HTML
|
||||
* @param string $key Key to translate
|
||||
* @param string $param1 chaine de param1
|
||||
* @param string $param2 chaine de param2
|
||||
* @param string $param3 chaine de param3
|
||||
* @param string $param4 chaine de param4
|
||||
* @param int $maxsize Max length of text
|
||||
* @return string Translated string (encoded into HTML entities and UTF8)
|
||||
*/
|
||||
function trans($key, $param1='', $param2='', $param3='', $param4='', $maxsize=0)
|
||||
{
|
||||
@@ -400,7 +400,7 @@ class Translate {
|
||||
// We replace some HTML tags by __xx__ to avoid having them encoded by htmlentities
|
||||
$str=str_replace(array('<','>','"',),array('__lt__','__gt__','__quot__'),$str);
|
||||
|
||||
$str=$this->convToOutputCharset($str); // Convert string to $this->charset_output
|
||||
//$str=$this->convToOutputCharset($str); // Convert string to $this->charset_output
|
||||
|
||||
// Crypt string into HTML
|
||||
// $str est une chaine stockee en memoire au format $this->charset_output
|
||||
@@ -412,8 +412,9 @@ class Translate {
|
||||
}
|
||||
else // Translation is not available
|
||||
{
|
||||
$str=$this->getTradFromKey($key);
|
||||
return $this->convToOutputCharset($str);
|
||||
//$str=$this->getTradFromKey($key);
|
||||
//return $this->convToOutputCharset($str);
|
||||
return $this->getTradFromKey($key);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -424,25 +425,16 @@ class Translate {
|
||||
* et si toujours pas trouve, il est retourne tel quel.
|
||||
* Parameters of this method must not contains any HTML tags.
|
||||
*
|
||||
* @param key key of string to translate
|
||||
* @param param1 chaine de param1
|
||||
* @param param2 chaine de param2
|
||||
* @param param3 chaine de param3
|
||||
* @param param4 chaine de param4
|
||||
* @return string chaine traduite
|
||||
* @param string $key Key to translate
|
||||
* @param string $param1 chaine de param1
|
||||
* @param string $param2 chaine de param2
|
||||
* @param string $param3 chaine de param3
|
||||
* @param string $param4 chaine de param4
|
||||
* @return string Translated string (encoded into UTF8)
|
||||
*/
|
||||
function transnoentities($key, $param1='', $param2='', $param3='', $param4='')
|
||||
{
|
||||
if (! empty($this->tab_translate[$key]))
|
||||
{
|
||||
// Si la traduction est disponible
|
||||
$newstr=sprintf($this->tab_translate[$key],$param1,$param2,$param3,$param4);
|
||||
}
|
||||
else
|
||||
{
|
||||
$newstr=$this->getTradFromKey($key);
|
||||
}
|
||||
return $this->convToOutputCharset($newstr);
|
||||
return $this->convToOutputCharset($this->transnoentitiesnoconv($key, $param1, $param2, $param3, $param4));
|
||||
}
|
||||
|
||||
|
||||
@@ -453,25 +445,26 @@ class Translate {
|
||||
* No convert to encoding charset of lang object is done.
|
||||
* Parameters of this method must not contains any HTML tags.
|
||||
*
|
||||
* @param key key of string to translate
|
||||
* @param param1 chaine de param1
|
||||
* @param param2 chaine de param1
|
||||
* @param param3 chaine de param1
|
||||
* @param param4 chaine de param1
|
||||
* @return string chaine traduite
|
||||
* @param string $key Key to translate
|
||||
* @param string $param1 chaine de param1
|
||||
* @param string $param2 chaine de param2
|
||||
* @param string $param3 chaine de param3
|
||||
* @param string $param4 chaine de param4
|
||||
* @return string Translated string
|
||||
*/
|
||||
function transnoentitiesnoconv($key, $param1='', $param2='', $param3='', $param4='')
|
||||
{
|
||||
if (! empty($this->tab_translate[$key]))
|
||||
if (! empty($this->tab_translate[$key])) // Translation is available
|
||||
{
|
||||
// Si la traduction est disponible
|
||||
$newstr=sprintf($this->tab_translate[$key],$param1,$param2,$param3,$param4);
|
||||
$str=$this->tab_translate[$key];
|
||||
|
||||
$str=sprintf($str,$param1,$param2,$param3,$param4);
|
||||
}
|
||||
else
|
||||
{
|
||||
$newstr=$this->getTradFromKey($key);
|
||||
$str=$this->getTradFromKey($key);
|
||||
}
|
||||
return $newstr;
|
||||
return $str;
|
||||
}
|
||||
|
||||
|
||||
@@ -650,7 +643,7 @@ class Translate {
|
||||
$sql = "SELECT ".$fieldlabel." as label";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.$tablename;
|
||||
$sql.= " WHERE ".$fieldkey." = '".$key."'";
|
||||
dol_syslog('Translate::getLabelFromKey sql='.$sql,LOG_DEBUG);
|
||||
dol_syslog(get_class($this).'::getLabelFromKey sql='.$sql,LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@@ -664,7 +657,7 @@ class Translate {
|
||||
else
|
||||
{
|
||||
$this->error=$db->lasterror();
|
||||
dol_syslog("Translate::getLabelFromKey error=".$this->error,LOG_ERR);
|
||||
dol_syslog(get_class($this).'::getLabelFromKey error='.$this->error,LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ function GETPOST($paramname,$check='',$method=0)
|
||||
if (! empty($check))
|
||||
{
|
||||
// Check if numeric
|
||||
if ($check == 'int' && ! preg_match('/^[\.,0-9]+$/i',trim($out))) $out='';
|
||||
if ($check == 'int' && ! preg_match('/^[-\.,0-9]+$/i',trim($out))) $out='';
|
||||
// Check if alpha
|
||||
//if ($check == 'alpha' && ! preg_match('/^[ =:@#\/\\\(\)\-\._a-z0-9]+$/i',trim($out))) $out='';
|
||||
// '"' is dangerous because param in url can close the href= or src= and add javascript functions.
|
||||
@@ -735,34 +735,33 @@ function dolibarr_print_date($time,$format='',$to_gmt=false,$outputlangs='',$enc
|
||||
/**
|
||||
* Return a formated address (part address/zip/town/state) according to country rules
|
||||
*
|
||||
* @param outputlangs Output langs object
|
||||
* @param object A company or contact object
|
||||
* @return string Formated string
|
||||
* @param Object $object A company or contact object
|
||||
* @return string Formated string
|
||||
*/
|
||||
function dol_format_address($outputlangs,$object)
|
||||
function dol_format_address($object)
|
||||
{
|
||||
$ret='';
|
||||
$countriesusingstate=array('US','IN');
|
||||
|
||||
// Address
|
||||
$ret .= $outputlangs->convToOutputCharset($object->address);
|
||||
$ret .= $object->address;
|
||||
// Zip/Town/State
|
||||
if (in_array($object->country_code,array('US'))) // US: town, state, zip
|
||||
{
|
||||
$ret .= ($ret ? "\n" : '' ).$outputlangs->convToOutputCharset($object->town);
|
||||
$ret .= ($ret ? "\n" : '' ).$object->town;
|
||||
if ($object->state && in_array($object->country_code,$countriesusingstate))
|
||||
{
|
||||
$ret.=", ".$outputlangs->convToOutputCharset($object->departement);
|
||||
$ret.=", ".$object->departement;
|
||||
}
|
||||
if ($object->zip) $ret .= ', '.$outputlangs->convToOutputCharset($object->zip);
|
||||
if ($object->zip) $ret .= ', '.$object->zip;
|
||||
}
|
||||
else // Other: zip town, state
|
||||
{
|
||||
$ret .= ($ret ? "\n" : '' ).$outputlangs->convToOutputCharset($object->zip);
|
||||
$ret .= ' '.$outputlangs->convToOutputCharset($object->town);
|
||||
$ret .= ($ret ? "\n" : '' ).$object->zip;
|
||||
$ret .= ' '.$object->town;
|
||||
if ($object->state && in_array($object->country_code,$countriesusingstate))
|
||||
{
|
||||
$ret.=", ".$outputlangs->convToOutputCharset($object->state);
|
||||
$ret.=", ".$object->state;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1838,11 +1837,11 @@ function img_action($alt = "default", $numaction)
|
||||
{
|
||||
global $conf,$langs;
|
||||
if ($alt=="default") {
|
||||
if ($numaction == -1) $alt=$langs->trans("ChangeDoNotContact");
|
||||
if ($numaction == 0) $alt=$langs->trans("ChangeNeverContacted");
|
||||
if ($numaction == 1) $alt=$langs->trans("ChangeToContact");
|
||||
if ($numaction == 2) $alt=$langs->trans("ChangeContactInProcess");
|
||||
if ($numaction == 3) $alt=$langs->trans("ChangeContactDone");
|
||||
if ($numaction == -1) $alt=$langs->transnoentitiesnoconv("ChangeDoNotContact");
|
||||
if ($numaction == 0) $alt=$langs->transnoentitiesnoconv("ChangeNeverContacted");
|
||||
if ($numaction == 1) $alt=$langs->transnoentitiesnoconv("ChangeToContact");
|
||||
if ($numaction == 2) $alt=$langs->transnoentitiesnoconv("ChangeContactInProcess");
|
||||
if ($numaction == 3) $alt=$langs->transnoentitiesnoconv("ChangeContactDone");
|
||||
}
|
||||
return '<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 $micro_start_time;
|
||||
|
||||
|
||||
if ($zone == 'private') print "\n".'<!-- Common footer for private page -->'."\n";
|
||||
else print "\n".'<!-- Common footer for public page -->'."\n";
|
||||
|
||||
|
||||
@@ -190,7 +190,7 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
|
||||
|
||||
if ($mode == 'source')
|
||||
{
|
||||
$stringaddress .= ($stringaddress ? "\n" : '' ).dol_format_address($outputlangs,$sourcecompany)."\n";
|
||||
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($sourcecompany))."\n";
|
||||
|
||||
// Tel
|
||||
if ($sourcecompany->tel) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($sourcecompany->tel);
|
||||
@@ -207,13 +207,13 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
|
||||
if ($usecontact)
|
||||
{
|
||||
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset($targetcontact->getFullName($outputlangs,1));
|
||||
$stringaddress .= ($stringaddress ? "\n" : '' ).dol_format_address($outputlangs,$targetcontact)."\n";
|
||||
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($targetcontact))."\n";
|
||||
// Country
|
||||
if ($targetcontact->pays_code && $targetcontact->pays_code != $sourcecompany->pays_code) $stringaddress.=$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcontact->pays_code))."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$stringaddress .= ($stringaddress ? "\n" : '' ).dol_format_address($outputlangs,$targetcompany)."\n";
|
||||
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($targetcompany))."\n";
|
||||
// Country
|
||||
if ($targetcompany->pays_code && $targetcompany->pays_code != $sourcecompany->pays_code) $stringaddress.=$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcompany->pays_code))."\n";
|
||||
}
|
||||
@@ -250,7 +250,7 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
|
||||
|
||||
if ($mode == 'delivery') // for a delivery address (address + phone/fax)
|
||||
{
|
||||
$stringaddress .= ($stringaddress ? "\n" : '' ).dol_format_address($outputlangs,$deliverycompany)."\n";
|
||||
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($deliverycompany))."\n";
|
||||
|
||||
// Tel
|
||||
if ($deliverycompany->phone) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($deliverycompany->phone);
|
||||
@@ -1213,7 +1213,7 @@ function pdf_getlinetotalwithtax($object,$i,$outputlangs,$hidedetails=0)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (empty($hidedetails) || $hidedetails > 1) return
|
||||
if (empty($hidedetails) || $hidedetails > 1) return
|
||||
price(($object->lines[$i]->total_ht) + ($object->lines[$i]->total_ht)*($object->lines[$i]->tva_tx)/100);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,15 +64,6 @@ function product_prepare_head($object, $user)
|
||||
$h++;
|
||||
}
|
||||
|
||||
// Show barcode tab
|
||||
if ($conf->global->MAIN_MODULE_BARCODE && $user->rights->barcode->lire)
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT."/product/barcode.php?id=".$object->id;
|
||||
$head[$h][1] = $langs->trans("BarCode");
|
||||
$head[$h][2] = 'barcode';
|
||||
$h++;
|
||||
}
|
||||
|
||||
// Multilangs
|
||||
if($conf->global->MAIN_MULTILANGS)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -24,7 +24,7 @@
|
||||
* \brief Fichier de la classe permettant de generer les bordereaux envoi au modele Merou
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT."/core/modules/expedition/doc/ModelePdfExpedition.class.php";
|
||||
require_once DOL_DOCUMENT_ROOT."/core/modules/expedition/modules_expedition.php";
|
||||
require_once DOL_DOCUMENT_ROOT."/contact/class/contact.class.php";
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/company.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php');
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
* \brief Fichier de la classe permettant de generer les bordereaux envoi au modele Rouget
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT."/core/modules/expedition/doc/ModelePdfExpedition.class.php";
|
||||
require_once DOL_DOCUMENT_ROOT."/core/modules/expedition/expedition/modules_expedition.php";
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/company.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php');
|
||||
|
||||
|
||||
139
htdocs/core/modules/expedition/modules_expedition.php
Executable file → Normal file
139
htdocs/core/modules/expedition/modules_expedition.php
Executable file → Normal file
@@ -5,6 +5,7 @@
|
||||
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* 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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -26,14 +27,47 @@
|
||||
* \ingroup expedition
|
||||
* \brief File of class to manage expedition numbering
|
||||
*/
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/commondocgenerator.class.php");
|
||||
|
||||
class ModelNumRefExpedition
|
||||
/**
|
||||
* \class ModelePdfExpedition
|
||||
* \brief Parent class of sending receipts models
|
||||
*/
|
||||
abstract class ModelePdfExpedition extends CommonDocGenerator
|
||||
{
|
||||
var $error='';
|
||||
|
||||
|
||||
/**
|
||||
* \brief Return list of active generation modules
|
||||
* \param $db Database handler
|
||||
*/
|
||||
function liste_modeles($db)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$type='shipping';
|
||||
$liste=array();
|
||||
|
||||
include_once(DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php');
|
||||
$liste=getListOfModels($db,$type,'');
|
||||
|
||||
return $liste;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \class ModelNumRefExpedition
|
||||
* \brief Classe mere des modeles de numerotation des references d expedition
|
||||
*/
|
||||
abstract class ModelNumRefExpedition
|
||||
{
|
||||
var $error='';
|
||||
|
||||
/**
|
||||
* Return if a module can be used or not
|
||||
* @return boolean true if module can be used
|
||||
/** Return if a module can be used or not
|
||||
*
|
||||
* @return boolean true if module can be used
|
||||
*/
|
||||
function isEnabled()
|
||||
{
|
||||
@@ -96,4 +130,101 @@ class ModelNumRefExpedition
|
||||
return $langs->trans("NotAvailable");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Cree un bon d'expedition sur disque
|
||||
* @param db objet base de donnee
|
||||
* @param object object expedition
|
||||
* @param modele force le modele a utiliser ('' to not force)
|
||||
* @param outputlangs objet lang a utiliser pour traduction
|
||||
* @return int <=0 if KO, >0 if OK
|
||||
*/
|
||||
function expedition_pdf_create($db, $object, $modele, $outputlangs)
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
$langs->load("sendings");
|
||||
|
||||
// Increase limit for PDF build
|
||||
$err=error_reporting();
|
||||
error_reporting(0);
|
||||
@set_time_limit(120);
|
||||
error_reporting($err);
|
||||
|
||||
$dir = "/core/modules/expedition/";
|
||||
$srctemplatepath='';
|
||||
|
||||
// Positionne le modele sur le nom du modele a utiliser
|
||||
if (! dol_strlen($modele))
|
||||
{
|
||||
if (! empty($conf->global->EXPEDITION_ADDON_PDF))
|
||||
{
|
||||
$modele = $conf->global->EXPEDITION_ADDON_PDF;
|
||||
}
|
||||
else
|
||||
{
|
||||
$modele = 'rouget';
|
||||
}
|
||||
}
|
||||
|
||||
// If selected modele is a filename template (then $modele="modelname:filename")
|
||||
$tmp=explode(':',$modele,2);
|
||||
if (! empty($tmp[1]))
|
||||
{
|
||||
$modele=$tmp[0];
|
||||
$srctemplatepath=$tmp[1];
|
||||
}
|
||||
|
||||
// Search template file
|
||||
$file=''; $classname=''; $filefound=0;
|
||||
foreach(array('doc','pdf') as $prefix)
|
||||
{
|
||||
$file = $prefix."_expedition_".$modele.".modules.php";
|
||||
|
||||
// On verifie l'emplacement du modele
|
||||
$file = dol_buildpath($dir.'doc/'.$file);
|
||||
|
||||
if (file_exists($file))
|
||||
{
|
||||
$filefound=1;
|
||||
$classname=$prefix.'_expedition_'.$modele;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Charge le modele
|
||||
if ($filefound)
|
||||
{
|
||||
require_once($file);
|
||||
|
||||
$obj = new $classname($db);
|
||||
|
||||
$result=$object->fetch_origin();
|
||||
|
||||
// We save charset_output to restore it because write_file can change it if needed for
|
||||
// output format that does not support UTF8.
|
||||
$sav_charset_output=$outputlangs->charset_output;
|
||||
if ($obj->write_file($object, $outputlangs) > 0)
|
||||
{
|
||||
$outputlangs->charset_output=$sav_charset_output;
|
||||
|
||||
// we delete preview files
|
||||
//require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
|
||||
//dol_delete_preview($object);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$outputlangs->charset_output=$sav_charset_output;
|
||||
dol_syslog("Erreur dans expedition_pdf_create");
|
||||
dol_print_error($db,$obj->error);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error('',$langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$dir.$file));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -268,11 +268,11 @@ class modSociete extends DolibarrModules
|
||||
$this->import_label[$r]='ImportDataset_company_1';
|
||||
$this->import_icon[$r]='company';
|
||||
$this->import_tables_array[$r]=array('s'=>MAIN_DB_PREFIX.'societe'); // List of tables to insert into (insert done in same order)
|
||||
$this->import_fields_array[$r]=array('s.nom'=>"Name*",'s.status'=>"Status",'s.client'=>"Customer*",'s.fournisseur'=>"Supplier*",'s.datec'=>"DateCreation",'s.code_client'=>"CustomerCode",'s.code_fournisseur'=>"SupplierCode",'s.address'=>"Address",'s.cp'=>"Zip",'s.ville'=>"Town",'s.tel'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email",'s.siret'=>"IdProf1",'s.siren'=>"IdProf2",'s.ape'=>"IdProf3",'s.idprof4'=>"IdProf4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital",'s.note'=>"Note",'s.fk_typent'=>"ThirdPartyType",'s.fk_effectif'=>"Effectif","s.fk_forme_juridique"=>"JuridicalStatus",'s.fk_prospectlevel'=>'ProspectLevel','s.fk_stcomm'=>'ProspectStatus','s.default_lang'=>'DefaultLanguage','s.gencod'=>'BarCode');
|
||||
$this->import_fields_array[$r]=array('s.nom'=>"Name*",'s.status'=>"Status",'s.client'=>"Customer*",'s.fournisseur'=>"Supplier*",'s.datec'=>"DateCreation",'s.code_client'=>"CustomerCode",'s.code_fournisseur'=>"SupplierCode",'s.address'=>"Address",'s.cp'=>"Zip",'s.ville'=>"Town",'s.tel'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email",'s.siret'=>"IdProf1",'s.siren'=>"IdProf2",'s.ape'=>"IdProf3",'s.idprof4'=>"IdProf4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital",'s.note'=>"Note",'s.fk_typent'=>"ThirdPartyType",'s.fk_effectif'=>"Effectif","s.fk_forme_juridique"=>"JuridicalStatus",'s.fk_prospectlevel'=>'ProspectLevel','s.fk_stcomm'=>'ProspectStatus','s.default_lang'=>'DefaultLanguage','s.barcode'=>'BarCode');
|
||||
$this->import_entities_array[$r]=array(); // We define here only fields that use another picto
|
||||
$this->import_regex_array[$r]=array('s.status'=>'^[0|1]','s.client'=>'^[0|1|2|3]','s.fournisseur'=>'^[0|1]');
|
||||
//$this->import_regex_array[$r]=array('s.status'=>'^[0|1]','s.client'=>'^[0|1|2|3]','s.fournisseur'=>'^[0|1]','s.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','s.fk_typent'=>array('rule'=>'fetchidfromcode','file'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch')));
|
||||
$this->import_examplevalues_array[$r]=array('s.nom'=>"MyBigCompany",'s.status'=>"0 (closed) or 1 (active)",'s.client'=>'0 (no customer no prospect)/1 (customer)/2 (prospect)/3 (customer and prospect)','s.fournisseur'=>'0 or 1','s.datec'=>dol_print_date(mktime(),'YYYY-MM-DD'),'s.code_client'=>"CU01-0001",'s.code_fournisseur'=>"SU01-0001",'s.address'=>"61 jump street",'s.cp'=>"123456",'s.ville'=>"Big town",'s.tel'=>"0101010101",'s.fax'=>"0101010102",'s.url'=>"http://mycompany.com",'s.email'=>"test@mycompany.com",'s.siret'=>"",'s.siren'=>"",'s.ape'=>"",'s.idprof4'=>"",'s.tva_intra'=>"FR0123456789",'s.capital'=>"10000",'s.note'=>"This is an example of note for record",'s.fk_typent'=>"2",'s.fk_effectif'=>"3","s.fk_forme_juridique"=>"1",'s.fk_prospectlevel'=>'PL_MEDIUM','s.fk_stcomm'=>'','s.default_lang'=>'en_US','s.gencod'=>'123456789');
|
||||
$this->import_examplevalues_array[$r]=array('s.nom'=>"MyBigCompany",'s.status'=>"0 (closed) or 1 (active)",'s.client'=>'0 (no customer no prospect)/1 (customer)/2 (prospect)/3 (customer and prospect)','s.fournisseur'=>'0 or 1','s.datec'=>dol_print_date(mktime(),'YYYY-MM-DD'),'s.code_client'=>"CU01-0001",'s.code_fournisseur'=>"SU01-0001",'s.address'=>"61 jump street",'s.cp'=>"123456",'s.ville'=>"Big town",'s.tel'=>"0101010101",'s.fax'=>"0101010102",'s.url'=>"http://mycompany.com",'s.email'=>"test@mycompany.com",'s.siret'=>"",'s.siren'=>"",'s.ape'=>"",'s.idprof4'=>"",'s.tva_intra'=>"FR0123456789",'s.capital'=>"10000",'s.note'=>"This is an example of note for record",'s.fk_typent'=>"2",'s.fk_effectif'=>"3","s.fk_forme_juridique"=>"1",'s.fk_prospectlevel'=>'PL_MEDIUM','s.fk_stcomm'=>'','s.default_lang'=>'en_US','s.barcode'=>'123456789');
|
||||
|
||||
// Import list of contact and attributes
|
||||
/* $r++;
|
||||
|
||||
@@ -33,7 +33,7 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/product/class/html.formproduct.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/product.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/sendings.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/modules/expedition/doc/ModelePdfExpedition.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/modules/expedition/modules_expedition.php");
|
||||
if ($conf->product->enabled || $conf->service->enabled) require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");
|
||||
if ($conf->propal->enabled) require_once(DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php");
|
||||
if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT."/commande/class/commande.class.php");
|
||||
|
||||
@@ -103,3 +103,6 @@ ALTER TABLE llx_facture MODIFY ref_client varchar(255);
|
||||
UPDATE llx_societe SET fk_stcomm = 0 WHERE fk_stcomm IS NULL;
|
||||
ALTER TABLE llx_societe MODIFY COLUMN fk_stcomm integer NOT NULL;
|
||||
|
||||
ALTER TABLE llx_societe CHANGE COLUMN gencod barcode varchar(255);
|
||||
ALTER TABLE llx_societe ADD COLUMN fk_barcode_type integer DEFAULT 0;
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ create table llx_societe
|
||||
tva_assuj tinyint DEFAULT 1, -- assujeti ou non a la TVA
|
||||
localtax1_assuj tinyint DEFAULT 0, -- assujeti ou non a local tax 1
|
||||
localtax2_assuj tinyint DEFAULT 0, -- assujeti ou non a local tax 2
|
||||
gencod varchar(255), -- barcode
|
||||
barcode varchar(255), -- barcode
|
||||
price_level integer NULL, -- level of price for multiprices
|
||||
default_lang varchar(6), -- default language
|
||||
logo varchar(255),
|
||||
|
||||
@@ -258,7 +258,7 @@ function html_print_paybox_footer($fromcompany,$langs)
|
||||
$line1="";
|
||||
if ($fromcompany->forme_juridique_code)
|
||||
{
|
||||
$line1.=($line1?" - ":"").$langs->convToOutputCharset(getFormeJuridiqueLabel($fromcompany->forme_juridique_code));
|
||||
$line1.=($line1?" - ":"").getFormeJuridiqueLabel($fromcompany->forme_juridique_code);
|
||||
}
|
||||
// Capital
|
||||
if ($fromcompany->capital)
|
||||
@@ -270,14 +270,14 @@ function html_print_paybox_footer($fromcompany,$langs)
|
||||
{
|
||||
$field=$langs->transcountrynoentities("ProfId1",$fromcompany->pays_code);
|
||||
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
|
||||
$line1.=($line1?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof1);
|
||||
$line1.=($line1?" - ":"").$field.": ".$fromcompany->idprof1;
|
||||
}
|
||||
// Prof Id 2
|
||||
if ($fromcompany->idprof2)
|
||||
{
|
||||
$field=$langs->transcountrynoentities("ProfId2",$fromcompany->pays_code);
|
||||
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
|
||||
$line1.=($line1?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof2);
|
||||
$line1.=($line1?" - ":"").$field.": ".$fromcompany->idprof2;
|
||||
}
|
||||
|
||||
// Second line of company infos
|
||||
@@ -287,19 +287,19 @@ function html_print_paybox_footer($fromcompany,$langs)
|
||||
{
|
||||
$field=$langs->transcountrynoentities("ProfId3",$fromcompany->pays_code);
|
||||
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
|
||||
$line2.=($line2?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof3);
|
||||
$line2.=($line2?" - ":"").$field.": ".$fromcompany->idprof3;
|
||||
}
|
||||
// Prof Id 4
|
||||
if ($fromcompany->idprof4)
|
||||
{
|
||||
$field=$langs->transcountrynoentities("ProfId4",$fromcompany->pays_code);
|
||||
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
|
||||
$line2.=($line2?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof4);
|
||||
$line2.=($line2?" - ":"").$field.": ".$fromcompany->idprof4;
|
||||
}
|
||||
// IntraCommunautary VAT
|
||||
if ($fromcompany->tva_intra != '')
|
||||
{
|
||||
$line2.=($line2?" - ":"").$langs->transnoentities("VATIntraShort").": ".$langs->convToOutputCharset($fromcompany->tva_intra);
|
||||
$line2.=($line2?" - ":"").$langs->transnoentities("VATIntraShort").": ".$fromcompany->tva_intra;
|
||||
}
|
||||
|
||||
print '<br><br><hr>'."\n";
|
||||
|
||||
@@ -86,7 +86,7 @@ function html_print_paypal_footer($fromcompany,$langs)
|
||||
$line1="";
|
||||
if ($fromcompany->forme_juridique_code)
|
||||
{
|
||||
$line1.=($line1?" - ":"").$langs->convToOutputCharset(getFormeJuridiqueLabel($fromcompany->forme_juridique_code));
|
||||
$line1.=($line1?" - ":"").getFormeJuridiqueLabel($fromcompany->forme_juridique_code);
|
||||
}
|
||||
// Capital
|
||||
if ($fromcompany->capital)
|
||||
@@ -98,14 +98,14 @@ function html_print_paypal_footer($fromcompany,$langs)
|
||||
{
|
||||
$field=$langs->transcountrynoentities("ProfId1",$fromcompany->pays_code);
|
||||
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
|
||||
$line1.=($line1?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof1);
|
||||
$line1.=($line1?" - ":"").$field.": ".$fromcompany->idprof1;
|
||||
}
|
||||
// Prof Id 2
|
||||
if ($fromcompany->idprof2)
|
||||
{
|
||||
$field=$langs->transcountrynoentities("ProfId2",$fromcompany->pays_code);
|
||||
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
|
||||
$line1.=($line1?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof2);
|
||||
$line1.=($line1?" - ":"").$field.": ".$fromcompany->idprof2;
|
||||
}
|
||||
|
||||
// Second line of company infos
|
||||
@@ -115,19 +115,19 @@ function html_print_paypal_footer($fromcompany,$langs)
|
||||
{
|
||||
$field=$langs->transcountrynoentities("ProfId3",$fromcompany->pays_code);
|
||||
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
|
||||
$line2.=($line2?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof3);
|
||||
$line2.=($line2?" - ":"").$field.": ".$fromcompany->idprof3;
|
||||
}
|
||||
// Prof Id 4
|
||||
if ($fromcompany->idprof4)
|
||||
{
|
||||
$field=$langs->transcountrynoentities("ProfId4",$fromcompany->pays_code);
|
||||
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
|
||||
$line2.=($line2?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof4);
|
||||
$line2.=($line2?" - ":"").$field.": ".$fromcompany->idprof4;
|
||||
}
|
||||
// IntraCommunautary VAT
|
||||
if ($fromcompany->tva_intra != '')
|
||||
{
|
||||
$line2.=($line2?" - ":"").$langs->transnoentities("VATIntraShort").": ".$langs->convToOutputCharset($fromcompany->tva_intra);
|
||||
$line2.=($line2?" - ":"").$langs->transnoentities("VATIntraShort").": ".$fromcompany->tva_intra;
|
||||
}
|
||||
|
||||
print '<br><br><hr>'."\n";
|
||||
@@ -156,7 +156,7 @@ function paypaladmin_prepare_head()
|
||||
$h++;
|
||||
|
||||
$object=(object) array();
|
||||
|
||||
|
||||
// Show more tabs from modules
|
||||
// Entries must be declared in modules descriptor with line
|
||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||
|
||||
@@ -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&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&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 ' <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();
|
||||
?>
|
||||
@@ -37,7 +37,7 @@ class Product extends CommonObject
|
||||
public $element='product';
|
||||
public $table_element='product';
|
||||
public $fk_element='fk_product';
|
||||
public $childtables=array('propaldet','commandedet','facturedet','contratdet','product_fournisseur_price');
|
||||
protected $childtables=array('propaldet','commandedet','facturedet','contratdet','product_fournisseur_price');
|
||||
protected $isnolinkedbythird = 1; // No field fk_soc
|
||||
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||
|
||||
@@ -105,12 +105,12 @@ class Product extends CommonObject
|
||||
var $accountancy_code_buy;
|
||||
var $accountancy_code_sell;
|
||||
|
||||
//! Codes barres
|
||||
var $barcode;
|
||||
var $barcode_type;
|
||||
var $barcode_type_code;
|
||||
var $barcode_type_label;
|
||||
var $barcode_type_coder;
|
||||
//! barcode
|
||||
var $barcode; // value
|
||||
var $barcode_type; // id
|
||||
var $barcode_type_code; // code (loaded by fetch_barcode)
|
||||
var $barcode_type_label; // label (loaded by fetch_barcode)
|
||||
var $barcode_type_coder; // coder (loaded by fetch_barcode)
|
||||
|
||||
var $stats_propale=array();
|
||||
var $stats_commande=array();
|
||||
@@ -403,7 +403,7 @@ class Product extends CommonObject
|
||||
global $langs, $conf;
|
||||
|
||||
$error=0;
|
||||
|
||||
|
||||
// Verification parametres
|
||||
if (! $this->libelle) $this->libelle = 'MISSING LABEL';
|
||||
|
||||
@@ -1100,35 +1100,6 @@ class Product extends CommonObject
|
||||
// multilangs
|
||||
if ($conf->global->MAIN_MULTILANGS) $this->getMultiLangs();
|
||||
|
||||
// Barcode
|
||||
if ($conf->global->MAIN_MODULE_BARCODE)
|
||||
{
|
||||
if ($this->barcode_type == 0)
|
||||
{
|
||||
$this->barcode_type = $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE;
|
||||
}
|
||||
|
||||
if ($this->barcode_type > 0)
|
||||
{
|
||||
$sql = "SELECT code, libelle, coder";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_barcode_type";
|
||||
$sql.= " WHERE rowid = ".$this->barcode_type;
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$result = $this->db->fetch_array($resql);
|
||||
$this->barcode_type_code = $result["code"];
|
||||
$this->barcode_type_label = $result["libelle"];
|
||||
$this->barcode_type_coder = $result["coder"];
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Load multiprices array
|
||||
if ($conf->global->PRODUIT_MULTIPRICES)
|
||||
{
|
||||
@@ -2547,18 +2518,18 @@ class Product extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* Show photos of a product (nbmax maximum)
|
||||
* Show photos of a product (nbmax maximum), into several columns
|
||||
* TODO Move this into html.formproduct.class.php
|
||||
*
|
||||
* @param sdir Directory to scan
|
||||
* @param size 0=original size, 1 use thumbnail if possible
|
||||
* @param nbmax Nombre maximum de photos (0=pas de max)
|
||||
* @param nbbyrow Nombre vignettes par ligne (si mode vignette)
|
||||
* @param showfilename 1=Show filename
|
||||
* @param showaction 1=Show icon with action links (resize, delete)
|
||||
* @param maxHeight Max height of image when size=1
|
||||
* @param maxWidth Max width of image when size=1
|
||||
* @return string Html code to show photo. Number of photos shown is saved in this->nbphoto
|
||||
* TODO Move this into html.formproduct.class.php
|
||||
* @param sdir Directory to scan
|
||||
* @param size 0=original size, 1 use thumbnail if possible
|
||||
* @param nbmax Nombre maximum de photos (0=pas de max)
|
||||
* @param nbbyrow Nombre vignettes par ligne (si mode vignette)
|
||||
* @param showfilename 1=Show filename
|
||||
* @param showaction 1=Show icon with action links (resize, delete)
|
||||
* @param maxHeight Max height of image when size=1
|
||||
* @param maxWidth Max width of image when size=1
|
||||
* @return string Html code to show photo. Number of photos shown is saved in this->nbphoto
|
||||
*/
|
||||
function show_photos($sdir,$size=0,$nbmax=0,$nbbyrow=5,$showfilename=0,$showaction=0,$maxHeight=120,$maxWidth=160)
|
||||
{
|
||||
@@ -2572,7 +2543,6 @@ class Product extends CommonObject
|
||||
$dirthumb = $dir.'thumbs/';
|
||||
$pdirthumb = $pdir.'thumbs/';
|
||||
|
||||
|
||||
$return ='<!-- Photo -->'."\n";
|
||||
/*$return.="<script type=\"text/javascript\">
|
||||
jQuery(function() {
|
||||
@@ -2715,6 +2685,7 @@ class Product extends CommonObject
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retourne tableau de toutes les photos du produit
|
||||
*
|
||||
|
||||
@@ -87,6 +87,26 @@ $error=$hookmanager->error; $errors=$hookmanager->errors;
|
||||
|
||||
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')
|
||||
{
|
||||
$product = new Product($db);
|
||||
@@ -629,6 +649,7 @@ llxHeader('',$langs->trans("CardProduct".$_GET["type"]),$helpurl);
|
||||
$form = new Form($db);
|
||||
$formproduct = new FormProduct($db);
|
||||
|
||||
|
||||
if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
||||
{
|
||||
// -----------------------------------------
|
||||
@@ -981,13 +1002,14 @@ else
|
||||
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
|
||||
print '<table class="border" width="100%"><tr>';
|
||||
|
||||
// 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 '</td>';
|
||||
|
||||
@@ -1000,17 +1022,66 @@ else
|
||||
if ($object->type!=1) $nblignes++;
|
||||
if ($object->isservice()) $nblignes++;
|
||||
else $nblignes+=4;
|
||||
if ($showbarcode) $nblignes+=2;
|
||||
|
||||
// Photo
|
||||
if ($isphoto)
|
||||
if ($showphoto || $showbarcode)
|
||||
{
|
||||
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 '</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&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&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 ' <input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
}
|
||||
else
|
||||
{
|
||||
print $object->barcode;
|
||||
}
|
||||
print '</td></tr>'."\n";
|
||||
}
|
||||
|
||||
// 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 $form->editfieldval("ProductAccountancySellCode",'productaccountancycodesell',$object->accountancy_code_sell,$object,$user->rights->produit->creer|$user->rights->service->creer);
|
||||
|
||||
@@ -107,7 +107,7 @@ if ($_GET["socid"])
|
||||
|
||||
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\">";
|
||||
|
||||
@@ -153,7 +153,7 @@ abstract class ActionsCardCommon
|
||||
$this->object->code_client = $_POST["code_client"];
|
||||
$this->object->code_fournisseur = $_POST["code_fournisseur"];
|
||||
$this->object->capital = $_POST["capital"];
|
||||
$this->object->gencod = $_POST["gencod"];
|
||||
$this->object->barcode = $_POST["barcode"];
|
||||
$this->object->canvas = GETPOST("canvas");
|
||||
|
||||
$this->object->tva_assuj = $_POST["assujtva_value"];
|
||||
@@ -686,7 +686,7 @@ abstract class ActionsCardCommon
|
||||
$this->object->idprof4 = $_POST["idprof4"];
|
||||
$this->object->typent_id = $_POST["typent_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->default_lang = $_POST["default_lang"];
|
||||
$this->object->commercial_id = $_POST["commercial_id"];
|
||||
|
||||
@@ -98,7 +98,7 @@
|
||||
<?php if ($conf->global->MAIN_MODULE_BARCODE) { ?>
|
||||
<tr>
|
||||
<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>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ if ($this->control->tpl['fournisseur']) {
|
||||
<?php if ($conf->global->MAIN_MODULE_BARCODE) { ?>
|
||||
<tr>
|
||||
<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>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ dol_fiche_head($head, 'card', $langs->trans("ThirdParty"),0,'company');
|
||||
<?php if ($conf->global->MAIN_MODULE_BARCODE) { ?>
|
||||
<tr>
|
||||
<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>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors']
|
||||
<?php if ($conf->global->MAIN_MODULE_BARCODE) { ?>
|
||||
<tr>
|
||||
<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>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ if ($this->control->tpl['fournisseur']) {
|
||||
<?php if ($conf->global->MAIN_MODULE_BARCODE) { ?>
|
||||
<tr>
|
||||
<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>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ dol_fiche_head($head, 'card', $langs->trans("ThirdParty"),0,'company');
|
||||
<?php if ($conf->global->MAIN_MODULE_BARCODE) { ?>
|
||||
<tr>
|
||||
<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>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* 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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -48,18 +48,13 @@ class Address
|
||||
|
||||
|
||||
/**
|
||||
* \brief Constructeur de la classe
|
||||
* \param DB handler acces base de donnees
|
||||
* \param id id societe (0 par defaut)
|
||||
* Constructeur de la classe
|
||||
*
|
||||
* @param DoliDB $db handler acces base de donnees
|
||||
*/
|
||||
function Address($DB, $id=0)
|
||||
function Address($db)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$this->db = $DB;
|
||||
|
||||
$this->id = $id;
|
||||
|
||||
$this->db = $db;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -242,12 +237,13 @@ class Address
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief 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
|
||||
* \return int >0 si ok, <0 si ko
|
||||
* Charge depuis la base toutes les adresses d'une societe
|
||||
*
|
||||
* @param int $socid Id de la societe a charger en memoire
|
||||
* @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;
|
||||
|
||||
@@ -337,10 +333,11 @@ class Address
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Charge depuis la base l'objet adresse
|
||||
* \param id Id de l'adresse a charger en memoire
|
||||
* \param user Objet de l'utilisateur
|
||||
* \return int >0 si ok, <0 si ko
|
||||
* Charge depuis la base l'objet adresse
|
||||
*
|
||||
* @param int $id Id de l'adresse a charger en memoire
|
||||
* @param User $user Objet de l'utilisateur
|
||||
* @return int >0 si ok, <0 si ko
|
||||
*/
|
||||
function fetch_address($id, $user=0)
|
||||
{
|
||||
|
||||
@@ -39,7 +39,7 @@ class Societe extends CommonObject
|
||||
public $element='societe';
|
||||
public $table_element = 'societe';
|
||||
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
|
||||
|
||||
var $id;
|
||||
@@ -74,7 +74,13 @@ class Societe extends CommonObject
|
||||
var $fax;
|
||||
var $email;
|
||||
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)
|
||||
var $siren; // IdProf1 - Deprecated
|
||||
@@ -142,13 +148,13 @@ class Societe extends CommonObject
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $DB Database handler
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
public function Societe($DB)
|
||||
public function Societe($db)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$this->db = $DB;
|
||||
$this->db = $db;
|
||||
|
||||
$this->client = 0;
|
||||
$this->prospect = 0;
|
||||
@@ -168,15 +174,15 @@ class Societe extends CommonObject
|
||||
/**
|
||||
* Create third party in database
|
||||
*
|
||||
* @param user Object of user that ask creation
|
||||
* @return int >= 0 if OK, < 0 if KO
|
||||
* @param User $user Object of user that ask creation
|
||||
* @return int >= 0 if OK, < 0 if KO
|
||||
*/
|
||||
function create($user='')
|
||||
{
|
||||
global $langs,$conf;
|
||||
|
||||
$error=0;
|
||||
|
||||
|
||||
// Clean parameters
|
||||
if (empty($this->status)) $this->status=0;
|
||||
$this->name=$this->name?trim($this->name):trim($this->nom);
|
||||
@@ -365,13 +371,13 @@ class Societe extends CommonObject
|
||||
/**
|
||||
* Update parameters of third party
|
||||
*
|
||||
* @param id id societe
|
||||
* @param user Utilisateur qui demande la mise a jour
|
||||
* @param call_trigger 0=non, 1=oui
|
||||
* @param allowmodcodeclient Inclut modif code client et code compta
|
||||
* @param allowmodcodefournisseur Inclut modif code fournisseur et code compta fournisseur
|
||||
* @param action 'create' or 'update'
|
||||
* @return int <0 if KO, >=0 if OK
|
||||
* @param int $id id societe
|
||||
* @param User $user Utilisateur qui demande la mise a jour
|
||||
* @param int $call_trigger 0=non, 1=oui
|
||||
* @param int $allowmodcodeclient Inclut modif code client et code compta
|
||||
* @param int $allowmodcodefournisseur Inclut modif code fournisseur et code compta fournisseur
|
||||
* @param string $action 'create' or 'update'
|
||||
* @return int <0 if KO, >=0 if OK
|
||||
*/
|
||||
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);
|
||||
|
||||
//Gencod
|
||||
$this->gencod=trim($this->gencod);
|
||||
$this->barcode=trim($this->barcode);
|
||||
|
||||
// For automatic creation
|
||||
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 .= ",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 .= ",logo = ".($this->logo?"'".$this->logo."'":"null");
|
||||
|
||||
@@ -610,6 +616,7 @@ class Societe extends CommonObject
|
||||
|
||||
/**
|
||||
* Load a third party from database into memory
|
||||
*
|
||||
* @param rowid Id of third party to load
|
||||
* @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)
|
||||
@@ -637,7 +644,7 @@ class Societe extends CommonObject
|
||||
$sql .= ', s.fk_typent as typent_id';
|
||||
$sql .= ', s.fk_effectif as effectif_id';
|
||||
$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.localtax1_assuj, s.localtax2_assuj, s.fk_prospectlevel, s.default_lang, s.logo';
|
||||
$sql .= ', s.import_key';
|
||||
@@ -736,7 +743,7 @@ class Societe extends CommonObject
|
||||
$this->code_compta = $obj->code_compta;
|
||||
$this->code_compta_fournisseur = $obj->code_compta_fournisseur;
|
||||
|
||||
$this->gencod = $obj->gencod;
|
||||
$this->barcode = $obj->barcode;
|
||||
|
||||
$this->tva_assuj = $obj->tva_assuj;
|
||||
$this->tva_intra = $obj->tva_intra;
|
||||
@@ -803,65 +810,12 @@ class Societe extends CommonObject
|
||||
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...)
|
||||
*
|
||||
* @param id id of third party to delete
|
||||
* @return int <0 if KO, 0 if nothing done, >0 if OK
|
||||
* @param int $id Id of third party to delete
|
||||
* @return int <0 if KO, 0 if nothing done, >0 if OK
|
||||
*/
|
||||
function delete($id)
|
||||
{
|
||||
@@ -2357,7 +2311,7 @@ class Societe extends CommonObject
|
||||
|
||||
/**
|
||||
* Create a third party into database from a member object
|
||||
*
|
||||
*
|
||||
* @param member Object member
|
||||
* @param socname Name of third party to force
|
||||
* @return int <0 if KO, id of created account if OK
|
||||
|
||||
@@ -135,7 +135,7 @@ if (empty($reshook))
|
||||
$object->code_client = $_POST["code_client"];
|
||||
$object->code_fournisseur = $_POST["code_fournisseur"];
|
||||
$object->capital = $_POST["capital"];
|
||||
$object->gencod = $_POST["gencod"];
|
||||
$object->barcode = $_POST["barcode"];
|
||||
|
||||
$object->tva_intra = $_POST["tva_intra"];
|
||||
$object->tva_assuj = $_POST["assujtva_value"];
|
||||
@@ -535,7 +535,7 @@ else
|
||||
$object->email = $_POST["email"];
|
||||
$object->url = $_POST["url"];
|
||||
$object->capital = $_POST["capital"];
|
||||
$object->gencod = $_POST["gencod"];
|
||||
$object->barcode = $_POST["barcode"];
|
||||
$object->idprof1 = $_POST["idprof1"];
|
||||
$object->idprof2 = $_POST["idprof2"];
|
||||
$object->idprof3 = $_POST["idprof3"];
|
||||
@@ -757,7 +757,7 @@ else
|
||||
// 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>';
|
||||
}
|
||||
|
||||
@@ -1040,7 +1040,7 @@ else
|
||||
$object->idprof4=$_POST["idprof4"];
|
||||
$object->typent_id=$_POST["typent_id"];
|
||||
$object->effectif_id=$_POST["effectif_id"];
|
||||
$object->gencod=$_POST["gencod"];
|
||||
$object->barcode=$_POST["barcode"];
|
||||
$object->forme_juridique_code=$_POST["forme_juridique_code"];
|
||||
$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
|
||||
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 '</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
|
||||
print '<tr><td valign="top">'.$langs->trans('Address').'</td><td colspan="3"><textarea name="adresse" cols="40" rows="3" wrap="soft">';
|
||||
print $object->address;
|
||||
@@ -1442,6 +1442,9 @@ else
|
||||
|
||||
dol_htmloutput_errors($error,$errors);
|
||||
|
||||
$showlogo=$object->logo;
|
||||
$showbarcode=($conf->barcode->enabled && $user->rights->barcode->lire);
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
@@ -1460,84 +1463,89 @@ else
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Logo
|
||||
// Logo+barcode
|
||||
$rowspan=4;
|
||||
if (! empty($conf->global->SOCIETE_USEPREFIX)) $rowspan++;
|
||||
if ($object->client) $rowspan++;
|
||||
if ($conf->fournisseur->enabled && $object->fournisseur && ! empty($user->rights->fournisseur->lire)) $rowspan++;
|
||||
if ($conf->global->MAIN_MODULE_BARCODE) $rowspan++;
|
||||
if (empty($conf->global->SOCIETE_DISABLE_STATE)) $rowspan++;
|
||||
$showlogo='';
|
||||
if ($object->logo)
|
||||
$htmllogobar='';
|
||||
if ($showlogo || $showbarcode)
|
||||
{
|
||||
$showlogo.='<td rowspan="'.$rowspan.'" style="text-align: center;" width="25%">';
|
||||
$showlogo.=$form->showphoto('societe',$object,50);
|
||||
$showlogo.='</td>';
|
||||
$htmllogobar.='<td rowspan="'.$rowspan.'" style="text-align: center;" width="25%">';
|
||||
if ($showlogo) $htmllogobar.=$form->showphoto('societe',$object,50);
|
||||
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
|
||||
{
|
||||
print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="'.(2+($object->logo?0:1)).'">'.$object->prefix_comm.'</td>';
|
||||
print $showlogo; $showlogo='';
|
||||
print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="'.(2+(($showlogo || $showbarcode)?0:1)).'">'.$object->prefix_comm.'</td>';
|
||||
print $htmllogobar; $htmllogobar='';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Customer code
|
||||
if ($object->client)
|
||||
{
|
||||
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;
|
||||
if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
|
||||
print '</td>';
|
||||
print $showlogo; $showlogo='';
|
||||
print $htmllogobar; $htmllogobar='';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Supplier code
|
||||
if ($conf->fournisseur->enabled && $object->fournisseur && ! empty($user->rights->fournisseur->lire))
|
||||
{
|
||||
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;
|
||||
if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
|
||||
print '</td>';
|
||||
print $showlogo; $showlogo='';
|
||||
print $htmllogobar; $htmllogobar='';
|
||||
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
|
||||
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
|
||||
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);
|
||||
print "</td></tr>";
|
||||
|
||||
// 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 "</td>";
|
||||
print '</tr>';
|
||||
|
||||
// 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);
|
||||
if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->pays,$langs->trans("CountryIsInEEC"),1,0);
|
||||
else print ($img?$img.' ':'').$object->pays;
|
||||
print '</td></tr>';
|
||||
|
||||
// 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 '<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>';
|
||||
|
||||
@@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user