Merge pull request #800 from FHenry/develop

Qual : Review code after intalling PHPUnit, CodeSniffer on Eclipse...
This commit is contained in:
Laurent Destailleur 2013-04-05 13:39:52 -07:00
commit a3c5db968e
23 changed files with 292 additions and 208 deletions

View File

@ -44,24 +44,24 @@ $object = new Expedition($db);
* Actions
*/
//if ($action==setvalue AND $carrier)
if ($action==setvalue)
if ($action=='setvalue')
{
// need to add check on values
$object->update[code]=GETPOST('code','alpha');
$object->update[libelle]=GETPOST('libelle','alpha');
$object->update[description]=GETPOST('description','alpha');
$object->update[tracking]=GETPOST('tracking','alpha');
$object->update['code']=GETPOST('code','alpha');
$object->update['libelle']=GETPOST('libelle','alpha');
$object->update['description']=GETPOST('description','alpha');
$object->update['tracking']=GETPOST('tracking','alpha');
$object->update_delivery_method($carrier);
header("Location: carrier.php");
exit;
}
if ($action==activate_carrier AND $carrier!='')
if ($action=='activate_carrier' && $carrier!='')
{
$object->activ_delivery_method($carrier);
}
if ($action==disable_carrier AND $carrier!='')
if ($action=='disable_carrier' && $carrier!='')
{
$object->disable_delivery_method($carrier);
}
@ -134,26 +134,26 @@ if ($action=='edit_carrier' || $action=='setvalue')
$var=!$var;
print '<tr '.$bc[$var].'><td class="fieldrequired">';
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 ' &nbsp; '.$langs->trans("Example").': CODE';
print '</td></tr>';
$var=!$var;
print '<tr '.$bc[$var].'><td class="fieldrequired">';
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>';
$var=!$var;
print '<tr '.$bc[$var].'><td class="fieldrequired">';
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>';
$var=!$var;
print '<tr '.$bc[$var].'><td class="fieldrequired">';
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 ' &nbsp; '.$langs->trans("Example").': http://www.website.com/dir/{TRACKID}';
print '</td></tr>';
@ -186,25 +186,26 @@ else
print '<td align="center" width="60">'.$langs->trans("Status").'</td>';
print '<td align="center" width="30">'.$langs->trans("Edit").'</td>';
print "</tr>\n";
for ($i=0; $i<sizeof($object->listmeths); $i++)
$numlistmeths=count($object->listmeths);
for ($i=0; $i<$numlistmeths; $i++)
{
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td>'.$object->listmeths[$i][code].'</td>';
print '<td>'.$object->listmeths[$i][libelle].'</td>';
print '<td>'.$object->listmeths[$i][description].'</td>';
print '<td>'.$object->listmeths[$i][tracking].'</td>';
print '<td>'.$object->listmeths[$i]['code'].'</td>';
print '<td>'.$object->listmeths[$i]['libelle'].'</td>';
print '<td>'.$object->listmeths[$i]['description'].'</td>';
print '<td>'.$object->listmeths[$i]['tracking'].'</td>';
print '<td align="center">';
if($object->listmeths[$i][active] == 0)
if($object->listmeths[$i]['active'] == 0)
{
print '<a href="carrier.php?action=activate_carrier&amp;carrier='.$object->listmeths[$i][rowid].'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print '<a href="carrier.php?action=activate_carrier&amp;carrier='.$object->listmeths[$i]['rowid'].'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
}
else
{
print '<a href="carrier.php?action=disable_carrier&amp;carrier='.$object->listmeths[$i][rowid].'">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>';
print '<a href="carrier.php?action=disable_carrier&amp;carrier='.$object->listmeths[$i]['rowid'].'">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>';
}
print '</td><td align="center">';
print '<a href="carrier.php?action=edit_carrier&amp;carrier='.$object->listmeths[$i][rowid].'">'.img_picto($langs->trans("Edit"),'edit').'</a>';
print '<a href="carrier.php?action=edit_carrier&amp;carrier='.$object->listmeths[$i]['rowid'].'">'.img_picto($langs->trans("Edit"),'edit').'</a>';
print '</td>';
print "</tr>\n";
}

View File

@ -1199,7 +1199,6 @@ class Propal extends CommonObject
* Update value of extrafields on the proposal
*
* @param User $user Object user that modify
* @param double $remise Amount discount
* @return int <0 if ko, >0 if ok
*/
function update_extrafields($user)

View File

