From 1820649175451d34a84f29ad1ea6c5e29aed161f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Jun 2017 16:44:04 +0200 Subject: [PATCH] Maxi debug of v6 --- htdocs/accountancy/index.php | 24 +- htdocs/adherents/card.php | 111 ++++---- htdocs/adherents/subscription.php | 28 +- htdocs/adherents/type.php | 14 +- htdocs/admin/dict.php | 54 ++-- htdocs/categories/edit.php | 1 + htdocs/categories/viewcat.php | 23 +- htdocs/comm/action/card.php | 82 ++---- htdocs/comm/card.php | 75 +++-- htdocs/comm/mailing/advtargetemailing.php | 11 +- htdocs/comm/mailing/card.php | 69 +++-- htdocs/comm/propal/card.php | 127 +++------ htdocs/commande/card.php | 86 +++--- htdocs/commande/orderstoinvoice.php | 31 +-- htdocs/compta/bank/card.php | 101 +++---- htdocs/compta/bank/various_payment/card.php | 16 +- htdocs/compta/deplacement/card.php | 24 +- htdocs/compta/facture/card.php | 133 +++++---- htdocs/compta/localtax/card.php | 22 +- htdocs/compta/prelevement/bons.php | 31 +-- htdocs/compta/prelevement/create.php | 10 +- htdocs/compta/prelevement/index.php | 6 +- htdocs/compta/prelevement/list.php | 36 +-- htdocs/compta/salaries/card.php | 26 +- htdocs/compta/tva/card.php | 15 +- htdocs/contact/card.php | 56 ++-- htdocs/contrat/card.php | 258 +++++++++--------- htdocs/core/class/commonobject.class.php | 234 ++++++++-------- htdocs/core/class/extrafields.class.php | 38 ++- htdocs/core/tpl/extrafields_view.tpl.php | 90 ++++-- htdocs/don/card.php | 38 +-- htdocs/expedition/card.php | 224 +++++++-------- htdocs/fourn/card.php | 71 +++-- htdocs/fourn/commande/card.php | 43 ++- htdocs/fourn/commande/orderstoinvoice.php | 27 +- htdocs/fourn/facture/card.php | 38 +-- htdocs/fourn/product/list.php | 132 ++++++--- htdocs/langs/en_US/admin.lang | 2 +- htdocs/langs/en_US/main.lang | 2 +- htdocs/langs/en_US/withdrawals.lang | 2 +- .../template/class/myobject.class.php | 49 ++-- .../core/modules/modMyModule.class.php | 39 ++- .../modulebuilder/template/myobject_card.php | 75 +++-- .../modulebuilder/template/myobject_list.php | 123 ++++----- htdocs/product/card.php | 82 +++--- htdocs/product/document.php | 23 +- htdocs/product/stock/product.php | 92 +++---- htdocs/projet/class/project.class.php | 52 ++-- htdocs/projet/class/task.class.php | 3 + htdocs/projet/tasks/task.php | 11 +- htdocs/resource/add.php | 2 +- htdocs/resource/card.php | 35 +-- htdocs/societe/card.php | 80 +++--- htdocs/societe/class/societe.class.php | 49 ++-- htdocs/societe/commerciaux.php | 19 +- htdocs/societe/consumption.php | 27 +- htdocs/supplier_proposal/card.php | 96 +++---- htdocs/theme/eldy/style.css.php | 4 +- htdocs/theme/md/style.css.php | 2 +- htdocs/user/card.php | 147 +++++----- htdocs/user/group/card.php | 30 +- 61 files changed, 1705 insertions(+), 1746 deletions(-) diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index c7caa5daac3..02549be2a94 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -45,10 +45,13 @@ $langs->load("compta"); $langs->load("banks"); $langs->load("loans"); + /* * Actions */ +// None + /* * View @@ -73,35 +76,31 @@ print "
\n"; $step++; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("AccountingJournals").''); print "
\n"; -print "
\n"; $step++; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("Pcg_version").''); print "
\n"; -print "
\n"; $step++; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("Chartofaccounts").''); print "
\n"; -print "
\n"; +print "
\n"; print $langs->trans("AccountancyAreaDescActionOnceBis"); print "
\n"; print "
\n"; $step++; -print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescMisc", $step, ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'')."
\n"; +print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescMisc", $step, ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'')."\n"; print "
\n"; $step++; $textlink = ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuVatAccounts").''; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, $textlink); print "
\n"; -print "
\n"; if (! empty($conf->tax->enabled)) { $textlink = ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuTaxAccounts").''; $step++; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, $textlink); print "
\n"; - print "
\n"; } /*if (! empty($conf->salaries->enabled)) { @@ -116,7 +115,6 @@ if (! empty($conf->expensereport->enabled)) // TODO Move this in the default ac $step++; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").''); print "
\n"; - print "
\n"; } /* if (! empty($conf->loan->enabled)) @@ -124,26 +122,22 @@ if (! empty($conf->loan->enabled)) $step++; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescLoan", $step, ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuSpecialExpenses").'-'.$langs->transnoentitiesnoconv("Loans").' '.$langs->transnoentitiesnoconv("or").' '.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); print "
\n"; - print "
\n"; } if (! empty($conf->don->enabled)) { $step++; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDonation", $step, ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDonationAccounts").''); print "
\n"; - print "
\n"; }*/ $step++; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("ProductsBinding").''); print "
\n"; -print "
\n"; $step++; $textlink=''.$langs->transnoentitiesnoconv("MenuBankCash").''; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, $textlink); print "
\n"; -print "
\n"; print "
\n"; @@ -155,19 +149,19 @@ $step = 0; $langs->loadLangs(array('bills', 'trips')); $step++; -print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("BillsCustomers"), ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("CustomersVentilation").'')."
\n"; +print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("BillsCustomers"), ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("CustomersVentilation").'')."\n"; print "
\n"; $step++; -print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("BillsSuppliers"), ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("SuppliersVentilation").'')."
\n"; +print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("BillsSuppliers"), ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("SuppliersVentilation").'')."\n"; print "
\n"; $step++; -print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("ExpenseReports"), ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'')."
\n"; +print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("ExpenseReports"), ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'')."\n"; print "
\n"; $step++; -print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescWriteRecords", chr(64+$step), $langs->transnoentitiesnoconv("Journalization"), $langs->transnoentitiesnoconv("WriteBookKeeping"))."
\n"; +print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescWriteRecords", chr(64+$step), $langs->transnoentitiesnoconv("Journalization"), $langs->transnoentitiesnoconv("WriteBookKeeping"))."\n"; print "
\n"; $step++; diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 1234f75e059..81aa2c7c6ad 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -96,7 +96,7 @@ if ($id > 0) // Define variables to know what current user can do on properties of user linked to edited member if ($object->user_id) { - // $ User is the user who edits, $ object->user_id is the id of the related user in the edited member + // $ User is the user who edits, $ object->user_id is the id of the related user in the edited member $caneditfielduser=((($user->id == $object->user_id) && $user->rights->user->self->creer) || (($user->id != $object->user_id) && $user->rights->user->user->creer)); $caneditpassworduser=((($user->id == $object->user_id) && $user->rights->user->self->password) @@ -213,7 +213,7 @@ if (empty($reshook)) { if ($result > 0) { - // User creation + // User creation $company = new Societe($db); $result=$company->create_from_member($object,GETPOST('companyname')); @@ -714,7 +714,7 @@ if (empty($reshook)) } } } - + // Actions to build doc $upload_dir = $conf->adherent->dir_output; $permissioncreate=$user->rights->adherent->creer; @@ -834,7 +834,7 @@ else print ''; print ''; } - + // Type print ''.$langs->trans("MemberType").''; $listetype=$adht->liste_array(); @@ -948,20 +948,6 @@ else print $object->showOptionals($extrafields,'edit'); } - /* - // Third party Dolibarr - if (! empty($conf->societe->enabled)) - { - print ''.$langs->trans("LinkedToDolibarrThirdParty").''; - print $form->select_company($object->fk_soc,'socid','',1); - print ''; - } - - // Login Dolibarr - print ''.$langs->trans("LinkedToDolibarrUser").''; - print $form->select_dolusers($object->user_id, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); - print ''; - */ print ''; print "\n"; @@ -1061,12 +1047,12 @@ else print ''; // Ref - print ''; + print ''; // Login if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { - print ''; + print ''; } // Password @@ -1095,7 +1081,7 @@ else print ""; // Company - print ''; + print ''; // Civility print ''; // Lastname - print ''; + print ''; print ''; // Firstname - print ''; + print ''; print ''; // Photo @@ -1131,7 +1117,7 @@ else // Address print ''; // Zip / Town @@ -1143,7 +1129,7 @@ else // Country //$object->country_id=$object->country_id?$object->country_id:$mysoc->country_id; // In edit mode we don't force to company country if not defined - print ''; @@ -1168,7 +1154,7 @@ else // Skype if (! empty($conf->skype->enabled)) { - print ''; + print ''; } // Birthday @@ -1185,7 +1171,7 @@ else if (! empty( $conf->categorie->enabled ) && !empty( $user->rights->categorie->lire )) { print ''; - print '
'.$langs->trans("Ref").''.$object->id.'
'.$langs->trans("Ref").''.$object->id.'
'.$langs->trans("Login").' / '.$langs->trans("Id").'login).'">
'.$langs->trans("Login").' / '.$langs->trans("Id").'login).'">
'.$langs->trans("Company").'societe).'">
'.$langs->trans("Company").'societe).'">
'.$langs->trans("UserTitle").''; @@ -1104,11 +1090,11 @@ else print '
'.$langs->trans("Lastname").'lastname).'">
'.$langs->trans("Lastname").'lastname).'">
'.$langs->trans("Firstname").'firstname).'">
'.$langs->trans("Firstname").'firstname).'">
'.$langs->trans("Address").''; - print ''; + print ''; print '
'.$langs->trans('Country').''; + print '
'.$langs->trans('Country').''; print $form->select_country(isset($_POST["country_id"])?$_POST["country_id"]:$object->country_id,'country_id'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); print '
'.$langs->trans("Skype").'skype).'">
'.$langs->trans("Skype").'skype).'">
' . fieldLabel('Categories', 'memcats') . ''; + print ''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_MEMBER, null, null, null, null, 1); $c = new Categorie($db); $cats = $c->containing($object->id, Categorie::TYPE_MEMBER); @@ -1197,7 +1183,7 @@ else } // Other attributes - $parameters=array("colspan"=>2); + $parameters=array(); $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)) { @@ -1416,12 +1402,12 @@ else if (! empty($conf->societe->enabled)) $rowspan++; $linkback = ''.$langs->trans("BackToList").''; - + dol_banner_tab($object, 'rowid', $linkback); - + print '
'; print '
'; - + print '
'; print ''; @@ -1463,15 +1449,15 @@ else } print ''; } - + print '
'; - + print '
'; print '
'; - + print '
'; print ''; - + // Birthday print ''; @@ -1487,13 +1473,8 @@ else print ''; } - // Other attributes - $parameters=array('colspan'=>2); - $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)) - { - print $object->showOptionals($extrafields, 'view', $parameters); - } + // Other attributes + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; // Date end subscription print ''; - + // Third party Dolibarr if (! empty($conf->societe->enabled)) { @@ -1595,12 +1576,12 @@ else print '
'; dol_fiche_end(); - - + + /* * Hotbar */ - + print '
'; $parameters = array(); $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been @@ -1616,7 +1597,7 @@ else { print '
'.$langs->trans("Modify").'
'; } - + // Validate if ($object->statut == -1) { @@ -1629,7 +1610,7 @@ else print '
'.$langs->trans("Validate").'
'; } } - + // Reactivate if ($object->statut == 0) { @@ -1642,7 +1623,7 @@ else print '
'.$langs->trans("Reenable")."
"; } } - + // Send card by email if ($user->rights->adherent->creer) { @@ -1660,7 +1641,7 @@ else { print '
'.$langs->trans("SendCardByMail")."
"; } - + // Terminate if ($object->statut >= 1) { @@ -1673,7 +1654,7 @@ else print '
'.$langs->trans("Resiliate")."
"; } } - + // Create third party if (! empty($conf->societe->enabled) && ! $object->fk_soc) { @@ -1687,7 +1668,7 @@ else print '
'.$langs->trans("CreateDolibarrThirdParty")."
"; } } - + // Create user if (! $user->societe_id && ! $object->user_id) { @@ -1701,7 +1682,7 @@ else print '
'.$langs->trans("CreateDolibarrLogin")."
"; } } - + // Delete if ($user->rights->adherent->supprimer) { @@ -1711,12 +1692,12 @@ else { print '
'.$langs->trans("Delete")."
"; } - + // Action SPIP if (! empty($conf->mailmanspip->enabled) && ! empty($conf->global->ADHERENT_USE_SPIP)) { $isinspip = $mailmanspip->is_in_spip($object); - + if ($isinspip == 1) { print '\n"; @@ -1726,7 +1707,7 @@ else print '\n"; } } - + } } print '
'; @@ -1736,11 +1717,11 @@ else print '

'.$langs->trans('SPIPConnectionFailed').': '.$mailmanspip->error.''; } - - + + print '
'; print ''; // ancre - + // Documents generes $filename = dol_sanitizeFileName($object->ref); //$filename = 'tmp_cards.php'; @@ -1752,15 +1733,15 @@ else print $formfile->showdocuments('member', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $object->default_lang, '', $object); $somethingshown = $formfile->numoffiles; - + // Show links to link elements //$linktoelem = $form->showLinkToObjectBlock($object, null, array('subscription')); //$somethingshown = $form->showLinkedObjectBlock($object, ''); - + // Show links to link elements /*$linktoelem = $form->showLinkToObjectBlock($object,array('order')); if ($linktoelem) print ($somethingshown?'':'
').$linktoelem; - + // Link for paypal payment /* if (! empty($conf->paypal->enabled) && $object->statut != 0) { @@ -1769,15 +1750,15 @@ else } */ print '
'; - + // List of actions on element /* Already in tab Agenda/Events include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; $formactions = new FormActions($db); $somethingshown = $formactions->showactions($object, 'member', $socid); */ - print '
'; - + print ''; + } } diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index 1874a0b37a7..21de6e305b5 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -389,7 +389,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && ! { $invoice->linked_objects = array_merge($invoice->linked_objects, $_POST['other_linked_objects']); } - + $result=$invoice->create($user); if ($result <= 0) { @@ -581,12 +581,12 @@ if ($rowid > 0) dol_fiche_head($head, 'subscription', $langs->trans("Member"), -1, 'user'); $linkback = ''.$langs->trans("BackToList").''; - + dol_banner_tab($object, 'rowid', $linkback); - + print '
'; print '
'; - + print '
'; print '
'.$langs->trans("Birthday").''.dol_print_date($object->birth,'day').'
'.$langs->trans("SubscriptionEndDate").''; @@ -1518,7 +1499,7 @@ else } } print '
'; @@ -624,13 +624,13 @@ if ($rowid > 0) } print '
'; - + print '
'; print '
'; - + print '
'; print ''; - + // Birthday print ''; @@ -646,13 +646,9 @@ if ($rowid > 0) print ''; } - // Other attributes - $parameters=array('colspan'=>2); - $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)) - { - print $object->showOptionals($extrafields, 'view', $parameters); - } + // Other attributes + $cols=2; + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; // Date end subscription print ''; - + // Third party Dolibarr if (! empty($conf->societe->enabled)) { @@ -752,7 +748,7 @@ if ($rowid > 0) print "\n"; print '
'; - + dol_fiche_end(); print ''; diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 20adc36dec5..4935b6c4c6d 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -336,14 +336,8 @@ if ($rowid > 0) print '"; - // Other attributes - $parameters=array(); - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook - if (empty($reshook) && ! empty($extrafields->attribute_label)) - { - // View extrafields - print $object->showOptionals($extrafields); - } + // Other attributes + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; print '
'.$langs->trans("Birthday").''.dol_print_date($object->birth,'day').'
'.$langs->trans("SubscriptionEndDate").''; @@ -677,7 +673,7 @@ if ($rowid > 0) } } print '
'.$langs->trans("WelcomeEMail").''; print nl2br($object->mail_valid)."
'; print '
'; @@ -674,6 +668,10 @@ if ($rowid > 0) // Other attributes $parameters=array(); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook + if (empty($reshook) && ! empty($extrafields->attribute_label)) + { + print $object->showOptionals($extrafields,'edit'); + } print '
'; diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 913fcf75de6..22e7bf7087f 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -569,8 +569,8 @@ if ($id == 10) if (GETPOST('button_removefilter') || GETPOST('button_removefilter.x') || GETPOST('button_removefilter_x')) { - $search_country_id = ''; - $search_code = ''; + $search_country_id = ''; + $search_code = ''; } // Actions add or modify an entry into a dictionary @@ -660,11 +660,11 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) if ($_POST["accountancy_code"] <= 0) $_POST["accountancy_code"]=''; // If empty, we force to null if ($_POST["accountancy_code_sell"] <= 0) $_POST["accountancy_code_sell"]=''; // If empty, we force to null if ($_POST["accountancy_code_buy"] <= 0) $_POST["accountancy_code_buy"]=''; // If empty, we force to null - if ($id == 10 && isset($_POST["code"])) // Spaces are not allowed into code + if ($id == 10 && isset($_POST["code"])) // Spaces are not allowed into code { $_POST["code"]=preg_replace('/\s/','',$_POST["code"]); } - + // Si verif ok et action add, on ajoute la ligne if ($ok && GETPOST('actionadd')) { @@ -945,7 +945,7 @@ if ($id) if (! preg_match('/ WHERE /',$sql)) $sql.= " WHERE 1 = 1"; if ($search_country_id > 0) $sql.= " AND c.rowid = ".$search_country_id; if ($search_code != '') $sql.= natural_search("code", $search_code); - + if ($sortfield) { // If sort order is "country", we use country_code instead @@ -972,16 +972,16 @@ if ($id) print '
'; print ''; print ''; - + // Form to add a new line if ($tabname[$id]) { $alabelisused=0; - + $fieldlist=explode(',',$tabfield[$id]); print ''; - + // Line for title print ''; foreach ($fieldlist as $field => $value) @@ -1012,9 +1012,9 @@ if ($id) if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { if ($id != 25) $valuetoshow=$form->textwithtooltip($langs->trans("Label"), $langs->trans("LabelUsedByDefault"),2,1,img_help(1,'')); - else $valuetoshow=$langs->trans("Label"); + else $valuetoshow=$langs->trans("Label"); } - if ($fieldlist[$field]=='libelle_facture') { + if ($fieldlist[$field]=='libelle_facture') { $valuetoshow=$form->textwithtooltip($langs->trans("LabelOnDocuments"), $langs->trans("LabelUsedByDefault"),2,1,img_help(1,'')); } if ($fieldlist[$field]=='country') { @@ -1055,7 +1055,7 @@ if ($id) if ($fieldlist[$field]=='affect') { $valuetoshow=$langs->trans("WithCounter"); } if ($fieldlist[$field]=='delay') { $valuetoshow=$langs->trans("NoticePeriod"); } if ($fieldlist[$field]=='newbymonth') { $valuetoshow=$langs->trans("NewByMonth"); } - + if ($id == 2) // Special cas for state page { if ($fieldlist[$field]=='region_id') { $valuetoshow=' '; $showfield=1; } @@ -1120,7 +1120,7 @@ if ($id) if ($id == 4) $colspan++; print '
'; - + /*if (! empty($alabelisused) && $id != 25) // If there is one label among fields, we show legend of * { print '* '.$langs->trans("LabelUsedByDefault").'.
'; @@ -1130,11 +1130,11 @@ if ($id) print '
'; print '
'; - + print '
'; print ''; print ''; - + // List of available record in database dol_syslog("htdocs/admin/dict", LOG_DEBUG); $resql=$db->query($sql); @@ -1150,29 +1150,29 @@ if ($id) } print ''; - + // Title line with search boxes print ''; $filterfound=0; foreach ($fieldlist as $field => $value) { $showfield=1; // By defaut - + if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $showfield=0; } - + if ($showfield) { if ($value == 'country') { print ''; $filterfound++; } elseif ($value == 'code') { print ''; $filterfound++; } @@ -1193,7 +1193,7 @@ if ($id) } print ''; print ''; - + // Title of lines print ''; foreach ($fieldlist as $field => $value) @@ -1235,7 +1235,7 @@ if ($id) //else $valuetoshow=$langs->trans("Label"); $valuetoshow=$langs->trans("Label"); } - if ($fieldlist[$field]=='libelle_facture') { + if ($fieldlist[$field]=='libelle_facture') { //$valuetoshow=$form->textwithtooltip($langs->trans("LabelOnDocuments"), $langs->trans("LabelUsedByDefault"),2,1,img_help(1,'')); $valuetoshow=$langs->trans("LabelOnDocuments"); } @@ -1368,7 +1368,7 @@ if ($id) if ($value == 'private') { $valuetoshow = yn($elementList[$valuetoshow]); - } + } else if ($fieldlist[$field]=='libelle_facture') { $langs->load("bills"); $key=$langs->trans("PaymentCondition".strtoupper($obj->code)); @@ -1516,7 +1516,7 @@ if ($id) if ($obj->code == 'RECEP') $canbemodified=1; if ($tabname[$id] == MAIN_DB_PREFIX."c_actioncomm") $canbemodified=1; - // Url + // Url $rowidcol=$tabrowid[$id]; // If rowidcol not defined if (empty($rowidcol) || in_array($id, array(6,7,8,13,17,19,27))) $rowidcol='rowid'; @@ -1565,7 +1565,7 @@ if ($id) $i++; } } - + print '
'; - print $form->select_country($search_country_id, 'search_country_id', '', 28, 'maxwidth200 maxwidthonsmartphone'); + print $form->select_country($search_country_id, 'search_country_id', '', 28, 'maxwidth150 maxwidthonsmartphone'); print ''; - print ''; + print ''; print '
'; } else { @@ -1598,12 +1598,12 @@ else { if ($showemptyline) { - + print '   '; $showemptyline=0; } - + $value=$tabname[$i]; print ''; if (! empty($tabcond[$i])) @@ -1764,7 +1764,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='') print ''; $transfound=0; // Special case for labels - if ($tabname == MAIN_DB_PREFIX.'c_payment_term') + if ($tabname == MAIN_DB_PREFIX.'c_payment_term') { $langs->load("bills"); $transkey="PaymentCondition".strtoupper($obj->code); diff --git a/htdocs/categories/edit.php b/htdocs/categories/edit.php index 9981d09cda0..c2f93c17ccd 100644 --- a/htdocs/categories/edit.php +++ b/htdocs/categories/edit.php @@ -173,6 +173,7 @@ print ''.$langs->trans("In").''; print $form->select_all_categories($type,$object->fk_parent,'parent',64,$object->id); print ''; +$parameters=array(); $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)) { diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 665b033936e..11aff01dc99 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -235,11 +235,8 @@ print $langs->trans("Color").''; print $formother->showColor($object->color); print ''; -$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)) -{ - print $object->showOptionals($extrafields); -} +// Other attributes +include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; print ''; print ''; @@ -290,7 +287,7 @@ else if (count($cats) > 0) { foreach ($cats as $cat) - { + { print "\t".''."\n"; print "\t\t".''; print "".$cat->label.""; @@ -359,7 +356,7 @@ if ($object->type == Categorie::TYPE_PRODUCT) if (count($prods) > 0) { foreach ($prods as $prod) - { + { print "\t".''."\n"; print ''; print $prod->getNomUrl(1); @@ -408,7 +405,7 @@ if ($object->type == Categorie::TYPE_SUPPLIER) if (count($socs) > 0) { foreach ($socs as $soc) - { + { print "\t".''."\n"; print ''; print $soc->getNomUrl(1); @@ -462,7 +459,7 @@ if($object->type == Categorie::TYPE_CUSTOMER) if ($user->societe_id > 0 && $soc->id != $user->societe_id) continue; // External user always see only themself $i++; - + print "\t".''."\n"; print ''; print $soc->getNomUrl(1); @@ -513,7 +510,7 @@ if ($object->type == Categorie::TYPE_MEMBER) if (count($prods) > 0) { foreach ($prods as $key => $member) - { + { print "\t".''."\n"; print ''; $member->ref=$member->login; @@ -567,7 +564,7 @@ if($object->type == Categorie::TYPE_CONTACT) foreach ($contacts as $key => $contact) { $i++; - + print "\t".''."\n"; print ''; print $contact->getNomUrl(1,'category'); @@ -619,7 +616,7 @@ if ($object->type == Categorie::TYPE_ACCOUNT) if (count($accounts) > 0) { foreach ($accounts as $key => $account) - { + { print "\t".''."\n"; print ''; print $account->getNomUrl(1,0); @@ -672,7 +669,7 @@ if ($object->type == Categorie::TYPE_PROJECT) if (count($projects) > 0) { foreach ($projects as $key => $project) - { + { print "\t".''."\n"; print ''; print $project->getNomUrl(1,0); diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index eb2eddb3197..3a634cc21cd 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -121,7 +121,7 @@ if (GETPOST('removedassigned') || GETPOST('removedassigned') == '0') $donotclearsession=1; if ($action == 'add') $action = 'create'; if ($action == 'update') $action = 'edit'; - + $listUserAssignedUpdated = true; } @@ -734,7 +734,7 @@ if ($action == 'create') print '
'; print $form->select_dolusers_forevent(($action=='create'?'add':'update'), 'assignedtouser', 1, '', 0, '', '', 0, 0, 0, 'AND u.statut != 0'); print '
'; - if (in_array($user->id,array_keys($listofuserid))) + if (in_array($user->id,array_keys($listofuserid))) { print '
'; print $langs->trans("MyAvailability").': '.$langs->trans("Busy"); @@ -752,8 +752,8 @@ if ($action == 'create') print ''; print '

'; - - + + print ''; // Related company @@ -830,12 +830,9 @@ if ($action == 'create') $doleditor->Create(); print ''; - // Other attributes - $parameters=array('id'=>$object->id); + $parameters=array(); $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)) { print $object->showOptionals($extrafields,'edit'); @@ -863,11 +860,11 @@ if ($id > 0) $result3=$object->fetch_contact(); $result4=$object->fetch_userassigned(); $result5=$object->fetch_optionals($id,$extralabels); - - if ($listUserAssignedUpdated || $donotclearsession) + + if ($listUserAssignedUpdated || $donotclearsession) { $percentage=in_array(GETPOST('status'),array(-1,100))?GETPOST('status'):(in_array(GETPOST('complete'),array(-1,100))?GETPOST('complete'):GETPOST("percentage")); // If status is -1 or 100, percentage is not defined and we must use status - + $datep=dol_mktime($fulldayevent?'00':$aphour, $fulldayevent?'00':$apmin, 0, $_POST["apmonth"], $_POST["apday"], $_POST["apyear"]); $datef=dol_mktime($fulldayevent?'23':$p2hour, $fulldayevent?'59':$p2min, $fulldayevent?'59':'0', $_POST["p2month"], $_POST["p2day"], $_POST["p2year"]); @@ -884,7 +881,7 @@ if ($id > 0) //$object->societe->id = $_POST["socid"]; // deprecated //$object->contact->id = $_POST["contactid"]; // deprecated $object->fk_project = GETPOST("projectid",'int'); - + $object->note = GETPOST("note"); } @@ -1076,11 +1073,11 @@ if ($id > 0) $listofuserid=json_decode($_SESSION['assignedtouser'], true); } } - + print '
'; print $form->select_dolusers_forevent(($action=='create'?'add':'update'), 'assignedtouser', 1, '', 0, '', '', 0, 0, 0, 'AND u.statut != 0'); print '
'; - if (in_array($user->id,array_keys($listofuserid))) + if (in_array($user->id,array_keys($listofuserid))) { print '
'; print $langs->trans("MyAvailability").': id]['transparency']?' checked':'').'>'.$langs->trans("Busy"); @@ -1098,10 +1095,10 @@ if ($id > 0) print '
'; - + print '

'; - + print ''; if ($conf->societe->enabled) @@ -1165,7 +1162,7 @@ if ($id > 0) print ''; // Other attributes - $parameters=array('id'=>$object->id); + $parameters=array(); $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)) { @@ -1212,8 +1209,8 @@ if ($id > 0) $out.=img_picto($langs->trans("ViewDay"),'object_calendarday','class="hideonsmartphone pictoactionview"'); $out.=''.$langs->trans("ViewDay").''; $linkback.=$out; - - + + $morehtmlref='
'; // Thirdparty //$morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); @@ -1253,14 +1250,14 @@ if ($id > 0) } } $morehtmlref.='
'; - - + + dol_banner_tab($object, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', $morehtmlref); - + print '
'; - + print '
'; - + // Affichage fiche action en mode visu print '
'; @@ -1324,7 +1321,7 @@ if ($id > 0) print '
'; print $form->select_dolusers_forevent('view', 'assignedtouser', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); print '
'; - if ($object->datep != $object->datef && in_array($user->id,array_keys($listofuserid))) + if ($object->datep != $object->datef && in_array($user->id,array_keys($listofuserid))) { print '
'; print $langs->trans("MyAvailability").': '.(($object->userassigned[$user->id]['transparency'] > 0)?$langs->trans("Busy"):$langs->trans("Available")); // We show nothing if event is assigned to nobody @@ -1364,7 +1361,7 @@ if ($id > 0) } } print ''; - + // Related contact print '
'; print ''; } - + // Priority print ''; // Other attributes - $parameters=array('colspan'=>' colspan="3"', 'colspanvalue'=>'3', 'id'=>$object->id); - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + $cols=3; + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; print '
'.$langs->trans("ActionOnContact").''; @@ -1385,7 +1382,7 @@ if ($id > 0) } print '
'.$langs->trans("Priority").''; print ($object->priority?$object->priority:''); @@ -1409,38 +1406,13 @@ if ($id > 0) print '
'; - //Extra field - if (empty($reshook) && ! empty($extrafields->attribute_label)) - { - print '

