diff --git a/ChangeLog b/ChangeLog index 777be335d62..18f9fbe2dcb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,10 +4,13 @@ English Dolibarr ChangeLog ***** ChangeLog for 10.0.0 compared to 9.0.0 ***** For Users: -NEW: Module ticket is available as a stable module -NEW: Experimental module "Vendor receptions" +NEW: Module Ticket is available as a stable module. +NEW: Experimental module "Vendor receptions". +NEW: Experimental module "BOM". +FIX: Disallow line start date to be after end date For Developers: +NEW: Module DebugBar is available as a stable module. WARNING: @@ -21,6 +24,7 @@ Following changes may create regressions for some external modules, but were nec * All methods set_draft() were renamed into setDraft(). * Removed deprecated function function test_sql_and_script_inject that was replaced with testSqlAndScriptInject. * Method load_measuring_units were renamed into selectMeasuringUnits and select_measuring_units was deprecated. +* Hidden option CHANGE_ORDER_CONCAT_DESCRIPTION were renamed into MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION ***** ChangeLog for 9.0.1 compared to 9.0.0 ***** diff --git a/dev/dolibarr_changes.txt b/dev/dolibarr_changes.txt index d8861154f9e..5bad55fd4d2 100644 --- a/dev/dolibarr_changes.txt +++ b/dev/dolibarr_changes.txt @@ -8,6 +8,15 @@ ALL: Check "@CHANGE" +PrestaShopWebservice: +--------------------- +Replace + $params = array('filter', 'display', 'sort', 'limit', 'id_shop', 'id_group_shop'); +With + $params = array('filter', 'display', 'sort', 'limit', 'id_shop', 'id_group_shop', 'date'); + + + CKEDITOR (4.6.2): ----------------- * In ckeditor/ckeditor/contents.css diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index e0b8c6f70c2..089c156eb04 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -247,7 +247,7 @@ if ($resql) print ''; print ''; - $newcardbutton = '' . $langs->trans("Addanaccount").''; + $newcardbutton = '' . $langs->trans("Addanaccount").''; $newcardbutton.= ''; $newcardbutton.= ''; diff --git a/htdocs/accountancy/admin/fiscalyear.php b/htdocs/accountancy/admin/fiscalyear.php index 795edda5f4c..16c5b508b1c 100644 --- a/htdocs/accountancy/admin/fiscalyear.php +++ b/htdocs/accountancy/admin/fiscalyear.php @@ -113,11 +113,11 @@ if ($result) if (! empty($user->rights->accounting->fiscalyear)) { - $addbutton = '' . $langs->trans("NewFiscalYear") .''; + $addbutton = '' . $langs->trans("NewFiscalYear") .''; } else { - $addbutton = '' . $langs->trans("NewFiscalYear") .''; + $addbutton = '' . $langs->trans("NewFiscalYear") .''; } $title = $langs->trans('AccountingPeriods'); diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index 07df2a91872..37ec3c4e503 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -333,7 +333,7 @@ if ($result) if ($accounting_product_mode == 'ACCOUNTANCY_BUY') print ''; // Current account print ''; - print ''; + print ''; $listofvals=array('withoutvalidaccount'=>$langs->trans("WithoutValidAccount"), 'withvalidaccount'=>$langs->trans("WithValidAccount")); print ' '.$langs->trans("or").' '.$form->selectarray('search_current_account_valid', $listofvals, $search_current_account_valid, 1); print ''; @@ -481,6 +481,14 @@ if ($result) }); init_savebutton(); + + jQuery("#search_current_account").keyup(function() { + if (jQuery("#search_current_account").val() != \'\') + { + console.log("We set a value of account to search "+jQuery("#search_current_account").val()+", so we disable the other search criteria on account"); + jQuery("#search_current_account_valid").val(-1); + } + }); }); '; diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index c1716dc18af..207ea3464d8 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -451,7 +451,7 @@ $button.= ''; $groupby = ' ' . $langs->trans("GroupByAccountAccounting") . ''; -$newcardbutton = '' . $langs->trans("NewAccountingMvt").''; +$newcardbutton = ''.$langs->trans("NewAccountingMvt").''; $newcardbutton.= ''; $newcardbutton.= ''; @@ -648,7 +648,7 @@ if ($num > 0) // Document date if (! empty($arrayfields['t.doc_date']['checked'])) { - print '' . dol_print_date($line->doc_date, 'day') . ''; + print '' . dol_print_date($line->doc_date, 'day') . ''; if (! $i) $totalarray['nbfield']++; } @@ -701,7 +701,7 @@ if ($num > 0) // Lettering code if (! empty($arrayfields['t.lettering_code']['checked'])) { - print '' . $line->lettering_code . ''; + print '' . $line->lettering_code . ''; if (! $i) $totalarray['nbfield']++; } @@ -711,26 +711,26 @@ if ($num > 0) $accountingjournal = new AccountingJournal($db); $result = $accountingjournal->fetch('', $line->code_journal); $journaltoshow = (($result > 0)?$accountingjournal->getNomUrl(0, 0, 0, '', 0) : $line->code_journal); - print '' . $journaltoshow . ''; + print '' . $journaltoshow . ''; if (! $i) $totalarray['nbfield']++; } // Creation operation date if (! empty($arrayfields['t.date_creation']['checked'])) { - print '' . dol_print_date($line->date_creation, 'dayhour') . ''; + print '' . dol_print_date($line->date_creation, 'dayhour') . ''; if (! $i) $totalarray['nbfield']++; } // Modification operation date if (! empty($arrayfields['t.tms']['checked'])) { - print '' . dol_print_date($line->date_modification, 'dayhour') . ''; + print '' . dol_print_date($line->date_modification, 'dayhour') . ''; if (! $i) $totalarray['nbfield']++; } // Action column - print ''; + print ''; print '' . img_edit() . ' '; print '' . img_delete() . ''; print ''; diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 8988491c927..38dc49c5bf6 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -257,7 +257,7 @@ if ($action == 'delbookkeepingyear') { print '
'; $viewflat = ' ' . $langs->trans("ViewFlatList") . ''; -$newcardbutton = '' . $langs->trans("NewAccountingMvt").''; +$newcardbutton = ''.$langs->trans("NewAccountingMvt").''; $newcardbutton.= ''; $newcardbutton.= ''; diff --git a/htdocs/accountancy/class/accountancysystem.class.php b/htdocs/accountancy/class/accountancysystem.class.php index 53e824219c5..c8a855c0d8a 100644 --- a/htdocs/accountancy/class/accountancysystem.class.php +++ b/htdocs/accountancy/class/accountancysystem.class.php @@ -142,12 +142,12 @@ class AccountancySystem $result = $this->rowid; } else { $result = - 2; - $this->error = "AccountancySystem::Create Erreur $result"; + $this->error = "AccountancySystem::Create Error $result"; dol_syslog($this->error, LOG_ERR); } } else { $result = - 1; - $this->error = "AccountancySystem::Create Erreur $result"; + $this->error = "AccountancySystem::Create Error $result"; dol_syslog($this->error, LOG_ERR); } diff --git a/htdocs/adherents/admin/adherent_emails.php b/htdocs/adherents/admin/adherent_emails.php index 09f7aa22032..3f901539380 100644 --- a/htdocs/adherents/admin/adherent_emails.php +++ b/htdocs/adherents/admin/adherent_emails.php @@ -161,7 +161,7 @@ $helptext.='__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, form_constantes($constantes, 0, $helptext); -//print '
'; +//print '
'; //print '
'; dol_fiche_end(); diff --git a/htdocs/adherents/agenda.php b/htdocs/adherents/agenda.php index 3869afccf6d..f6c178f2e4d 100644 --- a/htdocs/adherents/agenda.php +++ b/htdocs/adherents/agenda.php @@ -151,7 +151,7 @@ if ($object->id > 0) $newcardbutton = ''; if (! empty($conf->agenda->enabled)) { - $newcardbutton.=''.$langs->trans("AddAction").''; + $newcardbutton.=''.$langs->trans("AddAction").''; $newcardbutton.= ''; $newcardbutton.= ''; } diff --git a/htdocs/adherents/canvas/default/tpl/adherentcard_create.tpl.php b/htdocs/adherents/canvas/default/tpl/adherentcard_create.tpl.php index 50c66a88f69..742c11d5160 100644 --- a/htdocs/adherents/canvas/default/tpl/adherentcard_create.tpl.php +++ b/htdocs/adherents/canvas/default/tpl/adherentcard_create.tpl.php @@ -120,7 +120,7 @@ echo $this->control->tpl['ajax_selectcountry']; ?> - "> + ">
diff --git a/htdocs/adherents/canvas/default/tpl/adherentcard_edit.tpl.php b/htdocs/adherents/canvas/default/tpl/adherentcard_edit.tpl.php index 96d1a571e8a..3b25467860b 100644 --- a/htdocs/adherents/canvas/default/tpl/adherentcard_edit.tpl.php +++ b/htdocs/adherents/canvas/default/tpl/adherentcard_edit.tpl.php @@ -134,7 +134,7 @@ echo $this->control->tpl['ajax_selectcountry']; - + ">  "> diff --git a/htdocs/adherents/document.php b/htdocs/adherents/document.php index 8dca985af70..2de98e1b96a 100644 --- a/htdocs/adherents/document.php +++ b/htdocs/adherents/document.php @@ -113,7 +113,7 @@ if ($id > 0) print '
'; print '
'; - print ''; + print '
'; $linkback = ''.$langs->trans("BackToList").''; @@ -128,7 +128,7 @@ if ($id > 0) // Morphy print ''; - /*print '';*/ print ''; @@ -140,10 +140,10 @@ if ($id > 0) print ''; print ''; - // Nbre fichiers + // Number of Attached Files print ''; - //Total taille + //Total Size Of Attached Files print ''; print '
'.$langs->trans("Nature").''.$object->getmorphylib().''; + /*print ''; print $form->showphoto('memberphoto',$object); print '
'.$langs->trans("UserTitle").''.$object->getCivilityLabel().' 
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.dol_print_size($totalsize, 1, 1).'
'; diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php index d1ae80378ee..1d1232a9d58 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -162,7 +162,7 @@ if ($conf->use_javascript_ajax) print '
'; print ''; print ''; - print ''; } if (! empty($arrayfields['d.firstname']['checked'])) { - print ''; } if (! empty($arrayfields['d.lastname']['checked'])) { - print ''; } if (! empty($arrayfields['d.gender']['checked'])) @@ -463,17 +463,17 @@ if (! empty($arrayfields['d.gender']['checked'])) } if (! empty($arrayfields['d.company']['checked'])) { - print ''; } if (! empty($arrayfields['d.login']['checked'])) { - print ''; } if (! empty($arrayfields['d.morphy']['checked'])) { - print ''; } if (! empty($arrayfields['t.libelle']['checked'])) @@ -486,18 +486,18 @@ if (! empty($arrayfields['t.libelle']['checked'])) if (! empty($arrayfields['d.address']['checked'])) { - print ''; } if (! empty($arrayfields['d.zip']['checked'])) { - print ''; } if (! empty($arrayfields['d.town']['checked'])) { - print ''; } // State @@ -510,38 +510,38 @@ if (! empty($arrayfields['state.nom']['checked'])) // Country if (! empty($arrayfields['country.code_iso']['checked'])) { - print ''; } // Phone pro if (! empty($arrayfields['d.phone']['checked'])) { - print ''; } // Phone perso if (! empty($arrayfields['d.phone_perso']['checked'])) { - print ''; } // Phone mobile if (! empty($arrayfields['d.phone_mobile']['checked'])) { - print ''; } // Email if (! empty($arrayfields['d.email']['checked'])) { - print ''; } if (! empty($arrayfields['d.datefin']['checked'])) { - print ''; } // Extra fields @@ -576,7 +576,7 @@ if (! empty($arrayfields['d.statut']['checked'])) print ''; } // Action column -print ''; @@ -647,7 +647,7 @@ while ($i < min($num, $limit)) if (! empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) { - print ''; + print ''; if (! $i) $totalarray['nbfield']++; } @@ -753,7 +753,7 @@ while ($i < min($num, $limit)) // Country if (! empty($arrayfields['country.code_iso']['checked'])) { - print ''; @@ -794,7 +794,7 @@ while ($i < min($num, $limit)) { if ($datefin) { - print ''; if (! $i) $totalarray['nbfield']++; @@ -834,7 +834,7 @@ while ($i < min($num, $limit)) // Date modification if (! empty($arrayfields['d.tms']['checked'])) { - print ''; if (! $i) $totalarray['nbfield']++; @@ -848,7 +848,7 @@ while ($i < min($num, $limit)) if (! $i) $totalarray['nbfield']++; } // Action column - print ''; - /*print '';*/ print ''; diff --git a/htdocs/adherents/stats/byproperties.php b/htdocs/adherents/stats/byproperties.php index 6ba88e7771b..1832e14e6eb 100644 --- a/htdocs/adherents/stats/byproperties.php +++ b/htdocs/adherents/stats/byproperties.php @@ -121,8 +121,8 @@ print '
'.$langs->trans("Statistics").'
'; + print '
'; $SommeA=0; $SommeB=0; diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 35e1fd1553f..bafd24b0ff5 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -365,7 +365,7 @@ $massactionbutton=$form->selectMassAction('', $arrayofmassactions); $newcardbutton=''; if ($user->rights->adherent->creer) { - $newcardbutton=''.$langs->trans('NewMember').''; + $newcardbutton=''.$langs->trans('NewMember').''; $newcardbutton.= ''; $newcardbutton.= ''; } @@ -441,17 +441,17 @@ if (! empty($arrayfields['d.ref']['checked'])) } if (! empty($arrayfields['d.civility']['checked'])) { - print ''; + print ''; print ''; + print ''; print ''; + print ''; print ''; + print ''; print ''; + print ''; print ''; + print ''; print ''; + print ''; print ''; + print ''; print ''; + print ''; print ''; + print ''; print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100'); print ''; + print ''; print ''; + print ''; print ''; + print ''; print ''; + print ''; print ''; + print ''; print ''; +print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print ''.$obj->rowid.''.$obj->rowid.''; + print ''; $tmparray=getCountry($obj->country, 'all'); print $tmparray['label']; print ''; + print ''; print dol_print_date($datefin, 'day'); if ($memberstatic->hasDelay()) { $textlate .= ' ('.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($conf->adherent->subscription->warning_delay/60/60/24) >= 0 ? '+' : '').ceil($conf->adherent->subscription->warning_delay/60/60/24).' '.$langs->trans("days").')'; @@ -804,7 +804,7 @@ while ($i < min($num, $limit)) } else { - print ''; + print ''; if ($obj->subscription == 'yes') { print $langs->trans("SubscriptionNotReceived"); @@ -826,7 +826,7 @@ while ($i < min($num, $limit)) // Date creation if (! empty($arrayfields['d.datec']['checked'])) { - print ''; + print ''; print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); print ''; + print ''; print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); print ''; + print ''; if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined { $selected=0; diff --git a/htdocs/adherents/note.php b/htdocs/adherents/note.php index 0acd98a9ead..b3e18f543be 100644 --- a/htdocs/adherents/note.php +++ b/htdocs/adherents/note.php @@ -93,7 +93,7 @@ if ($id) // Morphy print '
'.$langs->trans("Nature").''.$object->getmorphylib().''; + /*print ''; print $form->showphoto('memberphoto',$member); print '
'; print ''; print ''; print ''; -print ''; -print ''; +print ''; +print ''; print ''; if (! $foundphy) $data[]=array('label'=>'phy','nb'=>'0','lastdate'=>'', 'lastsubscriptiondate'=>''); @@ -133,8 +133,8 @@ foreach ($data as $val) print ''; print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; } diff --git a/htdocs/adherents/stats/geo.php b/htdocs/adherents/stats/geo.php index 568c8ea6af9..2ae7e2d0001 100644 --- a/htdocs/adherents/stats/geo.php +++ b/htdocs/adherents/stats/geo.php @@ -287,7 +287,7 @@ if (count($arrayjs) && $mode == 'memberbycountry') print "\n"; // print the div tag that will contain the map - print '
'."\n"; + print '
'."\n"; print '
'; } @@ -297,10 +297,10 @@ if ($mode) print '
'.$langs->trans("Nature").''.$langs->trans("NbOfMembers").''.$langs->trans("LastMemberDate").''.$langs->trans("LatestSubscriptionDate").''.$langs->trans("LastMemberDate").''.$langs->trans("LatestSubscriptionDate").'
'.$memberstatic->getmorphylib($val['label']).''.$val['nb'].''.dol_print_date($val['lastdate'], 'dayhour').''.dol_print_date($val['lastsubscriptiondate'], 'dayhour').''.dol_print_date($val['lastdate'], 'dayhour').''.dol_print_date($val['lastsubscriptiondate'], 'dayhour').'
'; print ''; print ''; - if ($label2) print ''; + if ($label2) print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; foreach ($data as $val) @@ -308,10 +308,10 @@ if ($mode) $year = $val['year']; print ''; print ''; - if ($label2) print ''; + if ($label2) print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; } diff --git a/htdocs/adherents/stats/index.php b/htdocs/adherents/stats/index.php index 2492e0c0602..4a7229af5ef 100644 --- a/htdocs/adherents/stats/index.php +++ b/htdocs/adherents/stats/index.php @@ -157,7 +157,7 @@ print ''; print ''; -print ''; +print ''; print '
'.$label.''.$label2.''.$label2.''.$langs->trans("NbOfMembers").''.$langs->trans("LastMemberDate").''.$langs->trans("LatestSubscriptionDate").''.$langs->trans("LastMemberDate").''.$langs->trans("LatestSubscriptionDate").'
'.$val['label'].''.$val['label2'].''.$val['label2'].''.$val['nb'].''.dol_print_date($val['lastdate'], 'dayhour').''.dol_print_date($val['lastsubscriptiondate'], 'dayhour').''.dol_print_date($val['lastdate'], 'dayhour').''.dol_print_date($val['lastsubscriptiondate'], 'dayhour').'
'.$langs->trans("User").''; print $form->select_dolusers($userid, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); print '
'; print ''; print '

'; @@ -170,7 +170,7 @@ $data = $stats->getAllByYear(); print '
'; print ''; print ''; -print ''; +print ''; print ''; print ''; print ''; @@ -184,7 +184,7 @@ foreach ($data as $val) { // If we have empty year $oldyear--; print ''; - print ''; } print ''; - print ''; - // Conditions de reglement par defaut + // Default terms of the settlement $langs->load('bills'); $form = new Form($db); print ''; @@ -1558,7 +1621,7 @@ if ($action=='create') $langs->load('projects'); print ''; } @@ -1826,40 +1889,57 @@ elseif (! empty($object->id)) $morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', 0, 1); $morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); - if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref.=' ('.$langs->trans("OtherOrders").')'; + $morehtmlref.='
'.$langs->trans('ThirdParty'); + if(! empty($conf->global->MAIN_CAN_EDIT_SUPPLIER_ON_SUPPLIER_ORDER) && ! empty($user->rights->fournisseur->commande->creer) && $action == 'edit_thirdparty') { + $morehtmlref .= ' : '; + $morehtmlref .= ''; + $morehtmlref .= ''; + $morehtmlref .= ''; + $morehtmlref .= $form->select_company($object->thirdparty->id, 'new_socid', 's.fournisseur = 1', '', 0, 0, array(), 0, 'minwidth300'); + $morehtmlref .= ''; + $morehtmlref .= ''; + } + if(empty($conf->global->MAIN_CAN_EDIT_SUPPLIER_ON_SUPPLIER_ORDER) || $action != 'edit_thirdparty') { + if(! empty($conf->global->MAIN_CAN_EDIT_SUPPLIER_ON_SUPPLIER_ORDER) && $object->statut == CommandeFournisseur::STATUS_DRAFT) { + $morehtmlref .= '' . img_edit($langs->transnoentitiesnoconv('SetThirdParty')) . ''; + } + $morehtmlref .= ' : '.$object->thirdparty->getNomUrl(1); + if(empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref .= ' (' . $langs->trans("OtherOrders") . ')'; + } + // Project - if (! empty($conf->projet->enabled)) - { - $langs->load("projects"); - $morehtmlref.='
'.$langs->trans('Project') . ' '; - if ($user->rights->fournisseur->commande->creer) - { - if ($action != 'classify') - $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref.=''; - $morehtmlref.=''; - $morehtmlref.=''; - $morehtmlref.=$formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS)?$object->socid:-1), $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref.=''; - $morehtmlref.=''; - } else { - $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); - } - } else { - if (! empty($object->fk_project)) { - $proj = new Project($db); - $proj->fetch($object->fk_project); - $morehtmlref.=''; - $morehtmlref.=$proj->ref; - $morehtmlref.=''; - } else { - $morehtmlref.=''; - } - } - } + if(!empty($conf->projet->enabled)) { + $langs->load("projects"); + $morehtmlref .= '
' . $langs->trans('Project') . ' '; + if($user->rights->fournisseur->commande->creer) { + if($action != 'classify') + $morehtmlref .= '' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + if($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref .= ''; + $morehtmlref .= ''; + $morehtmlref .= ''; + $morehtmlref .= $formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref .= ''; + $morehtmlref .= ''; + } + else { + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } + else { + if(!empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref .= ''; + $morehtmlref .= $proj->ref; + $morehtmlref .= ''; + } + else { + $morehtmlref .= ''; + } + } + } $morehtmlref.=''; @@ -1916,7 +1996,7 @@ elseif (! empty($object->id)) print ''; - // Conditions de reglement par defaut + // Default terms of the settlement $langs->load('bills'); print ''; } + $parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql); + $reshook=$hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + print "
'.$langs->trans("Year").''.$langs->trans("Year").''.$langs->trans("NbOfSubscriptions").''.$langs->trans("AmountTotal").''.$langs->trans("AmountAverage").'
'; + print ''; print ''; print $oldyear; print ''; @@ -195,7 +195,7 @@ foreach ($data as $val) print '
'; + print ''; //print ''; print $year; //print ''; @@ -215,7 +215,7 @@ print '
'; // Show graphs -print ''; } // Active - print ''; @@ -1872,7 +1872,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') print ''; } elseif ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'type_cdr' || $fieldlist[$field] == 'deductible' || $fieldlist[$field] == 'category_type') { - if ($fieldlist[$field] == 'type_cdr') print ''; } @@ -1928,7 +1928,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') // Le type de taxe locale elseif ($fieldlist[$field] == 'localtax1_type' || $fieldlist[$field] == 'localtax2_type') { - print ''; } diff --git a/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php b/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php index f4ed611ac03..dfd3f3f36c1 100644 --- a/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php +++ b/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php @@ -46,7 +46,7 @@ class PrestaShopWebservice /** @var array compatible versions of PrestaShop Webservice */ const PSCOMPATIBLEVERSIONMIN = '1.4.0.0'; - const PSCOMPATIBLEVERSIONMAX = '1.6.99.99'; + const PSCOMPATIBLEVERSIONMAX = '1.7.99.99'; /** @@ -128,6 +128,7 @@ class PrestaShopWebservice CURLOPT_HTTPHEADER => array( 'Expect:' ) ); + dol_syslog("curl_init url=".$url); $session = curl_init($url); $curl_options = array(); @@ -142,6 +143,7 @@ class PrestaShopWebservice if (!isset($curl_options[$defkey])) $curl_options[$defkey] = $curl_params[$defkey]; + dol_syslog("curl curl_options = ".var_export($curl_options, true)); curl_setopt_array($session, $curl_options); $response = curl_exec($session); @@ -309,7 +311,9 @@ class PrestaShopWebservice if (isset($options['id'])) $url .= '/'.$options['id']; - $params = array('filter', 'display', 'sort', 'limit', 'id_shop', 'id_group_shop'); + // @CHANGE LDR + //$params = array('filter', 'display', 'sort', 'limit', 'id_shop', 'id_group_shop'); + $params = array('filter', 'display', 'sort', 'limit', 'id_shop', 'id_group_shop', 'date'); foreach ($params as $p) foreach ($options as $k => $o) if (strpos($k, $p) !== false) @@ -388,6 +392,47 @@ class PrestaShopWebservice self::checkStatusCode($request['status_code']);// check the response validity return self::parseXML($request['response']); } + + /** + * Delete (DELETE) a resource. + * Unique parameter must take :

+ * 'resource' => Resource name
+ * 'id' => ID or array which contains IDs of a resource(s) you want to delete

