diff --git a/htdocs/admin/carrier.php b/htdocs/admin/carrier.php index 612c14d2248..ebc31c8b4cb 100644 --- a/htdocs/admin/carrier.php +++ b/htdocs/admin/carrier.php @@ -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 ''; print $langs->trans("Code").''; - print ''; + print ''; print '   '.$langs->trans("Example").': CODE'; print ''; $var=!$var; print ''; print $langs->trans("Name").''; - print ''; + print ''; print ''; $var=!$var; print ''; print $langs->trans("Description").''; - print ''; + print ''; print ''; $var=!$var; print ''; print $langs->trans("Tracking").''; - print ''; + print ''; print '   '.$langs->trans("Example").': http://www.website.com/dir/{TRACKID}'; print ''; @@ -186,25 +186,26 @@ else print ''.$langs->trans("Status").''; print ''.$langs->trans("Edit").''; print "\n"; - for ($i=0; $ilistmeths); $i++) + $numlistmeths=count($object->listmeths); + for ($i=0; $i<$numlistmeths; $i++) { $var=!$var; print ""; - print ''.$object->listmeths[$i][code].''; - print ''.$object->listmeths[$i][libelle].''; - print ''.$object->listmeths[$i][description].''; - print ''.$object->listmeths[$i][tracking].''; + print ''.$object->listmeths[$i]['code'].''; + print ''.$object->listmeths[$i]['libelle'].''; + print ''.$object->listmeths[$i]['description'].''; + print ''.$object->listmeths[$i]['tracking'].''; print ''; - if($object->listmeths[$i][active] == 0) + if($object->listmeths[$i]['active'] == 0) { - print ''.img_picto($langs->trans("Disabled"),'switch_off').''; + print ''.img_picto($langs->trans("Disabled"),'switch_off').''; } else { - print ''.img_picto($langs->trans("Enabled"),'switch_on').''; + print ''.img_picto($langs->trans("Enabled"),'switch_on').''; } print ''; - print ''.img_picto($langs->trans("Edit"),'edit').''; + print ''.img_picto($langs->trans("Edit"),'edit').''; print ''; print "\n"; } diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 0288fa4f31f..13d2e6e87a4 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -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) diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 22cfc938ba1..ff08d7c9686 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -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')); } /* diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index a24b21c51a8..6c19894e7f1 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -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) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 398f30dd100..d85b8fb89b1 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -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) diff --git a/htdocs/core/boxes/box_comptes.php b/htdocs/core/boxes/box_comptes.php index 817fec968da..5fc8d2add91 100644 --- a/htdocs/core/boxes/box_comptes.php +++ b/htdocs/core/boxes/box_comptes.php @@ -45,7 +45,9 @@ class box_comptes extends ModeleBoxes /** - * Constructor + * Constructor + * + * @param DoliDB $db Database handler */ function __construct($db) { diff --git a/htdocs/core/boxes/box_members.php b/htdocs/core/boxes/box_members.php index 7add5a76939..91d3cd918b9 100755 --- a/htdocs/core/boxes/box_members.php +++ b/htdocs/core/boxes/box_members.php @@ -45,7 +45,9 @@ class box_members extends ModeleBoxes /** - * Constructor + * Constructor + * + * @param DoliDB $db Database handler */ function __construct($db) { diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 048d25e0549..e078639724c 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -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') { diff --git a/htdocs/core/class/dolprintipp.class.php b/htdocs/core/class/dolprintipp.class.php index 30ddbfe254a..e7a0d051cb3 100644 --- a/htdocs/core/class/dolprintipp.class.php +++ b/htdocs/core/class/dolprintipp.class.php @@ -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) { diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index d35fb8dd369..e6ef238d502 100755 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -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) diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 9fca74bc397..3de291bbe76 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -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='') { diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index f863d1c925d..18f4195a166 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -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 */ diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 38ad5dee987..4ffb5ba3b00 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -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) { diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 65816d52309..34f1bd5878f 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1,38 +1,38 @@ * Copyright (C) 2006 Rodolphe Quiedeville - * Copyright (C) 2007 Patrick Raguin - * Copyright (C) 2010-2012 Regis Houssin - * Copyright (C) 2010 Juanjo Menent - * Copyright (C) 2012 Christophe Battarel - * - * 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 . - * or see http://www.gnu.org/ - */ +* Copyright (C) 2007 Patrick Raguin +* Copyright (C) 2010-2012 Regis Houssin +* Copyright (C) 2010 Juanjo Menent +* Copyright (C) 2012 Christophe Battarel +* +* 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 . +* 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); + } + } } /** diff --git a/htdocs/core/menus/standard/auguria_menu.php b/htdocs/core/menus/standard/auguria_menu.php index 44185cea085..d1a67514a2b 100644 --- a/htdocs/core/menus/standard/auguria_menu.php +++ b/htdocs/core/menus/standard/auguria_menu.php @@ -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); } } diff --git a/htdocs/core/modules/modPrintIPP.class.php b/htdocs/core/modules/modPrintIPP.class.php index 53cadf53699..35fd62af04e 100644 --- a/htdocs/core/modules/modPrintIPP.class.php +++ b/htdocs/core/modules/modPrintIPP.class.php @@ -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); } } diff --git a/htdocs/cron/card.php b/htdocs/cron/card.php index 3a3caa16626..4b36797347c 100644 --- a/htdocs/cron/card.php +++ b/htdocs/cron/card.php @@ -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'); } } diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index b43f4ed9bd4..60514e73942 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -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; diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 393a316df15..9896eb50486 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -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) diff --git a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql index 2055bc2b1ab..c8cec34bb22 100755 --- a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql +++ b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql @@ -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; + diff --git a/htdocs/install/mysql/tables/llx_printer_ipp.sql b/htdocs/install/mysql/tables/llx_printer_ipp.sql new file mode 100644 index 00000000000..0e030b24c95 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_printer_ipp.sql @@ -0,0 +1,28 @@ +-- ============================================================================ +-- Copyright (C) 2013 Florian HENRY +-- +-- 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 . +-- +-- ============================================================================ + +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; diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index 0edb8291677..f3538c6e266 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -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."%'"; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 607e0563e7d..70883769602 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -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};