diff --git a/ChangeLog b/ChangeLog index 777be335d62..57714680554 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,10 +4,12 @@ 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". For Developers: +NEW: Module DebugBar is available as a stable module. WARNING: @@ -21,6 +23,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/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index 3c4632f3a85..295a565f0c5 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -284,7 +284,7 @@ $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfiel if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1); print '
'; -print ''."\n"; +print '
'."\n"; // Line for filters fields 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 ''; +print ''; +print ''; + 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/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..62f5443d693 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"))."

"; @@ -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/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/translation.php b/htdocs/admin/translation.php index cea8c4b5174..9498fe06d6b 100644 --- a/htdocs/admin/translation.php +++ b/htdocs/admin/translation.php @@ -224,9 +224,7 @@ else print load_fiche_titre($langs->trans("Translation"), $enabledisablehtml, 'title_setup'); -//print ''; -print $langs->trans("TranslationDesc")."
\n"; -//print '
'; +print ''.$langs->trans("TranslationDesc")."
\n"; print "
\n"; $current_language_code=$langs->defaultlang; 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 ''; print '"; - // Conditions de reglement + // terms of the settlement print ''; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index c20abf44fe2..7d837b12072 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 diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php old mode 100644 new mode 100755 index ce6a8610a1f..ed1f2e50a39 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1844,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))) { 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 '
'; diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 75fa9117230..2859fcf9052 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)) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php old mode 100644 new mode 100755 index f85870bd6f1..1f370625d5c --- 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))) { @@ -1674,7 +1675,7 @@ if ($action == 'create' && $user->rights->commande->creer) print $form->selectDate($datedelivery, 'liv_', '', '', '', "crea_commande", 1, 1); print "
' . $langs->trans('PaymentConditionsShort') . ''; $form->select_conditions_paiements($cond_reglement_id, 'cond_reglement_id', - 1, 1); print '
' . $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/contrat/card.php b/htdocs/contrat/card.php index 1b638849538..35a5ac78b2e 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 diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 03eab8be202..bddf190b62c 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -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/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/extrafields.class.php b/htdocs/core/class/extrafields.class.php index f7b0edaa0f1..32238ea4ef8 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1653,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/html.form.class.php b/htdocs/core/class/html.form.class.php index 9905cd1252a..2fb79ca56f2 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -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.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/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 54ad9b2066b..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) { @@ -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 42d419bd7d1..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) { 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/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..f1c67429d95 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; @@ -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 " +
+ '.$userDropDownImage.' + +

+ '.$profilName.' +
'.dol_print_date($user->datepreviouslogin, "dayhour", 'tzuser').' +

