From ed4b69d0ab7974bfc79c451d1911395edf6d1546 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Mon, 17 Mar 2014 20:36:45 +0100 Subject: [PATCH 1/8] Update language key --- htdocs/langs/fr_FR/bills.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/fr_FR/bills.lang b/htdocs/langs/fr_FR/bills.lang index 7602dd3d37d..c994343289c 100644 --- a/htdocs/langs/fr_FR/bills.lang +++ b/htdocs/langs/fr_FR/bills.lang @@ -64,7 +64,7 @@ ConfirmDeletePayment=Êtes-vous sûr de vouloir supprimer ce paiement ? ConfirmConvertToReduc=Voulez-vous convertir cet avoir ou acompte en réduction future ?
Le montant sera alors stocké en réduction fixe en attente pour le client. Cette dernière pourra être utilisée pour réduire le montant d'une facture en cours ou prochaine de ce client. SupplierPayments=Règlements fournisseurs ReceivedPayments=Règlements reçus -ReceivedCustomersPayments=Règlements reçus du client +ReceivedCustomersPayments=Règlements reçus des clients PayedSuppliersPayments=Paiements aux fournisseurs ReceivedCustomersPaymentsToValid=Règlements clients reçus à valider PaymentsReportsForYear=Rapports de règlements pour %s From 4d6d7c19b2367167cd2bd6448afc18ed77a24af1 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Mon, 17 Mar 2014 21:47:06 +0100 Subject: [PATCH 2/8] Correct typo --- htdocs/compta/paiement/liste.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/paiement/liste.php b/htdocs/compta/paiement/liste.php index 32400cf29cc..70cba5d80d0 100644 --- a/htdocs/compta/paiement/liste.php +++ b/htdocs/compta/paiement/liste.php @@ -60,7 +60,7 @@ if (! $sortfield) $sortfield="p.rowid"; * View */ -llxHeader('',$langs->trans("ListPayment")); +llxHeader('', $langs->trans('ListPayment')); $form=new Form($db); From a7c97cc71a9dc200b6d0b1184727cb3aba0e185b Mon Sep 17 00:00:00 2001 From: aspangaro Date: Mon, 17 Mar 2014 21:51:31 +0100 Subject: [PATCH 3/8] Add title in list of supplier payments --- htdocs/fourn/facture/paiement.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 18334fcf93c..760874b7008 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -34,6 +34,7 @@ require DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php'; $langs->load('companies'); $langs->load('bills'); $langs->load('banks'); +$langs->load('compta'); $action = GETPOST('action','alpha'); $confirm = GETPOST('confirm'); @@ -232,7 +233,7 @@ if ($action == 'confirm_paiement' && $confirm == 'yes') $supplierstatic=new Societe($db); $invoicesupplierstatic = new FactureFournisseur($db); -llxHeader(); +llxHeader('', $langs->trans('ListPayment')); $form=new Form($db); From 58796b85c891b9ffc96646c70fd12f798567a377 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Tue, 18 Mar 2014 06:53:45 +0100 Subject: [PATCH 4/8] Try to correct travis --- htdocs/fourn/facture/paiement.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 760874b7008..3c37e3cf07c 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -233,7 +233,7 @@ if ($action == 'confirm_paiement' && $confirm == 'yes') $supplierstatic=new Societe($db); $invoicesupplierstatic = new FactureFournisseur($db); -llxHeader('', $langs->trans('ListPayment')); +llxHeader('',$langs->trans('ListPayment')); $form=new Form($db); From 9be52ca2c854e616439185464ac8057c537f32d1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Mar 2014 22:16:18 +0100 Subject: [PATCH 5/8] Fix: better way to remove duplicate barcode in repair.sql --- htdocs/install/mysql/migration/repair.sql | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 3cd1f430f9b..1436b125029 100644 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -103,16 +103,18 @@ update llx_opensurvey_sondage set format = 'A' where format = 'A+'; -- ALTER TABLE llx_facture_fourn ALTER COLUMN fk_cond_reglement DROP NOT NULL; --- Sequence to removed duplicated values of barcode. Use serveral times if you still have duplicate. -create table tmp_product as (select * from llx_product); -select barcode, max(rowid) from tmp_product where barcode is not null group by barcode having count(rowid) >= 2; -update llx_product set barcode = null where barcode is not null and (barcode, rowid) in (select barcode, max(rowid) from tmp_product where barcode is not null group by barcode having count(rowid) >= 2); -drop table tmp_product; +-- Sequence to removed duplicated values of barcode in llx_product. Use serveral times if you still have duplicate. +--select barcode, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_product where barcode is not null group by barcode having count(rowid) >= 2; +create table tmp_product_double as (select barcode, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_product where barcode is not null group by barcode having count(rowid) >= 2); +--select * from tmp_product_double; +update llx_product set barcode = null where (rowid, barcode) in (select max_rowid, barcode from tmp_product_double); +drop table tmp_product_double; --- Sequence to removed duplicated values of barcode. Use serveral times if you still have duplicate. -create table tmp_societe as (select * from llx_societe); -select barcode, max(rowid) from tmp_societe where barcode is not null group by barcode having count(rowid) >= 2; -update llx_societe set barcode = null where barcode is not null and (barcode, rowid) in (select barcode, max(rowid) from tmp_societe where barcode is not null group by barcode having count(rowid) >= 2); -drop table tmp_societe; +-- Sequence to removed duplicated values of barcode in llx_societe. Use serveral times if you still have duplicate. +--select barcode, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_societe where barcode is not null group by barcode having count(rowid) >= 2; +create table tmp_societe_double as (select barcode, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_societe where barcode is not null group by barcode having count(rowid) >= 2); +--select * from tmp_societe_double; +update llx_societe set barcode = null where (rowid, barcode) in (select max_rowid, barcode from tmp_societe_double); +drop table tmp_societe_double; From 3030c2f4315ba820ea7c4f2beef88097a8dce2bf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Mar 2014 22:24:57 +0100 Subject: [PATCH 6/8] Fix: form to add images should not show link form --- htdocs/product/photos.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/photos.php b/htdocs/product/photos.php index 864b36c3149..34a2e836599 100644 --- a/htdocs/product/photos.php +++ b/htdocs/product/photos.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2009 Laurent Destailleur + * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005 Eric Seigne * Copyright (C) 2005-2012 Regis Houssin * @@ -162,7 +162,7 @@ if ($object->id) { // Affiche formulaire upload $formfile=new FormFile($db); - $formfile->form_attach_new_file($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans("AddPhoto"), 1, 0, 1, 50, $object, '', false); // ajax=false for the moment. true may not work. + $formfile->form_attach_new_file($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans("AddPhoto"), 1, 0, ($user->rights->produit->creer || $user->rights->service->creer), 50, $object, '', false, '', 0); // ajax=false for the moment. true may not work. } // Affiche photos From ce4c78972af32ce47f8ac535e03f23e2b25f1a12 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Mar 2014 23:24:00 +0100 Subject: [PATCH 7/8] Fix: Image always fit into window when using cropping feature even if file is a very large file. --- htdocs/core/js/lib_photosresize.js | 22 +++++--- htdocs/core/photos_resize.php | 88 ++++++++++++++++-------------- 2 files changed, 62 insertions(+), 48 deletions(-) diff --git a/htdocs/core/js/lib_photosresize.js b/htdocs/core/js/lib_photosresize.js index 94c7ffa2a33..6847de0bd54 100644 --- a/htdocs/core/js/lib_photosresize.js +++ b/htdocs/core/js/lib_photosresize.js @@ -1,4 +1,4 @@ -// Copyright (C) 2009 Laurent Destailleur +// Copyright (C) 2009-2014 Laurent Destailleur // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -19,23 +19,29 @@ // \brief File that include javascript functions for croping feature // +/* Enable jcrop plugin onto id cropbox */ jQuery(function() { jQuery('#cropbox').Jcrop({ onSelect: updateCoords, onChange: updateCoords }); }); - + +/* Update fields that store new size */ function updateCoords(c) { - jQuery('#x').val(c.x); - jQuery('#y').val(c.y); - jQuery('#x2').val(c.x2); - jQuery('#y2').val(c.y2); - jQuery('#w').val(c.w); - jQuery('#h').val(c.h); + //alert(parseInt(jQuery("#ratioforcrop").val())); + ratio=1; + if (parseInt(jQuery("#ratioforcrop").val()) > 0) ratio = parseInt(jQuery("#ratioforcrop").val()); + jQuery('#x').val(Math.ceil(c.x * ratio)); + jQuery('#y').val(Math.ceil(c.y * ratio)); + jQuery('#x2').val(Math.ceil(c.x2 * ratio)); + jQuery('#y2').val(Math.ceil(c.y2 * ratio)); + jQuery('#w').val(Math.ceil(c.w * ratio)); + jQuery('#h').val(Math.ceil(c.h * ratio)); }; +/* checkCoords */ function checkCoords() { if (parseInt(jQuery('#w').val())) return true; diff --git a/htdocs/core/photos_resize.php b/htdocs/core/photos_resize.php index 4d74a819ebf..b96e0717eab 100644 --- a/htdocs/core/photos_resize.php +++ b/htdocs/core/photos_resize.php @@ -128,11 +128,8 @@ if ($mesg) print '
'.$mesg.'
'; $infoarray=dol_getImageSize($dir."/".urldecode($_GET["file"])); $height=$infoarray['height']; $width=$infoarray['width']; -print $langs->trans("CurrentInformationOnImage").':'; -print '
    -
  • '.$langs->trans("Width").': '.$width.' px
  • -
  • '.$langs->trans("Height").': '.$height.' px
  • -
'; +print $langs->trans("CurrentInformationOnImage").': '; +print $langs->trans("Width").': '.$width.' x '.$langs->trans("Height").': '.$height.'
'; print '
'."\n"; @@ -142,55 +139,66 @@ print '
'; print ''.$langs->trans("Resize").''; print $langs->trans("ResizeDesc").'
'; -print $langs->trans("NewLength").': px
'; +print $langs->trans("NewLength").': px   '.$langs->trans("or").'   '; print $langs->trans("NewHeight").': px  
'; print ''; print ''; print ''; print ''; print '
'; -print ''; -print '
'; +print ''."\n"; +print ''; +print '
'."\n"; /* - * Recadrage d'une image + * Crop image */ print '
'."\n"; if (! empty($conf->use_javascript_ajax)) { - -$infoarray=dol_getImageSize($dir."/".urldecode($_GET["file"])); -$height=$infoarray['height']; -$width=$infoarray['width']; - -print ''."\n"; -print '
'; -print ''.$langs->trans("Recenter").''; -print $langs->trans("DefineNewAreaToPick").'...
'; -print '
'; -print '
'; -print '

'; -print '
-
- '.$langs->trans("NewSizeAfterCropping").': - - - - - - -
- - - - - -
-
'; -print '
'; - + $infoarray=dol_getImageSize($dir."/".urldecode($_GET["file"])); + $height=$infoarray['height']; + $width=$infoarray['width']; + $widthforcrop=$width; $refsizeforcrop='orig'; $ratioforcrop=1; + if (! empty($_SESSION['dol_screenwidth']) && ($widthforcrop > round($_SESSION['dol_screenwidth']/2))) + { + $widthforcrop=min(round($_SESSION['dol_screenwidth']/2),$widthforcrop); + $refsizeforcrop='screenwidth'; + $ratioforcrop=2; + } + + print ''."\n"; + print '
'; + print ''.$langs->trans("Recenter").''; + print $langs->trans("DefineNewAreaToPick").'...
'; + print '
'; + print '
'; + print ''; + print '
'; + print '

'; + print '
+
+ '.$langs->trans("NewSizeAfterCropping").': + + + + + + +
+ + + + + + + +
+
'."\n"; + print '
'."\n"; + print '
'; } From 20ef4554e0a0a61a115527d9242534c107c55d50 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Mar 2014 23:43:58 +0100 Subject: [PATCH 8/8] Fix: missing unique key on barcode field to avoid database corruption --- htdocs/install/mysql/migration/3.5.0-3.6.0.sql | 11 +++++++++++ htdocs/install/mysql/migration/repair.sql | 3 +++ 2 files changed, 14 insertions(+) diff --git a/htdocs/install/mysql/migration/3.5.0-3.6.0.sql b/htdocs/install/mysql/migration/3.5.0-3.6.0.sql index e8c9d18f3ba..f9e0264b906 100644 --- a/htdocs/install/mysql/migration/3.5.0-3.6.0.sql +++ b/htdocs/install/mysql/migration/3.5.0-3.6.0.sql @@ -1080,3 +1080,14 @@ create table llx_categories_extrafields ) ENGINE=innodb; ALTER TABLE llx_categories_extrafields ADD INDEX idx_categories_extrafields (fk_object); + +update llx_product set barcode = null where barcode in ('', '-1', '0'); +update llx_societe set barcode = null where barcode in ('', '-1', '0'); + +-- Add missing unique keys +ALTER TABLE llx_product ADD INDEX idx_product_barcode (barcode); +ALTER TABLE llx_product ADD UNIQUE INDEX uk_product_barcode (barcode, fk_barcode_type, entity); +ALTER TABLE llx_societe ADD INDEX idx_societe_barcode (barcode); +ALTER TABLE llx_societe ADD UNIQUE INDEX uk_societe_barcode (barcode, fk_barcode_type, entity); + + diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 1436b125029..dec091e6e66 100644 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -103,6 +103,9 @@ update llx_opensurvey_sondage set format = 'A' where format = 'A+'; -- ALTER TABLE llx_facture_fourn ALTER COLUMN fk_cond_reglement DROP NOT NULL; +update llx_product set barcode = null where barcode in ('', '-1', '0'); +update llx_societe set barcode = null where barcode in ('', '-1', '0'); + -- Sequence to removed duplicated values of barcode in llx_product. Use serveral times if you still have duplicate. --select barcode, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_product where barcode is not null group by barcode having count(rowid) >= 2; create table tmp_product_double as (select barcode, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_product where barcode is not null group by barcode having count(rowid) >= 2);