'; - print '
'; - print ''; - foreach($extrafields->attribute_label as $key=>$label) - { - if (isset($_POST["options_" . $key])) { - if (is_array($_POST["options_" . $key])) { - // $_POST["options"] is an array but following code expects a comma separated string - $value = implode(",", $_POST["options_" . $key]); - } else { - $value = $_POST["options_" . $key]; - } - } else { - $value = $object->array_options["options_" . $key]; - } - print '\n"; - } - print '
'.$label.''; - print $extrafields->showOutputField($key,$value); - print "
'; - } - print '
'; - + dol_fiche_end(); } diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 5b08519b9b8..bee23ad4ded 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -131,7 +131,7 @@ if (empty($reshook)) $result=$object->setBankAccount(GETPOST('fk_account','int')); if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); } - + // customer preferred shipping method if ($action == 'setshippingmethod' && $user->rights->societe->creer) { @@ -207,9 +207,9 @@ if ($id > 0) dol_fiche_head($head, 'customer', $langs->trans("ThirdParty"), -1, 'company'); $linkback = ''.$langs->trans("BackToList").''; - + dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); - + print '
'; print '
'; @@ -376,11 +376,11 @@ if ($id > 0) $limit_field_type = (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) ? 'numeric' : 'amount'; print $form->editfieldval("OutstandingBill",'outstanding_limit',$object->outstanding_limit,$object,$user->rights->societe->creer,$limit_field_type,($object->outstanding_limit != '' ? price($object->outstanding_limit) : '')); //if (empty($object->outstanding_limit)) print $langs->trans("NoLimit"); - + print ''; print ''; } - + // Multiprice level if (! empty($conf->global->PRODUIT_MULTIPRICES)) { @@ -432,13 +432,8 @@ if ($id > 0) } // Other attributes - $parameters=array('socid'=>$object->id, 'colspan' => ' colspan="3"', 'colspanvalue' => '3'); - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - if (empty($reshook) && ! empty($extrafields->attribute_label)) - { - print $object->showOptionals($extrafields); - } + $parameters=array('socid'=>$object->id); + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; // Sales representative include DOL_DOCUMENT_ROOT.'/societe/tpl/linesalesrepresentative.tpl.php'; @@ -471,10 +466,10 @@ if ($id > 0) if ($object->client == 2 || $object->client == 3) { print '
'; - + print '
'; print ''; - + // Level of prospect print ''; print ''; print ''; print ''; print '
'; print ''; print "
'; @@ -508,12 +503,12 @@ if ($id > 0) print '
"; } - + print '
'; $boxstat = ''; - + // Nbre max d'elements des petites listes $MAXLIST=$conf->global->MAIN_SIZE_SHORTLIST_LIMIT; @@ -521,7 +516,7 @@ if ($id > 0) $boxstat.='
'; $boxstat.=''; $boxstat.=''; $boxstat.='
'; - + if ($conf->propal->enabled) { // Box proposals @@ -557,14 +552,14 @@ if ($id > 0) $boxstat.=''; if ($link) $boxstat.=''; } - + if ($conf->facture->enabled) { $tmp = $object->getOutstandingBills(); $outstandingOpened=$tmp['opened']; $outstandingTotal=$tmp['total_ht']; $outstandingTotalIncTax=$tmp['total_ttc']; - + $text=$langs->trans("OverAllInvoices"); $link=''; $icon='bill'; @@ -574,7 +569,7 @@ if ($id > 0) $boxstat.=''.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).''; $boxstat.=''; if ($link) $boxstat.=''; - + // Box outstanding bill $warn = ''; if ($object->outstanding_limit != '' && $object->outstanding_limit < $outstandingOpened) @@ -591,13 +586,13 @@ if ($id > 0) $boxstat.=''; if ($link) $boxstat.=''; } - + $boxstat.='
'; $boxstat.='
'; - + print $boxstat; - + $now=dol_now(); /* @@ -639,7 +634,7 @@ if ($id > 0) while ($i < $num && $i < $MAXLIST) { $objp = $db->fetch_object($resql); - + print '
'; $propal_static->id = $objp->propalid; @@ -723,7 +718,7 @@ if ($id > 0) while ($i < $num && $i < $MAXLIST) { $objp = $db->fetch_object($resql); - + print '
'; $commande_static->id = $objp->cid; @@ -849,7 +844,7 @@ if ($id > 0) $contrat=new Contrat($db); $objp = $db->fetch_object($resql); - + print '
'; $contrat->id=$objp->id; @@ -905,7 +900,7 @@ if ($id > 0) print ''.img_picto($langs->trans("Statistics"),'stats').'
'; print ''; - + } $i = 0; while ($i < $num && $i < $MAXLIST) @@ -921,7 +916,7 @@ if ($id > 0) print ''.convertSecondToTime($objp->duration).''."\n"; print ''.$fichinter_static->getLibStatut(5).''."\n"; print ''; - + $i++; } $db->free($resql); @@ -977,7 +972,7 @@ if ($id > 0) while ($i < $num && $i < $MAXLIST) { $objp = $db->fetch_object($resql); - + print ''; print ''; $facturestatic->id = $objp->facid; @@ -1006,7 +1001,7 @@ if ($id > 0) print price($objp->total_ttc); print ''; } - + print ''.($facturestatic->LibStatut($objp->paye,$objp->statut,5,$objp->am)).''; print "\n"; $i++; @@ -1042,31 +1037,31 @@ if ($id > 0) { print ''; } - + if (! empty($conf->propal->enabled) && $user->rights->propal->creer && $object->status==1) { $langs->load("propal"); print ''; } - + if (! empty($conf->commande->enabled) && $user->rights->commande->creer && $object->status==1) { $langs->load("orders"); print ''; } - + if ($user->rights->contrat->creer && $object->status==1) { $langs->load("contracts"); print ''; } - + if (! empty($conf->ficheinter->enabled) && $user->rights->ficheinter->creer && $object->status==1) { $langs->load("fichinter"); print ''; } - + // Add invoice if ($user->societe_id == 0) { @@ -1075,7 +1070,7 @@ if ($id > 0) $langs->load("trips"); print ''; } - + if (! empty($conf->facture->enabled) && $object->status==1) { if (empty($user->rights->facture->creer)) @@ -1086,7 +1081,7 @@ if ($id > 0) { $langs->load("bills"); $langs->load("orders"); - + if (! empty($conf->commande->enabled)) { if ($object->client != 0 && $object->client != 2) @@ -1099,11 +1094,11 @@ if ($id > 0) if ($object->client != 0 && $object->client != 2) print ''; else print ''; - + } } } - + // Add action if (! empty($conf->agenda->enabled) && ! empty($conf->global->MAIN_REPEATTASKONEACHTAB) && $object->status==1) { @@ -1117,7 +1112,7 @@ if ($id > 0) } } } - + print '
'; if (! empty($conf->global->MAIN_REPEATCONTACTONEACHTAB)) diff --git a/htdocs/comm/mailing/advtargetemailing.php b/htdocs/comm/mailing/advtargetemailing.php index 0a9cdca7abc..0262a50d65c 100644 --- a/htdocs/comm/mailing/advtargetemailing.php +++ b/htdocs/comm/mailing/advtargetemailing.php @@ -767,16 +767,15 @@ if ($object->fetch($id) >= 0) { } else { $std_soc = new Societe($db); $action_search = 'query'; + // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php'; $hookmanager = new HookManager($db); - $hookmanager->initHooks(array ( - 'thirdpartycard' - )); + $hookmanager->initHooks(array ('thirdpartycard')); + + $parameters=array(); if (! empty($advTarget->id)) { - $parameters = array ( - 'array_query' => $advTarget->filtervalue - ); + $parameters = array('array_query' => $advTarget->filtervalue); } // Module extrafield feature $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $std_soc, $action_search); diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 0b4c3c239f9..956710e2abc 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -231,10 +231,10 @@ if (empty($reshook)) if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $substitutionarray['__SECUREKEYPAYPAL_ORDER__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2); else $substitutionarray['__SECUREKEYPAYPAL_ORDER__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN . 'order' . $obj->source_id, 2); - + if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $substitutionarray['__SECUREKEYPAYPAL_INVOICE__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2); else $substitutionarray['__SECUREKEYPAYPAL_INVOICE__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN . 'invoice' . $obj->source_id, 2); - + if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $substitutionarray['__SECUREKEYPAYPAL_CONTRACTLINE__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2); else $substitutionarray['__SECUREKEYPAYPAL_CONTRACTLINE__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN . 'contractline' . $obj->source_id, 2); } @@ -700,11 +700,11 @@ if ($action == 'create') } $htmltext.=''; - + $availablelink=$form->textwithpicto($langs->trans("AvailableVariables"), $htmltext, 1, 'help', '', 0, 2, 'availvar'); //print ''.img_picto($langs->trans("ClickToShowDescription"), $imginfo).''; - - + + // Print mail form print load_fiche_titre($langs->trans("NewMailing"), $availablelink, 'title_generic'); @@ -733,14 +733,14 @@ if ($action == 'create') print ''; print ''; - + print '
'; // Editeur wysiwyg require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor=new DolEditor('body',$_POST['body'],'',600,'dolibarr_mailings','',true,true,$conf->global->FCKEDITOR_ENABLE_MAILING,20,'90%'); $doleditor->Create(); print '
'; - + dol_fiche_end(); print '
'; @@ -809,7 +809,7 @@ else { if (! empty($conf->global->MAILING_LIMIT_WARNING_PHPMAIL) && $sendingmode == 'mail') setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_PHPMAIL), null, 'warnings'); if (! empty($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL) && $sendingmode != 'mail') setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL), null, 'warnings'); - + // The feature is forbidden from GUI, we show just message to use from command line. setEventMessages($langs->trans("MailingNeedCommand"), null, 'warnings'); setEventMessages('', null, 'warnings'); @@ -823,7 +823,7 @@ else { if (! empty($conf->global->MAILING_LIMIT_WARNING_PHPMAIL) && $sendingmode == 'mail') setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_PHPMAIL), null, 'warnings'); if (! empty($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL) && $sendingmode != 'mail') setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL), null, 'warnings'); - + $text=''; if ($conf->global->MAILING_LIMIT_SENDBYCLI >= 0) { @@ -841,12 +841,12 @@ else $morehtmlright=''; if ($object->statut == 2) $morehtmlright.=' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.') '; - + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright); print '
'; print '
'; - + print ''; // Description @@ -863,7 +863,7 @@ else print ''; - + // Nb of distinct emails print ''; // Other attributes - $parameters=array(); - $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)) - { - print $object->showOptionals($extrafields); - } + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; print '
'.$form->editfieldkey("MailErrorsTo",'email_errorsto',$object->email_errorsto,$object,$user->rights->mailing->creer && $object->statut < 3,'string').''; print $form->editfieldval("MailErrorsTo",'email_errorsto',$object->email_errorsto,$object,$user->rights->mailing->creer && $object->statut < 3,'string'); print '
'; print $langs->trans("TotalNbOfDistinctRecipients"); @@ -895,20 +895,15 @@ else print '
'; print "
"; - + dol_fiche_end(); - + // Clone confirmation if ($action == 'clone') { @@ -1053,12 +1048,12 @@ else $htmltext.=$key.' = '.$langs->trans($val).'
'; } $htmltext.=''; - + // Print mail content print load_fiche_titre($langs->trans("EMail"), $form->textwithpicto($langs->trans("AvailableVariables"), $htmltext, 1, 'help', '', 0, 2, 'emailsubstitionhelp'), 'title_generic'); - + dol_fiche_head('', '', '', -1); - + print ''; // Subject @@ -1086,9 +1081,9 @@ else /*print '';*/ - + print '
'.$langs->trans("BackgroundColorByDefault").''; print $htmlother->selectColor($object->bgcolor,'bgcolor','edit_mailing',0); print '
'; - + // Message print '
'; if (empty($object->bgcolor) || strtolower($object->bgcolor) == 'ffffff') @@ -1103,23 +1098,23 @@ else print '
'; dol_fiche_end(); - + } else { /* * Mailing en mode edition */ - + dol_fiche_head($head, 'card', $langs->trans("Mailing"), -1, 'email'); - + $linkback = ''.$langs->trans("BackToList").''; $morehtmlright=''; if ($object->statut == 2) $morehtmlright.=' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.') '; - + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright); - + print '
'; print '
'; @@ -1131,7 +1126,7 @@ else print $form->showrefnav($object,'id', $linkback); print ''; */ - + // Topic print ''.$langs->trans("MailTitle").''.$object->titre.''; // From @@ -1171,24 +1166,24 @@ else print "
\n"; - + print ''."\n"; print ''; print ''; print ''; - + $htmltext = ''.$langs->trans("FollowingConstantsWillBeSubstituted").':
'; foreach($object->substitutionarray as $key => $val) { $htmltext.=$key.' = '.$langs->trans($val).'
'; } $htmltext.='
'; - + // Print mail content print load_fiche_titre($langs->trans("EMail"), $form->textwithpicto($langs->trans("AvailableVariables"), $htmltext, 1, 'help', '', 0, 2, 'emailsubstitionhelp'), 'title_generic'); dol_fiche_head(); - + print ''; // Subject @@ -1237,9 +1232,9 @@ else print ''; - + print '
'.$langs->trans("BackgroundColorByDefault").''; print $htmlother->selectColor($object->bgcolor,'bgcolor','edit_mailing',0); print '
'; - + // Message print '
'; // Editeur wysiwyg diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index df86464281a..2dee7425e8c 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -499,7 +499,7 @@ if (empty($reshook)) $tva_tx = $lines[$i]->tva_tx; if (! empty($lines[$i]->vat_src_code) && ! preg_match('/\(/', $tva_tx)) $tva_tx .= ' ('.$lines[$i]->vat_src_code.')'; - + $result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, 'HT', 0, $lines[$i]->info_bits, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $date_start, $date_end, $array_options, $lines[$i]->fk_unit); if ($result > 0) { @@ -755,7 +755,7 @@ if (empty($reshook)) $db->begin(); // $tva_tx can be 'x.x (XXX)' - + // Ecrase $pu par celui du produit // Ecrase $desc par celui du produit // Ecrase $tva_tx par celui du produit @@ -770,7 +770,7 @@ if (empty($reshook)) $tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id); $tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id); if (empty($tva_tx)) $tva_npr=0; - + $pu_ht = $prod->price; $pu_ttc = $prod->price_ttc; $price_min = $prod->price_min; @@ -811,7 +811,7 @@ if (empty($reshook)) $tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx)); $tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx)); - + // if price ht is forced (ie: calculated by margin rate and cost price). TODO Why this ? if (! empty($price_ht)) { $pu_ht = price2num($price_ht, 'MU'); @@ -1170,27 +1170,12 @@ if (empty($reshook)) $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute')); if ($ret < 0) $error++; - if (! $error) { - // Actions on extra fields (by external module or standard code) - // TODO 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) { - $error ++; - } - } else if ($reshook < 0) - $error ++; + $result = $object->insertExtraFields(); + if ($result < 0) $error++; } - - if ($error) - $action = 'edit_extras'; + if ($error) $action = 'edit_extras'; } if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->propal->creer) @@ -1325,7 +1310,7 @@ if ($action == 'create') // Replicate extrafields $objectsrc->fetch_optionals($originid); $object->array_options = $objectsrc->array_options; - + if (!empty($conf->multicurrency->enabled)) { if (!empty($objectsrc->multicurrency_code)) $currency_code = $objectsrc->multicurrency_code; @@ -1355,10 +1340,10 @@ if ($action == 'create') print ''; // Reference - print ''; + print ''; // Ref customer - print ''; print ''; @@ -1366,7 +1351,7 @@ if ($action == 'create') print ''; print ''; if ($socid > 0) { - print ''; @@ -1374,7 +1359,7 @@ if ($action == 'create') $shipping_method_id = $soc->shipping_method_id; } } else { - print ''; } @@ -1404,7 +1389,7 @@ if ($action == 'create') if ($socid > 0) { // Ligne info remises tiers - print ''; // Validaty duration - print ''; + print ''; // Terms of payment - print ''; // Mode of payment - print ''; // Bank Account if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL) && ! empty($conf->banque->enabled)) { - print ''; } @@ -1450,20 +1435,20 @@ if ($action == 'create') print ''; // Delivery delay - print ''; // Shipping Method if (! empty($conf->expedition->enabled)) { - print ''; } // Delivery date (or manufacturing) print ''; - print ''; - print ''; @@ -1495,7 +1480,7 @@ if ($action == 'create') { print ''; print ''; - print ''; } @@ -1503,7 +1488,7 @@ if ($action == 'create') // Template to use by default print ''; print ''; - print '"; @@ -1513,7 +1498,7 @@ if ($action == 'create') { print ''; print ''; - print ''; } @@ -1521,7 +1506,7 @@ if ($action == 'create') // Public note print ''; print ''; - print ''; print ''; - print ''; - print ''; - print '"; + print ''; + print ''; + print '"; if ($mysoc->localtax1_assuj == "1" || $objectsrc->total_localtax1 != 0 ) // Localtax1 { - print '"; + print '"; } if ($mysoc->localtax2_assuj == "1" || $objectsrc->total_localtax2 != 0) // Localtax2 { - print '"; + print '"; } - print '"; + print '"; } print "
' . $langs->trans('Ref') . '' . $langs->trans("Draft") . '
' . $langs->trans('Ref') . '' . $langs->trans("Draft") . '
' . $langs->trans('RefCustomer') . ''; + print '
' . $langs->trans('RefCustomer') . ''; print '
' . $langs->trans('Customer') . ''; + print ''; print $soc->getNomUrl(1); print ''; print ''; + print ''; print $form->select_company('', 'socid', '(s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1', 'SelectThirdParty'); // reload page to retrieve customer informations if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE)) @@ -1396,7 +1381,7 @@ if ($action == 'create') // Contacts (ask contact only if thirdparty already defined). TODO do this also into order and invoice. if ($socid > 0) { - print "
" . $langs->trans("DefaultContact") . ''; + print "
" . $langs->trans("DefaultContact") . ''; $form->select_contacts($soc->id, $contactid, 'contactid', 1, $srccontactslist); print '
' . $langs->trans('Discounts') . ''; + print '
' . $langs->trans('Discounts') . ''; if ($soc->remise_percent) print $langs->trans("CompanyHasRelativeDiscount", $soc->remise_percent); else @@ -1420,26 +1405,26 @@ if ($action == 'create') } // Date - print '
' . $langs->trans('Date') . ''; + print '
' . $langs->trans('Date') . ''; $form->select_date('', '', '', '', '', "addprop", 1, 1); print '
' . $langs->trans("ValidityDuration") . ' ' . $langs->trans("days") . '
' . $langs->trans("ValidityDuration") . ' ' . $langs->trans("days") . '
' . $langs->trans('PaymentConditionsShort') . ''; + print '
' . $langs->trans('PaymentConditionsShort') . ''; $form->select_conditions_paiements($soc->cond_reglement_id, 'cond_reglement_id'); print '
' . $langs->trans('PaymentMode') . ''; + print '
' . $langs->trans('PaymentMode') . ''; $form->select_types_paiements($soc->mode_reglement_id, 'mode_reglement_id'); print '
' . $langs->trans('BankAccount') . ''; + print '
' . $langs->trans('BankAccount') . ''; $form->select_comptes($fk_account, 'fk_account', 0, '', 1); print '
' . $langs->trans('AvailabilityPeriod') . ''; + print '
' . $langs->trans('AvailabilityPeriod') . ''; $form->selectAvailabilityDelay('', 'availability_id', '', 1); print '
' . $langs->trans('SendingMethod') . ''; + print '
' . $langs->trans('SendingMethod') . ''; print $form->selectShippingMethod($shipping_method_id, 'shipping_method_id', '', 1); print '
' . $langs->trans("DeliveryDate") . ''; + print ''; if ($conf->global->DATE_LIVRAISON_WEEK_DELAY != "") { $tmpdte = time() + ((7 * $conf->global->DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60); $syear = date("Y", $tmpdte); @@ -1483,7 +1468,7 @@ if ($action == 'create') $langs->load("projects"); print '
' . $langs->trans("Project") . ''; + print '' . $langs->trans("Project") . ''; $numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0); print '   id).'">' . $langs->trans("AddProject") . ''; print '
'; + print ''; print $form->select_incoterms((!empty($soc->fk_incoterms) ? $soc->fk_incoterms : ''), (!empty($soc->location_incoterms)?$soc->location_incoterms:'')); print '
' . $langs->trans("DefaultModel") . ''; + print ''; $liste = ModelePDFPropales::liste_modeles($db); print $form->selectarray('model', $liste, ($conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT ? $conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT : $conf->global->PROPALE_ADDON_PDF)); print "
'.fieldLabel('Currency','multicurrency_code').''; + print ''; print $form->selectMultiCurrency($currency_code, 'multicurrency_code', 0); print '
' . $langs->trans('NotePublic') . ''; + print ''; $note_public = $object->getDefaultCreateValueFor('note_public', (is_object($objectsrc)?$objectsrc->note_public:null)); $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); print $doleditor->Create(1); @@ -1531,7 +1516,7 @@ if ($action == 'create') { print '
' . $langs->trans('NotePrivate') . ''; + print ''; $note_private = $object->getDefaultCreateValueFor('note_private', ((! empty($origin) && ! empty($originid) && is_object($objectsrc))?$objectsrc->note_private:null)); $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); print $doleditor->Create(1); @@ -1540,10 +1525,8 @@ if ($action == 'create') } // 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 + $parameters = array(); + $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)) { print $object->showOptionals($extrafields, 'edit'); } @@ -1578,19 +1561,19 @@ if ($action == 'create') elseif ($newclassname == 'Fichinter') $newclassname = 'Intervention'; - print '
' . $langs->trans($newclassname) . '' . $objectsrc->getNomUrl(1) . '
' . $langs->trans('TotalHT') . '' . price($objectsrc->total_ht, 0, $langs, 1, -1, -1, $conf->currency) . '
' . $langs->trans('TotalVAT') . '' . price($objectsrc->total_tva, 0, $langs, 1, -1, -1, $conf->currency) . "
' . $langs->trans($newclassname) . '' . $objectsrc->getNomUrl(1) . '
' . $langs->trans('TotalHT') . '' . price($objectsrc->total_ht, 0, $langs, 1, -1, -1, $conf->currency) . '
' . $langs->trans('TotalVAT') . '' . price($objectsrc->total_tva, 0, $langs, 1, -1, -1, $conf->currency) . "
' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '' . price($objectsrc->total_localtax1, 0, $langs, 1, -1, -1, $conf->currency) . "
' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '' . price($objectsrc->total_localtax1, 0, $langs, 1, -1, -1, $conf->currency) . "
' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '' . price($objectsrc->total_localtax2, 0, $langs, 1, -1, -1, $conf->currency) . "
' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '' . price($objectsrc->total_localtax2, 0, $langs, 1, -1, -1, $conf->currency) . "
' . $langs->trans('TotalTTC') . '' . price($objectsrc->total_ttc, 0, $langs, 1, -1, -1, $conf->currency) . "
' . $langs->trans('TotalTTC') . '' . price($objectsrc->total_ttc, 0, $langs, 1, -1, -1, $conf->currency) . "
\n"; @@ -2036,43 +2019,6 @@ if ($action == 'create') print ''; } - // Project - /* - if (! empty($conf->projet->enabled)) - { - $langs->load("projects"); - print ''; - print ''; - if ($user->rights->propal->creer) - { - if ($action != 'classify') - print ''; - print '
'; - print $langs->trans('Project') . '' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '
'; - print ''; - if ($action == 'classify') { - $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1); - } else { - $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0); - } - print ''; - } else { - print ''; - if (! empty($object->fk_project)) { - print ''; - $proj = new Project($db); - $proj->fetch($object->fk_project); - print ''; - print $proj->ref; - print ''; - print ''; - } else { - print ' '; - } - } - print ''; - }*/ - if ($soc->outstanding_limit) { // Outstanding Bill @@ -2129,7 +2075,6 @@ if ($action == 'create') } // Other attributes - $cols = 2; include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; print ''; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index ebd8864568a..189d13c3ced 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -49,7 +49,7 @@ if (! empty($conf->projet->enabled)) { require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; } - + require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; if (!empty($conf->variants->enabled)) { @@ -116,7 +116,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e if (empty($reshook)) { - if ($cancel) + if ($cancel) { if ($action != 'addlink' && $action != 'updateline') { @@ -130,7 +130,7 @@ if (empty($reshook)) } $action=''; } - + include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once @@ -379,7 +379,7 @@ if (empty($reshook)) $tva_tx = $lines[$i]->tva_tx; if (! empty($lines[$i]->vat_src_code) && ! preg_match('/\(/', $tva_tx)) $tva_tx .= ' ('.$lines[$i]->vat_src_code.')'; - + $result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $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_options, $lines[$i]->fk_unit, $object->origin, $lines[$i]->rowid); if ($result < 0) { @@ -779,7 +779,7 @@ if (empty($reshook)) $tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx)); $tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx)); - + // if price ht is forced (ie: calculated by margin rate and cost price). TODO Why this ? if (! empty($price_ht)) { $pu_ht = price2num($price_ht, 'MU'); @@ -1457,10 +1457,10 @@ if ($action == 'create' && $user->rights->commande->creer) print ''; // Reference - print ''; + print ''; // Reference client - print ''; else @@ -1471,12 +1471,12 @@ if ($action == 'create' && $user->rights->commande->creer) print ''; print ''; if ($socid > 0) { - print ''; } else { - print ''; // Ligne info remises tiers - print ''; } // Date - print ''; // Delivery date planed - print ""; // Conditions de reglement - print ''; // Mode de reglement - print ''; // Bank Account if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER) && ! empty($conf->banque->enabled)) { - print ''; } // Delivery delay - print ''; // Shipping Method if (! empty($conf->expedition->enabled)) { - print ''; } @@ -1565,13 +1565,13 @@ if ($action == 'create' && $user->rights->commande->creer) if (! empty($conf->expedition->enabled) && ! empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) { require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; $formproduct=new FormProduct($db); - print ''; } // What trigger creation - print ''; @@ -1582,7 +1582,7 @@ if ($action == 'create' && $user->rights->commande->creer) { $langs->load("projects"); print ''; - print ''; @@ -1594,7 +1594,7 @@ if ($action == 'create' && $user->rights->commande->creer) { print ''; print ''; - print ''; - print ''; print ''; - print ''; } @@ -1635,7 +1634,7 @@ if ($action == 'create' && $user->rights->commande->creer) // Note public print ''; print ''; - print ''; print ''; - print ''; - print ''; - print '"; + print ''; + print ''; + print '"; if ($mysoc->localtax1_assuj == "1" || $objectsrc->total_localtax1 != 0) // Localtax1 RE { - print '"; + print '"; } if ($mysoc->localtax2_assuj == "1" || $objectsrc->total_localtax2 != 0) // Localtax2 IRPF { - print '"; + print '"; } - print '"; + print '"; if (!empty($conf->multicurrency->enabled)) { - print ''; - print '"; - print '"; + print ''; + print '"; + print '"; } } @@ -2240,7 +2239,7 @@ if ($action == 'create' && $user->rights->commande->creer) } print ''; */ - + $tmparray=$object->getTotalWeightVolume(); $totalWeight=$tmparray['weight']; $totalVolume=$tmparray['volume']; @@ -2269,7 +2268,7 @@ if ($action == 'create' && $user->rights->commande->creer) else print ' '; print '
' . $langs->trans('Ref') . '' . $langs->trans("Draft") . '
' . $langs->trans('Ref') . '' . $langs->trans("Draft") . '
' . $langs->trans('RefCustomer') . ''; + print '
' . $langs->trans('RefCustomer') . ''; if (!empty($conf->global->MAIN_USE_PROPAL_REFCLIENT_FOR_ORDER) && ! empty($origin) && ! empty($originid)) print '
' . $langs->trans('Customer') . ''; + print ''; print $soc->getNomUrl(1); print ''; print ''; + print ''; print $form->select_company('', 'socid', 's.client = 1 OR s.client = 3', 'SelectThirdParty'); // reload page to retrieve customer informations if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE)) @@ -1497,12 +1497,12 @@ if ($action == 'create' && $user->rights->commande->creer) // Contact of order if ($socid > 0) { - print "
" . $langs->trans("DefaultContact") . ''; + print "
" . $langs->trans("DefaultContact") . ''; $form->select_contacts($soc->id, $setcontact, 'contactid', 1, $srccontactslist); print '
' . $langs->trans('Discounts') . ''; + print '
' . $langs->trans('Discounts') . ''; if ($soc->remise_percent) print $langs->trans("CompanyHasRelativeDiscount", $soc->remise_percent); else @@ -1517,12 +1517,12 @@ if ($action == 'create' && $user->rights->commande->creer) print '
' . $langs->trans('Date') . ''; + print '
' . $langs->trans('Date') . ''; $form->select_date('', 're', '', '', '', "crea_commande", 1, 1); // Always autofill date with current date print '
".$langs->trans("DateDeliveryPlanned").''; + print "
".$langs->trans("DateDeliveryPlanned").''; if (empty($datedelivery)) { if (! empty($conf->global->DATE_LIVRAISON_WEEK_DELAY)) $datedelivery = time() + ((7*$conf->global->DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60); @@ -1532,31 +1532,31 @@ if ($action == 'create' && $user->rights->commande->creer) print "
' . $langs->trans('PaymentConditionsShort') . ''; + print '
' . $langs->trans('PaymentConditionsShort') . ''; $form->select_conditions_paiements($cond_reglement_id, 'cond_reglement_id', - 1, 1); print '
' . $langs->trans('PaymentMode') . ''; + print '
' . $langs->trans('PaymentMode') . ''; $form->select_types_paiements($mode_reglement_id, 'mode_reglement_id'); print '
' . $langs->trans('BankAccount') . ''; + print '
' . $langs->trans('BankAccount') . ''; $form->select_comptes($fk_account, 'fk_account', 0, '', 1); print '
' . $langs->trans('AvailabilityPeriod') . ''; + print '
' . $langs->trans('AvailabilityPeriod') . ''; $form->selectAvailabilityDelay($availability_id, 'availability_id', '', 1); print '
' . $langs->trans('SendingMethod') . ''; + print '
' . $langs->trans('SendingMethod') . ''; print $form->selectShippingMethod($shipping_method_id, 'shipping_method_id', '', 1); print '
' . $langs->trans('Warehouse') . ''; + print '
' . $langs->trans('Warehouse') . ''; print $formproduct->selectWarehouses($warehouse_id, 'warehouse_id', '', 1); print '
' . $langs->trans('Source') . ''; + print '
' . $langs->trans('Source') . ''; $form->selectInputReason($demand_reason_id, 'demand_reason_id', '', 1); print '
' . $langs->trans("Project") . ''; + print '' . $langs->trans("Project") . ''; $numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0); print '   id).'">' . $langs->trans("AddProject") . ''; print '
'; + print ''; $incoterm_id = GETPOST('incoterm_id'); $incoterm_location = GETPOST('location_incoterms'); if (empty($incoterm_id)) @@ -1607,16 +1607,15 @@ if ($action == 'create' && $user->rights->commande->creer) } // Other attributes - $parameters = array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"', 'socid'=>$socid); + $parameters = array('objectsrc' => $objectsrc, 'socid'=>$socid); $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)) { print $object->showOptionals($extrafields, 'edit'); } // Template to use by default print '
' . $langs->trans('DefaultModel') . ''; + print ''; include_once DOL_DOCUMENT_ROOT . '/core/modules/commande/modules_commande.php'; $liste = ModelePDFCommandes::liste_modeles($db); print $form->selectarray('model', $liste, $conf->global->COMMANDE_ADDON_PDF); @@ -1627,7 +1626,7 @@ if ($action == 'create' && $user->rights->commande->creer) { print '
'.fieldLabel('Currency','multicurrency_code').''; + print ''; print $form->selectMultiCurrency($currency_code, 'multicurrency_code'); print '
' . $langs->trans('NotePublic') . ''; + print ''; $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); print $doleditor->Create(1); @@ -1646,7 +1645,7 @@ if ($action == 'create' && $user->rights->commande->creer) if (empty($user->societe_id)) { print '
' . $langs->trans('NotePrivate') . ''; + print ''; $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); print $doleditor->Create(1); @@ -1689,26 +1688,26 @@ if ($action == 'create' && $user->rights->commande->creer) $newclassname = $classname; } - print '
' . $langs->trans($newclassname) . '' . $objectsrc->getNomUrl(1) . '
' . $langs->trans('TotalHT') . '' . price($objectsrc->total_ht) . '
' . $langs->trans('TotalVAT') . '' . price($objectsrc->total_tva) . "
' . $langs->trans($newclassname) . '' . $objectsrc->getNomUrl(1) . '
' . $langs->trans('TotalHT') . '' . price($objectsrc->total_ht) . '
' . $langs->trans('TotalVAT') . '' . price($objectsrc->total_tva) . "
' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '' . price($objectsrc->total_localtax1) . "
' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '' . price($objectsrc->total_localtax1) . "
' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '' . price($objectsrc->total_localtax2) . "
' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '' . price($objectsrc->total_localtax2) . "
' . $langs->trans('TotalTTC') . '' . price($objectsrc->total_ttc) . "
' . $langs->trans('TotalTTC') . '' . price($objectsrc->total_ttc) . "
' . $langs->trans('MulticurrencyTotalHT') . '' . price($objectsrc->multicurrency_total_ht) . '
' . $langs->trans('MulticurrencyTotalVAT') . '' . price($objectsrc->multicurrency_total_tva) . "
' . $langs->trans('MulticurrencyTotalTTC') . '' . price($objectsrc->multicurrency_total_ttc) . "
' . $langs->trans('MulticurrencyTotalHT') . '' . price($objectsrc->multicurrency_total_ht) . '
' . $langs->trans('MulticurrencyTotalVAT') . '' . price($objectsrc->multicurrency_total_tva) . "
' . $langs->trans('MulticurrencyTotalTTC') . '' . price($objectsrc->multicurrency_total_ttc) . "
'; print ''; - print ''; + print ''; if ($action != 'editincoterm') { print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1); @@ -2291,7 +2290,7 @@ if ($action == 'create' && $user->rights->commande->creer) if ($action != 'editbankaccount' && $user->rights->commande->creer) print 'id.'">'.img_edit($langs->trans('SetBankAccount'),1).''; print ''; - print ''; + print ''; if ($action == 'editbankaccount') { $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1); } else { @@ -2302,7 +2301,6 @@ if ($action == 'create' && $user->rights->commande->creer) } // Other attributes - $cols = 2; include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; print ''; @@ -2320,18 +2318,18 @@ if ($action == 'create' && $user->rights->commande->creer) print '' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . ''; print '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ''; print ''; - + // Multicurrency Amount VAT print '' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . ''; print '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ''; print ''; - + // Multicurrency Amount TTC print '' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . ''; print '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ''; print ''; } - + // Total HT print '' . $langs->trans('AmountHT') . ''; print '' . price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency) . ''; diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index b05b6658ca7..8db18cea304 100644 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -411,17 +411,17 @@ if ($action == 'create' && !$error) print ''; // Ref - print ''; + print ''; // Third party - print ''; print ''."\n"; // Type - print ''; // Payment term - print ''; // Payment mode - print ''; // Project @@ -451,7 +451,7 @@ if ($action == 'create' && !$error) $formproject=new FormProjets($db); $langs->load('projects'); - print ''; } @@ -469,9 +469,8 @@ if ($action == 'create' && !$error) } // Other attributes - $parameters=array('objectsrc' => $objectsrc, 'idsrc' => $listoforders, 'colspan' => ' colspan="3"'); + $parameters=array('objectsrc' => $objectsrc, 'idsrc' => $listoforders); $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)) { $object=new Facture($db); @@ -489,8 +488,8 @@ if ($action == 'create' && !$error) // Public note print ''; print ''; - print ''; } @@ -622,7 +621,7 @@ if (($action != 'create' && $action != 'add') || ($action == 'create' && $error) print ''; - + //DATE ORDER print ''; - + //ALL/NONE print ''; print ''; - print ''; + print ''; // Label print ''; - print ''; + print ''; // Type print ''; - print ''; // Currency print ''; - print ''; - print ''; @@ -362,13 +362,13 @@ if ($action == 'create') $object->country_code = getCountry($selectedcode, 2); // Force country code on account to have following field on bank fields matching country rules print ''; - print ''; // State - print ''; - print ''; + print ''; // Tags-Categories - if ($conf->categorie->enabled) + if ($conf->categorie->enabled) { - print ''; - print ''; // Other attributes - $parameters=array('colspan' => 3); + $parameters=array(); $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)) { @@ -422,18 +422,18 @@ if ($action == 'create') // Sold print ''; - print ''; + print ''; print ''; - print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print '
'.$langs->trans('Ref').''.$langs->trans('Draft').'
'.$langs->trans('Ref').''.$langs->trans('Draft').'
'.$langs->trans('Customer').''; + print '
'.$langs->trans('Customer').''; print $soc->getNomUrl(1); print ''; print '
'.$langs->trans('Type').''; + print '
'.$langs->trans('Type').''; print ''."\n"; // Standard invoice @@ -434,15 +434,15 @@ if ($action == 'create' && !$error) print '
'; // Date invoice - print '
'.$langs->trans('Date').''; + print '
'.$langs->trans('Date').''; $html->select_date('','','','','',"add",1,1); print '
'.$langs->trans('PaymentConditionsShort').''; + print '
'.$langs->trans('PaymentConditionsShort').''; $html->select_conditions_paiements(isset($_POST['cond_reglement_id'])?$_POST['cond_reglement_id']:$cond_reglement_id,'cond_reglement_id'); print '
'.$langs->trans('PaymentMode').''; + print '
'.$langs->trans('PaymentMode').''; $html->select_types_paiements(isset($_POST['mode_reglement_id'])?$_POST['mode_reglement_id']:$mode_reglement_id,'mode_reglement_id'); print '
'.$langs->trans('Project').''; + print '
'.$langs->trans('Project').''; $formproject->select_projects($soc->id, $projectid, 'projectid'); print '
'.$langs->trans('NotePublic').''; - print '
'; print ''; print ''; print $period; @@ -637,7 +636,7 @@ if (($action != 'create' && $action != 'add') || ($action == 'create' && $error) print ''; print ''; print ''; if ($conf->use_javascript_ajax) print ''.$langs->trans("All").' / '.$langs->trans("None").''; @@ -653,7 +652,7 @@ if (($action != 'create' && $action != 'add') || ($action == 'create' && $error) while ($i < $num) { $objp = $db->fetch_object($resql); - + print '
'; diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 2cb90b6a44a..7267769379e 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -75,7 +75,7 @@ if ($action == 'add') $error=0; $db->begin(); - + // Create account $object = new Account($db); @@ -116,7 +116,7 @@ if ($action == 'add') $object->comment = trim(GETPOST("account_comment")); $object->fk_user_author = $user->id; - + if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($object->account_number)) { setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("AccountancyCode")), null, 'errors'); @@ -149,7 +149,7 @@ if ($action == 'add') $object->setCategories($categories); $_GET["id"]=$id; // Force chargement page en mode visu - + $action=''; } else { @@ -159,7 +159,7 @@ if ($action == 'add') $action='create'; // Force chargement page en mode creation } } - + if (! $error) { $db->commit(); @@ -324,21 +324,21 @@ if ($action == 'create') // Ref print '
'.$langs->trans("Ref").'ref).'" maxlength="12">
ref).'" maxlength="12">
'.$langs->trans("LabelBankCashAccount").'
'.$langs->trans("AccountType").''; + print ''; $formbank->selectTypeOfBankAccount(isset($_POST["type"])?$_POST["type"]: Account::TYPE_CURRENT,"type"); print '
'.$langs->trans("Currency").''; + print ''; $selectedcode=$object->currency_code; if (! $selectedcode) $selectedcode=$conf->currency; print $form->selectCurrency((isset($_POST["account_currency_code"])?$_POST["account_currency_code"]:$selectedcode), 'account_currency_code'); @@ -348,7 +348,7 @@ if ($action == 'create') // Status print '
'.$langs->trans("Status").''; + print ''; print $form->selectarray("clos", $object->status,(isset($_POST["clos"])?$_POST["clos"]:$object->clos)); print '
'.$langs->trans("BankAccountCountry").''; + print ''; print $form->select_country($selectedcode,'account_country_id'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); print '
'.$langs->trans('State').''; + print '
'.$langs->trans('State').''; if ($selectedcode) { $formcompany->select_departement(isset($_POST["account_state_id"])?$_POST["account_state_id"]:'',$selectedcode,'account_state_id'); @@ -381,12 +381,12 @@ if ($action == 'create') // Web print '
'.$langs->trans("Web").'
'.$langs->trans("Categories").''; + print '
'.$langs->trans("Categories").''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_ACCOUNT, '', 'parent', 64, 0, 1); $c = new Categorie($db); $cats = $c->containing($object->id,Categorie::TYPE_ACCOUNT); @@ -399,7 +399,7 @@ if ($action == 'create') // Comment print '
'.$langs->trans("Comment").''; + print ''; // Editor wysiwyg require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor=new DolEditor('account_comment',(GETPOST("account_comment")?GETPOST("account_comment"):$object->comment),'',90,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,ROWS_4,'90%'); @@ -407,7 +407,7 @@ if ($action == 'create') print '
'.$langs->trans("InitialBankBalance").'solde)).'">
solde)).'">
'.$langs->trans("Date").''; + print ''; $form->select_date('', 're', 0, 0, 0, 'formsoc'); print '
'.$langs->trans("BalanceMinimalAllowed").'min_allowed).'">
min_allowed).'">
'.$langs->trans("BalanceMinimalDesired").'min_desired).'">
min_desired).'">
'; print '
'; @@ -444,7 +444,7 @@ if ($action == 'create') // If bank account print ''.$langs->trans("BankName").''; - print ''; + print ''; print ''; // Show fields of bank account @@ -477,21 +477,21 @@ if ($action == 'create') // IBAN print ''.$langs->trans($ibankey).''; - print ''; + print ''; print ''.$langs->trans($bickey).''; - print ''; + print ''; - print ''.$langs->trans("BankAccountDomiciliation").''; + print ''.$langs->trans("BankAccountDomiciliation").''; print ""; print ''.$langs->trans("BankAccountOwner").''; - print ''; + print ''; print ''; - print ''.$langs->trans("BankAccountOwnerAddress").''; + print ''.$langs->trans("BankAccountOwnerAddress").''; print ""; @@ -503,8 +503,8 @@ if ($action == 'create') print ''; // Accountancy code $fieldrequired=''; - if (! empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) $fieldrequired='fieldrequired '; - + if (! empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) $fieldrequired='fieldrequired '; + if (! empty($conf->accounting->enabled)) { print ''; @@ -515,7 +515,7 @@ if ($action == 'create') else { print ''; - print ''; + print ''; } // Accountancy journal @@ -565,10 +565,10 @@ else // Onglets $head=bank_prepare_head($object); - dol_fiche_head($head, 'bankname', $langs->trans("FinancialAccount"),0,'account'); + dol_fiche_head($head, 'bankname', $langs->trans("FinancialAccount"), -1, 'account'); $formconfirm = ''; - + // Confirmation to delete if ($action == 'delete') { @@ -578,24 +578,24 @@ else // Print form confirm print $formconfirm; - + $linkback = ''.$langs->trans("BackToList").''; - + $morehtmlref=''; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); - - + + print '
'; print '
'; print '
'; - + print '
'.$langs->trans("AccountancyCode").'
'.$langs->trans("AccountancyCode").'account_number).'">
account_number).'">
'; // Ref /* print ''; - print '';*/ @@ -662,25 +662,25 @@ else print $object->account_number; } print ''; - + // Accountancy journal if (! empty($conf->accounting->enabled)) { print ''; print ''; } - + // Other attributes $cols = 2; include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; - + print '
'.$langs->trans("Ref").''; + print ''; print $form->showrefnav($object, 'ref', $linkback, 1, 'ref'); print '
'.$langs->trans("AccountancyJournal").''; - + $accountingjournal = new AccountingJournal($db); $accountingjournal->fetch($object->fk_accountancy_journal); print $accountingjournal->getNomUrl(0,1,1,'',1); - + print '
'; print '
'; @@ -689,7 +689,7 @@ else print '
'; print ''; - + // Categories if ($conf->categorie->enabled) { print '"; - print ''; @@ -374,7 +374,7 @@ else if ($id) // Public note print ''; - print ''; - print '
'.$langs->trans("Categories").''; @@ -705,9 +705,9 @@ else if ($object->type == Account::TYPE_SAVINGS || $object->type == Account::TYPE_CURRENT) { print '
'; - + print '
'; - + print ''; print ''; @@ -726,7 +726,7 @@ else } print ''; - print ''; + print ''; print ''; } @@ -776,7 +776,7 @@ else print ''; print '
'; - + dol_fiche_end(); /* @@ -839,7 +839,7 @@ else dol_fiche_head(''); print '
'; - + print '
'.$langs->trans("BankName").'
'.$langs->trans($val).''.$content.''.$content.'
'; // Ref @@ -921,7 +921,7 @@ else print ''; // Tags-Categories - if ($conf->categorie->enabled) + if ($conf->categorie->enabled) { print ''; // Other attributes - $parameters=array('colspan' => 3); + $parameters=array(); $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)) { print $object->showOptionals($extrafields,'edit'); } + print '
'.$langs->trans("Categories").''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_ACCOUNT, '', 'parent', 64, 0, 1); @@ -944,12 +944,13 @@ else print '
'; print '
'; diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index 20c49c71468..c0481829425 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -74,7 +74,7 @@ if ($action == 'add' && empty($cancel)) $datep=dol_mktime(12,0,0, GETPOST("datepmonth"), GETPOST("datepday"), GETPOST("datepyear")); $datev=dol_mktime(12,0,0, GETPOST("datevmonth"), GETPOST("datevday"), GETPOST("datevyear")); if (empty($datev)) $datev=$datep; - + $object->accountid=GETPOST("accountid") > 0 ? GETPOST("accountid","int") : 0; $object->datev=$datev; $object->datep=$datep; @@ -207,7 +207,7 @@ if ($action == 'create') print load_fiche_titre($langs->trans("NewVariousPayment"),'', 'title_accountancy.png'); dol_fiche_head('', ''); - + print ''; // Date payment @@ -274,7 +274,7 @@ if ($action == 'create') print $formaccounting->select_account($accountancy_code, 'accountancy_code', 1, null, 1, 1, ''); print ''; } - else // For external software + else // For external software { print ''; print '
'.$langs->trans("AccountAccounting").''; @@ -282,7 +282,7 @@ if ($action == 'create') } // Other attributes - $parameters=array('colspan' => ' colspan="1"'); + $parameters=array(); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook print '
'; @@ -315,7 +315,7 @@ if ($id) print ''; $linkback = ''.$langs->trans("BackToList").''; - + print ""; print '
'.$langs->trans("Ref").''; print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'ref', ''); @@ -372,14 +372,14 @@ if ($id) } // Other attributes - $parameters=array('colspan' => ' colspan="1"'); - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + $parameters=array('socid'=>$object->id); + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; print '
'; dol_fiche_end(); - + /* * Action buttons */ diff --git a/htdocs/compta/deplacement/card.php b/htdocs/compta/deplacement/card.php index aa315e5c854..949a7701698 100644 --- a/htdocs/compta/deplacement/card.php +++ b/htdocs/compta/deplacement/card.php @@ -251,7 +251,7 @@ if ($action == 'create') print ''; print ""; - print ''; @@ -277,7 +277,7 @@ if ($action == 'create') // Public note print ''; print ''; - print ''; print ''; - print '
'.$langs->trans("Type").''; + print ''.$langs->trans("Type").''; $form->select_type_fees(GETPOST('type','int'),'type',1); print '
'.$langs->trans('NotePublic').''; + print ''; $doleditor = new DolEditor('note_public', GETPOST('note_public', 'alpha'), '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8,'90%'); print $doleditor->Create(1); @@ -289,7 +289,7 @@ if ($action == 'create') { print '
'.$langs->trans('NotePrivate').''; + print ''; $doleditor = new DolEditor('note_private', GETPOST('note_private', 'alpha'), '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '90%'); print $doleditor->Create(1); @@ -298,7 +298,7 @@ if ($action == 'create') } // Other attributes - $parameters=array('colspan' => ' colspan="2"'); + $parameters=array(); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook print '
'; @@ -340,7 +340,7 @@ else if ($id) // Ref print "
'.$langs->trans("Ref").''; + print ''.$langs->trans("Ref").''; print $object->ref; print '
'.$langs->trans("NotePublic").''; + print ''; $doleditor = new DolEditor('note_public', $object->note_public, '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '90%'); print $doleditor->Create(1); @@ -385,7 +385,7 @@ else if ($id) if (empty($user->societe_id)) { print '
'.$langs->trans("NotePrivate").''; + print ''; $doleditor = new DolEditor('note_private', $object->note_private, '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '90%'); print $doleditor->Create(1); @@ -394,7 +394,7 @@ else if ($id) } // Other attributes - $parameters=array('colspan' => ' colspan="3"'); + $parameters=array(); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook print '
'; @@ -412,7 +412,7 @@ else if ($id) else { /* - * Confirm delete trip + * Confirm delete trip */ if ($action == 'delete') { @@ -501,9 +501,9 @@ else if ($id) // Statut print ''.$langs->trans("Status").''.$object->getLibStatut(4).''; - // Other attributes - $parameters=array('colspan' => ' colspan="3"', 'showblocbydefault' => 1); - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + // Other attributes + $parameters=array('socid'=>$object->id); + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; print "
"; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index b739e551b9d..e9be0a0b962 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -615,7 +615,7 @@ if (empty($reshook)) $db->begin(); $amount_ht = $amount_tva = $amount_ttc = array(); - + // Loop on each vat rate $i = 0; foreach ($object->lines as $line) @@ -644,19 +644,19 @@ if (empty($reshook)) $discount->fk_facture_source = $object->id; $error = 0; - - if ($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT || $object->type == Facture::TYPE_SITUATION) + + if ($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT || $object->type == Facture::TYPE_SITUATION) { // If we're on a standard invoice, we have to get excess received to create a discount in TTC without VAT - + $sql = 'SELECT SUM(pf.amount) as total_paiements FROM llx_c_paiement as c, llx_paiement_facture as pf, llx_paiement as p WHERE pf.fk_facture = '.$object->id.' AND p.fk_paiement = c.id AND pf.fk_paiement = p.rowid ORDER BY p.datep, p.tms'; - + $resql = $db->query($sql); $res = $db->fetch_object($resql); $total_paiements = $res->total_paiements; - + $discount->amount_ht = $discount->amount_ttc = $total_paiements - $object->total_ttc; $discount->amount_tva = 0; $discount->tva_tx = 0; @@ -666,7 +666,7 @@ if (empty($reshook)) { $error++; } - + } if ($object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT) { @@ -676,7 +676,7 @@ if (empty($reshook)) $discount->amount_tva = abs($amount_tva[$tva_tx]); $discount->amount_ttc = abs($amount_ttc[$tva_tx]); $discount->tva_tx = abs($tva_tx); - + $result = $discount->create($user); if ($result < 0) { @@ -684,7 +684,7 @@ if (empty($reshook)) break; } } - + } if (empty($error)) @@ -1027,7 +1027,7 @@ if (empty($reshook)) } $id = $object->create($user); // This include class to add_object_linked() and add add_contact() - + if ($id > 0) { dol_include_once('/' . $element . '/class/' . $subelement . '.class.php'); @@ -1049,13 +1049,13 @@ if (empty($reshook)) { if ($typeamount == 'amount') $amount = $valuedeposit; else $amount = $srcobject->total_ttc * ($valuedeposit / 100); - + $TTotalByTva = array(); foreach ($srcobject->lines as &$line) { $TTotalByTva[$line->tva_tx] += $line->total_ttc ; } - + $amount_to_diff = 0; foreach ($TTotalByTva as $tva => &$total) { @@ -1099,10 +1099,10 @@ if (empty($reshook)) $error ++; } } - + $amount_ttc_diff = $amountdeposit[0]; } - + foreach ($amountdeposit as $tva => $amount) { $result = $object->addline( @@ -1116,7 +1116,7 @@ if (empty($reshook)) 0, // remise_percent 0, // date_start 0, // date_end - 0, + 0, $lines[$i]->info_bits, // info_bits 0, 'HT', @@ -1132,16 +1132,16 @@ if (empty($reshook)) $langs->trans('Deposit') ); } - + $diff = $object->total_ttc - $amount_ttc_diff; - + if (!empty($conf->global->MAIN_DEPOSIT_MULTI_TVA) && $diff != 0) { $object->fetch_lines(); $subprice_diff = $object->lines[0]->subprice - $diff / (1 + $object->lines[0]->tva_tx / 100); $object->updateline($object->lines[0]->id, $object->lines[0]->desc, $subprice_diff, $object->lines[0]->qty, $object->lines[0]->remise_percent, $object->lines[0]->date_start, $object->lines[0]->date_end, $object->lines[0]->tva_tx, 0, 0, 'HT', $object->lines[0]->info_bits, $object->lines[0]->product_type, 0, 0, 0, $object->lines[0]->pa_ht, $object->lines[0]->label, 0, array(), 100); } - + } else { @@ -1219,7 +1219,7 @@ if (empty($reshook)) $tva_tx = $lines[$i]->tva_tx; if (! empty($lines[$i]->vat_src_code) && ! preg_match('/\(/', $tva_tx)) $tva_tx .= ' ('.$lines[$i]->vat_src_code.')'; - + // View third's localtaxes for NOW and do not use value from origin. // TODO Is this really what we want ? Yes if source if template invoice but what if proposal or order ? $localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty); @@ -1556,7 +1556,7 @@ if (empty($reshook)) $tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx)); $tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx)); - + // if price ht was forced (ie: from gui when calculated by margin rate and cost price). TODO Why this ? if (! empty($price_ht)) { @@ -2123,11 +2123,11 @@ if ($action == 'create') if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code; } - + if (!empty($soc->id)) $absolute_discount = $soc->getAvailableDiscounts(); $note_public = $object->getDefaultCreateValueFor('note_public', (is_object($objectsrc)?$objectsrc->note_public:null)); $note_private = $object->getDefaultCreateValueFor('note_private', ((! empty($origin) && ! empty($originid) && is_object($objectsrc))?$objectsrc->note_private:null)); - + if (! empty($conf->use_javascript_ajax)) { require_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; @@ -2331,7 +2331,7 @@ if ($action == 'create') if ((empty($origin)) || ((($origin == 'propal') || ($origin == 'commande')) && (! empty($originid)))) { // Deposit - if (empty($conf->global->INVOICE_DISABLE_DEPOSIT)) + if (empty($conf->global->INVOICE_DISABLE_DEPOSIT)) { print '
'; $tmp=' '; @@ -2342,7 +2342,7 @@ if ($action == 'create') }); }); '; - + $desc = $form->textwithpicto($tmp.$langs->trans("InvoiceDeposit"), $langs->transnoentities("InvoiceDepositDesc"), 1, 'help', '', 0, 3); print '
'; print $desc; @@ -2356,7 +2356,7 @@ if ($action == 'create') print '' . $langs->trans('Value') . ':'; } print '
'; - + print '
'; } } @@ -2388,7 +2388,7 @@ if ($action == 'create') } // Replacement - if (empty($conf->global->INVOICE_DISABLE_REPLACEMENT)) + if (empty($conf->global->INVOICE_DISABLE_REPLACEMENT)) { print ''; print '
'; @@ -2435,7 +2435,7 @@ if ($action == 'create') if ($socid > 0) { // Credit note - if (empty($conf->global->INVOICE_DISABLE_CREDIT_NOTE)) + if (empty($conf->global->INVOICE_DISABLE_CREDIT_NOTE)) { print '
'; $tmp='textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1, 'help', '', 0, 3); print $desc; - + print '
'; print '    0 ? 'checked':'').' /> "; print '
    0 ? 'checked':'').' /> "; print '
