diff --git a/COPYRIGHT b/COPYRIGHT index a961a442507..519910ea1b1 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -28,10 +28,10 @@ Restler 3.0 LGPL-3+ Yes TCPDF 6.2.6 LGPL-3+ Yes PDF generation JS libraries: -jQuery 1.8.2 MIT License Yes JS library -jQuery UI 1.9.1 GPL and MIT License Yes JS library plugin UI +jQuery 1.11.3 MIT License Yes JS library +jQuery UI 1.11.4 GPL and MIT License Yes JS library plugin UI jQuery select2 3.5.2 GPL and Apache License Yes JS library plugin for sexier multiselect -jQuery blockUI 2.43 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups) +jQuery blockUI 2.70.0 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups) jQuery Colorpicker 1.1 MIT License Yes JS library for color picker for a defined list of colors jQuery DataTables 1.9.4 BSD Yes JS library for tables output jQuery FileUpload 5.0.3 GPL and MIT License Yes JS library to upload files diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index c1ad179342a..dba04aafa05 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -1,11 +1,11 @@ * Copyright (C) 2013-2014 Florian Henry - * Copyright (C) 2013-2014 Alexandre Spangaro + * Copyright (C) 2013-2015 Alexandre Spangaro * Copyright (C) 2014 Ari Elbaz (elarifr) * Copyright (C) 2014 Marcos García * Copyright (C) 2014 Juanjo Menent - * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2015 Jean-François Ferry * * 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 @@ -56,6 +56,8 @@ $list = array ( 'ACCOUNTING_PRODUCT_SOLD_ACCOUNT', 'ACCOUNTING_SERVICE_BUY_ACCOUNT', 'ACCOUNTING_SERVICE_SOLD_ACCOUNT', + 'ACCOUNTING_VAT_BUY_ACCOUNT', + 'ACCOUNTING_VAT_SOLD_ACCOUNT', 'ACCOUNTING_ACCOUNT_SUSPENSE', 'ACCOUNTING_ACCOUNT_TRANSFER_CASH' ); diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 0a000e01833..862ff92eb4b 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -112,7 +112,7 @@ if ($result) { $num = $db->num_rows($result); // les variables $cptfour = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER)) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef"); - $cpttva = (! empty($conf->global->ACCOUNTING_VAT_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_ACCOUNT : $langs->trans("CodeNotDef"); + $cpttva = (! empty($conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"); $tabfac = array (); $tabht = array (); diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index db9af17388a..83191f88bf4 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -136,7 +136,7 @@ if ($result) { else $compta_prod = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"); } - $cpttva = (! empty($conf->global->ACCOUNTING_VAT_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_ACCOUNT : $langs->trans("CodeNotDef"); + $cpttva = (! empty($conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"); $compta_tva = (! empty($obj->account_tva) ? $obj->account_tva : $cpttva); // Situation invoices handling diff --git a/htdocs/admin/compta.php b/htdocs/admin/compta.php index 48cad667a51..6020cb7947e 100644 --- a/htdocs/admin/compta.php +++ b/htdocs/admin/compta.php @@ -44,7 +44,7 @@ $list = array( 'ACCOUNTING_PRODUCT_SOLD_ACCOUNT', 'ACCOUNTING_SERVICE_BUY_ACCOUNT', 'ACCOUNTING_SERVICE_SOLD_ACCOUNT', - 'ACCOUNTING_VAT_ACCOUNT', + 'ACCOUNTING_VAT_SOLD_ACCOUNT', 'ACCOUNTING_VAT_BUY_ACCOUNT', 'ACCOUNTING_ACCOUNT_CUSTOMER', 'ACCOUNTING_ACCOUNT_SUPPLIER' diff --git a/htdocs/admin/expensereport.php b/htdocs/admin/expensereport.php index eb21636126a..15c810f46c5 100644 --- a/htdocs/admin/expensereport.php +++ b/htdocs/admin/expensereport.php @@ -146,6 +146,10 @@ if ($action == 'setModuleOptions') else if ($action == 'set') { $ret = addDocumentModel($value, $type, $label, $scandir); + if ($ret > 0 && empty($conf->global->EXPENSEREPORT_ADDON_PDF)) + { + dolibarr_set_const($db, 'EXPENSEREPORT_ADDON_PDF', $value,'chaine',0,'',$conf->entity); + } } else if ($action == 'del') diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 6bf5c5a5dca..aa0a2f8b61a 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -410,17 +410,19 @@ if ($id > 0) print ''; $limit_field_type = (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) ? 'numeric' : 'amount'; print $form->editfieldval("OutstandingBill",'outstanding_limit',$object->outstanding_limit,$object,$user->rights->societe->creer,$limit_field_type,($object->outstanding_limit != '' ? price($object->outstanding_limit) : '')); + if (empty($object->outstanding_limit)) print $langs->trans("NoLimit"); // display amount and link to unpaid bill $outstandingBills = $object->get_OutstandingBill(); - if ($outstandingBills != 0) + print ' (' . $langs->trans('CurrentOutstandingBill') . ': '; + print price($outstandingBills, '', $langs, 0, 0, - 1, $conf->currency); + if ($object->outstanding_limit != '') { - print ' ('.$langs->trans("CurrentOutstandingBill"); - print ' '; - print price($outstandingBills, '', $langs, 0, -1, -1, $conf->currency); - print ''; - if ($outstandingBills > $object->outstanding_limit) print img_warning($langs->trans("OutstandingBillReached")); - print ')'; + if ($outstandingBills > $object->outstanding_limit) + print img_warning($langs->trans("OutstandingBillReached")); + //print ' / ' . price($soc->outstanding_limit); } + print ')'; + print ''; print ''; } diff --git a/htdocs/compta/deplacement/index.php b/htdocs/compta/deplacement/index.php index 37a0f944bb3..b8920bb45a4 100644 --- a/htdocs/compta/deplacement/index.php +++ b/htdocs/compta/deplacement/index.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005-2011 Regis Houssin * @@ -98,7 +98,7 @@ print '
'; // Statistics -print ''; +print '
'; print ''; print ''; print "\n"; @@ -111,7 +111,7 @@ foreach ($listoftype as $code => $label) if ($conf->use_javascript_ajax) { - print ''; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index a461d1b9c82..518a22ede78 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -2502,7 +2502,9 @@ if ($action == 'create') } print '
'; -} else if ($id > 0 || ! empty($ref)) { +} +else if ($id > 0 || ! empty($ref)) +{ /* * Show object in view mode */ @@ -2522,7 +2524,8 @@ if ($action == 'create') $result = $object->fetch_thirdparty(); $soc = new Societe($db); - $soc->fetch($object->socid); + $result=$soc->fetch($object->socid); + if ($result < 0) dol_print_error($db); $selleruserevenustamp = $mysoc->useRevenueStamp(); $totalpaye = $object->getSommePaiement(); @@ -2857,7 +2860,8 @@ if ($action == 'create') $outstandingBills = $soc->get_OutstandingBill(); print ' - ' . $langs->trans('CurrentOutstandingBill') . ': '; print price($outstandingBills, '', $langs, 0, 0, - 1, $conf->currency); - if ($soc->outstanding_limit != '') { + if ($soc->outstanding_limit != '') + { if ($outstandingBills > $soc->outstanding_limit) print img_warning($langs->trans("OutstandingBillReached")); print ' / ' . price($soc->outstanding_limit); @@ -2946,7 +2950,8 @@ if ($action == 'create') } else print '. '; } - if ($absolute_creditnote > 0) { + if ($absolute_creditnote > 0) + { // If validated, we show link "add credit note to payment" if ($object->statut != 1 || $object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT) { if ($object->statut == 0 && $object->type != Facture::TYPE_DEPOSIT) { diff --git a/htdocs/compta/journal/sellsjournal.php b/htdocs/compta/journal/sellsjournal.php index 9fd0d411d8e..e2842f6dd1e 100644 --- a/htdocs/compta/journal/sellsjournal.php +++ b/htdocs/compta/journal/sellsjournal.php @@ -151,7 +151,7 @@ if ($result) if($obj->product_type == 0) $compta_prod = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT)?$conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT:$langs->trans("CodeNotDef")); else $compta_prod = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT)?$conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT:$langs->trans("CodeNotDef")); } - $cpttva = (! empty($conf->global->ACCOUNTING_VAT_ACCOUNT)?$conf->global->ACCOUNTING_VAT_ACCOUNT:$langs->trans("CodeNotDef")); + $cpttva = (! empty($conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT)?$conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT:$langs->trans("CodeNotDef")); $compta_tva = (! empty($obj->account_tva)?$obj->account_tva:$cpttva); $account_localtax1=getLocalTaxesFromRate($obj->tva_tx, 1, $obj->thirdparty, $mysoc); diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index 4b92ce7eebc..e995b06aa6b 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2013 Antoine Iauch * Copyright (C) 2013 Laurent Destailleur * Copyright (C) 2015 Raphaël Doursenaud * @@ -18,8 +18,8 @@ */ /** - * \file htdocs/compta/stats/cabyprodserv.php - * \brief Page reporting TO by Products & Services + * \file htdocs/compta/stats/cabyprodserv.php + * \brief Page reporting TO by Products & Services */ require '../../main.inc.php'; @@ -47,13 +47,13 @@ if (GETPOST("modecompta")) $modecompta=GETPOST("modecompta"); $sortorder=isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"]; $sortfield=isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"]; if (! $sortorder) $sortorder="asc"; -if (! $sortfield) $sortfield="name"; +if (! $sortfield) $sortfield="ref"; // Category $selected_cat = (int) GETPOST('search_categ', 'int'); $subcat = false; if (GETPOST('subcat', 'alpha') === 'yes') { - $subcat = true; + $subcat = true; } // Date range @@ -132,7 +132,7 @@ $headerparams = array_merge($commonparams, $headerparams); $tableparams = array_merge($commonparams, $tableparams); foreach($allparams as $key => $value) { - $paramslink .= '&' . $key . '=' . $value; + $paramslink .= '&' . $key . '=' . $value; } @@ -148,28 +148,28 @@ $nom=$langs->trans("SalesTurnover").', '.$langs->trans("ByProductsAndServices"); if ($modecompta=="CREANCES-DETTES") { $calcmode=$langs->trans("CalcModeDebt"); - $calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; + $calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; - $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); + $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); - $description=$langs->trans("RulesCADue"); + $description=$langs->trans("RulesCADue"); if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { - $description.= $langs->trans("DepositsAreNotIncluded"); + $description.= $langs->trans("DepositsAreNotIncluded"); } else { - $description.= $langs->trans("DepositsAreIncluded"); + $description.= $langs->trans("DepositsAreIncluded"); } - $builddate=time(); + $builddate=time(); } else { $calcmode=$langs->trans("CalcModeEngagement"); $calcmode.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; - $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); + $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); - $description=$langs->trans("RulesCAIn"); - $description.= $langs->trans("DepositsAreIncluded"); + $description=$langs->trans("RulesCAIn"); + $description.= $langs->trans("DepositsAreIncluded"); - $builddate=time(); + $builddate=time(); } report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,$tableparams,$calcmode); @@ -180,221 +180,226 @@ $catotal=0; if ($modecompta == 'CREANCES-DETTES') { - $sql = "SELECT DISTINCT p.rowid as rowid, p.ref as ref, p.label as label,"; - $sql.= " sum(l.total_ht) as amount, sum(l.total_ttc) as amount_ttc"; - $sql.= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."facturedet as l, ".MAIN_DB_PREFIX."product as p"; + $sql = "SELECT DISTINCT p.rowid as rowid, p.ref as ref, p.label as label,"; + $sql.= " SUM(l.total_ht) as amount, SUM(l.total_ttc) as amount_ttc,"; + $sql.= " SUM(CASE WHEN f.type = 2 THEN -l.qty ELSE l.qty END) as qty"; + $sql.= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."facturedet as l, ".MAIN_DB_PREFIX."product as p"; if ($selected_cat === -2) // Without any category { - $sql.= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product"; + $sql.= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product"; } else if ($selected_cat) // Into a specific category { - $sql.= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_product as cp"; + $sql.= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_product as cp"; } - $sql.= " WHERE l.fk_product = p.rowid"; + $sql.= " WHERE l.fk_product = p.rowid"; $sql.= " AND l.fk_facture = f.rowid"; - $sql.= " AND f.fk_statut in (1,2)"; - if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { - $sql.= " AND f.type IN (0,1,2,5)"; - } else { + $sql.= " AND f.fk_statut in (1,2)"; + if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { + $sql.= " AND f.type IN (0,1,2,5)"; + } else { $sql.= " AND f.type IN (0,1,2,3,5)"; - } - if ($date_start && $date_end) { - $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; - } + } + if ($date_start && $date_end) { + $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; + } if ($selected_cat === -2) // Without any category { - $sql.=" AND cp.fk_product is null"; + $sql.=" AND cp.fk_product is null"; } else if ($selected_cat) { // Into a specific category - $sql.= " AND (c.rowid = ".$selected_cat; - if ($subcat) $sql.=" OR c.fk_parent = " . $selected_cat; - $sql.= ")"; + $sql.= " AND (c.rowid = ".$selected_cat; + if ($subcat) $sql.=" OR c.fk_parent = " . $selected_cat; + $sql.= ")"; $sql.= " AND cp.fk_categorie = c.rowid AND cp.fk_product = p.rowid"; } - $sql.= " AND f.entity = ".$conf->entity; - $sql.= " GROUP BY p.rowid, p.ref, p.label"; - $sql.= " ORDER BY p.ref"; + $sql.= " AND f.entity = ".$conf->entity; + $sql.= " GROUP BY p.rowid, p.ref, p.label"; + $sql.= $db->order($sortfield,$sortorder); - dol_syslog("cabyprodserv", LOG_DEBUG); - $result = $db->query($sql); - if ($result) { - $num = $db->num_rows($result); - $i=0; - while ($i < $num) { - $obj = $db->fetch_object($result); - $amount_ht[$obj->rowid] = $obj->amount; - $amount[$obj->rowid] = $obj->amount_ttc; - $name[$obj->rowid] = $obj->ref . ' - ' . $obj->label; - $catotal_ht+=$obj->amount; - $catotal+=$obj->amount_ttc; - $i++; + dol_syslog("cabyprodserv", LOG_DEBUG); + $result = $db->query($sql); + if ($result) { + $num = $db->num_rows($result); + $i=0; + while ($i < $num) { + $obj = $db->fetch_object($result); + $amount_ht[$obj->rowid] = $obj->amount; + $amount[$obj->rowid] = $obj->amount_ttc; + $qty[$obj->rowid] = $obj->qty; + $name[$obj->rowid] = $obj->ref . ' - ' . $obj->label; + $catotal_ht+=$obj->amount; + $catotal+=$obj->amount_ttc; + $qtytotal+=$obj->qty; + $i++; + } + } else { + dol_print_error($db); } - } else { - dol_print_error($db); - } - // Show Array - $i=0; - print '
'; - // Extra parameters management - foreach($headerparams as $key => $value) - { - print ''; - } + // Show Array + $i=0; + print ''; + // Extra parameters management + foreach($headerparams as $key => $value) + { + print ''; + } - print '
'.$langs->trans("Statistics").'
'; + print '
'; $data=array('series'=>$dataseries); dol_print_graph('stats',300,180,$data,1,'pie',1); print '
'; - // Category filter - print ''; - print ''; - print ''; - // Array header - print ""; - print_liste_field_titre( - $langs->trans("Product"), - $_SERVER["PHP_SELF"], - "name", - "", - $paramslink, - "", - $sortfield, - $sortorder - ); - print_liste_field_titre( - $langs->trans('AmountHT'), - $_SERVER["PHP_SELF"], - "amount_ht", - "", - $paramslink, - 'align="right"', - $sortfield, - $sortorder - ); - print_liste_field_titre( - $langs->trans("AmountTTC"), - $_SERVER["PHP_SELF"], - "amount_ttc", - "", - $paramslink, - 'align="right"', - $sortfield, - $sortorder - ); - print_liste_field_titre( - $langs->trans("Percentage"), - $_SERVER["PHP_SELF"], - "amount_ttc", - "", - $paramslink, - 'align="right"', - $sortfield, - $sortorder - ); - // TODO: statistics? - print "\n"; + print '
'; - print $langs->trans("Category") . ': ' . $formother->select_categories(Categorie::TYPE_PRODUCT, $selected_cat, 'search_categ', true); - print ' '; - print $langs->trans("SubCats") . '? '; - print ''; - print ''; - print '
'; + // Category filter + print ''; + print ''; + print ''; + + // Array header + print ""; + print_liste_field_titre( + $langs->trans("Product"), + $_SERVER["PHP_SELF"], + "ref", + "", + $paramslink, + "", + $sortfield, + $sortorder + ); + print_liste_field_titre( + $langs->trans('Quantity'), + $_SERVER["PHP_SELF"], + "qty", + "", + $paramslink, + 'align="right"', + $sortfield, + $sortorder + ); + print_liste_field_titre( + $langs->trans("Percentage"), + $_SERVER["PHP_SELF"], + "qty", + "", + $paramslink, + 'align="right"', + $sortfield, + $sortorder + ); + print_liste_field_titre( + $langs->trans('AmountHT'), + $_SERVER["PHP_SELF"], + "amount", + "", + $paramslink, + 'align="right"', + $sortfield, + $sortorder + ); + print_liste_field_titre( + $langs->trans("AmountTTC"), + $_SERVER["PHP_SELF"], + "amount_ttc", + "", + $paramslink, + 'align="right"', + $sortfield, + $sortorder + ); + print_liste_field_titre( + $langs->trans("Percentage"), + $_SERVER["PHP_SELF"], + "amount_ttc", + "", + $paramslink, + 'align="right"', + $sortfield, + $sortorder + ); + print "\n"; - // Array Data - $var=true; + // Array Data + $var=true; - if (count($amount)) { - $arrayforsort=$name; - // defining arrayforsort - if ($sortfield == 'nom' && $sortorder == 'asc') { - asort($name); - $arrayforsort=$name; - } - if ($sortfield == 'nom' && $sortorder == 'desc') { - arsort($name); - $arrayforsort=$name; - } - if ($sortfield == 'amount_ht' && $sortorder == 'asc') { - asort($amount_ht); - $arrayforsort=$amount_ht; - } - if ($sortfield == 'amount_ht' && $sortorder == 'desc') { - arsort($amount_ht); - $arrayforsort=$amount_ht; - } - if ($sortfield == 'amount_ttc' && $sortorder == 'asc') { - asort($amount); - $arrayforsort=$amount; - } - if ($sortfield == 'amount_ttc' && $sortorder == 'desc') { - arsort($amount); - $arrayforsort=$amount; - } - foreach($arrayforsort as $key=>$value) { - $var=!$var; - print ""; + if (count($name)) { + foreach($name as $key=>$value) { + $var=!$var; + print ""; - // Product - $fullname=$name[$key]; - if ($key >= 0) { - $linkname=''.img_object($langs->trans("ShowProduct"),'product').' '.$fullname.''; - } else { - $linkname=$langs->trans("PaymentsNotLinkedToProduct"); - } + // Product + $fullname=$name[$key]; + if ($key >= 0) { + $linkname=''.img_object($langs->trans("ShowProduct"),'product').' '.$fullname.''; + } else { + $linkname=$langs->trans("PaymentsNotLinkedToProduct"); + } - print "\n"; + print "\n"; + + // Quantity + print ''; + + // Percent; + print ''; + + // Amount w/o VAT + print ''; + + // Amount with VAT + print ''; + + // Percent; + print ''; + + // TODO: statistics? + + print "\n"; + $i++; + } - // Amount w/o VAT - print ''; + // Total + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; - // Amount with VAT - print ''; - - // Percent; - print ''; - - // TODO: statistics? - - print "\n"; - $i++; - } - - // Total - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - $db->free($result); - } - print "
'; + print $langs->trans("Category") . ': ' . $formother->select_categories(Categorie::TYPE_PRODUCT, $selected_cat, 'search_categ', true); + print ' '; + print $langs->trans("SubCats") . '? '; + print ''; + print ''; + print '
".$linkname."".$linkname."'; + print $qty[$key]; + print ''.($qtytotal > 0 ? round(100 * $qty[$key] / $qtytotal, 2).'%' : ' ').''; + /*if ($key > 0) { + print ''; + } else { + print ''; + }*/ + print price($amount_ht[$key]); + //print ''; + print ''; + /*if ($key > 0) { + print ''; + } else { + print ''; + }*/ + print price($amount[$key]); + //print ''; + print ''.($catotal > 0 ? round(100 * $amount[$key] / $catotal, 2).'%' : ' ').'
'; - /*if ($key > 0) { - print ''; - } else { - print ''; - }*/ - print price($amount_ht[$key]); - //print ''; - print '
'.$langs->trans("Total").''.price($catotal_ht).''.price($catotal).' 
'; - /*if ($key > 0) { - print ''; - } else { - print ''; - }*/ - print price($amount[$key]); - //print ''; - print ''.($catotal > 0 ? round(100 * $amount[$key] / $catotal, 2).'%' : ' ').'
'.$langs->trans("Total").''.price($catotal_ht).''.price($catotal).' 
"; - print ''; + $db->free($result); + } + print ""; + print ''; } else { - // $modecompta != 'CREANCES-DETTES' - // "Calculation of part of each product for accountancy in this mode is not possible. When a partial payment (for example 5 euros) is done on an - // invoice with 2 product (product A for 10 euros and product B for 20 euros), what is part of paiment for product A and part of paiment for product B ? - // Because there is no way to know this, this report is not relevant. + // $modecompta != 'CREANCES-DETTES' + // "Calculation of part of each product for accountancy in this mode is not possible. When a partial payment (for example 5 euros) is done on an + // invoice with 2 product (product A for 10 euros and product B for 20 euros), what is part of paiment for product A and part of paiment for product B ? + // Because there is no way to know this, this report is not relevant. print '
'.$langs->trans("TurnoverPerProductInCommitmentAccountingNotRelevant") . '
'; } diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index e39c5502b4d..4d0451285b1 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2007 Franky Van Liedekerke @@ -1149,6 +1149,14 @@ else else print $langs->trans("NoDolibarrAccess"); print ''; + print ''; + print $langs->trans("ExportCardToFormat").''; + print ''; + print img_picto($langs->trans("VCard"),'vcard.png').' '; + print $langs->trans("VCard"); + print ''; + print ''; + print ""; print dol_fiche_end(); diff --git a/htdocs/contact/exportimport.php b/htdocs/contact/exportimport.php deleted file mode 100644 index e9e9c70966c..00000000000 --- a/htdocs/contact/exportimport.php +++ /dev/null @@ -1,112 +0,0 @@ - - * Copyright (C) 2006-2012 Regis Houssin - * - * 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/contact/exportimport.php - * \ingroup societe - * \brief Onglet exports-imports d'un contact - */ - -require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/contact.lib.php'; - -$langs->load("companies"); - -// Security check -$id = GETPOST('id', 'int'); -if ($user->societe_id) $socid=$user->societe_id; -$result = restrictedArea($user, 'contact', $id, 'socpeople&societe'); - - -/* - * View - */ - -$title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses")); - -llxHeader('',$title,'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas'); - -$form = new Form($db); - -$contact = new Contact($db); -$contact->fetch($id, $user); - - -$head = contact_prepare_head($contact); - -dol_fiche_head($head, 'exportimport', $title, 0, 'contact'); - - -/* - * Fiche en mode visu - */ -print ''; - -$linkback = ''.$langs->trans("BackToList").''; - -// Ref -print ''; - -// Name -print ''; -print ''; - -// Company -if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) -{ - if ($contact->socid > 0) - { - $objsoc = new Societe($db); - $objsoc->fetch($contact->socid); - - print ''; - } - else - { - print ''; - } -} - -// Civility -print ''; - -print '
'.$langs->trans("Ref").''; -print $form->showrefnav($contact, 'id', $linkback); -print '
'.$langs->trans("Lastname").' / '.$langs->trans("Label").''.$contact->lastname.''.$langs->trans("Firstname").''.$contact->firstname.'
'.$langs->trans("ThirdParty").''.$objsoc->getNomUrl(1).'
'.$langs->trans("ThirdParty").''; - print $langs->trans("ContactNotLinkedToCompany"); - print '
'.$langs->trans("UserTitle").''; -print $contact->getCivilityLabel(); -print '
'; - -print '
'; - -print '
'; - -print $langs->trans("ExportCardToFormat").': '; -print ''; -print img_picto($langs->trans("VCard"),'vcard.png').' '; -print $langs->trans("VCard"); -print ''; - - - - -$db->close(); - -llxFooter(); diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index ee7742660c1..b26f8c3c3d3 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -130,24 +130,25 @@ class HookManager // Define type of hook ('output' or 'addreplace'. 'returnvalue' is deprecated). $hooktype='output'; - if (in_array( - $method, - array( - 'addMoreActionsButtons', - 'addStatisticLine', - 'deleteFile', - 'doActions', - 'formCreateThirdpartyOptions', - 'formObjectOptions', - 'formattachOptions', - 'formBuilddocLineOptions', - 'moveUploadedFile', - 'pdf_writelinedesc', - 'paymentsupplierinvoices', - 'printSearchForm', - 'formatEvent' - ) - )) $hooktype='addreplace'; + if (in_array( + $method, + array( + 'addMoreActionsButtons', + 'addStatisticLine', + 'deleteFile', + 'doActions', + 'formCreateThirdpartyOptions', + 'formObjectOptions', + 'formattachOptions', + 'formBuilddocLineOptions', + 'moveUploadedFile', + 'pdf_writelinedesc', + 'paymentsupplierinvoices', + 'printAddress', + 'printSearchForm', + 'formatEvent' + ) + )) $hooktype='addreplace'; // Deprecated hook types ('returnvalue') if (preg_match('/^pdf_/',$method) && $method != 'pdf_writelinedesc') $hooktype='returnvalue'; // pdf_xxx except pdf_writelinedesc are 'returnvalue' hooks. When there is 2 hooks of this type, only last one win. TODO Move them into 'output' or 'addreplace' hooks. if ($method == 'insertExtraFields') diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index c4385b6324e..69d17aecee4 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -504,7 +504,7 @@ function show_projects($conf,$langs,$db,$object,$backtopage='') $projecttmp = new Project($db); $i=0; - $var=false; + $var=true; while ($i < $num) { $obj = $db->fetch_object($result); diff --git a/htdocs/core/lib/contact.lib.php b/htdocs/core/lib/contact.lib.php index 40dab648de1..bd995cf63d0 100644 --- a/htdocs/core/lib/contact.lib.php +++ b/htdocs/core/lib/contact.lib.php @@ -57,11 +57,6 @@ function contact_prepare_head(Contact $object) $head[$tab][2] = 'perso'; $tab++; - $head[$tab][0] = DOL_URL_ROOT.'/contact/exportimport.php?id='.$object->id; - $head[$tab][1] = $langs->trans("ExportImport"); - $head[$tab][2] = 'exportimport'; - $tab++; - // Show more tabs from modules // Entries must be declared in modules descriptor with line // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index a6e8687278b..d2ade2e4fc6 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -361,7 +361,7 @@ class pdf_standard extends ModeleExpenseReport // Total with all taxes $pdf->SetFont('','', $default_font_size - 1); - $pdf->SetXY($this->postotalttc-2, $curY); + $pdf->SetXY($this->postotalttc-1, $curY); $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalttc, 3, price($object->lines[$i]->total_ttc), 0, 'R'); $nexY+=5; diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php index 6a4ec011747..1e0725659a0 100644 --- a/htdocs/core/modules/modFacture.class.php +++ b/htdocs/core/modules/modFacture.class.php @@ -241,10 +241,10 @@ class modFacture extends DolibarrModules $this->export_label[$r]='CustomersInvoicesAndPayments'; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_icon[$r]='bill'; $this->export_permission[$r]=array(array("facture","facture","export")); - $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>"DateDue",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_private'=>"NotePrivate",'f.note_public'=>"NotePublic",'f.fk_user_author'=>'CreatedById','uc.login'=>'CreatedByLogin','f.fk_user_valid'=>'ValidatedById','uv.login'=>'ValidatedByLogin','p.rowid'=>'PaymentId','pf.amount'=>'AmountPayment','p.datep'=>'DatePayment','p.num_paiement'=>'PaymentNumber','p.fk_bank'=>'IdTransaction'); + $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>"DateDue",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_private'=>"NotePrivate",'f.note_public'=>"NotePublic",'f.fk_user_author'=>'CreatedById','uc.login'=>'CreatedByLogin','f.fk_user_valid'=>'ValidatedById','uv.login'=>'ValidatedByLogin','p.rowid'=>'PaymentId','pf.amount'=>'AmountPayment','p.datep'=>'DatePayment','p.num_paiement'=>'PaymentNumber','pt.code'=>'PaymentMode','p.fk_bank'=>'IdTransaction'); //$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.rowid'=>"List:facture:facnumber",'f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Number",'f.total_ttc'=>"Number",'f.tva'=>"Number",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'pf.amount'=>'Number','p.datep'=>'Date','p.num_paiement'=>'Number','p.fk_bank'=>'Number'); $this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.rowid'=>"List:facture:facnumber",'f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Number",'f.total_ttc'=>"Number",'f.tva'=>"Number",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'pf.amount'=>'Number','p.datep'=>'Date','p.num_paiement'=>'Number','p.fk_bank'=>'Number'); - $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.date_lim_reglement'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_private'=>"invoice",'f.note_public'=>"invoice",'p.rowid'=>'payment','pf.amount'=>'payment','p.datep'=>'payment','p.num_paiement'=>'payment','p.fk_bank'=>'payment','f.fk_user_author'=>'user','uc.login'=>'user','f.fk_user_valid'=>'user','uv.login'=>'user'); + $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.date_lim_reglement'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_private'=>"invoice",'f.note_public'=>"invoice",'p.rowid'=>'payment','pf.amount'=>'payment','p.datep'=>'payment','p.num_paiement'=>'payment','pt.code'=>'payment','p.fk_bank'=>'payment','f.fk_user_author'=>'user','uc.login'=>'user','f.fk_user_valid'=>'user','uv.login'=>'user'); $this->export_dependencies_array[$r]=array('payment'=>'p.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them // Add extra fields $sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture'"; @@ -295,6 +295,7 @@ class modFacture extends DolibarrModules $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'facture_extrafields as extra ON f.rowid = extra.fk_object'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON pf.fk_facture = f.rowid'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'paiement as p ON pf.fk_paiement = p.rowid'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as pt ON pt.id = p.fk_paiement'; $this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid'; $this->export_sql_end[$r] .=' AND f.entity IN ('.getEntity('facture',1).')'; $r++; diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index dbdc56be3b2..691cfe7d72d 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -166,7 +166,7 @@ class modProduct extends DolibarrModules if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.barcode'=>'product')); if (! empty($conf->fournisseur->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('s.nom'=>'product','pf.ref_fourn'=>'product','pf.unitprice'=>'product')); // Add extra fields - $sql="SELECT name, label, type FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'product'"; + $sql="SELECT name, label, type FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'product' AND entity IN (0, ".$conf->entity.')'; $resql=$this->db->query($sql); if ($resql) // This can fail when class is used on old database (during migration for example) { @@ -251,7 +251,8 @@ class modProduct extends DolibarrModules $this->import_fields_array[$r]=array('p.ref'=>"Ref*",'p.label'=>"Label*",'p.description'=>"Description",'p.url'=>"PublicUrl",'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",'p.length'=>"Length",'p.surface'=>"Surface",'p.volume'=>"Volume",'p.weight'=>"Weight",'p.duration'=>"Duration",'p.customcode'=>'CustomCode','p.price'=>"SellingPriceHT",'p.price_ttc'=>"SellingPriceTTC",'p.tva_tx'=>'VAT','p.tosell'=>"OnSell*",'p.tobuy'=>"OnBuy*",'p.fk_product_type'=>"Type*",'p.finished'=>'Nature','p.datec'=>'DateCreation*'); if (! empty($conf->barcode->enabled)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.barcode'=>'BarCode')); // Add extra fields - $sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'product' AND entity = ".$conf->entity; + $import_extrafield_sample=array(); + $sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'product' entity IN (0, ".$conf->entity.')'; $resql=$this->db->query($sql); if ($resql) // This can fail when class is used on old database (during migration for example) { @@ -260,13 +261,14 @@ class modProduct extends DolibarrModules $fieldname='extra.'.$obj->name; $fieldlabel=ucfirst($obj->label); $this->import_fields_array[$r][$fieldname]=$fieldlabel.($obj->fieldrequired?'*':''); + $import_extrafield_sample[$fieldname]=$fieldlabel; } } // End add extra fields $this->import_fieldshidden_array[$r]=array('extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'product'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) $this->import_regex_array[$r]=array('p.ref'=>'[^ ]','p.tosell'=>'^[0|1]$','p.tobuy'=>'^[0|1]$','p.fk_product_type'=>'^[0|1]$','p.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$'); - $this->import_examplevalues_array[$r]=array('p.ref'=>"PREF123456",'p.label'=>"My product",'p.description'=>"This is a description example for record",'p.note'=>"Some note",'p.price'=>"100",'p.price_ttc'=>"110",'p.tva_tx'=>'10','p.tosell'=>"0 or 1",'p.tobuy'=>"0 or 1",'p.fk_product_type'=>"0 for product/1 for service",'p.finished'=>'','p.duration'=>"1y",'p.datec'=>'2008-12-31'); - + $import_sample=array('p.ref'=>"PREF123456",'p.label'=>"My product",'p.description'=>"This is a description example for record",'p.note'=>"Some note",'p.price'=>"100",'p.price_ttc'=>"110",'p.tva_tx'=>'10','p.tosell'=>"0 or 1",'p.tobuy'=>"0 or 1",'p.fk_product_type'=>"0 for product/1 for service",'p.finished'=>'','p.duration'=>"1y",'p.datec'=>'2008-12-31'); + $this->import_examplevalues_array[$r]=array_merge($import_sample,$import_extrafield_sample); if (! empty($conf->fournisseur->enabled)) { diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index db55be8754c..fad1af3c082 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -527,7 +527,8 @@ jQuery(document).ready(function() { } if (this.id == 'pmpprice') { - var defaultbuyprice = global->MARGIN_PMP_AS_DEFAULT_BUY_PRICE)?int($conf->global->MARGIN_PMP_AS_DEFAULT_BUY_PRICE):1); ?>; + // If margin is calculated on PMP, we set it by defaut (but only if value is not 0) + var defaultbuyprice = global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE == 'pmp')?1:0); ?>; if (this.price > 0 && 1 == defaultbuyprice) { defaultkey = this.id; defaultprice = this.price; } options += ''; } diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 1e7a0d054c0..fd701cc333b 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -49,6 +49,7 @@ $date_start = dol_mktime(0, 0, 0, GETPOST('date_debutmonth'), GETPOST('date_debu $date_end = dol_mktime(0, 0, 0, GETPOST('date_finmonth'), GETPOST('date_finday'), GETPOST('date_finyear')); $date = dol_mktime(0, 0, 0, GETPOST('datemonth'), GETPOST('dateday'), GETPOST('dateyear')); $fk_projet=GETPOST('fk_projet'); +$vatrate=GETPOST('vatrate'); $ref=GETPOST("ref",'alpha'); // If socid provided by ajax company selector @@ -178,7 +179,7 @@ if ($action == 'update' && $user->rights->expensereport->creer) } } -if ($action == "confirm_save" && GETPOST("confirm") == "yes" && $id > 0 && $user->rights->expensereport->creer) +if ($action == "confirm_validate" && GETPOST("confirm") == "yes" && $id > 0 && $user->rights->expensereport->creer) { $object = new ExpenseReport($db); $object->fetch($id); @@ -220,6 +221,8 @@ if ($action == "confirm_save" && GETPOST("confirm") == "yes" && $id > 0 && $user if ($emailTo && $emailFrom) { + $filename=array(); $filedir=array(); $mimetype=array(); + // SUBJECT $subject = $langs->trans("ExpenseReportWaitingForApproval"); @@ -234,7 +237,6 @@ if ($action == "confirm_save" && GETPOST("confirm") == "yes" && $id > 0 && $user if($resultPDF): // ATTACHMENT - $filename=array(); $filedir=array(); $mimetype=array(); array_push($filename,dol_sanitizeFileName($object->ref).".pdf"); array_push($filedir,$conf->expensereport->dir_output . "/" . dol_sanitizeFileName($object->ref) . "/" . dol_sanitizeFileName($object->ref).".pdf"); array_push($mimetype,"application/pdf"); @@ -260,7 +262,7 @@ if ($action == "confirm_save" && GETPOST("confirm") == "yes" && $id > 0 && $user if ($mailfile->error) { $mesg=''; - $mesg.=$langs->trans('ErrorFailedToSendMail',$from,$sendto); + $mesg.=$langs->trans('ErrorFailedToSendMail', $emailFrom, $emailTo); $mesg.='
'.$mailfile->error; setEventMessage($mesg,'errors'); } @@ -666,123 +668,6 @@ if ($action == "confirm_cancel" && GETPOST('confirm')=="yes" && GETPOST('detail_ } } -if ($action == "confirm_paid" && GETPOST('confirm')=="yes" && $id > 0 && $user->rights->expensereport->to_paid) -{ - $object = new ExpenseReport($db); - $object->fetch($id); - - $result = $object->setPaid($user); - - if ($result > 0) - { - // Define output language - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) - { - $outputlangs = $langs; - $newlang = ''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; - if (! empty($newlang)) { - $outputlangs = new Translate("", $conf); - $outputlangs->setDefaultLang($newlang); - } - $model=$object->modelpdf; - $ret = $object->fetch($id); // Reload to get new records - - $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); - } - } - - if ($result > 0) - { - if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) - { - // Send mail - - // TO - $destinataire = new User($db); - $destinataire->fetch($object->fk_user_author); - $emailTo = $destinataire->email; - - // FROM - $expediteur = new User($db); - $expediteur->fetch($object->fk_user_paid); - $emailFrom = $expediteur->email; - - // SUBJECT - $subject = "' ERP - Note de frais payée"; - - // CONTENT - $message = "Bonjour {$destinataire->firstname},\n\n"; - $message.= "Votre note de frais \"{$object->ref}\" vient d'être payée.\n"; - $message.= "- Payeur : {$expediteur->firstname} {$expediteur->lastname}\n"; - $message.= "- Lien : {$dolibarr_main_url_root}/expensereport/card.php?id={$object->id}\n\n"; - $message.= "Bien cordialement,\n' SI"; - - // Génération du pdf avant attachement - $object->setDocModel($user,""); - $resultPDF = expensereport_pdf_create($db,$object,'',"",$langs); - - // PREPARE SEND - $mailfile = new CMailFile($subject,$emailTo,$emailFrom,$message); - - if(!$mailfile->error): - - // SEND - $result=$mailfile->sendfile(); - if ($result): - // Insert écriture dans le compte courant - $idTrip = $id; - $idAccount = 1; - - $object = new ExpenseReport($db); - $object->fetch($idTrip); - - $datePaiement = explode("-",$object->date_paiement); - - $dateop = dol_mktime(12,0,0,$datePaiement[1],$datePaiement[2],$datePaiement[0]); - $operation = $object->code_paiement; - $label = "Règlement ".$object->ref; - $amount = - price2num($object->total_ttc); - $num_chq = ''; - $cat1 = ''; - - $user = new User($db); - $user->fetch($object->fk_user_paid); - - $acct=new Account($db,$idAccount); - $insertid = $acct->addline($dateop, $operation, $label, $amount, $num_chq, $cat1, $user); - - if ($insertid > 0): - $sql = " UPDATE ".MAIN_DB_PREFIX."expensereport as d"; - $sql.= " SET integration_compta = 1, fk_bank_account = $idAccount"; - $sql.= " WHERE rowid = $idTrip"; - $resql=$db->query($sql); - if($result): - Header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); - exit; - else: - dol_print_error($db); - endif; - else: - dol_print_error($db,$acct->error); - endif; - endif; - - else: - - $mesg="Impossible d'envoyer l'email."; - - endif; - // END - Send mail - } - } - else - { - setEventMessages($object->error, $object->errors, 'errors'); - } -} - if ($action == "confirm_brouillonner" && GETPOST('confirm')=="yes" && $id > 0 && $user->rights->expensereport->creer) { $object = new ExpenseReport($db); @@ -827,16 +712,96 @@ if ($action == "confirm_brouillonner" && GETPOST('confirm')=="yes" && $id > 0 && } } -if ($action == 'set_paid') +if ($action == 'set_paid' && $id > 0 && $user->rights->expensereport->to_paid) { - if ($object->set_paid($id) >= 0) + $object = new ExpenseReport($db); + $object->fetch($id); + + $result = $object->set_paid($id, $user); + + if ($result > 0) { - header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); - exit; + // Define output language + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; + if (! empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + $model=$object->modelpdf; + $ret = $object->fetch($id); // Reload to get new records + + $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); + } + } + + if ($result > 0) + { + if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) + { + // Send mail + + // TO + $destinataire = new User($db); + $destinataire->fetch($object->fk_user_author); + $emailTo = $destinataire->email; + + // FROM + $expediteur = new User($db); + $expediteur->fetch($user->id); + $emailFrom = $expediteur->email; + + // SUBJECT + $subject = "'ERP - Note de frais payée"; + + // CONTENT + $message = "Bonjour {$destinataire->firstname},\n\n"; + $message.= "Votre note de frais \"{$object->ref}\" vient d'être payée.\n"; + $message.= "- Payeur : {$expediteur->firstname} {$expediteur->lastname}\n"; + $message.= "- Lien : {$dolibarr_main_url_root}/expensereport/card.php?id={$object->id}\n\n"; + $message.= "Bien cordialement,\n' SI"; + + // Generate pdf before attachment + $object->setDocModel($user,""); + $resultPDF = expensereport_pdf_create($db,$object,'',"",$langs); + + // PREPARE SEND + $mailfile = new CMailFile($subject,$emailTo,$emailFrom,$message); + + if(!$mailfile->error): + + // SEND + $result=$mailfile->sendfile(); + if ($result): + + // Retour + if($result): + Header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); + exit; + else: + dol_print_error($db); + endif; + + else: + dol_print_error($db,$acct->error); + endif; + + else: + + $mesg="Impossible d'envoyer l'email."; + + endif; + // END - Send mail + } + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); } - else { - setEventMessage($object->error, 'errors'); - } } if ($action == "addline") @@ -859,7 +824,8 @@ if ($action == "addline") $object_ligne->fk_c_type_fees = GETPOST('fk_c_type_fees'); - $object_ligne->vatrate = price2num(GETPOST('vatrate')); + $object_ligne->fk_c_tva = GETPOST('fk_c_tva'); + $object_ligne->vatrate = price2num($vatrate); $object_ligne->fk_projet = $fk_projet; @@ -904,10 +870,10 @@ if ($action == "addline") { $object_ligne->fk_expensereport = $_POST['fk_expensereport']; - $type = 0; // TODO What if service + $type = 0; // TODO What if service ? $tmp = calcul_price_total($qty, $up, 0, $vatrate, 0, 0, 0, 'TTC', 0, $type); - $object_ligne->vatrate = price2num(GETPOST('vatrate')); + $object_ligne->vatrate = price2num($vatrate); $object_ligne->total_ttc = $tmp[2]; $object_ligne->total_ht = $tmp[0]; $object_ligne->total_tva = $tmp[1]; @@ -1308,7 +1274,7 @@ else print ''.$langs->trans("AUTHORPAIEMENT").''; print ''; $userfee=new User($db); - $userfee->fetch($object->fk_user_paid); + $userfee->fetch($user->id); print $userfee->getNomUrl(1); print ''; @@ -1350,7 +1316,7 @@ else dol_fiche_head($head, 'card', $langs->trans("TripCard"), 0, 'trip'); if ($action == 'save'): - $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("SaveTrip"),$langs->trans("ConfirmSaveTrip"),"confirm_save","","",1); + $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("SaveTrip"),$langs->trans("ConfirmSaveTrip"),"confirm_validate","","",1); if ($ret == 'html') print '
'; endif; @@ -1399,7 +1365,7 @@ else if ($ret == 'html') print '
'; } - print ''; + print '
'; $linkback = ''.$langs->trans("BackToList").''; @@ -1426,6 +1392,7 @@ else print ''; print ''; print ''; + print ''; print ''; print ''; @@ -1529,20 +1496,6 @@ else print ''; print ''; print ''; - if($object->fk_statut==6) - { - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - } // User to inform if($object->fk_statut<3) // informed @@ -1614,6 +1567,22 @@ else print ''; print ''; } + + if($object->fk_statut==6) + { + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + } + print '
'.$langs->trans("Statut").''.$object->getLibStatut(4).'
'.$langs->trans("NotePublic").''.$object->note_public.''.$langs->trans("DATE_SAVE").''.dol_print_date($object->date_create,'dayhour').'
'.$langs->trans("AUTHORPAIEMENT").''; - $userfee=new User($db); - $userfee->fetch($object->fk_user_paid); - print $userfee->getNomUrl(1); - print '
'.$langs->trans("DATE_PAIEMENT").''.$object->date_paiement.'
'.$langs->trans("AUTHORPAIEMENT").''; + $userfee=new User($db); + $userfee->fetch($object->fk_user_paid); + print $userfee->getNomUrl(1); + print '
'.$langs->trans("DATE_PAIEMENT").''.$object->date_paiement.'
'; print '
'; @@ -1999,9 +1968,9 @@ if ($action != 'create' && $action != 'edit') print ''; } - if ($object->statut == 1 && round($remaintopay) == 0 && $object->paid == 0 && $user->rights->don->creer) + if (round($remaintopay) == 0 && $object->paid == 0) { - print '"; + print '"; } // Cancel diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 9d8e7510e06..0aa45386a85 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2015 Laurent Destailleur + * Copyright (C) 2015 Alexandre Spangaro * * 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 @@ -88,8 +89,6 @@ class ExpenseReport extends CommonObject var $fk_user_approve; // Paiement - var $date_paiement; - var $fk_user_paid; var $user_paid_infos; /* @@ -112,7 +111,7 @@ class ExpenseReport extends CommonObject // List of language codes for status $this->statuts_short = array(0 => 'Draft', 2 => 'Validated', 4 => 'Canceled', 5 => 'Approved', 6 => 'Paid', 99 => 'Refused'); - $this->statuts = array(0 => 'Draft', 2 => 'Validated', 4 => 'Canceled', 5 => 'Approved', 6 => 'Paid', 99 => 'Refused'); + $this->statuts = array(0 => 'Draft', 2 => 'ValidatedWaitingApproval', 4 => 'Canceled', 5 => 'Approved', 6 => 'Paid', 99 => 'Refused'); $this->statuts_logo = array(0 => 'statut0', 2 => 'statut1', 4 => 'statut5', 5 => 'statut3', 6 => 'statut6', 99 => 'statut8'); return 1; @@ -241,7 +240,6 @@ class ExpenseReport extends CommonObject $sql.= " , fk_user_author = ".($user->id > 0 ? "'".$user->id."'":"null"); $sql.= " , fk_user_validator = ".($this->fk_user_validator > 0 ? $this->fk_user_validator:"null"); $sql.= " , fk_user_valid = ".($this->fk_user_valid > 0 ? $this->fk_user_valid:"null"); - $sql.= " , fk_user_paid = ".($this->fk_user_paid > 0 ? $this->fk_user_paid:"null"); $sql.= " , fk_statut = ".($this->fk_statut >= 0 ? $this->fk_statut:'0'); $sql.= " , fk_c_paiement = ".($this->fk_c_paiement > 0 ? $this->fk_c_paiement:"null"); $sql.= " , note_public = ".(!empty($this->note_public)?"'".$this->db->escape($this->note_public)."'":"''"); @@ -277,9 +275,9 @@ class ExpenseReport extends CommonObject $sql.= " d.detail_refuse, d.detail_cancel, d.fk_user_refuse, d.fk_user_cancel,"; // ACTIONS $sql.= " d.date_refuse, d.date_cancel,"; // ACTIONS $sql.= " d.total_ht, d.total_ttc, d.total_tva,"; // TOTAUX (int) - $sql.= " d.date_debut, d.date_fin, d.date_create, d.date_valid, d.date_approve, d.date_paiement,"; // DATES (datetime) + $sql.= " d.date_debut, d.date_fin, d.date_create, d.date_valid, d.date_approve,"; // DATES (datetime) $sql.= " d.fk_user_author, d.fk_user_validator, d.fk_statut as status, d.fk_c_paiement,"; - $sql.= " d.fk_user_valid, d.fk_user_approve, d.fk_user_paid,"; + $sql.= " d.fk_user_valid, d.fk_user_approve,"; $sql.= " dp.libelle as libelle_paiement, dp.code as code_paiement"; // INNER JOIN paiement $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as d LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as dp ON d.fk_c_paiement = dp.id"; if ($ref) $sql.= " WHERE d.ref = '".$this->db->escape($ref)."'"; @@ -305,7 +303,6 @@ class ExpenseReport extends CommonObject $this->date_debut = $this->db->jdate($obj->date_debut); $this->date_fin = $this->db->jdate($obj->date_fin); - $this->date_paiement = $this->db->jdate($obj->date_paiement); $this->date_valid = $this->db->jdate($obj->date_valid); $this->date_approve = $this->db->jdate($obj->date_approve); $this->date_create = $this->db->jdate($obj->date_create); @@ -318,7 +315,6 @@ class ExpenseReport extends CommonObject $this->fk_user_refuse = $obj->fk_user_refuse; $this->fk_user_cancel = $obj->fk_user_cancel; $this->fk_user_approve = $obj->fk_user_approve; - $this->fk_user_paid = $obj->fk_user_paid; $user_author = new User($this->db); if ($this->fk_user_author > 0) $user_author->fetch($this->fk_user_author); @@ -341,13 +337,6 @@ class ExpenseReport extends CommonObject $this->user_valid_infos = dolGetFirstLastname($user_valid->firstname, $user_valid->lastname); } - if ($this->fk_statut==6) - { - $user_paid = new User($this->db); - if ($this->fk_user_paid > 0) $user_paid->fetch($this->fk_user_paid); - $this->user_paid_infos = dolGetFirstLastname($user_paid->firstname, $user_paid->lastname); - } - $this->libelle_statut = $obj->libelle_statut; $this->libelle_paiement = $obj->libelle_paiement; $this->code_statut = $obj->code_statut; @@ -376,13 +365,16 @@ class ExpenseReport extends CommonObject * Classify the expense report as paid * * @param int $id id of expense report - * @return int <0 if KO, >0 if OK + * @param user $fuser User + * @return int <0 if KO, >0 if OK */ - function set_paid($id) + function set_paid($id, $fuser) { - $sql = "UPDATE ".MAIN_DB_PREFIX."expensereport SET fk_statut = 6"; + $sql = "UPDATE ".MAIN_DB_PREFIX."expensereport"; + $sql.= " SET fk_statut = 6; $sql.= " WHERE rowid = $id AND fk_statut = 5"; + dol_syslog(get_class($this)."::set_paid sql=".$sql, LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -1017,41 +1009,6 @@ class ExpenseReport extends CommonObject } } - /** - * setPaid - * - * @param User $fuser User - * @return int <0 if KO, >0 if OK - */ - function setPaid($fuser) - { - $now= dol_now(); - - $this->date_paiement = $this->db->idate($now); - if ($this->fk_statut != 6) - { - $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; - $sql.= " SET fk_statut = 6, fk_user_paid = ".$fuser->id.","; - $sql.= " date_paiement='".$this->db->idate($this->date_paiement)."'"; - $sql.= ' WHERE rowid = '.$this->id; - - dol_syslog(get_class($this)."::setPaid sql=".$sql, LOG_DEBUG); - if ($this->db->query($sql)) - { - return 1; - } - else - { - $this->error=$this->db->error(); - return -1; - } - } - else - { - dol_syslog(get_class($this)."::set_paid expensereport already with paid status", LOG_WARNING); - } - } - /** * set_unpaid * diff --git a/htdocs/expensereport/export_csv.php b/htdocs/expensereport/export_csv.php index 3a2010ce340..817d651c3e8 100644 --- a/htdocs/expensereport/export_csv.php +++ b/htdocs/expensereport/export_csv.php @@ -126,9 +126,8 @@ if (isset($_POST['action'])) $outputlangs = $langs; $outputlangs->charset_output = 'UTF-8'; - $sql = "SELECT d.rowid, d.ref, d.date_paiement, d.total_ht, d.total_tva, d.total_ttc"; + $sql = "SELECT d.rowid, d.ref, d.total_ht, d.total_tva, d.total_ttc"; $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as d"; - $sql.= " WHERE date_paiement LIKE '".$select_date."%'"; $sql.= " ORDER BY d.rowid"; $result = $db->query($sql); @@ -146,7 +145,7 @@ if (isset($_POST['action'])) $objet->total_tva = number_format($objet->total_tva,2); $objet->total_ttc = number_format($objet->total_ttc,2); $objet->ref = trim($objet->ref); - $ligne.= "{$objet->rowid}, {$objet->ref}, ----, {$objet->date_paiement}, {$objet->total_ht}, {$objet->total_tva}, {$objet->total_ttc}\n"; + $ligne.= "{$objet->rowid}, {$objet->ref}, ----, {$objet->total_ht}, {$objet->total_tva}, {$objet->total_ttc}\n"; $ligne.= "--->, Ligne, Type, Description, ----, ----, ----\n"; diff --git a/htdocs/expensereport/index.php b/htdocs/expensereport/index.php index 5b157f6df8b..e98921362ff 100644 --- a/htdocs/expensereport/index.php +++ b/htdocs/expensereport/index.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005-2011 Regis Houssin * @@ -70,13 +70,11 @@ $totalnb=$totalsum=0; $sql = "SELECT tf.code, tf.label, count(de.rowid) as nb, sum(de.total_ht) as km"; $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as d, ".MAIN_DB_PREFIX."expensereport_det as de, ".MAIN_DB_PREFIX."c_type_fees as tf"; $sql.= " WHERE de.fk_expensereport = d.rowid AND de.fk_c_type_fees = tf.id"; - // RESTRICT RIGHTS if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous)) { $sql.= " AND d.fk_user_author IN (".join(',',$childids).")\n"; } - $sql.= " GROUP BY tf.code, tf.label"; $result = $db->query($sql); @@ -202,7 +200,7 @@ if ($result) } else { - print ''.$langs->trans("None").''; + print ''.$langs->trans("None").''; } print '
'; } diff --git a/htdocs/expensereport/synchro_compta.php b/htdocs/expensereport/synchro_compta.php index 58fcbaee301..90eb4bd4674 100644 --- a/htdocs/expensereport/synchro_compta.php +++ b/htdocs/expensereport/synchro_compta.php @@ -33,8 +33,6 @@ if ($_GET["action"] == 'confirm_ndf_to_account' && $_GET["confirm"] == "yes"): $expensereport = new ExpenseReport($db); $expensereport->fetch($idTrip,$user); - $datePaiement = explode("-",$expensereport->date_paiement); - $dateop = dol_mktime(12,0,0,$datePaiement[1],$datePaiement[2],$datePaiement[0]); $operation = $expensereport->code_paiement; $label = "Règlement ".$expensereport->ref; @@ -43,7 +41,7 @@ if ($_GET["action"] == 'confirm_ndf_to_account' && $_GET["confirm"] == "yes"): $cat1 = ''; $user = new User($db); - $user->fetch($expensereport->fk_user_paid); + $user->fetch($user->id); $acct=new Account($db,$idAccount); $insertid = $acct->addline($dateop, $operation, $label, $amount, $num_chq, $cat1, $user); diff --git a/htdocs/includes/jquery/plugins/blockUI/jquery.blockUI.js b/htdocs/includes/jquery/plugins/blockUI/jquery.blockUI.js index 6acca8c7b81..90ce5d64df3 100644 --- a/htdocs/includes/jquery/plugins/blockUI/jquery.blockUI.js +++ b/htdocs/includes/jquery/plugins/blockUI/jquery.blockUI.js @@ -1,10 +1,10 @@ /*! * jQuery blockUI plugin - * Version 2.43 (29-JUL-2012) - * @requires jQuery v1.2.3 or later + * Version 2.70.0-2014.11.23 + * Requires jQuery v1.7 or later * * Examples at: http://malsup.com/jquery/block/ - * Copyright (c) 2007-2010 M. Alsup + * Copyright (c) 2007-2013 M. Alsup * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html @@ -13,22 +13,20 @@ */ ;(function() { +/*jshint eqeqeq:false curly:false latedef:false */ +"use strict"; function setup($) { - if (/1\.(0|1|2)\.(0|1|2)/.test($.fn.jquery) || /^1.1/.test($.fn.jquery)) { - alert('blockUI requires jQuery v1.2.3 or later! You are using v' + $.fn.jquery); - return; - } - $.fn._fadeIn = $.fn.fadeIn; - var noOp = function() {}; + var noOp = $.noop || function() {}; // this bit is to ensure we don't call setExpression when we shouldn't (with extra muscle to handle - // retarded userAgent strings on Vista) + // confusing userAgent strings on Vista) + var msie = /MSIE/.test(navigator.userAgent); + var ie6 = /MSIE 6.0/.test(navigator.userAgent) && ! /MSIE 8.0/.test(navigator.userAgent); var mode = document.documentMode || 0; - var setExpr = $.browser.msie && (($.browser.version < 8 && !mode) || mode < 8); - var ie6 = $.browser.msie && /MSIE 6.0/.test(navigator.userAgent) && !mode; + var setExpr = $.isFunction( document.createElement('div').style.setExpression ); // global $ methods for blocking/unblocking the entire page $.blockUI = function(opts) { install(window, opts); }; @@ -39,17 +37,47 @@ var $m = $('
'); if (title) $m.append('

'+title+'

'); if (message) $m.append('

'+message+'

'); - if (timeout == undefined) timeout = 3000; - $.blockUI({ - message: $m, fadeIn: 700, fadeOut: 1000, centerY: false, - timeout: timeout, showOverlay: false, - onUnblock: onClose, - css: $.blockUI.defaults.growlCSS + if (timeout === undefined) timeout = 3000; + + // Added by konapun: Set timeout to 30 seconds if this growl is moused over, like normal toast notifications + var callBlock = function(opts) { + opts = opts || {}; + + $.blockUI({ + message: $m, + fadeIn : typeof opts.fadeIn !== 'undefined' ? opts.fadeIn : 700, + fadeOut: typeof opts.fadeOut !== 'undefined' ? opts.fadeOut : 1000, + timeout: typeof opts.timeout !== 'undefined' ? opts.timeout : timeout, + centerY: false, + showOverlay: false, + onUnblock: onClose, + css: $.blockUI.defaults.growlCSS + }); + }; + + callBlock(); + var nonmousedOpacity = $m.css('opacity'); + $m.mouseover(function() { + callBlock({ + fadeIn: 0, + timeout: 30000 + }); + + var displayBlock = $('.blockMsg'); + displayBlock.stop(); // cancel fadeout if it has started + displayBlock.fadeTo(300, 1); // make it easier to read the message by removing transparency + }).mouseout(function() { + $('.blockMsg').fadeOut(1000); }); + // End konapun additions }; // plugin method for blocking element content $.fn.block = function(opts) { + if ( this[0] === window ) { + $.blockUI( opts ); + return this; + } var fullOpts = $.extend({}, $.blockUI.defaults, opts || {}); this.each(function() { var $el = $(this); @@ -59,30 +87,35 @@ }); return this.each(function() { - if ($.css(this,'position') == 'static') + if ($.css(this,'position') == 'static') { this.style.position = 'relative'; - if ($.browser.msie) - this.style.zoom = 1; // force 'hasLayout' + $(this).data('blockUI.static', true); + } + this.style.zoom = 1; // force 'hasLayout' in ie install(this, opts); }); }; // plugin method for unblocking element content $.fn.unblock = function(opts) { + if ( this[0] === window ) { + $.unblockUI( opts ); + return this; + } return this.each(function() { remove(this, opts); }); }; - $.blockUI.version = 2.42; // 2nd generation blocking at no extra cost! + $.blockUI.version = 2.70; // 2nd generation blocking at no extra cost! // override these in your code to change the default behavior and style $.blockUI.defaults = { // message displayed when blocking (use null for no message) message: '

Please wait...

', - title: null, // title string; only used when theme == true - draggable: true, // only used when theme == true (requires jquery-ui.js to be loaded) + title: null, // title string; only used when theme == true + draggable: true, // only used when theme == true (requires jquery-ui.js to be loaded) theme: false, // set to true to use with jQuery UI themes @@ -111,30 +144,35 @@ // styles for the overlay overlayCSS: { - backgroundColor: '#000', - opacity: 0.6, - cursor: 'wait' + backgroundColor: '#000', + opacity: 0.6, + cursor: 'wait' }, + // style to replace wait cursor before unblocking to correct issue + // of lingering wait cursor + cursorReset: 'default', + // styles applied when using $.growlUI growlCSS: { - width: '350px', + width: '350px', top: '10px', - left: '', - right: '10px', - border: 'none', + left: '', + right: '10px', + border: 'none', padding: '5px', opacity: 0.6, - cursor: 'default', + cursor: 'default', color: '#fff', backgroundColor: '#000', - '-webkit-border-radius': '10px', - '-moz-border-radius': '10px', - 'border-radius': '10px' + '-webkit-border-radius':'10px', + '-moz-border-radius': '10px', + 'border-radius': '10px' }, // IE issues: 'about:blank' fails on HTTPS and javascript:false is s-l-o-w // (hat tip to Jorge H. N. de Vasconcelos) + /*jshint scripturl:true */ iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank', // force usage of iframe in non-IE browsers (handy for blocking applets) @@ -174,8 +212,12 @@ // page blocking focusInput: true, + // elements that can receive focus + focusableElements: ':input:enabled:visible', + // suppresses the use of overlay styles on FF/Linux (due to performance issues with opacity) - applyPlatformOpacityRules: true, + // no longer needed in 2012 + // applyPlatformOpacityRules: true, // callback method invoked when fadeIn has completed and blocking message is visible onBlock: null, @@ -183,9 +225,13 @@ // callback method invoked when unblocking has completed; the callback is // passed the element that has been unblocked (which is the window object for page // blocks) and the options that were passed to the unblock call: - // onUnblock(element, options) + // onUnblock(element, options) onUnblock: null, + // callback method invoked when the overlay area is clicked. + // setting this will turn the cursor to a pointer, otherwise cursor defined in overlayCss will be used. + onOverlayClick: null, + // don't ask; if you really must know: http://groups.google.com/group/jquery-en/browse_thread/thread/36640a8730503595/2f6a79a77a78e493#2f6a79a77a78e493 quirksmodeOffsetHack: 4, @@ -212,6 +258,9 @@ opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {}); css = $.extend({}, $.blockUI.defaults.css, opts.css || {}); + if (opts.onOverlayClick) + opts.overlayCSS.cursor = 'pointer'; + themedCSS = $.extend({}, $.blockUI.defaults.themedCSS, opts.themedCSS || {}); msg = msg === undefined ? opts.message : msg; @@ -241,30 +290,31 @@ // layer1 is the iframe layer which is used to supress bleed through of underlying content // layer2 is the overlay layer which has opacity and a wait cursor (by default) // layer3 is the message content that is displayed while blocking + var lyr1, lyr2, lyr3, s; + if (msie || opts.forceIframe) + lyr1 = $(''); + else + lyr1 = $(''); - var lyr1 = ($.browser.msie || opts.forceIframe) - ? $('') - : $(''); + if (opts.theme) + lyr2 = $(''); + else + lyr2 = $(''); - var lyr2 = opts.theme - ? $('') - : $(''); - - var lyr3, s; if (opts.theme && full) { s = ''; } else if (opts.theme) { s = ''; } else if (full) { @@ -286,12 +336,12 @@ } // style the overlay - if (!opts.theme && (!opts.applyPlatformOpacityRules || !($.browser.mozilla && /Linux/.test(navigator.platform)))) + if (!opts.theme /*&& (!opts.applyPlatformOpacityRules)*/) lyr2.css(opts.overlayCSS); lyr2.css('position', full ? 'fixed' : 'absolute'); // make iframe layer transparent in IE - if ($.browser.msie || opts.forceIframe) + if (msie || opts.forceIframe) lyr1.css('opacity',0.0); //$([lyr1[0],lyr2[0],lyr3[0]]).appendTo(full ? 'body' : el); @@ -308,28 +358,32 @@ } // ie7 must use absolute positioning in quirks mode and to account for activex issues (when scrolling) - var expr = setExpr && (!$.boxModel || $('object,embed', full ? null : el).length > 0); + var expr = setExpr && (!$.support.boxModel || $('object,embed', full ? null : el).length > 0); if (ie6 || expr) { // give body 100% height - if (full && opts.allowBodyStretch && $.boxModel) + if (full && opts.allowBodyStretch && $.support.boxModel) $('html,body').css('height','100%'); // fix ie6 issue when blocked element has a border width - if ((ie6 || !$.boxModel) && !full) { + if ((ie6 || !$.support.boxModel) && !full) { var t = sz(el,'borderTopWidth'), l = sz(el,'borderLeftWidth'); var fixT = t ? '(0 - '+t+')' : 0; var fixL = l ? '(0 - '+l+')' : 0; } // simulate fixed position - $.each([lyr1,lyr2,lyr3], function(i,o) { + $.each(layers, function(i,o) { var s = o[0].style; s.position = 'absolute'; if (i < 2) { - full ? s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:'+opts.quirksmodeOffsetHack+') + "px"') - : s.setExpression('height','this.parentNode.offsetHeight + "px"'); - full ? s.setExpression('width','jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"') - : s.setExpression('width','this.parentNode.offsetWidth + "px"'); + if (full) + s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.support.boxModel?0:'+opts.quirksmodeOffsetHack+') + "px"'); + else + s.setExpression('height','this.parentNode.offsetHeight + "px"'); + if (full) + s.setExpression('width','jQuery.support.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"'); + else + s.setExpression('width','this.parentNode.offsetWidth + "px"'); if (fixL) s.setExpression('left', fixL); if (fixT) s.setExpression('top', fixT); } @@ -338,7 +392,7 @@ s.marginTop = 0; } else if (!opts.centerY && full) { - var top = (opts.css && opts.css.top) ? parseInt(opts.css.top) : 0; + var top = (opts.css && opts.css.top) ? parseInt(opts.css.top, 10) : 0; var expression = '((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"'; s.setExpression('top',expression); } @@ -355,7 +409,7 @@ $(msg).show(); } - if (($.browser.msie || opts.forceIframe) && opts.showOverlay) + if ((msie || opts.forceIframe) && opts.showOverlay) lyr1.show(); // opacity is zero if (opts.fadeIn) { var cb = opts.onBlock ? opts.onBlock : noOp; @@ -372,7 +426,7 @@ if (msg) lyr3.show(); if (opts.onBlock) - opts.onBlock(); + opts.onBlock.bind(lyr3)(); } // bind key and mouse events @@ -380,7 +434,7 @@ if (full) { pageBlock = lyr3[0]; - pageBlockEls = $(':input:enabled:visible',pageBlock); + pageBlockEls = $(opts.focusableElements,pageBlock); if (opts.focusInput) setTimeout(focus, 20); } @@ -390,14 +444,18 @@ if (opts.timeout) { // auto-unblock var to = setTimeout(function() { - full ? $.unblockUI(opts) : $(el).unblock(opts); + if (full) + $.unblockUI(opts); + else + $(el).unblock(opts); }, opts.timeout); $(el).data('blockUI.timeout', to); } - }; + } // remove the block function remove(el, opts) { + var count; var full = (el == window); var $el = $(el); var data = $el.data('blockUI.history'); @@ -418,21 +476,36 @@ if (full) // crazy selector to handle odd field errors in ie6/7 els = $('body').children().filter('.blockUI').add('body > .blockUI'); else - els = $('.blockUI', el); + els = $el.find('>.blockUI'); + + // fix cursor issue + if ( opts.cursorReset ) { + if ( els.length > 1 ) + els[1].style.cursor = opts.cursorReset; + if ( els.length > 2 ) + els[2].style.cursor = opts.cursorReset; + } if (full) pageBlock = pageBlockEls = null; if (opts.fadeOut) { - els.fadeOut(opts.fadeOut); - setTimeout(function() { reset(els,data,opts,el); }, opts.fadeOut); + count = els.length; + els.stop().fadeOut(opts.fadeOut, function() { + if ( --count === 0) + reset(els,data,opts,el); + }); } else reset(els, data, opts, el); - }; + } // move blocking element back into the DOM where it started function reset(els,data,opts,el) { + var $el = $(el); + if ( $el.data('blockUI.isBlocked') ) + return; + els.each(function(i,o) { // remove via DOM calls so we don't lose event handlers if (this.parentNode) @@ -442,14 +515,24 @@ if (data && data.el) { data.el.style.display = data.display; data.el.style.position = data.position; + data.el.style.cursor = 'default'; // #59 if (data.parent) data.parent.appendChild(data.el); - $(el).removeData('blockUI.history'); + $el.removeData('blockUI.history'); + } + + if ($el.data('blockUI.static')) { + $el.css('position', 'static'); // #22 } if (typeof opts.onUnblock == 'function') opts.onUnblock(el,opts); - }; + + // fix issue in Safari 6 where block artifacts remain until reflow + var body = $(document.body), w = body.width(), cssW = body[0].style.width; + body.width(w-1).width(w); + body[0].style.width = cssW; + } // bind/unbind the handler function bind(b, el, opts) { @@ -462,40 +545,47 @@ $el.data('blockUI.isBlocked', b); // don't bind events when overlay is not in use or if bindEvents is false - if (!opts.bindEvents || (b && !opts.showOverlay)) + if (!full || !opts.bindEvents || (b && !opts.showOverlay)) return; // bind anchors and inputs for mouse and key events - var events = 'mousedown mouseup keydown keypress'; - b ? $(document).bind(events, opts, handler) : $(document).unbind(events, handler); + var events = 'mousedown mouseup keydown keypress keyup touchstart touchend touchmove'; + if (b) + $(document).bind(events, opts, handler); + else + $(document).unbind(events, handler); // former impl... - // var $e = $('a,:input'); - // b ? $e.bind(events, opts, handler) : $e.unbind(events, handler); - }; + // var $e = $('a,:input'); + // b ? $e.bind(events, opts, handler) : $e.unbind(events, handler); + } // event handler to suppress keyboard/mouse events when blocking function handler(e) { // allow tab navigation (conditionally) - if (e.keyCode && e.keyCode == 9) { + if (e.type === 'keydown' && e.keyCode && e.keyCode == 9) { if (pageBlock && e.data.constrainTabKey) { var els = pageBlockEls; var fwd = !e.shiftKey && e.target === els[els.length-1]; var back = e.shiftKey && e.target === els[0]; if (fwd || back) { - setTimeout(function(){focus(back)},10); + setTimeout(function(){focus(back);},10); return false; } } } var opts = e.data; + var target = $(e.target); + if (target.hasClass('blockOverlay') && opts.onOverlayClick) + opts.onOverlayClick(e); + // allow events within the message content - if ($(e.target).parents('div.' + opts.blockMsgClass).length > 0) + if (target.parents('div.' + opts.blockMsgClass).length > 0) return true; // allow events for content that is not being blocked - return $(e.target).parents().children().filter('div.blockUI').length == 0; - }; + return target.parents().children().filter('div.blockUI').length === 0; + } function focus(back) { if (!pageBlockEls) @@ -503,7 +593,7 @@ var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0]; if (e) e.focus(); - }; + } function center(el, x, y) { var p = el.parentNode, s = el.style; @@ -511,15 +601,16 @@ var t = ((p.offsetHeight - el.offsetHeight)/2) - sz(p,'borderTopWidth'); if (x) s.left = l > 0 ? (l+'px') : '0'; if (y) s.top = t > 0 ? (t+'px') : '0'; - }; + } function sz(el, p) { - return parseInt($.css(el,p))||0; - }; + return parseInt($.css(el,p),10)||0; + } - }; + } + /*global define:true */ if (typeof define === 'function' && define.amd && define.amd.jQuery) { define(['jquery'], setup); } else { diff --git a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql index 5f207693f57..f10fc56af45 100755 --- a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql +++ b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql @@ -231,7 +231,6 @@ CREATE TABLE llx_expensereport ( date_approve datetime, date_refuse datetime, date_cancel datetime, - date_paiement datetime, tms timestamp, fk_user_author integer NOT NULL, fk_user_modif integer DEFAULT NULL, @@ -240,7 +239,6 @@ CREATE TABLE llx_expensereport ( fk_user_approve integer DEFAULT NULL, fk_user_refuse integer DEFAULT NULL, fk_user_cancel integer DEFAULT NULL, - fk_user_paid integer DEFAULT NULL, fk_statut integer NOT NULL, -- 1=brouillon, 2=validé (attente approb), 4=annulé, 5=approuvé, 6=payed, 99=refusé fk_c_paiement integer DEFAULT NULL, paid smallint default 0 NOT NULL, @@ -705,4 +703,4 @@ ALTER TABLE llx_holiday_logs ADD COLUMN fk_type integer NOT NULL DEFAULT 1; UPDATE llx_holiday_users SET fk_type = 1 WHERE fk_type IS NULL; UPDATE llx_holiday_logs SET fk_type = 1 WHERE fk_type IS NULL; - +UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_VAT_SOLD_ACCOUNT')__ WHERE __DECRYPT('name')__ = 'ACCOUNTING_VAT_ACCOUNT'; diff --git a/htdocs/install/mysql/tables/llx_expensereport.sql b/htdocs/install/mysql/tables/llx_expensereport.sql index 879623b6b7e..2e7e3911f99 100755 --- a/htdocs/install/mysql/tables/llx_expensereport.sql +++ b/htdocs/install/mysql/tables/llx_expensereport.sql @@ -34,7 +34,6 @@ CREATE TABLE llx_expensereport ( date_approve datetime, date_refuse datetime, date_cancel datetime, - date_paiement datetime, tms timestamp, fk_user_author integer NOT NULL, fk_user_modif integer DEFAULT NULL, @@ -43,7 +42,6 @@ CREATE TABLE llx_expensereport ( fk_user_approve integer DEFAULT NULL, fk_user_refuse integer DEFAULT NULL, fk_user_cancel integer DEFAULT NULL, - fk_user_paid integer DEFAULT NULL, fk_statut integer NOT NULL, -- 1=brouillon, 2=validé (attente approb), 4=annulé, 5=approuvé, 6=payed, 99=refusé fk_c_paiement integer DEFAULT NULL, paid smallint default 0 NOT NULL, diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 0a1f7af31a0..caf52b28eea 100755 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -492,7 +492,7 @@ Module400Desc=Management of projects, opportunities or leads. You can then assig Module410Name=Webcalendar Module410Desc=Webcalendar integration Module500Name=Special expenses -Module500Desc=Management of special expenses (taxes, social contribution, dividends) +Module500Desc=Management of special expenses (taxes, social or fiscal taxes, dividends) Module510Name=Salaries Module510Desc=Management of employees salaries and payments Module520Name=Loan @@ -501,7 +501,7 @@ Module600Name=Notifications Module600Desc=Send EMail notifications on some Dolibarr business events to third-party contacts (setup defined on each thirdparty) Module700Name=Donations Module700Desc=Donation management -Module770Name=Expense Report +Module770Name=Expense reports Module770Desc=Management and claim expense reports (transportation, meal, ...) Module1120Name=Supplier commercial proposal Module1120Desc=Request supplier commercial proposal and prices @@ -600,10 +600,10 @@ Permission86=Send customers orders Permission87=Close customers orders Permission88=Cancel customers orders Permission89=Delete customers orders -Permission91=Read social contributions and vat -Permission92=Create/modify social contributions and vat -Permission93=Delete social contributions and vat -Permission94=Export social contributions +Permission91=Read social or fiscal taxes and vat +Permission92=Create/modify social or fiscal taxes and vat +Permission93=Delete social or fiscal taxes and vat +Permission94=Export social or fiscal taxes Permission95=Read reports Permission101=Read sendings Permission102=Create/modify sendings @@ -801,7 +801,7 @@ DictionaryCountry=Countries DictionaryCurrency=Currencies DictionaryCivility=Civility title DictionaryActions=Type of agenda events -DictionarySocialContributions=Social contributions types +DictionarySocialContributions=Social or fiscal taxes types DictionaryVAT=VAT Rates or Sales Tax Rates DictionaryRevenueStamp=Amount of revenue stamps DictionaryPaymentConditions=Payment terms @@ -1511,7 +1511,7 @@ ConfirmDeleteMenu=Are you sure you want to delete menu entry %s ? DeleteLine=Delete line ConfirmDeleteLine=Are you sure you want to delete this line ? ##### Tax ##### -TaxSetup=Taxes, social contributions and dividends module setup +TaxSetup=Taxes, social or fiscal taxes and dividends module setup OptionVatMode=VAT due OptionVATDefault=Cash basis OptionVATDebitOption=Accrual basis diff --git a/htdocs/langs/en_US/banks.lang b/htdocs/langs/en_US/banks.lang index f363ffa56c6..d12f45387d6 100644 --- a/htdocs/langs/en_US/banks.lang +++ b/htdocs/langs/en_US/banks.lang @@ -113,7 +113,7 @@ CustomerInvoicePayment=Customer payment CustomerInvoicePaymentBack=Customer payment back SupplierInvoicePayment=Supplier payment WithdrawalPayment=Withdrawal payment -SocialContributionPayment=Social contribution payment +SocialContributionPayment=Social/fiscal tax payment FinancialAccountJournal=Financial account journal BankTransfer=Bank transfer BankTransfers=Bank transfers diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 3e645e84834..4f1512a431d 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -178,7 +178,7 @@ NumberOfBills=Nb of invoices NumberOfBillsByMonth=Nb of invoices by month AmountOfBills=Amount of invoices AmountOfBillsByMonthHT=Amount of invoices by month (net of tax) -ShowSocialContribution=Show social contribution +ShowSocialContribution=Show social/fiscal tax ShowBill=Show invoice ShowInvoice=Show invoice ShowInvoiceReplace=Show replacing invoice @@ -270,7 +270,7 @@ BillAddress=Bill address HelpEscompte=This discount is a discount granted to customer because its payment was made before term. HelpAbandonBadCustomer=This amount has been abandoned (customer said to be a bad customer) and is considered as an exceptional loose. HelpAbandonOther=This amount has been abandoned since it was an error (wrong customer or invoice replaced by an other for example) -IdSocialContribution=Social contribution id +IdSocialContribution=Social/fiscal tax payment id PaymentId=Payment id InvoiceId=Invoice id InvoiceRef=Invoice ref. diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang index 116b2c52fa8..09858bc092f 100644 --- a/htdocs/langs/en_US/compta.lang +++ b/htdocs/langs/en_US/compta.lang @@ -56,23 +56,23 @@ VATCollected=VAT collected ToPay=To pay ToGet=To get back SpecialExpensesArea=Area for all special payments -TaxAndDividendsArea=Tax, social contributions and dividends area -SocialContribution=Social contribution -SocialContributions=Social contributions +TaxAndDividendsArea=Sale taxes, social/fiscal taxes contributions and dividends area +SocialContribution=Social or fiscal tax +SocialContributions=Social or fiscal taxes MenuSpecialExpenses=Special expenses MenuTaxAndDividends=Taxes and dividends MenuSalaries=Salaries -MenuSocialContributions=Social contributions -MenuNewSocialContribution=New contribution -NewSocialContribution=New social contribution -ContributionsToPay=Contributions to pay +MenuSocialContributions=Social/fiscal taxes +MenuNewSocialContribution=New tax payment +NewSocialContribution=New social/fiscal tax +ContributionsToPay=Social/fiscal taxes to pay AccountancyTreasuryArea=Accountancy/Treasury area AccountancySetup=Accountancy setup NewPayment=New payment Payments=Payments PaymentCustomerInvoice=Customer invoice payment PaymentSupplierInvoice=Supplier invoice payment -PaymentSocialContribution=Social contribution payment +PaymentSocialContribution=Social/fiscal tax payment PaymentVat=VAT payment PaymentSalary=Salary payment ListPayment=List of payments @@ -91,7 +91,7 @@ LT1PaymentES=RE Payment LT1PaymentsES=RE Payments VATPayment=VAT Payment VATPayments=VAT Payments -SocialContributionsPayments=Social contributions payments +SocialContributionsPayments=Social/fiscal taxes payments ShowVatPayment=Show VAT payment TotalToPay=Total to pay TotalVATReceived=Total VAT received @@ -116,11 +116,11 @@ NewCheckDepositOn=Create receipt for deposit on account: %s NoWaitingChecks=No checks waiting for deposit. DateChequeReceived=Check reception date NbOfCheques=Nb of checks -PaySocialContribution=Pay a social contribution -ConfirmPaySocialContribution=Are you sure you want to classify this social contribution as paid? -DeleteSocialContribution=Delete a social contribution -ConfirmDeleteSocialContribution=Are you sure you want to delete this social contribution? -ExportDataset_tax_1=Social contributions and payments +PaySocialContribution=Pay a social/fiscal tax +ConfirmPaySocialContribution=Are you sure you want to classify this social or fiscal tax as paid? +DeleteSocialContribution=Delete a social or fiscal tax payment +ConfirmDeleteSocialContribution=Are you sure you want to delete this social/fiscal tax payment? +ExportDataset_tax_1=Social and fiscal taxes and payments CalcModeVATDebt=Mode %sVAT on commitment accounting%s. CalcModeVATEngagement=Mode %sVAT on incomes-expenses%s. CalcModeDebt=Mode %sClaims-Debts%s said Commitment accounting. @@ -198,10 +198,10 @@ CalculationRuleDescSupplier=according to supplier, choose appropriate method to TurnoverPerProductInCommitmentAccountingNotRelevant=Turnover report per product, when using a cash accountancy mode is not relevant. This report is only available when using engagement accountancy mode (see setup of accountancy module). CalculationMode=Calculation mode AccountancyJournal=Accountancy code journal -ACCOUNTING_VAT_ACCOUNT=Default accountancy code for collecting VAT +ACCOUNTING_VAT_SOLD_ACCOUNT=Default accountancy code for collecting VAT ACCOUNTING_VAT_BUY_ACCOUNT=Default accountancy code for paying VAT ACCOUNTING_ACCOUNT_CUSTOMER=Accountancy code by default for customer thirdparties ACCOUNTING_ACCOUNT_SUPPLIER=Accountancy code by default for supplier thirdparties -CloneTax=Clone a social contribution -ConfirmCloneTax=Confirm the clone of a social contribution +CloneTax=Clone a social/fiscal tax +ConfirmCloneTax=Confirm the clone of a social/fiscal tax payment CloneTaxForNextMonth=Clone it for next month diff --git a/htdocs/langs/en_US/ecm.lang b/htdocs/langs/en_US/ecm.lang index bbbf2d3a046..96995adc8ac 100644 --- a/htdocs/langs/en_US/ecm.lang +++ b/htdocs/langs/en_US/ecm.lang @@ -35,7 +35,7 @@ ECMSearchByEntity=Search by object ECMSectionOfDocuments=Directories of documents ECMTypeManual=Manual ECMTypeAuto=Automatic -ECMDocsBySocialContributions=Documents linked to social contributions +ECMDocsBySocialContributions=Documents linked to social or fiscal taxes ECMDocsByThirdParties=Documents linked to third parties ECMDocsByProposals=Documents linked to proposals ECMDocsByOrders=Documents linked to customers orders diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 9a878366bc7..8b935e8cc18 100755 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -191,3 +191,4 @@ WarningNotRelevant=Irrelevant operation for this dataset WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs=Feature disabled when display setup is optimized for blind person or text browsers. WarningPaymentDateLowerThanInvoiceDate=Payment date (%s) is earlier than invoice date (%s) for invoice %s. WarningTooManyDataPleaseUseMoreFilters=Too many data. Please use more filters +WarningSomeLinesWithNullHourlyRate=Some times were recorded by users when their hourly rate was not defined. A value of 0 was used but this may result in wrong valuation of time spent. diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index ae766c7a147..66de0fe3eee 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -57,7 +57,7 @@ ErrorSomeErrorWereFoundRollbackIsDone=Some errors were found. We rollback change ErrorConfigParameterNotDefined=Parameter %s is not defined inside Dolibarr config file conf.php. ErrorCantLoadUserFromDolibarrDatabase=Failed to find user %s in Dolibarr database. ErrorNoVATRateDefinedForSellerCountry=Error, no vat rates defined for country '%s'. -ErrorNoSocialContributionForSellerCountry=Error, no social contribution type defined for country '%s'. +ErrorNoSocialContributionForSellerCountry=Error, no social/fiscal taxes type defined for country '%s'. ErrorFailedToSaveFile=Error, failed to save file. SetDate=Set date SelectDate=Select a date @@ -302,7 +302,7 @@ UnitPriceTTC=Unit price PriceU=U.P. PriceUHT=U.P. (net) AskPriceSupplierUHT=U.P. net Requested -PriceUTTC=U.P. +PriceUTTC=U.P. (inc. tax) Amount=Amount AmountInvoice=Invoice amount AmountPayment=Payment amount @@ -339,6 +339,7 @@ IncludedVAT=Included tax HT=Net of tax TTC=Inc. tax VAT=Sales tax +VATs=Sales taxes LT1ES=RE LT2ES=IRPF VATRate=Tax Rate diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index 52e1b942a6c..1ea6ffb5e9d 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -77,6 +77,7 @@ ListExpenseReportsAssociatedProject=List of expense reports associated with the ListDonationsAssociatedProject=List of donations associated with the project ListActionsAssociatedProject=List of events associated with the project ListTaskTimeUserProject=List of time consumed on tasks of project +TaskTimeUserProject=Time consumed on tasks of project ActivityOnProjectThisWeek=Activity on project this week ActivityOnProjectThisMonth=Activity on project this month ActivityOnProjectThisYear=Activity on project this year @@ -152,4 +153,4 @@ ResourceNotAssignedToProject=Not assigned to project ResourceNotAssignedToTask=Not assigned to task AssignTaskToMe=Assign task to me AssignTask=Assign -ProjectOverview=Overview \ No newline at end of file +ProjectOverview=Overview diff --git a/htdocs/langs/en_US/trips.lang b/htdocs/langs/en_US/trips.lang index d4e4e8c4359..969ceaa01d6 100644 --- a/htdocs/langs/en_US/trips.lang +++ b/htdocs/langs/en_US/trips.lang @@ -76,6 +76,7 @@ BROUILLONNER=Reopen SendToValid=Sent on approval ModifyInfoGen=Edit ValidateAndSubmit=Validate and submit for approval +ValidatedWaitingApproval=Validated (waiting for approval) NOT_VALIDATOR=You are not allowed to approve this expense report NOT_AUTHOR=You are not the author of this expense report. Operation cancelled. diff --git a/htdocs/margin/admin/margin.php b/htdocs/margin/admin/margin.php index 715bfe7b35b..9a0f55010ab 100644 --- a/htdocs/margin/admin/margin.php +++ b/htdocs/margin/admin/margin.php @@ -141,16 +141,28 @@ print ''.$langs->trans('MargeBrute'); print ' global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE == '1') print 'checked '; -print '/>
'.$langs->trans('MargeNette'); +print '/>
'; +/*print $langs->trans('MargeNette'); print ' global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE == '2') print 'checked '; -print '/>'; +print '/>';*/ +// TODO Check that PMP is available when stock module is not enabled. If not, make this choice greyed when stock module disabled. +//if (! empty($conf->stock->enabled)) +//{ + print $langs->trans('MargeNette'); + print ' global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE == 'pmp') + print 'checked '; + print '/>'; +//} print ''; print ''; print ''; print ''; -print ''.$langs->trans('MARGIN_TYPE_DETAILS').''; +print ''.$langs->trans('MARGIN_TYPE_DETAILS'); +print ' ('.$langs->trans("PMP").')'; +print ''; print ''; print ''; diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 3b2caf30ad7..bd20a930aa4 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -930,7 +930,7 @@ class Task extends CommonObject $result=array(); $sql = "SELECT"; - $sql.= " SUM(t.task_duration / 3600 * thm) as amount"; + $sql.= " SUM(t.task_duration / 3600 * ".$this->db->ifsql("t.thm IS NULL", 0, "t.thm").") as amount, SUM(".$this->db->ifsql("t.thm IS NULL", 1, 0).") as nblinesnull"; $sql.= " FROM ".MAIN_DB_PREFIX."projet_task_time as t"; $sql.= " WHERE t.fk_task = ".$id; if (is_object($fuser) && $fuser->id > 0) @@ -947,7 +947,8 @@ class Task extends CommonObject $datefieldname="task_datehour"; $sql.=" AND (".$datefieldname." <= '".$this->db->idate($datee)."' OR ".$datefieldname." IS NULL)"; } - + //print $sql; + dol_syslog(get_class($this)."::getSumOfAmount", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) @@ -955,7 +956,8 @@ class Task extends CommonObject $obj = $this->db->fetch_object($resql); $result['amount'] = $obj->amount; - + $result['nblinesnull'] = $obj->nblinesnull; + $this->db->free($resql); return $result; } diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 8bb7c9f75ce..8ade207155e 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -357,7 +357,6 @@ foreach ($listofreferent as $key => $value) $elementarray = $object->get_element_list($key, $tablename, $datefieldname, $dates, $datee); if (count($elementarray)>0 && is_array($elementarray)) { - $var=true; $total_ht = 0; $total_ttc = 0; @@ -622,7 +621,11 @@ foreach ($listofreferent as $key => $value) } else { - if ($element instanceof Task) print $element->getNomUrl(1,'withproject','time'); + if ($element instanceof Task) + { + print $element->getNomUrl(1,'withproject','time'); + print ' - '.dol_trunc($element->label, 48); + } else print $element->getNomUrl(1); $element_doc = $element->element; @@ -681,13 +684,19 @@ foreach ($listofreferent as $key => $value) print ''; // Amount without tax + $warning=''; if (empty($value['disableamount'])) { if ($tablename == 'don') $total_ht_by_line=$element->amount; elseif ($tablename == 'projet_task') { - $tmp = $element->getSumOfAmount($elementuser, $dates, $datee); + $tmp = $element->getSumOfAmount($elementuser, $dates, $datee); // $element is a task. $elementuser may be empty $total_ht_by_line = price2num($tmp['amount'],'MT'); + if ($tmp['nblinesnull'] > 0) + { + $langs->load("errors"); + $warning=$langs->trans("WarningSomeLinesWithNullHourlyRate"); + } } else { @@ -697,6 +706,7 @@ foreach ($listofreferent as $key => $value) if (! $qualifiedfortotal) print ''; print (isset($total_ht_by_line)?price($total_ht_by_line):' '); if (! $qualifiedfortotal) print ''; + if ($warning) print ' '.img_warning($warning); print ''; } else print ''; @@ -718,13 +728,18 @@ foreach ($listofreferent as $key => $value) if (! $qualifiedfortotal) print ''; print (isset($total_ttc_by_line)?price($total_ttc_by_line):' '); if (! $qualifiedfortotal) print ''; + if ($warning) print ' '.img_warning($warning); print ''; } else print ''; // Status print ''; - if ($element instanceof CommonInvoice) + if ($tablename == 'expensereport_det') + { + print $expensereport->getLibStatut(5); + } + else if ($element instanceof CommonInvoice) { //This applies for Facture and FactureFournisseur print $element->getLibStatut(5, $element->getSommePaiement()); @@ -792,48 +807,11 @@ foreach ($listofreferent as $key => $value) print $elementarray; } print ""; - - - /* - * Barre d'action - */ - print '
'; - - if ($object->statut > 0) - { - if ($object->thirdparty->prospect || $object->thirdparty->client) - { - if ($key == 'propal' && ! empty($conf->propal->enabled) && $user->rights->propale->creer) - { - print ''.$langs->trans("AddProp").''; - } - if ($key == 'order' && ! empty($conf->commande->enabled) && $user->rights->commande->creer) - { - print ''.$langs->trans("AddCustomerOrder").''; - } - if ($key == 'invoice' && ! empty($conf->facture->enabled) && $user->rights->facture->creer) - { - print ''.$langs->trans("AddCustomerInvoice").''; - } - } - if ($object->thirdparty->fournisseur) - { - if ($key == 'order_supplier' && ! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande->creer) - { - print ''.$langs->trans("AddSupplierOrder").''; - } - if ($key == 'invoice_supplier' && ! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->creer) - { - print ''.$langs->trans("AddSupplierInvoice").''; - } - } - } - - print '
'; } } + llxFooter(); $db->close(); diff --git a/htdocs/support/index.php b/htdocs/support/index.php index dbde74ed857..afd7a4f6338 100644 --- a/htdocs/support/index.php +++ b/htdocs/support/index.php @@ -194,7 +194,7 @@ print ''; print ''; print ''; -#$urlwiki='http://wiki.dolibarr.org/index.php/List of Dolibarr partners and providers'; +//$urlwiki='http://wiki.dolibarr.org/index.php/List of Dolibarr partners and providers'; $urlwiki='http://partners.dolibarr.org'; print ''; print ''; @@ -229,7 +229,7 @@ print '
'; print ''; print ''; -#$urlwiki='http://wiki.dolibarr.org/index.php/List of Dolibarr partners and providers'; +//$urlwiki='http://wiki.dolibarr.org/index.php/List of Dolibarr partners and providers'; $urlwiki='http://partners.dolibarr.org'; print ''; print ''; diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 0e59d540573..730f2d76f18 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -2570,6 +2570,7 @@ div.dolgraph div.legend table tbody tr { height: auto; } .logo_setup { content:url(); + display: inline-block; } div.titre {