From 5b243abe4b82c3a5f04d1c15dbc5d511e0bd9ddc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Sat, 16 Nov 2013 12:00:08 +0100 Subject: [PATCH] Fix: Miscellaneous fixes --- htdocs/comm/fiche.php | 4 ++-- htdocs/compta/facture.php | 22 +++++++++++++------ htdocs/core/class/html.form.class.php | 10 ++++++--- htdocs/core/db/pgsql.class.php | 5 +++-- .../install/mysql/migration/3.4.0-3.5.0.sql | 2 +- .../install/mysql/tables/llx_societe_rib.sql | 2 +- 6 files changed, 29 insertions(+), 16 deletions(-) diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php index c766cc54907..7467aee23b3 100644 --- a/htdocs/comm/fiche.php +++ b/htdocs/comm/fiche.php @@ -1,6 +1,6 @@ <?php /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> - * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> + * Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> @@ -389,7 +389,7 @@ if ($id > 0) print '<td>'; print $form->editfieldkey("OutstandingBill",'OutstandingBill',$object->outstanding_limit,$object,$user->rights->societe->creer); print '</td><td colspan="3">'; - print price($form->editfieldval("OutstandingBill",'OutstandingBill',$object->outstanding_limit,$object,$user->rights->societe->creer)); + print $form->editfieldval("OutstandingBill",'OutstandingBill',$object->outstanding_limit,$object,$user->rights->societe->creer,'amount',price($object->outstanding_limit)); print '</td>'; print '</tr>'; } diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 219887ebee5..c54d6242fce 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -2312,19 +2312,22 @@ if ($action == 'create') print '</td></tr>'; } - if ($soc->outstanding_limit) + // TODO This is nt a roperty of invoice so should not appears here but as a warning on thirdparty + /* + if ($soc->outstanding_limit) { $outstandigBills=$soc->get_OutstandingBill(); // Outstanding Bill print '<tr><td>'; print $langs->trans('OutstandingBill'); - print '</td><td align=right>'; + print '</td><td align="right" colspan="2">'; print price($outstandigBills); if ($outstandigBills > $soc->outstanding_limit) print img_warning($langs->trans("OutstandingBillReached")); print ' / '.price($soc->outstanding_limit); print '</td>'; print '</tr>'; } + */ // Other attributes $parameters=array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"'); @@ -3042,7 +3045,7 @@ else if ($id > 0 || ! empty($ref)) $nbrows=8; $nbcols=2; if (! empty($conf->projet->enabled)) $nbrows++; if (! empty($conf->banque->enabled)) $nbcols++; - if (! empty($soc->outstandingbill)) $nbrows++; + //if (! empty($soc->outstandingbill)) $nbrows++; if($mysoc->localtax1_assuj=="1") $nbrows++; if($mysoc->localtax2_assuj=="1") $nbrows++; if ($selleruserevenustamp) $nbrows++; @@ -3314,18 +3317,23 @@ else if ($id > 0 || ! empty($ref)) } print '</td></tr>'; + // TODO This is nt a roperty of invoice so should not appears here but as a warning on thirdparty + /* if ($soc->outstandingbill) { + $outstandingBills=$soc->get_OutstandingBill(); // Outstanding Bill print '<tr><td>'; print $langs->trans('OutstandingBill'); - print '</td><td align=right>'; - print price($soc->get_OutstandingBill()).' / '; - print price($soc->outstandingbill); + print '</td><td align="right">'; + print price($outstandingBills); + if ($outstandigBills > $soc->outstanding_limit) print img_warning($langs->trans("OutstandingBillReached")); + print ' / '.price($soc->outstandingbill); print '</td>'; print '</tr>'; } - + */ + // Amount print '<tr><td>'.$langs->trans('AmountHT').'</td>'; print '<td align="right" colspan="3" nowrap>'.price($object->total_ht,1,'',1,-1,-1,$conf->currency).'</td></tr>'; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 296ae741e1b..36c1f838810 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -121,8 +121,8 @@ class Form * @param string $value Value to show/edit * @param object $object Object * @param boolean $perm Permission to allow button to edit parameter - * @param string $typeofdata Type of data ('string' by default, 'email', 'numeric:99', 'text' or 'textarea:rows:cols', 'day' or 'datepicker', 'ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols', 'select:xxx'...) - * @param string $editvalue When in edit mode, use this value as $value instead of value + * @param string $typeofdata Type of data ('string' by default, 'amount', 'email', 'numeric:99', 'text' or 'textarea:rows:cols', 'day' or 'datepicker', 'ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols', 'select:xxx'...) + * @param string $editvalue When in edit mode, use this value as $value instead of value (for example, you can provide here a formated price instead of value) * @param object $extObject External object * @param string $success Success message * @param string $moreparam More param to add on a href URL @@ -134,6 +134,9 @@ class Form $ret=''; + // Check parameters + if (empty($typeofdata)) return 'ErrorBadParameter'; + // When option to edit inline is activated if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && ! preg_match('/^select;|datehourpicker/',$typeofdata)) // FIXME add jquery timepicker { @@ -150,7 +153,7 @@ class Form $ret.='<input type="hidden" name="id" value="'.$object->id.'">'; $ret.='<table class="nobordernopadding" cellpadding="0" cellspacing="0">'; $ret.='<tr><td>'; - if (preg_match('/^(string|email|numeric)/',$typeofdata)) + if (preg_match('/^(string|email|numeric|amount)/',$typeofdata)) { $tmp=explode(':',$typeofdata); $ret.='<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($editvalue?$editvalue:$value).'"'.($tmp[1]?' size="'.$tmp[1].'"':'').'>'; @@ -193,6 +196,7 @@ class Form else { if ($typeofdata == 'email') $ret.=dol_print_email($value,0,0,0,0,1); + elseif ($typeofdata == 'amount') $ret.=price($value,'',$langs); elseif (preg_match('/^text/',$typeofdata) || preg_match('/^note/',$typeofdata)) $ret.=dol_htmlentitiesbr($value); elseif ($typeofdata == 'day' || $typeofdata == 'datepicker') $ret.=dol_print_date($value,'day'); elseif ($typeofdata == 'datehourpicker') $ret.=dol_print_date($value,'dayhour'); diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 8159304f376..7c0366fb4a0 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -210,7 +210,8 @@ class DoliDBPgsql extends DoliDB // tinyint type conversion $line=preg_replace('/tinyint\(?[0-9]*\)?/','smallint',$line); - + $line=preg_replace('/tinyint/i','smallint',$line); + // nuke unsigned $line=preg_replace('/(int\w+|smallint)\s+unsigned/i','\\1',$line); @@ -875,7 +876,7 @@ class DoliDBPgsql extends DoliDB 42701=> 'DB_ERROR_COLUMN_ALREADY_EXISTS', '42710' => 'DB_ERROR_KEY_NAME_ALREADY_EXISTS', '23505' => 'DB_ERROR_RECORD_ALREADY_EXISTS', - '42704' => 'DB_ERROR_NO_INDEX_TO_DROP', + '42704' => 'DB_ERROR_NO_INDEX_TO_DROP', // May also be Type xxx does not exists '42601' => 'DB_ERROR_SYNTAX', '42P16' => 'DB_ERROR_PRIMARY_KEY_ALREADY_EXISTS', 1075 => 'DB_ERROR_CANT_DROP_PRIMARY_KEY', diff --git a/htdocs/install/mysql/migration/3.4.0-3.5.0.sql b/htdocs/install/mysql/migration/3.4.0-3.5.0.sql index 5fbd3dcc3f4..a091e7f089c 100755 --- a/htdocs/install/mysql/migration/3.4.0-3.5.0.sql +++ b/htdocs/install/mysql/migration/3.4.0-3.5.0.sql @@ -359,5 +359,5 @@ ALTER TABLE llx_societe ADD skype VARCHAR(255) AFTER email; ALTER TABLE llx_adherent ADD skype VARCHAR(255) AFTER email; -- multi-rib -ALTER TABLE llx_societe_rib ADD default_rib TINYINT NOT NULL DEFAULT 0 AFTER owner_address; +ALTER TABLE llx_societe_rib ADD default_rib smallint NOT NULL DEFAULT 0 AFTER owner_address; UPDATE llx_societe_rib SET default_rib = 1; diff --git a/htdocs/install/mysql/tables/llx_societe_rib.sql b/htdocs/install/mysql/tables/llx_societe_rib.sql index d928da868ed..1bedff6da4c 100644 --- a/htdocs/install/mysql/tables/llx_societe_rib.sql +++ b/htdocs/install/mysql/tables/llx_societe_rib.sql @@ -36,7 +36,7 @@ create table llx_societe_rib domiciliation varchar(255), proprio varchar(60), owner_address varchar(255), - default_rib tinyint NOT NULL DEFAULT 0, + default_rib smallint NOT NULL DEFAULT 0, import_key varchar(14) -- import key -- GitLab