From 606674d8c852f29ac4c3acfb79bd6ecac624e0c3 Mon Sep 17 00:00:00 2001 From: simnandez Date: Fri, 13 Jul 2012 15:28:25 +0200 Subject: [PATCH 1/3] Fix: Bad local taxes if price base type is TTC Conflicts: htdocs/core/lib/price.lib.php --- htdocs/core/lib/price.lib.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/htdocs/core/lib/price.lib.php b/htdocs/core/lib/price.lib.php index 11161c32258..89cb4512d13 100644 --- a/htdocs/core/lib/price.lib.php +++ b/htdocs/core/lib/price.lib.php @@ -94,14 +94,16 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $txlocalta //Local taxes if ($txlocaltax1>0) { - $result[14] = price2num(($tot_sans_remise * (1 + ( $txlocaltax1 / 100))) - $tot_sans_remise, 'MT'); + + $result[14] = price2num(($result[6] * ( 1 + ( $txlocaltax1 / 100))) - $result[6], 'MT'); $result[8] = price2num($result[8] + $result[14], 'MT'); - $result[9] = price2num(($tot_avec_remise * (1 + ( $txlocaltax1 / 100))) - $tot_avec_remise, 'MT'); + $result[9] = price2num(($result[0] * ( 1 + ( $txlocaltax1 / 100))) - $result[0], 'MT'); $result[2] = price2num($result[2] + $result[9], 'MT'); - $result[11] = price2num(($pu * (1 + ( $txlocaltax1 / 100))) - $pu, 'MT'); + $result[11] = price2num(($result[3] * ( 1 + ( $txlocaltax1 / 100))) - $pu, 'MT'); $result[5] = price2num($result[5] + $result[11], 'MT'); + } else { @@ -111,10 +113,11 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $txlocalta } if ($txlocaltax2>0) - { - $result[15] = price2num(($tot_sans_remise * (1 + ( $txlocaltax2 / 100))) - $tot_sans_remise, 'MT'); - $result[10] = price2num(($tot_avec_remise * (1 + ( $txlocaltax2 / 100))) - $tot_avec_remise, 'MT'); - $result[12] = price2num(($pu * (1 + ( $txlocaltax2 / 100))) - $pu, 'MT'); + + { + $result[15] = price2num(($result[6] * ( 1 + ( $txlocaltax2 / 100))) - $result[6], 'MT'); + $result[10] = price2num(($result[0] * ( 1 + ( $txlocaltax2 / 100))) - $result[0], 'MT'); + $result[12] = price2num(($result[3] * ( 1 + ( $txlocaltax2 / 100))) - $pu, 'MT'); //If Country is Spain, localtax2 (IRPF) will be subtracted if ($mysoc->country_code=='ES') From b8338425f4b65b5720c61d67bb36beca7a384445 Mon Sep 17 00:00:00 2001 From: simnandez Date: Fri, 13 Jul 2012 15:46:42 +0200 Subject: [PATCH 2/3] Trad: Add missing translations --- htdocs/langs/ca_ES/admin.lang | 2 +- htdocs/langs/ca_ES/errors.lang | 1 + htdocs/langs/ca_ES/sendings.lang | 2 ++ htdocs/langs/ca_ES/workflow.lang | 4 +++- htdocs/langs/es_ES/admin.lang | 2 +- htdocs/langs/es_ES/errors.lang | 1 + htdocs/langs/es_ES/sendings.lang | 2 ++ htdocs/langs/es_ES/workflow.lang | 4 +++- 8 files changed, 14 insertions(+), 4 deletions(-) diff --git a/htdocs/langs/ca_ES/admin.lang b/htdocs/langs/ca_ES/admin.lang index c66b15054e6..bb468f8eb1a 100644 --- a/htdocs/langs/ca_ES/admin.lang +++ b/htdocs/langs/ca_ES/admin.lang @@ -670,7 +670,7 @@ DictionnarySocialContributions=Tipus de càrregues socials DictionnaryVAT=Taxa d'IVA (Impost sobre vendes als EEUU) DictionnaryPaymentConditions=Condicions de pagament DictionnaryPaymentModes=Modes de pagament -DictionnaryTypeContact=Tipus de contactes +DictionnaryTypeContact=Tipus de contactes/adreces DictionnaryEcotaxe=Barems CEcoParticipación (DEEE) DictionnaryPaperFormat=Formats paper DictionnaryFees=Tipus de desplaçaments i honoraris diff --git a/htdocs/langs/ca_ES/errors.lang b/htdocs/langs/ca_ES/errors.lang index 64b3cbb97be..44668eddf64 100644 --- a/htdocs/langs/ca_ES/errors.lang +++ b/htdocs/langs/ca_ES/errors.lang @@ -109,6 +109,7 @@ ErrUnzipFails=No s'ha pogut descomprimir el fitxer %s amb ZipArchive ErrNoZipEngine=En aquest PHP no hi ha motor per descomprimir l'arxiu %s ErrorFileMustBeADolibarrPackage=El fitxer %s ha de ser un paquet Dolibarr en format zip ErrorFileRequired=Es requereix un fitxer de paquet Dolibarr en format zip +ErrorPhpCurlNotInstalled=L'extensió PHP CURL no es troba instal·lada, és indispensable per dialogar amb Paypal. # Warnings WarningSafeModeOnCheckExecDir=Atenció, està activada l'opció PHP safe_mode, la comanda ha d'estar dins d'un directori declarat dins del paràmetre php safe_mode_exec_dir. diff --git a/htdocs/langs/ca_ES/sendings.lang b/htdocs/langs/ca_ES/sendings.lang index 70facdbf280..df64623f238 100644 --- a/htdocs/langs/ca_ES/sendings.lang +++ b/htdocs/langs/ca_ES/sendings.lang @@ -57,6 +57,8 @@ SendShippingRef=Enviament d'expedició %s ActionsOnShipping=Events sobre l'expedició LinkToTrackYourPackage=Enllaç per al seguiment del seu paquet ShipmentCreationIsDoneFromOrder=De moment, la creació d'una nova expedició es realitza des de la fitxa de comanda. +RelatedShippings=Expedició(ns) associades + # Sending methods SendingMethodCATCH=Recollit pel client SendingMethodTRANS=Transportista diff --git a/htdocs/langs/ca_ES/workflow.lang b/htdocs/langs/ca_ES/workflow.lang index f081bc94233..c55f3d72614 100644 --- a/htdocs/langs/ca_ES/workflow.lang +++ b/htdocs/langs/ca_ES/workflow.lang @@ -6,4 +6,6 @@ ThereIsNoWorkflowToModify=No hi ha workflow modificable per als mòduls que té descWORKFLOW_PROPAL_AUTOCREATE_ORDER=Crear una comanda de client automàticament a la signatura d'un pressupost descWORKFLOW_PROPAL_AUTOCREATE_INVOICE=Crear una factura a client automàticament a la signatura d'un pressupost descWORKFLOW_CONTRACT_AUTOCREATE_INVOICE=Crear una factura a client automàticament a la validació d'un contracte -descWORKFLOW_ORDER_AUTOCREATE_INVOICE=Crear una factura a client automàticament al tancament d'una comanda de client \ No newline at end of file +descWORKFLOW_ORDER_AUTOCREATE_INVOICE=Crear una factura a client automàticament al tancament d'una comanda de client +descWORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL=Clasificar como facturado el presupuesto al mismo tiempo que el pedido +descWORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER=Clasificar como facturados los pedidos al mismo tiempo que la factura \ No newline at end of file diff --git a/htdocs/langs/es_ES/admin.lang b/htdocs/langs/es_ES/admin.lang index 0f5c7ee124b..96126531a54 100644 --- a/htdocs/langs/es_ES/admin.lang +++ b/htdocs/langs/es_ES/admin.lang @@ -670,7 +670,7 @@ DictionnarySocialContributions=Tipos de cargas sociales DictionnaryVAT=Tasa de IVA (Impuesto sobre ventas en EEUU) DictionnaryPaymentConditions=Condiciones de pago DictionnaryPaymentModes=Modos de pago -DictionnaryTypeContact=Tipos de contactos +DictionnaryTypeContact=Tipos de contactos/direcciones DictionnaryEcotaxe=Baremos CEcoParticipación (DEEE) DictionnaryPaperFormat=Formatos papel DictionnaryFees=Tipo de desplazamientos y honorarios diff --git a/htdocs/langs/es_ES/errors.lang b/htdocs/langs/es_ES/errors.lang index c60421b87cb..200cede7c8f 100644 --- a/htdocs/langs/es_ES/errors.lang +++ b/htdocs/langs/es_ES/errors.lang @@ -109,6 +109,7 @@ ErrUnzipFails=No se ha podido descomprimir el archivo %s con ZipArchive ErrNoZipEngine=En este PHP no hay motor para descomprimir el archivo %s ErrorFileMustBeADolibarrPackage=El archivo %s debe ser un paquete Dolibarr en formato zip ErrorFileRequired=Se requiere un archivo de paquete Dolibarr en formato zip +ErrorPhpCurlNotInstalled=La extensión PHP CURL no se encuentra instalada, es indispensable para dialogar con Paypal. # Warnings WarningSafeModeOnCheckExecDir=Atención, está activada la opción PHP safe_mode, el comando deberá estar dentro de un directorio declarado dentro del parámetro php safe_mode_exec_dir. diff --git a/htdocs/langs/es_ES/sendings.lang b/htdocs/langs/es_ES/sendings.lang index 861c49439dd..113af44ba93 100644 --- a/htdocs/langs/es_ES/sendings.lang +++ b/htdocs/langs/es_ES/sendings.lang @@ -57,6 +57,8 @@ SendShippingRef=Envío expedición %s ActionsOnShipping=Eventos sobre la expedición LinkToTrackYourPackage=Enlace para el seguimento de su paquete ShipmentCreationIsDoneFromOrder=De momento, la creación de una nueva expedición se realiza desde la ficha de pedido. +RelatedShippings=Expedición(es) asociada(s) + # Sending methods SendingMethodCATCH=Recogido por el cliente SendingMethodTRANS=Transportista diff --git a/htdocs/langs/es_ES/workflow.lang b/htdocs/langs/es_ES/workflow.lang index 057790f2223..d6f1677fbc5 100644 --- a/htdocs/langs/es_ES/workflow.lang +++ b/htdocs/langs/es_ES/workflow.lang @@ -6,4 +6,6 @@ ThereIsNoWorkflowToModify=No hay workflow modificable para los módulos que tien descWORKFLOW_PROPAL_AUTOCREATE_ORDER=Crear un pedido de cliente automáticamente a la firma de un presupuesto descWORKFLOW_PROPAL_AUTOCREATE_INVOICE=Crear una factura a cliente automáticamente a la firma de un presupuesto descWORKFLOW_CONTRACT_AUTOCREATE_INVOICE=Crear una factura a cliente automáticamente a la validación de un contrato -descWORKFLOW_ORDER_AUTOCREATE_INVOICE=Crear una factura a cliente automáticamente al cierre de un pedido de cliente \ No newline at end of file +descWORKFLOW_ORDER_AUTOCREATE_INVOICE=Crear una factura a cliente automáticamente al cierre de un pedido de cliente +descWORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL=Clasificar como facturado el presupuesto al mismo tiempo que el pedido +descWORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER=Clasificar como facturados los pedidos al mismo tiempo que la factura \ No newline at end of file From 4f458c01f4cb780f6f1294c5f98fbabc0afc7773 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 13 Jul 2012 16:21:59 +0200 Subject: [PATCH 3/3] Fix: missing entity filter --- htdocs/fourn/facture/impayees.php | 3 ++- htdocs/fourn/facture/index.php | 6 ++++-- htdocs/fourn/facture/paiement.php | 34 ++++++++++++++++--------------- 3 files changed, 24 insertions(+), 19 deletions(-) diff --git a/htdocs/fourn/facture/impayees.php b/htdocs/fourn/facture/impayees.php index 709f2079bcf..6a51edc9c2e 100644 --- a/htdocs/fourn/facture/impayees.php +++ b/htdocs/fourn/facture/impayees.php @@ -98,7 +98,8 @@ if ($user->rights->fournisseur->facture->lire) if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= ",".MAIN_DB_PREFIX."facture_fourn as f"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf ON f.rowid=pf.fk_facturefourn "; - $sql.= " WHERE f.fk_soc = s.rowid"; + $sql.= " WHERE f.entity = ".$conf->entity; + $sql.= " AND f.fk_soc = s.rowid"; $sql.= " AND f.paye = 0 AND f.fk_statut = 1"; if ($option == 'late') $sql.=" AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->fournisseur->warning_delay)."'"; if (! $user->rights->societe->client->voir && ! $socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; diff --git a/htdocs/fourn/facture/index.php b/htdocs/fourn/facture/index.php index a6e7631fe6e..074fff441ec 100644 --- a/htdocs/fourn/facture/index.php +++ b/htdocs/fourn/facture/index.php @@ -72,7 +72,8 @@ if ($mode == 'search') if ($modesearch == 'soc') { $sql = "SELECT s.rowid FROM ".MAIN_DB_PREFIX."societe as s "; - $sql.= " WHERE s.nom like '%".$db->escape(strtolower($socname))."%'"; + $sql.= " WHERE s.nom LIKE '%".$db->escape(strtolower($socname))."%'"; + $sql.= " AND s.entity IN (".getEntity('societe', 1).")"; } $resql=$db->query($sql); @@ -106,7 +107,8 @@ $sql.= " fac.total_ht, fac.total_ttc, fac.paye as paye, fac.fk_statut as fk_stat if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as fac"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; -$sql.= " WHERE fac.fk_soc = s.rowid"; +$sql.= " WHERE fac.entity = ".$conf->entity; +$sql.= " AND fac.fk_soc = s.rowid"; if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid) { diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 1024a16c8f9..3852c19620d 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -1,9 +1,10 @@ - * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2004-2012 Laurent Destailleur - * Copyright (C) 2004 Christophe Combelles - * Copyright (C) 2005 Marc Barilley / Ocebo +/* Copyright (C) 2003-2005 Rodolphe Quiedeville + * Copyright (C) 2004 Eric Seigne + * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2004 Christophe Combelles + * Copyright (C) 2005 Marc Barilley / Ocebo + * Copyright (C) 2005-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -193,10 +194,10 @@ if ($action == 'create' || $action == 'add_paiement') $sql = 'SELECT s.nom, s.rowid as socid,'; $sql.= ' f.rowid as ref, f.facnumber, f.amount, f.total_ttc as total'; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; - $sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'facture_fourn as f'; + $sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'facture_fourn as f'; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql .= ' WHERE f.fk_soc = s.rowid'; - $sql .= ' AND f.rowid = '.$facid; + $sql.= ' WHERE f.fk_soc = s.rowid'; + $sql.= ' AND f.rowid = '.$facid; if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; $resql = $db->query($sql); if ($resql) @@ -254,13 +255,14 @@ if ($action == 'create' || $action == 'add_paiement') * Autres factures impayees */ $sql = 'SELECT f.rowid as facid,f.rowid as ref,f.facnumber,f.total_ttc, f.datef as df'; - $sql .= ', sum(pf.amount) as am'; - $sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as f'; - $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON pf.fk_facturefourn = f.rowid'; - $sql .= ' WHERE f.fk_soc = '.$facture->socid; - $sql .= ' AND f.paye = 0'; - $sql .= ' AND f.fk_statut = 1'; // Statut=0 => non validee, Statut=2 => annulee - $sql .= ' GROUP BY f.rowid,f.facnumber,f.total_ttc,f.datef'; + $sql.= ', sum(pf.amount) as am'; + $sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as f'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON pf.fk_facturefourn = f.rowid'; + $sql.= " WHERE f.entity = ".$conf->entity; + $sql.= ' AND f.fk_soc = '.$facture->socid; + $sql.= ' AND f.paye = 0'; + $sql.= ' AND f.fk_statut = 1'; // Statut=0 => non validee, Statut=2 => annulee + $sql.= ' GROUP BY f.rowid,f.facnumber,f.total_ttc,f.datef'; $resql = $db->query($sql); if ($resql) { @@ -370,7 +372,7 @@ if (! $_GET['action'] && ! $_POST['action']) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe AS s ON s.rowid = f.fk_soc'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON b.fk_account = ba.rowid'; - $sql.= ' WHERE 1=1'; + $sql.= " WHERE f.entity = ".$conf->entity; if (!$user->rights->societe->client->voir) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid) {