From 93b1b4c66e5e2cd25f1a6fe29fd8889252902286 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 21 Feb 2016 21:02:25 +0100 Subject: [PATCH 01/41] FIX #4580 --- htdocs/comm/prospect/list.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/prospect/list.php b/htdocs/comm/prospect/list.php index 7259cff218e..e58694fa0f8 100644 --- a/htdocs/comm/prospect/list.php +++ b/htdocs/comm/prospect/list.php @@ -438,10 +438,10 @@ if ($resql) // Prospect status print ''; $arraystcomm=array(); - foreach($prospectstatic->cacheprospectstatus as $key => $val) - { - $arraystcomm[$val['id']]=$val['label']; - } + foreach($prospectstatic->cacheprospectstatus as $key => $val) + { + $arraystcomm[$val['id']]=($langs->trans("StatusProspect".$val['id']) != "StatusProspect".$val['id'] ? $langs->trans("StatusProspect".$val['id']) : $val['label']); + } print $form->selectarray('search_stcomm', $arraystcomm, $search_stcomm, -2); print ''; From ac6001cec89ae7857be0426accc9a2cda17ff039 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 22 Feb 2016 09:27:18 +0100 Subject: [PATCH 02/41] Fix do not show warning if account defined --- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index a02ad089c5b..9716b6bd968 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -881,8 +881,8 @@ class pdf_crabe extends ModelePDFFactures $this->error = $outputlangs->transnoentities("ErrorNoPaiementModeConfigured"); } // Avoid having any valid PDF with setup that is not complete - elseif (($object->mode_reglement_code == 'CHQ' && empty($conf->global->FACTURE_CHQ_NUMBER)) - || ($object->mode_reglement_code == 'VIR' && empty($conf->global->FACTURE_RIB_NUMBER))) + elseif (($object->mode_reglement_code == 'CHQ' && empty($conf->global->FACTURE_CHQ_NUMBER) && empty($object->fk_account) && empty($object->fk_bank)) + || ($object->mode_reglement_code == 'VIR' && empty($conf->global->FACTURE_RIB_NUMBER) && empty($object->fk_account) && empty($object->fk_bank))) { $outputlangs->load("errors"); From 30d6aa0b96231c855692957a63745305a9aca153 Mon Sep 17 00:00:00 2001 From: fmarcet Date: Fri, 26 Feb 2016 13:14:23 +0100 Subject: [PATCH 03/41] FIX: Some filters are lost when paging --- htdocs/commande/list.php | 21 ++++++++++++++------- htdocs/compta/facture/list.php | 11 +++++++++-- htdocs/fourn/facture/list.php | 10 +++++++++- 3 files changed, 32 insertions(+), 10 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 517cd95e536..237cd9c0c29 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -9,6 +9,7 @@ * Copyright (C) 2015 Frederic France * Copyright (C) 2015 Marcos García * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2016 Ferran Marcet * * 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 @@ -44,8 +45,10 @@ $langs->load('companies'); $orderyear=GETPOST("orderyear","int"); $ordermonth=GETPOST("ordermonth","int"); +$orderday=GETPOST("orderday","int"); $deliveryyear=GETPOST("deliveryyear","int"); $deliverymonth=GETPOST("deliverymonth","int"); +$deliveryday=GETPOST("deliveryday","int"); $search_product_category=GETPOST('search_product_category','int'); $search_ref=GETPOST('search_ref','alpha')!=''?GETPOST('search_ref','alpha'):GETPOST('sref','alpha'); $search_ref_customer=GETPOST('search_ref_customer','alpha'); @@ -87,7 +90,9 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both $search_total_ht=''; $orderyear=''; $ordermonth=''; - $deliverymonth=''; + $orderday=''; + $deliveryday=''; + $deliverymonth=''; $deliveryyear=''; } @@ -168,10 +173,10 @@ if ($viewstatut <> '') } if ($ordermonth > 0) { - if ($orderyear > 0 && empty($day)) + if ($orderyear > 0 && empty($orderday)) $sql.= " AND c.date_commande BETWEEN '".$db->idate(dol_get_first_day($orderyear,$ordermonth,false))."' AND '".$db->idate(dol_get_last_day($orderyear,$ordermonth,false))."'"; - else if ($orderyear > 0 && ! empty($day)) - $sql.= " AND c.date_commande BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $ordermonth, $day, $orderyear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $ordermonth, $day, $orderyear))."'"; + else if ($orderyear > 0 && ! empty($orderday)) + $sql.= " AND c.date_commande BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $ordermonth, $orderday, $orderyear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $ordermonth, $orderday, $orderyear))."'"; else $sql.= " AND date_format(c.date_commande, '%m') = '".$ordermonth."'"; } @@ -181,10 +186,10 @@ else if ($orderyear > 0) } if ($deliverymonth > 0) { - if ($deliveryyear > 0 && empty($day)) + if ($deliveryyear > 0 && empty($deliveryday)) $sql.= " AND c.date_livraison BETWEEN '".$db->idate(dol_get_first_day($deliveryyear,$deliverymonth,false))."' AND '".$db->idate(dol_get_last_day($deliveryyear,$deliverymonth,false))."'"; - else if ($deliveryyear > 0 && ! empty($day)) - $sql.= " AND c.date_livraison BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $deliverymonth, $day, $deliveryyear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $deliverymonth, $day, $deliveryyear))."'"; + else if ($deliveryyear > 0 && ! empty($deliveryday)) + $sql.= " AND c.date_livraison BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $deliverymonth, $deliveryday, $deliveryyear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $deliverymonth, $deliveryday, $deliveryyear))."'"; else $sql.= " AND date_format(c.date_livraison, '%m') = '".$deliverymonth."'"; } @@ -240,8 +245,10 @@ if ($resql) $title.=' - '.$langs->trans('StatusOrderValidated').', '.(empty($conf->expedition->enabled)?'':$langs->trans("StatusOrderSent").', ').$langs->trans('StatusOrderToBill'); $param='&socid='.$socid.'&viewstatut='.$viewstatut; + if ($orderday) $param.='&orderday='.$orderday; if ($ordermonth) $param.='&ordermonth='.$ordermonth; if ($orderyear) $param.='&orderyear='.$orderyear; + if ($deliveryday) $param.='&deliveryday='.$deliveryday; if ($deliverymonth) $param.='&deliverymonth='.$deliverymonth; if ($deliveryyear) $param.='&deliveryyear='.$deliveryyear; if ($search_ref) $param.='&search_ref='.$search_ref; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 2581bb382ca..772abae8362 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -10,7 +10,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2015 Ferran Marcet + * Copyright (C) 2015-2016 Ferran Marcet * * 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 @@ -119,7 +119,6 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e // Do we click on purge search criteria ? if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { - $search_categ=''; $search_user=''; $search_sale=''; $search_product_category=''; @@ -132,6 +131,9 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both $day=''; $year=''; $month=''; + $day_lim=''; + $year_lim=''; + $month_lim=''; } @@ -261,13 +263,18 @@ if ($resql) } $param='&socid='.$socid; + if ($day) $param.='&day='.$day; if ($month) $param.='&month='.$month; if ($year) $param.='&year=' .$year; + if ($day_lim) $param.='&day_lim='.$day_lim; + if ($month_lim) $param.='&month_lim='.$month_lim; + if ($year_lim) $param.='&year_lim=' .$year_lim; if ($search_ref) $param.='&search_ref=' .$search_ref; if ($search_refcustomer) $param.='&search_refcustomer=' .$search_refcustomer; if ($search_societe) $param.='&search_societe=' .$search_societe; if ($search_sale > 0) $param.='&search_sale=' .$search_sale; if ($search_user > 0) $param.='&search_user=' .$search_user; + if ($search_product_category > 0) $param.='$search_product_category=' .$search_product_category; if ($search_montant_ht != '') $param.='&search_montant_ht='.$search_montant_ht; if ($search_montant_ttc != '') $param.='&search_montant_ttc='.$search_montant_ttc; if ($search_status != '') $param.='&search_status='.$search_status; diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index a2b48c253df..a02f2f78440 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -8,7 +8,7 @@ * Copyright (C) 2015 Marcos García * Copyright (C) 2015 juanjo Menent * Copyright (C) 2015 Abbes Bahfir - * Copyright (C) 2015 Ferran Marcet + * Copyright (C) 2015-2016 Ferran Marcet * * 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 @@ -93,6 +93,10 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both $search_status=""; $year=""; $month=""; + $day=""; + $year_lim=""; + $month_lim=""; + $day_lim=""; } /* @@ -230,8 +234,12 @@ if ($resql) } $param='&socid='.$socid; + if ($day) $param.='&day='.urlencode($day); if ($month) $param.='&month='.urlencode($month); if ($year) $param.='&year=' .urlencode($year); + if ($day_lim) $param.='&day_lim='.urlencode($day_lim); + if ($month_lim) $param.='&month_lim='.urlencode($month_lim); + if ($year_lim) $param.='&year_lim=' .urlencode($year_lim); if ($search_ref) $param.='&search_ref='.urlencode($search_ref); if ($search_ref_supplier) $param.='&search_ref_supplier'.urlencode($search_ref_supplier); if ($search_label) $param.='&search_label='.urlencode($search_label); From 9a0af064bf6533e9c476a606624c365cc85b32e1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 26 Feb 2016 19:05:02 +0100 Subject: [PATCH 04/41] Prepare rc2 --- build/makepack-dolibarr.pl | 14 +++++++------- htdocs/filefunc.inc.php | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index c8b3c7664e2..0983ec5d0ef 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -148,9 +148,9 @@ $FILENAMEEXEDOLIWAMP = "DoliWamp-$MAJOR.$MINOR.$BUILD"; $ARCH='noarch'; $newbuild = $BUILD; $newbuild =~ s/(dev|alpha)/0.1.a/gi; # dev (fedora) -$newbuild =~ s/beta/0.2.beta1/gi; # beta (fedora) -$newbuild =~ s/rc./0.3.rc1/gi; # rc (fedora) -if ($newbuild !~ /-/) { $newbuild.='-0.3'; } # finale (fedora) +$newbuild =~ s/beta(.?)/0.2.beta/gi; # beta (fedora) (we want beta1, beta2, betax to be same package name) +$newbuild =~ s/rc(.?)/0.3.rc/gi; # rc (fedora) (we want rc1, rc2, rcx to be same package name) +if ($newbuild !~ /-/) { $newbuild.='-0.4'; } # finale (fedora) #$newbuild =~ s/(dev|alpha)/0/gi; # dev #$newbuild =~ s/beta/1/gi; # beta #$newbuild =~ s/rc./2/gi; # rc @@ -162,10 +162,10 @@ $FILENAMERPM=$FILENAMETGZ2."-".$RPMSUBVERSION.".".$ARCH.".rpm"; # For Deb $newbuild = $BUILD; $newbuild =~ s/(dev|alpha)/1/gi; # dev -$newbuild =~ s/beta/2/gi; # beta -$newbuild =~ s/rc./3/gi; # rc -if ($newbuild !~ /-/) { $newbuild.='-3'; } # finale is same than rc. -# now newbuild is 0-1 or 0-3 for example. Note that for native package (see debian/source/format), we should not use a dash part but to get a better version management +$newbuild =~ s/beta(.?)/2/gi; # beta (we want beta1, beta2, betax to be same package name) +$newbuild =~ s/rc(.?)/3/gi; # rc (we want rc1, rc2, rcx to be same package name) +if ($newbuild !~ /-/) { $newbuild.='-4'; } # finale is same than rc. +# now newbuild is 0-1 or 0-4 for example. Note that for native package (see debian/source/format), we should not use a dash part but to get a better version management $build = $newbuild; $build =~ s/-.*$//g; # now build is 0 for example diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 84cb17669da..498572fffe1 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -31,7 +31,7 @@ */ if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr'); -if (! defined('DOL_VERSION')) define('DOL_VERSION','3.9.0-rc'); +if (! defined('DOL_VERSION')) define('DOL_VERSION','3.9.0-rc2'); if (! defined('EURO')) define('EURO',chr(128)); From 4cf59d3f9b66ca03076fce06936e49285bf07ff2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 26 Feb 2016 19:13:25 +0100 Subject: [PATCH 05/41] Fix if option WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER is on, we must not show unpaid orders. --- htdocs/compta/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 70e2564829e..c39b585d7b1 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -628,7 +628,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) /* * Customers orders to be billed */ -if (! empty($conf->facture->enabled) && ! empty($conf->commande->enabled) && $user->rights->commande->lire) +if (! empty($conf->facture->enabled) && ! empty($conf->commande->enabled) && $user->rights->commande->lire && empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) { $commandestatic=new Commande($db); $langs->load("orders"); From 7691e8c01891396f4419c5af1dc3cb4e75eeb61b Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 26 Feb 2016 22:17:22 +0100 Subject: [PATCH 06/41] FIX : Improve and add missing translations As is not the branch develop, instead of transifex, we use GIT --- htdocs/langs/en_US/projects.lang | 1 + htdocs/langs/es_ES/boxes.lang | 6 +++--- htdocs/langs/es_ES/companies.lang | 4 ++-- htdocs/langs/es_ES/projects.lang | 1 + htdocs/langs/fr_FR/projects.lang | 1 + 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index 6fa62f96905..979fd4670bb 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -192,3 +192,4 @@ OppStatusNEGO=Negociation OppStatusPENDING=Pending OppStatusWIN=Won OppStatusLOST=Lost +Budget=Budget \ No newline at end of file diff --git a/htdocs/langs/es_ES/boxes.lang b/htdocs/langs/es_ES/boxes.lang index bedacd37bb5..28241fdb79a 100644 --- a/htdocs/langs/es_ES/boxes.lang +++ b/htdocs/langs/es_ES/boxes.lang @@ -45,13 +45,13 @@ BoxTitleLastModifiedProspects=Los %s últimos clientes potenciales modificados BoxTitleLastProductsInContract=Los %s últimos productos/servicios contratados BoxTitleLastModifiedMembers=Últimos %s miembros BoxTitleLastFicheInter=Las %s últimas intervenciones modificadas -BoxTitleOldestUnpaidCustomerBills=%s facturas a clientes más antiguras pendientes de cobro -BoxTitleOldestUnpaidSupplierBills=%s facturas de proveedores más antiguas pendientes de pago +BoxTitleOldestUnpaidCustomerBills=Las %s facturas a clientes más antiguras pendientes de cobro +BoxTitleOldestUnpaidSupplierBills=Las %s facturas de proveedores más antiguas pendientes de pago BoxTitleCurrentAccounts=Balance de cuentas abiertas BoxTitleSalesTurnover=Volumen de ventas realizado BoxTitleTotalUnpaidCustomerBills=Facturas a clientes pendientes de cobro BoxTitleTotalUnpaidSuppliersBills=Facturas de proveedores pendientes de pago -BoxTitleLastModifiedContacts=Los %s últimos contactos/direcciones modificadas +BoxTitleLastModifiedContacts=Los %s últimos contactos/direcciones modificados BoxMyLastBookmarks=Mis %s últimos marcadores BoxOldestExpiredServices=Servicios antiguos expirados BoxLastExpiredServices=Los %s contratos más antiguos con servicios activos expirados diff --git a/htdocs/langs/es_ES/companies.lang b/htdocs/langs/es_ES/companies.lang index 22f46c2c4dc..7e2fea3d2af 100644 --- a/htdocs/langs/es_ES/companies.lang +++ b/htdocs/langs/es_ES/companies.lang @@ -266,8 +266,8 @@ CustomerRelativeDiscountShort=Descuento relativo CustomerAbsoluteDiscountShort=Descuento fijo CompanyHasRelativeDiscount=Este cliente tiene un descuento por defecto de %s%% CompanyHasNoRelativeDiscount=Este cliente no tiene descuentos relativos por defecto -CompanyHasAbsoluteDiscount=Este cliente tiene %s %s descuentos disponibles (descuentos, anticipos...) -CompanyHasCreditNote=Este cliente tiene %s %s anticipos disponibles +CompanyHasAbsoluteDiscount=Este cliente tiene %s %s en descuentos o anticipos disponibles +CompanyHasCreditNote=Este cliente tiene %s %s en anticipos disponibles CompanyHasNoAbsoluteDiscount=Este cliente no tiene más descuentos fijos disponibles CustomerAbsoluteDiscountAllUsers=Descuentos fijos en curso (acordado por todos los usuarios) CustomerAbsoluteDiscountMy=Descuentos fijos en curso (acordados personalmente) diff --git a/htdocs/langs/es_ES/projects.lang b/htdocs/langs/es_ES/projects.lang index c1fdad6cb99..0c68fbd1cf5 100644 --- a/htdocs/langs/es_ES/projects.lang +++ b/htdocs/langs/es_ES/projects.lang @@ -198,3 +198,4 @@ OppStatusNEGO=Negociación OppStatusPENDING=Pendiente OppStatusWIN=Ganado OppStatusLOST=Perdido +Budget=Presupuesto diff --git a/htdocs/langs/fr_FR/projects.lang b/htdocs/langs/fr_FR/projects.lang index d9e0c374dda..13bc1fc4765 100644 --- a/htdocs/langs/fr_FR/projects.lang +++ b/htdocs/langs/fr_FR/projects.lang @@ -198,3 +198,4 @@ OppStatusNEGO=Négociation OppStatusPENDING=En attente OppStatusWIN=Gagné OppStatusLOST=Perdu +Budget=Budget \ No newline at end of file From b34459c94947ee7ba85f313c9308db37dd152a76 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 26 Feb 2016 22:31:36 +0100 Subject: [PATCH 07/41] FIX : Improve and add missing translations As is not the branch develop, instead of transifex, we use GIT --- htdocs/langs/es_ES/admin.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/es_ES/admin.lang b/htdocs/langs/es_ES/admin.lang index 64a71bfaf52..3223320d657 100644 --- a/htdocs/langs/es_ES/admin.lang +++ b/htdocs/langs/es_ES/admin.lang @@ -1091,7 +1091,7 @@ SendmailOptionMayHurtBuggedMTA=La funcionalidad de enviar correo electrónico a TranslationSetup=Configuración traducción TranslationDesc=La elección del idioma mostrado en pantalla se modifica:
* A nivel global desde el menú Inicio - Configuración - Entorno
* De manera específica al usuario desde la pestaña Interfaz usuario de su ficha de usuario (hacer clic en su login en la parte superior izquierda de la pantalla). TranslationOverwriteDesc=También puede sobreescribir algún valor completando/editando la tabla siguiente. Debe utilizar "%s" para el código de idioma, "%s" para la clave que encuentra en el archivo langs/xx_XX/somefile.lang y "%s" para el nuevo valor que desea utilizar como nueva traducción. -TotalNumberOfActivatedModules=Total number of activated feature modules: %s / %s +TotalNumberOfActivatedModules=Número total de módulos activados: %s / %s YouMustEnableOneModule=Debe activar al menos un módulo. ClassNotFoundIntoPathWarning=No se ha encontrado la clase %s en su path PHP YesInSummer=Sí en verano From c2c6d77caa67c46b2144c04fec739c25eaedb7c8 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 26 Feb 2016 22:43:25 +0100 Subject: [PATCH 08/41] FIX : Improve and add missing translations As is not the branch develop, instead of transifex, we use GIT --- htdocs/langs/es_ES/cron.lang | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/es_ES/cron.lang b/htdocs/langs/es_ES/cron.lang index eef866fdbea..1997727d542 100644 --- a/htdocs/langs/es_ES/cron.lang +++ b/htdocs/langs/es_ES/cron.lang @@ -40,8 +40,8 @@ CronNone=Ninguna CronDtStart=No antes de CronDtEnd=No después de CronDtNextLaunch=Sig. ejec. -CronDtLastLaunch=Start date of last execution -CronDtLastResult=End date of last execution +CronDtLastLaunch=Fecha inicio última ejec. +CronDtLastResult=Fecha finalización última ejec. CronFrequency=Frecuencia CronClass=Clase CronMethod=Metodo From 41fb60e4a28f327994cfaba79003bdf0945511da Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sat, 27 Feb 2016 06:38:48 +0100 Subject: [PATCH 09/41] Fixed: comestic correction of company card --- htdocs/societe/commerciaux.php | 2 +- htdocs/societe/consumption.php | 2 +- htdocs/societe/document.php | 8 ++++---- htdocs/societe/note.php | 14 +++++++------- htdocs/societe/rib.php | 6 +++--- htdocs/societe/soc.php | 4 ++-- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/htdocs/societe/commerciaux.php b/htdocs/societe/commerciaux.php index b35e7096ef3..92ce3c614ce 100644 --- a/htdocs/societe/commerciaux.php +++ b/htdocs/societe/commerciaux.php @@ -126,7 +126,7 @@ if ($socid) print ''; print ''; - print 'global->SOCIETE_USEPREFIX)?' colspan="3"':'').'>'; + print 'global->SOCIETE_USEPREFIX)?' colspan="3"':'').'>'; print $object->code_client; if ($object->check_codeclient() <> 0) print ' '.$langs->trans("WrongCustomerCode"); print ''; diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index 0c5e6646889..b70f0e576d7 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -124,7 +124,7 @@ print '
'; print '
'.$langs->trans('CustomerCode').''.$langs->trans('CustomerCode').'
'; // Alias names (commercial, trademark or alias names) -print ''; +print ''; print ''; if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php index 2c951ed8670..d37310ab269 100644 --- a/htdocs/societe/document.php +++ b/htdocs/societe/document.php @@ -91,7 +91,7 @@ llxHeader('',$title,$help_url); if ($object->id) { /* - * Affichage onglets + * Show tabs */ if (! empty($conf->notification->enabled)) $langs->load("mails"); $head = societe_prepare_head($object); @@ -117,7 +117,7 @@ if ($object->id) print '
'.$object->name_alias.'
'; // Alias names (commercial, trademark or alias names) - print '"; @@ -145,10 +145,10 @@ if ($object->id) print ''; } - // Nbre fichiers + // Number of files print ''; - //Total taille + // Total size print ''; print '
'.$langs->trans('AliasNames').''; + print '
'.$langs->trans('AliasNames').''; print $object->name_alias; print "
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'
'; diff --git a/htdocs/societe/note.php b/htdocs/societe/note.php index ceb5fa6eac5..acd7f32d375 100644 --- a/htdocs/societe/note.php +++ b/htdocs/societe/note.php @@ -1,10 +1,10 @@ - * Copyright (C) 2004-2011 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2010 Juanjo Menent - * Copyright (C) 2013 Florian Henry - * Copyright (C) 2015 Marcos García +/* Copyright (C) 2001-2005 Rodolphe Quiedeville + * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2010 Juanjo Menent + * Copyright (C) 2013 Florian Henry + * Copyright (C) 2015 Marcos García * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -83,7 +83,7 @@ if ($id > 0) print ''; // Alias names (commercial, trademark or alias names) - print '"; diff --git a/htdocs/societe/rib.php b/htdocs/societe/rib.php index 1d0fccfe33d..c7f087daf72 100644 --- a/htdocs/societe/rib.php +++ b/htdocs/societe/rib.php @@ -247,7 +247,7 @@ if ($socid && $action != 'edit' && $action != "create") print '
'; print '
'.$langs->trans('AliasNames').''; + print '
'.$langs->trans('AliasNames').''; print $object->name_alias; print "
'; - print ''; + print ''; print ''; print ''; @@ -466,7 +466,7 @@ if ($socid && $action == 'edit' && $user->rights->societe->creer) print '
'; print '
'.$langs->trans("LabelRIB").'
'.$langs->trans("LabelRIB").''.$account->label.'
'.$langs->trans("BankName").'
'; - print ''; + print ''; print ''; print ''; @@ -600,7 +600,7 @@ if ($socid && $action == 'create' && $user->rights->societe->creer) print '
'; print '
'.$langs->trans("LabelRIB").'
'.$langs->trans("LabelRIB").'
'.$langs->trans("BankName").'
'; - print ''; + print ''; print ''; print ''; diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index ddc23769f46..df7bcd03278 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -1905,7 +1905,7 @@ else print '
'.$langs->trans("LabelRIB").'
'.$langs->trans("LabelRIB").'
'.$langs->trans("Bank").'
'; // Alias names (commercial, trademark or alias names) - print '"; @@ -2148,7 +2148,7 @@ else print '
'.$langs->trans('AliasNames').''; + print '
'.$langs->trans('AliasNames').''; print $object->name_alias; print "
'; // Legal - print ''; + print ''; // Capital print '\n"; @@ -352,24 +360,24 @@ if ($action == 'create') { print $formventilation->select_auxaccount($line->code_tiers, 'code_tiers', 1); print ''; print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; print ''; } else { - print ''; - print ''; + print ''; + print ''; print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; - print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; print ''; print ''; @@ -417,4 +425,4 @@ if ($action == 'create') { } llxFooter(); -$db->close(); \ No newline at end of file +$db->close(); diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index d6925ac1995..387df40122c 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -1,7 +1,7 @@ - * Copyright (C) 2013-2014 Florian Henry - * Copyright (C) 2013-2015 Alexandre Spangaro +/* Copyright (C) 2013-2016 Olivier Geffroy + * Copyright (C) 2013-2016 Florian Henry + * Copyright (C) 2013-2016 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 @@ -19,9 +19,9 @@ */ /** - * \file htdocs/accountancy/bookkeeping/list.php - * \ingroup Accounting Expert - * \brief List operation of book keeping + * \file htdocs/accountancy/bookkeeping/list.php + * \ingroup Advanced accountancy + * \brief List operation of book keeping */ require '../../main.inc.php'; @@ -260,8 +260,8 @@ if ($action == 'delbookkeeping') { $date = dol_print_date($line->doc_date, $conf->global->ACCOUNTING_EXPORT_DATE); print $date . $sep; print $line->doc_ref . $sep; - print length_accounta($line->numero_compte) . $sep; - print length_accountg($line->code_tiers) . $sep; + print length_accountg($line->numero_compte) . $sep; + print length_accounta($line->code_tiers) . $sep; print price($line->debit) . $sep; print price($line->credit) . $sep; @@ -277,7 +277,7 @@ if ($action == 'delbookkeeping') { $date = dol_print_date($line->doc_date, '%d/%m/%Y'); print $date . $sep; print $line->code_journal . $sep; - print length_accounta($line->numero_compte) . $sep; + print length_accountg($line->numero_compte) . $sep; print $line->piece_num . $sep; print $line->doc_ref . $sep; print price($line->debit) . $sep; @@ -289,6 +289,9 @@ if ($action == 'delbookkeeping') { } } +/* + * View + */ else { $title_page = $langs->trans("Bookkeeping") . ' ' . dol_print_date($search_date_start) . '-' . dol_print_date($search_date_end); @@ -352,8 +355,8 @@ else { print '
'; print '
' . "\n"; - print '
'; - print '' . $langs->trans("NewAccountingMvt") . ''; + print '
'; + print ''; // print '' . $langs->trans("Export") . ''; print '
'; @@ -396,12 +399,12 @@ else { print '
'; print ''; - print ''; + print ''; print ''; @@ -412,7 +415,7 @@ else { print $formventilation->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, ''); // print $langs->trans('To') . ' ' . $langs->trans('AccountAccounting') . ': '; print '
'; - print $langs->trans('To'); + print $langs->trans('to'); print $formventilation->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, ''); print ''; // print ''; @@ -422,7 +425,7 @@ else { print $formventilation->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1); // print $langs->trans('To') . ' ' . $langs->trans('ThirdPartyAccount') . ': '; print '
'; - print $langs->trans('To'); + print $langs->trans('to'); print $formventilation->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1); print ''; // print ''; @@ -468,7 +471,7 @@ else { // print ''; print ''; print ''; print "\n"; diff --git a/htdocs/accountancy/bookkeeping/listbyyear.php b/htdocs/accountancy/bookkeeping/listbyyear.php index 002d5670a0c..1989328b2ca 100644 --- a/htdocs/accountancy/bookkeeping/listbyyear.php +++ b/htdocs/accountancy/bookkeeping/listbyyear.php @@ -1,7 +1,7 @@ - * Copyright (C) 2013-2014 Alexandre Spangaro - * Copyright (C) 2013-2014 Florian Henry +/* Copyright (C) 2013-2016 Olivier Geffroy + * Copyright (C) 2013-2016 Alexandre Spangaro + * Copyright (C) 2013-2016 Florian Henry * * 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 @@ -19,9 +19,9 @@ */ /** - * \file htdocs/accountancy/bookkeeping/listbyyear.php - * \ingroup Accounting Expert - * \brief Book keeping by year + * \file htdocs/accountancy/bookkeeping/listbyyear.php + * \ingroup Advanced accountancy + * \brief Book keeping by year */ require '../../main.inc.php'; @@ -183,13 +183,13 @@ print ''; print '
'; print $langs->trans('From') . ' ' . $langs->trans('AccountAccounting') . ': '; print $formventilation->select_account($search_numero_compte_start, 'search_numero_compte_start', 1, array (), 1, 1, ''); -print $langs->trans('To') . ' ' . $langs->trans('AccountAccounting') . ': '; +print $langs->trans('to') . ' ' . $langs->trans('AccountAccounting') . ': '; print $formventilation->select_account($search_numero_compte_end, 'search_numero_compte_end', 1, array (), 1, 1, ''); print '
'; print '
'; print $langs->trans('From') . ' ' . $langs->trans('ThirdPartyAccount') . ': '; print $formventilation->select_auxaccount($search_code_tiers_start, 'search_code_tiers_start', 1); -print $langs->trans('To') . ' ' . $langs->trans('ThirdPartyAccount') . ': '; +print $langs->trans('to') . ' ' . $langs->trans('ThirdPartyAccount') . ': '; print $formventilation->select_auxaccount($search_code_tiers_end, 'searchcode_tiers_end', 1); print '
'; print "
'.$langs->trans('JuridicalStatus').''.$object->forme_juridique.'
'.$langs->trans('JuridicalStatus').''.$object->forme_juridique.'
'.$langs->trans('Capital').''; From c907cd139c3abff2cc5fa5305071a5b728b15469 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sat, 27 Feb 2016 08:15:58 +0100 Subject: [PATCH 10/41] Lot of corrections --- htdocs/accountancy/bookkeeping/card.php | 66 +++++++++++-------- htdocs/accountancy/bookkeeping/list.php | 35 +++++----- htdocs/accountancy/bookkeeping/listbyyear.php | 45 ++++++------- htdocs/accountancy/journal/sellsjournal.php | 14 ++-- htdocs/fourn/card.php | 2 +- htdocs/fourn/facture/card.php | 2 +- htdocs/societe/soc.php | 2 +- 7 files changed, 89 insertions(+), 77 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 2d7242ff225..b77bc5446af 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -1,7 +1,7 @@ - * Copyright (C) 2013-2014 Florian Henry - * Copyright (C) 2013-2015 Alexandre Spangaro +/* Copyright (C) 2013-2016 Olivier Geffroy + * Copyright (C) 2013-2016 Florian Henry + * Copyright (C) 2013-2016 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 @@ -18,13 +18,14 @@ */ /** - * \file htdocs/accountancy/bookkeeping/card.php - * \ingroup Accounting Expert - * \brief Page to show account + * \file htdocs/accountancy/bookkeeping/card.php + * \ingroup Advanced accountancy + * \brief Page to show book-entry */ require '../../main.inc.php'; // Class +require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php'; @@ -190,6 +191,9 @@ else if ($action == "confirm_create") { } } +/* + * View + */ llxHeader(); $html = new Form($db); @@ -237,29 +241,32 @@ if ($action == 'create') { print ''; print ''; - print ''; + print ''; print ''; print ''; + print ''; print ''; print ''; - print ''; + print ''; print ''; - print ''; print ''; + print ''; print ''; print ''; print ''; + print ''; print ''; print ''; print ''; + print '
' . $langs->trans("NumMvts") . '' . $langs->trans("NumMvts") . '' . $next_num_mvt . '
' . $langs->trans("Docdate") . ''; print $html->select_date('', 'doc_date', '', '', '', "create_mvt", 1, 1); print '
' . $langs->trans("Codejournal") . '' . $html->selectarray('code_journal', $code_journal_array) . '
' . $langs->trans("Docref") . '
' . $langs->trans("Doctype") . '
'; dol_fiche_end(); @@ -281,7 +288,7 @@ if ($action == 'create') { print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; @@ -301,6 +308,7 @@ if ($action == 'create') { print ''; print ''; print '
' . $langs->trans("NumMvts") . '' . $langs->trans("NumMvts") . '' . $book->piece_num . '
' . $book->doc_type . '
'; + print '
'; $result = $book->fetch_all_per_mvt($piece_num); if ($result < 0) { @@ -328,11 +336,11 @@ if ($action == 'create') { print_liste_field_titre($langs->trans("Numerocompte")); print_liste_field_titre($langs->trans("Code_tiers")); print_liste_field_titre($langs->trans("Labelcompte")); - print_liste_field_titre($langs->trans("Debit")); - print_liste_field_titre($langs->trans("Credit")); - print_liste_field_titre($langs->trans("Amount")); - print_liste_field_titre($langs->trans("Sens")); - print_liste_field_titre(''); + print_liste_field_titre($langs->trans("Debit"), "", "", "", "", 'align="center"'); + print_liste_field_titre($langs->trans("Credit"), "", "", "", "", 'align="center"'); + print_liste_field_titre($langs->trans("Amount"), "", "", "", "", 'align="center"'); + print_liste_field_titre($langs->trans("Sens"), "", "", "", "", 'align="center"'); + print_liste_field_titre($langs->trans("Action"), "", "", "", "", 'width="60" align="center"'); print "
' . $line->montant . '' . $line->sens . '' . price($line->montant) . '' . $line->sens . ''; print '' . "\n"; print ''; print '' . $line->numero_compte . '' . $line->code_tiers . '' . length_accountg($line->numero_compte) . '' . length_accounta($line->code_tiers) . '' . $line->label_compte . '' . $line->debit . '' . $line->credit . '' . $line->montant . '' . $line->sens . '' . price($line->debit) . '' . price($line->credit) . '' . price($line->montant) . '' . $line->sens . ''; + print ''; print ''; print img_edit(); print ' '; @@ -400,8 +408,8 @@ if ($action == 'create') { print $formventilation->select_auxaccount($code_tiers, 'code_tiers', 1); print '
'; print $langs->trans('From') . ': '; print $form->select_date($search_date_start, 'date_start', 0, 0, 1); print '
'; - print $langs->trans('To') . ': '; + print $langs->trans('to') . ': '; print $form->select_date($search_date_end, 'date_end', 0, 0, 1); // print $form->select_date($search_doc_date, 'doc_date', 0, 0, 1); print '
' . $line->sens . '' . $line->code_journal . ''; - print '' . img_edit() . ''; + print '' . img_edit() . ' '; print '' . img_delete() . ''; print '
"; @@ -203,15 +203,14 @@ print_liste_field_titre($langs->trans("AccountAccounting"), $_SERVER['PHP_SELF'] print_liste_field_titre($langs->trans("ThirdPartyAccount"), $_SERVER['PHP_SELF'], "t.code_tiers", "", $options, "", $sortfield, $sortorder); print_liste_field_titre($langs->trans("Label"), $_SERVER['PHP_SELF'], "t.label_compte", "", $options, "", $sortfield, $sortorder); print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, "", $sortfield, $sortorder); -print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, "", $sortfield, $sortorder); -print_liste_field_titre($langs->trans("Amount"), $_SERVER['PHP_SELF'], "t.montant", "", $options, "", $sortfield, $sortorder); -print_liste_field_titre($langs->trans("Sens"), $_SERVER['PHP_SELF'], "t.sens", "", $options, "", $sortfield, $sortorder); -print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $options, "", $sortfield, $sortorder); -print '\n"; -print ''; +print ''; print ''; @@ -249,15 +248,18 @@ print ''; print ''; -print ''; -print ''; -print ''; print "\n"; @@ -268,7 +270,6 @@ foreach ( $object->lines as $line ) { $var = ! $var; print ""; - print '' . "\n"; print '' . "\n"; print ''; @@ -279,9 +280,9 @@ foreach ( $object->lines as $line ) { print ''; print ''; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; print "\n"; } print "
'; -print ''; +print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="center"', $sortfield, $sortorder); +print_liste_field_titre($langs->trans("Amount"), $_SERVER['PHP_SELF'], "t.montant", "", $options, 'align="center"', $sortfield, $sortorder); +print_liste_field_titre($langs->trans("Sens"), $_SERVER['PHP_SELF'], "t.sens", "", $options, 'align="center"', $sortfield, $sortorder); +print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $options, 'align="center"', $sortfield, $sortorder); +print_liste_field_titre($langs->trans("Action"), $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder); print "
'; print ''; print ''; print ''; +print ''; print ''; print ''; +print ''; print ''; print ''; +print ''; +print ''; +print ' '; +print ''; print '
' . $line->piece_num . '' . $line->doc_type . '' . dol_print_date($line->doc_date) . '' . price($line->debit) . '' . price($line->credit) . '' . price($line->montant) . '' . $line->sens . '' . $line->code_journal . '' . img_edit() . '' . $line->sens . '' . $line->code_journal . '' . img_edit() . '
"; diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 4678a677597..5166d503b06 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -4,9 +4,9 @@ * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2012 Regis Houssin * Copyright (C) 2013 Christophe Battarel - * Copyright (C) 2013-2015 Alexandre Spangaro - * Copyright (C) 2013-2014 Florian Henry - * Copyright (C) 2013-2014 Olivier Geffroy + * Copyright (C) 2013-2016 Alexandre Spangaro + * Copyright (C) 2013-2016 Florian Henry + * Copyright (C) 2013-2016 Olivier Geffroy * Copyright (C) 2014 Raphaël Doursenaud * * This program is free software; you can redistribute it and/or modify @@ -24,9 +24,9 @@ */ /** - * \file htdocs/accountancy/journal/sellsjournal.php - * \ingroup Accounting Expert - * \brief Page with sells journal + * \file htdocs/accountancy/journal/sellsjournal.php + * \ingroup Advanced accountancy + * \brief Page with sells journal */ require '../../main.inc.php'; @@ -40,10 +40,10 @@ require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php'; // Langs +$langs->load("commercial"); $langs->load("compta"); $langs->load("bills"); $langs->load("other"); -$langs->load("main"); $langs->load("accountancy"); $date_startmonth = GETPOST('date_startmonth'); diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 3deb2dc1c45..61c2d3862af 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -139,7 +139,7 @@ if ($object->id > 0) print ''; // Alias names (commercial, trademark or alias names) - print '"; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 20ba703e63e..4b07e7aa639 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1336,7 +1336,7 @@ if ($action == 'create') print '
'.$langs->trans('AliasNameShort').''; + print '
'.$langs->trans('AliasNameShort').''; print $object->name_alias; print "
'; // Ref - print ''; + print ''; // Third party print ''; diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index df7bcd03278..ffb587fcc53 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -1479,7 +1479,7 @@ else } // Name - print ''; + print ''; print ''; // Alias names (commercial, trademark or alias names) From 77173344fe88ac95af2a9dbac4d591e9363b3b3b Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Sat, 27 Feb 2016 09:36:09 +0100 Subject: [PATCH 11/41] NEW : Add Malta VAT into 3.9 --- htdocs/install/mysql/data/llx_c_tva.sql | 6 ++++++ htdocs/install/mysql/migration/3.8.0-3.9.0.sql | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/htdocs/install/mysql/data/llx_c_tva.sql b/htdocs/install/mysql/data/llx_c_tva.sql index 7c44f09620f..7e3560d04bb 100644 --- a/htdocs/install/mysql/data/llx_c_tva.sql +++ b/htdocs/install/mysql/data/llx_c_tva.sql @@ -170,6 +170,12 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (12 insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (124, 12, '7','0','VAT super-reduced rate', 1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (125, 12, '0','0','VAT Rate 0', 1); +-- MALTA (id country=148) +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1481, 148, '18','0','VAT standard rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1482, 148, '7','0','VAT reduced rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1483, 148, '5','0','VAT super-reduced rate', 1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1484, 148, '0','0','VAT Rate 0', 1); + -- NEDERLAND (id country=17) insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (171, 17, '19','0','Algemeen BTW tarief',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (172, 17, '6','0','Verlaagd BTW tarief', 1); diff --git a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql index 7eb1fd46269..b6be65f725c 100755 --- a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql +++ b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql @@ -597,3 +597,9 @@ ALTER TABLE llx_holiday ADD COLUMN entity integer DEFAULT 1 NOT NULL; -- Fix Argentina provences INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2326', 2305, '', 0, 'MISIONES', 'Misiones', 1); UPDATE llx_c_departements SET ncc = "FORMOSA", nom = "Formosa" WHERE nom = "Formosa Misiones"; + +-- MALTA VATS (id country=148) +INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (1481, 148, '18','0','VAT standard rate',1); +INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (1482, 148, '7','0','VAT reduced rate',1); +INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (1483, 148, '5','0','VAT super-reduced rate', 1); +INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (1484, 148, '0','0','VAT Rate 0', 1); From 486488795a5afa321567a478ad4e4c3a4035d721 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Sat, 27 Feb 2016 09:44:48 +0100 Subject: [PATCH 12/41] FIX : Remove bad migration file for this version --- .../install/mysql/migration/3.9.0-4.0.0.sql | 25 ------------------- 1 file changed, 25 deletions(-) delete mode 100644 htdocs/install/mysql/migration/3.9.0-4.0.0.sql diff --git a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql deleted file mode 100644 index f8a74fec247..00000000000 --- a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql +++ /dev/null @@ -1,25 +0,0 @@ --- --- Be carefull to requests order. --- This file must be loaded by calling /install/index.php page --- when current version is 4.0.0 or higher. --- --- To rename a table: ALTER TABLE llx_table RENAME TO llx_table_new; --- To add a column: ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol; --- To rename a column: ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60); --- To drop a column: ALTER TABLE llx_table DROP COLUMN oldname; --- To change type of field: ALTER TABLE llx_table MODIFY COLUMN name varchar(60); --- To drop a foreign key: ALTER TABLE llx_table DROP FOREIGN KEY fk_name; --- To drop an index: -- VMYSQL4.0 DROP INDEX nomindex on llx_table --- To drop an index: -- VPGSQL8.0 DROP INDEX nomindex --- To restrict request to Mysql version x.y minimum use -- VMYSQLx.y --- To restrict request to Pgsql version x.y minimum use -- VPGSQLx.y --- To make pk to be auto increment (mysql): VMYSQL4.3 ALTER TABLE llx_c_shipment_mode CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT; --- To make pk to be auto increment (postgres): VPGSQL8.2 NOT POSSIBLE. MUST DELETE/CREATE TABLE --- To set a field as NULL: VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name DROP NOT NULL; --- To set a field as default NULL: VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET DEFAULT NULL; --- Note: fields with type BLOB/TEXT can't have default value. --- -- VPGSQL8.2 DELETE FROM llx_usergroup_user WHERE fk_user NOT IN (SELECT rowid from llx_user); --- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup); - - -ALTER TABLE llx_accounting_bookkeeping ADD COLUMN validated tinyint DEFAULT 0 NOT NULL; From 8807222f24ef7a5de00b2addb0c2c86e0200784a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 27 Feb 2016 11:32:49 +0100 Subject: [PATCH 13/41] Fix a lot of fixes to have the french vat npr working better --- htdocs/comm/propal.php | 10 +++++----- htdocs/comm/propal/class/propal.class.php | 10 ++++++---- htdocs/commande/card.php | 2 ++ htdocs/commande/class/commande.class.php | 7 +++++-- htdocs/compta/facture.php | 8 ++++++-- htdocs/compta/facture/class/facture.class.php | 8 +++++--- htdocs/contrat/card.php | 6 ++++-- htdocs/core/class/html.form.class.php | 1 + htdocs/core/lib/functions.lib.php | 8 +++++--- htdocs/fourn/class/fournisseur.product.class.php | 1 - htdocs/fourn/commande/card.php | 13 +++++++------ htdocs/fourn/facture/card.php | 14 +++++++------- htdocs/product/card.php | 6 ++++-- htdocs/product/fournisseurs.php | 5 ++++- htdocs/supplier_proposal/card.php | 7 +++---- .../class/supplier_proposal.class.php | 7 ++++--- 16 files changed, 68 insertions(+), 45 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index f6870cbd595..5406ba72a26 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -461,9 +461,7 @@ if (empty($reshook)) $array_options = $lines[$i]->array_options; } - $tva_tx=get_default_tva($mysoc, $object->thirdparty); - - $result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, 'HT', 0, $lines[$i]->info_bits, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $date_start, $date_end, $array_options, $lines[$i]->fk_unit); + $result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $lines[$i]->tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, 'HT', 0, $lines[$i]->info_bits, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $date_start, $date_end, $array_options, $lines[$i]->fk_unit); if ($result > 0) { $lineid = $result; @@ -747,6 +745,8 @@ if (empty($reshook)) // If prices fields are update $tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id); $tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id); + if (empty($tva_tx)) $tva_npr=0; + $pu_ht = $prod->price; $pu_ttc = $prod->price_ttc; $price_min = $prod->price_min; @@ -867,8 +867,8 @@ if (empty($reshook)) $date_end = dol_mktime(GETPOST('date_end' . $predef . 'hour'), GETPOST('date_end' . $predef . 'min'), GETPOST('date_end' . $predef . 'sec'), GETPOST('date_end' . $predef . 'month'), GETPOST('date_end' . $predef . 'day'), GETPOST('date_end' . $predef . 'year')); // Local Taxes - $localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty); - $localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty); + $localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty, $tva_npr); + $localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty, $tva_npr); $info_bits = 0; if ($tva_npr) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 460b574c246..5a45d884e09 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -239,9 +239,10 @@ class Propal extends CommonObject $productdesc = $prod->description; $tva_tx = get_default_tva($mysoc,$this->client,$prod->id); - // local taxes - $localtax1_tx = get_default_localtax($mysoc,$this->client,1,$prod->tva_tx); - $localtax2_tx = get_default_localtax($mysoc,$this->client,2,$prod->tva_tx); + $tva_npr = get_default_npr($mysoc,$this->client,$prod->id); + if (empty($tva_tx)) $tva_npr=0; + $localtax1_tx = get_localtax($tva_tx,1,$mysoc,$this->client,$tva_npr); + $localtax2_tx = get_localtax($tva_tx,2,$mysoc,$this->client,$tva_npr); // multiprix if($conf->global->PRODUIT_MULTIPRICES && $this->client->price_level) @@ -262,7 +263,8 @@ class Propal extends CommonObject $line->remise_percent=$remise_percent; $line->tva_tx=$tva_tx; $line->fk_unit=$prod->fk_unit; - + if ($tva_npr) $line->info_bits = 1; + $this->lines[]=$line; } } diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index d7b2bab080a..d8ac0b6d63d 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -643,6 +643,8 @@ if (empty($reshook)) // Update if prices fields are defined $tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id); $tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id); + if (empty($tva_tx)) $tva_npr=0; + $pu_ht = $prod->price; $pu_ttc = $prod->price_ttc; $price_min = $prod->price_min; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 915e8a1e08c..9302c702ff1 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1382,8 +1382,11 @@ class Commande extends CommonOrder $prod->fetch($idproduct); $tva_tx = get_default_tva($mysoc,$this->client,$prod->id); - $localtax1_tx=get_localtax($tva_tx,1,$this->client); - $localtax2_tx=get_localtax($tva_tx,2,$this->client); + $tva_npr = get_default_npr($mysoc,$this->client,$prod->id); + if (empty($tva_tx)) $tva_npr=0; + $localtax1_tx=get_localtax($tva_tx,1,$this->client,$mysoc,$tva_npr); + $localtax2_tx=get_localtax($tva_tx,2,$this->client,$mysoc,$tva_npr); + // multiprix if($conf->global->PRODUIT_MULTIPRICES && $this->client->price_level) $price = $prod->multiprices[$this->client->price_level]; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index d922ce35d96..8f6f9f204ac 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1314,6 +1314,8 @@ if (empty($reshook)) // Update if prices fields are defined $tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id); $tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id); + if (empty($tva_tx)) $tva_npr=0; + $pu_ht = $prod->price; $pu_ttc = $prod->price_ttc; $price_min = $prod->price_min; @@ -1330,6 +1332,7 @@ if (empty($reshook)) { if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level])) $tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level]; if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level]; + if (empty($tva_tx)) $tva_npr=0; } } elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) @@ -1413,6 +1416,7 @@ if (empty($reshook)) $pu_ttc = price2num(GETPOST('price_ttc'), 'MU'); $tva_npr = (preg_match('/\*/', $tva_tx) ? 1 : 0); $tva_tx = str_replace('*', '', $tva_tx); + if (empty($tva_tx)) $tva_npr=0; $label = (GETPOST('product_label') ? GETPOST('product_label') : ''); $desc = $product_desc; $type = GETPOST('type'); @@ -1424,8 +1428,8 @@ if (empty($reshook)) $buyingprice = price2num(GETPOST('buying_price' . $predef) != '' ? GETPOST('buying_price' . $predef) : ''); // If buying_price is '0', we must keep this value // Local Taxes - $localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty, $mysoc); - $localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty, $mysoc); + $localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty, $mysoc, $tva_npr); + $localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty, $mysoc, $tva_npr); $info_bits = 0; if ($tva_npr) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index c66bbb6d1c2..7c761ccb40f 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -484,8 +484,10 @@ class Facture extends CommonInvoice $res=$prod->fetch($_facrec->lines[$i]->fk_product); } $tva_tx = get_default_tva($mysoc,$soc,$prod->id); - $localtax1_tx=get_localtax($tva_tx,1,$soc); - $localtax2_tx=get_localtax($tva_tx,2,$soc); + $tva_npr = get_default_npr($mysoc,$soc,$prod->id); + if (empty($tva_tx)) $tva_npr=0; + $localtax1_tx=get_localtax($tva_tx,1,$soc,$mysoc,$tva_npr); + $localtax2_tx=get_localtax($tva_tx,2,$soc,$mysoc,$tva_npr); $result_insert = $this->addline( $_facrec->lines[$i]->desc, @@ -496,7 +498,7 @@ class Facture extends CommonInvoice $localtax2_tx, $_facrec->lines[$i]->fk_product, $_facrec->lines[$i]->remise_percent, - '','',0,0,'','HT',0, + '','',0,$tva_npr,'','HT',0, $_facrec->lines[$i]->product_type, $_facrec->lines[$i]->rang, $_facrec->lines[$i]->special_code, diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 37ec345295b..babda9eff3c 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -458,6 +458,8 @@ if (empty($reshook)) $tva_tx = get_default_tva($mysoc,$object->thirdparty,$prod->id); $tva_npr = get_default_npr($mysoc,$object->thirdparty,$prod->id); + if (empty($tva_tx)) $tva_npr=0; + $pu_ht = $prod->price; $pu_ttc = $prod->price_ttc; $price_min = $prod->price_min; @@ -518,8 +520,8 @@ if (empty($reshook)) $fk_unit= GETPOST('units', 'alpha'); } - $localtax1_tx=get_localtax($tva_tx,1,$object->thirdparty); - $localtax2_tx=get_localtax($tva_tx,2,$object->thirdparty); + $localtax1_tx=get_localtax($tva_tx,1,$object->thirdparty,$mysoc,$tva_npr); + $localtax2_tx=get_localtax($tva_tx,2,$object->thirdparty,$mysoc,$tva_npr); // ajout prix achat $fk_fournprice = $_POST['fournprice']; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index be1bfc0c7fc..482acbbab46 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4083,6 +4083,7 @@ class Form { $defaulttx=get_default_tva($societe_vendeuse,$societe_acheteuse,$idprod); $defaultnpr=get_default_npr($societe_vendeuse,$societe_acheteuse,$idprod); + if (empty($defaulttx)) $defaultnpr=0; } // Si taux par defaut n'a pu etre determine, on prend dernier de la liste. diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index c9917e5852d..2b987ec1cbd 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3317,14 +3317,15 @@ function price2num($amount,$rounding='',$alreadysqlnb=0) * Return localtax rate for a particular vat, when selling a product with vat $vatrate, from a $thirdparty_buyer to a $thirdparty_seller * Note: This function applies same rules than get_default_tva * - * @param float $vatrate Vat rate. Can be '8.5' or '8.5 (8.5NPR)' for example + * @param float $vatrate Vat rate. Can be '8.5' or '8.5 (VATCODEX)' for example * @param int $local Local tax to search and return (1 or 2 return only tax rate 1 or tax rate 2) * @param Societe $thirdparty_buyer Object of buying third party * @param Societe $thirdparty_seller Object of selling third party + * @param int $vatnpr If vat rate is NPR or not * @return mixed 0 if not found, localtax rate if found * @see get_default_tva */ -function get_localtax($vatrate, $local, $thirdparty_buyer="", $thirdparty_seller="") +function get_localtax($vatrate, $local, $thirdparty_buyer="", $thirdparty_seller="", $vatnpr=0) { global $db, $conf, $mysoc; @@ -3433,7 +3434,8 @@ function get_localtax($vatrate, $local, $thirdparty_buyer="", $thirdparty_seller $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c"; $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$thirdparty_seller->country_code."'"; $sql .= " AND t.taux = ".((float) $vatratecleaned)." AND t.active = 1"; - if ($vatratecode) $sql.= " AND t.code ='".$vatratecode."'"; + if ($vatratecode) $sql.= " AND t.code ='".$vatratecode."'"; // If we have the code, we use it in priority + else $sql.= " AND t.recuperableonly ='".$npr."'"; dol_syslog("get_localtax", LOG_DEBUG); $resql=$db->query($sql); diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 4865eac6951..e13528c0382 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -190,7 +190,6 @@ class ProductFournisseur extends Product if ($delivery_time_days != '' && ! is_numeric($delivery_time_days)) $delivery_time_days = ''; if ($price_base_type == 'TTC') { - //$ttx = get_default_tva($fourn,$mysoc,$this->id); // We must use the VAT rate defined by user and not calculate it $ttx = $tva_tx; $buyprice = $buyprice/(1+($ttx/100)); } diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 50df02b1bff..a0cf8bc11bb 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -340,12 +340,13 @@ if (empty($reshook)) $desc = $productsupplier->description; if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc); - $tva_tx = get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice')); $type = $productsupplier->type; - - // Local Taxes - $localtax1_tx= get_localtax($tva_tx, 1,$mysoc,$object->thirdparty); - $localtax2_tx= get_localtax($tva_tx, 2,$mysoc,$object->thirdparty); + + $tva_tx = get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice')); + $tva_npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice')); + if (empty($tva_tx)) $tva_npr=0; + $localtax1_tx= get_localtax($tva_tx, 1, $mysoc, $object->thirdparty, $tva_npr); + $localtax2_tx= get_localtax($tva_tx, 2, $mysoc, $object->thirdparty, $tva_npr); $result=$object->addline( $desc, @@ -361,7 +362,7 @@ if (empty($reshook)) 'HT', $pu_ttc, $type, - '', + $tva_npr, '', $date_start, $date_end, diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 4b07e7aa639..e7b766e1777 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -706,17 +706,17 @@ if (empty($reshook)) $desc = $productsupplier->description; if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc); - $tvatx=get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, $_POST['idprodfournprice']); - $npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, $_POST['idprodfournprice']); - - $localtax1_tx= get_localtax($tvatx, 1, $mysoc,$object->thirdparty); - $localtax2_tx= get_localtax($tvatx, 2, $mysoc,$object->thirdparty); + $tva_tx=get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, $_POST['idprodfournprice']); + $tva_npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, $_POST['idprodfournprice']); + if (empty($tva_tx)) $tva_npr=0; + $localtax1_tx= get_localtax($tva_tx, 1, $mysoc, $object->thirdparty, $tva_npr); + $localtax2_tx= get_localtax($tva_tx, 2, $mysoc, $object->thirdparty, $tva_npr); $type = $productsupplier->type; $price_base_type = 'HT'; // TODO Save the product supplier ref into database into field ref_supplier (must rename field ref into ref_supplier first) - $result=$object->addline($desc, $productsupplier->fourn_pu, $tvatx, $localtax1_tx, $localtax2_tx, $qty, $idprod, $remise_percent, $date_start, $date_end, 0, $npr, $price_base_type, $type, -1, 0, $array_options, $productsupplier->fk_unit); + $result=$object->addline($desc, $productsupplier->fourn_pu, $tva_tx, $localtax1_tx, $localtax2_tx, $qty, $idprod, $remise_percent, $date_start, $date_end, 0, $tva_npr, $price_base_type, $type, -1, 0, $array_options, $productsupplier->fk_unit); } if ($idprod == -2 || $idprod == 0) { @@ -763,7 +763,7 @@ if (empty($reshook)) $price_base_type = 'HT'; } - $result=$object->addline($product_desc, $ht, $tva_tx, $localtax1_tx, $localtax2_tx, $qty, 0, $remise_percent, $date_start, $date_end, 0, $npr, $price_base_type, $type, -1, 0, $array_options, $fk_unit); + $result=$object->addline($product_desc, $ht, $tva_tx, $localtax1_tx, $localtax2_tx, $qty, 0, $remise_percent, $date_start, $date_end, 0, $tva_npr, $price_base_type, $type, -1, 0, $array_options, $fk_unit); } //print "xx".$tva_tx; exit; diff --git a/htdocs/product/card.php b/htdocs/product/card.php index c66984028cb..c269e560a4c 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -568,8 +568,10 @@ if (empty($reshook)) $desc = $object->description; $tva_tx = get_default_tva($mysoc, $soc, $object->id); - $localtax1_tx = get_localtax($tva_tx, 1, $soc); - $localtax2_tx = get_localtax($tva_tx, 2, $soc); + $tva_npr = get_default_npr($mysoc, $soc, $object->id); + if (empty($tva_tx)) $tva_npr=0; + $localtax1_tx = get_localtax($tva_tx, 1, $soc, $mysoc, $tva_npr); + $localtax2_tx = get_localtax($tva_tx, 2, $soc, $mysoc, $tva_npr); $pu_ht = $object->price; $pu_ttc = $object->price_ttc; diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 0fe2769803d..2665ae8fd1e 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -423,7 +423,9 @@ if ($id > 0 || $ref) $mysoc2->name='Fictive seller with same country'; $mysoc2->tva_assuj=1; $default_vat=get_default_tva($mysoc2, $mysoc, $object->id, 0); - + $default_npr=get_default_npr($mysoc2, $mysoc, $object->id, 0); + if (empty($default_vat)) $default_npr=$default_vat; + print ''; print ''; print ''; print ''; - print ''; + + if ($obj->account_parent) + { + $accountparent->id = $obj->rowid2; + $accountparent->label = $obj->label2; + $accountparent->account_number = $obj->account_number2; + + print ''; + } + else + { + print ''; + } print ''; print ''; print ''; - print ''; + print ''; print "\n"; $total += $row->nb; } @@ -138,7 +139,7 @@ else } print ''; print ''; -print ''; +print ''; print "\n"; print "
'.$langs->trans('Ref').''.$langs->trans('Draft').'
'.$langs->trans('Ref').''.$langs->trans('Draft').'
'.$langs->trans('Supplier').'
'.fieldLabel('ThirdPartyName','name',1).'
'.fieldLabel('ThirdPartyName','name',1).'
'.$langs->trans("VATRateForSupplierProduct").''; //print $form->load_tva('tva_tx',$object->tva_tx,$supplier,$mysoc); // Do not use list here as it may be any vat rates for any country @@ -432,6 +434,7 @@ if ($id > 0 || $ref) $tmpproductsupplier=new ProductFournisseur($db); $tmpproductsupplier->fetch_product_fournisseur_price($rowid, 1); $default_vat=$tmpproductsupplier->fourn_tva_tx; + $default_npr=$tmpproductsupplier->fourn_tva_npr; } else { diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 2a64fa5d4c5..cf5e75f0669 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -344,9 +344,7 @@ if (empty($reshook)) $array_option = $lines[$i]->array_options; } - $tva_tx=get_default_tva($mysoc, $object->thirdparty); - - $result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, 'HT', 0, $lines[$i]->info_bits, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_option); + $result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $lines[$i]->tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, 'HT', 0, $lines[$i]->info_bits, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_option); if ($result > 0) { $lineid = $result; @@ -561,7 +559,8 @@ if (empty($reshook)) // If prices fields are update $tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id); $tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id); - + if (empty($tva_tx)) $tva_npr=0; + //On garde le prix indiqué dans l'input pour la demande de prix fournisseur //$pu_ht = $prod->price; $pu_ht = price2num($price_ht, 'MU'); diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 54a578a1e61..2350d8d5be1 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -191,9 +191,10 @@ class SupplierProposal extends CommonObject $productdesc = $prod->description; $tva_tx = get_default_tva($mysoc,$this->client,$prod->id); - // local taxes - $localtax1_tx = get_default_localtax($mysoc,$this->client,1,$prod->tva_tx); - $localtax2_tx = get_default_localtax($mysoc,$this->client,2,$prod->tva_tx); + $tva_npr = get_default_npr($mysoc,$this->client,$prod->id); + if (empty($tva_tx)) $tva_npr=0; + $localtax1_tx = get_localtax($tva_tx,1,$mysoc,$this->client,$tva_npr); + $localtax2_tx = get_localtax($tva_tx,2,$mysoc,$this->client,$tva_npr); // multiprix if($conf->global->PRODUIT_MULTIPRICES && $this->client->price_level) From 1bf188db863da4134fff7b38a4af09ae23fb967b Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sat, 27 Feb 2016 14:34:32 +0100 Subject: [PATCH 14/41] Fix: Double line --- htdocs/core/lib/report.lib.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/core/lib/report.lib.php b/htdocs/core/lib/report.lib.php index e8cecacf589..fa05e632983 100644 --- a/htdocs/core/lib/report.lib.php +++ b/htdocs/core/lib/report.lib.php @@ -48,8 +48,6 @@ function report_header($nom,$variante,$period,$periodlink,$description,$builddat if(! empty($varlink)) $varlink = '?'.$varlink; - if(! empty($varlink)) $varlink = '?'.$varlink; - $h=0; $head[$h][0] = $_SERVER["PHP_SELF"].$varlink; $head[$h][1] = $langs->trans("Report"); From 4dd50460d36a4b490bdf11681a8a46158048b19f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 27 Feb 2016 15:50:06 +0100 Subject: [PATCH 15/41] Fix MAIN_THIRDPARTY_CREATION_INDIVIDUAL syntax error in name --- htdocs/societe/soc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index b376a8c2765..4bad452110b 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -763,7 +763,7 @@ else * Creation */ $private=GETPOST("private","int"); - if (! empty($conf->global->MAIN_THIRPARTY_CREATION_INDIVIDUAL) && ! isset($_GET['private']) && ! isset($_POST['private'])) $private=1; + if (! empty($conf->global->MAIN_THIRDPARTY_CREATION_INDIVIDUAL) && ! isset($_GET['private']) && ! isset($_POST['private'])) $private=1; if (empty($private)) $private=0; // Load object modCodeTiers From ba6dadb6fa97af3b1fe927c97b7c35c2b6fb38ad Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sat, 27 Feb 2016 16:21:40 +0100 Subject: [PATCH 16/41] Fix: Use getNomUrl to show account_parent instead of rowid of the account --- htdocs/accountancy/admin/account.php | 35 ++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 8ebaa93d96c..3f251e0090b 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2015 Alexandre Spangaro +/* Copyright (C) 2013-2016 Olivier Geffroy + * Copyright (C) 2013-2016 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 @@ -17,9 +17,9 @@ */ /** - * \file htdocs/accountancy/admin/account.php - * \ingroup Accounting Expert - * \brief List accounting account + * \file htdocs/accountancy/admin/account.php + * \ingroup Advanced accountancy + * \brief List accounting account */ require '../../main.inc.php'; @@ -104,10 +104,12 @@ llxHeader('', $langs->trans("ListAccounts")); $pcgver = $conf->global->CHARTOFACCOUNTS; -$sql = "SELECT aa.rowid, aa.fk_pcg_version, aa.pcg_type, aa.pcg_subtype, aa.account_number, aa.account_parent , aa.label, aa.active "; -$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa, " . MAIN_DB_PREFIX . "accounting_system as asy"; -$sql .= " WHERE aa.fk_pcg_version = asy.pcg_version"; -$sql .= " AND asy.rowid = " . $pcgver; +$sql = "SELECT aa.rowid, aa.fk_pcg_version, aa.pcg_type, aa.pcg_subtype, aa.account_number, aa.account_parent , aa.label, aa.active, "; +$sql .= " a2.rowid as rowid2, a2.label as label2, a2.account_number as account_number2"; +$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa"; +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as a2 ON aa.account_parent = a2.rowid"; +$sql .= " WHERE asy.rowid = " . $pcgver; if (strlen(trim($search_account))) { $sql .= " AND aa.account_number like '%" . $search_account . "%'"; @@ -175,6 +177,7 @@ if ($result) { $var = false; $accountstatic = new AccountingAccount($db); + $accountparent = new AccountingAccount($db); while ( $i < min($num, $limit) ) { $obj = $db->fetch_object($resql); @@ -186,7 +189,19 @@ if ($result) { print '
' . $accountstatic->getNomUrl(1) . '' . $obj->label . '' . $obj->account_parent . '' . $accountparent->getNomUrl(1) . ' ' . $obj->pcg_type . '' . $obj->pcg_subtype . ''; From 0136a1742efbe9662e0bc024476fe95be483633b Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sat, 27 Feb 2016 16:21:59 +0100 Subject: [PATCH 17/41] Spaces !!! --- htdocs/accountancy/journal/bankjournal.php | 110 ++++++++++----------- 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 8eaf497fbf0..90d63ef05f8 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -23,9 +23,9 @@ */ /** - * \file htdocs/accountancy/journal/bankjournal.php - * \ingroup Accounting Expert - * \brief Page with bank journal + * \file htdocs/accountancy/journal/bankjournal.php + * \ingroup Advanced accountancy + * \brief Page with bank journal */ require '../../main.inc.php'; @@ -72,7 +72,7 @@ $now = dol_now(); if ($user->societe_id > 0 && empty($id_bank_account)) accessforbidden(); - /* +/* * View */ $year_current = strftime("%Y", dol_now()); @@ -127,7 +127,7 @@ $journal = $bank_code_journal->accountancy_journal; dol_syslog("accountancy/journal/bankjournal.php", LOG_DEBUG); $result = $db->query($sql); if ($result) { - + $num = $db->num_rows($result); // Variables $cptfour = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef")); @@ -135,22 +135,22 @@ if ($result) { $accountancy_account_salary = (! empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : $langs->trans("CodeNotDef")); $accountancy_account_pay_vat = (! empty($conf->global->ACCOUNTING_VAT_PAY_ACCOUNT) ? $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT : $langs->trans("CodeNotDef")); $accountancy_account_pay_donation = (! empty($conf->global->DONATION_ACCOUNTINGACCOUNT) ? $conf->global->DONATION_ACCOUNTINGACCOUNT : $langs->trans("CodeNotDef")); - + $tabpay = array (); $tabbq = array (); $tabtp = array (); $tabtype = array (); - + $i = 0; while ( $i < $num ) { $obj = $db->fetch_object($result); - + $tabcompany[$obj->rowid] = array ( 'id' => $obj->socid, 'name' => $obj->name, 'code_client' => $obj->code_compta ); - + // Controls $compta_bank = $obj->account_number; if ($obj->label == '(SupplierInvoicePayment)') @@ -159,8 +159,8 @@ if ($result) { $compta_soc = (! empty($obj->code_compta) ? $obj->code_compta : $cptcli); if ($obj->typeop == '(BankTransfert)') $compta_soc = $conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH; - - // Variable bookkeeping + + // Variable bookkeeping $tabpay[$obj->rowid]["date"] = $obj->do; $tabpay[$obj->rowid]["type_payment"] = $obj->fk_type; $tabpay[$obj->rowid]["ref"] = $obj->label; @@ -171,12 +171,12 @@ if ($result) { $tabpay[$obj->rowid]["lib"] = dol_trunc($obj->label, 60); } $links = $object->get_url($obj->rowid); - + // get_url may return -1 which is not traversable if (is_array($links)) { foreach ( $links as $key => $val ) { $tabtype[$obj->rowid] = $links[$key]['type']; - + if ($links[$key]['type'] == 'payment') { $paymentstatic->id = $links[$key]['url_id']; $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentstatic->getNomUrl(2); @@ -197,7 +197,7 @@ if ($result) { } else if ($links[$key]['type'] == 'sc') { $chargestatic->id = $links[$key]['url_id']; $chargestatic->ref = $links[$key]['url_id']; - + $tabpay[$obj->rowid]["lib"] .= ' ' . $chargestatic->getNomUrl(2); if (preg_match('/^\((.*)\)$/i', $links[$key]['label'], $reg)) { if ($reg[1] == 'socialcontribution') @@ -208,14 +208,14 @@ if ($result) { } $chargestatic->ref = $chargestatic->lib; $tabpay[$obj->rowid]["soclib"] = $chargestatic->getNomUrl(1, 30); - + $sqlmid = 'SELECT cchgsoc.accountancy_code'; $sqlmid .= " FROM " . MAIN_DB_PREFIX . "c_chargesociales cchgsoc "; $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "chargesociales as chgsoc ON chgsoc.fk_type=cchgsoc.id"; $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementcharge as paycharg ON paycharg.fk_charge=chgsoc.rowid"; $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "bank_url as bkurl ON bkurl.url_id=paycharg.rowid"; $sqlmid .= " WHERE bkurl.fk_bank=" . $obj->rowid; - + dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG); $resultmid = $db->query($sqlmid); if ($resultmid) { @@ -247,9 +247,9 @@ if ($result) { }*/ } } - + $tabbq[$obj->rowid][$compta_bank] += $obj->amount; - + // if($obj->socid)$tabtp[$obj->rowid][$compta_soc] += $obj->amount; $i ++; @@ -265,7 +265,7 @@ if ($result) { // Write bookkeeping if ($action == 'writebookkeeping') { $now = dol_now(); - + $error = 0; foreach ( $tabpay as $key => $val ) { // Bank @@ -286,9 +286,9 @@ if ($action == 'writebookkeeping') { $bookkeeping->code_journal = $journal; $bookkeeping->fk_user_author = $user->id; $bookkeeping->date_create = $now; - + if ($tabtype[$key] == 'payment') { - + $sqlmid = 'SELECT fac.facnumber'; $sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture fac "; $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement_facture as payfac ON payfac.fk_facture=fac.rowid"; @@ -301,7 +301,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->doc_ref = $objmid->facnumber; } } else if ($tabtype[$key] == 'payment_supplier') { - + $sqlmid = 'SELECT facf.ref_supplier,facf.ref'; $sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture_fourn facf "; $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as payfacf ON payfacf.fk_facturefourn=facf.rowid"; @@ -315,7 +315,7 @@ if ($action == 'writebookkeeping') { ; } } - + $result = $bookkeeping->create($user); if ($result < 0) { $error ++; @@ -338,12 +338,12 @@ if ($action == 'writebookkeeping') { $bookkeeping->code_journal = $journal; $bookkeeping->fk_user_author = $user->id; $bookkeeping->date_create = $now; - + if ($tabtype[$key] == 'sc') { $bookkeeping->code_tiers = ''; $bookkeeping->numero_compte = $k; } else if ($tabtype[$key] == 'payment') { - + $sqlmid = 'SELECT fac.facnumber'; $sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture fac "; $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement_facture as payfac ON payfac.fk_facture=fac.rowid"; @@ -358,7 +358,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->code_tiers = $k; $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER; } else if ($tabtype[$key] == 'payment_supplier') { - + $sqlmid = 'SELECT facf.ref_supplier,facf.ref'; $sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture_fourn facf "; $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as payfacf ON payfacf.fk_facturefourn=facf.rowid"; @@ -373,7 +373,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->code_tiers = $k; $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER; } else if ($tabtype[$key] == 'company') { - + $sqlmid = 'SELECT fac.facnumber'; $sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture fac "; $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement_facture as payfac ON payfac.fk_facture=fac.rowid"; @@ -392,7 +392,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->doc_ref = $k; $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER; } - + $result = $bookkeeping->create($user); if ($result < 0) { $error ++; @@ -400,7 +400,7 @@ if ($action == 'writebookkeeping') { } } } - + if (empty($error)) { setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs'); } @@ -408,25 +408,25 @@ if ($action == 'writebookkeeping') { // Export if ($action == 'export_csv') { $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; - + include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php'; - + $companystatic = new Client($db); - + // Model Cegid Expert Export if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) { $sep = ";"; - + foreach ( $tabpay as $key => $val ) { $date = dol_print_date($db->jdate($val["date"]), '%d%m%Y'); - + $companystatic->id = $tabcompany[$key]['id']; $companystatic->name = $tabcompany[$key]['name']; $companystatic->client = $tabcompany[$key]['code_client']; - + $date = dol_print_date($db->jdate($val["date"]), '%d%m%Y'); - + // Bank foreach ( $tabbq[$key] as $k => $mt ) { print $date . $sep; @@ -439,7 +439,7 @@ if ($action == 'export_csv') { print $val["ref"] . $sep; print "\n"; } - + // Third party if (is_array($tabtp[$key])) { foreach ( $tabtp[$key] as $k => $mt ) { @@ -477,10 +477,10 @@ if ($action == 'export_csv') { // Model Classic Export foreach ( $tabpay as $key => $val ) { $date = dol_print_date($db->jdate($val["date"]), 'day'); - + $companystatic->id = $tabcompany[$key]['id']; $companystatic->name = $tabcompany[$key]['name']; - + // Bank foreach ( $tabbq[$key] as $k => $mt ) { print '"' . $date . '"' . $sep; @@ -491,7 +491,7 @@ if ($action == 'export_csv') { print '"' . ($mt < 0 ? price(- $mt) : '') . '"'; print "\n"; } - + // Third party if (is_array($tabtp[$key])) { foreach ( $tabtp[$key] as $k => $mt ) { @@ -520,23 +520,23 @@ if ($action == 'export_csv') { } } else { $form = new Form($db); - + llxHeader('', $langs->trans("FinanceJournal")); - + $nom = $langs->trans("FinanceJournal") . ' - ' . $journal; $builddate = time(); $description = $langs->trans("DescFinanceJournal") . '
'; $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); - + $varlink = 'id_account=' . $id_bank_account; report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array ( 'action' => '' ), '', $varlink); - + print ''; - + print ''; - + print ' '; - + /* * Show result array */ print '

'; - + $i = 0; print ""; print ""; @@ -566,10 +566,10 @@ if ($action == 'export_csv') { print ""; print ""; print "\n"; - + $var = true; $r = ''; - + foreach ( $tabpay as $key => $val ) { $date = dol_print_date($db->jdate($val["date"]), 'day'); @@ -579,8 +579,8 @@ if ($action == 'export_csv') { if ($val["lib"] == '(CustomerInvoicePayment)') { $reflabel = $langs->trans('CustomerInvoicePayment'); } - - // Bank + + // Bank foreach ( $tabbq[$key] as $k => $mt ) { print ""; print ""; @@ -592,7 +592,7 @@ if ($action == 'export_csv') { print ""; print ""; } - + // Third party if (is_array($tabtp[$key])) { foreach ( $tabtp[$key] as $k => $mt ) { @@ -623,9 +623,9 @@ if ($action == 'export_csv') { } $var = ! $var; } - + print "
" . $langs->trans("PaymentMode") . "" . $langs->trans("Debit") . "" . $langs->trans("Credit") . "
" . $date . "" . ($mt < 0 ? price(- $mt) : '') . "
"; - + llxFooter(); } $db->close(); From 526ea743e060c7a7ba865d37c8a29ecc6d61dfc2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 27 Feb 2016 17:56:59 +0100 Subject: [PATCH 18/41] Fix: the view my task must show only task you are assigned to --- htdocs/projet/activity/index.php | 63 ++++++++++++++++++++++++++------ 1 file changed, 52 insertions(+), 11 deletions(-) diff --git a/htdocs/projet/activity/index.php b/htdocs/projet/activity/index.php index 39f728263ad..7d87dbae298 100644 --- a/htdocs/projet/activity/index.php +++ b/htdocs/projet/activity/index.php @@ -49,6 +49,7 @@ $now = dol_now(); $projectstatic=new Project($db); $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1); // Return all projects I have permission on because I want my tasks and some of my task may be on a public projet that is not my project +$taskstatic=new Task($db); $tasktmp=new Task($db); $title=$langs->trans("Activities"); @@ -125,7 +126,7 @@ if ( $resql ) $projectstatic->title=$row->title; print $projectstatic->getNomUrl(1, '', 1); print '
'.convertSecondToTime($row->nb).''.convertSecondToTime($row->nb, 'allhourmin').'
'.$langs->trans('Total').''.convertSecondToTime($total).''.convertSecondToTime($total, 'allhourmin').'
"; @@ -181,7 +182,7 @@ if ($db->type != 'pgsql') $projectstatic->title=$row->title; print $projectstatic->getNomUrl(1, '', 1); print ''; - print ''.convertSecondToTime($row->nb).''; + print ''.convertSecondToTime($row->nb, 'allhourmin').''; print "\n"; $total += $row->nb; } @@ -194,7 +195,7 @@ if ($db->type != 'pgsql') } print ''; print ''.$langs->trans('Total').''; - print ''.convertSecondToTime($total).''; + print ''.convertSecondToTime($total, 'allhourmin').''; print "\n"; print ""; } @@ -240,7 +241,7 @@ if ( $resql ) $projectstatic->title=$row->title; print $projectstatic->getNomUrl(1, '', 1); print ''; - print ''.convertSecondToTime($row->nb).''; + print ''.convertSecondToTime($row->nb, 'allhourmin').''; print "\n"; $total += $row->nb; } @@ -253,7 +254,7 @@ else } print ''; print ''.$langs->trans('Total').''; -print ''.convertSecondToTime($total).''; +print ''.convertSecondToTime($total, 'allhourmin').''; print "\n"; print "
"; @@ -292,7 +293,7 @@ if ( $resql ) $projectstatic->title=$row->title; print $projectstatic->getNomUrl(1, '', 1); print ''; - print ''.convertSecondToTime($row->nb).''; + print ''.convertSecondToTime($row->nb, 'allhourmin').''; print "\n"; $var=!$var; } @@ -304,7 +305,7 @@ else } print ''; print ''.$langs->trans('Total').''; -print ''.convertSecondToTime($total).''; +print ''.convertSecondToTime($total, 'allhourmin').''; print "\n"; print ""; @@ -342,7 +343,7 @@ if (! empty($conf->global->PROJECT_TASK_TIME_YEAR)) $projectstatic->title=$row->title; print $projectstatic->getNomUrl(1, '', 1); print ''; - print ''.convertSecondToTime($row->nb).''; + print ''.convertSecondToTime($row->nb, 'allhourmin').''; print "\n"; $var=!$var; } @@ -354,7 +355,7 @@ if (! empty($conf->global->PROJECT_TASK_TIME_YEAR)) } print ''; print ''.$langs->trans('Total').''; - print ''.convertSecondToTime($total).''; + print ''.convertSecondToTime($total, 'allhourmin').''; print "\n"; print ""; } @@ -366,6 +367,38 @@ print '
'; if (empty($conf->global->PROJECT_HIDE_TASKS)) { + // Get id of types of contacts for projects (This list never contains a lot of elements) + $listofprojectcontacttype=array(); + $sql = "SELECT ctc.rowid, ctc.code FROM ".MAIN_DB_PREFIX."c_type_contact as ctc"; + $sql.= " WHERE ctc.element = '" . $projectstatic->element . "'"; + $sql.= " AND ctc.source = 'internal'"; + $resql = $db->query($sql); + if ($resql) + { + while($obj = $db->fetch_object($resql)) + { + $listofprojectcontacttype[$obj->rowid]=$obj->code; + } + } + else dol_print_error($db); + if (count($listofprojectcontacttype) == 0) $listofprojectcontacttype[0]='0'; // To avoid sql syntax error if not found + // Get id of types of contacts for tasks (This list never contains a lot of elements) + $listoftaskcontacttype=array(); + $sql = "SELECT ctc.rowid, ctc.code FROM ".MAIN_DB_PREFIX."c_type_contact as ctc"; + $sql.= " WHERE ctc.element = '" . $taskstatic->element . "'"; + $sql.= " AND ctc.source = 'internal'"; + $resql = $db->query($sql); + if ($resql) + { + while($obj = $db->fetch_object($resql)) + { + $listoftaskcontacttype[$obj->rowid]=$obj->code; + } + } + else dol_print_error($db); + if (count($listoftaskcontacttype) == 0) $listoftaskcontacttype[0]='0'; // To avoid sql syntax error if not found + + // Tasks for all resources of all opened projects and time spent for each task/resource $max = (empty($conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA)?1000:$conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA); @@ -376,8 +409,16 @@ if (empty($conf->global->PROJECT_HIDE_TASKS)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t on t.fk_projet = p.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task_time as tasktime on tasktime.fk_task = t.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on tasktime.fk_user = u.rowid"; + if ($mine) + { + $sql.= ", " . MAIN_DB_PREFIX . "element_contact as ect"; + } $sql.= " WHERE p.entity = ".$conf->entity; - if ($mine || empty($user->rights->projet->all->lire)) $sql.= " AND p.rowid IN (".$projectsListId.")"; + if ($mine || empty($user->rights->projet->all->lire)) $sql.= " AND p.rowid IN (".$projectsListId.")"; // project i have permission on + if ($mine) // this may duplicate record if we are contact twice + { + $sql.= " AND ect.fk_c_type_contact IN (".join(',',array_keys($listoftaskcontacttype)).") AND ect.element_id = t.rowid AND ect.fk_socpeople = ".$user->id; + } if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; $sql.= " AND p.fk_statut=1"; $sql.= " GROUP BY p.ref, p.title, p.rowid, t.label, t.rowid, t.planned_workload, t.duration_effective, t.progress, t.dateo, t.datee"; From 15503f12b917629bc7cee091ad3d646dc8ecda39 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 27 Feb 2016 18:29:01 +0100 Subject: [PATCH 19/41] FIX Removed a bugged list. Fixed another one to not count data of previous year. --- htdocs/projet/activity/index.php | 115 ++++++++++++++++--------------- 1 file changed, 59 insertions(+), 56 deletions(-) diff --git a/htdocs/projet/activity/index.php b/htdocs/projet/activity/index.php index 7d87dbae298..480294607f6 100644 --- a/htdocs/projet/activity/index.php +++ b/htdocs/projet/activity/index.php @@ -201,65 +201,68 @@ if ($db->type != 'pgsql') } -// TODO Do not use week function to be compatible with all database +/* if ($db->type != 'pgsql') { + print '
'; + + // Affichage de la liste des projets de la semaine + print ''; + print ''; + print ''; + print ''; + print "\n"; + + $sql = "SELECT p.rowid, p.ref, p.title, SUM(tt.task_duration) as nb"; + $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; + $sql.= " , ".MAIN_DB_PREFIX."projet_task as t"; + $sql.= " , ".MAIN_DB_PREFIX."projet_task_time as tt"; + $sql.= " WHERE t.fk_projet = p.rowid"; + $sql.= " AND p.entity = ".$conf->entity; + $sql.= " AND tt.fk_task = t.rowid"; + $sql.= " AND tt.fk_user = ".$user->id; + $sql.= " AND task_date >= '".dol_get_first_day($year, $month).'" AND ..."; + $sql.= " AND p.rowid in (".$projectsListId.")"; + $sql.= " GROUP BY p.rowid, p.ref, p.title"; + + $resql = $db->query($sql); + if ( $resql ) + { + $total = 0; + $var=true; + + while ($row = $db->fetch_object($resql)) + { + $var=!$var; + print ""; + print ''; + print ''; + print "\n"; + $total += $row->nb; + } + + $db->free($resql); + } + else + { + dol_print_error($db); + } + print ''; + print ''; + print ''; + print "\n"; + print "
'.$langs->trans("ActivityOnProjectThisWeek").''.$langs->trans("Time").'
'; + $projectstatic->id=$row->rowid; + $projectstatic->ref=$row->ref; + $projectstatic->title=$row->title; + print $projectstatic->getNomUrl(1, '', 1); + print ''.convertSecondToTime($row->nb, 'allhourmin').'
'.$langs->trans('Total').''.convertSecondToTime($total, 'allhourmin').'

"; + +} +*/ + print '
'; -/* Affichage de la liste des projets de la semaine */ -print ''; -print ''; -print ''; -print ''; -print "\n"; - -$sql = "SELECT p.rowid, p.ref, p.title, SUM(tt.task_duration) as nb"; -$sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; -$sql.= " , ".MAIN_DB_PREFIX."projet_task as t"; -$sql.= " , ".MAIN_DB_PREFIX."projet_task_time as tt"; -$sql.= " WHERE t.fk_projet = p.rowid"; -$sql.= " AND p.entity = ".$conf->entity; -$sql.= " AND tt.fk_task = t.rowid"; -$sql.= " AND tt.fk_user = ".$user->id; -$sql.= " AND week(task_date) = '".strftime("%W",time())."'"; -$sql.= " AND p.rowid in (".$projectsListId.")"; -$sql.= " GROUP BY p.rowid, p.ref, p.title"; - -$resql = $db->query($sql); -if ( $resql ) -{ - $total = 0; - $var=true; - - while ($row = $db->fetch_object($resql)) - { - $var=!$var; - print ""; - print ''; - print ''; - print "\n"; - $total += $row->nb; - } - - $db->free($resql); -} -else -{ - dol_print_error($db); -} -print ''; -print ''; -print ''; -print "\n"; -print "
'.$langs->trans("ActivityOnProjectThisWeek").''.$langs->trans("Time").'
'; - $projectstatic->id=$row->rowid; - $projectstatic->ref=$row->ref; - $projectstatic->title=$row->title; - print $projectstatic->getNomUrl(1, '', 1); - print ''.convertSecondToTime($row->nb, 'allhourmin').'
'.$langs->trans('Total').''.convertSecondToTime($total, 'allhourmin').'

"; - -} - /* Affichage de la liste des projets du mois */ print ''; print ''; @@ -275,7 +278,7 @@ $sql.= " WHERE t.fk_projet = p.rowid"; $sql.= " AND p.entity = ".$conf->entity; $sql.= " AND tt.fk_task = t.rowid"; $sql.= " AND tt.fk_user = ".$user->id; -$sql.= " AND date_format(task_date,'%y-%m') = '".strftime("%y-%m",$now)."'"; +$sql.= " AND task_date BETWEEN '".dol_get_first_day($year, $month).'" AND "'.dol_get_last_day($year, $month)."'"; $sql.= " AND p.rowid in (".$projectsListId.")"; $sql.= " GROUP BY p.rowid, p.ref, p.title"; From 1038e92354824b5995a89d8dd72f456677a35309 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 27 Feb 2016 18:42:57 +0100 Subject: [PATCH 20/41] FIX sql request and total for time spen for current month --- htdocs/projet/activity/index.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/activity/index.php b/htdocs/projet/activity/index.php index 480294607f6..e9db844a1f7 100644 --- a/htdocs/projet/activity/index.php +++ b/htdocs/projet/activity/index.php @@ -46,6 +46,10 @@ $langs->load("projects"); */ $now = dol_now(); +$tmp=dol_getdate($now); +$day=$tmp['mday']; +$month=$tmp['mon']; +$year=$tmp['year']; $projectstatic=new Project($db); $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1); // Return all projects I have permission on because I want my tasks and some of my task may be on a public projet that is not my project @@ -221,7 +225,7 @@ if ($db->type != 'pgsql') $sql.= " AND p.entity = ".$conf->entity; $sql.= " AND tt.fk_task = t.rowid"; $sql.= " AND tt.fk_user = ".$user->id; - $sql.= " AND task_date >= '".dol_get_first_day($year, $month).'" AND ..."; + $sql.= " AND task_date >= '".$db->idate(dol_get_first_day($year, $month)).'" AND ..."; $sql.= " AND p.rowid in (".$projectsListId.")"; $sql.= " GROUP BY p.rowid, p.ref, p.title"; @@ -278,13 +282,15 @@ $sql.= " WHERE t.fk_projet = p.rowid"; $sql.= " AND p.entity = ".$conf->entity; $sql.= " AND tt.fk_task = t.rowid"; $sql.= " AND tt.fk_user = ".$user->id; -$sql.= " AND task_date BETWEEN '".dol_get_first_day($year, $month).'" AND "'.dol_get_last_day($year, $month)."'"; +$sql.= " AND task_date BETWEEN '".$db->idate(dol_get_first_day($year, $month))."' AND '".$db->idate(dol_get_last_day($year, $month))."'"; $sql.= " AND p.rowid in (".$projectsListId.")"; $sql.= " GROUP BY p.rowid, p.ref, p.title"; $resql = $db->query($sql); if ( $resql ) { + $total = 0; + $var=false; while ($row = $db->fetch_object($resql)) @@ -299,6 +305,7 @@ if ( $resql ) print ''; print "\n"; $var=!$var; + $total += $row->nb; } $db->free($resql); } From 193699a1b3170bc8fac8da49526d069e5f478f93 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 27 Feb 2016 18:47:02 +0100 Subject: [PATCH 21/41] Fix duration format --- htdocs/projet/activity/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/activity/index.php b/htdocs/projet/activity/index.php index e9db844a1f7..d2f2d80bf94 100644 --- a/htdocs/projet/activity/index.php +++ b/htdocs/projet/activity/index.php @@ -502,13 +502,13 @@ if (empty($conf->global->PROJECT_HIDE_TASKS)) print ''; print ''; print ''; print ''; print ''; print ''; print ''; print "\n"; -$sql = "SELECT p.rowid, p.ref, p.title, SUM(tt.task_duration) as nb"; +$sql = "SELECT p.rowid, p.ref, p.title, p.public, SUM(tt.task_duration) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql.= ", ".MAIN_DB_PREFIX."projet_task as t"; $sql.= ", ".MAIN_DB_PREFIX."projet_task_time as tt"; @@ -117,7 +117,7 @@ $sql.= " AND tt.fk_task = t.rowid"; $sql.= " AND tt.fk_user = ".$user->id; $sql.= " AND date_format(task_date,'%y-%m-%d') = '".strftime("%y-%m-%d",$now)."'"; $sql.= " AND p.rowid in (".$projectsListId.")"; -$sql.= " GROUP BY p.rowid, p.ref, p.title"; +$sql.= " GROUP BY p.rowid, p.ref, p.title, p.public"; $resql = $db->query($sql); if ( $resql ) @@ -133,6 +133,7 @@ if ( $resql ) $projectstatic->id=$row->rowid; $projectstatic->ref=$row->ref; $projectstatic->title=$row->title; + $projectstatic->public=$row->public; print $projectstatic->getNomUrl(1, '', 1); print ''; print ''; @@ -163,7 +164,7 @@ if ($db->type != 'pgsql') print ''; print "\n"; - $sql = "SELECT p.rowid, p.ref, p.title, sum(tt.task_duration) as nb"; + $sql = "SELECT p.rowid, p.ref, p.title, p.public, sum(tt.task_duration) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql.= ", ".MAIN_DB_PREFIX."projet_task as t"; $sql.= ", ".MAIN_DB_PREFIX."projet_task_time as tt"; @@ -173,7 +174,7 @@ if ($db->type != 'pgsql') $sql.= " AND tt.fk_user = ".$user->id; $sql.= " AND date_format(date_add(task_date, INTERVAL 1 DAY),'%y-%m-%d') = '".strftime("%y-%m-%d",$now)."'"; $sql.= " AND p.rowid in (".$projectsListId.")"; - $sql.= " GROUP BY p.rowid, p.ref, p.title"; + $sql.= " GROUP BY p.rowid, p.ref, p.title, p.public"; $resql = $db->query($sql); if ( $resql ) @@ -189,6 +190,7 @@ if ($db->type != 'pgsql') $projectstatic->id=$row->rowid; $projectstatic->ref=$row->ref; $projectstatic->title=$row->title; + $projectstatic->public=$row->public; print $projectstatic->getNomUrl(1, '', 1); print ''; print ''; @@ -222,7 +224,7 @@ if ($db->type != 'pgsql') print ''; print "\n"; - $sql = "SELECT p.rowid, p.ref, p.title, SUM(tt.task_duration) as nb"; + $sql = "SELECT p.rowid, p.ref, p.title, p.public, SUM(tt.task_duration) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql.= " , ".MAIN_DB_PREFIX."projet_task as t"; $sql.= " , ".MAIN_DB_PREFIX."projet_task_time as tt"; @@ -248,6 +250,7 @@ if ($db->type != 'pgsql') $projectstatic->id=$row->rowid; $projectstatic->ref=$row->ref; $projectstatic->title=$row->title; + $projectstatic->public=$row->public; print $projectstatic->getNomUrl(1, '', 1); print ''; print ''; @@ -279,7 +282,7 @@ print ''; print "\n"; -$sql = "SELECT p.rowid, p.ref, p.title, SUM(tt.task_duration) as nb"; +$sql = "SELECT p.rowid, p.ref, p.title, p.public, SUM(tt.task_duration) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql.= ", ".MAIN_DB_PREFIX."projet_task as t"; $sql.= ", ".MAIN_DB_PREFIX."projet_task_time as tt"; @@ -289,7 +292,7 @@ $sql.= " AND tt.fk_task = t.rowid"; $sql.= " AND tt.fk_user = ".$user->id; $sql.= " AND task_date BETWEEN '".$db->idate(dol_get_first_day($year, $month))."' AND '".$db->idate(dol_get_last_day($year, $month))."'"; $sql.= " AND p.rowid in (".$projectsListId.")"; -$sql.= " GROUP BY p.rowid, p.ref, p.title"; +$sql.= " GROUP BY p.rowid, p.ref, p.title, p.public"; $resql = $db->query($sql); if ( $resql ) @@ -305,6 +308,7 @@ if ( $resql ) $projectstatic->id=$row->rowid; $projectstatic->ref=$row->ref; $projectstatic->title=$row->title; + $projectstatic->public=$row->public; print $projectstatic->getNomUrl(1, '', 1); print ''; print ''; @@ -333,7 +337,7 @@ if (! empty($conf->global->PROJECT_TASK_TIME_YEAR)) print ''; print "\n"; - $sql = "SELECT p.rowid, p.ref, p.title, SUM(tt.task_duration) as nb"; + $sql = "SELECT p.rowid, p.ref, p.title, p.public, SUM(tt.task_duration) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql.= ", ".MAIN_DB_PREFIX."projet_task as t"; $sql.= ", ".MAIN_DB_PREFIX."projet_task_time as tt"; @@ -343,7 +347,7 @@ if (! empty($conf->global->PROJECT_TASK_TIME_YEAR)) $sql.= " AND tt.fk_user = ".$user->id; $sql.= " AND YEAR(task_date) = '".strftime("%Y",$now)."'"; $sql.= " AND p.rowid in (".$projectsListId.")"; - $sql.= " GROUP BY p.rowid, p.ref, p.title"; + $sql.= " GROUP BY p.rowid, p.ref, p.title, p.public"; $var=false; $resql = $db->query($sql); @@ -356,6 +360,7 @@ if (! empty($conf->global->PROJECT_TASK_TIME_YEAR)) $projectstatic->id=$row->rowid; $projectstatic->ref=$row->ref; $projectstatic->title=$row->title; + $projectstatic->public=$row->public; print $projectstatic->getNomUrl(1, '', 1); print ''; print ''; @@ -418,7 +423,7 @@ if (empty($conf->global->PROJECT_HIDE_TASKS)) $max = (empty($conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA)?1000:$conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA); - $sql = "SELECT p.ref, p.title, p.rowid as projectid, p.fk_statut as status, p.fk_opp_status as opp_status, t.label, t.rowid as taskid, t.planned_workload, t.duration_effective, t.progress, t.dateo, t.datee, SUM(tasktime.task_duration) as timespent"; + $sql = "SELECT p.ref, p.title, p.rowid as projectid, p.fk_statut as status, p.fk_opp_status as opp_status, p.public, t.label, t.rowid as taskid, t.planned_workload, t.duration_effective, t.progress, t.dateo, t.datee, SUM(tasktime.task_duration) as timespent"; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t on t.fk_projet = p.rowid"; @@ -436,7 +441,7 @@ if (empty($conf->global->PROJECT_HIDE_TASKS)) } if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; $sql.= " AND p.fk_statut=1"; - $sql.= " GROUP BY p.ref, p.title, p.rowid, t.label, t.rowid, t.planned_workload, t.duration_effective, t.progress, t.dateo, t.datee"; + $sql.= " GROUP BY p.ref, p.title, p.rowid, p.fk_statut, p.fk_opp_status, p.public, t.label, t.rowid, t.planned_workload, t.duration_effective, t.progress, t.dateo, t.datee"; $sql.= " ORDER BY t.dateo desc, t.rowid desc, t.datee"; $sql.= $db->plimit($max+1); // We want more to know if we have more than limit @@ -484,6 +489,7 @@ if (empty($conf->global->PROJECT_HIDE_TASKS)) $projectstatic->id=$obj->projectid; $projectstatic->ref=$obj->ref; $projectstatic->title=$obj->title; + $projectstatic->public=$obj->public; print $projectstatic->getNomUrl(1,'',16,'','
'); //print ''.$obj->title.''; print ''; From be9a14443326aba7cf21f4fa3eb89039abe1db67 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 28 Feb 2016 12:43:00 +0100 Subject: [PATCH 24/41] FIX Add a test to show bugged module with a bad declaration of dictionaries to avoid to see clean module to be breaked. --- htdocs/core/lib/admin.lib.php | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 12470310ae4..29651b84344 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -591,7 +591,7 @@ function listOfSessions() //$sessValues = 'newtoken|s:32:"1239f7a0c4b899200fe9ca5ea394f307";dol_loginmesg|s:0:"";newtoken|s:32:"1236457104f7ae0f328c2928973f3cb5";dol_loginmesg|s:0:"";token|s:32:"123615ad8d650c5cc4199b9a1a76783f";dol_login|s:5:"admin";dol_authmode|s:8:"dolibarr";dol_tz|s:1:"1";dol_tz_string|s:13:"Europe/Berlin";dol_dst|i:0;dol_dst_observed|s:1:"1";dol_dst_first|s:0:"";dol_dst_second|s:0:"";dol_screenwidth|s:4:"1920";dol_screenheight|s:3:"971";dol_company|s:12:"MyBigCompany";dol_entity|i:1;mainmenu|s:4:"home";leftmenuopened|s:10:"admintools";idmenu|s:0:"";leftmenu|s:10:"admintools";'; if (preg_match('/dol_login/i',$sessValues) && // limit to dolibarr session - (preg_match('/dol_entity\|i:'.$conf->entity.';/i',$sessValues) || preg_match('/dol_entity\|s:([0-9]+):"'.$conf->entity.'"/i',$sessValues)) && // limit to current entity + (preg_match('/dol_entity\|i:'.$conf->entity.';/i',$sessValues) || preg_match('/dol_entity\|s:([0-9]+):"'.$conf->entity.'"/i',$sessValues)) && // limit to current entity preg_match('/dol_company\|s:([0-9]+):"('.$conf->global->MAIN_INFO_SOCIETE_NOM.')"/i',$sessValues)) // limit to company name { $tmp=explode('_', $file); @@ -982,21 +982,29 @@ function complete_dictionary_with_modules(&$taborder,&$tabname,&$tablib,&$tabsql //var_dump($objMod->dictionaries['tabname']); $taborder[] = 0; $tabfieldcheck[] = array(); $tabhelp[] = array(); + $nbtabname=$nbtablib=$nbtabsql=$nbtabsqlsort=$nbtabfield=$nbtabfieldvalue=$nbtabfieldinsert=$nbtabrowid=$nbtabcond=$nbtabfieldcheck=$nbtabhelp=0; foreach($objMod->dictionaries['tabname'] as $val) { $taborder[] = count($tabname)+1; + $nbtabname++; $tabname[] = $val; } - foreach($objMod->dictionaries['tablib'] as $val) $tablib[] = $val; - foreach($objMod->dictionaries['tabsql'] as $val) $tabsql[] = $val; - foreach($objMod->dictionaries['tabsqlsort'] as $val) $tabsqlsort[] = $val; - foreach($objMod->dictionaries['tabfield'] as $val) $tabfield[] = $val; - foreach($objMod->dictionaries['tabfieldvalue'] as $val) $tabfieldvalue[] = $val; - foreach($objMod->dictionaries['tabfieldinsert'] as $val) $tabfieldinsert[] = $val; - foreach($objMod->dictionaries['tabrowid'] as $val) $tabrowid[] = $val; - foreach($objMod->dictionaries['tabcond'] as $val) $tabcond[] = $val; - if (! empty($objMod->dictionaries['tabfieldcheck'])) foreach($objMod->dictionaries['tabfieldcheck'] as $val) $tabfieldcheck[] = $val; - if (! empty($objMod->dictionaries['tabhelp'])) foreach($objMod->dictionaries['tabhelp'] as $val) $tabhelp[] = $val; + foreach($objMod->dictionaries['tablib'] as $val) { $nbtablib++; $tablib[] = $val; } + foreach($objMod->dictionaries['tabsql'] as $val) { $nbtabsql++; $tabsql[] = $val; } + foreach($objMod->dictionaries['tabsqlsort'] as $val) { $nbtabsqlsort++; $tabsqlsort[] = $val; } + foreach($objMod->dictionaries['tabfield'] as $val) { $nbtabfield++; $tabfield[] = $val; } + foreach($objMod->dictionaries['tabfieldvalue'] as $val) { $nbtabfieldvalue++; $tabfieldvalue[] = $val; } + foreach($objMod->dictionaries['tabfieldinsert'] as $val) { $nbtabfieldinsert++; $tabfieldinsert[] = $val; } + foreach($objMod->dictionaries['tabrowid'] as $val) { $nbtabrowid++; $tabrowid[] = $val; } + foreach($objMod->dictionaries['tabcond'] as $val) { $nbtabcond++; $tabcond[] = $val; } + if (! empty($objMod->dictionaries['tabfieldcheck'])) foreach($objMod->dictionaries['tabfieldcheck'] as $val) { $nbtabfieldcheck++; $tabfieldcheck[] = $val; } + if (! empty($objMod->dictionaries['tabhelp'])) foreach($objMod->dictionaries['tabhelp'] as $val) { $nbtabhelp++; $tabhelp[] = $val; } + + if ($nbtabname != $nbtablib || $nbtablib != $nbtabsql || $nbtabsql != $nbtabsqlsort) + { + print 'Error in descriptor of module '.$const_name.'. Array ->dictionaries has not same number of record for key "tabname", "tablib", "tabsql" and "tabsqlsort"'; + //print "$const_name: $nbtabname=$nbtablib=$nbtabsql=$nbtabsqlsort=$nbtabfield=$nbtabfieldvalue=$nbtabfieldinsert=$nbtabrowid=$nbtabcond=$nbtabfieldcheck=$nbtabhelp\n"; + } //foreach($objMod->dictionaries['tabsqlsort'] as $val) $tablib[] = $val; //$tabname = array_merge ($tabname, $objMod->dictionaries['tabname']); //var_dump($tabcond); From b7e0faa332f82eab0f040f4443c52b3b44878a7d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 28 Feb 2016 14:01:21 +0100 Subject: [PATCH 25/41] More complete css --- htdocs/theme/eldy/style.css.php | 4 ++++ htdocs/theme/md/style.css.php | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index e1f58616f36..310da9087aa 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -520,10 +520,14 @@ div.myavailability { .minwidth100 { min-width: 100px; } .minwidth200 { min-width: 200px; } .minwidth300 { min-width: 300px; } +.minwidth400 { min-width: 400px; } +.minwidth500 { min-width: 500px; } .maxwidth100 { max-width: 100px; } .maxwidth150 { max-width: 150px; } .maxwidth200 { max-width: 200px; } .maxwidth300 { max-width: 300px; } +.maxwidth400 { max-width: 400px; } +.maxwidth500 { max-width: 500px; } .titlefield { width: 30%; } .hideonsmartphone { display: none; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index baa772e85dd..38ac3d13c1e 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -516,10 +516,14 @@ div.myavailability { .minwidth100 { min-width: 100px; } .minwidth200 { min-width: 200px; } .minwidth300 { min-width: 300px; } +.minwidth400 { min-width: 400px; } +.minwidth500 { min-width: 500px; } .maxwidth100 { max-width: 100px; } .maxwidth150 { max-width: 150px; } .maxwidth200 { max-width: 200px; } .maxwidth300 { max-width: 300px; } +.maxwidth400 { max-width: 400px; } +.maxwidth500 { max-width: 500px; } .titlefield { width: 30%; } .hideonsmartphone { display: none; } From 4b28dadd6e87e227fd56a2b4ac83f45cbea77c32 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 28 Feb 2016 14:44:09 +0100 Subject: [PATCH 26/41] More complete instruction to convert image to theme --- htdocs/theme/eldy/img/menus/README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/theme/eldy/img/menus/README.md b/htdocs/theme/eldy/img/menus/README.md index 12cd9da537a..3b04bafbc9b 100644 --- a/htdocs/theme/eldy/img/menus/README.md +++ b/htdocs/theme/eldy/img/menus/README.md @@ -4,9 +4,10 @@ Tutorial to create a new image for menu: 1) First find an image. 2) With Gimp, open image and check there is a alpha channel. If not add one. 3) Convert image into back and white (Menu Image - Mode - Grey levels). -4) Use the degrade tool with option: -* Erase color +4) Use the degrade tool with option (Menu Tools - Paint - Degrade - CTRL+L): +* Mode: Erase color (you can also try "Elear only") * Opacity: 50 +/- * Offset: 0 * Shape: Linear +* Select on image top of file and drag to bottom. Il est possible aussi d'augmenter la transparence globale depuis le calque. From 77490bff713824d7d7ccecf7dc2d41dad52b3c51 Mon Sep 17 00:00:00 2001 From: fmarcet Date: Mon, 29 Feb 2016 10:07:48 +0100 Subject: [PATCH 27/41] FIX: Status filter don't work --- htdocs/fourn/facture/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index a02f2f78440..8704e781a30 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -304,7 +304,7 @@ if ($resql) print ''; print ''; } + // Alias names (commercial, trademark or alias names) + print ''; + print ''; + // Prospect/Customer print ''; print ''; } - // Alias names (commercial, trademark or alias names) - print ''; - print ''; - // Address print ''; print '
'.convertSecondToTime($row->nb, 'allhourmin').'
'.dol_print_date($db->jdate($obj->dateo),'day').''.dol_print_date($db->jdate($obj->datee),'day').''; - print convertSecondToTime($obj->planned_workload, 'all'); + print convertSecondToTime($obj->planned_workload, 'allhourmin'); print ''; print ($obj->taskid>0)?$obj->progress.'%':''; print ''; - print convertSecondToTime($obj->timespent, 'all'); + print convertSecondToTime($obj->timespent, 'allhourmin'); print ''; if (! empty($obj->taskid)) From 6b7551c5d279ef943ed01adeb9299230dba01c79 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 27 Feb 2016 19:12:45 +0100 Subject: [PATCH 22/41] Fix: Introduce hidden option to disable feature than hangs when too much data --- htdocs/projet/activity/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/activity/index.php b/htdocs/projet/activity/index.php index d2f2d80bf94..31c1e950ea7 100644 --- a/htdocs/projet/activity/index.php +++ b/htdocs/projet/activity/index.php @@ -375,7 +375,7 @@ if (! empty($conf->global->PROJECT_TASK_TIME_YEAR)) print '
'; -if (empty($conf->global->PROJECT_HIDE_TASKS)) +if (empty($conf->global->PROJECT_HIDE_TASKS) && empty($conf->global->PROJECT_HIDE_LIST_HOME_AREA)) { // Get id of types of contacts for projects (This list never contains a lot of elements) $listofprojectcontacttype=array(); From 39d6d16c029a895f596a3f37d2f19c3226a8105c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 27 Feb 2016 19:20:11 +0100 Subject: [PATCH 23/41] Fix bad picto "shared project" --- htdocs/projet/activity/index.php | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/htdocs/projet/activity/index.php b/htdocs/projet/activity/index.php index c565dff3352..5950f7ab43b 100644 --- a/htdocs/projet/activity/index.php +++ b/htdocs/projet/activity/index.php @@ -107,7 +107,7 @@ print '
'.$langs->trans('ActivityOnProjectToday').''.$langs->trans("Time").'
'.convertSecondToTime($row->nb, 'allhourmin').''.$langs->trans("Time").'
'.convertSecondToTime($row->nb, 'allhourmin').''.$langs->trans("Time").'
'.convertSecondToTime($row->nb, 'allhourmin').''.$langs->trans("ActivityOnProjectThisMonth").': '.dol_print_date($no print ''.$langs->trans("Time").'
'.convertSecondToTime($row->nb, 'allhourmin').''.$langs->trans("Time").'
'.convertSecondToTime($row->nb, 'allhourmin').''; $liststatus=array('0'=>$langs->trans("Draft"),'1'=>$langs->trans("Unpaid"), '2'=>$langs->trans("Paid")); - print $form->selectarray('filtre', $liststatus, $search_status, 1); + print $form->selectarray('search_status', $liststatus, $search_status, 1); print ''; print ''; print ''; From 21c7aacddb1cb7b963503acaf9ecbb2ecafe47b9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 29 Feb 2016 10:22:38 +0100 Subject: [PATCH 28/41] Fix add hidden option INVOICE_DEFAULT_UNPAYED_SORT_ORDER to be able to provide backward compatibility with old behaviour. --- htdocs/compta/facture/list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 8f7b805f4d5..fd0a61b638f 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -83,6 +83,7 @@ if ($page == -1) { $page = 0; } $offset = $limit * $page; +if (! $sortorder && ! empty($conf->global->INVOICE_DEFAULT_UNPAYED_SORT_ORDER) && $search_status == 1) $sortorder=$conf->global->INVOICE_DEFAULT_UNPAYED_SORT_ORDER; if (! $sortorder) $sortorder='DESC'; if (! $sortfield) $sortfield='f.datef'; From d2c71fbf8f8ee7354e2d22268c72a0adb1c447d1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 29 Feb 2016 10:35:18 +0100 Subject: [PATCH 29/41] Fix alias name was visible twice. --- htdocs/societe/soc.php | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index dc2d6b6a516..c4fb84fa30f 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -980,6 +980,10 @@ else print ' 
'.fieldLabel('ProspectCustomer','customerprospect',1).'
'.fieldLabel('Address','address').'