'; - + print '
'; } } @@ -2492,7 +2492,7 @@ if ($action == 'create') print '
' . "\n"; } } - + // Template invoice print '
'; $tmp=' '; @@ -2589,9 +2589,8 @@ if ($action == 'create') } // Other attributes - $parameters = array('objectsrc' => $objectsrc,'colspan' => ' colspan="3"'); - $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by - // hook + $parameters = array('objectsrc' => $objectsrc,'colspan' => ' colspan="2"', 'cols'=>2); + $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)) { print $object->showOptionals($extrafields, 'edit'); } @@ -2731,7 +2730,7 @@ if ($action == 'create') { print '' . $langs->trans('MulticurrencyTotalHT') . '' . price($objectsrc->multicurrency_total_ht) . ''; print '' . $langs->trans('MulticurrencyTotalVAT') . '' . price($objectsrc->multicurrency_total_tva) . ""; - print '' . $langs->trans('MulticurrencyTotalTTC') . '' . price($objectsrc->multicurrency_total_ttc) . ""; + print '' . $langs->trans('MulticurrencyTotalTTC') . '' . price($objectsrc->multicurrency_total_ttc) . ""; } } @@ -3488,21 +3487,21 @@ else if ($id > 0 || ! empty($ref)) print '
'; print '
'; print '
'; - + print ''; - + if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) { // Multicurrency Amount HT print ''; print ''; print ''; - + // Multicurrency Amount VAT print ''; print ''; print ''; - + // Multicurrency Amount TTC print ''; print ''; @@ -3584,12 +3583,12 @@ else if ($id > 0 || ! empty($ref)) $nbrows += 5; if (! empty($conf->incoterm->enabled)) $nbrows += 1; - - if ($object->type == Facture::TYPE_SITUATION && ! empty($conf->global->INVOICE_USE_SITUATION)) + + if ($object->type == Facture::TYPE_SITUATION && ! empty($conf->global->INVOICE_USE_SITUATION)) { if (count($object->tab_previous_situation_invoice) > 0 || count($object->tab_next_situation_invoice) > 0) print '
' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
'; - + if (count($object->tab_previous_situation_invoice) > 0) { // List of previous invoices print ''; @@ -3601,7 +3600,7 @@ else if ($id > 0 || ! empty($ref)) print ''; print ''; print ''; - + $total_prev_ht = $total_prev_ttc = 0; foreach ($object->tab_previous_situation_invoice as $prev_invoice) { $totalpaye = $prev_invoice->getSommePaiement(); @@ -3616,9 +3615,9 @@ else if ($id > 0 || ! empty($ref)) print ''; print ''; print ''; - + } - + print ''; print ''; print ''; @@ -3626,7 +3625,7 @@ else if ($id > 0 || ! empty($ref)) print ''; print ''; } - + if (count($object->tab_next_situation_invoice) > 0) { // List of next invoices print ''; @@ -3637,9 +3636,9 @@ else if ($id > 0 || ! empty($ref)) print ''; print ''; print ''; - + $total_next_ht = $total_next_ttc = 0; - + foreach ($object->tab_next_situation_invoice as $next_invoice) { $totalpaye = $next_invoice->getSommePaiement(); $total_next_ht += $next_invoice->total_ht; @@ -3652,9 +3651,9 @@ else if ($id > 0 || ! empty($ref)) print ''; print ''; print ''; - + } - + print ''; print ''; if (! empty($conf->banque->enabled)) print ''; @@ -3664,7 +3663,7 @@ else if ($id > 0 || ! empty($ref)) print ''; print ''; } - + if (count($object->tab_previous_situation_invoice) > 0 || count($object->tab_next_situation_invoice) > 0) print '
' . $langs->trans('AmountTTC') . ' 
' . price($prev_invoice->total_ttc) . '' . $prev_invoice->getLibStatut(3, $totalpaye) . '
' . price($total_prev_ht) . ' 
' . $langs->trans('AmountTTC') . ' 
' . price($next_invoice->total_ttc) . '' . $next_invoice->getLibStatut(3, $totalpaye) . '
 
'; } @@ -3741,7 +3740,7 @@ else if ($id > 0 || ! empty($ref)) print ''; $i ++; } - } + } /*else { print '' . $langs->trans("None") . ''; }*/ @@ -3837,7 +3836,7 @@ else if ($id > 0 || ! empty($ref)) // Billed print '' . $langs->trans("Billed") . ' :' . price($object->total_ttc) . ' '; - + // Remainder to pay print ''; if ($resteapayeraffiche >= 0) @@ -3847,11 +3846,11 @@ else if ($id > 0 || ! empty($ref)) print ' :'; print '' . price($resteapayeraffiche) . ''; print ' '; - } + } else // Credit note { $cssforamountpaymentcomplete=''; - + // Total already paid back print ''; print $langs->trans('AlreadyPaidBack'); @@ -3909,14 +3908,14 @@ else if ($id > 0 || ! empty($ref)) { if ($object->situation_cycle_ref && $object->statut == 0) { print '
'; - + print ''; print ''; print ''; print ''; - + print ''; - + print ''; if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { @@ -3954,11 +3953,11 @@ else if ($id > 0 || ! empty($ref)) print ''; print ''; print ''; - + print '
%
'; - + print ''; - + print '
'; } } @@ -3969,14 +3968,14 @@ else if ($id > 0 || ! empty($ref)) '; - + if (! empty($conf->use_javascript_ajax) && $object->statut == 0) { include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php'; } - + print '
'; print ''; - + // Show object lines if (! empty($object->lines)) $ret = $object->printObjectLines($action, $mysoc, $soc, $lineid, 1); @@ -4037,10 +4036,10 @@ else if ($id > 0 || ! empty($ref)) } } } - + $discount = new DiscountAbsolute($db); $result = $discount->fetch(0, $object->id); - + // Reopen a standard paid invoice if ((($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT) || ($object->type == Facture::TYPE_CREDIT_NOTE && empty($discount->id)) @@ -4097,7 +4096,7 @@ else if ($id > 0 || ! empty($ref)) //print ''.$langs->trans("MakeWithdrawRequest").''; } } - + // Create payment if ($object->type != Facture::TYPE_CREDIT_NOTE && $object->statut == 1 && $object->paye == 0 && $user->rights->facture->paiement) { if ($objectidnext) { @@ -4253,7 +4252,7 @@ else if ($id > 0 || ! empty($ref)) // Show links to link elements $linktoelem = $form->showLinkToObjectBlock($object, null, array('invoice')); $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); - + // Link for paypal payment if (! empty($conf->paypal->enabled) && $object->statut != 0) { include_once DOL_DOCUMENT_ROOT . '/paypal/lib/paypal.lib.php'; diff --git a/htdocs/compta/localtax/card.php b/htdocs/compta/localtax/card.php index 1772b6861dd..315b89637af 100644 --- a/htdocs/compta/localtax/card.php +++ b/htdocs/compta/localtax/card.php @@ -158,7 +158,7 @@ if ($id) if ($action == 'create') { print load_fiche_titre($langs->transcountry($lttype==2?"newLT2Payment":"newLT1Payment",$mysoc->country_code)); - + print ''."\n"; print ''; print ''; @@ -193,14 +193,14 @@ if ($action == 'create') $form->select_types_paiements(GETPOST("paiementtype"), "paiementtype"); print "\n"; print ""; - + // Number print ''."\n"; } // Other attributes - $parameters=array('colspan' => ' colspan="1"'); + $parameters=array(); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook print '
'.$langs->trans('Numero'); print ' ('.$langs->trans("ChequeOrTransferNumber").')'; print '
'; @@ -237,20 +237,20 @@ if ($id) print ''; print ""; - print ''; print ""; - print ''; - print ''; - print ''; + print ''; if (! empty($conf->banque->enabled)) { @@ -261,7 +261,7 @@ if ($id) print ''; print ''; - print ''; print ''; @@ -269,13 +269,13 @@ if ($id) } // Other attributes - $parameters=array('colspan' => ' colspan="3"'); + $parameters=array(); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$vatpayment,$action); // Note that $action and $object may have been modified by hook - + print '
'.$langs->trans("Ref").''; + print ''.$langs->trans("Ref").''; print $vatpayment->ref; print '
'.$langs->trans("DatePayment").''; + print ''.$langs->trans("DatePayment").''; print dol_print_date($vatpayment->datep,'day'); print '
'.$langs->trans("DateValue").''; + print '
'.$langs->trans("DateValue").''; print dol_print_date($vatpayment->datev,'day'); print '
'.$langs->trans("Amount").''.price($vatpayment->amount).'
'.$langs->trans("Amount").''.price($vatpayment->amount).'
'.$langs->trans('BankTransactionLine').''; + print ''; print $bankline->getNomUrl(1,0,'showall'); print '
'; dol_fiche_end(); - + /* * Boutons d'actions diff --git a/htdocs/compta/prelevement/bons.php b/htdocs/compta/prelevement/bons.php index 41f6abb25c5..9a5585c2513 100644 --- a/htdocs/compta/prelevement/bons.php +++ b/htdocs/compta/prelevement/bons.php @@ -1,6 +1,6 @@ - * Copyright (C) 2005-2008 Laurent Destailleur + * Copyright (C) 2005-2017 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2010-2012 Juanjo Menent * @@ -107,33 +107,32 @@ if ($result) print ''; print ''; print ''; - + print_barre_liste($langs->trans("WithdrawalsReceipts"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic', 0, '', '', $limit); $moreforfilter=''; - + print '
'; print ''."\n"; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print_liste_field_titre($langs->trans("WithdrawalsReceipts"),$_SERVER["PHP_SELF"],"p.ref",'','','class="liste_titre"'); print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"p.datec","","",'class="liste_titre" align="center"'); print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"","","",'align="center"'); print "\n"; - print ''; - print ''; - print ''; - print ''; - print ''; - - while ($i < min($num,$limit)) { - $obj = $db->fetch_object($result); + $obj = $db->fetch_object($result); print '
 '; + $searchpicto=$form->showFilterButtons(); + print $searchpicto; + print '
 '; - $searchpicto=$form->showFilterAndCheckAddButtons(0); - print $searchpicto; - print '
'; @@ -151,9 +150,9 @@ if ($result) } print "
"; print '
'; - + print ''; - + $db->free($result); } else diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 5d77a9b9771..0834b3500a7 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -94,9 +94,7 @@ llxHeader('', $langs->trans("NewStandingOrder")); if (prelevement_check_config() < 0) { $langs->load("errors"); - print '
'; - print $langs->trans("ErrorModuleSetupNotComplete"); - print '
'; + setEventMessages($langs->trans("ErrorModuleSetupNotComplete"), null, 'errors'); } /*$h=0; @@ -148,7 +146,7 @@ if ($nb) } else { - print ''.$langs->trans("CreateAll")."\n"; + print 'transnoentitiesnoconv("StandingOrders"))).'">'.$langs->trans("CreateAll")."\n"; } print "
\n"; @@ -194,7 +192,7 @@ if ($resql) while ($i < $num && $i < 20) { $obj = $db->fetch_object($resql); - + print ''; print ''; $invoicestatic->id=$obj->rowid; @@ -268,7 +266,7 @@ if ($result) while ($i < min($num,$limit)) { $obj = $db->fetch_object($result); - + print ''; diff --git a/htdocs/compta/prelevement/index.php b/htdocs/compta/prelevement/index.php index 32257a71a0f..271ce4da7fe 100644 --- a/htdocs/compta/prelevement/index.php +++ b/htdocs/compta/prelevement/index.php @@ -129,7 +129,7 @@ if ($resql) $invoicestatic->type=$obj->type; $alreadypayed=$invoicestatic->getSommePaiement(); - + print ''; print $invoicestatic->getNomUrl(1,'withdraw'); print ''; @@ -157,7 +157,7 @@ if ($resql) } else { - print ''.$langs->trans("NoInvoiceToWithdraw").''; + print ''.$langs->trans("NoInvoiceToWithdraw", $langs->transnoentitiesnoconv("StandingOrders")).''; } print "
"; } @@ -197,7 +197,7 @@ if ($result) while ($i < min($num,$limit)) { $obj = $db->fetch_object($result); - + print ''; diff --git a/htdocs/compta/prelevement/list.php b/htdocs/compta/prelevement/list.php index e9e46b6afff..208be88aeae 100644 --- a/htdocs/compta/prelevement/list.php +++ b/htdocs/compta/prelevement/list.php @@ -130,10 +130,24 @@ if ($result) print '
'; $moreforfilter=''; - + print '
'; print ''."\n"; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print_liste_field_titre($langs->trans("Line"),$_SERVER["PHP_SELF"]); print_liste_field_titre($langs->trans("WithdrawalsReceipts"),$_SERVER["PHP_SELF"],"p.ref"); @@ -144,24 +158,10 @@ if ($result) print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"pl.amount","","",'align="right"'); print_liste_field_titre(''); print "\n"; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; while ($i < min($num,$limit)) { - $obj = $db->fetch_object($result); + $obj = $db->fetch_object($result); print '
   '; + $searchpicto=$form->showFilterButtons(); + print $searchpicto; + print '
   '; - $searchpicto=$form->showFilterAndCheckAddButtons(0); - print $searchpicto; - print '
