Qual : Review code after intalling PHPUnit, CodeSniffer on Eclipse...
This commit is contained in:
parent
281cd49f32
commit
c109467d20
@ -44,24 +44,24 @@ $object = new Expedition($db);
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
//if ($action==setvalue AND $carrier)
|
//if ($action==setvalue AND $carrier)
|
||||||
if ($action==setvalue)
|
if ($action=='setvalue')
|
||||||
{
|
{
|
||||||
// need to add check on values
|
// need to add check on values
|
||||||
$object->update[code]=GETPOST('code','alpha');
|
$object->update['code']=GETPOST('code','alpha');
|
||||||
$object->update[libelle]=GETPOST('libelle','alpha');
|
$object->update['libelle']=GETPOST('libelle','alpha');
|
||||||
$object->update[description]=GETPOST('description','alpha');
|
$object->update['description']=GETPOST('description','alpha');
|
||||||
$object->update[tracking]=GETPOST('tracking','alpha');
|
$object->update['tracking']=GETPOST('tracking','alpha');
|
||||||
$object->update_delivery_method($carrier);
|
$object->update_delivery_method($carrier);
|
||||||
header("Location: carrier.php");
|
header("Location: carrier.php");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action==activate_carrier AND $carrier!='')
|
if ($action=='activate_carrier' && $carrier!='')
|
||||||
{
|
{
|
||||||
$object->activ_delivery_method($carrier);
|
$object->activ_delivery_method($carrier);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action==disable_carrier AND $carrier!='')
|
if ($action=='disable_carrier' && $carrier!='')
|
||||||
{
|
{
|
||||||
$object->disable_delivery_method($carrier);
|
$object->disable_delivery_method($carrier);
|
||||||
}
|
}
|
||||||
@ -134,26 +134,26 @@ if ($action=='edit_carrier' || $action=='setvalue')
|
|||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr '.$bc[$var].'><td class="fieldrequired">';
|
print '<tr '.$bc[$var].'><td class="fieldrequired">';
|
||||||
print $langs->trans("Code").'</td><td>';
|
print $langs->trans("Code").'</td><td>';
|
||||||
print '<input size="32" type="text" name="code" value="'.$object->listmeths[0][code].'">';
|
print '<input size="32" type="text" name="code" value="'.$object->listmeths[0]['code'].'">';
|
||||||
print ' '.$langs->trans("Example").': CODE';
|
print ' '.$langs->trans("Example").': CODE';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr '.$bc[$var].'><td class="fieldrequired">';
|
print '<tr '.$bc[$var].'><td class="fieldrequired">';
|
||||||
print $langs->trans("Name").'</td><td>';
|
print $langs->trans("Name").'</td><td>';
|
||||||
print '<input size="32" type="text" name="libelle" value="'.$object->listmeths[0][libelle].'">';
|
print '<input size="32" type="text" name="libelle" value="'.$object->listmeths[0]['libelle'].'">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr '.$bc[$var].'><td class="fieldrequired">';
|
print '<tr '.$bc[$var].'><td class="fieldrequired">';
|
||||||
print $langs->trans("Description").'</td><td>';
|
print $langs->trans("Description").'</td><td>';
|
||||||
print '<input size="64" type="text" name="description" value="'.$object->listmeths[0][description].'">';
|
print '<input size="64" type="text" name="description" value="'.$object->listmeths[0]['description'].'">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr '.$bc[$var].'><td class="fieldrequired">';
|
print '<tr '.$bc[$var].'><td class="fieldrequired">';
|
||||||
print $langs->trans("Tracking").'</td><td>';
|
print $langs->trans("Tracking").'</td><td>';
|
||||||
print '<input size="128" type="text" name="tracking" value="'.$object->listmeths[0][tracking].'">';
|
print '<input size="128" type="text" name="tracking" value="'.$object->listmeths[0]['tracking'].'">';
|
||||||
print ' '.$langs->trans("Example").': http://www.website.com/dir/{TRACKID}';
|
print ' '.$langs->trans("Example").': http://www.website.com/dir/{TRACKID}';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
@ -186,25 +186,26 @@ else
|
|||||||
print '<td align="center" width="60">'.$langs->trans("Status").'</td>';
|
print '<td align="center" width="60">'.$langs->trans("Status").'</td>';
|
||||||
print '<td align="center" width="30">'.$langs->trans("Edit").'</td>';
|
print '<td align="center" width="30">'.$langs->trans("Edit").'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
for ($i=0; $i<sizeof($object->listmeths); $i++)
|
$numlistmeths=count($object->listmeths);
|
||||||
|
for ($i=0; $i<$numlistmeths; $i++)
|
||||||
{
|
{
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<tr ".$bc[$var].">";
|
print "<tr ".$bc[$var].">";
|
||||||
print '<td>'.$object->listmeths[$i][code].'</td>';
|
print '<td>'.$object->listmeths[$i]['code'].'</td>';
|
||||||
print '<td>'.$object->listmeths[$i][libelle].'</td>';
|
print '<td>'.$object->listmeths[$i]['libelle'].'</td>';
|
||||||
print '<td>'.$object->listmeths[$i][description].'</td>';
|
print '<td>'.$object->listmeths[$i]['description'].'</td>';
|
||||||
print '<td>'.$object->listmeths[$i][tracking].'</td>';
|
print '<td>'.$object->listmeths[$i]['tracking'].'</td>';
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
if($object->listmeths[$i][active] == 0)
|
if($object->listmeths[$i]['active'] == 0)
|
||||||
{
|
{
|
||||||
print '<a href="carrier.php?action=activate_carrier&carrier='.$object->listmeths[$i][rowid].'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
print '<a href="carrier.php?action=activate_carrier&carrier='.$object->listmeths[$i]['rowid'].'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<a href="carrier.php?action=disable_carrier&carrier='.$object->listmeths[$i][rowid].'">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>';
|
print '<a href="carrier.php?action=disable_carrier&carrier='.$object->listmeths[$i]['rowid'].'">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>';
|
||||||
}
|
}
|
||||||
print '</td><td align="center">';
|
print '</td><td align="center">';
|
||||||
print '<a href="carrier.php?action=edit_carrier&carrier='.$object->listmeths[$i][rowid].'">'.img_picto($langs->trans("Edit"),'edit').'</a>';
|
print '<a href="carrier.php?action=edit_carrier&carrier='.$object->listmeths[$i]['rowid'].'">'.img_picto($langs->trans("Edit"),'edit').'</a>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1199,7 +1199,6 @@ class Propal extends CommonObject
|
|||||||
* Update value of extrafields on the proposal
|
* Update value of extrafields on the proposal
|
||||||
*
|
*
|
||||||
* @param User $user Object user that modify
|
* @param User $user Object user that modify
|
||||||
* @param double $remise Amount discount
|
|
||||||
* @return int <0 if ko, >0 if ok
|
* @return int <0 if ko, >0 if ok
|
||||||
*/
|
*/
|
||||||
function update_extrafields($user)
|
function update_extrafields($user)
|
||||||
|
|||||||
@ -1107,7 +1107,7 @@ else if ($action == 'print_file' AND $user->rights->printipp->use)
|
|||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/dolprintipp.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/dolprintipp.class.php';
|
||||||
$printer = new dolPrintIPP($db,$conf->global->PRINTIPP_HOST,$conf->global->PRINTIPP_PORT,$user->login,$conf->global->PRINTIPP_USER,$conf->global->PRINTIPP_PASSWORD);
|
$printer = new dolPrintIPP($db,$conf->global->PRINTIPP_HOST,$conf->global->PRINTIPP_PORT,$user->login,$conf->global->PRINTIPP_USER,$conf->global->PRINTIPP_PASSWORD);
|
||||||
$printer->print_file(GETPOST('file',alpha),GETPOST('printer',alpha));
|
$printer->print_file(GETPOST('file','alpha'),GETPOST('printer','alpha'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -559,7 +559,6 @@ class Facture extends CommonInvoice
|
|||||||
* Load an object from its id and create a new one in database
|
* Load an object from its id and create a new one in database
|
||||||
*
|
*
|
||||||
* @param int $socid Id of thirdparty
|
* @param int $socid Id of thirdparty
|
||||||
* @param HookManager $hookmanager Hook manager instance
|
|
||||||
* @return int New id of clone
|
* @return int New id of clone
|
||||||
*/
|
*/
|
||||||
function createFromClone($socid=0)
|
function createFromClone($socid=0)
|
||||||
|
|||||||
@ -894,6 +894,8 @@ class Contrat extends CommonObject
|
|||||||
* @param float $price_base_type HT or TTC
|
* @param float $price_base_type HT or TTC
|
||||||
* @param float $pu_ttc Prix unitaire TTC
|
* @param float $pu_ttc Prix unitaire TTC
|
||||||
* @param int $info_bits Bits de type de lignes
|
* @param int $info_bits Bits de type de lignes
|
||||||
|
* @param int $fk_fournprice Fourn price id
|
||||||
|
* @param int $pa_ht Buying price HT
|
||||||
* @return int <0 si erreur, >0 si ok
|
* @return int <0 si erreur, >0 si ok
|
||||||
*/
|
*/
|
||||||
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $date_start, $date_end, $price_base_type='HT', $pu_ttc=0, $info_bits=0, $fk_fournprice=null, $pa_ht = 0)
|
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $date_start, $date_end, $price_base_type='HT', $pu_ttc=0, $info_bits=0, $fk_fournprice=null, $pa_ht = 0)
|
||||||
@ -1034,6 +1036,8 @@ class Contrat extends CommonObject
|
|||||||
* @param timestamp $date_fin_reel Date de fin reelle
|
* @param timestamp $date_fin_reel Date de fin reelle
|
||||||
* @param float $price_base_type HT or TTC
|
* @param float $price_base_type HT or TTC
|
||||||
* @param int $info_bits Bits de type de lignes
|
* @param int $info_bits Bits de type de lignes
|
||||||
|
* @param int $fk_fournprice Fourn price id
|
||||||
|
* @param int $pa_ht Buying price HT
|
||||||
* @return int < 0 si erreur, > 0 si ok
|
* @return int < 0 si erreur, > 0 si ok
|
||||||
*/
|
*/
|
||||||
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $tvatx, $localtax1tx=0, $localtax2tx=0, $date_debut_reel='', $date_fin_reel='', $price_base_type='HT', $info_bits=0, $fk_fournprice=null, $pa_ht = 0)
|
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $tvatx, $localtax1tx=0, $localtax2tx=0, $date_debut_reel='', $date_fin_reel='', $price_base_type='HT', $info_bits=0, $fk_fournprice=null, $pa_ht = 0)
|
||||||
|
|||||||
@ -45,7 +45,9 @@ class box_comptes extends ModeleBoxes
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param DoliDB $db Database handler
|
||||||
*/
|
*/
|
||||||
function __construct($db)
|
function __construct($db)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -45,7 +45,9 @@ class box_members extends ModeleBoxes
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param DoliDB $db Database handler
|
||||||
*/
|
*/
|
||||||
function __construct($db)
|
function __construct($db)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2196,7 +2196,7 @@ abstract class CommonObject
|
|||||||
* @param object $extrafields extrafield Object
|
* @param object $extrafields extrafield Object
|
||||||
* @param string $mode Show output (view) or input (edit) for extrafield
|
* @param string $mode Show output (view) or input (edit) for extrafield
|
||||||
*
|
*
|
||||||
* return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function showOptionals($extrafields,$mode='view')
|
function showOptionals($extrafields,$mode='view')
|
||||||
{
|
{
|
||||||
|
|||||||
@ -42,6 +42,9 @@ class dolprintIPP
|
|||||||
* @param DoliDB $db database
|
* @param DoliDB $db database
|
||||||
* @param string $host host of Cups
|
* @param string $host host of Cups
|
||||||
* @param string $port port
|
* @param string $port port
|
||||||
|
* @param string $userid userid
|
||||||
|
* @param string $user user
|
||||||
|
* @param string $password password
|
||||||
* @return printIPP
|
* @return printIPP
|
||||||
*/
|
*/
|
||||||
function __construct($db,$host,$port,$userid,$user,$password)
|
function __construct($db,$host,$port,$userid,$user,$password)
|
||||||
@ -77,6 +80,10 @@ class dolprintIPP
|
|||||||
/**
|
/**
|
||||||
* Print selected file
|
* Print selected file
|
||||||
*
|
*
|
||||||
|
* @param string $file file
|
||||||
|
* @param string $module module
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
function print_file($file,$module)
|
function print_file($file,$module)
|
||||||
{
|
{
|
||||||
@ -112,6 +119,9 @@ class dolprintIPP
|
|||||||
/**
|
/**
|
||||||
* List jobs print
|
* List jobs print
|
||||||
*
|
*
|
||||||
|
* @param string $module module
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
function list_jobs($module)
|
function list_jobs($module)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -97,6 +97,7 @@ class ExtraFields
|
|||||||
* @param string $elementtype Element type ('member', 'product', 'company', ...)
|
* @param string $elementtype Element type ('member', 'product', 'company', ...)
|
||||||
* @param int $unique Is field unique or not
|
* @param int $unique Is field unique or not
|
||||||
* @param int $required Is field required or not
|
* @param int $required Is field required or not
|
||||||
|
* @param string $default_value Defaulted value
|
||||||
* @param array $param Params for field
|
* @param array $param Params for field
|
||||||
* @return int <=0 if KO, >0 if OK
|
* @return int <=0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
@ -219,7 +220,7 @@ class ExtraFields
|
|||||||
* @param array $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) )
|
* @param array $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) )
|
||||||
* @return int <=0 if KO, >0 if OK
|
* @return int <=0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
private function create_label($attrname, $label='', $type='', $pos=0, $size=0, $elementtype='member', $unique=0, $required=0,$param)
|
private function create_label($attrname, $label='', $type='', $pos=0, $size=0, $elementtype='member', $unique=0, $required=0, $param='')
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
@ -356,7 +357,7 @@ class ExtraFields
|
|||||||
* @param array $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) )
|
* @param array $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) )
|
||||||
* @return int >0 if OK, <=0 if KO
|
* @return int >0 if OK, <=0 if KO
|
||||||
*/
|
*/
|
||||||
function update($attrname,$label,$type,$length,$elementtype,$unique=0,$required=0,$pos,$param='')
|
function update($attrname,$label,$type,$length,$elementtype,$unique=0,$required=0,$pos=0,$param='')
|
||||||
{
|
{
|
||||||
$table=$elementtype.'_extrafields';
|
$table=$elementtype.'_extrafields';
|
||||||
// Special case for not normalized table names
|
// Special case for not normalized table names
|
||||||
@ -814,7 +815,7 @@ class ExtraFields
|
|||||||
* Fill array_options array for object by extrafields value (using for data send by forms)
|
* Fill array_options array for object by extrafields value (using for data send by forms)
|
||||||
*
|
*
|
||||||
* @param array $extralabels $array of extrafields
|
* @param array $extralabels $array of extrafields
|
||||||
* @param object $object object
|
* @param object &$object object
|
||||||
* @return int 1 if array_options set / 0 if no value
|
* @return int 1 if array_options set / 0 if no value
|
||||||
*/
|
*/
|
||||||
function setOptionalsFromPost($extralabels,&$object)
|
function setOptionalsFromPost($extralabels,&$object)
|
||||||
|
|||||||
@ -211,9 +211,10 @@ class FormOther
|
|||||||
/**
|
/**
|
||||||
* Return list of revenue stamp for country
|
* Return list of revenue stamp for country
|
||||||
*
|
*
|
||||||
* @param string $selected Value of preselected revenue stamp
|
* @param string $selected Value of preselected revenue stamp
|
||||||
* @param string $htmlname Name of combo list
|
* @param string $htmlname Name of combo list
|
||||||
* @return string HTML select list
|
* @param string $country_code Country Code
|
||||||
|
* @return string HTML select list
|
||||||
*/
|
*/
|
||||||
function select_revenue_stamp($selected='',$htmlname='revenuestamp',$country_code='')
|
function select_revenue_stamp($selected='',$htmlname='revenuestamp',$country_code='')
|
||||||
{
|
{
|
||||||
|
|||||||
@ -694,6 +694,7 @@ class Translate
|
|||||||
/**
|
/**
|
||||||
* Return a currency code into its symbol
|
* Return a currency code into its symbol
|
||||||
*
|
*
|
||||||
|
* @param string $currency_code Currency Code
|
||||||
* @param string $amount If not '', show currency + amount according to langs ($10, 10€).
|
* @param string $amount If not '', show currency + amount according to langs ($10, 10€).
|
||||||
* @return string Amount + Currency symbol encoded into UTF8
|
* @return string Amount + Currency symbol encoded into UTF8
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -299,9 +299,10 @@ function ajax_dialog($title,$message,$w=350,$h=150)
|
|||||||
/**
|
/**
|
||||||
* Convert a html select field into an ajax combobox
|
* Convert a html select field into an ajax combobox
|
||||||
*
|
*
|
||||||
* @param string $htmlname Name of html select field
|
* @param string $htmlname Name of html select field
|
||||||
* @param array $event Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
|
* @param array $event Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
|
||||||
* @return string Return html string to convert a select field into a combo
|
* @param int $minLengthToAutocomplete Minimum length of input string to start autocomplete
|
||||||
|
* @return string Return html string to convert a select field into a combo
|
||||||
*/
|
*/
|
||||||
function ajax_combobox($htmlname, $event=array(), $minLengthToAutocomplete=0)
|
function ajax_combobox($htmlname, $event=array(), $minLengthToAutocomplete=0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,38 +1,38 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
||||||
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 3 of the License, or
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* or see http://www.gnu.org/
|
* or see http://www.gnu.org/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/core/lib/pdf.lib.php
|
* \file htdocs/core/lib/pdf.lib.php
|
||||||
* \brief Set of functions used for PDF generation
|
* \brief Set of functions used for PDF generation
|
||||||
* \ingroup core
|
* \ingroup core
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return array with format properties of default PDF format
|
* Return array with format properties of default PDF format
|
||||||
*
|
*
|
||||||
* @return array Array('width'=>w,'height'=>h,'unit'=>u);
|
* @return array Array('width'=>w,'height'=>h,'unit'=>u);
|
||||||
*/
|
*/
|
||||||
function pdf_getFormat()
|
function pdf_getFormat()
|
||||||
{
|
{
|
||||||
global $conf,$db;
|
global $conf,$db;
|
||||||
@ -78,7 +78,7 @@ function pdf_getInstance($format='',$metric='mm',$pagetype='P')
|
|||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
if (! empty($conf->global->MAIN_USE_FPDF) && ! empty($conf->global->MAIN_DISABLE_FPDI))
|
if (! empty($conf->global->MAIN_USE_FPDF) && ! empty($conf->global->MAIN_DISABLE_FPDI))
|
||||||
return "Error MAIN_USE_FPDF and MAIN_DISABLE_FPDI can't be set together";
|
return "Error MAIN_USE_FPDF and MAIN_DISABLE_FPDI can't be set together";
|
||||||
|
|
||||||
// We use by default TCPDF else FPDF
|
// We use by default TCPDF else FPDF
|
||||||
if (empty($conf->global->MAIN_USE_FPDF)) require_once TCPDF_PATH.'tcpdf.php';
|
if (empty($conf->global->MAIN_USE_FPDF)) require_once TCPDF_PATH.'tcpdf.php';
|
||||||
@ -96,15 +96,15 @@ function pdf_getInstance($format='',$metric='mm',$pagetype='P')
|
|||||||
{
|
{
|
||||||
/* Permission supported by TCPDF
|
/* Permission supported by TCPDF
|
||||||
- print : Print the document;
|
- print : Print the document;
|
||||||
- modify : Modify the contents of the document by operations other than those controlled by 'fill-forms', 'extract' and 'assemble';
|
- modify : Modify the contents of the document by operations other than those controlled by 'fill-forms', 'extract' and 'assemble';
|
||||||
- copy : Copy or otherwise extract text and graphics from the document;
|
- copy : Copy or otherwise extract text and graphics from the document;
|
||||||
- annot-forms : Add or modify text annotations, fill in interactive form fields, and, if 'modify' is also set, create or modify interactive form fields (including signature fields);
|
- annot-forms : Add or modify text annotations, fill in interactive form fields, and, if 'modify' is also set, create or modify interactive form fields (including signature fields);
|
||||||
- fill-forms : Fill in existing interactive form fields (including signature fields), even if 'annot-forms' is not specified;
|
- fill-forms : Fill in existing interactive form fields (including signature fields), even if 'annot-forms' is not specified;
|
||||||
- extract : Extract text and graphics (in support of accessibility to users with disabilities or for other purposes);
|
- extract : Extract text and graphics (in support of accessibility to users with disabilities or for other purposes);
|
||||||
- assemble : Assemble the document (insert, rotate, or delete pages and create bookmarks or thumbnail images), even if 'modify' is not set;
|
- assemble : Assemble the document (insert, rotate, or delete pages and create bookmarks or thumbnail images), even if 'modify' is not set;
|
||||||
- print-high : Print the document to a representation from which a faithful digital copy of the PDF content could be generated. When this is not set, printing is limited to a low-level representation of the appearance, possibly of degraded quality.
|
- print-high : Print the document to a representation from which a faithful digital copy of the PDF content could be generated. When this is not set, printing is limited to a low-level representation of the appearance, possibly of degraded quality.
|
||||||
- owner : (inverted logic - only for public-key) when set permits change of encryption and enables all other permissions.
|
- owner : (inverted logic - only for public-key) when set permits change of encryption and enables all other permissions.
|
||||||
*/
|
*/
|
||||||
if (class_exists('FPDI')) $pdf = new FPDI($pagetype,$metric,$format);
|
if (class_exists('FPDI')) $pdf = new FPDI($pagetype,$metric,$format);
|
||||||
else $pdf = new TCPDF($pagetype,$metric,$format);
|
else $pdf = new TCPDF($pagetype,$metric,$format);
|
||||||
// For TCPDF, we specify permission we want to block
|
// For TCPDF, we specify permission we want to block
|
||||||
@ -125,10 +125,10 @@ function pdf_getInstance($format='',$metric='mm',$pagetype='P')
|
|||||||
{
|
{
|
||||||
// Declare here a class to overwrite FPDI to add method writeHTMLCell
|
// Declare here a class to overwrite FPDI to add method writeHTMLCell
|
||||||
/**
|
/**
|
||||||
* This class if a enhanced FPDI class that support method writeHTMLCell
|
* This class if a enhanced FPDI class that support method writeHTMLCell
|
||||||
*/
|
*/
|
||||||
class FPDI_DolExtended extends FPDI
|
class FPDI_DolExtended extends FPDI
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* __call
|
* __call
|
||||||
*
|
*
|
||||||
@ -230,16 +230,16 @@ function pdf_getPDFFontSize($outputlangs)
|
|||||||
*/
|
*/
|
||||||
function pdf_getHeightForLogo($logo)
|
function pdf_getHeightForLogo($logo)
|
||||||
{
|
{
|
||||||
$height=22; $maxwidth=130;
|
$height=22; $maxwidth=130;
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
|
||||||
$tmp=dol_getImageSize($logo);
|
$tmp=dol_getImageSize($logo);
|
||||||
if ($tmp['height'])
|
if ($tmp['height'])
|
||||||
{
|
{
|
||||||
$width=round($height*$tmp['width']/$tmp['height']);
|
$width=round($height*$tmp['width']/$tmp['height']);
|
||||||
if ($width > $maxwidth) $height=$height*$maxwidth/$width;
|
if ($width > $maxwidth) $height=$height*$maxwidth/$width;
|
||||||
}
|
}
|
||||||
//print $tmp['width'].' '.$tmp['height'].' '.$width; exit;
|
//print $tmp['width'].' '.$tmp['height'].' '.$width; exit;
|
||||||
return $height;
|
return $height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -275,15 +275,15 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
|
|||||||
|
|
||||||
if (empty($conf->global->MAIN_PDF_DISABLESOURCEDETAILS))
|
if (empty($conf->global->MAIN_PDF_DISABLESOURCEDETAILS))
|
||||||
{
|
{
|
||||||
// Tel
|
// Tel
|
||||||
if ($sourcecompany->tel) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($sourcecompany->tel);
|
if ($sourcecompany->tel) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($sourcecompany->tel);
|
||||||
// Fax
|
// Fax
|
||||||
if ($sourcecompany->fax) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($sourcecompany->fax);
|
if ($sourcecompany->fax) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($sourcecompany->fax);
|
||||||
// EMail
|
// EMail
|
||||||
if ($sourcecompany->email) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($sourcecompany->email);
|
if ($sourcecompany->email) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($sourcecompany->email);
|
||||||
// Web
|
// Web
|
||||||
if ($sourcecompany->url) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($sourcecompany->url);
|
if ($sourcecompany->url) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($sourcecompany->url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($mode == 'target')
|
if ($mode == 'target')
|
||||||
@ -307,16 +307,16 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
|
|||||||
|
|
||||||
|
|
||||||
if (! empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS))
|
if (! empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS))
|
||||||
{
|
{
|
||||||
// Tel
|
// Tel
|
||||||
if ($targetcontact->tel) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($targetcontact->tel);
|
if ($targetcontact->tel) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($targetcontact->tel);
|
||||||
// Fax
|
// Fax
|
||||||
if ($targetcontact->fax) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcontact->fax);
|
if ($targetcontact->fax) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcontact->fax);
|
||||||
// EMail
|
// EMail
|
||||||
if ($targetcontact->email) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($targetcontact->email);
|
if ($targetcontact->email) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($targetcontact->email);
|
||||||
// Web
|
// Web
|
||||||
if ($targetcontact->url) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($targetcontact->url);
|
if ($targetcontact->url) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($targetcontact->url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -325,16 +325,16 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
|
|||||||
if (!empty($targetcompany->country_code) && $targetcompany->country_code != $sourcecompany->country_code) $stringaddress.=$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcompany->country_code))."\n";
|
if (!empty($targetcompany->country_code) && $targetcompany->country_code != $sourcecompany->country_code) $stringaddress.=$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcompany->country_code))."\n";
|
||||||
|
|
||||||
if (! empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS))
|
if (! empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS))
|
||||||
{
|
{
|
||||||
// Tel
|
// Tel
|
||||||
if ($targetcompany->tel) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($targetcompany->tel);
|
if ($targetcompany->tel) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($targetcompany->tel);
|
||||||
// Fax
|
// Fax
|
||||||
if ($targetcompany->fax) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcompany->fax);
|
if ($targetcompany->fax) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcompany->fax);
|
||||||
// EMail
|
// EMail
|
||||||
if ($targetcompany->email) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($targetcompany->email);
|
if ($targetcompany->email) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($targetcompany->email);
|
||||||
// Web
|
// Web
|
||||||
if ($targetcompany->url) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($targetcompany->url);
|
if ($targetcompany->url) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($targetcompany->url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Intra VAT
|
// Intra VAT
|
||||||
@ -575,7 +575,7 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default
|
|||||||
$pdf->MultiCell(100, 3, $val, 0, 'L', 0);
|
$pdf->MultiCell(100, 3, $val, 0, 'L', 0);
|
||||||
//$nboflines=dol_nboflines_bis($val,120);
|
//$nboflines=dol_nboflines_bis($val,120);
|
||||||
//$cury+=($nboflines*3)+2;
|
//$cury+=($nboflines*3)+2;
|
||||||
$tmpy=$pdf->getStringHeight (100, $val);
|
$tmpy=$pdf->getStringHeight(100, $val);
|
||||||
$cury+=$tmpy;
|
$cury+=$tmpy;
|
||||||
}
|
}
|
||||||
else if (! $usedetailedbban) $cury+=1;
|
else if (! $usedetailedbban) $cury+=1;
|
||||||
@ -626,11 +626,11 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
|
|||||||
{
|
{
|
||||||
// Make substitution
|
// Make substitution
|
||||||
$substitutionarray=array(
|
$substitutionarray=array(
|
||||||
'__FROM_NAME__' => $fromcompany->nom,
|
'__FROM_NAME__' => $fromcompany->nom,
|
||||||
'__FROM_EMAIL__' => $fromcompany->email,
|
'__FROM_EMAIL__' => $fromcompany->email,
|
||||||
'__TOTAL_TTC__' => $object->total_ttc,
|
'__TOTAL_TTC__' => $object->total_ttc,
|
||||||
'__TOTAL_HT__' => $object->total_ht,
|
'__TOTAL_HT__' => $object->total_ht,
|
||||||
'__TOTAL_VAT__' => $object->total_vat
|
'__TOTAL_VAT__' => $object->total_vat
|
||||||
);
|
);
|
||||||
complete_substitutions_array($substitutionarray,$outputlangs,$object);
|
complete_substitutions_array($substitutionarray,$outputlangs,$object);
|
||||||
$newfreetext=make_substitutions($conf->global->$paramfreetext,$substitutionarray);
|
$newfreetext=make_substitutions($conf->global->$paramfreetext,$substitutionarray);
|
||||||
@ -937,11 +937,11 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl
|
|||||||
}
|
}
|
||||||
elseif ($desc == '(DEPOSIT)' && $object->lines[$i]->fk_remise_except)
|
elseif ($desc == '(DEPOSIT)' && $object->lines[$i]->fk_remise_except)
|
||||||
{
|
{
|
||||||
$discount=new DiscountAbsolute($db);
|
$discount=new DiscountAbsolute($db);
|
||||||
$discount->fetch($object->lines[$i]->fk_remise_except);
|
$discount->fetch($object->lines[$i]->fk_remise_except);
|
||||||
$libelleproduitservice=$outputlangs->transnoentitiesnoconv("DiscountFromDeposit",$discount->ref_facture_source);
|
$libelleproduitservice=$outputlangs->transnoentitiesnoconv("DiscountFromDeposit",$discount->ref_facture_source);
|
||||||
// Add date of deposit
|
// Add date of deposit
|
||||||
if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) echo ' ('.dol_print_date($discount->datec,'day','',$outputlangs).')';
|
if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) echo ' ('.dol_print_date($discount->datec,'day','',$outputlangs).')';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1024,7 +1024,6 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl
|
|||||||
* @param int $i Current line number
|
* @param int $i Current line number
|
||||||
* @param Translate $outputlangs Object langs for output
|
* @param Translate $outputlangs Object langs for output
|
||||||
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
|
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
|
||||||
* @param HookManager $hookmanager Hook manager instance
|
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function pdf_getlinenum($object,$i,$outputlangs,$hidedetails=0)
|
function pdf_getlinenum($object,$i,$outputlangs,$hidedetails=0)
|
||||||
@ -1132,12 +1131,12 @@ function pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails=0)
|
|||||||
*/
|
*/
|
||||||
function pdf_getlineupexcltax($object,$i,$outputlangs,$hidedetails=0)
|
function pdf_getlineupexcltax($object,$i,$outputlangs,$hidedetails=0)
|
||||||
{
|
{
|
||||||
global $conf, $hookmanager;
|
global $conf, $hookmanager;
|
||||||
|
|
||||||
$sign=1;
|
$sign=1;
|
||||||
if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1;
|
if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1;
|
||||||
|
|
||||||
if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line)))
|
if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line)))
|
||||||
{
|
{
|
||||||
$special_code = $object->lines[$i]->special_code;
|
$special_code = $object->lines[$i]->special_code;
|
||||||
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
|
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
|
||||||
@ -1164,19 +1163,19 @@ function pdf_getlineupwithtax($object,$i,$outputlangs,$hidedetails=0)
|
|||||||
{
|
{
|
||||||
global $hookmanager;
|
global $hookmanager;
|
||||||
|
|
||||||
if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line)))
|
if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line)))
|
||||||
{
|
{
|
||||||
$special_code = $object->lines[$i]->special_code;
|
$special_code = $object->lines[$i]->special_code;
|
||||||
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
|
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
|
||||||
foreach($object->hooks as $modules)
|
foreach($object->hooks as $modules)
|
||||||
{
|
{
|
||||||
if (method_exists($modules[$special_code],'pdf_getlineupwithtax')) return $modules[$special_code]->pdf_getlineupwithtax($object,$i,$outputlangs,$hidedetails);
|
if (method_exists($modules[$special_code],'pdf_getlineupwithtax')) return $modules[$special_code]->pdf_getlineupwithtax($object,$i,$outputlangs,$hidedetails);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (empty($hidedetails) || $hidedetails > 1) return price(($object->lines[$i]->subprice) + ($object->lines[$i]->subprice)*($object->lines[$i]->tva_tx)/100);
|
if (empty($hidedetails) || $hidedetails > 1) return price(($object->lines[$i]->subprice) + ($object->lines[$i]->subprice)*($object->lines[$i]->tva_tx)/100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1342,10 +1341,10 @@ function pdf_getlineremisepercent($object,$i,$outputlangs,$hidedetails=0)
|
|||||||
*/
|
*/
|
||||||
function pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails=0)
|
function pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails=0)
|
||||||
{
|
{
|
||||||
global $conf, $hookmanager;
|
global $conf, $hookmanager;
|
||||||
|
|
||||||
$sign=1;
|
$sign=1;
|
||||||
if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1;
|
if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1;
|
||||||
|
|
||||||
if ($object->lines[$i]->special_code == 3)
|
if ($object->lines[$i]->special_code == 3)
|
||||||
{
|
{
|
||||||
@ -1381,27 +1380,27 @@ function pdf_getlinetotalwithtax($object,$i,$outputlangs,$hidedetails=0)
|
|||||||
{
|
{
|
||||||
global $hookmanager;
|
global $hookmanager;
|
||||||
|
|
||||||
if ($object->lines[$i]->special_code == 3)
|
if ($object->lines[$i]->special_code == 3)
|
||||||
{
|
{
|
||||||
return $outputlangs->transnoentities("Option");
|
return $outputlangs->transnoentities("Option");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line)))
|
if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line)))
|
||||||
{
|
{
|
||||||
$special_code = $object->lines[$i]->special_code;
|
$special_code = $object->lines[$i]->special_code;
|
||||||
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
|
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
|
||||||
foreach($object->hooks as $modules)
|
foreach($object->hooks as $modules)
|
||||||
{
|
{
|
||||||
if (method_exists($modules[$special_code],'pdf_getlinetotalwithtax')) return $modules[$special_code]->pdf_getlinetotalwithtax($object,$i,$outputlangs,$hidedetails);
|
if (method_exists($modules[$special_code],'pdf_getlinetotalwithtax')) return $modules[$special_code]->pdf_getlinetotalwithtax($object,$i,$outputlangs,$hidedetails);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (empty($hidedetails) || $hidedetails > 1) return
|
if (empty($hidedetails) || $hidedetails > 1) return
|
||||||
price(($object->lines[$i]->total_ht) + ($object->lines[$i]->total_ht)*($object->lines[$i]->tva_tx)/100);
|
price(($object->lines[$i]->total_ht) + ($object->lines[$i]->total_ht)*($object->lines[$i]->tva_tx)/100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -118,7 +118,7 @@ class MenuManager
|
|||||||
if ($leftmenu=="modulesadmintools" && $user->admin)
|
if ($leftmenu=="modulesadmintools" && $user->admin)
|
||||||
{
|
{
|
||||||
$langs->load("products");
|
$langs->load("products");
|
||||||
array_unshift($tabMenu,array(
|
$array_menu_product=array(
|
||||||
'url'=>"/product/admin/product_tools.php?mainmenu=home&leftmenu=modulesadmintools",
|
'url'=>"/product/admin/product_tools.php?mainmenu=home&leftmenu=modulesadmintools",
|
||||||
'titre'=>$langs->trans("ProductVatMassChange"),
|
'titre'=>$langs->trans("ProductVatMassChange"),
|
||||||
'enabled'=>($user->admin?true:false),
|
'enabled'=>($user->admin?true:false),
|
||||||
@ -130,10 +130,11 @@ class MenuManager
|
|||||||
'leftmenu'=>'modulesadmintools_massvat',
|
'leftmenu'=>'modulesadmintools_massvat',
|
||||||
'type'=>'left',
|
'type'=>'left',
|
||||||
'position'=>20
|
'position'=>20
|
||||||
));
|
);
|
||||||
|
array_unshift($tabMenu,$array_menu_product);
|
||||||
//$newmenu->add("/product/admin/product_tools.php?mainmenu=home&leftmenu=modulesadmintools", $langs->trans("ProductVatMassChange"), 1, $user->admin);
|
//$newmenu->add("/product/admin/product_tools.php?mainmenu=home&leftmenu=modulesadmintools", $langs->trans("ProductVatMassChange"), 1, $user->admin);
|
||||||
}
|
}
|
||||||
array_unshift($tabMenu,array(
|
$array_menu_product=array(
|
||||||
'url'=>"/admin/tools/index.php?mainmenu=home&leftmenu=modulesadmintools",
|
'url'=>"/admin/tools/index.php?mainmenu=home&leftmenu=modulesadmintools",
|
||||||
'titre'=>$langs->trans("ModulesSystemTools"),
|
'titre'=>$langs->trans("ModulesSystemTools"),
|
||||||
'enabled'=>($user->admin?true:false),
|
'enabled'=>($user->admin?true:false),
|
||||||
@ -144,7 +145,8 @@ class MenuManager
|
|||||||
'leftmenu'=>'modulesadmintools',
|
'leftmenu'=>'modulesadmintools',
|
||||||
'type'=>'left',
|
'type'=>'left',
|
||||||
'position'=>20
|
'position'=>20
|
||||||
));
|
);
|
||||||
|
array_unshift($tabMenu,$array_menu_product);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -35,10 +35,12 @@ include_once(DOL_DOCUMENT_ROOT ."/core/modules/DolibarrModules.class.php");
|
|||||||
class modPrintIPP extends DolibarrModules
|
class modPrintIPP extends DolibarrModules
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Constructeur. Definit les noms, constantes et boites
|
/**
|
||||||
* \param DB handler d'acces base
|
* Constructor
|
||||||
*/
|
*
|
||||||
|
* @param DoliDB $db Database handler
|
||||||
|
*/
|
||||||
function __construct($db)
|
function __construct($db)
|
||||||
{
|
{
|
||||||
$this->db = $db ;
|
$this->db = $db ;
|
||||||
@ -120,25 +122,33 @@ class modPrintIPP extends DolibarrModules
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Fonction appelee lors de l'activation du module. Insere en base les constantes, boites, permissions du module.
|
* Function called when module is enabled.
|
||||||
* Definit egalement les repertoires de donnees a creer pour ce module.
|
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
||||||
*/
|
* It also creates data directories
|
||||||
function init()
|
*
|
||||||
{
|
* @param string $options Options when enabling module ('', 'noboxes')
|
||||||
$sql = array("CREATE TABLE IF NOT EXISTS llx_printer_ipp (rowid int(11) NOT NULL AUTO_INCREMENT,printer_name text NOT NULL, printer_location text NOT NULL,printer_uri varchar(256) NOT NULL,copy int(11) NOT NULL DEFAULT '1',module varchar(16) NOT NULL,login varchar(32) NOT NULL,PRIMARY KEY (rowid)) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;");
|
* @return int 1 if OK, 0 if KO
|
||||||
|
*/
|
||||||
return $this->_init($sql);
|
function init($options='')
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Fonction appelee lors de la desactivation d'un module.
|
|
||||||
* Supprime de la base les constantes, boites et permissions du module.
|
|
||||||
*/
|
|
||||||
function remove()
|
|
||||||
{
|
{
|
||||||
$sql = array();
|
$sql = array();
|
||||||
|
|
||||||
return $this->_remove($sql);
|
return $this->_init($sql, $options);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function called when module is disabled.
|
||||||
|
* Remove from database constants, boxes and permissions from Dolibarr database.
|
||||||
|
* Data directories are not deleted
|
||||||
|
*
|
||||||
|
* @param string $options Options when enabling module ('', 'noboxes')
|
||||||
|
* @return int 1 if OK, 0 if KO
|
||||||
|
*/
|
||||||
|
function remove($options='')
|
||||||
|
{
|
||||||
|
$sql = array();
|
||||||
|
|
||||||
|
return $this->_remove($sql, $options);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -54,7 +54,7 @@ if(!empty($cancel)) {
|
|||||||
if (!empty($id)) {
|
if (!empty($id)) {
|
||||||
$action='';
|
$action='';
|
||||||
}else {
|
}else {
|
||||||
Header ( "Location: ".dol_buildpath('/cron/cron/list.php',1).'?status=1');
|
Header("Location: ".dol_buildpath('/cron/cron/list.php',1).'?status=1');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -69,7 +69,7 @@ if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->cron->del
|
|||||||
setEventMessage($object->error,'errors');
|
setEventMessage($object->error,'errors');
|
||||||
$action='edit';
|
$action='edit';
|
||||||
}else {
|
}else {
|
||||||
Header ( "Location: ".dol_buildpath('/cron/cron/list.php',1).'?status=1');
|
Header("Location: ".dol_buildpath('/cron/cron/list.php',1).'?status=1');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -407,7 +407,7 @@ class Cronjob extends CommonObject
|
|||||||
|
|
||||||
$sql.= " ORDER BY $sortfield $sortorder ";
|
$sql.= " ORDER BY $sortfield $sortorder ";
|
||||||
if (!empty($limit) && !empty($offset)) {
|
if (!empty($limit) && !empty($offset)) {
|
||||||
$sql.= $this->db->plimit( $limit + 1 ,$offset);
|
$sql.= $this->db->plimit($limit + 1,$offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sqlwhere = array();
|
$sqlwhere = array();
|
||||||
@ -1061,7 +1061,8 @@ class Cronjob extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Crob Job line class
|
* Crob Job line class
|
||||||
*/
|
*/
|
||||||
class Cronjobline{
|
class Cronjobline
|
||||||
|
{
|
||||||
|
|
||||||
var $id;
|
var $id;
|
||||||
var $ref;
|
var $ref;
|
||||||
|
|||||||
@ -1195,14 +1195,14 @@ class Expedition extends CommonObject
|
|||||||
{
|
{
|
||||||
while ($obj = $this->db->fetch_object($resql))
|
while ($obj = $this->db->fetch_object($resql))
|
||||||
{
|
{
|
||||||
$this->listmeths[$i][rowid] = $obj->rowid;
|
$this->listmeths[$i]['rowid'] = $obj->rowid;
|
||||||
$this->listmeths[$i][code] = $obj->code;
|
$this->listmeths[$i]['code'] = $obj->code;
|
||||||
$label=$langs->trans('SendingMethod'.$obj->code);
|
$label=$langs->trans('SendingMethod'.$obj->code);
|
||||||
$this->listmeths[$i][libelle] = ($label != 'SendingMethod'.$obj->code?$label:$obj->libelle);
|
$this->listmeths[$i]['libelle'] = ($label != 'SendingMethod'.$obj->code?$label:$obj->libelle);
|
||||||
$this->listmeths[$i][description] = $obj->description;
|
$this->listmeths[$i]['description'] = $obj->description;
|
||||||
if ($obj->tracking)
|
if ($obj->tracking)
|
||||||
{
|
{
|
||||||
$this->listmeths[$i][tracking] = $obj->tracking;
|
$this->listmeths[$i]['tracking'] = $obj->tracking;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1214,11 +1214,11 @@ class Expedition extends CommonObject
|
|||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT."/core/modules/expedition/methode_expedition_".strtolower($obj->code).'.modules.php';
|
require_once DOL_DOCUMENT_ROOT."/core/modules/expedition/methode_expedition_".strtolower($obj->code).'.modules.php';
|
||||||
$shipmethod = new $classname();
|
$shipmethod = new $classname();
|
||||||
$this->listmeths[$i][tracking] = $shipmethod->provider_url_status('{TRACKID}');
|
$this->listmeths[$i]['tracking'] = $shipmethod->provider_url_status('{TRACKID}');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->listmeths[$i][active] = $obj->active;
|
$this->listmeths[$i]['active'] = $obj->active;
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1227,7 +1227,9 @@ class Expedition extends CommonObject
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Update/create delivery method.
|
* Update/create delivery method.
|
||||||
* @param id $id id method to activate
|
*
|
||||||
|
* @param string $id id method to activate
|
||||||
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function update_delivery_method($id='')
|
function update_delivery_method($id='')
|
||||||
@ -1235,16 +1237,16 @@ class Expedition extends CommonObject
|
|||||||
if ($id=='')
|
if ($id=='')
|
||||||
{
|
{
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."c_shipment_mode (code, libelle, description, tracking)";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."c_shipment_mode (code, libelle, description, tracking)";
|
||||||
$sql.=" VALUES ('".$this->update[code]."','".$this->update[libelle]."','".$this->update[description]."','".$this->update[tracking]."')";
|
$sql.=" VALUES ('".$this->update['code']."','".$this->update['libelle']."','".$this->update['description']."','".$this->update['tracking']."')";
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."c_shipment_mode SET";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."c_shipment_mode SET";
|
||||||
$sql.= " code='".$this->update[code]."'";
|
$sql.= " code='".$this->update['code']."'";
|
||||||
$sql.= ",libelle='".$this->update[libelle]."'";
|
$sql.= ",libelle='".$this->update['libelle']."'";
|
||||||
$sql.= ",description='".$this->update[description]."'";
|
$sql.= ",description='".$this->update['description']."'";
|
||||||
$sql.= ",tracking='".$this->update[tracking]."'";
|
$sql.= ",tracking='".$this->update['tracking']."'";
|
||||||
$sql.= " WHERE rowid=".$id;
|
$sql.= " WHERE rowid=".$id;
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
}
|
}
|
||||||
@ -1253,7 +1255,9 @@ class Expedition extends CommonObject
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Activate delivery method.
|
* Activate delivery method.
|
||||||
|
*
|
||||||
* @param id $id id method to activate
|
* @param id $id id method to activate
|
||||||
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function activ_delivery_method($id)
|
function activ_delivery_method($id)
|
||||||
@ -1267,7 +1271,9 @@ class Expedition extends CommonObject
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* DesActivate delivery method.
|
* DesActivate delivery method.
|
||||||
|
*
|
||||||
* @param id $id id method to desactivate
|
* @param id $id id method to desactivate
|
||||||
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function disable_delivery_method($id)
|
function disable_delivery_method($id)
|
||||||
|
|||||||
@ -210,3 +210,14 @@ ALTER TABLE llx_user ADD COLUMN fk_state integer DEFAULT 0;
|
|||||||
ALTER TABLE llx_user ADD COLUMN fk_country integer DEFAULT 0;
|
ALTER TABLE llx_user ADD COLUMN fk_country integer DEFAULT 0;
|
||||||
ALTER TABLE llx_product_price ADD COLUMN import_key varchar(14) AFTER price_by_qty;
|
ALTER TABLE llx_product_price ADD COLUMN import_key varchar(14) AFTER price_by_qty;
|
||||||
|
|
||||||
|
CREATE TABLE llx_printer_ipp
|
||||||
|
(
|
||||||
|
rowid int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
printer_name text NOT NULL,
|
||||||
|
printer_location text NOT NULL,
|
||||||
|
printer_uri varchar(256) NOT NULL,
|
||||||
|
copy int(11) NOT NULL DEFAULT '1',
|
||||||
|
module varchar(16) NOT NULL,
|
||||||
|
login varchar(32) NOT NULL,
|
||||||
|
)ENGINE=innodb;
|
||||||
|
|
||||||
|
|||||||
28
htdocs/install/mysql/tables/llx_printer_ipp.sql
Normal file
28
htdocs/install/mysql/tables/llx_printer_ipp.sql
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
-- ============================================================================
|
||||||
|
-- Copyright (C) 2013 Florian HENRY <florian.henry@open-concept.pro>
|
||||||
|
--
|
||||||
|
-- This program is free software; you can redistribute it and/or modify
|
||||||
|
-- it under the terms of the GNU General Public License as published by
|
||||||
|
-- the Free Software Foundation; either version 3 of the License, or
|
||||||
|
-- (at your option) any later version.
|
||||||
|
--
|
||||||
|
-- This program is distributed in the hope that it will be useful,
|
||||||
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
-- GNU General Public License for more details.
|
||||||
|
--
|
||||||
|
-- You should have received a copy of the GNU General Public License
|
||||||
|
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
--
|
||||||
|
-- ============================================================================
|
||||||
|
|
||||||
|
CREATE TABLE llx_printer_ipp
|
||||||
|
(
|
||||||
|
rowid int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
printer_name text NOT NULL,
|
||||||
|
printer_location text NOT NULL,
|
||||||
|
printer_uri varchar(256) NOT NULL,
|
||||||
|
copy int(11) NOT NULL DEFAULT '1',
|
||||||
|
module varchar(16) NOT NULL,
|
||||||
|
login varchar(32) NOT NULL,
|
||||||
|
)ENGINE=innodb;
|
||||||
@ -202,14 +202,14 @@ $sql.= $where;
|
|||||||
if ($month > 0) {
|
if ($month > 0) {
|
||||||
if ($year > 0) {
|
if ($year > 0) {
|
||||||
$start = dol_mktime(0, 0, 0, $month, 1, $year);
|
$start = dol_mktime(0, 0, 0, $month, 1, $year);
|
||||||
$end = dol_time_plus_duree($start, 1 , 'm') - 1;
|
$end = dol_time_plus_duree($start,1,'m') - 1;
|
||||||
$sql.= " AND ".$datePrint." BETWEEN '".$db->idate($start)."' AND '".$db->idate($end)."'";
|
$sql.= " AND ".$datePrint." BETWEEN '".$db->idate($start)."' AND '".$db->idate($end)."'";
|
||||||
} else {
|
} else {
|
||||||
$sql.= " AND date_format(".$datePrint.", '%m') = '".sprintf('%02d',$month)."'";
|
$sql.= " AND date_format(".$datePrint.", '%m') = '".sprintf('%02d',$month)."'";
|
||||||
}
|
}
|
||||||
} else if ($year > 0) {
|
} else if ($year > 0) {
|
||||||
$start = dol_mktime(0, 0, 0, 1, 1, $year);
|
$start = dol_mktime(0, 0, 0, 1, 1, $year);
|
||||||
$end = dol_time_plus_duree($start, 1 , 'y') - 1;
|
$end = dol_time_plus_duree($start,1,'y') - 1;
|
||||||
$sql.= " AND ".$datePrint." BETWEEN '".$db->idate($start)."' AND '".$db->idate($end)."'";
|
$sql.= " AND ".$datePrint." BETWEEN '".$db->idate($start)."' AND '".$db->idate($end)."'";
|
||||||
}
|
}
|
||||||
if ($sref) $sql.= " AND ".$doc_number." LIKE '%".$sref."%'";
|
if ($sref) $sql.= " AND ".$doc_number." LIKE '%".$sref."%'";
|
||||||
|
|||||||
@ -2090,11 +2090,15 @@ class User extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update user using data from the LDAP
|
* Update user using data from the LDAP
|
||||||
* // TODO: Voir pourquoi le update met à jour avec toutes les valeurs vide (global $user écrase ?)
|
*
|
||||||
|
* @param ldapuser &$ldapuser Ladp User
|
||||||
|
*
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function update_ldap2dolibarr(&$ldapuser)
|
function update_ldap2dolibarr(&$ldapuser)
|
||||||
{
|
{
|
||||||
|
// TODO: Voir pourquoi le update met à jour avec toutes les valeurs vide (global $user écrase ?)
|
||||||
global $user, $conf;
|
global $user, $conf;
|
||||||
|
|
||||||
$this->firstname=$ldapuser->{$conf->global->LDAP_FIELD_FIRSTNAME};
|
$this->firstname=$ldapuser->{$conf->global->LDAP_FIELD_FIRSTNAME};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user