@ -1107,7 +1107,7 @@ else if ($action == 'print_file' AND $user->rights->printipp->use)
{
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->print_file(GETPOST('file',alpha),GETPOST('printer',alpha));
$printer->print_file(GETPOST('file','alpha'),GETPOST('printer','alpha'));
}
/*

View File

@ -559,7 +559,6 @@ class Facture extends CommonInvoice
* Load an object from its id and create a new one in database
*
* @param int $socid Id of thirdparty
* @param HookManager $hookmanager Hook manager instance
* @return int New id of clone
*/
function createFromClone($socid=0)

View File

@ -894,6 +894,8 @@ class Contrat extends CommonObject
* @param float $price_base_type HT or TTC
* @param float $pu_ttc Prix unitaire TTC
* @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
*/
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 float $price_base_type HT or TTC
* @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
*/
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)

View File

@ -45,7 +45,9 @@ class box_comptes extends ModeleBoxes
/**
* Constructor
* Constructor
*
* @param DoliDB $db Database handler
*/
function __construct($db)
{

View File

@ -45,7 +45,9 @@ class box_members extends ModeleBoxes
/**
* Constructor
* Constructor
*
* @param DoliDB $db Database handler
*/
function __construct($db)
{

View File

@ -2196,7 +2196,7 @@ abstract class CommonObject
* @param object $extrafields extrafield Object
* @param string $mode Show output (view) or input (edit) for extrafield
*
* return string
* @return string
*/
function showOptionals($extrafields,$mode='view')
{

View File

@ -42,6 +42,9 @@ class dolprintIPP
* @param DoliDB $db database
* @param string $host host of Cups
* @param string $port port
* @param string $userid userid
* @param string $user user
* @param string $password password
* @return printIPP
*/
function __construct($db,$host,$port,$userid,$user,$password)
@ -76,7 +79,11 @@ class dolprintIPP
/**
* Print selected file
*
* @param string $file file
* @param string $module module
*
* @return void
*/
function print_file($file,$module)
{
@ -112,6 +119,9 @@ class dolprintIPP
/**
* List jobs print
*
* @param string $module module
*
* @return void
*/
function list_jobs($module)
{

View File

@ -97,6 +97,7 @@ class ExtraFields
* @param string $elementtype Element type ('member', 'product', 'company', ...)
* @param int $unique Is field unique or not
* @param int $required Is field required or not
* @param string $default_value Defaulted value
* @param array $param Params for field
* @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')) )
* @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;
@ -356,7 +357,7 @@ class ExtraFields
* @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
*/
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';
// 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)
*
* @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
*/
function setOptionalsFromPost($extralabels,&$object)

View File

@ -211,9 +211,10 @@ class FormOther
/**
* Return list of revenue stamp for country
*
* @param string $selected Value of preselected revenue stamp
* @param string $htmlname Name of combo list
* @return string HTML select list
* @param string $selected Value of preselected revenue stamp
* @param string $htmlname Name of combo list
* @param string $country_code Country Code
* @return string HTML select list
*/
function select_revenue_stamp($selected='',$htmlname='revenuestamp',$country_code='')
{

View File

@ -694,6 +694,7 @@ class Translate
/**
* 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).
* @return string Amount + Currency symbol encoded into UTF8
*/

View File

@ -299,9 +299,10 @@ function ajax_dialog($title,$message,$w=350,$h=150)
/**
* Convert a html select field into an ajax combobox
*
* @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')))
* @return string Return html string to convert a select field into a combo
* @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 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)
{

View File

@ -1,38 +1,38 @@
<?php
/* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* or see http://www.gnu.org/
*/
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* or see http://www.gnu.org/
*/
/**
* \file htdocs/core/lib/pdf.lib.php
* \brief Set of functions used for PDF generation
* \ingroup core
*/
* \brief Set of functions used for PDF generation
* \ingroup core
*/
/**
* 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()
{
global $conf,$db;
@ -78,7 +78,7 @@ function pdf_getInstance($format='',$metric='mm',$pagetype='P')
global $conf;
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
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
- print : Print the document;
- 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;
- 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;
- 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;
- 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.
*/
- 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;
- 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;
- 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;
- 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.
*/
if (class_exists('FPDI')) $pdf = new FPDI($pagetype,$metric,$format);
else $pdf = new TCPDF($pagetype,$metric,$format);
// 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
/**
* 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
{
{
/**
* __call
*
@ -230,16 +230,16 @@ function pdf_getPDFFontSize($outputlangs)
*/
function pdf_getHeightForLogo($logo)
{
$height=22; $maxwidth=130;
include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
$tmp=dol_getImageSize($logo);
if ($tmp['height'])
{
$width=round($height*$tmp['width']/$tmp['height']);
if ($width > $maxwidth) $height=$height*$maxwidth/$width;
}
//print $tmp['width'].' '.$tmp['height'].' '.$width; exit;
return $height;
$height=22; $maxwidth=130;
include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
$tmp=dol_getImageSize($logo);
if ($tmp['height'])
{
$width=round($height*$tmp['width']/$tmp['height']);
if ($width > $maxwidth) $height=$height*$maxwidth/$width;
}
//print $tmp['width'].' '.$tmp['height'].' '.$width; exit;
return $height;
}
@ -275,15 +275,15 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
if (empty($conf->global->MAIN_PDF_DISABLESOURCEDETAILS))
{
// Tel
if ($sourcecompany->tel) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($sourcecompany->tel);
// Fax
if ($sourcecompany->fax) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($sourcecompany->fax);
// EMail
if ($sourcecompany->email) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($sourcecompany->email);
// Web
if ($sourcecompany->url) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($sourcecompany->url);
}
// Tel
if ($sourcecompany->tel) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($sourcecompany->tel);
// Fax
if ($sourcecompany->fax) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($sourcecompany->fax);
// EMail
if ($sourcecompany->email) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($sourcecompany->email);
// Web
if ($sourcecompany->url) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($sourcecompany->url);
}
}
if ($mode == 'target')
@ -307,16 +307,16 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
if (! empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS))
{
// Tel
if ($targetcontact->tel) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($targetcontact->tel);
// Fax
if ($targetcontact->fax) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcontact->fax);
// EMail
if ($targetcontact->email) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($targetcontact->email);
// Web
if ($targetcontact->url) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($targetcontact->url);
}
{
// Tel
if ($targetcontact->tel) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($targetcontact->tel);
// Fax
if ($targetcontact->fax) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcontact->fax);
// EMail
if ($targetcontact->email) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($targetcontact->email);
// Web
if ($targetcontact->url) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($targetcontact->url);
}
}
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($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS))
{
// Tel
if ($targetcompany->tel) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($targetcompany->tel);
// Fax
if ($targetcompany->fax) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcompany->fax);
// EMail
if ($targetcompany->email) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($targetcompany->email);
// Web
if ($targetcompany->url) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($targetcompany->url);
}
{
// Tel
if ($targetcompany->tel) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($targetcompany->tel);
// Fax
if ($targetcompany->fax) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcompany->fax);
// EMail
if ($targetcompany->email) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($targetcompany->email);
// Web
if ($targetcompany->url) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($targetcompany->url);
}
}
// 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);
//$nboflines=dol_nboflines_bis($val,120);
//$cury+=($nboflines*3)+2;
$tmpy=$pdf->getStringHeight (100, $val);
$tmpy=$pdf->getStringHeight(100, $val);
$cury+=$tmpy;
}
else if (! $usedetailedbban) $cury+=1;
@ -626,11 +626,11 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
{
// Make substitution
$substitutionarray=array(
'__FROM_NAME__' => $fromcompany->nom,
'__FROM_EMAIL__' => $fromcompany->email,
'__TOTAL_TTC__' => $object->total_ttc,
'__TOTAL_HT__' => $object->total_ht,
'__TOTAL_VAT__' => $object->total_vat
'__FROM_NAME__' => $fromcompany->nom,
'__FROM_EMAIL__' => $fromcompany->email,
'__TOTAL_TTC__' => $object->total_ttc,
'__TOTAL_HT__' => $object->total_ht,
'__TOTAL_VAT__' => $object->total_vat
);
complete_substitutions_array($substitutionarray,$outputlangs,$object);
$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)
{
$discount=new DiscountAbsolute($db);
$discount->fetch($object->lines[$i]->fk_remise_except);
$libelleproduitservice=$outputlangs->transnoentitiesnoconv("DiscountFromDeposit",$discount->ref_facture_source);
// Add date of deposit
if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) echo ' ('.dol_print_date($discount->datec,'day','',$outputlangs).')';
$discount=new DiscountAbsolute($db);
$discount->fetch($object->lines[$i]->fk_remise_except);
$libelleproduitservice=$outputlangs->transnoentitiesnoconv("DiscountFromDeposit",$discount->ref_facture_source);
// Add date of deposit
if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) echo ' ('.dol_print_date($discount->datec,'day','',$outputlangs).')';
}
else
{
@ -1024,7 +1024,6 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl
* @param int $i Current line number
* @param Translate $outputlangs Object langs for output
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
* @param HookManager $hookmanager Hook manager instance
* @return void
*/
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)
{
global $conf, $hookmanager;
global $conf, $hookmanager;
$sign=1;
if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1;
$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;
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;
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;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
foreach($object->hooks as $modules)
{
if (method_exists($modules[$special_code],'pdf_getlineupwithtax')) return $modules[$special_code]->pdf_getlineupwithtax($object,$i,$outputlangs,$hidedetails);
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;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
foreach($object->hooks as $modules)
{
if (method_exists($modules[$special_code],'pdf_getlineupwithtax')) return $modules[$special_code]->pdf_getlineupwithtax($object,$i,$outputlangs,$hidedetails);
}
}
else
{
if (empty($hidedetails) || $hidedetails > 1) return price(($object->lines[$i]->subprice) + ($object->lines[$i]->subprice)*($object->lines[$i]->tva_tx)/100);
}
}
else
{
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)
{
global $conf, $hookmanager;
global $conf, $hookmanager;
$sign=1;
if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1;
$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)
{
@ -1381,27 +1380,27 @@ function pdf_getlinetotalwithtax($object,$i,$outputlangs,$hidedetails=0)
{
global $hookmanager;
if ($object->lines[$i]->special_code == 3)
{
return $outputlangs->transnoentities("Option");
}
else
{
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;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
foreach($object->hooks as $modules)
{
if (method_exists($modules[$special_code],'pdf_getlinetotalwithtax')) return $modules[$special_code]->pdf_getlinetotalwithtax($object,$i,$outputlangs,$hidedetails);
if ($object->lines[$i]->special_code == 3)
{
return $outputlangs->transnoentities("Option");
}
else
{
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;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
foreach($object->hooks as $modules)
{
if (method_exists($modules[$special_code],'pdf_getlinetotalwithtax')) return $modules[$special_code]->pdf_getlinetotalwithtax($object,$i,$outputlangs,$hidedetails);
}
}
else
{
if (empty($hidedetails) || $hidedetails > 1) return
price(($object->lines[$i]->total_ht) + ($object->lines[$i]->total_ht)*($object->lines[$i]->tva_tx)/100);
}
}
}
else
{
if (empty($hidedetails) || $hidedetails > 1) return
price(($object->lines[$i]->total_ht) + ($object->lines[$i]->total_ht)*($object->lines[$i]->tva_tx)/100);
}
}
}
/**

View File

@ -118,7 +118,7 @@ class MenuManager
if ($leftmenu=="modulesadmintools" && $user->admin)
{
$langs->load("products");
array_unshift($tabMenu,array(
$array_menu_product=array(
'url'=>"/product/admin/product_tools.php?mainmenu=home&leftmenu=modulesadmintools",
'titre'=>$langs->trans("ProductVatMassChange"),
'enabled'=>($user->admin?true:false),
@ -130,10 +130,11 @@ class MenuManager
'leftmenu'=>'modulesadmintools_massvat',
'type'=>'left',
'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);
}
array_unshift($tabMenu,array(
$array_menu_product=array(
'url'=>"/admin/tools/index.php?mainmenu=home&leftmenu=modulesadmintools",
'titre'=>$langs->trans("ModulesSystemTools"),
'enabled'=>($user->admin?true:false),
@ -144,7 +145,8 @@ class MenuManager
'leftmenu'=>'modulesadmintools',
'type'=>'left',
'position'=>20
));
);
array_unshift($tabMenu,$array_menu_product);
}
}

View File

@ -35,10 +35,12 @@ include_once(DOL_DOCUMENT_ROOT ."/core/modules/DolibarrModules.class.php");
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)
{
$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.
* Definit egalement les repertoires de donnees a creer pour ce module.
*/
function init()
{
$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 $this->_init($sql);
}
/**
* \brief Fonction appelee lors de la desactivation d'un module.
* Supprime de la base les constantes, boites et permissions du module.
*/
function remove()
* Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function init($options='')
{
$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);
}
}