'; @@ -199,9 +199,9 @@ if ($result) } print "
"; print '
'; - + print '
'; - + $db->free($result); } else diff --git a/htdocs/compta/salaries/card.php b/htdocs/compta/salaries/card.php index 68f59d03cfa..599f54d97be 100644 --- a/htdocs/compta/salaries/card.php +++ b/htdocs/compta/salaries/card.php @@ -2,7 +2,7 @@ /* Copyright (C) 2011-2017 Alexandre Spangaro * Copyright (C) 2014 Laurent Destailleur * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2015 Charlie BENKE + * Copyright (C) 2015 Charlie BENKE * * 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 @@ -72,7 +72,7 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel")) $datesp=dol_mktime(12,0,0, $_POST["datespmonth"], $_POST["datespday"], $_POST["datespyear"]); $dateep=dol_mktime(12,0,0, $_POST["dateepmonth"], $_POST["dateepday"], $_POST["dateepyear"]); if (empty($datev)) $datev=$datep; - + $object->accountid=GETPOST("accountid") > 0 ? GETPOST("accountid","int") : 0; $object->fk_user=GETPOST("fk_user") > 0 ? GETPOST("fk_user","int") : 0; $object->datev=$datev; @@ -116,7 +116,7 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel")) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankAccount")), null, 'errors'); $error++; } - + if (! $error) { $db->begin(); @@ -229,7 +229,7 @@ if ($action == 'create') print load_fiche_titre($langs->trans("NewSalaryPayment"),'', 'title_accountancy.png'); dol_fiche_head('', ''); - + print ''; // Date payment @@ -300,7 +300,7 @@ if ($action == 'create') } // Other attributes - $parameters=array('colspan' => ' colspan="1"'); + $parameters=array(); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook print '
'; @@ -351,24 +351,24 @@ if ($id) print ''.$langs->trans("Label").''.$object->label.''; print ""; - print ''.$langs->trans("DateStartPeriod").''; + print ''.$langs->trans("DateStartPeriod").''; print dol_print_date($object->datesp,'day'); print ''; - print ''.$langs->trans("DateEndPeriod").''; + print ''.$langs->trans("DateEndPeriod").''; print dol_print_date($object->dateep,'day'); print ''; print ""; - print ''.$langs->trans("DatePayment").''; + print ''.$langs->trans("DatePayment").''; print dol_print_date($object->datep,'day'); print ''; - print ''.$langs->trans("DateValue").''; + print ''.$langs->trans("DateValue").''; print dol_print_date($object->datev,'day'); print ''; - print ''.$langs->trans("Amount").''.price($object->amount,0,$outputlangs,1,-1,-1,$conf->currency).''; + print ''.$langs->trans("Amount").''.price($object->amount,0,$outputlangs,1,-1,-1,$conf->currency).''; if (! empty($conf->banque->enabled)) { @@ -379,7 +379,7 @@ if ($id) print ''; print ''.$langs->trans('BankTransactionLine').''; - print ''; + print ''; print $bankline->getNomUrl(1,0,'showall'); print ''; print ''; @@ -387,7 +387,7 @@ if ($id) } // Other attributes - $parameters=array('colspan' => ' colspan="3"'); + $parameters=array(); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook print ''; @@ -396,7 +396,7 @@ if ($id) dol_fiche_end(); - + /* * Action buttons */ diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php index e33ec6b3d55..4a3ea9ee516 100644 --- a/htdocs/compta/tva/card.php +++ b/htdocs/compta/tva/card.php @@ -65,7 +65,7 @@ if ($action == 'setdatev' && $user->rights->tax->charges->creer) $object->datev=dol_mktime(12,0,0,$_POST['datevmonth'],$_POST['datevday'],$_POST['datevyear']); $result=$object->update($user); if ($result < 0) dol_print_error($db,$object->error); - + $action=''; } @@ -81,7 +81,7 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel")) $object->num_payment=GETPOST("num_payment"); $object->datev=$datev; $object->datep=$datep; - + $amount = price2num(GETPOST("amount")); if ($refund == 1) { $amount= -$amount; @@ -89,7 +89,7 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel")) $object->amount= $amount; $object->label=GETPOST("label"); $object->note=GETPOST("note"); - + if (empty($object->datev)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DateValue")), null, 'errors'); @@ -207,11 +207,11 @@ if ($action == 'create') print '$(document).ready(function () { $("#radiopayment").click(function() { $("#label").val($(this).data("label")); - + }); $("#radiorefund").click(function() { $("#label").val($(this).data("label")); - + }); });'; print ''."\n"; @@ -282,7 +282,7 @@ if ($action == 'create') print ''."\n"; // Other attributes - $parameters=array('colspan' => ' colspan="1"'); + $parameters=array(); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook print ''; @@ -349,7 +349,8 @@ if ($id) } // Other attributes - $reshook=$hookmanager->executeHooks('formObjectOptions','',$object,$action); // Note that $action and $object may have been modified by hook + $parameters=array(); + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook print ''; diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index fde2e428169..67a7d9b31e4 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -316,7 +316,7 @@ if (empty($reshook)) $object->photo = dol_sanitizeFileName($_FILES['photo']['name']); // Create thumbs - $object->addThumbs($newfile); + $object->addThumbs($newfile); } } } @@ -664,7 +664,7 @@ else } // Other attributes - $parameters=array('colspan' => ' colspan="3"'); + $parameters=array('colspan' => ' colspan="3"','cols'=>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)) { @@ -674,7 +674,7 @@ else print "
"; print '
'; - + // Add personnal information print load_fiche_titre('
'.$langs->trans("PersonalInformations").'
','',''); @@ -787,7 +787,7 @@ else print $object->ref; print ''; } - + // Lastname print ''; print 'lastname).'" autofocus="autofocus">'; @@ -932,7 +932,7 @@ else } // Other attributes - $parameters=array('colspan' => ' colspan="3"'); + $parameters=array('colspan' => ' colspan="3"', 'cols'=>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)) { @@ -1054,7 +1054,7 @@ else } $linkback = ''.$langs->trans("BackToList").''; - + $morehtmlref='
'; if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) { @@ -1064,14 +1064,14 @@ else if ($objsoc->id > 0) $morehtmlref.=$objsoc->getNomUrl(1); else $morehtmlref.=$langs->trans("ContactNotLinkedToCompany"); } - $morehtmlref.='
'; - + $morehtmlref.='
'; + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref); - - + + print '
'; print '
'; - + print '
'; print ''; @@ -1102,26 +1102,14 @@ else print $object->LibPubPriv($object->priv); print ''; - // Note Public - /* - print ''; - - // Note Private - print ''; - */ - print '
'.$langs->trans("NotePublic").''; - print nl2br($object->note_public); - print '
'.$langs->trans("NotePrivate").''; - print nl2br($object->note_private); - print '
'; - + print '
'; print '
'; - + print '
'; print ''; - + // Categories if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) { print ''; @@ -1130,14 +1118,10 @@ else 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 - print $hookmanager->resPrint; - if (empty($reshook) && ! empty($extrafields->attribute_label)) - { - print $object->showOptionals($extrafields); - } + // Other attributes + $cols = 3; + $parameyers=array('socid'=>$socid); + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; $object->load_ref_elements(); @@ -1193,10 +1177,10 @@ else print ''; print "
' . $langs->trans("Categories") . '
"; - + print '
'; print '
'; - + print dol_fiche_end(); // Barre d'actions diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 31e5d6f3094..3c644e4260c 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -104,13 +104,13 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e if (empty($reshook)) { include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once - + include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once - + if ($action == 'confirm_active' && $confirm == 'yes' && $user->rights->contrat->activer) { $result = $object->active_line($user, GETPOST('ligne'), GETPOST('date'), GETPOST('dateend'), GETPOST('comment')); - + if ($result > 0) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); @@ -136,13 +136,13 @@ if (empty($reshook)) header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; } - else + else { setEventMessages($object->error, $object->errors, 'errors'); } } } - + // Si ajout champ produit predefini if (GETPOST('mode')=='predefined') { @@ -157,7 +157,7 @@ if (empty($reshook)) $date_end=dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), 0, GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear')); } } - + // Si ajout champ produit libre if (GETPOST('mode')=='libre') { @@ -172,7 +172,7 @@ if (empty($reshook)) $date_end_sl=dol_mktime(GETPOST('date_end_slhour'), GETPOST('date_end_slmin'), 0, GETPOST('date_end_slmonth'), GETPOST('date_end_slday'), GETPOST('date_end_slyear')); } } - + // Param dates $date_contrat=''; $date_start_update=''; @@ -199,7 +199,7 @@ if (empty($reshook)) { $datecontrat = dol_mktime(GETPOST('rehour'), GETPOST('remin'), 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); } - + // Add contract if ($action == 'add' && $user->rights->contrat->creer) { @@ -210,29 +210,29 @@ if (empty($reshook)) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); $action='create'; } - + if ($socid<1) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ThirdParty")), null, 'errors'); $action='create'; $error++; } - + // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels, $object); if ($ret < 0) { $error ++; $action = 'create'; } - + if (! $error) { $object->socid = $socid; $object->date_contrat = $datecontrat; - + $object->commercial_suivi_id = GETPOST('commercial_suivi_id','int'); $object->commercial_signature_id = GETPOST('commercial_signature_id','int'); - + $object->note_private = GETPOST('note_private','alpha'); $object->note_public = GETPOST('note_public','alpha'); $object->fk_project = GETPOST('projectid','int'); @@ -251,33 +251,33 @@ if (empty($reshook)) $element = $regs[1]; $subelement = $regs[2]; } - + // For compatibility if ($element == 'order') { $element = $subelement = 'commande'; } if ($element == 'propal') { $element = 'comm/propal'; $subelement = 'propal'; } - + $object->origin = $origin; $object->origin_id = $originid; - + // Possibility to add external linked objects with hooks $object->linked_objects[$object->origin] = $object->origin_id; if (is_array($_POST['other_linked_objects']) && ! empty($_POST['other_linked_objects'])) { $object->linked_objects = array_merge($object->linked_objects, $_POST['other_linked_objects']); } - + $id = $object->create($user); if ($id < 0) { setEventMessages($object->error, $object->errors, 'errors'); } - + if ($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) @@ -289,27 +289,27 @@ if (empty($reshook)) $srcobject->fetch_lines(); $lines = $srcobject->lines; } - + $fk_parent_line=0; $num=count($lines); - + for ($i=0;$i<$num;$i++) { $product_type=($lines[$i]->product_type?$lines[$i]->product_type:0); - + if ($product_type == 1 || (! empty($conf->global->CONTRACT_SUPPORT_PRODUCTS) && in_array($product_type, array(0,1)))) { // TODO Exclude also deee // service prédéfini if ($lines[$i]->fk_product > 0) { $product_static = new Product($db); - + // Define output language if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { $prod = new Product($db); $prod->id=$lines[$i]->fk_product; $prod->getMultiLangs(); - + $outputlangs = $langs; $newlang=''; if (empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id'); @@ -319,14 +319,14 @@ if (empty($reshook)) $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($newlang); } - + $label = (! empty($prod->multilangs[$outputlangs->defaultlang]["libelle"])) ? $prod->multilangs[$outputlangs->defaultlang]["libelle"] : $lines[$i]->product_label; } else { $label = $lines[$i]->product_label; } - + $desc .= ($lines[$i]->desc && $lines[$i]->desc!=$lines[$i]->libelle)?dol_htmlentitiesbr($lines[$i]->desc):''; } else { @@ -338,7 +338,7 @@ if (empty($reshook)) // View third's localtaxes for now $localtax1_tx = get_localtax($txtva, 1, $object->thirdparty); $localtax2_tx = get_localtax($txtva, 2, $object->thirdparty); - + $result = $object->addline( $desc, $lines[$i]->subprice, @@ -358,7 +358,7 @@ if (empty($reshook)) array(), $lines[$i]->fk_unit ); - + if ($result < 0) { $error++; @@ -372,13 +372,13 @@ if (empty($reshook)) setEventMessages($srcobject->error, $srcobject->errors, 'errors'); $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++; + $error++; } else { @@ -401,12 +401,12 @@ if (empty($reshook)) } } } - + else if ($action == 'classin' && $user->rights->contrat->creer) { $object->setProject(GETPOST('projectid')); } - + // Add a new line else if ($action == 'addline' && $user->rights->contrat->creer) { @@ -425,10 +425,10 @@ if (empty($reshook)) $idprod=GETPOST('idprod', 'int'); $tva_tx = ''; } - + $qty = GETPOST('qty'.$predef); $remise_percent = GETPOST('remise_percent'.$predef); - + if ($qty == '') { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Qty")), null, 'errors'); @@ -439,7 +439,7 @@ if (empty($reshook)) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Description")), null, 'errors'); $error++; } - + // Extrafields $extrafieldsline = new ExtraFields($db); $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); @@ -458,7 +458,7 @@ if (empty($reshook)) $date_start=dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), GETPOST('date_start'.$predef.'sec'), GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year')); $date_end=dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end'.$predef.'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year')); $price_base_type = (GETPOST('price_base_type', 'alpha')?GETPOST('price_base_type', 'alpha'):'HT'); - + // Ecrase $pu par celui du produit // Ecrase $desc par celui du produit // Ecrase $tva_tx par celui du produit @@ -467,17 +467,17 @@ if (empty($reshook)) { $prod = new Product($db); $prod->fetch($idprod); - + // Update if prices fields are defined $tva_tx = get_default_tva($mysoc,$object->thirdparty,$prod->id); $tva_npr = get_default_npr($mysoc,$object->thirdparty,$prod->id); if (empty($tva_tx)) $tva_npr=0; - + $pu_ht = $prod->price; $pu_ttc = $prod->price_ttc; $price_min = $prod->price_min; $price_base_type = $prod->price_base_type; - + // On defini prix unitaire if ($conf->global->PRODUIT_MULTIPRICES && $object->thirdparty->price_level) { @@ -489,11 +489,11 @@ if (empty($reshook)) elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php'; - + $prodcustprice = new Productcustomerprice($db); - + $filter = array('t.fk_product' => $prod->id,'t.fk_soc' => $object->thirdparty->id); - + $result = $prodcustprice->fetch_all('', '', 0, 0, $filter); if ($result) { if (count($prodcustprice->lines) > 0) { @@ -504,10 +504,10 @@ if (empty($reshook)) } } } - + $tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx)); $tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx)); - + // On reevalue prix selon taux tva car taux tva transaction peut etre different // de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur). if ($tmpvat != $tmpprodvat) @@ -521,7 +521,7 @@ if (empty($reshook)) $pu_ttc = price2num($pu_ht * (1 + ($tmpvat/100)), 'MU'); } } - + $desc=$prod->description; $desc=dol_concatdesc($desc,$product_desc); $fk_unit = $prod->fk_unit; @@ -535,20 +535,20 @@ if (empty($reshook)) $desc=$product_desc; $fk_unit= GETPOST('units', 'alpha'); } - + $localtax1_tx=get_localtax($tva_tx,1,$object->thirdparty,$mysoc,$tva_npr); $localtax2_tx=get_localtax($tva_tx,2,$object->thirdparty,$mysoc,$tva_npr); - + // ajout prix achat $fk_fournprice = $_POST['fournprice']; if ( ! empty($_POST['buying_price']) ) $pa_ht = $_POST['buying_price']; else $pa_ht = null; - + $info_bits=0; if ($tva_npr) $info_bits |= 0x01; - + if($price_min && (price2num($pu_ht)*(1-price2num($remise_percent)/100) < price2num($price_min))) { $object->error = $langs->trans("CantBeLessThanMinPrice",price(price2num($price_min,'MU'),0,$langs,0,0,-1,$conf->currency)); @@ -577,7 +577,7 @@ if (empty($reshook)) $fk_unit ); } - + if ($result > 0) { // Define output language @@ -591,14 +591,14 @@ if (empty($reshook)) $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); } - + $ret = $object->fetch($id); // Reload to get new records - + $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); } - + unset($_POST ['prod_entry_mode']); - + unset($_POST['qty']); unset($_POST['type']); unset($_POST['remise_percent']); @@ -615,7 +615,7 @@ if (empty($reshook)) unset($_POST ['np_markRate']); unset($_POST['dp_desc']); unset($_POST['idprod']); - + unset($_POST['date_starthour']); unset($_POST['date_startmin']); unset($_POST['date_startsec']); @@ -635,30 +635,30 @@ if (empty($reshook)) } } } - + else if ($action == 'updateline' && $user->rights->contrat->creer && ! GETPOST('cancel')) { $objectline = new ContratLigne($db); if ($objectline->fetch(GETPOST('elrowid'))) { $db->begin(); - + if ($date_start_real_update == '') $date_start_real_update=$objectline->date_ouverture; if ($date_end_real_update == '') $date_end_real_update=$objectline->date_cloture; - + $vat_rate = GETPOST('eltva_tx'); // Define info_bits $info_bits = 0; if (preg_match('/\*/', $vat_rate)) $info_bits |= 0x01; - + // Define vat_rate $vat_rate = str_replace('*', '', $vat_rate); $localtax1_tx=get_localtax($vat_rate, 1, $object->thirdparty, $mysoc); $localtax2_tx=get_localtax($vat_rate, 2, $object->thirdparty, $mysoc); - + $txtva = $vat_rate; - + // Clean vat code $vat_src_code=''; if (preg_match('/\((.*)\)/', $txtva, $reg)) @@ -666,16 +666,16 @@ if (empty($reshook)) $vat_src_code = $reg[1]; $txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate. } - + // ajout prix d'achat $fk_fournprice = $_POST['fournprice']; if ( ! empty($_POST['buying_price']) ) $pa_ht = $_POST['buying_price']; else $pa_ht = null; - + $fk_unit = GETPOST('unit', 'alpha'); - + $objectline->description=GETPOST('product_desc'); $objectline->price_ht=GETPOST('elprice'); $objectline->subprice=GETPOST('elprice'); @@ -692,21 +692,21 @@ if (empty($reshook)) $objectline->fk_user_cloture=$user->id; $objectline->fk_fournprice=$fk_fournprice; $objectline->pa_ht=$pa_ht; - + if ($fk_unit > 0) { $objectline->fk_unit = GETPOST('unit'); } else { $objectline->fk_unit = null; } - + // Extrafields $extrafieldsline = new ExtraFields($db); $extralabelsline = $extrafieldsline->fetch_name_optionals_label($objectline->table_element); $array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef); $objectline->array_options=$array_options; - + // TODO verifier price_min si fk_product et multiprix - + $result=$objectline->update($user); if ($result > 0) { @@ -723,11 +723,11 @@ if (empty($reshook)) setEventMessages($objectline->error, $objectline->errors, 'errors'); } } - + else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->contrat->creer) { $result = $object->deleteline(GETPOST('lineid'),$user); - + if ($result >= 0) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); @@ -738,23 +738,23 @@ if (empty($reshook)) setEventMessages($object->error, $object->errors, 'errors'); } } - + else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->contrat->creer) { $result = $object->validate($user); } - + else if ($action == 'reopen' && $user->rights->contrat->creer) { $result = $object->reopen($user); } - + // Close all lines else if ($action == 'confirm_close' && $confirm == 'yes' && $user->rights->contrat->creer) { $object->cloture($user); } - + else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->contrat->supprimer) { $result=$object->delete($user); @@ -768,7 +768,7 @@ if (empty($reshook)) setEventMessages($object->error, $object->errors, 'errors'); } } - + else if ($action == 'confirm_move' && $confirm == 'yes' && $user->rights->contrat->creer) { if (GETPOST('newcid') > 0) @@ -791,39 +791,39 @@ if (empty($reshook)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("RefNewContract")), null, 'errors'); } - } - else if ($action == 'update_extras') + } + else if ($action == 'update_extras') { // Fill array 'array_options' with data from update form $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute')); if ($ret < 0) $error ++; - + if (! $error) { - + $result = $object->insertExtraFields(); if ($result < 0) { $error ++; } } else if ($reshook < 0) $error ++; - + if ($error) { $action = 'edit_extras'; setEventMessages($object->error, $object->errors, 'errors'); } - } - elseif ($action=='setref_supplier') + } + elseif ($action=='setref_supplier') { $cancelbutton = GETPOST('cancel'); if (!$cancelbutton) { - + $result = $object->fetch($id); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } - + $result = $object->setValueFrom('ref_supplier', GETPOST('ref_supplier','alpha'), '', null, 'text', '', $user, 'CONTRACT_MODIFY'); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); @@ -838,17 +838,17 @@ if (empty($reshook)) exit; } } - elseif ($action=='setref_customer') + elseif ($action=='setref_customer') { $cancelbutton = GETPOST('cancel'); - + if (!$cancelbutton) { $result = $object->fetch($id); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } - + $result = $object->setValueFrom('ref_customer', GETPOST('ref_customer','alpha'), '', null, 'text', '', $user, 'CONTRACT_MODIFY'); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); @@ -863,16 +863,16 @@ if (empty($reshook)) exit; } } - elseif ($action=='setref') + elseif ($action=='setref') { $cancelbutton = GETPOST('cancel'); - + if (!$cancelbutton) { $result = $object->fetch($id); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } - + $result = $object->setValueFrom('ref', GETPOST('ref','alpha'), '', null, 'text', '', $user, 'CONTRACT_MODIFY'); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); @@ -886,11 +886,11 @@ if (empty($reshook)) header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $id); exit; } - } - elseif ($action=='setdate_contrat') + } + elseif ($action=='setdate_contrat') { $cancelbutton = GETPOST('cancel'); - + if (!$cancelbutton) { $result = $object->fetch($id); if ($result < 0) { @@ -911,13 +911,13 @@ if (empty($reshook)) exit; } } - + // Generation doc (depuis lien ou depuis cartouche doc) else if ($action == 'builddoc' && $user->rights->contrat->creer) { if (GETPOST('model')) { $object->setDocModel($user, GETPOST('model')); } - + // Define output language $outputlangs = $langs; if (! empty($conf->global->MAIN_MULTILANGS)) { @@ -933,12 +933,12 @@ if (empty($reshook)) $action=''; } } - + // Remove file in doc form else if ($action == 'remove_file' && $user->rights->contrat->creer) { if ($object->id > 0) { require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; - + $langs->load("other"); $upload_dir = $conf->contrat->dir_output; $file = $upload_dir . '/' . GETPOST('file'); @@ -965,7 +965,7 @@ if (empty($reshook)) { $contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid')); $result = $object->add_contact($contactid, GETPOST('type'), GETPOST('source')); - + if ($result >= 0) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); @@ -984,18 +984,18 @@ if (empty($reshook)) } } } - + // bascule du statut d'un contact else if ($action == 'swapstatut') { $result=$object->swapContactStatus(GETPOST('ligne')); } - + // Efface un contact else if ($action == 'deletecontact') { $result = $object->delete_contact(GETPOST('lineid')); - + if ($result >= 0) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); @@ -1040,7 +1040,7 @@ llxHeader('',$langs->trans("Contract"),""); $form = new Form($db); $formfile = new FormFile($db); if (! empty($conf->projet->enabled)) $formproject = new FormProjets($db); - + $objectlignestatic=new ContratLigne($db); // Load object modContract @@ -1209,7 +1209,7 @@ if ($action == 'create') } // Other attributes - $parameters=array('objectsrc' => $objectsrc,'colspan' => ' colspan="3"'); + $parameters=array('objectsrc' => $objectsrc,'colspan' => ' colspan="3"', 'cols'=>3); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook // Other attributes @@ -1333,7 +1333,7 @@ else $linkback = ''.$langs->trans("BackToList").''; - + $morehtmlref=''; if (! empty($modCodeContract->code_auto)) { $morehtmlref.=$object->ref; @@ -1341,7 +1341,7 @@ else $morehtmlref.=$form->editfieldkey("",'ref',$object->ref,$object,$user->rights->contrat->creer,'string','',0,3); $morehtmlref.=$form->editfieldval("",'ref',$object->ref,$object,$user->rights->contrat->creer,'string','',0,2); } - + $morehtmlref.='
'; // Ref customer $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->rights->contrat->creer, 'string', '', 0, 1); @@ -1392,10 +1392,10 @@ else print '
'; print '
'; - - + + print ''; - + // Ligne info remises tiers print '
'.$langs->trans('Discount').''; if ($object->thirdparty->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$object->thirdparty->remise_percent); @@ -1423,7 +1423,7 @@ else print "
"; print '
'; - + if (! empty($object->brouillon) && $user->rights->contrat->creer) { print ''; @@ -1615,7 +1615,7 @@ else { print dol_print_date($db->jdate($objp->date_debut)); // Warning si date prevu passee et pas en service - if ($objp->statut == 0 && $db->jdate($objp->date_debut) < ($now - $conf->contrat->services->inactifs->warning_delay)) { + if ($objp->statut == 0 && $db->jdate($objp->date_debut) < ($now - $conf->contrat->services->inactifs->warning_delay)) { $warning_delay=$conf->contrat->services->inactifs->warning_delay / 3600 / 24; $textlate = $langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($warning_delay) >= 0 ? '+' : '').ceil($warning_delay).' '.$langs->trans("days"); print " ".img_warning($textlate); @@ -1627,7 +1627,7 @@ else if ($objp->date_fin) { print dol_print_date($db->jdate($objp->date_fin)); - if ($objp->statut == 4 && $db->jdate($objp->date_fin) < ($now - $conf->contrat->services->expires->warning_delay)) { + if ($objp->statut == 4 && $db->jdate($objp->date_fin) < ($now - $conf->contrat->services->expires->warning_delay)) { $warning_delay=$conf->contrat->services->expires->warning_delay / 3600 / 24; $textlate = $langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($warning_delay) >= 0 ? '+' : '').ceil($warning_delay).' '.$langs->trans("days"); print " ".img_warning($textlate); @@ -1814,13 +1814,13 @@ else $tmpaction='activateline'; $tmpactionpicto='play'; $tmpactiontext=$langs->trans("Activate"); - if ($objp->statut == 4) + if ($objp->statut == 4) { $tmpaction='unactivateline'; $tmpactionpicto='playstop'; $tmpactiontext=$langs->trans("Unactivate"); } - if (($tmpaction=='activateline' && $user->rights->contrat->activer) || ($tmpaction=='unactivateline' && $user->rights->contrat->desactiver)) + if (($tmpaction=='activateline' && $user->rights->contrat->activer) || ($tmpaction=='unactivateline' && $user->rights->contrat->desactiver)) { print ''; print img_picto($tmpactiontext, $tmpactionpicto); @@ -1962,7 +1962,7 @@ else print ''; print ''; print ''; - + print ''; print ''; @@ -1997,7 +1997,7 @@ else $var = true; $forcetoshowtitlelines=1; - + // Add free products/services $object->formAddObjectLine(1, $mysoc, $soc); @@ -2037,7 +2037,7 @@ else if ($user->rights->contrat->creer) print ''; else print ''; } - + if (! empty($conf->facture->enabled) && $object->statut > 0 && $object->nbofservicesclosed < $nbofservices) { $langs->load("bills"); @@ -2051,7 +2051,7 @@ else if ($user->rights->commande->creer) print ''; else print ''; } - + // Clone if ($user->rights->contrat->creer) { print ''; @@ -2083,16 +2083,16 @@ else print "
"; } - + // Select mail models is same action as presend if (GETPOST('modelselected')) { $action = 'presend'; } - + if ($action != 'presend') { print '
'; - + /* * Documents generes */ @@ -2101,25 +2101,25 @@ else $urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id; $genallowed = $user->rights->contrat->creer; $delallowed = $user->rights->contrat->supprimer; - + $var = true; - + print $formfile->showdocuments('contract', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang); - - + + // Show links to link elements $linktoelem = $form->showLinkToObjectBlock($object, null, array('contrat')); $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); - - + + print '
'; - + // List of actions on element include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; $formactions = new FormActions($db); $somethingshown = $formactions->showactions($object, 'contract', $socid); - + print '
'; } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index fe93387cadb..7656d8bcc06 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -89,13 +89,13 @@ abstract class CommonObject * @var Object To store a cloned copy of object before to edit it and keep track of old properties */ public $oldcopy; - + /** * @var string Column name of the ref field. */ protected $table_ref_field = ''; - + // Following vars are used by some objects only. We keep this property here in CommonObject to be able to provide common method using them. @@ -330,10 +330,10 @@ abstract class CommonObject public $firstname; public $civility_id; - + // No constructor as it is an abstract class - + /** * Check an object id/ref exists * If you don't need/want to instantiate object and just need to know if object exists, use this method instead of fetch @@ -398,7 +398,7 @@ abstract class CommonObject $lastname=$this->lastname; $firstname=$this->firstname; if (empty($lastname)) $lastname=(isset($this->lastname)?$this->lastname:(isset($this->name)?$this->name:(isset($this->nom)?$this->nom:(isset($this->societe)?$this->societe:(isset($this->company)?$this->company:''))))); - + $ret=''; if ($option && $this->civility_id) { @@ -597,11 +597,11 @@ abstract class CommonObject dol_syslog("CODE_NOT_VALID_FOR_THIS_ELEMENT"); return -3; } - + $datecreate = dol_now(); $this->db->begin(); - + // Insertion dans la base $sql = "INSERT INTO ".MAIN_DB_PREFIX."element_contact"; $sql.= " (element_id, fk_socpeople, datecreate, statut, fk_c_type_contact) "; @@ -1238,19 +1238,19 @@ abstract class CommonObject function setValueFrom($field, $value, $table='', $id=null, $format='', $id_field='', $fuser=null, $trigkey='') { global $user,$langs,$conf; - + if (empty($table)) $table=$this->table_element; if (empty($id)) $id=$this->id; if (empty($format)) $format='text'; if (empty($id_field)) $id_field='rowid'; $error=0; - + $this->db->begin(); // Special case if ($table == 'product' && $field == 'note_private') $field='note'; - + $sql = "UPDATE ".MAIN_DB_PREFIX.$table." SET "; if ($format == 'text') $sql.= $field." = '".$this->db->escape($value)."'"; else if ($format == 'int') $sql.= $field." = ".$this->db->escape($value); @@ -1396,13 +1396,13 @@ abstract class CommonObject } $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; - if ($this->table_element == 'actioncomm') + if ($this->table_element == 'actioncomm') { if ($projectid) $sql.= ' SET fk_project = '.$projectid; else $sql.= ' SET fk_project = NULL'; - $sql.= ' WHERE id = '.$this->id; + $sql.= ' WHERE id = '.$this->id; } - else + else { if ($projectid) $sql.= ' SET fk_projet = '.$projectid; else $sql.= ' SET fk_projet = NULL'; @@ -1535,7 +1535,7 @@ abstract class CommonObject if($mode == 1) { $line->subprice = 0; } - + switch ($this->element) { case 'propal': $this->updateline($line->id, $line->subprice, $line->qty, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->desc, 'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, $line->skip_update_total, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice); @@ -1626,7 +1626,7 @@ abstract class CommonObject /** * Define delivery address * @deprecated - * + * * @param int $id Address id * @return int <0 si ko, >0 si ok */ @@ -1950,7 +1950,7 @@ abstract class CommonObject { $fieldposition = 'rang'; if ($this->table_element_line == 'ecm_files') $fieldposition = 'position'; - + $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element_line.' SET '.$fieldposition.' = '.$rang; $sql.= ' WHERE rowid = '.$rowid; @@ -2163,7 +2163,7 @@ abstract class CommonObject function update_note($note,$suffix='') { global $user; - + if (! $this->table_element) { dol_syslog(get_class($this)."::update_note was called on objet with property table_element not defined", LOG_ERR); @@ -2177,7 +2177,7 @@ abstract class CommonObject // Special cas //var_dump($this->table_element);exit; if ($this->table_element == 'product') $suffix=''; - + $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; $sql.= " SET note".$suffix." = ".(!empty($note)?("'".$this->db->escape($note)."'"):"NULL"); $sql.= " ,".(in_array($this->table_element, array('actioncomm', 'adherent', 'advtargetemailing', 'cronjob', 'establishment'))?"fk_user_mod":"fk_user_modif")." = ".$user->id; @@ -2188,7 +2188,7 @@ abstract class CommonObject { if ($suffix == '_public') $this->note_public = $note; else if ($suffix == '_private') $this->note_private = $note; - else + else { $this->note = $note; // deprecated $this->note_private = $note; @@ -2437,7 +2437,7 @@ abstract class CommonObject // Special case if ($origin == 'order') $origin='commande'; if ($origin == 'invoice') $origin='facture'; - + $this->db->begin(); $sql = "INSERT INTO ".MAIN_DB_PREFIX."element_element ("; @@ -2470,10 +2470,10 @@ abstract class CommonObject * Fetch array of objects linked to current object. Links are loaded into this->linkedObjects array and this->linkedObjectsIds * Possible usage for parameters: * - all parameters empty -> we look all link to current object (current object can be source or target) - * - source id+type -> will get target list linked to source - * - target id+type -> will get source list linked to target - * - source id+type + target type -> will get target list of the type - * - target id+type + target source -> will get source list of the type + * - source id+type -> will get target list linked to source + * - target id+type -> will get source list linked to target + * - source id+type + target type -> will get target list of the type + * - target id+type + target source -> will get source list of the type * * @param int $sourceid Object source id (if not defined, id of object) * @param string $sourcetype Object source type (if not defined, element name of object) @@ -2791,7 +2791,7 @@ abstract class CommonObject global $user,$langs,$conf; $savElementId=$elementId; // To be used later to know if we were using the method using the id of this or not. - + $elementId = (!empty($elementId)?$elementId:$this->id); $elementTable = (!empty($elementType)?$elementType:$this->table_element); @@ -2821,7 +2821,7 @@ abstract class CommonObject if ($this->element == 'fichinter' && $status == 3) $trigkey='FICHINTER_CLASSIFY_DONE'; if ($this->element == 'fichinter' && $status == 2) $trigkey='FICHINTER_CLASSIFY_BILLED'; if ($this->element == 'fichinter' && $status == 1) $trigkey='FICHINTER_CLASSIFY_UNBILLED'; - + if ($trigkey) { // Appel des triggers @@ -2837,7 +2837,7 @@ abstract class CommonObject if (! $error) { $this->db->commit(); - + if (empty($savElementId)) // If the element we update was $this (so $elementId is null) { $this->statut = $status; @@ -2932,7 +2932,7 @@ abstract class CommonObject function isObjectUsed($id=0) { if (empty($id)) $id=$this->id; - + // Check parameters if (! isset($this->childtables) || ! is_array($this->childtables) || count($this->childtables) == 0) { @@ -3049,12 +3049,12 @@ abstract class CommonObject foreach ($this->lines as $line) { - if (isset($line->qty_asked)) + if (isset($line->qty_asked)) { if (empty($totalOrdered)) $totalOrdered=0; // Avoid warning because $totalOrdered is '' $totalOrdered+=$line->qty_asked; // defined for shipment only } - if (isset($line->qty_shipped)) + if (isset($line->qty_shipped)) { if (empty($totalToShip)) $totalToShip=0; // Avoid warning because $totalToShip is '' $totalToShip+=$line->qty_shipped; // defined for shipment only @@ -3082,7 +3082,7 @@ abstract class CommonObject if (empty($totalWeight)) $totalWeight=0; // Avoid warning because $totalWeight is '' if (empty($totalVolume)) $totalVolume=0; // Avoid warning because $totalVolume is '' - + //var_dump($line->volume_units); if ($weight_units < 50) // >50 means a standard unit (power of 10 of official unit), > 50 means an exotic unit (like inch) { @@ -3318,54 +3318,54 @@ abstract class CommonObject if (! empty($conf->margin->enabled) && ! empty($this->element) && in_array($this->element,array('facture','propal','commande'))) $usemargins=1; $num = count($this->lines); - + //Line extrafield require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; $extrafieldsline = new ExtraFields($this->db); $extralabelslines=$extrafieldsline->fetch_name_optionals_label($this->table_element_line); - + $parameters = array('num'=>$num,'i'=>$i,'dateSelector'=>$dateSelector,'seller'=>$seller,'buyer'=>$buyer,'selected'=>$selected, 'extrafieldsline'=>$extrafieldsline); $reshook = $hookmanager->executeHooks('printObjectLineTitle', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if (empty($reshook)) { print ''; - + if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) print ' '; - + // Description print ''.$langs->trans('Description').''; - + if ($this->element == 'supplier_proposal') { print ''.$langs->trans("SupplierProposalRefFourn").''; } - + // VAT print ''.$langs->trans('VAT').''; - + // Price HT print ''.$langs->trans('PriceUHT').''; - + // Multicurrency if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('PriceUHTCurrency', $this->multicurrency_code).''; - + if ($inputalsopricewithtax) print ''.$langs->trans('PriceUTTC').''; - + // Qty print ''.$langs->trans('Qty').''; - + if($conf->global->PRODUCT_USE_UNITS) { print ''.$langs->trans('Unit').''; } - + // Reduction short print ''.$langs->trans('ReductionShort').''; - + if ($this->situation_cycle_ref) { print '' . $langs->trans('Progress') . ''; } - + if ($usemargins && ! empty($conf->margin->enabled) && empty($user->societe_id)) { if (!empty($user->rights->margins->creer)) @@ -3373,32 +3373,32 @@ abstract class CommonObject if ($conf->global->MARGIN_TYPE == "1") print ''.$langs->trans('BuyingPrice').''; else - print ''.$langs->trans('CostPrice').''; + print ''.$langs->trans('CostPrice').''; } - + if (! empty($conf->global->DISPLAY_MARGIN_RATES) && $user->rights->margins->liretous) print ''.$langs->trans('MarginRate').''; if (! empty($conf->global->DISPLAY_MARK_RATES) && $user->rights->margins->liretous) print ''.$langs->trans('MarkRate').''; } - + // Total HT print ''.$langs->trans('TotalHTShort').''; - + // Multicurrency if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('TotalHTShortCurrency', $this->multicurrency_code).''; - + if ($outputalsopricetotalwithtax) print ''.$langs->trans('TotalTTCShort').''; - + print ''; // No width to allow autodim - + print ''; - + print ''; - + print "\n"; } - + $var = true; $i = 0; @@ -3407,7 +3407,7 @@ abstract class CommonObject //Line extrafield $line->fetch_optionals($line->id,$extralabelslines); - + //if (is_object($hookmanager) && (($line->product_type == 9 && ! empty($line->special_code)) || ! empty($line->fk_parent_line))) if (is_object($hookmanager)) // Old code is commented on preceding line. @@ -3588,7 +3588,7 @@ abstract class CommonObject foreach ($this->lines as $line) { - + if (is_object($hookmanager) && (($line->product_type == 9 && ! empty($line->special_code)) || ! empty($line->fk_parent_line))) { @@ -3868,7 +3868,7 @@ abstract class CommonObject $modele=$tmp[0]; $srctemplatepath=$tmp[1]; } - + // Search template files $file=''; $classname=''; $filefound=0; @@ -3897,7 +3897,7 @@ abstract class CommonObject if ($filefound) { global $db; // Required to solve a conception default in commonstickergenerator.class.php making an include of code using $db - + require_once $file; $obj = new $classname($this->db); @@ -3956,7 +3956,7 @@ abstract class CommonObject // output format that does not support UTF8. $sav_charset_output=$outputlangs->charset_output; - if (in_array(get_class($this), array('Adherent'))) + if (in_array(get_class($this), array('Adherent'))) { $arrayofrecords = array(); // The write_file of templates of adherent class need this $resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, 'member', 1, $moreparams); @@ -4104,25 +4104,36 @@ abstract class CommonObject * Function to get extra fields of a member into $this->array_options * This method is in most cases called by method fetch of objects but you can call it separately. * - * @param int $rowid Id of line - * @param array $optionsArray Array resulting of call of extrafields->fetch_name_optionals_label() + * @param int $rowid Id of line. Use the id of object if not defined. Deprecated. Function must be called without parameters. + * @param array $optionsArray Array resulting of call of extrafields->fetch_name_optionals_label(). Deprecated. Function must be called without parameters. * @return int <0 if error, 0 if no optionals to find nor found, 1 if a line is found and optional loaded */ function fetch_optionals($rowid=null,$optionsArray=null) { if (empty($rowid)) $rowid=$this->id; - //To avoid SQL errors. Probably not the better solution though + // To avoid SQL errors. Probably not the better solution though if (!$this->table_element) { return 0; } if (! is_array($optionsArray)) { - // optionsArray not already loaded, so we load it - require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - $extrafields = new ExtraFields($this->db); - $optionsArray = $extrafields->fetch_name_optionals_label($this->table_element); + // $extrafields is not a known object, we initialize it. Best practice is to have $extrafields defined into card.php or list.php page. + // TODO Use of existing extrafield is not yet ready (must mutualize code that use extrafields in form first) + // global $extrafields; + //if (! is_object($extrafields)) + //{ + require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + $extrafields = new ExtraFields($this->db); + //} + + // Load array of extrafields for elementype = $this->table_element + if (empty($extrafields->attributes[$this->table_element]['loaded'])) + { + $extrafields->fetch_name_optionals_label($this->table_element); + } + $optionsArray = $extrafields->attributes[$this->table_element]['label']; } // Request to get complementary values @@ -4131,12 +4142,15 @@ abstract class CommonObject $sql = "SELECT rowid"; foreach ($optionsArray as $name => $label) { - $sql.= ", ".$name; + if (empty($extrafields->attributes[$this->table_element]['type'][$name]) || $extrafields->attributes[$this->table_element]['type'][$name] != 'separate') + { + $sql.= ", ".$name; + } } $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields"; $sql.= " WHERE fk_object = ".$rowid; - dol_syslog(get_class($this)."::fetch_optionals", LOG_DEBUG); + dol_syslog(get_class($this)."::fetch_optionals get extrafields data for ".$this->table_element, LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -4217,7 +4231,7 @@ abstract class CommonObject require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; $extrafields = new ExtraFields($this->db); $target_extrafields=$extrafields->fetch_name_optionals_label($this->table_element); - + //Eliminate copied source object extra_fields that do not exist in target object $new_array_options=array(); foreach ($this->array_options as $key => $value) { @@ -4266,7 +4280,7 @@ abstract class CommonObject { if (is_numeric($value)) $res=$object->fetch($value); else $res=$object->fetch('',$value); - + if ($res > 0) $this->array_options[$key]=$object->id; else { @@ -4678,7 +4692,7 @@ abstract class CommonObject } return $buyPrice; } - + /** * Function test if type is date * @@ -4690,7 +4704,7 @@ abstract class CommonObject if(isset($info['type']) && $info['type']=='date') return true; else return false; } - + /** * Function test if type is array * @@ -4706,7 +4720,7 @@ abstract class CommonObject } else return false; } - + /** * Function test if type is null * @@ -4722,7 +4736,7 @@ abstract class CommonObject } else return false; } - + /** * Function test if type is integer * @@ -4738,7 +4752,7 @@ abstract class CommonObject } else return false; } - + /** * Function test if type is float * @@ -4754,7 +4768,7 @@ abstract class CommonObject } else return false; } - + /** * Function test if type is text * @@ -4770,7 +4784,7 @@ abstract class CommonObject } else return false; } - + /** * Function test if is indexed * @@ -4786,7 +4800,7 @@ abstract class CommonObject } else return false; } - + /** * Function to prepare the values to insert * @@ -4829,7 +4843,7 @@ abstract class CommonObject $query[$field] = $this->{$field}; } } - + return $query; } @@ -4843,30 +4857,30 @@ abstract class CommonObject */ public function createCommon(User $user, $notrigger = false) { - + $fields = array_merge(array('datec'=>$this->db->idate(dol_now())), $this->set_save_query()); - + foreach ($fields as $k => $v) { - + $keys[] = $k; $values[] = $this->quote($v); - + } $sql = 'INSERT INTO '.MAIN_DB_PREFIX.$this->table_element.' ( '.implode( ",", $keys ).' ) VALUES ( '.implode( ",", $values ).' ) '; $res = $this->db->query( $sql ); if($res===false) { - + return false; } - + // TODO Add triggers - + return true; - + } - + /** * Function to load data into current object this * @@ -4905,10 +4919,10 @@ abstract class CommonObject { $this->{$field} = $obj->{$field}; } - + } } - + /** * Function to concat keys of fields * @@ -4919,7 +4933,7 @@ abstract class CommonObject $keys = array_keys($this->fields); return implode(',', $keys); } - + /** * Load object in memory from the database * @@ -4930,12 +4944,12 @@ abstract class CommonObject */ public function fetchCommon($id, $ref = null) { - + if (empty($id) && empty($ref)) return false; - + $sql = 'SELECT '.$this->get_field_list().', datec, tms'; $sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element; - + if(!empty($id)) $sql.= ' WHERE rowid = '.$id; else $sql.= ' WHERE ref = \''.$this->quote($ref).'\''; @@ -4946,10 +4960,10 @@ abstract class CommonObject { $this->id = $id; $this->set_vars_by_db($obj); - + $this->datec = $this->db->idate($obj->datec); $this->tms = $this->db->idate($obj->tms); - + return $this->id; } else @@ -4978,9 +4992,9 @@ abstract class CommonObject public function updateCommon(User $user, $notrigger = false) { $fields = $this->set_save_query(); - + foreach ($fields as $k => $v) { - + if (is_array($key)){ $i=array_search($k, $key); if ( $i !== false) { @@ -4993,22 +5007,22 @@ abstract class CommonObject continue; } } - + $tmp[] = $k.'='.$this->quote($v); } $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' SET '.implode( ',', $tmp ).' WHERE rowid='.$this->id ; $res = $this->db->query( $sql ); - + if($res===false) { //error return false; } - + // TODO Add triggers - + return true; } - + /** * Delete object in database * @@ -5020,14 +5034,14 @@ abstract class CommonObject public function deleteCommon(User $user, $notrigger = false) { $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE rowid='.$this->id; - + $res = $this->db->query( $sql ); if($res===false) { return false; } - + // TODO Add triggers - + return true; } @@ -5038,12 +5052,12 @@ abstract class CommonObject * @return string|int */ protected function quote($value) { - + if(is_null($value)) return 'NULL'; else if(is_numeric($value)) return $value; else return "'".$this->db->escape( $value )."'"; - + } - + } diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 16214e10bf1..754a8300366 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -69,6 +69,9 @@ class ExtraFields // Array to store if extra field is hidden var $attribute_hidden; // warning, do not rely on this. If your module need a hidden data, it must use its own table. + // New array to store extrafields definition + var $attributes; + var $error; var $errno; @@ -640,26 +643,29 @@ class ExtraFields /** - * Load array this->attribute_xxx like attribute_label, attribute_type, ... + * Load array this->attributes, or old this->attribute_xxx like attribute_label, attribute_type, ... * - * @param string $elementtype Type of element ('adherent', 'commande', 'thirdparty', 'facture', 'propal', 'product', ...) - * @param boolean $forceload Force load of extra fields whatever is option MAIN_EXTRAFIELDS_DISABLED - * @return array Array of attributes for all extra fields + * @param string $elementtype Type of element ('adherent', 'commande', 'thirdparty', 'facture', 'propal', 'product', ...). + * @param boolean $forceload Force load of extra fields whatever is option MAIN_EXTRAFIELDS_DISABLED. Deprecated. Should not be required. + * @return array Array of attributes keys+label for all extra fields. */ function fetch_name_optionals_label($elementtype,$forceload=false) { global $conf; - if ( empty($elementtype) ) return array(); + if (empty($elementtype) ) return array(); if ($elementtype == 'thirdparty') $elementtype='societe'; if ($elementtype == 'contact') $elementtype='socpeople'; $array_name_label=array(); - // For avoid conflicts with external modules + // To avoid conflicts with external modules. TODO Remove this. if (!$forceload && !empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return $array_name_label; + // We should not have several time this log. If we have, there is some optimization to do by calling a simple $object->fetch_optionals() that include cache management. + dol_syslog("fetch_name_optionals_label elementtype=".$elementtype); + $sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,list,ishidden,fielddefault,fieldcomputed"; $sql.= " FROM ".MAIN_DB_PREFIX."extrafields"; $sql.= " WHERE entity IN (0,".$conf->entity.")"; @@ -673,12 +679,13 @@ class ExtraFields { while ($tab = $this->db->fetch_object($resql)) { - // we can add this attribute to adherent object + // We can add this attribute to object. TODO Remove this and return $this->attributes[$elementtype]['label'] if ($tab->type != 'separate') { $array_name_label[$tab->name]=$tab->label; } + // Old usage $this->attribute_type[$tab->name]=$tab->type; $this->attribute_label[$tab->name]=$tab->label; $this->attribute_size[$tab->name]=$tab->size; @@ -693,8 +700,25 @@ class ExtraFields $this->attribute_perms[$tab->name]=$tab->perms; $this->attribute_list[$tab->name]=$tab->list; $this->attribute_hidden[$tab->name]=$tab->ishidden; + + // New usage + $this->attributes[$tab->elementtype]['type'][$tab->name]=$tab->type; + $this->attributes[$tab->elementtype]['label'][$tab->name]=$tab->label; + $this->attributes[$tab->elementtype]['size'][$tab->name]=$tab->size; + $this->attributes[$tab->elementtype]['elementtype'][$tab->name]=$tab->elementtype; + $this->attributes[$tab->elementtype]['default'][$tab->name]=$tab->fielddefault; + $this->attributes[$tab->elementtype]['computed'][$tab->name]=$tab->fieldcomputed; + $this->attributes[$tab->elementtype]['unique'][$tab->name]=$tab->fieldunique; + $this->attributes[$tab->elementtype]['required'][$tab->name]=$tab->fieldrequired; + $this->attributes[$tab->elementtype]['param'][$tab->name]=($tab->param ? unserialize($tab->param) : ''); + $this->attributes[$tab->elementtype]['pos'][$tab->name]=$tab->pos; + $this->attributes[$tab->elementtype]['alwayseditable'][$tab->name]=$tab->alwayseditable; + $this->attributes[$tab->elementtype]['perms'][$tab->name]=$tab->perms; + $this->attributes[$tab->elementtype]['list'][$tab->name]=$tab->list; + $this->attributes[$tab->elementtype]['ishidden'][$tab->name]=$tab->ishidden; } } + if ($elementtype) $this->attributes[$elementtype]['loaded']=1; } else { diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index fcb92f1b525..9c9813e18ca 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -17,22 +17,28 @@ * * Need to have following variables defined: * $object (invoice, order, ...) + * $action * $conf * $langs * + * $parameters * $cols */ ?> - + fetch_optionals($object->id, $extralabels); -$parameters = array('colspan' => ' colspan="'.$cols.'"', 'cols' => $cols, 'socid' => $object->fk_soc); -$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); +if (! is_array($parameters)) $parameters = array(); +if (! empty($cols)) $parameters['colspan'] = ' colspan="'.$cols.'"'; +if (! empty($cols)) $parameters['cols'] = $cols; +if (! empty($object->fk_soc)) $parameters['socid'] = $object->fk_soc; -if (empty($reshook) && ! empty($extrafields->attribute_label)) +$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + +if (empty($reshook) && ! empty($extrafields->attributes[$object->table_element]['label'])) { - foreach ($extrafields->attribute_label as $key => $label) + foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $label) { if ($action == 'edit_extras') { @@ -42,54 +48,63 @@ if (empty($reshook) && ! empty($extrafields->attribute_label)) { $value = $object->array_options["options_" . $key]; } - if ($extrafields->attribute_type[$key] == 'separate') + if ($extrafields->attributes[$object->table_element]['type'][$key] == 'separate') { print $extrafields->showSeparator($key); } else { - if (!empty($extrafields->attribute_hidden[$key])) print ''; + if (! empty($extrafields->attributes[$object->table_element]['ishidden'][$key])) print ''; else print ''; print ''; print ''; print 'attribute_required[$key])) print ' class="fieldrequired"'; + if ((! empty($action) && ($action == 'create' || $action == 'edit')) && ! empty($extrafields->attributes[$object->table_element]['required'][$key])) print ' class="fieldrequired"'; print '>' . $langs->trans($label) . ''; //TODO Improve element and rights detection //var_dump($user->rights); $permok=false; + $keyforperm=$object->element; if ($object->element == 'fichinter') $keyforperm='ficheinter'; if (isset($user->rights->$keyforperm)) $permok=$user->rights->$keyforperm->creer||$user->rights->$keyforperm->create||$user->rights->$keyforperm->write; - if ($object->element=='order_supplier') $permok=$user->rights->fournisseur->commande->creer; + + if ($object->element=='order_supplier') $permok=$user->rights->fournisseur->commande->creer; if ($object->element=='invoice_supplier') $permok=$user->rights->fournisseur->facture->creer; - if ($object->element=='shipping') $permok=$user->rights->expedition->creer; - if ($object->element=='delivery') $permok=$user->rights->expedition->livraison->creer; - if ($object->element=='productlot') $permok=$user->rights->stock->creer; - - if (($object->statut == 0 || $extrafields->attribute_alwayseditable[$key]) - && $permok && ($action != 'edit_extras' || GETPOST('attribute') != $key)) - print ''; + if ($object->element=='shipping') $permok=$user->rights->expedition->creer; + if ($object->element=='delivery') $permok=$user->rights->expedition->livraison->creer; + if ($object->element=='productlot') $permok=$user->rights->stock->creer; + if (($object->statut == 0 || ! empty($extrafields->attributes[$object->table_element]['alwayseditable'][$key])) + && $permok && ($action != 'edit_extras' || GETPOST('attribute') != $key) + && empty($extrafields->attributes[$object->table_element]['computed'][$key])) + { + $fieldid='id'; + if ($object->table_element == 'societe') $fieldid='socid'; + print ''; + } print '
' . img_edit().'' . img_edit().'
'; $html_id = !empty($object->id) ? $object->element.'_extras_'.$key.'_'.$object->id : ''; print ''; // Convert date into timestamp format - if (in_array($extrafields->attribute_type[$key], array('date','datetime'))) { + if (in_array($extrafields->attributes[$object->table_element]['type'][$key], array('date','datetime'))) { $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"]) : $db->jdate($object->array_options['options_' . $key]); } //TODO Improve element and rights detection if ($action == 'edit_extras' && $permok && GETPOST('attribute') == $key) { - print '
'; + $fieldid='id'; + if ($object->table_element == 'societe') $fieldid='socid'; + + print ''; print ''; print ''; print ''; - print ''; + print ''; print $extrafields->showInputField($key, $value,'','','',0,$object->id); @@ -102,8 +117,41 @@ if (empty($reshook) && ! empty($extrafields->attribute_label)) print $extrafields->showOutputField($key, $value); } print '' . "\n"; + + print "\n"; + // Add code to manage list depending on others + if (! empty($conf->use_javascript_ajax)) + print ' + '."\n"; } } } ?> - \ No newline at end of file + \ No newline at end of file diff --git a/htdocs/don/card.php b/htdocs/don/card.php index 882b80ec339..8e1bd00d893 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -50,7 +50,7 @@ $cancel=GETPOST('cancel'); $amount=GETPOST('amount'); $donation_date=dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); $projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0); - + $object = new Don($db); $extrafields = new ExtraFields($db); @@ -336,7 +336,7 @@ if ($action == 'create') print ''; // Country - print ''; + print ''; print $form->select_country(GETPOST('country_id')!=''?GETPOST('country_id'):$object->country_id); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); print ''; @@ -346,7 +346,7 @@ if ($action == 'create') // Public note print ''; print '' . $langs->trans('NotePublic') . ''; - print ''; + print ''; $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); print $doleditor->Create(1); @@ -356,7 +356,7 @@ if ($action == 'create') if (empty($user->societe_id)) { print ''; print '' . $langs->trans('NotePrivate') . ''; - print ''; + print ''; $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); print $doleditor->Create(1); @@ -371,7 +371,7 @@ if ($action == 'create') } // Other attributes - $parameters=array('colspan' => 3); + $parameters=array(); $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)) { @@ -442,7 +442,7 @@ if (! empty($id) && $action == 'edit') } else { - print ''.$langs->trans("Amount").''; + print ''.$langs->trans("Amount").''; print price($object->amount,0,$langs,0,0,-1,$conf->currency); print ''; } @@ -467,7 +467,7 @@ if (! empty($id) && $action == 'edit') print ''; // Country - print ''.$langs->trans('Country').''; + print ''.$langs->trans('Country').''; print $form->select_country((!empty($object->country_id)?$object->country_id:$mysoc->country_code),'country_id'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); print ''; @@ -496,7 +496,7 @@ if (! empty($id) && $action == 'edit') } // Other attributes - $parameters=array('colspan' => ' colspan="2"'); + $parameters=array(); $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)) { @@ -544,9 +544,9 @@ if (! empty($id) && $action != 'edit') // Print form confirm print $formconfirm; - + $linkback = ''.$langs->trans("BackToList").''; - + $morehtmlref='
'; // Project if (! empty($conf->projet->enabled)) @@ -581,8 +581,8 @@ if (! empty($id) && $action != 'edit') } } $morehtmlref.='
'; - - + + dol_banner_tab($object, 'rowid', $linkback, 1, 'rowid', 'ref', $morehtmlref); @@ -620,7 +620,7 @@ if (! empty($id) && $action != 'edit') // Zip / Town print ''.$langs->trans("Zip").' / '.$langs->trans("Town").''; print $object->zip.($object->zip && $object->town?' / ':'').$object->town.''; - + // Country print ''.$langs->trans('Country').''; if (! empty($object->country_code)) @@ -634,18 +634,18 @@ if (! empty($id) && $action != 'edit') print $object->country_olddata; } print ''; - + // EMail print "".''.$langs->trans("EMail").''.dol_print_email($object->email).''; */ - + // Payment mode print "".$langs->trans("PaymentMode").""; $form->form_modes_reglement(null, $object->modepaymentid,'none'); print "\n"; - + //print "".''.$langs->trans("Status").''.$object->getLibStatut(4).''; - + // Project /* if (! empty($conf->projet->enabled)) @@ -660,7 +660,7 @@ if (! empty($id) && $action != 'edit') print ''; print ''; }*/ - + // Other attributes $cols = 2; include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; @@ -702,7 +702,7 @@ if (! empty($id) && $action != 'edit') while ($i < $num) { $objp = $db->fetch_object($resql); - + print ''; print ''.img_object($langs->trans("Payment"),"payment").' '.$objp->rowid.''; print ''.dol_print_date($db->jdate($objp->dp),'day')."\n"; diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 8a5811a790a..2c34f5eddcd 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -115,12 +115,12 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e if (empty($reshook)) { - if ($cancel) - { - $action = ''; + if ($cancel) + { + $action = ''; $object->fetch($id); // show shipment also after canceling modification } - + include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once // Set incoterm @@ -129,13 +129,13 @@ if (empty($reshook)) $object->fetch($id); $result = $object->reOpen(); } - + // Set incoterm if ($action == 'set_incoterms' && !empty($conf->incoterm->enabled)) { $result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha')); } - + if ($action == 'setref_customer') { $result = $object->fetch($id); @@ -152,14 +152,14 @@ if (empty($reshook)) exit; } } - + if ($action == 'update_extras') { // Fill array 'array_options' with data from update form $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute')); if ($ret < 0) $error++; - + if (! $error) { // Actions on extra fields (by external module or standard code) @@ -175,11 +175,11 @@ if (empty($reshook)) } else if ($reshook < 0) $error++; } - + if ($error) $action = 'edit_extras'; } - + // Create shipment if ($action == 'add' && $user->rights->expedition->creer) { @@ -251,18 +251,18 @@ if (empty($reshook)) $sub_qty[$j]['q']=GETPOST($qty,'int'); // the qty we want to move for this stock record $sub_qty[$j]['id_batch']=GETPOST($batch,'int'); // the id into llx_product_batch of stock record to move $subtotalqty+=$sub_qty[$j]['q']; - + //var_dump($qty);var_dump($batch);var_dump($sub_qty[$j]['q']);var_dump($sub_qty[$j]['id_batch']); - + $j++; $batch="batchl".$i."_".$j; $qty = "qtyl".$i.'_'.$j; } - + $batch_line[$i]['detail']=$sub_qty; // array of details $batch_line[$i]['qty']=$subtotalqty; $batch_line[$i]['ix_l']=GETPOST($idl,'int'); - + $totalqty+=$subtotalqty; } else @@ -289,11 +289,11 @@ if (empty($reshook)) $stockLine[$i][$j]['ix_l']=GETPOST($idl,'int'); $totalqty+=GETPOST($qty,'int'); - + $j++; $stockLocation="ent1".$i."_".$j; $qty = "qtyl".$i.'_'.$j; - } + } } else { @@ -301,7 +301,7 @@ if (empty($reshook)) //shipment line for product with no batch management and no multiple stock location if (GETPOST($qty,'int') > 0) $totalqty+=GETPOST($qty,'int'); } - + // Extrafields $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); $array_options[$i] = $extrafieldsline->getOptionalsFromPost($extralabelsline, $i); @@ -312,9 +312,9 @@ if (empty($reshook)) unset($_POST["options_" . $key]); } } - + } - + //var_dump($batch_line[2]); if ($totalqty > 0) // There is at least one thing to ship @@ -324,7 +324,7 @@ if (empty($reshook)) { $qty = "qtyl".$i; if (! isset($batch_line[$i])) - { + { // not batch mode if (isset($stockLine[$i])) { @@ -352,7 +352,7 @@ if (empty($reshook)) $entrepot_id = is_numeric(GETPOST($ent,'int'))?GETPOST($ent,'int'):GETPOST('entrepot_id','int'); if ($entrepot_id < 0) $entrepot_id=''; if (! ($objectsrc->lines[$i]->fk_product > 0)) $entrepot_id = 0; - + $ret=$object->addline($entrepot_id, GETPOST($idl,'int'), GETPOST($qty,'int'), $array_options[$i]); if ($ret < 0) { @@ -363,7 +363,7 @@ if (empty($reshook)) } } else - { + { // batch mode if ($batch_line[$i]['qty']>0) { @@ -375,11 +375,11 @@ if (empty($reshook)) } } } - } + } // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels, $object); if ($ret < 0) $error++; - + if (! $error) { $ret=$object->create($user); // This create shipment (like Odoo picking) and line of shipments. Stock movement will when validating shipment. @@ -433,9 +433,9 @@ if (empty($reshook)) ) { $object->fetch_thirdparty(); - + $result = $object->valid($user); - + if ($result < 0) { $langs->load("errors"); @@ -627,7 +627,7 @@ if ($action == 'create2') $action=''; $id=''; $ref=''; } -// Mode creation. +// Mode creation. if ($action == 'create') { $expe = new Expedition($db); @@ -740,7 +740,7 @@ if ($action == 'create') // Weight print ''; print $langs->trans("Weight"); - print ' '; + print ' '; $text=$formproduct->select_measuring_units("weight_units","weight",GETPOST('weight_units','int')); $htmltext=$langs->trans("KeepEmptyForAutoCalculation"); print $form->textwithpicto($text, $htmltext); @@ -770,15 +770,15 @@ if ($action == 'create') print ''; print ''; print "\n"; - + // Other attributes $parameters = array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"', 'socid'=>$socid); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$expe,$action); // Note that $action and $object may have been modified by hook - + if (empty($reshook) && ! empty($extrafields->attribute_label)) { print $expe->showOptionals($extrafields, 'edit'); } - + // Incoterms if (!empty($conf->incoterm->enabled)) @@ -800,12 +800,12 @@ if ($action == 'create') print $form->selectarray('model', $liste, $conf->global->EXPEDITION_ADDON_PDF); print "\n"; } - + print ""; dol_fiche_end(); - + // Shipment lines $numAsked = count($object->lines); @@ -833,14 +833,14 @@ if ($action == 'create') print '
'; - - + + print ''; // Load shipments already done for same order $object->loadExpeditions(); - + if ($numAsked) { print ''; @@ -848,7 +848,7 @@ if ($action == 'create') print ''; print ''; print ''."\n"; - + // Product label if ($line->fk_product > 0) // If predefined product { @@ -913,7 +913,7 @@ if ($action == 'create') { print ($line->desc && $line->desc!=$line->product_label)?'
'.dol_htmlentitiesbr($line->desc):''; } - + print ''; } else @@ -958,7 +958,7 @@ if ($action == 'create') $quantityToBeDelivered = $quantityAsked - $quantityDelivered; } $warehouse_id = GETPOST('entrepot_id','int'); - + $warehouseObject = null; if ($warehouse_id > 0 || ! ($line->fk_product > 0) || empty($conf->stock->enabled)) // If warehouse was already selected or if product is not a predefined, we go into this part with no multiwarehouse selection { @@ -1040,10 +1040,10 @@ if ($action == 'create') { // Product need lot print ''; // end line and start a new one for lot/serial - + $staticwarehouse=new Entrepot($db); if ($warehouse_id > 0) $staticwarehouse->fetch($warehouse_id); - + $subj=0; // Define nb of lines suggested for this order line $nbofsuggested=0; @@ -1066,11 +1066,11 @@ if ($action == 'create') print ''; - + print ''; - + print ''; } } } - else + else { // ship from multiple locations if (empty($conf->productbatch->enabled) || ! $product->hasbatch()) { print ''; // end line and start a new one for each warehouse print ''; - + print ''; $subj=0; // Define nb of lines suggested for this order line $nbofsuggested=0; foreach ($product->stock_warehouse as $warehouse_id=>$stock_warehouse) { - if ($stock_warehouse->real > 0) + if ($stock_warehouse->real > 0) { $nbofsuggested++; } @@ -1119,7 +1119,7 @@ if ($action == 'create') foreach ($product->stock_warehouse as $warehouse_id=>$stock_warehouse) // $stock_warehouse is product_stock { $tmpwarehouseObject->fetch($warehouse_id); - if ($stock_warehouse->real > 0) + if ($stock_warehouse->real > 0) { $stock = + $stock_warehouse->real; // Convert it to number $deliverableQty = min($quantityToBeDelivered,$stock); @@ -1134,7 +1134,7 @@ if ($action == 'create') } else print $langs->trans("NA"); print ''; - + // Stock if (! empty($conf->stock->enabled)) { @@ -1142,10 +1142,10 @@ if ($action == 'create') if ($line->product_type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) { print $tmpwarehouseObject->getNomUrl(0).' '; - + print ''; print '('.$stock.')'; - + } else { @@ -1193,7 +1193,7 @@ if ($action == 'create') $subj=0; print ''; - + $tmpwarehouseObject=new Entrepot($db); $productlotObject=new Productlot($db); // Define nb of lines suggested for this order line @@ -1207,7 +1207,7 @@ if ($action == 'create') } } } - foreach ($product->stock_warehouse as $warehouse_id=>$stock_warehouse) + foreach ($product->stock_warehouse as $warehouse_id=>$stock_warehouse) { $tmpwarehouseObject->fetch($warehouse_id); if (($stock_warehouse->real > 0) && (count($stock_warehouse->detail_batch))) { @@ -1219,11 +1219,11 @@ if ($action == 'create') print ''; - + print ''; - + print ''; } } - - + + //Display lines extrafields - if (is_array($extralabelslines) && count($extralabelslines)>0) + if (is_array($extralabelslines) && count($extralabelslines)>0) { $colspan=5; $line = new ExpeditionLigne($db); @@ -1340,14 +1340,14 @@ else if ($id || $ref) $soc = new Societe($db); $soc->fetch($object->socid); - + $res = $object->fetch_optionals($object->id, $extralabels); $head=shipping_prepare_head($object); dol_fiche_head($head, 'shipping', $langs->trans("Shipment"), 0, 'sending'); $formconfirm=''; - + // Confirm deleteion if ($action == 'delete') { @@ -1393,18 +1393,18 @@ else if ($id || $ref) if (empty($reshook)) $formconfirm.=$hookmanager->resPrint; elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint; } - + // Print form confirm print $formconfirm; - - + + // Calculate totalWeight and totalVolume for all products // by adding weight and volume of each product line. $tmparray=$object->getTotalWeightVolume(); $totalWeight=$tmparray['weight']; $totalVolume=$tmparray['volume']; - - + + if ($typeobject == 'commande' && $object->$typeobject->id && ! empty($conf->commande->enabled)) { $objectsrc=new Commande($db); @@ -1459,15 +1459,15 @@ else if ($id || $ref) } } $morehtmlref.=''; - + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); - - + + print '
'; print '
'; print '
'; - + print '
'.$langs->trans("QtyOrdered").''.$langs->trans("QtyShipped").''.$langs->trans("QtyToShip"); - if (empty($conf->productbatch->enabled)) + if (empty($conf->productbatch->enabled)) { print '
('.$langs->trans("Fill").''; print ' / '.$langs->trans("Reset").')'; @@ -875,7 +875,7 @@ if ($action == 'create') $product = new Product($db); $line = $object->lines[$indiceAsked]; - + // Show product and description $type=$line->product_type?$line->product_type:$line->fk_product_type; @@ -885,7 +885,7 @@ if ($action == 'create') if (! empty($line->date_end)) $type=1; print '
'; print ''; print ''; - + print $staticwarehouse->getNomUrl(0).' / '; - + print ''; print ''; print $langs->trans("DetailBatchFormat", $dbatch->batch, dol_print_date($dbatch->eatby,"day"), dol_print_date($dbatch->sellby,"day"), $dbatch->qty); @@ -1089,28 +1089,28 @@ if ($action == 'create') print '
'; print ' '; print ''; print img_warning().' '.$langs->trans("NoProductToShipFoundIntoStock", $staticwarehouse->libelle); print '
'; print ''; print ''; - + print $tmpwarehouseObject->getNomUrl(0).' / '; - + print ''; print ''; //print $langs->trans("DetailBatchFormat", $dbatch->batch, dol_print_date($dbatch->eatby,"day"), dol_print_date($dbatch->sellby,"day"), $dbatch->qty); @@ -1242,7 +1242,7 @@ if ($action == 'create') } } } - + } if ($subj == 0) // Line not shown yet, we show it { @@ -1262,12 +1262,12 @@ if ($action == 'create') print $langs->trans("NA"); } print ''; if ($line->product_type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) { - $warehouse_selected_id = GETPOST('entrepot_id','int'); - if ($warehouse_selected_id > 0) + $warehouse_selected_id = GETPOST('entrepot_id','int'); + if ($warehouse_selected_id > 0) { $warehouseObject=new Entrepot($db); $warehouseObject->fetch($warehouse_selected_id); @@ -1287,10 +1287,10 @@ if ($action == 'create') print '
'; // Linked documents @@ -1550,7 +1550,7 @@ else if ($id || $ref) if (!empty($object->trueWeight)) print ' ('.$langs->trans("SumOfProductWeights").': '; //print $totalWeight.' '.measuring_units_string(0,"weight"); print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND)?$conf->global->MAIN_WEIGHT_DEFAULT_ROUND:-1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT)?$conf->global->MAIN_WEIGHT_DEFAULT_UNIT:'no'); - //if (empty($object->trueWeight)) print ' ('.$langs->trans("Calculated").')'; + //if (empty($object->trueWeight)) print ' ('.$langs->trans("Calculated").')'; if (!empty($object->trueWeight)) print ')'; } print ''; @@ -1597,7 +1597,7 @@ else if ($id || $ref) print '
'; $calculatedVolume=0; $volumeUnit=0; - if ($object->trueWidth && $object->trueHeight && $object->trueDepth) + if ($object->trueWidth && $object->trueHeight && $object->trueDepth) { $calculatedVolume=($object->trueWidth * $object->trueHeight * $object->trueDepth); $volumeUnit=$object->size_units * 3; @@ -1605,7 +1605,7 @@ else if ($id || $ref) // If sending volume not defined we use sum of products if ($calculatedVolume > 0) { - if ($volumeUnit < 50) + if ($volumeUnit < 50) { //print $calculatedVolume.' '.measuring_units_string($volumeUnit,"volume"); print showDimensionInBestUnit($calculatedVolume, $volumeUnit, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no'); @@ -1626,14 +1626,14 @@ else if ($id || $ref) // Other attributes $cols = 2; include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; - + print '
'; - + print '
'; print '
'; print '
'; print '
'; - + print ''; // Sending method @@ -1667,7 +1667,7 @@ else if ($id || $ref) } print ''; print ''; - + // Tracking Number print '
'.$form->editfieldkey("TrackingNumber",'trackingnumber',$object->tracking_number,$object,$user->rights->expedition->creer).''; print $form->editfieldval("TrackingNumber",'trackingnumber',$object->tracking_url,$object,$user->rights->expedition->creer,'string',$object->tracking_number); @@ -1697,19 +1697,19 @@ else if ($id || $ref) } print "
"; - + print '
'; print '
'; print '
'; - + print '
'; - + /* * Lines of products */ print '
'; - + print '
'; print ''; print ''; @@ -1732,7 +1732,7 @@ else if ($id || $ref) { print ''; } - + print ''; print ''; //print ''; @@ -1793,7 +1793,7 @@ else if ($id || $ref) { $num = $db->num_rows($resql); $i = 0; - + while($i < $num) { $obj = $db->fetch_object($resql); @@ -1900,7 +1900,7 @@ else if ($id || $ref) } } } - } + } print ''; // Weight @@ -1960,7 +1960,7 @@ else if ($id || $ref) } print $form->textwithtooltip(img_picto('', 'object_barcode').' '.$langs->trans("DetailBatchNumber"),$detail); } - else + else { print $langs->trans("NA"); } @@ -1970,7 +1970,7 @@ else if ($id || $ref) } } print ""; - + // Display lines extrafields if (is_array($extralabelslines) && count($extralabelslines)>0) { $colspan= empty($conf->productbatch->enabled) ? 5 : 6; @@ -1981,11 +1981,11 @@ else if ($id || $ref) print ''; } - + } - + // TODO Show also lines ordered but not delivered - + print "
'.$langs->trans("QtyInOtherShipments").''.$langs->trans("CalculatedWeight").''.$langs->trans("CalculatedVolume").''.$langs->trans("Size").'
\n"; print '
'; } @@ -1996,7 +1996,7 @@ else if ($id || $ref) $object->fetchObjectLinked($object->id,$object->element); - + /* * Boutons actions */ @@ -2023,14 +2023,14 @@ else if ($id || $ref) print ''.$langs->trans("Validate").''; } } - + // TODO add alternative status // 0=draft, 1=validated, 2=billed, we miss a status "delivered" (only available on order) if ($object->statut == 2 && $object->billed && $user->rights->expedition->creer) { print ''.$langs->trans("ReOpen").''; } - + // Send if ($object->statut > 0) { @@ -2040,7 +2040,7 @@ else if ($id || $ref) } else print ''.$langs->trans('SendByMail').''; } - + // Create bill and Close shipment if (! empty($conf->facture->enabled) && $object->statut > 0) { @@ -2049,7 +2049,7 @@ else if ($id || $ref) print ''.$langs->trans("CreateBill").''; } } - + // This is just to generate a delivery receipt //var_dump($object->linkedObjectsIds['delivery']); if ($conf->livraison_bon->enabled && ($object->statut == 1 || $object->statut == 2) && $user->rights->expedition->livraison->creer && count($object->linkedObjectsIds['delivery']) == 0) @@ -2071,14 +2071,14 @@ else if ($id || $ref) print ''.$langs->trans($label).''; } } - + if ($user->rights->expedition->supprimer) { print ''.$langs->trans("Delete").''; } - + } - + print '
'; } @@ -2086,11 +2086,11 @@ else if ($id || $ref) /* * Documents generated */ - + if ($action != 'presend') { print '
'; - + $objectref = dol_sanitizeFileName($object->ref); $filedir = $conf->expedition->dir_output . "/sending/" .$objectref; @@ -2101,12 +2101,12 @@ else if ($id || $ref) print $formfile->showdocuments('expedition',$objectref,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'','','',$soc->default_lang); - + // Show links to link elements //$linktoelem = $form->showLinkToObjectBlock($object, null, array('order')); $somethingshown = $form->showLinkedObjectBlock($object, ''); - + print '
'; // List of actions on element @@ -2117,11 +2117,11 @@ else if ($id || $ref) print '
'; } - + /* * Action presend */ - + //Select mail models is same action as presend if (GETPOST('modelselected')) { $action = 'presend'; @@ -2182,7 +2182,7 @@ else if ($id || $ref) { include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; $formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'shi'.$object->id); - } + } $formmail->withfrom=1; $liste=array(); foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value; @@ -2215,7 +2215,7 @@ else if ($id || $ref) { $contactarr=$objectsrc->liste_contact(-1,'external'); } - + if (is_array($contactarr) && count($contactarr)>0) { foreach($contactarr as $contact) { diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index cfa88b187f0..2e6fed839eb 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -133,9 +133,9 @@ if ($object->id > 0) dol_fiche_head($head, 'supplier', $langs->trans("ThirdParty"), -1, 'company'); $linkback = ''.$langs->trans("BackToList").''; - + dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); - + print '
'; print '
'; @@ -243,12 +243,7 @@ if ($object->id > 0) // Other attributes $parameters=array('socid'=>$object->id, 'colspan' => ' colspan="3"', 'colspanvalue' => '3'); - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - if (empty($reshook) && ! empty($extrafields->attribute_label)) - { - print $object->showOptionals($extrafields); - } + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; // Module Adherent if (! empty($conf->adherent->enabled)) @@ -278,15 +273,15 @@ if ($object->id > 0) print '
'; $boxstat = ''; - + // Nbre max d'elements des petites listes $MAXLIST=$conf->global->MAIN_SIZE_SHORTLIST_LIMIT; - + // Lien recap $boxstat.='
'; $boxstat.=''; $boxstat.=''; $boxstat.='
'; - + if ($conf->supplier_proposal->enabled) { // Box proposals @@ -304,7 +299,7 @@ if ($object->id > 0) $boxstat.=''; if ($link) $boxstat.=''; } - + if ($conf->fournisseur->enabled) { // Box proposals @@ -322,14 +317,14 @@ if ($object->id > 0) $boxstat.=''; if ($link) $boxstat.=''; } - + if ($conf->fournisseur->enabled) { $tmp = $object->getOutstandingBills('supplier'); $outstandingOpened=$tmp['opened']; $outstandingTotal=$tmp['total_ht']; $outstandingTotalIncTax=$tmp['total_ttc']; - + $text=$langs->trans("OverAllInvoices"); $link=''; $icon='bill'; @@ -339,7 +334,7 @@ if ($object->id > 0) $boxstat.=''.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).''; $boxstat.=''; if ($link) $boxstat.=''; - + // Box outstanding bill $text=$langs->trans("CurrentOutstandingBill"); $link=DOL_URL_ROOT.'/fourn/recap-fourn.php?socid='.$object->id; @@ -351,14 +346,14 @@ if ($object->id > 0) $boxstat.=''; if ($link) $boxstat.=''; } - + $boxstat.='
'; $boxstat.='
'; - + print $boxstat; - - + + $var=true; $MAXLIST=$conf->global->MAIN_SIZE_SHORTLIST_LIMIT; @@ -395,10 +390,10 @@ if ($object->id > 0) $sql.= ' AND pfp.fk_soc = '.$object->id; $sql .= $db->order('pfp.tms', 'desc'); $sql.= $db->plimit($MAXLIST); - + $query = $db->query($sql); if (! $query) dol_print_error($db); - + $return = array(); if ($db->num_rows($query)) { @@ -407,7 +402,7 @@ if ($object->id > 0) while ($objp = $db->fetch_object($query)) { - + $productstatic->id = $objp->rowid; $productstatic->ref = $objp->ref; @@ -445,12 +440,12 @@ if ($object->id > 0) print ''; } - + /* * Last supplier proposal */ $proposalstatic = new SupplierProposal($db); - + if ($user->rights->supplier_proposal->lire) { $sql = "SELECT p.rowid, p.ref, p.date_valid as dc, p.fk_statut, p.total_ht, p.tva as total_tva, p.total as total_ttc"; @@ -459,17 +454,17 @@ if ($object->id > 0) $sql.= " AND p.entity =".$conf->entity; $sql.= " ORDER BY p.date_valid DESC"; $sql.= " ".$db->plimit($MAXLIST); - + $resql=$db->query($sql); if ($resql) { $i = 0 ; $num = $db->num_rows($resql); - + if ($num > 0) { print ''; - + print ''; print ''; } - + $var = True; while ($i < $num && $i <= $MAXLIST) { $obj = $db->fetch_object($resql); - - + + print ''; print '
'; print ''; @@ -478,13 +473,13 @@ if ($object->id > 0) print '
'.$langs->trans("LastSupplierProposals",($num<$MAXLIST?"":$MAXLIST)).'
'; print '
'; $proposalstatic->id = $obj->rowid; @@ -509,14 +504,14 @@ if ($object->id > 0) $i++; } $db->free($resql); - + if ($num >0) print "
"; } else { dol_print_error($db); } - } + } /* * Last supplier orders @@ -558,7 +553,7 @@ if ($object->id > 0) $object_count = $db->fetch_object($resql); $num = $object_count->total; } - + $sql = "SELECT p.rowid,p.ref, p.date_commande as dc, p.fk_statut, p.total_ht, p.tva as total_tva, p.total_ttc"; $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as p "; $sql.= " WHERE p.fk_soc =".$object->id; @@ -587,7 +582,7 @@ if ($object->id > 0) while ($i < $num && $i < $MAXLIST) { $obj = $db->fetch_object($resql); - + print ''; print ''; @@ -660,7 +655,7 @@ if ($object->id > 0) while ($i < min($num,$MAXLIST)) { $obj = $db->fetch_object($resql); - + print ''; print ''; print ''; @@ -712,7 +707,7 @@ if ($object->id > 0) { print ''; } - + if ($conf->supplier_proposal->enabled && $user->rights->supplier_proposal->creer && $object->status==1) { $langs->load("supplier_proposal"); @@ -750,9 +745,9 @@ if ($object->id > 0) } } } - + print '
'; - + if (! empty($conf->global->MAIN_REPEATCONTACTONEACHTAB)) { diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index a6f0cc248f1..f77eb949c9a 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -279,7 +279,7 @@ if (empty($reshook)) if ($action == 'addline' && $user->rights->fournisseur->commande->creer) { $db->begin(); - + $langs->load('errors'); $error = 0; @@ -469,7 +469,7 @@ if (empty($reshook)) if (! $error && $result > 0) { $db->commit(); - + $ret=$object->fetch($object->id); // Reload to get new records // Define output language @@ -526,7 +526,7 @@ if (empty($reshook)) $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); } - + $action = ''; } @@ -1617,7 +1617,7 @@ elseif (! empty($object->id)) $res=$object->fetch_optionals($object->id,$extralabels); - + $head = ordersupplier_prepare_head($object); $title=$langs->trans("SupplierOrder"); @@ -1754,11 +1754,11 @@ elseif (! empty($object->id)) // Print form confirm print $formconfirm; - + // Supplier order card $linkback = ''.$langs->trans("BackToList").''; - + $morehtmlref='
'; // Ref supplier $morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', 0, 1); @@ -1798,15 +1798,15 @@ elseif (! empty($object->id)) } } $morehtmlref.='
'; - - - dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); - + + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + print '
'; print '
'; print '
'; - + print ''; // Date @@ -1995,16 +1995,15 @@ elseif (! empty($object->id)) } // Other attributes - $cols = 2; include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; print '
'; - + print '
'; print '
'; print '
'; print '
'; - + print ''; if (!empty($conf->multicurrency->enabled)) @@ -2013,18 +2012,18 @@ elseif (! empty($object->id)) print ''; print ''; print ''; - + // Multicurrency Amount VAT print ''; print ''; print ''; - + // Multicurrency Amount TTC print ''; print ''; print ''; } - + // Total print ''; print ''; @@ -2053,19 +2052,19 @@ elseif (! empty($object->id)) print ''; print '
' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
'.$langs->trans("AmountHT").''.price($object->total_ht,'',$langs,1,-1,-1,$conf->currency).'
'; - + // Margin Infos /*if (! empty($conf->margin->enabled)) { $formmargin->displayMarginInfos($object); }*/ - - + + print '
'; print '
'; print '
'; - + print '

