diff --git a/ChangeLog b/ChangeLog index a7e647fcc99..c7d0cd19192 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,7 @@ English Dolibarr ChangeLog ***** ChangeLog for 3.3 compared to 3.2.2 ***** For users: +- New: [ task #289 ] Can reorder tasks. - New: Add field "signature" into thirdparty card. If filled, text is added at end of predefined email texts. If option MAIL_DO_NOT_USE_SIGN is on, this feature is disabled. @@ -28,6 +29,9 @@ For users: - New: Add link to third party into sells and purchase journal. - New: Suggest a method to generate a backup file for user with no access to mysqldump binary. +- New: Can use extrafields on contacts/addresses. +- New: Support unique field for extrafields. +- New: Extra fields supports more types (now int, string, double, date, datetime). - New: Can correct stock of a warehouse from warehouse card. - New: [ task #185 ]: Can input amount when correcting stock to recalculate PMP. - New: [ task #454 ]: Add "No category" into filters on category. @@ -35,16 +39,16 @@ For users: - New: More surface control on stock correction page. - New: Add great britain provinces. - New: Update libs/tools/logo for DoliWamp. -- New: [ task #494 ] Send an email to foundation when a new member has auto-subscribed -- New: [ task #326 ]: Add a numbering module to suggest automatically a product ref -- New: Add conditional substitution IF/ELSEIF/ENDIF for ODT templates +- New: [ task #494 ] Send an email to foundation when a new member has auto-subscribed. +- New: [ task #326 ]: Add a numbering module to suggest automatically a product ref. +- New: Add conditional substitution IF/ELSEIF/ENDIF for ODT templates. - New: Add unit foot2, inch2, foot3 and inch3 for surface and volumes. - New: Can select thirdparties into emailing targets, even if module category is not enabled. - New: [ task #498 ] Improvement of the block to add products/services lines. - New: ECM autodir works also for files joined to products and services. - New: Add a selection module for emailing to enter a recipient from gui. -- New: Allow to search product from barcodes directly from the permanent mini search left box -- New: Allow to search product from barcodes directly from invoices, proposals... through AJAX +- New: Allow to search thirds and products from barcodes directly from the permanent mini search left box. +- New: Allow to search product from barcodes directly from invoices, proposals... through AJAX. New experimental modules: - New: Add margin and commissions management module. - New: Add holiday module. @@ -53,6 +57,7 @@ New experimental modules: - Fix: No images into product description lines as PDF generation does not work with this. - Fix: Errors weren't being shown in customer's & supplier's orders +- Fix: Lastname wasn't being recorded in xinputuser emailing module For developers: - New: Add webservice for thirdparty creation and list. diff --git a/htdocs/adherents/admin/adherent.php b/htdocs/adherents/admin/adherent.php index 02d9e7b90a2..4b9f5e672e8 100644 --- a/htdocs/adherents/admin/adherent.php +++ b/htdocs/adherents/admin/adherent.php @@ -111,7 +111,7 @@ $linkback=''.$langs->trans("BackToM print_fiche_titre($langs->trans("MembersSetup"),$linkback,'setup'); -$head = member_admin_prepare_head($adh); +$head = member_admin_prepare_head(); dol_fiche_head($head, 'general', $langs->trans("Member"), 0, 'user'); @@ -136,10 +136,9 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) print '
'; print ''; print ''; - print ''; print ''; print ''.$langs->trans("AdherentLoginRequired").''; - print $form->selectyesno('constvalue',!$conf->global->ADHERENT_LOGIN_NOT_REQUIRED,1); + print $form->selectyesno('constvalue',(! empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)?$conf->global->ADHERENT_LOGIN_NOT_REQUIRED:1),1); print ''; print ''; print "\n"; @@ -151,10 +150,9 @@ $var=!$var; print ''; print ''; print ''; -print ''; print ''; print ''.$langs->trans("AdherentMailRequired").''; -print $form->selectyesno('constvalue',$conf->global->ADHERENT_MAIL_REQUIRED,1); +print $form->selectyesno('constvalue',(! empty($conf->global->ADHERENT_MAIL_REQUIRED)?$conf->global->ADHERENT_MAIL_REQUIRED:0),1); print ''; print ''; print "\n"; @@ -165,10 +163,9 @@ $var=!$var; print ''; print ''; print ''; -print ''; print ''; print ''.$langs->trans("MemberSendInformationByMailByDefault").''; -print $form->selectyesno('constvalue',$conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL,1); +print $form->selectyesno('constvalue',(! empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL)?$conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL:0),1); print ''; print ''; print "\n"; @@ -179,10 +176,9 @@ $var=!$var; print ''; print ''; print ''; -print ''; print ''; print ''.$langs->trans("AddSubscriptionIntoAccount").''; -if ($conf->banque->enabled) +if (! empty($conf->banque->enabled)) { print ''; print $form->selectyesno('constvalue',$conf->global->ADHERENT_BANK_USE,1); diff --git a/htdocs/adherents/admin/adherent_extrafields.php b/htdocs/adherents/admin/adherent_extrafields.php index b14042a141e..4941cff79c5 100755 --- a/htdocs/adherents/admin/adherent_extrafields.php +++ b/htdocs/adherents/admin/adherent_extrafields.php @@ -1,7 +1,8 @@ - * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2004-2011 Laurent Destailleur +/* Copyright (C) 2001-2002 Rodolphe Quiedeville + * Copyright (C) 2003 Jean-Louis Bergamo + * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2012 Regis Houssin * * 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 @@ -34,15 +35,12 @@ $extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format -$type2label=array( -'varchar'=>$langs->trans('String'), -'text'=>$langs->trans('Text'), -'int'=>$langs->trans('Int'), -'date'=>$langs->trans('Date'), -'datetime'=>$langs->trans('DateAndTime') -); +$tmptype2label=getStaticMember(get_class($extrafields),'type2label'); +$type2label=array(''); +foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val); -$action=GETPOST("action"); +$action=GETPOST('action', 'alpha'); +$attrname=GETPOST('attrname', 'alpha'); $elementtype='member'; if (!$user->admin) accessforbidden(); @@ -70,7 +68,7 @@ $linkback=''.$langs->trans("BackToM print_fiche_titre($langs->trans("MembersSetup"),$linkback,'setup'); -$head = member_admin_prepare_head($adh); +$head = member_admin_prepare_head(); dol_fiche_head($head, 'attributes', $langs->trans("Member"), 0, 'user'); @@ -90,6 +88,7 @@ print ''.$langs->trans("Label").''; print ''.$langs->trans("AttributeCode").''; print ''.$langs->trans("Type").''; print ''.$langs->trans("Size").''; +print ''.$langs->trans("Unique").''; print ' '; print "\n"; @@ -102,6 +101,7 @@ foreach($extrafields->attribute_type as $key => $value) print "".$key."\n"; print "".$type2label[$extrafields->attribute_type[$key]]."\n"; print ''.$extrafields->attribute_size[$key]."\n"; + print ''.yn($extrafields->attribute_unique[$key])."\n"; print ''.img_edit().''; print "  ".img_delete()."\n"; print ""; @@ -112,10 +112,8 @@ print ""; dol_fiche_end(); -/* - * Barre d'actions - * - */ + +// Buttons if ($action != 'create' && $action != 'edit') { print '
'; @@ -135,29 +133,7 @@ if ($action == 'create') print "
"; print_titre($langs->trans('NewAttribute')); - print ''; - print ''; - print ''; - - print ''; - - // Label - print ''; - // Code - print ''; - // Type - print ''; - // Size - print ''; - - print '
'.$langs->trans("Label").'
'.$langs->trans("AttributeCode").' ('.$langs->trans("AlphaNumOnlyCharsAndNoSpace").')
'.$langs->trans("Type").''; - print $form->selectarray('type',$type2label,GETPOST('type')); - print '
'.$langs->trans("Size").'
'; - - print '

  '; - print '
'; - - print "\n"; + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; } /* ************************************************************************** */ @@ -165,47 +141,12 @@ if ($action == 'create') /* Edition d'un champ optionnel */ /* */ /* ************************************************************************** */ -if ($_GET["attrname"] && $action == 'edit') +if ($action == 'edit' && ! empty($attrname)) { print "
"; - print_titre($langs->trans("FieldEdition",$_GET["attrname"])); - - /* - * formulaire d'edition - */ - print '
'; - print ''; - print ''; - print ''; - print ''; - - // Label - print ''; - print ''; - print ''; - // Code - print ''; - print ''; - print ''; - print ''; - // Type - $type=$extrafields->attribute_type[$_GET["attrname"]]; - $size=$extrafields->attribute_size[$_GET["attrname"]]; - print ''; - print ''; - // Size - print ''; - - print '
'.$langs->trans("Label").'
'.$langs->trans("AttributeCode").''.$_GET["attrname"].' 
'.$langs->trans("Type").''; - print $type2label[$type]; - print ''; - print '
'.$langs->trans("Size").'
'; - - print '

  '; - print '
'; - - print "
"; + print_titre($langs->trans("FieldEdition", $attrname)); + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; } $db->close(); diff --git a/htdocs/adherents/admin/mailman.php b/htdocs/adherents/admin/mailman.php index 5e7aa08f547..b3169c721f2 100644 --- a/htdocs/adherents/admin/mailman.php +++ b/htdocs/adherents/admin/mailman.php @@ -151,7 +151,7 @@ $linkback=''.$langs->trans("BackToM print_fiche_titre($langs->trans("MailmanSpipSetup"),$linkback,'setup'); -$head = mailmanspip_admin_prepare_head($adh); +$head = mailmanspip_admin_prepare_head(); dol_fiche_head($head, 'mailman', $langs->trans("Setup"), 0, 'user'); @@ -163,7 +163,7 @@ dol_htmloutput_mesg($mesg); * Mailman */ $var=!$var; -if ($conf->global->ADHERENT_USE_MAILMAN) +if (! empty($conf->global->ADHERENT_USE_MAILMAN)) { //$lien=img_picto($langs->trans("Active"),'tick').' '; $lien=''; @@ -214,7 +214,7 @@ else dol_fiche_end(); -if ($conf->global->ADHERENT_USE_MAILMAN) +if (! empty($conf->global->ADHERENT_USE_MAILMAN)) { print '
'; print ''; diff --git a/htdocs/adherents/admin/public.php b/htdocs/adherents/admin/public.php index 911b1e13f7f..9dfac613f2a 100755 --- a/htdocs/adherents/admin/public.php +++ b/htdocs/adherents/admin/public.php @@ -1,7 +1,8 @@ - * Copyright (C) 2006-2011 Laurent Destailleur - * Copyright (C) 2011 Juanjo Menent +/* Copyright (C) 2001-2002 Rodolphe Quiedeville + * Copyright (C) 2006-2011 Laurent Destailleur + * Copyright (C) 2006-2012 Regis Houssin + * Copyright (C) 2011 Juanjo Menent * * 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 @@ -32,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; $langs->load("members"); $langs->load("admin"); -$action=GETPOST('action'); +$action=GETPOST('action', 'alpha'); if (! $user->admin) accessforbidden(); @@ -43,10 +44,15 @@ if (! $user->admin) accessforbidden(); if ($action == 'update') { - $res=dolibarr_set_const($db, "MEMBER_ENABLE_PUBLIC",$_POST["MEMBER_ENABLE_PUBLIC"],'chaine',0,'',$conf->entity); - $res=dolibarr_set_const($db, "MEMBER_NEWFORM_AMOUNT",$_POST["MEMBER_NEWFORM_AMOUNT"],'chaine',0,'',$conf->entity); - $res=dolibarr_set_const($db, "MEMBER_NEWFORM_EDITAMOUNT",$_POST["MEMBER_NEWFORM_EDITAMOUNT"],'chaine',0,'',$conf->entity); - $res=dolibarr_set_const($db, "MEMBER_NEWFORM_PAYONLINE",$_POST["MEMBER_NEWFORM_PAYONLINE"],'chaine',0,'',$conf->entity); + $public=GETPOST('MEMBER_ENABLE_PUBLIC'); + $amount=GETPOST('MEMBER_NEWFORM_AMOUNT'); + $editamount=GETPOST('MEMBER_NEWFORM_EDITAMOUNT'); + $payonline=GETPOST('MEMBER_NEWFORM_PAYONLINE'); + + $res=dolibarr_set_const($db, "MEMBER_ENABLE_PUBLIC",$public,'chaine',0,'',$conf->entity); + $res=dolibarr_set_const($db, "MEMBER_NEWFORM_AMOUNT",$amount,'chaine',0,'',$conf->entity); + $res=dolibarr_set_const($db, "MEMBER_NEWFORM_EDITAMOUNT",$editamount,'chaine',0,'',$conf->entity); + $res=dolibarr_set_const($db, "MEMBER_NEWFORM_PAYONLINE",$payonline,'chaine',0,'',$conf->entity); if (! $res > 0) $error++; @@ -74,7 +80,7 @@ llxHeader('',$langs->trans("MembersSetup"),$help_url); $linkback=''.$langs->trans("BackToModuleList").''; print_fiche_titre($langs->trans("MembersSetup"),$linkback,'setup'); -$head = member_admin_prepare_head($adh); +$head = member_admin_prepare_head(); dol_fiche_head($head, 'public', $langs->trans("Member"), 0, 'user'); @@ -123,7 +129,7 @@ print ''; print ''; print $langs->trans("EnablePublicSubscriptionForm"); print ''; -print $form->selectyesno("MEMBER_ENABLE_PUBLIC",$conf->global->MEMBER_ENABLE_PUBLIC,1); +print $form->selectyesno("MEMBER_ENABLE_PUBLIC",(! empty($conf->global->MEMBER_ENABLE_PUBLIC)?$conf->global->MEMBER_ENABLE_PUBLIC:0),1); print "\n"; // Type @@ -141,7 +147,7 @@ print ''; print ''; print $langs->trans("DefaultAmount"); print ''; -print '';; +print '';; print "\n"; // Can edit @@ -150,10 +156,10 @@ print ''; print ''; print $langs->trans("CanEditAmount"); print ''; -print $form->selectyesno("MEMBER_NEWFORM_EDITAMOUNT",$conf->global->MEMBER_NEWFORM_EDITAMOUNT,1); +print $form->selectyesno("MEMBER_NEWFORM_EDITAMOUNT",(! empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)?$conf->global->MEMBER_NEWFORM_EDITAMOUNT:0),1); print "\n"; -if ($conf->paybox->enabled || $conf->paypal->enabled) +if (! empty($conf->paybox->enabled) || ! empty($conf->paypal->enabled)) { // Jump to an online payment page $var=! $var; @@ -161,9 +167,9 @@ if ($conf->paybox->enabled || $conf->paypal->enabled) print $langs->trans("MEMBER_NEWFORM_PAYONLINE"); print ''; $listofval=array(); - if ($conf->paybox->enabled) $listofval['paybox']='Paybox'; - if ($conf->paypal->enabled) $listofval['paypal']='PayPal'; - print $form->selectarray("MEMBER_NEWFORM_PAYONLINE",$listofval,$conf->global->MEMBER_NEWFORM_PAYONLINE,1); + if (! empty($conf->paybox->enabled)) $listofval['paybox']='Paybox'; + if (! empty($conf->paypal->enabled)) $listofval['paypal']='PayPal'; + print $form->selectarray("MEMBER_NEWFORM_PAYONLINE",$listofval,(! empty($conf->global->MEMBER_NEWFORM_PAYONLINE)?$conf->global->MEMBER_NEWFORM_PAYONLINE:''),1); print "\n"; } diff --git a/htdocs/adherents/admin/spip.php b/htdocs/adherents/admin/spip.php index 2d571d2c615..29ae8e9e894 100644 --- a/htdocs/adherents/admin/spip.php +++ b/htdocs/adherents/admin/spip.php @@ -112,7 +112,7 @@ $linkback=''.$langs->trans("BackToM print_fiche_titre($langs->trans("MailmanSpipSetup"),$linkback,'setup'); -$head = mailmanspip_admin_prepare_head($adh); +$head = mailmanspip_admin_prepare_head(); dol_fiche_head($head, 'spip', $langs->trans("Setup"), 0, 'user'); @@ -123,7 +123,7 @@ dol_htmloutput_mesg($mesg); * Spip */ $var=!$var; -if ($conf->global->ADHERENT_USE_SPIP) +if (! empty($conf->global->ADHERENT_USE_SPIP)) { //$lien=img_picto($langs->trans("Active"),'tick').' '; $lien=''; diff --git a/htdocs/adherents/agenda.php b/htdocs/adherents/agenda.php index db8a055e32f..487c7636445 100644 --- a/htdocs/adherents/agenda.php +++ b/htdocs/adherents/agenda.php @@ -79,7 +79,7 @@ if ($id) llxHeader("",$langs->trans("Agenda"),''); - if ($conf->notification->enabled) $langs->load("mails"); + if (! empty($conf->notification->enabled)) $langs->load("mails"); $head = member_prepare_head($object); dol_fiche_head($head, 'agenda', $langs->trans("Member"),0,'user'); @@ -142,7 +142,7 @@ if ($id) print '
'; - if ($conf->agenda->enabled) + if (! empty($conf->agenda->enabled)) { print ''.$langs->trans("AddAction").''; } diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php index 61ef0da1314..400e386ef8e 100644 --- a/htdocs/adherents/card_subscriptions.php +++ b/htdocs/adherents/card_subscriptions.php @@ -246,7 +246,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $ } else { - if ($conf->banque->enabled && $_POST["paymentsave"] != 'none') + if (! empty($conf->banque->enabled) && $_POST["paymentsave"] != 'none') { if ($_POST["cotisation"]) { @@ -479,7 +479,7 @@ if ($rowid) $rowspan=9; if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) $rowspan+=1; - if ($conf->societe->enabled) $rowspan++; + if (! empty($conf->societe->enabled)) $rowspan++; print ''; print ''; @@ -545,7 +545,7 @@ if ($rowid) print ''; // Third party Dolibarr - if ($conf->societe->enabled) + if (! empty($conf->societe->enabled)) { print ''; print ''; print ''; print ''; - if ($conf->banque->enabled) + if (! empty($conf->banque->enabled)) { print ''; } @@ -693,7 +693,7 @@ if ($rowid) print '\n"; print '\n"; print ''; - if ($conf->banque->enabled) + if (! empty($conf->banque->enabled)) { print ''; // Complementary action - if ($conf->banque->enabled || $conf->facture->enabled) + if (! empty($conf->banque->enabled) || ! empty($conf->facture->enabled)) { $company=new Societe($db); if ($object->fk_soc) @@ -889,12 +889,12 @@ if ($rowid) print ''; print ''; // Banque - if ($conf->banque->enabled) + if (! empty($conf->banque->enabled)) { if ($objp->fk_account) { @@ -193,7 +193,7 @@ if ($result) print ''; print ""; - if ($allowinsertbankafter && ! $objp->fk_account && $conf->banque->enabled && $objp->cotisation) + if ($allowinsertbankafter && ! $objp->fk_account && ! empty($conf->banque->enabled) && $objp->cotisation) { print "\n"; } @@ -207,7 +207,7 @@ if ($result) print "\n"; print "\n"; print "\n"; - if ($conf->banque->enabled) + if (! empty($conf->banque->enabled)) { print ''; } diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php index 5647ae16839..7ca413a0c4a 100644 --- a/htdocs/adherents/fiche.php +++ b/htdocs/adherents/fiche.php @@ -54,7 +54,7 @@ $socid=GETPOST('socid','int'); // Security check $result=restrictedArea($user,'adherent',$rowid); -if ($conf->mailmanspip->enabled) +if (! empty($conf->mailmanspip->enabled)) { include_once DOL_DOCUMENT_ROOT.'/mailmanspip/class/mailmanspip.class.php'; @@ -212,7 +212,7 @@ if ($action == 'confirm_sendinfo' && $confirm == 'yes') if ($object->email) { $from=$conf->email_from; - if ($conf->global->ADHERENT_MAIL_FROM) $from=$conf->global->ADHERENT_MAIL_FROM; + if (! empty($conf->global->ADHERENT_MAIL_FROM)) $from=$conf->global->ADHERENT_MAIL_FROM; $result=$object->send_an_email($langs->transnoentitiesnoconv("ThisIsContentOfYourCard")."\n\n%INFOS%\n\n",$langs->transnoentitiesnoconv("CardContent")); @@ -844,7 +844,7 @@ if ($action == 'create') /* // Third party Dolibarr - if ($conf->societe->enabled) + if (! empty($conf->societe->enabled)) { print '"; @@ -369,7 +369,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propale->lire) * Proposals to process */ /* -if ($conf->propal->enabled) +if (! empty($conf->propal->enabled)) { $sql = "SELECT c.rowid, c.ref, c.fk_statut, s.nom, s.rowid as socid"; $sql.=" FROM ".MAIN_DB_PREFIX."propal as c"; @@ -418,7 +418,7 @@ if ($conf->propal->enabled) $filename=dol_sanitizeFileName($obj->ref); $filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; - $formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','',1,'',1); + print $formfile->getDocumentsLink($propalstatic->element, $filename, $filedir); print '
'; @@ -675,7 +675,7 @@ if ($rowid) print ''.$langs->trans("DateSubscription").''.$langs->trans("DateEnd").''.$langs->trans("Amount").''.$langs->trans("Account").''.dol_print_date($db->jdate($objp->dateadh),'day')."'.dol_print_date($db->jdate($objp->datef),'day')."'.price($objp->cotisation).''; if ($objp->bid) @@ -720,7 +720,7 @@ if ($rowid) // Link for paypal payment - if ($conf->paypal->enabled) + if (! empty($conf->paypal->enabled)) { include_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php'; print showPaypalPaymentUrl('membersubscription',$object->ref); @@ -740,8 +740,8 @@ if ($rowid) $bankdirect=0; // Option to write to bank is on by default $bankviainvoice=0; // Option to write via invoice is on by default $invoiceonly=0; - if ($conf->banque->enabled && $conf->global->ADHERENT_BANK_USE && (empty($_POST['paymentsave']) || $_POST["paymentsave"] == 'bankdirect')) $bankdirect=1; - if ($conf->banque->enabled && $conf->societe->enabled && $conf->facture->enabled && $object->fk_soc) $bankviainvoice=1; + if (! empty($conf->banque->enabled) && $conf->global->ADHERENT_BANK_USE && (empty($_POST['paymentsave']) || $_POST["paymentsave"] == 'bankdirect')) $bankdirect=1; + if (! empty($conf->banque->enabled) && ! empty($conf->societe->enabled) && ! empty($conf->facture->enabled) && $object->fk_soc) $bankviainvoice=1; print "\n\n\n"; @@ -873,7 +873,7 @@ if ($rowid) print dol_print_date(($datefrom?$datefrom:time()),"%Y").'" >
'; print ' '.$langs->trans("None").'
'; - if ($conf->banque->enabled) + if (! empty($conf->banque->enabled)) { print ' '.$langs->trans("MoreActionBankDirect").'
'; } - if ($conf->societe->enabled && $conf->facture->enabled) + if (! empty($conf->societe->enabled) && ! empty($conf->facture->enabled)) { print 'fk_soc) || empty($bankviainvoice)) print ' disabled="disabled"'; @@ -909,7 +909,7 @@ if ($rowid) } print '
'; } - if ($conf->banque->enabled && $conf->societe->enabled && $conf->facture->enabled) + if (! empty($conf->banque->enabled) && ! empty($conf->societe->enabled) && ! empty($conf->facture->enabled)) { print 'fk_soc) || empty($bankviainvoice)) print ' disabled="disabled"'; diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 3c0290b4eeb..c9f4a3de738 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -160,7 +160,7 @@ class Adherent extends CommonObject // Envoi mail confirmation $from=$conf->email_from; - if ($conf->global->ADHERENT_MAIL_FROM) $from=$conf->global->ADHERENT_MAIL_FROM; + if (! empty($conf->global->ADHERENT_MAIL_FROM)) $from=$conf->global->ADHERENT_MAIL_FROM; include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; $mailfile = new CMailFile($subjecttosend, $this->email, $from, $texttosend, $filename_list, $mimetype_list, $mimefilename_list, $addr_cc, $addr_bcc, $deliveryreceipt, $msgishtml); @@ -1382,7 +1382,7 @@ class Adherent extends CommonObject } // spip - if ($conf->global->ADHERENT_USE_SPIP && $conf->mailmanspip->enabled) + if ($conf->global->ADHERENT_USE_SPIP && ! empty($conf->mailmanspip->enabled)) { $result=$mailmanspip->add_to_spip($this); if ($result < 0) @@ -1427,7 +1427,7 @@ class Adherent extends CommonObject } } - if ($conf->global->ADHERENT_USE_SPIP && $conf->mailmanspip->enabled) + if ($conf->global->ADHERENT_USE_SPIP && ! empty($conf->mailmanspip->enabled)) { $result=$mailmanspip->del_to_spip($this); if ($result < 0) @@ -1787,31 +1787,31 @@ class Adherent extends CommonObject $this->fullname=$this->getFullName($langs); // Member - if ($this->fullname && $conf->global->LDAP_MEMBER_FIELD_FULLNAME) $info[$conf->global->LDAP_MEMBER_FIELD_FULLNAME] = $this->fullname; - if ($this->nom && $conf->global->LDAP_MEMBER_FIELD_NAME) $info[$conf->global->LDAP_MEMBER_FIELD_NAME] = $this->nom; - if ($this->prenom && $conf->global->LDAP_MEMBER_FIELD_FIRSTNAME) $info[$conf->global->LDAP_MEMBER_FIELD_FIRSTNAME] = $this->prenom; - if ($this->login && $conf->global->LDAP_MEMBER_FIELD_LOGIN) $info[$conf->global->LDAP_MEMBER_FIELD_LOGIN] = $this->login; - if ($this->pass && $conf->global->LDAP_MEMBER_FIELD_PASSWORD) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD] = $this->pass; // this->pass = mot de passe non crypte - if ($this->poste && $conf->global->LDAP_MEMBER_FIELD_TITLE) $info[$conf->global->LDAP_MEMBER_FIELD_TITLE] = $this->poste; - if ($this->adresse && $conf->global->LDAP_MEMBER_FIELD_ADDRESS) $info[$conf->global->LDAP_MEMBER_FIELD_ADDRESS] = $this->adresse; - if ($this->cp && $conf->global->LDAP_MEMBER_FIELD_ZIP) $info[$conf->global->LDAP_MEMBER_FIELD_ZIP] = $this->cp; - if ($this->ville && $conf->global->LDAP_MEMBER_FIELD_TOWN) $info[$conf->global->LDAP_MEMBER_FIELD_TOWN] = $this->ville; - if ($this->country_code && $conf->global->LDAP_MEMBER_FIELD_COUNTRY) $info[$conf->global->LDAP_MEMBER_FIELD_COUNTRY] = $this->country_code; - if ($this->email && $conf->global->LDAP_MEMBER_FIELD_MAIL) $info[$conf->global->LDAP_MEMBER_FIELD_MAIL] = $this->email; - if ($this->phone && $conf->global->LDAP_MEMBER_FIELD_PHONE) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE] = $this->phone; - if ($this->phone_perso && $conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO] = $this->phone_perso; - if ($this->phone_mobile && $conf->global->LDAP_MEMBER_FIELD_MOBILE) $info[$conf->global->LDAP_MEMBER_FIELD_MOBILE] = $this->phone_mobile; - if ($this->fax && $conf->global->LDAP_MEMBER_FIELD_FAX) $info[$conf->global->LDAP_MEMBER_FIELD_FAX] = $this->fax; - if ($this->note && $conf->global->LDAP_MEMBER_FIELD_DESCRIPTION) $info[$conf->global->LDAP_MEMBER_FIELD_DESCRIPTION] = $this->note; - if ($this->naiss && $conf->global->LDAP_MEMBER_FIELD_BIRTHDATE) $info[$conf->global->LDAP_MEMBER_FIELD_BIRTHDATE] = dol_print_date($this->naiss,'dayhourldap'); - if (isset($this->statut) && $conf->global->LDAP_FIELD_MEMBER_STATUS) $info[$conf->global->LDAP_FIELD_MEMBER_STATUS] = $this->statut; - if ($this->datefin && $conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION) $info[$conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION] = dol_print_date($this->datefin,'dayhourldap'); + if ($this->fullname && ! empty($conf->global->LDAP_MEMBER_FIELD_FULLNAME)) $info[$conf->global->LDAP_MEMBER_FIELD_FULLNAME] = $this->fullname; + if ($this->nom && ! empty($conf->global->LDAP_MEMBER_FIELD_NAME)) $info[$conf->global->LDAP_MEMBER_FIELD_NAME] = $this->nom; + if ($this->prenom && ! empty($conf->global->LDAP_MEMBER_FIELD_FIRSTNAME)) $info[$conf->global->LDAP_MEMBER_FIELD_FIRSTNAME] = $this->prenom; + if ($this->login && ! empty($conf->global->LDAP_MEMBER_FIELD_LOGIN)) $info[$conf->global->LDAP_MEMBER_FIELD_LOGIN] = $this->login; + if ($this->pass && ! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD] = $this->pass; // this->pass = mot de passe non crypte + if ($this->poste && ! empty($conf->global->LDAP_MEMBER_FIELD_TITLE)) $info[$conf->global->LDAP_MEMBER_FIELD_TITLE] = $this->poste; + if ($this->adresse && ! empty($conf->global->LDAP_MEMBER_FIELD_ADDRESS)) $info[$conf->global->LDAP_MEMBER_FIELD_ADDRESS] = $this->adresse; + if ($this->cp && ! empty($conf->global->LDAP_MEMBER_FIELD_ZIP)) $info[$conf->global->LDAP_MEMBER_FIELD_ZIP] = $this->cp; + if ($this->ville && ! empty($conf->global->LDAP_MEMBER_FIELD_TOWN)) $info[$conf->global->LDAP_MEMBER_FIELD_TOWN] = $this->ville; + if ($this->country_code && ! empty($conf->global->LDAP_MEMBER_FIELD_COUNTRY)) $info[$conf->global->LDAP_MEMBER_FIELD_COUNTRY] = $this->country_code; + if ($this->email && ! empty($conf->global->LDAP_MEMBER_FIELD_MAIL)) $info[$conf->global->LDAP_MEMBER_FIELD_MAIL] = $this->email; + if ($this->phone && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE] = $this->phone; + if ($this->phone_perso && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO] = $this->phone_perso; + if ($this->phone_mobile && ! empty($conf->global->LDAP_MEMBER_FIELD_MOBILE)) $info[$conf->global->LDAP_MEMBER_FIELD_MOBILE] = $this->phone_mobile; + if ($this->fax && ! empty($conf->global->LDAP_MEMBER_FIELD_FAX)) $info[$conf->global->LDAP_MEMBER_FIELD_FAX] = $this->fax; + if ($this->note && ! empty($conf->global->LDAP_MEMBER_FIELD_DESCRIPTION)) $info[$conf->global->LDAP_MEMBER_FIELD_DESCRIPTION] = $this->note; + if ($this->naiss && ! empty($conf->global->LDAP_MEMBER_FIELD_BIRTHDATE)) $info[$conf->global->LDAP_MEMBER_FIELD_BIRTHDATE] = dol_print_date($this->naiss,'dayhourldap'); + if (isset($this->statut) && ! empty($conf->global->LDAP_FIELD_MEMBER_STATUS)) $info[$conf->global->LDAP_FIELD_MEMBER_STATUS] = $this->statut; + if ($this->datefin && ! empty($conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION)) $info[$conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION] = dol_print_date($this->datefin,'dayhourldap'); // Subscriptions - if ($this->first_subscription_date && $conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE) $info[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE] = dol_print_date($this->first_subscription_date,'dayhourldap'); - if (isset($this->first_subscription_amount) && $conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT) $info[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT] = $this->first_subscription_amount; - if ($this->last_subscription_date && $conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE) $info[$conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE] = dol_print_date($this->last_subscription_date,'dayhourldap'); - if (isset($this->last_subscription_amount) && $conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT) $info[$conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT] = $this->last_subscription_amount; + if ($this->first_subscription_date && ! empty($conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE)) $info[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE] = dol_print_date($this->first_subscription_date,'dayhourldap'); + if (isset($this->first_subscription_amount) && ! empty($conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT)) $info[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT] = $this->first_subscription_amount; + if ($this->last_subscription_date && ! empty($conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE)) $info[$conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE] = dol_print_date($this->last_subscription_date,'dayhourldap'); + if (isset($this->last_subscription_amount) && ! empty($conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT)) $info[$conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT] = $this->last_subscription_amount; return $info; } diff --git a/htdocs/adherents/cotisations.php b/htdocs/adherents/cotisations.php index b0a75427697..1b4fabaf47e 100644 --- a/htdocs/adherents/cotisations.php +++ b/htdocs/adherents/cotisations.php @@ -99,7 +99,7 @@ if ($result) print_liste_field_titre($langs->trans("Name"),"cotisations.php","d.nom",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Login"),"cotisations.php","d.login",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Label"),"cotisations.php","c.note",$param,"",'align="left"',$sortfield,$sortorder); - if ($conf->banque->enabled) + if (! empty($conf->banque->enabled)) { print_liste_field_titre($langs->trans("Account"),"cotisations.php","b.fk_account",$pram,"","",$sortfield,$sortorder); } @@ -131,7 +131,7 @@ if ($result) $var=!$var; - if ($allowinsertbankafter && ! $objp->fk_account && $conf->banque->enabled && $objp->cotisation) + if ($allowinsertbankafter && ! $objp->fk_account && ! empty($conf->banque->enabled) && $objp->cotisation) { print ""; print ''; @@ -153,7 +153,7 @@ if ($result) print '
'.price($objp->cotisation).'
    
'.$langs->trans("LinkedToDolibarrThirdParty").''; print $form->select_company($object->fk_soc,'socid','',1); @@ -924,7 +924,7 @@ if ($action == 'edit') $rowspan=15; if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) $rowspan++; - if ($conf->societe->enabled) $rowspan++; + if (! empty($conf->societe->enabled)) $rowspan++; print '
'; print ''; @@ -1064,7 +1064,7 @@ if ($action == 'edit') } // Third party Dolibarr - if ($conf->societe->enabled) + if (! empty($conf->societe->enabled)) { print '
'.$langs->trans("LinkedToDolibarrThirdParty").''; if ($object->fk_soc) @@ -1148,7 +1148,7 @@ if ($rowid && $action != 'edit') array('label' => $langs->trans("LoginToCreate"), 'type' => 'text', 'name' => 'login', 'value' => $login) ); $text=$langs->trans("ConfirmCreateLogin").'
'; - if ($conf->societe->enabled) + if (! empty($conf->societe->enabled)) { if ($object->fk_soc > 0) $text.=$langs->trans("UserWillBeExternalUser"); else $text.=$langs->trans("UserWillBeInternalUser"); @@ -1204,8 +1204,8 @@ if ($rowid && $action != 'edit') // Cree un tableau formulaire $formquestion=array(); if ($object->email) $formquestion[]=array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $label, 'value' => ($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL?true:false)); - if ($conf->global->ADHERENT_USE_MAILMAN) { $formquestion[]=array('type'=>'other','label'=>$langs->transnoentitiesnoconv("SynchroMailManEnabled"),'value'=>''); } - if ($conf->global->ADHERENT_USE_SPIP) { $formquestion[]=array('type'=>'other','label'=>$langs->transnoentitiesnoconv("SynchroSpipEnabled"),'value'=>''); } + if (! empty($conf->global->ADHERENT_USE_MAILMAN)) { $formquestion[]=array('type'=>'other','label'=>$langs->transnoentitiesnoconv("SynchroMailManEnabled"),'value'=>''); } + if (! empty($conf->global->ADHERENT_USE_SPIP)) { $formquestion[]=array('type'=>'other','label'=>$langs->transnoentitiesnoconv("SynchroSpipEnabled"),'value'=>''); } print $form->formconfirm("fiche.php?rowid=".$rowid,$langs->trans("ValidateMember"),$langs->trans("ConfirmValidateMember"),"confirm_valid",$formquestion,1); } @@ -1276,7 +1276,7 @@ if ($rowid && $action != 'edit') $rowspan=17; if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) $rowspan++; - if ($conf->societe->enabled) $rowspan++; + if (! empty($conf->societe->enabled)) $rowspan++; print ''; @@ -1382,7 +1382,7 @@ if ($rowid && $action != 'edit') } // Third party Dolibarr - if ($conf->societe->enabled) + if (! empty($conf->societe->enabled)) { print ''; // Synchro contact active -if ($conf->societe->enabled) +if (! empty($conf->societe->enabled)) { $var=!$var; print ''; // Port $var=!$var; print ''; // Pass $var=!$var; print '"; print ''; print '"; } -if($conf->global->DATABASE_PWD_ENCRYPTED) +if (! empty($conf->global->DATABASE_PWD_ENCRYPTED)) { print '\n"; print ''."\n"; $var=true; -if ($conf->facture->enabled) +if (! empty($conf->facture->enabled)) { $var=!$var; print ""; @@ -147,7 +147,7 @@ if ($conf->facture->enabled) print "\n\n\n"; } -if ($conf->commande->enabled) +if (! empty($conf->commande->enabled)) { $var=!$var; print ""; @@ -161,7 +161,7 @@ if ($conf->commande->enabled) print "\n\n\n"; } -if ($conf->expedition->enabled) +if (! empty($conf->expedition->enabled)) { $var=!$var; print ""; @@ -183,7 +183,7 @@ print " \n"; print ''."\n"; $var=true; -if ($conf->fournisseur->enabled) +if (! empty($conf->fournisseur->enabled)) { $var=!$var; print ""; @@ -197,7 +197,7 @@ if ($conf->fournisseur->enabled) print "\n\n\n"; } -if ($conf->fournisseur->enabled) +if (! empty($conf->fournisseur->enabled)) { $var=!$var; print ""; @@ -210,7 +210,7 @@ if ($conf->fournisseur->enabled) print ''; print "\n\n\n"; } -if ($conf->fournisseur->enabled) +if (! empty($conf->fournisseur->enabled)) { $var=!$var; print ""; diff --git a/htdocs/admin/system/database.php b/htdocs/admin/system/database.php index 33cb8a640a2..555e87374c0 100644 --- a/htdocs/admin/system/database.php +++ b/htdocs/admin/system/database.php @@ -39,7 +39,7 @@ $form=new Form($db); llxHeader(); -print_fiche_titre($langs->trans("DatabaseConfiguration"),'','setup'); +print_fiche_titre($langs->trans("InfoDatabase"),'','setup'); // Database print '
'; print ''; // Bank line - if ($conf->banque->enabled) + if (! empty($conf->banque->enabled)) { if ($conf->global->ADHERENT_BANK_USE || $subscription->fk_bank) { @@ -290,7 +290,7 @@ if ($rowid && $action != 'edit') //$formquestion=array(); //$formquestion['text']=''.$langs->trans("ThisWillAlsoDeleteBankRecord").''; $text=$langs->trans("ConfirmDeleteSubscription"); - if ($conf->banque->enabled && $conf->global->ADHERENT_BANK_USE) $text.='
'.img_warning().' '.$langs->trans("ThisWillAlsoDeleteBankRecord"); + if (! empty($conf->banque->enabled) && ! empty($conf->global->ADHERENT_BANK_USE)) $text.='
'.img_warning().' '.$langs->trans("ThisWillAlsoDeleteBankRecord"); $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?rowid=".$subscription->id,$langs->trans("DeleteSubscription"),$text,"confirm_delete",$formquestion,0,1); if ($ret == 'html') print '
'; } @@ -335,7 +335,7 @@ if ($rowid && $action != 'edit') print ''; // Bank line - if ($conf->banque->enabled) + if (! empty($conf->banque->enabled)) { if ($conf->global->ADHERENT_BANK_USE || $subscription->fk_bank) { diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php index 7593c814b31..11acc1914a1 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -203,7 +203,7 @@ $var=true; */ $max=5; -$sql = "SELECT a.rowid, a.statut, a.nom as lastname, a.prenom as firstname,"; +$sql = "SELECT a.rowid, a.statut, a.nom as lastname, a.prenom as firstname, a.societe as company, a.fk_soc,"; $sql.= " a.tms as datem, datefin as date_end_subscription,"; $sql.= " ta.rowid as typeid, ta.libelle, ta.cotisation"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as ta"; @@ -232,11 +232,18 @@ if ($resql) $staticmember->id=$obj->rowid; $staticmember->lastname=$obj->lastname; $staticmember->firstname=$obj->firstname; + if (! empty($obj->fk_soc)) { + $staticmember->socid = $obj->fk_soc; + $staticmember->fetch_thirdparty(); + $staticmember->name=$staticmember->thirdparty->name; + } else { + $staticmember->name=$obj->company; + } $staticmember->ref=$staticmember->getFullName($langs); $statictype->id=$obj->typeid; $statictype->libelle=$obj->libelle; - print ''; - print ''; + print ''; + print ''; print ''; print ''; print ''; @@ -256,7 +263,7 @@ else */ $max=5; -$sql = "SELECT a.rowid, a.statut, a.nom as lastname, a.prenom as firstname,"; +$sql = "SELECT a.rowid, a.statut, a.nom as lastname, a.prenom as firstname, a.societe as company, a.fk_soc,"; $sql.= " datefin as date_end_subscription,"; $sql.= " c.rowid as cid, c.tms as datem, c.datec as datec, c.dateadh as date_start, c.datef as date_end, c.cotisation"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."cotisation as c"; @@ -287,9 +294,16 @@ if ($resql) $staticmember->id=$obj->rowid; $staticmember->lastname=$obj->lastname; $staticmember->firstname=$obj->firstname; + if (! empty($obj->fk_soc)) { + $staticmember->socid = $obj->fk_soc; + $staticmember->fetch_thirdparty(); + $staticmember->name=$staticmember->thirdparty->name; + } else { + $staticmember->name=$obj->company; + } $staticmember->ref=$staticmember->getFullName($langs); print ''; - print ''; + print ''; print ''; print ''; //print ''; @@ -320,7 +334,7 @@ foreach ($AdherentType as $key => $adhtype) { $var=!$var; print ""; - print ''; + print ''; print ''; print ''; print ''; diff --git a/htdocs/adherents/ldap.php b/htdocs/adherents/ldap.php index a97c729a908..5cc02159675 100644 --- a/htdocs/adherents/ldap.php +++ b/htdocs/adherents/ldap.php @@ -120,7 +120,7 @@ print ''; print ''; // Password not crypted -if ($conf->global->LDAP_MEMBER_FIELD_PASSWORD) +if (! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) { print ''; print ''; @@ -128,7 +128,7 @@ if ($conf->global->LDAP_MEMBER_FIELD_PASSWORD) } // Password crypted -if ($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED) +if (! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) { print ''; print ''; diff --git a/htdocs/adherents/liste.php b/htdocs/adherents/liste.php index 93549d1c516..4752a36a65a 100644 --- a/htdocs/adherents/liste.php +++ b/htdocs/adherents/liste.php @@ -84,7 +84,7 @@ llxHeader('',$langs->trans("Member"),'EN:Module_Foundations|FR:Module_Adhé $now=dol_now(); -$sql = "SELECT d.rowid, d.login, d.nom as lastname, d.prenom as firstname, d.societe, "; +$sql = "SELECT d.rowid, d.login, d.nom as lastname, d.prenom as firstname, d.societe as company, d.fk_soc,"; $sql.= " d.datefin,"; $sql.= " d.email, d.fk_adherent_type as type_id, d.morphy, d.statut,"; $sql.= " t.libelle as type, t.cotisation"; @@ -198,7 +198,7 @@ if ($resql) // Filter on categories $moreforfilter=''; - if ($conf->categorie->enabled) + if (! empty($conf->categorie->enabled)) { $moreforfilter.=$langs->trans('Categories'). ': '; $moreforfilter.=$formother->select_categories(3,$search_categ,'search_categ',1); @@ -238,7 +238,7 @@ if ($resql) print ''; print ''; @@ -268,6 +268,14 @@ if ($resql) $memberstatic->lastname=$objp->lastname; $memberstatic->firstname=$objp->firstname; + if (! empty($objp->fk_soc)) { + $memberstatic->socid = $objp->fk_soc; + $memberstatic->fetch_thirdparty(); + $companyname=$memberstatic->thirdparty->name; + } else { + $companyname=$objp->company; + } + $var=!$var; print ""; @@ -277,14 +285,11 @@ if ($resql) print "\n"; // Lastname - if ($objp->societe != '') - { - print "\n"; - } - else - { - print "\n"; - } + print "\n"; // Login print "\n"; @@ -293,7 +298,7 @@ if ($resql) $membertypestatic->id=$objp->type_id; $membertypestatic->libelle=$objp->type; print ''; // Moral/Physique diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php index 91c376a32f6..2bd8736dfda 100644 --- a/htdocs/admin/barcode.php +++ b/htdocs/admin/barcode.php @@ -290,7 +290,7 @@ if (! isset($_SERVER['WINDIR'])) } // Module produits -if ($conf->societe->enabled) +if (! empty($conf->societe->enabled)) { $var=!$var; print ""; @@ -308,7 +308,7 @@ if ($conf->societe->enabled) } // Module produits -if ($conf->product->enabled) +if (! empty($conf->product->enabled)) { $var=!$var; print ""; diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 18d7aafe3f5..b1838928511 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -661,7 +661,7 @@ else $var=!$var; print ''; diff --git a/htdocs/admin/compta.php b/htdocs/admin/compta.php index 86d87117ac1..6f45e70bc98 100644 --- a/htdocs/admin/compta.php +++ b/htdocs/admin/compta.php @@ -113,7 +113,7 @@ print "\n"; print ''; print ''; + if ($conf->global->MAIN_FEATURES_LEVEL >= 1 || ! empty($conf->global->MAIN_BUGTRACK_ENABLELINK)) + { + // Show bugtrack link + $var=!$var; + print '"; + print ''; + print ""; + } + // Message login $var=!$var; print ''."\n"; - /* - // Show bugtrack link - $var=!$var; - print '"; - print ''; - print ""; - */ - print '
'; @@ -1532,7 +1532,7 @@ if ($rowid && $action != 'edit') } // Create third party - if ($conf->societe->enabled && ! $object->fk_soc) + if (! empty($conf->societe->enabled) && ! $object->fk_soc) { if ($user->rights->societe->creer) { @@ -1570,7 +1570,7 @@ if ($rowid && $action != 'edit') } // Action SPIP - if ($conf->mailmanspip->enabled && $conf->global->ADHERENT_USE_SPIP) + if (! empty($conf->mailmanspip->enabled) && ! empty($conf->global->ADHERENT_USE_SPIP)) { $isinspip = $mailmanspip->is_in_spip($object); diff --git a/htdocs/adherents/fiche_subscription.php b/htdocs/adherents/fiche_subscription.php index 02c9539d262..8d8fb1aab13 100644 --- a/htdocs/adherents/fiche_subscription.php +++ b/htdocs/adherents/fiche_subscription.php @@ -66,7 +66,7 @@ if ($user->rights->adherent->cotisation->creer && $_REQUEST["action"] == 'update // If transaction consolidated if ($accountline->rappro) { - $errmsg=$langs->trans("SubscriptionLinkedToConciliatedTrnasaction"); + $errmsg=$langs->trans("SubscriptionLinkedToConciliatedTransaction"); } else { @@ -220,7 +220,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit') print '
'.$langs->trans("Label").''.$subscription->note.'
'.$staticmember->getNomUrl(1,24).''.$statictype->getNomUrl(1,16).''.$staticmember->getNomUrl(1,32).''.$statictype->getNomUrl(1,32).''.dol_print_date($db->jdate($obj->datem),'dayhour').''.$staticmember->LibStatut($obj->statut,($obj->cotisation=='yes'?1:0),$db->jdate($obj->date_end_subscription),5).'
'.$subscriptionstatic->getNomUrl(1).''.$staticmember->getNomUrl(1,24,'subscription').''.$staticmember->getNomUrl(1,32,'subscription').''.get_date_range($db->jdate($obj->date_start),$db->jdate($obj->date_end)).''.price($obj->cotisation).''.$staticmember->LibStatut($obj->statut,($obj->cotisation=='yes'?1:0),$db->jdate($obj->date_end_subscription),5).'
'.img_object($langs->trans("ShowType"),"group").' '.$adhtype->getNomUrl(0,dol_size(16)).''.$adhtype->getNomUrl(1, dol_size(32)).''.(isset($MemberToValidate[$key]) && $MemberToValidate[$key] > 0?$MemberToValidate[$key]:'').' '.$staticmember->LibStatut(-1,$adhtype->cotisation,0,3).''.(isset($MembersValidated[$key]) && ($MembersValidated[$key]-$MemberUpToDate[$key] > 0) ? $MembersValidated[$key]-$MemberUpToDate[$key]:'').' '.$staticmember->LibStatut(1,$adhtype->cotisation,0,3).''.(isset($MemberUpToDate[$key]) && $MemberUpToDate[$key] > 0 ? $MemberUpToDate[$key]:'').' '.$staticmember->LibStatut(1,$adhtype->cotisation,$now,3).'
'.$langs->trans("Login").''.$adh->login.' 
'.$langs->trans("LDAPFieldPasswordNotCrypted").''.$adh->pass.'
'.$langs->trans("LDAPFieldPasswordCrypted").''.$adh->pass_crypted.''; $listetype=$membertypestatic->liste_array(); - print $form->selectarray("type", $listetype, $type, 1, 0, 0, '', 0, 12); + print $form->selectarray("type", $listetype, $type, 1, 0, 0, '', 0, 32); print ' 
rowid\">".dol_trunc($memberstatic->getFullName($langs))." / ".dol_trunc($objp->societe,12)."rowid\">".dol_trunc($memberstatic->getFullName($langs))."rowid\">"; + print ((! empty($objp->lastname) || ! empty($objp->firstname)) ? dol_trunc($memberstatic->getFullName($langs)) : ''); + print (((! empty($objp->lastname) || ! empty($objp->firstname)) && ! empty($companyname)) ? ' / ' : ''); + print (! empty($companyname) ? dol_trunc($companyname, 32) : ''); + print "".$objp->login."'; - print $membertypestatic->getNomUrl(1,12); + print $membertypestatic->getNomUrl(1,32); print '
'.$langs->trans("State").''; - if ($conf->global->MAIN_INFO_SOCIETE_DEPARTEMENT) print getState($conf->global->MAIN_INFO_SOCIETE_DEPARTEMENT); + if (! empty($conf->global->MAIN_INFO_SOCIETE_DEPARTEMENT)) print getState($conf->global->MAIN_INFO_SOCIETE_DEPARTEMENT); else print ' '; print '
'.$langs->trans('OptionModeTrue').''.nl2br($langs->trans('OptionModeTrueDesc')); // Write info on way to count VAT -if ($conf->global->MAIN_MODULE_COMPTABILITE) +if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) { // print "
\n"; // print nl2br($langs->trans('OptionModeTrueInfoModuleComptabilite')); diff --git a/htdocs/admin/confexped.php b/htdocs/admin/confexped.php index d6859188a25..ddbbb7ece69 100644 --- a/htdocs/admin/confexped.php +++ b/htdocs/admin/confexped.php @@ -84,14 +84,14 @@ $head[$h][1] = $langs->trans("Setup"); $hselected=$h; $h++; -if ($conf->global->MAIN_SUBMODULE_EXPEDITION) +if (! empty($conf->global->MAIN_SUBMODULE_EXPEDITION)) { $head[$h][0] = DOL_URL_ROOT."/admin/expedition.php"; $head[$h][1] = $langs->trans("Sending"); $h++; } -if ($conf->global->MAIN_SUBMODULE_LIVRAISON) +if (! empty($conf->global->MAIN_SUBMODULE_LIVRAISON)) { $head[$h][0] = DOL_URL_ROOT."/admin/livraison.php"; $head[$h][1] = $langs->trans("Receivings"); diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index e187facc3e8..f321029ce98 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -8,6 +8,7 @@ * Copyright (C) 2011 Remy Younes * Copyright (C) 2012 Marcos García * Copyright (C) 2012 Christophe Battarel + * Copyright (C) 2011-2012 Alexandre Spangaro * * 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 @@ -136,7 +137,7 @@ $tabsql[6] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.t $tabsql[7] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.deductible, p.code as pays_code, p.libelle as pays, a.fk_pays as pays_id, a.active FROM ".MAIN_DB_PREFIX."c_chargesociales AS a, ".MAIN_DB_PREFIX."c_pays as p WHERE a.fk_pays=p.rowid and p.active=1"; $tabsql[8] = "SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_typent"; $tabsql[9] = "SELECT code_iso as code, label as libelle, unicode, active FROM ".MAIN_DB_PREFIX."c_currencies"; -$tabsql[10]= "SELECT t.rowid, t.taux, t.localtax1, t.localtax2, t.localtax1_type, t.localtax2_type, p.libelle as pays, p.code as pays_code, t.fk_pays as pays_id, t.recuperableonly, t.note, t.active, t.accountancy_code FROM ".MAIN_DB_PREFIX."c_tva as t, llx_c_pays as p WHERE t.fk_pays=p.rowid"; +$tabsql[10]= "SELECT t.rowid, t.taux, t.localtax1_type, t.localtax1, t.localtax2_type, t.localtax2, p.libelle as pays, p.code as pays_code, t.fk_pays as pays_id, t.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_tva as t, llx_c_pays as p WHERE t.fk_pays=p.rowid"; $tabsql[11]= "SELECT t.rowid as rowid, element, source, code, libelle, active FROM ".MAIN_DB_PREFIX."c_type_contact AS t"; $tabsql[12]= "SELECT c.rowid as rowid, code, sortorder, c.libelle, c.libelle_facture, nbjour, fdm, decalage, active FROM ".MAIN_DB_PREFIX.'c_payment_term AS c'; $tabsql[13]= "SELECT id as rowid, code, c.libelle, type, active FROM ".MAIN_DB_PREFIX."c_paiement AS c"; @@ -158,7 +159,7 @@ $tabsqlsort[2] ="pays ASC, code ASC"; $tabsqlsort[3] ="pays ASC, code ASC"; $tabsqlsort[4] ="code ASC"; $tabsqlsort[5] ="libelle ASC"; -$tabsqlsort[6] ="a.type ASC, a.module, a.position, a.code ASC"; +$tabsqlsort[6] ="a.type ASC, a.module ASC, a.position ASC, a.code ASC"; $tabsqlsort[7] ="pays ASC, code ASC, a.libelle ASC"; $tabsqlsort[8] ="libelle ASC"; $tabsqlsort[9] ="libelle ASC"; @@ -188,7 +189,7 @@ $tabfield[6] = "code,libelle,type,position"; $tabfield[7] = "code,libelle,pays_id,pays,deductible"; $tabfield[8] = "code,libelle"; $tabfield[9] = "code,libelle,unicode"; -$tabfield[10]= "pays_id,pays,taux,recuperableonly,localtax1,localtax2,localtax1_type,localtax2,localtax2_type,accountancy_code,note"; +$tabfield[10]= "pays_id,pays,taux,recuperableonly,localtax1_type,localtax1,localtax2_type,localtax2,accountancy_code_sell,accountancy_code_buy,note"; $tabfield[11]= "element,source,code,libelle"; $tabfield[12]= "code,libelle,libelle_facture,nbjour,fdm,decalage"; $tabfield[13]= "code,libelle,type"; @@ -214,7 +215,7 @@ $tabfieldvalue[6] = "code,libelle,type,position"; $tabfieldvalue[7] = "code,libelle,pays,deductible"; $tabfieldvalue[8] = "code,libelle"; $tabfieldvalue[9] = "code,libelle,unicode"; -$tabfieldvalue[10]= "pays,taux,recuperableonly,localtax1,localtax2,localtax1_type,localtax2,localtax2_type,accountancy_code,note"; +$tabfieldvalue[10]= "pays,taux,recuperableonly,localtax1_type,localtax1,localtax2_type,localtax2,accountancy_code_sell,accountancy_code_buy,note"; $tabfieldvalue[11]= "element,source,code,libelle"; $tabfieldvalue[12]= "code,libelle,libelle_facture,nbjour,fdm,decalage"; $tabfieldvalue[13]= "code,libelle,type"; @@ -240,7 +241,7 @@ $tabfieldinsert[6] = "code,libelle,type,position"; $tabfieldinsert[7] = "code,libelle,fk_pays,deductible"; $tabfieldinsert[8] = "code,libelle"; $tabfieldinsert[9] = "code_iso,label,unicode"; -$tabfieldinsert[10]= "fk_pays,taux,recuperableonly,localtax1,localtax2,localtax1_type,localtax2,localtax2_type,accountancy_code,note"; +$tabfieldinsert[10]= "fk_pays,taux,recuperableonly,localtax1_type,localtax1,localtax2_type,localtax2,accountancy_code_sell,accountancy_code_buy,note"; $tabfieldinsert[11]= "element,source,code,libelle"; $tabfieldinsert[12]= "code,libelle,libelle_facture,nbjour,fdm,decalage"; $tabfieldinsert[13]= "code,libelle,type"; @@ -374,13 +375,14 @@ $localtax_typeList = array(); if (GETPOST("id") == 10) { $localtax_typeList = array( - "1" => $langs->trans("%ageOnAllWithoutVAT"), - "2" => $langs->trans("%ageOnAllBeforeVAT"), - "3" => $langs->trans("%ageOnProductsWithoutVAT"), - "4" => $langs->trans("%ageOnProductsBeforeVAT"), - "5" => $langs->trans("%ageOnServiceWithoutVAT"), - "6" => $langs->trans("%ageOnServiceBeforeVAT"), - "7" => $langs->trans("AmountOnOrder") + "0" => $langs->trans("No"), + "1" => $langs->trans("Yes").' ('.$langs->trans("Type")." 1)", //$langs->trans("%ageOnAllWithoutVAT"), + "2" => $langs->trans("Yes").' ('.$langs->trans("Type")." 2)", //$langs->trans("%ageOnAllBeforeVAT"), + "3" => $langs->trans("Yes").' ('.$langs->trans("Type")." 3)", //$langs->trans("%ageOnProductsWithoutVAT"), + "4" => $langs->trans("Yes").' ('.$langs->trans("Type")." 4)", //$langs->trans("%ageOnProductsBeforeVAT"), + "5" => $langs->trans("Yes").' ('.$langs->trans("Type")." 5)", //$langs->trans("%ageOnServiceWithoutVAT"), + "6" => $langs->trans("Yes").' ('.$langs->trans("Type")." 6)", //$langs->trans("%ageOnServiceBeforeVAT"), + "7" => $langs->trans("Yes").' ('.$langs->trans("Type")." 7)" //$langs->trans("AmountOnOrder") // We will enable this later. For the moment, work only of invoice localtype ); } $msg=''; @@ -398,14 +400,13 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) $ok=1; foreach ($listfield as $f => $value) { - if ($value == 'pays') - { - if (in_array('region_id',$listfield)) { continue; } // For region page, we do not require the country input - } + if ($value == 'pays' && in_array('region_id',$listfield)) continue; // For region page, we do not require the country input + if ($value == 'localtax1' && empty($_POST['localtax1_type'])) continue; + if ($value == 'localtax2' && empty($_POST['localtax2_type'])) continue; if ((! isset($_POST[$value]) || $_POST[$value]=='') - && $listfield[$f] != 'decalage' // Fields that are not mandatory - && $listfield[$f] != 'module' // Fields that are not mandatory - && $listfield[$f] != 'accountancy_code') // Fields that are not mandatory + // && (! in_array($listfield[$f], array('decalage','module','accountancy_code','localtax1','localtax2'))) // Fields that are not mandatory + && (! in_array($listfield[$f], array('decalage','module','accountancy_code_sell','accountancy_code_buy'))) // Fields that are not mandatory + ) { $ok=0; $fieldnamekey=$listfield[$f]; @@ -425,10 +426,10 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) $msg.=$langs->trans("ErrorFieldRequired",$langs->transnoentities($fieldnamekey)).'
'; } } - // Autres verif - if ($tabname[$id] == MAIN_DB_PREFIX."c_actioncomm" && isset($_POST["type"]) && $_POST["type"]=='system') { + // Other checks + if ($tabname[$id] == MAIN_DB_PREFIX."c_actioncomm" && isset($_POST["type"]) && in_array($_POST["type"],array('system','systemauto'))) { $ok=0; - $msg.="Value 'system' for type is reserved. You can use 'user' as value to add your own record.
"; + $msg.="Value 'system' and 'systemauto' for type is reserved. You can use 'user' as value to add your own record.
"; } if (isset($_POST["code"]) && $_POST["code"]=='0') { $ok=0; @@ -438,6 +439,9 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) $ok=0; $msg.=$langs->trans("ErrorFieldRequired",$langs->trans("Country")).'
'; } + // Clean some parameters + if (isset($_POST["localtax1"]) && empty($_POST["localtax1"])) $_POST["localtax1"]='0'; // If empty, we force to 0 + if (isset($_POST["localtax2"]) && empty($_POST["localtax2"])) $_POST["localtax2"]='0'; // If empty, we force to 0 // Si verif ok et action add, on ajoute la ligne if ($ok && GETPOST('actionadd')) @@ -658,19 +662,20 @@ if ($id) // Complete requete recherche valeurs avec critere de tri $sql=$tabsql[$id]; - if (GETPOST('sortfield')) + + if ($sortfield) { // If sort order is "pays", we use pays_code instead - if ($_GET["sortfield"] == 'pays') $_GET["sortfield"]='pays_code'; - $sql.= " ORDER BY ".$_GET["sortfield"]; - if ($_GET["sortorder"]) + if ($sortfield == 'pays') $sortfield='pays_code'; + $sql.= " ORDER BY ".$sortfield; + if ($sortorder) { - $sql.=" ".strtoupper($_GET["sortorder"]); + $sql.=" ".strtoupper($sortorder); } $sql.=", "; - // Remove from default sort order the choosed order - $tabsqlsort[$id]=preg_replace('/'.$_GET["sortfield"].' '.$_GET["sortorder"].',/i','',$tabsqlsort[$id]); - $tabsqlsort[$id]=preg_replace('/'.$_GET["sortfield"].',/i','',$tabsqlsort[$id]); + // Clear the required sort criteria for the tabsqlsort to be able to force it with selected value + $tabsqlsort[$id]=preg_replace('/([a-z]+\.)?'.$sortfield.' '.$sortorder.',/i','',$tabsqlsort[$id]); + $tabsqlsort[$id]=preg_replace('/([a-z]+\.)?'.$sortfield.',/i','',$tabsqlsort[$id]); } else { $sql.=" ORDER BY "; @@ -681,7 +686,7 @@ if ($id) $fieldlist=explode(',',$tabfield[$id]); - print ''; + print ''; print ''; print ''; @@ -705,10 +710,10 @@ if ($id) if ($fieldlist[$field]=='source') { $valuetoshow=$langs->trans("Contact"); } if ($fieldlist[$field]=='price') { $valuetoshow=$langs->trans("PriceUHT"); } if ($fieldlist[$field]=='taux') { $valuetoshow=$langs->trans("Rate"); } - if ($fieldlist[$field]=='localtax1') { $valuetoshow=$langs->trans("localtax1"); $align="right";} - if ($fieldlist[$field]=='localtax2') { $valuetoshow=$langs->trans("localtax2"); $align="right";} - if ($fieldlist[$field]=='localtax1_type') { $valuetoshow=$langs->trans("localtax_type"); $align="center";} - if ($fieldlist[$field]=='localtax2_type') { $valuetoshow=$langs->trans("localtax_type"); $align="center";} + if ($fieldlist[$field]=='localtax1_type') { $valuetoshow=$form->textwithtooltip($langs->trans("UseLocalTax")." 2",$langs->trans("LocalTaxDesc"),2,1,img_help(1,'')); $align="center"; $sortable=0; } + if ($fieldlist[$field]=='localtax1') { $valuetoshow=$langs->trans("Rate")." 2";} + if ($fieldlist[$field]=='localtax2_type') { $valuetoshow=$form->textwithtooltip($langs->trans("UseLocalTax")." 3",$langs->trans("LocalTaxDesc"),2,1,img_help(1,'')); $align="center"; $sortable=0; } + if ($fieldlist[$field]=='localtax2') { $valuetoshow=$langs->trans("Rate")." 3";} if ($fieldlist[$field]=='organization') { $valuetoshow=$langs->trans("Organization"); } if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); } if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); } @@ -719,7 +724,7 @@ if ($id) if (in_array('region_id',$fieldlist)) { print ''; continue; } // For region page, we do not show the country input $valuetoshow=$langs->trans("Country"); } - if ($fieldlist[$field]=='recuperableonly') { $valuetoshow=MAIN_LABEL_MENTION_NPR; } + if ($fieldlist[$field]=='recuperableonly') { $valuetoshow=MAIN_LABEL_MENTION_NPR; $align="center"; } if ($fieldlist[$field]=='nbjour') { $valuetoshow=$langs->trans("NbOfDays"); } if ($fieldlist[$field]=='fdm') { $valuetoshow=$langs->trans("AtEndOfMonth"); } if ($fieldlist[$field]=='decalage') { $valuetoshow=$langs->trans("Offset"); } @@ -727,7 +732,8 @@ if ($id) if ($fieldlist[$field]=='height') { $valuetoshow=$langs->trans("Height"); } if ($fieldlist[$field]=='unit') { $valuetoshow=$langs->trans("MeasuringUnit"); } if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='pays_id') { $valuetoshow=''; } - if ($fieldlist[$field]=='accountancy_code'){ $valuetoshow=$langs->trans("AccountancyCode"); } + if ($fieldlist[$field]=='accountancy_code_sell'){ $valuetoshow=$langs->trans("AccountancyCodeSell"); } + if ($fieldlist[$field]=='accountancy_code_buy'){ $valuetoshow=$langs->trans("AccountancyCodeBuy"); } if ($fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); } if ($fieldlist[$field]=='account_number') { $valuetoshow=$langs->trans("Account"); } if ($fieldlist[$field]=='account_parent') { $valuetoshow=$langs->trans("Accountparent"); } @@ -779,6 +785,7 @@ if ($id) print ''; } + print ''; // List of available values in database dol_syslog("htdocs/admin/dict sql=".$sql, LOG_DEBUG); @@ -805,24 +812,33 @@ if ($id) // Determine le nom du champ par rapport aux noms possibles // dans les dictionnaires de donnees $showfield=1; // Par defaut + $align="left"; + $sortable=1; + $valuetoshow=''; + /* + $tmparray=getLabelOfField($fieldlist[$field]); + $showfield=$tmp['showfield']; + $valuetoshow=$tmp['valuetoshow']; + $align=$tmp['align']; + $sortable=$tmp['sortable']; + */ $valuetoshow=ucfirst($fieldlist[$field]); // Par defaut $valuetoshow=$langs->trans($valuetoshow); // try to translate - $align="left"; if ($fieldlist[$field]=='source') { $valuetoshow=$langs->trans("Contact"); } if ($fieldlist[$field]=='price') { $valuetoshow=$langs->trans("PriceUHT"); } if ($fieldlist[$field]=='taux') { $valuetoshow=$langs->trans("Rate"); } - if ($fieldlist[$field]=='localtax1') { $valuetoshow=$langs->trans("localtax1"); $align="right";} - if ($fieldlist[$field]=='localtax2') { $valuetoshow=$langs->trans("localtax2"); $align="right";} - if ($fieldlist[$field]=='localtax1_type') { $valuetoshow=$langs->trans("localtax_type"); $align="center";} - if ($fieldlist[$field]=='localtax2_type') { $valuetoshow=$langs->trans("localtax_type"); $align="center";} + if ($fieldlist[$field]=='localtax1_type') { $valuetoshow=$form->textwithtooltip($langs->trans("UseLocalTax")." 2",$langs->trans("LocalTaxDesc"),2,1,img_help(1,'')); $align="center"; $sortable=0; } + if ($fieldlist[$field]=='localtax1') { $valuetoshow=$langs->trans("Rate")." 2"; $sortable=0; } + if ($fieldlist[$field]=='localtax2_type') { $valuetoshow=$form->textwithtooltip($langs->trans("UseLocalTax")." 3",$langs->trans("LocalTaxDesc"),2,1,img_help(1,'')); $align="center"; $sortable=0; } + if ($fieldlist[$field]=='localtax2') { $valuetoshow=$langs->trans("Rate")." 3"; $sortable=0; } if ($fieldlist[$field]=='organization') { $valuetoshow=$langs->trans("Organization"); } if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); } if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); } if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); } - if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label")."*"; } + if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label")."*"; } if ($fieldlist[$field]=='libelle_facture') { $valuetoshow=$langs->trans("LabelOnDocuments")."*"; } if ($fieldlist[$field]=='pays') { $valuetoshow=$langs->trans("Country"); } - if ($fieldlist[$field]=='recuperableonly') { $valuetoshow=MAIN_LABEL_MENTION_NPR; } + if ($fieldlist[$field]=='recuperableonly') { $valuetoshow=MAIN_LABEL_MENTION_NPR; $align="center"; } if ($fieldlist[$field]=='nbjour') { $valuetoshow=$langs->trans("NbOfDays"); } if ($fieldlist[$field]=='fdm') { $valuetoshow=$langs->trans("AtEndOfMonth"); } if ($fieldlist[$field]=='decalage') { $valuetoshow=$langs->trans("Offset"); } @@ -830,8 +846,9 @@ if ($id) if ($fieldlist[$field]=='height') { $valuetoshow=$langs->trans("Height"); } if ($fieldlist[$field]=='unit') { $valuetoshow=$langs->trans("MeasuringUnit"); } if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='pays_id') { $showfield=0; } - if ($fieldlist[$field]=='accountancy_code'){ $valuetoshow=$langs->trans("AccountancyCode"); } - if ($fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); } + if ($fieldlist[$field]=='accountancy_code_sell'){ $valuetoshow=$langs->trans("AccountancyCodeSell"); $sortable=0; } + if ($fieldlist[$field]=='accountancy_code_buy'){ $valuetoshow=$langs->trans("AccountancyCodeBuy"); $sortable=0; } + if ($fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); } if ($fieldlist[$field]=='account_number') { $valuetoshow=$langs->trans("Accounts"); } if ($fieldlist[$field]=='account_parent') { $valuetoshow=$langs->trans("Accountsparent"); } if ($fieldlist[$field]=='pcg_type') { $valuetoshow=$langs->trans("Pcg_type"); } @@ -839,26 +856,25 @@ if ($id) // Affiche nom du champ if ($showfield) { - print_liste_field_titre($valuetoshow,$_SERVER["PHP_SELF"],$fieldlist[$field],($page?'page='.$page.'&':'').'&id='.$id,"","align=".$align,$sortfield,$sortorder); + print getTitleFieldOfList($valuetoshow,0,$_SERVER["PHP_SELF"],($sortable?$fieldlist[$field]:''),($page?'page='.$page.'&':'').'&id='.$id,"","align=".$align,$sortfield,$sortorder); } } - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"active",($page?'page='.$page.'&':'').'&id='.$id,"",'align="center"',$sortfield,$sortorder); + print getTitleFieldOfList($langs->trans("Status"),0,$_SERVER["PHP_SELF"],"active",($page?'page='.$page.'&':'').'&id='.$id,"",'align="center"',$sortfield,$sortorder); print ''; print ''; // Lines with values while ($i < $num) { - $obj = $db->fetch_object($resql); - $var=!$var; - //print_r($obj); - print ""; + $var = ! $var; + $obj = $db->fetch_object($resql); + //print_r($obj); + print ''; if ($action == 'edit' && ($rowid == (! empty($obj->rowid)?$obj->rowid:$obj->code))) { - print ''; + print ''; print ''; - print ''; print ''; print ''; @@ -873,9 +889,9 @@ if ($id) print ' '; } else - { - $tmpaction = 'view'; - $parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); + { + $tmpaction = 'view'; + $parameters=array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); $reshook=$hookmanager->executeHooks('viewDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks $error=$hookmanager->error; $errors=$hookmanager->errors; @@ -889,11 +905,11 @@ if ($id) $valuetoshow=$obj->$fieldlist[$field]; if ($value == 'element') { - $valuetoshow = $elementList[$valuetoshow]; + $valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow; } else if ($value == 'source') { - $valuetoshow = $sourceList[$valuetoshow]; + $valuetoshow = isset($sourceList[$valuetoshow])?$sourceList[$valuetoshow]:$valuetoshow; } else if ($valuetoshow=='all') { $valuetoshow=$langs->trans('All'); @@ -911,6 +927,7 @@ if ($id) } else if ($fieldlist[$field]=='recuperableonly' || $fieldlist[$field]=='fdm' || $fieldlist[$field] == 'deductible') { $valuetoshow=yn($valuetoshow); + $align="center"; } else if ($fieldlist[$field]=='price' || preg_match('/^amount/i',$fieldlist[$field])) { $valuetoshow=price($valuetoshow); @@ -1007,12 +1024,14 @@ if ($id) $valuetoshow=$localtax_typeList[$valuetoshow]; else $valuetoshow = ''; + $align="center"; } else if ($fieldlist[$field]=='localtax2_type') { if ($obj->localtax2 != 0) $valuetoshow=$localtax_typeList[$valuetoshow]; else $valuetoshow = ''; + $align="center"; } else if ($fieldlist[$field]=='localtax1') { if ($obj->localtax1 == 0) @@ -1024,7 +1043,16 @@ if ($id) $valuetoshow = ''; $align="right"; } + else if (in_array($fieldlist[$field],array('taux','localtax1','localtax2'))) + { + $align="right"; + } + else if (in_array($fieldlist[$field],array('recuperableonly'))) + { + $align="center"; + } + // Show value for field if ($showfield) print ''; } } @@ -1035,7 +1063,7 @@ if ($id) if (isset($obj->code) && ($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i',$obj->code))) $iserasable=0; if (isset($obj->code) && $obj->code == 'RECEP') $iserasable=0; if (isset($obj->code) && $obj->code == 'EF0') $iserasable=0; - if (isset($obj->type) && $obj->type == 'system') $iserasable=0; + if (isset($obj->type) && in_array($obj->type, array('system', 'systemauto'))) $iserasable=0; if ($iserasable) print ''.$actl[$obj->active].''; else print $langs->trans("AlwaysActive"); @@ -1203,11 +1231,10 @@ function fieldList($fieldlist,$obj='',$tabname='') } elseif (in_array($fieldlist[$field],array('nbjour','decalage','taux','localtax1','localtax2'))) { $align="left"; - // Les taxes locales sont cadrées à droite - if ($fieldlist[$field] == 'localtax1' || $fieldlist[$field] == 'localtax2') - $align="right"; + if (in_array($fieldlist[$field],array('taux','localtax1','localtax2'))) $align="right"; // Fields aligned on right print ''; + print ''; + print ''; } elseif ($fieldlist[$field] == 'libelle_facture') { print ''; @@ -1231,14 +1258,18 @@ function fieldList($fieldlist,$obj='',$tabname='') // Le type de taxe locale elseif ($fieldlist[$field] == 'localtax1_type' || $fieldlist[$field] == 'localtax2_type') { - print ''; } else { print ''; } } diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php index 43814ccb377..d83a089c20c 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -206,7 +206,7 @@ $head[$h][1] = $langs->trans("Sending"); $hselected=$h; $h++; -if ($conf->global->MAIN_SUBMODULE_LIVRAISON) +if (! empty($conf->global->MAIN_SUBMODULE_LIVRAISON)) { $head[$h][0] = DOL_URL_ROOT."/admin/livraison.php"; $head[$h][1] = $langs->trans("Receivings"); diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index 3dbcbda8133..402bc7501cb 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -628,7 +628,7 @@ $var=!$var; print ''; print ""; print "'; print ''; print ''; @@ -234,10 +236,21 @@ if ($action == 'edit') // Edit print ''; print ''; + if ($conf->global->MAIN_FEATURES_LEVEL >= 1 || ! empty($conf->global->MAIN_BUGTRACK_ENABLELINK)) + { + // Show bugtrack link + $var=!$var; + print ''; + print ''; + print ''; + } + // Message on login page $var=!$var; print ''."\n"; - /* - // Show bugtrack link - $var=!$var; - print ''; - print ''; - print ''; - */ - print '
 
 
 
'.$valuetoshow.''; - print ''; - print $html->selectarray($fieldlist[$field], $localtax_typeList,$obj->$fieldlist[$field]); + print ''; + print $form->selectarray($fieldlist[$field], $localtax_typeList,$obj->$fieldlist[$field]); print ''; - print ''; + $size=''; + if ($fieldlist[$field]=='libelle') $size='size="32" '; + if ($fieldlist[$field]=='accountancy_code_sell') $size='size="15" '; + if ($fieldlist[$field]=='accountancy_code_buy') $size='size="15" '; + print ''; print '
".$langs->trans("SuggestPaymentByRIBOnAccount").""; -if ($conf->banque->enabled) +if (! empty($conf->banque->enabled)) { $sql = "SELECT rowid, label"; $sql.= " FROM ".MAIN_DB_PREFIX."bank_account"; diff --git a/htdocs/admin/fckeditor.php b/htdocs/admin/fckeditor.php index d1a4ff48f67..17d4ddca75f 100644 --- a/htdocs/admin/fckeditor.php +++ b/htdocs/admin/fckeditor.php @@ -69,7 +69,7 @@ foreach($modules as $const => $desc) { dolibarr_set_const($db, "FCKEDITOR_ENABLE_".$const, "1",'chaine',0,'',$conf->entity); // Si fckeditor est active dans la description produit/service, on l'active dans les formulaires - if ($const == 'PRODUCTDESC' && $conf->global->PRODUIT_DESC_IN_FORM) + if ($const == 'PRODUCTDESC' && ! empty($conf->global->PRODUIT_DESC_IN_FORM)) { dolibarr_set_const($db, "FCKEDITOR_ENABLE_DETAILS", "1",'chaine',0,'',$conf->entity); } diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index 0db18adcf80..84c160351bd 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -1,7 +1,7 @@ - * Copyright (C) 2004-2011 Laurent Destailleur - * Copyright (C) 2005-2010 Regis Houssin +/* Copyright (C) 2001-2005 Rodolphe Quiedeville + * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin * * 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 @@ -57,7 +57,6 @@ if ($action == 'update') dolibarr_set_const($db, "MAIN_MULTILANGS", $_POST["main_multilangs"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_SIZE_LISTE_LIMIT", $_POST["main_size_liste_limit"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_DISABLE_JAVASCRIPT", $_POST["main_disable_javascript"],'chaine',0,'',$conf->entity); - dolibarr_set_const($db, "MAIN_USE_PREVIEW_TABS", $_POST["main_use_preview_tabs"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_BUTTON_HIDE_UNAUTHORIZED", $_POST["MAIN_BUTTON_HIDE_UNAUTHORIZED"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_START_WEEK", $_POST["MAIN_START_WEEK"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_SHOW_LOGO", $_POST["MAIN_SHOW_LOGO"],'chaine',0,'',$conf->entity); @@ -74,7 +73,10 @@ if ($action == 'update') dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr($_POST["main_motd"]),'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_HOME", dol_htmlcleanlastbr($_POST["main_home"]),'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_HELP_DISABLELINK", $_POST["MAIN_HELP_DISABLELINK"],'chaine',0,'',0); // Param for all entities - dolibarr_set_const($db, "MAIN_BUGTRACK_ENABLELINK", $_POST["MAIN_BUGTRACK_ENABLELINK"],'chaine',0,'',$conf->entity); + + // This one is not always defined + if (isset($_POST["MAIN_USE_PREVIEW_TABS"])) dolibarr_set_const($db, "MAIN_USE_PREVIEW_TABS", $_POST["MAIN_USE_PREVIEW_TABS"],'chaine',0,'',$conf->entity); + if (isset($_POST["MAIN_BUGTRACK_ENABLELINK"])) dolibarr_set_const($db, "MAIN_BUGTRACK_ENABLELINK", $_POST["MAIN_BUGTRACK_ENABLELINK"],'chaine',0,'',$conf->entity); $_SESSION["mainmenu"]=""; // Le gestionnaire de menu a pu changer @@ -187,7 +189,7 @@ if ($action == 'edit') // Edit { $var=!$var; print '
'.$langs->trans("UsePreviewTabs").''; - print $form->selectyesno('main_use_preview_tabs',isset($conf->global->MAIN_USE_PREVIEW_TABS)?$conf->global->MAIN_USE_PREVIEW_TABS:0,1); + print $form->selectyesno('MAIN_USE_PREVIEW_TABS',isset($conf->global->MAIN_USE_PREVIEW_TABS)?$conf->global->MAIN_USE_PREVIEW_TABS:0,1); print ' 
 
'.$langs->trans("ShowBugTrackLink").''; + print $form->selectyesno('MAIN_BUGTRACK_ENABLELINK',$conf->global->MAIN_BUGTRACK_ENABLELINK,1); + print ' 
'.$langs->trans("MessageLogin").''; - + $doleditor = new DolEditor('main_home', (isset($conf->global->MAIN_HOME)?$conf->global->MAIN_HOME:''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, 90); $doleditor->Create(); @@ -246,22 +259,12 @@ if ($action == 'edit') // Edit // Message of the day on home page $var=!$var; print '
'.$langs->trans("MessageOfDay").''; - + $doleditor = new DolEditor('main_motd', (isset($conf->global->MAIN_MOTD)?$conf->global->MAIN_MOTD:''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, 90); $doleditor->Create(); print '
'.$langs->trans("ShowBugTrackLink").''; - print $form->selectyesno('main_show_bugtrack_link',$conf->global->MAIN_BUGTRACK_ENABLELINK,1); - print ' 
'."\n"; @@ -387,6 +390,16 @@ else // Show print yn((isset($conf->global->MAIN_HELP_DISABLELINK)?$conf->global->MAIN_HELP_DISABLELINK:0),1); print '
'.$langs->trans("ShowBugTrackLink").''; + print yn($conf->global->MAIN_BUGTRACK_ENABLELINK)." 
'.$langs->trans("MessageLogin").''; @@ -401,15 +414,6 @@ else // Show else print ' '; print '
'.$langs->trans("ShowBugTrackLink").''; - print yn($conf->global->MAIN_BUGTRACK_ENABLELINK)." 
'."\n"; print '
'; diff --git a/htdocs/admin/ldap.php b/htdocs/admin/ldap.php index ba4b76a7e2a..6cc42777343 100644 --- a/htdocs/admin/ldap.php +++ b/htdocs/admin/ldap.php @@ -124,7 +124,7 @@ if ($conf->global->LDAP_SYNCHRO_ACTIVE && ! $conf->global->LDAP_USER_DN) print '
'.$langs->trans("LDAPDnContactActive").''; @@ -136,7 +136,7 @@ if ($conf->societe->enabled) } // Synchro adherentt active -if ($conf->adherent->enabled) +if (! empty($conf->adherent->enabled)) { $var=!$var; print '
'.$langs->trans("LDAPDnMemberActive").''; @@ -189,7 +189,7 @@ print ''.$langs->trans("LDAPServerExample").'
'.$langs->trans("LDAPServerPort").''; -if ($conf->global->LDAP_SERVER_PORT) +if (! empty($conf->global->LDAP_SERVER_PORT)) { print ''; } @@ -227,7 +227,7 @@ print ''.$langs->trans("LDAPAdminDnExample").'
'.$langs->trans("LDAPPassword").''; -if ($conf->global->LDAP_ADMIN_PASS) +if (! empty($conf->global->LDAP_ADMIN_PASS)) { print '';// je le met en visible pour test } @@ -252,7 +252,7 @@ print ''; */ if (function_exists("ldap_connect")) { - if ($conf->global->LDAP_SERVER_HOST) + if (! empty($conf->global->LDAP_SERVER_HOST)) { print ''.$langs->trans("LDAPTestConnect").'

'; } @@ -269,7 +269,7 @@ if (function_exists("ldap_connect")) print ''.$langs->trans("LDAPTCPConnectOK",$conf->global->LDAP_SERVER_HOST,$conf->global->LDAP_SERVER_PORT).''; print '
'; - if ($conf->global->LDAP_ADMIN_DN && $conf->global->LDAP_ADMIN_PASS) + if ($conf->global->LDAP_ADMIN_DN && ! empty($conf->global->LDAP_ADMIN_PASS)) { if ($result == 2) { diff --git a/htdocs/admin/ldap_members.php b/htdocs/admin/ldap_members.php index 83dcb2c50c4..61a1b2fa3a7 100644 --- a/htdocs/admin/ldap_members.php +++ b/htdocs/admin/ldap_members.php @@ -373,7 +373,7 @@ print info_admin($langs->trans("LDAPDescValues")); /* * Test de la connexion */ -if ($conf->global->LDAP_MEMBER_ACTIVE) +if (! empty($conf->global->LDAP_MEMBER_ACTIVE)) { $butlabel=$langs->trans("LDAPTestSynchroMember"); $testlabel='testmember'; diff --git a/htdocs/admin/livraison.php b/htdocs/admin/livraison.php index 9a23e3f968d..8a9c4759568 100644 --- a/htdocs/admin/livraison.php +++ b/htdocs/admin/livraison.php @@ -189,7 +189,7 @@ $head[$h][0] = DOL_URL_ROOT."/admin/confexped.php"; $head[$h][1] = $langs->trans("Setup"); $h++; -if ($conf->global->MAIN_SUBMODULE_EXPEDITION) +if (! empty($conf->global->MAIN_SUBMODULE_EXPEDITION)) { $head[$h][0] = DOL_URL_ROOT."/admin/expedition.php"; $head[$h][1] = $langs->trans("Sending"); diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index b2341019ead..6d869ba7a78 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -627,7 +627,7 @@ else print ''.$langs->trans("DoTestSend").''; - if ($conf->fckeditor->enabled) + if (! empty($conf->fckeditor->enabled)) { print ''.$langs->trans("DoTestSendHTML").''; } diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 65ea4f5a700..99f85b40fc9 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -37,6 +37,8 @@ $action=GETPOST('action'); if (!$user->admin) accessforbidden(); +$specialtostring=array(0=>'common', 1=>'interfaces', 2=>'other', 3=>'functional', 4=>'marketplace'); + /* * Actions @@ -150,17 +152,22 @@ foreach ($modulesdir as $dir) // We discard modules according to features level (PS: if module is activated we always show it) $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',get_class($objMod))); - if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && empty($conf->global->$const_name)) $modulequalified=0; - if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && empty($conf->global->$const_name)) $modulequalified=0; + if ($objMod->version == 'development' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 2))) $modulequalified=0; + if ($objMod->version == 'experimental' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 1))) $modulequalified=0; + //if ($mode == 'expdev' && ($objMod->version != 'experimental' && $objMod->version != 'development')) $modulequalified=0; + // Define array $categ with categ with at least one qualified module if ($modulequalified) { $modules[$i] = $objMod; $filename[$i]= $modName; - $orders[$i] = $objMod->family."_".$j; // Tri par famille puis numero module - //print "x".$modName." ".$orders[$i]."\n
"; - if (isset($categ[$objMod->special])) $categ[$objMod->special]++; // Array of all different modules categories - else $categ[$objMod->special]=1; + $orders[$i] = $objMod->family."_".$j; // Sort by family, then by module number + $special = isset($specialtostring[$objMod->special])?$specialtostring[$objMod->special]:'unknown'; + if ($objMod->version == 'development' || $objMod->version == 'experimental') $special='expdev'; + + //print "x".$modName." ".$orders[$i]." ".$special."\n
"; + if (isset($categ[$special])) $categ[$special]++; // Array of all different modules categories + else $categ[$special]=1; $dirmod[$i] = $dir; $j++; $i++; @@ -188,12 +195,13 @@ asort($orders); //var_dump($modules); // Start to show page - -if ($mode==0) { $tagmode = 'common'; print $langs->trans("ModulesDesc")."
\n"; } -if ($mode==2) { $tagmode = 'other'; print $langs->trans("ModulesSpecialDesc")."
\n"; } -if ($mode==1) { $tagmode = 'interfaces'; print $langs->trans("ModulesInterfaceDesc")."
\n"; } -if ($mode==3) { $tagmode = 'functional'; print $langs->trans("ModulesJobDesc")."
\n"; } -if ($mode==4) { $tagmode = 'marketplace'; print $langs->trans("ModulesMarketPlaceDesc")."
\n"; } +if (empty($mode)) $mode='common'; +if ($mode==='common') print $langs->trans("ModulesDesc")."
\n"; +if ($mode==='other') print $langs->trans("ModulesSpecialDesc")."
\n"; +if ($mode==='interfaces') print $langs->trans("ModulesInterfaceDesc")."
\n"; +if ($mode==='functional') print $langs->trans("ModulesJobDesc")."
\n"; +if ($mode==='marketplace') print $langs->trans("ModulesMarketPlaceDesc")."
\n"; +if ($mode==='expdev') print $langs->trans("ModuleFamilyExperimental")."
\n"; $nbofactivatedmodules=count($conf->modules); print $langs->trans("TotalNumberOfActivatedModules",($nbofactivatedmodules-1)); @@ -204,7 +212,7 @@ print "
\n"; $h = 0; -$categidx=0; // Main +$categidx='common'; // Main if (! empty($categ[$categidx])) { $head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=".$categidx; @@ -213,7 +221,7 @@ if (! empty($categ[$categidx])) $h++; } -$categidx=2; // Other +$categidx='other'; // Other if (! empty($categ[$categidx])) { $head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=".$categidx; @@ -222,7 +230,7 @@ if (! empty($categ[$categidx])) $h++; } -$categidx=1; // Interfaces +$categidx='interfaces'; // Interfaces if (! empty($categ[$categidx])) { $head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=".$categidx; @@ -231,7 +239,7 @@ if (! empty($categ[$categidx])) $h++; } -$categidx=3; // Not used +$categidx='functional'; // Not used if (! empty($categ[$categidx])) { $head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=".$categidx; @@ -240,23 +248,31 @@ if (! empty($categ[$categidx])) $h++; } -$categidx=4; -//if (! empty($categ[$categidx])) -//{ +$categidx='expdev'; +if (! empty($categ[$categidx])) +{ + $form = new Form($db); + $categidx='expdev'; $head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=".$categidx; - $head[$h][1] = $langs->trans("ModulesMarketPlaces"); - $head[$h][2] = 'marketplace'; + $head[$h][1] = $form->textwithpicto($langs->trans("ModuleFamilyExperimental"), $langs->trans('DoNotUseInProduction'), 1, 'warning', '', 0, 3); + $head[$h][2] = 'expdev'; $h++; -//} +} + +$categidx='marketplace'; +$head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=".$categidx; +$head[$h][1] = $langs->trans("ModulesMarketPlaces"); +$head[$h][2] = 'marketplace'; +$h++; -dol_fiche_head($head, $tagmode, $langs->trans("Modules")); +dol_fiche_head($head, $mode, $langs->trans("Modules")); dol_htmloutput_errors($mesg); -if ($mode != 4) +if ($mode != 'marketplace') { print "\n"; //print "\n"; @@ -271,7 +287,7 @@ if ($mode != 4) print "\n"; - // Affichage liste modules + // Show list of modules $var=true; $oldfamily=''; @@ -295,9 +311,11 @@ if ($mode != 4) $modName = $filename[$key]; $objMod = $modules[$key]; - //var_dump($objMod); - if ($objMod->special != $mode) continue; // Discard if not for tab + //print $objMod->name." - ".$key." - ".$objMod->special.' - '.$objMod->version."
"; + if (($mode != (isset($specialtostring[$objMod->special])?$specialtostring[$objMod->special]:'unknown') && $mode != 'expdev') + || ($mode == 'expdev' && $objMod->version != 'development' && $objMod->version != 'experimental')) continue; // Discard if not for current tab + if (! $objMod->getName()) { dol_syslog("Error for module ".$key." - Property name of module looks empty", LOG_WARNING); @@ -327,8 +345,6 @@ if ($mode != 4) //print ""; } - if ($objMod->special == $mode) - { $atleastoneforfamily++; if ($family!=$oldfamily) @@ -453,7 +469,6 @@ if ($mode != 4) } print "\n"; - } } print "
yy".$oldfamily."-".$family."-".$atleastoneforfamily."
\n"; diff --git a/htdocs/admin/prelevement.php b/htdocs/admin/prelevement.php index bee489b5454..453acee46fe 100644 --- a/htdocs/admin/prelevement.php +++ b/htdocs/admin/prelevement.php @@ -160,7 +160,7 @@ print '
'; * Notifications */ -if ($conf->global->MAIN_MODULE_NOTIFICATION) +if (! empty($conf->global->MAIN_MODULE_NOTIFICATION)) { $langs->load("mails"); print_titre($langs->trans("Notifications")); diff --git a/htdocs/admin/security.php b/htdocs/admin/security.php index 5d1c218f6a3..4413ab2c51b 100644 --- a/htdocs/admin/security.php +++ b/htdocs/admin/security.php @@ -301,7 +301,7 @@ $var=!$var; print "
'.$langs->trans("DoNotStoreClearPassword").''; -if ($conf->global->DATABASE_PWD_ENCRYPTED) +if (! empty($conf->global->DATABASE_PWD_ENCRYPTED)) { print img_picto($langs->trans("Active"),'tick'); } @@ -312,7 +312,7 @@ if (! $conf->global->DATABASE_PWD_ENCRYPTED) print ''.$langs->trans("Activate").''; print "'; if ($allow_disable_encryption) diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index deb55ee311c..cc604597d17 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -133,7 +133,7 @@ print "  
 
'; diff --git a/htdocs/admin/system/dolibarr.php b/htdocs/admin/system/dolibarr.php index 95828249c00..8ad87f5112d 100644 --- a/htdocs/admin/system/dolibarr.php +++ b/htdocs/admin/system/dolibarr.php @@ -42,7 +42,7 @@ $form=new Form($db); llxHeader(); -print_fiche_titre("Dolibarr",'','setup'); +print_fiche_titre($langs->trans("InfoDolibarr"),'','setup'); // Version $var=true; @@ -178,10 +178,12 @@ print ''; // Parent company +/* $var=!$var; print ''."\n"; $var=!$var; print ''."\n"; +*/ // Client $var=!$var; $tz=(int) $_SESSION['dol_tz'] + (int) $_SESSION['dol_dst']; @@ -210,6 +212,163 @@ print '
  => dol_get_first_day(1970,1,fals $var=!$var; print '
  => dol_get_first_day(1970,1,true)'.dol_get_first_day(1970,1,true).'     (=> dol_print_date() or idate() of this value = '.dol_print_date(dol_get_first_day(1970,1,true),'dayhour').')
'.$langs->trans("CompanyTZ").''.$langs->trans("FeatureNotYetAvailable").'
  => '.$langs->trans("CompanyHour").''.$langs->trans("FeatureNotYetAvailable").'
  => '.$langs->trans("File encodin print '
'; print '
'; + + +// Parameters in conf.php file (when a parameter start with ?, it is shown only if defined) +$configfileparameters=array( + 'dolibarr_main_url_root' => $langs->trans("URLRoot"), + 'dolibarr_main_url_root_alt' => $langs->trans("URLRoot").' (alt)', + 'dolibarr_main_document_root'=> $langs->trans("DocumentRootServer"), + 'dolibarr_main_document_root_alt' => $langs->trans("DocumentRootServer").' (alt)', + 'dolibarr_main_data_root' => $langs->trans("DataRootServer"), + 'separator' => '', + 'dolibarr_main_db_host' => $langs->trans("DatabaseServer"), + 'dolibarr_main_db_port' => $langs->trans("DatabasePort"), + 'dolibarr_main_db_name' => $langs->trans("DatabaseName"), + 'dolibarr_main_db_type' => $langs->trans("DriverType"), + 'dolibarr_main_db_user' => $langs->trans("DatabaseUser"), + 'dolibarr_main_db_pass' => $langs->trans("DatabasePassword"), + 'dolibarr_main_db_character_set' => $langs->trans("DBStoringCharset"), + 'dolibarr_main_db_collation' => $langs->trans("DBSortingCollation"), + '?dolibarr_main_db_prefix' => $langs->trans("Prefix"), + 'separator' => '', + 'dolibarr_main_authentication' => $langs->trans("AuthenticationMode"), + 'separator'=> '', + '?dolibarr_main_auth_ldap_login_attribute' => 'dolibarr_main_auth_ldap_login_attribute', + '?dolibarr_main_auth_ldap_host' => 'dolibarr_main_auth_ldap_host', + '?dolibarr_main_auth_ldap_port' => 'dolibarr_main_auth_ldap_port', + '?dolibarr_main_auth_ldap_version' => 'dolibarr_main_auth_ldap_version', + '?dolibarr_main_auth_ldap_dn' => 'dolibarr_main_auth_ldap_dn', + '?dolibarr_main_auth_ldap_admin_login' => 'dolibarr_main_auth_ldap_admin_login', + '?dolibarr_main_auth_ldap_admin_pass' => 'dolibarr_main_auth_ldap_admin_pass', + '?dolibarr_main_auth_ldap_debug' => 'dolibarr_main_auth_ldap_debug', + 'separator' => '', + '?dolibarr_lib_ADODB_PATH' => 'dolibarr_lib_ADODB_PATH', + '?dolibarr_lib_TCPDF_PATH' => 'dolibarr_lib_TCPDF_PATH', + '?dolibarr_lib_FPDI_PATH' => 'dolibarr_lib_FPDI_PATH', + '?dolibarr_lib_NUSOAP_PATH' => 'dolibarr_lib_NUSOAP_PATH', + '?dolibarr_lib_PHPEXCEL_PATH' => 'dolibarr_lib_PHPEXCEL_PATH', + '?dolibarr_lib_GEOIP_PATH' => 'dolibarr_lib_GEOIP_PATH', + '?dolibarr_lib_ODTPHP_PATH' => 'dolibarr_lib_ODTPHP_PATH', + '?dolibarr_lib_ODTPHP_PATHTOPCLZIP' => 'dolibarr_lib_ODTPHP_PATHTOPCLZIP', + '?dolibarr_js_CKEDITOR' => 'dolibarr_js_CKEDITOR', + '?dolibarr_js_JQUERY' => 'dolibarr_js_JQUERY', + '?dolibarr_js_JQUERY_UI' => 'dolibarr_js_JQUERY_UI', + '?dolibarr_js_JQUERY_FLOT' => 'dolibarr_js_JQUERY_FLOT', + '?dolibarr_font_DOL_DEFAULT_TTF' => 'dolibarr_font_DOL_DEFAULT_TTF', + '?dolibarr_font_DOL_DEFAULT_TTF_BOLD' => 'dolibarr_font_DOL_DEFAULT_TTF_BOLD', + 'separator' => '', + '?dolibarr_mailing_limit_sendbyweb' => 'Limit nb of email sent by page', + '?dolibarr_strict_mode' => 'Strict mode is on/off' +); + +$var=true; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''."\n"; + +foreach($configfileparameters as $key => $value) +{ + $ignore=0; + + if ($key == 'dolibarr_main_url_root_alt' && empty(${$key})) $ignore=1; + if ($key == 'dolibarr_main_document_root_alt' && empty(${$key})) $ignore=1; + + if (empty($ignore)) + { + $newkey = preg_replace('/^\?/','',$key); + + if (preg_match('/^\?/',$key) && empty(${$newkey})) continue; // We discard parametes starting with ? + if ($newkey == 'separator' && $lastkeyshown == 'separator') continue; + + $var=!$var; + print ""; + if ($newkey == 'separator') + { + print ''; + } + else + { + // Label + print "'; + // Key + print ''; + // Value + print ""; + } + print "\n"; + $lastkeyshown=$newkey; + } +} +print '
'.$langs->trans("Parameters").' '; +print $langs->trans("ConfigurationFile").' ('.$conffiletoshowshort.')'; +print ''.$langs->trans("Parameter").''.$langs->trans("Value").'
 ".$value.''.$newkey.'"; + if ($newkey == 'dolibarr_main_db_pass') print preg_replace('/./i','*',${$newkey}); + else if ($newkey == 'dolibarr_main_url_root' && preg_match('/__auto__/',${$newkey})) print ${$newkey}.' => '.constant('DOL_MAIN_URL_ROOT'); + else if ($newkey == 'dolibarr_main_url_root_alt' && preg_match('/__auto__/',${$newkey})) print ${$newkey}.' => '.constant('DOL_MAIN_URL_ROOT_ALT'); + else print ${$newkey}; + if ($newkey == 'dolibarr_main_url_root' && $newkey != DOL_MAIN_URL_ROOT) print ' (currently used by autodetect: '.DOL_MAIN_URL_ROOT.')'; + print "
'; +print '
'; + + + +// Parameters in database +print ''; +print ''; +print ''; +print ''; +if (empty($conf->multicompany->enabled) || !$user->entity) print ''; // If superadmin or multicompany disabled +print "\n"; + +$sql = "SELECT"; +$sql.= " rowid"; +$sql.= ", ".$db->decrypt('name')." as name"; +$sql.= ", ".$db->decrypt('value')." as value"; +$sql.= ", type"; +$sql.= ", note"; +$sql.= ", entity"; +$sql.= " FROM ".MAIN_DB_PREFIX."const"; +if (empty($conf->multicompany->enabled)) +{ + // If no multicompany mode, admins can see global and their constantes + $sql.= " WHERE entity IN (0,".$conf->entity.")"; +} +else +{ + // If multicompany mode, superadmin (user->entity=0) can see everything, admin are limited to their entities. + if ($user->entity) $sql.= " WHERE entity IN (".$user->entity.",".$conf->entity.")"; +} +$sql.= " ORDER BY entity, name ASC"; +$resql = $db->query($sql); +if ($resql) +{ + $num = $db->num_rows($resql); + $i = 0; + $var=True; + + while ($i < $num) + { + $obj = $db->fetch_object($resql); + $var=!$var; + + print ''; + print ''."\n"; + print ''."\n"; + if (empty($conf->multicompany->enabled) || !$user->entity) print ''."\n"; // If superadmin or multicompany disabled + print "\n"; + + $i++; + } +} + +print '
'.$langs->trans("Parameters").' '.$langs->trans("Database").''.$langs->trans("Value").''.$langs->trans("Entity").'
'.$obj->name.''.$obj->value.''.$obj->entity.'
'; + + + llxFooter(); $db->close(); diff --git a/htdocs/admin/system/os.php b/htdocs/admin/system/os.php index be2f6151e64..c6ade1e04a0 100644 --- a/htdocs/admin/system/os.php +++ b/htdocs/admin/system/os.php @@ -35,7 +35,7 @@ if (!$user->admin) llxHeader(); -print_fiche_titre("OS",'','setup'); +print_fiche_titre($langs->trans("InfoOS"),'','setup'); print ''; print ''; diff --git a/htdocs/admin/system/phpinfo.php b/htdocs/admin/system/phpinfo.php index db4630535de..13b7cef0c09 100644 --- a/htdocs/admin/system/phpinfo.php +++ b/htdocs/admin/system/phpinfo.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2005 Laurent Destailleur + * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -23,13 +23,13 @@ */ require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; $langs->load("admin"); if (! $user->admin) accessforbidden(); -$what=GETPOST('what','alpha'); /* @@ -38,85 +38,63 @@ $what=GETPOST('what','alpha'); llxHeader(); -/* Style phpinfo - body {background-color: #ffffff; color: #000000;} - body, td, th, h1, h2 {font-family: sans-serif;} - pre {margin: 0px; font-family: monospace;} +$title='InfoPHP'; - a:link {color: #000099; text-decoration: none; background-color: #ffffff;} - a:hover {text-decoration: underline;} - table {border-collapse: collapse;} - .center {text-align: center;} - .center table { margin-left: auto; margin-right: auto; text-align: left;} - .center th { text-align: center !important; } +if (isset($title)) +{ + print_fiche_titre($langs->trans($title), '', 'setup'); +} - td, th { border: 1px solid #000000; font-size: 75%; vertical-align: baseline;} - h1 {font-size: 150%;} - h2 {font-size: 125%;} - .p {text-align: left;} - .e {background-color: #ccccff; font-weight: bold; color: #000000;} - .h {background-color: #9999cc; font-weight: bold; color: #000000;} - .v {background-color: #cccccc; color: #000000;} - .vr {background-color: #cccccc; text-align: right; color: #000000;} - img {float: right; border: 0px;} - hr {width: 600px; background-color: #cccccc; border: 0px; height: 1px; color: #000000;} - */ - -ob_start(); - -if ($what == 'conf') +// Get php_info array +$phparray=phpinfo_array(); +foreach($phparray as $key => $value) { - $title = 'Setup'; - phpinfo(INFO_CONFIGURATION); -} -elseif ($what == 'env') -{ - $title = 'OSEnv'; - phpinfo(INFO_ENVIRONMENT); -} -elseif ($what == 'modules') -{ - $title = 'Modules'; - phpinfo(INFO_MODULES); -} -else -{ - phpinfo(); -} + //print_titre($key); + print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; + print ''; + //print ''; + print ''; + print ''; + print "\n"; -$chaine = ob_get_contents(); -ob_end_clean(); - -// Nettoie la sortie php pour inclusion dans une page deja existante -$chaine = preg_replace('/^/ims', '', $chaine); -$chaine = preg_replace('/<\/div><\/body><\/html>$/im', '', $chaine); -$chaine = preg_replace('/table(.*)important; \}/i','',$chaine); -$chaine = str_replace('
', '', $chaine); -$chaine = str_replace('cellpadding="3" ', 'cellpadding="1" cellspacing="1" ', $chaine); -$chaine = str_replace('class="h"','class="liste_titre"', $chaine); -$chaine = str_replace(''; + print ''; + $valtoshow=$keyvalue; + if ($keyparam == 'X-ChromePhp-Data') $valtoshow=dol_trunc($keyvalue,80); + print ''; + print ''; + } + else + { + $var=!$var; + print ''; + print ''; + $i=0; + foreach($keyvalue as $keyparam2 => $keyvalue2) + { + print ''; + } + print ''; + } + } + print '
'.$langs->trans("Parameter").''.$key.''.$langs->trans("Value").'
', '', $chaine); -$chaine = str_replace('th>', 'td>', $chaine); -// Titles -$chaine = preg_replace('/]*)>/i','
',$chaine); -$chaine = str_replace('

', '
', $chaine); -$chaine = str_replace('

', '

', $chaine); -$chaine = str_replace('', '', $chaine); - -$chaine = str_replace('
', '', $chaine); -$chaine = str_replace('', '', $chaine); -$chaine = str_replace('
Configuration

', '', $chaine); -// Add LF -$chaine = preg_replace('/(pcntl_[a-z]+),/','$1, ',$chaine); - -if (isset($title)) -{ - print_fiche_titre($langs->trans($title), '', 'setup'); - print '
'; + $var=true; + //var_dump($value); + foreach($value as $keyparam => $keyvalue) + { + if (! is_array($keyvalue)) + { + $var=!$var; + print '
'.$keyparam.''.$valtoshow.'
'.$keyparam.''; + $valtoshow=$keyvalue2; + if ($keyparam == 'disable_functions') $valtoshow=join(', ',explode(',',trim($valtoshow))); + //print $keyparam2.' = '; + print $valtoshow; + $i++; + print '

'; } - -print "$chaine\n"; // Ne pas centrer la reponse php car certains tableau du bas tres large rendent ceux du haut completement a droite -print "
\n"; + llxFooter(); + $db->close(); ?> \ No newline at end of file diff --git a/htdocs/admin/system/web.php b/htdocs/admin/system/web.php index fe8ee87a8e4..640e85624b8 100644 --- a/htdocs/admin/system/web.php +++ b/htdocs/admin/system/web.php @@ -42,7 +42,7 @@ if (!$user->admin) accessforbidden(); llxHeader(); -print_fiche_titre($langs->trans("WebServer"),'','setup'); +print_fiche_titre($langs->trans("InfoWebServer"),'','setup'); print ''; print "\n"; diff --git a/htdocs/admin/tools/purge.php b/htdocs/admin/tools/purge.php index b835b4a5953..46eebf3f299 100644 --- a/htdocs/admin/tools/purge.php +++ b/htdocs/admin/tools/purge.php @@ -36,7 +36,7 @@ $choice=GETPOST('choice'); // Define filelog to discard it from purge $filelog=''; -if ($conf->syslog->enabled) +if (! empty($conf->syslog->enabled)) { $filelog=SYSLOG_FILE; $filelog=preg_replace('/DOL_DATA_ROOT/i',DOL_DATA_ROOT,$filelog); @@ -131,7 +131,7 @@ print '
".$langs->trans("Parameter")."".$langs->trans("Value")."
'; print ''; -if ($conf->banque->enabled) +if (! empty($conf->banque->enabled)) { $var=!$var; print ''; @@ -126,7 +126,7 @@ if ($conf->banque->enabled) print ''; } -if ($conf->stock->enabled) +if (! empty($conf->stock->enabled)) { $var=!$var; print ''; @@ -135,7 +135,7 @@ if ($conf->stock->enabled) print ''; } -if ($conf->service->enabled) +if (! empty($conf->service->enabled)) { $var=! $var; print ''; print "\n"; -if ($conf->stock->enabled) +if (! empty($conf->stock->enabled)) { $langs->load("stocks"); print ""; diff --git a/htdocs/cashdesk/index_verif.php b/htdocs/cashdesk/index_verif.php index d71b2cb866f..0b42d4a78fd 100644 --- a/htdocs/cashdesk/index_verif.php +++ b/htdocs/cashdesk/index_verif.php @@ -49,14 +49,14 @@ if (! ($thirdpartyid > 0)) } // If we setup stock module to ask movement on invoices, we must not allow access if required setup not finished. -if ($conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_BILL && ! ($warehouseid > 0)) +if (! empty($conf->stock->enabled) && $conf->global->STOCK_CALCULATE_ON_BILL && ! ($warehouseid > 0)) { $retour=$langs->trans("CashDeskSetupStock"); header('Location: '.DOL_URL_ROOT.'/cashdesk/index.php?err='.urlencode($retour).'&user='.$username.'&socid='.$thirdpartyid.'&warehouseid='.$warehouseid); exit; } -if (! empty($_POST['txtUsername']) && $conf->banque->enabled && (empty($conf_fkaccount_cash) || empty($conf_fkaccount_cheque) || empty($conf_fkaccount_cb))) +if (! empty($_POST['txtUsername']) && ! empty($conf->banque->enabled) && (empty($conf_fkaccount_cash) || empty($conf_fkaccount_cheque) || empty($conf_fkaccount_cb))) { $langs->load("errors"); $retour=$langs->trans("ErrorModuleSetupNotComplete"); diff --git a/htdocs/cashdesk/tpl/facturation1.tpl.php b/htdocs/cashdesk/tpl/facturation1.tpl.php index fc1a3f431c5..ec465c4bd6b 100644 --- a/htdocs/cashdesk/tpl/facturation1.tpl.php +++ b/htdocs/cashdesk/tpl/facturation1.tpl.php @@ -74,7 +74,7 @@ $langs->load("cashdesk"); $label = $tab_designations[$i]['label']; print ''."\n "; } @@ -92,7 +92,7 @@ $langs->load("cashdesk"); $label = $tab_designations[$i]['label']; print ''."\n "; } diff --git a/htdocs/cashdesk/tpl/menu.tpl.php b/htdocs/cashdesk/tpl/menu.tpl.php index ba9767e5983..b1cdf424f89 100644 --- a/htdocs/cashdesk/tpl/menu.tpl.php +++ b/htdocs/cashdesk/tpl/menu.tpl.php @@ -48,7 +48,7 @@ if (!empty($conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE)) $bankcheque->fetch($conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE); $bankchequeLink = $bankcheque->getNomUrl(1); } -if (!empty($_SESSION["CASHDESK_ID_WAREHOUSE"]) && $conf->stock->enabled) +if (!empty($_SESSION["CASHDESK_ID_WAREHOUSE"]) && ! empty($conf->stock->enabled)) { $warehouse=new Entrepot($db); $warehouse->fetch($_SESSION["CASHDESK_ID_WAREHOUSE"]); @@ -72,7 +72,7 @@ print $langs->trans("CashDeskThirdParty").': '.$companyLink.'
'; /*print $langs->trans("CashDeskBankCash").': '.$bankcashLink.'
'; print $langs->trans("CashDeskBankCB").': '.$bankcbLink.'
'; print $langs->trans("CashDeskBankCheque").': '.$bankchequeLink.'
';*/ -if (!empty($_SESSION["CASHDESK_ID_WAREHOUSE"]) && $conf->stock->enabled) +if (!empty($_SESSION["CASHDESK_ID_WAREHOUSE"]) && ! empty($conf->stock->enabled)) { print $langs->trans("CashDeskWarehouse").': '.$warehouseLink; } diff --git a/htdocs/cashdesk/validation_verif.php b/htdocs/cashdesk/validation_verif.php index fcd8eda6873..bb1df0af089 100644 --- a/htdocs/cashdesk/validation_verif.php +++ b/htdocs/cashdesk/validation_verif.php @@ -161,7 +161,7 @@ switch ($action) $product->fetch($tab_liste[$i]['fk_article']); $ret=array('label'=>$product->label,'tva_tx'=>$product->tva_tx,'price'=>$product->price); - if ($conf->global->PRODUIT_MULTIPRICES) + if (! empty($conf->global->PRODUIT_MULTIPRICES)) { if (isset($product->multiprices[$societe->price_level])) { diff --git a/htdocs/categories/categorie.php b/htdocs/categories/categorie.php index a50a3a53896..a69ded5360d 100644 --- a/htdocs/categories/categorie.php +++ b/htdocs/categories/categorie.php @@ -182,7 +182,7 @@ if ($socid) require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; $langs->load("companies"); - if ($conf->notification->enabled) $langs->load("mails"); + if (! empty($conf->notification->enabled)) $langs->load("mails"); $soc = new Societe($db); $result = $soc->fetch($socid); @@ -363,7 +363,7 @@ else if ($id || $ref) $rowspan=5; if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) $rowspan+=1; - if ($conf->societe->enabled) $rowspan++; + if (! empty($conf->societe->enabled)) $rowspan++; print '
'; -if ($conf->syslog->enabled) +if (! empty($conf->syslog->enabled)) { print 'clicktodial->enabled) +if (empty($conf->clicktodial->enabled)) { accessforbidden(); exit; diff --git a/htdocs/cashdesk/admin/cashdesk.php b/htdocs/cashdesk/admin/cashdesk.php index ddc72aa795a..af642f4bc3d 100644 --- a/htdocs/cashdesk/admin/cashdesk.php +++ b/htdocs/cashdesk/admin/cashdesk.php @@ -105,7 +105,7 @@ print '
'.$langs->trans("CashDeskThirdPartyFo print ''; print $form->select_company($conf->global->CASHDESK_ID_THIRDPARTY,'socid','s.client in (1,3)',1,1); print '
'.$langs->trans("CashDeskBankAccountForSell").'
'.$langs->trans("CashDeskIdWareHouse").'
'; diff --git a/htdocs/cashdesk/class/Facturation.class.php b/htdocs/cashdesk/class/Facturation.class.php index fb072f27d33..af0b033d81f 100644 --- a/htdocs/cashdesk/class/Facturation.class.php +++ b/htdocs/cashdesk/class/Facturation.class.php @@ -144,7 +144,7 @@ class Facturation $newcartarray[$i]['price']=$product->price; $newcartarray[$i]['price_ttc']=$product->price_ttc; - if ($conf->global->PRODUIT_MULTIPRICES) + if (! empty($conf->global->PRODUIT_MULTIPRICES)) { if (isset($product->multiprices[$societe->price_level])) { diff --git a/htdocs/cashdesk/facturation.php b/htdocs/cashdesk/facturation.php index 3d1f28768bf..09c1353e7e9 100644 --- a/htdocs/cashdesk/facturation.php +++ b/htdocs/cashdesk/facturation.php @@ -30,14 +30,14 @@ if ( $_GET['filtre'] ) { $ret=array(); $i=0; $sql = "SELECT p.rowid, p.ref, p.label, p.tva_tx, p.fk_product_type"; - if ($conf->stock->enabled && !empty($conf_fkentrepot)) $sql.= ", ps.reel"; + if (! empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql.= ", ps.reel"; $sql.= " FROM ".MAIN_DB_PREFIX."product as p"; - if ($conf->stock->enabled && !empty($conf_fkentrepot)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot = '".$conf_fkentrepot."'"; + if (! empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot = '".$conf_fkentrepot."'"; $sql.= " WHERE p.entity IN (".getEntity('product', 1).")"; $sql.= " AND p.tosell = 1"; if(!$conf->global->CASHDESK_SERVICES) $sql.= " AND p.fk_product_type = 0"; $sql.= " AND (p.ref LIKE '%".$_GET['filtre']."%' OR p.label LIKE '%".$_GET['filtre']."%' "; - if ($conf->barcode->enabled) $sql.= " OR p.barcode LIKE '%".$_GET['filtre']."%')"; + if (! empty($conf->barcode->enabled)) $sql.= " OR p.barcode LIKE '%".$_GET['filtre']."%')"; else $sql.= ")"; $sql.= " ORDER BY label"; @@ -67,9 +67,9 @@ if ( $_GET['filtre'] ) { $i=0; $sql = "SELECT p.rowid, ref, label, tva_tx, p.fk_product_type"; - if ($conf->stock->enabled && !empty($conf_fkentrepot)) $sql.= ", ps.reel"; + if (! empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql.= ", ps.reel"; $sql.= " FROM ".MAIN_DB_PREFIX."product as p"; - if ($conf->stock->enabled && !empty($conf_fkentrepot)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot = '".$conf_fkentrepot."'"; + if (! empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot = '".$conf_fkentrepot."'"; $sql.= " WHERE p.entity IN (".getEntity('product', 1).")"; $sql.= " AND p.tosell = 1"; if(!$conf->global->CASHDESK_SERVICES) $sql.= " AND p.fk_product_type = 0"; diff --git a/htdocs/cashdesk/facturation_dhtml.php b/htdocs/cashdesk/facturation_dhtml.php index d327b2af07c..911aae6a576 100644 --- a/htdocs/cashdesk/facturation_dhtml.php +++ b/htdocs/cashdesk/facturation_dhtml.php @@ -44,9 +44,9 @@ header("Content-type: text/html; charset=".$conf->file->character_set_client); if (dol_strlen($_GET["code"]) >= 0) // If search criteria is on char length at least { $sql = "SELECT p.rowid, p.ref, p.label, p.tva_tx"; - if ($conf->stock->enabled && !empty($conf_fkentrepot)) $sql.= ", ps.reel"; + if (! empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql.= ", ps.reel"; $sql.= " FROM ".MAIN_DB_PREFIX."product as p"; - if ($conf->stock->enabled && !empty($conf_fkentrepot)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot = '".$conf_fkentrepot."'"; + if (! empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot = '".$conf_fkentrepot."'"; $sql.= " WHERE p.entity IN (".getEntity('product', 1).")"; $sql.= " AND p.tosell = 1"; $sql.= " AND p.fk_product_type = 0"; diff --git a/htdocs/cashdesk/facturation_verif.php b/htdocs/cashdesk/facturation_verif.php index 86be5906cc4..ea2700e9a22 100644 --- a/htdocs/cashdesk/facturation_verif.php +++ b/htdocs/cashdesk/facturation_verif.php @@ -32,9 +32,9 @@ switch ( $_GET['action'] ) if ( $_POST['hdnSource'] != 'NULL' ) { $sql = "SELECT p.rowid, p.ref, p.price, p.tva_tx"; - if ($conf->stock->enabled && !empty($conf_fkentrepot)) $sql.= ", ps.reel"; + if (! empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql.= ", ps.reel"; $sql.= " FROM ".MAIN_DB_PREFIX."product as p"; - if ($conf->stock->enabled && !empty($conf_fkentrepot)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot = ".$conf_fkentrepot; + if (! empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot = ".$conf_fkentrepot; $sql.= " WHERE p.entity IN (".getEntity('product', 1).")"; // Recuperation des donnees en fonction de la source (liste deroulante ou champ texte) ... @@ -62,7 +62,7 @@ switch ( $_GET['action'] ) } /** add Ditto for MultiPrix*/ - if ($conf->global->PRODUIT_MULTIPRICES) + if (! empty($conf->global->PRODUIT_MULTIPRICES)) { $thirdpartyid = $_SESSION['CASHDESK_ID_THIRDPARTY']; $productid = $ret['rowid']; diff --git a/htdocs/cashdesk/index.php b/htdocs/cashdesk/index.php index 4fe0a225e3f..3dac2d0f57d 100644 --- a/htdocs/cashdesk/index.php +++ b/htdocs/cashdesk/index.php @@ -98,7 +98,7 @@ print $form->select_company(GETPOST('socid','int')?GETPOST('socid','int'):$conf- print '
'; diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 34adae9b9d0..abf85d69cde 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -147,7 +147,7 @@ class Categorie dol_syslog(get_class($this).'::create sql='.$sql); $sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie (label, description,"; - if ($conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER) + if (! empty($conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER)) { $sql.= "fk_soc,"; } @@ -157,7 +157,7 @@ class Categorie //$sql.= ", fk_parent_id"; $sql.= ")"; $sql.= " VALUES ('".$this->db->escape($this->label)."', '".$this->db->escape($this->description)."',"; - if ($conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER) + if (! empty($conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER)) { $sql.= ($this->socid != -1 ? $this->socid : 'null').","; } @@ -269,7 +269,7 @@ class Categorie { $sql .= ", description = '".$this->db->escape($this->description)."'"; } - if ($conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER) + if (! empty($conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER)) { $sql .= ", fk_soc = ".($this->socid != -1 ? $this->socid : 'null'); } diff --git a/htdocs/categories/photos.php b/htdocs/categories/photos.php index 36bd186c627..5e1598fcc4c 100644 --- a/htdocs/categories/photos.php +++ b/htdocs/categories/photos.php @@ -129,7 +129,7 @@ if ($object->id) print ''; // Visibility - /* if ($type == 0 && $conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER) + /* if ($type == 0 && ! empty($conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER)) { if ($object->socid) { diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index ba9f8658784..f4ad2f6f078 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -96,13 +96,14 @@ class CActionComm } /** - * Return list of event types + * Return list of event types * - * @param int $active 1 or 0 to filter on event state active or not ('' by default = no filter) - * @param string $idorcode 'id' or 'code' - * @return array Array of all event types if OK, <0 if KO + * @param int $active 1 or 0 to filter on event state active or not ('' by default = no filter) + * @param string $idorcode 'id' or 'code' + * @param string $excludetype Type to exclude + * @return array Array of all event types if OK, <0 if KO */ - function liste_array($active='',$idorcode='id') + function liste_array($active='',$idorcode='id',$excludetype='') { global $langs,$conf; $langs->load("commercial"); @@ -112,10 +113,8 @@ class CActionComm $sql = "SELECT id, code, libelle, module"; $sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm"; - if ($active != '') - { - $sql.=" WHERE active=".$active; - } + if ($active != '') $sql.=" WHERE active=".$active; + if (! empty($excludetype)) $sql.=($active != ''?" AND":" WHERE")." type <> '".$excludetype."'"; $sql.= " ORDER BY module, position"; dol_syslog(get_class($this)."::liste_array sql=".$sql); diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index bde511d28ff..7fa1a71c5f3 100755 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; -if ($conf->projet->enabled) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; +if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; $langs->load("companies"); $langs->load("commercial"); @@ -222,7 +222,7 @@ if ($objectid > 0) print ''; // Project - if ($conf->projet->enabled) + if (! empty($conf->projet->enabled)) { print ''; @@ -760,7 +760,7 @@ if ($id) print ''; // Project - if ($conf->projet->enabled) + if (! empty($conf->projet->enabled)) { // Projet associe $langs->load("project"); @@ -927,7 +927,7 @@ if ($id) print ''; // Project - if ($conf->projet->enabled) + if (! empty($conf->projet->enabled)) { print '"; // Project - if ($conf->projet->enabled) + if (! empty($conf->projet->enabled)) { $projectid = 0; if ($origin == 'project') $projectid = ($originid?$originid:0); @@ -294,7 +294,7 @@ if ($action == 'create') } print ''; - if ($conf->global->PRODUCT_SHOW_WHEN_CREATE) print ''; + if (! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) print ''; print ''; print ''; @@ -303,7 +303,7 @@ if ($action == 'create') if (! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) { print ''; // Multiprice level - if ($conf->global->PRODUIT_MULTIPRICES) + if (! empty($conf->global->PRODUIT_MULTIPRICES)) { print ''; @@ -334,7 +334,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propale->lire) $filename=dol_sanitizeFileName($obj->ref); $filedir=$conf->propal->dir_output . '/' . dol_sanitizeFileName($obj->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->propalid; - $formfile->show_documents('propal',$filename,$filedir,$urlsource,'','','',1,'',1); + print $formfile->getDocumentsLink($propalstatic->element, $filename, $filedir); print '
'.$langs->trans("Project").''; if ($act->fk_project) diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index 837a995c966..be4f27a141c 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -450,7 +450,7 @@ if ($action == 'create') } else { - $htmlactions->select_type_actions($actioncomm->type_code, "actioncode"); + $htmlactions->select_type_actions($actioncomm->type_code, "actioncode","systemauto"); } print '
'.$langs->trans("Project").''; if ($act->fk_project) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index bf0f58e5843..abd61760e75 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php'; -if ($conf->projet->enabled) require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; +if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW=3; diff --git a/htdocs/comm/addpropal.php b/htdocs/comm/addpropal.php index 69adcb1bd9e..52f63e172a7 100644 --- a/htdocs/comm/addpropal.php +++ b/htdocs/comm/addpropal.php @@ -212,7 +212,7 @@ if ($action == 'create') print "
 
 
'.$langs->trans("CreateEmptyPropal").'
'; - if ($conf->product->enabled || $conf->service->enabled) + if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) { $lib=$langs->trans("ProductsAndServices"); diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php index f5b3b5a611b..889f13c635e 100644 --- a/htdocs/comm/fiche.php +++ b/htdocs/comm/fiche.php @@ -31,20 +31,20 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; -if ($conf->facture->enabled) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; -if ($conf->propal->enabled) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; -if ($conf->commande->enabled) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; -if ($conf->contrat->enabled) require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; -if ($conf->adherent->enabled) require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; -if ($conf->ficheinter->enabled) require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; +if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; +if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; +if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; +if (! empty($conf->contrat->enabled)) require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; +if (! empty($conf->adherent->enabled)) require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; +if (! empty($conf->ficheinter->enabled)) require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; $langs->load("companies"); -if ($conf->contrat->enabled) $langs->load("contracts"); -if ($conf->commande->enabled) $langs->load("orders"); -if ($conf->facture->enabled) $langs->load("bills"); -if ($conf->projet->enabled) $langs->load("projects"); -if ($conf->ficheinter->enabled) $langs->load("interventions"); -if ($conf->notification->enabled) $langs->load("mails"); +if (! empty($conf->contrat->enabled)) $langs->load("contracts"); +if (! empty($conf->commande->enabled)) $langs->load("orders"); +if (! empty($conf->facture->enabled)) $langs->load("bills"); +if (! empty($conf->projet->enabled)) $langs->load("projects"); +if (! empty($conf->ficheinter->enabled)) $langs->load("interventions"); +if (! empty($conf->notification->enabled)) $langs->load("mails"); // Security check $id = (GETPOST('socid','int') ? GETPOST('socid','int') : GETPOST('id','int')); @@ -345,7 +345,7 @@ if ($id > 0) print '
'; print '"; diff --git a/htdocs/comm/list.php b/htdocs/comm/list.php index f7da122ad49..da457735f9a 100755 --- a/htdocs/comm/list.php +++ b/htdocs/comm/list.php @@ -145,7 +145,7 @@ if ($result) // Filter on categories $moreforfilter=''; - if ($conf->categorie->enabled) + if (! empty($conf->categorie->enabled)) { $moreforfilter.=$langs->trans('Categories'). ': '; $moreforfilter.=$formother->select_categories(2,$search_categ,'search_categ',1); diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index fc9894caf6d..2081bda8cbb 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -178,7 +178,7 @@ if ($object->fetch($id) >= 0) print '
'; @@ -364,7 +364,7 @@ if ($id > 0) include DOL_DOCUMENT_ROOT.'/societe/tpl/linesalesrepresentative.tpl.php'; // Module Adherent - if ($conf->adherent->enabled) + if (! empty($conf->adherent->enabled)) { $langs->load("members"); $langs->load("users"); @@ -410,7 +410,7 @@ if ($id > 0) /* * Last proposals */ - if ($conf->propal->enabled && $user->rights->propal->lire) + if (! empty($conf->propal->enabled) && $user->rights->propal->lire) { $propal_static = new Propal($db); @@ -472,7 +472,7 @@ if ($id > 0) /* * Last orders */ - if ($conf->commande->enabled && $user->rights->commande->lire) + if (! empty($conf->commande->enabled) && $user->rights->commande->lire) { $commande_static=new Commande($db); @@ -527,7 +527,7 @@ if ($id > 0) /* * Last linked contracts */ - if ($conf->contrat->enabled && $user->rights->contrat->lire) + if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire) { $contratstatic=new Contrat($db); @@ -587,7 +587,7 @@ if ($id > 0) /* * Last interventions */ - if ($conf->ficheinter->enabled && $user->rights->ficheinter->lire) + if (! empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire) { $sql = "SELECT s.nom, s.rowid, f.rowid as id, f.ref, f.fk_statut, f.duree as duration, f.datei as startdate"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as f"; @@ -642,7 +642,7 @@ if ($id > 0) /* * Last invoices */ - if ($conf->facture->enabled && $user->rights->facture->lire) + if (! empty($conf->facture->enabled) && $user->rights->facture->lire) { $facturestatic = new Facture($db); @@ -723,13 +723,13 @@ if ($id > 0) */ print '
'; - if ($conf->propal->enabled && $user->rights->propal->creer) + if (! empty($conf->propal->enabled) && $user->rights->propal->creer) { $langs->load("propal"); print ''.$langs->trans("AddProp").''; } - if ($conf->commande->enabled && $user->rights->commande->creer) + if (! empty($conf->commande->enabled) && $user->rights->commande->creer) { $langs->load("orders"); print ''.$langs->trans("AddOrder").''; @@ -741,7 +741,7 @@ if ($id > 0) print ''.$langs->trans("AddContract").''; } - if ($conf->ficheinter->enabled && $user->rights->ficheinter->creer) + if (! empty($conf->ficheinter->enabled) && $user->rights->ficheinter->creer) { $langs->load("fichinter"); print ''.$langs->trans("AddIntervention").''; @@ -750,13 +750,13 @@ if ($id > 0) // Add invoice if ($user->societe_id == 0) { - if ($conf->deplacement->enabled) + if (! empty($conf->deplacement->enabled)) { $langs->load("trips"); print ''.$langs->trans("AddTrip").''; } - if ($conf->facture->enabled) + if (! empty($conf->facture->enabled)) { if ($user->rights->facture->creer) { @@ -772,7 +772,7 @@ if ($id > 0) } // Add action - if ($conf->agenda->enabled && ! empty($conf->global->MAIN_REPEATTASKONEACHTAB)) + if (! empty($conf->agenda->enabled) && ! empty($conf->global->MAIN_REPEATTASKONEACHTAB)) { if ($user->rights->agenda->myactions->create) { diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index b46d47c57da..d124b836692 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -28,8 +28,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php'; -if ($conf->contrat->enabled) require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; -if ($conf->propal->enabled) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; +if (! empty($conf->contrat->enabled)) require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; +if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; if (! $user->rights->societe->lire) accessforbidden(); @@ -80,7 +80,7 @@ $now=dol_now(); $form = new Form($db); $formfile = new FormFile($db); $companystatic=new Societe($db); -if ($conf->propal->enabled) $propalstatic=new Propal($db); +if (! empty($conf->propal->enabled)) $propalstatic=new Propal($db); llxHeader(); @@ -89,15 +89,15 @@ print_fiche_titre($langs->trans("CustomerArea")); print ''; print ''; -if (($conf->propal->enabled && $user->rights->propale->lire) || - ($conf->contrat->enabled && $user->rights->contrat->lire) || - ($conf->commande->enabled && $user->rights->commande->lire)) +if ((! empty($conf->propal->enabled) && $user->rights->propale->lire) || + (! empty($conf->contrat->enabled) && $user->rights->contrat->lire) || + (! empty($conf->commande->enabled) && $user->rights->commande->lire)) { print ''; print '
'; } // Recherche Propal -if ($conf->propal->enabled && $user->rights->propal->lire) +if (! empty($conf->propal->enabled) && $user->rights->propal->lire) { $var=false; print '
'; @@ -116,7 +116,7 @@ if ($conf->propal->enabled && $user->rights->propal->lire) /* * Recherche Contrat */ -if ($conf->contrat->enabled && $user->rights->contrat->lire) +if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire) { $var=false; print ''; @@ -135,7 +135,7 @@ if ($conf->contrat->enabled && $user->rights->contrat->lire) /* * Draft proposals */ -if ($conf->propal->enabled && $user->rights->propal->lire) +if (! empty($conf->propal->enabled) && $user->rights->propal->lire) { $sql = "SELECT p.rowid, p.ref, p.total_ht, s.rowid as socid, s.nom as name, s.client, s.canvas"; $sql.= " FROM ".MAIN_DB_PREFIX."propal as p"; @@ -200,7 +200,7 @@ if ($conf->propal->enabled && $user->rights->propal->lire) /* * Draft orders */ -if ($conf->commande->enabled && $user->rights->commande->lire) +if (! empty($conf->commande->enabled) && $user->rights->commande->lire) { $langs->load("orders"); @@ -255,9 +255,9 @@ if ($conf->commande->enabled && $user->rights->commande->lire) } } -if (($conf->propal->enabled && $user->rights->propale->lire) || - ($conf->contrat->enabled && $user->rights->contrat->lire) || - ($conf->commande->enabled && $user->rights->commande->lire)) +if ((! empty($conf->propal->enabled) && $user->rights->propale->lire) || + (! empty($conf->contrat->enabled) && $user->rights->contrat->lire) || + (! empty($conf->commande->enabled) && $user->rights->commande->lire)) { print '
'; @@ -276,7 +276,7 @@ $max=3; /* * Last modified customers or prospects */ -if ($conf->societe->enabled && $user->rights->societe->lire) +if (! empty($conf->societe->enabled) && $user->rights->societe->lire) { $langs->load("boxes"); @@ -336,7 +336,7 @@ if ($conf->societe->enabled && $user->rights->societe->lire) } // Last suppliers -if ($conf->fournisseur->enabled && $user->rights->societe->lire) +if (! empty($conf->fournisseur->enabled) && $user->rights->societe->lire) { $langs->load("boxes"); @@ -408,7 +408,7 @@ if ($user->rights->agenda->myactions->read) /* * Last contracts */ -if ($conf->contrat->enabled && $user->rights->contrat->lire && 0) // TODO A REFAIRE DEPUIS NOUVEAU CONTRAT +if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire && 0) // TODO A REFAIRE DEPUIS NOUVEAU CONTRAT { $langs->load("contracts"); @@ -466,7 +466,7 @@ if ($conf->contrat->enabled && $user->rights->contrat->lire && 0) // TODO A REFA /* * Opened proposals */ -if ($conf->propal->enabled && $user->rights->propal->lire) +if (! empty($conf->propal->enabled) && $user->rights->propal->lire) { $langs->load("propal"); @@ -516,7 +516,7 @@ if ($conf->propal->enabled && $user->rights->propal->lire) $filename=dol_sanitizeFileName($obj->ref); $filedir=$conf->propal->dir_output . '/' . dol_sanitizeFileName($obj->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->propalid; - $formfile->show_documents('propal',$filename,$filedir,$urlsource,'','','',1,'',1); + print $formfile->getDocumentsLink($propalstatic->element, $filename, $filedir); print '
'; print "
'; - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; print ''; print '
'.$langs->trans("Ref").''; diff --git a/htdocs/comm/mailing/fiche.php b/htdocs/comm/mailing/fiche.php index 39bdc5f1ec7..7fa1160d43d 100644 --- a/htdocs/comm/mailing/fiche.php +++ b/htdocs/comm/mailing/fiche.php @@ -440,9 +440,9 @@ if ($action == 'add') $object->bgcolor = trim($_POST["bgcolor"]); $object->bgimage = trim($_POST["bgimage"]); - if (! $object->titre) $mesg.=($mesg?'
':'').$langs->trans("ErrorFieldRequired",$langs->trans("MailTitle")); - if (! $object->sujet) $mesg.=($mesg?'
':'').$langs->trans("ErrorFieldRequired",$langs->trans("MailTopic")); - if (! $object->body) $mesg.=($mesg?'
':'').$langs->trans("ErrorFieldRequired",$langs->trans("MailBody")); + if (! $object->titre) $mesg.=($mesg?'
':'').$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailTitle")); + if (! $object->sujet) $mesg.=($mesg?'
':'').$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailTopic")); + if (! $object->body) $mesg.=($mesg?'
':'').$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailMessage")); if (! $mesg) { @@ -526,8 +526,8 @@ if ($action == 'update' && empty($_POST["removedfile"]) && empty($_POST["cancel" $object->bgcolor = trim($_POST["bgcolor"]); $object->bgimage = trim($_POST["bgimage"]); - if (! $object->sujet) $mesg.=($mesg?'
':'').$langs->trans("ErrorFieldRequired",$langs->trans("MailTopic")); - if (! $object->body) $mesg.=($mesg?'
':'').$langs->trans("ErrorFieldRequired",$langs->trans("MailBody")); + if (! $object->sujet) $mesg.=($mesg?'
':'').$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailTopic")); + if (! $object->body) $mesg.=($mesg?'
':'').$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailMessage")); if (! $mesg) { diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 84a6e6eb5ca..ff28de54e80 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -714,6 +714,8 @@ else if ($action == "addline" && $user->rights->propal->creer) } } + $desc=''; + // Define output language if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { @@ -734,8 +736,7 @@ else if ($action == "addline" && $user->rights->propal->creer) $desc = $prod->description; } - $desc.= ($desc && ! empty($product_desc)) ? ((dol_textishtml($desc) || dol_textishtml($product_desc))?"
\n":"\n") : ""; - $desc.= $product_desc; + $desc=dol_concatdesc($desc,$product_desc); } $type = $prod->type; @@ -911,7 +912,8 @@ else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('sa 0, $fournprice, $buying_price, - $label + $label, + $type ); if ($result >= 0) @@ -1231,7 +1233,7 @@ else if ($action == 'validate') } $text=$langs->trans('ConfirmValidateProp',$numref); - if ($conf->notification->enabled) + if (! empty($conf->notification->enabled)) { require_once DOL_DOCUMENT_ROOT .'/core/class/notify.class.php'; $notify=new Notify($db); @@ -1640,7 +1642,7 @@ if ($object->statut == 0 && $user->rights->propal->creer) $object->formAddFreeProduct(0,$mysoc,$soc,$hookmanager); // Add predefined products/services - if ($conf->product->enabled || $conf->service->enabled) + if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) { $var=!$var; $object->formAddPredefinedProduct(0,$mysoc,$soc,$hookmanager); @@ -1738,7 +1740,7 @@ if ($action != 'presend') // Create an invoice and classify billed if ($object->statut == 2 && $user->societe_id == 0) { - if ($conf->facture->enabled && $user->rights->facture->creer) + if (! empty($conf->facture->enabled) && $user->rights->facture->creer) { print ''.$langs->trans("AddBill").''; } diff --git a/htdocs/comm/propal/apercu.php b/htdocs/comm/propal/apercu.php index 5b4fc238342..d09ea9802e3 100644 --- a/htdocs/comm/propal/apercu.php +++ b/htdocs/comm/propal/apercu.php @@ -29,7 +29,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; -if ($conf->projet->enabled) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; +if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; $langs->load('propal'); $langs->load("bills"); diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 44d3c2f3f68..65287b23e57 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -6,7 +6,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2008 Raphael Bertrand - * Copyright (C) 2010-2011 Juanjo Menent + * Copyright (C) 2010-2012 Juanjo Menent * Copyright (C) 2010-2011 Philippe Grand * Copyright (C) 2012 Christophe Battarel * @@ -352,7 +352,7 @@ class Propal extends CommonObject // qty, pu, remise_percent et txtva // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. - $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits); + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits,$type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; @@ -463,9 +463,10 @@ class Propal extends CommonObject * @param int $fk_fournprice Id supplier price * @param int $pa_ht Buying price without tax * @param string $label ??? + * @param int $type 0/1=Product/service * @return int 0 if OK, <0 if KO */ - function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0, $txlocaltax2=0, $desc='', $price_base_type='HT', $info_bits=0, $special_code=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='') + function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0, $txlocaltax2=0, $desc='', $price_base_type='HT', $info_bits=0, $special_code=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $type=0) { global $conf,$user,$langs; @@ -491,7 +492,7 @@ class Propal extends CommonObject // qty, pu, remise_percent et txtva // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. - $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits); + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; @@ -2780,6 +2781,8 @@ class PropaleLigne $sql.= " , total_ht=".price2num($this->total_ht).""; $sql.= " , total_tva=".price2num($this->total_tva).""; $sql.= " , total_ttc=".price2num($this->total_ttc).""; + $sql.= " , total_localtax1=".price2num($this->total_localtax1).""; + $sql.= " , total_localtax2=".price2num($this->total_localtax2).""; } $sql.= " , fk_product_fournisseur_price='".$this->fk_fournprice."'"; $sql.= " , buy_price_ht='".price2num($this->pa_ht)."'"; diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index 60520d33ab5..129fda94ffe 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -164,12 +164,11 @@ if ($object->id > 0) // Affiche formulaire upload $formfile=new FormFile($db); - $formfile->form_attach_new_file($_SERVER['PHP_SELF'].'?id='.$object->id,'',0,0,$user->rights->propale->creer,50,$object); + $formfile->form_attach_new_file($_SERVER['PHP_SELF'].'?id='.$object->id,'',0,0,$user->rights->propal->creer,50,$object); // List of document - $param='&id='.$object->id; - $formfile->list_of_documents($filearray,$object,'propal',$param); + $formfile->list_of_documents($filearray,$object,'propal'); } else { diff --git a/htdocs/comm/propal/index.php b/htdocs/comm/propal/index.php index 831970d2e14..fb6fa29902e 100644 --- a/htdocs/comm/propal/index.php +++ b/htdocs/comm/propal/index.php @@ -151,7 +151,7 @@ else /* * Draft proposals */ -if ($conf->propal->enabled) +if (! empty($conf->propal->enabled)) { $sql = "SELECT c.rowid, c.ref, s.nom as socname, s.rowid as socid, s.canvas, s.client"; $sql.= " FROM ".MAIN_DB_PREFIX."propal as c"; @@ -257,7 +257,7 @@ if ($resql) $filename=dol_sanitizeFileName($obj->ref); $filedir=$conf->propal->dir_output . '/' . dol_sanitizeFileName($obj->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; - $formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','',1,'',1); + print $formfile->getDocumentsLink($propalstatic->element, $filename, $filedir); print '
'; print '
'; print "
'; print ''; @@ -441,7 +441,7 @@ if ($conf->propal->enabled) /* * Proposal that are in a shipping process */ -/*if ($conf->propal->enabled) +/*if (! empty($conf->propal->enabled)) { $sql = "SELECT c.rowid, c.ref, c.fk_statut, c.facture, s.nom, s.rowid as socid"; $sql.= " FROM ".MAIN_DB_PREFIX."commande as c"; @@ -490,7 +490,7 @@ if ($conf->propal->enabled) $filename=dol_sanitizeFileName($obj->ref); $filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; - $formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','',1,'',1); + print $formfile->getDocumentsLink($propalstatic->element, $filename, $filedir); print ''; print ''; diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 81f56e21366..8603f0a7394 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -35,7 +35,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formpropal.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; -if ($conf->projet->enabled) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; +if (! empty($conf->projet->enabled)) + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; $langs->load('companies'); $langs->load('propal'); @@ -319,7 +320,7 @@ if ($result) $filename=dol_sanitizeFileName($objp->ref); $filedir=$conf->propal->dir_output . '/' . dol_sanitizeFileName($objp->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$objp->propalid; - $formfile->show_documents('propal',$filename,$filedir,$urlsource,'','','',1,'',1); + print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); print ''; if ($objp->client == 1) diff --git a/htdocs/comm/propal/stats/index.php b/htdocs/comm/propal/stats/index.php index dc4d24d5dd1..1f0d9be22e6 100644 --- a/htdocs/comm/propal/stats/index.php +++ b/htdocs/comm/propal/stats/index.php @@ -217,11 +217,11 @@ complete_head_from_modules($conf,$langs,$object,$head,$h,'propal_stats'); dol_fiche_head($head,'byyear',$langs->trans("Statistics")); -if (empty($socid)) -{ - print ''; - print ''; // Project - if ($conf->projet->enabled) + if (! empty($conf->projet->enabled)) { $langs->load('projects'); print '
'; +print ''; +print '
'; +//if (empty($socid)) +//{ // Show filter box print ''; print ''; @@ -246,7 +246,7 @@ if (empty($socid)) print '
'; print ''; print '

'; -} +//} print ''; print ''; diff --git a/htdocs/comm/prospect/fiche.php b/htdocs/comm/prospect/fiche.php index 3a16307a760..14264358cfa 100644 --- a/htdocs/comm/prospect/fiche.php +++ b/htdocs/comm/prospect/fiche.php @@ -29,8 +29,8 @@ require_once DOL_DOCUMENT_ROOT.'/comm/prospect/class/prospect.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; -if ($conf->adherent->enabled) require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; -if ($conf->propal->enabled) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; +if (! empty($conf->adherent->enabled)) require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; +if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; $langs->load('companies'); $langs->load('projects'); @@ -152,7 +152,7 @@ if ($socid > 0) print ''; // Multiprice level - if ($conf->global->PRODUIT_MULTIPRICES) + if (! empty($conf->global->PRODUIT_MULTIPRICES)) { print ''; @@ -319,6 +319,8 @@ if ($resql) $companystatic->client=$objp->client; print ''; print ''; diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index c0ef16db6fb..60ce5d3b11b 100755 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -2,7 +2,7 @@ /* Copyright (C) 2001-2005 Rodolphe Quiedeville * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005 Marc Barilley / Ocebo - * Copyright (C) 2005-2011 Regis Houssin + * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2012 Andreu Bisquerra Gaya * Copyright (C) 2012 David Rodriguez Martinez * Copyright (C) 2012 Juanjo Menent @@ -34,21 +34,25 @@ require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php'; -if ($conf->projet->enabled) require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; +if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; $langs->load('orders'); $langs->load('deliveries'); $langs->load('companies'); -$langs->load('orderstoinvoice@orderstoinvoice'); -$sref=GETPOST('sref'); -$sref_client=GETPOST('sref_client'); -$sall=GETPOST('sall'); -$socid=GETPOST('socid','int'); - -if (! $user->rights->facture->creer) +if (! $user->rights->facture->creer) accessforbidden(); +$id = (GETPOST('id')?GETPOST("id"):GETPOST("facid")); // For backward compatibility +$ref = GETPOST('ref','alpha'); +$action = GETPOST('action','alpha'); +$confirm = GETPOST('confirm','alpha'); +$sref = GETPOST('sref'); +$sref_client = GETPOST('sref_client'); +$sall = GETPOST('sall'); +$socid = GETPOST('socid','int'); + + $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); if (! $sortfield) $sortfield='c.rowid'; @@ -120,19 +124,15 @@ if (($action == 'create' || $action == 'add') && empty($mesgs)) $_POST['originid']=$orders_id[0]; } - $sall=isset($_GET['sall'])?trim($_GET['sall']):trim($_POST['sall']); - $projectid=isset($_GET['projectid'])?$_GET['projectid']:0; - $id =(GETPOST('id')?GETPOST("id"):GETPOST("facid")); // For backward compatibility - $ref =GETPOST('ref'); - $socid =GETPOST('socid'); - $action =GETPOST('action'); - $confirm =GETPOST('confirm'); - $lineid =GETPOST('lineid'); - $userid =GETPOST('userid'); - $search_ref =GETPOST('sf_ref')?GETPOST('sf_ref'):GETPOST('search_ref'); + + $projectid = GETPOST('projectid','int')?GETPOST('projectid','int'):0; + $lineid = GETPOST('lineid','int'); + $userid = GETPOST('userid','int'); + $search_ref = GETPOST('sf_ref')?GETPOST('sf_ref'):GETPOST('search_ref'); + $closeOrders = GETPOST('autocloseorders') != '' ? true : false; // Security check - $fieldid = isset($_GET["ref"])?'facnumber':'rowid'; + $fieldid = GETPOST('ref','alpha')?'facnumber':'rowid'; if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'facture', $id,'','','fk_soc',$fieldid); @@ -216,8 +216,10 @@ if (($action == 'create' || $action == 'add') && empty($mesgs)) $result=$srcobject->fetch($orders_id[$ii]); if ($result > 0) { - $srcobject->classer_facturee(); - $srcobject->setStatut(3); + if($closeOrders) { + $srcobject->classer_facturee(); + $srcobject->setStatut(3); + } $lines = $srcobject->lines; if (empty($lines) && method_exists($srcobject,'fetch_lines')) $lines = $srcobject->fetch_lines(); $fk_parent_line=0; @@ -384,6 +386,7 @@ if ($action == 'create') print ''; print ''; print ''; + print ''; print '
'; print ''; diff --git a/htdocs/commande/liste.php b/htdocs/commande/liste.php index 08c68939903..b3ea2328866 100644 --- a/htdocs/commande/liste.php +++ b/htdocs/commande/liste.php @@ -308,7 +308,7 @@ if ($resql) $filename=dol_sanitizeFileName($objp->ref); $filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($objp->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$objp->rowid; - $formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','',1,'',1); + print $formfile->getDocumentsLink($generic_commande->element, $filename, $filedir); print '
'; @@ -181,7 +181,7 @@ if ($socid > 0) include DOL_DOCUMENT_ROOT.'/societe/tpl/linesalesrepresentative.tpl.php'; // Module Adherent - if ($conf->adherent->enabled) + if (! empty($conf->adherent->enabled)) { $langs->load("members"); $langs->load("users"); @@ -225,7 +225,7 @@ if ($socid > 0) /* * Last proposals */ - if ($conf->propal->enabled && $user->rights->propale->lire) + if (! empty($conf->propal->enabled) && $user->rights->propale->lire) { $propal_static=new Propal($db); @@ -297,13 +297,13 @@ if ($socid > 0) print '
'; - if ($conf->propal->enabled && $user->rights->propale->creer) + if (! empty($conf->propal->enabled) && $user->rights->propale->creer) { print ''.$langs->trans("AddProp").''; } // Add action - if ($conf->agenda->enabled && ! empty($conf->global->MAIN_REPEATTASKONEACHTAB)) + if (! empty($conf->agenda->enabled) && ! empty($conf->global->MAIN_REPEATTASKONEACHTAB)) { if ($user->rights->agenda->myactions->create) { diff --git a/htdocs/comm/prospect/index.php b/htdocs/comm/prospect/index.php index 3280c456e4f..f4f603fb45b 100644 --- a/htdocs/comm/prospect/index.php +++ b/htdocs/comm/prospect/index.php @@ -50,7 +50,7 @@ print ''; print ''; @@ -353,7 +353,7 @@ if ($conf->commande->enabled) /* * Orders thar are in a shipping process */ -if ($conf->commande->enabled) +if (! empty($conf->commande->enabled)) { $sql = "SELECT c.rowid, c.ref, c.fk_statut, c.facture, s.nom, s.rowid as socid"; $sql.= " FROM ".MAIN_DB_PREFIX."commande as c"; @@ -402,7 +402,7 @@ if ($conf->commande->enabled) $filename=dol_sanitizeFileName($obj->ref); $filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; - $formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','',1,'',1); + print $formfile->getDocumentsLink($commandestatic->element, $filename, $filedir); print '
'; -if ($conf->propal->enabled) +if (! empty($conf->propal->enabled)) { $var=false; print ''; @@ -111,7 +111,7 @@ if ($resql) /* * Liste des propal brouillons */ -if ($conf->propal->enabled && $user->rights->propale->lire) +if (! empty($conf->propal->enabled) && $user->rights->propale->lire) { $sql = "SELECT p.rowid, p.ref, p.price, s.nom as sname"; $sql.= " FROM ".MAIN_DB_PREFIX."propal as p"; @@ -164,13 +164,13 @@ if ($conf->propal->enabled && $user->rights->propale->lire) */ print ''; // Delivery address - if ($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) + if (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT)) { print ''; @@ -282,7 +282,7 @@ else dol_print_error($db); /* * Orders to process */ -if ($conf->commande->enabled) +if (! empty($conf->commande->enabled)) { $sql = "SELECT c.rowid, c.ref, c.fk_statut, c.facture, s.nom, s.rowid as socid"; $sql.=" FROM ".MAIN_DB_PREFIX."commande as c"; @@ -331,7 +331,7 @@ if ($conf->commande->enabled) $filename=dol_sanitizeFileName($obj->ref); $filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; - $formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','',1,'',1); + print $formfile->getDocumentsLink($commandestatic->element, $filename, $filedir); print '
'; -if ($conf->agenda->enabled) show_array_actions_to_do(10); +if (! empty($conf->agenda->enabled)) show_array_actions_to_do(10); /* * Dernieres propales ouvertes * */ -if ($conf->propal->enabled && $user->rights->propale->lire) +if (! empty($conf->propal->enabled) && $user->rights->propale->lire) { $sql = "SELECT s.nom as name, s.rowid as socid, s.client, s.canvas,"; $sql.= " p.rowid as propalid, p.total as total_ttc, p.ref, p.datep as dp, c.label as statut, c.id as statutid"; diff --git a/htdocs/comm/prospect/list.php b/htdocs/comm/prospect/list.php index d24ac0c2e47..caac721333c 100755 --- a/htdocs/comm/prospect/list.php +++ b/htdocs/comm/prospect/list.php @@ -261,7 +261,7 @@ if ($resql) // Filter on categories $moreforfilter=''; - if ($conf->categorie->enabled) + if (! empty($conf->categorie->enabled)) { $moreforfilter.=$langs->trans('Categories'). ': '; $moreforfilter.=$formother->select_categories(2,$search_categ,'search_categ',1); diff --git a/htdocs/comm/prospect/recap-prospect.php b/htdocs/comm/prospect/recap-prospect.php index 3640cee6279..02c6b2508e3 100644 --- a/htdocs/comm/prospect/recap-prospect.php +++ b/htdocs/comm/prospect/recap-prospect.php @@ -28,7 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $langs->load("companies"); $langs->load('other'); -if ($conf->facture->enabled) $langs->load("bills"); +if (! empty($conf->facture->enabled)) $langs->load("bills"); // Security check $socid = $_GET["socid"]; diff --git a/htdocs/comm/recap-client.php b/htdocs/comm/recap-client.php index fe240ac2266..8b1d4c8aef1 100644 --- a/htdocs/comm/recap-client.php +++ b/htdocs/comm/recap-client.php @@ -27,7 +27,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $langs->load("companies"); -if ($conf->facture->enabled) $langs->load("bills"); +if (! empty($conf->facture->enabled)) $langs->load("bills"); // Security check $socid = $_GET["socid"]; diff --git a/htdocs/commande/apercu.php b/htdocs/commande/apercu.php index 83822aa2407..87d84d297d3 100644 --- a/htdocs/commande/apercu.php +++ b/htdocs/commande/apercu.php @@ -29,8 +29,8 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; -if ($conf->propal->enabled) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; -if ($conf->projet->enabled) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; +if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; +if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; $langs->load('orders'); $langs->load('propal'); diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index a38422cd0eb..ee3f627f073 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2006 Andre Cianfarani - * Copyright (C) 2010-2011 Juanjo Menent + * Copyright (C) 2010-2012 Juanjo Menent * Copyright (C) 2011 Jean Heimburger * Copyright (C) 2012 Christophe Battarel * @@ -237,7 +237,7 @@ class Commande extends CommonOrder if (! $error) { // If stock is incremented on validate order, we must increment it - if ($result >= 0 && $conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1) + if ($result >= 0 && ! empty($conf->stock->enabled) && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1) { require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; $langs->load("agenda"); @@ -351,7 +351,7 @@ class Commande extends CommonOrder if ($this->db->query($sql)) { // If stock is decremented on validate order, we must reincrement it - if ($conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1) + if (! empty($conf->stock->enabled) && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1) { require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; $langs->load("agenda"); @@ -534,7 +534,7 @@ class Commande extends CommonOrder if ($this->db->query($sql)) { // If stock is decremented on validate order, we must reincrement it - if ($conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1) + if (! empty($conf->stock->enabled) && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1) { require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; $langs->load("agenda"); @@ -999,6 +999,7 @@ class Commande extends CommonOrder * @param int $fk_parent_line Parent line * @param int $fk_fournprice Id supplier price * @param int $pa_ht Buying price (without tax) + * @param string $label Label * @return int >0 if OK, <0 if KO * * @see add_product @@ -1054,7 +1055,7 @@ class Commande extends CommonOrder // qty, pu, remise_percent et txtva // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. - $tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits); + $tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits,$type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; @@ -2159,6 +2160,7 @@ class Commande extends CommonOrder * @param int $skip_update_total Skip update of total * @param int $fk_fournprice Id supplier price * @param int $pa_ht Buying price (without tax) + * @param string $label Label * @return int < 0 if KO, > 0 if OK */ function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0,$txlocaltax2=0, $price_base_type='HT', $info_bits=0, $date_start='', $date_end='', $type=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='') @@ -2192,7 +2194,7 @@ class Commande extends CommonOrder // qty, pu, remise_percent et txtva // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. - $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits); + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; @@ -2538,7 +2540,7 @@ class Commande extends CommonOrder $result=''; - if ($conf->expedition->enabled && ($option == 1 || $option == 2)) $url = DOL_URL_ROOT.'/expedition/shipment.php?id='.$this->id; + if (! empty($conf->expedition->enabled) && ($option == 1 || $option == 2)) $url = DOL_URL_ROOT.'/expedition/shipment.php?id='.$this->id; else $url = DOL_URL_ROOT.'/commande/fiche.php?id='.$this->id; if ($short) return $url; @@ -2682,7 +2684,7 @@ class Commande extends CommonOrder $line->total_ht=100; $line->total_ttc=119.6; $line->total_tva=19.6; - $line->remise_percent=00; + $line->remise_percent=0; } $prodid = rand(1, $num_prods); $line->fk_product=$prodids[$prodid]; @@ -2841,13 +2843,15 @@ class OrderLine var $localtax2_tx; // Local tax 2 var $subprice; // U.P. HT (example 100) var $remise_percent; // % for line discount (example 20%) + var $fk_remise_except; var $rang = 0; var $fk_fournprice; var $pa_ht; var $marge_tx; var $marque_tx; var $info_bits = 0; // Bit 0: 0 si TVA normal - 1 si TVA NPR - // Bit 1: 0 ligne normale - 1 si ligne de remise fixe + // Bit 1: 0 ligne normale - 1 si ligne de remise fixe + var $special_code = 0; var $total_ht; // Total HT de la ligne toute quantite et incluant la remise ligne var $total_tva; // Total TVA de la ligne toute quantite et incluant la remise ligne var $total_localtax1; // Total local tax 1 for the line @@ -3140,11 +3144,11 @@ class OrderLine $sql.= " , total_ht=".price2num($this->total_ht).""; $sql.= " , total_tva=".price2num($this->total_tva).""; $sql.= " , total_ttc=".price2num($this->total_ttc).""; + $sql.= " , total_localtax1=".price2num($this->total_localtax1); + $sql.= " , total_localtax2=".price2num($this->total_localtax2); } $sql.= " , fk_product_fournisseur_price=".(! empty($this->fk_fournprice)?$this->fk_fournprice:"null"); $sql.= " , buy_price_ht='".price2num($this->pa_ht)."'"; - $sql.= " , total_localtax1=".price2num($this->total_localtax1); - $sql.= " , total_localtax2=".price2num($this->total_localtax2); $sql.= " , info_bits=".$this->info_bits; $sql.= " , date_start=".(! empty($this->date_start)?"'".$this->db->idate($this->date_start)."'":"null"); $sql.= " , date_end=".(! empty($this->date_end)?"'".$this->db->idate($this->date_end)."'":"null"); diff --git a/htdocs/commande/contact.php b/htdocs/commande/contact.php index 0caf1c80d63..d190a550834 100644 --- a/htdocs/commande/contact.php +++ b/htdocs/commande/contact.php @@ -178,7 +178,7 @@ if ($id > 0 || ! empty($ref)) print ''.$object->client->getNomUrl(1).'
'; print '
'; diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 2c665ec982c..2d348b131e8 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -618,6 +618,8 @@ else if ($action == 'addline' && $user->rights->commande->creer) } } + $desc=''; + // Define output language if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { @@ -638,8 +640,7 @@ else if ($action == 'addline' && $user->rights->commande->creer) $desc = $prod->description; } - $desc.= ($desc && ! empty($product_desc)) ? ((dol_textishtml($desc) || dol_textishtml($product_desc))?"
\n":"\n") : ""; - $desc.= $product_desc; + $desc=dol_concatdesc($desc,$product_desc); } $type = $prod->type; @@ -1462,7 +1463,7 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G // Date de livraison print "
".$langs->trans("DeliveryDate").''; - if ($conf->global->DATE_LIVRAISON_WEEK_DELAY) + if (! empty($conf->global->DATE_LIVRAISON_WEEK_DELAY)) { $datedelivery = time() + ((7*$conf->global->DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60); } @@ -1699,7 +1700,7 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G } $text=$langs->trans('ConfirmValidateOrder',$numref); - if ($conf->notification->enabled) + if (! empty($conf->notification->enabled)) { require_once DOL_DOCUMENT_ROOT .'/core/class/notify.class.php'; $notify=new Notify($db); @@ -1808,7 +1809,7 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G * Commande */ $nbrow=9; - if ($conf->projet->enabled) $nbrow++; + if (! empty($conf->projet->enabled)) $nbrow++; //Local taxes if ($mysoc->country_code=='ES') @@ -2153,7 +2154,7 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G $object->formAddFreeProduct(1,$mysoc,$soc,$hookmanager); // Add predefined products/services - if ($conf->product->enabled || $conf->service->enabled) + if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) { $var=!$var; $object->formAddPredefinedProduct(1,$mysoc,$soc,$hookmanager); @@ -2201,7 +2202,7 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G // Ship $numshipping=0; - if ($conf->expedition->enabled) + if (! empty($conf->expedition->enabled)) { $numshipping = $object->nb_expedition(); @@ -2235,7 +2236,7 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G // Create bill and Classify billed - if ($conf->facture->enabled && $object->statut > 0 && ! $object->billed) + if (! empty($conf->facture->enabled) && $object->statut > 0 && ! $object->billed) { if ($user->rights->facture->creer && empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) { diff --git a/htdocs/commande/index.php b/htdocs/commande/index.php index 0c7a40d2ac8..af38165d48a 100644 --- a/htdocs/commande/index.php +++ b/htdocs/commande/index.php @@ -165,7 +165,7 @@ else /* * Draft orders */ -if ($conf->commande->enabled) +if (! empty($conf->commande->enabled)) { $sql = "SELECT c.rowid, c.ref, s.nom, s.rowid as socid"; $sql.= " FROM ".MAIN_DB_PREFIX."commande as c"; @@ -262,7 +262,7 @@ if ($resql) $filename=dol_sanitizeFileName($obj->ref); $filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; - $formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','',1,'',1); + print $formfile->getDocumentsLink($commandestatic->element, $filename, $filedir); print '
'; print '
'; print '
'; print '
'; print '
'; print $companystatic->getNomUrl(1,'customer'); + print ' '; + print img_picto($langs->trans("CreateInvoiceForThisCustomer").' : '.$companystatic->nom,'object_bill').''; print ''.$objp->ref_client.'
'; // Ref print ''; @@ -403,6 +406,7 @@ if ($action == 'create') print $desc; print ''."\n"; print '
'.$langs->trans('Ref').''.$langs->trans('Draft').'
'; + // Date invoice print '
'.$langs->trans('Date').''; $html->select_date(0,'','','','',"add",1,1); @@ -416,7 +420,7 @@ if ($action == 'create') $html->select_types_paiements(isset($_POST['mode_reglement_id'])?$_POST['mode_reglement_id']:$mode_reglement_id,'mode_reglement_id'); print '
'.$langs->trans('Project').''; @@ -445,7 +449,7 @@ if ($action == 'create') $result=$srcobject->fetch($sel); if ($result > 0) { - $commandes.= $srcobject->ref." "; + $commandes.= $srcobject->ref.", "; } } print $commandes; @@ -463,20 +467,20 @@ if ($action == 'create') } print '
'; - print ''; - while ($i < $n) { print ''; - + $i++; } - - print "\n"; + // Button "Create Draft" - print '
'; + print '
'; print "\n"; + + print ''; + print "\n"; } @@ -496,35 +500,18 @@ if (($action != 'create' && $action != 'add') || ! empty($mesgs)) }); rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= ' WHERE c.fk_soc = s.rowid'; - // Which invoice to show - if ($viewstatut <> '') - { - if ($viewstatut < 4 && $viewstatut > -2) - { - $sql.= ' AND c.fk_statut ='.$viewstatut; // brouillon, validee, en cours, annulee - if ($viewstatut == 3) - { - $sql.= ' AND c.facture = 0'; // need to create invoice - } - } - if ($viewstatut == 4) - { - $sql.= ' AND c.facture = 1'; // invoice created - } - if ($viewstatut == -2) // To process - { - //$sql.= ' AND c.fk_statut IN (1,2,3) AND c.facture = 0'; - $sql.= " AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))"; // If status is 2 and facture=1, it must be selected - } - } - $sql.= ' AND s.entity = '.$conf->entity; + $sql.= ' WHERE c.entity = '.$conf->entity; + $sql.= ' AND c.fk_soc = s.rowid'; + + // Show orders with status validated, shipping started and delivered (well any order we can bill) + $sql.= " AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))"; + if ($socid) $sql.= ' AND s.rowid = '.$socid; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($sref) @@ -535,18 +522,18 @@ if (($action != 'create' && $action != 'add') || ! empty($mesgs)) { $sql.= " AND (c.ref LIKE '%".$db->escape($sall)."%' OR c.note LIKE '%".$db->escape($sall)."%')"; } - + //Date filter if ($date_start && $date_end) $sql.= " AND c.date_commande >= '".$db->idate($date_start)."' AND c.date_commande <= '".$db->idate($date_end)."'"; if ($date_starty && $date_endy) $sql.= " AND c.date_livraison >= '".$db->idate($date_starty)."' AND c.date_livraison <= '".$db->idate($date_endy)."'"; - + if (!empty($sref_client)) { $sql.= ' AND c.ref_client LIKE \'%'.$db->escape($sref_client).'%\''; } $sql.= ' ORDER BY '.$sortfield.' '.$sortorder; $resql = $db->query($sql); - + if ($resql) { if ($socid) @@ -559,19 +546,21 @@ if (($action != 'create' && $action != 'add') || ! empty($mesgs)) { $title = $langs->trans('ListOfOrders'); } - $title.=' - '.$langs->trans('StatusOrderToBillShort'); + $title.=' - '.$langs->trans('StatusOrderValidated').', '.$langs->trans("StatusOrderSent").', '.$langs->trans('StatusOrderToBill'); $num = $db->num_rows($resql); print_fiche_titre($title); $i = 0; $period=$html->select_date($date_start,'date_start',0,0,1,'',1,0,1).' - '.$html->select_date($date_end,'date_end',0,0,1,'',1,0,1); $periodely=$html->select_date($date_starty,'date_start_dely',0,0,1,'',1,0,1).' - '.$html->select_date($date_endy,'date_end_dely',0,0,1,'',1,0,1); - // Company - print '

'; - $companystatic->id=$socid; - $companystatic->nom=$soc->nom; - - print $companystatic->getNomUrl(1,'customer'); - print '

'; + + if (! empty($socid)) + { + // Company + $companystatic->id=$socid; + $companystatic->nom=$soc->nom; + print '

'.$companystatic->getNomUrl(1,'customer').'

'; + } + print ''; print ''; print_liste_field_titre($langs->trans('Ref'),'orderstoinvoice.php','c.ref','','&socid='.$socid,'',$sortfield,$sortorder); @@ -581,7 +570,7 @@ if (($action != 'create' && $action != 'add') || ! empty($mesgs)) print_liste_field_titre($langs->trans('Status'),'','','','','align="right"'); print_liste_field_titre($langs->trans('GenerateBill'),'','','','','align="center"'); print ''; - + // Lignes des champs de filtre print ''; print ''; @@ -593,88 +582,88 @@ if (($action != 'create' && $action != 'add') || ! empty($mesgs)) //print ''; - + //DATE DELIVERY print ''; - + //SEARCH BUTTON print ''; - + print ''; print ''; - + print ''; $var=True; $generic_commande = new Commande($db); - + while ($i < $num) { $objp = $db->fetch_object($resql); $var=!$var; print ''; print ''; - + print ''; - + // Order date print ''; - + //Delivery date print ''; - + // Statut print ''; - + // Checkbox print '' ; - + print ''; - + $total = $total + $objp->price; $subtotal = $subtotal + $objp->price; $i++; } print '
'; print ''; print ''; - + //DATE ORDER print ''; print $period; print ''; print $periodely; print ''; print ''; - + //ALL/NONE print ''; if ($conf->use_javascript_ajax) print ''.$langs->trans("All").' / '.$langs->trans("None").''; print '
'; - + $generic_commande->id=$objp->rowid; $generic_commande->ref=$objp->ref; - + print ''; print ''; - + print ''; - + print '
'; print $generic_commande->getNomUrl(1,$objp->fk_statut); print ''; if (($objp->fk_statut > 0) && ($objp->fk_statut < 3) && $db->jdate($objp->date_valid) < ($now - $conf->commande->client->warning_delay)) print img_picto($langs->trans("Late"),"warning"); print ''; $filename=dol_sanitizeFileName($objp->ref); $filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($objp->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$objp->rowid; - $formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','',1,'',1); + print $formfile->getDocumentsLink($generic_commande->element, $filename, $filedir); print '
'; print '
'.$objp->ref_client.''; print dol_print_date($db->jdate($objp->date_commande),'day'); print ''; print dol_print_date($db->jdate($objp->date_livraison),'day'); print ''.$generic_commande->LibStatut($objp->fk_statut,$objp->facturee,5).''; print ''; print '
'; - + /* * Boutons actions */ @@ -683,7 +672,9 @@ if (($action != 'create' && $action != 'add') || ! empty($mesgs)) print ''; print '
'; print ''.$langs->trans("GoBack").''; - print ''; + print ''; + print '

'.$langs->trans("CloseProcessedOrdersAutomatically"); + print '
'; print ''; $db->free($resql); } diff --git a/htdocs/commande/stats/index.php b/htdocs/commande/stats/index.php index a92dd6cb2f3..fd97ae70f4a 100644 --- a/htdocs/commande/stats/index.php +++ b/htdocs/commande/stats/index.php @@ -238,11 +238,11 @@ complete_head_from_modules($conf,$langs,$object,$head,$h,$type); dol_fiche_head($head,'byyear',$langs->trans("Statistics")); -if (empty($socid)) -{ - print ''; - print ''; // Accountancy code - if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED) + if (! empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) { print ''; print ''; @@ -563,7 +563,7 @@ else print ''; // Accountancy code - if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED) + if (! empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) { print ''; print ''; diff --git a/htdocs/compta/bank/ligne.php b/htdocs/compta/bank/ligne.php index 584afaa321f..18227bf825d 100644 --- a/htdocs/compta/bank/ligne.php +++ b/htdocs/compta/bank/ligne.php @@ -32,7 +32,7 @@ $langs->load("banks"); $langs->load("compta"); $langs->load("bills"); $langs->load("categories"); -if ($conf->adherent->enabled) $langs->load("members"); +if (! empty($conf->adherent->enabled)) $langs->load("members"); $id = (GETPOST('id','int') ? GETPOST('id','int') : GETPOST('account','int')); diff --git a/htdocs/compta/deplacement/fiche.php b/htdocs/compta/deplacement/fiche.php index df453887ea1..754764fa32c 100644 --- a/htdocs/compta/deplacement/fiche.php +++ b/htdocs/compta/deplacement/fiche.php @@ -27,7 +27,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/trip.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; -if ($conf->projet->enabled) +if (! empty($conf->projet->enabled)) { require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; @@ -489,7 +489,7 @@ else if ($id) print ''; // Project - if ($conf->projet->enabled) + if (! empty($conf->projet->enabled)) { $langs->load('projects'); print ''; diff --git a/htdocs/compta/dons/fiche.php b/htdocs/compta/dons/fiche.php index fb6c8de4f5a..e6ec1a422ae 100644 --- a/htdocs/compta/dons/fiche.php +++ b/htdocs/compta/dons/fiche.php @@ -29,7 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/dons/class/don.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; -if ($conf->projet->enabled) require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; +if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; $langs->load("companies"); $langs->load("donations"); @@ -280,7 +280,7 @@ if ($action == 'create') print ''; $nbrows=11; - if ($conf->projet->enabled) $nbrows++; + if (! empty($conf->projet->enabled)) $nbrows++; // Date print '\n"; - if ($conf->projet->enabled) + if (! empty($conf->projet->enabled)) { // Si module projet actif print "'; $nbrows=12; - if ($conf->projet->enabled) $nbrows++; + if (! empty($conf->projet->enabled)) $nbrows++; // Date print "".'".'".''; // Project - if ($conf->projet->enabled) + if (! empty($conf->projet->enabled)) { print "".''; } diff --git a/htdocs/compta/dons/liste.php b/htdocs/compta/dons/liste.php index ced00f94c50..3a3a8d7a180 100644 --- a/htdocs/compta/dons/liste.php +++ b/htdocs/compta/dons/liste.php @@ -53,7 +53,7 @@ if (!$user->rights->don->lire) accessforbidden(); * View */ -if ($conf->projet->enabled) $projectstatic=new Project($db); +if (! empty($conf->projet->enabled)) $projectstatic=new Project($db); llxHeader('',$langs->trans("Donations"),'EN:Module_Donations|FR:Module_Dons|ES:Módulo_Donaciones'); @@ -160,7 +160,7 @@ if ($resql) print "\n"; print "\n"; print ''; - if ($conf->projet->enabled) + if (! empty($conf->projet->enabled)) { print "'."\n"; // Proforma - if ($conf->global->FACTURE_USE_PROFORMAT) + if (! empty($conf->global->FACTURE_USE_PROFORMAT)) { print ''; // Project - if ($conf->projet->enabled) + if (! empty($conf->projet->enabled)) { $langs->load('projects'); print ''; print ''; print ''; - if ($conf->service->enabled) + if (! empty($conf->service->enabled)) { print ''; } @@ -2090,7 +2091,7 @@ if ($action == 'create') print ''; print ''; print ''; // Si le module service est actif, on propose des dates de debut et fin a la ligne - if ($conf->service->enabled) + if (! empty($conf->service->enabled)) { print ''; - // TODO not used - if ($flag_different_price) + + if ($flag_price_may_change) { print ''; } @@ -340,7 +339,7 @@ if ($action == 'create') } else { - print "Erreur facture $invoice->id inexistante"; + dol_print_error('',"Error, no invoice ".$invoice->id); } } else @@ -348,7 +347,6 @@ else /* * View mode */ - if ($id > 0) { if ($object->fetch($id) > 0) @@ -366,7 +364,7 @@ else print ''; print ''; - print ''; + print ''; print ""; diff --git a/htdocs/compta/facture/impayees.php b/htdocs/compta/facture/impayees.php index 6cd4850ddd8..7b60344fc06 100644 --- a/htdocs/compta/facture/impayees.php +++ b/htdocs/compta/facture/impayees.php @@ -88,7 +88,7 @@ if ($action == "builddoc" && $user->rights->facture->lire) } $pdf->SetFont(pdf_getPDFFont($outputlangs)); - if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false); + if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); // Add all others foreach($files as $file) @@ -340,7 +340,7 @@ if ($resql) print ''; print '
'; +print ''; +print '
'; +//if (empty($socid)) +//{ // Show filter box print '
'; print ''; @@ -268,7 +268,7 @@ if (empty($socid)) print '
'; print ''; print '

'; -} +//} print ''; print ''; diff --git a/htdocs/commissions/admin/commissions.php b/htdocs/commissions/admin/commissions.php index e14b97b35b2..de9b5761ecb 100644 --- a/htdocs/commissions/admin/commissions.php +++ b/htdocs/commissions/admin/commissions.php @@ -42,6 +42,7 @@ if (GETPOST('commissionBase')) if (dolibarr_set_const($db, 'COMMISSION_BASE', GETPOST('commissionBase'), 'string', 0, '', $conf->entity) > 0) { $conf->global->COMMISSION_BASE = GETPOST('commissionBase'); + setEventMessage($langs->trans("RecordModifiedSuccessfully")); } else { @@ -179,10 +180,12 @@ print ''; print ''; print '
'; -print '
'; print ''; +dol_fiche_end(); + +print '
'; llxFooter(); $db->close(); diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index e215dbdcca2..e6c5cb4f580 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -429,11 +429,11 @@ if ($id > 0 || ! empty($ref)) $sql.= ", s.rowid as socid, s.nom as thirdparty"; } /* - if ($mode_search && $conf->adherent->enabled) + if ($mode_search && ! empty($conf->adherent->enabled)) { } - if ($mode_search && $conf->tax->enabled) + if ($mode_search && ! empty($conf->tax->enabled)) { } @@ -445,12 +445,12 @@ if ($id > 0 || ! empty($ref)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu1 ON bu1.fk_bank = b.rowid AND bu1.type='company'"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON bu1.url_id = s.rowid"; } - if ($mode_search && $conf->tax->enabled) + if ($mode_search && ! empty($conf->tax->enabled)) { $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu2 ON bu2.fk_bank = b.rowid AND bu2.type='payment_vat'"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."tva as t ON bu2.url_id = t.rowid"; } - if ($mode_search && $conf->adherent->enabled) + if ($mode_search && ! empty($conf->adherent->enabled)) { // TODO Mettre jointure sur adherent pour recherche sur un adherent //$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu3 ON bu3.fk_bank = b.rowid AND bu3.type='company'"; diff --git a/htdocs/compta/bank/fiche.php b/htdocs/compta/bank/fiche.php index 65abe9ccb5f..490b228f25a 100644 --- a/htdocs/compta/bank/fiche.php +++ b/htdocs/compta/bank/fiche.php @@ -281,7 +281,7 @@ if ($action == 'create') print '
'.$langs->trans("AccountancyCode").'
'.$langs->trans("AccountancyCode").'account_number).'">
'.$langs->trans("Date").''; @@ -318,7 +318,7 @@ if ($action == 'create') $form->select_types_paiements('', 'modepaiement', 'CRDT', 0, 1); print "
".$langs->trans("Project").""; @@ -368,7 +368,7 @@ if (! empty($id) && $action == 'edit') print '
'.$langs->trans("Date").''; @@ -458,7 +458,7 @@ if (! empty($id) && $action != 'edit') $linkback = ''.$langs->trans("BackToList").''; $nbrows=12; - if ($conf->projet->enabled) $nbrows++; + if (! empty($conf->projet->enabled)) $nbrows++; // Ref print "
'.$langs->trans("Ref").''; @@ -502,7 +502,7 @@ if (! empty($id) && $action != 'edit') print "
'.$langs->trans("Status").''.$don->getLibStatut(4).'
'.$langs->trans("Project").''.$don->projet.'
".$objp->societe."".$donationstatic->getFullName($langs)."'.dol_print_date($db->jdate($objp->datedon),'day').'"; if ($objp->pid) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 4e928108813..f6a326d4a67 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1049,6 +1049,8 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights- } } + $desc=''; + // Define output language if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { @@ -1069,8 +1071,7 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights- $desc = $prod->description; } - $desc.= ($desc && ! empty($product_desc)) ? ((dol_textishtml($desc) || dol_textishtml($product_desc))?"
\n":"\n") : ""; - $desc.= $product_desc; + $desc=dol_concatdesc($desc,$product_desc); } if (! empty($prod->customcode) || ! empty($prod->country_code)) @@ -1882,7 +1883,7 @@ if ($action == 'create') print '
'; print ''; @@ -1973,7 +1974,7 @@ if ($action == 'create') print '
'.$langs->trans('Project').''; @@ -2080,7 +2081,7 @@ if ($action == 'create') print ''.$langs->trans('Qty').''.$langs->trans('ReductionShort').'     '.$langs->trans('ServiceLimitedDuration').'
'; // multiprix - if($conf->global->PRODUIT_MULTIPRICES) + if (! empty($conf->global->PRODUIT_MULTIPRICES)) $form->select_produits('','idprod'.$i,'',$conf->product->limit_size,$soc->price_level); else $form->select_produits('','idprod'.$i,'',$conf->product->limit_size); @@ -2099,7 +2100,7 @@ if ($action == 'create') print '% '; print ''; @@ -2243,7 +2244,7 @@ else if ($id > 0 || ! empty($ref)) } $text=$langs->trans('ConfirmValidateBill',$numref); - if ($conf->notification->enabled) + if (! empty($conf->notification->enabled)) { require_once DOL_DOCUMENT_ROOT .'/core/class/notify.class.php'; $notify=new Notify($db); @@ -2624,8 +2625,8 @@ else if ($id > 0 || ! empty($ref)) */ $nbrows=8; $nbcols=2; - if ($conf->projet->enabled) $nbrows++; - if ($conf->banque->enabled) $nbcols++; + if (! empty($conf->projet->enabled)) $nbrows++; + if (! empty($conf->banque->enabled)) $nbcols++; //Local taxes if ($mysoc->pays_code=='ES') @@ -2642,7 +2643,7 @@ else if ($id > 0 || ! empty($ref)) print ''; print ''; print ''; - if ($conf->banque->enabled) print ''; + if (! empty($conf->banque->enabled)) print ''; print ''; print ''; print ''; @@ -2679,7 +2680,7 @@ else if ($id > 0 || ! empty($ref)) print dol_print_date($db->jdate($objp->dp),'day').''; $label=($langs->trans("PaymentType".$objp->payment_code)!=("PaymentType".$objp->payment_code))?$langs->trans("PaymentType".$objp->payment_code):$objp->payment_label; print ''; - if ($conf->banque->enabled) + if (! empty($conf->banque->enabled)) { $bankaccountstatic->id=$objp->baid; $bankaccountstatic->ref=$objp->ref; @@ -3016,7 +3017,7 @@ else if ($id > 0 || ! empty($ref)) $object->formAddFreeProduct(1,$mysoc,$soc,$hookmanager); // Add predefined products/services - if ($conf->product->enabled || $conf->service->enabled) + if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) { $var=!$var; $object->formAddPredefinedProduct(1,$mysoc,$soc,$hookmanager); @@ -3268,7 +3269,7 @@ else if ($id > 0 || ! empty($ref)) $somethingshown=$object->showLinkedObjectBlock(); // Link for paypal payment - if ($conf->paypal->enabled && $object->statut != 0) + if (! empty($conf->paypal->enabled) && $object->statut != 0) { include_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php'; print showPaypalPaymentUrl('invoice',$object->ref); diff --git a/htdocs/compta/facture/apercu.php b/htdocs/compta/facture/apercu.php index bac78a55c78..1ad6c0480ba 100644 --- a/htdocs/compta/facture/apercu.php +++ b/htdocs/compta/facture/apercu.php @@ -30,7 +30,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; -if ($conf->projet->enabled) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; +if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; $langs->load("bills"); @@ -288,7 +288,7 @@ if ($id > 0 || ! empty($ref)) print ''; $nbrows=5; - if ($conf->projet->enabled) $nbrows++; + if (! empty($conf->projet->enabled)) $nbrows++; print ''; // Projet - if ($conf->projet->enabled) + if (! empty($conf->projet->enabled)) { $langs->load("projects"); print ''; diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index be13100c539..95fd10c7068 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -62,6 +62,8 @@ class FactureRec extends Facture var $rang; var $special_code; + var $usenewprice=0; + var $lines=array(); @@ -114,6 +116,7 @@ class FactureRec extends Facture $sql.= ", fk_projet"; $sql.= ", fk_cond_reglement"; $sql.= ", fk_mode_reglement"; + $sql.= ", usenewprice"; $sql.= ") VALUES ("; $sql.= "'".$this->titre."'"; $sql.= ", '".$facsrc->socid."'"; @@ -126,6 +129,7 @@ class FactureRec extends Facture $sql.= ", ".(! empty($facsrc->fk_project)?"'".$facsrc->fk_project."'":"null"); $sql.= ", '".$facsrc->cond_reglement_id."'"; $sql.= ", '".$facsrc->mode_reglement_id."'"; + $sql.= ", '".$this->usenewprice."'"; $sql.= ")"; if ($this->db->query($sql)) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index dbf3bd849cb..004ca90fcc4 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -7,7 +7,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2007 Franky Van Liedekerke - * Copyright (C) 2010-2011 Juanjo Menent + * Copyright (C) 2010-2012 Juanjo Menent * Copyright (C) 2012 Christophe Battarel * Copyright (C) 2012 Marcos García * @@ -691,7 +691,7 @@ class Facture extends CommonInvoice // Possibility to add external linked objects with hooks $this->linked_objects[$this->origin] = $this->origin_id; - if (is_array($object->other_linked_objects) && ! empty($object->other_linked_objects)) + if (! empty($object->other_linked_objects) && is_array($object->other_linked_objects)) { $this->linked_objects = array_merge($this->linked_objects, $object->other_linked_objects); } @@ -1330,6 +1330,8 @@ class Facture extends CommonInvoice if (! $cond_reglement) $cond_reglement=$this->cond_reglement_code; if (! $cond_reglement) $cond_reglement=$this->cond_reglement_id; + $cdr_nbjour=0; $cdr_fdm=0; $cdr_decalage=0; + $sqltemp = 'SELECT c.fdm,c.nbjour,c.decalage'; $sqltemp.= ' FROM '.MAIN_DB_PREFIX.'c_payment_term as c'; if (is_numeric($cond_reglement)) $sqltemp.= " WHERE c.rowid=".$cond_reglement; @@ -1809,7 +1811,7 @@ class Facture extends CommonInvoice if ($result) { // Si on decremente le produit principal et ses composants a la validation de facture, on réincrement - if ($this->type != 3 && $result >= 0 && $conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_BILL) + if ($this->type != 3 && $result >= 0 && ! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_BILL)) { require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; $langs->load("agenda"); @@ -1925,7 +1927,7 @@ class Facture extends CommonInvoice // qty, pu, remise_percent et txtva // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. - $tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits); + $tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; @@ -2063,7 +2065,7 @@ class Facture extends CommonInvoice // Calculate total with, without tax and tax from qty, pu, remise_percent and txtva // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. - $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits); + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; @@ -3446,11 +3448,11 @@ class FactureLigne $sql.= ",total_ht=".price2num($this->total_ht).""; $sql.= ",total_tva=".price2num($this->total_tva).""; $sql.= ",total_ttc=".price2num($this->total_ttc).""; + $sql.= ",total_localtax1=".price2num($this->total_localtax1).""; + $sql.= ",total_localtax2=".price2num($this->total_localtax2).""; } $sql.= " , fk_product_fournisseur_price='".$this->fk_fournprice."'"; $sql.= " , buy_price_ht='".price2num($this->pa_ht)."'"; - $sql.= ",total_localtax1=".price2num($this->total_localtax1).""; - $sql.= ",total_localtax2=".price2num($this->total_localtax2).""; $sql.= ",fk_parent_line=".($this->fk_parent_line>0?$this->fk_parent_line:"null"); if (! empty($this->rang)) $sql.= ", rang=".$this->rang; $sql.= " WHERE rowid = ".$this->rowid; diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index 461cfaa03c0..a0173e74fa4 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -73,6 +73,7 @@ if ($action == 'add') { $object->titre = GETPOST('titre', 'alpha'); $object->note = GETPOST('comment'); + $object->usenewprice = GETPOST('usenewprice'); if ($object->create($user, $id) > 0) { @@ -122,11 +123,14 @@ if ($action == 'create') print ''; print ''; + $rowspan=4; + if (! empty($conf->projet->enabled) && $invoice->fk_project > 0) $rowspan++; + print '
'.($object->type == 2 ? $langs->trans("PaymentsBack") : $langs->trans('Payments')).''.$langs->trans('Type').''.$langs->trans('BankAccount').''.$langs->trans('BankAccount').''.$langs->trans('Amount').' 
'.$label.' '.$objp->num_paiement.''; /* @@ -366,7 +366,7 @@ if ($id > 0 || ! empty($ref)) print '
'.$langs->trans('Status').''.($object->getLibStatut(4,$totalpaye)).'
'; $invoice->fetch_thirdparty(); - print ''; + print ''; print ''; @@ -135,7 +139,7 @@ if ($action == 'create') print ''; print ''; - print ''; @@ -149,7 +153,7 @@ if ($action == 'create') $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$invoice->id, $facture->mode_reglement_id, 'none'); print ""; - if (! empty($conf->projet->enabled)) + if (! empty($conf->projet->enabled) && $invoice->fk_project > 0) { print "'; print ''; print ''; - print ''; + if (empty($conf->global->PRODUIT_MULTIPRICES)) print ''; print "\n"; } $var=True; @@ -223,21 +227,19 @@ if ($action == 'create') } $var=!$var; - print ""; + print ""; // Show product and description $type=(isset($objp->product_type)?$objp->product_type:$objp->fk_product_type); - if ($objp->fk_product) + if ($objp->fk_product > 0) { print ''; + print ''; print ''; if ($objp->remise_percent > 0) { @@ -290,14 +292,19 @@ if ($action == 'create') print '\n"; - if ($objp->fk_product > 0 && $objp->subprice <> $product->price) + // Price of product + if (empty($conf->global->PRODUIT_MULTIPRICES)) { - print '\n"; - $flag_different_price++; - } - else - { - print ''; + if ($objp->fk_product > 0) + { + $flag_price_may_change++; + $prodprice=$product_static->price; // price HT + print '\n"; + } + else + { + print ''; + } } print ""; @@ -315,21 +322,13 @@ if ($action == 'create') print "
'.$langs->trans("Customer").''.$invoice->client->getNomUrl(1).'
'.$langs->trans("Customer").''.$invoice->client->getNomUrl(1,'customer').''; //print $langs->trans("NotePrivate"); print '
'; + print ''; print ''; print '
".$langs->trans("Project").""; if ($invoice->fk_project > 0) @@ -208,7 +212,7 @@ if ($action == 'create') print ''.$langs->trans("Qty").''.$langs->trans("ReductionShort").''.$langs->trans("PriceU").'N.P.'.$langs->trans("CurrentProductPrice").'
'; print ''; // ancre pour retourner sur la ligne // Show product and description - $product_static->type=$objp->fk_product_type; - $product_static->id=$objp->fk_product; - $product_static->ref=$objp->ref; + $product_static->fetch($objp->fk_product); // We need all information later $text=$product_static->getNomUrl(1); $text.= ' - '.(! empty($objp->custom_label)?$objp->custom_label:$objp->product_label); $description=(! empty($conf->global->PRODUIT_DESC_IN_FORM)?'':dol_htmlentitiesbr($objp->description)); @@ -277,7 +279,7 @@ if ($action == 'create') } - print ''.$objp->tva_tx.' %'.vatrate($objp->tva_tx).'%'.$objp->qty.''.price($objp->subprice)."'.price($product->price)." '.price($prodprice)." 
"; print '
'; - print ''; + print ''; + print ''; print ''; print '
'.$object->titre.'
'.$langs->trans("Customer").''.$object->thirdparty->getNomUrl(1).''.$object->thirdparty->getNomUrl(1,'customer').'". $langs->trans("PaymentConditions") ." : "; $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id,'none'); print "
'; $filename=dol_sanitizeFileName($objp->facnumber); $filedir=$conf->facture->dir_output . '/' . dol_sanitizeFileName($objp->facnumber); - $foundpdf=$formfile->show_documents('facture',$filename,$filedir,$urlsource,'','','',1,'',1,$param); + print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir); print '
'; @@ -365,8 +365,10 @@ if ($resql) // Checkbox print ''; - if ($foundpdf) print ''; - else print ' '; + if (! empty($formfile->numoffiles)) + print ''; + else + print ' '; print '' ; print "\n"; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 8a19de20180..9d668723f34 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -341,7 +341,7 @@ if ($resql) $filename=dol_sanitizeFileName($objp->facnumber); $filedir=$conf->facture->dir_output . '/' . dol_sanitizeFileName($objp->facnumber); $urlsource=$_SERVER['PHP_SELF'].'?id='.$objp->facid; - $formfile->show_documents('facture',$filename,$filedir,$urlsource,'','','',1,'',1); + print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir); print ''; print ''; print ''; diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index f298fb1dff8..29647e69d10 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -457,11 +457,15 @@ if ($object->id > 0) print ''.$langs->trans("MakeWithdrawRequest").''; } } + else + { + print ''.$langs->trans("MakeWithdrawRequest").''; + } print "

\n"; - print $langs->trans("DoStandingOrdersBeforePayments").'
'; + print $langs->trans("DoStandingOrdersBeforePayments").'

'; /* diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php index 1de79ee5600..dddf19e6e34 100644 --- a/htdocs/compta/facture/stats/index.php +++ b/htdocs/compta/facture/stats/index.php @@ -214,11 +214,11 @@ complete_head_from_modules($conf,$langs,$object,$head,$h,$type); dol_fiche_head($head,'byyear',$langs->trans("Statistics")); -if (empty($socid)) -{ - print ''; - print ''; @@ -781,7 +781,7 @@ if ($conf->facture->enabled && $conf->commande->enabled && $user->rights->comman $societestatic->client=1; print $societestatic->getNomUrl(1,'customer',44); print ''; - if ($conf->global->MAIN_SHOW_HT_ON_SUMMARY) print ''; + if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print ''; print ''; print ''; print ''; @@ -795,7 +795,7 @@ if ($conf->facture->enabled && $conf->commande->enabled && $user->rights->comman } print ''; - if ($conf->global->MAIN_SHOW_HT_ON_SUMMARY) print ''; + if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print ''; print ''; print ''; print ''; @@ -813,7 +813,7 @@ if ($conf->facture->enabled && $conf->commande->enabled && $user->rights->comman /* * Unpaid customers invoices */ -if ($conf->facture->enabled && $user->rights->facture->lire) +if (! empty($conf->facture->enabled) && $user->rights->facture->lire) { $facstatic=new Facture($db); @@ -840,7 +840,7 @@ if ($conf->facture->enabled && $user->rights->facture->lire) print '
'; +print ''; +print '
'; +//if (empty($socid)) +//{ // Show filter box print '
'; print ''; @@ -244,7 +244,7 @@ if (empty($socid)) print '
'; print ''; print '

'; -} +//} print ''; print ''; diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index bf2c773265b..7cbbbb8e5da 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -27,9 +27,9 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; -if ($conf->commande->enabled) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; -if ($conf->commande->enabled) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; -if ($conf->tax->enabled) require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'; +if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; +if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; +if (! empty($conf->tax->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'; // L'espace compta/treso doit toujours etre actif car c'est un espace partage // par de nombreux modules (banque, facture, commande a facturer, etc...) independamment @@ -40,7 +40,7 @@ if ($conf->tax->enabled) require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/ $langs->load("compta"); $langs->load("bills"); -if ($conf->commande->enabled) $langs->load("orders"); +if (! empty($conf->commande->enabled)) $langs->load("orders"); // Security check $socid=''; @@ -108,7 +108,7 @@ $max=3; /* * Search invoices */ -if ($conf->facture->enabled && $user->rights->facture->lire) +if (! empty($conf->facture->enabled) && $user->rights->facture->lire) { print ''; print ''; @@ -125,7 +125,7 @@ if ($conf->facture->enabled && $user->rights->facture->lire) /* * Search supplier invoices */ -if ($conf->fournisseur->enabled && $user->rights->fournisseur->lire) +if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire) { print ''; print ''; @@ -142,7 +142,7 @@ if ($conf->fournisseur->enabled && $user->rights->fournisseur->lire) /* * Search donations */ -if ($conf->don->enabled && $user->rights->don->lire) +if (! empty($conf->don->enabled) && $user->rights->don->lire) { print ''; print ''; @@ -159,7 +159,7 @@ if ($conf->don->enabled && $user->rights->don->lire) /* * Search expenses */ -if ($conf->deplacement->enabled && $user->rights->deplacement->lire) +if (! empty($conf->deplacement->enabled) && $user->rights->deplacement->lire) { print ''; print ''; @@ -176,7 +176,7 @@ if ($conf->deplacement->enabled && $user->rights->deplacement->lire) /** * Draft customers invoices */ -if ($conf->facture->enabled && $user->rights->facture->lire) +if (! empty($conf->facture->enabled) && $user->rights->facture->lire) { $sql = "SELECT f.facnumber, f.rowid, f.total_ttc, f.type,"; $sql.= " s.nom, s.rowid as socid"; @@ -250,7 +250,7 @@ if ($conf->facture->enabled && $user->rights->facture->lire) /** * Draft suppliers invoices */ -if ($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire) +if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire) { $sql = "SELECT f.facnumber, f.rowid, f.total_ttc, f.type,"; $sql.= " s.nom, s.rowid as socid"; @@ -320,7 +320,7 @@ print ''; print ''; @@ -388,7 +388,7 @@ if ($conf->facture->enabled && $user->rights->facture->lire) $thirdpartystatic->client=1; print $thirdpartystatic->getNomUrl(1,'customer',44); print ''; - if ($conf->global->MAIN_SHOW_HT_ON_SUMMARY) print ''; + if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print ''; print ''; print ''; print ''; @@ -404,7 +404,7 @@ if ($conf->facture->enabled && $user->rights->facture->lire) else { $colspan=5; - if ($conf->global->MAIN_SHOW_HT_ON_SUMMARY) $colspan++; + if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) $colspan++; print ''; } print '
'; // Last modified customer invoices -if ($conf->facture->enabled && $user->rights->facture->lire) +if (! empty($conf->facture->enabled) && $user->rights->facture->lire) { $langs->load("boxes"); $facstatic=new Facture($db); @@ -349,7 +349,7 @@ if ($conf->facture->enabled && $user->rights->facture->lire) print ''; print ''; - if ($conf->global->MAIN_SHOW_HT_ON_SUMMARY) print ''; + if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print ''; print ''; print ''; print ''; @@ -378,7 +378,7 @@ if ($conf->facture->enabled && $user->rights->facture->lire) $filename=dol_sanitizeFileName($obj->facnumber); $filedir=$conf->facture->dir_output . '/' . dol_sanitizeFileName($obj->facnumber); $urlsource=$_SERVER['PHP_SELF'].'?facid='.$obj->rowid; - $formfile->show_documents('facture',$filename,$filedir,$urlsource,'','','',1,'',1); + print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir); print '
'.$langs->trans("BoxTitleLastCustomerBills",$max).''.$langs->trans("AmountHT").''.$langs->trans("AmountHT").''.$langs->trans("AmountTTC").''.$langs->trans("DateModificationShort").' 
'; print '
'.price($obj->total).''.price($obj->total).''.price($obj->total_ttc).''.dol_print_date($db->jdate($obj->tms),'day').''.$facstatic->LibStatut($obj->paye,$obj->fk_statut,3,$obj->am).'
'.$langs->trans("NoInvoice").'

'; @@ -419,7 +419,7 @@ if ($conf->facture->enabled && $user->rights->facture->lire) // Last modified supplier invoices -if ($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire) +if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire) { $langs->load("boxes"); $facstatic=new FactureFournisseur($db); @@ -446,7 +446,7 @@ if ($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire) print ''; print ''; - if ($conf->global->MAIN_SHOW_HT_ON_SUMMARY) print ''; + if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print ''; print ''; print ''; print ''; @@ -469,7 +469,7 @@ if ($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire) $thirdpartystatic->fournisseur=1; print $thirdpartystatic->getNomUrl(1,'supplier',44); print ''; - if ($conf->global->MAIN_SHOW_HT_ON_SUMMARY) print ''; + if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print ''; print ''; print ''; print ''; @@ -484,7 +484,7 @@ if ($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire) else { $colspan=5; - if ($conf->global->MAIN_SHOW_HT_ON_SUMMARY) $colspan++; + if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) $colspan++; print ''; } print '
'.$langs->trans("BoxTitleLastSupplierBills",$max).''.$langs->trans("AmountHT").''.$langs->trans("AmountHT").''.$langs->trans("AmountTTC").''.$langs->trans("DateModificationShort").' '.price($obj->total_ht).''.price($obj->total_ht).''.price($obj->total_ttc).''.dol_print_date($db->jdate($obj->tms),'day').''.$facstatic->LibStatut($obj->paye,$obj->fk_statut,3).'
'.$langs->trans("NoInvoice").'

'; @@ -498,7 +498,7 @@ if ($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire) // Last donations -if ($conf->don->enabled && $user->rights->societe->lire) +if (! empty($conf->don->enabled) && $user->rights->societe->lire) { include_once DOL_DOCUMENT_ROOT.'/compta/dons/class/don.class.php'; @@ -633,7 +633,7 @@ if (! empty($conf->deplacement->enabled) && $user->rights->deplacement->lire) /** * Social contributions to pay */ -if ($conf->tax->enabled && $user->rights->tax->charges->lire) +if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) { if (!$socid) { @@ -709,7 +709,7 @@ if ($conf->tax->enabled && $user->rights->tax->charges->lire) /* * Customers orders to be billed */ -if ($conf->facture->enabled && $conf->commande->enabled && $user->rights->commande->lire) +if (! empty($conf->facture->enabled) && ! empty($conf->commande->enabled) && $user->rights->commande->lire) { $commandestatic=new Commande($db); $langs->load("orders"); @@ -742,7 +742,7 @@ if ($conf->facture->enabled && $conf->commande->enabled && $user->rights->comman print ''; print ""; print ''; - if ($conf->global->MAIN_SHOW_HT_ON_SUMMARY) print ''; + if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print ''; print ''; print ''; print ''; @@ -770,7 +770,7 @@ if ($conf->facture->enabled && $conf->commande->enabled && $user->rights->comman $filename=dol_sanitizeFileName($obj->ref); $filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; - $formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','',1,'',1); + print $formfile->getDocumentsLink($commandestatic->element, $filename, $filedir); print '
'.$langs->trans("OrdersToBill").' ('.$num.')'.$langs->trans("AmountHT").''.$langs->trans("AmountHT").''.$langs->trans("AmountTTC").''.$langs->trans("ToBill").' 
'; print '
'.price($obj->total_ht).''.price($obj->total_ht).''.price($obj->total_ttc).''.price($obj->total_ttc-$obj->tot_fttc).''.$commandestatic->LibStatut($obj->fk_statut,$obj->facture,3).'
'.$langs->trans("Total").'   ('.$langs->trans("RemainderToBill").': '.price($tot_tobill).') '.price($tot_ht).''.price($tot_ht).''.price($tot_ttc).''.price($tot_tobill).' 
'; print ''; - if ($conf->global->MAIN_SHOW_HT_ON_SUMMARY) print ''; + if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print ''; print ''; print ''; print ''; @@ -853,7 +853,6 @@ if ($conf->facture->enabled && $user->rights->facture->lire) { $obj = $db->fetch_object($resql); - print ''; print '
'.$langs->trans("BillsCustomersUnpaid",$num).' ('.$num.')'.$langs->trans("AmountHT").''.$langs->trans("AmountHT").''.$langs->trans("AmountTTC").''.$langs->trans("Received").' 
'; @@ -871,7 +870,7 @@ if ($conf->facture->enabled && $user->rights->facture->lire) $filename=dol_sanitizeFileName($obj->facnumber); $filedir=$conf->facture->dir_output . '/' . dol_sanitizeFileName($obj->facnumber); $urlsource=$_SERVER['PHP_SELF'].'?facid='.$obj->rowid; - $formfile->show_documents('facture',$filename,$filedir,$urlsource,'','','',1,'',1); + print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir); print '
'; print ''; @@ -881,7 +880,7 @@ if ($conf->facture->enabled && $user->rights->facture->lire) $societestatic->client=1; print $societestatic->getNomUrl(1,'customer',44); print ''; - if ($conf->global->MAIN_SHOW_HT_ON_SUMMARY) print ''.price($obj->total).''; + if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print ''.price($obj->total).''; print ''.price($obj->total_ttc).''; print ''.price($obj->am).''; print ''.$facstatic->LibStatut($obj->paye,$obj->fk_statut,3,$obj->am).''; @@ -895,7 +894,7 @@ if ($conf->facture->enabled && $user->rights->facture->lire) } print ''.$langs->trans("Total").'   ('.$langs->trans("RemainderToTake").': '.price($total_ttc-$totalam).') '; - if ($conf->global->MAIN_SHOW_HT_ON_SUMMARY) print ''.price($total).''; + if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print ''.price($total).''; print ''.price($total_ttc).''; print ''.price($totalam).''; print ' '; @@ -904,7 +903,7 @@ if ($conf->facture->enabled && $user->rights->facture->lire) else { $colspan=5; - if ($conf->global->MAIN_SHOW_HT_ON_SUMMARY) $colspan++; + if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) $colspan++; print ''.$langs->trans("NoInvoice").''; } print '
'; @@ -919,7 +918,7 @@ if ($conf->facture->enabled && $user->rights->facture->lire) /* * Unpayed supplier invoices */ -if ($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire) +if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire) { $facstatic=new FactureFournisseur($db); @@ -945,7 +944,7 @@ if ($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire) print ''; print ''; - if ($conf->global->MAIN_SHOW_HT_ON_SUMMARY) print ''; + if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print ''; print ''; print ''; print ''; @@ -968,7 +967,7 @@ if ($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire) $societestatic->nom=$obj->nom; $societestatic->client=0; print ''; - if ($conf->global->MAIN_SHOW_HT_ON_SUMMARY) print ''; + if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print ''; print ''; print ''; print ''; @@ -981,7 +980,7 @@ if ($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire) } print ''; - if ($conf->global->MAIN_SHOW_HT_ON_SUMMARY) print ''; + if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print ''; print ''; print ''; print ''; @@ -990,7 +989,7 @@ if ($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire) else { $colspan=5; - if ($conf->global->MAIN_SHOW_HT_ON_SUMMARY) $colspan++; + if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) $colspan++; print ''; } print '
'.$langs->trans("BillsSuppliersUnpaid",$num).' ('.$num.')'.$langs->trans("AmountHT").''.$langs->trans("AmountHT").''.$langs->trans("AmountTTC").''.$langs->trans("Paid").' '.$societestatic->getNomUrl(1, 'supplier', 44).''.price($obj->total_ht).''.price($obj->total_ht).''.price($obj->total_ttc).''.price($obj->am).''.$facstatic->LibStatut($obj->paye,$obj->fk_statut,3).'
'.$langs->trans("Total").'   ('.$langs->trans("RemainderToPay").': '.price($total_ttc-$totalam).') '.price($total).''.price($total).''.price($total_ttc).''.price($totalam).' 
'.$langs->trans("NoInvoice").'

'; diff --git a/htdocs/compta/journal/purchasesjournal.php b/htdocs/compta/journal/purchasesjournal.php index 07cd3d146e2..62ac4818cb9 100755 --- a/htdocs/compta/journal/purchasesjournal.php +++ b/htdocs/compta/journal/purchasesjournal.php @@ -3,6 +3,7 @@ * Copyright (C) 2007-2010 Jean Heimburger * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2012 Regis Houssin + * Copyright (C) 2011-2012 Alexandre Spangaro * * 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 @@ -95,7 +96,7 @@ $sql = "SELECT f.rowid, f.facnumber, f.type, f.datef, f.libelle,"; $sql.= " fd.total_ttc, fd.tva_tx, fd.total_ht, fd.tva as total_tva, fd.product_type,"; $sql.= " s.rowid as socid, s.nom as name, s.code_compta_fournisseur,"; $sql.= " p.rowid as pid, p.ref as ref, p.accountancy_code_buy,"; -$sql.= " ct.accountancy_code"; +$sql.= " ct.accountancy_code_buy as account_tva"; $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn_det fd"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '".$idpays."'"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product p ON p.rowid = fd.fk_product"; @@ -130,7 +131,7 @@ if ($result) if($obj->product_type == 0) $compta_prod = (! empty($conf->global->COMPTA_PRODUCT_BUY_ACCOUNT))?$conf->global->COMPTA_PRODUCT_BUY_ACCOUNT:$langs->trans("CodeNotDef"); else $compta_prod = (! empty($conf->global->COMPTA_SERVICE_BUY_ACCOUNT))?$conf->global->COMPTA_SERVICE_BUY_ACCOUNT:$langs->trans("CodeNotDef"); } - $compta_tva = (! empty($obj->accountancy_code))?$obj->accountancy_code:$cpttva; + $compta_tva = (! empty($obj->account_tva))?$obj->account_tva:$cpttva; $tabfac[$obj->rowid]["date"] = $obj->datef; $tabfac[$obj->rowid]["ref"] = $obj->facnumber; @@ -158,7 +159,7 @@ print ""; print "".$langs->trans("Date").""; print "".$langs->trans("Piece").' ('.$langs->trans("InvoiceRef").")"; print "".$langs->trans("Account").""; -print "".$langs->trans("Type")."".$langs->trans("Debit")."".$langs->trans("Credit").""; +print "".$langs->trans("Type")."".$langs->trans("Debit")."".$langs->trans("Credit").""; print "\n"; $var=true; diff --git a/htdocs/compta/journal/sellsjournal.php b/htdocs/compta/journal/sellsjournal.php index 66ed316c35e..78d174d9565 100755 --- a/htdocs/compta/journal/sellsjournal.php +++ b/htdocs/compta/journal/sellsjournal.php @@ -3,6 +3,7 @@ * Copyright (C) 2007-2010 Jean Heimburger * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2012 Regis Houssin + * Copyright (C) 2011-2012 Alexandre Spangaro * * 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 @@ -97,7 +98,7 @@ $sql = "SELECT f.rowid, f.facnumber, f.type, f.datef, f.ref_client,"; $sql.= " fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.total_ttc,"; $sql.= " s.rowid as socid, s.nom as name, s.code_compta, s.client,"; $sql.= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell,"; -$sql.= " ct.accountancy_code"; +$sql.= " ct.accountancy_code_sell as account_tva"; $sql.= " FROM ".MAIN_DB_PREFIX."facturedet fd"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product p ON p.rowid = fd.fk_product"; $sql.= " JOIN ".MAIN_DB_PREFIX."facture f ON f.rowid = fd.fk_facture"; @@ -134,7 +135,7 @@ if ($result) else $compta_prod = (! empty($conf->global->COMPTA_SERVICE_SOLD_ACCOUNT)?$conf->global->COMPTA_SERVICE_SOLD_ACCOUNT:$langs->trans("CodeNotDef")); } $cpttva = (! empty($conf->global->COMPTA_VAT_ACCOUNT)?$conf->global->COMPTA_VAT_ACCOUNT:$langs->trans("CodeNotDef")); - $compta_tva = (! empty($obj->accountancy_code)?$obj->accountancy_code:$cpttva); + $compta_tva = (! empty($obj->account_tva)?$obj->account_tva:$cpttva); //la ligne facture $tabfac[$obj->rowid]["date"] = $obj->datef; @@ -166,7 +167,7 @@ print ""; //print "".$langs->trans("JournalNum").""; print "".$langs->trans("Date")."".$langs->trans("Piece").' ('.$langs->trans("InvoiceRef").")"; print "".$langs->trans("Account").""; -print "".$langs->trans("Type")."".$langs->trans("Debit")."".$langs->trans("Credit").""; +print "".$langs->trans("Type")."".$langs->trans("Debit")."".$langs->trans("Credit").""; print "\n"; $var=true; diff --git a/htdocs/compta/localtax/class/localtax.class.php b/htdocs/compta/localtax/class/localtax.class.php index 3ad10ec2d08..a5afc66a9ef 100644 --- a/htdocs/compta/localtax/class/localtax.class.php +++ b/htdocs/compta/localtax/class/localtax.class.php @@ -464,12 +464,12 @@ class Localtax extends CommonObject $this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount")); return -4; } - if ($conf->banque->enabled && (empty($this->accountid) || $this->accountid <= 0)) + if (! empty($conf->banque->enabled) && (empty($this->accountid) || $this->accountid <= 0)) { $this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Account")); return -5; } - if ($conf->banque->enabled && (empty($this->paymenttype) || $this->paymenttype <= 0)) + if (! empty($conf->banque->enabled) && (empty($this->paymenttype) || $this->paymenttype <= 0)) { $this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("PaymentMode")); return -5; @@ -496,7 +496,7 @@ class Localtax extends CommonObject if ($this->id > 0) { $ok=1; - if ($conf->banque->enabled) + if (! empty($conf->banque->enabled)) { // Insertion dans llx_bank require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; diff --git a/htdocs/compta/localtax/clients.php b/htdocs/compta/localtax/clients.php index e62dc08adc9..ed0b7e11752 100644 --- a/htdocs/compta/localtax/clients.php +++ b/htdocs/compta/localtax/clients.php @@ -107,7 +107,7 @@ if ($modetax==1) // Calculate on invoice for goods and services $nom=$langs->transcountry("LT2ReportByCustomersInInputOutputMode",$mysoc->country_code); $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); $description=$langs->trans("RulesVATDue"); - if ($conf->global->MAIN_MODULE_COMPTABILITE) $description.='
'.$langs->trans("WarningDepositsNotIncluded"); + if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='
'.$langs->trans("WarningDepositsNotIncluded"); $description.=$fsearch; $description.='
('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')'; $builddate=time(); @@ -124,7 +124,7 @@ if ($modetax==0) // Invoice for goods, payment for services $nom=$langs->transcountry("LT2ReportByCustomersInInputOutputMode",$mysoc->country_code); $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); $description=$langs->trans("RulesVATIn"); - if ($conf->global->MAIN_MODULE_COMPTABILITE) $description.='
'.$langs->trans("WarningDepositsNotIncluded"); + if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='
'.$langs->trans("WarningDepositsNotIncluded"); $description.=$fsearch; $description.='
('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')'; $builddate=time(); diff --git a/htdocs/compta/localtax/fiche.php b/htdocs/compta/localtax/fiche.php index cccee441ac5..ce8ce775cf3 100644 --- a/htdocs/compta/localtax/fiche.php +++ b/htdocs/compta/localtax/fiche.php @@ -168,7 +168,7 @@ if ($_GET["action"] == 'create') // Amount print ''.$langs->trans("Amount").''; - if ($conf->banque->enabled) + if (! empty($conf->banque->enabled)) { print ''.$langs->trans("Account").''; $form->select_comptes($_POST["accountid"],"accountid",0,"courant=1",1); // Affiche liste des comptes courant @@ -227,7 +227,7 @@ if ($id) print ''.$langs->trans("Amount").''.price($vatpayment->amount).''; - if ($conf->banque->enabled) + if (! empty($conf->banque->enabled)) { if ($vatpayment->fk_account > 0) { diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 974b266354c..ed6e0c7f0aa 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -97,7 +97,7 @@ if ($action == 'add_paiement' || ($action == 'confirm_paiement' && $confirm=='ye $error++; } - if ($conf->banque->enabled) + if (! empty($conf->banque->enabled)) { // Si module bank actif, un compte est obligatoire lors de la saisie // d'un paiement @@ -245,7 +245,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie // Invoice with Paypal transaction // TODO add hook possibility (regis) - if ($conf->paypalplus->enabled && $conf->global->PAYPAL_ENABLE_TRANSACTION_MANAGEMENT && ! empty($facture->ref_int)) + if (! empty($conf->paypalplus->enabled) && $conf->global->PAYPAL_ENABLE_TRANSACTION_MANAGEMENT && ! empty($facture->ref_int)) { if (! empty($conf->global->PAYPAL_BANK_ACCOUNT)) $accountid=$conf->global->PAYPAL_BANK_ACCOUNT; $paymentnum=$facture->ref_int; @@ -385,7 +385,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie // Bank account print ''; - if ($conf->banque->enabled) + if (! empty($conf->banque->enabled)) { if ($facture->type != 2) print ''.$langs->trans('AccountToCredit').''; if ($facture->type == 2) print ''.$langs->trans('AccountToDebit').''; @@ -589,10 +589,10 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie { // print ''; print '

'.$langs->trans("ClosePaidInvoicesAutomatically"); - /*if ($conf->prelevement->enabled) + /*if (! empty($conf->prelevement->enabled)) { $langs->load("withdrawals"); - if ($conf->global->WITHDRAW_DISABLE_AUTOCREATE_ONPAYMENTS) print '
'.$langs->trans("IfInvoiceNeedOnWithdrawPaymentWontBeClosed"); + if (! empty($conf->global->WITHDRAW_DISABLE_AUTOCREATE_ONPAYMENTS)) print '
'.$langs->trans("IfInvoiceNeedOnWithdrawPaymentWontBeClosed"); }*/ print '


'; // print ''; diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 74d891a7764..3d23f896c0e 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -192,7 +192,7 @@ class Paiement extends CommonObject // This payment might be this one or a previous one if ($paym['type']=='PRE') { - if ($conf->prelevement->enabled) + if (! empty($conf->prelevement->enabled)) { // TODO Check if this payment has a withdraw request // if not, $mustwait++; // This will disable automatic close on invoice to allow to process @@ -377,7 +377,7 @@ class Paiement extends CommonObject $bank_line_id=0; $this->fk_account=$accountid; - if ($conf->banque->enabled) + if (! empty($conf->banque->enabled)) { require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; diff --git a/htdocs/compta/paiement/fiche.php b/htdocs/compta/paiement/fiche.php index acd041cc5c3..96b13604708 100644 --- a/htdocs/compta/paiement/fiche.php +++ b/htdocs/compta/paiement/fiche.php @@ -29,7 +29,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT .'/core/modules/facture/modules_facture.php'; -if ($conf->banque->enabled) require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; +if (! empty($conf->banque->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; $langs->load('bills'); $langs->load('banks'); @@ -238,7 +238,7 @@ print $form->editfieldval("Note",'note',$object->note,$object,$user->rights->fac print ''; // Bank account -if ($conf->banque->enabled) +if (! empty($conf->banque->enabled)) { if ($object->bank_account) { @@ -355,7 +355,7 @@ print ''; print '
'; -if ($conf->global->BILL_ADD_PAYMENT_VALIDATION) +if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) { if ($user->societe_id == 0 && $object->statut == 0 && $_GET['action'] == '') { diff --git a/htdocs/compta/paiement/liste.php b/htdocs/compta/paiement/liste.php index 714d8a20d59..e1d460e0051 100644 --- a/htdocs/compta/paiement/liste.php +++ b/htdocs/compta/paiement/liste.php @@ -143,7 +143,7 @@ if ($resql) print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$paramlist,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"p.amount","",$paramlist,'align="right"',$sortfield,$sortorder); //print_liste_field_titre($langs->trans("Invoices"),"","","",$paramlist,'align="left"',$sortfield,$sortorder); - if ($conf->global->BILL_ADD_PAYMENT_VALIDATION) + if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) { print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.statut","",$paramlist,'align="right"',$sortfield,$sortorder); } @@ -168,7 +168,7 @@ if ($resql) print ''; print ''; print ''; - if ($conf->global->BILL_ADD_PAYMENT_VALIDATION) + if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) { print ''; print ''; @@ -213,7 +213,7 @@ if ($resql) print ''; print ''.price($objp->amount).''; - if ($conf->global->BILL_ADD_PAYMENT_VALIDATION) + if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) { print ''; if ($objp->statut == 0) print ''; diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php index 8539e828ac5..ff53254f4aa 100755 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -66,7 +66,7 @@ if ($_POST["action"] == 'add_payment') $mesg = $langs->trans("ErrorFieldRequired",$langs->transnoentities("Date")); $error++; } - if ($conf->banque->enabled && ! $_POST["accountid"] > 0) + if (! empty($conf->banque->enabled) && ! $_POST["accountid"] > 0) { $mesg = $langs->trans("ErrorFieldRequired",$langs->transnoentities("AccountToCredit")); $error++; diff --git a/htdocs/compta/payment_sc/fiche.php b/htdocs/compta/payment_sc/fiche.php index de865468d60..222c78a7f1d 100644 --- a/htdocs/compta/payment_sc/fiche.php +++ b/htdocs/compta/payment_sc/fiche.php @@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php' require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/paymentsocialcontribution.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/facture/modules_facture.php'; -if ($conf->banque->enabled) require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; +if (! empty($conf->banque->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; $langs->load('bills'); $langs->load('banks'); @@ -189,7 +189,7 @@ print ''.$langs->trans('Amount').''.pr print ''.$langs->trans('Note').''.nl2br($paiement->note).''; // Bank account -if ($conf->banque->enabled) +if (! empty($conf->banque->enabled)) { if ($paiement->bank_account) { @@ -293,7 +293,7 @@ print '
'; print '
'; /* -if ($conf->global->BILL_ADD_PAYMENT_VALIDATION) +if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) { if ($user->societe_id == 0 && $paiement->statut == 0 && $_GET['action'] == '') { diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 0081af46ecf..11c575f701d 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -1185,7 +1185,7 @@ class BonPrelevement extends CommonObject if ($mysoc->country_code=='ES') { // TODO replace by a hook (external modules) - if ($conf->esaeb->enabled) + if (! empty($conf->esaeb->enabled)) { //Head $esaeb19 = new AEB19DocWritter; diff --git a/htdocs/compta/recap-compta.php b/htdocs/compta/recap-compta.php index c458f55813d..9b3cc8b487a 100644 --- a/htdocs/compta/recap-compta.php +++ b/htdocs/compta/recap-compta.php @@ -27,7 +27,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $langs->load("companies"); -if ($conf->facture->enabled) $langs->load("bills"); +if (! empty($conf->facture->enabled)) $langs->load("bills"); // Security check $socid = $_GET["socid"]; @@ -79,7 +79,7 @@ if ($socid > 0) print '
'; - if ($conf->facture->enabled && $user->rights->facture->lire) + if (! empty($conf->facture->enabled) && $user->rights->facture->lire) { // Factures print_fiche_titre($langs->trans("CustomerPreview")); diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index 7bff88b37a4..cfbf7a91568 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -472,7 +472,7 @@ class PaymentSocialContribution extends CommonObject $error=0; - if ($conf->banque->enabled) + if (! empty($conf->banque->enabled)) { require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; diff --git a/htdocs/compta/stats/cabyuser.php b/htdocs/compta/stats/cabyuser.php index 31a86e475df..7087653459c 100644 --- a/htdocs/compta/stats/cabyuser.php +++ b/htdocs/compta/stats/cabyuser.php @@ -282,9 +282,9 @@ if (count($amount)) // Other stats print ''; - if ($conf->propal->enabled && $key>0) print ' 
'.img_picto($langs->trans("ProposalStats"),"stats").' '; - if ($conf->commande->enabled && $key>0) print ' '.img_picto($langs->trans("OrderStats"),"stats").' '; - if ($conf->facture->enabled && $key>0) print ' '.img_picto($langs->trans("InvoiceStats"),"stats").' '; + if (! empty($conf->propal->enabled) && $key>0) print ' '.img_picto($langs->trans("ProposalStats"),"stats").' '; + if (! empty($conf->commande->enabled) && $key>0) print ' '.img_picto($langs->trans("OrderStats"),"stats").' '; + if (! empty($conf->facture->enabled) && $key>0) print ' '.img_picto($langs->trans("InvoiceStats"),"stats").' '; print ''; print "\n"; diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php index 3bf19f18942..1460cb185e5 100644 --- a/htdocs/compta/stats/casoc.php +++ b/htdocs/compta/stats/casoc.php @@ -292,9 +292,9 @@ if (count($amount)) // Other stats print ''; - if ($conf->propal->enabled && $key>0) print ' '.img_picto($langs->trans("ProposalStats"),"stats").' '; - if ($conf->commande->enabled && $key>0) print ' '.img_picto($langs->trans("OrderStats"),"stats").' '; - if ($conf->facture->enabled && $key>0) print ' '.img_picto($langs->trans("InvoiceStats"),"stats").' '; + if (! empty($conf->propal->enabled) && $key>0) print ' '.img_picto($langs->trans("ProposalStats"),"stats").' '; + if (! empty($conf->commande->enabled) && $key>0) print ' '.img_picto($langs->trans("OrderStats"),"stats").' '; + if (! empty($conf->facture->enabled) && $key>0) print ' '.img_picto($langs->trans("InvoiceStats"),"stats").' '; print ''; print "\n"; diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index 23d01de6631..7e2eeeebc0d 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -485,12 +485,12 @@ class Tva extends CommonObject $this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount")); return -4; } - if ($conf->banque->enabled && (empty($this->accountid) || $this->accountid <= 0)) + if (! empty($conf->banque->enabled) && (empty($this->accountid) || $this->accountid <= 0)) { $this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Account")); return -5; } - if ($conf->banque->enabled && (empty($this->paymenttype) || $this->paymenttype <= 0)) + if (! empty($conf->banque->enabled) && (empty($this->paymenttype) || $this->paymenttype <= 0)) { $this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("PaymentMode")); return -5; @@ -525,7 +525,7 @@ class Tva extends CommonObject if ($this->id > 0) { $ok=1; - if ($conf->banque->enabled) + if (! empty($conf->banque->enabled)) { // Insertion dans llx_bank require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; diff --git a/htdocs/compta/tva/clients.php b/htdocs/compta/tva/clients.php index 71dbdb6c947..68bfe41d968 100644 --- a/htdocs/compta/tva/clients.php +++ b/htdocs/compta/tva/clients.php @@ -117,7 +117,7 @@ if ($modetax==1) // Calculate on invoice for goods and services $description.='
'; $description.=$langs->trans("RulesVATDueProducts"); //if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='
'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite'); - //if ($conf->global->MAIN_MODULE_COMPTABILITE) $description.='
'.$langs->trans("WarningDepositsNotIncluded"); + //if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='
'.$langs->trans("WarningDepositsNotIncluded"); if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.='
'.$langs->trans("DepositsAreNotIncluded"); else $description.='
'.$langs->trans("DepositsAreIncluded"); $description.=$fsearch; @@ -147,7 +147,7 @@ if ($modetax==0) // Invoice for goods, payment for services if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.=' '.$langs->trans("DepositsAreNotIncluded"); else $description.=' '.$langs->trans("DepositsAreIncluded"); //if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='
'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite'); - //if ($conf->global->MAIN_MODULE_COMPTABILITE) $description.='
'.$langs->trans("WarningDepositsNotIncluded"); + //if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='
'.$langs->trans("WarningDepositsNotIncluded"); $description.=$fsearch; $description.='
('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')'; $builddate=time(); diff --git a/htdocs/compta/tva/fiche.php b/htdocs/compta/tva/fiche.php index a5e1693c8f2..765b0d77fb8 100644 --- a/htdocs/compta/tva/fiche.php +++ b/htdocs/compta/tva/fiche.php @@ -172,7 +172,7 @@ if ($_GET["action"] == 'create') // Amount print ''.$langs->trans("Amount").''; - if ($conf->banque->enabled) + if (! empty($conf->banque->enabled)) { print ''.$langs->trans("Account").''; $form->select_comptes($_POST["accountid"],"accountid",0,"courant=1",1); // Affiche liste des comptes courant @@ -236,7 +236,7 @@ if ($id) print ''.$langs->trans("Amount").''.price($vatpayment->amount).''; - if ($conf->banque->enabled) + if (! empty($conf->banque->enabled)) { if ($vatpayment->fk_account > 0) { diff --git a/htdocs/compta/tva/quadri_detail.php b/htdocs/compta/tva/quadri_detail.php index 1bcd7cabb47..e323117091d 100644 --- a/htdocs/compta/tva/quadri_detail.php +++ b/htdocs/compta/tva/quadri_detail.php @@ -137,7 +137,7 @@ if ($modetax==1) // Calculate on invoice for goods and services $description.='
'; $description.=$langs->trans("RulesVATDueProducts"); //if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='
'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite'); - //if ($conf->global->MAIN_MODULE_COMPTABILITE) $description.='
'.$langs->trans("WarningDepositsNotIncluded"); + //if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='
'.$langs->trans("WarningDepositsNotIncluded"); if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.='
'.$langs->trans("DepositsAreNotIncluded"); else $description.='
'.$langs->trans("DepositsAreIncluded"); $description.='
('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')'; @@ -174,7 +174,7 @@ if ($modetax==0) // Invoice for goods, payment for services if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.=' '.$langs->trans("DepositsAreNotIncluded"); else $description.=' '.$langs->trans("DepositsAreIncluded"); //if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='
'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite'); - //if ($conf->global->MAIN_MODULE_COMPTABILITE) $description.='
'.$langs->trans("WarningDepositsNotIncluded"); + //if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='
'.$langs->trans("WarningDepositsNotIncluded"); $description.=$fsearch; $description.='
('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')'; $builddate=time(); diff --git a/htdocs/contact/canvas/actions_contactcard_common.class.php b/htdocs/contact/canvas/actions_contactcard_common.class.php index c839f7a24e1..bcfaa39be96 100644 --- a/htdocs/contact/canvas/actions_contactcard_common.class.php +++ b/htdocs/contact/canvas/actions_contactcard_common.class.php @@ -310,7 +310,7 @@ abstract class ActionsContactCardCommon if ($action == 'view' || $action == 'edit' || $action == 'delete') { // Emailing - if ($conf->mailing->enabled) + if (! empty($conf->mailing->enabled)) { $langs->load("mails"); $this->tpl['nb_emailing'] = $this->object->getNbOfEMailings(); @@ -322,25 +322,25 @@ abstract class ActionsContactCardCommon $this->object->load_ref_elements(); - if ($conf->commande->enabled) + if (! empty($conf->commande->enabled)) { $this->tpl['contact_element'][$i]['linked_element_label'] = $langs->trans("ContactForOrders"); $this->tpl['contact_element'][$i]['linked_element_value'] = $this->object->ref_commande?$this->object->ref_commande:$langs->trans("NoContactForAnyOrder"); $i++; } - if ($conf->propal->enabled) + if (! empty($conf->propal->enabled)) { $this->tpl['contact_element'][$i]['linked_element_label'] = $langs->trans("ContactForProposals"); $this->tpl['contact_element'][$i]['linked_element_value'] = $this->object->ref_propal?$this->object->ref_propal:$langs->trans("NoContactForAnyProposal"); $i++; } - if ($conf->contrat->enabled) + if (! empty($conf->contrat->enabled)) { $this->tpl['contact_element'][$i]['linked_element_label'] = $langs->trans("ContactForContracts"); $this->tpl['contact_element'][$i]['linked_element_value'] = $this->object->ref_contrat?$this->object->ref_contrat:$langs->trans("NoContactForAnyContract"); $i++; } - if ($conf->facture->enabled) + if (! empty($conf->facture->enabled)) { $this->tpl['contact_element'][$i]['linked_element_label'] = $langs->trans("ContactForInvoices"); $this->tpl['contact_element'][$i]['linked_element_value'] = $this->object->ref_facturation?$this->object->ref_facturation:$langs->trans("NoContactForAnyInvoice"); diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 93ee8e61692..bf0f5057179 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -263,6 +263,22 @@ class Contact extends CommonObject unset($this->state_code); unset($this->state); + // Actions on extra fields (by external module or standard code) + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + $hookmanager=new HookManager($this->db); + $hookmanager->initHooks(array('contactdao')); + $parameters=array('socid'=>$this->id); + $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + if (empty($reshook)) + { + $result=$this->insertExtraFields(); + if ($result < 0) + { + $error++; + } + } + else if ($reshook < 0) $error++; + if (! $error && ! $notrigger) { // Appel des triggers @@ -331,9 +347,9 @@ class Contact extends CommonObject $this->fullname=$this->getFullName($langs); // Fields - if ($this->fullname && $conf->global->LDAP_CONTACT_FIELD_FULLNAME) $info[$conf->global->LDAP_CONTACT_FIELD_FULLNAME] = $this->fullname; - if ($this->lastname && $conf->global->LDAP_CONTACT_FIELD_NAME) $info[$conf->global->LDAP_CONTACT_FIELD_NAME] = $this->lastname; - if ($this->firstname && $conf->global->LDAP_CONTACT_FIELD_FIRSTNAME) $info[$conf->global->LDAP_CONTACT_FIELD_FIRSTNAME] = $this->firstname; + if ($this->fullname && ! empty($conf->global->LDAP_CONTACT_FIELD_FULLNAME)) $info[$conf->global->LDAP_CONTACT_FIELD_FULLNAME] = $this->fullname; + if ($this->lastname && ! empty($conf->global->LDAP_CONTACT_FIELD_NAME)) $info[$conf->global->LDAP_CONTACT_FIELD_NAME] = $this->lastname; + if ($this->firstname && ! empty($conf->global->LDAP_CONTACT_FIELD_FIRSTNAME)) $info[$conf->global->LDAP_CONTACT_FIELD_FIRSTNAME] = $this->firstname; if ($this->poste) $info["title"] = $this->poste; if ($this->socid > 0) @@ -346,16 +362,16 @@ class Contact extends CommonObject if ($soc->client == 2) $info["businessCategory"] = "Prospects"; if ($soc->fournisseur == 1) $info["businessCategory"] = "Suppliers"; } - if ($this->address && $conf->global->LDAP_CONTACT_FIELD_ADDRESS) $info[$conf->global->LDAP_CONTACT_FIELD_ADDRESS] = $this->address; - if ($this->cp && $conf->global->LDAP_CONTACT_FIELD_ZIP) $info[$conf->global->LDAP_CONTACT_FIELD_ZIP] = $this->cp; - if ($this->ville && $conf->global->LDAP_CONTACT_FIELD_TOWN) $info[$conf->global->LDAP_CONTACT_FIELD_TOWN] = $this->ville; - if ($this->country_code && $conf->global->LDAP_CONTACT_FIELD_COUNTRY) $info[$conf->global->LDAP_CONTACT_FIELD_COUNTRY] = $this->country_code; - if ($this->phone_pro && $conf->global->LDAP_CONTACT_FIELD_PHONE) $info[$conf->global->LDAP_CONTACT_FIELD_PHONE] = $this->phone_pro; - if ($this->phone_perso && $conf->global->LDAP_CONTACT_FIELD_HOMEPHONE) $info[$conf->global->LDAP_CONTACT_FIELD_HOMEPHONE] = $this->phone_perso; - if ($this->phone_mobile && $conf->global->LDAP_CONTACT_FIELD_MOBILE) $info[$conf->global->LDAP_CONTACT_FIELD_MOBILE] = $this->phone_mobile; - if ($this->fax && $conf->global->LDAP_CONTACT_FIELD_FAX) $info[$conf->global->LDAP_CONTACT_FIELD_FAX] = $this->fax; - if ($this->note && $conf->global->LDAP_CONTACT_FIELD_DESCRIPTION) $info[$conf->global->LDAP_CONTACT_FIELD_DESCRIPTION] = $this->note; - if ($this->email && $conf->global->LDAP_CONTACT_FIELD_MAIL) $info[$conf->global->LDAP_CONTACT_FIELD_MAIL] = $this->email; + if ($this->address && ! empty($conf->global->LDAP_CONTACT_FIELD_ADDRESS)) $info[$conf->global->LDAP_CONTACT_FIELD_ADDRESS] = $this->address; + if ($this->cp && ! empty($conf->global->LDAP_CONTACT_FIELD_ZIP)) $info[$conf->global->LDAP_CONTACT_FIELD_ZIP] = $this->cp; + if ($this->ville && ! empty($conf->global->LDAP_CONTACT_FIELD_TOWN)) $info[$conf->global->LDAP_CONTACT_FIELD_TOWN] = $this->ville; + if ($this->country_code && ! empty($conf->global->LDAP_CONTACT_FIELD_COUNTRY)) $info[$conf->global->LDAP_CONTACT_FIELD_COUNTRY] = $this->country_code; + if ($this->phone_pro && ! empty($conf->global->LDAP_CONTACT_FIELD_PHONE)) $info[$conf->global->LDAP_CONTACT_FIELD_PHONE] = $this->phone_pro; + if ($this->phone_perso && ! empty($conf->global->LDAP_CONTACT_FIELD_HOMEPHONE)) $info[$conf->global->LDAP_CONTACT_FIELD_HOMEPHONE] = $this->phone_perso; + if ($this->phone_mobile && ! empty($conf->global->LDAP_CONTACT_FIELD_MOBILE)) $info[$conf->global->LDAP_CONTACT_FIELD_MOBILE] = $this->phone_mobile; + if ($this->fax && ! empty($conf->global->LDAP_CONTACT_FIELD_FAX)) $info[$conf->global->LDAP_CONTACT_FIELD_FAX] = $this->fax; + if ($this->note && ! empty($conf->global->LDAP_CONTACT_FIELD_DESCRIPTION)) $info[$conf->global->LDAP_CONTACT_FIELD_DESCRIPTION] = $this->note; + if ($this->email && ! empty($conf->global->LDAP_CONTACT_FIELD_MAIL)) $info[$conf->global->LDAP_CONTACT_FIELD_MAIL] = $this->email; if ($conf->global->LDAP_SERVER_TYPE == 'egroupware') { @@ -809,11 +825,11 @@ class Contact extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc"; $sql.= " WHERE mc.email = '".$this->db->escape($this->email)."'"; $sql.= " AND mc.statut NOT IN (-1,0)"; // -1 erreur, 0 non envoye, 1 envoye avec succes - + dol_syslog(get_class($this)."::getNbOfEMailings sql=".$sql, LOG_DEBUG); - + $resql=$this->db->query($sql); - + if ($resql) { $obj = $this->db->fetch_object($resql); diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php index 03a356a8a72..30e6952db44 100644 --- a/htdocs/contact/fiche.php +++ b/htdocs/contact/fiche.php @@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/contact.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; $langs->load("companies"); $langs->load("users"); @@ -47,6 +48,7 @@ $socid = GETPOST('socid','int'); if ($user->societe_id) $socid=$user->societe_id; $object = new Contact($db); +$extrafields = new ExtraFields($db); // Get object canvas (By default, this is not defined, so standard usage of dolibarr) $object->getCanvas($id); @@ -74,6 +76,7 @@ $hookmanager->initHooks(array('contactcard')); $parameters=array('id'=>$id, 'objcanvas'=>$objcanvas); $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +$error=$hookmanager->error; $errors=array_merge($errors, (array) $hookmanager->errors); if (empty($reshook)) { @@ -154,6 +157,15 @@ if (empty($reshook)) $object->birthday = dol_mktime(0,0,0,$_POST["birthdaymonth"],$_POST["birthdayday"],$_POST["birthdayyear"]); $object->birthday_alert = $_POST["birthday_alert"]; + // Get extra fields + foreach($_POST as $key => $value) + { + if (preg_match("/^options_/",$key)) + { + $object->array_options[$key]=GETPOST($key); + } + } + if (! $_POST["lastname"]) { $error++; $errors[]=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Lastname").' / '.$langs->transnoentities("Label")); @@ -242,6 +254,15 @@ if (empty($reshook)) $object->priv = $_POST["priv"]; $object->note = $_POST["note"]; + // Get extra fields + foreach($_POST as $key => $value) + { + if (preg_match("/^options_/",$key)) + { + $object->array_options[$key]=GETPOST($key); + } + } + $result = $object->update($_POST["contactid"], $user); if ($result > 0) @@ -264,6 +285,9 @@ if (empty($reshook)) * View */ +// fetch optionals attributes and labels +$extralabels=$extrafields->fetch_name_optionals_label('contact'); + $help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; llxHeader('',$langs->trans("ContactsAddresses"),$help_url); @@ -314,12 +338,9 @@ else { // Si edition contact deja existant $object = new Contact($db); - $return=$object->fetch($id, $user); - if ($return <= 0) - { - dol_print_error('',$object->error); - $id=0; - } + $res=$object->fetch($id, $user); + if ($res < 0) { dol_print_error($db,$object->error); exit; } + $res=$object->fetch_optionals($object->id,$extralabels); // Show tabs $head = contact_prepare_head($object); @@ -471,6 +492,20 @@ else // Note print ''.$langs->trans("Note").''; + // Other attributes + $parameters=array('colspan' => ' colspan="3"'); + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + if (empty($reshook) && ! empty($extrafields->attribute_label)) + { + foreach($extrafields->attribute_label as $key=>$label) + { + $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:(isset($object->array_options["options_".$key])?$object->array_options["options_".$key]:'')); + print ''.$label.''; + print $extrafields->showInputField($key,$value); + print ''."\n"; + } + } + print "
"; @@ -503,10 +538,6 @@ else } print ''; - // Other attributes - $parameters=array('colspan' => ' colspan="3"'); - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook - print "

"; @@ -651,35 +682,50 @@ else print $form->selectarray('priv',$selectarray,$object->priv,0); print ''; + // Note print ''.$langs->trans("Note").''; print ''; + // Other attributes + $parameters=array('colspan' => ' colspan="3"'); + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + if (empty($reshook) && ! empty($extrafields->attribute_label)) + { + foreach($extrafields->attribute_label as $key=>$label) + { + $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); + print ''.$label.''; + print $extrafields->showInputField($key,$value); + print "\n"; + } + } + $object->load_ref_elements(); - if ($conf->commande->enabled) + if (! empty($conf->commande->enabled)) { print ''.$langs->trans("ContactForOrders").''; print $object->ref_commande?$object->ref_commande:$langs->trans("NoContactForAnyOrder"); print ''; } - if ($conf->propal->enabled) + if (! empty($conf->propal->enabled)) { print ''.$langs->trans("ContactForProposals").''; print $object->ref_propal?$object->ref_propal:$langs->trans("NoContactForAnyProposal"); print ''; } - if ($conf->contrat->enabled) + if (! empty($conf->contrat->enabled)) { print ''.$langs->trans("ContactForContracts").''; print $object->ref_contrat?$object->ref_contrat:$langs->trans("NoContactForAnyContract"); print ''; } - if ($conf->facture->enabled) + if (! empty($conf->facture->enabled)) { print ''.$langs->trans("ContactForInvoices").''; print $object->ref_facturation?$object->ref_facturation:$langs->trans("NoContactForAnyInvoice"); @@ -697,10 +743,6 @@ else else print $langs->trans("NoDolibarrAccess"); print ''; - // Other attributes - $parameters=array('colspan' => ' colspan="3"'); - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook - print '
'; print '
'; @@ -744,7 +786,7 @@ else //array('label' => $form->textwithpicto($langs->trans("Type"),$langs->trans("InternalExternalDesc")), 'type' => 'select', 'name' => 'intern', 'default' => 1, 'values' => array(0=>$langs->trans('Internal'),1=>$langs->trans('External'))) ); $text=$langs->trans("ConfirmCreateContact").'
'; - if ($conf->societe->enabled) + if (! empty($conf->societe->enabled)) { if ($object->socid > 0) $text.=$langs->trans("UserWillBeExternalUser"); else $text.=$langs->trans("UserWillBeInternalUser"); @@ -823,7 +865,7 @@ else // Email print ''.$langs->trans("EMail").''.dol_print_email($object->email,$object->id,$object->socid,'AC_EMAIL').''; - if ($conf->mailing->enabled) + if (! empty($conf->mailing->enabled)) { $langs->load("mails"); print ''.$langs->trans("NbOfEMailingsReceived").''; @@ -851,34 +893,49 @@ else print $object->LibPubPriv($object->priv); print ''; + // Note print ''.$langs->trans("Note").''; print nl2br($object->note); print ''; + // Other attributes + $parameters=array('socid'=>$socid, 'colspan' => ' colspan="3"'); + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + if (empty($reshook) && ! empty($extrafields->attribute_label)) + { + foreach($extrafields->attribute_label as $key=>$label) + { + $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:(isset($object->array_options['options_'.$key])?$object->array_options['options_'.$key]:'')); + print ''.$label.''; + print $extrafields->showOutputField($key,$value); + print "\n"; + } + } + $object->load_ref_elements(); - if ($conf->commande->enabled) + if (! empty($conf->commande->enabled)) { print ''.$langs->trans("ContactForOrders").''; print $object->ref_commande?$object->ref_commande:$langs->trans("NoContactForAnyOrder"); print ''; } - if ($conf->propal->enabled) + if (! empty($conf->propal->enabled)) { print ''.$langs->trans("ContactForProposals").''; print $object->ref_propal?$object->ref_propal:$langs->trans("NoContactForAnyProposal"); print ''; } - if ($conf->contrat->enabled) + if (! empty($conf->contrat->enabled)) { print ''.$langs->trans("ContactForContracts").''; print $object->ref_contrat?$object->ref_contrat:$langs->trans("NoContactForAnyContract"); print ''; } - if ($conf->facture->enabled) + if (! empty($conf->facture->enabled)) { print ''.$langs->trans("ContactForInvoices").''; print $object->ref_facturation?$object->ref_facturation:$langs->trans("NoContactForAnyInvoice"); @@ -895,10 +952,6 @@ else else print $langs->trans("NoDolibarrAccess"); print ''; - // Other attributes - $parameters=array('colspan' => ' colspan="3"'); - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook - print ""; print ""; diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php index 4c9ba902cd0..c402c184366 100644 --- a/htdocs/contrat/fiche.php +++ b/htdocs/contrat/fiche.php @@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/contract/modules_contract.php'; if (! empty($conf->produit->enabled) || ! empty($conf->service->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; -if ($conf->projet->enabled) { +if (! empty($conf->projet->enabled)) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; } @@ -618,7 +618,7 @@ if ($action == 'create') $form->select_date($datecontrat,'',0,0,'',"contrat"); print ""; - if ($conf->projet->enabled) + if (! empty($conf->projet->enabled)) { print ''.$langs->trans("Project").''; select_projects($soc->id,GETPOST("projectid"),"projectid"); @@ -767,7 +767,7 @@ else print ''.dol_print_date($object->date_contrat,"dayhour")."\n"; // Projet - if ($conf->projet->enabled) + if (! empty($conf->projet->enabled)) { $langs->load("projects"); print ''; @@ -1276,7 +1276,7 @@ else print ""; print ''; // multiprix - if($conf->global->PRODUIT_MULTIPRICES) + if (! empty($conf->global->PRODUIT_MULTIPRICES)) $form->select_produits('','idprod',1,$conf->product->limit_size,$object->thirdparty->price_level); else $form->select_produits('','idprod',1,$conf->product->limit_size); @@ -1359,7 +1359,7 @@ else else print ''.$langs->trans("Validate").''; } - if ($conf->facture->enabled && $object->statut > 0 && $object->nbofservicesclosed < $nbofservices) + if (! empty($conf->facture->enabled) && $object->statut > 0 && $object->nbofservicesclosed < $nbofservices) { $langs->load("bills"); if ($user->rights->facture->creer) print ''.$langs->trans("CreateBill").''; diff --git a/htdocs/core/admin_extrafields.inc.php b/htdocs/core/admin_extrafields.inc.php index 3bd46c7abf0..c1a7da31374 100644 --- a/htdocs/core/admin_extrafields.inc.php +++ b/htdocs/core/admin_extrafields.inc.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2011-2012 Laurent Destailleur * * 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 @@ -24,20 +24,34 @@ $maxsizestring=255; $maxsizeint=10; +$extrasize=GETPOST('size'); +if (GETPOST('type')=='double' && strpos($extrasize,',')===false) $extrasize='24,8'; +if (GETPOST('type')=='date') $extrasize=''; +if (GETPOST('type')=='datetime') $extrasize=''; + + // Add attribute if ($action == 'add') { if ($_POST["button"] != $langs->trans("Cancel")) { // Check values - if (GETPOST('type')=='varchar' && GETPOST('size') > $maxsizestring) + if (! GETPOST('type')) + { + $error++; + $langs->load("errors"); + $mesg=$langs->trans("ErrorFieldRequired",$langs->trans("Type")); + $action = 'create'; + } + + if (GETPOST('type')=='varchar' && $extrasize > $maxsizestring) { $error++; $langs->load("errors"); $mesg=$langs->trans("ErrorSizeTooLongForVarcharType",$maxsizestring); $action = 'create'; } - if (GETPOST('type')=='int' && GETPOST('size') > $maxsizeint) + if (GETPOST('type')=='int' && $extrasize > $maxsizeint) { $error++; $langs->load("errors"); @@ -50,7 +64,7 @@ if ($action == 'add') // Type et taille non encore pris en compte => varchar(255) if (isset($_POST["attrname"]) && preg_match("/^\w[a-zA-Z0-9-_]*$/",$_POST['attrname'])) { - $result=$extrafields->addExtraField($_POST['attrname'],$_POST['label'],$_POST['type'],$_POST['pos'],$_POST['size'],$elementtype); + $result=$extrafields->addExtraField($_POST['attrname'],$_POST['label'],$_POST['type'],$_POST['pos'],$extrasize,$elementtype,(GETPOST('unique')?1:0)); if ($result > 0) { header("Location: ".$_SERVER["PHP_SELF"]); @@ -79,14 +93,21 @@ if ($action == 'update') if ($_POST["button"] != $langs->trans("Cancel")) { // Check values - if (GETPOST('type')=='varchar' && GETPOST('size') > $maxsizestring) + if (! GETPOST('type')) + { + $error++; + $langs->load("errors"); + $mesg=$langs->trans("ErrorFieldRequired",$langs->trans("Type")); + $action = 'create'; + } + if (GETPOST('type')=='varchar' && $extrasize > $maxsizestring) { $error++; $langs->load("errors"); $mesg=$langs->trans("ErrorSizeTooLongForVarcharType",$maxsizestring); $action = 'edit'; } - if (GETPOST('type')=='int' && GETPOST('size') > $maxsizeint) + if (GETPOST('type')=='int' && $extrasize > $maxsizeint) { $error++; $langs->load("errors"); @@ -98,13 +119,9 @@ if ($action == 'update') { if (isset($_POST["attrname"]) && preg_match("/^\w[a-zA-Z0-9-_]*$/",$_POST['attrname'])) { - $result=$extrafields->update($_POST['attrname'],$_POST['type'],$_POST['size'],$elementtype); + $result=$extrafields->update($_POST['attrname'],$_POST['label'],$_POST['type'],$extrasize,$elementtype,(GETPOST('unique')?1:0)); if ($result > 0) { - if (isset($_POST['label'])) - { - $extrafields->update_label($_POST['attrname'],$_POST['label'],$_POST['type'],$_POST['size'],$elementtype); - } header("Location: ".$_SERVER["PHP_SELF"]); exit; } diff --git a/htdocs/core/ajax/row.php b/htdocs/core/ajax/row.php index 69212205832..647b39510b2 100644 --- a/htdocs/core/ajax/row.php +++ b/htdocs/core/ajax/row.php @@ -43,21 +43,31 @@ print ''; } // Barcode image diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index 9435cebb1a4..09213bdd0b9 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -191,11 +191,12 @@ class FormActions /** * Output list of type of event * - * @param string $selected Type pre-selectionne - * @param string $htmlname Nom champ formulaire + * @param string $selected Type pre-selectionne + * @param string $htmlname Nom champ formulaire + * @param string $excludetype Type to exclude * @return void */ - function select_type_actions($selected='',$htmlname='actioncode') + function select_type_actions($selected='',$htmlname='actioncode',$excludetype='') { global $langs,$user; @@ -204,7 +205,7 @@ class FormActions $caction=new CActionComm($this->db); $form=new Form($this->db); - $arraylist=$caction->liste_array(1,'code'); + $arraylist=$caction->liste_array(1, 'code', $excludetype); array_unshift($arraylist,' '); // Add empty line at start //asort($arraylist); diff --git a/htdocs/core/class/html.formbarcode.class.php b/htdocs/core/class/html.formbarcode.class.php index 5a9ab8b6ee8..86ef77b3536 100644 --- a/htdocs/core/class/html.formbarcode.class.php +++ b/htdocs/core/class/html.formbarcode.class.php @@ -74,8 +74,8 @@ class FormBarCode } // We check if barcode is already selected by default - if ((($conf->product->enabled || $conf->service->enabled) && $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE == $code_id) || - ($conf->societe->enabled && $conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY == $code_id)) + if (((! empty($conf->product->enabled) || ! empty($conf->service->enabled)) && $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE == $code_id) || + (! empty($conf->societe->enabled) && $conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY == $code_id)) { $disable = 'disabled="disabled"'; } diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index b848d6b2759..f4eca4bc09b 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -521,7 +521,7 @@ class FormCompany $sql = "SELECT s.rowid, s.nom FROM"; $sql.= " ".MAIN_DB_PREFIX."societe as s"; $sql.= " WHERE s.entity IN (".getEntity('societe', 1).")"; - if ($selected && $conf->use_javascript_ajax && $conf->global->COMPANY_USE_SEARCH_TO_SELECT) $sql.= " AND rowid = ".$selected; + if ($selected && $conf->use_javascript_ajax && ! empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT)) $sql.= " AND rowid = ".$selected; else { // For ajax search we limit here. For combo list, we limit later @@ -536,7 +536,7 @@ class FormCompany $resql = $this->db->query($sql); if ($resql) { - if ($conf->use_javascript_ajax && $conf->global->COMPANY_USE_SEARCH_TO_SELECT) + if ($conf->use_javascript_ajax && ! empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT)) { $minLength = (is_numeric($conf->global->COMPANY_USE_SEARCH_TO_SELECT)?$conf->global->COMPANY_USE_SEARCH_TO_SELECT:2); diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 74f190074b6..446d6cdf984 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -65,7 +65,7 @@ class FormFile { global $conf,$langs; - if ($conf->global->MAIN_USE_JQUERY_FILEUPLOAD) + if (! empty($conf->global->MAIN_USE_JQUERY_FILEUPLOAD)) { return $this->_formAjaxFileUpload($object); } @@ -182,7 +182,7 @@ class FormFile * @param string $modelselected Model to preselect by default * @param string $allowgenifempty Allow generation even if list of template ($genallowed) is empty (show however a warning) * @param string $forcenomultilang Do not show language option (even if MAIN_MULTILANGS defined) - * @param int $iconPDF Show only PDF icon with link (1/0) + * @param int $iconPDF Obsolete, see getDocumentsLink * @param int $maxfilenamelength Max length for filename shown * @param string $noform Do not output html form tags * @param string $param More param on http links @@ -199,18 +199,15 @@ class FormFile global $langs,$bc,$conf; + // For backward compatibility + if (! empty($iconPDF)) { + return $this->getDocumentsLink($modulepart, $filename, $filedir); + } + $forname='builddoc'; $out=''; $var=true; - // Clean paramaters - if ($iconPDF == 1) - { - $genallowed = ''; - $delallowed = 0; - $modelselected = ''; - $forcenomultilang=0; - } //$filename = dol_sanitizeFileName($filename); //Must be sanitized before calling show_documents $headershown=0; $showempty=0; @@ -440,80 +437,64 @@ class FormFile } // Get list of files - if ($filedir) + if (! empty($filedir)) { - $png = ''; - $filter = ''; - if ($iconPDF==1) - { - $png = '\.png$'; - $filter = $filename.'.pdf'; - } - $file_list=dol_dir_list($filedir,'files',0,$filter,'\.meta$'.($png?'|'.$png:''),'date',SORT_DESC); + $file_list=dol_dir_list($filedir,'files',0,'','\.meta$','date',SORT_DESC); // Affiche en-tete tableau si non deja affiche - if (! empty($file_list) && ! $headershown && ! $iconPDF) + if (! empty($file_list) && ! $headershown) { $headershown=1; $out.= '
'.$titletoshow.'
'; $out.= ''; } - else if (empty($file_list) && ! empty($iconPDF)) - { - // For ajax treatment - $out.= '
'.img_picto('', 'refresh').'
'."\n"; - } // Loop on each file found - foreach($file_list as $file) - { - $var=!$var; + if (is_array($file_list)) + { + foreach($file_list as $file) + { + $var=!$var; - // Define relative path for download link (depends on module) - $relativepath=$file["name"]; // Cas general - if ($filename) $relativepath=$filename."/".$file["name"]; // Cas propal, facture... - // Autre cas - if ($modulepart == 'donation') { $relativepath = get_exdir($filename,2).$file["name"]; } - if ($modulepart == 'export') { $relativepath = $file["name"]; } + // Define relative path for download link (depends on module) + $relativepath=$file["name"]; // Cas general + if ($filename) $relativepath=$filename."/".$file["name"]; // Cas propal, facture... + // Autre cas + if ($modulepart == 'donation') { $relativepath = get_exdir($filename,2).$file["name"]; } + if ($modulepart == 'export') { $relativepath = $file["name"]; } - if (! $iconPDF) $out.= ""; + $out.= ""; - // Show file name with link to download - if (! $iconPDF) $out.= ''; - // Show file size - $out.= ''; - // Show file date - $out.= ''; - } + // Show file name with link to download + $out.= ''; - if ($delallowed) - { - $out.= ''; - } + // Show file size + $size=(! empty($file['size'])?$file['size']:dol_filesize($filedir."/".$file["name"])); + $out.= ''; - if (! $iconPDF) $out.= ''; + // Show file date + $date=(! empty($file['date'])?$file['date']:dol_filemtime($filedir."/".$file["name"])); + $out.= ''; + + if ($delallowed) + { + $out.= ''; + } + } + + $out.= ''; $this->numoffiles++; } @@ -533,6 +514,60 @@ class FormFile return $out; } + /** + * Show only Document icon with link + * + * @param string $modulepart propal, facture, facture_fourn, ... + * @param string $filename Sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if $filedir is already complete) + * @param string $filedir Directory to scan + * @return string Output string with HTML link of documents (might be empty string) + */ + function getDocumentsLink($modulepart, $filename, $filedir) + { + if (! function_exists('dol_dir_list')) { + include DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + } + + $out=''; + + $this->numoffiles=0; + + $file_list=dol_dir_list($filedir, 'files', 0, $filename.'.pdf', '\.meta$|\.png$'); + + // For ajax treatment + $out.= '
'.img_picto('', 'refresh').'
'."\n"; + + if (! empty($file_list)) + { + // Loop on each file found + foreach($file_list as $file) + { + // Define relative path for download link (depends on module) + $relativepath=$file["name"]; // Cas general + if ($filename) $relativepath=$filename."/".$file["name"]; // Cas propal, facture... + // Autre cas + if ($modulepart == 'donation') { + $relativepath = get_exdir($filename,2).$file["name"]; + } + if ($modulepart == 'export') { + $relativepath = $file["name"]; + } + + // Show file name with link to download + $out.= 'numoffiles++; + } + } + + return $out; + } + /** * Show list of documents in a directory @@ -551,83 +586,117 @@ class FormFile * @param string $url Full url to use for click links ('' = autodetect) * @return int <0 if KO, nb of files shown if OK */ - function list_of_documents($filearray,$object,$modulepart,$param,$forcedownload=0,$relativepath='',$permtodelete=1,$useinecm=0,$textifempty='',$maxlength=0,$title='',$url='') - { - global $user, $conf, $langs; - global $bc; - global $sortfield, $sortorder, $maxheightmini; + function list_of_documents($filearray,$object,$modulepart,$param='',$forcedownload=0,$relativepath='',$permtodelete=1,$useinecm=0,$textifempty='',$maxlength=0,$title='',$url='') + { + global $user, $conf, $langs; + global $bc, $hookmanager; + global $sortfield, $sortorder, $maxheightmini; - // Show list of existing files - if (empty($useinecm)) print_titre($title?$title:$langs->trans("AttachedFiles")); - if (empty($url)) $url=$_SERVER["PHP_SELF"]; - print '
'; - $out.= 'trans("File").': '.$file["name"]).' '.dol_trunc($file["name"],$maxfilenamelength); - } - else - { - $out.= img_pdf($file["name"],2); - } - $out.= ''."\n"; - if (! $iconPDF) - { - $size=(! empty($file['size'])?$file['size']:dol_filesize($filedir."/".$file["name"])); - $date=(! empty($file['date'])?$file['date']:dol_filemtime($filedir."/".$file["name"])); - $out.= ''.dol_print_size($size).''.dol_print_date($date, 'dayhour').''; + $out.= 'trans("File").': '.$file["name"]).' '.dol_trunc($file["name"],$maxfilenamelength); + $out.= ''."\n"; + $out.= ''; - $out.= ''.img_delete().''.dol_print_size($size).'
'.dol_print_date($date, 'dayhour').''; + $out.= ''.img_delete().'
'; - print ''; - print_liste_field_titre($langs->trans("Documents2"),$url,"name","",$param,'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Size"),$url,"size","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Date"),$url,"date","",$param,'align="center"',$sortfield,$sortorder); - if (empty($useinecm)) print_liste_field_titre('',$url,"","",$param,'align="center"'); - print_liste_field_titre('','',''); - print ''; + if (! is_object($hookmanager)) + { + if (! class_exists('HookManager')) { + // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array + require DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + $hookmanager=new HookManager($this->db); + } + } + $hookmanager->initHooks(array('formfile')); - $nboffiles=count($filearray); + $parameters=array( + 'filearray' => $filearray, + 'modulepart'=> $modulepart, + 'param' => $param, + 'forcedownload' => $forcedownload, + 'relativepath' => $relativepath, + 'permtodelete' => $permtodelete, + 'useinecm' => $useinecm, + 'textifempty' => $textifempty, + 'maxlength' => $maxlength, + 'title' => $title, + 'url' => $url + ); + $reshook=$hookmanager->executeHooks('showFilesList', $parameters, $object); - if ($nboffiles > 0) include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; + if (isset($reshook) && $reshook != '') // null or '' for bypass + { + return $reshook; + } + else + { + $param = (isset($object->id)?'&id='.$object->id:'').$param; - $var=true; - foreach($filearray as $key => $file) // filearray must be only files here - { - if ($file['name'] != '.' - && $file['name'] != '..' - && ! preg_match('/\.meta$/i',$file['name'])) - { - // Define relative path used to store the file - if (empty($relativepath)) - $relativepath=(! empty($object->ref)?dol_sanitizeFileName($object->ref):'').'/'; + // Show list of existing files + if (empty($useinecm)) print_titre($title?$title:$langs->trans("AttachedFiles")); + if (empty($url)) $url=$_SERVER["PHP_SELF"]; + print '
'; + print ''; + print_liste_field_titre($langs->trans("Documents2"),$url,"name","",$param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Size"),$url,"size","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Date"),$url,"date","",$param,'align="center"',$sortfield,$sortorder); + if (empty($useinecm)) print_liste_field_titre('',$url,"","",$param,'align="center"'); + print_liste_field_titre('','',''); + print ''; - $var=!$var; - print ''; - print '\n"; - print ''; - print ''; - // Preview - if (empty($useinecm)) - { - print ''; - } - // Delete or view link - print '"; - print "\n"; - } - } - if ($nboffiles == 0) - { - print ''; - } - print "
'; - //print "XX".$file['name']; //$file['name'] must be utf8 - print ''; - print img_mime($file['name'],$file['name'].' ('.dol_print_size($file['size'],0,0).')').' '; - print dol_trunc($file['name'],$maxlength,'middle'); - print ''; - print "'.dol_print_size($file['size'],1,1).''.dol_print_date($file['date'],"dayhour").''; - $tmp=explode('.',$file['name']); - $minifile=$tmp[0].'_mini.'.$tmp[1]; - if (image_format_supported($file['name']) > 0) print ''; - else print ' '; - print ''; - if ($useinecm) print ''.img_view().'   '; - if ($permtodelete) print ''.img_delete().''; - else print ' '; - print "
'; - if (empty($textifempty)) print $langs->trans("NoFileFound"); - else print $textifempty; - print '
"; + $nboffiles=count($filearray); - return $nboffiles; - } + if ($nboffiles > 0) include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; + + $var=true; + foreach($filearray as $key => $file) // filearray must be only files here + { + if ($file['name'] != '.' + && $file['name'] != '..' + && ! preg_match('/\.meta$/i',$file['name'])) + { + // Define relative path used to store the file + if (empty($relativepath)) + $relativepath=(! empty($object->ref)?dol_sanitizeFileName($object->ref):'').'/'; + + $var=!$var; + print ''; + print ''; + //print "XX".$file['name']; //$file['name'] must be utf8 + print ''; + print img_mime($file['name'],$file['name'].' ('.dol_print_size($file['size'],0,0).')').' '; + print dol_trunc($file['name'],$maxlength,'middle'); + print ''; + print "\n"; + print ''.dol_print_size($file['size'],1,1).''; + print ''.dol_print_date($file['date'],"dayhour","tzuser").''; + // Preview + if (empty($useinecm)) + { + print ''; + $tmp=explode('.',$file['name']); + $minifile=$tmp[0].'_mini.'.$tmp[1]; + if (image_format_supported($file['name']) > 0) print ''; + else print ' '; + print ''; + } + // Delete or view link + print ''; + if ($useinecm) print ''.img_view().'   '; + if ($permtodelete) print ''.img_delete().''; + else print ' '; + print ""; + print "\n"; + } + } + if ($nboffiles == 0) + { + print ''; + if (empty($textifempty)) print $langs->trans("NoFileFound"); + else print $textifempty; + print ''; + } + print ""; + + return $nboffiles; + } + } /** diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index df775c55cd7..174b76231da 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -567,7 +567,7 @@ class FormMail elseif (! is_numeric($this->withbody)) { $defaultmessage=$this->withbody; } // Complete substitution array - if ($conf->paypal->enabled && $conf->global->PAYPAL_ADD_PAYMENT_URL) + if (! empty($conf->paypal->enabled) && ! empty($conf->global->PAYPAL_ADD_PAYMENT_URL)) { require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php'; diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php index 35da1b90beb..9e06d62ff74 100644 --- a/htdocs/core/class/ldap.class.php +++ b/htdocs/core/class/ldap.class.php @@ -107,8 +107,8 @@ class Ldap global $conf; //Server - if ($conf->global->LDAP_SERVER_HOST) $this->server[] = $conf->global->LDAP_SERVER_HOST; - if ($conf->global->LDAP_SERVER_HOST_SLAVE) $this->server[] = $conf->global->LDAP_SERVER_HOST_SLAVE; + if (! empty($conf->global->LDAP_SERVER_HOST)) $this->server[] = $conf->global->LDAP_SERVER_HOST; + if (! empty($conf->global->LDAP_SERVER_HOST_SLAVE)) $this->server[] = $conf->global->LDAP_SERVER_HOST_SLAVE; $this->serverPort = $conf->global->LDAP_SERVER_PORT; $this->ldapProtocolVersion = $conf->global->LDAP_SERVER_PROTOCOLVERSION; $this->dn = $conf->global->LDAP_SERVER_DN; diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 873b92641b9..eaa173eb6fe 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -1,7 +1,7 @@ - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2012 J. Fernando Lagrange +/* Copyright (C) 2008-2011 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2012 J. Fernando Lagrange * * 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 @@ -1024,7 +1024,7 @@ function form_constantes($tableau) $sql.= ", note"; $sql.= " FROM ".MAIN_DB_PREFIX."const"; $sql.= " WHERE ".$db->decrypt('name')." = '".$const."'"; - $sql.= " AND entity in (0, ".$conf->entity.")"; + $sql.= " AND entity IN (0, ".$conf->entity.")"; $sql.= " ORDER BY name ASC, entity DESC"; $result = $db->query($sql); @@ -1034,6 +1034,11 @@ function form_constantes($tableau) $obj = $db->fetch_object($result); // Take first result of select $var=!$var; + // For avoid warning in strict mode + if (empty($obj)) { + $obj = (object) array('rowid'=>'','name'=>'','value'=>'','type'=>'','note'=>''); + } + print "\n".''; print ""; @@ -1197,4 +1202,33 @@ function delDocumentModel($name, $type) } } + +/** + * Return the php_info into an array + * + * @return array Array with PHP infos + */ +function phpinfo_array() +{ + ob_start(); + phpinfo(); + $info_arr = array(); + $info_lines = explode("\n", strip_tags(ob_get_clean(), "

")); // end of ob_start() + $cat = "General"; + foreach($info_lines as $line) + { + // new cat? + preg_match("~

(.*)

~", $line, $title) ? $cat = $title[1] : null; + if(preg_match("~]+>([^<]*)]+>([^<]*)~", $line, $val)) + { + $info_arr[trim($cat)][trim($val[1])] = $val[2]; + } + elseif(preg_match("~]+>([^<]*)]+>([^<]*)]+>([^<]*)~", $line, $val)) + { + $info_arr[trim($cat)][trim($val[1])] = array("local" => $val[2], "master" => $val[3]); + } + } + return $info_arr; +} + ?> diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index 30989a272e7..990fee14ae9 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -47,7 +47,7 @@ function print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirt global $conf,$langs,$db; // Filters - if ($canedit || $conf->projet->enabled) + if ($canedit || ! empty($conf->projet->enabled)) { print ''; print ''; @@ -57,7 +57,7 @@ function print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirt print ''; print ''; print ''; - if ($canedit || $conf->projet->enabled) + if ($canedit || ! empty($conf->projet->enabled)) { print ''; } - if ($conf->projet->enabled) + if (! empty($conf->projet->enabled)) { print ''; print ''; - if ($conf->agenda->enabled && $user->rights->agenda->myactions->create) + if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) { print ''; // Propals - if ($conf->propal->enabled && $user->rights->propale->lire) + if (! empty($conf->propal->enabled) && $user->rights->propale->lire) { $ret=$product->load_stats_propale($socid); if ($ret < 0) dol_print_error($db); @@ -206,7 +206,7 @@ function show_stats_for_company($product,$socid) print ''; } // Commandes clients - if ($conf->commande->enabled && $user->rights->commande->lire) + if (! empty($conf->commande->enabled) && $user->rights->commande->lire) { $ret=$product->load_stats_commande($socid); if ($ret < 0) dol_print_error($db); @@ -223,7 +223,7 @@ function show_stats_for_company($product,$socid) print ''; } // Commandes fournisseurs - if ($conf->fournisseur->enabled && $user->rights->fournisseur->commande->lire) + if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande->lire) { $ret=$product->load_stats_commande_fournisseur($socid); if ($ret < 0) dol_print_error($db); @@ -240,7 +240,7 @@ function show_stats_for_company($product,$socid) print ''; } // Contrats - if ($conf->contrat->enabled && $user->rights->contrat->lire) + if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire) { $ret=$product->load_stats_contrat($socid); if ($ret < 0) dol_print_error($db); @@ -257,7 +257,7 @@ function show_stats_for_company($product,$socid) print ''; } // Factures clients - if ($conf->facture->enabled && $user->rights->facture->lire) + if (! empty($conf->facture->enabled) && $user->rights->facture->lire) { $ret=$product->load_stats_facture($socid); if ($ret < 0) dol_print_error($db); @@ -274,7 +274,7 @@ function show_stats_for_company($product,$socid) print ''; } // Factures fournisseurs - if ($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire) + if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire) { $ret=$product->load_stats_facture_fournisseur($socid); if ($ret < 0) dol_print_error($db); diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 3f8e5831d9d..e5dddb11ea5 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -48,8 +48,9 @@ function project_prepare_head($object) $head[$h][2] = 'contact'; $h++; - if ($conf->fournisseur->enabled || $conf->propal->enabled || $conf->commande->enabled || $conf->facture->enabled || $conf->contrat->enabled - || $conf->ficheinter->enabled || $conf->agenda->enabled || $conf->deplacement->enabled) + if (! empty($conf->fournisseur->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->commande->enabled) + || ! empty($conf->facture->enabled) || ! empty($conf->contrat->enabled) + || ! empty($conf->ficheinter->enabled) || ! empty($conf->agenda->enabled) || ! empty($conf->deplacement->enabled)) { $head[$h][0] = DOL_URL_ROOT.'/projet/element.php?id='.$object->id; $head[$h][1] = $langs->trans("Referers"); @@ -325,7 +326,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t $lastprojectid=$lines[$i]->fk_project; } - print "\n"; + print ''."\n"; // Project if ($showproject) diff --git a/htdocs/core/lib/propal.lib.php b/htdocs/core/lib/propal.lib.php index ca30e8631f1..a0922fc4c4c 100644 --- a/htdocs/core/lib/propal.lib.php +++ b/htdocs/core/lib/propal.lib.php @@ -43,9 +43,8 @@ function propal_prepare_head($object) $head[$h][2] = 'comm'; $h++; - if ((!$conf->commande->enabled && - (($conf->expedition_bon->enabled && $user->rights->expedition->lire) - || ($conf->livraison_bon->enabled && $user->rights->expedition->livraison->lire)))) + if ((empty($conf->commande->enabled) && ((! empty($conf->expedition_bon->enabled) && $user->rights->expedition->lire) + || (! empty($conf->livraison_bon->enabled) && $user->rights->expedition->livraison->lire)))) { $langs->load("sendings"); $head[$h][0] = DOL_URL_ROOT.'/expedition/propal.php?id='.$object->id; @@ -62,7 +61,7 @@ function propal_prepare_head($object) $head[$h][2] = 'preview'; $h++; } - + if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) { $head[$h][0] = DOL_URL_ROOT.'/comm/propal/contact.php?id='.$object->id; diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index 3d1b69279f6..5f402fad68c 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -432,7 +432,7 @@ function getRandomPassword($generic=false) $generated_password=''; if ($generic) $generated_password=dol_hash(mt_rand()); - else if ($conf->global->USER_PASSWORD_GENERATED) + else if (! empty($conf->global->USER_PASSWORD_GENERATED)) { $nomclass="modGeneratePass".ucfirst($conf->global->USER_PASSWORD_GENERATED); $nomfichier=$nomclass.".class.php"; diff --git a/htdocs/core/lib/stock.lib.php b/htdocs/core/lib/stock.lib.php index caf9d7ef43d..7fb81297cb3 100644 --- a/htdocs/core/lib/stock.lib.php +++ b/htdocs/core/lib/stock.lib.php @@ -52,7 +52,7 @@ function stock_prepare_head($object) */ /* Disabled because will never be implemented. Table always empty. - if ($conf->global->STOCK_USE_WAREHOUSE_BY_USER) + if (! empty($conf->global->STOCK_USE_WAREHOUSE_BY_USER)) { // Should not be enabled by defaut because does not work yet correctly because // personnal stocks are not tagged into table llx_entrepot diff --git a/htdocs/core/lib/tax.lib.php b/htdocs/core/lib/tax.lib.php index 7bd6e542a42..eab91d27d4b 100644 --- a/htdocs/core/lib/tax.lib.php +++ b/htdocs/core/lib/tax.lib.php @@ -106,7 +106,7 @@ function vat_by_thirdparty($db, $y, $date_start, $date_end, $modetax, $direction if ($modetax == 1) { // If vat paid on due invoices (non draft) - if ($conf->global->MAIN_MODULE_ACCOUNTING) + if (! empty($conf->global->MAIN_MODULE_ACCOUNTING)) { // TODO a ce jour on se sait pas la compter car le montant tva d'un payment // n'est pas stocke dans la table des payments. @@ -115,7 +115,7 @@ function vat_by_thirdparty($db, $y, $date_start, $date_end, $modetax, $direction // detail part tva et part ht). $sql = 'TODO'; } - if ($conf->global->MAIN_MODULE_COMPTABILITE) + if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) { $sql = "SELECT s.rowid as socid, s.nom as nom, s.siren as tva_intra, s.tva_assuj as assuj,"; $sql.= " sum(fd.total_ht) as amount, sum(fd.".$total_tva.") as tva,"; @@ -145,7 +145,7 @@ function vat_by_thirdparty($db, $y, $date_start, $date_end, $modetax, $direction } else { - if ($conf->global->MAIN_MODULE_ACCOUNTING) + if (! empty($conf->global->MAIN_MODULE_ACCOUNTING)) { // If vat paid on payments // TODO a ce jour on se sait pas la compter car le montant tva d'un payment @@ -155,7 +155,7 @@ function vat_by_thirdparty($db, $y, $date_start, $date_end, $modetax, $direction // detail part tva et part ht). $sql = 'TODO'; } - if ($conf->global->MAIN_MODULE_COMPTABILITE) + if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) { // Tva sur factures payes (should be on payment) /* $sql = "SELECT s.rowid as socid, s.nom as nom, s.tva_intra as tva_intra, s.tva_assuj as assuj,"; @@ -262,7 +262,7 @@ function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction, $sql=''; if ($modetax == 1) // Option vat on delivery for goods (payment) and debit invoice for services { - if ($conf->global->MAIN_MODULE_ACCOUNTING) + if (! empty($conf->global->MAIN_MODULE_ACCOUNTING)) { // TODO a ce jour on se sait pas la compter car le montant tva d'un payment // n'est pas stocke dans la table des payments. @@ -271,7 +271,7 @@ function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction, // detail part tva et part ht). $sql='TODO'; } - if ($conf->global->MAIN_MODULE_COMPTABILITE) + if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) { // Count on delivery date (use invoice date as delivery is unknown) $sql = "SELECT d.rowid, d.product_type as dtype, d.".$fk_facture." as facid, d.tva_tx as rate, d.total_ht as total_ht, d.total_ttc as total_ttc, d.".$total_tva." as total_vat, d.description as descr,"; @@ -307,7 +307,7 @@ function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction, } else // Option vat on delivery for goods (payments) and payments for services { - if ($conf->global->MAIN_MODULE_ACCOUNTING) + if (! empty($conf->global->MAIN_MODULE_ACCOUNTING)) { // TODO a ce jour on se sait pas la compter car le montant tva d'un payment // n'est pas stocke dans la table des payments. @@ -316,7 +316,7 @@ function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction, // detail part tva et part ht). $sql='TODO'; } - if ($conf->global->MAIN_MODULE_COMPTABILITE) + if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) { // Count on delivery date (use invoice date as delivery is unknown) $sql = "SELECT d.rowid, d.product_type as dtype, d.".$fk_facture." as facid, d.tva_tx as rate, d.total_ht as total_ht, d.total_ttc as total_ttc, d.".$total_tva." as total_vat, d.description as descr,"; @@ -419,7 +419,7 @@ function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction, $sql=''; if ($modetax == 1) // Option vat on delivery for goods (payment) and debit invoice for services { - if ($conf->global->MAIN_MODULE_ACCOUNTING) + if (! empty($conf->global->MAIN_MODULE_ACCOUNTING)) { // Count on invoice date // TODO a ce jour on se sait pas la compter car le montant tva d'un payment @@ -429,7 +429,7 @@ function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction, // detail part tva et part ht). $sql='TODO'; } - if ($conf->global->MAIN_MODULE_COMPTABILITE) + if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) { // Count on invoice date $sql = "SELECT d.rowid, d.product_type as dtype, d.".$fk_facture." as facid, d.tva_tx as rate, d.total_ht as total_ht, d.total_ttc as total_ttc, d.".$total_tva." as total_vat, d.description as descr,"; @@ -465,7 +465,7 @@ function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction, } else // Option vat on delivery for goods (payments) and payments for services { - if ($conf->global->MAIN_MODULE_ACCOUNTING) + if (! empty($conf->global->MAIN_MODULE_ACCOUNTING)) { // Count on payments date // TODO a ce jour on se sait pas la compter car le montant tva d'un payment @@ -475,7 +475,7 @@ function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction, // detail part tva et part ht). $sql='TODO'; } - if ($conf->global->MAIN_MODULE_COMPTABILITE) + if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) { // Count on payments date $sql = "SELECT d.rowid, d.product_type as dtype, d.".$fk_facture." as facid, d.tva_tx as rate, d.total_ht as total_ht, d.total_ttc as total_ttc, d.".$total_tva." as total_vat, d.description as descr,"; diff --git a/htdocs/core/login/functions_http.php b/htdocs/core/login/functions_http.php index c40e3b1609d..8aea6d40a2c 100644 --- a/htdocs/core/login/functions_http.php +++ b/htdocs/core/login/functions_http.php @@ -33,7 +33,7 @@ */ function check_user_password_http($usertotest,$passwordtotest,$entitytotest) { - dol_syslog("functions_http::check_user_password_http _SERVER[REMOTE_USER]=".$_SERVER["REMOTE_USER"]); + dol_syslog("functions_http::check_user_password_http _SERVER[REMOTE_USER]=".(empty($_SERVER["REMOTE_USER"])?'':$_SERVER["REMOTE_USER"])); $login=''; if (! empty($_SERVER["REMOTE_USER"])) diff --git a/htdocs/core/login/functions_ldap.php b/htdocs/core/login/functions_ldap.php index e38e33e2c79..f39ce16b629 100644 --- a/htdocs/core/login/functions_ldap.php +++ b/htdocs/core/login/functions_ldap.php @@ -146,7 +146,7 @@ function check_user_password_ldap($usertotest,$passwordtotest,$entitytotest) $login=$usertotest; // ldap2dolibarr synchronisation - if ($login && $conf->ldap->enabled && $conf->global->LDAP_SYNCHRO_ACTIVE == 'ldap2dolibarr') + if ($login && ! empty($conf->ldap->enabled) && $conf->global->LDAP_SYNCHRO_ACTIVE == 'ldap2dolibarr') { // On charge les attributs du user ldap if ($ldapdebug) print "DEBUG: login ldap = ".$login."
\n"; diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index cfb9fa158d1..273abe91b7c 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -36,7 +36,6 @@ insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk -- Home - Sytem info insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$user->admin', __HANDLER__, 'left', 300__+MAX_llx_menu__, 'home', 'admintools', 1__+MAX_llx_menu__, '/admin/tools/index.php?leftmenu=admintools', 'SystemTools', 0, 'admin', '', '', 2, 2, __ENTITY__); insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$leftmenu==\'admintools\'', __HANDLER__, 'left', 201__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/dolibarr.php?leftmenu=admintools', 'InfoDolibarr', 1, 'admin', '', '', 2, 0, __ENTITY__); -insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$leftmenu==\'admintools\'', __HANDLER__, 'left', 202__+MAX_llx_menu__, 'home', '', 201__+MAX_llx_menu__, '/admin/system/constall.php?leftmenu=admintools', 'AllParameters', 2, 'admin', '', '', 2, 1, __ENTITY__); insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$leftmenu==\'admintools\'', __HANDLER__, 'left', 208__+MAX_llx_menu__, 'home', '', 201__+MAX_llx_menu__, '/admin/system/modules.php?leftmenu=admintools', 'Modules', 2, 'admin', '', '', 2, 2, __ENTITY__); insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$leftmenu==\'admintools\'', __HANDLER__, 'left', 207__+MAX_llx_menu__, 'home', '', 201__+MAX_llx_menu__, '/admin/triggers.php?leftmenu=admintools', 'Triggers', 2, 'admin', '', '', 2, 3, __ENTITY__); insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$leftmenu==\'admintools\'', __HANDLER__, 'left', 204__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/os.php?leftmenu=admintools', 'InfoOS', 1, 'admin', '', '', 2, 1, __ENTITY__); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 9bd599aab12..ed1e6159e3b 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -124,9 +124,9 @@ function print_eldy_menu($db,$atarget,$type_user) $classname = 'class="tmenu"'; } $chaine=""; - if ($conf->product->enabled) { $chaine.=$langs->trans("Products"); } - if ($conf->product->enabled && $conf->service->enabled) { $chaine.="/"; } - if ($conf->service->enabled) { $chaine.=$langs->trans("Services"); } + if (! empty($conf->product->enabled)) { $chaine.=$langs->trans("Products"); } + if (! empty($conf->product->enabled) && ! empty($conf->service->enabled)) { $chaine.="/"; } + if (! empty($conf->service->enabled)) { $chaine.=$langs->trans("Services"); } $idsel='products'; if ($user->rights->produit->lire || $user->rights->service->lire) @@ -687,27 +687,26 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after) // System tools $newmenu->add("/admin/tools/index.php?mainmenu=home&leftmenu=admintools", $langs->trans("SystemTools"), 0, 1, '', $mainmenu, 'admintools'); - if ($leftmenu=="admintools") + if (preg_match('/^admintools/',$leftmenu)) { - $newmenu->add('/admin/system/dolibarr.php?mainmenu=home', $langs->trans('InfoDolibarr'), 1); - $newmenu->add('/admin/system/constall.php?mainmenu=home', $langs->trans('AllParameters'), 2); - $newmenu->add('/admin/system/modules.php?mainmenu=home', $langs->trans('Modules'), 2); - $newmenu->add('/admin/triggers.php?mainmenu=home', $langs->trans('Triggers'), 2); - $newmenu->add('/admin/system/os.php?mainmenu=home', $langs->trans('InfoOS'), 1); - $newmenu->add('/admin/system/web.php?mainmenu=home', $langs->trans('InfoWebServer'), 1); - $newmenu->add('/admin/system/phpinfo.php?mainmenu=home', $langs->trans('InfoPHP'), 1); + $newmenu->add('/admin/system/dolibarr.php?mainmenu=home&leftmenu=admintools_info', $langs->trans('InfoDolibarr'), 1); + if ($leftmenu=='admintools_info') $newmenu->add('/admin/system/modules.php?mainmenu=home&leftmenu=admintools_info', $langs->trans('Modules'), 2); + if ($leftmenu=='admintools_info') $newmenu->add('/admin/triggers.php?mainmenu=home&leftmenu=admintools_info', $langs->trans('Triggers'), 2); + $newmenu->add('/admin/system/os.php?mainmenu=home&leftmenu=admintools', $langs->trans('InfoOS'), 1); + $newmenu->add('/admin/system/web.php?mainmenu=home&leftmenu=admintools', $langs->trans('InfoWebServer'), 1); + $newmenu->add('/admin/system/phpinfo.php?mainmenu=home&leftmenu=admintools', $langs->trans('InfoPHP'), 1); //if (function_exists('xdebug_is_enabled')) $newmenu->add('/admin/system/xdebug.php', $langs->trans('XDebug'),1); - $newmenu->add('/admin/system/database.php?mainmenu=home', $langs->trans('InfoDatabase'), 1); + $newmenu->add('/admin/system/database.php?mainmenu=home&leftmenu=admintools', $langs->trans('InfoDatabase'), 1); - $newmenu->add("/admin/tools/dolibarr_export.php?mainmenu=home", $langs->trans("Backup"),1); - $newmenu->add("/admin/tools/dolibarr_import.php?mainmenu=home", $langs->trans("Restore"),1); - $newmenu->add("/admin/tools/update.php?mainmenu=home", $langs->trans("MenuUpgrade"),1); - if (function_exists('eaccelerator_info')) $newmenu->add("/admin/tools/eaccelerator.php?mainmenu=home", $langs->trans("EAccelerator"),1); - $newmenu->add("/admin/tools/listevents.php?mainmenu=home", $langs->trans("Audit"),1); - $newmenu->add("/admin/tools/listsessions.php?mainmenu=home", $langs->trans("Sessions"),1); - $newmenu->add("/admin/tools/purge.php?mainmenu=home", $langs->trans("Purge"),1); - $newmenu->add("/support/index.php?mainmenu=home", $langs->trans("HelpCenter"),1,1,'targethelp'); - $newmenu->add('/admin/system/about.php?mainmenu=home', $langs->trans('About'), 1); + $newmenu->add("/admin/tools/dolibarr_export.php?mainmenu=home&leftmenu=admintools", $langs->trans("Backup"),1); + $newmenu->add("/admin/tools/dolibarr_import.php?mainmenu=home&leftmenu=admintools", $langs->trans("Restore"),1); + $newmenu->add("/admin/tools/update.php?mainmenu=home&leftmenu=admintools", $langs->trans("MenuUpgrade"),1); + if (function_exists('eaccelerator_info')) $newmenu->add("/admin/tools/eaccelerator.php?mainmenu=home&leftmenu=admintools", $langs->trans("EAccelerator"),1); + $newmenu->add("/admin/tools/listevents.php?mainmenu=home&leftmenu=admintools", $langs->trans("Audit"),1); + $newmenu->add("/admin/tools/listsessions.php?mainmenu=home&leftmenu=admintools", $langs->trans("Sessions"),1); + $newmenu->add("/admin/tools/purge.php?mainmenu=home&leftmenu=admintools", $langs->trans("Purge"),1); + $newmenu->add('/admin/system/about.php?mainmenu=home&leftmenu=admintools', $langs->trans('About'), 1); + $newmenu->add("/support/index.php?mainmenu=home&leftmenu=admintools", $langs->trans("HelpCenter"),1,1,'targethelp'); } // Modules system tools if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) @@ -738,7 +737,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after) if ($mainmenu == 'companies') { // Societes - if ($conf->societe->enabled) + if (! empty($conf->societe->enabled)) { $langs->load("companies"); $newmenu->add("/societe/index.php?leftmenu=thirdparties", $langs->trans("ThirdParty"), 0, $user->rights->societe->lire, '', $mainmenu, 'thirdparties'); @@ -751,7 +750,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after) } // Prospects - if ($conf->societe->enabled && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) + if (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) { $langs->load("commercial"); $newmenu->add("/comm/prospect/list.php?leftmenu=prospects", $langs->trans("ListProspectsShort"), 1, $user->rights->societe->lire, '', $mainmenu, 'prospects'); @@ -767,7 +766,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after) } // Clients - if ($conf->societe->enabled) + if (! empty($conf->societe->enabled)) { $langs->load("commercial"); $newmenu->add("/comm/list.php?leftmenu=customers", $langs->trans("ListCustomersShort"), 1, $user->rights->societe->lire, '', $mainmenu, 'customers'); @@ -777,7 +776,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after) } // Fournisseurs - if ($conf->societe->enabled && $conf->fournisseur->enabled) + if (! empty($conf->societe->enabled) && ! empty($conf->fournisseur->enabled)) { $langs->load("suppliers"); $newmenu->add("/fourn/liste.php?leftmenu=suppliers", $langs->trans("ListSuppliersShort"), 1, $user->rights->fournisseur->lire, '', $mainmenu, 'suppliers'); @@ -796,12 +795,12 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after) $newmenu->add("/contact/list.php?leftmenu=contacts", $langs->trans("List"), 1, $user->rights->societe->contact->lire); if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) $newmenu->add("/contact/list.php?leftmenu=contacts&type=p", $langs->trans("Prospects"), 2, $user->rights->societe->contact->lire); $newmenu->add("/contact/list.php?leftmenu=contacts&type=c", $langs->trans("Customers"), 2, $user->rights->societe->contact->lire); - if ($conf->fournisseur->enabled) $newmenu->add("/contact/list.php?leftmenu=contacts&type=f", $langs->trans("Suppliers"), 2, $user->rights->societe->contact->lire); + if (! empty($conf->fournisseur->enabled)) $newmenu->add("/contact/list.php?leftmenu=contacts&type=f", $langs->trans("Suppliers"), 2, $user->rights->societe->contact->lire); $newmenu->add("/contact/list.php?leftmenu=contacts&type=o", $langs->trans("Others"), 2, $user->rights->societe->contact->lire); //$newmenu->add("/contact/list.php?userid=$user->id", $langs->trans("MyContacts"), 1, $user->rights->societe->contact->lire); // Categories - if ($conf->categorie->enabled) + if (! empty($conf->categorie->enabled)) { $langs->load("categories"); // Categories prospects/customers @@ -811,7 +810,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after) $newmenu->add("/categories/fiche.php?action=create&type=2", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); } // Categories suppliers - if ($conf->fournisseur->enabled) + if (! empty($conf->fournisseur->enabled)) { $newmenu->add("/categories/index.php?leftmenu=cat&type=1", $langs->trans("SuppliersCategoriesShort"), 0, $user->rights->categorie->lire); if (empty($user->societe_id)) @@ -856,7 +855,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after) $newmenu->add("/commande/liste.php?leftmenu=orders", $langs->trans("List"), 1, $user->rights->commande->lire); if ($leftmenu=="orders") $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=0", $langs->trans("StatusOrderDraftShort"), 2, $user->rights->commande->lire); if ($leftmenu=="orders") $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=1", $langs->trans("StatusOrderValidated"), 2, $user->rights->commande->lire); - if ($leftmenu=="orders" && $conf->expedition->enabled) $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=2", $langs->trans("StatusOrderOnProcessShort"), 2, $user->rights->commande->lire); + if ($leftmenu=="orders" && ! empty($conf->expedition->enabled)) $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=2", $langs->trans("StatusOrderOnProcessShort"), 2, $user->rights->commande->lire); if ($leftmenu=="orders") $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=".($conf->expedition->enabled?"3":"-2"), $langs->trans("StatusOrderToBill"), 2, $user->rights->commande->lire); if ($leftmenu=="orders") $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=4", $langs->trans("StatusOrderProcessed"), 2, $user->rights->commande->lire); if ($leftmenu=="orders") $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=-1", $langs->trans("StatusOrderCanceledShort"), 2, $user->rights->commande->lire); @@ -1047,7 +1046,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after) /* if ($leftmenu=="ca") $newmenu->add("/compta/stats/cumul.php?leftmenu=ca","Cumule",2,$user->rights->compta->resultat->lire); - if ($conf->propal->enabled) { + if (! empty($conf->propal->enabled)) { if ($leftmenu=="ca") $newmenu->add("/compta/stats/prev.php?leftmenu=ca","Previsionnel",2,$user->rights->compta->resultat->lire); if ($leftmenu=="ca") $newmenu->add("/compta/stats/comp.php?leftmenu=ca","Transforme",2,$user->rights->compta->resultat->lire); } @@ -1129,11 +1128,11 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after) $newmenu->add("/product/fiche.php?leftmenu=product&action=create&type=0", $langs->trans("NewProduct"), 1, $user->rights->produit->creer); $newmenu->add("/product/liste.php?leftmenu=product&type=0", $langs->trans("List"), 1, $user->rights->produit->lire); } - if ($conf->propal->enabled) + if (! empty($conf->propal->enabled)) { $newmenu->add("/product/popuprop.php?leftmenu=stats&type=0", $langs->trans("Statistics"), 1, $user->rights->produit->lire && $user->rights->propale->lire); } - if ($conf->stock->enabled) + if (! empty($conf->stock->enabled)) { $newmenu->add("/product/reassort.php?type=0", $langs->trans("Stocks"), 1, $user->rights->produit->lire && $user->rights->stock->lire); } @@ -1148,7 +1147,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after) $newmenu->add("/product/fiche.php?leftmenu=service&action=create&type=1", $langs->trans("NewService"), 1, $user->rights->service->creer); } $newmenu->add("/product/liste.php?leftmenu=service&type=1", $langs->trans("List"), 1, $user->rights->service->lire); - if ($conf->propal->enabled) + if (! empty($conf->propal->enabled)) { $newmenu->add("/product/popuprop.php?leftmenu=stats&type=1", $langs->trans("Statistics"), 1, $user->rights->service->lire && $user->rights->propale->lire); } @@ -1348,7 +1347,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after) } $newmenu->add("/adherents/index.php?leftmenu=export&mainmenu=members",$langs->trans("Exports"),0,$user->rights->adherent->export, '', $mainmenu, 'export'); - if ($conf->export->enabled && $leftmenu=="export") $newmenu->add("/exports/index.php?leftmenu=export",$langs->trans("Datas"),1,$user->rights->adherent->export); + if (! empty($conf->export->enabled) && $leftmenu=="export") $newmenu->add("/exports/index.php?leftmenu=export",$langs->trans("Datas"),1,$user->rights->adherent->export); if ($leftmenu=="export") $newmenu->add("/adherents/htpasswd.php?leftmenu=export",$langs->trans("Filehtpasswd"),1,$user->rights->adherent->export); if ($leftmenu=="export") $newmenu->add("/adherents/cartes/carte.php?leftmenu=export",$langs->trans("MembersCards"),1,$user->rights->adherent->export); diff --git a/htdocs/core/modules/action/rapport.pdf.php b/htdocs/core/modules/action/rapport.pdf.php index 5a384852cba..7bcbc8e8057 100644 --- a/htdocs/core/modules/action/rapport.pdf.php +++ b/htdocs/core/modules/action/rapport.pdf.php @@ -112,7 +112,7 @@ class CommActionRapport if (file_exists($dir)) { $pdf=pdf_getInstance($this->format); - $heightforinfotot = 80; // Height reserved to output the info and total part (value include bottom margin) + $heightforinfotot = 50; // Height reserved to output the info and total part $heightforfooter = 25; // Height reserved to output the footer (value include bottom margin) $pdf->SetAutoPageBreak(1,0); diff --git a/htdocs/core/modules/cheque/pdf/modules_chequereceipts.php b/htdocs/core/modules/cheque/pdf/modules_chequereceipts.php index f031ea2d4aa..66115ca5068 100644 --- a/htdocs/core/modules/cheque/pdf/modules_chequereceipts.php +++ b/htdocs/core/modules/cheque/pdf/modules_chequereceipts.php @@ -83,7 +83,7 @@ function chequereceipt_pdf_create($db, $id, $message, $modele, $outputlangs) // Positionne modele sur le nom du modele a utiliser if (! dol_strlen($modele)) { - if ($conf->global->FACTURE_ADDON_PDF) + if (! empty($conf->global->FACTURE_ADDON_PDF)) { $modele = $conf->global->FACTURE_ADDON_PDF; } diff --git a/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php b/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php index c54a539f297..4fd48630869 100644 --- a/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php +++ b/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php @@ -115,7 +115,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts // Create PDF instance $pdf=pdf_getInstance($this->format); - $heightforinfotot = 80; // Height reserved to output the info and total part (value include bottom margin) + $heightforinfotot = 50; // Height reserved to output the info and total part $heightforfooter = 25; // Height reserved to output the footer (value include bottom margin) $pdf->SetAutoPageBreak(1,0); @@ -135,7 +135,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->transnoentities("CheckReceipt")." ".$number); - if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false); + if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php index e46a7bfc2b6..90e1ab86aeb 100644 --- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php +++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php @@ -315,7 +315,7 @@ class doc_generic_order_odt extends ModelePDFCommandes if (! empty($usecontact)) { // On peut utiliser le nom de la societe du contact - if ($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) $socobject = $object->contact; + if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact; else $socobject = $object->client; } else diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index f6b29b52b0a..495e292d3f6 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -2,7 +2,7 @@ /* Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2008 Raphael Bertrand - * Copyright (C) 2010-2011 Juanjo Menent + * Copyright (C) 2010-2012 Juanjo Menent * * 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 @@ -143,7 +143,7 @@ class pdf_einstein extends ModelePDFCommandes $outputlangs->load("orders"); $default_font_size = pdf_getPDFFontSize($outputlangs); - + if ($conf->commande->dir_output) { $object->fetch_thirdparty(); @@ -177,7 +177,7 @@ class pdf_einstein extends ModelePDFCommandes $nblignes = count($object->lines); $pdf=pdf_getInstance($this->format); - $heightforinfotot = 80; // Height reserved to output the info and total part (value include bottom margin) + $heightforinfotot = 50; // Height reserved to output the info and total part (value include bottom margin) $heightforfooter = 25; // Height reserved to output the footer (value include bottom margin) $pdf->SetAutoPageBreak(1,0); @@ -203,7 +203,7 @@ class pdf_einstein extends ModelePDFCommandes $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Order")); - if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false); + if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right @@ -227,7 +227,7 @@ class pdf_einstein extends ModelePDFCommandes $tab_top = 90; - $tab_top_newpage = 10; + $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10); $tab_height = 130; $tab_height_newpage = 150; @@ -261,25 +261,28 @@ class pdf_einstein extends ModelePDFCommandes for ($i = 0 ; $i < $nblignes ; $i++) { $curY = $nexY; + $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage + $pdf->SetTextColor(0,0,0); + $pdf->setTopMargin($tab_top_newpage); $pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); // Description of product line - $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage $curX = $this->posxdesc-1; pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,$hideref,$hidedesc,0,$hookmanager); $nexY = $pdf->GetY(); $pageposafter=$pdf->getPage(); $pdf->setPage($pageposbefore); + $pdf->setTopMargin($this->marge_haute); $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. -// We suppose that a too long description is moved completely on next page -if ($pageposafter > $pageposbefore) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; -} - + // We suppose that a too long description is moved completely on next page + if ($pageposafter > $pageposbefore) { + $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + } + $pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut // VAT Rate @@ -353,6 +356,7 @@ if ($pageposafter > $pageposbefore) { $pagenb++; $pdf->setPage($pagenb); $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs, $hookmanager); } if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak) { @@ -369,19 +373,20 @@ if ($pageposafter > $pageposbefore) { $pdf->AddPage(); if (! empty($tplidx)) $pdf->useTemplate($tplidx); $pagenb++; + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs, $hookmanager); } } // Show square if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot, 0, $outputlangs, 0, 0); - $bottomlasttab=$this->page_hauteur - $heightforinfotot + 1; + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfooter, 0, $outputlangs, 0, 0); + $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1; } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot, 0, $outputlangs, 1, 0); - $bottomlasttab=$this->page_hauteur - $heightforinfotot + 1; + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfooter, 0, $outputlangs, 1, 0); + $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1; } // Affiche zone infos @@ -531,7 +536,7 @@ if ($pageposafter > $pageposbefore) { if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ') { // Si mode reglement non force ou si force a CHQ - if ($conf->global->FACTURE_CHQ_NUMBER) + if (! empty($conf->global->FACTURE_CHQ_NUMBER)) { if ($conf->global->FACTURE_CHQ_NUMBER > 0) { @@ -597,7 +602,7 @@ if ($pageposafter > $pageposbefore) { function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs) { global $conf,$mysoc; - + $default_font_size = pdf_getPDFFontSize($outputlangs); $tab2_top = $posy; @@ -616,7 +621,7 @@ if ($pageposafter > $pageposbefore) { $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + 0); - $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ht + $object->remise), 0, 'R', 1); + $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ht + (! empty($object->remise)?$object->remise:0)), 0, 'R', 1); // Show VAT by rates and total $pdf->SetFillColor(248,248,248); @@ -624,7 +629,7 @@ if ($pageposafter > $pageposbefore) { $this->atleastoneratenotnull=0; if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) { - $tvaisnull=((! empty($this->tva) && count($this->tva) == 1 && is_float($this->tva['0.000'])) ? true : false); + $tvaisnull=((! empty($this->tva) && count($this->tva) == 1 && isset($this->tva['0.000']) && is_float($this->tva['0.000'])) ? true : false); if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_ISNULL) && $tvaisnull) { // Nothing to do @@ -690,7 +695,7 @@ if ($pageposafter > $pageposbefore) { //Local tax 1 foreach($this->localtax1 as $tvakey => $tvaval) { - if ($tvakey>0) // On affiche pas taux 0 + if ($tvakey!=0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; @@ -718,7 +723,7 @@ if ($pageposafter > $pageposbefore) { //Local tax 2 foreach($this->localtax2 as $tvakey => $tvaval) { - if ($tvakey>0) // On affiche pas taux 0 + if ($tvakey!=0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; @@ -756,7 +761,13 @@ if ($pageposafter > $pageposbefore) { $pdf->SetTextColor(0,0,0); - $resteapayer = price2num($object->total_ttc - $deja_regle); + $creditnoteamount=0; + $depositsamount=0; + //$creditnoteamount=$object->getSumCreditNotesUsed(); + //$depositsamount=$object->getSumDepositsUsed(); + //print "x".$creditnoteamount."-".$depositsamount;exit; + $resteapayer = price2num($object->total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT'); + if (! empty($object->paye)) $resteapayer=0; if ($deja_regle > 0) { @@ -802,7 +813,7 @@ if ($pageposafter > $pageposbefore) { global $conf; $default_font_size = pdf_getPDFFontSize($outputlangs); - + // Amount in (at tab_top - 1) $pdf->SetTextColor(0,0,0); $pdf->SetFont('','', $default_font_size - 2); @@ -813,10 +824,10 @@ if ($pageposafter > $pageposbefore) { $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4); $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); } - + $pdf->SetDrawColor(128,128,128); $pdf->SetFont('','', $default_font_size - 1); - + // Output Rect $this->printRect($pdf,$this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param @@ -827,7 +838,7 @@ if ($pageposafter > $pageposbefore) { $pdf->SetXY($this->posxdesc-1, $tab_top+1); $pdf->MultiCell(108,2, $outputlangs->transnoentities("Designation"),'','L'); } - + if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) { $pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height); @@ -844,14 +855,14 @@ if ($pageposafter > $pageposbefore) { $pdf->SetXY($this->posxup-1, $tab_top+1); $pdf->MultiCell($this->posxqty-$this->posxup-1,2, $outputlangs->transnoentities("PriceUHT"),'','C'); } - + $pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height); if (empty($hidetop)) { $pdf->SetXY($this->posxqty-1, $tab_top+1); $pdf->MultiCell($this->posxdiscount-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C'); } - + $pdf->line($this->posxdiscount-1, $tab_top, $this->posxdiscount-1, $tab_top + $tab_height); if (empty($hidetop)) { @@ -861,7 +872,7 @@ if ($pageposafter > $pageposbefore) { $pdf->MultiCell($this->postotalht-$this->posxdiscount+1,2, $outputlangs->transnoentities("ReductionShort"),'','C'); } } - + if ($this->atleastonediscount) { $pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height); diff --git a/htdocs/core/modules/dons/modules_don.php b/htdocs/core/modules/dons/modules_don.php index c86a75652a5..922685bf649 100644 --- a/htdocs/core/modules/dons/modules_don.php +++ b/htdocs/core/modules/dons/modules_don.php @@ -167,7 +167,7 @@ function don_create($db, $id, $message, $modele, $outputlangs) // Set template to use if (! dol_strlen($modele)) { - if ($conf->global->DON_ADDON_MODEL) + if (! empty($conf->global->DON_ADDON_MODEL)) { $modele = $conf->global->DON_ADDON_MODEL; } diff --git a/htdocs/core/modules/expedition/doc/pdf_expedition_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_expedition_merou.modules.php index 2b8f00e21d5..0e41524f4a7 100644 --- a/htdocs/core/modules/expedition/doc/pdf_expedition_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_expedition_merou.modules.php @@ -1,6 +1,6 @@ - * Copyright (C) 2005-2009 Laurent Destailleur + * Copyright (C) 2005-2012 Laurent Destailleur * Copyright (C) 2005-2011 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -49,7 +49,6 @@ class pdf_expedition_merou extends ModelePdfExpedition $this->db = $db; $this->name = "merou"; - //$this->description = "Modele Merou A5"; $this->description = $langs->trans("DocumentModelMerou"); $this->type = 'pdf'; @@ -62,7 +61,7 @@ class pdf_expedition_merou extends ModelePdfExpedition $this->marge_haute=10; $this->marge_basse=10; - $this->option_logo = 1; // Affiche logo + $this->option_logo = 1; // Recupere emmetteur $this->emetteur=$mysoc; @@ -71,13 +70,18 @@ class pdf_expedition_merou extends ModelePdfExpedition /** - * Fonction generant le document sur le disque + * Function to build pdf onto disk * - * @param Object &$object Objet expedition a generer (ou id si ancienne methode) - * @param Translate $outputlangs Lang output object - * @return int 1=ok, 0=ko + * @param Object &$object Object expedition to generate (or id if old method) + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int $hidedetails Do not show line details + * @param int $hidedesc Do not show desc + * @param int $hideref Do not show ref + * @param object $hookmanager Hookmanager object + * @return int 1=OK, 0=KO */ - function write_file(&$object, $outputlangs) + function write_file(&$object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0,$hookmanager=false) { global $user,$conf,$langs,$mysoc; $default_font_size = pdf_getPDFFontSize($outputlangs); @@ -94,13 +98,9 @@ class pdf_expedition_merou extends ModelePdfExpedition $outputlangs->load("bills"); $outputlangs->load("products"); $outputlangs->load("propal"); - $outputlangs->load("sendings"); $outputlangs->load("deliveries"); + $outputlangs->load("sendings"); - //Generation de la fiche - $this->expe = $object; - - //Verification de la configuration if ($conf->expedition->dir_output) { $object->fetch_thirdparty(); @@ -113,13 +113,12 @@ class pdf_expedition_merou extends ModelePdfExpedition //Creation du destinataire $idcontact = $object->$origin->getIdContact('external','SHIPPING'); $this->destinataire = new Contact($this->db); - if ($idcontact[0]) $this->destinataire->fetch($idcontact[0]); + if (! empty($idcontact[0])) $this->destinataire->fetch($idcontact[0]); //Creation du livreur $idcontact = $object->$origin->getIdContact('internal','LIVREUR'); $this->livreur = new User($this->db); - if ($idcontact[0]) $this->livreur->fetch($idcontact[0]); - + if (! empty($idcontact[0])) $this->livreur->fetch($idcontact[0]); // Definition de $dir et $file if ($object->specimen) @@ -138,17 +137,18 @@ class pdf_expedition_merou extends ModelePdfExpedition { if (dol_mkdir($dir) < 0) { - $this->error=$outputlangs->transnoentities("ErrorCanNotCreateDir",$dir); + $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir); return 0; } } - //Si le dossier existe if (file_exists($dir)) { - $pdf=pdf_getInstance($this->format,'mm','l'); - $heightforinfotot = 80; // Height reserved to output the info and total part (value include bottom margin) - $heightforfooter = 25; // Height reserved to output the footer (value include bottom margin) + $nblignes = count($object->lines); + + $pdf=pdf_getInstance($this->format,'mm','l'); + $heightforinfotot = 0; // Height reserved to output the info and total part + $heightforfooter = 28; // Height reserved to output the footer (value include bottom margin) $pdf->SetAutoPageBreak(1,0); if (class_exists('TCPDF')) @@ -168,90 +168,130 @@ class pdf_expedition_merou extends ModelePdfExpedition $pagenb=0; $pdf->SetDrawColor(128,128,128); - //Generation de l entete du fichier + $pdf->AliasNbPages(); + $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetSubject($outputlangs->transnoentities("Sending")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Sending")); - if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false); + if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right - $pdf->SetFont('','', $default_font_size - 3); - // New page $pdf->AddPage(); $pagenb++; - $this->_pagehead($pdf, $this->expe, 1, $outputlangs); + $this->_pagehead($pdf, $object, 1, $outputlangs, $hookmanager); $pdf->SetFont('','', $default_font_size - 3); $pdf->MultiCell(0, 3, ''); // Set interline to 3 $pdf->SetTextColor(0,0,0); - //Initialisation des coordonnees - $tab_top = 53; - $tab_height = $this->page_hauteur - 78; + $tab_top = 52; + $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10); + $tab_height = $this->page_hauteur - $tab_top - $heightforfooter; + $tab_height_newpage = $this->page_hauteur - $tab_top_newpage - $heightforfooter; + $pdf->SetFillColor(240,240,240); $pdf->SetTextColor(0,0,0); - $pdf->SetFont('','', $default_font_size - 3); $pdf->SetXY(10, $tab_top + 5); - $iniY = $pdf->GetY(); - $curY = $pdf->GetY(); - $nexY = $pdf->GetY(); - //Generation du tableau - $this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs); - $nblignes = count($object->lines); + $iniY = $tab_top + 7; + $curY = $tab_top + 7; + $nexY = $tab_top + 7; - for ($i = 0 ; $i < $nblignes ; $i++) + $num=count($object->lines); + // Loop on each lines + for ($i = 0; $i < $num; $i++) { + $curY = $nexY; + $pdf->SetFont('','', $default_font_size - 3); + $pdf->SetTextColor(0,0,0); + + $pdf->setTopMargin($tab_top_newpage); + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. + $pageposbefore=$pdf->getPage(); + // Description de la ligne produit + $libelleproduitservice = pdf_writelinedesc($pdf,$object,$i,$outputlangs,90,3,50,$curY,0,1); + + $nexY = $pdf->GetY(); + $pageposafter=$pdf->getPage(); + $pdf->setPage($pageposbefore); + $pdf->setTopMargin($this->marge_haute); + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + + // We suppose that a too long description is moved completely on next page + if ($pageposafter > $pageposbefore) { + $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + } + + $pdf->SetFont('','', $default_font_size - 3); //Creation des cases a cocher - $pdf->Rect(10+3, $curY+1, 3, 3); - $pdf->Rect(20+3, $curY+1, 3, 3); + $pdf->Rect(10+3, $curY, 3, 3); + $pdf->Rect(20+3, $curY, 3, 3); //Insertion de la reference du produit - $pdf->SetXY(30, $curY+1); + $pdf->SetXY(30, $curY); $pdf->SetFont('','B', $default_font_size - 3); $pdf->MultiCell(24, 3, $outputlangs->convToOutputCharset($object->lines[$i]->ref), 0, 'L', 0); - //Insertion du libelle - $pdf->SetFont('','', $default_font_size - 3); - $pdf->SetXY(50, $curY+1); - //$libelleproduitservice=pdf_getlinedesc($object->$origin,$i,$outputlangs); - $libelleproduitservice = pdf_writelinedesc($pdf,$object->$origin,$i,$outputlangs,90,3,50,$curY+1,1); - //$pdf->writeHTMLCell(90, 3, 50, $curY+1, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 'L', 0); - //Insertion de la quantite commandee - $pdf->SetFont('','', $default_font_size - 3); - $pdf->SetXY(140, $curY+1); + + $pdf->SetXY(140, $curY); $pdf->MultiCell(30, 3, $object->lines[$i]->qty_asked, 0, 'C', 0); - //Insertion de la quantite a envoyer - $pdf->SetFont('','', $default_font_size - 3); - $pdf->SetXY(170, $curY+1); + + $pdf->SetXY(170, $curY); $pdf->MultiCell(30, 3, $object->lines[$i]->qty_shipped, 0, 'C', 0); - //Generation de la page 2 - $curY += (dol_nboflines_bis($libelleproduitservice,0,$outputlangs->charset_output)*3+1); - $nexY = $curY; - if ($nexY > ($tab_top+$tab_height-10) && $i < $nblignes - 1) + $nexY+=2; // Passe espace entre les lignes + + // Detect if some page were added automatically and output _tableau for past pages + while ($pagenb < $pageposafter) { - $this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs); - $this->_pagefoot($pdf, $object, $outputlangs); - $pdf->AliasNbPages(); - - $curY = $iniY; - + $pdf->setPage($pagenb); + if ($pagenb == 1) + { + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); + } + else + { + $this->_tableau($pdf, $tab_top_newpage - 1, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); + } + $this->_pagefoot($pdf,$object,$outputlangs); + $pagenb++; + $pdf->setPage($pagenb); + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + } + if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak) + { + if ($pagenb == 1) + { + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); + } + else + { + $this->_tableau($pdf, $tab_top_newpage - 1, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); + } + $this->_pagefoot($pdf,$object,$outputlangs); // New page $pdf->AddPage(); $pagenb++; - $this->_pagehead($pdf, $this->expe, 0, $outputlangs); - $pdf->MultiCell(0, 3, ''); // Set interline to 3 - $pdf->SetTextColor(0,0,0); - $pdf->SetFont('','', $default_font_size - 3); } } - //Insertion du pied de page - $this->_pagefoot($pdf, $object, $outputlangs); + // Show square + if ($pagenb == 1) + { + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfooter, 0, $outputlangs, 0, 0); + $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1; + } + else + { + $this->_tableau($pdf, $tab_top_newpage - 1, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfooter, 0, $outputlangs, 1, 0); + $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1; + } + + // Pied de page + $this->_pagefoot($pdf, $object, $outputlangs); $pdf->AliasNbPages(); $pdf->Close(); @@ -298,21 +338,24 @@ class pdf_expedition_merou extends ModelePdfExpedition $langs->load("main"); $langs->load("bills"); - $pdf->SetFont('','B', $default_font_size - 2); - $pdf->SetXY(10,$tab_top); - $pdf->MultiCell(10,5,"LS",0,'C',1); - $pdf->line(20, $tab_top, 20, $tab_top + $tab_height); - $pdf->SetXY(20,$tab_top); - $pdf->MultiCell(10,5,"LR",0,'C',1); - $pdf->line(30, $tab_top, 30, $tab_top + $tab_height); - $pdf->SetXY(30,$tab_top); - $pdf->MultiCell(20,5,$outputlangs->transnoentities("Ref"),0,'C',1); - $pdf->SetXY(50,$tab_top); - $pdf->MultiCell(90,5,$outputlangs->transnoentities("Description"),0,'L',1); - $pdf->SetXY(140,$tab_top); - $pdf->MultiCell(30,5,$outputlangs->transnoentities("QtyOrdered"),0,'C',1); - $pdf->SetXY(170,$tab_top); - $pdf->MultiCell(30,5,$outputlangs->transnoentities("QtyToShip"),0,'C',1); + if (empty($hidetop)) + { + $pdf->SetFont('','B', $default_font_size - 2); + $pdf->SetXY(10,$tab_top); + $pdf->MultiCell(10,5,"LS",0,'C',1); + $pdf->line(20, $tab_top, 20, $tab_top + $tab_height); + $pdf->SetXY(20,$tab_top); + $pdf->MultiCell(10,5,"LR",0,'C',1); + $pdf->line(30, $tab_top, 30, $tab_top + $tab_height); + $pdf->SetXY(30,$tab_top); + $pdf->MultiCell(20,5,$outputlangs->transnoentities("Ref"),0,'C',1); + $pdf->SetXY(50,$tab_top); + $pdf->MultiCell(90,5,$outputlangs->transnoentities("Description"),0,'L',1); + $pdf->SetXY(140,$tab_top); + $pdf->MultiCell(30,5,$outputlangs->transnoentities("QtyOrdered"),0,'C',1); + $pdf->SetXY(170,$tab_top); + $pdf->MultiCell(30,5,$outputlangs->transnoentities("QtyToShip"),0,'C',1); + } $pdf->Rect(10, $tab_top, 190, $tab_height); } @@ -537,7 +580,7 @@ class pdf_expedition_merou extends ModelePdfExpedition if (! empty($usecontact)) { // On peut utiliser le nom de la societe du contact - if ($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) $socname = $object->contact->socname; + if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname; else $socname = $object->client->nom; $carac_client_name=$outputlangs->convToOutputCharset($socname); } diff --git a/htdocs/core/modules/expedition/doc/pdf_expedition_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_expedition_rouget.modules.php index aaaf575dda0..31fb518df1b 100644 --- a/htdocs/core/modules/expedition/doc/pdf_expedition_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_expedition_rouget.modules.php @@ -1,6 +1,6 @@ - * Copyright (C) 2005-2009 Laurent Destailleur + * Copyright (C) 2005-2012 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -73,13 +73,18 @@ class pdf_expedition_rouget extends ModelePdfExpedition } /** - * Fonction generant le document sur le disque + * Function to build pdf onto disk * - * @param Object &$object Objet expedition a generer (ou id si ancienne methode) - * @param Translate $outputlangs Lang output object - * @return int 1=ok, 0=ko + * @param Object &$object Object expedition to generate (or id if old method) + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int $hidedetails Do not show line details + * @param int $hidedesc Do not show desc + * @param int $hideref Do not show ref + * @param object $hookmanager Hookmanager object + * @return int 1=OK, 0=KO */ - function write_file(&$object, $outputlangs) + function write_file(&$object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0,$hookmanager=false) { global $user,$conf,$langs; $default_font_size = pdf_getPDFFontSize($outputlangs); @@ -128,7 +133,7 @@ class pdf_expedition_rouget extends ModelePdfExpedition $nblignes = count($object->lines); $pdf=pdf_getInstance($this->format); - $heightforinfotot = 80; // Height reserved to output the info and total part (value include bottom margin) + $heightforinfotot = 0; // Height reserved to output the info and total part $heightforfooter = 25; // Height reserved to output the footer (value include bottom margin) $pdf->SetAutoPageBreak(1,0); @@ -155,8 +160,8 @@ class pdf_expedition_rouget extends ModelePdfExpedition $pdf->SetSubject($outputlangs->transnoentities("Sending")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); - $pdf->SetKeyWords($outputlangs->convToOutputCharset($fac->ref)." ".$outputlangs->transnoentities("Sending")); - if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false); + $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Sending")); + if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right @@ -170,8 +175,8 @@ class pdf_expedition_rouget extends ModelePdfExpedition $pdf->SetTextColor(0,0,0); $tab_top = 90; - $tab_top_newpage = 50; - $tab_height = 110; + $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10); + $tab_height = 130; $tab_height_newpage = 150; if (! empty($object->note_public) || ! empty($object->tracking_number)) @@ -223,12 +228,14 @@ class pdf_expedition_rouget extends ModelePdfExpedition $nexY = $tab_top + 7; $num=count($object->lines); + // Loop on each lines for ($i = 0; $i < $num; $i++) { $curY = $nexY; + $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage + $pdf->SetTextColor(0,0,0); - $pdf->SetFont('','', $default_font_size - 1); // Dans boucle pour gerer multi-page - + $pdf->setTopMargin($tab_top_newpage); $pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); @@ -238,13 +245,14 @@ class pdf_expedition_rouget extends ModelePdfExpedition $nexY = $pdf->GetY(); $pageposafter=$pdf->getPage(); $pdf->setPage($pageposbefore); + $pdf->setTopMargin($this->marge_haute); $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. - // We suppose that a too long description is moved completely on next page - if ($pageposafter > $pageposbefore) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; - } - + // We suppose that a too long description is moved completely on next page + if ($pageposafter > $pageposbefore) { + $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + } + $pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut $pdf->SetXY($this->posxqtyordered+5, $curY); @@ -293,13 +301,13 @@ class pdf_expedition_rouget extends ModelePdfExpedition // Show square if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot, 0, $outputlangs, 0, 0); - $bottomlasttab=$this->page_hauteur - $heightforinfotot + 1; + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter - $heightforinfotot, 0, $outputlangs, 0, 0); + $bottomlasttab=$this->page_hauteur - $heightforfooter - $heightforinfotot + 1; } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot, 0, $outputlangs, 1, 0); - $bottomlasttab=$this->page_hauteur - $heightforinfotot + 1; + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter - $heightforinfotot, 0, $outputlangs, 1, 0); + $bottomlasttab=$this->page_hauteur - $heightforfooter - $heightforinfotot + 1; } // Pied de page @@ -436,7 +444,7 @@ class pdf_expedition_rouget extends ModelePdfExpedition } // Show barcode - if ($conf->barcode->enabled) + if (! empty($conf->barcode->enabled)) { $posx=105; } @@ -445,7 +453,7 @@ class pdf_expedition_rouget extends ModelePdfExpedition $posx=$this->marge_gauche+3; } //$pdf->Rect($this->marge_gauche, $this->marge_haute, $this->page_largeur-$this->marge_gauche-$this->marge_droite, 30); - if ($conf->barcode->enabled) + if (! empty($conf->barcode->enabled)) { // TODO Build code bar with function writeBarCode of barcode module for sending ref $object->ref //$pdf->SetXY($this->marge_gauche+3, $this->marge_haute+3); @@ -453,7 +461,7 @@ class pdf_expedition_rouget extends ModelePdfExpedition } $pdf->SetDrawColor(128,128,128); - if ($conf->barcode->enabled) + if (! empty($conf->barcode->enabled)) { // TODO Build code bar with function writeBarCode of barcode module for sending ref $object->ref //$pdf->SetXY($this->marge_gauche+3, $this->marge_haute+3); @@ -579,7 +587,7 @@ class pdf_expedition_rouget extends ModelePdfExpedition if (! empty($usecontact)) { // On peut utiliser le nom de la societe du contact - if ($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) $socname = $object->contact->socname; + if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname; else $socname = $object->client->nom; $carac_client_name=$outputlangs->convToOutputCharset($socname); } diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index d796fee8441..78e28d24fec 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -326,7 +326,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures if (! empty($usecontact)) { // On peut utiliser le nom de la societe du contact - if ($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) $socobject = $object->contact; + if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact; else $socobject = $object->client; } else diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 2804e78fb6a..90f6030e11d 100755 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -2,7 +2,7 @@ /* Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2008 Raphael Bertrand - * Copyright (C) 2010-2011 Juanjo Menent + * Copyright (C) 2010-2012 Juanjo Menent * * 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 @@ -98,7 +98,7 @@ class pdf_crabe extends ModelePDFFactures // Get source company $this->emetteur=$mysoc; - if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default, if was not defined + if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default, if was not defined // Defini position des colonnes $this->posxdesc=$this->marge_gauche+1; @@ -119,14 +119,14 @@ class pdf_crabe extends ModelePDFFactures /** * Function to build pdf onto disk * - * @param int $object Id of object to generate - * @param object $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @param object $hookmanager Hookmanager object - * @return int 1=OK, 0=KO + * @param Object $object Object to generate + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int $hidedetails Do not show line details + * @param int $hidedesc Do not show desc + * @param int $hideref Do not show ref + * @param object $hookmanager Hookmanager object + * @return int 1=OK, 0=KO */ function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0,$hookmanager=false) { @@ -178,7 +178,7 @@ class pdf_crabe extends ModelePDFFactures $nblignes = count($object->lines); $pdf=pdf_getInstance($this->format); - $heightforinfotot = 80; // Height reserved to output the info and total part (value include bottom margin) + $heightforinfotot = 50; // Height reserved to output the info and total part $heightforfooter = 25; // Height reserved to output the footer (value include bottom margin) $pdf->SetAutoPageBreak(1,0); @@ -204,7 +204,7 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Invoice")); - if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false); + if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right @@ -221,13 +221,14 @@ class pdf_crabe extends ModelePDFFactures $pdf->AddPage(); if (! empty($tplidx)) $pdf->useTemplate($tplidx); $pagenb++; + $this->_pagehead($pdf, $object, 1, $outputlangs, $hookmanager); $pdf->SetFont('','', $default_font_size - 1); $pdf->MultiCell(0, 3, ''); // Set interline to 3 $pdf->SetTextColor(0,0,0); $tab_top = 90; - $tab_top_newpage = 10; + $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10); $tab_height = 130; $tab_height_newpage = 150; @@ -260,27 +261,30 @@ class pdf_crabe extends ModelePDFFactures $nexY = $tab_top + 7; // Loop on each lines - for ($i = 0 ; $i < $nblignes ; $i++) + for ($i = 0; $i < $nblignes; $i++) { $curY = $nexY; + $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage + $pdf->SetTextColor(0,0,0); + $pdf->setTopMargin($tab_top_newpage); $pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); // Description of product line - $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage $curX = $this->posxdesc-1; pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,$hideref,$hidedesc,0,$hookmanager); $nexY = $pdf->GetY(); $pageposafter=$pdf->getPage(); $pdf->setPage($pageposbefore); + $pdf->setTopMargin($this->marge_haute); $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. -// We suppose that a too long description is moved completely on next page -if ($pageposafter > $pageposbefore) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; -} + // We suppose that a too long description is moved completely on next page + if ($pageposafter > $pageposbefore) { + $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + } $pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut @@ -354,6 +358,7 @@ if ($pageposafter > $pageposbefore) { $pagenb++; $pdf->setPage($pagenb); $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs, $hookmanager); } if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak) { @@ -370,19 +375,20 @@ if ($pageposafter > $pageposbefore) { $pdf->AddPage(); if (! empty($tplidx)) $pdf->useTemplate($tplidx); $pagenb++; + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs, $hookmanager); } } // Show square if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot, 0, $outputlangs, 0, 0); - $bottomlasttab=$this->page_hauteur - $heightforinfotot + 1; + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfooter, 0, $outputlangs, 0, 0); + $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1; } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot, 0, $outputlangs, 1, 0); - $bottomlasttab=$this->page_hauteur - $heightforinfotot + 1; + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfooter, 0, $outputlangs, 1, 0); + $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1; } // Affiche zone infos @@ -643,7 +649,7 @@ if ($pageposafter > $pageposbefore) { if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ') { // Si mode reglement non force ou si force a CHQ - if ($conf->global->FACTURE_CHQ_NUMBER) + if (! empty($conf->global->FACTURE_CHQ_NUMBER)) { if ($conf->global->FACTURE_CHQ_NUMBER > 0) { @@ -739,7 +745,6 @@ if ($pageposafter > $pageposbefore) { $this->atleastoneratenotnull=0; if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) { - $tvaisnull=((! empty($this->tva) && count($this->tva) == 1 && isset($this->tva['0.000']) && is_float($this->tva['0.000'])) ? true : false); if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_ISNULL) && $tvaisnull) { @@ -804,7 +809,7 @@ if ($pageposafter > $pageposbefore) { //Local tax 1 foreach($this->localtax1 as $tvakey => $tvaval) { - if ($tvakey>0) // On affiche pas taux 0 + if ($tvakey!=0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; @@ -832,7 +837,7 @@ if ($pageposafter > $pageposbefore) { //Local tax 2 foreach($this->localtax2 as $tvakey => $tvaval) { - if ($tvakey>0) // On affiche pas taux 0 + if ($tvakey!=0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index e71db402c7a..9a5509de183 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -84,10 +84,9 @@ class pdf_soleil extends ModelePDFFicheinter $this->option_multilang = 0; // Dispo en plusieurs langues $this->option_draft_watermark = 1; //Support add of a watermark on drafts - // Recupere emmetteur + // Get source company $this->emetteur=$mysoc; - if (empty($this->emetteur->country_code)) - $this->emetteur->country_code = substr($langs->defaultlang,-2); // By default, if not defined + if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default, if not defined // Defini position des colonnes $this->posxdesc=$this->marge_gauche+1; @@ -96,14 +95,18 @@ class pdf_soleil extends ModelePDFFicheinter /** * Function to build pdf onto disk * - * @param object $object Object to generate + * @param int $object Id of object to generate * @param object $outputlangs Lang output object - * @return int 1=ok, 0=ko + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int $hidedetails Do not show line details + * @param int $hidedesc Do not show desc + * @param int $hideref Do not show ref + * @param object $hookmanager Hookmanager object + * @return int 1=OK, 0=KO */ - function write_file($object,$outputlangs) + function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0,$hookmanager=false) { global $user,$langs,$conf,$mysoc; - $default_font_size = pdf_getPDFFontSize($outputlangs); if (! is_object($outputlangs)) $outputlangs=$langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO @@ -114,6 +117,8 @@ class pdf_soleil extends ModelePDFFicheinter $outputlangs->load("companies"); $outputlangs->load("interventions"); + $default_font_size = pdf_getPDFFontSize($outputlangs); + if ($conf->ficheinter->dir_output) { $object->fetch_thirdparty(); @@ -135,7 +140,7 @@ class pdf_soleil extends ModelePDFFicheinter if (file_exists($dir)) { $pdf=pdf_getInstance($this->format); - $heightforinfotot = 80; // Height reserved to output the info and total part (value include bottom margin) + $heightforinfotot = 50; // Height reserved to output the info and total part $heightforfooter = 25; // Height reserved to output the footer (value include bottom margin) $pdf->SetAutoPageBreak(1,0); @@ -161,7 +166,7 @@ class pdf_soleil extends ModelePDFFicheinter $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("InterventionCard")); - if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false); + if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right @@ -169,16 +174,14 @@ class pdf_soleil extends ModelePDFFicheinter $pdf->AddPage(); if (! empty($tplidx)) $pdf->useTemplate($tplidx); $pagenb++; - $this->_pagehead($pdf, $object, 1, $outputlangs); - $pdf->SetTextColor(0,0,0); + $this->_pagehead($pdf, $object, 1, $outputlangs, $hookmanager); $pdf->SetFont('','', $default_font_size - 1); $pdf->MultiCell(0, 3, ''); // Set interline to 3 + $pdf->SetTextColor(0,0,0); $tab_top = 90; - $tab_top_middlepage = 10; - $tab_top_newpage = 10; + $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10); $tab_height = 130; - $tab_height_middlepage = 200; $tab_height_newpage = 150; // Affiche notes @@ -186,7 +189,7 @@ class pdf_soleil extends ModelePDFFicheinter { $tab_top = 88; - $pdf->SetFont('','', $default_font_size - 1); // Dans boucle pour gerer multi-page + $pdf->SetFont('','', $default_font_size - 1); $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($object->note_public), 0, 1); $nexY = $pdf->GetY(); $height_note=$nexY-$tab_top; @@ -242,48 +245,32 @@ class pdf_soleil extends ModelePDFFicheinter if ($valide > 0 || $object->specimen) { $curY = $nexY; + $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage + $pdf->SetTextColor(0,0,0); - $pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. - $pageposbefore=$pdf->getPage(); - - $pdf->SetFont('','B', $default_font_size - 1); - $pdf->SetXY($this->marge_gauche, $curY); - $txt=dol_htmlentitiesbr($outputlangs->transnoentities("Date")." : ".dol_print_date($objectligne->datei,'dayhour',false,$outputlangs,true)." - ".$outputlangs->transnoentities("Duration")." : ".convertSecondToTime($objectligne->duration),1,$outputlangs->charset_output); + $pdf->setTopMargin($tab_top_newpage); + $pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. + $pageposbefore=$pdf->getPage(); - $curYold=$nexYold=$nexY; - $pdf->writeHTMLCell(0, 3, $this->marge_gauche, $curY, $txt, 0, 1, 0); - $curY = $pdf->GetY(); - $nexY+=3; + // Description of product line + $txt=''.dol_htmlentitiesbr($outputlangs->transnoentities("Date")." : ".dol_print_date($objectligne->datei,'dayhour',false,$outputlangs,true)." - ".$outputlangs->transnoentities("Duration")." : ".convertSecondToTime($objectligne->duration),1,$outputlangs->charset_output).''; + $desc=dol_htmlentitiesbr($objectligne->desc,1); - $pdf->SetFont('','', $default_font_size - 1); + $pdf->writeHTMLCell(0, 0, $curX, $curY, dol_concatdesc($txt,$desc), 0, 1, 0); - $pdf->SetXY($this->marge_gauche, $nexY); - $desc = dol_htmlentitiesbr($objectligne->desc,1); + $nexY = $pdf->GetY(); + $pageposafter=$pdf->getPage(); + $pdf->setPage($pageposbefore); + $pdf->setTopMargin($this->marge_haute); + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. - $curYold = $pdf->GetY(); - $nexYold = $curYold; - - $pdf->writeHTMLCell(0, 3, $this->marge_gauche, $curY, $desc, 0, 1, 0); - - $stringheight=$pdf->getStringHeight('A', $txt); - $curY = $pdf->GetY(); - - $nexY+=(dol_nboflines_bis($objectligne->desc,0,$outputlangs->charset_output)*$stringheight); - //print $curYold."-".$nexYold." +".dol_nboflines_bis($objectligne->desc,52,$outputlangs->charset_output)."*".$stringheight."= ".$curY."-".$nexY."
"; - - $nexY+=2; // Passe espace entre les lignes - - $pageposafter=$pdf->getPage(); - $pdf->setPage($pageposbefore); - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. - - // We suppose that a too long description is moved completely on next page - if ($pageposafter > $pageposbefore) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + // We suppose that a too long description is moved completely on next page + if ($pageposafter > $pageposbefore) { + $pdf->setPage($pageposafter); $curY = $tab_top_newpage; } - $pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut - + $pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut + // Detect if some page were added automatically and output _tableau for past pages while ($pagenb < $pageposafter) { @@ -323,17 +310,15 @@ class pdf_soleil extends ModelePDFFicheinter // Show square if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot, 0, $outputlangs, 0, 0); - $bottomlasttab=$this->page_hauteur - $heightforinfotot + 1; + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfooter, 0, $outputlangs, 0, 0); + $bottomlasttab=$this->page_hauteur - $heightforfooter - $heightforfooter + 1; } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot, 0, $outputlangs, 1, 0); - $bottomlasttab=$this->page_hauteur - $heightforinfotot + 1; + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfooter, 0, $outputlangs, 1, 0); + $bottomlasttab=$this->page_hauteur - $heightforfooter - $heightforfooter + 1; } - $pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut - $this->_pagefoot($pdf,$object,$outputlangs); $pdf->AliasNbPages(); @@ -401,21 +386,24 @@ class pdf_soleil extends ModelePDFFicheinter $pdf->MultiCell(0, 3, ''); // Set interline to 3. Then writeMultiCell must use 3 also. */ - $pdf->Rect($this->marge_gauche, $tab_top, ($this->page_largeur-$this->marge_gauche-$this->marge_droite), $tab_height+3); - $pdf->SetXY($this->marge_gauche, $pdf->GetY() + 20); - $pdf->MultiCell(60, 5, '', 0, 'J', 0); - $pdf->SetXY(20,230); - $pdf->MultiCell(66,5, $outputlangs->transnoentities("NameAndSignatureOfInternalContact"),0,'L',0); + // Output Rect + $this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height+3, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param - $pdf->SetXY(20,235); - $pdf->MultiCell(80,25, '', 1); + if (empty($hidebottom)) + { + $pdf->SetXY(20,230); + $pdf->MultiCell(66,5, $outputlangs->transnoentities("NameAndSignatureOfInternalContact"),0,'L',0); - $pdf->SetXY(110,230); - $pdf->MultiCell(80,5, $outputlangs->transnoentities("NameAndSignatureOfExternalContact"),0,'L',0); + $pdf->SetXY(20,235); + $pdf->MultiCell(80,25, '', 1); - $pdf->SetXY(110,235); - $pdf->MultiCell(80,25, '', 1); + $pdf->SetXY(110,230); + $pdf->MultiCell(80,5, $outputlangs->transnoentities("NameAndSignatureOfExternalContact"),0,'L',0); + + $pdf->SetXY(110,235); + $pdf->MultiCell(80,25, '', 1); + } } /** @@ -559,7 +547,7 @@ class pdf_soleil extends ModelePDFFicheinter if (! empty($usecontact)) { // On peut utiliser le nom de la societe du contact - if ($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) $socname = $object->contact->socname; + if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname; else $socname = $object->client->nom; $carac_client_name=$outputlangs->convToOutputCharset($socname); } diff --git a/htdocs/core/modules/fichinter/modules_fichinter.php b/htdocs/core/modules/fichinter/modules_fichinter.php index 0cda5ac63b7..452e94f9ad0 100644 --- a/htdocs/core/modules/fichinter/modules_fichinter.php +++ b/htdocs/core/modules/fichinter/modules_fichinter.php @@ -166,7 +166,7 @@ function fichinter_create($db, $object, $modele, $outputlangs, $hidedetails=0, $ // Positionne modele sur le nom du modele de fichinter a utiliser if (! dol_strlen($modele)) { - if ($conf->global->FICHEINTER_ADDON_PDF) + if (! empty($conf->global->FICHEINTER_ADDON_PDF)) { $modele = $conf->global->FICHEINTER_ADDON_PDF; } diff --git a/htdocs/core/modules/livraison/modules_livraison.php b/htdocs/core/modules/livraison/modules_livraison.php index 663c7198755..3e6d48bd29d 100644 --- a/htdocs/core/modules/livraison/modules_livraison.php +++ b/htdocs/core/modules/livraison/modules_livraison.php @@ -167,7 +167,7 @@ function delivery_order_pdf_create($db, $object, $modele, $outputlangs='') // Positionne modele sur le nom du modele de bon de livraison a utiliser if (! dol_strlen($modele)) { - if ($conf->global->LIVRAISON_ADDON_PDF) + if (! empty($conf->global->LIVRAISON_ADDON_PDF)) { $modele = $conf->global->LIVRAISON_ADDON_PDF; } diff --git a/htdocs/core/modules/livraison/pdf/pdf_sirocco.modules.php b/htdocs/core/modules/livraison/pdf/pdf_sirocco.modules.php index 78a16adf15f..1e49e8f6c6d 100644 --- a/htdocs/core/modules/livraison/pdf/pdf_sirocco.modules.php +++ b/htdocs/core/modules/livraison/pdf/pdf_sirocco.modules.php @@ -31,8 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; /** - * \class pdf_sirocco - * \brief Classe permettant de generer les bons de livraison au modele Sirocco + * Classe permettant de generer les bons de livraison au modele Sirocco */ class pdf_sirocco extends ModelePDFDeliveryOrder { @@ -120,7 +119,7 @@ class pdf_sirocco extends ModelePDFDeliveryOrder if (file_exists($dir)) { $pdf=pdf_getInstance($this->format); - $heightforinfotot = 80; // Height reserved to output the info and total part (value include bottom margin) + $heightforinfotot = 50; // Height reserved to output the info and total part $heightforfooter = 25; // Height reserved to output the footer (value include bottom margin) $pdf->SetAutoPageBreak(1,0); @@ -158,7 +157,7 @@ class pdf_sirocco extends ModelePDFDeliveryOrder $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("DeliveryOrder")); - if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false); + if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right @@ -171,37 +170,40 @@ class pdf_sirocco extends ModelePDFDeliveryOrder $pdf->MultiCell(0, 3, ''); // Set interline to 3 $pdf->SetTextColor(0,0,0); - $tab_top = 100; - $tab_top_newpage = 50; - $tab_height = 140; - $tab_height_newpage = 190; + $tab_top = 90; + $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10); + $tab_height = 130; + $tab_height_newpage = 150; $iniY = $tab_top + 7; $curY = $tab_top + 7; $nexY = $tab_top + 7; + // Loop on each lines for ($i = 0 ; $i < $nblines ; $i++) { $curY = $nexY; + $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage + $pdf->SetTextColor(0,0,0); + $pdf->setTopMargin($tab_top_newpage); $pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); - + // Description of product line - $pdf->SetFont('','', $default_font_size - 1); - //$curX = $this->posxdesc-1; pdf_writelinedesc($pdf,$object,$i,$outputlangs,100,3,30,$curY,1); $nexY = $pdf->GetY(); $pageposafter=$pdf->getPage(); $pdf->setPage($pageposbefore); + $pdf->setTopMargin($this->marge_haute); $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. // We suppose that a too long description is moved completely on next page if ($pageposafter > $pageposbefore) { $pdf->setPage($pageposafter); $curY = $tab_top_newpage; } - + $pdf->SetFont('','', $default_font_size - 1); // Dans boucle pour gerer multi-page $pdf->SetXY(10, $curY); @@ -267,13 +269,13 @@ if ($pageposafter > $pageposbefore) { // Show square if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot, 0, $outputlangs, 0, 0); - $bottomlasttab=$this->page_hauteur - $heightforinfotot + 1; + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfooter, 0, $outputlangs, 0, 0); + $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1; } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot, 0, $outputlangs, 1, 0); - $bottomlasttab=$this->page_hauteur - $heightforinfotot + 1; + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfooter, 0, $outputlangs, 1, 0); + $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1; } /* @@ -351,7 +353,7 @@ if ($pageposafter > $pageposbefore) { $pdf->SetXY($this->marge_gauche,$posy); - if ($conf->global->MAIN_INFO_SOCIETE_NOM) + if (! empty($conf->global->MAIN_INFO_SOCIETE_NOM)) { $pdf->SetTextColor(0,0,200); $pdf->SetFont('','B', $default_font_size + 2); @@ -383,7 +385,7 @@ if ($pageposafter > $pageposbefore) { if (! empty($usecontact)) { // On peut utiliser le nom de la societe du contact - if ($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) $socname = $object->contact->socname; + if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname; else $socname = $object->client->nom; $carac_client_name=$outputlangs->convToOutputCharset($socname); } diff --git a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php index 7f5a25550a4..b2653beb7cc 100644 --- a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php +++ b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php @@ -34,10 +34,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; /** - * \class pdf_typhon - * \brief Classe permettant de generer les bons de livraison au modele Typho + * Classe permettant de generer les bons de livraison au modele Typho */ - class pdf_typhon extends ModelePDFDeliveryOrder { var $emetteur; // Objet societe qui emet @@ -143,7 +141,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder if (file_exists($dir)) { $pdf=pdf_getInstance($this->format); - $heightforinfotot = 50; // Height reserved to output the info and total part (value include bottom margin) + $heightforinfotot = 50; // Height reserved to output the info and total part $heightforfooter = 50; // Height reserved to output the footer (value include bottom margin) $pdf->SetAutoPageBreak(1,0); @@ -181,7 +179,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("DeliveryOrder")); - if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false); + if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right @@ -206,8 +204,8 @@ class pdf_typhon extends ModelePDFDeliveryOrder $pdf->SetTextColor(0,0,0); $tab_top = 90; - $tab_top_newpage = 5; - $tab_height = 150; + $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10); + $tab_height = 130; $tab_height_newpage = 150; // Affiche notes @@ -236,27 +234,30 @@ class pdf_typhon extends ModelePDFDeliveryOrder $curY = $tab_top + 7; $nexY = $tab_top + 7; - // Boucle sur les lignes + // Loop on each lines for ($i = 0 ; $i < $nblines ; $i++) { $curY = $nexY; + $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage + $pdf->SetTextColor(0,0,0); + $pdf->setTopMargin($tab_top_newpage); $pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot-50); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); // Description of product line - $pdf->SetFont('','', $default_font_size - 1); // Dans boucle pour gerer multi-page $curX = $this->posxdesc-1; pdf_writelinedesc($pdf,$object,$i,$outputlangs,108,3,$curX,$curY); $nexY = $pdf->GetY(); $pageposafter=$pdf->getPage(); $pdf->setPage($pageposbefore); + $pdf->setTopMargin($this->marge_haute); $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. - // We suppose that a too long description is moved completely on next page - if ($pageposafter > $pageposbefore) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + // We suppose that a too long description is moved completely on next page + if ($pageposafter > $pageposbefore) { + $pdf->setPage($pageposafter); $curY = $tab_top_newpage; } $pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut @@ -334,13 +335,13 @@ class pdf_typhon extends ModelePDFDeliveryOrder // Show square if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot, 0, $outputlangs, 0, 0); - $bottomlasttab=$this->page_hauteur - $heightforinfotot + 1; + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfooter, 0, $outputlangs, 0, 0); + $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1; } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot, 0, $outputlangs, 1, 0); - $bottomlasttab=$this->page_hauteur - $heightforinfotot + 1; + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfooter, 0, $outputlangs, 1, 0); + $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1; } /* @@ -642,7 +643,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder if (! empty($usecontact)) { // On peut utiliser le nom de la societe du contact - if ($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) $socname = $object->contact->socname; + if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname; else $socname = $object->client->nom; $carac_client_name=$outputlangs->convToOutputCharset($socname); } diff --git a/htdocs/core/modules/mailings/xinputuser.modules.php b/htdocs/core/modules/mailings/xinputuser.modules.php index 994bac804c4..12648f147fd 100644 --- a/htdocs/core/modules/mailings/xinputuser.modules.php +++ b/htdocs/core/modules/mailings/xinputuser.modules.php @@ -133,7 +133,7 @@ class mailing_xinputuser extends MailingTargets { $cibles[] = array( 'email' => $email, - 'name' => $name, + 'name' => $lastname, 'firstname' => $firstname, 'other' => $other, 'source_url' => '', diff --git a/htdocs/core/modules/member/doc/pdf_standard.class.php b/htdocs/core/modules/member/doc/pdf_standard.class.php index e80973afd67..cf01009e6c2 100644 --- a/htdocs/core/modules/member/doc/pdf_standard.class.php +++ b/htdocs/core/modules/member/doc/pdf_standard.class.php @@ -461,7 +461,7 @@ class pdf_standard $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->transnoentities('MembersCards')." ".$outputlangs->transnoentities("Foundation")." ".$outputlangs->convToOutputCharset($mysoc->name)); - if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false); + if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); $pdf->SetMargins(0,0); $pdf->SetAutoPageBreak(false); diff --git a/htdocs/core/modules/modCategorie.class.php b/htdocs/core/modules/modCategorie.class.php index bc18fa78ecb..00e2ebfc5d7 100644 --- a/htdocs/core/modules/modCategorie.class.php +++ b/htdocs/core/modules/modCategorie.class.php @@ -109,7 +109,7 @@ class modCategorie extends DolibarrModules $this->export_icon[$r]='category'; $this->export_enabled[$r]='$conf->fournisseur->enabled'; $this->export_permission[$r]=array(array("categorie","lire"),array("fournisseur","lire")); - $this->export_fields_array[$r]=array('u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'s.rowid'=>'IdThirdParty','s.nom'=>'Name','s.prefix_comm'=>"Prefix",'s.client'=>"Customer",'s.datec'=>"DateCreation",'s.tms'=>"DateLastModification",'s.code_client'=>"CustomerCode",'s.address'=>"Address",'s.cp'=>"Zip",'s.ville'=>"Town",'p.libelle'=>"Country",'p.code'=>"CountryCode",'s.tel'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email",'s.siret'=>"IdProf1",'s.siren'=>"IdProf2",'s.ape'=>"IdProf3",'s.idprof4'=>"IdProf4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital",'s.note'=>"Note"); + $this->export_fields_array[$r]=array('u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'s.rowid'=>'IdThirdParty','s.nom'=>'Name','s.prefix_comm'=>"Prefix",'s.client'=>"Customer",'s.datec'=>"DateCreation",'s.tms'=>"DateLastModification",'s.code_client'=>"CustomerCode",'s.address'=>"Address",'s.cp'=>"Zip",'s.ville'=>"Town",'p.libelle'=>"Country",'p.code'=>"CountryCode",'s.tel'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email",'s.siret'=>"ProfId1",'s.siren'=>"ProfId2",'s.ape'=>"ProfId3",'s.idprof4'=>"ProfId4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital",'s.note'=>"Note"); $this->export_entities_array[$r]=array('s.rowid'=>'company','s.nom'=>'company','s.prefix_comm'=>"company",'s.client'=>"company",'s.datec'=>"company",'s.tms'=>"company",'s.code_client'=>"company",'s.address'=>"company",'s.cp'=>"company",'s.ville'=>"company",'p.libelle'=>"company",'p.code'=>"company",'s.tel'=>"company",'s.fax'=>"company",'s.url'=>"company",'s.email'=>"company",'s.siret'=>"company",'s.siren'=>"company",'s.ape'=>"company",'s.idprof4'=>"company",'s.tva_intra'=>"company",'s.capital'=>"company",'s.note'=>"company"); // We define here only fields that use another picto $this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'categorie as u, '.MAIN_DB_PREFIX.'categorie_fournisseur as cf, '.MAIN_DB_PREFIX.'societe as s LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as t ON s.fk_typent = t.id LEFT JOIN '.MAIN_DB_PREFIX.'c_pays as p ON s.fk_pays = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'c_effectif as ce ON s.fk_effectif = ce.id LEFT JOIN '.MAIN_DB_PREFIX.'c_forme_juridique as cfj ON s.fk_forme_juridique = cfj.code'; @@ -123,7 +123,7 @@ class modCategorie extends DolibarrModules $this->export_icon[$r]='category'; $this->export_enabled[$r]='$conf->societe->enabled'; $this->export_permission[$r]=array(array("categorie","lire"),array("societe","lire")); - $this->export_fields_array[$r]=array('u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'s.rowid'=>'IdThirdParty','s.nom'=>'Name','s.prefix_comm'=>"Prefix",'s.client'=>"Customer",'s.datec'=>"DateCreation",'s.tms'=>"DateLastModification",'s.code_client'=>"CustomerCode",'s.address'=>"Address",'s.cp'=>"Zip",'s.ville'=>"Town",'p.libelle'=>"Country",'p.code'=>"CountryCode",'s.tel'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email",'s.siret'=>"IdProf1",'s.siren'=>"IdProf2",'s.ape'=>"IdProf3",'s.idprof4'=>"IdProf4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital",'s.note'=>"Note",'s.fk_prospectlevel'=>'ProspectLevel','s.fk_stcomm'=>'ProspectStatus'); + $this->export_fields_array[$r]=array('u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'s.rowid'=>'IdThirdParty','s.nom'=>'Name','s.prefix_comm'=>"Prefix",'s.client'=>"Customer",'s.datec'=>"DateCreation",'s.tms'=>"DateLastModification",'s.code_client'=>"CustomerCode",'s.address'=>"Address",'s.cp'=>"Zip",'s.ville'=>"Town",'p.libelle'=>"Country",'p.code'=>"CountryCode",'s.tel'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email",'s.siret'=>"ProfId1",'s.siren'=>"ProfId2",'s.ape'=>"ProfId3",'s.idprof4'=>"ProfId4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital",'s.note'=>"Note",'s.fk_prospectlevel'=>'ProspectLevel','s.fk_stcomm'=>'ProspectStatus'); $this->export_entities_array[$r]=array('s.rowid'=>'company','s.nom'=>'company','s.prefix_comm'=>"company",'s.client'=>"company",'s.datec'=>"company",'s.tms'=>"company",'s.code_client'=>"company",'s.address'=>"company",'s.cp'=>"company",'s.ville'=>"company",'p.libelle'=>"company",'p.code'=>"company",'s.tel'=>"company",'s.fax'=>"company",'s.url'=>"company",'s.email'=>"company",'s.siret'=>"company",'s.siren'=>"company",'s.ape'=>"company",'s.idprof4'=>"company",'s.tva_intra'=>"company",'s.capital'=>"company",'s.note'=>"company",'s.fk_prospectlevel'=>'company','s.fk_stcomm'=>'company'); // We define here only fields that use another picto $this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'categorie as u, '.MAIN_DB_PREFIX.'categorie_societe as cf, '.MAIN_DB_PREFIX.'societe as s LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as t ON s.fk_typent = t.id LEFT JOIN '.MAIN_DB_PREFIX.'c_pays as p ON s.fk_pays = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'c_effectif as ce ON s.fk_effectif = ce.id LEFT JOIN '.MAIN_DB_PREFIX.'c_forme_juridique as cfj ON s.fk_forme_juridique = cfj.code'; @@ -151,7 +151,7 @@ class modCategorie extends DolibarrModules $this->export_icon[$r]='category'; $this->export_enabled[$r]='$conf->adherent->enabled'; $this->export_permission[$r]=array(array("categorie","lire"),array("adherent","lire")); - $this->export_fields_array[$r]=array('u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'p.rowid'=>'MemberId','p.nom'=>'Name','p.prenom'=>'Firstname'); + $this->export_fields_array[$r]=array('u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'p.rowid'=>'MemberId','p.nom'=>'LastName','p.prenom'=>'Firstname'); $this->export_entities_array[$r]=array('p.rowid'=>'member','p.nom'=>'member','p.prenom'=>'member'); // We define here only fields that use another picto $this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'categorie as u, '.MAIN_DB_PREFIX.'categorie_member as cp, '.MAIN_DB_PREFIX.'adherent as p'; diff --git a/htdocs/core/modules/modCommande.class.php b/htdocs/core/modules/modCommande.class.php index 784f8e8ec08..bf8cc381db5 100644 --- a/htdocs/core/modules/modCommande.class.php +++ b/htdocs/core/modules/modCommande.class.php @@ -71,7 +71,7 @@ class modCommande extends DolibarrModules $this->depends = array("modSociete"); $this->requiredby = array("modExpedition"); $this->conflictwith = array(); - $this->langfiles = array("orders","bills","companies","products"); + $this->langfiles = array('orders', 'bills', 'companies','products', 'deliveries'); // Constantes $this->const = array(); @@ -173,7 +173,7 @@ class modCommande extends DolibarrModules $this->export_code[$r]=$this->rights_class.'_'.$r; $this->export_label[$r]='CustomersOrdersAndOrdersLines'; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_permission[$r]=array(array("commande","commande","export")); - $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','s.fk_pays'=>'Country','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','c.rowid'=>"Id",'c.ref'=>"Ref",'c.ref_client'=>"RefCustomer",'c.fk_soc'=>"IdCompany",'c.date_creation'=>"DateCreation",'c.date_commande'=>"DateOrder",'c.amount_ht'=>"Amount",'c.remise_percent'=>"GlobalDiscount",'c.total_ht'=>"TotalHT",'c.total_ttc'=>"TotalTTC",'c.facture'=>"OrderShortStatusInvoicee",'c.fk_statut'=>'Status','c.note'=>"Note",'c.date_livraison'=>'DeliveryDate','cd.rowid'=>'LineId','cd.label'=>"Linelabel",'cd.description'=>"LineDescription",'cd.product_type'=>'TypeOfLineServiceOrProduct','cd.tva_tx'=>"LineVATRate",'cd.qty'=>"LineQty",'cd.total_ht'=>"LineTotalHT",'cd.total_tva'=>"LineTotalVAT",'cd.total_ttc'=>"LineTotalTTC",'p.rowid'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel'); + $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','s.fk_pays'=>'Country','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','c.rowid'=>"Id",'c.ref'=>"Ref",'c.ref_client'=>"RefCustomer",'c.fk_soc'=>"IdCompany",'c.date_creation'=>"DateCreation",'c.date_commande'=>"OrderDate",'c.amount_ht'=>"Amount",'c.remise_percent'=>"GlobalDiscount",'c.total_ht'=>"TotalHT",'c.total_ttc'=>"TotalTTC",'c.facture'=>"Billed",'c.fk_statut'=>'Status','c.note'=>"Note",'c.date_livraison'=>'DeliveryDate','cd.rowid'=>'LineId','cd.label'=>"Label",'cd.description'=>"LineDescription",'cd.product_type'=>'TypeOfLineServiceOrProduct','cd.tva_tx'=>"LineVATRate",'cd.qty'=>"LineQty",'cd.total_ht'=>"LineTotalHT",'cd.total_tva'=>"LineTotalVAT",'cd.total_ttc'=>"LineTotalTTC",'p.rowid'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel'); $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','s.fk_pays'=>'company','s.tel'=>'company','s.siren'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.siret'=>'company','c.rowid'=>"order",'c.ref'=>"order",'c.ref_client'=>"order",'c.fk_soc'=>"order",'c.date_creation'=>"order",'c.date_commande'=>"order",'c.amount_ht'=>"order",'c.remise_percent'=>"order",'c.total_ht'=>"order",'c.total_ttc'=>"order",'c.facture'=>"order",'c.fk_statut'=>"order",'c.note'=>"order",'c.date_livraison'=>"order",'cd.rowid'=>'order_line','cd.label'=>"order_line",'cd.description'=>"order_line",'cd.product_type'=>'order_line','cd.tva_tx'=>"order_line",'cd.qty'=>"order_line",'cd.total_ht'=>"order_line",'cd.total_tva'=>"order_line",'cd.total_ttc'=>"order_line",'p.rowid'=>'product','p.ref'=>'product','p.label'=>'product'); $this->export_dependencies_array[$r]=array('order_line'=>'cd.rowid','product'=>'cd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php index 3dbf8fbcbad..656298bbc36 100644 --- a/htdocs/core/modules/modFacture.class.php +++ b/htdocs/core/modules/modFacture.class.php @@ -174,7 +174,7 @@ class modFacture extends DolibarrModules $this->export_label[$r]='CustomersInvoicesAndInvoiceLines'; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_icon[$r]='bill'; $this->export_permission[$r]=array(array("facture","facture","export")); - $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','c.code'=>'CountryCode','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>"DateDue",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note'=>"NotePrivate",'f.note_public'=>"NotePublic",'fd.rowid'=>'LineId','fd.label'=>"LineLabel",'fd.description'=>"LineDescription",'fd.price'=>"LineUnitPrice",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalVAT",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart",'fd.date_end'=>"DateEnd",'fd.product_type'=>"TypeOfLineServiceOrProduct",'fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel'); + $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','c.code'=>'CountryCode','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>"DateDue",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note'=>"NotePrivate",'f.note_public'=>"NotePublic",'fd.rowid'=>'LineId','fd.label'=>"Label",'fd.description'=>"LineDescription",'fd.price'=>"LineUnitPrice",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalVAT",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart",'fd.date_end'=>"DateEnd",'fd.product_type'=>"TypeOfLineServiceOrProduct",'fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel'); $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','c.code'=>'company','s.tel'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.date_lim_reglement'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note'=>"invoice",'f.note_public'=>"invoice",'fd.rowid'=>'invoice_line','fd.label'=>"invoice_line",'fd.description'=>"invoice_line",'fd.price'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line",'fd.product_type'=>'invoice_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product'); $this->export_dependencies_array[$r]=array('invoice_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them diff --git a/htdocs/core/modules/modFournisseur.class.php b/htdocs/core/modules/modFournisseur.class.php index 873445fd57b..116ff2c8283 100644 --- a/htdocs/core/modules/modFournisseur.class.php +++ b/htdocs/core/modules/modFournisseur.class.php @@ -68,7 +68,7 @@ class modFournisseur extends DolibarrModules // Dependances $this->depends = array("modSociete"); $this->requiredby = array(); - $this->langfiles = array("bills","companies","suppliers"); + $this->langfiles = array('bills', 'companies', 'suppliers', 'orders'); // Config pages $this->config_page_url = array("fournisseur.php"); diff --git a/htdocs/core/modules/modHoliday.class.php b/htdocs/core/modules/modHoliday.class.php index 0e8066f7a68..ee175a50588 100644 --- a/htdocs/core/modules/modHoliday.class.php +++ b/htdocs/core/modules/modHoliday.class.php @@ -61,7 +61,7 @@ class modHoliday extends DolibarrModules // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) $this->description = "Leave management"; // Possible values for version are: 'development', 'experimental', 'dolibarr' or version - $this->version = 'experimental'; + $this->version = 'dolibarr'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index c74985bca44..528096343ab 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -140,7 +140,7 @@ class modProduct extends DolibarrModules $this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref",'p.label'=>"Label",'p.description'=>"Description",'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",'p.length'=>"Length",'p.surface'=>"Surface",'p.volume'=>"Volume",'p.weight'=>"Weight",'p.customcode'=>'CustomCode','p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",'p.tva_tx'=>'VATRate','p.tosell'=>"OnSell",'p.tobuy'=>"OnBuy",'p.datec'=>'DateCreation','p.tms'=>'DateModification'); //if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge ($this->export_fields_array[$r],array('p.stock'=>'Stock','p.pmp'=>'PMPValue')); if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.pmp'=>'PMPValue')); - if (! empty($conf->barcode->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.barcode'=>'Barcode')); + if (! empty($conf->barcode->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.barcode'=>'BarCode')); $this->export_entities_array[$r]=array('p.rowid'=>"product",'p.ref'=>"product",'p.label'=>"product",'p.description'=>"product",'p.accountancy_code_sell'=>'product','p.accountancy_code_sell'=>'product','p.note'=>"product",'p.length'=>"product",'p.surface'=>"product",'p.volume'=>"product",'p.weight'=>"product",'p.customcode'=>'product','p.price_base_type'=>"product",'p.price'=>"product",'p.price_ttc'=>"product",'p.tva_tx'=>"product",'p.tosell'=>"product",'p.tobuy'=>"product",'p.datec'=>"product",'p.tms'=>"product"); //if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge ($this->export_entities_array[$r],array('p.stock'=>'product','p.pmp'=>'product')); if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.pmp'=>'product')); diff --git a/htdocs/core/modules/modPropale.class.php b/htdocs/core/modules/modPropale.class.php index 4fda2079c46..de004794807 100644 --- a/htdocs/core/modules/modPropale.class.php +++ b/htdocs/core/modules/modPropale.class.php @@ -169,7 +169,7 @@ class modPropale extends DolibarrModules $this->export_code[$r]=$this->rights_class.'_'.$r; $this->export_label[$r]='ProposalsAndProposalsLines'; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_permission[$r]=array(array("propale","export")); - $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','cp.code'=>'Country','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','c.rowid'=>"Id",'c.ref'=>"Ref",'c.ref_client'=>"RefCustomer",'c.fk_soc'=>"IdCompany",'c.datec'=>"DateCreation",'c.datep'=>"DatePropal",'c.fin_validite'=>"DateEndPropal",'c.remise_percent'=>"GlobalDiscount",'c.total_ht'=>"TotalHT",'c.total'=>"TotalTTC",'c.fk_statut'=>'Status','c.note'=>"Note",'c.date_livraison'=>'DeliveryDate','cd.rowid'=>'LineId','cd.label'=>"LineLabel",'cd.description'=>"LineDescription",'cd.product_type'=>'TypeOfLineServiceOrProduct','cd.tva_tx'=>"LineVATRate",'cd.qty'=>"LineQty",'cd.total_ht'=>"LineTotalHT",'cd.total_tva'=>"LineTotalVAT",'cd.total_ttc'=>"LineTotalTTC",'p.rowid'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel'); + $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','cp.code'=>'Country','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','c.rowid'=>"Id",'c.ref'=>"Ref",'c.ref_client'=>"RefCustomer",'c.fk_soc'=>"IdCompany",'c.datec'=>"DateCreation",'c.datep'=>"DatePropal",'c.fin_validite'=>"DateEndPropal",'c.remise_percent'=>"GlobalDiscount",'c.total_ht'=>"TotalHT",'c.total'=>"TotalTTC",'c.fk_statut'=>'Status','c.note'=>"Note",'c.date_livraison'=>'DeliveryDate','cd.rowid'=>'LineId','cd.label'=>"Label",'cd.description'=>"LineDescription",'cd.product_type'=>'TypeOfLineServiceOrProduct','cd.tva_tx'=>"LineVATRate",'cd.qty'=>"LineQty",'cd.total_ht'=>"LineTotalHT",'cd.total_tva'=>"LineTotalVAT",'cd.total_ttc'=>"LineTotalTTC",'p.rowid'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel'); $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','cp.code'=>'company','s.tel'=>'company','s.siren'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.siret'=>'company','c.rowid'=>"propal",'c.ref'=>"propal",'c.ref_client'=>"propal",'c.fk_soc'=>"propal",'c.datec'=>"propal",'c.datep'=>"propal",'c.fin_validite'=>"propal",'c.remise_percent'=>"propal",'c.total_ht'=>"propal",'c.total'=>"propal",'c.fk_statut'=>"propal",'c.note'=>"propal",'c.date_livraison'=>"propal",'cd.rowid'=>'propal_line','cd.label'=>"propal_line",'cd.description'=>"propal_line",'cd.product_type'=>'propal_line','cd.tva_tx'=>"propal_line",'cd.qty'=>"propal_line",'cd.total_ht'=>"propal_line",'cd.total_tva'=>"propal_line",'cd.total_ttc'=>"propal_line",'p.rowid'=>'product','p.ref'=>'product','p.label'=>'product'); $this->export_dependencies_array[$r]=array('propal_line'=>'cd.rowid','product'=>'cd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 603c7bb8798..3fb3633ee64 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -248,7 +248,7 @@ class modSociete extends DolibarrModules $this->export_label[$r]='ExportDataset_company_1'; $this->export_icon[$r]='company'; $this->export_permission[$r]=array(array("societe","export")); - $this->export_fields_array[$r]=array('s.rowid'=>"Id",'s.nom'=>"Name",'s.status'=>"Status",'s.client'=>"Customer",'s.fournisseur'=>"Supplier",'s.datec'=>"DateCreation",'s.tms'=>"DateLastModification",'s.code_client'=>"CustomerCode",'s.code_fournisseur'=>"SupplierCode",'s.address'=>"Address",'s.cp'=>"Zip",'s.ville'=>"Town",'p.libelle'=>"Country",'p.code'=>"CountryCode",'s.tel'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email",'s.default_lang'=>"DefaultLang",'s.siret'=>"IdProf1",'s.siren'=>"IdProf2",'s.ape'=>"IdProf3",'s.idprof4'=>"IdProf4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital",'s.note'=>"Note",'t.libelle'=>"ThirdPartyType",'ce.code'=>"Effectif","cfj.libelle"=>"JuridicalStatus",'s.fk_prospectlevel'=>'ProspectLevel','s.fk_stcomm'=>'ProspectStatus','d.nom'=>'State'); + $this->export_fields_array[$r]=array('s.rowid'=>"Id",'s.nom'=>"Name",'s.status'=>"Status",'s.client'=>"Customer",'s.fournisseur'=>"Supplier",'s.datec'=>"DateCreation",'s.tms'=>"DateLastModification",'s.code_client'=>"CustomerCode",'s.code_fournisseur'=>"SupplierCode",'s.address'=>"Address",'s.cp'=>"Zip",'s.ville'=>"Town",'p.libelle'=>"Country",'p.code'=>"CountryCode",'s.tel'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email",'s.default_lang'=>"DefaultLang",'s.siret'=>"ProfId1",'s.siren'=>"ProfId2",'s.ape'=>"ProfId3",'s.idprof4'=>"ProfId4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital",'s.note'=>"Note",'t.libelle'=>"ThirdPartyType",'ce.code'=>"Staff","cfj.libelle"=>"JuridicalStatus",'s.fk_prospectlevel'=>'ProspectLevel','s.fk_stcomm'=>'ProspectStatus','d.nom'=>'State'); if (! empty($conf->global->SOCIETE_USEPREFIX)) $this->export_fields_array[$r]['s.prefix']='Prefix'; $this->export_entities_array[$r]=array(); // We define here only fields that use another picto // Add extra fields @@ -320,7 +320,7 @@ class modSociete extends DolibarrModules $this->import_icon[$r]='company'; $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon $this->import_tables_array[$r]=array('s'=>MAIN_DB_PREFIX.'societe','extra'=>MAIN_DB_PREFIX.'societe_extrafields'); // List of tables to insert into (insert done in same order) - $this->import_fields_array[$r]=array('s.nom'=>"Name*",'s.status'=>"Status",'s.client'=>"Customer*",'s.fournisseur'=>"Supplier*",'s.code_client'=>"CustomerCode",'s.code_fournisseur'=>"SupplierCode",'s.code_compta'=>"CustomerAccountancyCode",'s.code_compta_fournisseur'=>"SupplierAccountancyCode",'s.address'=>"Address",'s.cp'=>"Zip",'s.ville'=>"Town",'s.fk_pays'=>"CountryCode",'s.tel'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email",'s.siret'=>"IdProf1",'s.siren'=>"IdProf2",'s.ape'=>"IdProf3",'s.idprof4'=>"IdProf4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital",'s.note'=>"Note",'s.fk_typent'=>"ThirdPartyType",'s.fk_effectif'=>"Effectif","s.fk_forme_juridique"=>"JuridicalStatus",'s.fk_prospectlevel'=>'ProspectLevel','s.fk_stcomm'=>'ProspectStatus','s.default_lang'=>'DefaultLanguage','s.barcode'=>'BarCode','s.datec'=>"DateCreation"); + $this->import_fields_array[$r]=array('s.nom'=>"Name*",'s.status'=>"Status",'s.client'=>"Customer*",'s.fournisseur'=>"Supplier*",'s.code_client'=>"CustomerCode",'s.code_fournisseur'=>"SupplierCode",'s.code_compta'=>"CustomerAccountancyCode",'s.code_compta_fournisseur'=>"SupplierAccountancyCode",'s.address'=>"Address",'s.cp'=>"Zip",'s.ville'=>"Town",'s.fk_pays'=>"CountryCode",'s.tel'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email",'s.siret'=>"ProfId1",'s.siren'=>"ProfId2",'s.ape'=>"ProfId3",'s.idprof4'=>"ProfId4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital",'s.note'=>"Note",'s.fk_typent'=>"ThirdPartyType",'s.fk_effectif'=>"Staff","s.fk_forme_juridique"=>"JuridicalStatus",'s.fk_prospectlevel'=>'ProspectLevel','s.fk_stcomm'=>'ProspectStatus','s.default_lang'=>'DefaultLanguage','s.barcode'=>'BarCode','s.datec'=>"DateCreation"); // Add extra fields $sql="SELECT name, label FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'company'"; $resql=$this->db->query($sql); diff --git a/htdocs/core/modules/modUser.class.php b/htdocs/core/modules/modUser.class.php index 63829e38963..8fcc8631e37 100644 --- a/htdocs/core/modules/modUser.class.php +++ b/htdocs/core/modules/modUser.class.php @@ -210,7 +210,7 @@ class modUser extends DolibarrModules $this->export_code[$r]=$this->rights_class.'_'.$r; $this->export_label[$r]='Liste des utilisateurs Dolibarr et attributs'; $this->export_permission[$r]=array(array("user","user","export")); - $this->export_fields_array[$r]=array('u.rowid'=>"Id",'u.login'=>"Login",'u.name'=>"Lastname",'u.firstname'=>"Firstname",'u.office_phone'=>'Tel','u.office_fax'=>'Fax','u.email'=>'EMail','u.datec'=>"DateCreation",'u.tms'=>"DateLastModification",'u.admin'=>"Admin",'u.statut'=>'Status','u.note'=>"Note",'u.datelastlogin'=>'LastConnexion','u.datepreviouslogin'=>'PreviousConnexion','u.fk_socpeople'=>"IdContact",'u.fk_societe'=>"IdCompany",'u.fk_member'=>"MemberId"); + $this->export_fields_array[$r]=array('u.rowid'=>"Id",'u.login'=>"Login",'u.name'=>"Lastname",'u.firstname'=>"Firstname",'u.office_phone'=>'Telephone','u.office_fax'=>'Fax','u.email'=>'EMail','u.datec'=>"DateCreation",'u.tms'=>"DateLastModification",'u.admin'=>"Admin",'u.statut'=>'Status','u.note'=>"Note",'u.datelastlogin'=>'LastConnexion','u.datepreviouslogin'=>'PreviousConnexion','u.fk_socpeople'=>"IdContact",'u.fk_societe'=>"IdCompany",'u.fk_member'=>"MemberId"); $this->export_entities_array[$r]=array('u.rowid'=>"user",'u.login'=>"user",'u.name'=>"user",'u.firstname'=>"user",'u.office_phone'=>'user','u.office_fax'=>'user','u.email'=>'user','u.datec'=>"user",'u.tms'=>"user",'u.admin'=>"user",'u.statut'=>'user','u.note'=>"user",'u.datelastlogin'=>'user','u.datepreviouslogin'=>'user','u.fk_socpeople'=>"contact",'u.fk_societe'=>"company",'u.fk_member'=>"member"); if (empty($conf->adherent->enabled)) { diff --git a/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php b/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php index 575d0172402..2b6ab211153 100644 --- a/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php +++ b/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php @@ -447,7 +447,7 @@ class pdf_standardlabel $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->transnoentities('MembersLabels')." ".$outputlangs->transnoentities("Foundation")." ".$outputlangs->convToOutputCharset($mysoc->name)); - if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false); + if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); $pdf->SetMargins(0,0); $pdf->SetAutoPageBreak(false); diff --git a/htdocs/core/modules/project/pdf/pdf_baleine.modules.php b/htdocs/core/modules/project/pdf/pdf_baleine.modules.php index 72d5c19b697..23352041b33 100644 --- a/htdocs/core/modules/project/pdf/pdf_baleine.modules.php +++ b/htdocs/core/modules/project/pdf/pdf_baleine.modules.php @@ -127,7 +127,7 @@ class pdf_baleine extends ModelePDFProjects if (file_exists($dir)) { $pdf=pdf_getInstance($this->format); - $heightforinfotot = 80; // Height reserved to output the info and total part (value include bottom margin) + $heightforinfotot = 50; // Height reserved to output the info and total part $heightforfooter = 25; // Height reserved to output the footer (value include bottom margin) $pdf->SetAutoPageBreak(1,0); @@ -154,7 +154,7 @@ class pdf_baleine extends ModelePDFProjects $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Project")); - if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false); + if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right @@ -265,13 +265,13 @@ class pdf_baleine extends ModelePDFProjects // Show square if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot, 0, $outputlangs, 0, 0); - $bottomlasttab=$this->page_hauteur - $heightforinfotot + 1; + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfooter, 0, $outputlangs, 0, 0); + $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1; } else { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot, 0, $outputlangs, 1, 0); - $bottomlasttab=$this->page_hauteur - $heightforinfotot + 1; + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfooter, 0, $outputlangs, 1, 0); + $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1; } /* diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index 86ff65a677a..5f15d9b86dc 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -314,7 +314,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales if (! empty($usecontact)) { // On peut utiliser le nom de la societe du contact - if ($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) $socobject = $object->contact; + if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact; else $socobject = $object->client; } else diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 436d0b2c72a..9f199310dc4 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -36,22 +36,22 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; */ class pdf_azur extends ModelePDFPropales { - var $db; - var $name; - var $description; - var $type; - - var $phpmin = array(4,3,0); // Minimum version of PHP required by module - var $version = 'dolibarr'; - - var $page_largeur; - var $page_hauteur; - var $format; - var $marge_gauche; - var $marge_droite; - var $marge_haute; - var $marge_basse; - + var $db; + var $name; + var $description; + var $type; + + var $phpmin = array(4,3,0); // Minimum version of PHP required by module + var $version = 'dolibarr'; + + var $page_largeur; + var $page_hauteur; + var $format; + var $marge_gauche; + var $marge_droite; + var $marge_haute; + var $marge_basse; + var $emetteur; // Objet societe qui emet @@ -117,14 +117,14 @@ class pdf_azur extends ModelePDFPropales /** * Function to build pdf onto disk * - * @param int $object Id of object to generate - * @param object $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @param object $hookmanager Hookmanager object - * @return int 1=OK, 0=KO + * @param Object $object Object to generate + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int $hidedetails Do not show line details + * @param int $hidedesc Do not show desc + * @param int $hideref Do not show ref + * @param object $hookmanager Hookmanager object + * @return int 1=OK, 0=KO */ function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0,$hookmanager=false) { @@ -142,12 +142,12 @@ class pdf_azur extends ModelePDFPropales $outputlangs->load("products"); $default_font_size = pdf_getPDFFontSize($outputlangs); - + if ($conf->propal->dir_output) { $object->fetch_thirdparty(); - $deja_regle = ""; + // $deja_regle = 0; // Definition of $dir and $file if ($object->specimen) @@ -177,7 +177,7 @@ class pdf_azur extends ModelePDFPropales // Create pdf instance $pdf=pdf_getInstance($this->format); - $heightforinfotot = 80; // Height reserved to output the info and total part (value include bottom margin) + $heightforinfotot = 50; // Height reserved to output the info and total part $heightforfooter = 25; // Height reserved to output the footer (value include bottom margin) $pdf->SetAutoPageBreak(1,0); @@ -203,7 +203,7 @@ class pdf_azur extends ModelePDFPropales $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("CommercialProposal")); - if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false); + if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right @@ -226,8 +226,8 @@ class pdf_azur extends ModelePDFPropales $pdf->SetTextColor(0,0,0); $tab_top = 90; - $tab_top_middlepage = 10; - $tab_top_newpage = 10; + $tab_top_middlepage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10); + $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10); $tab_height = 130; $tab_height_middlepage = 200; $tab_height_newpage = 150; @@ -262,25 +262,28 @@ class pdf_azur extends ModelePDFPropales for ($i = 0 ; $i < $nblignes ; $i++) { $curY = $nexY; + $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage + $pdf->SetTextColor(0,0,0); + $pdf->setTopMargin($tab_top_newpage); $pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); // Description of product line - $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage $curX = $this->posxdesc-1; pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY,$hideref,$hidedesc,0,$hookmanager); $nexY = $pdf->GetY(); $pageposafter=$pdf->getPage(); $pdf->setPage($pageposbefore); + $pdf->setTopMargin($this->marge_haute); $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. -// We suppose that a too long description is moved completely on next page -if ($pageposafter > $pageposbefore) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; -} - + // We suppose that a too long description is moved completely on next page + if ($pageposafter > $pageposbefore) { + $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + } + $pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut // VAT Rate @@ -353,6 +356,7 @@ if ($pageposafter > $pageposbefore) { $pagenb++; $pdf->setPage($pagenb); $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs, $hookmanager); } if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak) { @@ -369,32 +373,36 @@ if ($pageposafter > $pageposbefore) { $pdf->AddPage(); if (! empty($tplidx)) $pdf->useTemplate($tplidx); $pagenb++; + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs, $hookmanager); } } // Show square if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot, 0, $outputlangs, 0, 0); - $bottomlasttab=$this->page_hauteur - $heightforinfotot + 1; + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfooter, 0, $outputlangs, 0, 0); + $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1; } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot, 0, $outputlangs, 1, 0); - $bottomlasttab=$this->page_hauteur - $heightforinfotot + 1; + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfooter, 0, $outputlangs, 1, 0); + $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1; } // Affiche zone infos $posy=$this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs); // Affiche zone totaux - $posy=$this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs); + //$posy=$this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs); + $posy=$this->_tableau_tot($pdf, $object, 0, $bottomlasttab, $outputlangs); // Affiche zone versements + /* if ($deja_regle) { $posy=$this->_tableau_versements($pdf, $object, $posy, $outputlangs); } + */ // Pied de page $this->_pagefoot($pdf,$object,$outputlangs); @@ -563,7 +571,7 @@ if ($pageposafter > $pageposbefore) { if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ') { // Si mode reglement non force ou si force a CHQ - if ($conf->global->FACTURE_CHQ_NUMBER) + if (! empty($conf->global->FACTURE_CHQ_NUMBER)) { if ($conf->global->FACTURE_CHQ_NUMBER > 0) { @@ -640,7 +648,7 @@ if ($pageposafter > $pageposbefore) { $col1x = 120; $col2x = 170; $largcol2 = ($this->page_largeur - $this->marge_droite - $col2x); $index = 0; - + // Total HT $pdf->SetFillColor(255,255,255); $pdf->SetXY($col1x, $tab2_top + 0); @@ -722,7 +730,7 @@ if ($pageposafter > $pageposbefore) { //Local tax 1 foreach($this->localtax1 as $tvakey => $tvaval) { - if ($tvakey>0) // On affiche pas taux 0 + if ($tvakey!=0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; @@ -750,7 +758,7 @@ if ($pageposafter > $pageposbefore) { //Local tax 2 foreach($this->localtax2 as $tvakey => $tvaval) { - if ($tvakey>0) // On affiche pas taux 0 + if ($tvakey!=0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; @@ -790,9 +798,11 @@ if ($pageposafter > $pageposbefore) { } $pdf->SetTextColor(0,0,0); - + + /* $resteapayer = $object->total_ttc - $deja_regle; - if ($object->paye) $resteapayer=0; + if (! empty($object->paye)) $resteapayer=0; + */ if ($deja_regle > 0) { @@ -804,6 +814,7 @@ if ($pageposafter > $pageposbefore) { $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($deja_regle), 0, 'R', 0); + /* if ($object->close_code == 'discount_vat') { $index++; @@ -817,6 +828,7 @@ if ($pageposafter > $pageposbefore) { $resteapayer=0; } + */ $index++; $pdf->SetTextColor(0,0,60); @@ -863,10 +875,10 @@ if ($pageposafter > $pageposbefore) { $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4); $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); } - + $pdf->SetDrawColor(128,128,128); $pdf->SetFont('','',$default_font_size - 1); - + // Output Rect $this->printRect($pdf,$this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param @@ -877,7 +889,7 @@ if ($pageposafter > $pageposbefore) { $pdf->SetXY($this->posxdesc-1, $tab_top+1); $pdf->MultiCell(108,2, $outputlangs->transnoentities("Designation"),'','L'); } - + if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) { $pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height); @@ -894,14 +906,14 @@ if ($pageposafter > $pageposbefore) { $pdf->SetXY($this->posxup-1, $tab_top+1); $pdf->MultiCell($this->posxqty-$this->posxup-1,2, $outputlangs->transnoentities("PriceUHT"),'','C'); } - + $pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height); if (empty($hidetop)) { $pdf->SetXY($this->posxqty-1, $tab_top+1); $pdf->MultiCell($this->posxdiscount-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C'); } - + $pdf->line($this->posxdiscount-1, $tab_top, $this->posxdiscount-1, $tab_top + $tab_height); if (empty($hidetop)) { @@ -942,7 +954,7 @@ if ($pageposafter > $pageposbefore) { $outputlangs->load("companies"); $default_font_size = pdf_getPDFFontSize($outputlangs); - + pdf_pagehead($pdf,$outputlangs,$this->page_hauteur); // Show Draft Watermark @@ -1057,8 +1069,8 @@ if ($pageposafter > $pageposbefore) { $pdf->SetXY($posx,$posy); $pdf->SetFillColor(230,230,230); $pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1); - $pdf->SetTextColor(0,0,60); - + $pdf->SetTextColor(0,0,60); + // Show sender name $pdf->SetXY($posx+2,$posy+3); $pdf->SetFont('','B', $default_font_size); diff --git a/htdocs/core/modules/rapport/pdf_paiement.class.php b/htdocs/core/modules/rapport/pdf_paiement.class.php index b238ee3cfe6..d18c14b6b6d 100644 --- a/htdocs/core/modules/rapport/pdf_paiement.class.php +++ b/htdocs/core/modules/rapport/pdf_paiement.class.php @@ -180,7 +180,7 @@ class pdf_paiement $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); //$pdf->SetKeyWords(); - if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false); + if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right $pdf->SetAutoPageBreak(1,0); diff --git a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php index 7eeddd1f856..058cd1ffab8 100644 --- a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php +++ b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php @@ -109,7 +109,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0); else { - $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.odt'); + $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.odt','','name',SORT_ASC,0,true); // Disable hook for the moment if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles); } } diff --git a/htdocs/core/modules/societe/modules_societe.class.php b/htdocs/core/modules/societe/modules_societe.class.php index fc96075f430..63b470a28a1 100644 --- a/htdocs/core/modules/societe/modules_societe.class.php +++ b/htdocs/core/modules/societe/modules_societe.class.php @@ -381,7 +381,7 @@ function thirdparty_doc_create($db, $object, $message, $modele, $outputlangs) // Positionne modele sur le nom du modele a utiliser if (! dol_strlen($modele)) { - if ($conf->global->COMPANY_ADDON_PDF) + if (! empty($conf->global->COMPANY_ADDON_PDF)) { $modele = $conf->global->COMPANY_ADDON_PDF; } diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php index 756d94726e5..e6948d6ef7c 100755 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -176,7 +176,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $nblignes = count($object->lines); $pdf=pdf_getInstance($this->format); - $heightforinfotot = 80; // Height reserved to output the info and total part (value include bottom margin) + $heightforinfotot = 50; // Height reserved to output the info and total part $heightforfooter = 25; // Height reserved to output the footer (value include bottom margin) $pdf->SetAutoPageBreak(1,0); @@ -202,7 +202,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Order")); - if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false); + if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right @@ -225,7 +225,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pdf->SetTextColor(0,0,0); $tab_top = 90; - $tab_top_newpage = 10; + $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10); $tab_height = 130; $tab_height_newpage = 150; @@ -259,25 +259,28 @@ class pdf_canelle extends ModelePDFSuppliersInvoices for ($i = 0 ; $i < $nblignes ; $i++) { $curY = $nexY; + $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage + $pdf->SetTextColor(0,0,0); + $pdf->setTopMargin($tab_top_newpage); $pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); // Description of product line - $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage $curX = $this->posxdesc-1; pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,$hideref,$hidedesc,1,$hookmanager); $nexY = $pdf->GetY(); $pageposafter=$pdf->getPage(); $pdf->setPage($pageposbefore); + $pdf->setTopMargin($this->marge_haute); $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. -// We suppose that a too long description is moved completely on next page -if ($pageposafter > $pageposbefore) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; -} - +// We suppose that a too long description is moved completely on next page +if ($pageposafter > $pageposbefore) { + $pdf->setPage($pageposafter); $curY = $tab_top_newpage; +} + $pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut // VAT Rate @@ -365,13 +368,13 @@ if ($pageposafter > $pageposbefore) { // Show square if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot, 0, $outputlangs, 0, 0); - $bottomlasttab=$this->page_hauteur - $heightforinfotot + 1; + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfooter, 0, $outputlangs, 0, 0); + $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1; } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot, 0, $outputlangs, 1, 0); - $bottomlasttab=$this->page_hauteur - $heightforinfotot + 1; + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfooter, 0, $outputlangs, 1, 0); + $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1; } // Affiche zone totaux @@ -437,7 +440,7 @@ if ($pageposafter > $pageposbefore) { function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs) { global $conf,$mysoc; - + $default_font_size = pdf_getPDFFontSize($outputlangs); $tab2_top = $posy; @@ -455,7 +458,7 @@ if ($pageposafter > $pageposbefore) { $col1x = 120; $col2x = 170; $largcol2 = ($this->page_largeur - $this->marge_droite - $col2x); $index=0; - + // Total HT $pdf->SetFillColor(255,255,255); $pdf->SetXY($col1x, $tab2_top + 0); @@ -642,10 +645,10 @@ if ($pageposafter > $pageposbefore) { $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4); $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); } - + $pdf->SetDrawColor(128,128,128); $pdf->SetFont('','', $default_font_size - 1); - + // Output Rect $this->printRect($pdf,$this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param @@ -656,7 +659,7 @@ if ($pageposafter > $pageposbefore) { $pdf->SetXY($this->posxdesc-1, $tab_top+1); $pdf->MultiCell(108,2, $outputlangs->transnoentities("Designation"),'','L'); } - + if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) { $pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height); @@ -673,14 +676,14 @@ if ($pageposafter > $pageposbefore) { $pdf->SetXY($this->posxup-1, $tab_top+1); $pdf->MultiCell($this->posxqty-$this->posxup-1,2, $outputlangs->transnoentities("PriceUHT"),'','C'); } - + $pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height); if (empty($hidetop)) { $pdf->SetXY($this->posxqty-1, $tab_top+1); $pdf->MultiCell($this->posxdiscount-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C'); } - + $pdf->line($this->posxdiscount-1, $tab_top, $this->posxdiscount-1, $tab_top + $tab_height); if (empty($hidetop)) { @@ -690,7 +693,7 @@ if ($pageposafter > $pageposbefore) { $pdf->MultiCell($this->postotalht-$this->posxdiscount+1,2, $outputlangs->transnoentities("ReductionShort"),'','C'); } } - + if ($this->atleastonediscount) { $pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height); @@ -853,7 +856,7 @@ if ($pageposafter > $pageposbefore) { $posy+=1; $pdf->SetFont('','', $default_font_size - 1); - + $posy+=5; $pdf->SetXY($posx,$posy); if ($object->date) @@ -913,7 +916,7 @@ if ($pageposafter > $pageposbefore) { if (! empty($usecontact)) { // On peut utiliser le nom de la societe du contact - if ($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) $socname = $object->contact->socname; + if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname; else $socname = $mysoc->nom; $carac_client_name=$outputlangs->convToOutputCharset($socname); } diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index 9e8e5bdd064..d638c940988 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -188,7 +188,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $nblignes = count($object->lines); $pdf=pdf_getInstance($this->format); - $heightforinfotot = 80; // Height reserved to output the info and total part (value include bottom margin) + $heightforinfotot = 50; // Height reserved to output the info and total part $heightforfooter = 25; // Height reserved to output the footer (value include bottom margin) $pdf->SetAutoPageBreak(1,0); @@ -214,7 +214,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Order")); - if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false); + if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right @@ -237,7 +237,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->SetTextColor(0,0,0); $tab_top = 90; - $tab_top_newpage = 10; + $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10); $tab_height = 130; $tab_height_newpage = 150; @@ -271,25 +271,28 @@ class pdf_muscadet extends ModelePDFSuppliersOrders for ($i = 0 ; $i < $nblignes ; $i++) { $curY = $nexY; + $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage + $pdf->SetTextColor(0,0,0); + $pdf->setTopMargin($tab_top_newpage); $pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); // Description of product line - $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage $curX = $this->posxdesc-1; pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,0,0,1,$hookmanager); $nexY = $pdf->GetY(); $pageposafter=$pdf->getPage(); $pdf->setPage($pageposbefore); + $pdf->setTopMargin($this->marge_haute); $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. // We suppose that a too long description is moved completely on next page if ($pageposafter > $pageposbefore) { $pdf->setPage($pageposafter); $curY = $tab_top_newpage; } - + $pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut // VAT Rate @@ -326,15 +329,18 @@ if ($pageposafter > $pageposbefore) { $localtax1ligne=$object->lines[$i]->total_localtax1; $localtax2ligne=$object->lines[$i]->total_localtax2; - if ($object->remise_percent) $tvaligne-=($tvaligne*$object->remise_percent)/100; - if ($object->remise_percent) $localtax1ligne-=($localtax1ligne*$object->remise_percent)/100; - if ($object->remise_percent) $localtax2ligne-=($localtax2ligne*$object->remise_percent)/100; + if (! empty($object->remise_percent)) $tvaligne-=($tvaligne*$object->remise_percent)/100; + if (! empty($object->remise_percent)) $localtax1ligne-=($localtax1ligne*$object->remise_percent)/100; + if (! empty($object->remise_percent)) $localtax2ligne-=($localtax2ligne*$object->remise_percent)/100; $vatrate=(string) $object->lines[$i]->tva_tx; $localtax1rate=(string) $object->lines[$i]->localtax1_tx; $localtax2rate=(string) $object->lines[$i]->localtax2_tx; if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*'; + if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]=''; + if (! isset($this->localtax1[$localtax1rate])) $this->localtax1[$localtax1rate]=''; + if (! isset($this->localtax2[$localtax2rate])) $this->localtax2[$localtax2rate]=''; $this->tva[$vatrate] += $tvaligne; $this->localtax1[$localtax1rate]+=$localtax1ligne; $this->localtax2[$localtax2rate]+=$localtax2ligne; @@ -379,13 +385,13 @@ if ($pageposafter > $pageposbefore) { // Show square if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot, 0, $outputlangs, 0, 0); - $bottomlasttab=$this->page_hauteur - $heightforinfotot + 1; + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfooter, 0, $outputlangs, 0, 0); + $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1; } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot, 0, $outputlangs, 1, 0); - $bottomlasttab=$this->page_hauteur - $heightforinfotot + 1; + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfooter, 0, $outputlangs, 1, 0); + $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1; } // Affiche zone infos @@ -540,7 +546,7 @@ if ($pageposafter > $pageposbefore) { if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ') { // Si mode reglement non force ou si force a CHQ - if ($conf->global->FACTURE_CHQ_NUMBER) + if (! empty($conf->global->FACTURE_CHQ_NUMBER)) { if ($conf->global->FACTURE_CHQ_NUMBER > 0) { @@ -624,7 +630,7 @@ if ($pageposafter > $pageposbefore) { $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + 0); - $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ht + $object->remise), 0, 'R', 1); + $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ht + (! empty($object->remise)?$object->remise:0)), 0, 'R', 1); // Show VAT by rates and total $pdf->SetFillColor(248,248,248); @@ -761,7 +767,7 @@ if ($pageposafter > $pageposbefore) { //$depositsamount=$object->getSumDepositsUsed(); //print "x".$creditnoteamount."-".$depositsamount;exit; $resteapayer = price2num($object->total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT'); - if ($object->paye) $resteapayer=0; + if (! empty($object->paye)) $resteapayer=0; if ($deja_regle > 0) { @@ -811,17 +817,17 @@ if ($pageposafter > $pageposbefore) { // Amount in (at tab_top - 1) $pdf->SetTextColor(0,0,0); $pdf->SetFont('','', $default_font_size - 2); - + if (empty($hidetop)) { $titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$conf->currency)); $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4); $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); } - + $pdf->SetDrawColor(128,128,128); $pdf->SetFont('','', $default_font_size - 1); - + // Output Rect $this->printRect($pdf,$this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param @@ -832,7 +838,7 @@ if ($pageposafter > $pageposbefore) { $pdf->SetXY($this->posxdesc-1, $tab_top+1); $pdf->MultiCell(108,2, $outputlangs->transnoentities("Designation"),'','L'); } - + if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) { $pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height); @@ -849,14 +855,14 @@ if ($pageposafter > $pageposbefore) { $pdf->SetXY($this->posxup-1, $tab_top+1); $pdf->MultiCell($this->posxqty-$this->posxup-1,2, $outputlangs->transnoentities("PriceUHT"),'','C'); } - + $pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height); if (empty($hidetop)) { $pdf->SetXY($this->posxqty-1, $tab_top+1); $pdf->MultiCell($this->posxdiscount-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C'); } - + $pdf->line($this->posxdiscount-1, $tab_top, $this->posxdiscount-1, $tab_top + $tab_height); if (empty($hidetop)) { @@ -864,9 +870,9 @@ if ($pageposafter > $pageposbefore) { { $pdf->SetXY($this->posxdiscount-1, $tab_top+1); $pdf->MultiCell($this->postotalht-$this->posxdiscount+1,2, $outputlangs->transnoentities("ReductionShort"),'','C'); - } + } } - + if ($this->atleastonediscount) { $pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height); @@ -1016,7 +1022,7 @@ if ($pageposafter > $pageposbefore) { if (! empty($usecontact)) { // On peut utiliser le nom de la societe du contact - if ($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) $socname = $object->contact->socname; + if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname; else $socname = $object->client->name; $carac_client_name=$outputlangs->convToOutputCharset($socname); } diff --git a/htdocs/core/tpl/admin_extrafields.tpl.php b/htdocs/core/tpl/admin_extrafields.tpl.php new file mode 100644 index 00000000000..73750892cc2 --- /dev/null +++ b/htdocs/core/tpl/admin_extrafields.tpl.php @@ -0,0 +1,40 @@ + + * Copyright (C) 2012 Regis Houssin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +?> + + + + diff --git a/htdocs/core/tpl/admin_extrafields_add.tpl.php b/htdocs/core/tpl/admin_extrafields_add.tpl.php new file mode 100644 index 00000000000..a4ebedcc54c --- /dev/null +++ b/htdocs/core/tpl/admin_extrafields_add.tpl.php @@ -0,0 +1,66 @@ + + * Copyright (C) 2012 Regis Houssin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +?> + + + + +" method="post"> + + + +
'; @@ -97,7 +97,7 @@ function print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirt print '
'; diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index c4e5509cf3d..cace19d0c88 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -193,10 +193,15 @@ function societe_admin_prepare_head($object) complete_head_from_modules($conf,$langs,$object,$head,$h,'company_admin'); $head[$h][0] = DOL_URL_ROOT.'/societe/admin/societe_extrafields.php'; - $head[$h][1] = $langs->trans("ExtraFields"); + $head[$h][1] = $langs->trans("ExtraFieldsThirdParties"); $head[$h][2] = 'attributes'; $h++; + $head[$h][0] = DOL_URL_ROOT.'/societe/admin/contact_extrafields.php'; + $head[$h][1] = $langs->trans("ExtraFieldsContacts"); + $head[$h][2] = 'attributes_contacts'; + $h++; + complete_head_from_modules($conf,$langs,$object,$head,$h,'company_admin','remove'); return $head; @@ -400,12 +405,12 @@ function show_projects($conf,$langs,$db,$object,$backtopage='') $i = -1 ; - if ($conf->projet->enabled && $user->rights->projet->lire) + if (! empty($conf->projet->enabled) && $user->rights->projet->lire) { $langs->load("projects"); $buttoncreate=''; - if ($conf->projet->enabled && $user->rights->projet->creer) + if (! empty($conf->projet->enabled) && $user->rights->projet->creer) { //$buttoncreate=''.$langs->trans("AddProject").''; $buttoncreate=''.$langs->trans("AddProject").' '.img_picto($langs->trans("AddProject"),'filenew').''."\n"; @@ -502,7 +507,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') $contactstatic = new Contact($db); - if ($conf->clicktodial->enabled) + if (! empty($conf->clicktodial->enabled)) { $user->fetch_clicktodial(); // lecture des infos de clicktodial } @@ -573,7 +578,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') print dol_print_email($obj->email,$obj->rowid,$object->id,'AC_EMAIL'); print ''; print img_object($langs->trans("Rendez-Vous"),"action"); @@ -721,7 +726,7 @@ function show_actions_todo($conf,$langs,$db,$object,$objcon='',$noprint=0) $now=dol_now(); $out=''; - if ($conf->agenda->enabled) + if (! empty($conf->agenda->enabled)) { require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; $actionstatic=new ActionComm($db); @@ -883,7 +888,7 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0) $numaction = 0 ; $now=dol_now(); - if ($conf->agenda->enabled) + if (! empty($conf->agenda->enabled)) { // Recherche histo sur actioncomm $sql = "SELECT a.id, a.label,"; @@ -993,7 +998,7 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0) } - if ($conf->agenda->enabled || ($conf->mailing->enabled && ! empty($objcon->email))) + if (! empty($conf->agenda->enabled) || (! empty($conf->mailing->enabled) && ! empty($objcon->email))) { require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index b021db48448..b0d2c997d05 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -601,7 +601,7 @@ function dol_get_first_day_week($day,$month,$year,$gm=false) } /** - * Fonction retournant le nombre de jour fieries samedis et dimanches entre 2 dates entrees en timestamp + * Fonction retournant le nombre de jour feries samedis et dimanches entre 2 dates entrees en timestamp * Called by function num_open_day * * @param timestamp $timestampStart Timestamp de debut @@ -733,11 +733,12 @@ function num_public_holiday($timestampStart, $timestampEnd, $countrycode='FR') /** * Fonction retournant le nombre de jour entre deux dates + * Example: 2012-01-01 2012-01-02 => 1 if lastday=0, 2 if lastday=1 * * @param timestamp $timestampStart Timestamp de debut * @param timestamp $timestampEnd Timestamp de fin - * @param int $lastday On prend en compte le dernier jour, 0: non, 1:oui - * @return int Nombre de jours + * @param int $lastday Last day is included, 0: non, 1:oui + * @return int Number of days */ function num_between_day($timestampStart, $timestampEnd, $lastday=0) { @@ -751,8 +752,9 @@ function num_between_day($timestampStart, $timestampEnd, $lastday=0) { $bit = 1; } - $nbjours = round(($timestampEnd - $timestampStart)/(60*60*24)-$bit); + $nbjours = (int) floor(($timestampEnd - $timestampStart)/(60*60*24)) + 1 - $bit; } + //print ($timestampEnd - $timestampStart) - $lastday; return $nbjours; } @@ -762,22 +764,29 @@ function num_between_day($timestampStart, $timestampEnd, $lastday=0) * @param timestamp $timestampStart Timestamp de debut * @param timestamp $timestampEnd Timestamp de fin * @param int $inhour 0: sort le nombre de jour , 1: sort le nombre d'heure (72 max) - * @param int $lastday On prend en compte le dernier jour, 0: non, 1:oui + * @param int $lastday We include last day, 0: non, 1:oui * @return int Nombre de jours ou d'heures */ function num_open_day($timestampStart, $timestampEnd,$inhour=0,$lastday=0) { global $langs; + dol_syslog('num_open_day timestampStart='.$timestampStart.' timestampEnd='.$timestampEnd.' bit='.$lastday); + //print 'num_open_day timestampStart='.$timestampStart.' timestampEnd='.$timestampEnd.' bit='.$lastday; if ($timestampStart < $timestampEnd) { - $bit = 0; - if ($lastday == 1) $bit = 1; - $nbOpenDay = num_between_day($timestampStart, $timestampEnd, $bit) - num_public_holiday($timestampStart, $timestampEnd); + //print num_between_day($timestampStart, $timestampEnd, $lastday).' - '.num_public_holiday($timestampStart, $timestampEnd); + $nbOpenDay = num_between_day($timestampStart, $timestampEnd, $lastday) - num_public_holiday($timestampStart, $timestampEnd, $lastday); $nbOpenDay.= " ".$langs->trans("Days"); if ($inhour == 1 && $nbOpenDay <= 3) $nbOpenDay = $nbOpenDay*24 . $langs->trans("HourShort"); return $nbOpenDay; } + elseif ($timestampStart == $timestampEnd) + { + $nbOpenDay=$lastday; + if ($inhour == 1) $nbOpenDay = $nbOpenDay*24 . $langs->trans("HourShort"); + return $nbOpenDay=1; + } else { return $langs->trans("Error"); diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index af964d92ff1..90a2f8970c8 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -47,24 +47,16 @@ function dol_basename($pathfile) * @param string $sortcriteria Sort criteria ("","fullname","name","date","size") * @param string $sortorder Sort order (SORT_ASC, SORT_DESC) * @param int $mode 0=Return array minimum keys loaded (faster), 1=Force all keys like date and size to be loaded (slower), 2=Force load of date only, 3=Force load of size only + * @param int $nohook Disable all hooks * @return array Array of array('name'=>'xxx','fullname'=>'/abc/xxx','date'=>'yyy','size'=>99,'type'=>'dir|file') */ -function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter="", $sortcriteria="name", $sortorder=SORT_ASC, $mode=0) +function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter="", $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=false) { global $db, $hookmanager; + global $object; dol_syslog("files.lib.php::dol_dir_list path=".$path." types=".$types." recursive=".$recursive." filter=".$filter." excludefilter=".json_encode($excludefilter)); - if (! is_object($hookmanager)) - { - if (! class_exists('HookManager')) { - // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array - require DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; - $hookmanager=new HookManager($db); - } - } - $hookmanager->initHooks(array('fileslib')); - $loaddate=($mode==1||$mode==2)?true:false; $loadsize=($mode==1||$mode==3)?true:false; @@ -72,23 +64,35 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil $path=preg_replace('/([\\/]+)$/i','',$path); $newpath=dol_osencode($path); - $parameters=array( - 'path' => $newpath, - 'types'=> $types, - 'recursive' => $recursive, - 'filter' => $filter, - 'excludefilter' => $excludefilter, - 'sortcriteria' => $sortcriteria, - 'sortorder' => $sortorder, - 'loaddate' => $loaddate, - 'loadsize' => $loadsize - ); - $reshook=$hookmanager->executeHooks('getNodesList', $parameters); + if (! $nohook) { + if (! is_object($hookmanager)) + { + if (! class_exists('HookManager')) { + // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array + require DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + $hookmanager=new HookManager($db); + } + } + $hookmanager->initHooks(array('fileslib')); + + $parameters=array( + 'path' => $newpath, + 'types'=> $types, + 'recursive' => $recursive, + 'filter' => $filter, + 'excludefilter' => $excludefilter, + 'sortcriteria' => $sortcriteria, + 'sortorder' => $sortorder, + 'loaddate' => $loaddate, + 'loadsize' => $loadsize + ); + $reshook=$hookmanager->executeHooks('getNodesList', $parameters, $object); + } // $reshook may contain returns stacked by other modules // $reshook is always empty with an array for can not lose returns stacked with other modules // $hookmanager->resArray may contain array stacked by other modules - if (! empty($hookmanager->resArray)) // forced to use $hookmanager->resArray even if $hookmanager->resArray['nodes'] is empty + if (! $nohook && ! empty($hookmanager->resArray)) // forced to use $hookmanager->resArray even if $hookmanager->resArray['nodes'] is empty { return $hookmanager->resArray['nodes']; } @@ -511,13 +515,13 @@ function dol_copy($srcfile, $destfile, $newmask=0, $overwriteifexists=1) /** * Move a file into another name. + * This function differs from dol_move_uploaded_file, because it can be called in any context. * * @param string $srcfile Source file (can't be a directory) * @param string $destfile Destination file (can't be a directory) * @param string $newmask Mask for new file (0 by default means $conf->global->MAIN_UMASK) * @param int $overwriteifexists Overwrite file if exists (1 by default) * @return boolean True if OK, false if KO - * @see dol_move_uploaded_file */ function dol_move($srcfile, $destfile, $newmask=0, $overwriteifexists=1) { @@ -564,196 +568,136 @@ function dol_unescapefile($filename) * @param int $allowoverwrite 1=Overwrite target file if it already exists * @param int $disablevirusscan 1=Disable virus scan * @param string $uploaderrorcode Value of PHP upload error code ($_FILES['field']['error']) - * @param int $notrigger Disable all triggers + * @param int $nohook Disable all hooks * @param string $varfiles _FILES var name * @return int >0 if OK, <0 or string if KO - * @see dolCheckUploadedFile, dol_move + * @see dol_move */ -function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan=0, $uploaderrorcode=0, $notrigger=0, $varfiles='addedfile') +function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan=0, $uploaderrorcode=0, $nohook=0, $varfiles='addedfile') { - global $db, $hookmanager; - global $object; + global $conf, $db, $user, $langs; + global $object, $hookmanager; $error=0; - - // Check uploaded file - $dest_file=dolCheckUploadedFile($src_file, $dest_file, $disablevirusscan, $uploaderrorcode); - if (is_array($dest_file) && isset($dest_file['error'])) return $dest_file['error']; - - if (! is_object($hookmanager)) - { - if (! class_exists('HookManager')) { - // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array - require DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; - $hookmanager=new HookManager($db); - } - } - $hookmanager->initHooks(array('fileslib')); - - $parameters=array('dest_file' => $dest_file, 'varfiles' => $varfiles, 'allowoverwrite' => $allowoverwrite, 'notrigger' => $notrigger); - $reshook=$hookmanager->executeHooks('dolMoveUploadedFile', $parameters, $object); - - if (empty($reshook)) { - return dolMoveUploadedFile($src_file, $dest_file, $allowoverwrite, $notrigger); - } -} - -/** - * Check an uploaded file. - * If there is errors (virus found, antivir in error, bad filename), file is not moved. - * - * @param string $src_file Source full path filename ($_FILES['field']['tmp_name']) - * @param string $dest_file Target full path filename ($_FILES['field']['name']) - * @param int $disablevirusscan 1=Disable virus scan - * @param string $uploaderrorcode Value of PHP upload error code ($_FILES['field']['error']) - * @return int >0 if OK, <0 or string if KO - * @see dol_move_uploaded_file - */ -function dolCheckUploadedFile($src_file, $dest_file, $disablevirusscan=0, $uploaderrorcode=0) -{ - global $conf; - $file_name = $dest_file; - // If an upload error has been reported - if ($uploaderrorcode) + + if (empty($nohook)) { - switch($uploaderrorcode) + // If an upload error has been reported + if ($uploaderrorcode) { - case UPLOAD_ERR_INI_SIZE: // 1 - return array('error' => 'ErrorFileSizeTooLarge'); - break; - case UPLOAD_ERR_FORM_SIZE: // 2 - return array('error' => 'ErrorFileSizeTooLarge'); - break; - case UPLOAD_ERR_PARTIAL: // 3 - return array('error' => 'ErrorPartialFile'); - break; - case UPLOAD_ERR_NO_TMP_DIR: // - return array('error' => 'ErrorNoTmpDir'); - break; - case UPLOAD_ERR_CANT_WRITE: - return array('error' => 'ErrorFailedToWriteInDir'); - break; - case UPLOAD_ERR_EXTENSION: - return array('error' => 'ErrorUploadBlockedByAddon'); - break; - default: - break; - } - } - - // If we need to make a virus scan - if (empty($disablevirusscan) && file_exists($src_file) && ! empty($conf->global->MAIN_ANTIVIRUS_COMMAND)) - { - if (! class_exists('AntiVir')) { - require DOL_DOCUMENT_ROOT.'/core/class/antivir.class.php'; - } - $antivir=new AntiVir($db); - $result = $antivir->dol_avscan_file($src_file); - if ($result < 0) // If virus or error, we stop here - { - $reterrors=$antivir->errors; - dol_syslog('Files.lib::dol_move_uploaded_file File "'.$src_file.'" (target name "'.$file_name.'") KO with antivirus: result='.$result.' errors='.join(',',$antivir->errors), LOG_WARNING); - return array('error' => 'ErrorFileIsInfectedWithAVirus: '.join(',',$reterrors)); - } - } - - // Security: - // Disallow file with some extensions. We renamed them. - // Car si on a mis le rep documents dans un rep de la racine web (pas bien), cela permet d'executer du code a la demande. - if (preg_match('/\.htm|\.html|\.php|\.pl|\.cgi$/i',$file_name)) - { - $file_name.= '.noexe'; - } - - // Security: - // On interdit fichiers caches, remontees de repertoire ainsi que les pipes dans les noms de fichiers. - if (preg_match('/^\./',$src_file) || preg_match('/\.\./',$src_file) || preg_match('/[<>|]/',$src_file)) - { - dol_syslog("Refused to deliver file ".$src_file, LOG_WARNING); - return array('error' => -1); - } - - // Security: - // On interdit fichiers caches, remontees de repertoire ainsi que les pipe dans - // les noms de fichiers. - if (preg_match('/^\./',$dest_file) || preg_match('/\.\./',$dest_file) || preg_match('/[<>|]/',$dest_file)) - { - dol_syslog("Refused to deliver file ".$dest_file, LOG_WARNING); - return array('error' => -2); - } - - return $file_name; -} - -/** - * Move an uploaded file after some controls. - * If there is errors (virus found, antivir in error, bad filename), file is not moved. - * - * @param string $src_file Source full path filename ($_FILES['field']['tmp_name']) - * @param string $dest_file Target full path filename ($_FILES['field']['name']) - * @param int $allowoverwrite 1=Overwrite target file if it already exists - * @param int $notrigger Disable all triggers - * @return int >0 if OK, <0 or string if KO - */ -function dolMoveUploadedFile($src_file, $dest_file, $allowoverwrite, $notrigger=0) -{ - global $conf, $user, $langs, $db; - global $object; - - $error=0; - - // The file functions must be in OS filesystem encoding. - $src_file_osencoded=dol_osencode($src_file); - $file_name_osencoded=dol_osencode($dest_file); - - // Check if destination dir is writable - // TODO - - // Check if destination file already exists - if (! $allowoverwrite) - { - if (file_exists($file_name_osencoded)) - { - dol_syslog("Files.lib::dol_move_uploaded_file File ".$file_name." already exists. Return 'ErrorFileAlreadyExists'", LOG_WARNING); - return 'ErrorFileAlreadyExists'; - } - } - - // Move file - $return=move_uploaded_file($src_file_osencoded, $file_name_osencoded); - if ($return) - { - if (! empty($conf->global->MAIN_UMASK)) @chmod($file_name_osencoded, octdec($conf->global->MAIN_UMASK)); - dol_syslog("Files.lib::dol_move_uploaded_file Success to move ".$src_file." to ".$file_name." - Umask=".$conf->global->MAIN_UMASK, LOG_DEBUG); - - if (! $notrigger) - { - if (is_object($object)) + switch($uploaderrorcode) { - $object->src_file=$dest_file; - - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($db); - $result=$interface->run_triggers('FILE_UPLOAD',$object,$user,$langs,$conf); - if ($result < 0) { - $error++; $errors=$interface->errors; - } - // Fin appel triggers - } - else - { - dol_syslog("Files.lib::dol_move_uploaded_file Object not find", LOG_WARNING); + case UPLOAD_ERR_INI_SIZE: // 1 + return 'ErrorFileSizeTooLarge'; + break; + case UPLOAD_ERR_FORM_SIZE: // 2 + return 'ErrorFileSizeTooLarge'; + break; + case UPLOAD_ERR_PARTIAL: // 3 + return 'ErrorPartialFile'; + break; + case UPLOAD_ERR_NO_TMP_DIR: // + return 'ErrorNoTmpDir'; + break; + case UPLOAD_ERR_CANT_WRITE: + return 'ErrorFailedToWriteInDir'; + break; + case UPLOAD_ERR_EXTENSION: + return 'ErrorUploadBlockedByAddon'; + break; + default: + break; } } - return 1; // Success + // If we need to make a virus scan + if (empty($disablevirusscan) && file_exists($src_file) && ! empty($conf->global->MAIN_ANTIVIRUS_COMMAND)) + { + if (! class_exists('AntiVir')) { + require DOL_DOCUMENT_ROOT.'/core/class/antivir.class.php'; + } + $antivir=new AntiVir($db); + $result = $antivir->dol_avscan_file($src_file); + if ($result < 0) // If virus or error, we stop here + { + $reterrors=$antivir->errors; + dol_syslog('Files.lib::dol_move_uploaded_file File "'.$src_file.'" (target name "'.$dest_file.'") KO with antivirus: result='.$result.' errors='.join(',',$antivir->errors), LOG_WARNING); + return 'ErrorFileIsInfectedWithAVirus: '.join(',',$reterrors); + } + } + + // Security: + // Disallow file with some extensions. We renamed them. + // Car si on a mis le rep documents dans un rep de la racine web (pas bien), cela permet d'executer du code a la demande. + if (preg_match('/\.htm|\.html|\.php|\.pl|\.cgi$/i',$dest_file)) + { + $file_name.= '.noexe'; + } + + // Security: + // On interdit fichiers caches, remontees de repertoire ainsi que les pipes dans les noms de fichiers. + if (preg_match('/^\./',$src_file) || preg_match('/\.\./',$src_file) || preg_match('/[<>|]/',$src_file)) + { + dol_syslog("Refused to deliver file ".$src_file, LOG_WARNING); + return -1; + } + + // Security: + // On interdit fichiers caches, remontees de repertoire ainsi que les pipe dans + // les noms de fichiers. + if (preg_match('/^\./',$dest_file) || preg_match('/\.\./',$dest_file) || preg_match('/[<>|]/',$dest_file)) + { + dol_syslog("Refused to deliver file ".$dest_file, LOG_WARNING); + return -2; + } + + if (! is_object($hookmanager)) + { + if (! class_exists('HookManager')) { + // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array + require DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + $hookmanager=new HookManager($db); + } + } + $hookmanager->initHooks(array('fileslib')); + + $parameters=array('filename' => $file_name, 'varfiles' => $varfiles, 'allowoverwrite' => $allowoverwrite); + $reshook=$hookmanager->executeHooks('moveUploadedFile', $parameters, $object); } - else + + if (empty($reshook)) { - dol_syslog("Files.lib::dol_move_uploaded_file Failed to move ".$src_file." to ".$file_name, LOG_ERR); - return -3; // Unknown error + // The file functions must be in OS filesystem encoding. + $src_file_osencoded=dol_osencode($src_file); + $file_name_osencoded=dol_osencode($file_name); + + // Check if destination dir is writable + // TODO + + // Check if destination file already exists + if (! $allowoverwrite) + { + if (file_exists($file_name_osencoded)) + { + dol_syslog("Files.lib::dol_move_uploaded_file File ".$file_name." already exists. Return 'ErrorFileAlreadyExists'", LOG_WARNING); + return 'ErrorFileAlreadyExists'; + } + } + + // Move file + $return=move_uploaded_file($src_file_osencoded, $file_name_osencoded); + if ($return) + { + if (! empty($conf->global->MAIN_UMASK)) @chmod($file_name_osencoded, octdec($conf->global->MAIN_UMASK)); + dol_syslog("Files.lib::dol_move_uploaded_file Success to move ".$src_file." to ".$file_name." - Umask=".$conf->global->MAIN_UMASK, LOG_DEBUG); + return 1; // Success + } + else + { + dol_syslog("Files.lib::dol_move_uploaded_file Failed to move ".$src_file." to ".$file_name, LOG_ERR); + return -3; // Unknown error + } } } @@ -763,62 +707,70 @@ function dolMoveUploadedFile($src_file, $dest_file, $allowoverwrite, $notrigger= * @param string $file File to delete or mask of file to delete * @param int $disableglob Disable usage of glob like * * @param int $nophperrors Disable all PHP output errors - * @param int $notrigger Disable all triggers - * @param Object $object Object + * @param int $nohook Disable all hooks + * @param object $object Current object in use * @return boolean True if file is deleted, False if error */ -function dol_delete_file($file,$disableglob=0,$nophperrors=0,$notrigger=0,$object=null) +function dol_delete_file($file,$disableglob=0,$nophperrors=0,$nohook=0,$object=null) { global $db, $conf, $user, $langs; + global $hookmanager; $langs->load("other"); $langs->load("errors"); - $error=0; + if (empty($nohook)) + { + if (! is_object($hookmanager)) + { + if (! class_exists('HookManager')) { + // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array + require DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + $hookmanager=new HookManager($db); + } + } + $hookmanager->initHooks(array('fileslib')); - //print "x".$file." ".$disableglob; - $ok=true; - $file_osencoded=dol_osencode($file); // New filename encoded in OS filesystem encoding charset - if (empty($disableglob) && ! empty($file_osencoded)) - { - foreach (glob($file_osencoded) as $filename) - { - if ($nophperrors) $ok=@unlink($filename); // The unlink encapsulated by dolibarr - else $ok=unlink($filename); // The unlink encapsulated by dolibarr - if ($ok) - { - dol_syslog("Removed file ".$filename, LOG_DEBUG); - if (! $notrigger) - { - if (! is_object($object)) $object=(object) 'dummy'; - $object->src_file=$file; + $parameters=array( + 'GET' => $_GET, + 'file' => $file, + 'disableglob'=> $disableglob, + 'nophperrors' => $nophperrors + ); + $reshook=$hookmanager->executeHooks('deleteFile', $parameters, $object); + } - // TODO Replace trigger by a hook. Triggers must be used for business events only. - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($db); - $result=$interface->run_triggers('FILE_DELETE',$object,$user,$langs,$conf); - if ($result < 0) { $error++; $errors=$interface->errors; } - // Fin appel triggers - } - } - else { - dol_syslog("Failed to remove file ".$filename, LOG_WARNING); - } - } - } - else - { - if ($nophperrors) $ok=@unlink($file_osencoded); // The unlink encapsulated by dolibarr - else $ok=unlink($file_osencoded); // The unlink encapsulated by dolibarr - if ($ok) { - dol_syslog("Removed file ".$file_osencoded, LOG_DEBUG); - } - else { - dol_syslog("Failed to remove file ".$file_osencoded, LOG_WARNING); - } - } - return $ok; + if (empty($nohook) && isset($reshook) && $reshook != '') // 0:not deleted, 1:deleted, null or '' for bypass + { + return $reshook; + } + else + { + $error=0; + + //print "x".$file." ".$disableglob; + $ok=true; + $file_osencoded=dol_osencode($file); // New filename encoded in OS filesystem encoding charset + if (empty($disableglob) && ! empty($file_osencoded)) + { + foreach (glob($file_osencoded) as $filename) + { + if ($nophperrors) $ok=@unlink($filename); // The unlink encapsulated by dolibarr + else $ok=unlink($filename); // The unlink encapsulated by dolibarr + if ($ok) dol_syslog("Removed file ".$filename, LOG_DEBUG); + else dol_syslog("Failed to remove file ".$filename, LOG_WARNING); + } + } + else + { + if ($nophperrors) $ok=@unlink($file_osencoded); // The unlink encapsulated by dolibarr + else $ok=unlink($file_osencoded); // The unlink encapsulated by dolibarr + if ($ok) dol_syslog("Removed file ".$file_osencoded, LOG_DEBUG); + else dol_syslog("Failed to remove file ".$file_osencoded, LOG_WARNING); + } + + return $ok; + } } /** @@ -891,7 +843,8 @@ function dol_delete_preview($object) { global $langs,$conf; - $element = $object->element; + // Define parent dir of elements + $element = $object->element; if ($object->element == 'order_supplier') $dir = $conf->fournisseur->dir_output.'/commande'; elseif ($object->element == 'invoice_supplier') $dir = $conf->fournisseur->dir_output.'/facture'; @@ -899,8 +852,7 @@ function dol_delete_preview($object) elseif ($object->element == 'shipping') $dir = $conf->expedition->dir_output.'/sending'; elseif ($object->element == 'delivery') $dir = $conf->expedition->dir_output.'/receipt'; elseif ($object->element == 'fichinter') $dir = $conf->ficheinter->dir_output; - else - $dir = $conf->$element->dir_output; + else $dir=empty($conf->$element->dir_output)?'':$conf->$element->dir_output; if (empty($dir)) return 'ErrorObjectNoSupportedByFunction'; @@ -949,11 +901,18 @@ function dol_meta_create($object) { global $conf; - if (empty($conf->global->MAIN_DOC_CREATE_METAFILE)) return 0; + if (empty($conf->global->MAIN_DOC_CREATE_METAFILE)) return 0; // By default, no metafile. // Define parent dir of elements $element=$object->element; - $dir=empty($conf->$element->dir_output)?'':$conf->$element->dir_output; + + if ($object->element == 'order_supplier') $dir = $conf->fournisseur->dir_output.'/commande'; + elseif ($object->element == 'invoice_supplier') $dir = $conf->fournisseur->dir_output.'/facture'; + elseif ($object->element == 'project') $dir = $conf->projet->dir_output; + elseif ($object->element == 'shipping') $dir = $conf->expedition->dir_output.'/sending'; + elseif ($object->element == 'delivery') $dir = $conf->expedition->dir_output.'/receipt'; + elseif ($object->element == 'fichinter') $dir = $conf->ficheinter->dir_output; + else $dir=empty($conf->$element->dir_output)?'':$conf->$element->dir_output; if ($dir) { @@ -1045,7 +1004,7 @@ function dol_init_file_process($pathtoscan='') */ function dol_add_file_process($upload_dir,$allowoverwrite=0,$donotupdatesession=0,$varfiles='addedfile') { - global $db,$user,$conf,$langs,$_FILES; + global $db,$user,$conf,$langs; if (! empty($_FILES[$varfiles])) // For view $_FILES[$varfiles]['error'] { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 6b3cf8fc56f..1a4aa60a012 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -723,12 +723,12 @@ function dol_get_fiche_end($notab=0) function dol_format_address($object) { $ret=''; - $countriesusingstate=array('US','IN'); + $countriesusingstate=array('US','IN','GB'); // Address $ret .= $object->address; // Zip/Town/State - if (in_array($object->country_code,array('US'))) // US: town, state, zip + if (in_array($object->country_code,array('US'))) // US: title firstname name \n address lines \n town, state, zip \n country { $ret .= ($ret ? "\n" : '' ).$object->town; if ($object->state && in_array($object->country_code,$countriesusingstate)) @@ -737,7 +737,16 @@ function dol_format_address($object) } if ($object->zip) $ret .= ', '.$object->zip; } - else // Other: zip town, state + else if (in_array($object->country_code,array('GB'))) // UK: title firstname name \n address lines \n town state \n zip \n country + { + $ret .= ($ret ? "\n" : '' ).$object->town; + if ($object->state && in_array($object->country_code,$countriesusingstate)) + { + $ret.=", ".$object->departement; + } + if ($object->zip) $ret .= ($ret ? "\n" : '' ).$object->zip; + } + else // Other: title firstname name \n address lines \n zip town \n country { $ret .= ($ret ? "\n" : '' ).$object->zip; $ret .= ' '.$object->town; @@ -1140,7 +1149,7 @@ function dol_print_email($email,$cid=0,$socid=0,$addlink=0,$max=64,$showinvalid= $newemail.=img_warning($langs->trans("ErrorBadEMail",$email)); } - if (($cid || $socid) && $conf->agenda->enabled && $user->rights->agenda->myactions->create) + if (($cid || $socid) && ! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) { $type='AC_EMAIL'; $link=''; if (! empty($conf->global->AGENDA_ADDACTIONFOREMAIL)) $link=''.img_object($langs->trans("AddAction"),"calendar").''; @@ -1227,7 +1236,7 @@ function dol_print_phone($phone,$country="FR",$cid=0,$socid=0,$addlink=0,$separ= $newphone.='>'.$newphonesav.''; } - //if (($cid || $socid) && $conf->agenda->enabled && $user->rights->agenda->myactions->create) + //if (($cid || $socid) && ! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) { $type='AC_TEL'; $link=''; @@ -1871,8 +1880,8 @@ function img_help($usehelpcursor = 1, $usealttitle = 1) if ($usealttitle) { - if (is_string($usealttitle)) $alt = dol_escape_htmltag($usealttitle); - else $alt = $langs->trans('Info'); + if (is_string($usealttitle)) $usealttitle = dol_escape_htmltag($usealttitle); + else $usealttitle = $langs->trans('Info'); } return img_picto($usealttitle, 'info.png', ($usehelpcursor ? 'style="cursor: help"' : '')); @@ -2255,7 +2264,7 @@ function print_liste_field_titre($name, $file="", $field="", $begin="", $morepar * @param string $name Label of field * @param int $thead For thead format * @param string $file Url used when we click on sort picto - * @param string $field Field to use for new sorting + * @param string $field Field to use for new sorting. Empty if this field is not sortable. * @param string $begin ("" by defaut) * @param string $moreparam Add more parameters on sort url links ("" by default) * @param string $moreattrib Add more attributes on th ("" by defaut) @@ -3358,11 +3367,12 @@ function dol_microtime_float() } /** - * Return if a text is a html content + * Return if a text is a html content * - * @param string $msg Content to check - * @param int $option 0=Full detection, 1=Fast check - * @return boolean true/false + * @param string $msg Content to check + * @param int $option 0=Full detection, 1=Fast check + * @return boolean true/false + * @see dol_concatdesc */ function dol_textishtml($msg,$option=0) { @@ -3393,6 +3403,28 @@ function dol_textishtml($msg,$option=0) } } +/** + * Concat 2 descriptions (second one after first one) + * text1 html + text2 html => text1 + '
' + text2 + * text1 html + text2 txt => text1 + '
' + dol_nl2br(text2) + * text1 txt + text2 html => dol_nl2br(text1) + '
' + text2 + * text1 txt + text2 txt => text1 + '\n' + text2 + * + * @param string $text1 Text 1 + * @param string $text2 Text 2 + * @param string $forxml false=Use
, true=Use
+ * @return string Text 1 + new line + Text2 + * @see dol_textishtml + */ +function dol_concatdesc($text1,$text2,$forxml=false) +{ + $ret=''; + $ret.= (! dol_textishtml($text1) && dol_textishtml($text2))?dol_nl2br($text1, 0, $forxml):$text1; + $ret.= (! empty($text1) && ! empty($text2)) ? ((dol_textishtml($text1) || dol_textishtml($text2))?($forxml?"
\n":"
\n") : "\n") : ""; + $ret.= (dol_textishtml($text1) && ! dol_textishtml($text2))?dol_nl2br($text2, 0, $forxml):$text2; + return $ret; +} + /** * Make substition into a string * There is two type of substitions: @@ -3457,7 +3489,7 @@ function complete_substitutions_array(&$substitutionarray,$outputlangs,$object=' dol_syslog("Library functions_".$substitfile['name']." found into ".$dir); require_once $dir.$substitfile['name']; $function_name=$module."_".$callfunc; - $function_name($substitutionarray,$outputlangs,$object,$parameters); + if (function_exists($function_name)) $function_name($substitutionarray,$outputlangs,$object,$parameters); } } } @@ -3971,7 +4003,7 @@ function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type,$mode= if (verifCond($values[4])) { if ($values[3]) $langs->load($values[3]); - $head[$h][0] = dol_buildpath(preg_replace('/__ID__/i',$object->id,$values[5]),1); + $head[$h][0] = dol_buildpath(preg_replace('/__ID__/i', (! empty($object->id)?$object->id:''), $values[5]), 1); $head[$h][1] = $langs->trans($values[2]); $head[$h][2] = str_replace('+','',$values[1]); $h++; @@ -3981,7 +4013,7 @@ function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type,$mode= { if ($values[0] != $type) continue; if ($values[3]) $langs->load($values[3]); - $head[$h][0] = dol_buildpath(preg_replace('/__ID__/i',$object->id,$values[4]),1); + $head[$h][0] = dol_buildpath(preg_replace('/__ID__/i', (! empty($object->id)?$object->id:''), $values[4]), 1); $head[$h][1] = $langs->trans($values[2]); $head[$h][2] = str_replace('+','',$values[1]); $h++; @@ -3990,7 +4022,7 @@ function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type,$mode= { if ($values[0] != $type) continue; if ($values[2]) $langs->load($values[2]); - $head[$h][0] = dol_buildpath(preg_replace('/__ID__/i',$object->id,$values[3]),1); + $head[$h][0] = dol_buildpath(preg_replace('/__ID__/i', (! empty($object->id)?$object->id:''), $values[3]), 1); $head[$h][1] = $langs->trans($values[1]); $head[$h][2] = 'tab'.$values[1]; $h++; diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index c63360a07ad..90a2b1b3698 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -508,7 +508,7 @@ function array2table($data,$tableMarkup=1,$tableoptions='',$troptions='',$tdopti /** * Return next value for a mask * - * @param DoliSB $db Database handler + * @param DoliDB $db Database handler * @param string $mask Mask to use * @param string $table Table containing field with counter * @param string $field Field containing already used values of counter @@ -529,8 +529,14 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m if ($date == '') $date=dol_now(); // We use local year and month of PHP server to search numbers // but we should use local year and month of user + // For debugging + //include_once(DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'); + //$mask='{yyyy}-{0000}'; + //$date=dol_mktime(12, 0, 0, 1, 1, 1900); + //$date=dol_stringtotime('20121001'); + // Extract value for mask counter, mask raz and mask offset - if (! preg_match('/\{(0+)([@\+][0-9]+)?([@\+][0-9]+)?\}/i',$mask,$reg)) return 'ErrorBadMask'; + if (! preg_match('/\{(0+)([@\+][0-9\-\+\=]+)?([@\+][0-9\-\+\=]+)?\}/i',$mask,$reg)) return 'ErrorBadMask'; $masktri=$reg[1].(! empty($reg[2])?$reg[2]:'').(! empty($reg[3])?$reg[3]:''); $maskcounter=$reg[1]; $maskraz=-1; @@ -565,7 +571,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m } $maskwithonlyymcode=$mask; - $maskwithonlyymcode=preg_replace('/\{(0+)([@\+][0-9]+)?([@\+][0-9]+)?\}/i',$maskcounter,$maskwithonlyymcode); + $maskwithonlyymcode=preg_replace('/\{(0+)([@\+][0-9\-\+\=]+)?([@\+][0-9\-\+\=]+)?\}/i',$maskcounter,$maskwithonlyymcode); $maskwithonlyymcode=preg_replace('/\{dd\}/i','dd',$maskwithonlyymcode); $maskwithonlyymcode=preg_replace('/\{(c+)(0*)\}/i',$maskrefclient,$maskwithonlyymcode); $maskwithonlyymcode=preg_replace('/\{(t+)\}/i',$masktype_value,$maskwithonlyymcode); @@ -577,6 +583,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m // Now maskwithnocode = 0000ddmmyyyyccc for example // and maskcounter = 0000 for example //print "maskwithonlyymcode=".$maskwithonlyymcode." maskwithnocode=".$maskwithnocode."\n
"; + //var_dump($reg); // If an offset is asked if (! empty($reg[2]) && preg_match('/^\+/',$reg[2])) $maskoffset=preg_replace('/^\+/','',$reg[2]); @@ -584,12 +591,20 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m // Define $sqlwhere $sqlwhere=''; + $yearoffset=0; // Use year of current $date by default + $yearoffsettype=false; // false: no reset, 0,-,=,+: reset at offset SOCIETE_FISCAL_MONTH_START, x=reset at offset x // If a restore to zero after a month is asked we check if there is already a value for this year. - if (! empty($reg[2]) && preg_match('/^@/',$reg[2])) $maskraz=preg_replace('/^@/','',$reg[2]); - if (! empty($reg[3]) && preg_match('/^@/',$reg[3])) $maskraz=preg_replace('/^@/','',$reg[3]); - if ($maskraz == 0) $maskraz = $conf->global->SOCIETE_FISCAL_MONTH_START; + if (! empty($reg[2]) && preg_match('/^@/',$reg[2])) $yearoffsettype = preg_replace('/^@/','',$reg[2]); + if (! empty($reg[3]) && preg_match('/^@/',$reg[3])) $yearoffsettype = preg_replace('/^@/','',$reg[3]); + + //print "yearoffset=".$yearoffset." yearoffsettype=".$yearoffsettype; + if (is_numeric($yearoffsettype) && $yearoffsettype >= 1) + $maskraz=$yearoffsettype; // For backward compatibility + else if ($yearoffsettype === '0' || (! empty($yearoffsettype) && ! is_numeric($yearoffsettype) && $conf->global->SOCIETE_FISCAL_MONTH_START > 1)) + $maskraz = $conf->global->SOCIETE_FISCAL_MONTH_START; //print "maskraz=".$maskraz; + if ($maskraz > 0) // A reset is required { if ($maskraz > 12) return 'ErrorBadMaskBadRazMonth'; @@ -609,32 +624,60 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m if (preg_match('/^(.*)\{(y+)\}/i',$maskwithonlyymcode,$reg)) { $posy=2; $posm=0; } } //print "x".$maskwithonlyymcode." ".$maskraz." ".$posy." ".$posm; + //var_dump($reg); // Define $yearcomp and $monthcomp (that will be use in the select where to search max number) $monthcomp=$maskraz; - $yearoffset=0; $yearcomp=0; - if (date("m",$date) < $maskraz) { $yearoffset=-1; } // If current month lower that month of return to zero, year is previous year - if (dol_strlen($reg[$posy]) == 4) $yearcomp=sprintf("%04d",date("Y",$date)+$yearoffset); - if (dol_strlen($reg[$posy]) == 2) $yearcomp=sprintf("%02d",date("y",$date)+$yearoffset); - if (dol_strlen($reg[$posy]) == 1) $yearcomp=substr(date("y",$date),2,1)+$yearoffset; - if ($monthcomp > 1) // Test with month is useless if monthcomp = 0 or 1 (0 is same as 1) - { - if (dol_strlen($reg[$posy]) == 4) $yearcomp1=sprintf("%04d",date("Y",$date)+$yearoffset+1); - if (dol_strlen($reg[$posy]) == 2) $yearcomp1=sprintf("%02d",date("y",$date)+$yearoffset+1); - // FIXME If mask is {mm}{yy}, sqlwhere is wrong here - $sqlwhere.='('; - $sqlwhere.=' (SUBSTRING('.$field.', '.(dol_strlen($reg[1])+1).', '.dol_strlen($reg[2]).") = '".$yearcomp."'"; - $sqlwhere.=' AND SUBSTRING('.$field.', '.(dol_strlen($reg[1])+dol_strlen($reg[2])+1).', '.dol_strlen($reg[3]).") >= '".str_pad($monthcomp, dol_strlen($reg[3]), '0', STR_PAD_LEFT)."')"; - $sqlwhere.=' OR'; - $sqlwhere.=' (SUBSTRING('.$field.', '.(dol_strlen($reg[1])+1).', '.dol_strlen($reg[2]).") = '".$yearcomp1."'"; - $sqlwhere.=' AND SUBSTRING('.$field.', '.(dol_strlen($reg[1])+dol_strlen($reg[2])+1).', '.dol_strlen($reg[3]).") < '".str_pad($monthcomp, dol_strlen($reg[3]), '0', STR_PAD_LEFT)."') "; + if (! empty($yearoffsettype) && ! is_numeric($yearoffsettype) && $yearoffsettype != '=') // $yearoffsettype is - or + + { + $currentyear=date("Y", $date); + $fiscaldate=dol_mktime('0','0','0',$maskraz,'1',$currentyear); + $newyeardate=dol_mktime('0','0','0','1','1',$currentyear); + $nextnewyeardate=dol_mktime('0','0','0','1','1',$currentyear+1); + //echo 'currentyear='.$currentyear.' date='.dol_print_date($date, 'day').' fiscaldate='.dol_print_date($fiscaldate, 'day').'
'; + + // If after or equal of current fiscal date + if ($date >= $fiscaldate) + { + // If before of next new year date + if ($date < $nextnewyeardate && $yearoffsettype == '+') $yearoffset=1; + } + // If after or equal of current new year date + else if ($date >= $newyeardate && $yearoffsettype == '-') $yearoffset=-1; + } + // For backward compatibility + else if (date("m",$date) < $maskraz) { $yearoffset=-1; } // If current month lower that month of return to zero, year is previous year + + $yearlen = dol_strlen($reg[$posy]); + if ($yearlen == 4) $yearcomp=sprintf("%04d",date("Y",$date)+$yearoffset); + elseif ($yearlen == 2) $yearcomp=sprintf("%02d",date("y",$date)+$yearoffset); + elseif ($yearlen == 1) $yearcomp=substr(date("y",$date),2,1)+$yearoffset; + if ($monthcomp > 1) // Test with month is useless if monthcomp = 0 or 1 (0 is same as 1) (regis: $monthcomp can't equal 0) + { + if ($yearlen == 4) $yearcomp1=sprintf("%04d",date("Y",$date)+$yearoffset+1); + elseif ($yearlen == 2) $yearcomp1=sprintf("%02d",date("y",$date)+$yearoffset+1); + + $monthlen = dol_strlen($reg[$posm]); + $yearpos = (dol_strlen($reg[1])+1); + $monthpos = ($yearpos+$yearlen); + if ($posy == 3) { + $monthpos = (dol_strlen($reg[1])+1); + $yearpos = ($monthpos+$monthlen); + } + + $sqlwhere.="("; + $sqlwhere.=" (SUBSTRING(".$field.", ".$yearpos.", ".$yearlen.") = '".$yearcomp."'"; + $sqlwhere.=" AND SUBSTRING(".$field.", ".$monthpos.", ".$monthlen.") >= '".str_pad($monthcomp, $monthlen, '0', STR_PAD_LEFT)."')"; + $sqlwhere.=" OR"; + $sqlwhere.=" (SUBSTRING(".$field.", ".$yearpos.", ".$yearlen.") = '".$yearcomp1."'"; + $sqlwhere.=" AND SUBSTRING(".$field.", ".$monthpos.", ".$monthlen.") < '".str_pad($monthcomp, $monthlen, '0', STR_PAD_LEFT)."') "; $sqlwhere.=')'; } else // reset is done on january { - $sqlwhere.='( SUBSTRING('.$field.', '.(dol_strlen($reg[1])+1).', '.dol_strlen($reg[2]).") = '".$yearcomp."' )"; + $sqlwhere.='(SUBSTRING('.$field.', '.(dol_strlen($reg[1])+1).', '.dol_strlen($reg[2]).") = '".$yearcomp."')"; } } //print "sqlwhere=".$sqlwhere."
\n"; @@ -769,9 +812,18 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m $numFinal = $mask; // We replace special codes except refclient - $numFinal = preg_replace('/\{yyyy\}/i',date("Y",$date), $numFinal); - $numFinal = preg_replace('/\{yy\}/i', date("y",$date), $numFinal); - $numFinal = preg_replace('/\{y\}/i', substr(date("y",$date),2,1), $numFinal); + if (! empty($yearoffsettype) && ! is_numeric($yearoffsettype) && $yearoffsettype != '=') // yearoffsettype is - or +, so we don't want current year + { + $numFinal = preg_replace('/\{yyyy\}/i',date("Y",$date)+$yearoffset, $numFinal); + $numFinal = preg_replace('/\{yy\}/i', date("y",$date)+$yearoffset, $numFinal); + $numFinal = preg_replace('/\{y\}/i', substr(date("y",$date),2,1)+$yearoffset, $numFinal); + } + else // we want yyyy to be current year + { + $numFinal = preg_replace('/\{yyyy\}/i',date("Y",$date), $numFinal); + $numFinal = preg_replace('/\{yy\}/i', date("y",$date), $numFinal); + $numFinal = preg_replace('/\{y\}/i', substr(date("y",$date),2,1), $numFinal); + } $numFinal = preg_replace('/\{mm\}/i', date("m",$date), $numFinal); $numFinal = preg_replace('/\{dd\}/i', date("d",$date), $numFinal); @@ -1230,7 +1282,7 @@ function getListOfModels($db,$type,$maxfilenamelength=0) if (! $tmpdir) { unset($listofdir[$key]); continue; } if (is_dir($tmpdir)) { - $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.odt'); + $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.odt','','name',SORT_ASC,0,true); // Disable hook for the moment if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles); } } diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index 07e7550994b..8d3990942c1 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -57,7 +57,7 @@ function facture_prepare_head($object) } //if ($fac->mode_reglement_code == 'PRE') - if ($conf->prelevement->enabled) + if (! empty($conf->prelevement->enabled)) { $head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$object->id; $head[$h][1] = $langs->trans('StandingOrders'); diff --git a/htdocs/core/lib/json.lib.php b/htdocs/core/lib/json.lib.php index b6df4922534..cf3fa89c655 100644 --- a/htdocs/core/lib/json.lib.php +++ b/htdocs/core/lib/json.lib.php @@ -267,7 +267,7 @@ function _unval($val) { // single, escaped unicode character $utf16 = chr(hexdec($reg[1])) . chr(hexdec($reg[2])); - $utf8 .= utf162utf8($utf16); + $utf8 = utf162utf8($utf16); $val=preg_replace('/\\\u'.$reg[1].$reg[2].'/i',$utf8,$val); } return $val; diff --git a/htdocs/core/lib/ldap.lib.php b/htdocs/core/lib/ldap.lib.php index a5200a320d9..fc8b139df1b 100644 --- a/htdocs/core/lib/ldap.lib.php +++ b/htdocs/core/lib/ldap.lib.php @@ -41,7 +41,7 @@ function ldap_prepare_head() $head[$h][2] = 'ldap'; $h++; - if ($conf->global->LDAP_SYNCHRO_ACTIVE) + if (! empty($conf->global->LDAP_SYNCHRO_ACTIVE)) { $head[$h][0] = DOL_URL_ROOT."/admin/ldap_users.php"; $head[$h][1] = $langs->trans("LDAPUsersSynchro"); @@ -49,7 +49,7 @@ function ldap_prepare_head() $h++; } - if ($conf->global->LDAP_SYNCHRO_ACTIVE) + if (! empty($conf->global->LDAP_SYNCHRO_ACTIVE)) { $head[$h][0] = DOL_URL_ROOT."/admin/ldap_groups.php"; $head[$h][1] = $langs->trans("LDAPGroupsSynchro"); @@ -57,7 +57,7 @@ function ldap_prepare_head() $h++; } - if ($conf->societe->enabled && $conf->global->LDAP_CONTACT_ACTIVE) + if (! empty($conf->societe->enabled) && ! empty($conf->global->LDAP_CONTACT_ACTIVE)) { $head[$h][0] = DOL_URL_ROOT."/admin/ldap_contacts.php"; $head[$h][1] = $langs->trans("LDAPContactsSynchro"); @@ -65,7 +65,7 @@ function ldap_prepare_head() $h++; } - if ($conf->adherent->enabled && $conf->global->LDAP_MEMBER_ACTIVE) + if (! empty($conf->adherent->enabled) && ! empty($conf->global->LDAP_MEMBER_ACTIVE)) { $head[$h][0] = DOL_URL_ROOT."/admin/ldap_members.php"; $head[$h][1] = $langs->trans("LDAPMembersSynchro"); diff --git a/htdocs/core/lib/member.lib.php b/htdocs/core/lib/member.lib.php index 8928fac972e..15ada8ed4c0 100644 --- a/htdocs/core/lib/member.lib.php +++ b/htdocs/core/lib/member.lib.php @@ -106,7 +106,7 @@ function member_prepare_head($object) * @param Object $object Member * @return array head */ -function member_admin_prepare_head($object) +function member_admin_prepare_head() { global $langs, $conf, $user; @@ -122,7 +122,7 @@ function member_admin_prepare_head($object) // Entries must be declared in modules descriptor with line // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab - complete_head_from_modules($conf,$langs,$object,$head,$h,'member_admin'); + complete_head_from_modules($conf,$langs,'',$head,$h,'member_admin'); $head[$h][0] = DOL_URL_ROOT.'/adherents/admin/adherent_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFields"); @@ -134,7 +134,7 @@ function member_admin_prepare_head($object) $head[$h][2] = 'public'; $h++; - complete_head_from_modules($conf,$langs,$object,$head,$h,'member_admin','remove'); + complete_head_from_modules($conf,$langs,'',$head,$h,'member_admin','remove'); return $head; } diff --git a/htdocs/core/lib/order.lib.php b/htdocs/core/lib/order.lib.php index 2bd4fd8779b..3fc1bc73f04 100644 --- a/htdocs/core/lib/order.lib.php +++ b/htdocs/core/lib/order.lib.php @@ -34,13 +34,13 @@ function commande_prepare_head($object) { global $langs, $conf, $user; - if ($conf->expedition->enabled) $langs->load("sendings"); + if (! empty($conf->expedition->enabled)) $langs->load("sendings"); $langs->load("orders"); $h = 0; $head = array(); - if ($conf->commande->enabled && $user->rights->commande->lire) + if (! empty($conf->commande->enabled) && $user->rights->commande->lire) { $head[$h][0] = DOL_URL_ROOT.'/commande/fiche.php?id='.$object->id; $head[$h][1] = $langs->trans("OrderCard"); diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 33e562c464f..7cbcdb4854d 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -668,7 +668,7 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass { $pdf->SetXY($dims['lm'],-$posy); $width=20000; $align='L'; // By default, ask a manual break: We use a large value 20000, to not have automatic wrap. This make user understand, he need to add CR on its text. - if ($conf->global->MAIN_USE_AUTOWRAP_ON_FREETEXT) { $width=200; $align='C'; } + if (! empty($conf->global->MAIN_USE_AUTOWRAP_ON_FREETEXT)) { $width=200; $align='C'; } $pdf->MultiCell($width, 3, $line, 0, $align, 0); $posy-=($nbofline*3); // 6 of ligne + 3 of MultiCell } diff --git a/htdocs/core/lib/price.lib.php b/htdocs/core/lib/price.lib.php index 8e7d951514c..d6188ec75a0 100644 --- a/htdocs/core/lib/price.lib.php +++ b/htdocs/core/lib/price.lib.php @@ -1,7 +1,7 @@ * Copyright (C) 2006-2008 Laurent Destailleur - * Copyright (C) 2010 Juanjo Menent + * Copyright (C) 2010-2012 Juanjo Menent * Copyright (C) 2012 Christophe Battarel * * This program is free software; you can redistribute it and/or modify @@ -56,16 +56,16 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $localtax1 $result=array(); // TODO Remove this code. Added for backward compatibility. To remove once localtaxX_type is provided by caller. - if ($localtax1_type == '?') - { - if ($mysoc->country_code=='ES') $localtax1_type='1'; - else $localtax1_type='0'; - } - if ($localtax2_type == '?') - { - if ($mysoc->country_code=='ES') $localtax2_type='1'; - else $localtax2_type='0'; - } + if ($localtax1_type == '?') + { + if ($mysoc->country_code=='ES') $localtax1_type='3'; + else $localtax1_type='0'; + } + if ($localtax2_type == '?') + { + if ($mysoc->country_code=='ES') $localtax2_type='1'; + else $localtax2_type='0'; + } // initialize total (may be HT or TTC depending on price_base_type) $tot_sans_remise = $pu * $qty; @@ -164,6 +164,14 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $localtax1 // if there's some localtax without vat, we calculate localtaxes (we will add them at end) $apply_tax = false; + + //If price is 'TTC' we need to have the totals without VAT for a correct calculation + if ($price_base_type=='TTC') + { + $tot_sans_remise= price2num($tot_sans_remise / (1 + ($txtva / 100)),'MU'); + $tot_avec_remise= price2num($tot_avec_remise / (1 + ($txtva / 100)),'MU'); + } + switch($localtax1_type) { case '1': // localtax on product or service $apply_tax = true; @@ -176,6 +184,7 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $localtax1 break; } if ($apply_tax) { + $result[14] = price2num(($tot_sans_remise * (1 + ( $localtax1_rate / 100))) - $tot_sans_remise, 'MT'); // amount tax1 for total_ht_without_discount $result[8] += $result[14]; // total_ttc_without_discount + tax1 diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index c78fb19af09..b2cbb2f55a5 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -49,7 +49,7 @@ function product_prepare_head($object, $user) $head[$h][2] = 'price'; $h++; - if ($conf->fournisseur->enabled && $user->rights->fournisseur->lire) + if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire) { $head[$h][0] = DOL_URL_ROOT."/product/fournisseurs.php?id=".$object->id; $head[$h][1] = $langs->trans("SuppliersPrices"); @@ -63,7 +63,7 @@ function product_prepare_head($object, $user) $h++; // Show category tab - if ($conf->categorie->enabled && $user->rights->categorie->lire) + if (! empty($conf->categorie->enabled) && $user->rights->categorie->lire) { $head[$h][0] = DOL_URL_ROOT."/categories/categorie.php?id=".$object->id.'&type=0'; $head[$h][1] = $langs->trans('Categories'); @@ -72,7 +72,7 @@ function product_prepare_head($object, $user) } // Multilangs - if($conf->global->MAIN_MULTILANGS) + if (! empty($conf->global->MAIN_MULTILANGS)) { $head[$h][0] = DOL_URL_ROOT."/product/traduction.php?id=".$object->id; $head[$h][1] = $langs->trans("Translation"); @@ -81,7 +81,7 @@ function product_prepare_head($object, $user) } // Sub products - if($conf->global->PRODUIT_SOUSPRODUITS) + if (! empty($conf->global->PRODUIT_SOUSPRODUITS)) { $head[$h][0] = DOL_URL_ROOT."/product/composition/fiche.php?id=".$object->id; $head[$h][1] = $langs->trans('AssociatedProducts'); @@ -101,7 +101,7 @@ function product_prepare_head($object, $user) if($object->isproduct()) // Si produit stockable { - if ($conf->stock->enabled && $user->rights->stock->lire) + if (! empty($conf->stock->enabled) && $user->rights->stock->lire) { $head[$h][0] = DOL_URL_ROOT."/product/stock/product.php?id=".$object->id; $head[$h][1] = $langs->trans("Stock"); @@ -189,7 +189,7 @@ function show_stats_for_company($product,$socid) print '
+ + + + + + + + + + + +
trans("Label"); ?>
trans("AttributeCode"); ?> (trans("AlphaNumOnlyCharsAndNoSpace"); ?>)
trans("Type"); ?> +selectarray('type',$type2label,GETPOST('type')); ?> +
trans("Size"); ?>
trans("Unique"); ?>">
+ +

">   +">
+ + + + diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php new file mode 100644 index 00000000000..b93f136bc5d --- /dev/null +++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php @@ -0,0 +1,72 @@ + + * Copyright (C) 2012 Regis Houssin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +?> + + + + + +
?attrname=" method="post"> + + + + + + + + + + + +attribute_type[$attrname]; +$size=$extrafields->attribute_size[$attrname]; +$unique=$extrafields->attribute_unique[$attrname]; +?> + + + + + + +
trans("Label"); ?>
trans("AttributeCode"); ?>
trans("Type"); ?> + + +
trans("Size"); ?>
trans("Unique"); ?>">
+ +

">   +">
+ +
+ + diff --git a/htdocs/core/tpl/ajaxrow.tpl.php b/htdocs/core/tpl/ajaxrow.tpl.php index bb26c2d891e..62b4b929b7f 100644 --- a/htdocs/core/tpl/ajaxrow.tpl.php +++ b/htdocs/core/tpl/ajaxrow.tpl.php @@ -1,6 +1,6 @@ - * Copyright (C) 2010-2011 Laurent Destailleur + * Copyright (C) 2010-2012 Laurent Destailleur * * 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 @@ -15,12 +15,20 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . * + * Javascript code to activate drag and drop on lines */ ?> -lines) > 1 && GETPOST('action') != 'editline') { ?> -