+ * + * delete(array('resource' => 'orders', 'id' => 1)); + * // Following code will not be executed if an exception is thrown. + * echo 'Successfully deleted.'; + * } + * catch (PrestaShopWebserviceException $ex) + * { + * echo 'Error : '.$ex->getMessage(); + * } + * ?> + * + * @param array $options Array representing resource to delete. + */ + public function delete($options) + { + if (isset($options['url'])) + $url = $options['url']; + elseif (isset($options['resource']) && isset($options['id'])) + if (is_array($options['id'])) + $url = $this->url.'/api/'.$options['resource'].'/?id=['.implode(',', $options['id']).']'; + else + $url = $this->url.'/api/'.$options['resource'].'/'.$options['id']; + if (isset($options['id_shop'])) + $url .= '&id_shop='.$options['id_shop']; + if (isset($options['id_group_shop'])) + $url .= '&id_group_shop='.$options['id_group_shop']; + $request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'DELETE')); + self::checkStatusCode($request['status_code']);// check the response validity + return true; + } } /** diff --git a/htdocs/admin/dolistore/class/dolistore.class.php b/htdocs/admin/dolistore/class/dolistore.class.php index 8a27072fad1..421cef19af5 100644 --- a/htdocs/admin/dolistore/class/dolistore.class.php +++ b/htdocs/admin/dolistore/class/dolistore.class.php @@ -44,7 +44,6 @@ class Dolistore // setups public $url; // the url of this page public $shop_url; // the url of the shop - public $vat_rate; // the vat rate used in the shop (prices are provided without vat) public $lang; // the integer representing the lang in the store public $debug_api; // usefull if no dialog @@ -60,12 +59,11 @@ class Dolistore $this->url = DOL_URL_ROOT.'/admin/modules.php?mode=marketplace'; $this->shop_url = 'https://www.dolistore.com/index.php?controller=product&id_product='; - $this->vat_rate = 1.2; // 20% de TVA $this->debug_api = $debug; $langtmp = explode('_', $langs->defaultlang); $lang = $langtmp[0]; - $lang_array = array('en'=>0, 'fr'=>1, 'es'=>2, 'it'=>3, 'de'=>4); // Into table ps_lang of Prestashop - 1 + $lang_array = array('en'=>1, 'fr'=>2, 'es'=>3, 'it'=>4, 'de'=>5); // Into table ps_lang of Prestashop - 1 if (! in_array($lang, array_keys($lang_array))) $lang = 'en'; $this->lang = $lang_array[$lang]; } @@ -74,12 +72,50 @@ class Dolistore * Load data from remote Dolistore market place. * This fills ->categories * - * @param array $options Options * @return void */ - public function getRemoteData($options = array('start' => 0, 'end' => 10, 'per_page' => 50, 'categorie' => 0)) + public function getRemoteCategories() { - global $conf, $langs; + global $conf; + + try { + $this->api = new PrestaShopWebservice($conf->global->MAIN_MODULE_DOLISTORE_API_SRV, $conf->global->MAIN_MODULE_DOLISTORE_API_KEY, $this->debug_api); + dol_syslog("Call API with MAIN_MODULE_DOLISTORE_API_SRV = ".$conf->global->MAIN_MODULE_DOLISTORE_API_SRV); + // $conf->global->MAIN_MODULE_DOLISTORE_API_KEY is for the login of basic auth. There is no password as it is public data. + + // Here we set the option array for the Webservice : we want categories resources + $opt = array(); + $opt['resource'] = 'categories'; + $opt['display'] = '[id,id_parent,nb_products_recursive,active,is_root_category,name,description]'; + $opt['sort'] = 'id_asc'; + + // Call + dol_syslog("Call API with opt = ".var_export($opt, true)); + $xml = $this->api->get($opt); + $this->categories = $xml->categories->children(); + } catch (PrestaShopWebserviceException $e) { + // Here we are dealing with errors + $trace = $e->getTrace(); + if ($trace[0]['args'][0] == 404) die('Bad ID'); + elseif ($trace[0]['args'][0] == 401) die('Bad auth key'); + else + { + print 'Can not access to '.$conf->global->MAIN_MODULE_DOLISTORE_API_SRV.'
'; + print $e->getMessage(); + } + } + } + + /** + * Load data from remote Dolistore market place. + * This fills ->products + * + * @param array $options Options. If 'categorie' is defined, we filter products on this category id + * @return void + */ + public function getRemoteProducts($options = array('start' => 0, 'end' => 10, 'per_page' => 50, 'categorie' => 0, 'search' => '')) + { + global $conf; $this->start = $options['start']; $this->end = $options['end']; @@ -103,25 +139,26 @@ class Dolistore // make a search to limit the id returned. if ($this->search != '') { - $opt2['url'] = $conf->global->MAIN_MODULE_DOLISTORE_API_SRV.'/api/search?query='.$this->search.'&language='.$this->lang; + $opt2['url'] = $conf->global->MAIN_MODULE_DOLISTORE_API_SRV.'/api/search?query='.$this->search.'&language='.$this->lang; // It seems for search, key start with // Call - //var_dump($this->api); - - dol_syslog("Call API with opt = ".var_export($opt, true)); dol_syslog("Call API with opt2 = ".var_export($opt2, true)); - $xml = $this->api->get($opt2); + $products = array(); foreach ($xml->products->children() as $product) { $products[] = (int) $product['id']; } $opt['filter[id]'] = '['.implode('|', $products).']'; - } elseif ($this->categorie != 0) { + } elseif ($this->categorie != 0) { // We filter on category, so we first get list of product id in this category + // $opt2['url'] is set by default to $this->url.'/api/'.$options['resource']; $opt2['resource'] = 'categories'; $opt2['id'] = $this->categorie; + // Call + dol_syslog("Call API with opt2 = ".var_export($opt2, true)); $xml = $this->api->get($opt2); + $products = array(); foreach ($xml->category->associations->products->children() as $product) { $products[] = (int) $product->id; @@ -134,22 +171,10 @@ class Dolistore $opt['limit'] = "$this->start,$this->end"; // $opt['filter[id]'] contais list of product id that are result of search - // Call API to get the detail dol_syslog("Call API with opt = ".var_export($opt, true)); - dol_syslog("Call API with opt2 = ".var_export($opt2, true)); $xml = $this->api->get($opt); $this->products = $xml->products->children(); - - - // Here we set the option array for the Webservice : we want categories resources - $opt = array(); - $opt['resource'] = 'categories'; - $opt['display'] = '[id,id_parent,nb_products_recursive,active,is_root_category,name,description]'; - $opt['sort'] = 'id_asc'; - // Call - $xml = $this->api->get($opt); - $this->categories = $xml->categories->children(); } catch (PrestaShopWebserviceException $e) { // Here we are dealing with errors $trace = $e->getTrace(); @@ -186,15 +211,15 @@ class Dolistore $cat = $this->categories[$i]; if ($cat->is_root_category == 1 && $parent == 0) { $html .= '
  • '.$cat->name->language[$this->lang].' '.$cat->nb_products_recursive.'

    '; + .'title="'.dol_escape_htmltag(strip_tags($cat->description->language[$this->lang - 1])).'"' + .'>'.$cat->name->language[$this->lang - 1].' '.$cat->nb_products_recursive.''; $html .= self::get_categories($cat->id); $html .= "
  • \n"; } elseif (trim($cat->id_parent) == $parent && $cat->active == 1 && trim($cat->id_parent) != 0) { // si cat est de ce niveau $select = ($cat->id == $this->categorie) ? ' selected' : ''; $html .= '
  • '.$cat->name->language[$this->lang].' '.$cat->nb_products_recursive.''; + .' title="'.dol_escape_htmltag(strip_tags($cat->description->language[$this->lang - 1])).'" ' + .'>'.$cat->name->language[$this->lang - 1].' '.$cat->nb_products_recursive.''; $html .= self::get_categories($cat->id); $html .= "
  • \n"; } else { @@ -242,7 +267,7 @@ class Dolistore // add image or default ? if ($product->id_default_image != '') { $image_url = DOL_URL_ROOT.'/admin/dolistore/ajax/image.php?id_product='.$product->id.'&id_image='.$product->id_default_image; - $images = ''. + $images = ''. ''; } else { $images = ''; @@ -250,7 +275,7 @@ class Dolistore // free or pay ? if ($product->price > 0) { - $price = '

    '.price(round((float) $product->price * $this->vat_rate, 2)).' €

    '; + $price = '

    '.price(price2num($product->price, 'MT'), 0, $langs, 1, -1, -1, 'EUR').' '.$langs->trans("HT").'

    '; $download_link = ''; } else { $price = '

    '.$langs->trans('Free').'

    '; @@ -282,12 +307,12 @@ class Dolistore //output template $html .= ' - - + - - + + '; diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index fd74938d802..50c54621b51 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -178,10 +178,9 @@ if ($action == 'confirm_collect') dol_include_once('/emailcollector/class/emailcollector.class.php'); $res = $object->doCollectOneCollector(); - if ($res > 0) { - setEventMessages($object->output, null, 'mesgs'); + setEventMessages($object->lastresult, null, 'mesgs'); } else { @@ -391,7 +390,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $connectstringsource = $connectstringserver.imap_utf7_encode($sourcedir); $connectstringtarget = $connectstringserver.imap_utf7_encode($targetdir); - $connection = imap_open($connectstringsource, $object->user, $object->password); + $connection = imap_open($connectstringsource, $object->login, $object->password); } else { @@ -443,8 +442,21 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Add filter print ''; print ''; @@ -462,7 +474,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; print ''; print ''; print ''; diff --git a/htdocs/admin/emailcollector_list.php b/htdocs/admin/emailcollector_list.php index e8dbc07654c..a5c167f08e8 100644 --- a/htdocs/admin/emailcollector_list.php +++ b/htdocs/admin/emailcollector_list.php @@ -321,7 +321,7 @@ print ''; $newcardbutton=''; //if ($user->rights->emailcollector->creer) //{ -$newcardbutton=''.$langs->trans('New').''; +$newcardbutton=''.$langs->trans('New').''; $newcardbutton.= ''; $newcardbutton.= ''; //} diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php index d8398f610ba..04dcf3ddc36 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -254,7 +254,7 @@ foreach ($dirmodels as $reldir) else print $tmp; print ''."\n"; - print ''; @@ -336,10 +336,10 @@ print '
    '; +print ''; print_liste_field_titre('Ref', $_SERVER["PHP_SELF"], 'c.rowid', '', $param, '', $sortfield, $sortorder); - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; print ''; if (! empty($conf->banque->enabled)) { @@ -713,9 +713,9 @@ if ($rowid > 0) print ''; print ''; - print '\n"; - print '\n"; - print '\n"; + print '\n"; + print '\n"; + print '\n"; print ''; if (! empty($conf->banque->enabled)) { diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index e123669342d..26293f8a4ac 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -247,7 +247,7 @@ $massactionbutton=$form->selectMassAction('', $arrayofmassactions); $newcardbutton=''; if ($user->rights->adherent->cotisation->creer) { - $newcardbutton=''.$langs->trans('NewSubscription').''; + $newcardbutton=''.$langs->trans('NewSubscription').''; $newcardbutton.= ''; $newcardbutton.= ''; } @@ -284,7 +284,7 @@ $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfiel if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1); print '
    '; -print '
    '; if ($mesg) { print $mesg; } else { print $px1->show(); diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index d72d6ce8978..39466e8ae8a 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -692,9 +692,9 @@ if ($rowid > 0) print '
    '.$langs->trans("DateCreation").''.$langs->trans("DateStart").''.$langs->trans("DateEnd").''.$langs->trans("DateCreation").''.$langs->trans("DateStart").''.$langs->trans("DateEnd").''.$langs->trans("Amount").'
    '.$subscriptionstatic->getNomUrl(1).''.dol_print_date($db->jdate($objp->datec), 'dayhour')."'.dol_print_date($db->jdate($objp->dateh), 'day')."'.dol_print_date($db->jdate($objp->datef), 'day')."'.dol_print_date($db->jdate($objp->datec), 'dayhour')."'.dol_print_date($db->jdate($objp->dateh), 'day')."'.dol_print_date($db->jdate($objp->datef), 'day')."'.price($objp->subscription).'
    '."\n"; +print '
    '."\n"; // Line for filters fields @@ -299,33 +299,33 @@ if (! empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) // Ref if (! empty($arrayfields['d.ref']['checked'])) { - print ''; } // Type if (! empty($arrayfields['d.fk_type']['checked'])) { - print ''; } if (! empty($arrayfields['d.lastname']['checked'])) { - print ''; } if (! empty($arrayfields['d.firstname']['checked'])) { - print ''; } if (! empty($arrayfields['d.login']['checked'])) { - print ''; } @@ -529,13 +529,13 @@ while ($i < min($num, $limit)) // Date start if (! empty($arrayfields['c.dateadh']['checked'])) { - print '\n"; + print '\n"; if (! $i) $totalarray['nbfield']++; } // Date end if (! empty($arrayfields['c.datef']['checked'])) { - print '\n"; + print '\n"; if (! $i) $totalarray['nbfield']++; } // Price @@ -555,7 +555,7 @@ while ($i < min($num, $limit)) // Date creation if (! empty($arrayfields['c.datec']['checked'])) { - print ''; if (! $i) $totalarray['nbfield']++; @@ -563,13 +563,13 @@ while ($i < min($num, $limit)) // Date modification if (! empty($arrayfields['c.tms']['checked'])) { - print ''; if (! $i) $totalarray['nbfield']++; } // Action column - print ' - - + + '; print ''; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; print ''; print "\n"; @@ -277,9 +277,9 @@ if (! $rowid && $action != 'create' && $action != 'edit') //'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.' print ''; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; - print ''; - print ''; print ''; - print ''; print ''; @@ -663,7 +663,7 @@ if ($rowid > 0) // Date end subscription if ($datefin) { - print ''; +print ''; +print ''; + print '
    '; + print ''; print ''; + print ''; print ''; print''; + print ''; print ''; + print ''; print ''; + print ''; print ''.dol_print_date($db->jdate($obj->dateadh), 'day')."'.dol_print_date($db->jdate($obj->dateadh), 'day')."'.dol_print_date($db->jdate($obj->datef), 'day')."'.dol_print_date($db->jdate($obj->datef), 'day')."'; + print ''; print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); print ''; + print ''; print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); print ''; + print ''; if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined { $selected=0; diff --git a/htdocs/adherents/tpl/linkedobjectblock.tpl.php b/htdocs/adherents/tpl/linkedobjectblock.tpl.php index 622d20f7d42..e85eed336fb 100644 --- a/htdocs/adherents/tpl/linkedobjectblock.tpl.php +++ b/htdocs/adherents/tpl/linkedobjectblock.tpl.php @@ -44,8 +44,8 @@ foreach($linkedObjectBlock as $key => $objectlink)
    trans("Subscription"); ?> getNomUrl(1); ?>dateh, 'day'); ?>dateh, 'day'); ?> rights->adherent->lire) { $total = $total + $objectlink->amount; diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 2f4040b254f..72ea99ff18d 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -232,7 +232,7 @@ if (! $rowid && $action != 'create' && $action != 'edit') $newcardbutton=''; if ($user->rights->adherent->configurer) { - $newcardbutton=''.$langs->trans('NewMemberType').''; + $newcardbutton=''.$langs->trans('NewMemberType').''; $newcardbutton.= ''; $newcardbutton.= ''; } @@ -256,9 +256,9 @@ if (! $rowid && $action != 'create' && $action != 'edit') print '
    '.$langs->trans("Ref").''.$langs->trans("Label").''.$langs->trans("SubscriptionRequired").''.$langs->trans("VoteAllowed").''.$langs->trans("Status").''.$langs->trans("SubscriptionRequired").''.$langs->trans("VoteAllowed").''.$langs->trans("Status").' 
    '.dol_escape_htmltag($objp->label).''.yn($objp->subscription).''.yn($objp->vote).''; + print ''.yn($objp->subscription).''.yn($objp->vote).''; if ( !empty($objp->statut) ) { print img_picto($langs->trans("InActivity"), 'statut4'); } else { @@ -586,15 +586,15 @@ if ($rowid > 0) // Lignes des champs de filtre print '
    '; + print ''; print ''; + print ''; print ' '; + print ''; print ' '; + print ''; if ($datefin < dol_now() && $objp->statut > 0) { print dol_print_date($datefin, 'day')." ".img_warning($langs->trans("SubscriptionLate")); @@ -676,7 +676,7 @@ if ($rowid > 0) } else { - print ''; + print ''; if ($objp->subscription == 'yes') { print $langs->trans("SubscriptionNotReceived"); @@ -690,7 +690,7 @@ if ($rowid > 0) } // Actions - print ''; + print ''; if ($user->rights->adherent->creer) { print ''.img_edit().''; diff --git a/htdocs/admin/dav.php b/htdocs/admin/dav.php index 1ab783474b8..894706576b5 100644 --- a/htdocs/admin/dav.php +++ b/htdocs/admin/dav.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2008-2019 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -36,7 +36,8 @@ $action = GETPOST('action', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha'); $arrayofparameters=array( - 'DAV_ALLOW_PUBLIC_DIR'=>array('css'=>'minwidth200', 'enabled'=>1), + 'DAV_ALLOW_PRIVATE_DIR'=>array('css'=>'minwidth200', 'enabled'=>2), + 'DAV_ALLOW_PUBLIC_DIR'=>array('css'=>'minwidth200', 'enabled'=>1), 'DAV_ALLOW_ECM_DIR'=>array('css'=>'minwidth200', 'enabled'=>$conf->ecm->enabled) ); @@ -84,7 +85,11 @@ if ($action == 'edit') print '
    '; print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip')); print ''; - if ($key == 'DAV_ALLOW_PUBLIC_DIR' || $key == 'DAV_ALLOW_ECM_DIR') + if ($key == 'DAV_ALLOW_PRIVATE_DIR') + { + print $langs->trans("AlwaysActive"); + } + elseif ($key == 'DAV_ALLOW_PUBLIC_DIR' || $key == 'DAV_ALLOW_ECM_DIR') { print $form->selectyesno($key, $conf->global->$key, 1); } @@ -114,7 +119,11 @@ else print '
    '; print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip')); print ''; - if ($key == 'DAV_ALLOW_PUBLIC_DIR' || $key == 'DAV_ALLOW_ECM_DIR') + if ($key == 'DAV_ALLOW_PRIVATE_DIR') + { + print $langs->trans("AlwaysActive"); + } + elseif ($key == 'DAV_ALLOW_PUBLIC_DIR' || $key == 'DAV_ALLOW_ECM_DIR') { print yn($conf->global->$key); } diff --git a/htdocs/admin/debugbar.php b/htdocs/admin/debugbar.php index 34cc06c5f08..b6002d1a4df 100644 --- a/htdocs/admin/debugbar.php +++ b/htdocs/admin/debugbar.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2005-2019 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2007 Rodolphe Quiedeville * Copyright (C) 2013 Juanjo Menent @@ -47,8 +47,9 @@ if ($action == 'set') { $db->begin(); - $result = dolibarr_set_const($db, "DEBUGBAR_LOGS_LINES_NUMBER", GETPOST('DEBUGBAR_LOGS_LINES_NUMBER', 'int'), 'chaine', 0, '', 0); - if ($result < 0) + $result1 = dolibarr_set_const($db, "DEBUGBAR_LOGS_LINES_NUMBER", GETPOST('DEBUGBAR_LOGS_LINES_NUMBER', 'int'), 'chaine', 0, '', 0); + $result2 = dolibarr_set_const($db, "DEBUGBAR_USE_LOG_FILE", GETPOST('DEBUGBAR_USE_LOG_FILE', 'int'), 'chaine', 0, '', 0); + if ($result1 < 0 || $result2 < 0) { $error++; } @@ -61,7 +62,7 @@ if ($action == 'set') else { $db->rollback(); - setEventMessages($error, $errors, 'errors'); + setEventMessages($error, null, 'errors'); } } @@ -96,6 +97,12 @@ print '
    '.$langs->trans("DEBUGBAR_USE_LOG_FILE").''; +print $form->selectyesno('DEBUGBAR_USE_LOG_FILE', $conf->global->DEBUGBAR_USE_LOG_FILE, 1); +print ' '.$langs->trans("UsingLogFileShowAllRecordOfSubrequestButIsSlower"); +print '
    '; print "\n"; diff --git a/htdocs/admin/defaultvalues.php b/htdocs/admin/defaultvalues.php index c2559e0e2bf..8e4334c6214 100644 --- a/htdocs/admin/defaultvalues.php +++ b/htdocs/admin/defaultvalues.php @@ -207,7 +207,7 @@ else print load_fiche_titre($langs->trans("DefaultValues"), $enabledisablehtml, 'title_setup'); -print $langs->trans("DefaultValuesDesc")."
    \n"; +print ''.$langs->trans("DefaultValuesDesc")."
    \n"; print "
    \n"; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 541262b2bf5..ae4fde1876b 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -4,7 +4,7 @@ * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005-2017 Regis Houssin * Copyright (C) 2010-2016 Juanjo Menent - * Copyright (C) 2011-2015 Philippe Grand + * Copyright (C) 2011-2019 Philippe Grand * Copyright (C) 2011 Remy Younes * Copyright (C) 2012-2015 Marcos García * Copyright (C) 2012 Christophe Battarel @@ -370,7 +370,7 @@ $tabfieldinsert[35]= "label"; $tabfieldinsert[36]= "range_ik,fk_c_exp_tax_cat"; $tabfieldinsert[37]= "code,label,short_label,unit_type,scale"; -// Nom du rowid si le champ n'est pas de type autoincrement +// Rowid name if the field is not autoincrement type // Example: "" if id field is "rowid" and has autoincrement on // "nameoffield" if id field is not "rowid" or has not autoincrement on $tabrowid=array(); @@ -703,12 +703,12 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) $_POST["code"]=preg_replace('/\s/', '', $_POST["code"]); } - // Si verif ok et action add, on ajoute la ligne + // If check ok and action add, add the line if ($ok && GETPOST('actionadd')) { if ($tabrowid[$id]) { - // Recupere id libre pour insertion + // Get free id for insert $newid=0; $sql = "SELECT max(".$tabrowid[$id].") newid from ".$tabname[$id]; $result = $db->query($sql); @@ -771,7 +771,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) } } - // Si verif ok et action modify, on modifie la ligne + // If verif ok and action modify, modify the line if ($ok && GETPOST('actionmodify')) { if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; } @@ -1382,7 +1382,7 @@ if ($id) $withentity = fieldList($fieldlist, $obj, $tabname[$id], 'edit'); } - print '
    '; + print ''; print '
    '; print ''; print ''; @@ -1549,7 +1549,7 @@ if ($id) $valuetoshow = ($obj->code && $key != 'SizeUnit'.strtolower($obj->unit) ? $key : $obj->{$fieldlist[$field]}); } elseif ($fieldlist[$field]=='localtax1' || $fieldlist[$field]=='localtax2') { - $align="center"; + $class="center"; } elseif ($fieldlist[$field]=='localtax1_type') { if ($obj->localtax1 != 0) @@ -1644,14 +1644,14 @@ if ($id) // Only activated on country dictionary if ($id == 4) { - print '
    '; + print ''; if ($iserasable) print ''.$actl[$obj->favorite].''; else print $langs->trans("AlwaysActive"); print ''; + print ''; if ($canbedisabled) print ''.$actl[$obj->active].''; else { @@ -1669,7 +1669,7 @@ if ($id) // Delete link if ($iserasable) { - print ''; + print ''; if ($user->admin) print ''.img_delete().''; //else print ''.img_delete().''; // Some dictionary can be edited by other profile than admin print ''; + if ($fieldlist[$field] == 'type_cdr') print ''; else print ''; if ($fieldlist[$field] == 'type_cdr') { print $form->selectarray($fieldlist[$field], array(0=>$langs->trans('None'), 1=>$langs->trans('AtEndOfMonth'), 2=>$langs->trans('CurrentNext')), (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'')); @@ -1884,7 +1884,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') elseif (in_array($fieldlist[$field], array('nbjour','decalage','taux','localtax1','localtax2'))) { $align="left"; if (in_array($fieldlist[$field], array('taux','localtax1','localtax2'))) $align="center"; // Fields aligned on right - print ''; + print ''; print ''; print ''; + print ''; print $form->selectarray($fieldlist[$field], $localtax_typeList, (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'')); print '
    '.$newapp.$images.'

    '.$product->name->language[$this->lang] +

    '.$newapp.$images.'

    '.$product->name->language[$this->lang - 1] .'
    '.$version.'

    - '.dol_print_date(dol_stringtotime($product->date_upd), 'dayhour').' - '.$langs->trans('Ref').': '.$product->reference.' - '.$langs->trans('Id').': '.$product->id.'

    '.$product->description_short->language[$this->lang].'
    '.$price.' + '.dol_print_date(dol_stringtotime($product->date_upd), 'dayhour').' - '.$langs->trans('Ref').': '.$product->reference.' - '.$langs->trans('Id').': '.$product->id.'

    '.$product->description_short->language[$this->lang - 1].'
    '.$price.' '.$download_link.'
    '; - $arrayoftypes=array('from'=>'MailFrom', 'to'=>'MailTo', 'cc'=>'Cc', 'bcc'=>'Bcc', 'subject'=>'Subject', 'body'=>'Body', 'seen'=>'AlreadyRead', 'unseen'=>'NotRead', 'withtrackingid'=>'WithDolTrackingID', 'withouttrackingid'=>'WithoutDolTrackingID'); - print $form->selectarray('filtertype', $arrayoftypes, '', 1, 0, 0, '', 1); + $arrayoftypes=array( + 'from'=>'MailFrom', + 'to'=>'MailTo', + 'cc'=>'Cc', + 'bcc'=>'Bcc', + 'subject'=>'Subject', + 'body'=>'Body', + 'X1'=>'---', + 'seen'=>'AlreadyRead', + 'unseen'=>'NotRead', + 'X2'=>'---', + 'withtrackingid'=>'WithDolTrackingID', + 'withouttrackingid'=>'WithoutDolTrackingID' + ); + print $form->selectarray('filtertype', $arrayoftypes, '', 1, 0, 0, '', 1, 0, 0, '', '', 0, '', 2); print ''; print ''; print ''.$rulefilter['rulevalue'].''; - //print $rulefilterobj->getLibStatut(3); print ' '.img_delete().''; print '
    '; + print ''; if ($conf->global->EXPEDITION_ADDON_NUMBER == "$file") { print img_picto($langs->trans("Activated"), 'switch_on'); @@ -285,7 +285,7 @@ foreach ($dirmodels as $reldir) } } - print ''; + print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); print '
    '; print ''; print ''; print ''; -print ''; -print ''; -print ''; -print ''; +print ''; +print ''; +print ''; +print ''; print "\n"; clearstatcache(); @@ -391,7 +391,7 @@ foreach ($dirmodels as $reldir) // Active if (in_array($name, $def)) { - print '"; } // Defaut - print ''; // Preview - print ''; print ''; print ''; print ''; -print ''; -print ''; +print ''; +print ''; print ''."\n"; clearstatcache(); @@ -260,7 +260,7 @@ foreach ($dirmodels as $reldir) else print $tmp; print ''."\n"; - print ''; @@ -339,10 +339,10 @@ print '
    '.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Status").''.$langs->trans("Default").''.$langs->trans("ShortInfo").''.$langs->trans("Preview").''.$langs->trans("Status").''.$langs->trans("Default").''.$langs->trans("ShortInfo").''.$langs->trans("Preview").'
    '."\n"; + print ''."\n"; print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; @@ -399,13 +399,13 @@ foreach ($dirmodels as $reldir) } else { - print ''."\n"; + print ''."\n"; print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print "'; + print ''; if ($conf->global->EXPEDITION_ADDON_PDF == $name) { print img_picto($langs->trans("Default"), 'on'); @@ -430,12 +430,12 @@ foreach ($dirmodels as $reldir) $htmltooltip.='
    '.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1); $htmltooltip.='
    '.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1); - print '
    '; + print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); print ''; + print ''; if ($module->type == 'pdf') { print 'scandir.'&label='.urlencode($module->name).'">'.img_object($langs->trans("Preview"), 'sending').''; diff --git a/htdocs/admin/expensereport.php b/htdocs/admin/expensereport.php index 687e3fdf1e2..cac83ef8d8b 100644 --- a/htdocs/admin/expensereport.php +++ b/htdocs/admin/expensereport.php @@ -216,8 +216,8 @@ print '
    '.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Example").''.$langs->trans("Status").''.$langs->trans("ShortInfo").''.$langs->trans("Status").''.$langs->trans("ShortInfo").'
    '; + print ''; if ($conf->global->EXPENSEREPORT_ADDON == $file) { print img_picto($langs->trans("Activated"), 'switch_on'); @@ -291,7 +291,7 @@ foreach ($dirmodels as $reldir) } } - print ''; + print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); print '
    '; print ''; print ''; print ''; -print '\n"; -print '\n"; -print ''; -print ''; +print '\n"; +print '\n"; +print ''; +print ''; print "\n"; clearstatcache(); @@ -393,7 +393,7 @@ foreach ($dirmodels as $reldir) // Active if (in_array($name, $def)) { - print ""; } // Default - print "'; // Preview - print ''; print ''; print ''; print ''; -print ''; -print ''; +print ''; +print ''; print ''."\n"; clearstatcache(); @@ -344,7 +344,7 @@ foreach ($dirmodels as $reldir) else print $tmp; print ''."\n"; - print ''; - if ($action != 'editconditions' && ! empty($object->brouillon)) print ''; + if ($action != 'editconditions' && $object->statut == Expedition::STATUS_VALIDATED) print ''; print '
    '.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Status")."'.$langs->trans("Default")."'.$langs->trans("ShortInfo").''.$langs->trans("Preview").''.$langs->trans("Status")."'.$langs->trans("Default")."'.$langs->trans("ShortInfo").''.$langs->trans("Preview").'
    \n"; + print ''."\n"; print 'scandir.'&label='.urlencode($module->name).'">'; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; @@ -401,13 +401,13 @@ foreach ($dirmodels as $reldir) } else { - print "\n"; + print ''."\n"; print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; + print ''; if ($conf->global->EXPENSEREPORT_ADDON_PDF == "$name") { print img_picto($langs->trans("Default"), 'on'); @@ -428,12 +428,12 @@ foreach ($dirmodels as $reldir) $htmltooltip.='
    '.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1); $htmltooltip.='
    '.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1); $htmltooltip.='
    '.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1); - print '
    '; + print ''; print $form->textwithpicto('', $htmltooltip, -1, 0); print ''; + print ''; if ($module->type == 'pdf') { print ''.img_object($langs->trans("Preview"), 'intervention').''; @@ -472,7 +472,7 @@ print load_fiche_titre($langs->trans("OtherOptions"), '', ''); print ''; print ''; print ''; -print ''; +print ''; print "\n"; $substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2); diff --git a/htdocs/admin/export.php b/htdocs/admin/export.php index b477a75256b..c61cf4f81a2 100644 --- a/htdocs/admin/export.php +++ b/htdocs/admin/export.php @@ -51,48 +51,52 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; * View */ +$form=new Form($db); + $page_name = "ExportSetup"; llxHeader('', $langs->trans($page_name)); // Subheader -$linkback = '' - . $langs->trans("BackToModuleList") . ''; +$linkback = '' . $langs->trans("BackToModuleList") . ''; + print load_fiche_titre($langs->trans($page_name), $linkback); -// Configuration header +//$head = export_admin_prepare_head(); +$h=0; +$head = array(); +$head[$h][0] = DOL_URL_ROOT.'/admin/export.php'; +$head[$h][1] = $langs->trans("Setup"); +$head[$h][2] = 'setup'; +$h++; -dol_fiche_head( - $head, - 'settings', - $langs->trans("ExportsArea"), - 0, - "exports" -); +dol_fiche_head($head, 'setup', $langs->trans("ExportsArea"), -1, "exports"); -// Setup page goes here -$form=new Form($db); print '
    '.$langs->trans("Parameter").'
    '; print ''; -print ''."\n"; -print ''; -print ''."\n"; +print ''."\n"; +print ''; +print ''."\n"; // Example with a yes / no select print ''; -print ''; -print ''; -print ''; +print ''; +print ''; print '
    '.$langs->trans("ExportModel").' '.$langs->trans("Parameters").' 
    '.$langs->trans("set_EXPORTS_SHARE_MODELS").' '; +print ''.$langs->trans("EXPORTS_SHARE_MODELS").' '; + print '
    '; print ''; print ''; echo ajax_constantonoff('EXPORTS_SHARE_MODELS'); print '
    '; + print '
    '; +dol_fiche_end(); + // End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index b1c9df224ea..57a18afcbd3 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -284,8 +284,8 @@ print '
    '.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Example").''.$langs->trans("Status").''.$langs->trans("ShortInfo").''.$langs->trans("Status").''.$langs->trans("ShortInfo").'
    '; + print ''; //print "> ".$conf->global->FACTURE_ADDON." - ".$file; if ($conf->global->FACTURE_ADDON == $file || $conf->global->FACTURE_ADDON.'.php' == $file) { @@ -415,7 +415,7 @@ foreach ($dirmodels as $reldir) } } - print ''; + print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); if ($conf->global->FACTURE_ADDON.'.php' == $file) // If module is the one used, we show existing errors @@ -472,10 +472,10 @@ print ''; print ''; print ''; print ''; -print ''; -print ''; -print ''; -print ''; +print ''; +print ''; +print ''; +print ''; print "\n"; clearstatcache(); @@ -528,7 +528,7 @@ foreach ($dirmodels as $reldir) // Active if (in_array($name, $def)) { - print '"; } // Defaut - print "'; // Preview - print ''; } print '' . "\n"; @@ -772,7 +772,7 @@ if ($object->socid) { $remaintopay = $object->amount - $totalpaid; print ""; - print '\n"; + print '\n"; } print "
    '.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Status").''.$langs->trans("Default").''.$langs->trans("ShortInfo").''.$langs->trans("Preview").''.$langs->trans("Status").''.$langs->trans("Default").''.$langs->trans("ShortInfo").''.$langs->trans("Preview").'
    '."\n"; + print ''."\n"; print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; @@ -536,13 +536,13 @@ foreach ($dirmodels as $reldir) } else { - print "\n"; + print ''."\n"; print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("SetAsDefault"), 'switch_off').''; print ""; + print ''; if ($conf->global->FACTURE_ADDON_PDF == "$name") { print img_picto($langs->trans("Default"), 'on'); @@ -570,12 +570,12 @@ foreach ($dirmodels as $reldir) $htmltooltip.='
    '.$langs->trans("WatermarkOnDraftInvoices").': '.yn($module->option_draft_watermark, 1, 1); - print '
    '; + print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); print ''; + print ''; if ($module->type == 'pdf') { print ''.img_object($langs->trans("Preview"), 'bill').''; @@ -742,7 +742,7 @@ print load_fiche_titre($langs->trans("OtherOptions"), '', ''); print ''; print ''; print ''; -print ''; +print ''; print ''; print "\n"; @@ -752,7 +752,7 @@ print ''; print ''; print ''; } // Status @@ -568,18 +569,18 @@ print ''; print "\n"; print ''; -if (! empty($arrayfields['c.ref']['checked'])) print_liste_field_titre($arrayfields['c.ref']['label'], $_SERVER["PHP_SELF"], "c.ref", "", "$param", '', $sortfield, $sortorder); -if (! empty($arrayfields['c.ref_customer']['checked'])) print_liste_field_titre($arrayfields['c.ref_customer']['label'], $_SERVER["PHP_SELF"], "c.ref_customer", "", "$param", '', $sortfield, $sortorder); -if (! empty($arrayfields['c.ref_supplier']['checked'])) print_liste_field_titre($arrayfields['c.ref_supplier']['label'], $_SERVER["PHP_SELF"], "c.ref_supplier", "", "$param", '', $sortfield, $sortorder); -if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", "$param", '', $sortfield, $sortorder); -if (! empty($arrayfields['s.email']['checked'])) print_liste_field_titre($arrayfields['s.email']['label'], $_SERVER["PHP_SELF"], "s.email", "", "$param", '', $sortfield, $sortorder); +if (! empty($arrayfields['c.ref']['checked'])) print_liste_field_titre($arrayfields['c.ref']['label'], $_SERVER["PHP_SELF"], "c.ref", "", $param, '', $sortfield, $sortorder); +if (! empty($arrayfields['c.ref_customer']['checked'])) print_liste_field_titre($arrayfields['c.ref_customer']['label'], $_SERVER["PHP_SELF"], "c.ref_customer", "", $param, '', $sortfield, $sortorder); +if (! empty($arrayfields['c.ref_supplier']['checked'])) print_liste_field_titre($arrayfields['c.ref_supplier']['label'], $_SERVER["PHP_SELF"], "c.ref_supplier", "", $param, '', $sortfield, $sortorder); +if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder); +if (! empty($arrayfields['s.email']['checked'])) print_liste_field_titre($arrayfields['s.email']['label'], $_SERVER["PHP_SELF"], "s.email", "", $param, '', $sortfield, $sortorder); if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder); if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, '', $sortfield, $sortorder, 'center '); if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, '', $sortfield, $sortorder, 'center '); -if (! empty($arrayfields['sale_representative']['checked'])) print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", "$param", '', $sortfield, $sortorder); -if (! empty($arrayfields['c.date_contrat']['checked'])) print_liste_field_titre($arrayfields['c.date_contrat']['label'], $_SERVER["PHP_SELF"], "c.date_contrat", "", "$param", '', $sortfield, $sortorder, 'center '); +if (! empty($arrayfields['sale_representative']['checked'])) print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder); +if (! empty($arrayfields['c.date_contrat']['checked'])) print_liste_field_titre($arrayfields['c.date_contrat']['label'], $_SERVER["PHP_SELF"], "c.date_contrat", "", $param, '', $sortfield, $sortorder, 'center '); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields @@ -802,6 +803,10 @@ while ($i < min($num, $limit)) } $db->free($resql); +$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql); +$reshook=$hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; + print '
    '.$langs->trans("Parameter").''.$langs->trans("Value").''.$langs->trans("Value").' 
    '; print $langs->trans("ForceInvoiceDate"); -print ''; +print ''; print $form->selectyesno("forcedate", $conf->global->FAC_FORCE_DATE_VALIDATION, 1); print ''; print ''; @@ -828,7 +828,7 @@ print load_fiche_titre($langs->trans("Notifications"), '', ''); print ''; print ''; print ''; -print ''; +print ''; print ''; print "\n"; diff --git a/htdocs/admin/fckeditor.php b/htdocs/admin/fckeditor.php index 5b695066c58..b6e8fcf0fd2 100644 --- a/htdocs/admin/fckeditor.php +++ b/htdocs/admin/fckeditor.php @@ -148,7 +148,7 @@ else print '
    '.$langs->trans("Parameter").' 
    '; print ''; print ''; - print ''; + print ''; print "\n"; // Modules @@ -160,7 +160,7 @@ else print ''; print ''; print ''; - print ''; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; - print ''; // IP - print ''; - print ''; - print ''; @@ -279,7 +279,7 @@ if ($result) print ''; // Date - print ''; + print ''; // Code print ''; diff --git a/htdocs/admin/tools/listsessions.php b/htdocs/admin/tools/listsessions.php index bb397833ed3..08890379955 100644 --- a/htdocs/admin/tools/listsessions.php +++ b/htdocs/admin/tools/listsessions.php @@ -142,16 +142,16 @@ if ($savehandler == 'files') print ''; // ID - print ''; // Date creation - print ''; + print ''; // Date modification - print ''; + print ''; // Age print ''; diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php index cea8c4b5174..2a9983d95b1 100644 --- a/htdocs/admin/translation.php +++ b/htdocs/admin/translation.php @@ -224,14 +224,12 @@ else print load_fiche_titre($langs->trans("Translation"), $enabledisablehtml, 'title_setup'); -//print ''; -print $langs->trans("TranslationDesc")."
    \n"; -//print '
    '; -print "
    \n"; +//print ''.$langs->trans("TranslationDesc")."
    \n"; +//print "
    \n"; $current_language_code=$langs->defaultlang; $s=picto_from_langcode($current_language_code); -print $langs->trans("CurrentUserLanguage").': '.$s.' '.$current_language_code.'
    '; +print $form->textwithpicto($langs->trans("CurrentUserLanguage").': '.$s.' '.$current_language_code.'', $langs->trans("TranslationDesc")).'
    '; print '
    '; diff --git a/htdocs/asset/document.php b/htdocs/asset/document.php index 3359d5539b5..61be1ad51d6 100644 --- a/htdocs/asset/document.php +++ b/htdocs/asset/document.php @@ -117,7 +117,7 @@ if ($object->id) print '
    '; print '
    '; - print '
    '.$langs->trans("ActivateFCKeditor").''.$langs->trans("Action").''.$langs->trans("Action").'
    '.img_object("", $picto[$const]).''.$langs->trans($desc).''; + print ''; $constante = 'FCKEDITOR_ENABLE_'.$const; $value = (isset($conf->global->$constante)?$conf->global->$constante:0); if ($value == 0) diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index 612883dac38..0d6ac348413 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -217,7 +217,7 @@ $formadmin=new FormAdmin($db); print load_fiche_titre($langs->trans("GUISetup"), '', 'title_setup'); -print $langs->trans("DisplayDesc")."
    \n"; +print ''.$langs->trans("DisplayDesc")."
    \n"; print "
    \n"; diff --git a/htdocs/admin/index.php b/htdocs/admin/index.php index bce8c560d7c..9e0acb0ff62 100644 --- a/htdocs/admin/index.php +++ b/htdocs/admin/index.php @@ -37,11 +37,11 @@ $hookmanager->initHooks(array('homesetup')); * View */ +$form = new Form($db); + $wikihelp='EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones'; llxHeader('', $langs->trans("Setup"), $wikihelp); -$form = new Form($db); - print load_fiche_titre($langs->trans("SetupArea"), '', 'title_setup.png'); @@ -68,7 +68,7 @@ if (! empty($conf->global->MAIN_MOTD_SETUPPAGE)) } } -print $langs->trans("SetupDescription1").' '; +print $langs->trans("SetupDescription1"); print $langs->trans("AreaForAdminOnly").' '; print $langs->trans("SetupDescription2", $langs->transnoentities("MenuCompanySetup"), $langs->transnoentities("Modules"))."

    "; @@ -100,8 +100,8 @@ print '
    '.$moreinfo; if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)?1:$conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) // If only user module enabled { $langs->load("errors"); - $warnpicto=img_warning($langs->trans("WarningMandatorySetupNotComplete"), 'style="padding-right: 6px;"'); - print '
    '; + $warnpicto=img_warning($langs->trans("WarningEnableYourModulesApplications"), 'style="padding-right: 6px;"'); + print '
    '; } print '
    '; print '
    '; @@ -115,7 +115,7 @@ print $hookmanager->resPrint; if (empty($reshook)) { // Show into other - print $langs->trans("SetupDescription5")."
    "; + print ''.$langs->trans("SetupDescription5")."
    "; print "
    "; // Show logo diff --git a/htdocs/admin/menus/index.php b/htdocs/admin/menus/index.php index 5283d9a3aca..310322aa44c 100644 --- a/htdocs/admin/menus/index.php +++ b/htdocs/admin/menus/index.php @@ -256,7 +256,7 @@ if ($action == 'delete') $newcardbutton=''; if ($user->admin) { - $newcardbutton=''.$langs->trans('New').''; + $newcardbutton=''.$langs->trans('New').''; $newcardbutton.= ''; $newcardbutton.= ''; } diff --git a/htdocs/admin/menus/other.php b/htdocs/admin/menus/other.php index cda216a452b..5b1cb8e5f4b 100644 --- a/htdocs/admin/menus/other.php +++ b/htdocs/admin/menus/other.php @@ -84,13 +84,13 @@ dol_fiche_head($head, 'misc', $langs->trans("Menus"), -1); print ''; print ''; print ''; -print ''; +print ''; print ''; // Hide unauthorized menu print ''; print ''; -print ''; print ''."\n"; print ''."\n"; - if (empty($conf->multicompany->enabled) || !$user->entity) print ''."\n"; // If superadmin or multicompany disabled + if (empty($conf->multicompany->enabled) || !$user->entity) print ''."\n"; // If superadmin or multicompany disabled print "\n"; $i++; diff --git a/htdocs/admin/system/filecheck.php b/htdocs/admin/system/filecheck.php index 94d8909e063..9d7d10b932a 100644 --- a/htdocs/admin/system/filecheck.php +++ b/htdocs/admin/system/filecheck.php @@ -171,8 +171,8 @@ if (! $error && $xml) $out.=''; $out.=''; $out.=''; - $out.=''; - $out.=''; + $out.=''; + $out.=''; $out.=''."\n"; $i = 0; @@ -192,8 +192,8 @@ if (! $error && $xml) $out.=''; $out.='' . "\n"; $out.='' . "\n"; - $out.='' . "\n"; - $out.='' . "\n"; + $out.='' . "\n"; + $out.='' . "\n"; $out.="\n"; } @@ -239,7 +239,7 @@ if (! $error && $xml) $out.=''; $out.=''; $out.=''; - $out.=''; + $out.=''; $out.=''."\n"; $tmpfilelist = dol_sort_array($file_list['missing'], 'filename'); if (is_array($tmpfilelist) && count($tmpfilelist)) @@ -251,7 +251,7 @@ if (! $error && $xml) $out.=''; $out.='' . "\n"; $out.='' . "\n"; - $out.='' . "\n"; + $out.='' . "\n"; $out.="\n"; } } @@ -273,8 +273,8 @@ if (! $error && $xml) $out.=''; $out.=''; $out.=''; - $out.=''; - $out.=''; + $out.=''; + $out.=''; $out.=''; $out.=''; $out.=''."\n"; @@ -288,8 +288,8 @@ if (! $error && $xml) $out.=''; $out.='' . "\n"; $out.='' . "\n"; - $out.='' . "\n"; - $out.='' . "\n"; + $out.='' . "\n"; + $out.='' . "\n"; $size = dol_filesize(DOL_DOCUMENT_ROOT.'/'.$file['filename']); $totalsize += $size; $out.='' . "\n"; @@ -299,8 +299,8 @@ if (! $error && $xml) $out.=''; $out.='' . "\n"; $out.='' . "\n"; - $out.='' . "\n"; - $out.='' . "\n"; + $out.='' . "\n"; + $out.='' . "\n"; $out.='' . "\n"; $out.='' . "\n"; $out.="\n"; @@ -323,8 +323,8 @@ if (! $error && $xml) $out.=''; $out.=''; $out.=''; - $out.=''; - $out.=''; + $out.=''; + $out.=''; $out.=''; $out.=''; $out.=''."\n"; @@ -343,8 +343,8 @@ if (! $error && $xml) $out.=' '.$form->textwithpicto('', $htmltext, 1, 'help', '', 0, 2, 'helprm'.$i); } $out.='' . "\n"; - $out.='' . "\n"; - $out.='' . "\n"; + $out.='' . "\n"; + $out.='' . "\n"; $size = dol_filesize(DOL_DOCUMENT_ROOT.'/'.$file['filename']); $totalsize += $size; $out.='' . "\n"; @@ -354,8 +354,8 @@ if (! $error && $xml) $out.=''; $out.='' . "\n"; $out.='' . "\n"; - $out.='' . "\n"; - $out.='' . "\n"; + $out.='' . "\n"; + $out.='' . "\n"; $out.='' . "\n"; $out.='' . "\n"; $out.="\n"; diff --git a/htdocs/admin/system/modules.php b/htdocs/admin/system/modules.php index 7c713749b55..3269542a7bf 100644 --- a/htdocs/admin/system/modules.php +++ b/htdocs/admin/system/modules.php @@ -107,7 +107,7 @@ print '
    '.$langs->trans("Parameters").''.$langs->trans("Status").''.$langs->trans("Status").'
    '.$langs->trans("HideUnauthorizedMenu").''; +print ''; if (empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED)) { print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index c735362d87f..d06f5d393d9 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -888,7 +888,8 @@ if ($mode == 'marketplace') { // $options is array with filter criterias //var_dump($options); - $dolistore->getRemoteData($options); + $dolistore->getRemoteCategories(); + $dolistore->getRemoteProducts($options); print ''.$langs->trans('DOLISTOREdescriptionLong').'

    '; diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index 3c9611ca7f0..0bbdf9eefdf 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -115,7 +115,7 @@ $arraydetailsforpdffoot = array( print load_fiche_titre($langs->trans("PDF"), '', 'title_setup'); -print $langs->trans("PDFDesc")."
    \n"; +print ''.$langs->trans("PDFDesc")."
    \n"; print "
    \n"; $noCountryCode = (empty($mysoc->country_code) ? true : false); diff --git a/htdocs/admin/system/dolibarr.php b/htdocs/admin/system/dolibarr.php index da27efd9dc6..6cb56b4490e 100644 --- a/htdocs/admin/system/dolibarr.php +++ b/htdocs/admin/system/dolibarr.php @@ -446,7 +446,7 @@ if ($resql) print '
    '.$obj->name.''.dol_escape_htmltag($obj->value).''.$obj->entity.''.$obj->entity.'
    #' . $langs->trans("Constant") . '' . $langs->trans("ExpectedValue") . '' . $langs->trans("Value") . '' . $langs->trans("ExpectedValue") . '' . $langs->trans("Value") . '
    '.$i.''.$constname.''.$constvalue.''.$valueforchecksum.''.$constvalue.''.$valueforchecksum.'
    #' . $langs->trans("Filename") . '' . $langs->trans("ExpectedChecksum") . '' . $langs->trans("ExpectedChecksum") . '
    '.$i.''.$file['filename'].''.$file['expectedmd5'].''.$file['expectedmd5'].'
    #' . $langs->trans("Filename") . '' . $langs->trans("ExpectedChecksum") . '' . $langs->trans("CurrentChecksum") . '' . $langs->trans("ExpectedChecksum") . '' . $langs->trans("CurrentChecksum") . '' . $langs->trans("Size") . '' . $langs->trans("DateModification") . '
    '.$i.''.$file['filename'].''.$file['expectedmd5'].''.$file['md5'].''.$file['expectedmd5'].''.$file['md5'].''.dol_print_size($size).'
    '.$langs->trans("Total").''.dol_print_size($totalsize).'
    #' . $langs->trans("Filename") . '' . $langs->trans("ExpectedChecksum") . '' . $langs->trans("CurrentChecksum") . '' . $langs->trans("ExpectedChecksum") . '' . $langs->trans("CurrentChecksum") . '' . $langs->trans("Size") . '' . $langs->trans("DateModification") . '
    '.$file['expectedmd5'].''.$file['md5'].''.$file['expectedmd5'].''.$file['md5'].''.dol_print_size($size).'
    '.$langs->trans("Total").''.dol_print_size($totalsize).'
    '; print ''; print ''; print ''; -print ''; +print ''; print ''; print ''; $var=false; @@ -134,7 +134,7 @@ foreach($sortorder as $numero=>$name) // Version print ''; // Id - print ''; + print ''; // Permissions if ($modules[$numero]->rights) { diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php index 82f73b8066c..fb9eababad8 100644 --- a/htdocs/admin/tools/dolibarr_export.php +++ b/htdocs/admin/tools/dolibarr_export.php @@ -446,7 +446,7 @@ print "\n";
    -
    " id="buttonGo" />

    @@ -575,7 +575,7 @@ print "\n"; ?>
    -
    " id="buttonGo" />

    diff --git a/htdocs/admin/tools/eaccelerator.php b/htdocs/admin/tools/eaccelerator.php index 830499f2c59..61ae6bcf17f 100644 --- a/htdocs/admin/tools/eaccelerator.php +++ b/htdocs/admin/tools/eaccelerator.php @@ -173,10 +173,10 @@ function create_script_table($list) foreach($list as $script) { print '
    '; print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; print ''; } print '
    '.$langs->trans("Modules").''.$langs->trans("Version").''.$langs->trans("IdModule").''.$langs->trans("IdModule").''.$langs->trans("IdPermissions").'
    '.$modules[$numero]->getVersion().''.$numero.''.$numero.'
    '.dol_trunc($script['file'], 80, 'left').''.dol_print_date($script['mtime'], 'dayhour').''.number_format($script['size'] / 1024, 2).'KB'.$script['reloads'].' ('.$script['usecount'].')'.$script['hits'].''.dol_print_date($script['mtime'], 'dayhour').''.number_format($script['size'] / 1024, 2).'KB'.$script['reloads'].' ('.$script['usecount'].')'.$script['hits'].'
    '; @@ -203,9 +203,9 @@ function create_key_table($list) foreach($list as $key) { print '
    '.dol_trunc($key['name'], 80, 'left').''.dol_print_date($key['created'], 'dayhour').''.number_format($key['size']/1024, 3).'KB'; + print ''.dol_print_date($key['created'], 'dayhour').''.number_format($key['size']/1024, 3).'KB'; if ($key['ttl'] == -1) { print 'expired'; } elseif ($key['ttl'] == 0) { diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php index ab9a86b614f..987f965576a 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -238,20 +238,20 @@ if ($result) print ''.$form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0).''; + print ''; print ''; print ''; + print ''; print ''; print ''; + print ''; print ''; print ''; + print ''; //print ''; print '
    '.dol_print_date($db->jdate($obj->dateevent), '%Y-%m-%d %H:%M:%S').''.dol_print_date($db->jdate($obj->dateevent), '%Y-%m-%d %H:%M:%S').''.$obj->type.''.$sessionentry['login'].''; + print ''; if ("$key" == session_id()) print $form->textwithpicto($key, $langs->trans("YourSession")); else print $key; print ''.dol_print_date($sessionentry['creation'], '%Y-%m-%d %H:%M:%S').''.dol_print_date($sessionentry['creation'], '%Y-%m-%d %H:%M:%S').''.dol_print_date($sessionentry['modification'], '%Y-%m-%d %H:%M:%S').''.dol_print_date($sessionentry['modification'], '%Y-%m-%d %H:%M:%S').''.$sessionentry['age'].'
    '; + print '
    '; // Number of files print ''; diff --git a/htdocs/bom/bom_list.php b/htdocs/bom/bom_list.php index baa2ced0c4a..3b3b5ac9e15 100644 --- a/htdocs/bom/bom_list.php +++ b/htdocs/bom/bom_list.php @@ -316,13 +316,13 @@ print ''; $newcardbutton=''; //if ($user->rights->bom->creer) //{ - $newcardbutton=''.$langs->trans('New').''; + $newcardbutton=''.$langs->trans('New').''; $newcardbutton.= ''; $newcardbutton.= ''; //} //else //{ -// $newcardbutton=''.$langs->trans('New'); +// $newcardbutton=''.$langs->trans('New').''; // $newcardbutton.= ''; // $newcardbutton.= ''; //} diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index a4b70660c7f..9646b5d0d2e 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -604,7 +604,7 @@ class BOM extends CommonObject */ public function setDraft($user) { - global $conf,$langs; + global $conf, $langs; $error=0; @@ -630,6 +630,11 @@ class BOM extends CommonObject dol_syslog(get_class($this)."::setDraft", LOG_DEBUG); if ($this->db->query($sql)) { + if (! $error) + { + $this->oldcopy= clone $this; + } + if (!$error) { // Call trigger $result=$this->call_trigger('BOM_UNVALIDATE', $user); @@ -640,7 +645,7 @@ class BOM extends CommonObject $this->status=self::STATUS_DRAFT; $this->db->commit(); return 1; - }else { + } else { $this->db->rollback(); return -1; } diff --git a/htdocs/bookmarks/class/bookmark.class.php b/htdocs/bookmarks/class/bookmark.class.php index eb1342ad119..c9650cc854e 100644 --- a/htdocs/bookmarks/class/bookmark.class.php +++ b/htdocs/bookmarks/class/bookmark.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2015 Marcos García + * Copyright (C) 2015 Marcos García * * 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 @@ -64,6 +64,11 @@ class Bookmark extends CommonObject */ public $fk_user; + /** + * Date creation record (datec) + * + * @var integer + */ public $datec; public $url; diff --git a/htdocs/bookmarks/list.php b/htdocs/bookmarks/list.php index fba3e58baeb..17e23f0cadb 100644 --- a/htdocs/bookmarks/list.php +++ b/htdocs/bookmarks/list.php @@ -84,7 +84,7 @@ llxHeader('', $langs->trans("ListOfBookmarks")); $newcardbutton=''; if ($user->rights->bookmark->creer) { - $newcardbutton=''.$langs->trans('NewBookmark').''; + $newcardbutton=''.$langs->trans('NewBookmark').''; $newcardbutton.= ''; $newcardbutton.= ''; } diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index ce98dcbb6fc..971fcd30f0c 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -65,7 +65,7 @@ $arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css') llxHeader('', $title, '', '', 0, 0, $arrayofjs, $arrayofcss); -$newcardbutton = ''.$langs->trans("NewCategory").''; +$newcardbutton = ''.$langs->trans("NewCategory").''; $newcardbutton.= ''; $newcardbutton.= ''; diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index c6a4c3d225c..5654b3cb37f 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -903,7 +903,7 @@ if ($action == 'create') $numproject=$formproject->select_projects((! empty($societe->id)?$societe->id:-1), $projectid, 'projectid', 0, 0, 1, 1); - print '   '.$langs->trans("AddProject").' '; + print '   '.$langs->trans("AddProject").''; $urloption='?action=create'; $url = dol_buildpath('comm/action/card.php', 2).$urloption; @@ -1301,7 +1301,7 @@ if ($id > 0) $numprojet=$formproject->select_projects(($object->socid > 0 ? $object->socid : -1), $object->fk_project, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0); if ($numprojet==0) { - print '   '.$langs->trans("AddProject").' '; + print '   '.$langs->trans("AddProject").''; } print ''; } diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index ded7d4fd238..9869248a760 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -435,7 +435,7 @@ if ($resql) //$param='month='.$monthshown.'&year='.$year; $hourminsec='100000'; - $newcardbutton = ''.$langs->trans("AddAction").''; + $newcardbutton = ''.$langs->trans("AddAction").''; $newcardbutton.= ''; $newcardbutton.= ''; } diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 2ed25c9dd55..e5ade3fdf55 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -367,7 +367,7 @@ if ($user->rights->agenda->myactions->create || $user->rights->agenda->allaction //$param='month='.$monthshown.'&year='.$year; $hourminsec='100000'; - $newcardbutton = ''.$langs->trans("AddAction").''; + $newcardbutton = ''.$langs->trans("AddAction").''; $newcardbutton.= ''; $newcardbutton.= ''; } diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index c4ec266d454..384727d60b0 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -110,7 +110,7 @@ if (empty($reshook)) if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); } - // conditions de reglement + // terms of the settlement if ($action == 'setconditions' && $user->rights->societe->creer) { $object->fetch($id); @@ -317,7 +317,7 @@ if ($object->id > 0) print $object->tva_intra; print ''; - // Conditions de reglement par defaut + // default terms of the settlement $langs->load('bills'); print ''; - if ($action != 'editavailability' && ! empty($object->brouillon) && $usercancreate) + if ($action != 'editavailability' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) print ''; print '
    '.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
    '; print ''; } print '' . "\n"; @@ -1624,7 +1625,7 @@ if ($action == 'create') // Terms of payment print ''; // Mode of payment @@ -1677,7 +1678,7 @@ if ($action == 'create') print ''; print ''; print ''; } @@ -2047,11 +2048,11 @@ $formquestion = array_merge($formquestion, array( print '
    '; diff --git a/htdocs/comm/mailing/list.php b/htdocs/comm/mailing/list.php index 4e49b7bbbbd..54fdaef111b 100644 --- a/htdocs/comm/mailing/list.php +++ b/htdocs/comm/mailing/list.php @@ -156,7 +156,7 @@ if ($result) $newcardbutton=''; if ($user->rights->mailing->creer) { - $newcardbutton=''.$langs->trans('NewMailing').''; + $newcardbutton=''.$langs->trans('NewMailing').''; $newcardbutton.= ''; $newcardbutton.= ''; } diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 9a296def86b..4214d5fbdc4 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1039,7 +1039,8 @@ if (empty($reshook)) $desc = $prod->description; } - $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->CHANGE_ORDER_CONCAT_DESCRIPTION)); + if (!empty($product_desc) && !empty($conf->global->MAIN_NO_CONCAT_DESCRIPTION)) $desc= $product_desc; + else $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION)); // Add dimensions into product description /*if (empty($conf->global->MAIN_PRODUCT_DISABLE_AUTOADD_DIM)) @@ -1590,7 +1591,7 @@ if ($action == 'create') }); '; } - print ' '.$langs->trans("AddThirdParty").' '; + print ' '.$langs->trans("AddThirdParty").''; print '
    ' . $langs->trans('PaymentConditionsShort') . ''; - $form->select_conditions_paiements($soc->cond_reglement_id, 'cond_reglement_id'); + $form->select_conditions_paiements($soc->cond_reglement_id, 'cond_reglement_id', -1, 1); print '
    ' . $langs->trans("Project") . ''; $numprojet = $formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, 'projectid', 0, 0, 1, 1); - print '   id).'">' . $langs->trans("AddProject") . ' '; + print '   id).'">' . $langs->trans("AddProject") . ''; print '
    '; - if ($action != 'editdate' && ! empty($object->brouillon) && $usercancreate) + if ($action != 'editdate' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) print ''; print '
    '; print $langs->trans('Date'); print 'id . '">' . img_edit($langs->trans('SetDate'), 1) . '
    '; print '
    '; - if (! empty($object->brouillon) && $action == 'editdate' && $usercancreate) { + if ($object->statut == Propal::STATUS_DRAFT && $action == 'editdate' && $usercancreate) { print '
    '; print ''; print ''; @@ -2073,11 +2074,11 @@ $formquestion = array_merge($formquestion, array( print ''; - if ($action != 'editecheance' && ! empty($object->brouillon) && $usercancreate) + if ($action != 'editecheance' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) print ''; print '
    '; print $langs->trans('DateEndPropal'); print 'id . '">' . img_edit($langs->trans('SetConditions'), 1) . '
    '; print '
    '; - if (! empty($object->brouillon) && $action == 'editecheance' && $usercancreate) { + if ($object->statut == Propal::STATUS_DRAFT && $action == 'editecheance' && $usercancreate) { print ''; print ''; print ''; @@ -2101,11 +2102,11 @@ $formquestion = array_merge($formquestion, array( print ''; - if ($action != 'editconditions' && ! empty($object->brouillon) && $usercancreate) + if ($action != 'editconditions' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) print ''; print '
    '; print $langs->trans('PaymentConditionsShort'); print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetConditions'), 1) . '
    '; print '
    '; - if (! empty($object->brouillon) && $action == 'editconditions' && $usercancreate) { + if ($object->statut == Propal::STATUS_DRAFT && $action == 'editconditions' && $usercancreate) { $form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->cond_reglement_id, 'cond_reglement_id'); } else { $form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->cond_reglement_id, 'none'); @@ -2129,11 +2130,11 @@ $formquestion = array_merge($formquestion, array( if (! empty($conf->commande->enabled)) print ' (' . $langs->trans('AfterOrder') . ')'; print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetAvailability'), 1) . '
    '; print '
    '; - if (! empty($object->brouillon) && $action == 'editavailability' && $usercancreate) { + if ($object->statut == Propal::STATUS_DRAFT && $action == 'editavailability' && $usercancreate) { $form->form_availability($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->availability_id, 'availability_id', 1); } else { $form->form_availability($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->availability_id, 'none', 1); @@ -2166,11 +2167,11 @@ $formquestion = array_merge($formquestion, array( print ''; - if ($action != 'editdemandreason' && ! empty($object->brouillon) && $usercancreate) + if ($action != 'editdemandreason' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) print ''; print '
    '; print $langs->trans('Source'); print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetDemandReason'), 1) . '
    '; print '
    '; - if (! empty($object->brouillon) && $action == 'editdemandreason' && $usercancreate) { + if ($object->statut == Propal::STATUS_DRAFT && $action == 'editdemandreason' && $usercancreate) { $form->formInputReason($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->demand_reason_id, 'demand_reason_id', 1); } else { $form->formInputReason($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->demand_reason_id, 'none'); @@ -2184,11 +2185,11 @@ $formquestion = array_merge($formquestion, array( print ''; - if ($action != 'editmode' && ! empty($object->brouillon) && $usercancreate) + if ($action != 'editmode' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) print ''; print '
    '; print $langs->trans('PaymentMode'); print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMode'), 1) . '
    '; print '
    '; - if (! empty($object->brouillon) && $action == 'editmode' && $usercancreate) { + if ($object->statut == Propal::STATUS_DRAFT && $action == 'editmode' && $usercancreate) { $form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT', 1, 1); } else { $form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'none'); @@ -2204,11 +2205,11 @@ $formquestion = array_merge($formquestion, array( print ''; - if ($action != 'editmulticurrencycode' && ! empty($object->brouillon) && $usercancreate) + if ($action != 'editmulticurrencycode' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) print ''; print '
    '; print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0); print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '
    '; print '
    '; - if (! empty($object->brouillon) && $action == 'editmulticurrencycode' && $usercancreate) { + if ($object->statut == Propal::STATUS_DRAFT && $action == 'editmulticurrencycode' && $usercancreate) { $form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'multicurrency_code'); } else { $form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'none'); @@ -2221,11 +2222,11 @@ $formquestion = array_merge($formquestion, array( print ''; - if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency && $usercancreate) + if ($action != 'editmulticurrencyrate' && $object->statut == Propal::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency && $usercancreate) print ''; print '
    '; print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0); print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '
    '; print '
    '; - if (! empty($object->brouillon) && ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') && $usercancreate) { + if ($object->statut == Propal::STATUS_DRAFT && ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') && $usercancreate) { if($action == 'actualizemulticurrencyrate') { list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code); } diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index dc9bc9ea87e..388433222e0 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -439,6 +439,7 @@ class Propal extends CommonObject global $mysoc, $conf, $langs; dol_syslog(get_class($this)."::addline propalid=$this->id, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_except=$remise_percent, price_base_type=$price_base_type, pu_ttc=$pu_ttc, info_bits=$info_bits, type=$type, fk_remise_except=".$fk_remise_except); + if ($this->statut == self::STATUS_DRAFT) { include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; @@ -472,6 +473,12 @@ class Propal extends CommonObject // Check parameters if ($type < 0) return -1; + + if ($date_start && $date_end && $date_start > $date_end) { + $langs->load("errors"); + $this->error=$langs->trans('ErrorStartDateGreaterEnd'); + return -1; + } $this->db->begin(); @@ -629,7 +636,7 @@ class Propal extends CommonObject } else { - dol_syslog(get_class($this)."::addline status of order must be Draft to allow use of ->addline()", LOG_ERR); + dol_syslog(get_class($this)."::addline status of proposal must be Draft to allow use of ->addline()", LOG_ERR); return -3; } } @@ -665,7 +672,7 @@ class Propal extends CommonObject */ public function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $desc = '', $price_base_type = 'HT', $info_bits = 0, $special_code = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $type = 0, $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0) { - global $mysoc; + global $mysoc, $langs; dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise_percent=$remise_percent, txtva=$txtva, desc=$desc, price_base_type=$price_base_type, info_bits=$info_bits, special_code=$special_code, fk_parent_line=$fk_parent_line, pa_ht=$pa_ht, type=$type, date_start=$date_start, date_end=$date_end"); @@ -683,6 +690,12 @@ class Propal extends CommonObject if (empty($qty) && empty($special_code)) $special_code=3; // Set option tag if (! empty($qty) && $special_code == 3) $special_code=0; // Remove option tag if (empty($type)) $type=0; + + if ($date_start && $date_end && $date_start > $date_end) { + $langs->load("errors"); + $this->error=$langs->trans('ErrorStartDateGreaterEnd'); + return -1; + } if ($this->statut == self::STATUS_DRAFT) { @@ -2610,12 +2623,20 @@ class Propal extends CommonObject // phpcs:enable $error=0; + // Protection + if ($this->statut <= self::STATUS_DRAFT) + { + return 0; + } + + dol_syslog(get_class($this)."::setDraft", LOG_DEBUG); + $this->db->begin(); - $sql = "UPDATE ".MAIN_DB_PREFIX."propal SET fk_statut = ".self::STATUS_DRAFT; + $sql = "UPDATE ".MAIN_DB_PREFIX."propal"; + $sql.= " SET fk_statut = ".self::STATUS_DRAFT; $sql.= " WHERE rowid = ".$this->id; - dol_syslog(__METHOD__, LOG_DEBUG); $resql=$this->db->query($sql); if (!$resql) { @@ -2626,8 +2647,6 @@ class Propal extends CommonObject if (! $error) { $this->oldcopy= clone $this; - $this->statut = self::STATUS_DRAFT; - $this->brouillon = 1; } if (! $notrigger && empty($error)) @@ -2640,7 +2659,10 @@ class Propal extends CommonObject if (! $error) { - $this->db->commit(); + $this->statut = self::STATUS_DRAFT; + $this->brouillon = 1; + + $this->db->commit(); return 1; } else diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index 18d7edd1f03..4c464db4693 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -155,7 +155,7 @@ if ($object->id > 0) print '
    '; print '
    '; - print ''; + print '
    '; // Files infos print ''; diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 0b3179bd239..2a1d1b5b577 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -438,7 +438,7 @@ if ($resql) $newcardbutton=''; if ($user->rights->propal->creer) { - $newcardbutton=''.$langs->trans('NewPropal').''; + $newcardbutton=''.$langs->trans('NewPropal').''; $newcardbutton.= ''; $newcardbutton.= ''; } diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php old mode 100644 new mode 100755 index f85870bd6f1..bdd17ad217f --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -5,7 +5,7 @@ * Copyright (C) 2005-2015 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2010-2013 Juanjo Menent - * Copyright (C) 2011-2018 Philippe Grand + * Copyright (C) 2011-2019 Philippe Grand * Copyright (C) 2012-2013 Christophe Battarel * Copyright (C) 2012-2016 Marcos García * Copyright (C) 2012 Cedric Salvador @@ -868,7 +868,8 @@ if (empty($reshook)) $desc = $prod->description; } - $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->CHANGE_ORDER_CONCAT_DESCRIPTION)); + if (!empty($product_desc) && !empty($conf->global->MAIN_NO_CONCAT_DESCRIPTION)) $desc= $product_desc; + else $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION)); // Add custom code and origin country into description if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code))) { @@ -1636,7 +1637,7 @@ if ($action == 'create' && $user->rights->commande->creer) }); '; } - print ' '.$langs->trans("AddThirdParty").' '; + print ' '.$langs->trans("AddThirdParty").''; print ''; } print '' . "\n"; @@ -1674,7 +1675,7 @@ if ($action == 'create' && $user->rights->commande->creer) print $form->selectDate($datedelivery, 'liv_', '', '', '', "crea_commande", 1, 1); print ""; - // Conditions de reglement + // terms of the settlement print ''; @@ -1727,7 +1728,7 @@ if ($action == 'create' && $user->rights->commande->creer) print ''; print ''; print ''; } diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index f391d4bf0e0..b6e4010600c 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -499,16 +499,22 @@ class Commande extends CommonOrder return -1; } + dol_syslog(get_class($this)."::set_draft", LOG_DEBUG); + $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."commande"; $sql.= " SET fk_statut = ".self::STATUS_DRAFT; $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::set_draft", LOG_DEBUG); if ($this->db->query($sql)) { - // If stock is decremented on validate order, we must reincrement it + if (! $error) + { + $this->oldcopy= clone $this; + } + + // If stock is decremented on validate order, we must reincrement it if (! empty($conf->stock->enabled) && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1) { $result = 0; @@ -1069,7 +1075,7 @@ class Commande extends CommonOrder */ public function createFromClone($socid = 0) { - global $user,$hookmanager; + global $conf, $user,$hookmanager; $error=0; @@ -1079,69 +1085,88 @@ class Commande extends CommonOrder foreach($this->lines as $line) $line->fetch_optionals(); - // Load source object - $objFrom = clone $this; + // Load source object + $objFrom = clone $this; - // Change socid if needed - if (! empty($socid) && $socid != $this->socid) + // Change socid if needed + if (! empty($socid) && $socid != $this->socid) + { + $objsoc = new Societe($this->db); + + if ($objsoc->fetch($socid)>0) { - $objsoc = new Societe($this->db); - - if ($objsoc->fetch($socid)>0) - { - $this->socid = $objsoc->id; - $this->cond_reglement_id = (! empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0); - $this->mode_reglement_id = (! empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0); - $this->fk_project = 0; - $this->fk_delivery_address = 0; - } - - // TODO Change product price if multi-prices + $this->socid = $objsoc->id; + $this->cond_reglement_id = (! empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0); + $this->mode_reglement_id = (! empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0); + $this->fk_project = 0; + $this->fk_delivery_address = 0; } - $this->id=0; - $this->ref = ''; - $this->statut=self::STATUS_DRAFT; + // TODO Change product price if multi-prices + } - // Clear fields - $this->user_author_id = $user->id; - $this->user_valid = ''; - $this->date = dol_now(); - $this->date_commande = dol_now(); - $this->date_creation = ''; - $this->date_validation = ''; - $this->ref_client = ''; + $this->id=0; + $this->ref = ''; + $this->statut=self::STATUS_DRAFT; - // Create clone - $this->context['createfromclone'] = 'createfromclone'; - $result=$this->create($user); - if ($result < 0) $error++; + // Clear fields + $this->user_author_id = $user->id; + $this->user_valid = ''; + $this->date = dol_now(); + $this->date_commande = dol_now(); + $this->date_creation = ''; + $this->date_validation = ''; + if (empty($conf->global->MAIN_KEEP_REF_CUSTOMER_ON_CLONING)) $this->ref_client = ''; - if (! $error) + // Create clone + $this->context['createfromclone'] = 'createfromclone'; + $result=$this->create($user); + if ($result < 0) $error++; + + if (! $error) + { + // copy internal contacts + if ($this->copy_linked_contact($objFrom, 'internal') < 0) { - // Hook of thirdparty module - if (is_object($hookmanager)) - { - $parameters=array('objFrom'=>$objFrom); - $action=''; - $reshook=$hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks - if ($reshook < 0) $error++; - } + $error++; } + } - unset($this->context['createfromclone']); + if (! $error) + { + // copy external contacts if same company + if ($this->socid == $objFrom->socid) + { + if ($this->copy_linked_contact($objFrom, 'external') < 0) + $error++; + } + } - // End - if (! $error) + if (! $error) + { + // Hook of thirdparty module + if (is_object($hookmanager)) { - $this->db->commit(); - return $this->id; - } - else - { - $this->db->rollback(); - return -1; + $parameters=array('objFrom'=>$objFrom); + $action=''; + $reshook=$hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook < 0) $error++; } + } + + unset($this->context['createfromclone']); + + // End + if (! $error) + { + $this->db->commit(); + return $this->id; + } + else + { + $this->db->rollback(); + return -1; + } } @@ -1219,8 +1244,12 @@ class Commande extends CommonOrder $this->fk_delivery_address = $object->fk_delivery_address; $this->contact_id = $object->contactid; $this->ref_client = $object->ref_client; - $this->note_private = $object->note_private; - $this->note_public = $object->note_public; + + if (empty($conf->global->MAIN_DISABLE_PROPAGATE_NOTES_FROM_ORIGIN)) + { + $this->note_private = $object->note_private; + $this->note_public = $object->note_public; + } $this->origin = $object->element; $this->origin_id = $object->id; @@ -1358,6 +1387,12 @@ class Commande extends CommonOrder // Check parameters if ($type < 0) return -1; + if ($date_start && $date_end && $date_start > $date_end) { + $langs->load("errors"); + $this->error=$langs->trans('ErrorStartDateGreaterEnd'); + return -1; + } + $this->db->begin(); $product_type=$type; @@ -2920,9 +2955,8 @@ class Commande extends CommonOrder dol_syslog(get_class($this)."::updateline id=$rowid, desc=$desc, pu=$pu, qty=$qty, remise_percent=$remise_percent, txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, price_base_type=$price_base_type, info_bits=$info_bits, date_start=$date_start, date_end=$date_end, type=$type, fk_parent_line=$fk_parent_line, pa_ht=$pa_ht, special_code=$special_code"); include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; - if (! empty($this->brouillon)) + if ($this->statut == Propal::STATUS_DRAFT) { - $this->db->begin(); // Clean parameters if (empty($qty)) $qty=0; @@ -2933,6 +2967,12 @@ class Commande extends CommonOrder if (empty($remise_percent)) $remise_percent=0; if (empty($special_code) || $special_code == 3) $special_code=0; + if ($date_start && $date_end && $date_start > $date_end) { + $langs->load("errors"); + $this->error=$langs->trans('ErrorStartDateGreaterEnd'); + return -1; + } + $remise_percent=price2num($remise_percent); $qty=price2num($qty); $pu = price2num($pu); @@ -2942,6 +2982,8 @@ class Commande extends CommonOrder $txlocaltax1=price2num($txlocaltax1); $txlocaltax2=price2num($txlocaltax2); + $this->db->begin(); + // Calcul du total TTC et de la TVA pour la ligne a partir de // qty, pu, remise_percent et txtva // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php index 9c706bda200..37cbc70cd40 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -160,7 +160,7 @@ if ($id > 0 || ! empty($ref)) print '
    '; print '
    '; - print '
    '.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
    ' . $langs->trans('PaymentConditionsShort') . ''; $form->select_conditions_paiements($cond_reglement_id, 'cond_reglement_id', - 1, 1); print '
    ' . $langs->trans("Project") . ''; $numprojet = $formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0); - print '   id).'">' . $langs->trans("AddProject") . ' '; + print '   id).'">' . $langs->trans("AddProject") . ''; print '
    '; + print '
    '; print ''; print ''; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index c20abf44fe2..3fddf55924f 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2016 Laurent Destailleur + * Copyright (C) 2004-2019 Laurent Destailleur * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2012 Juanjo Menent @@ -441,7 +441,7 @@ if ($resql) $newcardbutton=''; if ($contextpage == 'orderlist' && $user->rights->commande->creer) { - $newcardbutton=''.$langs->trans('NewOrder').''; + $newcardbutton=''.$langs->trans('NewOrder').''; $newcardbutton.= ''; $newcardbutton.= ''; } @@ -497,12 +497,12 @@ if ($resql) print '"; - print '\n"; + print '\n"; print "
    '.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
    '.$langs->trans("TotalSizeOfAttachedFiles").''.dol_print_size($totalsize, 1, 1).'
    '; if (! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_BILL)) { - print $form->selectyesno('valdate_invoices', 0, 1, 1); + print $form->selectyesno('validate_invoices', 0, 1, 1); print ' ('.$langs->trans("AutoValidationNotPossibleWhenStockIsDecreasedOnInvoiceValidation").')'; } else { - print $form->selectyesno('valdate_invoices', 0, 1); + print $form->selectyesno('validate_invoices', 0, 1); } if (! empty($conf->workflow->enabled) && ! empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER)) print '     '.$langs->trans("IfValidateInvoiceIsNoOrderStayUnbilled").''; else print '     '.$langs->trans("OptionToSetOrderBilledNotEnabled").''; diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 68354d1961f..1304c3ce75d 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -757,11 +757,11 @@ if ($resql) if (empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)) // If direct entries is done using miscellaneous payments { if ($user->rights->banque->modifier) { - $newcardbutton = ''.$langs->trans("AddBankRecord").''; + $newcardbutton = ''.$langs->trans("AddBankRecord").''; $newcardbutton.= ''; $newcardbutton.= ''; } else { - $newcardbutton = ''.$langs->trans("AddBankRecord"); + $newcardbutton = ''.$langs->trans("AddBankRecord").''; $newcardbutton.= ''; $newcardbutton.= ''; } @@ -769,11 +769,11 @@ if ($resql) else // If direct entries is not done using miscellaneous payments { if ($user->rights->banque->modifier) { - $newcardbutton = ''.$langs->trans("AddBankRecord"); + $newcardbutton = ''.$langs->trans("AddBankRecord").''; $newcardbutton.= ''; $newcardbutton.= ''; } else { - $newcardbutton = ''.$langs->trans("AddBankRecord"); + $newcardbutton = ''.$langs->trans("AddBankRecord").''; $newcardbutton.= ''; $newcardbutton.= ''; } @@ -781,7 +781,7 @@ if ($resql) } else { - $newcardbutton = ''.$langs->trans("AddBankRecord"); + $newcardbutton = ''.$langs->trans("AddBankRecord").''; $newcardbutton.= ''; $newcardbutton.= ''; } diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index bd0e43b8461..89a05f3e215 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -1546,8 +1546,8 @@ class Account extends CommonObject * Some countries show less or more bank account properties to the user * * @param int $includeibanbic 1=Return also key for IBAN and BIC - * @return array - * @see useDetailedBBAN + * @return array Array of fields to show + * @see useDetailedBBAN() */ public function getFieldsToShow($includeibanbic = 0) { @@ -1693,13 +1693,27 @@ class AccountLine extends CommonObject */ public $ref; - public $datec; + /** + * Date creation record (datec) + * + * @var integer + */ + public $datec; + + /** + * Date (dateo) + * + * @var integer + */ public $dateo; /** - * Value date - */ + * Date value (datev) + * + * @var integer + */ public $datev; + public $amount; /** diff --git a/htdocs/compta/bank/document.php b/htdocs/compta/bank/document.php index 06fc4752d31..5b887f0bd8e 100644 --- a/htdocs/compta/bank/document.php +++ b/htdocs/compta/bank/document.php @@ -122,7 +122,7 @@ if ($id > 0 || !empty($ref)) { print '
    '; print '
    '; - print ''; + print '
    '; print ''; print ''; print "
    ' . $langs->trans("NbOfAttachedFiles") . '' . count($filearray) . '
    ' . $langs->trans("TotalSizeOfAttachedFiles") . '' .dol_print_size($totalsize, 1, 1).'
    \n"; diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index b0a7f546297..8cc396f3bc1 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -227,7 +227,7 @@ $massactionbutton=$form->selectMassAction('', $arrayofmassactions); $newcardbutton=''; if ($user->rights->banque->configurer) { - $newcardbutton.=''.$langs->trans("NewFinancialAccount").''; + $newcardbutton.=''.$langs->trans("NewFinancialAccount").''; $newcardbutton.= ''; $newcardbutton.= ''; } diff --git a/htdocs/compta/bank/various_payment/document.php b/htdocs/compta/bank/various_payment/document.php index 58cb526d566..36e8546a897 100644 --- a/htdocs/compta/bank/various_payment/document.php +++ b/htdocs/compta/bank/various_payment/document.php @@ -131,7 +131,7 @@ if ($object->id) $totalsize+=$file['size']; } - print ''; + print '
    '; print ''; print ''; diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index b3624e274f2..8be0b075e40 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -157,7 +157,7 @@ if ($result) $newcardbutton=''; if ($user->rights->banque->modifier) { - $newcardbutton=''.$langs->trans('MenuNewVariousPayment').''; + $newcardbutton=''.$langs->trans('MenuNewVariousPayment').''; $newcardbutton.= ''; $newcardbutton.= ''; } diff --git a/htdocs/compta/cashcontrol/cashcontrol_list.php b/htdocs/compta/cashcontrol/cashcontrol_list.php index 89b66531eec..71be539f974 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_list.php +++ b/htdocs/compta/cashcontrol/cashcontrol_list.php @@ -337,7 +337,7 @@ print ''; $newcardbutton=''; //if ($user->rights->monmodule->creer) //{ -$newcardbutton=''.$langs->trans('New').''; +$newcardbutton=''.$langs->trans('New').''; $newcardbutton.= ''; $newcardbutton.= ''; //} diff --git a/htdocs/compta/deplacement/class/deplacement.class.php b/htdocs/compta/deplacement/class/deplacement.class.php index ae1360ff633..243c4b5d110 100644 --- a/htdocs/compta/deplacement/class/deplacement.class.php +++ b/htdocs/compta/deplacement/class/deplacement.class.php @@ -57,7 +57,18 @@ class Deplacement extends CommonObject */ public $ismultientitymanaged = 0; - public $datec; // Creation date + /** + * Date creation record (datec) + * + * @var integer + */ + public $datec; + + /** + * Date (dated) + * + * @var integer + */ public $dated; /** diff --git a/htdocs/compta/deplacement/document.php b/htdocs/compta/deplacement/document.php index c94a527d575..8cba95e283b 100644 --- a/htdocs/compta/deplacement/document.php +++ b/htdocs/compta/deplacement/document.php @@ -100,7 +100,7 @@ if ($object->id) } - print '
    '.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
    '.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'
    '; + print '
    '; $linkback = ''.$langs->trans("BackToList").''; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php old mode 100644 new mode 100755 index d4459c8fcf6..e8da06ee2ca --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1303,7 +1303,6 @@ if (empty($reshook)) $tva_tx = $lines[$i]->tva_tx; $amountdeposit[$tva_tx] += ($lines[$i]->total_ht * $valuedeposit) / 100; } - } if($totalamount == 0) { @@ -1329,7 +1328,7 @@ if (empty($reshook)) } elseif ($typeamount=='variable') { $descline.= ' ('. $valuedeposit.'%)'; } - + $descline.= ' - '.$srcobject->ref; $result = $object->addline( $descline, @@ -1845,7 +1844,8 @@ if (empty($reshook)) $desc = $prod->description; } - $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->CHANGE_ORDER_CONCAT_DESCRIPTION)); + if (!empty($product_desc) && !empty($conf->global->MAIN_NO_CONCAT_DESCRIPTION)) $desc= $product_desc; + else $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION)); // Add custom code and origin country into description if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code))) { @@ -2698,7 +2698,7 @@ if ($action == 'create') }); '; } - print ' '.$langs->trans("AddThirdParty").' '; + print ' '.$langs->trans("AddThirdParty").''; print ''; } print '' . "\n"; @@ -3094,7 +3094,7 @@ if ($action == 'create') $langs->load('projects'); print ''; } @@ -4280,7 +4280,7 @@ elseif ($id > 0 || ! empty($ref)) print $langs->trans('AlreadyPaidNoCreditNotesNoDeposits'); else print $langs->trans('AlreadyPaid'); - print ' :'; + print ' :'; $resteapayeraffiche = $resteapayer; $cssforamountpaymentcomplete = 'amountpaymentcomplete'; @@ -4359,14 +4359,13 @@ elseif ($id > 0 || ! empty($ref)) // Billed print ''; - // Remainder to pay print ''; - print ''; + print ''; print ''; } else // Credit note @@ -4387,7 +4386,7 @@ elseif ($id > 0 || ! empty($ref)) if ($resteapayeraffiche > 0) print ' ('.$langs->trans('ExcessPaid').')'; print ' :'; - print ''; + print ''; print ''; // Sold credit note diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 2f8c94a63fa..2e299740290 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -675,7 +675,7 @@ class Facture extends CommonInvoice $vatrate = $line->tva_tx; if ($line->vat_src_code && ! preg_match('/\(.*\)/', $vatrate)) $vatrate.=' ('.$line->vat_src_code.')'; - $result = $this->addline( + $result = $this->addline( $line->desc, $line->subprice, $line->qty, @@ -1081,7 +1081,7 @@ class Facture extends CommonInvoice */ public function createFromOrder($object, User $user) { - global $hookmanager; + global $conf, $hookmanager; $error=0; @@ -1142,8 +1142,12 @@ class Facture extends CommonInvoice $this->fk_delivery_address = $object->fk_delivery_address; $this->contact_id = $object->contactid; $this->ref_client = $object->ref_client; - $this->note_private = $object->note_private; - $this->note_public = $object->note_public; + + if (empty($conf->global->MAIN_DISABLE_PROPAGATE_NOTES_FROM_ORIGIN)) + { + $this->note_private = $object->note_private; + $this->note_public = $object->note_public; + } $this->module_source = $object->module_source; $this->pos_source = $object->pos_source; @@ -1195,9 +1199,10 @@ class Facture extends CommonInvoice * @param int $notooltip 1=Disable tooltip * @param int $addlinktonotes 1=Add link to notes * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @param string $target Target of link ('', '_self', '_blank', '_parent', '_backoffice', ...) * @return string String with URL */ - public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $moretitle = '', $notooltip = 0, $addlinktonotes = 0, $save_lastsearch_value = -1) + public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $moretitle = '', $notooltip = 0, $addlinktonotes = 0, $save_lastsearch_value = -1, $target = '') { global $langs, $conf, $user, $form; @@ -1250,7 +1255,7 @@ class Facture extends CommonInvoice if ($moretitle) $label.=' - '.$moretitle; } - $linkclose=''; + $linkclose=($target?' target="'.$target.'"':''); if (empty($notooltip) && $user->rights->facture->lire) { if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) @@ -2502,7 +2507,7 @@ class Facture extends CommonInvoice { $is_last = $next_invoice->is_last_in_cycle(); - if ($next_invoice->brouillon && $is_last != 1) + if ($next_invoice->statut == self::STATUS_DRAFT && $is_last != 1) { $this->error = $langs->trans('updatePriceNextInvoiceErrorUpdateline', $next_invoice->ref); return false; @@ -2550,16 +2555,22 @@ class Facture extends CommonInvoice return 0; } + dol_syslog(get_class($this)."::set_draft", LOG_DEBUG); + $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."facture"; $sql.= " SET fk_statut = ".self::STATUS_DRAFT; $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::set_draft", LOG_DEBUG); $result=$this->db->query($sql); if ($result) { + if (! $error) + { + $this->oldcopy= clone $this; + } + // Si on decremente le produit principal et ses composants a la validation de facture, on réincrement if ($this->type != self::TYPE_DEPOSIT && $result >= 0 && ! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_BILL)) { @@ -2585,6 +2596,7 @@ class Facture extends CommonInvoice $old_statut=$this->statut; $this->brouillon = 1; $this->statut = self::STATUS_DRAFT; + // Call trigger $result=$this->call_trigger('BILL_UNVALIDATE', $user); if ($result < 0) @@ -2668,7 +2680,8 @@ class Facture extends CommonInvoice global $mysoc, $conf, $langs; dol_syslog(get_class($this)."::addline id=$this->id,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, fk_product=$fk_product,remise_percent=$remise_percent,date_start=$date_start,date_end=$date_end,ventil=$ventil,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type, fk_unit=$fk_unit", LOG_DEBUG); - if (! empty($this->brouillon)) + + if ($this->statut == self::STATUS_DRAFT) { include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; @@ -2709,6 +2722,12 @@ class Facture extends CommonInvoice // Check parameters if ($type < 0) return -1; + if ($date_start && $date_end && $date_start > $date_end) { + $langs->load("errors"); + $this->error=$langs->trans('ErrorStartDateGreaterEnd'); + return -1; + } + $this->db->begin(); $product_type=$type; @@ -2912,6 +2931,12 @@ class Facture extends CommonInvoice } } + if ($date_start && $date_end && $date_start > $date_end) { + $langs->load("errors"); + $this->error=$langs->trans('ErrorStartDateGreaterEnd'); + return -1; + } + $this->db->begin(); // Clean parameters @@ -4382,10 +4407,6 @@ class FactureLigne extends CommonInvoiceLine public $date_start; public $date_end; - // Ne plus utiliser - //var $price; // P.U. HT apres remise % de ligne (exemple 80) - //var $remise; // Montant calcule de la remise % sur PU HT (exemple 20) - // From llx_product /** * @deprecated diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php index 9ddefd0ede4..44f69f512bd 100644 --- a/htdocs/compta/facture/document.php +++ b/htdocs/compta/facture/document.php @@ -165,7 +165,7 @@ if ($id > 0 || ! empty($ref)) print '
    '; print '
    '; - print '
    ' . $langs->trans('Project') . ''; $numprojet = $formproject->select_projects(($socid > 0 ? $socid : -1), $projectid, 'projectid', 0, 0, 1, 1); - print '   id.($fac_rec?'&fac_rec='.$fac_rec:'')).'">' . $langs->trans("AddProject") . ' '; + print '   id.($fac_rec?'&fac_rec='.$fac_rec:'')).'">' . $langs->trans("AddProject") . ''; print '
    0)?' class="amountalreadypaid"':'').'>' . price($totalpaye) . ' 
    ' . price($totalpaye) . ' 
    ' . $langs->trans("Billed") . ' :' . price($object->total_ttc) . ' 
    '; print $langs->trans('RemainderToPay'); if ($resteapayeraffiche < 0) print ' ('.$langs->trans('ExcessReceived').')'; print ' :' . price($resteapayeraffiche) . '' . price($resteapayeraffiche) . ' 
    ' . price($sign * $resteapayeraffiche) . '' . price($sign * $resteapayeraffiche) . ' 
    '; + print '
    '; print ''; print ''; diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index d768dc94ea5..fa8af87ac29 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -1305,7 +1305,7 @@ else print '
    '.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
    '.$langs->trans("TotalSizeOfAttachedFiles").''.dol_print_size($totalsize, 1, 1).'
    '; - if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editconditions' && ! empty($object->brouillon) && $user->rights->facture->creer) + if ($action != 'editconditions' && $user->rights->facture->creer) print ''; print '
    '; print $langs->trans('PaymentConditionsShort'); print 'id . '">' . img_edit($langs->trans('SetConditions'), 1) . '
    '; print '
    '; @@ -1329,7 +1329,7 @@ else print ''; - if ($action != 'editmode' && ! empty($object->brouillon) && $user->rights->facture->creer) + if ($action != 'editmode' && $user->rights->facture->creer) print ''; print '
    '; print $langs->trans('PaymentMode'); print 'id . '">' . img_edit($langs->trans('SetMode'), 1) . '
    '; print '
    '; @@ -1392,7 +1392,7 @@ else print ''; print '
    '; print $langs->trans('BankAccount'); print ''; - if (($action != 'editbankaccount') && $user->rights->facture->creer && ! empty($object->brouillon)) + if (($action != 'editbankaccount') && $user->rights->facture->creer && $object->statut == FactureRec::STATUS_DRAFT) print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'
    '; print '
    '; @@ -1414,7 +1414,7 @@ else print ''; print '
    '; print $langs->trans('Model'); print ''; - if (($action != 'editmodelpdf') && $user->rights->facture->creer && ! empty($object->brouillon)) + if (($action != 'editmodelpdf') && $user->rights->facture->creer && $object->statut == FactureRec::STATUS_DRAFT) print 'id.'">'.img_edit($langs->trans('SetModel'), 1).'
    '; print '
    '; @@ -1463,7 +1463,7 @@ else print ''; - if ($action != 'editfrequency' && ! empty($object->brouillon) && $user->rights->facture->creer) + if ($action != 'editfrequency' && $user->rights->facture->creer) print ''; print '
    '; print $langs->trans('Frequency'); print 'id . '">' . img_edit($langs->trans('Edit'), 1) . '
    '; print '
    '; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 39978cd82d1..749a0b28cfb 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -594,7 +594,7 @@ if ($resql) $newcardbutton=''; if($user->rights->facture->creer) { - $newcardbutton=''.$langs->trans('NewBill').''; + $newcardbutton=''.$langs->trans('NewBill').''; $newcardbutton.= ''; $newcardbutton.= ''; } diff --git a/htdocs/compta/localtax/list.php b/htdocs/compta/localtax/list.php index 8d02d8390dd..184c9600926 100644 --- a/htdocs/compta/localtax/list.php +++ b/htdocs/compta/localtax/list.php @@ -45,7 +45,7 @@ $localtax_static = new Localtax($db); $newcardbutton=''; if ($user->rights->tax->charges->creer) { - $newcardbutton=''.$langs->trans('NewLocalTaxPayment', ($ltt+1)).''; + $newcardbutton=''.$langs->trans('NewLocalTaxPayment', ($ltt+1)).''; $newcardbutton.= ''; $newcardbutton.= ''; } diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index 6e86ecf14b6..0107ba60383 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -138,7 +138,7 @@ if ($resql) $newcardbutton=''; if ($user->rights->banque->cheque) { - $newcardbutton = ''.$langs->trans('NewCheckDeposit').''; + $newcardbutton = ''.$langs->trans('NewCheckDeposit').''; $newcardbutton.= ''; $newcardbutton.= ''; } diff --git a/htdocs/compta/prelevement/bons.php b/htdocs/compta/prelevement/bons.php index fcd48a6a305..49f44af1702 100644 --- a/htdocs/compta/prelevement/bons.php +++ b/htdocs/compta/prelevement/bons.php @@ -108,7 +108,7 @@ if ($result) $newcardbutton=''; if ($user->rights->prelevement->bons->creer) { - $newcardbutton = ''.$langs->trans('NewStandingOrder').''; + $newcardbutton = ''.$langs->trans('NewStandingOrder').''; $newcardbutton.= ''; $newcardbutton.= ''; } diff --git a/htdocs/compta/salaries/document.php b/htdocs/compta/salaries/document.php index 5335b8fc39e..3ff92d23c1c 100644 --- a/htdocs/compta/salaries/document.php +++ b/htdocs/compta/salaries/document.php @@ -114,7 +114,7 @@ if ($object->id) print '
    '; print '
    '; - print ''; + print '
    '; print ''; print ''; print '
    '.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
    '.$langs->trans("TotalSizeOfAttachedFiles").''.dol_print_size($totalsize, 1, 1).'
    '; diff --git a/htdocs/compta/salaries/list.php b/htdocs/compta/salaries/list.php index e0fb1b38636..6ce49536d20 100644 --- a/htdocs/compta/salaries/list.php +++ b/htdocs/compta/salaries/list.php @@ -150,7 +150,7 @@ if ($result) $newcardbutton=''; if (! empty($user->rights->salaries->write)) { - $newcardbutton=''.$langs->trans('NewSalaryPayment').''; + $newcardbutton=''.$langs->trans('NewSalaryPayment').''; $newcardbutton.= ''; $newcardbutton.= ''; } diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index d3093a6f374..8bdbd68bfc4 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -665,7 +665,7 @@ if ($id > 0) $cssforamountpaymentcomplete = 'amountpaymentcomplete'; print '
    '.$langs->trans("RemainderToPay")." :'.price($resteapayer)."
    '.price($resteapayer)."
    "; $db->free($resql); diff --git a/htdocs/compta/sociales/document.php b/htdocs/compta/sociales/document.php index 87bef4e69d1..1025f7b11ed 100644 --- a/htdocs/compta/sociales/document.php +++ b/htdocs/compta/sociales/document.php @@ -145,7 +145,7 @@ if ($object->id) } - print ''; + print '
    '; print ''; print ''; diff --git a/htdocs/compta/sociales/list.php b/htdocs/compta/sociales/list.php index 8a8cc1f61b8..f5e88c7fb29 100644 --- a/htdocs/compta/sociales/list.php +++ b/htdocs/compta/sociales/list.php @@ -152,7 +152,7 @@ if ($resql) $newcardbutton=''; if($user->rights->tax->charges->creer) { - $newcardbutton=''.$langs->trans('MenuNewSocialContribution'); + $newcardbutton=''.$langs->trans('MenuNewSocialContribution').''; $newcardbutton.= ''; $newcardbutton.= ''; } diff --git a/htdocs/compta/tva/clients.php b/htdocs/compta/tva/clients.php index e3539620351..e0775313dd3 100644 --- a/htdocs/compta/tva/clients.php +++ b/htdocs/compta/tva/clients.php @@ -47,36 +47,36 @@ $langs->loadLangs(array("other","compta","banks","bills","companies","product"," $year=GETPOST("year", "int"); if (empty($year)) { - $year_current = strftime("%Y", dol_now()); - $year_start = $year_current; + $year_current = strftime("%Y", dol_now()); + $year_start = $year_current; } else { - $year_current = $year; - $year_start = $year; + $year_current = $year; + $year_start = $year; } $date_start=dol_mktime(0, 0, 0, GETPOST("date_startmonth"), GETPOST("date_startday"), GETPOST("date_startyear")); $date_end=dol_mktime(23, 59, 59, GETPOST("date_endmonth"), GETPOST("date_endday"), GETPOST("date_endyear")); // Quarter if (empty($date_start) || empty($date_end)) // We define date_start and date_end { - $q=GETPOST("q"); - if (empty($q)) - { - if (GETPOST("month")) { $date_start=dol_get_first_day($year_start, GETPOST("month"), false); $date_end=dol_get_last_day($year_start, GETPOST("month"), false); } - else - { - $date_start=dol_get_first_day($year_start, empty($conf->global->SOCIETE_FISCAL_MONTH_START)?1:$conf->global->SOCIETE_FISCAL_MONTH_START, false); - if (empty($conf->global->MAIN_INFO_VAT_RETURN) || $conf->global->MAIN_INFO_VAT_RETURN == 2) $date_end=dol_time_plus_duree($date_start, 3, 'm') - 1; - elseif ($conf->global->MAIN_INFO_VAT_RETURN == 3) $date_end=dol_time_plus_duree($date_start, 1, 'y') - 1; - elseif ($conf->global->MAIN_INFO_VAT_RETURN == 1) $date_end=dol_time_plus_duree($date_start, 1, 'm') - 1; - } - } - else - { - if ($q==1) { $date_start=dol_get_first_day($year_start, 1, false); $date_end=dol_get_last_day($year_start, 3, false); } - if ($q==2) { $date_start=dol_get_first_day($year_start, 4, false); $date_end=dol_get_last_day($year_start, 6, false); } - if ($q==3) { $date_start=dol_get_first_day($year_start, 7, false); $date_end=dol_get_last_day($year_start, 9, false); } - if ($q==4) { $date_start=dol_get_first_day($year_start, 10, false); $date_end=dol_get_last_day($year_start, 12, false); } - } + $q=GETPOST("q"); + if (empty($q)) + { + if (GETPOST("month", 'int')) { $date_start=dol_get_first_day($year_start, GETPOST("month", 'int'), false); $date_end=dol_get_last_day($year_start, GETPOST("month", 'int'), false); } + else + { + $date_start=dol_get_first_day($year_start, empty($conf->global->SOCIETE_FISCAL_MONTH_START)?1:$conf->global->SOCIETE_FISCAL_MONTH_START, false); + if (empty($conf->global->MAIN_INFO_VAT_RETURN) || $conf->global->MAIN_INFO_VAT_RETURN == 2) $date_end=dol_time_plus_duree($date_start, 3, 'm') - 1; + elseif ($conf->global->MAIN_INFO_VAT_RETURN == 3) $date_end=dol_time_plus_duree($date_start, 1, 'y') - 1; + elseif ($conf->global->MAIN_INFO_VAT_RETURN == 1) $date_end=dol_time_plus_duree($date_start, 1, 'm') - 1; + } + } + else + { + if ($q==1) { $date_start=dol_get_first_day($year_start, 1, false); $date_end=dol_get_last_day($year_start, 3, false); } + if ($q==2) { $date_start=dol_get_first_day($year_start, 4, false); $date_end=dol_get_last_day($year_start, 6, false); } + if ($q==3) { $date_start=dol_get_first_day($year_start, 7, false); $date_end=dol_get_last_day($year_start, 9, false); } + if ($q==4) { $date_start=dol_get_first_day($year_start, 10, false); $date_end=dol_get_last_day($year_start, 12, false); } + } } $min = price2num(GETPOST("min", "alpha")); @@ -113,12 +113,12 @@ $morequerystring=''; $listofparams=array('date_startmonth','date_startyear','date_startday','date_endmonth','date_endyear','date_endday'); foreach ($listofparams as $param) { - if (GETPOST($param)!='') $morequerystring.=($morequerystring?'&':'').$param.'='.GETPOST($param); + if (GETPOST($param)!='') $morequerystring.=($morequerystring?'&':'').$param.'='.GETPOST($param); } $special_report = false; if (isset($_REQUEST['extra_report']) && $_REQUEST['extra_report'] == 1) { - $special_report = true; + $special_report = true; } llxHeader('', $langs->trans("VATReport"), '', '', 0, 0, '', '', $morequerystring); @@ -141,7 +141,7 @@ $period=$form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$f $prevyear=$year_start; $prevquarter=$q; if ($prevquarter > 1) { - $prevquarter--; + $prevquarter--; } else { $prevquarter=4; $prevyear--; @@ -149,7 +149,7 @@ if ($prevquarter > 1) { $nextyear=$year_start; $nextquarter=$q; if ($nextquarter < 4) { - $nextquarter++; + $nextquarter++; } else { $nextquarter=1; $nextyear++; @@ -161,7 +161,7 @@ if ($conf->global->TAX_MODE_SELL_PRODUCT == 'payment') $description.=$langs->tra if ($conf->global->TAX_MODE_SELL_SERVICE == 'invoice') $description.='
    '.$langs->trans("RulesVATDueServices"); if ($conf->global->TAX_MODE_SELL_SERVICE == 'payment') $description.='
    '.$langs->trans("RulesVATInServices"); if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { - $description.='
    '.$langs->trans("DepositsAreNotIncluded"); + $description.='
    '.$langs->trans("DepositsAreNotIncluded"); } if (! empty($conf->global->MAIN_MODULE_ACCOUNTING)) $description.='
    '.$langs->trans("ThisIsAnEstimatedValue"); @@ -169,15 +169,15 @@ if (! empty($conf->global->MAIN_MODULE_ACCOUNTING)) $description.='
    '.$langs- $description.=$fsearch; if (! empty($conf->global->TAX_REPORT_EXTRA_REPORT)) { - $description.='
    ' - . ' ' - . $langs->trans('SimpleReport') - . '' - . '
    ' - . ' ' - . $langs->trans('AddExtraReport') - . '' - . '
    '; + $description.='
    ' + . ' ' + . $langs->trans('SimpleReport') + . '' + . '
    ' + . ' ' + . $langs->trans('AddExtraReport') + . '' + . '
    '; } $elementcust=$langs->trans("CustomersInvoices"); @@ -185,13 +185,13 @@ $productcust=$langs->trans("Description"); $namerate=$langs->trans("VATRate"); $amountcust=$langs->trans("AmountHT"); if ($mysoc->tva_assuj) { - $vatcust.=' ('.$langs->trans("ToPay").')'; + $vatcust.=' ('.$langs->trans("ToPay").')'; } $elementsup=$langs->trans("SuppliersInvoices"); $productsup=$langs->trans("Description"); $amountsup=$langs->trans("AmountHT"); if ($mysoc->tva_assuj) { - $vatsup.=' ('.$langs->trans("ToGetBack").')'; + $vatsup.=' ('.$langs->trans("ToGetBack").')'; } report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, array(), $calcmode); @@ -214,546 +214,536 @@ $x_paye = tax_by_thirdparty('vat', $db, 0, $date_start, $date_end, $modetax, 'bu if (! is_array($x_coll) || ! is_array($x_paye)) { - $langs->load("errors"); - if ($x_coll == -1) { - print ''; - } elseif ($x_coll == -2) { - print ''; - } else { - print ''; - } + $langs->load("errors"); + if ($x_coll == -1) { + print ''; + } elseif ($x_coll == -2) { + print ''; + } else { + print ''; + } } else { - $x_both = array(); - //now, from these two arrays, get another array with one rate per line - foreach(array_keys($x_coll) as $my_coll_thirdpartyid) - { - $x_both[$my_coll_thirdpartyid]['coll']['totalht'] = $x_coll[$my_coll_thirdpartyid]['totalht']; - $x_both[$my_coll_thirdpartyid]['coll']['vat'] = $x_coll[$my_coll_thirdpartyid]['vat']; - $x_both[$my_coll_thirdpartyid]['paye']['totalht'] = 0; - $x_both[$my_coll_thirdpartyid]['paye']['vat'] = 0; - $x_both[$my_coll_thirdpartyid]['coll']['links'] = ''; - $x_both[$my_coll_thirdpartyid]['coll']['detail'] = array(); - foreach($x_coll[$my_coll_thirdpartyid]['facid'] as $id=>$dummy) { - $invoice_customer->id=$x_coll[$my_coll_thirdpartyid]['facid'][$id]; - $invoice_customer->ref=$x_coll[$my_coll_thirdpartyid]['facnum'][$id]; - $invoice_customer->type=$x_coll[$my_coll_thirdpartyid]['type'][$id]; - $company_static->fetch($x_coll[$my_coll_thirdpartyid]['company_id'][$id]); - $x_both[$my_coll_thirdpartyid]['coll']['detail'][] = array( - 'id' =>$x_coll[$my_coll_thirdpartyid]['facid'][$id], - 'descr' =>$x_coll[$my_coll_thirdpartyid]['descr'][$id], - 'pid' =>$x_coll[$my_coll_thirdpartyid]['pid'][$id], - 'pref' =>$x_coll[$my_coll_thirdpartyid]['pref'][$id], - 'ptype' =>$x_coll[$my_coll_thirdpartyid]['ptype'][$id], - 'payment_id'=>$x_coll[$my_coll_thirdpartyid]['payment_id'][$id], - 'payment_amount'=>$x_coll[$my_coll_thirdpartyid]['payment_amount'][$id], - 'ftotal_ttc'=>$x_coll[$my_coll_thirdpartyid]['ftotal_ttc'][$id], - 'dtotal_ttc'=>$x_coll[$my_coll_thirdpartyid]['dtotal_ttc'][$id], - 'dtype' =>$x_coll[$my_coll_thirdpartyid]['dtype'][$id], - 'drate' =>$x_coll[$my_coll_thirdpartyid]['drate'][$id], - 'datef' =>$x_coll[$my_coll_thirdpartyid]['datef'][$id], - 'datep' =>$x_coll[$my_coll_thirdpartyid]['datep'][$id], - 'company_link'=>$company_static->getNomUrl(1, '', 20), - 'ddate_start'=>$x_coll[$my_coll_thirdpartyid]['ddate_start'][$id], - 'ddate_end' =>$x_coll[$my_coll_thirdpartyid]['ddate_end'][$id], - 'totalht' =>$x_coll[$my_coll_thirdpartyid]['totalht_list'][$id], - 'vat' =>$x_coll[$my_coll_thirdpartyid]['vat_list'][$id], - 'link' =>$invoice_customer->getNomUrl(1, '', 12) - ); - } - } - // tva paid - foreach (array_keys($x_paye) as $my_paye_thirdpartyid) { - $x_both[$my_paye_thirdpartyid]['paye']['totalht'] = $x_paye[$my_paye_thirdpartyid]['totalht']; - $x_both[$my_paye_thirdpartyid]['paye']['vat'] = $x_paye[$my_paye_thirdpartyid]['vat']; - if (!isset($x_both[$my_paye_thirdpartyid]['coll']['totalht'])) { - $x_both[$my_paye_thirdpartyid]['coll']['totalht'] = 0; - $x_both[$my_paye_thirdpartyid]['coll']['vat'] = 0; - } - $x_both[$my_paye_thirdpartyid]['paye']['links'] = ''; - $x_both[$my_paye_thirdpartyid]['paye']['detail'] = array(); + $x_both = array(); + //now, from these two arrays, get another array with one rate per line + foreach(array_keys($x_coll) as $my_coll_thirdpartyid) + { + $x_both[$my_coll_thirdpartyid]['coll']['totalht'] = $x_coll[$my_coll_thirdpartyid]['totalht']; + $x_both[$my_coll_thirdpartyid]['coll']['vat'] = $x_coll[$my_coll_thirdpartyid]['vat']; + $x_both[$my_coll_thirdpartyid]['paye']['totalht'] = 0; + $x_both[$my_coll_thirdpartyid]['paye']['vat'] = 0; + $x_both[$my_coll_thirdpartyid]['coll']['links'] = ''; + $x_both[$my_coll_thirdpartyid]['coll']['detail'] = array(); + foreach($x_coll[$my_coll_thirdpartyid]['facid'] as $id=>$dummy) { + $invoice_customer->id=$x_coll[$my_coll_thirdpartyid]['facid'][$id]; + $invoice_customer->ref=$x_coll[$my_coll_thirdpartyid]['facnum'][$id]; + $invoice_customer->type=$x_coll[$my_coll_thirdpartyid]['type'][$id]; + $company_static->fetch($x_coll[$my_coll_thirdpartyid]['company_id'][$id]); + $x_both[$my_coll_thirdpartyid]['coll']['detail'][] = array( + 'id' =>$x_coll[$my_coll_thirdpartyid]['facid'][$id], + 'descr' =>$x_coll[$my_coll_thirdpartyid]['descr'][$id], + 'pid' =>$x_coll[$my_coll_thirdpartyid]['pid'][$id], + 'pref' =>$x_coll[$my_coll_thirdpartyid]['pref'][$id], + 'ptype' =>$x_coll[$my_coll_thirdpartyid]['ptype'][$id], + 'payment_id'=>$x_coll[$my_coll_thirdpartyid]['payment_id'][$id], + 'payment_amount'=>$x_coll[$my_coll_thirdpartyid]['payment_amount'][$id], + 'ftotal_ttc'=>$x_coll[$my_coll_thirdpartyid]['ftotal_ttc'][$id], + 'dtotal_ttc'=>$x_coll[$my_coll_thirdpartyid]['dtotal_ttc'][$id], + 'dtype' =>$x_coll[$my_coll_thirdpartyid]['dtype'][$id], + 'drate' =>$x_coll[$my_coll_thirdpartyid]['drate'][$id], + 'datef' =>$x_coll[$my_coll_thirdpartyid]['datef'][$id], + 'datep' =>$x_coll[$my_coll_thirdpartyid]['datep'][$id], + 'company_link'=>$company_static->getNomUrl(1, '', 20), + 'ddate_start'=>$x_coll[$my_coll_thirdpartyid]['ddate_start'][$id], + 'ddate_end' =>$x_coll[$my_coll_thirdpartyid]['ddate_end'][$id], + 'totalht' =>$x_coll[$my_coll_thirdpartyid]['totalht_list'][$id], + 'vat' =>$x_coll[$my_coll_thirdpartyid]['vat_list'][$id], + 'link' =>$invoice_customer->getNomUrl(1, '', 12) + ); + } + } + // tva paid + foreach (array_keys($x_paye) as $my_paye_thirdpartyid) { + $x_both[$my_paye_thirdpartyid]['paye']['totalht'] = $x_paye[$my_paye_thirdpartyid]['totalht']; + $x_both[$my_paye_thirdpartyid]['paye']['vat'] = $x_paye[$my_paye_thirdpartyid]['vat']; + if (!isset($x_both[$my_paye_thirdpartyid]['coll']['totalht'])) { + $x_both[$my_paye_thirdpartyid]['coll']['totalht'] = 0; + $x_both[$my_paye_thirdpartyid]['coll']['vat'] = 0; + } + $x_both[$my_paye_thirdpartyid]['paye']['links'] = ''; + $x_both[$my_paye_thirdpartyid]['paye']['detail'] = array(); - foreach ($x_paye[$my_paye_thirdpartyid]['facid'] as $id=>$dummy) - { - // ExpenseReport - if ($x_paye[$my_paye_thirdpartyid]['ptype'][$id] == 'ExpenseReportPayment') - { - $expensereport->id=$x_paye[$my_paye_thirdpartyid]['facid'][$id]; - $expensereport->ref=$x_paye[$my_paye_thirdpartyid]['facnum'][$id]; - $expensereport->type=$x_paye[$my_paye_thirdpartyid]['type'][$id]; + foreach ($x_paye[$my_paye_thirdpartyid]['facid'] as $id=>$dummy) + { + // ExpenseReport + if ($x_paye[$my_paye_thirdpartyid]['ptype'][$id] == 'ExpenseReportPayment') + { + $expensereport->id=$x_paye[$my_paye_thirdpartyid]['facid'][$id]; + $expensereport->ref=$x_paye[$my_paye_thirdpartyid]['facnum'][$id]; + $expensereport->type=$x_paye[$my_paye_thirdpartyid]['type'][$id]; - $x_both[$my_paye_thirdpartyid]['paye']['detail'][] = array( - 'id' =>$x_paye[$my_paye_thirdpartyid]['facid'][$id], - 'descr' =>$x_paye[$my_paye_thirdpartyid]['descr'][$id], - 'pid' =>$x_paye[$my_paye_thirdpartyid]['pid'][$id], - 'pref' =>$x_paye[$my_paye_thirdpartyid]['pref'][$id], - 'ptype' =>$x_paye[$my_paye_thirdpartyid]['ptype'][$id], - 'payment_id' =>$x_paye[$my_paye_thirdpartyid]['payment_id'][$id], - 'payment_amount' =>$x_paye[$my_paye_thirdpartyid]['payment_amount'][$id], - 'ftotal_ttc' =>price2num($x_paye[$my_paye_thirdpartyid]['ftotal_ttc'][$id]), - 'dtotal_ttc' =>price2num($x_paye[$my_paye_thirdpartyid]['dtotal_ttc'][$id]), - 'dtype' =>$x_paye[$my_paye_thirdpartyid]['dtype'][$id], - 'drate' =>$x_paye[$my_coll_thirdpartyid]['drate'][$id], - 'ddate_start' =>$x_paye[$my_paye_thirdpartyid]['ddate_start'][$id], - 'ddate_end' =>$x_paye[$my_paye_thirdpartyid]['ddate_end'][$id], - 'totalht' =>price2num($x_paye[$my_paye_thirdpartyid]['totalht_list'][$id]), - 'vat' =>$x_paye[$my_paye_thirdpartyid]['vat_list'][$id], - 'link' =>$expensereport->getNomUrl(1) - ); - } - else - { - $invoice_supplier->id=$x_paye[$my_paye_thirdpartyid]['facid'][$id]; - $invoice_supplier->ref=$x_paye[$my_paye_thirdpartyid]['facnum'][$id]; - $invoice_supplier->type=$x_paye[$my_paye_thirdpartyid]['type'][$id]; - $company_static->fetch($x_paye[$my_paye_thirdpartyid]['company_id'][$id]); - $x_both[$my_paye_thirdpartyid]['paye']['detail'][] = array( - 'id' =>$x_paye[$my_paye_thirdpartyid]['facid'][$id], - 'descr' =>$x_paye[$my_paye_thirdpartyid]['descr'][$id], - 'pid' =>$x_paye[$my_paye_thirdpartyid]['pid'][$id], - 'pref' =>$x_paye[$my_paye_thirdpartyid]['pref'][$id], - 'ptype' =>$x_paye[$my_paye_thirdpartyid]['ptype'][$id], - 'payment_id'=>$x_paye[$my_paye_thirdpartyid]['payment_id'][$id], - 'payment_amount'=>$x_paye[$my_paye_thirdpartyid]['payment_amount'][$id], - 'ftotal_ttc'=>price2num($x_paye[$my_paye_thirdpartyid]['ftotal_ttc'][$id]), - 'dtotal_ttc'=>price2num($x_paye[$my_paye_thirdpartyid]['dtotal_ttc'][$id]), - 'dtype' =>$x_paye[$my_paye_thirdpartyid]['dtype'][$id], - 'drate' =>$x_paye[$my_coll_thirdpartyid]['drate'][$id], - 'datef' =>$x_paye[$my_paye_thirdpartyid]['datef'][$id], - 'datep' =>$x_paye[$my_paye_thirdpartyid]['datep'][$id], - 'company_link'=>$company_static->getNomUrl(1, '', 20), - 'ddate_start'=>$x_paye[$my_paye_thirdpartyid]['ddate_start'][$id], - 'ddate_end' =>$x_paye[$my_paye_thirdpartyid]['ddate_end'][$id], - 'totalht' =>price2num($x_paye[$my_paye_thirdpartyid]['totalht_list'][$id]), - 'vat' =>$x_paye[$my_paye_thirdpartyid]['vat_list'][$id], - 'link' =>$invoice_supplier->getNomUrl(1, '', 12) - ); - } - } - } - //now we have an array (x_both) indexed by rates for coll and paye + $x_both[$my_paye_thirdpartyid]['paye']['detail'][] = array( + 'id' =>$x_paye[$my_paye_thirdpartyid]['facid'][$id], + 'descr' =>$x_paye[$my_paye_thirdpartyid]['descr'][$id], + 'pid' =>$x_paye[$my_paye_thirdpartyid]['pid'][$id], + 'pref' =>$x_paye[$my_paye_thirdpartyid]['pref'][$id], + 'ptype' =>$x_paye[$my_paye_thirdpartyid]['ptype'][$id], + 'payment_id' =>$x_paye[$my_paye_thirdpartyid]['payment_id'][$id], + 'payment_amount' =>$x_paye[$my_paye_thirdpartyid]['payment_amount'][$id], + 'ftotal_ttc' =>price2num($x_paye[$my_paye_thirdpartyid]['ftotal_ttc'][$id]), + 'dtotal_ttc' =>price2num($x_paye[$my_paye_thirdpartyid]['dtotal_ttc'][$id]), + 'dtype' =>$x_paye[$my_paye_thirdpartyid]['dtype'][$id], + 'drate' =>$x_paye[$my_coll_thirdpartyid]['drate'][$id], + 'ddate_start' =>$x_paye[$my_paye_thirdpartyid]['ddate_start'][$id], + 'ddate_end' =>$x_paye[$my_paye_thirdpartyid]['ddate_end'][$id], + 'totalht' =>price2num($x_paye[$my_paye_thirdpartyid]['totalht_list'][$id]), + 'vat' =>$x_paye[$my_paye_thirdpartyid]['vat_list'][$id], + 'link' =>$expensereport->getNomUrl(1) + ); + } + else + { + $invoice_supplier->id=$x_paye[$my_paye_thirdpartyid]['facid'][$id]; + $invoice_supplier->ref=$x_paye[$my_paye_thirdpartyid]['facnum'][$id]; + $invoice_supplier->type=$x_paye[$my_paye_thirdpartyid]['type'][$id]; + $company_static->fetch($x_paye[$my_paye_thirdpartyid]['company_id'][$id]); + $x_both[$my_paye_thirdpartyid]['paye']['detail'][] = array( + 'id' =>$x_paye[$my_paye_thirdpartyid]['facid'][$id], + 'descr' =>$x_paye[$my_paye_thirdpartyid]['descr'][$id], + 'pid' =>$x_paye[$my_paye_thirdpartyid]['pid'][$id], + 'pref' =>$x_paye[$my_paye_thirdpartyid]['pref'][$id], + 'ptype' =>$x_paye[$my_paye_thirdpartyid]['ptype'][$id], + 'payment_id'=>$x_paye[$my_paye_thirdpartyid]['payment_id'][$id], + 'payment_amount'=>$x_paye[$my_paye_thirdpartyid]['payment_amount'][$id], + 'ftotal_ttc'=>price2num($x_paye[$my_paye_thirdpartyid]['ftotal_ttc'][$id]), + 'dtotal_ttc'=>price2num($x_paye[$my_paye_thirdpartyid]['dtotal_ttc'][$id]), + 'dtype' =>$x_paye[$my_paye_thirdpartyid]['dtype'][$id], + 'drate' =>$x_paye[$my_coll_thirdpartyid]['drate'][$id], + 'datef' =>$x_paye[$my_paye_thirdpartyid]['datef'][$id], + 'datep' =>$x_paye[$my_paye_thirdpartyid]['datep'][$id], + 'company_link'=>$company_static->getNomUrl(1, '', 20), + 'ddate_start'=>$x_paye[$my_paye_thirdpartyid]['ddate_start'][$id], + 'ddate_end' =>$x_paye[$my_paye_thirdpartyid]['ddate_end'][$id], + 'totalht' =>price2num($x_paye[$my_paye_thirdpartyid]['totalht_list'][$id]), + 'vat' =>$x_paye[$my_paye_thirdpartyid]['vat_list'][$id], + 'link' =>$invoice_supplier->getNomUrl(1, '', 12) + ); + } + } + } + //now we have an array (x_both) indexed by rates for coll and paye - //print table headers for this quadri - incomes first + //print table headers for this quadri - incomes first - $x_coll_sum = 0; - $x_coll_ht = 0; - $x_paye_sum = 0; - $x_paye_ht = 0; + $x_coll_sum = 0; + $x_coll_ht = 0; + $x_paye_sum = 0; + $x_paye_ht = 0; - $span=$columns; - if ($modetax != 1) $span+=2; + $span=$columns; + if ($modetax != 1) $span+=2; - //print ''; + //print ''; - // Customers invoices - print ''; - print ''; - print ''; - if ($conf->global->TAX_MODE_SELL_PRODUCT == 'payment' || $conf->global->TAX_MODE_SELL_SERVICE == 'payment') print ''; - else print ''; - print ''; - print ''; - if ($modetax != 1) - { - print ''; - print ''; - } - print ''; - print ''; - print ''; + // Customers invoices + print ''; + print ''; + print ''; + if ($conf->global->TAX_MODE_SELL_PRODUCT == 'payment' || $conf->global->TAX_MODE_SELL_SERVICE == 'payment') print ''; + else print ''; + print ''; + print ''; + if ($modetax != 1) + { + print ''; + print ''; + } + print ''; + print ''; + print ''; - $action = "tvadetail"; - $parameters["mode"] = $modetax; - $parameters["start"] = $date_start; - $parameters["end"] = $date_end; - $parameters["type"] = 'vat'; + $action = "tvadetail"; + $parameters["mode"] = $modetax; + $parameters["start"] = $date_start; + $parameters["end"] = $date_end; + $parameters["type"] = 'vat'; - $object = array(&$x_coll, &$x_paye, &$x_both); - // Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array - $hookmanager->initHooks(array('externalbalance')); - $reshook=$hookmanager->executeHooks('addVatLine', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks + $object = array(&$x_coll, &$x_paye, &$x_both); + // Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array + $hookmanager->initHooks(array('externalbalance')); + $reshook=$hookmanager->executeHooks('addVatLine', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks - foreach (array_keys($x_coll) as $thirdparty_id) { - $subtot_coll_total_ht = 0; - $subtot_coll_vat = 0; + foreach (array_keys($x_coll) as $thirdparty_id) { + $subtot_coll_total_ht = 0; + $subtot_coll_vat = 0; - if (is_array($x_both[$thirdparty_id]['coll']['detail'])) - { + if ($min == 0 || ($min > 0 && $x_both[$thirdparty_id]['coll']['totalht'] > $min)) + { + if (is_array($x_both[$thirdparty_id]['coll']['detail'])) + { + // VAT Rate + print ""; + print ''; + print '' . "\n"; - // VAT Rate - print ""; - print ''; - print ''."\n"; + foreach ($x_both[$thirdparty_id]['coll']['detail'] as $index => $fields) { + // Define type + // We MUST use dtype (type in line). We can use something else, only if dtype is really unknown. + $type = (isset($fields['dtype']) ? $fields['dtype'] : $fields['ptype']); + // Try to enhance type detection using date_start and date_end for free lines where type + // was not saved. + if (!empty($fields['ddate_start'])) { + $type = 1; + } + if (!empty($fields['ddate_end'])) { + $type = 1; + } - foreach ($x_both[$thirdparty_id]['coll']['detail'] as $index => $fields) { - // Define type - // We MUST use dtype (type in line). We can use something else, only if dtype is really unknown. - $type=(isset($fields['dtype'])?$fields['dtype']:$fields['ptype']); - // Try to enhance type detection using date_start and date_end for free lines where type - // was not saved. - if (!empty($fields['ddate_start'])) { - $type=1; - } - if (!empty($fields['ddate_end'])) { - $type=1; - } + print ''; + + // Ref + print ''; + + // Invoice date + print ''; + + // Payment date + if ($conf->global->TAX_MODE_SELL_PRODUCT == 'payment' || $conf->global->TAX_MODE_SELL_SERVICE == 'payment') { + print ''; + } else { + print ''; + } + + // Rate + print ''; + + // Description + print ''; + + // Total HT + if ($modetax != 1) { + print ''; + } + + // Payment + $ratiopaymentinvoice = 1; + if ($modetax != 1) { + print ''; + } + + // Total collected + print ''; + + // VAT + print ''; + print ''; + + $subtot_coll_total_ht += $temp_ht; + $subtot_coll_vat += $temp_vat; + $x_coll_sum += $temp_vat; + } + } + // Total customers for this vat rate + print ''; + print ''; + print ''; + if ($modetax != 1) { + print ''; + print ''; + } + print ''; + print ''; + print ''; + } + } + + if (count($x_coll) == 0) // Show a total ine if nothing shown + { + print ''; + print ''; + print ''; + if ($modetax != 1) { + print ''; + print ''; + } + print ''; + print ''; + print ''; + } + + // Blank line + print ''; + + // Print table headers for this quadri - expenses now + print ''; + print ''; + print ''; + if ($conf->global->TAX_MODE_BUY_PRODUCT == 'payment' || $conf->global->TAX_MODE_BUY_SERVICE == 'payment') print ''; + else print ''; + print ''; + print ''; + if ($modetax != 1) { + print ''; + print ''; + } + print ''; + print ''; + print ''."\n"; + + foreach (array_keys($x_paye) as $thirdparty_id) + { + $subtot_paye_total_ht = 0; + $subtot_paye_vat = 0; + + if ($min == 0 || ($min > 0 && $x_both[$thirdparty_id]['paye']['totalht'] > $min)) { + + if (is_array($x_both[$thirdparty_id]['paye']['detail'])) { + print ""; + print ''; + print '' . "\n"; + + foreach ($x_both[$thirdparty_id]['paye']['detail'] as $index => $fields) { + // Define type + // We MUST use dtype (type in line). We can use something else, only if dtype is really unknown. + $type = (isset($fields['dtype']) ? $fields['dtype'] : $fields['ptype']); + // Try to enhance type detection using date_start and date_end for free lines where type + // was not saved. + if (!empty($fields['ddate_start'])) { + $type = 1; + } + if (!empty($fields['ddate_end'])) { + $type = 1; + } - print ''; + print ''; - // Ref - print ''; + // Ref + print ''; - // Invoice date - print ''; + // Invoice date + print ''; - // Payment date - if ($conf->global->TAX_MODE_SELL_PRODUCT == 'payment' || $conf->global->TAX_MODE_SELL_SERVICE == 'payment') print ''; - else print ''; + // Payment date + if ($conf->global->TAX_MODE_BUY_PRODUCT == 'payment' || $conf->global->TAX_MODE_BUY_SERVICE == 'payment') { + print ''; + } else { + print ''; + } - // Rate - print ''; + // Company name + print ''; - // Description - print ''; + // Show range + print_date_range($fields['ddate_start'], $fields['ddate_end']); + } + print ''; - // Total HT - if ($modetax != 1) - { - print ''; - } + // Total HT + if ($modetax != 1) { + print ''; + } - // Payment - $ratiopaymentinvoice=1; - if ($modetax != 1) - { - print ''; - } + // Payment + $ratiopaymentinvoice = 1; + if ($modetax != 1) + { + print ''; + if (($type == 0 && $conf->global->TAX_MODE_BUY_PRODUCT == 'invoice') + || ($type == 1 && $conf->global->TAX_MODE_BUY_SERVICE == 'invoice')) + { + print $langs->trans("NA"); + } + else + { + if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) { + $ratiopaymentinvoice = ($fields['payment_amount'] / $fields['ftotal_ttc']); + } + print price(price2num($fields['payment_amount'], 'MT')); + if (isset($fields['payment_amount'])) { + print ' (' . round($ratiopaymentinvoice * 100, 2) . '%)'; + } + } + print ''; + } - // VAT - print ''; - print ''; + // VAT paid + print ''; - $subtot_coll_total_ht += $temp_ht; - $subtot_coll_vat += $temp_vat; - $x_coll_sum += $temp_vat; - } - } - // Total customers for this vat rate - print ''; - print ''; - print ''; - if ($modetax != 1) { - print ''; - print ''; - } - print ''; - print ''; - print ''; - } + // VAT + print ''; + print ''; - if (count($x_coll) == 0) // Show a total ine if nothing shown - { - print ''; - print ''; - print ''; - if ($modetax != 1) { - print ''; - print ''; - } - print ''; - print ''; - print ''; - } + $subtot_paye_total_ht += $temp_ht; + $subtot_paye_vat += $temp_vat; + $x_paye_sum += $temp_vat; + } + } + // Total suppliers for this vat rate + print ''; + print ''; + print ''; + if ($modetax != 1) { + print ''; + print ''; + } + print ''; + print ''; + print ''; + } + } - // Blank line - print ''; + if (count($x_paye) == 0) { // Show a total line if nothing shown + print ''; + print ''; + print ''; + if ($modetax != 1) { + print ''; + print ''; + } + print ''; + print ''; + print ''; + } - // Print table headers for this quadri - expenses now - print ''; - print ''; - print ''; - if ($conf->global->TAX_MODE_BUY_PRODUCT == 'payment' || $conf->global->TAX_MODE_BUY_SERVICE == 'payment') print ''; - else print ''; - print ''; - print ''; - if ($modetax != 1) { - print ''; - print ''; - } - print ''; - print ''; - print ''."\n"; + print '
    '.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
    '.$langs->trans("TotalSizeOfAttachedFiles").''.dol_print_size($totalsize, 1, 1).'
    ' . $langs->trans("ErrorNoAccountancyModuleLoaded") . '
    ' . $langs->trans("FeatureNotYetAvailable") . '
    ' . $langs->trans("Error") . '
    ' . $langs->trans("ErrorNoAccountancyModuleLoaded") . '
    ' . $langs->trans("FeatureNotYetAvailable") . '
    ' . $langs->trans("Error") . '
    '..')
    '..')
    '.$elementcust.''.$langs->trans("DateInvoice").''.$langs->trans("DatePayment").''.$namerate.''.$productcust.''.$amountcust.''.$langs->trans("Payment").' ('.$langs->trans("PercentOfInvoice").')'.$langs->trans("AmountHTVATRealReceived").''.$vatcust.'
    '.$elementcust.''.$langs->trans("DateInvoice").''.$langs->trans("DatePayment").''.$namerate.''.$productcust.''.$amountcust.''.$langs->trans("Payment").' ('.$langs->trans("PercentOfInvoice").')'.$langs->trans("AmountHTVATRealReceived").''.$vatcust.'
    '; + if (is_numeric($thirdparty_id)) { + $company_static->fetch($thirdparty_id); + print $langs->trans("ThirdParty") . ': ' . $company_static->getNomUrl(1); + } else { + $tmpid = preg_replace('/userid_/', '', $thirdparty_id); + $user_static->fetch($tmpid); + print $langs->trans("User") . ': ' . $user_static->getNomUrl(1); + } + print '
    '; - if (is_numeric($thirdparty_id)) - { - $company_static->fetch($thirdparty_id); - print $langs->trans("ThirdParty").': '.$company_static->getNomUrl(1); - } - else - { - $tmpid = preg_replace('/userid_/', '', $thirdparty_id); - $user_static->fetch($tmpid); - print $langs->trans("User").': '.$user_static->getNomUrl(1); - } - print '
    ' . $fields['link'] . '' . dol_print_date($fields['datef'], 'day') . '' . dol_print_date($fields['datep'], 'day') . '' . $fields['drate'] . ''; + if ($fields['pid']) { + $product_static->id = $fields['pid']; + $product_static->ref = $fields['pref']; + $product_static->type = $fields['dtype']; // We force with the type of line to have type how line is registered + print $product_static->getNomUrl(1); + if (dol_string_nohtmltag($fields['descr'])) { + print ' - ' . dol_trunc(dol_string_nohtmltag($fields['descr']), 24); + } + } else { + if ($type) { + $text = img_object($langs->trans('Service'), 'service'); + } else { + $text = img_object($langs->trans('Product'), 'product'); + } + if (preg_match('/^\((.*)\)$/', $fields['descr'], $reg)) { + if ($reg[1] == 'DEPOSIT') { + $fields['descr'] = $langs->transnoentitiesnoconv('Deposit'); + } elseif ($reg[1] == 'CREDIT_NOTE') { + $fields['descr'] = $langs->transnoentitiesnoconv('CreditNote'); + } else { + $fields['descr'] = $langs->transnoentitiesnoconv($reg[1]); + } + } + print $text . ' ' . dol_trunc(dol_string_nohtmltag($fields['descr']), 24); + + // Show range + print_date_range($fields['ddate_start'], $fields['ddate_end']); + } + print ''; + print price($fields['totalht']); + if (price2num($fields['ftotal_ttc'])) { + //print $fields['dtotal_ttc']."/".$fields['ftotal_ttc']." - "; + $ratiolineinvoice = ($fields['dtotal_ttc'] / $fields['ftotal_ttc']); + //print ' ('.round($ratiolineinvoice*100,2).'%)'; + } + print ''; + //print $fields['totalht']."-".$fields['payment_amount']."-".$fields['ftotal_ttc']; + if ($fields['payment_amount'] && $fields['ftotal_ttc']) { + $payment_static->id = $fields['payment_id']; + print $payment_static->getNomUrl(2); + } + if (($type == 0 && $conf->global->TAX_MODE_SELL_PRODUCT == 'invoice') + || ($type == 1 && $conf->global->TAX_MODE_SELL_SERVICE == 'invoice')) { + print $langs->trans("NA"); + } else { + if (isset($fields['payment_amount']) && price2num($fields['ftotal_ttc'])) { + $ratiopaymentinvoice = ($fields['payment_amount'] / $fields['ftotal_ttc']); + } + print price(price2num($fields['payment_amount'], 'MT')); + if (isset($fields['payment_amount'])) { + print ' (' . round($ratiopaymentinvoice * 100, 2) . '%)'; + } + } + print ''; + $temp_ht = $fields['totalht'] * $ratiopaymentinvoice; + print price(price2num($temp_ht, 'MT'), 1); + print ''; + $temp_vat = $fields['vat'] * $ratiopaymentinvoice; + print price(price2num($temp_vat, 'MT'), 1); + //print price($fields['vat']); + print '
    ' . $langs->trans("Total") . ':  ' . price(price2num($subtot_coll_total_ht, 'MT')) . '' . price(price2num($subtot_coll_vat, 'MT')) . '
    '.$langs->trans("Total").':  '.price(price2num(0, 'MT')).''.price(price2num(0, 'MT')).'
     
    '.$elementsup.''.$langs->trans("DateInvoice").''.$langs->trans("DatePayment").''.$namesup.''.$productsup.''.$amountsup.''.$langs->trans("Payment").' ('.$langs->trans("PercentOfInvoice").')'.$langs->trans("AmountHTVATRealPaid").''.$vatsup.'
    '; + if (is_numeric($thirdparty_id)) { + $company_static->fetch($thirdparty_id); + print $langs->trans("ThirdParty") . ': ' . $company_static->getNomUrl(1); + } else { + $tmpid = preg_replace('/userid_/', '', $thirdparty_id); + $user_static->fetch($tmpid); + print $langs->trans("User") . ': ' . $user_static->getNomUrl(1); + } + print '
    '.$fields['link'].'' . $fields['link'] . '' . dol_print_date($fields['datef'], 'day') . '' . dol_print_date($fields['datef'], 'day') . '' . dol_print_date($fields['datep'], 'day') . '' . dol_print_date($fields['datep'], 'day') . '' . $fields['drate'] . '' . $fields['company_link'] . ''; - if ($fields['pid']) - { - $product_static->id=$fields['pid']; - $product_static->ref=$fields['pref']; - $product_static->type=$fields['dtype']; // We force with the type of line to have type how line is registered - print $product_static->getNomUrl(1); - if (dol_string_nohtmltag($fields['descr'])) { - print ' - '.dol_trunc(dol_string_nohtmltag($fields['descr']), 24); - } - } - else - { - if ($type) { - $text = img_object($langs->trans('Service'), 'service'); - } else { - $text = img_object($langs->trans('Product'), 'product'); - } - if (preg_match('/^\((.*)\)$/', $fields['descr'], $reg)) { - if ($reg[1]=='DEPOSIT') { - $fields['descr']=$langs->transnoentitiesnoconv('Deposit'); - } elseif ($reg[1]=='CREDIT_NOTE') { - $fields['descr']=$langs->transnoentitiesnoconv('CreditNote'); - } else { - $fields['descr']=$langs->transnoentitiesnoconv($reg[1]); - } - } - print $text.' '.dol_trunc(dol_string_nohtmltag($fields['descr']), 24); + // Description + print ''; + if ($fields['pid']) { + $product_static->id = $fields['pid']; + $product_static->ref = $fields['pref']; + $product_static->type = $fields['dtype']; // We force with the type of line to have type how line is registered + print $product_static->getNomUrl(1); + if (dol_string_nohtmltag($fields['descr'])) { + print ' - ' . dol_trunc(dol_string_nohtmltag($fields['descr']), 24); + } + } else { + if ($type) { + $text = img_object($langs->trans('Service'), 'service'); + } else { + $text = img_object($langs->trans('Product'), 'product'); + } + if (preg_match('/^\((.*)\)$/', $fields['descr'], $reg)) { + if ($reg[1] == 'DEPOSIT') { + $fields['descr'] = $langs->transnoentitiesnoconv('Deposit'); + } elseif ($reg[1] == 'CREDIT_NOTE') { + $fields['descr'] = $langs->transnoentitiesnoconv('CreditNote'); + } else { + $fields['descr'] = $langs->transnoentitiesnoconv($reg[1]); + } + } + print $text . ' ' . dol_trunc(dol_string_nohtmltag($fields['descr']), 24); - // Show range - print_date_range($fields['ddate_start'], $fields['ddate_end']); - } - print ''; - print price($fields['totalht']); - if (price2num($fields['ftotal_ttc'])) - { - //print $fields['dtotal_ttc']."/".$fields['ftotal_ttc']." - "; - $ratiolineinvoice=($fields['dtotal_ttc']/$fields['ftotal_ttc']); - //print ' ('.round($ratiolineinvoice*100,2).'%)'; - } - print ''; + print price($fields['totalht']); + if (price2num($fields['ftotal_ttc'])) { + //print $fields['dtotal_ttc']."/".$fields['ftotal_ttc']." - "; + $ratiolineinvoice = ($fields['dtotal_ttc'] / $fields['ftotal_ttc']); + //print ' ('.round($ratiolineinvoice*100,2).'%)'; + } + print ''; - //print $fields['totalht']."-".$fields['payment_amount']."-".$fields['ftotal_ttc']; - if ($fields['payment_amount'] && $fields['ftotal_ttc']) - { - $payment_static->id=$fields['payment_id']; - print $payment_static->getNomUrl(2); - } - if (($type == 0 && $conf->global->TAX_MODE_SELL_PRODUCT == 'invoice') - || ($type == 1 && $conf->global->TAX_MODE_SELL_SERVICE == 'invoice')) - { - print $langs->trans("NA"); - } else { - if (isset($fields['payment_amount']) && price2num($fields['ftotal_ttc'])) { - $ratiopaymentinvoice=($fields['payment_amount']/$fields['ftotal_ttc']); - } - print price(price2num($fields['payment_amount'], 'MT')); - if (isset($fields['payment_amount'])) { - print ' ('.round($ratiopaymentinvoice*100, 2).'%)'; - } - } - print ''; + if ($fields['payment_amount'] && $fields['ftotal_ttc']) + { + $paymentfourn_static->id = $fields['payment_id']; + print $paymentfourn_static->getNomUrl(2); + } - // Total collected - print ''; - $temp_ht=$fields['totalht']*$ratiopaymentinvoice; - print price(price2num($temp_ht, 'MT'), 1); - print ''; - $temp_vat=$fields['vat']*$ratiopaymentinvoice; - print price(price2num($temp_vat, 'MT'), 1); - //print price($fields['vat']); - print '
    '; + $temp_ht = $fields['totalht'] * $ratiopaymentinvoice; + print price(price2num($temp_ht, 'MT'), 1); + print '
    '.$langs->trans("Total").':  '.price(price2num($subtot_coll_total_ht, 'MT')).''.price(price2num($subtot_coll_vat, 'MT')).'
    '; + $temp_vat = $fields['vat'] * $ratiopaymentinvoice; + print price(price2num($temp_vat, 'MT'), 1); + //print price($fields['vat']); + print '
    '.$langs->trans("Total").':  '.price(price2num(0, 'MT')).''.price(price2num(0, 'MT')).'
    ' . $langs->trans("Total") . ':  ' . price(price2num($subtot_paye_total_ht, 'MT')) . '' . price(price2num($subtot_paye_vat, 'MT')) . '
     
    '.$langs->trans("Total").':  '.price(price2num(0, 'MT')).''.price(price2num(0, 'MT')).'
    '.$elementsup.''.$langs->trans("DateInvoice").''.$langs->trans("DatePayment").''.$namesup.''.$productsup.''.$amountsup.''.$langs->trans("Payment").' ('.$langs->trans("PercentOfInvoice").')'.$langs->trans("AmountHTVATRealPaid").''.$vatsup.'
    '; - foreach (array_keys($x_paye) as $thirdparty_id) - { - $subtot_paye_total_ht = 0; - $subtot_paye_vat = 0; + // Total to pay + print '

    '; + print ''; + $diff = $x_coll_sum - $x_paye_sum; + print ''; + print ''; + print '\n"; + print "\n"; - if (is_array($x_both[$thirdparty_id]['paye']['detail'])) - { - print ""; - print ''; - print ''."\n"; - - foreach ($x_both[$thirdparty_id]['paye']['detail'] as $index=>$fields) { - // Define type - // We MUST use dtype (type in line). We can use something else, only if dtype is really unknown. - $type=(isset($fields['dtype'])?$fields['dtype']:$fields['ptype']); - // Try to enhance type detection using date_start and date_end for free lines where type - // was not saved. - if (!empty($fields['ddate_start'])) { - $type=1; - } - if (!empty($fields['ddate_end'])) { - $type=1; - } - - - print ''; - - // Ref - print ''; - - // Invoice date - print ''; - - // Payment date - if ($conf->global->TAX_MODE_BUY_PRODUCT == 'payment' || $conf->global->TAX_MODE_BUY_SERVICE == 'payment') print ''; - else print ''; - - // Company name - print ''; - - // Description - print ''; - - // Total HT - if ($modetax != 1) - { - print ''; - } - - // Payment - $ratiopaymentinvoice=1; - if ($modetax != 1) - { - print ''; - } - - // VAT paid - print ''; - - // VAT - print ''; - print ''; - - $subtot_paye_total_ht += $temp_ht; - $subtot_paye_vat += $temp_vat; - $x_paye_sum += $temp_vat; - } - } - // Total suppliers for this vat rate - print ''; - print ''; - print ''; - if ($modetax != 1) { - print ''; - print ''; - } - print ''; - print ''; - print ''; - } - - if (count($x_paye) == 0) { // Show a total line if nothing shown - print ''; - print ''; - print ''; - if ($modetax != 1) { - print ''; - print ''; - } - print ''; - print ''; - print ''; - } - - print '
    '.$langs->trans("TotalToPay").($q?', '.$langs->trans("Quadri").' '.$q:'').''.price(price2num($diff, 'MT'))."
    '; - if (is_numeric($thirdparty_id)) - { - $company_static->fetch($thirdparty_id); - print $langs->trans("ThirdParty").': '.$company_static->getNomUrl(1); - } - else - { - $tmpid = preg_replace('/userid_/', '', $thirdparty_id); - $user_static->fetch($tmpid); - print $langs->trans("User").': '.$user_static->getNomUrl(1); - } - print '
    '.$fields['link'].'' . dol_print_date($fields['datef'], 'day') . '' . dol_print_date($fields['datep'], 'day') . '' . $fields['company_link'] . ''; - if ($fields['pid']) - { - $product_static->id=$fields['pid']; - $product_static->ref=$fields['pref']; - $product_static->type=$fields['dtype']; // We force with the type of line to have type how line is registered - print $product_static->getNomUrl(1); - if (dol_string_nohtmltag($fields['descr'])) { - print ' - '.dol_trunc(dol_string_nohtmltag($fields['descr']), 24); - } - } - else - { - if ($type) { - $text = img_object($langs->trans('Service'), 'service'); - } else { - $text = img_object($langs->trans('Product'), 'product'); - } - if (preg_match('/^\((.*)\)$/', $fields['descr'], $reg)) { - if ($reg[1]=='DEPOSIT') { - $fields['descr']=$langs->transnoentitiesnoconv('Deposit'); - } elseif ($reg[1]=='CREDIT_NOTE') { - $fields['descr']=$langs->transnoentitiesnoconv('CreditNote'); - } else { - $fields['descr']=$langs->transnoentitiesnoconv($reg[1]); - } - } - print $text.' '.dol_trunc(dol_string_nohtmltag($fields['descr']), 24); - - // Show range - print_date_range($fields['ddate_start'], $fields['ddate_end']); - } - print ''; - print price($fields['totalht']); - if (price2num($fields['ftotal_ttc'])) - { - //print $fields['dtotal_ttc']."/".$fields['ftotal_ttc']." - "; - $ratiolineinvoice=($fields['dtotal_ttc']/$fields['ftotal_ttc']); - //print ' ('.round($ratiolineinvoice*100,2).'%)'; - } - print ''; - if ($fields['payment_amount'] && $fields['ftotal_ttc']) - { - $paymentfourn_static->id=$fields['payment_id']; - print $paymentfourn_static->getNomUrl(2); - } - - if (($type == 0 && $conf->global->TAX_MODE_BUY_PRODUCT == 'invoice') - || ($type == 1 && $conf->global->TAX_MODE_BUY_SERVICE == 'invoice')) - { - print $langs->trans("NA"); - } - else - { - if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) { - $ratiopaymentinvoice=($fields['payment_amount']/$fields['ftotal_ttc']); - } - print price(price2num($fields['payment_amount'], 'MT')); - if (isset($fields['payment_amount'])) { - print ' ('.round($ratiopaymentinvoice*100, 2).'%)'; - } - } - print ''; - $temp_ht=$fields['totalht']*$ratiopaymentinvoice; - print price(price2num($temp_ht, 'MT'), 1); - print ''; - $temp_vat=$fields['vat']*$ratiopaymentinvoice; - print price(price2num($temp_vat, 'MT'), 1); - //print price($fields['vat']); - print '
    '.$langs->trans("Total").':  '.price(price2num($subtot_paye_total_ht, 'MT')).''.price(price2num($subtot_paye_vat, 'MT')).'
    '.$langs->trans("Total").':  '.price(price2num(0, 'MT')).''.price(price2num(0, 'MT')).'
    '; - - // Total to pay - print '

    '; - print ''; - $diff = $x_coll_sum - $x_paye_sum; - print ''; - print ''; - print '\n"; - print "\n"; - - $i++; + $i++; } print '
    '.$langs->trans("TotalToPay").($q?', '.$langs->trans("Quadri").' '.$q:'').''.price(price2num($diff, 'MT'))."
    '; diff --git a/htdocs/compta/tva/document.php b/htdocs/compta/tva/document.php index bb8819f9588..78a1029b2f4 100644 --- a/htdocs/compta/tva/document.php +++ b/htdocs/compta/tva/document.php @@ -131,7 +131,7 @@ if ($object->id) } - print ''; + print '
    '; print ''; print ''; diff --git a/htdocs/compta/tva/list.php b/htdocs/compta/tva/list.php index 6d5f5ffbc13..061008f42a8 100644 --- a/htdocs/compta/tva/list.php +++ b/htdocs/compta/tva/list.php @@ -150,7 +150,7 @@ if ($result) $newcardbutton=''; if ($user->rights->tax->charges->creer) { - $newcardbutton=''.$langs->trans('NewVATPayment'); + $newcardbutton=''.$langs->trans('NewVATPayment').''; $newcardbutton.= ''; $newcardbutton.= ''; } diff --git a/htdocs/contact/agenda.php b/htdocs/contact/agenda.php index cf2c198d36e..5b9e84f2d16 100644 --- a/htdocs/contact/agenda.php +++ b/htdocs/contact/agenda.php @@ -261,7 +261,7 @@ else { if (! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create)) { - $newcardbutton.=''.$langs->trans("AddAction").''; + $newcardbutton.=''.$langs->trans("AddAction").''; $newcardbutton.= ''; $newcardbutton.= ''; } diff --git a/htdocs/contact/document.php b/htdocs/contact/document.php index 1f2f895fed8..86f2dc8c3c9 100644 --- a/htdocs/contact/document.php +++ b/htdocs/contact/document.php @@ -124,7 +124,7 @@ if ($object->id) print '
    '; print '
    '; - print '
    '.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
    '.$langs->trans("TotalSizeOfAttachedFiles").''.dol_print_size($totalsize, 1, 1).'
    '; + print '
    '; // Company /* diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 4419c087a3c..a5fe555151f 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -453,7 +453,7 @@ $massactionbutton=$form->selectMassAction('', $arrayofmassactions); $newcardbutton=''; if ($user->rights->societe->contact->creer) { - $newcardbutton=''.$langs->trans('NewContactAddress').''; + $newcardbutton=''.$langs->trans('NewContactAddress').''; $newcardbutton.= ''; $newcardbutton.= ''; } diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 1b638849538..c61e2e6177a 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -540,7 +540,7 @@ if (empty($reshook)) } $desc=$prod->description; - $desc=dol_concatdesc($desc, $product_desc, '', !empty($conf->global->CHANGE_ORDER_CONCAT_DESCRIPTION)); + $desc=dol_concatdesc($desc, $product_desc, '', !empty($conf->global->MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION)); $fk_unit = $prod->fk_unit; } else @@ -1212,7 +1212,7 @@ if ($action == 'create') { print ''; } print ''."\n"; @@ -1254,7 +1254,7 @@ if ($action == 'create') print '"; } diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index f89ad5e7307..79fc66dfce8 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -1374,7 +1374,6 @@ class Contrat extends CommonObject if ($this->statut >= 0) { - $this->db->begin(); // Clean parameters $pu_ht=price2num($pu_ht); @@ -1394,7 +1393,7 @@ class Contrat extends CommonObject if (empty($txtva) || ! is_numeric($txtva)) $txtva=0; if (empty($txlocaltax1) || ! is_numeric($txlocaltax1)) $txlocaltax1=0; if (empty($txlocaltax2) || ! is_numeric($txlocaltax2)) $txlocaltax2=0; - + if ($price_base_type=='HT') { $pu=$pu_ht; @@ -1406,6 +1405,14 @@ class Contrat extends CommonObject // Check parameters if (empty($remise_percent)) $remise_percent=0; + + if ($date_start && $date_end && $date_start > $date_end) { + $langs->load("errors"); + $this->error=$langs->trans('ErrorStartDateGreaterEnd'); + return -1; + } + + $this->db->begin(); $localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->societe, $mysoc); @@ -1596,6 +1603,12 @@ class Contrat extends CommonObject { $remise_percent=0; } + + if ($date_start && $date_end && $date_start > $date_end) { + $langs->load("errors"); + $this->error=$langs->trans('ErrorStartDateGreaterEnd'); + return -1; + } dol_syslog(get_class($this)."::updateline $rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $date_debut_reel, $date_fin_reel, $tvatx, $localtax1tx, $localtax2tx, $price_base_type, $info_bits"); diff --git a/htdocs/contrat/contact.php b/htdocs/contrat/contact.php index 1e8fbcbfdee..1235fe301cf 100644 --- a/htdocs/contrat/contact.php +++ b/htdocs/contrat/contact.php @@ -204,7 +204,7 @@ if ($id > 0 || ! empty($ref)) print '
    '; print '
    '; - print '
    '; print $form->select_company('', 'socid', '', 'SelectThirdParty', 1, 0, null, 0, 'minwidth300'); - print ' '.$langs->trans("AddThirdParty").' '; + print ' '.$langs->trans("AddThirdParty").''; print '
    '.$langs->trans("Project").''; $formproject->select_projects(($soc->id>0?$soc->id:-1), $projectid, "projectid", 0, 0, 1, 1); - print '   id).'">' . $langs->trans("AddProject") . ' '; + print '   id).'">' . $langs->trans("AddProject") . ''; print "
    '; + print '
    '; // Ligne info remises tiers diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php index 64ecff642f7..27d97572529 100644 --- a/htdocs/contrat/document.php +++ b/htdocs/contrat/document.php @@ -178,7 +178,7 @@ if ($object->id) print '
    '; - print '
    '; + print '
    '; print ''; print ''; print '
    '.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
    '.$langs->trans("TotalSizeOfAttachedFiles").''.dol_print_size($totalsize, 1, 1).'
    '; diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index d27460e4b6a..38473252377 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -1,12 +1,13 @@ - * Copyright (C) 2004-2017 Laurent Destailleur + * Copyright (C) 2004-2019 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2015 Claudio Aschieri * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2016-2018 Ferran Marcet + * Copyright (C) 2019 Nicolas ZABOURI * * 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 @@ -25,7 +26,7 @@ /** * \file htdocs/contrat/list.php * \ingroup contrat - * \brief Page liste des contrats + * \brief Page to list contracts */ require '../main.inc.php'; @@ -375,7 +376,7 @@ $massactionbutton=$form->selectMassAction('', $arrayofmassactions); $newcardbutton=''; if ($user->rights->contrat->creer) { - $newcardbutton=''.$langs->trans('NewContractSubscription').''; + $newcardbutton=''.$langs->trans('NewContractSubscription').''; $newcardbutton.= ''; $newcardbutton.= ''; } @@ -549,11 +550,11 @@ if (! empty($arrayfields['lower_planned_end_date']['checked'])) { print '
    '; $arrayofoperators=array('0'=>'','='=>'=','<='=>'<=','>='=>'>='); - print $form->selectarray('search_op2df', $arrayofoperators, $search_op2df, 0); + print $form->selectarray('search_op2df', $arrayofoperators, $search_op2df, 0, 0, 0, '', 0, 0, 0, '', 'maxwidth50imp'); print '
    '; - print $formother->select_month($search_dfmonth, 'search_dfmonth', 1, 0, 'valignmiddle'); + print $formother->select_month($search_dfmonth, 'search_dfmonth', 1, 0); print ' '; - $formother->select_year($search_dfyear, 'search_dfyear', 1, 20, 5, 0, 0, '', 'valignmiddle'); + $formother->select_year($search_dfyear, 'search_dfyear', 1, 20, 5, 0, 0, ''); print '
    '; print ''; diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 03eab8be202..55dda5a5934 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -539,7 +539,7 @@ if ($massaction == 'confirm_createbills') // Create bills from orders { $orders = GETPOST('toselect', 'array'); $createbills_onebythird = GETPOST('createbills_onebythird', 'int'); - $validate_invoices = GETPOST('valdate_invoices', 'int'); + $validate_invoices = GETPOST('validate_invoices', 'int'); $TFact = array(); $TFactThird = array(); @@ -616,6 +616,12 @@ if ($massaction == 'confirm_createbills') // Create bills from orders for ($i=0;$i<$num;$i++) { $desc=($lines[$i]->desc?$lines[$i]->desc:$lines[$i]->libelle); + // If we build one invoice for several order, we must put the invoice of order on the line + if (! empty($createbills_onebythird)) + { + $desc=dol_concatdesc($desc, $langs->trans("Order").' '.$cmd->ref.' - '.dol_print_date($cmd->date, 'day', $langs)); + } + if ($lines[$i]->subprice < 0) { // Negative line, we create a discount line diff --git a/htdocs/core/class/comment.class.php b/htdocs/core/class/comment.class.php index 1bf7a4eb9db..9aaa577d838 100644 --- a/htdocs/core/class/comment.class.php +++ b/htdocs/core/class/comment.class.php @@ -43,9 +43,19 @@ class Comment extends CommonObject */ public $description; + /** + * Date modification record (tms) + * + * @var integer + */ public $tms; - public $datec; + /** + * Date creation record (datec) + * + * @var integer + */ + public $datec; /** * @var int ID diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 6e939a6278c..9dd49ea8864 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -598,6 +598,7 @@ abstract class CommonInvoice extends CommonObject // 2 : application de la règle, le N du mois courant ou suivant elseif ($cdr_type == 2 && !empty($cdr_decalage)) { + include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $datelim = $this->date + ($cdr_nbjour * 3600 * 24); $date_piece = dol_mktime(0, 0, 0, date('m', $datelim), date('d', $datelim), date('Y', $datelim)); // Sans les heures minutes et secondes diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 7b83dce5394..7294d77aa07 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5169,8 +5169,9 @@ abstract class CommonObject $table_element = $this->table_element; if ($table_element == 'categorie') $table_element = 'categories'; // For compatibility + dol_syslog(get_class($this)."::insertExtraFields delete then insert", LOG_DEBUG); + $sql_del = "DELETE FROM ".MAIN_DB_PREFIX.$table_element."_extrafields WHERE fk_object = ".$this->id; - dol_syslog(get_class($this)."::insertExtraFields delete", LOG_DEBUG); $this->db->query($sql_del); $sql = "INSERT INTO ".MAIN_DB_PREFIX.$table_element."_extrafields (fk_object"; @@ -5181,6 +5182,17 @@ abstract class CommonObject if ($extrafields->attributes[$this->table_element]['type'][$attributeKey] != 'separate') // Only for other type than separator $sql.=",".$attributeKey; } + // We must insert a default value for fields for other entities that are mandatory to avoid not null error + if (is_array($extrafields->attributes[$this->table_element]['mandatoryfieldsofotherentities'])) + { + foreach($extrafields->attributes[$this->table_element]['mandatoryfieldsofotherentities'] as $tmpkey => $tmpval) + { + if (! isset($extrafields->attributes[$this->table_element]['type'][$tmpkey])) // If field not already added previously + { + $sql.=",".$tmpkey; + } + } + } $sql .= ") VALUES (".$this->id; foreach($new_array_options as $key => $value) @@ -5199,10 +5211,23 @@ abstract class CommonObject } } } + // We must insert a default value for fields for other entities that are mandatory to avoid not null error + if (is_array($extrafields->attributes[$this->table_element]['mandatoryfieldsofotherentities'])) + { + foreach($extrafields->attributes[$this->table_element]['mandatoryfieldsofotherentities'] as $tmpkey => $tmpval) + { + if (! isset($extrafields->attributes[$this->table_element]['type'][$tmpkey])) // If field not already added previously + { + if (in_array($tmpval, array('int', 'double'))) $sql.=", 0"; + else $sql.=", ''"; + } + } + } + $sql.=")"; - dol_syslog(get_class($this)."::insertExtraFields insert", LOG_DEBUG); $resql = $this->db->query($sql); + if (! $resql) { $this->error=$this->db->lasterror(); diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index ecbecdeee2d..12d6b337fd0 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -659,8 +659,8 @@ class Conf if (! isset($this->global->MAIN_EXTRAFIELDS_IN_ONE_TD)) $this->global->MAIN_EXTRAFIELDS_IN_ONE_TD = 1; - $this->global->MAIN_MODULE_DOLISTORE_API_SRV='https://www.dolistore.com'; - $this->global->MAIN_MODULE_DOLISTORE_API_KEY='dolistorecatalogpublickey1234567'; + if (empty($this->global->MAIN_MODULE_DOLISTORE_API_SRV)) $this->global->MAIN_MODULE_DOLISTORE_API_SRV='https://www.dolistore.com'; + if (empty($this->global->MAIN_MODULE_DOLISTORE_API_KEY)) $this->global->MAIN_MODULE_DOLISTORE_API_KEY='dolistorecatalogpublickey1234567'; // For backward compatibility if (isset($this->product)) $this->produit=$this->product; diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php index 0a681b95b18..93b51d0ddf8 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -73,7 +73,12 @@ class DiscountAbsolute */ public $description; - public $datec; // Date creation + /** + * Date creation record (datec) + * + * @var integer + */ + public $datec; /** * @var int ID invoice line when a discount is used into an invoice line (for absolute discounts) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index ce8916c1871..32238ea4ef8 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -864,8 +864,8 @@ class ExtraFields $sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,langs,list,totalizable,fielddefault,fieldcomputed,entity,enabled,help"; $sql.= " FROM ".MAIN_DB_PREFIX."extrafields"; - $sql.= " WHERE entity IN (0,".$conf->entity.")"; - if ($elementtype) $sql.= " AND elementtype = '".$elementtype."'"; // Filed with object->table_element + //$sql.= " WHERE entity IN (0,".$conf->entity.")"; // Filter is done later + if ($elementtype) $sql.= " WHERE elementtype = '".$elementtype."'"; // Filed with object->table_element $sql.= " ORDER BY pos"; $resql=$this->db->query($sql); @@ -875,6 +875,16 @@ class ExtraFields { while ($tab = $this->db->fetch_object($resql)) { + if ($tab->entity != 0 && $tab->entity != $conf->entity) + { + // This field is not in current entity. We discard but before we save it into the array of mandatory fields if it is a mandatory field without default value + if ($tab->fieldrequired && is_null($tab->fielddefault)) + { + $this->attributes[$tab->elementtype]['mandatoryfieldsofotherentities'][$tab->name]=$tab->type; + } + continue; + } + // We can add this attribute to object. TODO Remove this and return $this->attributes[$elementtype]['label'] if ($tab->type != 'separate') { @@ -1643,7 +1653,7 @@ class ExtraFields } elseif ($type == 'phone') { - $value=dol_print_phone($value, '', 0, 0, '', ' ', 1); + $value=dol_print_phone($value, '', 0, 0, '', ' ', 'phone'); } elseif ($type == 'price') { diff --git a/htdocs/core/class/fiscalyear.class.php b/htdocs/core/class/fiscalyear.class.php index 014946434be..5c6a5b4cf4d 100644 --- a/htdocs/core/class/fiscalyear.class.php +++ b/htdocs/core/class/fiscalyear.class.php @@ -63,10 +63,28 @@ class Fiscalyear extends CommonObject * @var string fiscal year label */ public $label; - + + /** + * Date start (date_start) + * + * @var integer + */ public $date_start; + + /** + * Date end (date_end) + * + * @var integer + */ public $date_end; - public $datec; + + /** + * Date creation record (datec) + * + * @var integer + */ + public $datec; + public $statut; // 0=open, 1=closed /** diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 9905cd1252a..4f61435f124 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5841,10 +5841,10 @@ class Form * @param string $morecss Add more class to css styles * @param int $addjscombo Add js combo * @param string $moreparamonempty Add more param on the empty option line. Not used if show_empty not set - * @param int $disablebademail Check if an email is found into value and if not disable and colorize entry + * @param int $disablebademail 1=Check if a not valid email, 2=Check string '---', and if found into value, disable and colorize entry * @param int $nohtmlescape No html escaping. * @return string HTML select string. - * @see multiselectarray, selectArrayAjax, selectArrayFilter + * @see multiselectarray(), selectArrayAjax(), selectArrayFilter() */ public static function selectarray($htmlname, $array, $id = '', $show_empty = 0, $key_in_label = 0, $value_as_key = 0, $moreparam = '', $translate = 0, $maxlen = 0, $disabled = 0, $sort = '', $morecss = '', $addjscombo = 0, $moreparamonempty = '', $disablebademail = 0, $nohtmlescape = 0) { @@ -5902,9 +5902,9 @@ class Form $disabled=''; $style=''; if (! empty($disablebademail)) { - if (! preg_match('/<.+@.+>/', $value)) + if (($disablebademail == 1 && ! preg_match('/<.+@.+>/', $value)) + || ($disablebademail == 2 && preg_match('/---/', $value))) { - //$value=preg_replace('/'.preg_quote($a,'/').'/', $b, $value); $disabled=' disabled'; $style=' class="warning"'; } @@ -6610,7 +6610,11 @@ class Form // Can complete the possiblelink array $hookmanager->initHooks(array('commonobject')); $parameters=array('listofidcompanytoscan' => $listofidcompanytoscan); - $reshook=$hookmanager->executeHooks('showLinkToObjectBlock', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + + if (! empty($listofidcompanytoscan)) // If empty, we don't have criteria to scan the object we can link to + { + $reshook=$hookmanager->executeHooks('showLinkToObjectBlock', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + } if (empty($reshook)) { diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index 6afe7552187..c9c1bc3d782 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -205,7 +205,7 @@ class FormActions $newcardbutton=''; if (! empty($conf->agenda->enabled)) { - $newcardbutton = ''.$langs->trans("AddEvent").''; + $newcardbutton = ''.$langs->trans("AddEvent").''; $newcardbutton.= ''; $newcardbutton.= ''; } diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 5f6958ae206..10a91c3fb07 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1044,7 +1044,7 @@ class FormFile * @param int $disablemove 1=Disable move button, 0=Position move is possible. * @param int $addfilterfields Add line with filters * @return int <0 if KO, nb of files shown if OK - * @see list_of_autoecmfiles + * @see list_of_autoecmfiles() */ public function list_of_documents($filearray, $object, $modulepart, $param = '', $forcedownload = 0, $relativepath = '', $permonobject = 1, $useinecm = 0, $textifempty = '', $maxlength = 0, $title = '', $url = '', $showrelpart = 0, $permtoeditline = -1, $upload_dir = '', $sortfield = '', $sortorder = 'ASC', $disablemove = 1, $addfilterfields = 0) { diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 1bb59077bec..3957e44daf5 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -63,8 +63,8 @@ class FormOther * @param string $selected Id modele pre-selectionne * @param string $htmlname Nom de la zone select * @param string $type Type des modeles recherches - * @param int $useempty Affiche valeur vide dans liste - * @param int $fk_user Utilisateur créant le modèle + * @param int $useempty Show an empty value in list + * @param int $fk_user User that has created the template (this is set to null to get all export model when EXPORTS_SHARE_MODELS is on) * @return void */ public function select_export_model($selected = '', $htmlname = 'exportmodelid', $type = '', $useempty = 0, $fk_user = null) @@ -73,7 +73,7 @@ class FormOther $sql = "SELECT rowid, label"; $sql.= " FROM ".MAIN_DB_PREFIX."export_model"; $sql.= " WHERE type = '".$type."'"; - if (!empty($fk_user)) $sql.=" AND fk_user=".$fk_user; + if (!empty($fk_user)) $sql.=" AND fk_user IN (0, ".$fk_user.")"; // An export model $sql.= " ORDER BY rowid"; $result = $this->db->query($sql); if ($result) @@ -848,7 +848,7 @@ class FormOther * @param string $morecss More Css * @return string */ - public function select_month($selected = '', $htmlname = 'monthid', $useempty = 0, $longlabel = 0, $morecss = '') + public function select_month($selected = '', $htmlname = 'monthid', $useempty = 0, $longlabel = 0, $morecss = 'maxwidth50imp valignmiddle') { // phpcs:enable global $langs; @@ -895,7 +895,7 @@ class FormOther * @param string $morecss More CSS * @return string */ - public function select_year($selected = '', $htmlname = 'yearid', $useempty = 0, $min_year = 10, $max_year = 5, $offset = 0, $invert = 0, $option = '', $morecss = 'valignmiddle widthauto') + public function select_year($selected = '', $htmlname = 'yearid', $useempty = 0, $min_year = 10, $max_year = 5, $offset = 0, $invert = 0, $option = '', $morecss = 'valignmiddle maxwidth75imp') { // phpcs:enable print $this->selectyear($selected, $htmlname, $useempty, $min_year, $max_year, $offset, $invert, $option, $morecss); @@ -915,7 +915,7 @@ class FormOther * @param string $morecss More css * @return string */ - public function selectyear($selected = '', $htmlname = 'yearid', $useempty = 0, $min_year = 10, $max_year = 5, $offset = 0, $invert = 0, $option = '', $morecss = 'valignmiddle widthauto') + public function selectyear($selected = '', $htmlname = 'yearid', $useempty = 0, $min_year = 10, $max_year = 5, $offset = 0, $invert = 0, $option = '', $morecss = 'valignmiddle maxwidth75imp') { $out=''; diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index 1e596209cdb..0c16deab43b 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -572,12 +572,13 @@ class Utils */ public function generateDoc($module) { - global $conf, $langs, $user; + global $conf, $langs, $user, $mysoc; global $dirins; $error = 0; $modulelowercase=strtolower($module); + $now=dol_now(); // Dir for module $dir = $dirins.'/'.$modulelowercase; @@ -688,16 +689,16 @@ class Utils //var_dump($phpfileval['fullname']); $arrayreplacement=array( - 'mymodule'=>strtolower($modulename), - 'MyModule'=>$modulename, - 'MYMODULE'=>strtoupper($modulename), - 'My module'=>$modulename, - 'my module'=>$modulename, - 'Mon module'=>$modulename, - 'mon module'=>$modulename, - 'htdocs/modulebuilder/template'=>strtolower($modulename), + 'mymodule'=>strtolower($module), + 'MyModule'=>$module, + 'MYMODULE'=>strtoupper($module), + 'My module'=>$module, + 'my module'=>$module, + 'Mon module'=>$module, + 'mon module'=>$module, + 'htdocs/modulebuilder/template'=>strtolower($module), '__MYCOMPANY_NAME__'=>$mysoc->name, - '__KEYWORDS__'=>$modulename, + '__KEYWORDS__'=>$module, '__USER_FULLNAME__'=>$user->getFullName($langs), '__USER_EMAIL__'=>$user->email, '__YYYY-MM-DD__'=>dol_print_date($now, 'dayrfc'), diff --git a/htdocs/core/db/mssql.class.php b/htdocs/core/db/mssql.class.php index 4c95098813d..efffd5059c6 100644 --- a/htdocs/core/db/mssql.class.php +++ b/htdocs/core/db/mssql.class.php @@ -161,7 +161,7 @@ class DoliDBMssql extends DoliDB * @param string $name name of database (not used for mysql, used for pgsql) * @param int $port Port of database server * @return false|resource|true Database access handler - * @see close + * @see close() */ public function connect($host, $login, $passwd, $name, $port = 0) { @@ -216,7 +216,7 @@ class DoliDBMssql extends DoliDB * Close database connexion * * @return bool True if disconnect successfull, false otherwise - * @see connect + * @see connect() */ public function close() { @@ -511,7 +511,7 @@ class DoliDBMssql extends DoliDB * * @param resource $resultset Resulset of requests * @return int Nb of lines - * @see affected_rows + * @see affected_rows() */ public function num_rows($resultset) { @@ -527,7 +527,7 @@ class DoliDBMssql extends DoliDB * * @param resource $resultset Curseur de la requete voulue * @return int Nombre de lignes - * @see num_rows + * @see num_rows() */ public function affected_rows($resultset) { diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 1e244df883f..6b546f5dfc3 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -191,7 +191,7 @@ class DoliDBMysqli extends DoliDB * @param string $name name of database (not used for mysql, used for pgsql) * @param integer $port Port of database server * @return mysqli Database access object - * @see close + * @see close() */ public function connect($host, $login, $passwd, $name, $port = 0) { @@ -228,7 +228,7 @@ class DoliDBMysqli extends DoliDB * Close database connexion * * @return bool True if disconnect successfull, false otherwise - * @see connect + * @see connect() */ public function close() { @@ -280,6 +280,7 @@ class DoliDBMysqli extends DoliDB if ($conf->global->SYSLOG_LEVEL < LOG_DEBUG) dol_syslog(get_class($this)."::query SQL Error query: ".$query, LOG_ERR); // Log of request was not yet done previously dol_syslog(get_class($this)."::query SQL Error message: ".$this->lasterrno." ".$this->lasterror, LOG_ERR); + //var_dump(debug_print_backtrace()); } $this->lastquery=$query; $this->_results = $ret; @@ -324,7 +325,7 @@ class DoliDBMysqli extends DoliDB * Return datas as an array * * @param mysqli_result $resultset Resultset of request - * @return array|null|0 Array or null if KO or end of cursor or 0 if resultset is bool + * @return array|null|int Array or null if KO or end of cursor or 0 if resultset is bool */ public function fetch_row($resultset) { @@ -348,7 +349,7 @@ class DoliDBMysqli extends DoliDB * * @param mysqli_result $resultset Resulset of requests * @return int Nb of lines - * @see affected_rows + * @see affected_rows() */ public function num_rows($resultset) { @@ -364,7 +365,7 @@ class DoliDBMysqli extends DoliDB * * @param mysqli_result $resultset Curseur de la requete voulue * @return int Nombre de lignes - * @see num_rows + * @see num_rows() */ public function affected_rows($resultset) { @@ -868,7 +869,7 @@ class DoliDBMysqli extends DoliDB if ($field_desc['default'] != '') { if ($field_desc['type'] == 'double' || $field_desc['type'] == 'tinyint' || $field_desc['type'] == 'int') $sql.=" DEFAULT ".$this->escape($field_desc['default']); - elseif ($field_desc['type'] == 'text') $sql.=" DEFAULT '".$this->escape($field_desc['default'])."'"; // Default not supported on text fields + elseif ($field_desc['type'] != 'text') $sql.=" DEFAULT '".$this->escape($field_desc['default'])."'"; // Default not supported on text fields } dol_syslog(get_class($this)."::DDLUpdateField ".$sql, LOG_DEBUG); @@ -952,7 +953,7 @@ class DoliDBMysqli extends DoliDB * Note: if we are connected to databasename, it is same result than using SELECT default_character_set_name FROM information_schema.SCHEMATA WHERE schema_name = "databasename";) * * @return string Charset - * @see getDefaultCollationDatabase + * @see getDefaultCollationDatabase() */ public function getDefaultCharacterSetDatabase() { @@ -998,7 +999,7 @@ class DoliDBMysqli extends DoliDB * Return collation used in current database * * @return string Collation value - * @see getDefaultCharacterSetDatabase + * @see getDefaultCharacterSetDatabase() */ public function getDefaultCollationDatabase() { diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 6e72d9c435a..2777f2d0365 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -396,7 +396,7 @@ class DoliDBPgsql extends DoliDB * @param string $name Name of database (not used for mysql, used for pgsql) * @param integer $port Port of database server * @return false|resource Database access handler - * @see close + * @see close() */ public function connect($host, $login, $passwd, $name, $port = 0) { @@ -471,7 +471,7 @@ class DoliDBPgsql extends DoliDB * Close database connexion * * @return boolean True if disconnect successfull, false otherwise - * @see connect + * @see connect() */ public function close() { @@ -605,7 +605,7 @@ class DoliDBPgsql extends DoliDB * * @param resourse $resultset Resulset of requests * @return int Nb of lines, -1 on error - * @see affected_rows + * @see affected_rows() */ public function num_rows($resultset) { @@ -1176,7 +1176,7 @@ class DoliDBPgsql extends DoliDB if ($field_desc['default'] != '') { if ($field_desc['type'] == 'double' || $field_desc['type'] == 'tinyint' || $field_desc['type'] == 'int') $sql.=" DEFAULT ".$this->escape($field_desc['default']); - elseif ($field_desc['type'] == 'text') $sql.=" DEFAULT '".$this->escape($field_desc['default'])."'"; // Default not supported on text fields + elseif ($field_desc['type'] != 'text') $sql.=" DEFAULT '".$this->escape($field_desc['default'])."'"; // Default not supported on text fields } dol_syslog($sql, LOG_DEBUG); diff --git a/htdocs/core/db/sqlite3.class.php b/htdocs/core/db/sqlite3.class.php index 5ed0a05ee2a..b7d06870ff5 100644 --- a/htdocs/core/db/sqlite3.class.php +++ b/htdocs/core/db/sqlite3.class.php @@ -321,7 +321,7 @@ class DoliDBSqlite3 extends DoliDB * @param string $name name of database (not used for mysql, used for pgsql) * @param integer $port Port of database server * @return SQLite3 Database access handler - * @see close + * @see close() */ public function connect($host, $login, $passwd, $name, $port = 0) { @@ -377,7 +377,7 @@ class DoliDBSqlite3 extends DoliDB * Close database connexion * * @return bool True if disconnect successfull, false otherwise - * @see connect + * @see connect() */ public function close() { @@ -557,7 +557,7 @@ class DoliDBSqlite3 extends DoliDB * * @param SQLite3Result $resultset Resulset of requests * @return int Nb of lines - * @see affected_rows + * @see affected_rows() */ public function num_rows($resultset) { @@ -578,7 +578,7 @@ class DoliDBSqlite3 extends DoliDB * * @param SQLite3Result $resultset Resulset of requests * @return int Nb of lines - * @see affected_rows + * @see affected_rows() */ public function affected_rows($resultset) { diff --git a/htdocs/core/js/lib_foot.js.php b/htdocs/core/js/lib_foot.js.php index 265504cf3f3..14c69259b98 100644 --- a/htdocs/core/js/lib_foot.js.php +++ b/htdocs/core/js/lib_foot.js.php @@ -53,6 +53,7 @@ if (empty($conf->dol_no_mouse_hover)) hide: { delay: 50 }, tooltipClass: "mytooltip", content: function () { + console.log("Return title for popup"); return $(this).prop(\'title\'); /* To force to get title as is */ } });'."\n"; diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php index 6a16357f6fa..db86d5e8b58 100644 --- a/htdocs/core/js/lib_head.js.php +++ b/htdocs/core/js/lib_head.js.php @@ -1009,6 +1009,23 @@ function getParameterByName(name, valueifnotfound) function dolroundjs(number, decimals) { return +(Math.round(number + "e+" + decimals) + "e-" + decimals); } +/** + * Function similar to PHP price() + * + * @param {number|string} amount The amount to show + * @param {string} mode 'MT' or 'MU' + * @return {string} The amount with digits + */ +function pricejs(amount, mode) { + var main_max_dec_shown = global->MAIN_MAX_DECIMALS_SHOWN); ?>; + var main_rounding_unit = global->MAIN_MAX_DECIMALS_UNIT; ?>; + var main_rounding_tot = global->MAIN_MAX_DECIMALS_TOT; ?>; + + if (mode == 'MU') return amount.toFixed(main_rounding_unit); + if (mode == 'MT') return amount.toFixed(main_rounding_tot); + return 'Bad value for parameter mode'; +} + /** * Function similar to PHP price2num() * diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 32ee83ae027..d6fe993aa2d 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -730,7 +730,7 @@ function show_projects($conf, $langs, $db, $object, $backtopage = '', $nocreatel $newcardbutton=''; if (! empty($conf->projet->enabled) && $user->rights->projet->creer && empty($nocreatelink)) { - $newcardbutton=''.$langs->trans("AddProject").''; + $newcardbutton=''.$langs->trans("AddProject").''; $newcardbutton.= ''; $newcardbutton.= ''; } @@ -934,7 +934,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '') if ($user->rights->societe->contact->creer) { $addcontact = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("AddContact") : $langs->trans("AddContactAddress")); - $newcardbutton=''.$addcontact.''; + $newcardbutton=''.$addcontact.''; $newcardbutton.= ''; $newcardbutton.= ''; } diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index b2c7edf4590..d3a3ab08671 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1823,24 +1823,27 @@ function deleteFilesIntoDatabaseIndex($dir, $file, $mode = 'uploaded') * @param string $fileinput Input file name * @param string $ext Format of target file (It is also extension added to file if fileoutput is not provided). * @param string $fileoutput Output filename + * @param string $page Page number if we convert a PDF into png * @return int <0 if KO, 0=Nothing done, >0 if OK */ -function dol_convert_file($fileinput, $ext = 'png', $fileoutput = '') +function dol_convert_file($fileinput, $ext = 'png', $fileoutput = '', $page = '') { global $langs; - if (class_exists('Imagick')) { - $image=new Imagick(); + $image=new Imagick(); try { - $ret = $image->readImage($fileinput); + $filetoconvert=$fileinput.(($page != '')?'['.$page.']':''); + //var_dump($filetoconvert); + $ret = $image->readImage($filetoconvert); } catch(Exception $e) { - dol_syslog("Failed to read image using Imagick. Try to install package 'apt-get install ghostscript'.", LOG_WARNING); + $ext = pathinfo($fileinput, PATHINFO_EXTENSION); + dol_syslog("Failed to read image using Imagick (Try to install package 'apt-get install php-imagick ghostscript' and check there is no policy to disable ".$ext." convertion in /etc/ImageMagick*/policy.xml): ".$e->getMessage(), LOG_WARNING); return 0; } if ($ret) { - $ret = $image->setImageFormat($ext); + $ret = $image->setImageFormat($ext); if ($ret) { if (empty($fileoutput)) $fileoutput=$fileinput.".".$ext; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 9160cf57933..80cd10afb54 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -982,7 +982,7 @@ function dol_strtoupper($utf8_string) */ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename = '', $restricttologhandler = '') { - global $conf, $user; + global $conf, $user, $debugbar; // If syslog module enabled if (empty($conf->syslog->enabled)) return; @@ -998,8 +998,8 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename = if (! empty($message)) { // Test log level - $logLevels = array(LOG_EMERG, LOG_ALERT, LOG_CRIT, LOG_ERR, LOG_WARNING, LOG_NOTICE, LOG_INFO, LOG_DEBUG); - if (!in_array($level, $logLevels, true)) + $logLevels = array(LOG_EMERG=>'EMERG', LOG_ALERT=>'ALERT', LOG_CRIT=>'CRITICAL', LOG_ERR=>'ERR', LOG_WARNING=>'WARN', LOG_NOTICE=>'NOTICE', LOG_INFO=>'INFO', LOG_DEBUG=>'DEBUG'); + if (! array_key_exists($level, $logLevels)) { throw new Exception('Incorrect log level'); } @@ -1008,9 +1008,10 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename = $message = preg_replace('/password=\'[^\']*\'/', 'password=\'hidden\'', $message); // protection to avoid to have value of password in log // If adding log inside HTML page is required - if (! empty($_REQUEST['logtohtml']) && (! empty($conf->global->MAIN_ENABLE_LOG_TO_HTML) || ! empty($conf->global->MAIN_LOGTOHTML))) // MAIN_LOGTOHTML kept for backward compatibility + if ((! empty($_REQUEST['logtohtml']) && ! empty($conf->global->MAIN_ENABLE_LOG_TO_HTML)) + || (! empty($user->rights->debugbar->read) && is_object($debugbar))) { - $conf->logbuffer[] = dol_print_date(time(), "%Y-%m-%d %H:%M:%S")." ".$message; + $conf->logbuffer[] = dol_print_date(time(), "%Y-%m-%d %H:%M:%S")." ".$logLevels[$level]." ".$message; } //TODO: Remove this. MAIN_ENABLE_LOG_INLINE_HTML should be deprecated and use a log handler dedicated to HTML output @@ -1381,53 +1382,46 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi $filepath = $dir_output . $subdir . "/"; - $file = $filepath . $objectref . ".pdf"; + $filepdf = $filepath . $objectref . ".pdf"; $relativepath = $subdir.'/'.$objectref.'.pdf'; // Define path to preview pdf file (preview precompiled "file.ext" are "file.ext_preview.png") - $fileimage = $file.'_preview.png'; // If PDF has 1 page - $fileimagebis = $file.'_preview-0.png'; // If PDF has more than one page + $fileimage = $filepdf.'_preview.png'; $relativepathimage = $relativepath.'_preview.png'; - // Si fichier PDF existe - if (file_exists($file)) + $pdfexists = file_exists($filepdf); + + // If PDF file exists + if ($pdfexists) { - $encfile = urlencode($file); // Conversion du PDF en image png si fichier png non existant - if ( (! file_exists($fileimage) || (filemtime($fileimage) < filemtime($file))) - && (! file_exists($fileimagebis) || (filemtime($fileimagebis) < filemtime($file))) - ) + if (! file_exists($fileimage) || (filemtime($fileimage) < filemtime($filepdf))) { - if (empty($conf->global->MAIN_DISABLE_PDF_THUMBS)) // If you experienc trouble with pdf thumb generation and imagick, you can disable here. + if (empty($conf->global->MAIN_DISABLE_PDF_THUMBS)) // If you experience trouble with pdf thumb generation and imagick, you can disable here. { include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $ret = dol_convert_file($file, 'png', $fileimage); + $ret = dol_convert_file($filepdf, 'png', $fileimage, '0'); // Convert first page of PDF into a file _preview.png if ($ret < 0) $error++; } } + } + if ($pdfexists && ! $error) + { $heightforphotref=70; if (! empty($conf->dol_optimize_smallscreen)) $heightforphotref=60; - // Si fichier png PDF d'1 page trouve + // If the preview file is found if (file_exists($fileimage)) { $phototoshow = '
    '; $phototoshow.= ''; $phototoshow.= '
    '; } - // Si fichier png PDF de plus d'1 page trouve - elseif (file_exists($fileimagebis)) - { - $preview = preg_replace('/\.png/', '', $relativepathimage) . "-0.png"; - $phototoshow = '
    '; - $phototoshow.= '

    '; - $phototoshow.= '

    '; - } } } elseif (! $phototoshow) { - $phototoshow = $form->showphoto($modulepart, $object, 0, 0, 0, 'photoref', 'small', 1, 0, $maxvisiblephotos); + $phototoshow.= $form->showphoto($modulepart, $object, 0, 0, 0, 'photoref', 'small', 1, 0, $maxvisiblephotos); } if ($phototoshow) @@ -1440,7 +1434,7 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi if (! $phototoshow) // Show No photo link (picto of pbject) { - $morehtmlleft.='
    '; + $morehtmlleft.='
    '; if ($object->element == 'action') { $width=80; @@ -1791,7 +1785,7 @@ function dol_print_date($time, $format = '', $tzoutput = 'tzserver', $outputlang || preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])$/i', $time, $reg)) // Deprecated. Ex: 1970-01-01, 1970-01-01 01:00:00, 19700101010000 { // TODO Remove this. This part of code should not be used. - dol_syslog("Functions.lib::dol_print_date function call with deprecated value of time in page ".$_SERVER["PHP_SELF"], LOG_ERR); + dol_syslog("Functions.lib::dol_print_date function call with deprecated value of time in page ".$_SERVER["PHP_SELF"], LOG_WARNING); //if (function_exists('debug_print_backtrace')) debug_print_backtrace(); // Date has format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS' or 'YYYYMMDDHHMMSS' $syear = (! empty($reg[1]) ? $reg[1] : ''); @@ -3681,7 +3675,7 @@ function img_searchclear($titlealt = 'default', $other = '') * @param string $text Text info * @param integer $infoonimgalt Info is shown only on alt of star picto, otherwise it is show on output after the star picto * @param int $nodiv No div - * @param string $admin '1'=Info for admin users. '0'=Info for standard users (change only the look), 'xxx'=Other + * @param string $admin '1'=Info for admin users. '0'=Info for standard users (change only the look), 'error','xxx'=Other * @param string $morecss More CSS * @return string String with info text */ @@ -5760,7 +5754,7 @@ function dol_textishtml($msg, $option = 0) * @param string $text1 Text 1 * @param string $text2 Text 2 * @param bool $forxml false=Use
    instead of \n if html content detected, true=Use
    instead of \n if html content detected - * @param bool $invert invert order of description lines if CONF CHANGE_ORDER_CONCAT_DESCRIPTION is active + * @param bool $invert invert order of description lines (we often use config MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION in this parameter) * @return string Text 1 + new line + Text2 * @see dol_textishtml() */ @@ -7164,7 +7158,7 @@ function complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, */ function printCommonFooter($zone = 'private') { - global $conf, $hookmanager, $user; + global $conf, $hookmanager, $user, $debugbar; global $action; global $micro_start_time; @@ -7328,11 +7322,17 @@ function printCommonFooter($zone = 'private') // Add Xdebug coverage of code if (defined('XDEBUGCOVERAGE')) { - print_r(xdebug_get_code_coverage()); + print_r(xdebug_get_code_coverage()); } - // If there is some logs in buffer to show - if (count($conf->logbuffer)) + // Add DebugBar data + if (! empty($user->rights->debugbar->read) && is_object($debugbar)) + { + $debugbar['time']->stopMeasure('pageaftermaster'); + print ''."\n"; + print $debugbar->getRenderer()->render(); + } + elseif (count($conf->logbuffer)) // If there is some logs in buffer to show { print "\n"; print "'."\n"; $tplcontent.= ''."\n"; diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index fd51506bd01..fe4f7e3c17a 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -104,7 +104,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->product->enabled', __HANDLER__, 'left', 2800__+MAX_llx_menu__, 'products', 'product', 3__+MAX_llx_menu__, '/product/index.php?mainmenu=products&leftmenu=product&type=0', 'Products', 0, 'products', '$user->rights->produit->lire', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->product->enabled', __HANDLER__, 'left', 2801__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/card.php?mainmenu=products&leftmenu=product&action=create&type=0', 'NewProduct', 1, 'products', '$user->rights->produit->creer', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->product->enabled', __HANDLER__, 'left', 2802__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/list.php?mainmenu=products&leftmenu=product&type=0', 'List', 1, 'products', '$user->rights->produit->lire', '', 2, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->product->enabled', __HANDLER__, 'left', 2803__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/reassort.php?mainmenu=products&type=0', 'Stocks', 1, 'products', '$user->rights->produit->lire && $user->rights->stock->lire', '', 2, 4, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->product->enabled', __HANDLER__, 'left', 2803__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/reassort.php?mainmenu=products&type=0', 'MenuStocks', 1, 'products', '$user->rights->produit->lire && $user->rights->stock->lire', '', 2, 4, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->productbatch->enabled', __HANDLER__, 'left', 2805__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/reassortlot.php?mainmenu=products&type=0', 'StocksByLotSerial', 1, 'products', '$user->rights->produit->lire && $user->rights->stock->lire', '', 2, 5, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->productbatch->enabled', __HANDLER__, 'left', 2806__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/stock/productlot_list.php?mainmenu=products', 'LotSerial', 1, 'products', '$user->rights->produit->lire && $user->rights->stock->lire', '', 2, 6, __ENTITY__); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 4a7fbf6ac98..f810720504b 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1500,7 +1500,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $newmenu->add("/product/list.php?leftmenu=product&type=0", $langs->trans("List"), 1, $user->rights->produit->lire); if (! empty($conf->stock->enabled)) { - $newmenu->add("/product/reassort.php?type=0", $langs->trans("Stocks"), 1, $user->rights->produit->lire && $user->rights->stock->lire); + $newmenu->add("/product/reassort.php?type=0", $langs->trans("MenuStocks"), 1, $user->rights->produit->lire && $user->rights->stock->lire); } if (! empty($conf->productbatch->enabled)) { diff --git a/htdocs/core/modules/modDebugBar.class.php b/htdocs/core/modules/modDebugBar.class.php index 6592ecb5acf..cef0ae2d1ad 100644 --- a/htdocs/core/modules/modDebugBar.class.php +++ b/htdocs/core/modules/modDebugBar.class.php @@ -54,18 +54,7 @@ class modDebugBar extends DolibarrModules $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); $this->picto='technic'; - $this->module_parts = array( - // Set here all hooks context managed by module. To find available hook context, make a "grep -r '>initHooks(' *" on source code. You can also set hook context 'all' - 'hooks' => array( - 'data' => array( - 'main', - 'login', - ), - 'entity' => '0', - ), - // Set this to 1 if feature of module are opened to external users - 'moduleforexternal' => 0, - ); + $this->module_parts = array('moduleforexternal' => 0); // Data directories to create when module is enabled $this->dirs = array(); @@ -80,9 +69,7 @@ class modDebugBar extends DolibarrModules // Constants // Example: $this->const=array(0=>array('MYMODULE_MYNEWCONST1','chaine','myvalue','This is a constant to add',0), // 1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0) ); - $this->const = array( - 0 => array('DEBUGBAR_LOGS_LINES_NUMBER', 'chaine', '100', 'Number of log lines to show in debug bar', 1) - ); + $this->const = array(); // Boxes $this->boxes = array(); diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index 368a41a6fac..f9cb16fc9c0 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -325,6 +325,8 @@ class modProduct extends DolibarrModules 'p.duration' => "Duration",///duration of service 'p.url' => "PublicUrl", 'p.accountancy_code_sell' => "ProductAccountancySellCode", + 'p.accountancy_code_sell_intra' => "ProductAccountancySellIntraCode", + 'p.accountancy_code_sell_export' => "ProductAccountancySellExportCode", 'p.accountancy_code_buy' => "ProductAccountancyBuyCode", 'p.weight' => "Weight", 'p.weight_units' => "WeightUnits", diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 32b3b4b97fc..242389214d8 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -332,19 +332,28 @@ class modSociete extends DolibarrModules 'c.rowid'=>"IdContact",'c.civility'=>"CivilityCode",'c.lastname'=>'Lastname','c.firstname'=>'Firstname','c.poste'=>'PostOrFunction', 'c.datec'=>"DateCreation",'c.tms'=>"DateLastModification",'c.priv'=>"ContactPrivate",'c.address'=>"Address",'c.zip'=>"Zip",'c.town'=>"Town", 'd.nom'=>'State','co.label'=>"Country",'co.code'=>"CountryCode",'c.phone'=>"Phone",'c.fax'=>"Fax",'c.phone_mobile'=>"Mobile",'c.email'=>"EMail", + 'c.statut'=>"Status", 's.rowid'=>"IdCompany",'s.nom'=>"CompanyName",'s.status'=>"Status",'s.code_client'=>"CustomerCode",'s.code_fournisseur'=>"SupplierCode", - 's.client'=>'Customer','s.fournisseur'=>'Supplier' + 's.client'=>'Customer','s.fournisseur'=>'Supplier', + 's.address'=>'Address','s.phone'=>'Phone','s.email'=>"Email", + 't.libelle'=>"ThirdPartyType" ); $this->export_examplevalues_array[$r]=array('s.client'=>'0 (no customer no prospect)/1 (customer)/2 (prospect)/3 (customer and prospect)','s.fournisseur'=>'0 (not a supplier) or 1 (supplier)'); $this->export_TypeFields_array[$r]=array( 'c.civility'=>"List:c_civility:label:code",'c.lastname'=>'Text','c.firstname'=>'Text','c.poste'=>'Text','c.datec'=>"Date",'c.priv'=>"Boolean", 'c.address'=>"Text",'c.zip'=>"Text",'c.town'=>"Text",'d.nom'=>'Text','co.label'=>"List:c_country:label:rowid",'co.code'=>"Text",'c.phone'=>"Text", - 'c.fax'=>"Text",'c.email'=>"Text",'s.rowid'=>"List:societe:nom::thirdparty",'s.nom'=>"Text",'s.status'=>"Status",'s.code_client'=>"Text",'s.code_fournisseur'=>"Text", - 's.client'=>"Text",'s.fournisseur'=>"Text" + 'c.fax'=>"Text",'c.email'=>"Text", + 'c.statut'=>"Status", + 's.rowid'=>"List:societe:nom::thirdparty",'s.nom'=>"Text",'s.status'=>"Status",'s.code_client'=>"Text",'s.code_fournisseur'=>"Text", + 's.client'=>"Text",'s.fournisseur'=>"Text", + 's.address'=>"Text",'s.phone'=>"Text",'s.email'=>"Text", + 't.libelle'=>"Text" ); $this->export_entities_array[$r]=array( 's.rowid'=>"company",'s.nom'=>"company", 's.status'=>'company', 's.code_client'=>"company",'s.code_fournisseur'=>"company", 's.client'=>"company", - 's.fournisseur'=>"company" + 's.fournisseur'=>"company", + 's.address'=>"company", 's.phone'=>"company", 's.email'=>"company", + 't.libelle'=>"company" ); // We define here only fields that use another picto if (empty($conf->fournisseur->enabled)) { @@ -363,6 +372,7 @@ class modSociete extends DolibarrModules $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON c.fk_departement = d.rowid'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON c.fk_pays = co.rowid'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople_extrafields as extra ON extra.fk_object = c.rowid'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as t ON s.fk_typent = t.id'; $this->export_sql_end[$r] .=' WHERE c.entity IN ('.getEntity('socpeople').')'; if (is_object($user) && empty($user->rights->societe->client->voir)) { $this->export_sql_end[$r] .=' AND (sc.fk_user = '.$user->id.' '; diff --git a/htdocs/core/tpl/notes.tpl.php b/htdocs/core/tpl/notes.tpl.php index e88bc059ee4..65876c7f1e5 100644 --- a/htdocs/core/tpl/notes.tpl.php +++ b/htdocs/core/tpl/notes.tpl.php @@ -74,7 +74,7 @@ if (! empty($conf->fckeditor->enabled) && ! empty($conf->global->FCKEDITOR_ENABL else $typeofdata='textarea:12:95%'; print ''."\n"; -print '
    '."\n"; +print '
    '."\n"; if ($module != 'product') { // No public note yet on products print '
    '."\n"; diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index ab905f745de..1aceb9c60ef 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -346,13 +346,13 @@ print ''; $newcardbutton=''; if ($user->rights->cron->create) { - $newcardbutton.=''.$langs->trans("CronCreateJob").''; + $newcardbutton.=''.$langs->trans("CronCreateJob").''; $newcardbutton.= ''; $newcardbutton.= ''; } else { - $newcardbutton.=''.$langs->trans("CronCreateJob").''; + $newcardbutton.=''.$langs->trans("CronCreateJob").''; $newcardbutton.= ''; $newcardbutton.= ''; } diff --git a/htdocs/debugbar/class/DataCollector/DolLogsCollector.php b/htdocs/debugbar/class/DataCollector/DolLogsCollector.php index 8c03bdc2830..8e39c68b6b7 100644 --- a/htdocs/debugbar/class/DataCollector/DolLogsCollector.php +++ b/htdocs/debugbar/class/DataCollector/DolLogsCollector.php @@ -17,7 +17,7 @@ class DolLogsCollector extends MessagesCollector /** * @var int number of lines to show */ - protected $lines; + protected $maxnboflines; /** * Constructor @@ -31,8 +31,10 @@ class DolLogsCollector extends MessagesCollector parent::__construct($name); + $this->nboflines=0; + $this->maxnboflines = empty($conf->global->DEBUGBAR_LOGS_LINES_NUMBER) ? 250 : $conf->global->DEBUGBAR_LOGS_LINES_NUMBER; // High number slows seriously output + $this->path = $path ?: $this->getLogsFile(); - $this->lines = empty($conf->global->DEBUGBAR_LOGS_LINES_NUMBER) ? 250 : $conf->global->DEBUGBAR_LOGS_LINES_NUMBER; // This slow seriously output } /** @@ -68,7 +70,31 @@ class DolLogsCollector extends MessagesCollector */ public function collect() { - $this->getStorageLogs($this->path); + global $conf; + + $uselogfile=$conf->global->DEBUGBAR_USE_LOGFILE; + + if ($uselogfile) + { + $this->getStorageLogs($this->path); + } + else + { + $log_levels = $this->getLevels(); + + foreach ($conf->logbuffer as $line) { + if ($this->nboflines >= $this->maxnboflines) + { + break; + } + foreach ($log_levels as $level_key => $level) { + if (strpos(strtolower($line), strtolower($level_key)) == 20) { + $this->nboflines++; + $this->addMessage($line, $level, false); + } + } + } + } return parent::collect(); } @@ -76,14 +102,13 @@ class DolLogsCollector extends MessagesCollector /** * Get the path to the logs file * - * @return string Path of log file + * @return string */ public function getLogsFile() { - // default dolibarr log file - $path = DOL_DATA_ROOT . '/dolibarr.log'; - - return $path; + // default dolibarr log file + $path = DOL_DATA_ROOT . '/dolibarr.log'; + return $path; } /** @@ -94,16 +119,16 @@ class DolLogsCollector extends MessagesCollector */ public function getStorageLogs($path) { - if (! file_exists($path)) { - return; - } + if (! file_exists($path)) { + return; + } - // Load the latest lines - $file = implode("", $this->tailFile($path, $this->lines)); + // Load the latest lines + $file = implode("", $this->tailFile($path, $this->maxnboflines)); - foreach ($this->getLogs($file) as $log) { - $this->addMessage($log['line'], $log['level'], false); - } + foreach ($this->getLogs($file) as $log) { + $this->addMessage($log['line'], $log['level'], false); + } } /** @@ -115,32 +140,32 @@ class DolLogsCollector extends MessagesCollector */ protected function tailFile($file, $lines) { - $handle = fopen($file, "r"); - $linecounter = $lines; - $pos = -2; - $beginning = false; - $text = []; - while ($linecounter > 0) { - $t = " "; - while ($t != "\n") { - if (fseek($handle, $pos, SEEK_END) == -1) { - $beginning = true; - break; - } - $t = fgetc($handle); - $pos--; - } - $linecounter--; - if ($beginning) { - rewind($handle); - } - $text[$lines - $linecounter - 1] = fgets($handle); - if ($beginning) { - break; - } - } - fclose($handle); - return array_reverse($text); + $handle = fopen($file, "r"); + $linecounter = $lines; + $pos = -2; + $beginning = false; + $text = []; + while ($linecounter > 0) { + $t = " "; + while ($t != "\n") { + if (fseek($handle, $pos, SEEK_END) == -1) { + $beginning = true; + break; + } + $t = fgetc($handle); + $pos--; + } + $linecounter--; + if ($beginning) { + rewind($handle); + } + $text[$lines - $linecounter - 1] = fgets($handle); + if ($beginning) { + break; + } + } + fclose($handle); + return array_reverse($text); } /** @@ -151,21 +176,21 @@ class DolLogsCollector extends MessagesCollector */ public function getLogs($file) { - $pattern = "/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}.*/"; - $log_levels = $this->getLevels(); - preg_match_all($pattern, $file, $matches); - $log = []; - foreach ($matches as $lines) { - foreach ($lines as $line) { - foreach ($log_levels as $level_key => $level) { - if (strpos(strtolower($line), strtolower($level_key)) == 20) { - $log[] = ['level' => $level, 'line' => $line]; - } - } - } - } - $log = array_reverse($log); - return $log; + $pattern = "/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}.*/"; + $log_levels = $this->getLevels(); + preg_match_all($pattern, $file, $matches); + $log = []; + foreach ($matches as $lines) { + foreach ($lines as $line) { + foreach ($log_levels as $level_key => $level) { + if (strpos(strtolower($line), strtolower($level_key)) == 20) { + $log[] = ['level' => $level, 'line' => $line]; + } + } + } + } + $log = array_reverse($log); + return $log; } /** @@ -178,6 +203,7 @@ class DolLogsCollector extends MessagesCollector $class = new ReflectionClass(new LogLevel()); $levels = $class->getConstants(); $levels['ERR'] = 'error'; + $levels['WARN'] = 'warning'; return $levels; } diff --git a/htdocs/debugbar/class/DebugBar.php b/htdocs/debugbar/class/DebugBar.php index d3cc545e1b3..d36583d9852 100644 --- a/htdocs/debugbar/class/DebugBar.php +++ b/htdocs/debugbar/class/DebugBar.php @@ -31,12 +31,12 @@ class DolibarrDebugBar extends DebugBar global $conf; //$this->addCollector(new PhpInfoCollector()); - $this->addCollector(new DolMessagesCollector()); + //$this->addCollector(new DolMessagesCollector()); $this->addCollector(new DolRequestDataCollector()); $this->addCollector(new DolConfigCollector()); $this->addCollector(new DolTimeDataCollector()); $this->addCollector(new DolMemoryCollector()); - $this->addCollector(new DolExceptionsCollector()); + //$this->addCollector(new DolExceptionsCollector()); $this->addCollector(new DolQueryCollector()); $this->addCollector(new DolibarrCollector()); if ($conf->syslog->enabled) { @@ -51,6 +51,10 @@ class DolibarrDebugBar extends DebugBar */ public function getRenderer() { - return parent::getJavascriptRenderer(DOL_URL_ROOT.'/includes/DebugBar/Resources'); + $renderer = parent::getJavascriptRenderer(DOL_URL_ROOT.'/includes/DebugBar/Resources'); + //$renderer->disableVendor('jquery'); + $renderer->disableVendor('fontawesome'); + $renderer->disableVendor('highlightjs'); + return $renderer; } } diff --git a/htdocs/debugbar/class/actions_debugbar.class.php b/htdocs/debugbar/class/actions_debugbar.class.php deleted file mode 100644 index 08790ca1cd3..00000000000 --- a/htdocs/debugbar/class/actions_debugbar.class.php +++ /dev/null @@ -1,113 +0,0 @@ -getRenderer(); - $conf->global->MAIN_HTML_HEADER .= $renderer->renderHead(); - } - - /** - * Overloading the afterLogin function - * - * @param array $parameters Hook metadatas (context, etc...) - * @param CommonObject $object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...) - * @param string $action Current action (if set). Generally create or edit or null - * @param HookManager $hookmanager Hook manager propagated to allow calling another hook - * @return int < 0 on error, 0 on success, 1 to replace standard code - */ - public function afterLogin($parameters, &$object, &$action, $hookmanager) - { - $error = 0; // Error counter - - if (in_array('login', explode(':', $parameters['context']))) - { - $this->loadDebugBar(); - } - - if (! $error) - { - return 0; // or return 1 to replace standard code - } - else - { - return -1; - } - } - - /** - * Overloading the updateSession function - * - * @param array $parameters Hook metadatas (context, etc...) - * @param CommonObject $object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...) - * @param string $action Current action (if set). Generally create or edit or null - * @param HookManager $hookmanager Hook manager propagated to allow calling another hook - * @return int < 0 on error, 0 on success, 1 to replace standard code - */ - public function updateSession($parameters, &$object, &$action, $hookmanager) - { - $error = 0; // Error counter - - if (in_array('main', explode(':', $parameters['context']))) - { - $this->loadDebugBar(); - } - - if (! $error) - { - return 0; // or return 1 to replace standard code - } - else - { - return -1; - } - } - - /** - * Overloading the printCommonFooter function - * - * @param array $parameters Hook metadatas (context, etc...) - * @param CommonObject $object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...) - * @param string $action Current action (if set). Generally create or edit or null - * @param HookManager $hookmanager Hook manager propagated to allow calling another hook - * @return int <0 on error, 0 on success, 1 to replace standard code - */ - public function printCommonFooter($parameters, &$object, &$action, $hookmanager) - { - global $user, $debugbar, $langs; - - $error = 0; // Error counter - $context = explode(':', $parameters['context']); - - if (in_array('main', $context) || in_array('login', $context)) - { - if ($user->rights->debugbar->read && is_object($debugbar)) { - $renderer = $debugbar->getRenderer(); - echo $renderer->render(); - } - } - - if (! $error) - { - return 0; // or return 1 to replace standard code - } - else - { - return -1; - } - } -} diff --git a/htdocs/don/card.php b/htdocs/don/card.php index 08eb9efb094..2e80e4a1fc9 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -372,7 +372,7 @@ if ($action == 'create') }); '; } - print ' '.$langs->trans("AddThirdParty").' '; + print ' '.$langs->trans("AddThirdParty").''; print '
    ".$langs->trans("RemainderToPay")." :'.price($remaintopay)."
    '.price($remaintopay)."
    "; $db->free($resql); diff --git a/htdocs/don/document.php b/htdocs/don/document.php index d0308ab89f4..fcb3c87ad9d 100644 --- a/htdocs/don/document.php +++ b/htdocs/don/document.php @@ -157,7 +157,7 @@ if ($object->id) print '
    '; print '
    '; - print ''; + print '
    '; // Ref /* diff --git a/htdocs/don/list.php b/htdocs/don/list.php index 15648375677..e68b4e46399 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -142,7 +142,7 @@ if ($resql) $newcardbutton=''; if ($user->rights->don->creer) { - $newcardbutton=''.$langs->trans('NewDonation').''; + $newcardbutton=''.$langs->trans('NewDonation').''; $newcardbutton.= ''; $newcardbutton.= ''; } @@ -200,7 +200,7 @@ if ($resql) print $searchpicto; print ''; print "\n"; - + print ''; print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "d.rowid", "", $param, "", $sortfield, $sortorder); if (! empty($conf->global->DONATION_USE_THIRDPARTIES)) { @@ -231,7 +231,7 @@ if ($resql) $donationstatic->firstname=$objp->firstname; print ""; if (! empty($conf->global->DONATION_USE_THIRDPARTIES)) { - + $company=new Societe($db); $result=$company->fetch($objp->socid); if (!empty($objp->socid) && $company->id > 0) { diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 4186d4eae3f..74c71104777 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -961,7 +961,7 @@ if ($action == 'create') print ''; print ''; print ''; } diff --git a/htdocs/expedition/document.php b/htdocs/expedition/document.php index cacc6a874ac..5c178cbdaf2 100644 --- a/htdocs/expedition/document.php +++ b/htdocs/expedition/document.php @@ -94,7 +94,7 @@ if ($id > 0 || ! empty($ref)){ $head = shipping_prepare_head($object); dol_fiche_head($head, 'documents', $langs->trans("Shipment"), -1, 'sending'); - + // Build file list $filearray=dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC), 1); @@ -159,7 +159,7 @@ if ($id > 0 || ! empty($ref)){ print '
    '; print '
    '; - print '
    ".$donationstatic->getNomUrl(1)."
    ' . $langs->trans("Project") . ''; $numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0); - print '   id).'">' . $langs->trans("AddProject") . ' '; + print '   id).'">' . $langs->trans("AddProject") . ''; print '
    '; + print '
    '; print ''; print ''; diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 371be10adbd..b60852f205b 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2016-2018 Ferran Marcet + * Copyright (C) 2019 Nicolas ZABOURI * * 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 @@ -279,7 +280,7 @@ if ($resql) $newcardbutton=''; if ($user->rights->expedition->creer) { - $newcardbutton=''.$langs->trans('NewSending').''; + $newcardbutton=''.$langs->trans('NewSending').''; $newcardbutton.= ''; $newcardbutton.= ''; } @@ -623,6 +624,10 @@ if ($resql) $i++; } + $parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql); + $reshook=$hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + print "
    '.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
    '.$langs->trans("TotalSizeOfAttachedFiles").''.dol_print_size($totalsize, 1, 1).'
    "; print "
    "; print ''; diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index d9b2537e4ba..2108cb82eef 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -436,7 +436,7 @@ if ($id > 0 || ! empty($ref)) print $langs->trans('PaymentConditionsShort'); print '
    id.'">'.img_edit($langs->trans('SetConditions'),1).'id.'">'.img_edit($langs->trans('SetConditions'),1).'
    '; print '
    '; if ($action == 'editconditions') @@ -454,7 +454,7 @@ if ($id > 0 || ! empty($ref)) print ''; - if ($action != 'editmode' && ! empty($object->brouillon)) print ''; + if ($action != 'editmode' && $object->statut == Expedition::STATUS_VALIDATED) print ''; print '
    '; print $langs->trans('PaymentMode'); print 'id.'">'.img_edit($langs->trans('SetMode'),1).'id.'">'.img_edit($langs->trans('SetMode'),1).'
    '; print '
    '; if ($action == 'editmode') diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index c39b67a8680..927e59f4877 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -26,17 +26,18 @@ * \brief Page for trip and expense report card */ -$res=0; require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; +require_once DOL_DOCUMENT_ROOT . '/ecm/class/ecmfiles.class.php'; require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/expensereport.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/price.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/modules/expensereport/modules_expensereport.php'; require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php'; require_once DOL_DOCUMENT_ROOT . '/expensereport/class/paymentexpensereport.class.php'; @@ -1090,9 +1091,18 @@ if (empty($reshook)) $error = 0; // First save uploaded file - if (! empty($_FILES)) + $fk_ecm_files = 0; + if (GETPOSTISSET('attachfile')) { - + $arrayoffiles=GETPOST('attachfile', 'array'); + if (is_array($arrayoffiles) && ! empty($arrayoffiles[0])) + { + include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php'; + $relativepath='expensereport/'.$object->ref.'/'.$arrayoffiles[0]; + $ecmfiles=new EcmFiles($db); + $ecmfiles->fetch(0, '', $relativepath); + $fk_ecm_files = $ecmfiles->id; + } } // if VAT is not used in Dolibarr, set VAT rate to 0 because VAT rate is necessary. @@ -1111,7 +1121,7 @@ if (empty($reshook)) $qty = GETPOST('qty', 'int'); if (empty($qty)) $qty=1; - if (! $fk_c_type_fees > 0) + if (! ($fk_c_type_fees > 0)) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors'); @@ -1144,13 +1154,12 @@ if (empty($reshook)) setEventMessages($langs->trans("WarningDateOfLineMustBeInExpenseReportRange"), null, 'warnings'); } - // S'il y'a eu au moins une erreur if (! $error) { $type = 0; // TODO What if service ? We should take the type product/service from the type of expense report llx_c_type_fees // Insert line - $result = $object->addline($qty, $value_unit, $fk_c_type_fees, $vatrate, $date, $comments, $fk_projet, $fk_c_exp_tax_cat, $type); + $result = $object->addline($qty, $value_unit, $fk_c_type_fees, $vatrate, $date, $comments, $fk_projet, $fk_c_exp_tax_cat, $type, $fk_ecm_files); if ($result > 0) { $ret = $object->fetch($object->id); // Reload to get new records @@ -1340,6 +1349,7 @@ $formproject = new FormProjets($db); $projecttmp = new Project($db); $paymentexpensereportstatic=new PaymentExpenseReport($db); $bankaccountstatic = new Account($db); +$ecmfilesstatic = new EcmFiles($db); // Create if ($action == 'create') @@ -1709,7 +1719,7 @@ else print '
    '; print '
    '; - print ''; + print '
    '; // Author print ''; @@ -1853,7 +1863,7 @@ else print '
    '; print '
    '; - print '
    '; + print '
    '; // Amount print ''; @@ -1979,7 +1989,7 @@ else print ''; print ''; - print ''; + print ''; $db->free($resql); } @@ -2020,7 +2030,7 @@ else if (! empty($conf->projet->enabled)) print ''; if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; @@ -2030,6 +2040,9 @@ else print ''; print ''; } + // Picture + print ''; // Ajout des boutons de modification/suppression if (($object->fk_statut < 2 || $object->fk_statut == 99) && $user->rights->expensereport->creer) { @@ -2102,6 +2115,80 @@ else print ''; } + // Column with preview + print ''; + // Ajout des boutons de modification/suppression if (($object->fk_statut < ExpenseReport::STATUS_VALIDATED || $object->fk_statut == ExpenseReport::STATUS_REFUSED) && $user->rights->expensereport->creer) { @@ -2122,72 +2209,77 @@ else if ($action == 'editline' && $line->rowid == GETPOST('rowid', 'int')) { - print ''; + print ''; - print ''; + print ''; - // Select date - print ''; + // Select date + print ''; - // Select project - if (! empty($conf->projet->enabled)) - { - print ''; - } - - if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) - { - print ''; - } - - // Select type - print ''; - - // Add comments + // Select project + if (! empty($conf->projet->enabled)) + { print ''; + } - // VAT - print ''; + } - // Unit price - print ''; + // Select type + print ''; - // Unit price with tax - print ''; + // Add comments + print ''; - // Quantity - print ''; + // VAT + print ''; - if ($action != 'editline') - { - print ''; - print ''; - } + // Unit price + print ''; - print ''; + // Unit price with tax + print ''; + + // Quantity + print ''; + + if ($action != 'editline') + { + print ''; + print ''; + } + + // Picture + print ''; + + print ''; } $i++; @@ -2197,7 +2289,7 @@ else // Add a line if (($object->fk_statut == ExpenseReport::STATUS_DRAFT || $object->fk_statut == ExpenseReport::STATUS_REFUSED) && $action != 'editline' && $user->rights->expensereport->creer) { - $colspan = 10; + $colspan = 11; if (! empty($conf->global->MAIN_USE_EXPENSE_IK)) $colspan++; if (! empty($conf->projet->enabled)) $colspan++; if ($action != 'editline') $colspan++; @@ -2232,10 +2324,12 @@ else print '$(document).ready(function() { $( ".auploadnewfilenow" ).click(function() { jQuery(".truploadnewfilenow").toggle(); + jQuery(".trattachnewfilenow").hide(); return false; }); $( ".aattachtodoc" ).click(function() { jQuery(".trattachnewfilenow").toggle(); + jQuery(".truploadnewfilenow").hide(); return false; });'; if (is_array(GETPOST('attachfile', 'array')) && count(GETPOST('attachfile', 'array'))) @@ -2249,14 +2343,12 @@ else print ''; // Add line to upload new file - print 'global->MAIN_OPTIMIZEFORTEXTBROWSER)?' style="display: none"':'').'>'; + print 'global->MAIN_OPTIMIZEFORTEXTBROWSER)?' style="display: none"':'').'>'; print 'global->MAIN_OPTIMIZEFORTEXTBROWSER)?' style="display: none"':'').'>'; + print 'global->MAIN_OPTIMIZEFORTEXTBROWSER)?' style="display: none"':'').'>'; print ''; @@ -2363,7 +2497,10 @@ else print ''; print ''; print ''; - print ''; + print ''; + print ''; + print ''; + print ''; print ''; print ''; @@ -2424,6 +2561,9 @@ else print ''; // We must be able to enter decimal qty print ''; + // Picture + print ''; + if ($action != 'editline') { print ''; @@ -2649,7 +2789,6 @@ if (GETPOST('modelselected', 'alpha')) { if ($action != 'presend') { - /* * Generate documents */ @@ -2669,11 +2808,15 @@ if ($action != 'presend') $somethingshown = $formfile->numoffiles; } + // Disabled for expensereport, there is no thirdparty on expensereport, so nothing to define the list of other object we can suggest to link to + /* if ($action != 'create' && $action != 'edit' && ($id || $ref)) { $linktoelem = $form->showLinkToObjectBlock($object, null, array('expensereport')); $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); } + */ + print '
    '; // List of actions on element include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 0bc5c533f9e..b60a8a68b49 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -971,7 +971,7 @@ class ExpenseReport extends CommonObject $this->lines=array(); $sql = ' SELECT de.rowid, de.comments, de.qty, de.value_unit, de.date, de.rang,'; - $sql.= ' de.'.$this->fk_element.', de.fk_c_type_fees, de.fk_c_exp_tax_cat, de.fk_projet as fk_project, de.tva_tx,'; + $sql.= ' de.'.$this->fk_element.', de.fk_c_type_fees, de.fk_c_exp_tax_cat, de.fk_projet as fk_project, de.tva_tx, de.fk_ecm_files,'; $sql.= ' de.total_ht, de.total_tva, de.total_ttc,'; $sql.= ' ctf.code as code_type_fees, ctf.label as libelle_type_fees,'; $sql.= ' p.ref as ref_projet, p.title as title_projet'; @@ -1010,8 +1010,9 @@ class ExpenseReport extends CommonObject $deplig->fk_expensereport = $objp->fk_expensereport; $deplig->fk_c_type_fees = $objp->fk_c_type_fees; $deplig->fk_c_exp_tax_cat = $objp->fk_c_exp_tax_cat; - $deplig->fk_projet = $objp->fk_project; + $deplig->fk_projet = $objp->fk_project; // deprecated $deplig->fk_project = $objp->fk_project; + $deplig->fk_ecm_files = $objp->fk_ecm_files; $deplig->total_ht = $objp->total_ht; $deplig->total_tva = $objp->total_tva; @@ -1687,20 +1688,21 @@ class ExpenseReport extends CommonObject /** * addline * - * @param float $qty Qty - * @param double $up Value init - * @param int $fk_c_type_fees Type payment - * @param string $vatrate Vat rate (Can be '10' or '10 (ABC)') - * @param string $date Date - * @param string $comments Description - * @param int $fk_project Project id - * @param int $fk_c_exp_tax_cat Car category id - * @param int $type Type line - * @return int <0 if KO, >0 if OK + * @param float $qty Qty + * @param double $up Value init + * @param int $fk_c_type_fees Type payment + * @param string $vatrate Vat rate (Can be '10' or '10 (ABC)') + * @param string $date Date + * @param string $comments Description + * @param int $fk_project Project id + * @param int $fk_c_exp_tax_cat Car category id + * @param int $type Type line + * @param int $fk_ecm_files Id of ECM file to link to this expensereport line + * @return int <0 if KO, >0 if OK */ - public function addline($qty = 0, $up = 0, $fk_c_type_fees = 0, $vatrate = 0, $date = '', $comments = '', $fk_project = 0, $fk_c_exp_tax_cat = 0, $type = 0) + public function addline($qty = 0, $up = 0, $fk_c_type_fees = 0, $vatrate = 0, $date = '', $comments = '', $fk_project = 0, $fk_c_exp_tax_cat = 0, $type = 0, $fk_ecm_files = 0) { - global $conf,$langs,$mysoc; + global $conf, $langs, $mysoc; dol_syslog(get_class($this)."::addline qty=$qty, up=$up, fk_c_type_fees=$fk_c_type_fees, vatrate=$vatrate, date=$date, fk_project=$fk_project, type=$type, comments=$comments", LOG_DEBUG); @@ -1750,7 +1752,10 @@ class ExpenseReport extends CommonObject $this->line->fk_c_type_fees = $fk_c_type_fees; $this->line->fk_c_exp_tax_cat = $fk_c_exp_tax_cat; $this->line->comments = $comments; - $this->line->fk_projet = $fk_project; + $this->line->fk_projet = $fk_project; // deprecated + $this->line->fk_project = $fk_project; + + $this->line->fk_ecm_files = $fk_ecm_files; $this->applyOffset(); $this->checkRules($type, $seller); @@ -2497,6 +2502,12 @@ class ExpenseReportLine public $total_tva; public $total_ttc; + /** + * @var int ID into llx_ecm_files table to link line to attached file + */ + public $fk_ecm_files; + + /** * Constructor * @@ -2516,7 +2527,7 @@ class ExpenseReportLine public function fetch($rowid) { $sql = 'SELECT fde.rowid, fde.fk_expensereport, fde.fk_c_type_fees, fde.fk_c_exp_tax_cat, fde.fk_projet as fk_project, fde.date,'; - $sql.= ' fde.tva_tx as vatrate, fde.vat_src_code, fde.comments, fde.qty, fde.value_unit, fde.total_ht, fde.total_tva, fde.total_ttc,'; + $sql.= ' fde.tva_tx as vatrate, fde.vat_src_code, fde.comments, fde.qty, fde.value_unit, fde.total_ht, fde.total_tva, fde.total_ttc, fde.fk_ecm_files,'; $sql.= ' ctf.code as type_fees_code, ctf.label as type_fees_libelle,'; $sql.= ' pjt.rowid as projet_id, pjt.title as projet_title, pjt.ref as projet_ref'; $sql.= ' FROM '.MAIN_DB_PREFIX.'expensereport_det as fde'; @@ -2531,8 +2542,8 @@ class ExpenseReportLine $objp = $this->db->fetch_object($result); $this->rowid = $objp->rowid; - $this->id = $obj->rowid; - $this->ref = $obj->ref; + $this->id = $objp->rowid; + $this->ref = $objp->ref; $this->fk_expensereport = $objp->fk_expensereport; $this->comments = $objp->comments; $this->qty = $objp->qty; @@ -2552,6 +2563,7 @@ class ExpenseReportLine $this->total_ht = $objp->total_ht; $this->total_tva = $objp->total_tva; $this->total_ttc = $objp->total_ttc; + $this->fk_ecm_files = $objp->fk_ecm_files; $this->db->free($result); } else { @@ -2585,7 +2597,7 @@ class ExpenseReportLine $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'expensereport_det'; $sql.= ' (fk_expensereport, fk_c_type_fees, fk_projet,'; - $sql.= ' tva_tx, vat_src_code, comments, qty, value_unit, total_ht, total_tva, total_ttc, date, rule_warning_message, fk_c_exp_tax_cat)'; + $sql.= ' tva_tx, vat_src_code, comments, qty, value_unit, total_ht, total_tva, total_ttc, date, rule_warning_message, fk_c_exp_tax_cat, fk_ecm_files)'; $sql.= " VALUES (".$this->db->escape($this->fk_expensereport).","; $sql.= " ".$this->db->escape($this->fk_c_type_fees).","; $sql.= " ".$this->db->escape($this->fk_project>0?$this->fk_project:($this->fk_projet>0?$this->fk_projet:'null')).","; @@ -2599,7 +2611,8 @@ class ExpenseReportLine $sql.= " ".$this->db->escape($this->total_ttc).","; $sql.= "'".$this->db->idate($this->date)."',"; $sql.= " '".$this->db->escape($this->rule_warning_message)."',"; - $sql.= " ".$this->db->escape($this->fk_c_exp_tax_cat); + $sql.= " ".$this->db->escape($this->fk_c_exp_tax_cat).","; + $sql.= " ".($this->fk_ecm_files > 0 ? $this->fk_ecm_files : 'null'); $sql.= ")"; $resql=$this->db->query($sql); @@ -2645,7 +2658,7 @@ class ExpenseReportLine * @param ExpenseReportRule $rule object rule to check * @param int $fk_user user author id * @param string $mode day|EX_DAY / month|EX_MON / year|EX_YEA to get amount - * @return amount Amount + * @return float Amount */ public function getExpAmount(ExpenseReportRule $rule, $fk_user, $mode = 'day') { @@ -2682,7 +2695,7 @@ class ExpenseReportLine } /** - * update + * Update line * * @param User $user User * @return int <0 if KO, >0 if OK diff --git a/htdocs/expensereport/document.php b/htdocs/expensereport/document.php index b1be48ffc76..f5295118bda 100644 --- a/htdocs/expensereport/document.php +++ b/htdocs/expensereport/document.php @@ -114,7 +114,7 @@ if ($object->id) print '
    '; print '
    '; - print '
    '.$langs->trans("AmountExpected").':'.price($object->total_ttc).'
    '.$langs->trans("RemainderToPay").':'.price($resteapayeraffiche).'
    '.price($resteapayeraffiche).'
    '.$langs->trans('Project').''.$langs->trans('CarCategory').''.$langs->trans('Type').''.$langs->trans('Description').''.$langs->trans('Description').''.$langs->trans('VAT').''.$langs->trans('PriceUHT').''.$langs->trans('PriceUTTC').''.$langs->trans('AmountHT').''.$langs->trans('AmountTTC').''; + print ''.price($line->total_ttc).''; + if ($line->fk_ecm_files > 0) + { + $modulepart='expensereport'; + $maxheightmini=32; + + $result = $ecmfilesstatic->fetch($line->fk_ecm_files); + if ($result > 0) + { + $relativepath=preg_replace('/expensereport\//', '', $ecmfilesstatic->filepath); + $fileinfo = pathinfo($ecmfilesstatic->filepath.'/'.$ecmfilesstatic->filename); + if (image_format_supported($fileinfo['basename']) > 0) + { + $minifile=getImageFileNameForSize($fileinfo['basename'], '_mini'); // For new thumbs using same ext (in lower case howerver) than original + if (! dol_is_file($conf->expensereport->dir_output.'/'.$relativepath.'/'.$minifile)) $minifile=getImageFileNameForSize($fileinfo['basename'], '_mini', '.png'); // For backward compatibility of old thumbs that were created with filename in lower case and with .png extension + //print $file['path'].'/'.$minifile.'
    '; + $urlforhref=getAdvancedPreviewUrl($modulepart, $relativepath.'/'.$fileinfo['filename'].'.'.strtolower($fileinfo['extension']), 1, '&entity='.(!empty($object->entity)?$object->entity:$conf->entity)); + if (empty($urlforhref)) { + $urlforhref=DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.(!empty($object->entity)?$object->entity:$conf->entity).'&file='.urlencode($relativepath.$fileinfo['filename'].'.'.strtolower($fileinfo['extension'])); + print ''; + } else { + print ''; + } + print ''; + print ''; + } + else + { + $modulepart='expensereport'; + $thumbshown=0; + if (preg_match('/\.pdf$/i', $ecmfilesstatic->filename)) + { + $filepdf = $conf->expensereport->dir_output.'/'.$relativepath.'/'.$ecmfilesstatic->filename; + $fileimage = $conf->expensereport->dir_output.'/'.$relativepath.'/'.$ecmfilesstatic->filename.'_preview.png'; + $relativepathimage = $relativepath.'/'.$ecmfilesstatic->filename.'_preview.png'; + + $pdfexists = file_exists($filepdf); + if ($pdfexists) + { + // Conversion du PDF en image png si fichier png non existant + if (! file_exists($fileimage) || (filemtime($fileimage) < filemtime($filepdf))) + { + if (empty($conf->global->MAIN_DISABLE_PDF_THUMBS)) // If you experience trouble with pdf thumb generation and imagick, you can disable here. + { + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + $ret = dol_convert_file($filepdf, 'png', $fileimage, '0'); // Convert first page of PDF into a file _preview.png + if ($ret < 0) $error++; + } + } + } + + if ($pdfexists && ! $error) + { + $heightforphotref=70; + if (! empty($conf->dol_optimize_smallscreen)) $heightforphotref=60; + // If the preview file is found + if (file_exists($fileimage)) + { + $thumbshown=1; + print ''; + } + } + } + + if (! $thumbshown) + { + print img_mime($ecmfilesstatic->filename); + } + } + } + } + print '
    '; - print $form->selectDate($line->date, 'date'); - print ''; + print $form->selectDate($line->date, 'date'); + print ''; - $formproject->select_projects(-1, $line->fk_project, 'fk_projet', 0, 0, 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth300'); - print ''; - $params = array('fk_expense' => $object->id, 'fk_expense_det' => $line->rowid, 'date' => $line->dates); - print $form->selectExpenseCategories($line->fk_c_exp_tax_cat, 'fk_c_exp_tax_cat', 1, array(), 'fk_c_type_fees', $userauthor->default_c_exp_tax_cat, $params); - print ''; - select_type_fees_id($line->fk_c_type_fees, 'fk_c_type_fees'); - print ''; - print ''; + $formproject->select_projects(-1, $line->fk_project, 'fk_projet', 0, 0, 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth300'); print ''; - print $form->load_tva('vatrate', (isset($_POST["vatrate"])?$_POST["vatrate"]:$line->vatrate), $mysoc, '', 0, 0, '', false, 1); + if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) + { + print ''; + $params = array('fk_expense' => $object->id, 'fk_expense_det' => $line->rowid, 'date' => $line->dates); + print $form->selectExpenseCategories($line->fk_c_exp_tax_cat, 'fk_c_exp_tax_cat', 1, array(), 'fk_c_type_fees', $userauthor->default_c_exp_tax_cat, $params); print ''; - print ''; - print ''; + select_type_fees_id($line->fk_c_type_fees, 'fk_c_type_fees'); + print ''; - print ''; - print ''; + print ''; + print ''; - print ''; - print ''; + print $form->load_tva('vatrate', (isset($_POST["vatrate"])?$_POST["vatrate"]:$line->vatrate), $mysoc, '', 0, 0, '', false, 1); + print ''.$langs->trans('AmountHT').''.$langs->trans('AmountTTC').''; + print ''; + print ''; - print ''; - print ''; - print '
    '; - print '
    '; + print ''; + print ''; + print ''; + print ''.$langs->trans('AmountHT').''.$langs->trans('AmountTTC').''; + //print $line->fk_ecm_files; + print ''; + print ''; + print ''; + print '
    '; + print '
    '; $modulepart = 'expensereport'; $permission = $user->rights->expensereport->creer; - $formfile=new FormFile($db); - // We define var to enable the feature to add prefix of uploaded files $savingdocmask=''; if (empty($conf->global->MAIN_DISABLE_SUGGEST_REF_AS_PREFIX)) @@ -2266,10 +2358,6 @@ else { $savingdocmask=dol_sanitizeFileName($object->ref).'-__file__'; } - /*if (in_array($modulepart,array('member'))) - { - $savingdocmask=$object->login.'___file__'; - }*/ } // Show upload form (document and links) @@ -2305,7 +2393,7 @@ else $nbLinks=Link::count($db, $object->element, $object->id); if ($nbFiles >= 0) { - print '
    '; //print ''.$langs->trans("AttachTheNewLineToTheDocument").'
    '; $modulepart='expensereport';$maxheightmini=48; @@ -2316,8 +2404,7 @@ else $fileinfo = pathinfo($file['name']); if (image_format_supported($file['name']) > 0) { - $minifile=getImageFileNameForSize($file['name'], '_mini'); // For new thumbs using same ext (in lower case howerver) than original - //if (! dol_is_file($file['path'].'/'.$minifile)) $minifile=getImageFileNameForSize($file['name'], '_mini', '.png'); // For backward compatibility of old thumbs that were created with filename in lower case and with .png extension + $minifile=getImageFileNameForSize($file['name'], '_mini'); // For new thumbs using same ext (in lower case however) than original //print $file['path'].'/'.$minifile.'
    '; $urlforhref=getAdvancedPreviewUrl($modulepart, $fileinfo['relativename'].'.'.strtolower($fileinfo['extension']), 1, '&entity='.(!empty($object->entity)?$object->entity:$conf->entity)); if (empty($urlforhref)) { @@ -2326,10 +2413,57 @@ else } else { print ''; } - print ''; + print '
    '; + print ''; + print '
    '; print '
    '; } - else print ' '; + else + { + $modulepart='expensereport'; + print '
    '; + $thumbshown=0; + if (preg_match('/\.pdf$/i', $file['name'])) + { + $filepdf = $conf->expensereport->dir_output.'/'.$relativepath.$file['name']; + $fileimage = $conf->expensereport->dir_output.'/'.$relativepath.$file['name'].'_preview.png'; + $relativepathimage = $relativepath.$file['name'].'_preview.png'; + + $pdfexists = file_exists($filepdf); + + if ($pdfexists) + { + // Conversion du PDF en image png si fichier png non existant + if (! file_exists($fileimage) || (filemtime($fileimage) < filemtime($filepdf))) + { + if (empty($conf->global->MAIN_DISABLE_PDF_THUMBS)) // If you experience trouble with pdf thumb generation and imagick, you can disable here. + { + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + $ret = dol_convert_file($filepdf, 'png', $fileimage, '0'); // Convert first page of PDF into a file _preview.png + if ($ret < 0) $error++; + } + } + } + + if ($pdfexists && ! $error) + { + $heightforphotref=70; + if (! empty($conf->dol_optimize_smallscreen)) $heightforphotref=60; + // If the preview file is found + if (file_exists($fileimage)) + { + $thumbshown=1; + print ''; + } + } + } + + if (! $thumbshown) + { + print img_mime($minifile); + } + print '
    '; + } print '
    '; $checked=''; //var_dump(GETPOST($file['relativename'])); var_dump($file['relativename']); var_dump($_FILES['userfile']['name']); @@ -2345,7 +2479,7 @@ else break; } } - print ' '.$file['relativename']; + print '
    '.$file['relativename'].'
    '; print ''; } print '
    '.$langs->trans('PriceUHT').''.$langs->trans('PriceUTTC').''.$langs->trans('Qty').'
    '; + print '
    '; $linkback = ''.$langs->trans("BackToList").''; diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index c221baf7d65..242b60920fe 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -455,7 +455,7 @@ if ($resql) $newcardbutton=''; if ($user->rights->expensereport->creer) { - $newcardbutton=''.$langs->trans('NewTrip').''; + $newcardbutton=''.$langs->trans('NewTrip').''; $newcardbutton.= ''; $newcardbutton.= ''; } diff --git a/htdocs/exports/index.php b/htdocs/exports/index.php index 98b1f4552a0..83208ffa020 100644 --- a/htdocs/exports/index.php +++ b/htdocs/exports/index.php @@ -52,11 +52,11 @@ if (count($export->array_export_code)) { if ($user->rights->export->creer) { - print ''.$langs->trans("NewExport").''; + print ''.$langs->trans("NewExport").''; } else { - print ''.$langs->trans("NewExport").''; + print ''.$langs->trans("NewExport").''; } } print ''; diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index d9434d018c3..47e7dd48589 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -948,7 +948,7 @@ if ($action == 'create') $numprojet=$formproject->select_projects($soc->id, $projectid, 'projectid'); if ($numprojet==0) { - print '   '.$langs->trans("AddProject").' '; + print '   '.$langs->trans("AddProject").''; } print ''; } @@ -961,7 +961,7 @@ if ($action == 'create') $numcontrat=$formcontract->select_contract($soc->id, GETPOST('contratid', 'int'), 'contratid', 0, 1); if ($numcontrat==0) { - print '   '.$langs->trans("AddContract").' '; + print '   '.$langs->trans("AddContract").''; } print ''; } diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 43cd79bfe70..46d898253da 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -5,8 +5,8 @@ * Copyright (C) 2011-2013 Juanjo Menent * Copyright (C) 2015 Marcos García * Copyright (C) 2015 Charlie Benke - * Copyright (C) 2018 Nicolas ZABOURI - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018 Nicolas ZABOURI + * Copyright (C) 2018 Frédéric France * * 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 @@ -69,12 +69,26 @@ class Fichinter extends CommonObject public $socid; // Id client public $author; - public $datec; + + /** + * Date creation record (datec) + * + * @var integer + */ + public $datec; + public $datev; public $dateo; public $datee; public $datet; - public $datem; + + /** + * Date modification record (tms) + * + * @var integer + */ + public $datem; + public $duration; public $statut = 0; // 0=draft, 1=validated, 2=invoiced, 3=Terminate @@ -445,35 +459,56 @@ class Fichinter extends CommonObject * Set status to draft * * @param User $user User that set draft - * @return int <0 if KO, >0 if OK + * @return int <0 if KO, >0 if OK */ public function setDraft($user) { global $langs, $conf; - if ($this->statut != 0) + $error=0; + + // Protection + if ($this->statut <= self::STATUS_DRAFT) { - $this->db->begin(); + return 0; + } - $sql = "UPDATE ".MAIN_DB_PREFIX."fichinter"; - $sql.= " SET fk_statut = 0"; - $sql.= " WHERE rowid = ".$this->id; - $sql.= " AND entity = ".$conf->entity; + dol_syslog(get_class($this)."::setDraft", LOG_DEBUG); - dol_syslog("Fichinter::setDraft", LOG_DEBUG); - $resql=$this->db->query($sql); - if ($resql) - { - $this->db->commit(); - return 1; - } - else - { - $this->db->rollback(); - $this->error=$this->db->lasterror(); - return -1; + $this->db->begin(); + + $sql = "UPDATE ".MAIN_DB_PREFIX."fichinter"; + $sql.= " SET fk_statut = ".self::STATUS_DRAFT; + $sql.= " WHERE rowid = ".$this->id; + + $resql=$this->db->query($sql); + if ($resql) + { + if (!$error) { + $this->oldcopy = clone $this; + } + + if (!$error) { + // Call trigger + $result=$this->call_trigger('FICHINTER_UNVALIDATE', $user); + if ($result < 0) $error++; + } + + if (!$error) { + $this->statut=self::STATUS_DRAFT; + $this->db->commit(); + return 1; + } else { + $this->db->rollback(); + return -1; } } + else + { + $this->db->rollback(); + $this->error=$this->db->lasterror(); + return -1; + } } /** diff --git a/htdocs/fichinter/document.php b/htdocs/fichinter/document.php index a23eab2ae2c..d5aed88079a 100644 --- a/htdocs/fichinter/document.php +++ b/htdocs/fichinter/document.php @@ -154,7 +154,7 @@ if ($object->id) print '
    '; print '
    '; - print '
    '; + print '
    '; print ''; print ''; print '
    '.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
    '.$langs->trans("TotalSizeOfAttachedFiles").''.dol_print_size($totalsize, 1, 1).'
    '; diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index c105d06a852..2a24f1f31ea 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -293,7 +293,7 @@ if ($resql) $newcardbutton=''; if ($user->rights->ficheinter->creer) { - $newcardbutton=''.$langs->trans('NewIntervention').''; + $newcardbutton=''.$langs->trans('NewIntervention').''; $newcardbutton.= ''; $newcardbutton.= ''; } diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index ae17cdecd46..2c6580be662 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -90,7 +90,7 @@ if (empty($reshook)) $mesg=join(',', $object->errors); } } - // conditions de reglement + // terms of the settlement if ($action == 'setconditions' && $user->rights->societe->creer) { $object->fetch($id); @@ -225,7 +225,7 @@ if ($object->id > 0) print $object->tva_intra; print '
    '; diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 5f7789e72f5..3573484f7c7 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1543,6 +1543,11 @@ class CommandeFournisseur extends CommonOrder return -1; } if ($type < 0) return -1; + if ($date_start && $date_end && $date_start > $date_end) { + $langs->load("errors"); + $this->error=$langs->trans('ErrorStartDateGreaterEnd'); + return -1; + } $this->db->begin(); @@ -2470,7 +2475,7 @@ class CommandeFournisseur extends CommonOrder */ public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $price_base_type = 'HT', $info_bits = 0, $type = 0, $notrigger = 0, $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $ref_supplier = '') { - global $mysoc, $conf; + global $mysoc, $conf, $langs; dol_syslog(get_class($this)."::updateline $rowid, $desc, $pu, $qty, $remise_percent, $txtva, $price_base_type, $info_bits, $type, $fk_unit"); include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; @@ -2478,8 +2483,6 @@ class CommandeFournisseur extends CommonOrder if ($this->brouillon) { - $this->db->begin(); - // Clean parameters if (empty($qty)) $qty=0; if (empty($info_bits)) $info_bits=0; @@ -2500,6 +2503,13 @@ class CommandeFournisseur extends CommonOrder // Check parameters if ($type < 0) return -1; + if ($date_start && $date_end && $date_start > $date_end) { + $langs->load("errors"); + $this->error=$langs->trans('ErrorStartDateGreaterEnd'); + return -1; + } + + $this->db->begin(); // Calcul du total TTC et de la TVA pour la ligne a partir de // qty, pu, remise_percent et txtva diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 4450ee611f8..703b90cc831 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -5,7 +5,7 @@ * Copyright (C) 2005 Marc Barilley * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010-2017 Juanjo Menent - * Copyright (C) 2013-2018 Philippe Grand + * Copyright (C) 2013-2019 Philippe Grand * Copyright (C) 2013 Florian Henry * Copyright (C) 2014-2016 Marcos García * Copyright (C) 2015 Bahfir Abbes @@ -113,10 +113,35 @@ class FactureFournisseur extends CommonInvoice public $author; public $libelle; - public $datec; // Creation date - public $tms; // Last update date - public $date; // Invoice date - public $date_echeance; // Max payment date + + /** + * Date creation record (datec) + * + * @var integer + */ + public $datec; + + /** + * Date modification record (tms) + * + * @var integer + */ + public $tms; + + /** + * Invoice date (date) + * + * @var integer + */ + public $date; + + /** + * Max payment date (date_echeance) + * + * @var integer + */ + public $date_echeance; + public $amount=0; public $remise=0; public $tva=0; @@ -1471,16 +1496,22 @@ class FactureFournisseur extends CommonInvoice return 0; } + dol_syslog(get_class($this)."::set_draft", LOG_DEBUG); + $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn"; - $sql.= " SET fk_statut = 0"; + $sql.= " SET fk_statut = ".self::STATUS_DRAFT; $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::set_draft", LOG_DEBUG); $result=$this->db->query($sql); if ($result) { + if (! $error) + { + $this->oldcopy= clone $this; + } + // Si on incremente le produit principal et ses composants a la validation de facture fournisseur, on decremente if ($result >= 0 && ! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL)) { @@ -1585,6 +1616,12 @@ class FactureFournisseur extends CommonInvoice if (!preg_match('/\((.*)\)/', $txtva)) { $txtva = price2num($txtva); // $txtva can have format '5,1' or '5.1' or '5.1(XXX)', we must clean only if '5,1' } + + if ($date_start && $date_end && $date_start > $date_end) { + $langs->load("errors"); + $this->error=$langs->trans('ErrorStartDateGreaterEnd'); + return -1; + } $this->db->begin(); @@ -1806,7 +1843,7 @@ class FactureFournisseur extends CommonInvoice */ public function updateline($id, $desc, $pu, $vatrate, $txlocaltax1 = 0, $txlocaltax2 = 0, $qty = 1, $idproduct = 0, $price_base_type = 'HT', $info_bits = 0, $type = 0, $remise_percent = 0, $notrigger = false, $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $ref_supplier = '') { - global $mysoc; + global $mysoc, $langs; dol_syslog(get_class($this)."::updateline $id,$desc,$pu,$vatrate,$qty,$idproduct,$price_base_type,$info_bits,$type,$remise_percent,$notrigger,$date_start,$date_end,$fk_unit,$pu_ht_devise,$ref_supplier", LOG_DEBUG); include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; @@ -1818,6 +1855,12 @@ class FactureFournisseur extends CommonInvoice // Check parameters //if (! is_numeric($pu) || ! is_numeric($qty)) return -1; if ($type < 0) return -1; + + if ($date_start && $date_end && $date_start > $date_end) { + $langs->load("errors"); + $this->error=$langs->trans('ErrorStartDateGreaterEnd'); + return -1; + } // Clean parameters if (empty($vatrate)) $vatrate=0; diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index bdf480ccfc4..7fc1b990c09 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -200,6 +200,69 @@ if (empty($reshook)) if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); } + // Edit Thirdparty + if (! empty($conf->global->MAIN_CAN_EDIT_SUPPLIER_ON_SUPPLIER_ORDER) && $action == 'set_thirdparty' && $user->rights->fournisseur->commande->creer && $object->statut == CommandeFournisseur::STATUS_DRAFT) + { + $new_socid = GETPOST('new_socid', 'int'); + if(! empty($new_socid) && $new_socid != $object->thirdparty->id) { + $db->begin(); + + // Update supplier + $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande_fournisseur'; + $sql .= ' SET fk_soc='.$new_socid; + $sql.= ' WHERE fk_soc='.$object->thirdparty->id; + $sql.= ' AND rowid='.$object->id; + + $res = $db->query($sql); + + if(! $res) $db->rollback(); + else { + $db->commit(); + + // Replace prices for each lines by new supplier prices + foreach($object->lines as $l) { + $sql = 'SELECT price, unitprice, tva_tx, ref_fourn'; + $sql.= ' FROM '.MAIN_DB_PREFIX.'product_fournisseur_price'; + $sql.= ' WHERE fk_product='.$l->fk_product; + $sql.= ' AND fk_soc='.$new_socid; + $sql.= ' ORDER BY unitprice ASC'; + + $resql = $db->query($sql); + if($resql) { + $num_row = $db->num_rows($resql); + if(empty($num_row)) { + // No product price for this supplier ! + $l->subprice = 0; + $l->total_ht = 0; + $l->total_tva = 0; + $l->total_ttc = 0; + $l->ref_supplier = ''; + $l->update(); + } + else { + // No need for loop to keep best supplier price + $obj = $db->fetch_object($resql); + $l->subprice = $obj->unitprice; + $l->total_ht = $obj->price; + $l->tva_tx = $obj->tva_tx; + $l->total_tva = $l->total_ht * ($obj->tva_tx/100); + $l->total_ttc = $l->total_ht + $l->total_tva; + $l->ref_supplier = $obj->ref_fourn; + $l->update(); + } + } + else { + dol_print_error($db); + } + $db->free($resql); + } + $object->update_price(); + } + } + header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id); + exit; + } + if ($action == 'setremisepercent' && $user->rights->fournisseur->commande->creer) { $result = $object->set_remise($user, $_POST['remise_percent']); @@ -404,7 +467,7 @@ if (empty($reshook)) $desc = $productsupplier->desc_supplier; } else $desc = $productsupplier->description; - if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->CHANGE_ORDER_CONCAT_DESCRIPTION)); + if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION)); $type = $productsupplier->type; $price_base_type = ($productsupplier->fourn_price_base_type?$productsupplier->fourn_price_base_type:'HT'); @@ -1496,7 +1559,7 @@ if ($action=='create') }); '; } - print ' '.$langs->trans("AddThirdParty").' '; + print ' '.$langs->trans("AddThirdParty").''; } 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 '   id).'">' . $langs->trans("AddProject") . ' '; + print '   id).'">' . $langs->trans("AddProject") . ''; print '
    '; print ''; print ''; print ''; print '
    '; @@ -1964,7 +2044,7 @@ elseif (! empty($object->id)) print ''; - if ($action != 'editmulticurrencycode' && ! empty($object->brouillon)) + if ($action != 'editmulticurrencycode' && $object->statut == CommandeFournisseur::STATUS_DRAFT) print ''; print '
    '; print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0); print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '
    '; print '
    '; @@ -1981,7 +2061,7 @@ elseif (! empty($object->id)) print ''; - if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) + if ($action != 'editmulticurrencyrate' && $object->statut == CommandeFournisseur::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) print ''; print '
    '; print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0); print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '
    '; print '
    '; diff --git a/htdocs/fourn/commande/document.php b/htdocs/fourn/commande/document.php index 2c1fce8f6d2..f933ecfdb5f 100644 --- a/htdocs/fourn/commande/document.php +++ b/htdocs/fourn/commande/document.php @@ -160,7 +160,7 @@ if ($object->id > 0) print '
    '; print '
    '; - print ''; + print '
    '; print ''; print ''; print "
    '.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
    '.$langs->trans("TotalSizeOfAttachedFiles").''.dol_print_size($totalsize, 1, 1).'
    \n"; diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index a2351dd7d9a..9af1fd438f9 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -8,6 +8,7 @@ * Copyright (C) 2016 Ferran Marcet * Copyright (C) 2018 Frédéric France * Copyright (C) 2018 Charlene Benke + * Copyright (C) 2019 Nicolas ZABOURI * * 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 @@ -228,7 +229,7 @@ if (empty($reshook)) { $orders = GETPOST('toselect', 'array'); $createbills_onebythird = GETPOST('createbills_onebythird', 'int'); - $validate_invoices = GETPOST('valdate_invoices', 'int'); + $validate_invoices = GETPOST('validate_invoices', 'int'); $TFact = array(); $TFactThird = array(); @@ -631,7 +632,7 @@ if ($resql) $newcardbutton=''; if($user->rights->fournisseur->commande->creer) { - $newcardbutton=''.$langs->trans('NewOrder').''; + $newcardbutton=''.$langs->trans('NewOrder').''; $newcardbutton.= ''; $newcardbutton.= ''; } @@ -682,7 +683,7 @@ if ($resql) print $langs->trans('ValidateInvoices'); print '
    '; - print $form->selectyesno('valdate_invoices', 1, 1); + print $form->selectyesno('validate_invoices', 1, 1); print '
    '; @@ -1159,6 +1160,10 @@ if ($resql) print '
    \n"; print '
    '; print "\n"; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index c2a5552f15e..b19de1c2046 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1247,7 +1247,7 @@ if (empty($reshook)) $desc = $productsupplier->desc_supplier; } else $desc = $productsupplier->description; - if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->CHANGE_ORDER_CONCAT_DESCRIPTION)); + if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION)); $type = $productsupplier->type; $price_base_type = ($productsupplier->fourn_price_base_type?$productsupplier->fourn_price_base_type:'HT'); @@ -1756,7 +1756,7 @@ if ($action == 'create') }); '; } - print ' '.$langs->trans("AddThirdParty").' '; + print ' '.$langs->trans("AddThirdParty").''; } print ''; @@ -2480,7 +2480,7 @@ else print ''.$form->editfieldval("Label", 'label', $object->label, $object, ($user->rights->fournisseur->facture->creer)).''; print ''; - $form_permission = $object->statutrights->fournisseur->facture->creer && $object->getSommePaiement() <= 0; + $form_permission = ($object->statut < FactureFournisseur::STATUS_CLOSED) && $user->rights->fournisseur->facture->creer && ($object->getSommePaiement() <= 0); // Date print ''.$form->editfieldkey("DateInvoice", 'datef', $object->datep, $object, $form_permission, 'datepicker').''; @@ -2495,7 +2495,7 @@ else } print ''; - // Conditions de reglement par defaut + // Default terms of the settlement $langs->load('bills'); print ''; print ''; - print ''; + print ''; } */ @@ -2912,7 +2912,7 @@ else else print $langs->trans('ExcessPaid'); print ' :'; - print ''; + print ''; print ''; } else // Credit note @@ -2934,7 +2934,7 @@ else else print $langs->trans('ExcessPaid'); print ' :'; - print ''; + print ''; print ''; // Sold credit note diff --git a/htdocs/fourn/facture/document.php b/htdocs/fourn/facture/document.php index ec4003dcfb7..55075a5014f 100644 --- a/htdocs/fourn/facture/document.php +++ b/htdocs/fourn/facture/document.php @@ -160,7 +160,7 @@ if ($object->id > 0) print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&urlfile='.urlencode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1); } - print '
    '; @@ -2547,7 +2547,7 @@ else print ''; - if ($action != 'editmulticurrencycode' && ! empty($object->brouillon)) + if ($action != 'editmulticurrencycode' && $object->statut == FactureFournisseur::STATUS_DRAFT) print ''; print '
    '; print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0); print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '
    '; print '
    '; @@ -2564,18 +2564,18 @@ else print ''; - if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) + if ($action != 'editmulticurrencyrate' && $object->statut == FactureFournisseur::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) print ''; print '
    '; print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0); print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '
    '; print '
    '; if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') { - if($action == 'actualizemulticurrencyrate') { + if ($action == 'actualizemulticurrencyrate') { list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code); } $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code); } else { $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code); - if($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) { + if ($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) { print '
            '; print ''.$langs->trans("ActualizeCurrency").''; print '
    '; @@ -2802,7 +2802,7 @@ else $resteapayer = $object->total_ttc - $totalpaye; print '
    '.$langs->trans('RemainderToPay').' :'.price($resteapayer).'
    '.price($resteapayer).'
    ' . price($resteapayeraffiche) . '' . price($resteapayeraffiche) . ' 
    ' . price($sign * $resteapayeraffiche) . '' . price($sign * $resteapayeraffiche) . ' 
    '; + print '
    '; // Type print ''; - print ''; } diff --git a/htdocs/loan/document.php b/htdocs/loan/document.php index eeee232befb..0b7e23bbd3f 100644 --- a/htdocs/loan/document.php +++ b/htdocs/loan/document.php @@ -143,7 +143,7 @@ if ($object->id) } - print '
    '.$langs->trans('Type').''; @@ -232,7 +232,7 @@ if ($object->id > 0) print '
    '; - print ''; + print '
    '; // Nb of files print ''; diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 3a710642b03..2e0f3c17d1f 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -466,7 +466,7 @@ if ($resql) $newcardbutton=''; if ($user->rights->fournisseur->facture->creer) { - $newcardbutton=''.$langs->trans('NewBill').''; + $newcardbutton=''.$langs->trans('NewBill').''; $newcardbutton.= ''; $newcardbutton.= ''; } @@ -518,7 +518,7 @@ if ($resql) print $langs->trans('ValidateInvoices'); print ''; print ''; print ''; print '
    '.$langs->trans('NbOfAttachedFiles').''.count($filearray).'
    '; - print $form->selectyesno('valdate_invoices', 1, 1); + print $form->selectyesno('validate_invoices', 1, 1); print '
    '; diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 1c92e558c41..fc90f8a3ed5 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -1105,7 +1105,7 @@ else print '
    '; print '
    '; - print ''; + print '
    '; print ''; // User @@ -1213,7 +1213,7 @@ else print '
    '; // Info workflow - print '
    '."\n"; + print '
    '."\n"; print ''; if (! empty($object->fk_user_create)) diff --git a/htdocs/holiday/document.php b/htdocs/holiday/document.php index 942b6cb98fb..a594a920e74 100644 --- a/htdocs/holiday/document.php +++ b/htdocs/holiday/document.php @@ -118,7 +118,7 @@ if ($object->id) //print '
    '; print '
    '; - print '
    '; + print '
    '; print ''; print ''; @@ -223,7 +223,7 @@ if ($object->id) print '
    '; // Info workflow - print '
    '.$langs->trans("User").'
    '."\n"; + print '
    '."\n"; print ''; if (! empty($object->fk_user_create)) diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 2a77c9e1068..4679bf125b5 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -340,7 +340,7 @@ else $newcardbutton=''; if ($user->rights->holiday->write) { - $newcardbutton=''.$langs->trans('MenuAddCP').''; + $newcardbutton=''.$langs->trans('MenuAddCP').''; $newcardbutton.= ''; $newcardbutton.= ''; } diff --git a/htdocs/ifttt/admin/index.php b/htdocs/ifttt/admin/index.php index de3abbe3c2a..ec8fb8c756c 100644 --- a/htdocs/ifttt/admin/index.php +++ b/htdocs/ifttt/admin/index.php @@ -38,11 +38,12 @@ if (! $user->admin) $action=GETPOST('action', 'aZ09'); -if ($action == 'setproductionmode') +if ($action == 'set') { - $status = GETPOST('status', 'alpha'); + $res1 = dolibarr_set_const($db, 'IFTTT_SERVICE_KEY', GETPOST('IFTTT_SERVICE_KEY', 'alpha'), 'chaine', 0, '', 0); + $res2 = dolibarr_set_const($db, 'IFTTT_DOLIBARR_ENDPOINT_SECUREKEY', GETPOST('IFTTT_DOLIBARR_ENDPOINT_SECUREKEY', 'alpha'), 'chaine', 0, '', 0); - if (dolibarr_set_const($db, 'IFTTT_PRODUCTION_MODE', $status, 'chaine', 0, '', 0) > 0) + if ($res1 > 0 && $res2) { header("Location: ".$_SERVER["PHP_SELF"]); exit; @@ -66,38 +67,44 @@ print load_fiche_titre($langs->trans("IFTTTSetup"), $linkback, 'title_setup'); print $langs->trans("IFTTTDesc")."
    \n"; print "
    \n"; -//print ''; +print ''; print ''; +print ''; print '
    '; print ''; print ""; -print '"; +print '"; print ""; print ""; -print ''; -print ''; -$production_mode=(empty($conf->global->IFTTT_PRODUCTION_MODE)?false:true); -if ($production_mode) -{ - print ''; -} -else -{ - print ''; -} -print ''; +print ''; +print ''; +print ''; +print ''; +print ''; + +print ''; +print ''; +print ''; +print ''; print ''; print '
    ".$langs->trans("Parameter")."'.$langs->trans("Value")."'.$langs->trans("Value")." 
    '.$langs->trans("ProductionMode").''; - print img_picto($langs->trans("Activated"), 'switch_on'); - print ''; - print img_picto($langs->trans("Disabled"), 'switch_off'); - print ' 
    '.$langs->trans("IFTTT_SERVICE_KEY").''; +print ''; +print ''.$langs->trans("YouWillFindItOnYourIFTTTAccount").'
    '.$langs->trans("IFTTT_DOLIBARR_ENDPOINT_SECUREKEY").''; +print ''; +print ''.$langs->trans("DefineAValueOfYourChoice").'
    '; + +print '
    '; +print ''; +print '
    '; + +print ''; + print '

    '; -/* + // Define $urlwithroot $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); @@ -106,26 +113,13 @@ $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain // Show message $message=''; -$url=$urlwithroot.'/api/index.php/login?login=auserlogin&password=thepassword[&reset=1]'; -$message.=$langs->trans("UrlToGetKeyToUseAPIs").':
    '; +$url=$urlwithroot.'/ifttt/index.php?securekey='.$conf->global->IFTTT_DOLIBARR_ENDPOINT_SECUREKEY; +$message.=$langs->trans("UrlForIFTTT").':
    '; $message.=img_picto('', 'object_globe.png').' '.$url; print $message; print '
    '; print '
    '; -// Explorer -print ''.$langs->trans("ApiExporerIs").':
    '; -if (dol_is_dir(DOL_DOCUMENT_ROOT.'/includes/restler/framework/Luracast/Restler/explorer')) -{ - $url=DOL_MAIN_URL_ROOT.'/api/index.php/explorer'; - print img_picto('', 'object_globe.png').' '.$url."
    \n"; -} -else -{ - print $langs->trans("NotAvailableWithThisDistribution"); -} - -*/ llxFooter(); $db->close(); diff --git a/htdocs/imports/index.php b/htdocs/imports/index.php index b493534f772..6ccb0adcf44 100644 --- a/htdocs/imports/index.php +++ b/htdocs/imports/index.php @@ -92,7 +92,7 @@ if (count($import->array_import_code)) { //if ($user->rights->import->run) //{ - print ''.$langs->trans("NewImport").''; + print ''.$langs->trans("NewImport").''; //} //else //{ diff --git a/htdocs/install/mysql/data/llx_10_c_regions.sql b/htdocs/install/mysql/data/llx_10_c_regions.sql index 4928bfe7856..34d903a0da7 100644 --- a/htdocs/install/mysql/data/llx_10_c_regions.sql +++ b/htdocs/install/mysql/data/llx_10_c_regions.sql @@ -9,6 +9,7 @@ -- Copyright (C) 2012 Sebastian Neuwert -- Copyright (C) 2012 Ricardo Schluter -- Copyright (C) 2015 Ferran Marcet +-- Copyright (C) 2019~ Lao Tian <281388879@qq.com> -- -- 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 @@ -352,3 +353,39 @@ INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES (25 -- Regions Slovenia (rowid country=202) INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ('202', '20203', 'SI03', NULL, 'East Slovenia'); INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ('202', '20204', 'SI04', NULL, 'West Slovenia'); + +-- Regions China (rowid country=9) +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,901, '京',0,'北京市'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,902, '津',0,'天津市'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,903, '沪',0,'上海市'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,904, '渝',0,'重庆市'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,905, '冀',0,'河北省'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,906, '晋',0,'山西省'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,907, '辽',0,'辽宁省'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,908, '吉',0,'吉林省'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,909, '黑',0,'黑龙江省'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,910, '苏',0,'江苏省'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,911, '浙',0,'浙江省'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,912, '皖',0,'安徽省'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,913, '闽',0,'福建省'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,914, '赣',0,'江西省'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,915, '鲁',0,'山东省'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,916, '豫',0,'河南省'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,917, '鄂',0,'湖北省'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,918, '湘',0,'湖南省'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,919, '粤',0,'广东省'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,920, '琼',0,'海南省'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,921, '川',0,'四川省'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,922, '贵',0,'贵州省'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,923, '云',0,'云南省'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,924, '陕',0,'陕西省'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,925, '甘',0,'甘肃省'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,926, '青',0,'青海省'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,927, '台',0,'台湾省'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,928, '蒙',0,'内蒙古自治区'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,929, '桂',0,'广西壮族自治区'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,930, '藏',0,'西藏自治区'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,931, '宁',0,'宁夏回族自治区'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,932, '新',0,'新疆维吾尔自治区'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,933, '港',0,'香港特别行政区'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,934, '澳',0,'澳门特别行政区'); diff --git a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql index 219deef6dc2..f75c618612d 100644 --- a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql +++ b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql @@ -189,7 +189,7 @@ ALTER TABLE llx_socpeople ADD COLUMN linkedin varchar(255) after whatsapp; ALTER TABLE llx_adherent ADD COLUMN linkedin varchar(255) after whatsapp; ALTER TABLE llx_user ADD COLUMN linkedin varchar(255) after whatsapp; -ALTER TABLE llx_expensereport_det ADD COLUMN fk_expensereport_line integer DEFAULT NULL; +ALTER TABLE llx_expensereport_det ADD COLUMN fk_ecm_files integer DEFAULT NULL; CREATE TABLE llx_bom_bom( @@ -271,3 +271,7 @@ ALTER TABLE llx_expensereport_det ADD COLUMN subprice double(24,8) DEFAULT 0 NOT ALTER TABLE llx_product_attribute_combination ADD INDEX idx_product_att_com_product_parent (fk_product_parent); ALTER TABLE llx_product_attribute_combination ADD INDEX idx_product_att_com_product_child (fk_product_child); +ALTER TABLE llx_product ADD COLUMN fk_project integer DEFAULT NULL; +ALTER TABLE llx_product ADD INDEX idx_product_fk_project (fk_project); + +ALTER TABLE llx_actioncomm ADD COLUMN calling_duration integer; diff --git a/htdocs/install/mysql/tables/llx_emailcollector_emailcollectorfilter.sql b/htdocs/install/mysql/tables/llx_emailcollector_emailcollectorfilter.sql index 6312fa5785f..e4071e5500a 100644 --- a/htdocs/install/mysql/tables/llx_emailcollector_emailcollectorfilter.sql +++ b/htdocs/install/mysql/tables/llx_emailcollector_emailcollectorfilter.sql @@ -19,7 +19,7 @@ CREATE TABLE llx_emailcollector_emailcollectorfilter( rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, fk_emailcollector INTEGER NOT NULL, type varchar(128) NOT NULL, - rulevalue varchar(255) NULL, + rulevalue varchar(128) NULL, date_creation datetime NOT NULL, tms timestamp NOT NULL, fk_user_creat integer NOT NULL, diff --git a/htdocs/install/mysql/tables/llx_expensereport_det.sql b/htdocs/install/mysql/tables/llx_expensereport_det.sql index c87d26c94a8..75d503ac181 100644 --- a/htdocs/install/mysql/tables/llx_expensereport_det.sql +++ b/htdocs/install/mysql/tables/llx_expensereport_det.sql @@ -51,7 +51,7 @@ CREATE TABLE llx_expensereport_det multicurrency_total_tva double(24,8) DEFAULT 0, multicurrency_total_ttc double(24,8) DEFAULT 0, fk_facture integer DEFAULT 0, -- ID of customer invoice line if expense is rebilled to a customer - fk_expensereport_line integer DEFAULT NULL, -- ID of ECM file that is source document of expense report + fk_ecm_files integer DEFAULT NULL, -- ID of ECM file that is source document of expense report fk_code_ventilation integer DEFAULT 0, rang integer DEFAULT 0, -- position of line import_key varchar(14), diff --git a/htdocs/install/mysql/tables/llx_product.key.sql b/htdocs/install/mysql/tables/llx_product.key.sql index d339f2082ee..bd48aa99cd4 100644 --- a/htdocs/install/mysql/tables/llx_product.key.sql +++ b/htdocs/install/mysql/tables/llx_product.key.sql @@ -30,6 +30,7 @@ ALTER TABLE llx_product ADD INDEX idx_product_seuil_stock_alerte (seuil_stock_al ALTER TABLE llx_product ADD INDEX idx_product_fk_country (fk_country); ALTER TABLE llx_product ADD INDEX idx_product_fk_user_author (fk_user_author); ALTER TABLE llx_product ADD INDEX idx_product_fk_barcode_type (fk_barcode_type); +ALTER TABLE llx_product ADD INDEX idx_product_fk_project (fk_project); ALTER TABLE llx_product ADD UNIQUE INDEX uk_product_barcode (barcode, fk_barcode_type, entity); ALTER TABLE llx_product ADD CONSTRAINT fk_product_fk_unit FOREIGN KEY (fk_unit) REFERENCES llx_c_units (rowid); diff --git a/htdocs/install/mysql/tables/llx_product.sql b/htdocs/install/mysql/tables/llx_product.sql index 8569c6e28d2..fb6e4cf5f1a 100755 --- a/htdocs/install/mysql/tables/llx_product.sql +++ b/htdocs/install/mysql/tables/llx_product.sql @@ -94,5 +94,6 @@ create table llx_product fk_price_expression integer, -- Link to the rule for dynamic price calculation desiredstock integer DEFAULT 0, fk_unit integer DEFAULT NULL, - price_autogen tinyint DEFAULT 0 + price_autogen tinyint DEFAULT 0, + fk_project integer DEFAULT NULL -- Used when product was generated by a project or is specifif to a project )ENGINE=innodb; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 6719b35f795..709e2267405 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -481,9 +481,11 @@ FilesAttachedToEmail=Attach file SendEmailsReminders=Send agenda reminders by emails davDescription=Setup a WebDAV server DAVSetup=Setup of module DAV -DAV_ALLOW_PUBLIC_DIR=Enable the public directory (WebDAV directory - no login required) -DAV_ALLOW_PUBLIC_DIRTooltip=The WebDAV public directory is a WebDAV directory anybody can access (in read and write mode), with no authorization required (login/password account). -DAV_ALLOW_ECM_DIR=Enable the private directory (root directory of the DMS/ECM module - login required) +DAV_ALLOW_PRIVATE_DIR=Enable the generic private directory (WebDAV dedicated directory named "private" - login required) +DAV_ALLOW_PRIVATE_DIRTooltip=The generic private directory is a WebDAV directory anybody can access with its application login/pass. +DAV_ALLOW_PUBLIC_DIR=Enable the generic public directory (WebDAV dedicated directory named "public" - no login required) +DAV_ALLOW_PUBLIC_DIRTooltip=The generic public directory is a WebDAV directory anybody can access (in read and write mode), with no authorization required (login/password account). +DAV_ALLOW_ECM_DIR=Enable the DMS/ECM private directory (root directory of the DMS/ECM module - login required) DAV_ALLOW_ECM_DIRTooltip=The root directory where all files are manually uploaded when using the DMS/ECM module. Similarly as access from the web interface, you will need a valid login/password with adecuate permissions to access it. # Modules Module0Name=Users & Groups @@ -1053,8 +1055,8 @@ Delays_MAIN_DELAY_CHEQUES_TO_DEPOSIT=Check deposit not done Delays_MAIN_DELAY_EXPENSEREPORTS=Expense report to approve SetupDescription1=Before starting to use Dolibarr some initial parameters must be defined and modules enabled/configured. SetupDescription2=The following two sections are mandatory (the two first entries in the Setup menu): -SetupDescription3=%s -> %s
    Basic parameters used to customize the default behavior of Dolibarr (e.g for country-related features). -SetupDescription4=%s -> %s
    Dolibarr ERP/CRM is a collection of many modules/applications, all more or less independent. The modules relevant to your needs must be enabled and configured. New items/options are added to menus with the activation of a module. +SetupDescription3=%s -> %s
    Basic parameters used to customize the default behavior of your application (e.g for country-related features). +SetupDescription4=%s -> %s
    This software is a suite of many modules/applications, all more or less independent. The modules relevant to your needs must be enabled and configured. New items/options are added to menus with the activation of a module. SetupDescription5=Other Setup menu entries manage optional parameters. LogEvents=Security audit events Audit=Audit @@ -1837,7 +1839,7 @@ XEmailsDoneYActionsDone=%s emails qualified, %s emails successfully processed (f RecordEvent=Record email event CreateLeadAndThirdParty=Create lead (and third party if necessary) CodeLastResult=Result code of last collect -NbOfEmailsInInbox=Number of email in source directory +NbOfEmailsInInbox=Number of emails in source directory LoadThirdPartyFromName=Load third party from name (load only) LoadThirdPartyFromNameOrCreate=Load third party from name (create if not found) WithDolTrackingID=Dolibarr Tracking ID found @@ -1848,7 +1850,6 @@ ECMAutoTree=Show automatic ECM tree OperationParamDesc=Define values to use for action, or how to extract values. For example:
    VALUE:abc
    REGEX:SUBJECT:([^\s]*)
    REGEX:BODY:My company name is\s([^\s]*) OpeningHours=Opening hours OpeningHoursDesc=Enter here the regular opening hours of your company. -##### Resource #### ResourceSetup=Configuration of Resource module UseSearchToSelectResource=Use a search form to choose a resource (rather than a drop-down list). DisabledResourceLinkUser=Disable feature to link a resource to users @@ -1871,4 +1872,6 @@ LogsLinesNumber=Number of lines to show on logs tab UseDebugBar=Use the debug bar DEBUGBAR_LOGS_LINES_NUMBER=Number of last log lines to keep in console WarningValueHigherSlowsDramaticalyOutput=Warning, higher values slows dramaticaly output -DebugBarModuleActivated=Module debugbar is activated and slows dramaticaly the interface \ No newline at end of file +DebugBarModuleActivated=Module debugbar is activated and slows dramaticaly the interface +EXPORTS_SHARE_MODELS=Export models are share with everybody +ExportSetup=Setup of module Export diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 0934b4c1e46..8aa6d8ffb52 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -550,4 +550,4 @@ AutoFillDateFromShort=Set start date AutoFillDateTo=Set end date for service line with next invoice date AutoFillDateToShort=Set end date MaxNumberOfGenerationReached=Max number of gen. reached -BILL_DELETEInDolibarr=Invoice deleted +BILL_DELETEInDolibarr=Invoice deleted \ No newline at end of file diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index 83939e94187..dc6ae7dc02e 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -50,9 +50,14 @@ TheoricalAmount=Theorical amount RealAmount=Real amount CashFenceDone=Cash fence done for the period NbOfInvoices=Nb of invoices -Paymentnumpad=Payment Num Pad +Paymentnumpad=Type of Pad to enter payment Numberspad=Numbers Pad -BillsCoinsPad=Bills and Coins Pad +BillsCoinsPad=Coins and banknotes Pad DolistorePosCategory=TakePOS modules and other POS solutions for Dolibarr TakeposNeedsCategories=TakePOS needs product categories to work -OrderNotes=Order Notes \ No newline at end of file +OrderNotes=Order Notes +CashDeskBankAccountFor=Default account to use for payments in +NoPaimementModesDefined=No paiment mode defined in TakePOS configuration +TicketVatGrouped=Group VAT by rate in tickets +AutoPrintTickets=Automatically print tickets +EnableBarOrRestaurantFeatures=Enable features for Bar or Restaurant \ No newline at end of file diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index 9a75ef1a950..7931f6ec3b6 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -97,8 +97,6 @@ LocalTax2IsUsedES= IRPF is used LocalTax2IsNotUsedES= IRPF is not used LocalTax1ES=RE LocalTax2ES=IRPF -TypeLocaltax1ES=RE Type -TypeLocaltax2ES=IRPF Type WrongCustomerCode=Customer code invalid WrongSupplierCode=Vendor code invalid CustomerCodeModel=Customer code model diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 5e1e8fcd32e..6f12bd4ca37 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -218,7 +218,8 @@ ErrorVariableKeyForContentMustBeSet=Error, the constant with name %s (with text ErrorURLMustStartWithHttp=URL %s must start with http:// or https:// # Warnings WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user. -WarningMandatorySetupNotComplete=Mandatory setup parameters are not yet defined +WarningMandatorySetupNotComplete=Click here to setup mandatory parameters +WarningEnableYourModulesApplications=Click here to enable your modules and applications WarningSafeModeOnCheckExecDir=Warning, PHP option safe_mode is on so command must be stored inside a directory declared by php parameter safe_mode_exec_dir. WarningBookmarkAlreadyExists=A bookmark with this title or this target (URL) already exists. WarningPassIsEmpty=Warning, database password is empty. This is a security hole. You should add a password to your database and change your conf.php file to reflect this. diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 6638a4c1a04..54c86a1589c 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -402,6 +402,7 @@ LT1ES=RE LT2ES=IRPF LT1IN=CGST LT2IN=SGST +LT1GC=Additionnal cents VATRate=Tax Rate VATCode=Tax Rate code VATNPR=Tax Rate NPR @@ -964,4 +965,5 @@ SelectAThirdPartyFirst=Select a third party first... YouAreCurrentlyInSandboxMode=You are currently in the %s "sandbox" mode Inventory=Inventory AnalyticCode=Analytic code -TMenuMRP=MRP \ No newline at end of file +TMenuMRP=MRP +ShowMoreInfos=Show More Infos \ No newline at end of file diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang index c10f57aec43..8e2d57a03fc 100644 --- a/htdocs/langs/en_US/modulebuilder.lang +++ b/htdocs/langs/en_US/modulebuilder.lang @@ -104,4 +104,9 @@ ContentCantBeEmpty=Content of file can't be empty WidgetDesc=You can generate and edit here the widgets that will be embedded with your module. CLIDesc=You can generate here some command line scripts you want to provide with your module. CLIFile=CLI File -NoCLIFile=No CLI files \ No newline at end of file +NoCLIFile=No CLI files +UseSpecificEditorName = Use a specific editor name +UseSpecificEditorURL = Use a specific editor URL +UseSpecificFamily = Use a specific family +UseSpecificAuthor = Use a specific author +UseSpecificVersion = Use a specific initial version \ No newline at end of file diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 325297b6d1f..3304ab3b3ef 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -39,9 +39,10 @@ ServicesOnSellAndOnBuy=Services for sale and for purchase LastModifiedProductsAndServices=Last %s modified products/services LastRecordedProducts=Latest %s recorded products LastRecordedServices=Latest %s recorded services -CardProduct0=Product card -CardProduct1=Service card +CardProduct0=Product +CardProduct1=Service Stock=Stock +MenuStocks=Stocks Stocks=Stocks and location (warehouse) of products Movements=Movements Sell=Sell diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index 4f395925cdd..df0563383c0 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -57,6 +57,8 @@ NewTimeSpent=Time spent MyTimeSpent=My time spent BillTime=Bill the time spent BillTimeShort=Bill time +TimeToBill=Time not billed +TimeBilled=Time billed Tasks=Tasks Task=Task TaskDateStart=Task start date @@ -114,7 +116,7 @@ ConfirmCloseAProject=Are you sure you want to close this project? AlsoCloseAProject=Also close project (keep it open if you still need to follow production tasks on it) ReOpenAProject=Open project ConfirmReOpenAProject=Are you sure you want to re-open this project? -ProjectContact=Project contacts +ProjectContact=Contacts of project TaskContact=Task contacts ActionsOnProject=Events on project YouAreNotContactOfProject=You are not a contact of this private project @@ -123,7 +125,7 @@ DeleteATimeSpent=Delete time spent ConfirmDeleteATimeSpent=Are you sure you want to delete this time spent? DoNotShowMyTasksOnly=See also tasks not assigned to me ShowMyTasksOnly=View only tasks assigned to me -TaskRessourceLinks=Contacts task +TaskRessourceLinks=Contacts of task ProjectsDedicatedToThisThirdParty=Projects dedicated to this third party NoTasks=No tasks for this project LinkedToAnotherCompany=Linked to other third party @@ -237,8 +239,7 @@ ModuleSalaryToDefineHourlyRateMustBeEnabled=Module 'Salaries' must be enabled to NewTaskRefSuggested=Task ref already used, a new task ref is required TimeSpentInvoiced=Time spent billed TimeSpentForInvoice=Time spent -GenerateInvoice=Generate invoice OneLinePerUser=One line per user ServiceToUseOnLines=Service to use on lines InvoiceGeneratedFromTimeSpent=Invoice %s has been generated from time spent on project -ProjectBillTimeDescription=Check if you enter timesheet on tasks of project and plan to generate invoice(s) from the timesheet to invoice the customer of project. \ No newline at end of file +ProjectBillTimeDescription=Check if you enter timesheet on tasks of project AND you plan to generate invoice(s) from the timesheet to bill the customer of the project (do not check if you plan to create invoice that is not based on entered timesheets). \ No newline at end of file diff --git a/htdocs/langs/fr_FR/cashdesk.lang b/htdocs/langs/fr_FR/cashdesk.lang index f588b04a751..44c978784a4 100644 --- a/htdocs/langs/fr_FR/cashdesk.lang +++ b/htdocs/langs/fr_FR/cashdesk.lang @@ -49,3 +49,7 @@ AmountAtEndOfPeriod=Montant en fin de période (jour, mois ou année) TheoricalAmount=Montant théorique RealAmount=Montant réel CashFenceDone=Clôture de caisse faite pour la période +CashDeskBankAccountFor=Compte utilisé pour les paiements en +NoPaimementModesDefined=Pas de mode de paiement défini dans la configuration de TakePOS +TicketVatGrouped=Grouper la TVA par taux dans les tickets +AutoPrintTickets=Imprimet les tickets automatiquement \ No newline at end of file diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index 1c9d6f97a01..bb2b69f63f2 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -743,7 +743,7 @@ if ($id > 0) $staytopay = $object->capital - $totalpaid; print '
    '.$langs->trans("RemainderToPay").' :'; + print ''; print price($staytopay, 0, $langs, 0, 0, -1, $conf->currency); print '
    '; + print '
    '; print ''; print ''; print "
    '.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
    '.$langs->trans("TotalSizeOfAttachedFiles").''.dol_print_size($totalsize, 1, 1).'
    \n"; diff --git a/htdocs/loan/list.php b/htdocs/loan/list.php index 2fb58d6132c..e4b51c2429a 100644 --- a/htdocs/loan/list.php +++ b/htdocs/loan/list.php @@ -116,7 +116,7 @@ if ($resql) $newcardbutton=''; if ($user->rights->loan->write) { - $newcardbutton=''.$langs->trans('NewLoan').''; + $newcardbutton=''.$langs->trans('NewLoan').''; $newcardbutton.= ''; $newcardbutton.= ''; } diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 109d0f5f1fe..805fdc90d19 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -194,7 +194,7 @@ if (! empty($_SERVER['DOCUMENT_ROOT']) && substr($_SERVER['DOCUMENT_ROOT'], -6) set_include_path($_SERVER['DOCUMENT_ROOT'] . '/htdocs'); } -// Include the conf.php and functions.lib.php +// Include the conf.php and functions.lib.php. This defined the constants like DOL_DOCUMENT_ROOT, DOL_DATA_ROOT, DOL_URL_ROOT... require_once 'filefunc.inc.php'; // If there is a POST parameter to tell to save automatically some POST parameters into cookies, we do it. @@ -242,12 +242,24 @@ if (! defined('NOSESSION')) }*/ } -// Init the 5 global objects, this include will make the new and set properties for: $conf, $db, $langs, $user, $mysoc +// Init the 5 global objects, this include will make the 'new Xxx()' and set properties for: $conf, $db, $langs, $user, $mysoc require_once 'master.inc.php'; // Activate end of page function register_shutdown_function('dol_shutdown'); +// Load debugbar +if (! empty($conf->debugbar->enabled)) +{ + global $debugbar; + include_once DOL_DOCUMENT_ROOT.'/debugbar/class/DebugBar.php'; + $debugbar = new DolibarrDebugBar(); + $renderer = $debugbar->getRenderer(); + $conf->global->MAIN_HTML_HEADER .= $renderer->renderHead(); + + $debugbar['time']->startMeasure('pageaftermaster', 'Page generation (after environment init)'); +} + // Detection browser if (isset($_SERVER["HTTP_USER_AGENT"])) { @@ -1582,7 +1594,10 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead } } - print '