'; - + if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) { $blocname = 'contacts'; diff --git a/htdocs/fourn/commande/orderstoinvoice.php b/htdocs/fourn/commande/orderstoinvoice.php index 32f1a5538b5..9fb9a63828d 100644 --- a/htdocs/fourn/commande/orderstoinvoice.php +++ b/htdocs/fourn/commande/orderstoinvoice.php @@ -76,9 +76,9 @@ $extrafields = new ExtraFields($db); // fetch optionals attributes and labels $extralabels=$extrafields->fetch_name_optionals_label('facture_fourn'); -if ($action == 'create') +if ($action == 'create') { - if (! is_array($selected)) + if (! is_array($selected)) { $error++; setEventMessages($langs->trans('Error_OrderNotChecked'), null, 'errors'); @@ -246,10 +246,10 @@ if (($action == 'create' || $action == 'add') && ! $error) { // End of object creation, we show it if ($id > 0 && ! $error) { - + foreach($orders_id as $fk_supplier_order) { $supplier_order = new CommandeFournisseur($db); - if ($supplier_order->fetch($fk_supplier_order)>0 && $supplier_order->statut == 5) + if ($supplier_order->fetch($fk_supplier_order)>0 && $supplier_order->statut == 5) { if ($supplier_order->classifyBilled($user) < 0) { @@ -258,20 +258,20 @@ if (($action == 'create' || $action == 'add') && ! $error) { $_GET["origin"] = $_POST["origin"]; $_GET["originid"] = $_POST["originid"]; $mesgs[] = '
' . $object->error . '
'; - + $error++; break; } - + } } - + if(!$error) { $db->commit(); header('Location: ' . DOL_URL_ROOT . '/fourn/facture/card.php?facid=' . $id); exit(); } - + } else { $db->rollback(); $action = 'create'; @@ -366,7 +366,8 @@ if ($action == 'create' && !$error) { $parameters = array ( 'objectsrc' => $objectsrc, 'idsrc' => $listoforders, - 'colspan' => ' colspan="3"' + 'colspan' => ' colspan="2"', + 'cols'=>2 ); $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook @@ -494,7 +495,7 @@ if (($action != 'create' && $action != 'add') && !$error) { $companystatic->nom = $soc->nom; print '

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