+
+ + +
'.$dropdownBody.'
+ + + + +
+
+ + '; + + + return $btnUser; +} + /** * Show left menu bar * diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index 31bbfa4b701..442748ae935 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -115,8 +115,6 @@ $helpurl='EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks'; $form=new Form($db); $htmlother=new FormOther($db); -$title=$langs->trans("ProductsAndServices"); - $sql = 'SELECT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,'; $sql.= ' p.fk_product_type, p.tms as datem,'; $sql.= ' p.duration, p.tosell as statut, p.tobuy, p.seuil_stock_alerte, p.desiredstock,'; @@ -191,22 +189,22 @@ if ($resql) } else { $texte = $langs->trans("ProductsAndServices"); } - $texte.=' ('.$langs->trans("Stocks").')'; + $texte.=' ('.$langs->trans("MenuStocks").')'; $param=''; - if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; - if ($sall) $param.="&sall=".$sall; - if ($tosell) $param.="&tosell=".$tosell; - if ($tobuy) $param.="&tobuy=".$tobuy; - if ($type) $param.="&type=".$type; - if ($fourn_id) $param.="&fourn_id=".$fourn_id; - if ($snom) $param.="&snom=".$snom; - if ($sref) $param.="&sref=".$sref; - if ($search_sale) $param.="&search_sale=".$search_sale; - if ($search_categ) $param.="&search_categ=".$search_categ; - if ($toolowstock) $param.="&toolowstock=".$toolowstock; - if ($sbarcode) $param.="&sbarcode=".$sbarcode; - if ($catid) $param.="&catid=".$catid; + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); + if ($sall) $param.="&sall=".urlencode($sall); + if ($tosell) $param.="&tosell=".urlencode($tosell); + if ($tobuy) $param.="&tobuy=".urlencode($tobuy); + if ($type) $param.="&type=".urlencode($type); + if ($fourn_id) $param.="&fourn_id=".urlencode($fourn_id); + if ($snom) $param.="&snom=".urlencode($snom); + if ($sref) $param.="&sref=".urlencode($sref); + if ($search_sale) $param.="&search_sale=".urlencode($search_sale); + if ($search_categ) $param.="&search_categ=".urlencode($search_categ); + if ($toolowstock) $param.="&toolowstock=".urlencode($toolowstock); + if ($sbarcode) $param.="&sbarcode=".urlencode($sbarcode); + if ($catid) $param.="&catid=".urlencode($catid); llxHeader("", $texte, $helpurl); diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index 95d5e3dd229..8bed0a87adc 100644 --- a/htdocs/projet/contact.php +++ b/htdocs/projet/contact.php @@ -180,7 +180,7 @@ if ($id > 0 || ! empty($ref)) print '
'; print '
'; - print ''; + print '
'; // Visibility print '
'.$langs->trans("Visibility").''; @@ -233,7 +233,7 @@ if ($id > 0 || ! empty($ref)) print '
'; print '
'; - print ''; + print '
'; // Description print '
'.$langs->trans("Description").''; diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index dc737e8968c..62680a973bd 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -157,7 +157,7 @@ print '
'; print '
'; print '
'; -print ''; +print '
'; // Visibility print '
'.$langs->trans("Visibility").''; @@ -210,7 +210,7 @@ print '
'; print '
'; print '
'; -print ''; +print '
'; // Description print '
'.$langs->trans("Description").''; diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 068a26b5fe2..166d224d1be 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -356,7 +356,7 @@ if ($id > 0 || ! empty($ref)) print '
'; print '
'; - print ''; + print '
'; // Visibility print '
'.$langs->trans("Visibility").''; @@ -409,7 +409,7 @@ if ($id > 0 || ! empty($ref)) print '
'; print '
'; - print ''; + print '
'; // Description print '
'.$langs->trans("Description").''; diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index af8dc9d39cf..3fe8abfa73b 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -220,7 +220,7 @@ if ($id > 0 || ! empty($ref)) print '
'; print '
'; - print ''; + print '
'; // Visibility print '
'.$langs->trans("Visibility").''; @@ -254,7 +254,7 @@ if ($id > 0 || ! empty($ref)) print '
'; print '
'; - print ''; + print '
'; // Description print '
'.$langs->trans("Description").''; diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 37934aa0957..ba06a8ba49e 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -35,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; // Load translation files required by the page -$langs->load('projects'); +$langs->loadLangs(array('projects','bills','orders')); $action = GETPOST('action', 'alpha'); $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) @@ -149,47 +149,61 @@ if ($action == 'addtimespent' && $user->rights->projet->lire) if (! $error) { - if ($id || $ref) + if ($id || $ref) { $object->fetch($id, $ref); } else { - $object->fetch(GETPOST('taskid', 'int')); + if (! GETPOST('taskid', 'int') || GETPOST('taskid', 'int') < 0) + { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Task")), null, 'errors'); + $action='createtime'; + $error++; + } + else + { + $object->fetch(GETPOST('taskid', 'int')); + } } - $object->fetch_projet(); - if (empty($object->project->statut)) + if (! $error) { - setEventMessages($langs->trans("ProjectMustBeValidatedFirst"), null, 'errors'); - $error++; - } - else - { - $object->timespent_note = $_POST["timespent_note"]; - if (GETPOST('progress', 'int') > 0) $object->progress = GETPOST('progress', 'int'); // If progress is -1 (not defined), we do not change value - $object->timespent_duration = $_POST["timespent_durationhour"]*60*60; // We store duration in seconds - $object->timespent_duration+= ($_POST["timespent_durationmin"]?$_POST["timespent_durationmin"]:0)*60; // We store duration in seconds - if (GETPOST("timehour") != '' && GETPOST("timehour") >= 0) // If hour was entered - { - $object->timespent_date = dol_mktime(GETPOST("timehour"), GETPOST("timemin"), 0, GETPOST("timemonth"), GETPOST("timeday"), GETPOST("timeyear")); - $object->timespent_withhour = 1; - } - else - { - $object->timespent_date = dol_mktime(12, 0, 0, GETPOST("timemonth"), GETPOST("timeday"), GETPOST("timeyear")); - } - $object->timespent_fk_user = $_POST["userid"]; - $result=$object->addTimeSpent($user); - if ($result >= 0) - { - setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); - } - else - { - setEventMessages($langs->trans($object->error), null, 'errors'); - $error++; - } + $object->fetch_projet(); + + if (empty($object->project->statut)) + { + setEventMessages($langs->trans("ProjectMustBeValidatedFirst"), null, 'errors'); + $action='createtime'; + $error++; + } + else + { + $object->timespent_note = $_POST["timespent_note"]; + if (GETPOST('progress', 'int') > 0) $object->progress = GETPOST('progress', 'int'); // If progress is -1 (not defined), we do not change value + $object->timespent_duration = $_POST["timespent_durationhour"]*60*60; // We store duration in seconds + $object->timespent_duration+= ($_POST["timespent_durationmin"]?$_POST["timespent_durationmin"]:0)*60; // We store duration in seconds + if (GETPOST("timehour") != '' && GETPOST("timehour") >= 0) // If hour was entered + { + $object->timespent_date = dol_mktime(GETPOST("timehour"), GETPOST("timemin"), 0, GETPOST("timemonth"), GETPOST("timeday"), GETPOST("timeyear")); + $object->timespent_withhour = 1; + } + else + { + $object->timespent_date = dol_mktime(12, 0, 0, GETPOST("timemonth"), GETPOST("timeday"), GETPOST("timeyear")); + } + $object->timespent_fk_user = $_POST["userid"]; + $result=$object->addTimeSpent($user); + if ($result >= 0) + { + setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); + } + else + { + setEventMessages($langs->trans($object->error), null, 'errors'); + $error++; + } + } } } else @@ -488,7 +502,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print '
'; print '
'; - print ''; + print '
'; // Visibility print '
'.$langs->trans("Visibility").''; @@ -522,7 +536,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print '
'; print '
'; - print ''; + print '
'; // Description print '
'.$langs->trans("Description").''; @@ -809,7 +823,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) if (! empty($withproject) && $projectstatic->bill_time) { $arrayofmassactions = array( - 'generateinvoice'=>$langs->trans("GenerateInvoice"), + 'generateinvoice'=>$langs->trans("GenerateBill"), //'builddoc'=>$langs->trans("PDFMerge"), ); //if ($user->rights->projet->creer) $arrayofmassactions['predelete']=$langs->trans("Delete"); @@ -901,7 +915,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print '
'; print '
'; - print ' '; + print ' '; print ''; print '
'; print '
'; @@ -1109,7 +1123,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) $selectedfields.=(count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print '
'; - print ''."\n"; + print '
'."\n"; // Fields title search print ''; diff --git a/htdocs/public/ifttt/index.php b/htdocs/public/ifttt/index.php new file mode 100644 index 00000000000..a879dc1d41f --- /dev/null +++ b/htdocs/public/ifttt/index.php @@ -0,0 +1,88 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/public/ifttt/index.php + * \ingroup ifttt + * \brief Page to IFTTT endpoint agenda + * http://127.0.0.1/dolibarr/public/ifttt/index.php?securekey=... + */ + +if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); +if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no menu to show +if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php +if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); +if (! defined('NOLOGIN')) define("NOLOGIN", 1); // This means this output page does not require to be logged. +if (! defined('NOCSRFCHECK')) define("NOCSRFCHECK", 1); // We accept to go on this page from external web site. + +// This is a wrapper, so header is empty + +/** + * Header function + * + * @return void + */ +function llxHeaderVierge() +{ + print 'IFTTT API'; +} +/** + * Footer function + * + * @return void + */ +function llxFooterVierge() +{ + print ''; +} + + +require '../../main.inc.php'; + +// Security check +if (empty($conf->ifttt->enabled)) accessforbidden('', 0, 0, 1); + +// Check config +if (empty($conf->global->IFTTT_DOLIBARR_ENDPOINT_SECUREKEY)) +{ + $user->getrights(); + + llxHeaderVierge(); + print '
Module Agenda was not configured properly.
'; + llxFooterVierge(); + exit; +} + +// Check exportkey +if (empty($_GET["securekey"]) || $conf->global->IFTTT_DOLIBARR_ENDPOINT_SECUREKEY != $_GET["securekey"]) +{ + $user->getrights(); + + llxHeaderVierge(); + print '
Bad value for securekey.
'; + llxFooterVierge(); + exit; +} + + +// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array of hooks +$hookmanager->initHooks(array('iftttapi')); + + +llxHeaderVierge(); +print '
TODO
'; +llxFooterVierge(); diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index b641d4adcc8..684208eb1b3 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -630,7 +630,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)); $pu_ht = $productsupplier->fourn_pu; diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php index d80297d53a2..a2dd6ed1b96 100644 --- a/htdocs/takepos/admin/setup.php +++ b/htdocs/takepos/admin/setup.php @@ -65,6 +65,7 @@ if (GETPOST('action', 'alpha') == 'set') $res = dolibarr_set_const($db, "TAKEPOS_PRINT_SERVER", GETPOST('TAKEPOS_PRINT_SERVER', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_ORDER_PRINTERS", GETPOST('TAKEPOS_ORDER_PRINTERS', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_ORDER_NOTES", GETPOST('TAKEPOS_ORDER_NOTES', 'alpha'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_AUTO_PRINT_TICKETS", GETPOST('TAKEPOS_AUTO_PRINT_TICKETS', 'int'), 'int', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_HEADER", GETPOST('TAKEPOS_HEADER', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_FOOTER", GETPOST('TAKEPOS_FOOTER', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_NUMPAD", GETPOST('TAKEPOS_NUMPAD', 'alpha'), 'chaine', 0, '', $conf->entity); @@ -124,6 +125,13 @@ if (! empty($conf->service->enabled)) print $form->selectyesno("CASHDESK_SERVICES", $conf->global->CASHDESK_SERVICES, 1); print "
\n"; } +print '\n"; + + print '
'; +print $langs->trans("AutoPrintTickets"); +print ''; +print $form->selectyesno("TAKEPOS_AUTO_PRINT_TICKETS", $conf->global->TAKEPOS_AUTO_PRINT_TICKETS, 1); +print "
'; print $form->textwithpicto($langs->trans("RootCategoryForProductsToSell"), $langs->trans("RootCategoryForProductsToSellDesc")); diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 45a65af3f94..e1a4b32d935 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -376,7 +376,8 @@ if ($action=="valid") { print '

'.$invoice->ref." ".$langs->trans('BillShortStatusValidated').'

'; if ($conf->global->TAKEPOSCONNECTOR) print '
'; - else print '
'; + else print '
'; + if($conf->global->TAKEPOS_AUTO_PRINT_TICKETS) print ''; } if ($action == "search") diff --git a/htdocs/theme/eldy/dropdown.css.php b/htdocs/theme/eldy/dropdown.css.php new file mode 100644 index 00000000000..b484ef255e2 --- /dev/null +++ b/htdocs/theme/eldy/dropdown.css.php @@ -0,0 +1,169 @@ + +/*