diff --git a/ChangeLog b/ChangeLog index 1529a25943d..43f9e3c6859 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,7 +2,7 @@ English Dolibarr ChangeLog -------------------------------------------------------------- -***** ChangeLog for 3.5 compared to 3.4 ***** +***** ChangeLog for 3.5 compared to 3.4.* ***** For users: - New: [ task #862 ] Add ODT on shipments - New: [ task #149 ] Add # of notes and attachments in tabs @@ -78,7 +78,7 @@ this was not a good pratice, since object->id is already known so no need to pro parameter. All methods addline in this case were modified to remove this information. -***** ChangeLog for 3.4 compared to 3.3.2 ***** +***** ChangeLog for 3.4 compared to 3.3.* ***** For users: - New: Can use ODS templates as document templates. - New: Add link to autofill/reset with quantity to ship when creating a @@ -168,6 +168,8 @@ WARNING: If you used external modules, some of them may need to be upgraded due function to keep same behaviour. +***** ChangeLog for 3.3.4 compared to 3.3.3 ***** +- Fix: [ bug #1001 ] Social Contribution : State not correct ***** ChangeLog for 3.3.3 compared to 3.3.2 ***** - Fix: [ bug #903 ] Fatal error: Call to undefined function dol_get_first_day() in htdocs/commande/liste.php @@ -212,7 +214,7 @@ WARNING: If you used external modules, some of them may need to be upgraded due - Fix: [ bug #762 ] Bad profit calculation in Reporting - Fix: bug dictionnary with wrong prefix table -***** ChangeLog for 3.3 compared to 3.2.3 ***** +***** ChangeLog for 3.3 compared to 3.2.* ***** For users: - New: Add holiday module, to declare and follow holidays of your employees. - New: Add margin management module. @@ -390,7 +392,7 @@ Dolibarr license has also been updated from GPLv2+ to GPLv3+. -***** ChangeLog for 3.2.0 compared to 3.1.3 ***** +***** ChangeLog for 3.2.0 compared to 3.1.* ***** WARNING: PHP lower than 5.x are no more supported. WARNING: Because of a major datastructure change onto supplier prices tables, be aware to make a backup of your database before making upgrade. @@ -631,7 +633,7 @@ For translators: -***** ChangeLog for 3.0 compared to 2.9 ***** +***** ChangeLog for 3.0 compared to 2.9.* ***** For users: - New: Can edit date of cheque receipts. @@ -727,7 +729,7 @@ For developers: - Qual: Removed deprecated code. -***** ChangeLog for 2.9 compared to 2.8 ***** +***** ChangeLog for 2.9 compared to 2.8.* ***** For users: - New: POS module allow to choose which warehouse to use. @@ -845,7 +847,7 @@ For users: - Fix: bug #29526 : Numérotation Proposition Incorrecte après duplication -***** ChangeLog for 2.8 compared to 2.7 ***** +***** ChangeLog for 2.8 compared to 2.7.* ***** For users: - New: Support note on trips module @@ -909,7 +911,7 @@ For users: - Fix: Update member photo. -***** ChangeLog for 2.7 compared to 2.6 ***** +***** ChangeLog for 2.7 compared to 2.6.* ***** For users: - New: Add a print icon to show a page to print without menus. @@ -1008,7 +1010,7 @@ For developers: - All install files are now in same directory /install. -***** ChangeLog for 2.6 compared to 2.5 ***** +***** ChangeLog for 2.6 compared to 2.5.* ***** For users: - New: Add filter on status in emailing selector for Dolibarr users. @@ -1091,7 +1093,7 @@ For developers: - First change for future geoip module. -***** ChangeLog for 2.5 compared to 2.4 ***** +***** ChangeLog for 2.5 compared to 2.4.* ***** For users: - Sessions timeout can be configured to overwrite PHP setup. @@ -1155,7 +1157,7 @@ For developers: -***** ChangeLog for 2.4 compared to 2.2 ***** +***** ChangeLog for 2.4 compared to 2.2.* ***** For users: - Add a calendar module (module agenda) with ical/vcal/rss export. @@ -1210,7 +1212,7 @@ For developers: Windows with Apache and Mysql included. -***** ChangeLog for 2.2 compared to 2.1 ***** +***** ChangeLog for 2.2 compared to 2.1.* ***** - Add more statistics on main page. - Add option to add message on login page. @@ -1244,7 +1246,7 @@ For developers: - Can drag and drop boxes on main page. -***** ChangeLog for 2.1 compared to 2.0.1 ***** +***** ChangeLog for 2.1 compared to 2.0.* ***** - Added a better installer. - Support user and groups permissions. @@ -1315,7 +1317,7 @@ Minor bug fixes -***** ChangeLog for 2.0 compared to 1.0 ***** +***** ChangeLog for 2.0 compared to 1.0.* ***** ChangeLog file size is so important, that it is not included inside Dolibarr package. You can find it at www.dolibarr.org diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php index 1e70df2da8d..7c92bd18623 100644 --- a/htdocs/adherents/fiche.php +++ b/htdocs/adherents/fiche.php @@ -914,7 +914,7 @@ else // Login Dolibarr print ''.$langs->trans("LinkedToDolibarrUser").''; - print $form->select_users($object->user_id,'userid',1); + print $form->select_dolusers($object->user_id,'userid',1); print ''; */ diff --git a/htdocs/adherents/stats/index.php b/htdocs/adherents/stats/index.php index 01d0a3b04b9..33cc80b4b93 100644 --- a/htdocs/adherents/stats/index.php +++ b/htdocs/adherents/stats/index.php @@ -155,7 +155,7 @@ $filter='s.client in (1,2,3)'; print $form->select_company($id,'memberid',$filter,1); print ''; print ''.$langs->trans("User").''; -print $form->select_users($userid,'userid',1); +print $form->select_dolusers($userid,'userid',1); print ''; print ''; print ''; diff --git a/htdocs/admin/prelevement.php b/htdocs/admin/prelevement.php index 2e21c3cfb4c..0c87c347e5c 100644 --- a/htdocs/admin/prelevement.php +++ b/htdocs/admin/prelevement.php @@ -142,7 +142,7 @@ print ""; print ''.$langs->trans("ResponsibleUser").''; print ''; print ''; -print $form->select_users($conf->global->PRELEVEMENT_USER,'value0',1); +print $form->select_dolusers($conf->global->PRELEVEMENT_USER,'value0',1); print ''; print ''; diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 56091c694b0..235e6e7ef9b 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -331,7 +331,7 @@ else if ($action == 'add' && $user->rights->propal->creer) $object->origin = GETPOST('origin'); $object->origin_id = GETPOST('originid'); - for ($i = 1 ; $i <= $conf->global->PRODUCT_SHOW_WHEN_CREATE; $i++) + for ($i = 1; $i <= $conf->global->PRODUCT_SHOW_WHEN_CREATE; $i++) { if ($_POST['idprod'.$i]) { @@ -344,55 +344,61 @@ else if ($action == 'add' && $user->rights->propal->creer) // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels,$object); - - $id = $object->create($user); + if($ret < 0) { + $error++; + $action = 'create'; + } } - if ($id > 0) - { - // Insertion contact par defaut si defini - if (GETPOST('contactidp') > 0) - { - $result=$object->add_contact(GETPOST('contactidp'),'CUSTOMER','external'); - if ($result < 0) - { - $error++; - setEventMessage($langs->trans("ErrorFailedToAddContact"), 'errors'); - } - } + if(!$error) { + $id = $object->create($user); - if (! $error) + if ($id > 0) { - $db->commit(); - - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + // Insertion contact par defaut si defini + if (GETPOST('contactidp') > 0) { - // Define output language - $outputlangs = $langs; - if (! empty($conf->global->MAIN_MULTILANGS)) + $result=$object->add_contact(GETPOST('contactidp'),'CUSTOMER','external'); + if ($result < 0) { - $outputlangs = new Translate("",$conf); - $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); - $outputlangs->setDefaultLang($newlang); + $error++; + setEventMessage($langs->trans("ErrorFailedToAddContact"), 'errors'); } - $ret=$object->fetch($id); // Reload to get new records - propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); } - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); - exit; + if (! $error) + { + $db->commit(); + + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + // Define output language + $outputlangs = $langs; + if (! empty($conf->global->MAIN_MULTILANGS)) + { + $outputlangs = new Translate("",$conf); + $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); + $outputlangs->setDefaultLang($newlang); + } + $ret=$object->fetch($id); // Reload to get new records + propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); + } + + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); + exit; + } + else + { + $db->rollback(); + } } else { + dol_print_error($db,$object->error); $db->rollback(); + exit; } } - else - { - dol_print_error($db,$object->error); - $db->rollback(); - exit; - } } } @@ -1150,24 +1156,30 @@ else if ($action == 'update_extras') $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); $ret = $extrafields->setOptionalsFromPost($extralabels,$object); - // Actions on extra fields (by external module or standard code) - // FIXME le hook fait double emploi avec le trigger !! - $hookmanager->initHooks(array('propaldao')); - $parameters=array('id'=>$object->id); - $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks - if (empty($reshook)) - { - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if($ret < 0) { + $error++; + $action = 'edit_extras'; + } + + if(!$error) { + // Actions on extra fields (by external module or standard code) + // FIXME le hook fait double emploi avec le trigger !! + $hookmanager->initHooks(array('propaldao')); + $parameters=array('id'=>$object->id); + $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks + if (empty($reshook)) { - $result=$object->insertExtraFields(); - if ($result < 0) + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used { - $error++; + $result=$object->insertExtraFields(); + if ($result < 0) + { + $error++; + } } } + else if ($reshook < 0) $error++; } - else if ($reshook < 0) $error++; - } if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->propal->creer) diff --git a/htdocs/comm/propal/stats/index.php b/htdocs/comm/propal/stats/index.php index 9887af77d38..b3b8379afc3 100644 --- a/htdocs/comm/propal/stats/index.php +++ b/htdocs/comm/propal/stats/index.php @@ -235,7 +235,7 @@ print '
'; print ''; // User print ''.$langs->trans("CreatedBy").''; - print $form->select_users($userid,'userid',1); + print $form->select_dolusers($userid,'userid',1); print ''; // Year print ''.$langs->trans("Year").''; diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 89b2fe5181e..8f710dadca4 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -274,124 +274,137 @@ else if ($action == 'add' && $user->rights->commande->creer) // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels,$object); + if($ret < 0) + $error++; - $object_id = $object->create($user); + if(!$error) { + $object_id = $object->create($user); - if ($object_id > 0) - { - dol_include_once('/'.$element.'/class/'.$subelement.'.class.php'); - - $classname = ucfirst($subelement); - $srcobject = new $classname($db); - - dol_syslog("Try to find source object origin=".$object->origin." originid=".$object->origin_id." to add lines"); - $result=$srcobject->fetch($object->origin_id); - if ($result > 0) + if ($object_id > 0) { - $lines = $srcobject->lines; - if (empty($lines) && method_exists($srcobject,'fetch_lines')) $lines = $srcobject->fetch_lines(); + dol_include_once('/'.$element.'/class/'.$subelement.'.class.php'); - $fk_parent_line=0; - $num=count($lines); + $classname = ucfirst($subelement); + $srcobject = new $classname($db); - for ($i=0;$i<$num;$i++) + dol_syslog("Try to find source object origin=".$object->origin." originid=".$object->origin_id." to add lines"); + $result=$srcobject->fetch($object->origin_id); + if ($result > 0) { - $label=(! empty($lines[$i]->label)?$lines[$i]->label:''); - $desc=(! empty($lines[$i]->desc)?$lines[$i]->desc:$lines[$i]->libelle); - $product_type=(! empty($lines[$i]->product_type)?$lines[$i]->product_type:0); + $lines = $srcobject->lines; + if (empty($lines) && method_exists($srcobject,'fetch_lines')) $lines = $srcobject->fetch_lines(); - // Dates - // TODO mutualiser - $date_start=$lines[$i]->date_debut_prevue; - if ($lines[$i]->date_debut_reel) $date_start=$lines[$i]->date_debut_reel; - if ($lines[$i]->date_start) $date_start=$lines[$i]->date_start; - $date_end=$lines[$i]->date_fin_prevue; - if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel; - if ($lines[$i]->date_end) $date_end=$lines[$i]->date_end; + $fk_parent_line=0; + $num=count($lines); - // Reset fk_parent_line for no child products and special product - if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) { - $fk_parent_line = 0; - } - - //Extrafields - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i],'fetch_optionals') ) // For avoid conflicts if trigger used + for ($i=0;$i<$num;$i++) { - $lines[$i]->fetch_optionals($lines[$i]->rowid); - $array_option=$lines[$i]->array_options; + $label=(! empty($lines[$i]->label)?$lines[$i]->label:''); + $desc=(! empty($lines[$i]->desc)?$lines[$i]->desc:$lines[$i]->libelle); + $product_type=(! empty($lines[$i]->product_type)?$lines[$i]->product_type:0); + + // Dates + // TODO mutualiser + $date_start=$lines[$i]->date_debut_prevue; + if ($lines[$i]->date_debut_reel) $date_start=$lines[$i]->date_debut_reel; + if ($lines[$i]->date_start) $date_start=$lines[$i]->date_start; + $date_end=$lines[$i]->date_fin_prevue; + if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel; + if ($lines[$i]->date_end) $date_end=$lines[$i]->date_end; + + // Reset fk_parent_line for no child products and special product + if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) { + $fk_parent_line = 0; + } + + //Extrafields + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i],'fetch_optionals') ) // For avoid conflicts if trigger used + { + $lines[$i]->fetch_optionals($lines[$i]->rowid); + $array_option=$lines[$i]->array_options; + } + + $result = $object->addline( + $desc, + $lines[$i]->subprice, + $lines[$i]->qty, + $lines[$i]->tva_tx, + $lines[$i]->localtax1_tx, + $lines[$i]->localtax2_tx, + $lines[$i]->fk_product, + $lines[$i]->remise_percent, + $lines[$i]->info_bits, + $lines[$i]->fk_remise_except, + 'HT', + 0, + $date_start, + $date_end, + $product_type, + $lines[$i]->rang, + $lines[$i]->special_code, + $fk_parent_line, + $lines[$i]->fk_fournprice, + $lines[$i]->pa_ht, + $label, + $array_option + ); + + if ($result < 0) + { + $error++; + break; + } + + // Defined the new fk_parent_line + if ($result > 0 && $lines[$i]->product_type == 9) { + $fk_parent_line = $result; + } } - $result = $object->addline( - $desc, - $lines[$i]->subprice, - $lines[$i]->qty, - $lines[$i]->tva_tx, - $lines[$i]->localtax1_tx, - $lines[$i]->localtax2_tx, - $lines[$i]->fk_product, - $lines[$i]->remise_percent, - $lines[$i]->info_bits, - $lines[$i]->fk_remise_except, - 'HT', - 0, - $date_start, - $date_end, - $product_type, - $lines[$i]->rang, - $lines[$i]->special_code, - $fk_parent_line, - $lines[$i]->fk_fournprice, - $lines[$i]->pa_ht, - $label, - $array_option - ); - - if ($result < 0) - { - $error++; - break; - } - - // Defined the new fk_parent_line - if ($result > 0 && $lines[$i]->product_type == 9) { - $fk_parent_line = $result; - } + // Hooks + $parameters=array('objFrom'=>$srcobject); + $reshook=$hookmanager->executeHooks('createFrom',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + if ($reshook < 0) $error++; + } + else + { + $mesg=$srcobject->error; + $error++; } - - // Hooks - $parameters=array('objFrom'=>$srcobject); - $reshook=$hookmanager->executeHooks('createFrom',$parameters,$object,$action); // Note that $action and $object may have been modified by hook - if ($reshook < 0) $error++; } else { - $mesg=$srcobject->error; + $mesg=$object->error; $error++; } } else { - $mesg=$object->error; - $error++; + // Required extrafield left blank, error message already defined by setOptionalsFromPost() + $action='create'; } } else { // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels,$object); + if($ret < 0) + $error++; - $object_id = $object->create($user); + if(!$error) { + $object_id = $object->create($user); - // If some invoice's lines already known - $NBLINES=8; - for ($i = 1 ; $i <= $NBLINES ; $i++) - { - if ($_POST['idprod'.$i]) + // If some invoice's lines already known + $NBLINES=8; + for ($i = 1 ; $i <= $NBLINES ; $i++) { - $xid = 'idprod'.$i; - $xqty = 'qty'.$i; - $xremise = 'remise_percent'.$i; - $object->add_product($_POST[$xid],$_POST[$xqty],$_POST[$xremise]); + if ($_POST['idprod'.$i]) + { + $xid = 'idprod'.$i; + $xqty = 'qty'.$i; + $xremise = 'remise_percent'.$i; + $object->add_product($_POST[$xid],$_POST[$xqty],$_POST[$xremise]); + } } } } @@ -1167,23 +1180,32 @@ else if ($action == 'update_extras') $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); $ret = $extrafields->setOptionalsFromPost($extralabels,$object); - // Actions on extra fields (by external module or standard code) - // FIXME le hook fait double emploi avec le trigger !! - $hookmanager->initHooks(array('orderdao')); - $parameters=array('id'=>$object->id); - $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks - if (empty($reshook)) - { - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if($ret < 0) + $error++; + + if(!$error) { + // Actions on extra fields (by external module or standard code) + // FIXME le hook fait double emploi avec le trigger !! + $hookmanager->initHooks(array('orderdao')); + $parameters=array('id'=>$object->id); + $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks + if (empty($reshook)) { - $result=$object->insertExtraFields(); - if ($result < 0) + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used { - $error++; + $result=$object->insertExtraFields(); + if ($result < 0) + { + $error++; + } } } + else if ($reshook < 0) $error++; + } + else + { + $action = 'edit_extras'; } - else if ($reshook < 0) $error++; } @@ -1372,7 +1394,7 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G } } -if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->commande->creer) +if (! $error && ! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->commande->creer) { if ($action == 'addcontact') { diff --git a/htdocs/commande/stats/index.php b/htdocs/commande/stats/index.php index 57354926865..31cb0566934 100644 --- a/htdocs/commande/stats/index.php +++ b/htdocs/commande/stats/index.php @@ -257,7 +257,7 @@ print '
'; print ''; // User print ''.$langs->trans("CreatedBy").''; - print $form->select_users($userid,'userid',1); + print $form->select_dolusers($userid,'userid',1); print ''; // Year print ''.$langs->trans("Year").''; diff --git a/htdocs/compta/deplacement/fiche.php b/htdocs/compta/deplacement/fiche.php index bc2795e554f..e82d962053d 100644 --- a/htdocs/compta/deplacement/fiche.php +++ b/htdocs/compta/deplacement/fiche.php @@ -280,7 +280,7 @@ if ($action == 'create') print ""; print ''.$langs->trans("Person").''; - print $form->select_users(GETPOST('fk_user','int'),'fk_user',1); + print $form->select_dolusers(GETPOST('fk_user','int'),'fk_user',1); print ''; print ""; @@ -375,7 +375,7 @@ else if ($id) // Who print ""; print ''.$langs->trans("Person").''; - print $form->select_users(GETPOST('fk_user','int')?GETPOST('fk_user','int'):$object->fk_user,'fk_user',0); + print $form->select_dolusers(GETPOST('fk_user','int')?GETPOST('fk_user','int'):$object->fk_user,'fk_user',0); print ''; // Date diff --git a/htdocs/compta/deplacement/stats/index.php b/htdocs/compta/deplacement/stats/index.php index 3112c5aebed..cd52ada8220 100755 --- a/htdocs/compta/deplacement/stats/index.php +++ b/htdocs/compta/deplacement/stats/index.php @@ -220,7 +220,7 @@ print $form->select_company($socid,'socid',$filter,1,1); print ''; // User print ''.$langs->trans("User").'/'.$langs->trans("SalesRepresentative").''; -print $form->select_users($userid,'userid',1); +print $form->select_dolusers($userid,'userid',1); print ''; // Year print ''.$langs->trans("Year").''; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 33e27fdb1e9..c3590cb94a5 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -661,7 +661,8 @@ else if ($action == 'add' && $user->rights->facture->creer) // Fill array 'array_options' with data from add form $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); $ret = $extrafields->setOptionalsFromPost($extralabels,$object); - + if($ret < 0) + $error++; // Replacement invoice if ($_POST['type'] == 1) @@ -1906,24 +1907,32 @@ if ($action == 'update_extras') // Fill array 'array_options' with data from add form $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); $ret = $extrafields->setOptionalsFromPost($extralabels,$object); + if($ret < 0) + $error++; - // Actions on extra fields (by external module or standard code) - // FIXME le hook fait double emploi avec le trigger !! - $hookmanager->initHooks(array('invoicedao')); - $parameters=array('id'=>$object->id); - $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks - if (empty($reshook)) - { - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if(!$error) { + // Actions on extra fields (by external module or standard code) + // FIXME le hook fait double emploi avec le trigger !! + $hookmanager->initHooks(array('invoicedao')); + $parameters=array('id'=>$object->id); + $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks + if (empty($reshook)) { - $result=$object->insertExtraFields(); - if ($result < 0) + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used { - $error++; + $result=$object->insertExtraFields(); + if ($result < 0) + { + $error++; + } } } + else if ($reshook < 0) $error++; + } + else + { + $action = 'edit_extras'; } - else if ($reshook < 0) $error++; } diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php index af4ff83cd54..211bc355cc6 100644 --- a/htdocs/compta/facture/stats/index.php +++ b/htdocs/compta/facture/stats/index.php @@ -235,7 +235,7 @@ print '
'; print ''; // User print ''.$langs->trans("CreatedBy").''; - print $form->select_users($userid,'userid',1); + print $form->select_dolusers($userid,'userid',1); print ''; // Year print ''.$langs->trans("Year").''; diff --git a/htdocs/compta/payment_sc/fiche.php b/htdocs/compta/payment_sc/fiche.php index c8d710e2831..0ad3eaf8622 100644 --- a/htdocs/compta/payment_sc/fiche.php +++ b/htdocs/compta/payment_sc/fiche.php @@ -262,7 +262,7 @@ if ($resql) // Expected to pay print ''.price($objp->sc_amount).''; // Status - print ''.$socialcontrib->LibStatut($objp->fk_statut,2).''; + print ''.$socialcontrib->getLibStatut(4).''; // Amount payed print ''.price($objp->amount).''; print "\n"; diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php index 4989fc98440..3cc5824ddc5 100644 --- a/htdocs/contrat/fiche.php +++ b/htdocs/contrat/fiche.php @@ -850,12 +850,12 @@ if ($action == 'create') // Commercial suivi print ''.$langs->trans("TypeContact_contrat_internal_SALESREPFOLL").''; - print $form->select_users(GETPOST("commercial_suivi_id")?GETPOST("commercial_suivi_id"):$user->id,'commercial_suivi_id',1,''); + print $form->select_dolusers(GETPOST("commercial_suivi_id")?GETPOST("commercial_suivi_id"):$user->id,'commercial_suivi_id',1,''); print ''; // Commercial signature print ''.$langs->trans("TypeContact_contrat_internal_SALESREPSIGN").''; - print $form->select_users(GETPOST("commercial_signature_id")?GETPOST("commercial_signature_id"):$user->id,'commercial_signature_id',1,''); + print $form->select_dolusers(GETPOST("commercial_signature_id")?GETPOST("commercial_signature_id"):$user->id,'commercial_signature_id',1,''); print ''; print ''.$langs->trans("Date").''; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 4cb0f68959e..f4645721185 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2254,6 +2254,10 @@ abstract class CommonObject { $value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$this->db->jdate($this->array_options['options_'.$key]); } + + if($extrafields->attribute_required[$key]) + $label = ''.$label.''; + $out .= ''.$label.''; $out .=''; diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index da4ba612f01..051c9950fd2 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -23,13 +23,13 @@ /** * \file htdocs/core/class/extrafields.class.php -* \ingroup core -* \brief File of class to manage extra fields -*/ + * \ingroup core + * \brief File of class to manage extra fields + */ /** * Class to manage standard extra fields -*/ + */ class ExtraFields { var $db; @@ -683,16 +683,18 @@ class ExtraFields } elseif ($type == 'sellist') { + $out=''; } @@ -993,7 +993,9 @@ class ExtraFields */ function setOptionalsFromPost($extralabels,&$object) { - global $_POST; + global $_POST, $langs; + $nofillrequired='';// For error when required field left blank + $error_field_required = array(); if (is_array($extralabels)) { @@ -1001,6 +1003,11 @@ class ExtraFields foreach ($extralabels as $key => $value) { $key_type = $this->attribute_type[$key]; + if($this->attribute_required[$key] && !GETPOST("options_$key",2)) + { + $nofillrequired++; + $error_field_required[] = $value; + } if (in_array($key_type,array('date','datetime'))) { @@ -1028,7 +1035,14 @@ class ExtraFields $object->array_options["options_".$key]=$value_key; } - return 1; + if($nofillrequired) { + $langs->load('errors'); + setEventMessage($langs->trans('ErrorFieldsRequired').' : '.implode(', ',$error_field_required),'errors'); + return -1; + } + else { + return 1; + } } else { return 0; @@ -1080,4 +1094,4 @@ class ExtraFields return 0; } } -} \ No newline at end of file +} diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 625e068ec2a..60ac2cf0571 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1061,6 +1061,7 @@ class Form * @param int $enableonly Array list of users id to be enabled. All other must be disabled * @param int $force_entity 0 or Id of environment to force * @return void + * @deprecated */ function select_users($selected='',$htmlname='userid',$show_empty=0,$exclude='',$disabled=0,$include='',$enableonly='',$force_entity=0) { @@ -1079,9 +1080,10 @@ class Form * @param array $enableonly Array list of users id to be enabled. All other must be disabled * @param int $force_entity 0 or Id of environment to force * @param int $maxlength Maximum length of string into list (0=no limit) + * @param int $showstatus Show user status into label * @return string HTML select string */ - function select_dolusers($selected='', $htmlname='userid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity=0, $maxlength=0) + function select_dolusers($selected='', $htmlname='userid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity=0, $maxlength=0, $showstatus=0) { global $conf,$user,$langs; @@ -1142,7 +1144,7 @@ class Form while ($i < $num) { $obj = $this->db->fetch_object($resql); - + $userstatic->id=$obj->rowid; $userstatic->lastname=$obj->lastname; $userstatic->firstname=$obj->firstname; @@ -1164,13 +1166,10 @@ class Form } $out.= $userstatic->getFullName($langs, 0, 0, $maxlength); - if ($obj->statut == 1) + if ($showstatus) { - $out.=" (".$langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4').")"; - } - else - { - $out.=" (".$langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5').")"; + if ($obj->statut == 1) $out.=" (".$langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4').")"; + else $out.=" (".$langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5').")"; } if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity) @@ -1182,7 +1181,7 @@ class Form //if ($obj->admin) $out.= ' *'; if (! empty($conf->global->MAIN_SHOW_LOGIN)) $out.= ' ('.$obj->login.')'; $out.= ''; - + $i++; } } diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 6ab8a204437..bc1eefcce3b 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -347,9 +347,10 @@ class FormOther * @param string $selected Preselected value * @param string $htmlname Name of combo list (example: 'search_sale') * @param User $user Object user + * @param int $showstatus Show user status into label * @return string Html combo list code */ - function select_salesrepresentatives($selected,$htmlname,$user) + function select_salesrepresentatives($selected,$htmlname,$user,$showstatus=0) { global $conf,$langs; $langs->load('users'); @@ -385,13 +386,11 @@ class FormOther if ($obj_usr->rowid == $selected) $moreforfilter.=' selected="selected"'; $moreforfilter.='>'; - if ($obj_usr->statut == 1) - { - $moreforfilter.=$obj_usr->firstname." ".$obj_usr->name." (".$obj_usr->login.')'." ". img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); - } - else - { - $moreforfilter.=$obj_usr->firstname." ".$obj_usr->name." (".$obj_usr->login.')'." ". img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); + $moreforfilter.=dolGetFirstLastname($obj_usr->firstname,$obj_usr->name)." (".$obj_usr->login.')'; + if ($showstatus) + { + if ($obj_usr->statut == 1) $moreforfilter.=" ". img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); + else $moreforfilter.=" ". img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); } $moreforfilter.=''; } diff --git a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php index 995815a0724..8f37976f3b1 100644 --- a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php +++ b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php @@ -787,6 +787,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L'); } + $pdf->SetTextColor(0,0,60); } /** diff --git a/htdocs/fourn/commande/liste.php b/htdocs/fourn/commande/liste.php index a65e19137ee..478bf76f86f 100644 --- a/htdocs/fourn/commande/liste.php +++ b/htdocs/fourn/commande/liste.php @@ -132,12 +132,12 @@ if ($resql) print '
'; print ''; print ''; - print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"cf.ref","","",'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","",'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Author"),$_SERVER["PHP_SELF"],"u.login","","",'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"total_ttc","","",'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("OrderDate"),$_SERVER["PHP_SELF"],"dc","","",'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"cf.fk_statut","","",'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"cf.ref","",$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","",$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Author"),$_SERVER["PHP_SELF"],"u.login","",$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"total_ttc","",$param,$sortfield,$sortorder); + print_liste_field_titre($langs->trans("OrderDate"),$_SERVER["PHP_SELF"],"dc","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"cf.fk_statut","",$param,'align="right"',$sortfield,$sortorder); print "\n"; print ''; diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php index bb46a1291a6..1cf37e77d6f 100644 --- a/htdocs/holiday/define_holiday.php +++ b/htdocs/holiday/define_holiday.php @@ -137,7 +137,7 @@ if($cp_events == 1) print $langs->trans('MotifCP').' : '; print $holiday->selectEventCP(); print '   '.$langs->trans('UserCP').' : '; - print $form->select_users('',"userCP",1,"",0,''); + print $form->select_dolusers('',"userCP",1,"",0,''); print ' '; print '
'; diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index fc29a748dbe..60a85d4b626 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -299,7 +299,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->socie print ''; print ''; // Date start diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 2b6306b5afd..41f19aef127 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -323,7 +323,7 @@ if ($id > 0 || ! empty($ref)) print ''; // Note @@ -412,7 +412,7 @@ if ($id > 0 || ! empty($ref)) print '
'.$langs->trans("AffectedTo").''; - print $form->select_users($user->id,'userid',1); + print $form->select_dolusers($user->id,'userid',1); print '
'; $contactoftask=$object->getListContactId('internal'); print img_object('','user'); - print $form->select_users($_POST["userid"]?$_POST["userid"]:$user->id,'userid',0,'',0,'',$contactoftask); + print $form->select_dolusers($_POST["userid"]?$_POST["userid"]:$user->id,'userid',0,'',0,'',$contactoftask); print ''; if ($_GET['action'] == 'editline' && $_GET['lineid'] == $task_time->rowid) { - print $form->select_users($task_time->fk_user,'userid_line'); + print $form->select_dolusers($task_time->fk_user,'userid_line'); } else {