'; } - + print ''; print ''; print ''; @@ -517,7 +518,7 @@ if (($action != 'create' && $action != 'add') && !$error) { print ''; - + // DATE ORDER print ''; // Payment term - print ''; // Payment mode - print ''; // Bank Account - print ''; @@ -1724,7 +1724,7 @@ if ($action == 'create') { print ''; print ''; - print ''; } @@ -1735,7 +1735,7 @@ if ($action == 'create') $formproject = new FormProjets($db); $langs->load('projects'); - print ''; } @@ -1790,7 +1790,7 @@ if ($action == 'create') $langs->load('orders'); $txt=$langs->trans("SupplierOrder"); } - print ''; - print ''; - print '"; + print ''; + print '"; if ($mysoc->localtax1_assuj=="1" || $object->total_localtax1 != 0) //Localtax1 { - print '"; + print '"; } if ($mysoc->localtax2_assuj=="1" || $object->total_localtax2 != 0) //Localtax2 { - print '"; + print '"; } - print '"; + print '"; if (!empty($conf->multicurrency->enabled)) { - print ''; - print '"; - print '"; + print ''; + print '"; + print '"; } } // Other options - $parameters=array('colspan' => ' colspan="6"'); + $parameters=array(); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook // Bouton "Create Draft" @@ -2347,7 +2347,7 @@ else while ($i < $num) { $objp = $db->fetch_object($result); - + print '
'; print ''; print ''; print $period; @@ -606,9 +607,9 @@ if (($action != 'create' && $action != 'add') && !$error) { print ''; print ''; print ''; - + print ''; - + $db->free($resql); } else { print dol_print_error($db); diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 04e6ea98481..0ec657ccdfe 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -206,7 +206,7 @@ if (empty($reshook)) } $model=$object->modelpdf; $ret = $object->fetch($id); // Reload to get new records - + $result=$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result < 0) dol_print_error($db,$result); } @@ -1198,7 +1198,7 @@ if (empty($reshook)) $upload_dir = $conf->fournisseur->facture->dir_output; $permissioncreate = $user->rights->fournisseur->facture->creer; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; - + // Make calculation according to calculationrule if ($action == 'calculate') { @@ -1674,7 +1674,7 @@ if ($action == 'create') if ($socid > 0) { // Discounts for third party - print '
' . $langs->trans('Discounts') . ''; + print '
' . $langs->trans('Discounts') . ''; if ($soc->remise_percent) print $langs->trans("CompanyHasRelativeDiscount", '' . $soc->remise_percent . ''); else @@ -1705,17 +1705,17 @@ if ($action == 'create') print '
'.$langs->trans('PaymentConditionsShort').''; + print '
'.$langs->trans('PaymentConditionsShort').''; $form->select_conditions_paiements(isset($_POST['cond_reglement_id'])?$_POST['cond_reglement_id']:$cond_reglement_id, 'cond_reglement_id'); print '
'.$langs->trans('PaymentMode').''; + print '
'.$langs->trans('PaymentMode').''; $form->select_types_paiements(isset($_POST['mode_reglement_id'])?$_POST['mode_reglement_id']:$mode_reglement_id, 'mode_reglement_id', 'DBIT'); print '
'.$langs->trans('BankAccount').''; + print '
'.$langs->trans('BankAccount').''; $form->select_comptes($fk_account, 'fk_account', 0, '', 1); print '
'.fieldLabel('Currency','multicurrency_code').''; + print ''; print $form->selectMultiCurrency($currency_code, 'multicurrency_code'); print '
' . $langs->trans('Project') . ''; + print '
' . $langs->trans('Project') . ''; $formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS)?$societe->id:-1), $projectid, 'projectid', 0, 0, 1, 1); print '
'.$txt.''.$objectsrc->getNomUrl(1); + print '
'.$txt.''.$objectsrc->getNomUrl(1); // We check if Origin document (id and type is known) has already at least one invoice attached to it $objectsrc->fetchObjectLinked($originid,$origin,'','invoice_supplier'); $cntinvoice=count($objectsrc->linkedObjects['invoice_supplier']); @@ -1800,29 +1800,29 @@ if ($action == 'create') echo ' ('.$langs->trans('LatestRelatedBill').end($objectsrc->linkedObjects['invoice_supplier'])->getNomUrl(1).')'; } echo '
'.$langs->trans('TotalHT').''.price($objectsrc->total_ht).'
'.$langs->trans('TotalVAT').''.price($objectsrc->total_tva)."
'.$langs->trans('TotalHT').''.price($objectsrc->total_ht).'
'.$langs->trans('TotalVAT').''.price($objectsrc->total_tva)."
'.$langs->transcountry("AmountLT1",$mysoc->country_code).''.price($objectsrc->total_localtax1)."
'.$langs->transcountry("AmountLT1",$mysoc->country_code).''.price($objectsrc->total_localtax1)."
'.$langs->transcountry("AmountLT2",$mysoc->country_code).''.price($objectsrc->total_localtax2)."
'.$langs->transcountry("AmountLT2",$mysoc->country_code).''.price($objectsrc->total_localtax2)."
'.$langs->trans('TotalTTC').''.price($objectsrc->total_ttc)."
'.$langs->trans('TotalTTC').''.price($objectsrc->total_ttc)."
' . $langs->trans('MulticurrencyTotalHT') . '' . price($objectsrc->multicurrency_total_ht) . '
' . $langs->trans('MulticurrencyTotalVAT') . '' . price($objectsrc->multicurrency_total_tva) . "
' . $langs->trans('MulticurrencyTotalTTC') . '' . price($objectsrc->multicurrency_total_ttc) . "
' . $langs->trans('MulticurrencyTotalHT') . '' . price($objectsrc->multicurrency_total_ht) . '
' . $langs->trans('MulticurrencyTotalVAT') . '' . price($objectsrc->multicurrency_total_tva) . "
' . $langs->trans('MulticurrencyTotalTTC') . '' . price($objectsrc->multicurrency_total_ttc) . "
'; $paymentstatic->id=$objp->rowid; $paymentstatic->datepaye=$db->jdate($objp->dp); diff --git a/htdocs/fourn/product/list.php b/htdocs/fourn/product/list.php index ca874511c94..14682f7928b 100644 --- a/htdocs/fourn/product/list.php +++ b/htdocs/fourn/product/list.php @@ -31,8 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; -$langs->load("products"); -$langs->load("suppliers"); +$langs->loadLangs(array("products","suppliers")); if (!$user->rights->produit->lire && !$user->rights->service->lire) accessforbidden(); @@ -42,40 +41,66 @@ $snom = GETPOST('snom'); $type = GETPOST('type'); $optioncss = GETPOST('optioncss','alpha'); -$sortfield = GETPOST('sortfield'); -$sortorder = GETPOST('sortorder'); -$page = GETPOST('page'); -if ($page < 0) { - $page = 0 ; -} +// Load variable for pagination +$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit; +$sortfield = GETPOST('sortfield','alpha'); +$sortorder = GETPOST('sortorder','alpha'); +$page = GETPOST('page','int'); +if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +if (! $sortfield) $sortfield="p.ref"; // Set here default search field +if (! $sortorder) $sortorder="ASC"; -$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; -$offset = $limit * $page ; +$fourn_id = GETPOST('fourn_id', 'intcomma'); +$catid = GETPOST('catid', 'intcomma'); -if (! $sortfield) $sortfield = 'p.ref'; -if (! $sortorder) $sortorder = 'DESC'; +// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array +$hookmanager->initHooks(array('supplierpricelist')); +$extrafields = new ExtraFields($db); -if (GETPOST('button_removefilter')) -{ - $sref = ''; - $sRefSupplier = ''; - $snom = ''; -} - -$fourn_id = GETPOST('fourn_id', 'int'); - -if (isset($_REQUEST['catid'])) -{ - $catid = $_REQUEST['catid']; -} /* -* Mode Liste -* -*/ + * ACTIONS + * + * Put here all code to do according to value of "action" parameter + */ +if (GETPOST('cancel')) { $action='list'; $massaction=''; } +if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; } + +$parameters=array(); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + +if (empty($reshook)) +{ + // Selection of new fields + include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + + // Purge search criteria + if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers + { + $sref = ''; + $sRefSupplier = ''; + $snom = ''; + $search_field1=''; + $search_field2=''; + $search_date_creation=''; + $search_date_update=''; + $toselect=''; + $search_array_options=array(); + } +} + +/* + * View + */ + +$form = new Form($db); $productstatic = new Product($db); $companystatic = new Societe($db); @@ -87,6 +112,17 @@ if ($fourn_id) $supplier->fetch($fourn_id); } + + +$arrayofmassactions = array( + 'presend'=>$langs->trans("SendByMail"), + 'builddoc'=>$langs->trans("PDFMerge"), +); +if ($user->rights->mymodule->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); +if ($massaction == 'presend') $arrayofmassactions=array(); +$massactionbutton=$form->selectMassAction('', $arrayofmassactions); + + $sql = "SELECT p.rowid, p.label, p.ref, p.fk_product_type, p.entity,"; $sql.= " ppf.fk_soc, ppf.ref_fourn, ppf.price as price, ppf.quantity as qty, ppf.unitprice,"; $sql.= " s.rowid as socid, s.nom as name"; @@ -155,7 +191,7 @@ if ($resql) print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords); - if (isset($catid)) + if (! empty($catid)) { print "
"; $c = new Categorie($db); @@ -175,17 +211,6 @@ if ($resql) print ''; - // Lignes des titres - print ""; - print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"], "p.ref",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("RefSupplierShort"),$_SERVER["PHP_SELF"], "ppf.ref_fourn",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"], "p.label",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Supplier"),$_SERVER["PHP_SELF"], "ppf.fk_soc",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("BuyingPrice"),$_SERVER["PHP_SELF"], "ppf.price",$param,"",'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("QtyMin"),$_SERVER["PHP_SELF"], "ppf.quantity",$param,"",'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("UnitPrice"),$_SERVER["PHP_SELF"], "ppf.unitprice",$param,"",'align="right"',$sortfield,$sortorder); - print "\n"; - // Lignes des champs de filtre print ''; print ''; - print ''; + print ''; + print ''; + print ''; + print ''; print ''; + // Lignes des titres + print ''; + print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"], "p.ref",$param,"","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("RefSupplierShort"),$_SERVER["PHP_SELF"], "ppf.ref_fourn",$param,"","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"], "p.label",$param,"","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Supplier"),$_SERVER["PHP_SELF"], "ppf.fk_soc",$param,"","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("BuyingPrice"),$_SERVER["PHP_SELF"], "ppf.price",$param,"",'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("QtyMin"),$_SERVER["PHP_SELF"], "ppf.quantity",$param,"",'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("UnitPrice"),$_SERVER["PHP_SELF"], "ppf.unitprice",$param,"",'align="right"',$sortfield,$sortorder); + print_liste_field_titre('',$_SERVER["PHP_SELF"]); + print "\n"; + $oldid = ''; $var=True; while ($i < min($num,$limit)) { $objp = $db->fetch_object($resql); - + print ''; print ''; + print ''; + print "\n"; $i++; } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index b04aaf40a31..03af3ddfe88 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -390,7 +390,7 @@ ExtrafieldCheckBox=Checkboxes ExtrafieldCheckBoxFromList=Checkboxes from table ExtrafieldLink=Link to an object ComputedFormula=Computed field -ComputedFormulaDesc=You can enter here a formula using other properties of object or any PHP coding to get a dynamic computed value. You can use any PHP compatible formulas including the "?" condition operator, and following global object: $db, $conf, $langs, $mysoc, $user, $object.
WARNING: Only some properties of $object may be available. If you need a properties not loaded, just fetch yourself the object into your formula like in the second example.
Using a computed field means you can't enter yourself any value from interface. Also, if there is a syntax error, the formula may return nothing.

Example of formula:
$object->id < 10 ? round($object->id / 2, 2) : ($object->array_options['options_extrafieldkey'] + 2 * $user->id) * (int) substr($mysoc->zip, 1, 2)

Example to reload object
(($reloadedobj = new Societe($db)) && ($reloadedobj->fetch($obj->id ? $obj->id : ($obj->rowid ? $obj->rowid : $object->id)) > 0)) ? round($reloadedobj->capital / 5) : '-1'

Other example of formula to force load of object and its parent object:
(($reloadedobj = new Task($db)) && ($reloadedobj->fetch($object->id) > 0) && ($secondloadedobj = new Project($db)) && ($secondloadedobj->fetch($reloadedobj->fk_project) > 0)) ? $secondloadedobj->ref : 'Parent project not found' +ComputedFormulaDesc=You can enter here a formula using other properties of object or any PHP coding to get a dynamic computed value. You can use any PHP compatible formulas including the "?" condition operator, and following global object: $db, $conf, $langs, $mysoc, $user, $object.
WARNING: Only some properties of $object may be available. If you need a properties not loaded, just fetch yourself the object into your formula like in the second example.
Using a computed field means you can't enter yourself any value from interface. Also, if there is a syntax error, the formula may return nothing.

Example of formula:
$object->id < 10 ? round($object->id / 2, 2) : ($object->id + 2 * $user->id) * (int) substr($mysoc->zip, 1, 2)

Example to reload object
(($reloadedobj = new Societe($db)) && ($reloadedobj->fetch($obj->id ? $obj->id : ($obj->rowid ? $obj->rowid : $object->id)) > 0)) ? $reloadedobj->array_options['options_extrafieldkey'] * $reloadedobj->capital / 5 : '-1'

Other example of formula to force load of object and its parent object:
(($reloadedobj = new Task($db)) && ($reloadedobj->fetch($object->id) > 0) && ($secondloadedobj = new Project($db)) && ($secondloadedobj->fetch($reloadedobj->fk_project) > 0)) ? $secondloadedobj->ref : 'Parent project not found' ExtrafieldParamHelpselect=Parameters list have to be like key,value

for example :
1,value1
2,value2
3,value3
...

In order to have the list depending on another complementary attribute list :
1,value1|options_parent_list_code:parent_key
2,value2|options_parent_list_code:parent_key

In order to have the list depending on another list :
1,value1|parent_list_code:parent_key
2,value2|parent_list_code:parent_key ExtrafieldParamHelpcheckbox=Parameters list have to be like key,value

for example :
1,value1
2,value2
3,value3
... ExtrafieldParamHelpradio=Parameters list have to be like key,value

for example :
1,value1
2,value2
3,value3
... diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 91e00c274ff..8ea14fdb305 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -726,7 +726,7 @@ ViewPrivateNote=View notes XMoreLines=%s line(s) hidden PublicUrl=Public URL AddBox=Add box -SelectElementAndClickRefresh=Select an element and click Refresh +SelectElementAndClick=Select an element and click %s PrintFile=Print File %s ShowTransaction=Show entry on bank account GoIntoSetupToChangeLogo=Go into Home - Setup - Company to change logo or go into Home - Setup - Display to hide. diff --git a/htdocs/langs/en_US/withdrawals.lang b/htdocs/langs/en_US/withdrawals.lang index 1eb906f1acc..8e80a111516 100644 --- a/htdocs/langs/en_US/withdrawals.lang +++ b/htdocs/langs/en_US/withdrawals.lang @@ -17,7 +17,7 @@ NbOfInvoiceToWithdrawWithInfo=Nb. of customer invoice with direct debit payment InvoiceWaitingWithdraw=Invoice waiting for direct debit AmountToWithdraw=Amount to withdraw WithdrawsRefused=Direct debit refused -NoInvoiceToWithdraw=No customer invoice in payment mode "withdraw" is waiting. Go on 'Withdraw' tab on invoice card to make a request. +NoInvoiceToWithdraw=No customer invoice with open 'Direct debit requests' is waiting. Go on tab '%s' on invoice card to make a request. ResponsibleUser=Responsible user WithdrawalsSetup=Direct debit payment setup WithdrawStatistics=Direct debit payment statistics diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 292c6a139a4..fe9105d0d9f 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -53,7 +53,7 @@ class MyModuleObject extends CommonObject * @var array Array with all fields and their property */ public $fields; - + /** * @var mixed Sample property 1 */ @@ -62,11 +62,11 @@ class MyModuleObject extends CommonObject * @var mixed Sample property 2 */ public $prop2; - + //... - + protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe - + public $table_element_line = 'mymoduleobjectdet'; public $class_element_line = 'MyModuleObjectline'; public $fk_element = 'fk_mymoduleobject'; @@ -75,9 +75,9 @@ class MyModuleObject extends CommonObject * @var MyModuleObjectLine[] Lines */ public $lines = array(); - - - + + + /** * Constructor * @@ -163,10 +163,9 @@ class MyModuleObject extends CommonObject /** * Load object in memory from the database * - * @param int $id Id object - * @param string $ref Ref - * - * @return int <0 if KO, 0 if not found, >0 if OK + * @param int $id Id object + * @param string $ref Ref + * @return int <0 if KO, 0 if not found, >0 if OK */ public function fetch($id, $ref = null) { @@ -199,20 +198,13 @@ class MyModuleObject extends CommonObject $this->prop2 = $obj->field2; //... } - - // Retrieve all extrafields for invoice - // fetch optionals attributes and labels - /* - require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - $extrafields=new ExtraFields($this->db); - $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true); - $this->fetch_optionals($this->id,$extralabels); - */ - - // $this->fetch_lines(); - + $this->db->free($resql); + $this->fetch_optionals(); + + // $this->fetch_lines(); + if ($numrows) { return 1; } else { @@ -221,7 +213,6 @@ class MyModuleObject extends CommonObject } else { $this->errors[] = 'Error ' . $this->db->lasterror(); dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR); - return - 1; } } @@ -306,7 +297,7 @@ class MyModuleObject extends CommonObject dol_syslog(__METHOD__, LOG_DEBUG); $error = 0; - + // Clean parameters if (isset($this->prop1)) { $this->prop1 = trim($this->prop1); @@ -386,7 +377,7 @@ class MyModuleObject extends CommonObject } // If you need to delete child tables to, you can insert them here - + if (!$error) { $sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element; $sql .= ' WHERE rowid=' . $this->id; @@ -475,7 +466,7 @@ class MyModuleObject extends CommonObject global $menumanager; if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips - + $result = ''; $companylink = ''; @@ -484,7 +475,7 @@ class MyModuleObject extends CommonObject $label.= '' . $langs->trans('Ref') . ': ' . $this->ref; $url = DOL_URL_ROOT.'/mymodule/'.$this->table_name.'_card.php?id='.$this->id; - + $linkclose=''; if (empty($notooltip)) { @@ -497,7 +488,7 @@ class MyModuleObject extends CommonObject $linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"'; } else $linkclose = ($morecss?' class="'.$morecss.'"':''); - + $linkstart = ''; $linkend=''; diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php index 5799d5bbab7..9e8f5ca9975 100644 --- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php +++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php @@ -69,7 +69,7 @@ class modMyModule extends DolibarrModules $this->descriptionlong = "MyModuleDescription (Long)"; $this->editor_name = 'Editor name'; $this->editor_url = 'https://www.example.com'; - + // Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z' $this->version = '1.0'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) @@ -151,7 +151,7 @@ class modMyModule extends DolibarrModules $conf->mymodule=new stdClass(); $conf->mymodule->enabled=0; } - + // Dictionaries $this->dictionaries=array(); /* Example: @@ -169,8 +169,9 @@ class modMyModule extends DolibarrModules ); */ + // Boxes - // Add here list of php file(s) stored in core/boxes that contains class to show a box. + // Add here list of php file(s) stored in core/boxes that contains class to show a widget. $this->boxes = array(); // List of boxes // Example: //$this->boxes=array( @@ -179,24 +180,38 @@ class modMyModule extends DolibarrModules // 2=>array('file'=>'myboxc.php@mymodule','note'=>'') //); + // Cronjobs $this->cronjobs = array(); // List of cron jobs entries to add // Example: $this->cronjobs=array(0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'/dir/class/file.class.php', 'objectname'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'test'=>true), // 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24, 'test'=>true) // ); + // Permissions $this->rights = array(); // Permission array used by this module - $r=0; - // Add here list of permission defined by an id, a label, a boolean and two constant strings. - // Example: - // $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) - // $this->rights[$r][1] = 'Permision label'; // Permission label - // $this->rights[$r][3] = 1; // Permission by default for new user (0/1) - // $this->rights[$r][4] = 'level1'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) - // $this->rights[$r][5] = 'level2'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) - // $r++; + $r=0; + $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) + $this->rights[$r][1] = 'Read objects of My Module'; // Permission label + $this->rights[$r][3] = 1; // Permission by default for new user (0/1) + $this->rights[$r][4] = 'read'; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2) + $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2) + + $r++; + $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) + $this->rights[$r][1] = 'Create/Update objects of My Module'; // Permission label + $this->rights[$r][3] = 1; // Permission by default for new user (0/1) + $this->rights[$r][4] = 'create'; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2) + $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2) + + $r++; + $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) + $this->rights[$r][1] = 'Delete objects of My Module'; // Permission label + $this->rights[$r][3] = 1; // Permission by default for new user (0/1) + $this->rights[$r][4] = 'delete'; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2) + $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2) + // Main menu entries $this->menu = array(); // List of menus to add diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index 1d22c464212..56e0ea1d3ed 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -96,18 +96,18 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e if (empty($reshook)) { - if ($cancel) + if ($cancel) { if ($action != 'addlink') { $urltogo=$backtopage?$backtopage:dol_buildpath('/mymodule/list.php',1); header("Location: ".$urltogo); exit; - } + } if ($id > 0 || ! empty($ref)) $ret = $object->fetch($id,$ref); $action=''; } - + // Action to add record if ($action == 'add' && ! empty($user->rights->mymodule->create)) { @@ -268,19 +268,19 @@ if ($action == 'create') if (($id || $ref) && $action == 'edit') { print load_fiche_titre($langs->trans("MyModule")); - + print ''; print ''; print ''; print ''; - + dol_fiche_head(); print '
'; @@ -197,19 +222,34 @@ if ($resql) print ''; print ''; print ''; - print ''; - print '  '; - print ''; + print ''; + $searchpicto=$form->showFilterButtons(); + print $searchpicto; print '
'; @@ -236,6 +276,8 @@ if ($resql) print ''.(isset($objp->unitprice) ? price($objp->unitprice) : '').'
'."\n"; // print ''; // LIST_OF_TD_LABEL_FIELDS_EDIT print '
'.$langs->trans("Label").'
'; - + dol_fiche_end(); print '
'; @@ -299,14 +299,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $head = mymodule_prepare_head($object); dol_fiche_head($head, 'order', $langs->trans("CustomerOrder"), -1, 'order'); - + $formconfirm = ''; - + // Confirmation to delete if ($action == 'delete') { $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteOrder'), $langs->trans('ConfirmDeleteOrder'), 'confirm_delete', '', 0, 1); } - + // Confirmation of action xxxx if ($action == 'xxx') { @@ -317,28 +317,28 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), // array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1))); - }*/ + }*/ $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220); } - + if (! $formconfirm) { $parameters = array('lineid' => $lineid); $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if (empty($reshook)) $formconfirm.=$hookmanager->resPrint; elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint; } - + // Print form confirm print $formconfirm; - - - + + + // Object card // ------------------------------------------------------------ - + $linkback = '' . $langs->trans("BackToList") . ''; - - + + $morehtmlref='
'; /* // Ref bis @@ -382,11 +382,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } */ $morehtmlref.='
'; - - + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); - - + + print '
'; print '
'; print '
'; @@ -396,7 +396,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Other attributes - $cols = 2; include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; print '
'; @@ -405,16 +404,16 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '
'; print '
'; print ''; - - + + print '
'; print '
'; print '
'; print '
'; - + print '

