diff --git a/ChangeLog b/ChangeLog index 68d6b1848f1..e70169095be 100644 --- a/ChangeLog +++ b/ChangeLog @@ -43,14 +43,31 @@ Dolibarr better: - All fields "fk_societe" were renamed into "fk_soc". ***** ChangeLog for 3.7.1 compared to 3.7.* ***** -- Fix: Bug in the new photo system -- Fix: Error management -- Fix: [ Bug #2714 ] Members -> Memberxy-> Agenda -> technical Error -- Fix: [ Bug #2713 ] 3.7.0 mailing-unsubscribe.php not unsubscribe +FIX Bug in the new photo system +FIX Error management +FIX [ Bug #2714 ] Members -> Memberxy-> Agenda -> technical Error +FIX [ Bug #2713 ] 3.7.0 mailing-unsubscribe.php not unsubscribe +FIX #2901 +FIX when we create an agenda event with "Not applicable" status, it is automatically saved with "To do" status +FIX check the user status during authentication +FIX top links menu have target attribute with wrong value +FIX extrafields required on thirdparty +FIX create contact with extrafield is null when it is require +FIX width multiselect +FIX "script" tag with wrong syntax +Fix bug debian 786479 +FIX update usergroup name +Fix facturestats was not filtering on invoice type +FIX #2856 : Wrong table design +FIX button create payment hide if tax amount is less than 1 +FIX event for restricted user was restricted if company null +FIX send mail, copy sendto don't read the list of contact +FIX Properly escape untrusted data to prevent HTML injection. +FIX send mail, copy sendto don't read the list of contact -- Path to save photos of products was moved in 3.7.0 to match path of other attached files. If you had loose - your photo on the photo tab of products, you can set the constant "PRODUCT_USE_OLD_PATH_FOR_PHOTO" to - restore old path. +Path to save photos of products was moved in 3.7.0 to match path of other attached files. If you had loose +your photo on the photo tab of products, you can set the constant "PRODUCT_USE_OLD_PATH_FOR_PHOTO" to +restore old path. WARNING: @@ -236,8 +253,8 @@ Dolibarr better: - Table llx_c_pays were renamed into llx_c_country. - Triggers *_BUILDDOC are removed. Building a doc is not a business event. For action after creation of a pdf or odt, hook "afterPDFCreation" or "afterODTCreation" must be used instead. -- A lot of pages called fiche.php were renamed into card.php -- A lot of pages called liste.php were renamed into list.php +- A lot of pages named fiche.php were renamed into card.php +- A lot of pages named liste.php were renamed into list.php - If you used warehouse/stock module, recheck setup of stock increase/decrease rules of the warehouse module and your Point Of Sale module setup if you use one. - Replaced USER_UPDATE_SESSION trigger with an updateSession hook may break modules using it. diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index c667754d4ab..bdfc9d8972a 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -455,8 +455,9 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT/documents`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/document`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/documents`; - # Removed known external modules to avoir any error when packaging on test env + # Removed known external modules to avoid any error when packaging from env where external modules are tested $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/ancotec*`; + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/cabinetmed*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/calling*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/bootstrap*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/custom*`; @@ -981,10 +982,10 @@ if ($nboftargetok) { mkdir($DESTI.'/package_windows'); if (-d $DESTI.'/package_windows') { $NEWDESTI=$DESTI.'/package_windows'; } - print "Remove target $FILENAMEEXEDOLIWAMP.exe...\n"; + print "Remove target $NEWDESTI/$FILENAMEEXEDOLIWAMP.exe...\n"; unlink "$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe"; - print "Check that in your Wine setup, you create a Z: drive that point to your /tmp directory.\n"; + print "Check that in your Wine setup, you create a Z: drive that point to your / directory.\n"; $SOURCEBACK=$SOURCE; $SOURCEBACK =~ s/\//\\/g; diff --git a/dev/codesniffer/ruleset.xml b/dev/codesniffer/ruleset.xml index 7f16ad02a76..9b5c0931650 100755 --- a/dev/codesniffer/ruleset.xml +++ b/dev/codesniffer/ruleset.xml @@ -350,6 +350,11 @@ + + + 0 + +
'; + $tmp=' jQuery(document).ready(function() { jQuery("#fac_replacement").change(function() { @@ -2158,7 +2160,7 @@ if ($action == 'create') }); }); '; - $text = $langs->trans("InvoiceReplacementAsk") . ' '; + $text = $tmp.$langs->trans("InvoiceReplacementAsk") . ' '; $text .= ''; - $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc"), 1); + $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc"), 1, 'help', '', 0, 3); print $desc; - print '' . "\n"; + print '
'; } else { - print ''; - print ''; - print ''; - $text = $langs->trans("InvoiceReplacement") . ' '; + print '
'; + $tmp=' '; + $text = $tmp.$langs->trans("InvoiceReplacement") . ' '; $text.= '('.$langs->trans("YouMustCreateInvoiceFromThird").') '; - $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc"), 1); + $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc"), 1, 'help', '', 0, 3); print $desc; - print '' . "\n"; + print '
'; } if (empty($origin)) @@ -2191,12 +2192,10 @@ if ($action == 'create') if ($socid > 0) { // Credit note - print ''; - print ''; - print ''; + print '
'; + $tmp=' jQuery(document).ready(function() { @@ -2212,7 +2211,7 @@ if ($action == 'create') }); }); '; - $text = $langs->transnoentities("InvoiceAvoirAsk") . ' '; + $text = $tmp.$langs->transnoentities("InvoiceAvoirAsk") . ' '; // $text.=''; $text .= ''; - $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1); + $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1, 'help', '', 0, 3); print $desc; print '
'; @@ -2233,22 +2232,22 @@ if ($action == 'create') print '
    0 ? 'checked':'').' /> "; print '