View File

@ -54,7 +54,7 @@ if(!empty($cancel)) {
if (!empty($id)) {
$action='';
}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');
$action='edit';
}else {
Header ( "Location: ".dol_buildpath('/cron/cron/list.php',1).'?status=1');
Header("Location: ".dol_buildpath('/cron/cron/list.php',1).'?status=1');
}
}

View File

@ -407,7 +407,7 @@ class Cronjob extends CommonObject
$sql.= " ORDER BY $sortfield $sortorder ";
if (!empty($limit) && !empty($offset)) {
$sql.= $this->db->plimit( $limit + 1 ,$offset);
$sql.= $this->db->plimit($limit + 1,$offset);
}
$sqlwhere = array();
@ -1061,7 +1061,8 @@ class Cronjob extends CommonObject
/**
* Crob Job line class
*/
class Cronjobline{
class Cronjobline
{
var $id;
var $ref;

View File

@ -1195,14 +1195,14 @@ class Expedition extends CommonObject
{
while ($obj = $this->db->fetch_object($resql))
{
$this->listmeths[$i][rowid] = $obj->rowid;
$this->listmeths[$i][code] = $obj->code;
$this->listmeths[$i]['rowid'] = $obj->rowid;
$this->listmeths[$i]['code'] = $obj->code;
$label=$langs->trans('SendingMethod'.$obj->code);
$this->listmeths[$i][libelle] = ($label != 'SendingMethod'.$obj->code?$label:$obj->libelle);
$this->listmeths[$i][description] = $obj->description;
$this->listmeths[$i]['libelle'] = ($label != 'SendingMethod'.$obj->code?$label:$obj->libelle);
$this->listmeths[$i]['description'] = $obj->description;
if ($obj->tracking)
{
$this->listmeths[$i][tracking] = $obj->tracking;
$this->listmeths[$i]['tracking'] = $obj->tracking;
}
else
{
@ -1214,11 +1214,11 @@ class Expedition extends CommonObject
{
require_once DOL_DOCUMENT_ROOT."/core/modules/expedition/methode_expedition_".strtolower($obj->code).'.modules.php';
$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++;
}
}
@ -1227,7 +1227,9 @@ class Expedition extends CommonObject
/**
* Update/create delivery method.
* @param id $id id method to activate
*
* @param string $id id method to activate
*
* @return void
*/
function update_delivery_method($id='')
@ -1235,16 +1237,16 @@ class Expedition extends CommonObject
if ($id=='')
{
$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);
}
else
{
$sql = "UPDATE ".MAIN_DB_PREFIX."c_shipment_mode SET";
$sql.= " code='".$this->update[code]."'";
$sql.= ",libelle='".$this->update[libelle]."'";
$sql.= ",description='".$this->update[description]."'";
$sql.= ",tracking='".$this->update[tracking]."'";
$sql.= " code='".$this->update['code']."'";
$sql.= ",libelle='".$this->update['libelle']."'";
$sql.= ",description='".$this->update['description']."'";
$sql.= ",tracking='".$this->update['tracking']."'";
$sql.= " WHERE rowid=".$id;
$resql = $this->db->query($sql);
}
@ -1253,7 +1255,9 @@ class Expedition extends CommonObject
/**
* Activate delivery method.
*
* @param id $id id method to activate
*
* @return void
*/
function activ_delivery_method($id)
@ -1267,7 +1271,9 @@ class Expedition extends CommonObject
/**
* DesActivate delivery method.
*
* @param id $id id method to desactivate
*
* @return void
*/
function disable_delivery_method($id)

View File

@ -210,4 +210,17 @@ 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_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;
ALTER TABLE llx_socpeople ADD COLUMN ref_ext varchar(128) after entity;

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

View File

@ -202,14 +202,14 @@ $sql.= $where;
if ($month > 0) {
if ($year > 0) {
$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)."'";
} else {
$sql.= " AND date_format(".$datePrint.", '%m') = '".sprintf('%02d',$month)."'";
}
} else if ($year > 0) {
$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)."'";
}
if ($sref) $sql.= " AND ".$doc_number." LIKE '%".$sref."%'";

View File

@ -2090,11 +2090,15 @@ class User extends CommonObject
}
/**
* Update user using data from the LDAP
* // TODO: Voir pourquoi le update met à jour avec toutes les valeurs vide (global $user écrase ?)
* Update user using data from the LDAP
*
* @param ldapuser &$ldapuser Ladp User
*
* @return int <0 if KO, >0 if OK
*/
function update_ldap2dolibarr(&$ldapuser)
{
// TODO: Voir pourquoi le update met à jour avec toutes les valeurs vide (global $user écrase ?)
global $user, $conf;
$this->firstname=$ldapuser->{$conf->global->LDAP_FIELD_FIRSTNAME};