'; - + dol_fiche_end(); @@ -424,14 +423,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $parameters=array(); $reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - + if (empty($reshook)) { if ($user->rights->mymodule->write) { print ''."\n"; } - + if ($user->rights->mymodule->delete) { print ''."\n"; @@ -440,12 +439,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '
'."\n"; } - + // Select mail models is same action as presend if (GETPOST('modelselected')) { $action = 'presend'; } - + if ($action != 'presend') { print '
'; @@ -458,23 +457,23 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $genallowed = $user->rights->mymodule->creer; $delallowed = $user->rights->mymodule->supprimer; print $formfile->showdocuments('mymodule', $comref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang); - - + + // Show links to link elements $linktoelem = $form->showLinkToObjectBlock($object, null, array('order')); $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); - - + + print '
'; - + // List of actions on element include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; $formactions = new FormActions($db); $somethingshown = $formactions->showactions($object, 'order', $socid); - + print '
'; } - + /* * Action presend diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index b1768785f4c..2d8525dfffa 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -35,7 +35,7 @@ //if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); //if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session) -// Change this following line to use the correct relative path (../, ../../, etc) +// Change this following lines to use the correct relative path (../, ../../, etc) $res=0; if (! $res && file_exists("../main.inc.php")) $res=@include '../main.inc.php'; // to work if your module directory is into dolibarr root htdocs directory if (! $res && file_exists("../../main.inc.php")) $res=@include '../../main.inc.php'; // to work if your module directory is into a subdir of root htdocs directory @@ -49,8 +49,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; dol_include_once('/mymodule/class/myobject.class.php'); // Load traductions files requiredby by page -$langs->load("mymodule"); -$langs->load("other"); +$langs->loadLangs(array("mymodule","other")); $action=GETPOST('action','alpha'); $massaction=GETPOST('massaction','alpha'); @@ -89,14 +88,14 @@ if ($user->societe_id > 0) } // Initialize technical object to manage context to save list fields -$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'mymodulelist'; +$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'myobjectlist'; // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array -$hookmanager->initHooks(array('mymodulelist')); +$hookmanager->initHooks(array('myobjectlist')); $extrafields = new ExtraFields($db); // fetch optionals attributes and labels -$extralabels = $extrafields->fetch_name_optionals_label('mymodule'); +$extralabels = $extrafields->fetch_name_optionals_label('myobject'); $search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_'); // List of fields to search into when doing a "search in all" @@ -227,7 +226,7 @@ foreach ($search_array_options as $key => $val) $typ=$extrafields->attribute_type[$tmpkey]; $mode=0; if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric - if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit))) + if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit))) { $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); } @@ -244,7 +243,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); $nbtotalofrecords = $db->num_rows($result); -} +} $sql.= $db->plimit($limit+1, $offset); @@ -263,7 +262,7 @@ if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && { $obj = $db->fetch_object($resql); $id = $obj->rowid; - header("Location: ".DOL_URL_ROOT.'/skeleton/card.php?id='.$id); + header("Location: ".DOL_URL_ROOT.'/mymodule/myobject_card.php?id='.$id); exit; } @@ -283,13 +282,13 @@ foreach ($search_array_options as $key => $val) $crit=$val; $tmpkey=preg_replace('/search_options_/','',$key); if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); -} +} $arrayofmassactions = array( 'presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge"), ); -if ($user->rights->mymodule->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); +if ($user->rights->mymodule->delete) $arrayofmassactions['delete']=$langs->trans("Delete"); if ($massaction == 'presend') $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); @@ -330,38 +329,11 @@ if (! empty($moreforfilter)) $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1); print '
'; print ''."\n"; -// Fields title -print ''; -// LIST_OF_TD_TITLE_FIELDS -//if (! empty($arrayfields['t.field1']['checked'])) print_liste_field_titre($arrayfields['t.field1']['label'],$_SERVER['PHP_SELF'],'t.field1','',$param,'',$sortfield,$sortorder); -//if (! empty($arrayfields['t.field2']['checked'])) print_liste_field_titre($arrayfields['t.field2']['label'],$_SERVER['PHP_SELF'],'t.field2','',$param,'',$sortfield,$sortorder); -// Extra fields -if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) -{ - foreach($extrafields->attribute_label as $key => $val) - { - if (! empty($arrayfields["ef.".$key]['checked'])) - { - $align=$extrafields->getAlignFlag($key); - $sortonfield = "ef.".$key; - if (! empty($extrafields->attribute_computed[$key])) $sortonfield=''; - print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); - } - } -} -// Hook fields -$parameters=array('arrayfields'=>$arrayfields); -$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook -print $hookmanager->resPrint; -if (! empty($arrayfields['t.datec']['checked'])) print_liste_field_titre($arrayfields['t.datec']['label'],$_SERVER["PHP_SELF"],"t.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); -if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre($arrayfields['t.tms']['label'],$_SERVER["PHP_SELF"],"t.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); -//if (! empty($arrayfields['t.status']['checked'])) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"t.status","",$param,'align="center"',$sortfield,$sortorder); -print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); -print ''."\n"; // Fields title search print ''; @@ -371,22 +343,22 @@ print ''; // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { - foreach($extrafields->attribute_label as $key => $val) + foreach($extrafields->attribute_label as $key => $val) { if (! empty($arrayfields["ef.".$key]['checked'])) { $align=$extrafields->getAlignFlag($key); $typeofextrafield=$extrafields->attribute_type[$key]; print ''; } } @@ -408,19 +380,48 @@ if (! empty($arrayfields['t.tms']['checked'])) print ''; } /*if (! empty($arrayfields['u.statut']['checked'])) -{ - // Status - print ''; -}*/ + { + // Status + print ''; + }*/ // Action column print ''; print ''."\n"; - + +// Fields title +print ''; +// LIST_OF_TD_TITLE_FIELDS +//if (! empty($arrayfields['t.field1']['checked'])) print_liste_field_titre($arrayfields['t.field1']['label'],$_SERVER['PHP_SELF'],'t.field1','',$param,'',$sortfield,$sortorder); +//if (! empty($arrayfields['t.field2']['checked'])) print_liste_field_titre($arrayfields['t.field2']['label'],$_SERVER['PHP_SELF'],'t.field2','',$param,'',$sortfield,$sortorder); +// Extra fields +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) +{ + foreach($extrafields->attribute_label as $key => $val) + { + if (! empty($arrayfields["ef.".$key]['checked'])) + { + $align=$extrafields->getAlignFlag($key); + $sortonfield = "ef.".$key; + if (! empty($extrafields->attribute_computed[$key])) $sortonfield=''; + print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); + } + } +} +// Hook fields +$parameters=array('arrayfields'=>$arrayfields); +$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; +if (! empty($arrayfields['t.datec']['checked'])) print_liste_field_titre($arrayfields['t.datec']['label'],$_SERVER["PHP_SELF"],"t.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); +if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre($arrayfields['t.tms']['label'],$_SERVER["PHP_SELF"],"t.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); +//if (! empty($arrayfields['t.status']['checked'])) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"t.status","",$param,'align="center"',$sortfield,$sortorder); +print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); +print ''."\n"; + // Detect if we need a fetch on each output line $needToFetchEachLine=0; @@ -441,12 +442,12 @@ while ($i < min($num, $limit)) print ''; // LIST_OF_TD_FIELDS_LIST /* - if (! empty($arrayfields['t.field1']['checked'])) + if (! empty($arrayfields['t.field1']['checked'])) { print ''; if (! $i) $totalarray['nbfield']++; } - if (! empty($arrayfields['t.field2']['checked'])) + if (! empty($arrayfields['t.field2']['checked'])) { print ''; if (! $i) $totalarray['nbfield']++; @@ -454,9 +455,9 @@ while ($i < min($num, $limit)) // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { - foreach($extrafields->attribute_label as $key => $val) + foreach($extrafields->attribute_label as $key => $val) { - if (! empty($arrayfields["ef.".$key]['checked'])) + if (! empty($arrayfields["ef.".$key]['checked'])) { print 'getAlignFlag($key); diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 5c6690b44f2..02ad2f5172c 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -145,9 +145,9 @@ if (empty($reshook)) $upload_dir = $conf->produit->dir_output; $permissioncreate = $user->rights->produit->creer; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; - + include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; - + // Barcode type if ($action == 'setfk_barcode_type' && $createbarcode) { @@ -203,7 +203,7 @@ if (empty($reshook)) $action = "create"; $error++; } - + if (! $error) { $units = GETPOST('units', 'int'); @@ -630,7 +630,7 @@ if (empty($reshook)) $tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx)); $tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx)); - + // On reevalue prix selon taux tva car taux tva transaction peut etre different // de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur). if ($tmpvat != $tmpprodvat) { @@ -640,7 +640,7 @@ if (empty($reshook)) $pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU'); } } - + if (GETPOST('propalid') > 0) { // Define cost price for margin calculation $buyprice=0; @@ -653,7 +653,7 @@ if (empty($reshook)) { $buyprice = $result; } - + $result = $propal->addline( $desc, $pu_ht, @@ -696,7 +696,7 @@ if (empty($reshook)) { $buyprice = $result; } - + $result = $commande->addline( $desc, $pu_ht, @@ -882,7 +882,7 @@ else dol_fiche_head(''); print '
'; - if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select')) && empty($extrafields->attribute_computed[$key])) - { - $crit=$val; - $tmpkey=preg_replace('/search_options_/','',$key); - $searchclass=''; - if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring'; - if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum'; - print ''; - } + if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select')) && empty($extrafields->attribute_computed[$key])) + { + $crit=$val; + $tmpkey=preg_replace('/search_options_/','',$key); + $searchclass=''; + if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring'; + if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum'; + print ''; + } print ''; - print $form->selectarray('search_statut', array('-1'=>'','0'=>$langs->trans('Disabled'),'1'=>$langs->trans('Enabled')),$search_statut); - print ''; + print $form->selectarray('search_statut', array('-1'=>'','0'=>$langs->trans('Disabled'),'1'=>$langs->trans('Enabled')),$search_statut); + print ''; -$searchpicto=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); +$searchpicto=$form->showFilterButtons(); print $searchpicto; print '
'.$obj->field1.''.$obj->field2.'
'; - + print ''; $tmpcode=''; if (! empty($modCodeProduct->code_auto)) $tmpcode=$modCodeProduct->getNextValue($object,$type); @@ -1045,7 +1045,7 @@ else } // Other attributes - $parameters=array('colspan' => 3); + $parameters=array('cols' => 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)) { @@ -1056,14 +1056,14 @@ else //if (! empty($conf->global->MAIN_DISABLE_NOTES_TAB)) available in create mode //{ print '"; //} - + if($conf->categorie->enabled) { // Categories print ''; } - else // For external software + else // For external software { // Accountancy_code_sell print ''; @@ -1364,7 +1364,7 @@ else } // Other attributes - $parameters=array('colspan' => ' colspan="2"'); + $parameters=array('colspan' => ' colspan="3"', 'cols'=>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)) { @@ -1372,7 +1372,7 @@ else } // Tags-Categories - if ($conf->categorie->enabled) + if ($conf->categorie->enabled) { print '"; } - + print '
'.$langs->trans("NoteNotVisibleOnBill").''; - + // We use dolibarr_details as type of DolEditor here, because we must not accept images as description is included into PDF and not accepted by TCPDF. $doleditor = new DolEditor('note_private', GETPOST('note_private'), '', 140, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_8, '90%'); $doleditor->Create(); - + print "
'.$langs->trans("Categories").''; @@ -1123,7 +1123,7 @@ else print $formaccounting->select_account(GETPOST('accountancy_code_buy'), 'accountancy_code_buy', 1, null, 1, 1, ''); print '
'.$langs->trans("ProductAccountancySellCode").'
'.$langs->trans("Categories").''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, '', 'parent', 64, 0, 1); @@ -1389,13 +1389,13 @@ else if (! empty($conf->global->MAIN_DISABLE_NOTES_TAB)) { print '
'.$langs->trans("NoteNotVisibleOnBill").''; - + $doleditor = new DolEditor('note_private', $object->note_private, '', 140, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_4, '90%'); $doleditor->Create(); - + print "
'; print '
'; @@ -1416,7 +1416,7 @@ else print $formaccounting->select_account($object->accountancy_code_buy, 'accountancy_code_buy', 1, '', 1, 1); print ''; } - else // For external software + else // For external software { // Accountancy_code_sell print ''.$langs->trans("ProductAccountancySellCode").''; @@ -1449,21 +1449,21 @@ else $head=product_prepare_head($object); $titre=$langs->trans("CardProduct".$object->type); $picto=($object->type== Product::TYPE_SERVICE?'service':'product'); - + dol_fiche_head($head, 'card', $titre, -1, $picto); $linkback = ''.$langs->trans("BackToList").''; $object->next_prev_filter=" fk_product_type = ".$object->type; dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref'); - - + + print '
'; print '
'; - + print '
'; print ''; - + // Type if (! empty($conf->produit->enabled) && ! empty($conf->service->enabled)) { @@ -1577,7 +1577,7 @@ else } print ''; */ - + // Batch number management (to batch) if (! empty($conf->productbatch->enabled)) { print '
'.$langs->trans("ManageLotSerial").''; @@ -1616,10 +1616,10 @@ else print '
'; print '
'; print '
'; - + print '
'; print ''; - + // Nature if($object->type!= Product::TYPE_SERVICE) { @@ -1727,11 +1727,7 @@ else // Other attributes $parameters=array('colspan' => ' colspan="'.(2+(($showphoto||$showbarcode)?1:0)).'"'); - $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)) - { - print $object->showOptionals($extrafields); - } + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; // Categories if($conf->categorie->enabled) { @@ -1747,13 +1743,13 @@ else print ''."\n"; print ' '."\n"; } - + print "
'.$langs->trans("NotePrivate").''.(dol_textishtml($object->note_private)?$object->note_private:dol_nl2br($object->note_private,1,true)).'
\n"; print '
'; - + print '
'; print '
'; - + dol_fiche_end(); } @@ -1814,16 +1810,16 @@ if (($action == 'clone' && (empty($conf->use_javascript_ajax) || ! empty($conf-> if ($action != 'create' && $action != 'edit') { print "\n".'
'."\n"; - + $parameters=array(); $reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if (empty($reshook)) { - if (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->creer ) || + if (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->creer ) || ($object->type == Product::TYPE_SERVICE && $user->rights->service->creer)) { if (! isset($object->no_button_edit) || $object->no_button_edit <> 1) print ''; - + if (! isset($object->no_button_copy) || $object->no_button_copy <> 1) { if (! empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile)) @@ -1837,7 +1833,7 @@ if ($action != 'create' && $action != 'edit') } } $object_is_used = $object->isObjectUsed($object->id); - + if (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->supprimer) || ($object->type == Product::TYPE_SERVICE && $user->rights->service->supprimer)) { @@ -1862,7 +1858,7 @@ if ($action != 'create' && $action != 'edit') print ''; } } - + print "\n
\n"; } @@ -1957,7 +1953,7 @@ if (! empty($conf->global->PRODUCT_ADD_FORM_ADD_TO) && $object->id && ($action = print ''; print load_fiche_titre($langs->trans("AddToDraft"),'',''); - + dol_fiche_head(''); $html .= ''.$langs->trans("Quantity").' '; @@ -1969,7 +1965,7 @@ if (! empty($conf->global->PRODUCT_ADD_FORM_ADD_TO) && $object->id && ($action = print ''; print $html; print '
'; - + print '
'; print ''; print '
'; @@ -2000,7 +1996,7 @@ if ($action != 'create' && $action != 'edit' && $action != 'delete') print $formfile->showdocuments($modulepart,$object->ref,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$object->default_lang, '', $object); $somethingshown=$formfile->numoffiles; - + print '
'; print '
'; diff --git a/htdocs/product/document.php b/htdocs/product/document.php index d0b58c9909c..2cf2f36b419 100644 --- a/htdocs/product/document.php +++ b/htdocs/product/document.php @@ -72,7 +72,7 @@ if ($id > 0 || ! empty($ref)) if (! empty($conf->product->enabled)) $upload_dir = $conf->product->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 0, $object, 'product').dol_sanitizeFileName($object->ref); elseif (! empty($conf->service->enabled)) $upload_dir = $conf->service->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 0, $object, 'product').dol_sanitizeFileName($object->ref); - + if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) // For backward compatiblity, we scan also old dirs { if (! empty($conf->product->enabled)) $upload_dirold = $conf->product->multidir_output[$object->entity].'/'.substr(substr("000".$object->id, -2),1,1).'/'.substr(substr("000".$object->id, -2),0,1).'/'.$object->id."/photos"; @@ -188,12 +188,13 @@ if ($object->id) $head=product_prepare_head($object); $titre=$langs->trans("CardProduct".$object->type); $picto=($object->type== Product::TYPE_SERVICE?'service':'product'); - + dol_fiche_head($head, 'documents', $titre, -1, $picto); + $parameters=array(); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - + // Construit liste des fichiers $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview.*\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); @@ -213,9 +214,9 @@ if ($object->id) $linkback = ''.$langs->trans("BackToList").''; $object->next_prev_filter=" fk_product_type = ".$object->type; dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref'); - + print '
'; - + print '
'; print ''; @@ -225,14 +226,14 @@ if ($object->id) print ''; print '
'; - + dol_fiche_end(); $permission = (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->creer) || ($object->type == Product::TYPE_SERVICE && $user->rights->service->creer)); $param = '&id=' . $object->id; include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php'; - + // Merge propal PDF document PDF files if (!empty($conf->global->PRODUIT_PDF_MERGE_PROPAL)) { @@ -308,17 +309,17 @@ if ($object->id) $checked = ''; $filename = $filetoadd['name']; - if ($conf->global->MAIN_MULTILANGS) + if ($conf->global->MAIN_MULTILANGS) { - if (array_key_exists($filetoadd['name'] . '_' . $delauft_lang, $filetomerge->lines)) + if (array_key_exists($filetoadd['name'] . '_' . $delauft_lang, $filetomerge->lines)) { $filename = $filetoadd['name'] . ' - ' . $langs->trans('Language_' . $delauft_lang); $checked = ' checked '; } } - else + else { - if (array_key_exists($filetoadd['name'], $filetomerge->lines)) + if (array_key_exists($filetoadd['name'], $filetomerge->lines)) { $checked = ' checked '; } diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index e894368beaf..4911026be47 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -111,10 +111,10 @@ $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($action == 'addlimitstockwarehouse') { - + $seuil_stock_alerte = GETPOST('seuil_stock_alerte'); $desiredstock = GETPOST('desiredstock'); - + $maj_ok = true; if($seuil_stock_alerte == '') { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("StockLimit")), null, 'errors'); @@ -124,44 +124,44 @@ if ($action == 'addlimitstockwarehouse') { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DesiredStock")), null, 'errors'); $maj_ok = false; } - + if($maj_ok) { - + $pse = new ProductStockEntrepot($db); if($pse->fetch('', GETPOST('id'), GETPOST('fk_entrepot')) > 0) { - + // Update $pse->seuil_stock_alerte = $seuil_stock_alerte; $pse->desiredstock = $desiredstock; if($pse->update($user) > 0) setEventMessage($langs->trans('ProductStockWarehouseUpdated')); - + } else { - + // Create $pse->fk_entrepot = GETPOST('fk_entrepot'); $pse->fk_product = GETPOST('id'); $pse->seuil_stock_alerte = GETPOST('seuil_stock_alerte'); $pse->desiredstock = GETPOST('desiredstock'); if($pse->create($user) > 0) setEventMessage($langs->trans('ProductStockWarehouseCreated')); - + } - + } header("Location: ".$_SERVER["PHP_SELF"]."?id=".GETPOST('id')); exit; - + } if($action == 'delete_productstockwarehouse') { - + $pse = new ProductStockEntrepot($db); $pse->fetch(GETPOST('fk_productstockwarehouse')); if($pse->delete($user) > 0) setEventMessage($langs->trans('ProductStockWarehouseDeleted')); - + $action = ''; - + } // Set stock limit @@ -233,7 +233,7 @@ if ($action == "correct_stock" && ! $cancel) $origin_element = 'project'; $origin_id = GETPOST('projectid', 'int'); } - + if (empty($object)) { $object = new Product($db); $result=$object->fetch($id); @@ -317,7 +317,7 @@ if ($action == "transfert_stock" && ! $cancel) { $object = new Product($db); $result=$object->fetch($id); - + if ($object->hasbatch() && ! $batchnumber) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("batch_number")), null, 'errors'); @@ -325,7 +325,7 @@ if ($action == "transfert_stock" && ! $cancel) $action='transfert'; } } - + if (! $error) { if ($id) @@ -341,7 +341,7 @@ if ($action == "transfert_stock" && ! $cancel) $pricesrc=0; if (isset($object->pmp)) $pricesrc=$object->pmp; $pricedest=$pricesrc; - + if ($object->hasbatch()) { $pdluo = new Productbatch($db); @@ -514,7 +514,7 @@ if ($id > 0 || $ref) { $object = new Product($db); $result = $object->fetch($id,$ref); - + $object->load_stock(); $title = $langs->trans('ProductServiceCard'); @@ -538,21 +538,21 @@ if ($id > 0 || $ref) $head=product_prepare_head($object); $titre=$langs->trans("CardProduct".$object->type); $picto=($object->type==Product::TYPE_SERVICE?'service':'product'); - + dol_fiche_head($head, 'stock', $titre, -1, $picto); dol_htmloutput_events(); $linkback = ''.$langs->trans("BackToList").''; - + dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref'); - + print '
'; - + print '
'; print '
'; - - if ($conf->productbatch->enabled) + + if ($conf->productbatch->enabled) { print ''; - + // Hook formObject - $parameters=array('colspan' => 3); + $parameters=array('cols'=>2); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook - + // Desired stock print ''; $stocktheo = price2num($object->stock_theorique, 'MS'); - + $found=0; $helpondiff=''.$langs->trans("StockDiffPhysicTeoric").':
'; // Number of customer orders running @@ -655,7 +655,7 @@ if ($id > 0 || $ref) if ($result < 0) dol_print_error($db,$object->error); $helpondiff.=' ('.$langs->trans("ProductQtyInDraft").': '.$object->stats_commande['qty'].')'; } - + // Number of product from customer order already sent (partial shipping) if (! empty($conf->expedition->enabled)) { @@ -663,7 +663,7 @@ if ($id > 0 || $ref) $result=$object->load_stats_sending(0,'2'); $helpondiff.=$langs->trans("ProductQtyInShipmentAlreadySent").': '.$object->stats_expedition['qty']; } - + // Number of supplier order running if (! empty($conf->fournisseur->enabled)) { @@ -674,14 +674,14 @@ if ($id > 0 || $ref) if ($result < 0) dol_print_error($db,$object->error); $helpondiff.=' ('.$langs->trans("ProductQtyInDraftOrWaitingApproved").': '.$object->stats_commande_fournisseur['qty'].')'; } - + // Number of product from supplier order already received (partial receipt) if (! empty($conf->fournisseur->enabled)) { if ($found) $helpondiff.='
'; else $found=1; $helpondiff.=$langs->trans("ProductQtyInSuppliersShipmentAlreadyRecevied").': '.$object->stats_reception['qty']; } - + // Calculating a theorical value print ''; - // Other options - $parameters=array(); - $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)) - { - print $object->showOptionals($extrafields); - } + // Other attributes + $cols = 3; + $parameyers=array('socid'=>$socid); + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; print '
'.$langs->trans("ManageLotSerial").''; print $object->getLibStatut(0,2); @@ -614,11 +614,11 @@ if ($id > 0 || $ref) print '
'.$form->editfieldkey("StockLimit",'seuil_stock_alerte',$object->seuil_stock_alerte,$object,$user->rights->produit->creer).''; print $form->editfieldval("StockLimit",'seuil_stock_alerte',$object->seuil_stock_alerte,$object,$user->rights->produit->creer,'string'); print '
'.$form->editfieldkey($form->textwithpicto($langs->trans("DesiredStock"), $langs->trans("DesiredStockDesc"), 1),'desiredstock',$object->desiredstock,$object,$user->rights->produit->creer); print ''; @@ -643,7 +643,7 @@ if ($id > 0 || $ref) print '
'; print $form->textwithpicto($langs->trans("VirtualStock"), $langs->trans("VirtualStockDesc")); @@ -723,7 +723,7 @@ if ($id > 0 || $ref) print ''; print '
'; - + dol_fiche_end(); } @@ -762,18 +762,18 @@ if (empty($reshook)) if (empty($action) && $object->id) { print "
\n"; - + if ($user->rights->stock->mouvement->creer) { print ''.$langs->trans("StockCorrection").''; } - + //if (($user->rights->stock->mouvement->creer) && ! $object->hasbatch()) if ($user->rights->stock->mouvement->creer) { print ''.$langs->trans("StockTransfer").''; } - + print '
'; } @@ -897,7 +897,7 @@ if ($resql) } } $i++; - + } } else dol_print_error($db); @@ -929,25 +929,25 @@ if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE)) print '