'; - print '' . "\n"; + print '
'; } else { - print ''; - print ''; - print ''; - $text = $langs->trans("InvoiceAvoir") . ' '; + print '
'; + $tmp=' '; + $text = $tmp.$langs->trans("InvoiceAvoir") . ' '; $text.= '('.$langs->trans("YouMustCreateInvoiceFromThird").') '; - $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1); + $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1, 'help', '', 0, 3); print $desc; - print '' . "\n"; + print '
' . "\n"; } } - print ''; + print ''; + print ''; if ($socid > 0) @@ -2293,12 +2292,15 @@ if ($action == 'create') print ''; // Project - if (! empty($conf->projet->enabled) && $socid > 0) { - $formproject = new FormProjets($db); + if (! empty($conf->projet->enabled) && $socid > 0) + { + $projectid = GETPOST('projectid')?GETPOST('projectid'):0; + if ($origin == 'project') $projectid = ($originid ? $originid : 0); $langs->load('projects'); print '' . $langs->trans('Project') . ''; - $formproject->select_projects($soc->id, $projectid, 'projectid', 0); + $numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0); + print '   id).'">' . $langs->trans("AddProject") . ''; print ''; } @@ -2320,7 +2322,7 @@ if ($action == 'create') print $object->showOptionals($extrafields, 'edit'); } - // Modele PDF + // Template to use by default print '' . $langs->trans('Model') . ''; print ''; include_once DOL_DOCUMENT_ROOT . '/core/modules/facture/modules_facture.php'; @@ -2337,7 +2339,7 @@ if ($action == 'create') { $note_public = $objectsrc->note_public; } - $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); + $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); print $doleditor->Create(1); // Private note @@ -2351,7 +2353,7 @@ if ($action == 'create') { $note_private = $objectsrc->note_private; } - $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); + $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); print $doleditor->Create(1); // print ' print ''; @@ -2418,7 +2420,9 @@ if ($action == 'create') print '' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '' . price($objectsrc->total_localtax2) . ""; } print '' . $langs->trans('TotalTTC') . '' . price($objectsrc->total_ttc) . ""; - } else { + } + else + { // Show deprecated optional form to add product line here if (! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) { print ''; @@ -3486,50 +3490,50 @@ if ($action == 'create') // Show global modifiers if (! empty($conf->global->INVOICE_US_SITUATION)) { - if ($object->situation_cycle_ref && $object->statut == 0) { - print ''; - print '
'; - print ''; - print ''; - print ''; + if ($object->situation_cycle_ref && $object->statut == 0) { + print ''; + print ''; + print ''; + print ''; + print ''; - if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { - print ' '; - } - print '' . $langs->trans('ModifyAllLines') . ''; - print ' '; - print ' '; - if ($inputalsopricewithtax) print ' '; - print ' '; - print ' '; - print '' . $langs->trans('Progress') . ''; - if (! empty($conf->margin->enabled) && empty($user->societe_id)) - { - print ' '; - if ((! empty($conf->global->DISPLAY_MARGIN_RATES) || ! empty($conf->global->DISPLAY_MARK_RATES)) && $user->rights->margins->liretous) { - print ' '; + if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { + print ' '; } - } - print ' '; - print ' '; - print ' '; - print ' '; - print "\n"; + print '' . $langs->trans('ModifyAllLines') . ''; + print ' '; + print ' '; + if ($inputalsopricewithtax) print ' '; + print ' '; + print ' '; + print '' . $langs->trans('Progress') . ''; + if (! empty($conf->margin->enabled) && empty($user->societe_id)) + { + print ' '; + if ((! empty($conf->global->DISPLAY_MARGIN_RATES) || ! empty($conf->global->DISPLAY_MARK_RATES)) && $user->rights->margins->liretous) { + print ' '; + } + } + print ' '; + print ' '; + print ' '; + print ' '; + print "\n"; - if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { - print ' '; + if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { + print ' '; + } + print ''; + print ' '; + print ' '; + print ' '; + print ' '; + print ' '; + print '%'; + print ''; + print ''; + print '
'; } - print ''; - print ' '; - print ' '; - print ' '; - print ' '; - print ' '; - print '%'; - print ''; - print ''; - print ''; - } } // Show object lines diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 075173d31c9..fc3d8936edf 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -92,18 +92,16 @@ class Facture extends CommonInvoice var $revenuestamp; /** * @deprecated + * @see note_private, note_public */ var $note; var $note_private; var $note_public; /** - * Check constants for more info: - * - STATUS_DRAFT - * - STATUS_VALIDATED - * - STATUS_PAID - * - STATUS_ABANDONED + * Invoice status * @var int + * @see Facture::STATUS_DRAFT, Facture::STATUS_VALIDATED, Facture::STATUS_PAID, Facture::STATUS_ABANDONED */ var $statut; //! Fermeture apres paiement partiel: discount_vat, badcustomer, abandon @@ -131,6 +129,9 @@ class Facture extends CommonInvoice * @deprecated */ var $products=array(); + /** + * @var FactureLigne[] + */ var $lines=array(); var $line; var $extraparams=array(); @@ -1119,7 +1120,8 @@ class Facture extends CommonInvoice $objp = $this->db->fetch_object($result); $line = new FactureLigne($this->db); - $line->rowid = $objp->rowid; + $line->id = $objp->rowid; + $line->rowid = $objp->rowid; // deprecated $line->label = $objp->custom_label; // deprecated $line->desc = $objp->description; // Description line $line->product_type = $objp->product_type; // Type of line @@ -2105,6 +2107,11 @@ class Facture extends CommonInvoice */ function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits=0, $fk_remise_except='', $price_base_type='HT', $pu_ttc=0, $type=self::TYPE_STANDARD, $rang=-1, $special_code=0, $origin='', $origin_id=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht=0, $label='', $array_options=0, $situation_percent=100, $fk_prev_id='', $fk_unit = null) { + // Deprecation warning + if ($label) { + dol_syslog(__METHOD__ . ": using line label is deprecated", LOG_WARNING); + } + global $mysoc, $conf, $langs; dol_syslog(get_class($this)."::addline facid=$this->id,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, fk_product=$fk_product,remise_percent=$remise_percent,date_start=$date_start,date_end=$date_end,ventil=$ventil,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type, fk_unit=$fk_unit", LOG_DEBUG); @@ -2289,6 +2296,11 @@ class Facture extends CommonInvoice */ function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type= self::TYPE_STANDARD, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_options=0, $situation_percent=0, $fk_unit = null) { + // Deprecation warning + if ($label) { + dol_syslog(__METHOD__ . ": using line label is deprecated", LOG_WARNING); + } + include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; global $mysoc; @@ -3685,7 +3697,10 @@ class FactureLigne extends CommonInvoiceLine var $fk_facture; //! Id parent line var $fk_parent_line; - var $label; // deprecated + /** + * @deprecated + */ + var $label; //! Description ligne var $desc; @@ -3717,8 +3732,16 @@ class FactureLigne extends CommonInvoiceLine //var $remise; // Montant calcule de la remise % sur PU HT (exemple 20) // From llx_product + /** + * @deprecated + * @see product_ref + */ var $ref; // Product ref (deprecated) var $product_ref; // Product ref + /** + * @deprecated + * @see product_label + */ var $libelle; // Product label (deprecated) var $product_label; // Product label var $product_desc; // Description produit diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php index 60c47564743..e4f9846309a 100644 --- a/htdocs/compta/facture/document.php +++ b/htdocs/compta/facture/document.php @@ -37,6 +37,7 @@ $langs->load('propal'); $langs->load('compta'); $langs->load('other'); $langs->load("bills"); +$langs->load('companies'); $id=(GETPOST('id','int')?GETPOST('id','int'):GETPOST('facid','int')); // For backward compatibility diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 6954ad46249..0e1763d4b86 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -36,6 +36,7 @@ if (!$user->rights->facture->lire) accessforbidden(); $langs->load("bills"); $langs->load("banks"); $langs->load("withdrawals"); +$langs->load('companies'); $id=(GETPOST('id','int')?GETPOST('id','int'):GETPOST('facid','int')); // For backward compatibility $ref=GETPOST('ref','alpha'); @@ -396,7 +397,7 @@ if ($object->id > 0) } print ""; print ''; - + // Montants print ''.$langs->trans('AmountHT').''; print ''.price($object->total_ht).''; diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 077bbde2420..60d669fcacf 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -40,7 +40,16 @@ class Paiement extends CommonObject var $ref; var $facid; var $datepaye; - var $total; // deprecated + /** + * @deprecated + * @see amount, amounts + */ + var $total; + /** + * @deprecated + * @see amount, amounts + */ + var $montant; var $amount; // Total amount of payment var $amounts=array(); // Array of amounts var $author; diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index d58e0add8ab..45b2c51acfa 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -40,6 +40,11 @@ class PaymentSocialContribution extends CommonObject var $datec=''; var $tms=''; var $datep=''; + /** + * @deprecated + * @see amount + */ + var $total; var $amount; // Total amount of payment var $amounts=array(); // Array of amounts var $fk_typepaiement; diff --git a/htdocs/contact/canvas/actions_contactcard_common.class.php b/htdocs/contact/canvas/actions_contactcard_common.class.php index 9e6624dda72..ad628fd6574 100644 --- a/htdocs/contact/canvas/actions_contactcard_common.class.php +++ b/htdocs/contact/canvas/actions_contactcard_common.class.php @@ -51,6 +51,8 @@ abstract class ActionsContactCardCommon */ private function getInstanceDao() { + dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING); + if (! is_object($this->object)) { $modelclassfile = dol_buildpath('/'.$this->dirmodule.'/canvas/'.$this->canvas.'/dao_'.$this->targetmodule.'_'.$this->canvas.'.class.php'); diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 588ce2b01ff..742378a2db3 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -201,12 +201,12 @@ if (empty($reshook)) // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels,$object); - if ($ret < 0) + if ($ret < 0) { $error++; $action = 'create'; } - + if (! GETPOST("lastname")) { $error++; $errors[]=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Lastname").' / '.$langs->transnoentities("Label")); @@ -1105,18 +1105,14 @@ else { if ($user->rights->societe->contact->creer) { - print ''.$langs->trans('Modify').''; + print ''.$langs->trans('Modify').''; } if (! $object->user_id && $user->rights->user->user->creer) { - print ''.$langs->trans("CreateDolibarrLogin").''; + print ''.$langs->trans("CreateDolibarrLogin").''; } - if ($user->rights->societe->contact->supprimer) - { - print ''.$langs->trans('Delete').''; - } // Activer if ($object->statut == 0 && $user->rights->societe->contact->creer) { @@ -1126,6 +1122,12 @@ else if ($object->statut == 1 && $user->rights->societe->contact->creer) { print ''.$langs->trans("DisableUser").''; + } + + // Delete + if ($user->rights->societe->contact->supprimer) + { + print ''.$langs->trans('Delete').''; } } diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index ca85995a7d3..0e3c4b0a2bc 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -50,9 +50,21 @@ class Contact extends CommonObject var $zip; var $town; - var $fk_departement; // deprecated - var $departement_code; // deprecated - var $departement; // deprecated + /** + * @deprecated + * @see state_id + */ + var $fk_departement; + /** + * @deprecated + * @see state_code + */ + var $departement_code; + /** + * @deprecated + * @see state + */ + var $departement; var $state_id; // Id of department var $state_code; // Code of department var $state; // Label of department @@ -80,7 +92,11 @@ class Contact extends CommonObject var $birthday; var $default_lang; var $note_public; // Public note - var $note; // deprecated + /** + * @deprecated + * @see note_public, note_private + */ + var $note; var $note_private; // Private note var $no_email; // 1=Don't send e-mail to this contact, 0=do diff --git a/htdocs/contact/document.php b/htdocs/contact/document.php index 2241a1e67f1..9a5ab3b0f07 100644 --- a/htdocs/contact/document.php +++ b/htdocs/contact/document.php @@ -80,8 +80,9 @@ llxHeader("",$langs->trans("Contact"), $helpurl); if ($object->id) { $head = contact_prepare_head($object); + $title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses")); - dol_fiche_head($head, 'documents', $langs->trans("Contact"), 0, 'contact'); + dol_fiche_head($head, 'documents', $title, 0, 'contact'); // Construit liste des fichiers diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 08bc8387387..fb0038b509f 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -154,6 +154,7 @@ class Contrat extends CommonObject /** * @deprecated Use fk_project instead + * @see fk_project */ var $fk_projet; @@ -1642,6 +1643,8 @@ class Contrat extends CommonObject */ function update_statut($user) { + dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING); + // If draft, we keep it (should not happen) if ($this->statut == 0) return 1; @@ -2165,6 +2168,7 @@ class ContratLigne extends CommonObjectLine /** * @var string * @deprecated Use $label instead + * @see label */ public $libelle; @@ -2189,6 +2193,7 @@ class ContratLigne extends CommonObjectLine /** * @var float * @deprecated Use $price_ht instead + * @see price_ht */ public $price; diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 22a33f4d2a8..d0730149b36 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -118,6 +118,7 @@ abstract class CommonDocGenerator 'mycompany_idprof5'=>$mysoc->idprof5, 'mycompany_idprof6'=>$mysoc->idprof6, 'mycompany_vatnumber'=>$mysoc->tva_intra, + 'mycompany_object'=>$mysoc->object, // Only private not exists for "mysoc" 'mycompany_note_private'=>$mysoc->note_private, diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 10f91a07631..4c511726979 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7,7 +7,7 @@ * Copyright (C) 2012-2013 Christophe Battarel * Copyright (C) 2011-2014 Philippe Grand * Copyright (C) 2012-2015 Marcos García - * Copyright (C) 2012-2014 Raphaël Doursenaud + * Copyright (C) 2012-2015 Raphaël Doursenaud * Copyright (C) 2012 Cedric Salvador * * This program is free software; you can redistribute it and/or modify @@ -44,6 +44,7 @@ abstract class CommonObject /** * @var string Error string * @deprecated Use instead the array of error strings + * @see errors */ public $error; @@ -82,7 +83,7 @@ abstract class CommonObject public $errors=array(); /** - * @var string Can be used to pass information when only object is provided to method + * @var string[] Can be used to pass information when only object is provided to method */ public $context=array(); @@ -96,7 +97,24 @@ abstract class CommonObject public $lastname; public $firstname; public $civility_id; + /** + * @deprecated + * @see thirdparty + */ + public $client; + /** + * @var Societe + */ public $thirdparty; + /** + * @deprecated + * @see project + */ + public $projet; + /** + * @var Project + */ + public $project; // No constructor as it is an abstract class @@ -113,13 +131,15 @@ abstract class CommonObject */ static function isExistingObject($element, $id, $ref='', $ref_ext='') { - global $db; + global $db,$conf; $sql = "SELECT rowid, ref, ref_ext"; $sql.= " FROM ".MAIN_DB_PREFIX.$element; - if ($id > 0) $sql.= " WHERE rowid = ".$db->escape($id); - else if ($ref) $sql.= " WHERE ref = '".$db->escape($ref)."'"; - else if ($ref_ext) $sql.= " WHERE ref_ext = '".$db->escape($ref_ext)."'"; + $sql.= " WHERE entity IN (".getEntity($element).")" ; + + if ($id > 0) $sql.= " AND rowid = ".$db->escape($id); + else if ($ref) $sql.= " AND ref = '".$db->escape($ref)."'"; + else if ($ref_ext) $sql.= " AND ref_ext = '".$db->escape($ref_ext)."'"; else { $error='ErrorWrongParameters'; dol_print_error(get_class()."::isExistingObject ".$error, LOG_ERR); @@ -759,10 +779,14 @@ abstract class CommonObject */ function fetch_projet() { + include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + + if (empty($this->fk_project) && ! empty($this->fk_projet)) $this->fk_project = $this->fk_projet; // For backward compatibility if (empty($this->fk_project)) return 0; $project = new Project($this->db); $result = $project->fetch($this->fk_project); + $this->projet = $project; // deprecated $this->project = $project; return $result; @@ -1639,9 +1663,10 @@ abstract class CommonObject /** * Update public note (kept for backward compatibility) * - * @param string $note New value for note - * @return int <0 if KO, >0 if OK - * @deprecated + * @param string $note New value for note + * @return int <0 if KO, >0 if OK + * @deprecated + * @see update_note() */ function update_note_public($note) { @@ -3956,15 +3981,16 @@ abstract class CommonObject * This function is meant to be called from replaceThirdparty with the appropiate tables * Column name fk_soc MUST be used to identify thirdparties * - * @param DoliDB $db Database handler - * @param int $origin_id Old thirdparty id - * @param int $dest_id New thirdparty id - * @param array $tables Tables that need to be changed + * @param DoliDB $db Database handler + * @param int $origin_id Old thirdparty id (the thirdparty to delete) + * @param int $dest_id New thirdparty id (the thirdparty that will received element of the other) + * @param array $tables Tables that need to be changed * @return bool */ public static function commonReplaceThirdparty(DoliDB $db, $origin_id, $dest_id, array $tables) { - foreach ($tables as $table) { + foreach ($tables as $table) + { $sql = 'UPDATE '.MAIN_DB_PREFIX.$table.' SET fk_soc = '.$dest_id.' WHERE fk_soc = '.$origin_id; if (!$db->query($sql)) { diff --git a/htdocs/core/class/commonobjectline.class.php b/htdocs/core/class/commonobjectline.class.php index 07019a0fa1d..ef854a2452e 100644 --- a/htdocs/core/class/commonobjectline.class.php +++ b/htdocs/core/class/commonobjectline.class.php @@ -39,6 +39,7 @@ abstract class CommonObjectLine extends CommonObject * Id of the line * @var int * @deprecated Try to use id property as possible (even if field into database is still rowid) + * @see id */ public $rowid; diff --git a/htdocs/core/class/commonorder.class.php b/htdocs/core/class/commonorder.class.php index b4882af8a58..5309b5524ee 100644 --- a/htdocs/core/class/commonorder.class.php +++ b/htdocs/core/class/commonorder.class.php @@ -43,6 +43,7 @@ abstract class CommonOrderLine extends CommonObjectLine * Product ref * @var string * @deprecated Use product_ref + * @see product_ref */ public $ref; @@ -56,6 +57,7 @@ abstract class CommonOrderLine extends CommonObjectLine * Product label * @var string * @deprecated Use product_label + * @see product_label */ public $libelle; @@ -78,7 +80,9 @@ abstract class CommonOrderLine extends CommonObjectLine public $qty; /** + * Unit price * @deprecated + * @see subprice */ var $price; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 53f77262db1..bdb4f57a4cc 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -376,7 +376,7 @@ class Form * @return string Code html du tooltip (texte+picto) * @see Use function textwithpicto if you can. */ - function textwithtooltip($text, $htmltext, $tooltipon = 1, $direction = 0, $img = '', $extracss = '', $notabs = 0, $incbefore = '', $noencodehtmltext = 0) + function textwithtooltip($text, $htmltext, $tooltipon = 1, $direction = 0, $img = '', $extracss = '', $notabs = 2, $incbefore = '', $noencodehtmltext = 0) { global $conf; @@ -391,14 +391,19 @@ class Form $htmltext=str_replace("\r","",$htmltext); $htmltext=str_replace("\n","",$htmltext); + $extrastyle=''; + if ($direction < 0) { $extracss=($extracss?$extracss.' ':'').'inline-block'; $extrastyle='padding: 0px; padding-left: 3px !important;'; } + if ($direction > 0) { $extracss=($extracss?$extracss.' ':'').'inline-block'; $extrastyle='padding: 0px; padding-right: 3px !important;'; } + $htmltext=str_replace('"',""",$htmltext); - if ($tooltipon == 2 || $tooltipon == 3) $paramfortooltipimg=' class="classfortooltip inline-block'.($extracss?' '.$extracss:'').'" style="padding: 0px;" title="'.($noencodehtmltext?$htmltext:dol_escape_htmltag($htmltext,1)).'"'; // Attribut to put on td img tag to store tooltip - else $paramfortooltipimg =($extracss?' class="'.$extracss.'"':''); // Attribut to put on td text tag - if ($tooltipon == 1 || $tooltipon == 3) $paramfortooltiptd=' class="classfortooltip inline-block'.($extracss?' '.$extracss:'').'" style="padding: 0px;" title="'.($noencodehtmltext?$htmltext:dol_escape_htmltag($htmltext,1)).'"'; // Attribut to put on td tag to store tooltip - else $paramfortooltiptd =($extracss?' class="'.$extracss.'"':''); // Attribut to put on td text tag + if ($tooltipon == 2 || $tooltipon == 3) $paramfortooltipimg=' class="classfortooltip inline-block'.($extracss?' '.$extracss:'').'" style="padding: 0px;'.($extrastyle?' '.$extrastyle:'').'" title="'.($noencodehtmltext?$htmltext:dol_escape_htmltag($htmltext,1)).'"'; // Attribut to put on td img tag to store tooltip + else $paramfortooltipimg =($extracss?' class="'.$extracss.'"':'').($extrastyle?' style="'.$extrastyle.'"':''); // Attribut to put on td text tag + if ($tooltipon == 1 || $tooltipon == 3) $paramfortooltiptd=' class="classfortooltip inline-block'.($extracss?' '.$extracss:'').'" style="padding: 0px;'.($extrastyle?' '.$extrastyle:'').'" title="'.($noencodehtmltext?$htmltext:dol_escape_htmltag($htmltext,1)).'"'; // Attribut to put on td tag to store tooltip + else $paramfortooltiptd =($extracss?' class="'.$extracss.'"':'').($extrastyle?' style="'.$extrastyle.'"':''); // Attribut to put on td text tag $s=""; if (empty($notabs)) $s.=''; elseif ($notabs == 2) $s.='
'; + // Define value if value is before if ($direction < 0) { $s.='<'.$tag.$paramfortooltipimg; if ($tag == 'td') { @@ -407,16 +412,12 @@ class Form $s.= '>'.$img.''; } // Use another method to help avoid having a space in value in order to use this value with jquery - // TODO add this in css - //if ($text != '') $s.='<'.$tag.$paramfortooltiptd.'>'.(($direction < 0)?' ':'').$text.(($direction > 0)?' ':'').''; - $paramfortooltiptd.= (($direction < 0)?' class="inline-block" style="padding: 0px; padding-left: 3px !important;"':''); - $paramfortooltiptd.= (($direction > 0)?' class="inline-block" style="padding: 0px; padding-right: 3px !important;"':''); + // Define label if ((string) $text != '') $s.='<'.$tag.$paramfortooltiptd.'>'.$text.''; + // Define value if value is after if ($direction > 0) { $s.='<'.$tag.$paramfortooltipimg; - if ($tag == 'td') { - $s .= ' valign="middle" width="14"'; - } + if ($tag == 'td') $s .= ' valign="middle" width="14"'; $s.= '>'.$img.''; } if (empty($notabs)) $s.='
'; @@ -437,7 +438,7 @@ class Form * @param int $notabs 0=Include table and tr tags, 1=Do not include table and tr tags, 2=use div, 3=use span * @return string HTML code of text, picto, tooltip */ - function textwithpicto($text, $htmltext, $direction = 1, $type = 'help', $extracss = '', $noencodehtmltext = 0, $notabs = 0) + function textwithpicto($text, $htmltext, $direction = 1, $type = 'help', $extracss = '', $noencodehtmltext = 0, $notabs = 2) { global $conf; @@ -858,6 +859,7 @@ class Form * @param int $limit Maximum number of elements * @return string HTML string with * @deprecated Use select_thirdparty instead + * @see select_thirdparty() */ function select_company($selected='', $htmlname='socid', $filter='', $showempty=0, $showtype=0, $forcecombo=0, $events=array(), $limit=0) { @@ -1227,6 +1229,7 @@ class Form * @param int $force_entity 0 or Id of environment to force * @return void * @deprecated + * @see select_dolusers() */ function select_users($selected='',$htmlname='userid',$show_empty=0,$exclude='',$disabled=0,$include='',$enableonly='',$force_entity=0) { @@ -1248,10 +1251,11 @@ class Form * @param int $showstatus 0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status * @param string $morefilter Add more filters into sql request * @param string $show_every 0=default list, 1=add also a value "Everybody" at beginning of list + * @param string $enableonlytext If option $enableonly is set, we use this text to explain into label why record is disabled. Not used if enableonly is empty. * @return string HTML select string * @see select_dolgroups */ - function select_dolusers($selected='', $htmlname='userid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity=0, $maxlength=0, $showstatus=0, $morefilter='', $show_every=0) + function select_dolusers($selected='', $htmlname='userid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity=0, $maxlength=0, $showstatus=0, $morefilter='', $show_every=0, $enableonlytext='') { global $conf,$user,$langs; @@ -1347,8 +1351,8 @@ class Form $userstatic->lastname=$obj->lastname; $userstatic->firstname=$obj->firstname; - $disableline=0; - if (is_array($enableonly) && count($enableonly) && ! in_array($obj->rowid,$enableonly)) $disableline=1; + $disableline=''; + if (is_array($enableonly) && count($enableonly) && ! in_array($obj->rowid,$enableonly)) $disableline=($enableonlytext?$enableonlytext:'1'); if ((is_object($selected) && $selected->id == $obj->rowid) || (! is_object($selected) && $selected == $obj->rowid)) { @@ -1398,6 +1402,10 @@ class Form } } $out.=($moreinfo?')':''); + if ($disableline && $disableline != '1') + { + $out.=' - '.$disableline; // This is text from $enableonlytext parameter + } $out.= ''; $i++; @@ -1460,7 +1468,7 @@ class Form $assignedtouser=array(); if (!empty($_SESSION['assignedtouser'])) { - $assignedtouser=dol_json_decode($_SESSION['assignedtouser'], true); + $assignedtouser=json_decode($_SESSION['assignedtouser'], true); } $nbassignetouser=count($assignedtouser); @@ -3029,6 +3037,7 @@ class Form * @param int $width Force width of box * @return void * @deprecated + * @see formconfirm() */ function form_confirm($page, $title, $question, $action, $formquestion='', $selectedchoice="", $useajax=0, $height=170, $width=500) { @@ -3086,7 +3095,7 @@ class Form // Now add questions $more.=''."\n"; - $more.=''."\n"; + $more.=''."\n"; foreach ($formquestion as $key => $input) { if (is_array($input) && ! empty($input)) @@ -3095,15 +3104,15 @@ class Form if ($input['type'] == 'text') { - $more.=''."\n"; + $more.=''."\n"; } else if ($input['type'] == 'password') { - $more.=''."\n"; + $more.=''."\n"; } else if ($input['type'] == 'select') { - $more.=''."\n"; @@ -3111,13 +3120,13 @@ class Form else if ($input['type'] == 'checkbox') { $more.=''; - $more.=''; - $more.=''."\n"; } @@ -4248,6 +4257,7 @@ class Form $hourSelected=0; $minSelected=0; + // Hours if ($iSecond != '') { require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; @@ -4278,6 +4288,7 @@ class Form $retstring.=' '.$langs->trans('HourShort'); + // Minutes if ($minunderhours) $retstring.='
'; else $retstring.=" "; @@ -4726,33 +4737,47 @@ class Form //print "paramid=$paramid,morehtml=$morehtml,shownav=$shownav,$fieldid,$fieldref,$morehtmlref,$moreparam"; $object->load_previous_next_ref((isset($object->next_prev_filter)?$object->next_prev_filter:''),$fieldid,$nodbprefix); - $previous_ref = $object->ref_previous?''.(empty($conf->dol_use_jmobile)?img_picto($langs->trans("Previous"),'previous.png'):' ').'':''; - $next_ref = $object->ref_next?''.(empty($conf->dol_use_jmobile)?img_picto($langs->trans("Next"),'next.png'):' ').'':''; + //$previous_ref = $object->ref_previous?''.(empty($conf->dol_use_jmobile)?img_picto($langs->trans("Previous"),'previous.png'):' ').'':''; + //$next_ref = $object->ref_next?''.(empty($conf->dol_use_jmobile)?img_picto($langs->trans("Next"),'next.png'):' ').'':''; + $previous_ref = $object->ref_previous?''.(empty($conf->dol_use_jmobile)?'<':' ').'':''; + $next_ref = $object->ref_next?''.(empty($conf->dol_use_jmobile)?'>':' ').'':''; //print "xx".$previous_ref."x".$next_ref; - if ($previous_ref || $next_ref || $morehtml) { - $ret.='
'.(! empty($formquestion['text'])?$formquestion['text']:'').'
'.(! empty($formquestion['text'])?$formquestion['text']:'').'
'.$input['label'].'
'.$input['label'].'
'.$input['label'].'
'.$input['label'].'
'; + $more.='
'; if (! empty($input['label'])) $more.=$input['label'].''; $more.=$this->selectarray($input['name'],$input['values'],$input['default'],1); $more.='
'.$input['label'].' '; + $more.=''.$input['label'].' '; $more.=''; else $more.=' '; + $more.='
'; + if (! empty($input['label'])) $more.=$input['label'].''; $more.=$input['value']; $more.='
'; - } + //if ($previous_ref || $next_ref || $morehtml) { + //$ret.=''; - $ret.=''; + //$ret.='
'; + $ret.='
'; + //} $ret.=dol_htmlentities($object->$fieldref); if ($morehtmlref) { $ret.=' '.$morehtmlref; } + $ret.='
'; + if ($previous_ref || $next_ref || $morehtml) + { + $ret.='
'.$morehtml; + //$ret.=''.$morehtml; + $ret.='
  • '.$morehtml.'
  • '; } if ($shownav && ($previous_ref || $next_ref)) { - $ret.='
    '.$previous_ref.''.$next_ref; + //$ret.=''.$previous_ref.''.$next_ref; + $ret.=''; + $ret.=''; } if ($previous_ref || $next_ref || $morehtml) { - $ret.='
    '; + //$ret.='
    '; + $ret.=''; } + $ret.=''; + return $ret; } @@ -4794,10 +4819,10 @@ class Form * @param int $width Width of photo * @param int $height Height of photo (auto if 0) * @param int $caneditfield Add edit fields - * @param string $photologo CSS name to use on img for photo + * @param string $cssclass CSS name to use on img for photo * @return string HTML code to output photo */ - static function showphoto($modulepart,$object,$width=100,$height=0,$caneditfield=0,$cssclass='photowithmargin') + static function showphoto($modulepart, $object, $width=100, $height=0, $caneditfield=0, $cssclass='photowithmargin') { global $conf,$langs; diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index 05200feee30..a005fb2b228 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -423,6 +423,7 @@ class FormCompany * @param string $filter Add a SQL filter on list * @return void * @deprecated Use print xxx->select_juridicalstatus instead + * @see select_juridicalstatus() */ function select_forme_juridique($selected='', $country_codeid=0, $filter='') { @@ -513,7 +514,7 @@ class FormCompany } } $out.= ''; - if ($user->admin) $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); + if ($user->admin) $out.= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); // Make select dynamic include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 926ee8a337a..2fea621626e 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -249,7 +249,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 Obsolete, see getDocumentsLink + * @param int $iconPDF Deprecated, 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 @@ -261,6 +261,11 @@ class FormFile */ function showdocuments($modulepart,$modulesubdir,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$allowgenifempty=1,$forcenomultilang=0,$iconPDF=0,$maxfilenamelength=28,$noform=0,$param='',$title='',$buttonlabel='',$codelang='',$morepicto='') { + // Deprecation warning + if (0 !== $iconPDF) { + dol_syslog(__METHOD__ . ": passing iconPDF parameter is deprecated", LOG_WARNING); + } + global $langs, $conf, $user, $hookmanager; global $form, $bc; diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index b9d5048db74..4e1a8ffc0c5 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -48,7 +48,16 @@ class FormMail extends Form var $withsubstit; // Show substitution array var $withfrom; - var $withto; // Show recipient emails + /** + * @var int + * @deprecated Fill withto with array before calling method. + * @see withto + */ + public $withtosocid; + /** + * @var int|int[] + */ + public $withto; // Show recipient emails var $withtofree; // Show free text for recipient emails var $withtocc; var $withtoccc; @@ -275,7 +284,7 @@ class FormMail extends Form $out.= "\n\n"; if ($this->withform == 1) { - $out.= '
    '."\n"; + $out.= ''."\n"; $out.= ''; $out.= ''; $out.= ''; @@ -703,6 +712,23 @@ class FormMail extends Form $out.= ''."\n"; if ($this->withform == 1) $out.= '
    '."\n"; + + // Disable enter key if option MAIN_MAILFORM_DISABLE_ENTER is set + if (! empty($conf->global->MAIN_MAILFORM_DISABLE_ENTERKEY)) + { + $out.= ''; + } + $out.= "\n"; return $out; diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 08c19463d27..5c2a3bc9274 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -592,6 +592,7 @@ class FormOther * @param array $arrayofcolors Array of colors. Example: array('29527A','5229A3','A32929','7A367A','B1365F','0D7813') * @return void * @deprecated + * @see selectColor() */ function select_color($set_color='', $prefix='f_color', $form_name='', $showcolorbox=1, $arrayofcolors='') { @@ -611,6 +612,11 @@ class FormOther */ function selectColor($set_color='', $prefix='f_color', $form_name='', $showcolorbox=1, $arrayofcolors='', $morecss='') { + // Deprecation warning + if ($form_name) { + dol_syslog(__METHOD__ . ": form_name parameter is deprecated", LOG_WARNING); + } + global $langs,$conf; $out=''; diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index 9469b680631..681c667854f 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -147,13 +147,15 @@ class FormProjets $labeltoshow.=' - '.$langs->trans("LinkedToAnotherCompany"); } - if (!empty($selected) && $selected == $obj->rowid && $obj->fk_statut > 0) + if (!empty($selected) && $selected == $obj->rowid) { - $out.= ''; + $out.= '