'; print_titre($langs->trans('AddNewProductStockWarehouse')); //print '
'; - + print ''; print ''; print ''; print ''; - + print ''; print ''; print ''; print ''; print ''; - + $pse = new ProductStockEntrepot($db); $lines = $pse->fetchAll(GETPOST('id')); - - if (!empty($lines)) + + if (!empty($lines)) { $var=false; - foreach($lines as $line) + foreach($lines as $line) { $ent = new Entrepot($db); $ent->fetch($line['fk_entrepot']); @@ -956,12 +956,12 @@ if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE)) print ''; print ''; print ''; - + } } - + print "
'.$formproduct->selectWarehouses('', 'fk_entrepot').'
'.$line['desiredstock'].''.img_delete().'
"; - + print ''; } diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index c434fa65381..ae5e5dbaa68 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -39,7 +39,7 @@ class Project extends CommonObject public $fk_element = 'fk_projet'; protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe public $picto = 'projectpub'; - + /** * {@inheritdoc} */ @@ -102,7 +102,7 @@ class Project extends CommonObject * @var Task[] */ public $lines; - + /** * Constructor @@ -146,7 +146,7 @@ class Project extends CommonObject dol_syslog(get_class($this)."::create error -1 ref null", LOG_ERR); return -1; } - + $this->db->begin(); $sql = "INSERT INTO " . MAIN_DB_PREFIX . "projet ("; @@ -261,7 +261,7 @@ class Project extends CommonObject dol_syslog(get_class($this)."::update error -3 " . $this->error, LOG_ERR); return -3; } - + if (dol_strlen(trim($this->ref)) > 0) { $this->db->begin(); @@ -392,7 +392,9 @@ class Project extends CommonObject $resql = $this->db->query($sql); if ($resql) { - if ($this->db->num_rows($resql)) + $num_rows = $this->db->num_rows($resql); + + if ($num_rows) { $obj = $this->db->fetch_object($resql); @@ -423,12 +425,16 @@ class Project extends CommonObject $this->db->free($resql); + // Retreive all extrafield for thirdparty + $this->fetch_optionals(); + return 1; } - else - { - return 0; - } + + $this->db->free($resql); + + if ($num_rows) return 1; + else return 0; } else { @@ -745,7 +751,7 @@ class Project extends CommonObject $this->error=$langs->trans("ErrorFieldFormat",$langs->transnoentities("Label")).'. '.$langs->trans('RemoveString',$langs->transnoentitiesnoconv("CopyOf")); return -1; } - + $this->db->begin(); $sql = "UPDATE " . MAIN_DB_PREFIX . "projet"; @@ -764,7 +770,7 @@ class Project extends CommonObject if ($result < 0) { $error++; } // End call triggers } - + if (!$error) { $this->statut=1; @@ -847,7 +853,7 @@ class Project extends CommonObject return -1; } } - + return 0; } @@ -936,9 +942,9 @@ class Project extends CommonObject global $conf, $langs, $user; if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips - + $result = ''; - + $label=''; if ($option != 'nolink') $label = '' . $langs->trans("ShowProject") . ''; $label .= ($label?'
':'').'' . $langs->trans('Ref') . ': ' . $this->ref; // The space must be after the : to not being explode when showing the title in img_picto @@ -965,11 +971,11 @@ class Project extends CommonObject $url = DOL_URL_ROOT . '/projet/card.php?id=' . $this->id; } // Add param to save lastsearch_values or not - $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0); + $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0); if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1; if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1'; } - + $linkclose=''; if (empty($notooltip) && $user->rights->propal->lire) { @@ -988,7 +994,7 @@ class Project extends CommonObject $linkstart = ''; $linkend=''; - + if ($withpicto) $result.=($linkstart . img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1) . $linkend); if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto != 2) $result.=$linkstart . $this->ref . $linkend . (($addlabel && $this->title) ? $sep . dol_trunc($this->title, ($addlabel > 1 ? $addlabel : 0)) : ''); @@ -1150,7 +1156,7 @@ class Project extends CommonObject { // No filter. Use this if user has permission to see all project } - + $sql.= $filter; //print $sql; @@ -1760,7 +1766,7 @@ class Project extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql.= " WHERE"; $sql.= " p.entity IN (".getEntity('projet', 1).")"; - if (! $user->rights->projet->all->lire) + if (! $user->rights->projet->all->lire) { $projectsListId = $this->getProjectsAuthorizedForUser($user,0,1); $sql .= "AND p.rowid IN (".$projectsListId.")"; @@ -1800,7 +1806,7 @@ class Project extends CommonObject $now = dol_now(); return ($this->datee ? $this->datee : $this->date_end) < ($now - $conf->projet->warning_delay); - } + } /** @@ -1911,10 +1917,10 @@ class Project extends CommonObject return 1; } - + /** * Create an array of tasks of current project - * + * * @param User $user Object user we want project allowed to * @return int >0 if OK, <0 if KO */ @@ -1925,6 +1931,6 @@ class Project extends CommonObject $this->lines = $taskstatic->getTasksArray(0, $user, $this->id, 0, 0); } - + } diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 8124f500bd6..84c0ec30471 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -250,6 +250,9 @@ class Task extends CommonObject $this->note_private = $obj->note_private; $this->note_public = $obj->note_public; $this->rang = $obj->rang; + + // Retreive all extrafield for thirdparty + $this->fetch_optionals(); } $this->db->free($resql); diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 9211d75f499..6018b8bef69 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -511,13 +511,10 @@ if ($id > 0 || ! empty($ref)) print nl2br($object->description); print '
'; diff --git a/htdocs/resource/add.php b/htdocs/resource/add.php index c8b4d124fed..2e988d16025 100644 --- a/htdocs/resource/add.php +++ b/htdocs/resource/add.php @@ -175,7 +175,7 @@ if (! $action) print ''; // Other attributes - $parameters=array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"'); + $parameters=array('objectsrc' => $objectsrc); $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)) { diff --git a/htdocs/resource/card.php b/htdocs/resource/card.php index 7f0a96a7ab4..a286eb60097 100644 --- a/htdocs/resource/card.php +++ b/htdocs/resource/card.php @@ -201,7 +201,7 @@ if ( $object->fetch($id) > 0 ) print ''; // Other attributes - $parameters=array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"'); + $parameters=array('objectsrc' => $objectsrc); $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)) { @@ -224,7 +224,7 @@ if ( $object->fetch($id) > 0 ) dol_fiche_head($head, 'resource', $langs->trans("ResourceSingular"), -1, 'resource'); $formconfirm = ''; - + // Confirm deleting resource line if ($action == 'delete') { @@ -233,21 +233,21 @@ if ( $object->fetch($id) > 0 ) // Print form confirm print $formconfirm; - - + + $linkback = '' . $langs->trans("BackToList") . ''; - - + + $morehtmlref='
'; $morehtmlref.='
'; - - + + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref); - - + + print '
'; print '
'; - + /*--------------------------------------- * View object */ @@ -269,21 +269,16 @@ if ( $object->fetch($id) > 0 ) print ''; // Other attributes - $parameters=array(); - $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)) - { - print $object->showOptionals($extrafields); - } + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; print ''; print ''; - + print '
'; - + print '

'; - + dol_fiche_end(); } diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index ba4383e6f8e..cb99949407b 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -140,7 +140,7 @@ if (empty($reshook)) if (!$errors) { // TODO Move the merge function into class of object. - + $db->begin(); // Recopy some data @@ -157,16 +157,16 @@ if (empty($reshook)) { if (empty($object->$property)) $object->$property = $soc_origin->$property; } - + // Concat some data $listofproperties=array( - 'note_public', 'note_private' + 'note_public', 'note_private' ); foreach ($listofproperties as $property) { $object->$property = dol_concatdesc($object->$property, $soc_origin->$property); } - + // Merge extrafields foreach ($soc_origin->array_options as $key => $val) { @@ -175,8 +175,8 @@ if (empty($reshook)) // TODO Merge categories $object->update($object->id, $user); - - // Move links + + // Move links $objects = array( 'Adherent' => '/adherents/class/adherent.class.php', 'Societe' => '/societe/class/societe.class.php', @@ -280,6 +280,21 @@ if (empty($reshook)) $res=$object->setValueFrom('localtax2_value', $value, '', null, 'text', '', $user, 'COMPANY_MODIFY'); } + if ($action == 'update_extras') { + $object->fetch($socid); + + // Fill array 'array_options' with data from update form + $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); + $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute')); + if ($ret < 0) $error++; + if (! $error) + { + $result = $object->insertExtraFields(); + if ($result < 0) $error++; + } + if ($error) $action = 'edit_extras'; + } + // Add new or update third party if ((! GETPOST('getcustomercode') && ! GETPOST('getsuppliercode')) && ($action == 'add' || $action == 'update') && $user->rights->societe->creer) @@ -487,7 +502,7 @@ if (empty($reshook)) if (empty($object->fournisseur)) $object->code_fournisseur=''; $result = $object->create($user); - + if ($result >= 0) { if ($object->particulier) @@ -557,7 +572,7 @@ if (empty($reshook)) $object->code_fournisseur = null; $object->code_client = null; } - + $error=$object->error; $errors=$object->errors; } @@ -851,7 +866,7 @@ else $object->particulier = $private; $object->prefix_comm = GETPOST('prefix_comm'); $object->client = GETPOST('client')?GETPOST('client'):$object->client; - + if(empty($duplicate_code_error)) { $object->code_client = GETPOST('code_client', 'alpha'); $object->fournisseur = GETPOST('fournisseur')?GETPOST('fournisseur'):$object->fournisseur; @@ -859,7 +874,7 @@ else else { setEventMessages($langs->trans('NewCustomerSupplierCodeProposed'),'', 'warnings'); } - + $object->code_fournisseur = GETPOST('code_fournisseur', 'alpha'); $object->address = GETPOST('address', 'alpha'); $object->zip = GETPOST('zipcode', 'alpha'); @@ -1135,7 +1150,7 @@ else print ''; print ''.fieldLabel('Web','url').''; print ''; - + // Skype if (! empty($conf->skype->enabled)) { @@ -1215,7 +1230,7 @@ else print ''.$langs->transcountry("LocalTax2IsUsed",$mysoc->country_code).''; print $form->selectyesno('localtax2assuj_value',(isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2)?$conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2:0),1); print ''; - + } elseif($mysoc->localtax1_assuj=="1") { @@ -1229,7 +1244,7 @@ else print $form->selectyesno('localtax2assuj_value',(isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2)?$conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2:0),1); print ''; } - + // Type - Size print ''.fieldLabel('ThirdPartyType','typent_id').''."\n"; $sortparam=(empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label. @@ -1544,7 +1559,7 @@ else dol_fiche_head($head, 'card', $langs->trans("ThirdParty"), 0, 'company'); - print '
'; + print '
'; print ''; // Ref/ID @@ -1750,7 +1765,7 @@ else $formcompany->select_localtax(1,$object->localtax1_value, "lt1"); print ''; } - + print ''; - + } elseif($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj!="1") { @@ -1773,7 +1788,7 @@ else print ''; } print ''; - + } elseif($mysoc->localtax2_assuj=="1" && $mysoc->localtax1_assuj!="1") { @@ -1787,7 +1802,7 @@ else } print ''; } - + // VAT Code print ''; print '
'.fieldLabel($langs->transcountry("LocalTax2IsUsed",$mysoc->country_code),'localtax2assuj_value').''; print $form->selectyesno('localtax2assuj_value',$object->localtax2_assuj,1); if (! isOnlyOneLocalTax(2)) @@ -1760,7 +1775,7 @@ else print ''; } print '
'.fieldLabel('VATIntra','intra_vat').''; @@ -1935,7 +1950,7 @@ else print '
'; print '
'; - + dol_fiche_end(); print '
'; @@ -1952,7 +1967,7 @@ else /* * View */ - + if (!empty($object->id)) $res=$object->fetch_optionals($object->id,$extralabels); //if ($res < 0) { dol_print_error($db); exit; } @@ -2091,7 +2106,7 @@ else print ''.$langs->transcountry("LocalTax2IsUsed",$mysoc->country_code).''; print yn($object->localtax2_assuj); print ''; - + if($object->localtax1_assuj=="1" && (! isOnlyOneLocalTax(1))) { print '
'; @@ -2145,7 +2160,7 @@ else print ''.$object->localtax1_value.''; } print '
'; - + } } elseif($mysoc->localtax2_assuj=="1" && $mysoc->localtax1_assuj!="1") @@ -2155,7 +2170,7 @@ else print ''; if($object->localtax2_assuj=="1" && (! isOnlyOneLocalTax(2))) { - + print '
'; print ''; print ''; @@ -2168,7 +2183,7 @@ else print ''.$object->localtax2_value.''; } print '
'; - + } } /* @@ -2179,7 +2194,7 @@ else print ''; } */ - + // VAT Code print ''; print ''.$langs->trans('VATIntra').''; @@ -2308,14 +2323,9 @@ else print ''; } - // Other attributes - $parameters=array('socid'=>$socid, 'colspan' => ' colspan="3"', 'colspanvalue' => '3'); - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - if (empty($reshook) && ! empty($extrafields->attribute_label)) - { - print $object->showOptionals($extrafields); - } + // Other attributes + $parameters=array('socid'=>$socid, 'colspan' => ' colspan="3"', 'colspanvalue' => '3'); + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; // Parent company if (empty($conf->global->SOCIETE_DISABLE_PARENTCOMPANY)) @@ -2574,10 +2584,10 @@ else // Subsidiaries list if (empty($conf->global->SOCIETE_DISABLE_SUBSIDIARIES)) - { + { $result=show_subsidiaries($conf,$langs,$db,$object); } - + // Contacts list if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) { diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index ebd06dbd5c4..724c0f66523 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1062,7 +1062,6 @@ class Societe extends CommonObject else if ($idprof6) $sql .= " WHERE s.idprof6 = '".$this->db->escape($idprof6)."' AND s.entity IN (".getEntity($this->element, 1).")"; $resql=$this->db->query($sql); - dol_syslog(get_class($this)."::fetch ".$sql); if ($resql) { $num=$this->db->num_rows($resql); @@ -1196,11 +1195,7 @@ class Societe extends CommonObject $result = 1; // Retreive all extrafield for thirdparty - // fetch optionals attributes and labels - require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); - $extrafields=new ExtraFields($this->db); - $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true); - $this->fetch_optionals($this->id,$extralabels); + $this->fetch_optionals(); } else { @@ -1843,16 +1838,16 @@ class Societe extends CommonObject && ($conf->global->SOCIETE_ADD_REF_IN_LIST == 1 || $conf->global->SOCIETE_ADD_REF_IN_LIST == 2 ) - ) + ) $code = $this->code_client . ' - '; if (($this->fournisseur) && (! empty ( $this->code_fournisseur )) && ($conf->global->SOCIETE_ADD_REF_IN_LIST == 1 || $conf->global->SOCIETE_ADD_REF_IN_LIST == 3 ) - ) + ) $code .= $this->code_fournisseur . ' - '; - + if ($conf->global->SOCIETE_ADD_REF_IN_LIST == 1) $name =$code.' '.$name; else @@ -1870,7 +1865,7 @@ class Societe extends CommonObject $label.= Form::showphoto('societe', $this, 80, 0, 0, 'photowithmargin', 'mini'); $label.= '
'; } - + $label.= '
'; if ($option == 'customer' || $option == 'compta' || $option == 'category' || $option == 'category_supplier') @@ -1903,7 +1898,7 @@ class Societe extends CommonObject $label.= '' . $langs->trans("ShowMargin") . ''; $linkstart = 'id; @@ -3376,7 +3371,7 @@ class Societe extends CommonObject else return array(); } - + /** * Return amount of order not paid and total * @@ -3387,7 +3382,7 @@ class Societe extends CommonObject { $table='commande'; if ($mode == 'supplier') $table = 'commande_fournisseur'; - + $sql = "SELECT rowid, total_ht, total_ttc, fk_statut FROM ".MAIN_DB_PREFIX.$table." as f"; $sql .= " WHERE fk_soc = ". $this->id; @@ -3411,7 +3406,7 @@ class Societe extends CommonObject else return array(); } - + /** * Return amount of bill not paid and total * @@ -3422,7 +3417,7 @@ class Societe extends CommonObject { $table='facture'; if ($mode == 'supplier') $table = 'facture_fourn'; - + /* Accurate value of remain to pay is to sum remaintopay for each invoice $paiement = $invoice->getSommePaiement(); $creditnotes=$invoice->getSumCreditNotesUsed(); @@ -3455,7 +3450,7 @@ class Societe extends CommonObject $tmpobject->id=$obj->rowid; if ($obj->fk_statut != 0 // Not a draft && ! ($obj->fk_statut == 3 && $obj->close_code == 'replaced') // Not a replaced invoice - ) + ) { $outstandingTotal+= $obj->total_ht; $outstandingTotalIncTax+= $obj->total_ttc; @@ -3474,12 +3469,12 @@ class Societe extends CommonObject } return array('opened'=>$outstandingOpened, 'total_ht'=>$outstandingTotal, 'total_ttc'=>$outstandingTotalIncTax); } - else + else { return array(); } } - + /** * Return amount of bill not paid * @@ -3502,7 +3497,7 @@ class Societe extends CommonObject //$sql .= " AND (fk_statut <> 3 OR close_code <> 'abandon')"; // Not abandonned for undefined reason $sql .= " AND fk_statut <> 3"; // Not abandonned $sql .= " AND fk_statut <> 2"; // Not clasified as paid - + dol_syslog("get_OutstandingBill", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) @@ -3522,7 +3517,7 @@ class Societe extends CommonObject else return 0; } - + /** * Return label of status customer is prospect/customer * @@ -3592,9 +3587,9 @@ class Societe extends CommonObject return 0; } } - + $modelpath = "core/modules/societe/doc/"; - + $result=$this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); } @@ -3615,7 +3610,7 @@ class Societe extends CommonObject public function setCategories($categories, $type) { require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; - + // Decode type if ($type == 'customer') { $type_id = Categorie::TYPE_CUSTOMER; diff --git a/htdocs/societe/commerciaux.php b/htdocs/societe/commerciaux.php index 89bb836d119..83bc3d6e99f 100644 --- a/htdocs/societe/commerciaux.php +++ b/htdocs/societe/commerciaux.php @@ -115,9 +115,9 @@ if (! empty($socid)) dol_fiche_head($head, 'salesrepresentative', $langs->trans("ThirdParty"), -1, 'company'); $linkback = ''.$langs->trans("BackToList").''; - + dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); - + print '
'; print '
'; @@ -167,17 +167,14 @@ if (! empty($socid)) $i = 0; $tmpuser = new User($db); - + while ($i < $num) { $obj = $db->fetch_object($resql); $parameters=array('socid'=>$object->id); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$obj,$action); // Note that $action and $object may have been modified by hook - if (empty($reshook)) { - - null; // actions in normal case - } + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); $tmpuser->id = $obj->rowid; $tmpuser->firstname = $obj->firstname; @@ -188,7 +185,7 @@ if (! empty($socid)) $tmpuser->societe_id = $obj->fk_soc; $tmpuser->photo = $obj->photo; print $tmpuser->getNomUrl(-1); - + /*print ''; print img_object($langs->trans("ShowUser"),"user").' '; print dolGetFirstLastname($obj->firstname, $obj->lastname)."\n"; @@ -216,7 +213,7 @@ if (! empty($socid)) print ''; print "
\n"; - + dol_fiche_end(); @@ -263,11 +260,11 @@ if (! empty($socid)) $var=True; $tmpuser=new User($db); - + while ($i < $num) { $obj = $db->fetch_object($resql); - + print ""; $tmpuser->id=$obj->rowid; $tmpuser->firstname=$obj->firstname; diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index 056a67e5587..29bc06ff760 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -359,16 +359,7 @@ if ($sql_select) print_barre_liste($langs->trans('ProductsIntoElements').' '.$typeElementString.' '.$button, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, $totalnboflines, '', 0, '', '', $limit); print ''."\n"; - // Titles with sort buttons - print ''; - print_liste_field_titre($langs->trans('Ref'),$_SERVER['PHP_SELF'],'doc_number','',$param,'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Date'),$_SERVER['PHP_SELF'],'dateprint','',$param,'align="center" width="150"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Status'),$_SERVER['PHP_SELF'],'fk_statut','',$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Product'),$_SERVER['PHP_SELF'],'','',$param,'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Quantity'),$_SERVER['PHP_SELF'],'prod_qty','',$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('TotalHT'),$_SERVER['PHP_SELF'],'total_ht','',$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('UnitPrice'),$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder); - print "\n"; + // Filters print ''; print ''; print ''; + // Titles with sort buttons + print ''; + print_liste_field_titre($langs->trans('Ref'),$_SERVER['PHP_SELF'],'doc_number','',$param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('Date'),$_SERVER['PHP_SELF'],'dateprint','',$param,'align="center" width="150"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('Status'),$_SERVER['PHP_SELF'],'fk_statut','',$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('Product'),$_SERVER['PHP_SELF'],'','',$param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('Quantity'),$_SERVER['PHP_SELF'],'prod_qty','',$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('TotalHT'),$_SERVER['PHP_SELF'],'total_ht','',$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('UnitPrice'),$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder); + print "\n"; + + $i = 0; while (($objp = $db->fetch_object($resql)) && $i < min($num, $limit)) { @@ -407,7 +410,7 @@ if ($sql_select) if (is_object($documentstaticline)) $documentstaticline->statut=$objp->status; - + print ''; print '\n"; - print ''; + print ''; print "
'; @@ -393,6 +384,18 @@ if ($sql_select) print '
'; print $documentstatic->getNomUrl(1); @@ -609,7 +612,7 @@ else if (empty($type_element) || $type_element == -1) print_liste_field_titre($langs->trans('Quantity'),$_SERVER['PHP_SELF'],'prod_qty','',$param,'align="right"',$sortfield,$sortorder); print "
'.$langs->trans("SelectElementAndClickRefresh").'
'.$langs->trans("SelectElementAndClick", $langs->transnoentitiesnoconv("Search")).'
"; } diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 86c350ecc22..020473fee59 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -505,7 +505,7 @@ if (empty($reshook)) } // Add a product line - if ($action == 'addline' && $user->rights->supplier_proposal->creer) + if ($action == 'addline' && $user->rights->supplier_proposal->creer) { $langs->load('errors'); $error = 0; @@ -515,7 +515,7 @@ if (empty($reshook)) $product_desc=(GETPOST('dp_desc')?GETPOST('dp_desc'):''); $date_start=dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), GETPOST('date_start' . $predef . 'sec'), GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year')); $date_end=dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end' . $predef . 'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year')); - + if (GETPOST('prod_entry_mode') == 'free') { $idprod=0; @@ -572,7 +572,7 @@ if (empty($reshook)) if ((GETPOST('prod_entry_mode') != 'free') && empty($error)) // With combolist mode idprodfournprice is > 0 or -1. With autocomplete, idprodfournprice is > 0 or '' { $productsupplier = new ProductFournisseur($db); - + if (empty($conf->global->SUPPLIER_PROPOSAL_WITH_NOPRICEDEFINED)) { $idprod=0; @@ -592,7 +592,7 @@ if (empty($reshook)) $idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice'), -1); // We force qty to -1 to be sure to find if a supplier price exist $res=$productsupplier->fetch($idprod); } - + if ($idprod > 0) { $pu_ht = $productsupplier->fourn_pu; @@ -601,7 +601,7 @@ if (empty($reshook)) $label = $productsupplier->label; $desc = $productsupplier->description; if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc); - + $tva_tx = get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice')); $tva_npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice')); if (empty($tva_tx)) $tva_npr=0; @@ -659,13 +659,13 @@ if (empty($reshook)) $type = GETPOST('type'); $fk_unit= GETPOST('units', 'alpha'); - + $tva_tx = price2num($tva_tx); // When vat is text input field - + // Local Taxes $localtax1_tx= get_localtax($tva_tx, 1, $mysoc, $object->thirdparty); $localtax2_tx= get_localtax($tva_tx, 2, $mysoc, $object->thirdparty); - + if (GETPOST('price_ht')!=='') { $price_base_type = 'HT'; @@ -678,13 +678,13 @@ if (empty($reshook)) $ht = $ttc / (1 + ($tva_tx / 100)); $price_base_type = 'HT'; } - + $result = $object->addline($desc, $ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $ttc, $info_bits, $type, - 1, 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $array_options, $ref_fourn, $fk_unit); //$result = $object->addline($desc, $ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, '', $remise_percent, $price_base_type, $ttc, $type,'','', $date_start, $date_end, $array_options, $fk_unit); } - if (! $error && $result > 0) + if (! $error && $result > 0) { $db->commit(); @@ -701,7 +701,7 @@ if (empty($reshook)) } $model=$object->modelpdf; $ret = $object->fetch($id); // Reload to get new records - + $result=$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result < 0) dol_print_error($db,$result); } @@ -711,7 +711,7 @@ if (empty($reshook)) unset($_POST['qty']); unset($_POST['type']); unset($_POST['remise_percent']); - unset($_POST['pu']); + unset($_POST['pu']); unset($_POST['price_ht']); unset($_POST['multicurrency_price_ht']); unset($_POST['price_ttc']); @@ -742,8 +742,8 @@ if (empty($reshook)) unset($_POST['date_endday']); unset($_POST['date_endmonth']); unset($_POST['date_endyear']); - } - else + } + else { $db->rollback(); @@ -959,27 +959,13 @@ if (empty($reshook)) // Fill array 'array_options' with data from update form $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute')); - if ($ret < 0) - $error ++; - - if (! $error) { - // Actions on extra fields (by external module or standard code) - $hookmanager->initHooks(array('supplier_proposaldao')); - $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) { - $error ++; - } - } else if ($reshook < 0) - $error ++; + if ($ret < 0) $error++; + if (! $error) + { + $result = $object->insertExtraFields(); + if ($result < 0) $error++; } - - if ($error) - $action = 'edit_extras'; + if ($error) $action = 'edit_extras'; } } @@ -1163,9 +1149,7 @@ if ($action == 'create') // 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 + $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)) { print $object->showOptionals($extrafields, 'edit'); } @@ -1367,11 +1351,11 @@ if ($action == 'create') // Print form confirm print $formconfirm; - + // Supplier proposal card $linkback = '
' . $langs->trans("BackToList") . ''; - - + + $morehtmlref='
'; // Ref supplier //$morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', 0, 1); @@ -1411,15 +1395,15 @@ if ($action == 'create') } } $morehtmlref.='
'; - - + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); - - + + print '
'; print '
'; print '
'; - + print ''; // Payment term @@ -1563,14 +1547,14 @@ if ($action == 'create') include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; print '
'; - + print '
'; print '
'; print '
'; print '
'; - + print ''; - + if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) { // Multicurrency Amount HT @@ -1588,7 +1572,7 @@ if ($action == 'create') print ''; print ''; } - + // Amount HT print ''; print ''; @@ -1619,18 +1603,18 @@ if ($action == 'create') print ''; print '
' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . $langs->trans('AmountHT') . '' . price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency) . '
'; - + // Margin Infos /*if (! empty($conf->margin->enabled)) { $formmargin->displayMarginInfos($object); - }*/ + }*/ print '
'; print '
'; print '
'; - + print '

'; - + if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) { $blocname = 'contacts'; $title = $langs->trans('ContactsAddresses'); @@ -1667,7 +1651,7 @@ if ($action == 'create') // Add free products/services form global $forceall, $senderissupplier, $dateSelector; $forceall=1; $senderissupplier=2; $dateSelector=0; // $senderissupplier=2 is same than 1 but disable test on minimum qty. - + if (! empty($object->lines)) $ret = $object->printObjectLines($action, $soc, $mysoc, $lineid, 1); @@ -1810,12 +1794,12 @@ if ($action == 'create') print $formfile->showdocuments('supplier_proposal', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang); - + // Show links to link elements $linktoelem = $form->showLinkToObjectBlock($object, null, array('supplier_proposal')); $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); - + print '
'; // List of actions on element diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 3912a9b80ff..c0738f004bc 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -265,7 +265,7 @@ input.select2-input { border-bottom: solid 1px rgba(0,0,0,.2) !important; /* required to avoid to lose bottom line when focus is lost on select2. */ } -.liste_titre input[name=monthvalid], .liste_titre input[name=search_smonth], .liste_titre input[name=search_emonth], .liste_titre input[name=smonth], .liste_titre input[name=month], .liste_titre input[name=month_lim] { +.liste_titre input[name=monthvalid], .liste_titre input[name=search_smonth], .liste_titre input[name=search_emonth], .liste_titre input[name=smonth], .liste_titre input[name=month], .liste_titre select[name=month], .liste_titre input[name=month_lim] { margin-right: 4px; } input[type=submit] { @@ -691,7 +691,7 @@ div.fiche>form>div.div-table-responsive, div.fiche>form>div.div-table-responsive overflow-x: auto; } div.fiche>form>div.div-table-responsive { - min-height: 390px; + min-height: 392px; } .flexcontainer { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index d3f822bcca2..4557c6856fb 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -692,7 +692,7 @@ div.fiche>form>div.div-table-responsive, div.fiche>form>div.div-table-responsive overflow-x: auto; } div.fiche>form>div.div-table-responsive { - min-height: 390px; + min-height: 392px; } .flexcontainer { diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 92951de98e8..88315f82763 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -300,7 +300,7 @@ if (empty($reshook)) { } } - if ($action == 'update' && ! $cancel) + if ($action == 'update' && ! $cancel) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -319,7 +319,7 @@ if (empty($reshook)) { $error ++; } - if (!$error) + if (!$error) { $object->fetch($id); @@ -456,7 +456,7 @@ if (empty($reshook)) { setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors'); } else { // Create thumbs - $object->addThumbs($newfile); + $object->addThumbs($newfile); } } else { $error ++; @@ -465,7 +465,7 @@ if (empty($reshook)) { } } } - + if (! $error && ! count($object->errors)) { // Then we add the associated categories @@ -476,7 +476,7 @@ if (empty($reshook)) { if (!$error && !count($object->errors)) { setEventMessages($langs->trans("UserModified"), null, 'mesgs'); $db->commit(); - + $login = $_SESSION["dol_login"]; if ($login && $login == $object->oldcopy->login && $object->oldcopy->login != $object->login) // Current user has changed its login { @@ -495,11 +495,11 @@ if (empty($reshook)) { if ($caneditpassword) // Case we can edit only password { dol_syslog("Not allowed to change fields, only password"); - + $object->fetch($id); - + $object->oldcopy = clone $object; - + $ret = $object->setPassword($user, GETPOST("password")); if ($ret < 0) { @@ -591,14 +591,14 @@ if (empty($reshook)) { setEventMessages($ldap->error, $ldap->errors, 'errors'); } } - + // Actions to send emails $trigger_name='USER_SENTBYMAIL'; $paramname='id'; // Name of param key to open the card $mode='emailfromuser'; $trackid='use'.$object->id; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; - + // Actions to build doc $upload_dir = $conf->user->dir_output; $permissioncreate=$user->rights->user->user->creer; @@ -1027,9 +1027,9 @@ if (($action == 'create') || ($action == 'adduserldap')) print ''; print ''; } - + // TODO Move this into tab RH (HierarchicalResponsible must be on both tab) - + // Hierarchy print ''.$langs->trans("HierarchicalResponsible").''; print ''; @@ -1076,7 +1076,7 @@ if (($action == 'create') || ($action == 'adduserldap')) print ''; print ''; print "\n"; - + // Date employment print ''.$langs->trans("DateEmployment").''; print ''; @@ -1092,9 +1092,9 @@ if (($action == 'create') || ($action == 'adduserldap')) print $formother->selectColor(GETPOST('color')?GETPOST('color'):$object->color, 'color', null, 1, '', 'hideifnotset'); print ''; } - + // Categories - if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) + if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) { print '' . fieldLabel('Categories', 'usercats') . ''; $cate_arbo = $form->select_all_categories('user', null, 'parent', null, null, 1); @@ -1110,7 +1110,7 @@ if (($action == 'create') || ($action == 'adduserldap')) { print $object->showOptionals($extrafields,'edit'); } - + // Note print ''; print $langs->trans("Note"); @@ -1127,7 +1127,7 @@ if (($action == 'create') || ($action == 'adduserldap')) $doleditor=new DolEditor('signature',GETPOST('signature'),'',138,'dolibarr_mailings','In',true,true,empty($conf->global->FCKEDITOR_ENABLE_USERSIGN)?0:1,ROWS_4,'90%'); print $doleditor->Create(1); print ''; - + print "\n"; dol_fiche_end(); @@ -1153,7 +1153,7 @@ else $object->fetch($id, '', '', 1); if ($res < 0) { dol_print_error($db,$object->error); exit; } $res=$object->fetch_optionals($object->id,$extralabels); - + // Check if user has rights $object->getrights(); if(empty($object->nb_rights)) setEventMessages($langs->trans('UserHasNoPermissions'), null, 'warnings'); @@ -1387,7 +1387,7 @@ else print ''.$langs->trans("AccountancyCode").''; print ''.$object->accountancy_code.''; } - + // TODO Move this into tab RH, visible when salarie or RH is visible (HierarchicalResponsible must be on both tab) // Hierarchy @@ -1468,7 +1468,7 @@ else } // Categories - if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) + if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) { print '' . $langs->trans( "Categories" ) . ''; print ''; @@ -1495,30 +1495,25 @@ else print "\n"; } } - + if (isset($conf->file->main_authentication) && preg_match('/openid/',$conf->file->main_authentication) && ! empty($conf->global->MAIN_OPENIDURL_PERUSER)) { print ''.$langs->trans("OpenIDURL").''; print ''.$object->openid.''; print "\n"; } - + print ''.$langs->trans("LastConnexion").''; print ''.dol_print_date($object->datelastlogin,"dayhour").''; print "\n"; - + print ''.$langs->trans("PreviousConnexion").''; print ''.dol_print_date($object->datepreviouslogin,"dayhour").''; print "\n"; - + // Other attributes - $parameters=array(); - $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)) - { - print $object->showOptionals($extrafields); - } - + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + // Company / Contact if (! empty($conf->societe->enabled)) { @@ -1598,7 +1593,7 @@ else $langs->load("mails"); print ''; } - + if ($caneditfield && (empty($conf->multicompany->enabled) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1))) { if (! empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) @@ -1680,36 +1675,36 @@ else /* * Affiche formulaire mail */ - + // By default if $action=='presend' $titreform='SendMail'; $topicmail=''; $action='send'; $modelmail='user'; - + print '
'; print load_fiche_titre($langs->trans($titreform)); - + dol_fiche_head(); - + // Define output language $outputlangs = $langs; $newlang = ''; if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang = $_REQUEST['lang_id']; - + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->default_lang; - + // Cree l'objet formulaire mail include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; $formmail = new FormMail($db); $formmail->param['langsmodels']=(empty($newlang)?$langs->defaultlang:$newlang); $formmail->fromtype = (GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user')); - + if($formmail->fromtype === 'user'){ $formmail->fromid = $user->id; - + } $formmail->trackid='thi'.$object->id; if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set @@ -1733,40 +1728,40 @@ else $formmail->substit['__FIRSTNAME__']=$object->firstname; $formmail->substit['__SIGNATURE__']=$user->signature; $formmail->substit['__PERSONALIZED__']=''; - + //Find the good contact adress /* $custcontact=''; $contactarr=array(); $contactarr=$object->liste_contact(-1,'external'); - + if (is_array($contactarr) && count($contactarr)>0) { foreach($contactarr as $contact) { if ($contact['libelle']==$langs->trans('TypeContact_facture_external_BILLING')) { - + require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; - + $contactstatic=new Contact($db); $contactstatic->fetch($contact['id']); $custcontact=$contactstatic->getFullName($langs,1); } } - + if (!empty($custcontact)) { $formmail->substit['__CONTACTCIVNAME__']=$custcontact; } }*/ - - + + // Tableau des parametres complementaires du post $formmail->param['action']=$action; $formmail->param['models']=$modelmail; $formmail->param['models_id']=GETPOST('modelmailselected','int'); $formmail->param['socid']=$object->id; $formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id; - + // Init list of files if (GETPOST("mode")=='init') { @@ -1774,7 +1769,7 @@ else $formmail->add_attached_files($file,basename($file),dol_mimetype($file)); } print $formmail->get_form(); - + dol_fiche_end(); } @@ -1783,17 +1778,17 @@ else /* * List of groups of user */ - + if ($canreadgroup) { print load_fiche_titre($langs->trans("ListOfGroupsForUser"),'',''); - + // On selectionne les groupes auquel fait parti le user $exclude = array(); - + $usergroup=new UserGroup($db); $groupslist = $usergroup->listGroupsForUser($object->id); - + if (! empty($groupslist)) { if (! (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode))) @@ -1804,14 +1799,14 @@ else } } } - + if ($caneditgroup) { print '
'."\n"; print ''; print ''; } - + print ''."\n"; print ''."\n"; if(! empty($conf->multicompany->enabled) && !empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity) @@ -1843,7 +1838,7 @@ else print ''; } print ''."\n"; - + /* * Groups assigned to user */ @@ -1851,8 +1846,8 @@ else { foreach($groupslist as $group) { - - + + print ''; print ''; } - + print "
'.$langs->trans("Groups").'
'; if ($caneditgroup) @@ -1899,9 +1894,9 @@ else { print '
'.$langs->trans("None").'
"; - + if ($caneditgroup) { print '
'; @@ -1910,7 +1905,7 @@ else } } } - + /* * Fiche en mode edition */ @@ -2030,7 +2025,7 @@ else print "\n"; // API key - if(! empty($conf->api->enabled) && $user->admin) + if(! empty($conf->api->enabled) && $user->admin) { print ''.$langs->trans("ApiKey").''; print ''; @@ -2280,9 +2275,9 @@ else print ''; print ""; } - + // TODO Move this into tab RH (HierarchicalResponsible must be on both tab) - + // Hierarchy print ''.$langs->trans("HierarchicalResponsible").''; print ''; @@ -2355,7 +2350,7 @@ else print $formother->selectColor(GETPOST('color')?GETPOST('color'):$object->color, 'color', null, 1, '', 'hideifnotset'); print ''; } - + // Photo print ''; print ''.$langs->trans("Photo").''; @@ -2363,9 +2358,9 @@ else print $form->showphoto('userphoto',$object,60,0,$caneditfield,'photowithmargin','small'); print ''; print ''; - + // Categories - if (!empty( $conf->categorie->enabled ) && !empty( $user->rights->categorie->lire )) + if (!empty( $conf->categorie->enabled ) && !empty( $user->rights->categorie->lire )) { print '' . fieldLabel( 'Categories', 'usercats' ) . ''; print ''; @@ -2470,7 +2465,7 @@ else print dol_htmlentitiesbr($object->signature); } print ''; - + print ''; dol_fiche_end(); @@ -2495,27 +2490,27 @@ else $urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id; $genallowed = $user->rights->user->user->creer; $delallowed = $user->rights->user->user->supprimer; - + $somethingshown = $formfile->show_documents('user', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang); - + // Show links to link elements $linktoelem = $form->showLinkToObjectBlock($object, null, null); $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); - + print '
'; - + // List of actions on element include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; $formactions = new FormActions($db); $somethingshown = $formactions->showactions($object, 'user', $socid); - - + + print '
'; } - + if (! empty($conf->ldap->enabled) && ! empty($object->ldap_sid)) $ldap->close(); } - + } if (! empty($conf->api->enabled) && ! empty($conf->use_javascript_ajax)) diff --git a/htdocs/user/group/card.php b/htdocs/user/group/card.php index bbcbd38c168..6cb04c8eab5 100644 --- a/htdocs/user/group/card.php +++ b/htdocs/user/group/card.php @@ -210,7 +210,7 @@ if ($action == 'update') setEventMessages($langs->trans('ErrorForbidden'), null, 'mesgs'); } } - + // Actions to build doc $upload_dir = $conf->usergroup->dir_output; $permissioncreate=$user->rights->user->user->creer; @@ -317,10 +317,10 @@ else dol_fiche_head($head, 'group', $title, -1, 'group'); dol_banner_tab($object,'id','',$user->rights->user->user->lire || $user->admin); - + print '
'; print '
'; - + print ''; // Name @@ -348,15 +348,11 @@ else // Other attributes $parameters=array('colspan' => ' colspan="2"'); - $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)) - { - print $object->showOptionals($extrafields); - } + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; print "
\n"; print '
'; - + dol_fiche_end(); @@ -448,7 +444,7 @@ else { foreach($object->members as $useringroup) { - + print ''; print ''; @@ -497,7 +493,7 @@ else } print ""; print "
"; - + /* * Documents generes */ @@ -506,21 +502,21 @@ else $urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id; $genallowed = $user->rights->user->user->creer; $delallowed = $user->rights->user->user->supprimer; - + $somethingshown = $formfile->show_documents('usergroup', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang); - + // Show links to link elements $linktoelem = $form->showLinkToObjectBlock($object, null, null); $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); - + print '
'; - + // List of actions on element include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; $formactions = new FormActions($db); $somethingshown = $formactions->showactions($object, 'usergroup', $socid); - - + + print '
'; }