diff --git a/dev/translation/sanity_check_en_langfiles.php b/dev/translation/sanity_check_en_langfiles.php index fdc0f738431..a3b3911c77f 100644 --- a/dev/translation/sanity_check_en_langfiles.php +++ b/dev/translation/sanity_check_en_langfiles.php @@ -18,20 +18,7 @@ echo ""; echo ""; -echo ""; +"; echo ""; -echo "

If you call this file with the argument \"?unused=true\" it searches for the translation strings that exist in en_US but are never used

"; -echo "

IMPORTANT: that can take quite a lot of time (up to 10 minutes), you need to tune the max_execution_time on your php.ini accordingly

"; -echo "

Happy translating :)

"; -// directory containing the php and lang files -$htdocs = "../../htdocs/"; +echo "If you call this file with the argument \"?unused=true\" it searches for the translation strings that exist in en_US but are never used.
"; +echo "IMPORTANT: that can take quite a lot of time (up to 10 minutes), you need to tune the max_execution_time on your php.ini accordingly.
"; +echo "Happy translating :)
"; + + +// STEP 1 - Search duplicates keys + + +// directory containing the php and lang files +$htdocs = "../../htdocs/"; + // directory containing the english lang files $workdir = $htdocs."langs/en_US/"; + $files = scandir($workdir); +if (empty($files)) +{ + echo "Can't scan workdir = ".$workdir; + exit; +} + $exludefiles = array('.','..','README'); $files = array_diff($files,$exludefiles); $langstrings_3d = array(); @@ -154,11 +103,12 @@ foreach ($files AS $file) { if (substr($row,0,1) !== '#') { // don't want lines without the separator (why should those even be here, anyway...) if (strpos($row,'=')!==false) { - $row_array = explode('=',$row); + $row_array = explode('=',$row); // $row_array[0] = key $langstrings_3d[$path_file['basename']][$line+1]=$row_array[0]; + $langstrings_3dtrans[$path_file['basename']][$line+1]=$row_array[1]; $langstrings_full[]=$row_array[0]; $langstrings_dist[$row_array[0]]=$row_array[0]; - } + } } } } @@ -167,16 +117,16 @@ foreach ($files AS $file) { foreach ($langstrings_3d AS $filename => $file) { foreach ($file AS $linenum => $value) { $keys = array_keys($langstrings_full, $value); - if (count($keys)>1) { + if (count($keys)>1) + { foreach ($keys AS $key) { - $dups[$value][$filename][$linenum] = ''; + $dups[$value][$filename][$linenum] = trim($langstrings_3dtrans[$filename][$linenum]); } } } } echo "

Duplicate strings in lang files in $workdir - ".count($dups)." found

"; -echo "
";
 
 echo " ";
 echo "";
@@ -190,22 +140,27 @@ foreach ($dups as $string => $pages) {
 	echo "";
+	echo "\n";
 }
 echo "";
 echo "
#StringFile and lines
"; foreach ($pages AS $page => $lines ) { echo "$page "; - foreach ($lines as $line => $nothing) { - echo "($line) "; + foreach ($lines as $line => $translatedvalue) { + //echo "($line - ".(substr($translatedvalue,0,20)).") "; + echo "($line - ".htmlentities($translatedvalue).") "; } echo "
"; } - echo "
"; -if ($_REQUEST['unused'] == 'true') { +// STEP 2 - Search key not used - foreach ($langstrings_dist AS $value){ + +if (! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') +{ + foreach ($langstrings_dist AS $value) + { $search = '\'trans("'.$value.'")\''; - $string = 'grep -R -m 1 -F --include=*.php '.$search.' '.$htdocs.'*'; + $string = 'grep -R -m 1 -F --exclude=includes/* --include=*.php '.$search.' '.$htdocs.'*'; exec($string,$output); if (empty($output)) { $unused[$value] = true; @@ -216,6 +171,9 @@ if ($_REQUEST['unused'] == 'true') { echo "

Strings in en_US that are never used

"; echo "
";
 	print_r($unused);
+	echo "
"; } + +echo "\n"; echo ""; -echo ""; \ No newline at end of file +echo ""; diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php index 369027b1e14..3761b75f384 100644 --- a/htdocs/adherents/card_subscriptions.php +++ b/htdocs/adherents/card_subscriptions.php @@ -547,7 +547,7 @@ $now=dol_now(); llxHeader('',$langs->trans("Subscriptions"),'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros'); -if ($rowid) +if ($rowid > 0) { $res=$object->fetch($rowid); if ($res < 0) { dol_print_error($db,$object->error); exit; } @@ -556,8 +556,6 @@ if ($rowid) $head = member_prepare_head($object); - dol_fiche_head($head, 'subscription', $langs->trans("Member"), 0, 'user'); - $rowspan=10; if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) $rowspan++; if (! empty($conf->societe->enabled)) $rowspan++; @@ -565,6 +563,9 @@ if ($rowid) print '
'; print ''; print ''; + + dol_fiche_head($head, 'subscription', $langs->trans("Member"), 0, 'user'); + print ''; $linkback = ''.$langs->trans("BackToList").''; @@ -696,10 +697,11 @@ if ($rowid) print ''; print "
\n"; - print '
'; dol_fiche_end(); + print ''; + dol_htmloutput_errors($errmsg,$errmsgs); @@ -873,7 +875,7 @@ if ($rowid) } }); '; - if (GETPOST('paymentsave')) print '$("#'.GETPOST('paymentsave').'").attr("checked",true);'; + if (GETPOST('paymentsave')) print '$("#'.GETPOST('paymentsave').'").prop("checked",true);'; print '});'; print ''."\n"; } @@ -1008,7 +1010,7 @@ if ($rowid) { $prodtmp=new Product($db); $prodtmp->fetch($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS); - print '. '.$langs->trans("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS", $prodtmp->getNomUrl(0)); + print '. '.$langs->transnoentitiesnoconv("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS", $prodtmp->getNomUrl(1)); // must use noentitiesnoconv to avoid to encode html into getNomUrl of product } print '
'; } @@ -1033,7 +1035,7 @@ if ($rowid) { $prodtmp=new Product($db); $prodtmp->fetch($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS); - print '. '.$langs->trans("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS", $prodtmp->getNomUrl(0)); + print '. '.$langs->transnoentitiesnoconv("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS", $prodtmp->getNomUrl(1)); // must use noentitiesnoconv to avoid to encode html into getNomUrl of product } print '
'; } diff --git a/htdocs/admin/const.php b/htdocs/admin/const.php index 6b63ba74c6b..55434d4de2e 100644 --- a/htdocs/admin/const.php +++ b/htdocs/admin/const.php @@ -165,7 +165,7 @@ jQuery(document).ready(function() { var row_num = field_id.split("_"); jQuery("#updateconst").show(); jQuery("#action").val('update'); - jQuery("#check_" + row_num[1]).attr("checked",true); + jQuery("#check_" + row_num[1]).prop("checked",true); }); }); diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 159c03589b1..2b50008d58a 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -271,12 +271,12 @@ if ($action == 'edit') { jQuery(".drag").hide(); jQuery("#MAIN_MAIL_EMAIL_TLS").val(0); - jQuery("#MAIN_MAIL_EMAIL_TLS").attr(\'disabled\', \'disabled\'); + jQuery("#MAIN_MAIL_EMAIL_TLS").prop("disabled", true); '; if ($linuxlike) { - print ' jQuery("#MAIN_MAIL_SMTP_SERVER").attr(\'disabled\', \'disabled\');'; - print ' jQuery("#MAIN_MAIL_SMTP_PORT").attr(\'disabled\', \'disabled\');'; + print ' jQuery("#MAIN_MAIL_SMTP_SERVER").prop("disabled", true);'; + print ' jQuery("#MAIN_MAIL_SMTP_PORT").prop("disabled", true);'; } print ' } @@ -284,9 +284,9 @@ if ($action == 'edit') { jQuery(".drag").show(); jQuery("#MAIN_MAIL_EMAIL_TLS").val('.$conf->global->MAIN_MAIL_EMAIL_TLS.'); - jQuery("#MAIN_MAIL_EMAIL_TLS").removeAttr(\'disabled\'); - jQuery("#MAIN_MAIL_SMTP_SERVER").removeAttr(\'disabled\'); - jQuery("#MAIN_MAIL_SMTP_PORT").removeAttr(\'disabled\'); + jQuery("#MAIN_MAIL_EMAIL_TLS").removeAttr("disabled"); + jQuery("#MAIN_MAIL_SMTP_SERVER").removeAttr("disabled"); + jQuery("#MAIN_MAIL_SMTP_PORT").removeAttr("disabled"); } } initfields(); diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php index 9ded9ae1f34..4ab41c7991e 100644 --- a/htdocs/admin/menus/edit.php +++ b/htdocs/admin/menus/edit.php @@ -255,12 +255,12 @@ if ($action == 'create') { if (jQuery("#topleft").val() == \'top\') { - jQuery("#menuId").attr(\'disabled\',\'disabled\'); + jQuery("#menuId").prop("disabled", true); jQuery("#menuId").val(\'\'); } else { - jQuery("#menuId").removeAttr(\'disabled\'); + jQuery("#menuId").removeAttr("disabled"); } } init_topleft(); diff --git a/htdocs/admin/system/about.php b/htdocs/admin/system/about.php index db16c024c13..889885bb6ea 100644 --- a/htdocs/admin/system/about.php +++ b/htdocs/admin/system/about.php @@ -51,8 +51,8 @@ print ''; print $langs->trans("Developpers").':'; print ''; //print "
\n"; diff --git a/htdocs/admin/system/modules.php b/htdocs/admin/system/modules.php index 47a386c1a03..1014beba184 100644 --- a/htdocs/admin/system/modules.php +++ b/htdocs/admin/system/modules.php @@ -118,7 +118,7 @@ foreach($sortorder as $numero=>$name) $idperms=""; $var=!$var; // Module - print ""; + print "'; $alt=$name.' - '.$modules_files[$numero]; if (! empty($picto[$numero])) { diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php index 842efb3a0ac..671a9bf9eba 100644 --- a/htdocs/admin/tools/dolibarr_export.php +++ b/htdocs/admin/tools/dolibarr_export.php @@ -96,7 +96,7 @@ jQuery(document).ready(function() { jQuery("#select_sql_compat").click(function() { if (jQuery("#select_sql_compat").val() == 'POSTGRESQL') { - jQuery("#checkbox_dump_disable-add-locks").attr('checked',true); + jQuery("#checkbox_dump_disable-add-locks").prop('checked',true); } }); diff --git a/htdocs/api/readme.md b/htdocs/api/README.md similarity index 100% rename from htdocs/api/readme.md rename to htdocs/api/README.md diff --git a/htdocs/asterisk/cidlookup.php b/htdocs/asterisk/cidlookup.php index 6b566e60f55..d1d965d99a7 100644 --- a/htdocs/asterisk/cidlookup.php +++ b/htdocs/asterisk/cidlookup.php @@ -32,7 +32,8 @@ include '../master.inc.php'; $phone = GETPOST('phone'); - +$notfound = "Not found"; +$error = "Error" // Security check if (empty($conf->clicktodial->enabled)) { @@ -64,13 +65,15 @@ if ($resql) if ($obj) { $found = $obj->name; + } else { + $found = $notfound; } $db->free($resql); } else { dol_print_error($db,'Error'); + $found = $error; } echo $found; - diff --git a/htdocs/barcode/printsheet.php b/htdocs/barcode/printsheet.php index 1a518b1859c..36d9117eefe 100644 --- a/htdocs/barcode/printsheet.php +++ b/htdocs/barcode/printsheet.php @@ -313,28 +313,28 @@ jQuery(document).ready(function() { { if (jQuery("#fillmanually:checked").val() == "fillmanually") { - jQuery("#submitproduct").attr(\'disabled\',\'disabled\'); - jQuery("#submitthirdparty").attr(\'disabled\',\'disabled\'); - jQuery("#search_productid").attr(\'disabled\',\'disabled\'); - jQuery("#socid").attr(\'disabled\',\'disabled\'); + jQuery("#submitproduct").prop("disabled", true); + jQuery("#submitthirdparty").prop("disabled", true); + jQuery("#search_productid").prop("disabled", true); + jQuery("#socid").prop("disabled", true); jQuery(".showforproductselector").hide(); jQuery(".showforthirdpartyselector").hide(); } if (jQuery("#fillfromproduct:checked").val() == "fillfromproduct") { - jQuery("#submitproduct").removeAttr(\'disabled\'); - jQuery("#submitthirdparty").attr(\'disabled\',\'disabled\'); - jQuery("#search_productid").removeAttr(\'disabled\'); - jQuery("#socid").attr(\'disabled\',\'disabled\'); + jQuery("#submitproduct").removeAttr("disabled"); + jQuery("#submitthirdparty").prop("disabled", true); + jQuery("#search_productid").removeAttr("disabled"); + jQuery("#socid").prop("disabled", true); jQuery(".showforproductselector").show(); jQuery(".showforthirdpartyselector").hide(); } if (jQuery("#fillfromthirdparty:checked").val() == "fillfromthirdparty") { - jQuery("#submitproduct").attr(\'disabled\',\'disabled\'); - jQuery("#submitthirdparty").removeAttr(\'disabled\'); - jQuery("#search_productid").attr(\'disabled\',\'disabled\'); - jQuery("#socid").removeAttr(\'disabled\'); + jQuery("#submitproduct").prop("disabled", true); + jQuery("#submitthirdparty").removeAttr("disabled"); + jQuery("#search_productid").prop("disabled", true); + jQuery("#socid").removeAttr("disabled"); jQuery(".showforproductselector").hide(); jQuery(".showforthirdpartyselector").show(); } @@ -348,11 +348,11 @@ jQuery(document).ready(function() { { if (jQuery("#select_fk_barcode_type").val() > 0 && jQuery("#forbarcode").val()) { - jQuery("#submitformbarcodegen").removeAttr(\'disabled\'); + jQuery("#submitformbarcodegen").removeAttr("disabled"); } else { - jQuery("#submitformbarcodegen").attr(\'disabled\',\'disabled\'); + jQuery("#submitformbarcodegen").prop("disabled", true); } } init_gendoc_button(); diff --git a/htdocs/categories/photos.php b/htdocs/categories/photos.php index 36a44f4bdda..59be328c55e 100644 --- a/htdocs/categories/photos.php +++ b/htdocs/categories/photos.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005 Eric Seigne * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2014 Jean-François Ferry @@ -128,7 +128,7 @@ if ($object->id) // Description print ''; print $langs->trans("Description").''; - print nl2br($object->description); + print dol_htmlentitiesbr($object->description); print ''; // Visibility diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index a1c544f338b..198ac73cd2a 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -166,6 +166,7 @@ elseif ($type == 4) $title=$langs->trans("ContactCategoriesShort"); else $title=$langs->trans("Category"); $head = categories_prepare_head($object,$type); + dol_fiche_head($head, 'card', $title, 0, 'category'); @@ -194,7 +195,7 @@ print ''; // Description print ''; print $langs->trans("Description").''; -print nl2br($object->description); +print dol_htmlentitiesbr($object->description); print ''; $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook @@ -205,12 +206,13 @@ if (empty($reshook) && ! empty($extrafields->attribute_label)) print ''; -print ''; +dol_fiche_end(); /* * Boutons actions */ + print "
\n"; if ($user->rights->categorie->creer) @@ -254,7 +256,7 @@ else { $var=!$var; print "\t\n"; - print "\t\t"; + print "\t\t".''; print "".$cat->label.""; print "\n"; print "\t\t".''.$cat->description."\n"; diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 7e842ae3678..eb88215fa20 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -570,11 +570,11 @@ if ($action == 'create') $(".fulldayendmin").removeAttr("disabled"); $("#p2").removeAttr("disabled"); } else { - $(".fulldaystarthour").attr("disabled","disabled").val("00"); - $(".fulldaystartmin").attr("disabled","disabled").val("00"); - $(".fulldayendhour").attr("disabled","disabled").val("23"); - $(".fulldayendmin").attr("disabled","disabled").val("59"); - $("#p2").removeAttr("disabled"); + $(".fulldaystarthour").prop("disabled", true).val("00"); + $(".fulldaystartmin").prop("disabled", true).val("00"); + $(".fulldayendhour").prop("disabled", true).val("23"); + $(".fulldayendmin").prop("disabled", true).val("59"); + $("#p2").removeAttr("disabled"); } } setdatefields(); @@ -841,10 +841,10 @@ if ($id > 0) $(".fulldayendhour").removeAttr("disabled"); $(".fulldayendmin").removeAttr("disabled"); } else { - $(".fulldaystarthour").attr("disabled","disabled").val("00"); - $(".fulldaystartmin").attr("disabled","disabled").val("00"); - $(".fulldayendhour").attr("disabled","disabled").val("23"); - $(".fulldayendmin").attr("disabled","disabled").val("59"); + $(".fulldaystarthour").prop("disabled", true).val("00"); + $(".fulldaystartmin").prop("disabled", true).val("00"); + $(".fulldayendhour").prop("disabled", true).val("23"); + $(".fulldayendmin").prop("disabled", true).val("59"); } } setdatefields(); @@ -986,7 +986,7 @@ if ($id > 0) } // Priority - print ''.$langs->trans("Priority").''; + print ''.$langs->trans("Priority").''; print ''; print ''; @@ -1174,7 +1174,7 @@ if ($id > 0) } // Priority - print ''.$langs->trans("Priority").''; + print ''.$langs->trans("Priority").''; print ($object->priority?$object->priority:''); print ''; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 1c0c72f07e5..6ff12430000 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -11,7 +11,7 @@ * Copyright (C) 2012 Cedric Salvador * Copyright (C) 2013 Florian Henry * Copyright (C) 2014 Ferran Marcet - * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2015 Jean-François Ferry * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1315,6 +1315,8 @@ if ($action == 'create' && $user->rights->commande->creer) print ''; print ''; + dol_fiche_head(''); + print ''; // Reference @@ -1545,8 +1547,10 @@ if ($action == 'create' && $user->rights->commande->creer) print '
'; + dol_fiche_end(); + // Button "Create Draft" - print '
'; + print '
'; print ''; diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index 1e7f3858f98..e75a9dda73b 100644 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -511,10 +511,10 @@ if (($action != 'create' && $action != 'add') && !$error) @@ -654,12 +654,12 @@ if (($action != 'create' && $action != 'add') && !$error) print ''.$objp->ref_client.''; // Order date - print ''; + print ''; print dol_print_date($db->jdate($objp->date_commande),'day'); print ''; //Delivery date - print ''; + print ''; print dol_print_date($db->jdate($objp->date_livraison),'day'); print ''; diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index 536bdc91662..1aea3e27c1b 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -313,19 +313,65 @@ if ($id > 0 || ! empty($ref)) $linkback = ''.$langs->trans("BackToList").''; // Ref - print ''.$langs->trans("Ref").''; + print ''.$langs->trans("Ref").''; print ''; print $form->showrefnav($object, 'ref', $linkback, 1, 'ref'); print ''; // Label - print ''.$langs->trans("Label").''; + print ''.$langs->trans("Label").''; print ''.$object->label.''; print ''; - print '
'; + dol_fiche_end(); + + + /* + * Boutons actions + */ + + if ($action != 'delete') + { + print '
'; + + if ($object->type != 2 && $object->rappro) // If not cash account and can be reconciliate + { + if ($user->rights->banque->consolidate) + { + print ''.$langs->trans("Conciliate").''; + } + else + { + print ''.$langs->trans("Conciliate").''; + } + } + + if ($action != 'addline') + { + if (empty($conf->global->BANK_DISABLE_DIRECT_INPUT)) + { + if ($user->rights->banque->modifier) + { + print 'id.'&page='.$page.($vline?'&vline='.$vline:'').'">'.$langs->trans("AddBankRecord").''; + } + else + { + print ''.$langs->trans("AddBankRecord").''; + } + } + else + { + print ''.$langs->trans("AddBankRecord").''; + } + } + + print '
'; + } + + print '
'; + /** * Search form */ @@ -364,15 +410,15 @@ if ($id > 0 || ! empty($ref)) } $navig.='
'; + //var_dump($navig); - print ''; - - // Show title if ($action != 'addline' && $action != 'delete') { - print ''; + print '
'.$navig.'
'; } + + print '
'.$navig.'
'; // Form to add a transaction with no invoice if ($user->rights->banque->modifier && $action == 'addline') @@ -776,11 +822,11 @@ if ($id > 0 || ! empty($ref)) { if ($total >= 0) { - print ''; + print ''; } else { - print ''; + print ''; } } else @@ -791,7 +837,7 @@ if ($id > 0 || ! empty($ref)) // Transaction reconciliated or edit link if ($objp->rappro && $object->canBeConciliated() > 0) // If line not conciliated and account can be conciliated { - print ''; - print ''; + print ''; print ''; print ''; } @@ -859,51 +905,6 @@ if ($id > 0 || ! empty($ref)) print "\n"; - dol_fiche_end(); - - - /* - * Boutons actions - */ - - if ($action != 'delete') - { - print '
'; - - if ($object->type != 2 && $object->rappro) // If not cash account and can be reconciliate - { - if ($user->rights->banque->consolidate) - { - print ''.$langs->trans("Conciliate").''; - } - else - { - print ''.$langs->trans("Conciliate").''; - } - } - - if ($action != 'addline') - { - if (empty($conf->global->BANK_DISABLE_DIRECT_INPUT)) - { - if ($user->rights->banque->modifier) - { - print 'id.'&page='.$page.($vline?'&vline='.$vline:'').'">'.$langs->trans("AddBankRecord").''; - } - else - { - print ''.$langs->trans("AddBankRecord").''; - } - } - else - { - print ''.$langs->trans("AddBankRecord").''; - } - } - - print '
'; - } - print '
'; } else diff --git a/htdocs/compta/bank/annuel.php b/htdocs/compta/bank/annuel.php index 6dfbea29791..990b32524a5 100644 --- a/htdocs/compta/bank/annuel.php +++ b/htdocs/compta/bank/annuel.php @@ -144,7 +144,7 @@ print '
 '.price($total).' '.price($total).' '.price($total).' '.price($total).''; + print ''; print ''; print img_edit(); print ''; @@ -844,7 +890,7 @@ if ($id > 0 || ! empty($ref)) if ($sep > 0) print ' '; // If we had at least one line in future else print $langs->trans("CurrentBalance"); print ' '.$object->currency_code.''.price($total, 0, $langs, 0, 0, -1, $object->currency_code).''.price($total, 0, $langs, 0, 0, -1, $object->currency_code).' 
'; $linkback = ''.$langs->trans("BackToList").''; // Ref -print ''; +print ''; print ''; // Label -print ''; +print ''; print ''; print '
'.$langs->trans("Ref").'
'.$langs->trans("Ref").''; if ($_GET["account"]) { @@ -172,7 +172,7 @@ else print '
'.$langs->trans("Label").'
'.$langs->trans("Label").''; if (! empty($id)) { @@ -186,12 +186,14 @@ print '
'; -print '
'; +dol_fiche_end(); + // Affiche tableau -print ''; +print '
'.$link.'
'; -print ''; + +print '
'.$link.'
'; print ''; for ($annee = $year_start ; $annee <= $year_end ; $annee++) @@ -245,16 +247,13 @@ for ($annee = $year_start ; $annee <= $year_end ; $annee++) } print "\n"; -// Ligne vierge -print ''; -$nbcol=0; -for ($annee = $year_start ; $annee <= $year_end ; $annee++) -{ - $nbcol+=2; -} -print "\n"; +print "
'.$langs->trans("Month").'
 
"; -// Solde actuel + +print '
'; + + +// Current balance $balance=0; $sql = "SELECT SUM(b.amount) as total"; @@ -274,6 +273,9 @@ if ($resql) else { dol_print_error($db); } + +print ''; + print '"; print ''; print "\n"; @@ -496,9 +498,9 @@ else unset($tblyear[1]); unset($tblyear[2]); - print '
'; + print '
'; print $show1; - print '
'; + print '
'; print $show2; print '
'; print '
'; diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index b7af461ff42..acc1d3ecfa3 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -1,7 +1,7 @@ * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2014-2015 Alexandre Spangaro * Copyright (C) 2015 Jean-François Ferry @@ -266,24 +266,26 @@ if ($action == 'create') print ''; print ''; + dol_fiche_head(''); + print '
'.$langs->trans("CurrentBalance")."'.price($balance).'
'; // Ref - print ''; + print ''; print ''; // Label - print ''; + print ''; print ''; // Type - print ''; + print ''; print ''; // Currency - print ''; + print ''; print ''; // Status - print ''; + print ''; print ''; @@ -307,7 +309,7 @@ if ($action == 'create') else if (empty($selectedcode)) $selectedcode=$mysoc->country_code; $account->country_code = getCountry($selectedcode, 2); // Force country code on account to have following field on bank fields matching country rules - print ''; + print ''; print ''; // Web - print ''; + print ''; print ''; // Comment - print ''; + print ''; print ''; + print ''; print ''; // Label - print ''; + print ''; print ''; // Type - print ''; + print ''; print ''; // Currency - print ''; + print ''; print ''; // Status - print ''; + print ''; print ''; // Country @@ -579,7 +583,7 @@ else print ''; // Conciliate - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print '\n"; - print ''; + print ''; print ''; // Other attributes @@ -687,7 +691,7 @@ else if ($account->getCountryCode() == 'IN') $ibankey="IFSC"; if ($account->getCountryCode() == 'IN') $bickey="SWIFT"; - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print '\n"; - print '\n"; - print '\n"; @@ -727,13 +731,13 @@ else print '
'.$langs->trans("Ref").'
'.$langs->trans("Ref").'ref).'" maxlength="12">
'.$langs->trans("LabelBankCashAccount").'
'.$langs->trans("LabelBankCashAccount").'
'.$langs->trans("AccountType").'
'.$langs->trans("AccountType").''; $formbank->select_type_comptes_financiers(isset($_POST["type"])?$_POST["type"]:1,"type"); print '
'.$langs->trans("Currency").'
'.$langs->trans("Currency").''; $selectedcode=$account->account_currency_code; if (! $selectedcode) $selectedcode=$conf->currency; @@ -293,7 +295,7 @@ if ($action == 'create') print '
'.$langs->trans("Status").'
'.$langs->trans("Status").''; print $form->selectarray("clos",array(0=>$account->status[0],1=>$account->status[1]),(isset($_POST["clos"])?$_POST["clos"]:$account->clos)); print '
'.$langs->trans("BankAccountCountry").'
'.$langs->trans("BankAccountCountry").''; print $form->select_country($selectedcode,'account_country_id'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); @@ -326,11 +328,11 @@ if ($action == 'create') print '
'.$langs->trans("Web").'
'.$langs->trans("Web").'
'.$langs->trans("Comment").'
'.$langs->trans("Comment").''; // Editor wysiwyg require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; @@ -353,18 +355,18 @@ if ($action == 'create') print ''; // Sold - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; print '
'.$langs->trans("InitialBankBalance").'
'.$langs->trans("InitialBankBalance").'solde)).'">
'.$langs->trans("Date").'
'.$langs->trans("Date").''; $form->select_date('', 're', 0, 0, 0, 'formsoc'); print '
'.$langs->trans("BalanceMinimalAllowed").'
'.$langs->trans("BalanceMinimalAllowed").'account_min_allowed).'">
'.$langs->trans("BalanceMinimalDesired").'
'.$langs->trans("BalanceMinimalDesired").'account_min_desired).'">
'; @@ -375,7 +377,7 @@ if ($action == 'create') print ''; // If bank account - print ''; + print ''; print ''; print ''; @@ -452,16 +454,16 @@ if ($action == 'create') print ''; print ''; - print '"; - print ''; + print ''; print ''; - print '"; @@ -474,25 +476,27 @@ if ($action == 'create') // Accountancy code if (! empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) { - print ''; + print ''; print ''; } else { - print ''; + print ''; print ''; } // Accountancy journal if (! empty($conf->accounting->enabled)) { - print ''; + print ''; print ''; } print '
'.$langs->trans("BankName").'
'.$langs->trans("BankName").'
'.$langs->trans($bickey).'
'.$langs->trans("BankAccountDomiciliation").''; + print '
'.$langs->trans("BankAccountDomiciliation").''; print "
'.$langs->trans("BankAccountOwner").'
'.$langs->trans("BankAccountOwner").''; print '
'.$langs->trans("BankAccountOwnerAddress").''; + print '
'.$langs->trans("BankAccountOwnerAddress").''; print "
'.$langs->trans("AccountancyCode").'
'.$langs->trans("AccountancyCode").'account_number).'">
'.$langs->trans("AccountancyCode").'
'.$langs->trans("AccountancyCode").'account_number).'">
'.$langs->trans("AccountancyJournal").'
'.$langs->trans("AccountancyJournal").'accountancy_journal).'">
'; - print '
'; + dol_fiche_end(); + + print '
'; print ''; } @@ -538,21 +542,21 @@ else $linkback = ''.$langs->trans("BackToList").''; // Ref - print '
'.$langs->trans("Ref").'
'.$langs->trans("Ref").''; print $form->showrefnav($account, 'ref', $linkback, 1, 'ref'); print '
'.$langs->trans("Label").'
'.$langs->trans("Label").''.$account->label.'
'.$langs->trans("AccountType").'
'.$langs->trans("AccountType").''.$account->type_lib[$account->type].'
'.$langs->trans("Currency").'
'.$langs->trans("Currency").''; $selectedcode=$account->account_currency_code; if (! $selectedcode) $selectedcode=$conf->currency; @@ -560,7 +564,7 @@ else print '
'.$langs->trans("Status").'
'.$langs->trans("Status").''.$account->getLibStatut(4).'
'.$langs->trans("Conciliable").'
'.$langs->trans("Conciliable").''; $conciliate=$account->canBeConciliated(); if ($conciliate == -2) print $langs->trans("No").' ('.$langs->trans("CashAccount").')'; @@ -587,19 +591,19 @@ else else print ($account->rappro==1 ? $langs->trans("Yes") : ($langs->trans("No").' ('.$langs->trans("ConciliationDisabled").')')); print '
'.$langs->trans("BalanceMinimalAllowed").'
'.$langs->trans("BalanceMinimalAllowed").''.$account->min_allowed.'
'.$langs->trans("BalanceMinimalDesired").'
'.$langs->trans("BalanceMinimalDesired").''.$account->min_desired.'
'.$langs->trans("Web").''; + print '
'.$langs->trans("Web").''; if ($account->url) print ''; print $account->url; if ($account->url) print ''; print "
'.$langs->trans("Comment").'
'.$langs->trans("Comment").''.dol_htmlentitiesbr($account->comment).'
'.$langs->trans($ibankey).'
'.$langs->trans($ibankey).''.$account->iban.' '; if (! empty($account->iban)) { if (! checkIbanForAccount($account)) { @@ -698,7 +702,7 @@ else } print '
'.$langs->trans($bickey).'
'.$langs->trans($bickey).''.$account->bic.' '; if (! empty($account->bic)) { if (! checkSwiftForAccount($account)) { @@ -709,15 +713,15 @@ else } print '
'.$langs->trans("BankAccountDomiciliation").''; + print '
'.$langs->trans("BankAccountDomiciliation").''; print nl2br($account->domiciliation); print "
'.$langs->trans("BankAccountOwner").''; + print '
'.$langs->trans("BankAccountOwner").''; print $account->proprio; print "
'.$langs->trans("BankAccountOwnerAddress").''; + print '
'.$langs->trans("BankAccountOwnerAddress").''; print nl2br($account->owner_address); print "
'; // Accountancy code - print ''; + print ''; print ''; // Accountancy journal if (! empty($conf->accounting->enabled)) { - print ''; + print ''; print ''; } @@ -799,24 +803,26 @@ else print ''; print ''."\n\n"; + dol_fiche_head(''); + print '
'.$langs->trans("AccountancyCode").'
'.$langs->trans("AccountancyCode").''.$account->account_number.'
'.$langs->trans("AccountancyJournal").'
'.$langs->trans("AccountancyJournal").''.$account->accountancy_journal.'
'; // Ref - print ''; + print ''; print ''; // Label - print ''; + print ''; print ''; // Type - print ''; + print ''; print ''; // Currency - print ''; print ''; // Status - print ''; + print ''; print ''; @@ -840,7 +846,7 @@ else else if (empty($selectedcode)) $selectedcode=$mysoc->country_code; $account->country_code = getCountry($selectedcode, 2); // Force country code on account to have following field on bank fields matching country rules - print ''; + print ''; print ''; // Conciliable - print ''; + print ''; print ''; // Balance - print ''; + print ''; print ''; - print ''; + print ''; print ''; // Web - print ''; + print ''; print ''; // Comment - print ''; + print ''; print ''; + print ''; print ''; // Label - print ''; + print ''; print ''; print '
'.$langs->trans("Ref").'
'.$langs->trans("Ref").'ref).'">
'.$langs->trans("Label").'
'.$langs->trans("Label").'label).'">
'.$langs->trans("AccountType").'
'.$langs->trans("AccountType").''; $formbank->select_type_comptes_financiers((isset($_POST["type"])?$_POST["type"]:$account->type),"type"); print '
'.$langs->trans("Currency"); + print '
'.$langs->trans("Currency"); print ''; print ''; @@ -828,7 +834,7 @@ else print '
'.$langs->trans("Status").'
'.$langs->trans("Status").''; print $form->selectarray("clos",array(0=>$account->status[0],1=>$account->status[1]),(isset($_POST["clos"])?$_POST["clos"]:$account->clos)); print '
'.$langs->trans("Country").'
'.$langs->trans("Country").''; print $form->select_country($selectedcode,'account_country_id'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); @@ -859,7 +865,7 @@ else print '
'.$langs->trans("Conciliable").'
'.$langs->trans("Conciliable").''; $conciliate=$account->canBeConciliated(); if ($conciliate == -2) print $langs->trans("No").' ('.$langs->trans("CashAccount").')'; @@ -868,19 +874,19 @@ else print '
'.$langs->trans("BalanceMinimalAllowed").'
'.$langs->trans("BalanceMinimalAllowed").'min_allowed).'">
'.$langs->trans("BalanceMinimalDesired").'
'.$langs->trans("BalanceMinimalDesired").'min_desired).'">
'.$langs->trans("Web").'
'.$langs->trans("Web").'url).'">'; print '
'.$langs->trans("Comment").'
'.$langs->trans("Comment").''; // Editor wysiwyg require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; @@ -903,7 +909,7 @@ else print ''; // If bank account - print ''; + print ''; print ''; print ''; @@ -975,22 +981,22 @@ else if ($account->getCountryCode() == 'IN') $bickey="SWIFT"; // IBAN - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print '"; - print ''; + print ''; print ''; - print '"; @@ -1004,25 +1010,27 @@ else // Accountancy code if (! empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) { - print ''; + print ''; print ''; } else { - print ''; + print ''; print ''; } // Accountancy journal if (! empty($conf->accounting->enabled)) { - print ''; + print ''; print ''; } print '
'.$langs->trans("BankName").'
'.$langs->trans("BankName").'
'.$langs->trans($ibankey).'
'.$langs->trans($ibankey).'
'.$langs->trans($bickey).'
'.$langs->trans($bickey).'
'.$langs->trans("BankAccountDomiciliation").''; + print '
'.$langs->trans("BankAccountDomiciliation").''; print "
'.$langs->trans("BankAccountOwner").'
'.$langs->trans("BankAccountOwner").''; print '
'.$langs->trans("BankAccountOwnerAddress").''; + print '
'.$langs->trans("BankAccountOwnerAddress").''; print "
'.$langs->trans("AccountancyCode").'
'.$langs->trans("AccountancyCode").'account_number).'">
'.$langs->trans("AccountancyCode").'
'.$langs->trans("AccountancyCode").'account_number).'">
'.$langs->trans("AccountancyJournal").'
'.$langs->trans("AccountancyJournal").'accountancy_journal).'">
'; - print '
'; + dol_fiche_end(); + + print '
'; print ''; print '     '; print ''; diff --git a/htdocs/compta/bank/graph.php b/htdocs/compta/bank/graph.php index d87d95f6026..6f885e12bde 100644 --- a/htdocs/compta/bank/graph.php +++ b/htdocs/compta/bank/graph.php @@ -441,7 +441,7 @@ else $datas = array(); $datamin = array(); $dataall = array(); - + $subtotal = 0; $day = $min; @@ -483,7 +483,7 @@ else if ($acct->min_desired) array_push($graph_datas[$i],$datamin[$i]); if ($acct->min_allowed) array_push($graph_datas[$i],$dataall[$i]); } - + $px3 = new DolGraph(); $px3->SetData($graph_datas); $arraylegends=array($langs->transnoentities("Balance")); @@ -760,7 +760,7 @@ print ''; $linkback = ''.$langs->trans("BackToList").''; // Ref -print ''; +print ''; print ''; // Label -print ''; +print ''; print ''; print '
'.$langs->trans("Ref").'
'.$langs->trans("Ref").''; if ($account) { @@ -799,7 +799,7 @@ else print '
'.$langs->trans("Label").'
'.$langs->trans("Label").''; if ($account && $_GET["option"]!='all') { @@ -813,6 +813,9 @@ print '
'; +dol_fiche_end(); + + print ''; // Navigation links @@ -876,8 +879,6 @@ if ($mode == 'showalltime') print '
'; -print "\n
\n"; - llxFooter(); diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index 1b5549b2c4e..eb56a95f96a 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005-2013 Regis Houssin * Copyright (C) 2015 Jean-François Ferry * @@ -128,22 +128,21 @@ if (empty($num)) $linkback = ''.$langs->trans("BackToList").''; // Ref - print '
'.$langs->trans("Ref").'
'.$langs->trans("Ref").''; print $form->showrefnav($acct, 'ref', $linkback, 1, 'ref'); print '
'.$langs->trans("Label").'
'.$langs->trans("Label").''.$acct->label.'
'; - print '
'; + dol_fiche_end(); - - print_barre_liste('', $page, $_SERVER["PHP_SELF"], "&account=".$acct->id, $sortfield, $sortorder,'',$numrows); + print_barre_liste('', $page, $_SERVER["PHP_SELF"], "&account=".$acct->id, $sortfield, $sortorder,'',$numrows); print ''; print ''; @@ -489,15 +488,15 @@ else if ($objp->amount < 0) { $totald = $totald + abs($objp->amount); - print '\n"; + print '\n"; } else { $totalc = $totalc + abs($objp->amount); - print "\n"; + print '\n"; } - print "\n"; + print '\n"; if ($user->rights->banque->modifier || $user->rights->banque->consolidate) { diff --git a/htdocs/compta/bank/treso.php b/htdocs/compta/bank/treso.php index 292742315bb..38f6b94952e 100644 --- a/htdocs/compta/bank/treso.php +++ b/htdocs/compta/bank/treso.php @@ -85,10 +85,6 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) } - /* - * - * - */ // Onglets $head=bank_prepare_head($acct); dol_fiche_head($head,'cash',$langs->trans("FinancialAccount"),0,'account'); @@ -98,25 +94,26 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) $linkback = ''.$langs->trans("BackToList").''; // Ref - print ''; + print ''; print ''; // Label - print ''; + print ''; print ''; print '
'.price($objp->amount * -1)." '.price($objp->amount * -1)."  ".price($objp->amount)." '.price($objp->amount)."".price($total)."'.price($total)."
'.$langs->trans("Ref").'
'.$langs->trans("Ref").''; print $form->showrefnav($acct, 'ref', $linkback, 1, 'ref'); print '
'.$langs->trans("Label").'
'.$langs->trans("Label").''.$acct->label.'
'; - print '
'; + dol_fiche_end(); + $solde = $acct->solde(0); /* * Affiche tableau des echeances a venir */ - print ''; + print '
'; // Ligne de titre tableau des ecritures print ''; @@ -134,13 +131,13 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) $var=!$var; print ''; print ''; - print ''; + print ''; print ''; $var=!$var; print ''; print ''; - print ''; + print ''; print ''; @@ -330,7 +327,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) $var=!$var; print ''; print ''; - print ''; + print ''; print ''; print "
'.$langs->trans("CurrentBalance").''.price($solde).''.price($solde).'
'.$langs->trans("RemainderToPay").'  
'.$langs->trans("FutureBalance").' ('.$acct->currency_code.')'.price($solde, 0, $langs, 0, 0, -1, $acct->currency_code).''.price($solde, 0, $langs, 0, 0, -1, $acct->currency_code).'
"; diff --git a/htdocs/compta/charges/index.php b/htdocs/compta/charges/index.php index 519c24792f9..183220d2004 100644 --- a/htdocs/compta/charges/index.php +++ b/htdocs/compta/charges/index.php @@ -94,15 +94,14 @@ if ($conf->salaries->enabled) print_fiche_titre($langs->trans("SalariesPayments").($year?' ('.$langs->trans("Year").' '.$year.')':''), '', ''); - $sql = "SELECT s.rowid, s.amount, s.label, s.datev as dm, s.salary, u.salary as current_salary"; + $sql = "SELECT s.rowid, s.amount, s.label, s.datep as datep, s.datev as datev, s.datesp, s.dateep, s.salary, u.salary as current_salary"; $sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s, ".MAIN_DB_PREFIX."user as u"; $sql.= " WHERE s.entity IN (".getEntity('user',1).")"; $sql.= " AND u.rowid = s.fk_user"; if ($year > 0) { - // Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance, - // ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire - $sql.= " AND s.datev between '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; + $sql.= " AND (s.datesp between '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; + $sql.= " OR s.dateep between '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."')"; } if (preg_match('/^s\./',$sortfield)) $sql.= $db->order($sortfield,$sortorder); @@ -114,11 +113,11 @@ if ($conf->salaries->enabled) $total = 0 ; print ''; print ''; - print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"s.datev","",$param,'width="140px"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"s.dateep","",$param,'width="140px"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"s.label","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"s.rowid","",$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"s.datev","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"s.datep","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder); print "\n"; $var=1; @@ -130,7 +129,8 @@ if ($conf->salaries->enabled) $var=!$var; print ""; - print ''."\n"; + + print ''."\n"; print "\n"; @@ -141,7 +141,7 @@ if ($conf->salaries->enabled) $sal_static->ref=$obj->rowid; print '\n"; - print '\n"; + print '\n"; print '"; print "\n"; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 1aaca07b57d..6621db1d241 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1969,6 +1969,8 @@ if ($action == 'create') print ''; print ''; + dol_fiche_head(''); + print '
'.dol_print_date($db->jdate($obj->dm),'day').''.dol_print_date($db->jdate($obj->dateep),'day').'".$obj->label."'.$sal_static->getNomUrl(1)."'.dol_print_date($db->jdate($obj->dm),'day')."'.dol_print_date($db->jdate($obj->datep),'day')."'.price($obj->amount)."
'; // Ref @@ -2099,7 +2101,7 @@ if ($action == 'create') print ''; @@ -2154,7 +2156,7 @@ if ($action == 'create') print ''; @@ -2200,7 +2202,7 @@ if ($action == 'create') // Show credit note options only if we checked credit note print ' @@ -646,7 +646,7 @@ if ($resql) print_liste_field_titre($langs->trans('RefCustomer'),$_SERVER["PHP_SELF"],'f.ref_client','',$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"f.datef","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateDue"),$_SERVER["PHP_SELF"],"f.date_lim_reglement","",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("PaymentMode"),$_SERVER["PHP_SELF"],"f.fk_reglement_mode","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("AmountHT"),$_SERVER["PHP_SELF"],"f.total","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Taxes"),$_SERVER["PHP_SELF"],"f.tva","",$param,'align="right"',$sortfield,$sortorder); @@ -683,7 +683,7 @@ if ($resql) print ''; print ''; print ''; print ''; print ''; @@ -799,7 +799,7 @@ if ($resql) print ''; // Remain to receive - print ''; + print ''; // Status of invoice print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; // Amount Local Taxes if ($mysoc->localtax1_assuj=="1") //Localtax1 { print ''; - print ''; + print ''; print ''; } if ($mysoc->localtax2_assuj=="1") //Localtax2 { print ''; - print ''; + print ''; print ''; } - print ''; + print ''; print ''; // We can also use bcadd to avoid pb with floating points @@ -428,7 +428,7 @@ if ($object->id > 0) //$resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT); $resteapayer = price2num($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits,'MT'); - print ''; + print ''; print ''; // Statut diff --git a/htdocs/compta/localtax/index.php b/htdocs/compta/localtax/index.php index 33ebfd3b1be..1e8570d7378 100644 --- a/htdocs/compta/localtax/index.php +++ b/htdocs/compta/localtax/index.php @@ -86,7 +86,7 @@ function pt ($db, $sql, $date) $i++; } - print '"; + print '"; print "
'; - $form->select_types_paiements($search_paymentmode, 'search_paymentmode'); + $form->select_types_paiements($search_paymentmode, 'search_paymentmode', '', 0, 0, 1); print ' '.((! empty($objp->am) || ! empty($cn) || ! empty($dep))?price($objp->total_ttc-$objp->am-$cn-$dep):' ').''.(((! empty($objp->total_ttc) || ! empty($objp->am) || ! empty($cn) || ! empty($dep)) && ($objp->total_ttc - $objp->am - $cn - $dep)) ? price($objp->total_ttc - $objp->am - $cn - $dep):' ').''; diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 9d8b9123b68..6954ad46249 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -399,27 +399,27 @@ if ($object->id > 0) // Montants print '
'.$langs->trans('AmountHT').''.price($object->total_ht).''.price($object->total_ht).''.$langs->trans('Currency'.$conf->currency).'
'.$langs->trans('AmountVAT').''.price($object->total_tva).'
'.$langs->trans('AmountVAT').''.price($object->total_tva).''.$langs->trans('Currency'.$conf->currency).'
'.$langs->transcountry("AmountLT1",$mysoc->country_code).''.price($object->total_localtax1).''.price($object->total_localtax1).''.$langs->trans("Currency".$conf->currency).'
'.$langs->transcountry("AmountLT2",$mysoc->country_code).''.price($object->total_localtax2).''.price($object->total_localtax2).''.$langs->trans("Currency".$conf->currency).'
'.$langs->trans('AmountTTC').''.price($object->total_ttc).'
'.$langs->trans('AmountTTC').''.price($object->total_ttc).''.$langs->trans('Currency'.$conf->currency).'
'.$langs->trans('RemainderToPay').''.price($resteapayer).'
'.$langs->trans('RemainderToPay').''.price($resteapayer).''.$langs->trans('Currency'.$conf->currency).'
'.$langs->trans("Total")." :".price($total)." 
'.$langs->trans("Total")." :".price($total)." 
"; $db->free($result); @@ -253,7 +253,7 @@ for ($m = 1 ; $m < 13 ; $m++ ) { $subtotalcoll=0; $subtotalpaye=0; $subtotal=0; } } -print ''.$langs->trans("TotalToPay").':'.price($total).''; +print ''.$langs->trans("TotalToPay").':'.price($total).''; print " \n"; print ''; diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index 6b218d52430..dba17a4798c 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -414,11 +414,11 @@ if ($action == 'new') { jQuery("#checkall_'.$bid.'").click(function() { - jQuery(".checkforremise_'.$bid.'").attr(\'checked\', true); + jQuery(".checkforremise_'.$bid.'").prop(\'checked\', true); }); jQuery("#checknone_'.$bid.'").click(function() { - jQuery(".checkforremise_'.$bid.'").attr(\'checked\', false); + jQuery(".checkforremise_'.$bid.'").prop(\'checked\', false); }); }); diff --git a/htdocs/compta/resultat/bilan.php b/htdocs/compta/resultat/bilan.php deleted file mode 100644 index 2f31b9e11b7..00000000000 --- a/htdocs/compta/resultat/bilan.php +++ /dev/null @@ -1,57 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/compta/resultat/bilan.php - * \ingroup compta - * \brief Fichier page bilan compta - */ - -require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'; - -// Security check -$socid = GETPOST('socid','int'); -if ($user->societe_id > 0) $socid = $user->societe_id; -if (! empty($conf->comptabilite->enabled)) $result=restrictedArea($user,'compta','','','resultat'); -if (! empty($conf->accounting->enabled)) $result=restrictedArea($user,'accounting','','','comptarapport'); - - -/* - * Views - */ - -llxHeader(); - -$year=$_GET["year"]; -$month=$_GET["month"]; -if (! $year) { $year = strftime("%Y", time()); } - - -/* Le compte de r�sultat est un document officiel requis par l'administration selon le status ou activit� */ - -print_titre("Bilan".($year?" annee $year":"")); - -print '
'; - -print $langs->trans("FeatureNotYetAvailable"); - - -llxFooter(); - -$db->close(); diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 65e6866befe..d9ad2825c88 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -144,6 +144,9 @@ else { $builddate=time(); //$exportlink=$langs->trans("NotYetAvailable"); } + +$hselected = 'report'; + report_header($name,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,array('modecompta'=>$modecompta),$calcmode); // Show report array diff --git a/htdocs/compta/resultat/compteres.php b/htdocs/compta/resultat/compteres.php deleted file mode 100644 index b3b6166589f..00000000000 --- a/htdocs/compta/resultat/compteres.php +++ /dev/null @@ -1,52 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'; - - -// Security check -$socid = GETPOST('socid','int'); -if ($user->societe_id > 0) $socid = $user->societe_id; -if (! empty($conf->comptabilite->enabled)) $result=restrictedArea($user,'compta','','','resultat'); -if (! empty($conf->accounting->enabled)) $result=restrictedArea($user,'accounting','','','comptarapport'); - - - -/* - * Views - */ -llxHeader(); - -$year=$_GET["year"]; -$month=$_GET["month"]; -if (! $year) { $year = strftime("%Y", time()); } - - -/* Le compte de resultat est un document officiel requis par l'administration selon le status ou activite */ - -print_titre("Compte de resultat".($year?" annee $year":"")); - -print '
'; - -print $langs->trans("FeatureNotYetAvailable"); - - -llxFooter(); - -$db->close(); diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index 544c4d8a9e2..94cac967a40 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -88,6 +88,9 @@ else { $builddate=time(); //$exportlink=$langs->trans("NotYetAvailable"); } + +$hselected='report'; + report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,array('modecompta'=>$modecompta),$calcmode); diff --git a/htdocs/compta/salaries/card.php b/htdocs/compta/salaries/card.php index 1fd3e1e59e0..3389cedec56 100644 --- a/htdocs/compta/salaries/card.php +++ b/htdocs/compta/salaries/card.php @@ -45,7 +45,7 @@ $socid = GETPOST("socid","int"); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'salaries', '', '', ''); -$sal = new PaymentSalary($db); +$object = new PaymentSalary($db); // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('salarycard','globalcard')); @@ -66,55 +66,61 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel")) { $error=0; - $datev=dol_mktime(12,0,0, $_POST["datevmonth"], $_POST["datevday"], $_POST["datevyear"]); $datep=dol_mktime(12,0,0, $_POST["datepmonth"], $_POST["datepday"], $_POST["datepyear"]); + $datev=dol_mktime(12,0,0, $_POST["datevmonth"], $_POST["datevday"], $_POST["datevyear"]); $datesp=dol_mktime(12,0,0, $_POST["datespmonth"], $_POST["datespday"], $_POST["datespyear"]); $dateep=dol_mktime(12,0,0, $_POST["dateepmonth"], $_POST["dateepday"], $_POST["dateepyear"]); - - $sal->accountid=GETPOST("accountid","int"); - $sal->fk_user=GETPOST("fk_user","int"); - $sal->datev=$datev; - $sal->datep=$datep; - $sal->amount=price2num(GETPOST("amount")); - $sal->label=GETPOST("label"); - $sal->datesp=$datesp; - $sal->dateep=$dateep; - $sal->note=GETPOST("note"); - $sal->type_payment=GETPOST("paymenttype"); - $sal->num_payment=GETPOST("num_payment"); - $sal->fk_user_creat=$user->id; + if (empty($datev)) $datev=$datep; + + $object->accountid=GETPOST("accountid","int"); + $object->fk_user=GETPOST("fk_user","int"); + $object->datev=$datev; + $object->datep=$datep; + $object->amount=price2num(GETPOST("amount")); + $object->label=GETPOST("label"); + $object->datesp=$datesp; + $object->dateep=$dateep; + $object->note=GETPOST("note"); + $object->type_payment=GETPOST("paymenttype"); + $object->num_payment=GETPOST("num_payment"); + $object->fk_user_creat=$user->id; // Set user current salary as ref salaray for the payment $fuser=new User($db); $fuser->fetch(GETPOST("fk_user","int")); - $sal->salary=$fuser->salary; + $object->salary=$fuser->salary; if (empty($datep) || empty($datev) || empty($datesp) || empty($dateep)) { setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")),'errors'); $error++; } - if (empty($sal->fk_user) || $sal->fk_user < 0) + if (empty($object->fk_user) || $object->fk_user < 0) { setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Employee")),'errors'); $error++; } - if (empty($sal->type_payment) || $sal->type_payment < 0) + if (empty($object->type_payment) || $object->type_payment < 0) { setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("PaymentMode")),'errors'); $error++; } - if (empty($sal->amount)) + if (empty($object->amount)) { setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Amount")),'errors'); $error++; } - + if (! empty($conf->banque->enabled) && ! $object->accountid > 0) + { + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Account")),'errors'); + $error++; + } + if (! $error) { $db->begin(); - $ret=$sal->create($user); + $ret=$object->create($user); if ($ret > 0) { $db->commit(); @@ -124,7 +130,7 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel")) else { $db->rollback(); - setEventMessage($sal->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); $action="create"; } } @@ -134,19 +140,19 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel")) if ($action == 'delete') { - $result=$sal->fetch($id); + $result=$object->fetch($id); - if ($sal->rappro == 0) + if ($object->rappro == 0) { $db->begin(); - $ret=$sal->delete($user); + $ret=$object->delete($user); if ($ret > 0) { - if ($sal->fk_bank) + if ($object->fk_bank) { $accountline=new AccountLine($db); - $result=$accountline->fetch($sal->fk_bank); + $result=$accountline->fetch($object->fk_bank); if ($result > 0) $result=$accountline->delete($user); // $result may be 0 if not found (when bank entry was deleted manually and fk_bank point to nothing) } @@ -158,15 +164,15 @@ if ($action == 'delete') } else { - $sal->error=$accountline->error; + $object->error=$accountline->error; $db->rollback(); - setEventMessage($sal->error,'errors'); + setEventMessage($object->error,'errors'); } } else { $db->rollback(); - setEventMessage($sal->error,'errors'); + setEventMessage($object->error,'errors'); } } else @@ -186,8 +192,8 @@ $form = new Form($db); if ($id) { - $salpayment = new PaymentSalary($db); - $result = $salpayment->fetch($id); + $object = new PaymentSalary($db); + $result = $object->fetch($id); if ($result <= 0) { dol_print_error($db); @@ -221,6 +227,8 @@ if ($action == 'create') print_fiche_titre($langs->trans("NewSalaryPayment"),'', 'title_accountancy.png'); + dol_fiche_head('', ''); + print ''; print ""; @@ -228,7 +236,7 @@ if ($action == 'create') print $form->select_date((empty($datep)?-1:$datep),"datep",'','','','add',1,1); print ''; - print ''; @@ -281,7 +289,7 @@ if ($action == 'create') print '
'.$langs->trans("DateValue").''; + print '
'.$langs->trans("DateValue").''; print $form->select_date((empty($datev)?-1:$datev),"datev",'','','','add',1,1); print '
'; - print "
"; + dol_fiche_end(); print '
'; print ''; @@ -311,45 +319,45 @@ if ($id) print ""; print ''.$langs->trans("Ref").''; - print $salpayment->ref; + print $object->ref; print ''; // Person print ''.$langs->trans("Person").''; $usersal=new User($db); - $usersal->fetch($salpayment->fk_user); + $usersal->fetch($object->fk_user); print $usersal->getNomUrl(1); print ''; // Label - print ''.$langs->trans("Label").''.$salpayment->label.''; + print ''.$langs->trans("Label").''.$object->label.''; print ""; print ''.$langs->trans("DateStartPeriod").''; - print dol_print_date($salpayment->datesp,'day'); + print dol_print_date($object->datesp,'day'); print ''; print ''.$langs->trans("DateEndPeriod").''; - print dol_print_date($salpayment->dateep,'day'); + print dol_print_date($object->dateep,'day'); print ''; print ""; print ''.$langs->trans("DatePayment").''; - print dol_print_date($salpayment->datep,'day'); + print dol_print_date($object->datep,'day'); print ''; print ''.$langs->trans("DateValue").''; - print dol_print_date($salpayment->datev,'day'); + print dol_print_date($object->datev,'day'); print ''; - print ''.$langs->trans("Amount").''.price($salpayment->amount,0,$outputlangs,1,-1,-1,$conf->currency).''; + print ''.$langs->trans("Amount").''.price($object->amount,0,$outputlangs,1,-1,-1,$conf->currency).''; if (! empty($conf->banque->enabled)) { - if ($salpayment->fk_account > 0) + if ($object->fk_account > 0) { $bankline=new AccountLine($db); - $bankline->fetch($salpayment->fk_bank); + $bankline->fetch($object->fk_bank); print ''; print ''.$langs->trans('BankTransactionLine').''; @@ -362,21 +370,22 @@ if ($id) // Other attributes $parameters=array('colspan' => ' colspan="3"'); - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$salpayment,$action); // Note that $action and $object may have been modified by hook + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook print ''; - print '
'; + dol_fiche_end(); + /* - * Boutons d'actions - */ - print "
\n"; - if ($salpayment->rappro == 0) + * Action buttons + */ + print '
'."\n"; + if ($object->rappro == 0) { if (! empty($user->rights->salaries->delete)) { - print ''.$langs->trans("Delete").''; + print ''.$langs->trans("Delete").''; } else { diff --git a/htdocs/compta/salaries/index.php b/htdocs/compta/salaries/index.php index 37ab81dff34..078b4acb057 100644 --- a/htdocs/compta/salaries/index.php +++ b/htdocs/compta/salaries/index.php @@ -36,6 +36,7 @@ if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'salaries', '', '', ''); $search_ref = GETPOST('search_ref','int'); +$search_user = GETPOST('search_user','alpha'); $search_label = GETPOST('search_label','alpha'); $search_amount = GETPOST('search_amount','alpha'); $sortfield = GETPOST("sortfield",'alpha'); @@ -46,7 +47,7 @@ $offset = $conf->liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; $limit = $conf->liste_limit; -if (! $sortfield) $sortfield="s.datev"; +if (! $sortfield) $sortfield="s.datep"; if (! $sortorder) $sortorder="DESC"; $filtre=$_GET["filtre"]; @@ -85,7 +86,7 @@ $salstatic = new PaymentSalary($db); $userstatic = new User($db); $sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.admin, u.salary as current_salary, u.fk_soc as fk_soc,"; -$sql.= " s.rowid, s.fk_user, s.amount, s.salary, s.label, s.datev as dm, s.fk_typepayment as type, s.num_payment,"; +$sql.= " s.rowid, s.fk_user, s.amount, s.salary, s.label, s.datep as datep, s.datev as datev, s.fk_typepayment as type, s.num_payment,"; $sql.= " pst.code as payment_code"; $sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON s.fk_typepayment = pst.id,"; @@ -95,7 +96,8 @@ $sql.= " AND s.entity = ".$conf->entity; // Search criteria if ($search_ref) $sql.=" AND s.rowid=".$search_ref; -if ($search_label) $sql.=" AND s.label LIKE '%".$db->escape($search_label)."%'"; +if ($search_user) $sql.=natural_search(array('u.login', 'u.lastname', 'u.firstname', 'u.email', 'u.note'), $search_user); +if ($search_label) $sql.=natural_search(array('s.label'), $search_label); if ($search_amount) $sql.=natural_search("s.amount", $search_amount, 1); if ($filtre) { $filtre=str_replace(":","=",$filtre); @@ -129,7 +131,7 @@ if ($result) print_liste_field_titre($langs->trans("Person"),$_SERVER["PHP_SELF"],"u.rowid","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"s.salary","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"s.label","",$param,'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"s.datev","",$param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"s.datep","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("PaymentMode"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre(""); @@ -141,11 +143,14 @@ if ($result) print ''; print ''; // People - print ' '; + print ''; + print ''; + print ''; // Current salary print ' '; // Label - print ''; + print ''; + // Date print ' '; // Type print ''; @@ -170,6 +175,7 @@ if ($result) $userstatic->login=$obj->login; $userstatic->email=$obj->email; $userstatic->societe_id=$obj->fk_soc; + $salstatic->id=$obj->rowid; $salstatic->ref=$obj->rowid; // Ref @@ -180,7 +186,8 @@ if ($result) print "".($obj->salary?price($obj->salary):'')."\n"; // Label payment print "".dol_trunc($obj->label,40)."\n"; - print ''.dol_print_date($db->jdate($obj->dm),'day')."\n"; + // Date payment + print ''.dol_print_date($db->jdate($obj->datep),'day')."\n"; // Type print ''.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.''; // Amount diff --git a/htdocs/compta/salaries/info.php b/htdocs/compta/salaries/info.php index 4d060685d54..cbc0c1742ff 100644 --- a/htdocs/compta/salaries/info.php +++ b/htdocs/compta/salaries/info.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2005-2015 Laurent Destailleur * Copyright (C) 2015 Charlie BENKE * * This program is free software; you can redistribute it and/or modify @@ -23,7 +23,7 @@ */ require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/paymentsalary.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/salaries.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index 08f9380c905..d58e0add8ab 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -25,8 +25,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; -/** \class PaymentSocialContribution - * \brief Class to manage payments of social contributions +/** + * Class to manage payments of social contributions */ class PaymentSocialContribution extends CommonObject { diff --git a/htdocs/compta/tva/index.php b/htdocs/compta/tva/index.php index c0dcff6d5c3..c84c7d2b633 100644 --- a/htdocs/compta/tva/index.php +++ b/htdocs/compta/tva/index.php @@ -93,7 +93,7 @@ function pt ($db, $sql, $date) $i++; } - print ''.$langs->trans("Total")." :".price($total)." "; + print ''.$langs->trans("Total")." :".price($total)." "; print ""; $db->free($result); @@ -216,7 +216,7 @@ for ($m = 1 ; $m < 13 ; $m++ ) $subtotalcoll=0; $subtotalpaye=0; $subtotal=0; } } -print ''.$langs->trans("TotalToPay").':'.price($total).''; +print ''.$langs->trans("TotalToPay").':'.price($total).''; print " \n"; print ''; diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index dcc7949340e..d7841677536 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -798,19 +798,19 @@ else print ''; // Note Public - print ''; + print ''; $doleditor = new DolEditor('note_public', $object->note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); print $doleditor->Create(1); print ''; // Note Private - print ''; + print ''; $doleditor = new DolEditor('note_private', $object->note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); print $doleditor->Create(1); print ''; // Statut - print ''.$langs->trans("Status").''; + print ''.$langs->trans("Status").''; print ''; print $object->getLibStatut(5); print ''; @@ -1025,16 +1025,16 @@ else print ''; // Note Public - print ''.$langs->trans("NotePublic").''; + print ''.$langs->trans("NotePublic").''; print nl2br($object->note_public); print ''; // Note Private - print ''.$langs->trans("NotePrivate").''; + print ''.$langs->trans("NotePrivate").''; print nl2br($object->note_private); // Statut - print ''.$langs->trans("Status").''; + print ''.$langs->trans("Status").''; print ''; print $object->getLibStatut(5); print ''; diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 21f48e58fb3..ec8004aa18a 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -437,7 +437,7 @@ if ($result) print ''; - if ($num > $limit) print_barre_liste('', $page, $_SERVER["PHP_SELF"], '&begin='.$begin.'&view='.$view.'&userid='.$userid, $sortfield, $sortorder, '', $num, $nbtotalofrecords, ''); + if ($num > $limit) print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, ''); $db->free($result); } diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 254185cc63d..cc9a394d983 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1021,12 +1021,12 @@ if ($action == 'create') } // Commercial suivi - print ''.$langs->trans("TypeContact_contrat_internal_SALESREPFOLL").''; + print ''.$langs->trans("TypeContact_contrat_internal_SALESREPFOLL").''; print $form->select_dolusers(GETPOST("commercial_suivi_id")?GETPOST("commercial_suivi_id"):$user->id,'commercial_suivi_id',1,''); print ''; // Commercial signature - print ''.$langs->trans("TypeContact_contrat_internal_SALESREPSIGN").''; + print ''.$langs->trans("TypeContact_contrat_internal_SALESREPSIGN").''; print $form->select_dolusers(GETPOST("commercial_signature_id")?GETPOST("commercial_signature_id"):$user->id,'commercial_signature_id',1,''); print ''; diff --git a/htdocs/core/actions_fetchobject.inc.php b/htdocs/core/actions_fetchobject.inc.php index 463b3113c2a..3014e8652a6 100644 --- a/htdocs/core/actions_fetchobject.inc.php +++ b/htdocs/core/actions_fetchobject.inc.php @@ -25,15 +25,19 @@ // $action must be defined // $object must be defined (object is loaded in this file with fetch) +// $cancel must be defined // $id or $ref must be defined (object is loaded in this file with fetch) -if ($id > 0 || ! empty($ref)) +if (($id > 0 || ! empty($ref)) && empty($cancel)) { $ret = $object->fetch($id,$ref); - if ($ret > 0) { + if ($ret > 0) + { $object->fetch_thirdparty(); - $id=$object->id; - } else { + $id = $object->id; + } + else + { setEventMessages($object->error, $object->errors, 'errors'); $action=''; } diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index e25107e24fa..1c132502b78 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1124,7 +1124,7 @@ class ExtraFields if (!empty($value)) { $checked=' checked '; } - $value=''; + $value=''; } elseif ($type == 'mail') { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 150ca48e477..406ad24db4b 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -56,9 +56,6 @@ class Form var $cache_types_fees=array(); var $cache_vatrates=array(); - var $tva_taux_value; - var $tva_taux_libelle; - /** * Constructor @@ -3842,10 +3839,10 @@ class Form /** * Output an HTML select vat rate * - * @param string $htmlname Nom champ html - * @param float $selectedrate Forcage du taux tva pre-selectionne. Mettre '' pour aucun forcage. - * @param Societe $societe_vendeuse Objet societe vendeuse - * @param Societe $societe_acheteuse Objet societe acheteuse + * @param string $htmlname Name of html select field + * @param float $selectedrate Force preselected vat rate. Use '' for no forcing. + * @param Societe $societe_vendeuse Thirdparty seller + * @param Societe $societe_acheteuse Thirdparty buyer * @param int $idprod Id product * @param int $info_bits Miscellaneous information on line (1 for NPR) * @param int $type ''=Unknown, 0=Product, 1=Service (Used if idprod not defined) @@ -3863,9 +3860,6 @@ class Form global $langs,$conf,$mysoc; $return=''; - $txtva=array(); - $libtva=array(); - $nprtva=array(); // Define defaultnpr and defaultttx $defaultnpr=($info_bits & 0x01); @@ -3972,10 +3966,6 @@ class Form $return.= '>'.vatrate($rate['libtva']); $return.= $rate['nprtva'] ? ' *': ''; $return.= ''; - - $this->tva_taux_value[] = $rate['txtva']; - $this->tva_taux_libelle[] = $rate['libtva']; - $this->tva_taux_npr[] = $rate['nprtva']; } if (! $options_only) $return.= ''; @@ -4356,7 +4346,7 @@ class Form '; } - $out.=''; if ($show_empty) { @@ -4425,7 +4415,7 @@ class Form static function selectArrayAjax($url, $htmlname, $array, $id='', $show_empty=0, $key_in_label=0, $value_as_key=0, $moreparam='', $translate=0, $maxlen=0, $disabled=0, $sort='', $morecss='', $addjscombo=0) { $out = ''; - + // Add code for jquery to use multiselect if ($addjscombo && empty($conf->dol_use_jmobile)) { @@ -4466,14 +4456,14 @@ class Form else { // TODO get values from ajax page to use a standard already completed array - + } - + $out.=self::selectarray('.'.$htmlname, $array, $id, $show_empty, $key_in_label, $value_as_key, '', $translate, $maxlen, $disabled, $sort, '', 0); - + return $out; } - + /** * Show a multiselect form from an array. * @@ -4539,7 +4529,7 @@ class Form // Try also magic suggest // Add data-role="none" to disable jmobile decoration - $out = ''."\n"; if (is_array($array) && ! empty($array)) { if ($value_as_key) $array=array_combine($array, $array); @@ -4568,7 +4558,7 @@ class Form } - + /** * Render list of categories linked to object with id $id and type $type * diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index c656cb0432d..9322680a682 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -95,17 +95,17 @@ class FormActions percentage.val(value); if (defaultvalue == -1) { - percentage.attr('disabled', 'disabled'); + percentage.prop('disabled', true); $('.hideifna').hide(); } else if (defaultvalue == 0) { percentage.val(0); - percentage.attr('disabled', 'disabled'); + percentage.prop('disabled', true); $('.hideifna').show(); } else if (defaultvalue == 100) { percentage.val(100); - percentage.attr('disabled', 'disabled'); + percentage.prop('disabled', true); $('.hideifna').show(); } else { diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 7870371a4ab..cecbefa0dd9 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -5,7 +5,8 @@ * Copyright (C) 2013 Charles-Fr BENKE * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2014 Marcos García - * + * Copyright (C) 2015 Bahfir Abbes + * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or diff --git a/htdocs/core/db/Database.interface.php b/htdocs/core/db/Database.interface.php index f27c4e75189..ab38cdf378c 100644 --- a/htdocs/core/db/Database.interface.php +++ b/htdocs/core/db/Database.interface.php @@ -4,7 +4,7 @@ * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2014 Raphaël Doursenaud + * Copyright (C) 2014-2015 Raphaël Doursenaud * * 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 @@ -21,7 +21,7 @@ */ /** - * Class to manage Dolibarr database access for a Mysql database + * Class to manage Dolibarr database access for an SQL database */ interface Database { @@ -111,13 +111,6 @@ interface Database */ function error(); - /** - * Return label of manager - * - * @return string Label - */ - function getLabel(); - /** * List tables into a database * @@ -141,7 +134,7 @@ interface Database * @param string $sortorder Sort order * @return string String to provide syntax of a sort sql string */ - function order($sortfield = 0, $sortorder = 0); + function order($sortfield = null, $sortorder = null); /** * Decrypt sensitive data in database @@ -216,7 +209,7 @@ interface Database * @param string $login login * @param string $passwd password * @param string $name name of database (not used for mysql, used for pgsql) - * @param string $port Port of database server + * @param int $port Port of database server * @return resource Database access handler * @see close */ @@ -293,10 +286,10 @@ interface Database * @param string $type Type de la table * @param array $unique_keys Tableau associatifs Nom de champs qui seront clef unique => valeur * @param array $fulltext_keys Tableau des Nom de champs qui seront indexes en fulltext - * @param string $keys Tableau des champs cles noms => valeur + * @param array $keys Tableau des champs cles noms => valeur * @return int <0 if KO, >=0 if OK */ - function DDLCreateTable($table, $fields, $primary_key, $type, $unique_keys = "", $fulltext_keys = "", $keys = ""); + function DDLCreateTable($table, $fields, $primary_key, $type, $unique_keys = null, $fulltext_keys = null, $keys = null); /** * Return list of available charset that can be used to store data in database @@ -382,15 +375,15 @@ interface Database ); /** - * Convert (by PHP) a PHP server TZ string date into a Timestamps date (GMT if gm=true) - * 19700101020000 -> 3600 with TZ+1 and gmt=0 - * 19700101020000 -> 7200 whaterver is TZ if gmt=1 - * + * Convert (by PHP) a PHP server TZ string date into a Timestamps date (GMT if gm=true) + * 19700101020000 -> 3600 with TZ+1 and gmt=0 + * 19700101020000 -> 7200 whaterver is TZ if gmt=1 + * * @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS) - * @param int $gm 1=Input informations are GMT values, otherwise local to server TZ + * @param bool $gm 1=Input informations are GMT values, otherwise local to server TZ * @return int|string Date TMS or '' - */ - function jdate($string, $gm=false); + */ + function jdate($string, $gm=false); /** * Encrypt sensitive data in database @@ -424,7 +417,7 @@ interface Database * @param resource $resultset Fre cursor * @return void */ - function free($resultset = 0); + function free($resultset = null); /** * Close database connexion diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php index 0aae168be79..6a7c5276025 100644 --- a/htdocs/core/db/DoliDB.class.php +++ b/htdocs/core/db/DoliDB.class.php @@ -1,6 +1,6 @@ + * Copyright (C) 2013-2015 Raphaël Doursenaud * Copyright (C) 2014-2015 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify @@ -29,41 +29,43 @@ require_once DOL_DOCUMENT_ROOT .'/core/db/Database.interface.php'; */ abstract class DoliDB implements Database { - //! Database handler - public $db; - //! Database type - public $type; - //! Charset used to force charset when creating database - public $forcecharset='utf8'; - //! Collate used to force collate when creating database - public $forcecollate='utf8_general_ci'; - //! Resultset of last query - private $_results; - //! 1 if connected, else 0 - public $connected; - //! 1 if database selected, else 0 - public $database_selected; - //! Selected database name - public $database_name; - //! Database username - public $database_user; - //! Database host - public $database_host; - //! Database port - public $database_port; - //! >=1 if a transaction is opened, 0 otherwise - public $transaction_opened; - //! Last successful query - public $lastquery; - //! Last failed query - public $lastqueryerror; - //! Last error message - public $lasterror; - //! Last error number - public $lasterrno; + /** @var resource Database handler */ + public $db; + /** @var string Database type */ + public $type; + /** @var string Charset used to force charset when creating database */ + public $forcecharset='utf8'; + /** @var string Collate used to force collate when creating database */ + public $forcecollate='utf8_general_ci'; + /** @var resource Resultset of last query */ + private $_results; + /** @var bool true if connected, else false */ + public $connected; + /** @var bool true if database selected, else false */ + public $database_selected; + /** @var string Selected database name */ + public $database_name; + /** @var string Database username */ + public $database_user; + /** @var string Database host */ + public $database_host; + /** @var int Database port */ + public $database_port; + /** @var int >=1 if a transaction is opened, 0 otherwise */ + public $transaction_opened; + /** @var string Last successful query */ + public $lastquery; + /** @ar string Last failed query */ + public $lastqueryerror; + /** @var string Last error message */ + public $lasterror; + /** @var int Last error number */ + public $lasterrno; - public $ok; - public $error; + /** @var bool Status */ + public $ok; + /** @var string */ + public $error; /** * Format a SQL IF @@ -205,16 +207,6 @@ abstract class DoliDB implements Database return preg_split("/[\.,-]/",$this->getVersion()); } - /** - * Return label of manager - * - * @return string Label - */ - function getLabel() - { - return $this->label; - } - /** * Return last request executed with query() * @@ -232,9 +224,9 @@ abstract class DoliDB implements Database * @param string $sortorder Sort order * @return string String to provide syntax of a sort sql string */ - function order($sortfield=0,$sortorder=0) + function order($sortfield=null,$sortorder=null) { - if ($sortfield) + if (isset($sortfield)) { $return=''; $fields=explode(',',$sortfield); @@ -244,7 +236,9 @@ abstract class DoliDB implements Database else $return.=','; $return.=preg_replace('/[^0-9a-z_\.]/i','',$val); - if ($sortorder) $return.=' '.preg_replace('/[^0-9a-z]/i','',$sortorder); + if (isset($sortorder)) { + $return.=' '.preg_replace('/[^0-9a-z]/i','',$sortorder); + } } return $return; } @@ -270,7 +264,7 @@ abstract class DoliDB implements Database * 19700101020000 -> 7200 whaterver is TZ if gmt=1 * * @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS) - * @param int $gm 1=Input informations are GMT values, otherwise local to server TZ + * @param bool $gm 1=Input informations are GMT values, otherwise local to server TZ * @return int|string Date TMS or '' */ function jdate($string, $gm=false) diff --git a/htdocs/core/db/mssql.class.php b/htdocs/core/db/mssql.class.php index 3523e21bdf0..0be65dfe2e6 100644 --- a/htdocs/core/db/mssql.class.php +++ b/htdocs/core/db/mssql.class.php @@ -21,7 +21,7 @@ /** * \file htdocs/core/db/mssql.class.php - * \brief Fichier de la classe permettant de gerer une base mssql + * \brief Fichier de la classe permettant de gerer une base MSSQL */ require_once DOL_DOCUMENT_ROOT .'/core/db/DoliDB.class.php'; @@ -41,7 +41,7 @@ class DoliDBMssql extends DoliDB var $forcecollate='latin1_swedish_ci'; // Can't be static as it may be forced with a dynamic value //! Version min database const VERSIONMIN='2000'; - //! Resultset of last query + /** @var resource Resultset of last query */ private $_results; /** @@ -57,7 +57,7 @@ class DoliDBMssql extends DoliDB */ function __construct($type, $host, $user, $pass, $name='', $port=0) { - global $conf,$langs; + global $langs; $this->database_user=$user; $this->database_host=$host; @@ -66,8 +66,8 @@ class DoliDBMssql extends DoliDB if (! function_exists("mssql_connect")) { - $this->connected = 0; - $this->ok = 0; + $this->connected = false; + $this->ok = false; $this->error="Mssql PHP functions for using MSSql driver are not available in this version of PHP"; dol_syslog(get_class($this)."::DoliDBMssql : MSsql PHP functions for using MSsql driver are not available in this version of PHP",LOG_ERR); return $this->ok; @@ -75,8 +75,8 @@ class DoliDBMssql extends DoliDB if (! $host) { - $this->connected = 0; - $this->ok = 0; + $this->connected = false; + $this->ok = false; $this->error=$langs->trans("ErrorWrongHostParameter"); dol_syslog(get_class($this)."::DoliDBMssql : Erreur Connect, wrong host parameters",LOG_ERR); return $this->ok; @@ -88,14 +88,14 @@ class DoliDBMssql extends DoliDB { // Si client connecte avec charset different de celui de la base Dolibarr // (La base Dolibarr a ete forcee en this->forcecharset a l'install) - $this->connected = 1; - $this->ok = 1; + $this->connected = true; + $this->ok = true; } else { // host, login ou password incorrect - $this->connected = 0; - $this->ok = 0; + $this->connected = false; + $this->ok = false; $this->error=mssql_get_last_message(); dol_syslog(get_class($this)."::DoliDBMssql : Erreur Connect mssql_get_last_message=".$this->error,LOG_ERR); } @@ -105,15 +105,15 @@ class DoliDBMssql extends DoliDB { if ($this->select_db($name)) { - $this->database_selected = 1; + $this->database_selected = true; $this->database_name = $name; - $this->ok = 1; + $this->ok = true; } else { - $this->database_selected = 0; + $this->database_selected = false; $this->database_name = ''; - $this->ok = 0; + $this->ok = false; $this->error=$this->error(); dol_syslog(get_class($this)."::DoliDBMssql : Erreur Select_db ".$this->error,LOG_ERR); } @@ -121,7 +121,7 @@ class DoliDBMssql extends DoliDB else { // Pas de selection de base demandee, ok ou ko - $this->database_selected = 0; + $this->database_selected = false; } return $this->ok; @@ -157,8 +157,8 @@ class DoliDBMssql extends DoliDB * @param string $login login * @param string $passwd password * @param string $name name of database (not used for mysql, used for pgsql) - * @param string $port Port of database server - * @return resource Database access handler + * @param int $port Port of database server + * @return false|resource|true Database access handler * @see close */ function connect($host, $login, $passwd, $name, $port=0) @@ -212,7 +212,7 @@ class DoliDBMssql extends DoliDB /** * Close database connexion * - * @return boolean True if disconnect successfull, false otherwise + * @return bool True if disconnect successfull, false otherwise * @see connect */ function close() @@ -220,7 +220,7 @@ class DoliDBMssql extends DoliDB if ($this->db) { if ($this->transaction_opened > 0) dol_syslog(get_class($this)."::close Closing a connection with an opened transaction depth=".$this->transaction_opened,LOG_ERR); - $this->connected=0; + $this->connected=false; return mssql_close($this->db); } return false; @@ -230,7 +230,7 @@ class DoliDBMssql extends DoliDB /** * Start transaction * - * @return int 1 if transaction successfuly opened or already opened, 0 if error + * @return bool true if transaction successfuly opened or already opened, false if error */ function begin() { @@ -250,7 +250,7 @@ class DoliDBMssql extends DoliDB } else { - return 1; + return true; } } @@ -258,7 +258,7 @@ class DoliDBMssql extends DoliDB * Validate a database transaction * * @param string $log Add more log to default log line - * @return int 1 if validation is OK or transaction level no started, 0 if ERROR + * @return bool true if validation is OK or transaction level no started, false if ERROR */ function commit($log='') { @@ -272,25 +272,26 @@ class DoliDBMssql extends DoliDB if ($ret) { dol_syslog("COMMIT Transaction",LOG_DEBUG); - return 1; + return true; } else { - return 0; + return false; } } elseif ($this->transaction_opened > 1) { - return 1; - } else - trigger_error("Commit requested but no transaction remain"); + return true; + } + trigger_error("Commit requested but no transaction remain"); + return false; } /** * Annulation d'une transaction et retour aux anciennes valeurs * * @param string $log Add more log to default log line - * @return int 1 si annulation ok ou transaction non ouverte, 0 en cas d'erreur + * @return bool true si annulation ok ou transaction non ouverte, false en cas d'erreur */ function rollback($log='') { @@ -305,9 +306,10 @@ class DoliDBMssql extends DoliDB } elseif ($this->transaction_opened > 1) { - return 1; - } else - trigger_error("Rollback requested but no transaction remain"); + return true; + } + trigger_error("Rollback requested but no transaction remain"); + return false; } /** @@ -317,7 +319,7 @@ class DoliDBMssql extends DoliDB * @param int $usesavepoint 0=Default mode, 1=Run a savepoint before and a rollbock to savepoint if error (this allow to have some request with errors inside global transactions). * Note that with Mysql, this parameter is not used as Myssql can already commit a transaction even if one request is in error, without using savepoints. * @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...) - * @return resource Resultset of answer + * @return false|resource|true Resultset of answer */ function query($query,$usesavepoint=0,$type='auto') { @@ -459,8 +461,8 @@ class DoliDBMssql extends DoliDB /** * Renvoie la ligne courante (comme un objet) pour le curseur resultset * - * @param Resultset $resultset Curseur de la requete voulue - * @return Object Object result line or false if KO or end of cursor + * @param resource $resultset Curseur de la requete voulue + * @return object|false Object result line or false if KO or end of cursor */ function fetch_object($resultset) { @@ -472,8 +474,8 @@ class DoliDBMssql extends DoliDB /** * Return datas as an array * - * @param Resultset $resultset Resultset of request - * @return array Array + * @param resource $resultset Resultset of request + * @return array|false Array or false if KO or end of cursor */ function fetch_array($resultset) { @@ -486,8 +488,8 @@ class DoliDBMssql extends DoliDB /** * Return datas as an array * - * @param Resultset $resultset Resultset of request - * @return array Array + * @param resource $resultset Resultset of request + * @return array|false Array or false if KO or end of cursor */ function fetch_row($resultset) { @@ -499,7 +501,7 @@ class DoliDBMssql extends DoliDB /** * Return number of lines for result of a SELECT * - * @param Resultset $resultset Resulset of requests + * @param resource $resultset Resulset of requests * @return int Nb of lines * @see affected_rows */ @@ -513,7 +515,7 @@ class DoliDBMssql extends DoliDB /** * Renvoie le nombre de lignes dans le resultat d'une requete INSERT, DELETE ou UPDATE * - * @param resultset $resultset Curseur de la requete voulue + * @param resource $resultset Curseur de la requete voulue * @return int Nombre de lignes * @see num_rows */ @@ -532,10 +534,10 @@ class DoliDBMssql extends DoliDB /** * Free last resultset used. * - * @param resultset $resultset Curseur de la requete voulue - * @return void + * @param resource $resultset Curseur de la requete voulue + * @return bool */ - function free($resultset=0) + function free($resultset=null) { // Si le resultset n'est pas fourni, on prend le dernier utilise sur cette connexion if (! is_resource($resultset)) { $resultset=$this->_results; } @@ -641,7 +643,7 @@ class DoliDBMssql extends DoliDB * * @param string $tab Table name concerned by insert. Ne sert pas sous MySql mais requis pour compatibilite avec Postgresql * @param string $fieldid Field name - * @return int Id of row + * @return int Id of row or -1 on error */ function last_insert_id($tab,$fieldid='rowid') { @@ -662,7 +664,7 @@ class DoliDBMssql extends DoliDB * * @param string $fieldorvalue Field name or value to encrypt * @param int $withQuotes Return string with quotes - * @return return XXX(field) or XXX('value') or field or 'value' + * @return string XXX(field) or XXX('value') or field or 'value' */ function encrypt($fieldorvalue, $withQuotes=0) { @@ -720,7 +722,7 @@ class DoliDBMssql extends DoliDB * @param string $charset Charset used to store data * @param string $collation Charset used to sort data * @param string $owner Username of database owner - * @return resource resource defined if OK, null if KO + * @return false|resource|true resource defined if OK, false if KO */ function DDLCreateDb($database,$charset='',$collation='',$owner='') { @@ -786,11 +788,13 @@ class DoliDBMssql extends DoliDB * @param string $type Type de la table * @param array $unique_keys Tableau associatifs Nom de champs qui seront clef unique => valeur * @param array $fulltext_keys Tableau des Nom de champs qui seront indexes en fulltext - * @param string $keys Tableau des champs cles noms => valeur + * @param array $keys Tableau des champs cles noms => valeur * @return int <0 if KO, >=0 if OK */ - function DDLCreateTable($table,$fields,$primary_key,$type,$unique_keys="",$fulltext_keys="",$keys="") + function DDLCreateTable($table,$fields,$primary_key,$type,$unique_keys=null,$fulltext_keys=null,$keys=null) { + // FIXME: $fulltext_keys parameter is unused + // cles recherchees dans le tableau des descriptions (fields) : type,value,attribute,null,default,extra // ex. : $fields['rowid'] = array('type'=>'int','value'=>'11','null'=>'not null','extra'=> 'auto_increment'); $sql = "create table ".$table."("; @@ -820,7 +824,7 @@ class DoliDBMssql extends DoliDB if($primary_key != "") $pk = "primary key(".$primary_key.")"; - if($unique_keys != "") + if(is_array($unique_keys)) { $i = 0; foreach($unique_keys as $key => $value) @@ -829,7 +833,7 @@ class DoliDBMssql extends DoliDB $i++; } } - if($keys != "") + if(is_array($keys)) { $i = 0; foreach($keys as $key => $value) @@ -841,9 +845,9 @@ class DoliDBMssql extends DoliDB $sql .= implode(',',$sqlfields); if($primary_key != "") $sql .= ",".$pk; - if($unique_keys != "") + if(is_array($unique_keys)) $sql .= ",".implode(',',$sqluq); - if($keys != "") + if(is_array($keys)) $sql .= ",".implode(',',$sqlk); $sql .=") type=".$type; @@ -859,7 +863,7 @@ class DoliDBMssql extends DoliDB * * @param string $table Name of table * @param string $field Optionnel : Name of field if we want description of field - * @return resource Resource + * @return false|resource|true Resource */ function DDLDescTable($table,$field="") { @@ -1047,7 +1051,7 @@ class DoliDBMssql extends DoliDB // FIXME: Dummy method // TODO: Implement - return ''; + return array(); } /** @@ -1123,7 +1127,7 @@ class DoliDBMssql extends DoliDB * * @param string $table Table name which contains fields * @param mixed $fields String for one field or array of string for multiple field - * @return boolean|multitype:object + * @return false|object */ function GetFieldInformation($table,$fields) { $sql="SELECT * from INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='".$this->escape($table)."' AND COLUMN_NAME"; diff --git a/htdocs/core/db/mysql.class.php b/htdocs/core/db/mysql.class.php index 64efc837bcd..30a7780afdf 100644 --- a/htdocs/core/db/mysql.class.php +++ b/htdocs/core/db/mysql.class.php @@ -21,13 +21,13 @@ /** * \file htdocs/core/db/mysql.class.php - * \brief Class file to manage Dolibarr database access for a Mysql database + * \brief Class file to manage Dolibarr database access for a MySQL database */ require_once DOL_DOCUMENT_ROOT .'/core/db/DoliDB.class.php'; /** - * Class to manage Dolibarr database access for a Mysql database + * Class to manage Dolibarr database access for a MySQL database using the mysql extension */ class DoliDBMysql extends DoliDB { @@ -37,7 +37,7 @@ class DoliDBMysql extends DoliDB const LABEL='MySQL'; //! Version min database const VERSIONMIN='4.1.0'; - //! Resultset of last query + /** @var resource Resultset of last query */ private $_results; /** @@ -69,8 +69,8 @@ class DoliDBMysql extends DoliDB if (! function_exists("mysql_connect")) { - $this->connected = 0; - $this->ok = 0; + $this->connected = false; + $this->ok = false; $this->error="Mysql PHP functions for using MySql driver are not available in this version of PHP. Try to use another driver."; dol_syslog(get_class($this)."::DoliDBMysql : Mysql PHP functions for using Mysql driver are not available in this version of PHP. Try to use another driver.",LOG_ERR); return $this->ok; @@ -78,8 +78,8 @@ class DoliDBMysql extends DoliDB if (! $host) { - $this->connected = 0; - $this->ok = 0; + $this->connected = false; + $this->ok = false; $this->error=$langs->trans("ErrorWrongHostParameter"); dol_syslog(get_class($this)."::DoliDBMysql : Erreur Connect, wrong host parameters",LOG_ERR); return $this->ok; @@ -89,14 +89,14 @@ class DoliDBMysql extends DoliDB $this->db = $this->connect($host, $user, $pass, $name, $port); if ($this->db) { - $this->connected = 1; - $this->ok = 1; + $this->connected = true; + $this->ok = true; } else { // host, login ou password incorrect - $this->connected = 0; - $this->ok = 0; + $this->connected = false; + $this->ok = false; $this->error=mysql_error(); dol_syslog(get_class($this)."::DoliDBMysql : Erreur Connect mysql_error=".$this->error,LOG_ERR); } @@ -106,9 +106,9 @@ class DoliDBMysql extends DoliDB { if ($this->select_db($name)) { - $this->database_selected = 1; + $this->database_selected = true; $this->database_name = $name; - $this->ok = 1; + $this->ok = true; // If client connected with different charset than Dolibarr HTML output $clientmustbe=''; @@ -122,9 +122,9 @@ class DoliDBMysql extends DoliDB } else { - $this->database_selected = 0; + $this->database_selected = false; $this->database_name = ''; - $this->ok = 0; + $this->ok = false; $this->error=$this->error(); dol_syslog(get_class($this)."::DoliDBMysql : Erreur Select_db ".$this->error,LOG_ERR); } @@ -132,7 +132,7 @@ class DoliDBMysql extends DoliDB else { // Pas de selection de base demandee, ok ou ko - $this->database_selected = 0; + $this->database_selected = false; if ($this->connected) { @@ -177,14 +177,14 @@ class DoliDBMysql extends DoliDB } /** - * Connexion to server + * Connection to server * * @param string $host database server host * @param string $login login * @param string $passwd password * @param string $name name of database (not used for mysql, used for pgsql) * @param integer $port Port of database server - * @return resource Database access handler + * @return resource|false Database access handler * @see close */ function connect($host, $login, $passwd, $name, $port=0) @@ -219,7 +219,7 @@ class DoliDBMysql extends DoliDB */ function getDriverInfo() { - return mysqli_get_client_info(); + return mysql_get_client_info(); } @@ -234,7 +234,7 @@ class DoliDBMysql extends DoliDB if ($this->db) { if ($this->transaction_opened > 0) dol_syslog(get_class($this)."::close Closing a connection with an opened transaction depth=".$this->transaction_opened,LOG_ERR); - $this->connected=0; + $this->connected=false; return mysql_close($this->db); } return false; @@ -247,7 +247,7 @@ class DoliDBMysql extends DoliDB * @param int $usesavepoint 0=Default mode, 1=Run a savepoint before and a rollbock to savepoint if error (this allow to have some request with errors inside global transactions). * Note that with Mysql, this parameter is not used as Myssql can already commit a transaction even if one request is in error, without using savepoints. * @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...) - * @return resource Resultset of answer + * @return resource|true|false Resultset of answer */ function query($query,$usesavepoint=0,$type='auto') { @@ -287,8 +287,8 @@ class DoliDBMysql extends DoliDB /** * Renvoie la ligne courante (comme un objet) pour le curseur resultset * - * @param Resultset $resultset Curseur de la requete voulue - * @return Object Object result line or false if KO or end of cursor + * @param resource $resultset Curseur de la requete voulue + * @return resource|false Object result line or false if KO or end of cursor */ function fetch_object($resultset) { @@ -300,7 +300,7 @@ class DoliDBMysql extends DoliDB /** * Return datas as an array * - * @param Resultset $resultset Resultset of request + * @param resource $resultset Resultset of request * @return array Array */ function fetch_array($resultset) @@ -327,7 +327,7 @@ class DoliDBMysql extends DoliDB /** * Return number of lines for result of a SELECT * - * @param Resultset $resultset Resulset of requests + * @param resource $resultset Resulset of requests * @return int Nb of lines * @see affected_rows */ @@ -341,7 +341,7 @@ class DoliDBMysql extends DoliDB /** * Renvoie le nombre de lignes dans le resultat d'une requete INSERT, DELETE ou UPDATE * - * @param resultset $resultset Curseur de la requete voulue + * @param resource $resultset Curseur de la requete voulue * @return int Nombre de lignes * @see num_rows */ @@ -358,10 +358,10 @@ class DoliDBMysql extends DoliDB /** * Free last resultset used. * - * @param resultset $resultset Curseur de la requete voulue + * @param resource $resultset Curseur de la requete voulue * @return void */ - function free($resultset=0) + function free($resultset=null) { // If resultset not provided, we take the last used by connexion if (! is_resource($resultset)) { $resultset=$this->_results; } @@ -558,7 +558,7 @@ class DoliDBMysql extends DoliDB * @param string $charset Charset used to store data * @param string $collation Charset used to sort data * @param string $owner Username of database owner - * @return resource resource defined if OK, null if KO + * @return false|resource|true resource defined if OK, null if KO */ function DDLCreateDb($database,$charset='',$collation='',$owner='') { @@ -634,11 +634,13 @@ class DoliDBMysql extends DoliDB * @param string $type Type de la table * @param array $unique_keys Tableau associatifs Nom de champs qui seront clef unique => valeur * @param array $fulltext_keys Tableau des Nom de champs qui seront indexes en fulltext - * @param string $keys Tableau des champs cles noms => valeur + * @param array $keys Tableau des champs cles noms => valeur * @return int <0 if KO, >=0 if OK */ - function DDLCreateTable($table,$fields,$primary_key,$type,$unique_keys="",$fulltext_keys="",$keys="") + function DDLCreateTable($table,$fields,$primary_key,$type,$unique_keys=null,$fulltext_keys=null,$keys=null) { + // FIXME: $fulltext_keys parameter is unused + // cles recherchees dans le tableau des descriptions (fields) : type,value,attribute,null,default,extra // ex. : $fields['rowid'] = array('type'=>'int','value'=>'11','null'=>'not null','extra'=> 'auto_increment'); $sql = "CREATE TABLE ".$table."("; @@ -673,7 +675,7 @@ class DoliDBMysql extends DoliDB if($primary_key != "") $pk = "primary key(".$primary_key.")"; - if($unique_keys != "") + if(is_array($unique_keys)) { $i = 0; foreach($unique_keys as $key => $value) @@ -682,7 +684,7 @@ class DoliDBMysql extends DoliDB $i++; } } - if($keys != "") + if(is_array($keys)) { $i = 0; foreach($keys as $key => $value) @@ -694,9 +696,9 @@ class DoliDBMysql extends DoliDB $sql .= implode(',',$sqlfields); if($primary_key != "") $sql .= ",".$pk; - if($unique_keys != "") + if(is_array($unique_keys)) $sql .= ",".implode(',',$sqluq); - if($keys != "") + if(is_array($keys)) $sql .= ",".implode(',',$sqlk); $sql .=") engine=".$type; @@ -712,7 +714,7 @@ class DoliDBMysql extends DoliDB * * @param string $table Name of table * @param string $field Optionnel : Name of field if we want description of field - * @return resource Resource + * @return false|resource|true Resource */ function DDLDescTable($table,$field="") { diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 1126f6c8a57..591789fcd89 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -21,13 +21,13 @@ /** * \file htdocs/core/db/mysqli.class.php - * \brief Class file to manage Dolibarr database access for a Mysql database + * \brief Class file to manage Dolibarr database access for a MySQL database */ require_once DOL_DOCUMENT_ROOT .'/core/db/DoliDB.class.php'; /** - * Class to manage Dolibarr database access for a Mysql database + * Class to manage Dolibarr database access for a MySQL database using the MySQLi extension */ class DoliDBMysqli extends DoliDB { @@ -36,8 +36,8 @@ class DoliDBMysqli extends DoliDB //! Database label const LABEL='MySQL'; //! Version min database - const VERSIONMIN='4.1.0'; - //! Resultset of last query + const VERSIONMIN='4.1.3'; + /** @var mysqli_result Resultset of last query */ private $_results; /** @@ -69,8 +69,8 @@ class DoliDBMysqli extends DoliDB if (! function_exists("mysqli_connect")) { - $this->connected = 0; - $this->ok = 0; + $this->connected = false; + $this->ok = false; $this->error="Mysqli PHP functions for using Mysqli driver are not available in this version of PHP. Try to use another driver."; dol_syslog(get_class($this)."::DoliDBMysqli : Mysqli PHP functions for using Mysqli driver are not available in this version of PHP. Try to use another driver.",LOG_ERR); return $this->ok; @@ -78,8 +78,8 @@ class DoliDBMysqli extends DoliDB if (! $host) { - $this->connected = 0; - $this->ok = 0; + $this->connected = false; + $this->ok = false; $this->error=$langs->trans("ErrorWrongHostParameter"); dol_syslog(get_class($this)."::DoliDBMysqli : Erreur Connect, wrong host parameters",LOG_ERR); return $this->ok; @@ -91,14 +91,14 @@ class DoliDBMysqli extends DoliDB if ($this->db) { - $this->connected = 1; - $this->ok = 1; + $this->connected = true; + $this->ok = true; } else { // host, login ou password incorrect - $this->connected = 0; - $this->ok = 0; + $this->connected = false; + $this->ok = false; $this->error=mysqli_connect_error(); dol_syslog(get_class($this)."::DoliDBMysqli : Erreur Connect mysqli_connect_error=".$this->error,LOG_ERR); } @@ -108,9 +108,9 @@ class DoliDBMysqli extends DoliDB { if ($this->select_db($name)) { - $this->database_selected = 1; + $this->database_selected = true; $this->database_name = $name; - $this->ok = 1; + $this->ok = true; // If client connected with different charset than Dolibarr HTML output $clientmustbe=''; @@ -124,9 +124,9 @@ class DoliDBMysqli extends DoliDB } else { - $this->database_selected = 0; + $this->database_selected = false; $this->database_name = ''; - $this->ok = 0; + $this->ok = false; $this->error=$this->error(); dol_syslog(get_class($this)."::DoliDBMysqli : Erreur Select_db ".$this->error,LOG_ERR); } @@ -134,7 +134,7 @@ class DoliDBMysqli extends DoliDB else { // Pas de selection de base demandee, ok ou ko - $this->database_selected = 0; + $this->database_selected = false; if ($this->connected) { @@ -187,7 +187,7 @@ class DoliDBMysqli extends DoliDB * @param string $passwd password * @param string $name name of database (not used for mysql, used for pgsql) * @param integer $port Port of database server - * @return resource Database access handler + * @return mysqli Database access handler * @see close */ function connect($host, $login, $passwd, $name, $port=0) @@ -230,7 +230,7 @@ class DoliDBMysqli extends DoliDB /** * Close database connexion * - * @return boolean True if disconnect successfull, false otherwise + * @return bool True if disconnect successfull, false otherwise * @see connect */ function close() @@ -238,7 +238,7 @@ class DoliDBMysqli extends DoliDB if ($this->db) { if ($this->transaction_opened > 0) dol_syslog(get_class($this)."::close Closing a connection with an opened transaction depth=".$this->transaction_opened,LOG_ERR); - $this->connected=0; + $this->connected=false; return mysqli_close($this->db); } return false; @@ -251,7 +251,7 @@ class DoliDBMysqli extends DoliDB * @param int $usesavepoint 0=Default mode, 1=Run a savepoint before and a rollbock to savepoint if error (this allow to have some request with errors inside global transactions). * Note that with Mysql, this parameter is not used as Myssql can already commit a transaction even if one request is in error, without using savepoints. * @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...) - * @return resource Resultset of answer + * @return bool|mysqli_result Resultset of answer */ function query($query,$usesavepoint=0,$type='auto') { @@ -290,8 +290,8 @@ class DoliDBMysqli extends DoliDB /** * Renvoie la ligne courante (comme un objet) pour le curseur resultset * - * @param Resultset $resultset Curseur de la requete voulue - * @return Object Object result line or false if KO or end of cursor + * @param mysqli_result $resultset Curseur de la requete voulue + * @return object|null Object result line or null if KO or end of cursor */ function fetch_object($resultset) { @@ -304,8 +304,8 @@ class DoliDBMysqli extends DoliDB /** * Return datas as an array * - * @param Resultset $resultset Resultset of request - * @return array Array + * @param mysqli_result $resultset Resultset of request + * @return array|null Array or null if KO or end of cursor */ function fetch_array($resultset) { @@ -317,8 +317,8 @@ class DoliDBMysqli extends DoliDB /** * Return datas as an array * - * @param resource $resultset Resultset of request - * @return array Array + * @param mysqli_result $resultset Resultset of request + * @return array|null|0 Array or null if KO or end of cursor or 0 if resultset is bool */ function fetch_row($resultset) { @@ -338,8 +338,8 @@ class DoliDBMysqli extends DoliDB /** * Return number of lines for result of a SELECT * - * @param Resultset $resultset Resulset of requests - * @return int Nb of lines + * @param mysqli_result $resultset Resulset of requests + * @return int Nb of lines * @see affected_rows */ function num_rows($resultset) @@ -352,8 +352,8 @@ class DoliDBMysqli extends DoliDB /** * Renvoie le nombre de lignes dans le resultat d'une requete INSERT, DELETE ou UPDATE * - * @param resultset $resultset Curseur de la requete voulue - * @return int Nombre de lignes + * @param mysqli_result $resultset Curseur de la requete voulue + * @return int Nombre de lignes * @see num_rows */ function affected_rows($resultset) @@ -369,10 +369,10 @@ class DoliDBMysqli extends DoliDB /** * Libere le dernier resultset utilise sur cette connexion * - * @param resultset $resultset Curseur de la requete voulue + * @param mysqli_result $resultset Curseur de la requete voulue * @return void */ - function free($resultset=0) + function free($resultset=null) { // If resultset not provided, we take the last used by connexion if (! is_object($resultset)) { $resultset=$this->_results; } @@ -401,8 +401,7 @@ class DoliDBMysqli extends DoliDB if (! $this->connected) { // Si il y a eu echec de connexion, $this->db n'est pas valide. return 'DB_ERROR_FAILED_TO_CONNECT'; - } - else { + } else { // Constants to convert a MySql error code to a generic Dolibarr error code $errorcode_map = array( 1004 => 'DB_ERROR_CANNOT_CREATE', @@ -434,8 +433,7 @@ class DoliDBMysqli extends DoliDB 1451 => 'DB_ERROR_CHILD_EXISTS' ); - if (isset($errorcode_map[mysqli_errno($this->db)])) - { + if (isset($errorcode_map[mysqli_errno($this->db)])) { return $errorcode_map[mysqli_errno($this->db)]; } $errno=mysqli_errno($this->db); @@ -464,7 +462,7 @@ class DoliDBMysqli extends DoliDB * * @param string $tab Table name concerned by insert. Ne sert pas sous MySql mais requis pour compatibilite avec Postgresql * @param string $fieldid Field name - * @return int Id of row + * @return int|string Id of row */ function last_insert_id($tab,$fieldid='rowid') { @@ -562,7 +560,7 @@ class DoliDBMysqli extends DoliDB * @param string $charset Charset used to store data * @param string $collation Charset used to sort data * @param string $owner Username of database owner - * @return resource resource defined if OK, null if KO + * @return bool|mysqli_result resource defined if OK, null if KO */ function DDLCreateDb($database,$charset='',$collation='',$owner='') { @@ -638,11 +636,13 @@ class DoliDBMysqli extends DoliDB * @param string $type Type de la table * @param array $unique_keys Tableau associatifs Nom de champs qui seront clef unique => valeur * @param array $fulltext_keys Tableau des Nom de champs qui seront indexes en fulltext - * @param string $keys Tableau des champs cles noms => valeur + * @param array $keys Tableau des champs cles noms => valeur * @return int <0 if KO, >=0 if OK */ - function DDLCreateTable($table,$fields,$primary_key,$type,$unique_keys="",$fulltext_keys="",$keys="") + function DDLCreateTable($table,$fields,$primary_key,$type,$unique_keys=null,$fulltext_keys=null,$keys=null) { + // FIXME: $fulltext_keys parameter is unused + // cles recherchees dans le tableau des descriptions (fields) : type,value,attribute,null,default,extra // ex. : $fields['rowid'] = array('type'=>'int','value'=>'11','null'=>'not null','extra'=> 'auto_increment'); $sql = "CREATE TABLE ".$table."("; @@ -677,8 +677,7 @@ class DoliDBMysqli extends DoliDB if($primary_key != "") $pk = "primary key(".$primary_key.")"; - if($unique_keys != "") - { + if(is_array($unique_keys)) { $i = 0; foreach($unique_keys as $key => $value) { @@ -686,7 +685,7 @@ class DoliDBMysqli extends DoliDB $i++; } } - if($keys != "") + if(is_array($keys)) { $i = 0; foreach($keys as $key => $value) @@ -700,7 +699,7 @@ class DoliDBMysqli extends DoliDB $sql .= ",".$pk; if($unique_keys != "") $sql .= ",".implode(',',$sqluq); - if($keys != "") + if(is_array($keys)) $sql .= ",".implode(',',$sqlk); $sql .=") engine=".$type; @@ -716,7 +715,7 @@ class DoliDBMysqli extends DoliDB * * @param string $table Name of table * @param string $field Optionnel : Name of field if we want description of field - * @return resource Resultset x (x->Field, x->Type, ...) + * @return bool|mysqli_result Resultset x (x->Field, x->Type, ...) */ function DDLDescTable($table,$field="") { @@ -763,14 +762,10 @@ class DoliDBMysqli extends DoliDB $sql.= " ".$field_position; dol_syslog(get_class($this)."::DDLAddField ".$sql,LOG_DEBUG); - if(! $this->query($sql)) - { - return -1; - } - else - { + if($this->query($sql)) { return 1; } + return -1; } /** @@ -808,12 +803,11 @@ class DoliDBMysqli extends DoliDB { $sql= "ALTER TABLE ".$table." DROP COLUMN `".$field_name."`"; dol_syslog(get_class($this)."::DDLDropField ".$sql,LOG_DEBUG); - if (! $this->query($sql)) - { - $this->error=$this->lasterror(); - return -1; + if ($this->query($sql)) { + return 1; } - else return 1; + $this->error=$this->lasterror(); + return -1; } @@ -883,7 +877,7 @@ class DoliDBMysqli extends DoliDB /** * Return list of available charset that can be used to store data in database * - * @return array List of Charset + * @return array|null List of Charset */ function getListOfCharacterSet() { @@ -926,7 +920,7 @@ class DoliDBMysqli extends DoliDB /** * Return list of available collation that can be used for database * - * @return array Liste of Collation + * @return array|null Liste of Collation */ function getListOfCollation() { diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index e946d39e143..0466c2ad96b 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -45,7 +45,7 @@ class DoliDBPgsql extends DoliDB var $forcecollate=''; // Can't be static as it may be forced with a dynamic value //! Version min database const VERSIONMIN='8.4.0'; // Version min database - //! Resultset of last query + /** @var resource Resultset of last query */ private $_results; public $unescapeslashquot; @@ -80,8 +80,8 @@ class DoliDBPgsql extends DoliDB if (! function_exists("pg_connect")) { - $this->connected = 0; - $this->ok = 0; + $this->connected = false; + $this->ok = false; $this->error="Pgsql PHP functions are not available in this version of PHP"; dol_syslog(get_class($this)."::DoliDBPgsql : Pgsql PHP functions are not available in this version of PHP",LOG_ERR); return $this->ok; @@ -89,8 +89,8 @@ class DoliDBPgsql extends DoliDB if (! $host) { - $this->connected = 0; - $this->ok = 0; + $this->connected = false; + $this->ok = false; $this->error=$langs->trans("ErrorWrongHostParameter"); dol_syslog(get_class($this)."::DoliDBPgsql : Erreur Connect, wrong host parameters",LOG_ERR); return $this->ok; @@ -102,14 +102,14 @@ class DoliDBPgsql extends DoliDB if ($this->db) { - $this->connected = 1; - $this->ok = 1; + $this->connected = true; + $this->ok = true; } else { // host, login ou password incorrect - $this->connected = 0; - $this->ok = 0; + $this->connected = false; + $this->ok = false; $this->error='Host, login or password incorrect'; dol_syslog(get_class($this)."::DoliDBPgsql : Erreur Connect ".$this->error,LOG_ERR); } @@ -119,15 +119,15 @@ class DoliDBPgsql extends DoliDB { if ($this->select_db($name)) { - $this->database_selected = 1; + $this->database_selected = true; $this->database_name = $name; - $this->ok = 1; + $this->ok = true; } else { - $this->database_selected = 0; + $this->database_selected = false; $this->database_name = ''; - $this->ok = 0; + $this->ok = false; $this->error=$this->error(); dol_syslog(get_class($this)."::DoliDBPgsql : Erreur Select_db ".$this->error,LOG_ERR); } @@ -135,7 +135,7 @@ class DoliDBPgsql extends DoliDB else { // Pas de selection de base demandee, ok ou ko - $this->database_selected = 0; + $this->database_selected = false; } return $this->ok; @@ -147,10 +147,10 @@ class DoliDBPgsql extends DoliDB * * @param string $line SQL request line to convert * @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...) - * @param string $unescapeslashquot Unescape slash quote with quote quote + * @param bool $unescapeslashquot Unescape slash quote with quote quote * @return string SQL request line converted */ - static function convertSQLFromMysql($line,$type='auto',$unescapeslashquot=0) + static function convertSQLFromMysql($line,$type='auto',$unescapeslashquot=false) { // Removed empty line if this is a comment line for SVN tagging if (preg_match('/^--\s\$Id/i',$line)) { @@ -353,7 +353,7 @@ class DoliDBPgsql extends DoliDB * On compare juste manuellement si la database choisie est bien celle activee par la connexion * * @param string $database Name of database - * @return boolean true if OK, false if KO + * @return bool true if OK, false if KO */ function select_db($database) { @@ -369,7 +369,7 @@ class DoliDBPgsql extends DoliDB * @param string $passwd Password * @param string $name Name of database (not used for mysql, used for pgsql) * @param integer $port Port of database server - * @return resource Database access handler + * @return false|resource Database access handler * @see close */ function connect($host, $login, $passwd, $name, $port=0) @@ -451,7 +451,7 @@ class DoliDBPgsql extends DoliDB if ($this->db) { if ($this->transaction_opened > 0) dol_syslog(get_class($this)."::close Closing a connection with an opened transaction depth=".$this->transaction_opened,LOG_ERR); - $this->connected=0; + $this->connected=false; return pg_close($this->db); } return false; @@ -463,7 +463,7 @@ class DoliDBPgsql extends DoliDB * @param string $query SQL query string * @param int $usesavepoint 0=Default mode, 1=Run a savepoint before and a rollback to savepoint if error (this allow to have some request with errors inside global transactions). * @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...) - * @return resource Resultset of answer + * @return false|resource Resultset of answer */ function query($query,$usesavepoint=0,$type='auto') { @@ -530,8 +530,8 @@ class DoliDBPgsql extends DoliDB /** * Renvoie la ligne courante (comme un objet) pour le curseur resultset * - * @param Resultset $resultset Curseur de la requete voulue - * @return Object Object result line or false if KO or end of cursor + * @param resource $resultset Curseur de la requete voulue + * @return false|object Object result line or false if KO or end of cursor */ function fetch_object($resultset) { @@ -544,7 +544,7 @@ class DoliDBPgsql extends DoliDB * Return datas as an array * * @param resource $resultset Resultset of request - * @return array Array + * @return false|array Array */ function fetch_array($resultset) { @@ -557,7 +557,7 @@ class DoliDBPgsql extends DoliDB * Return datas as an array * * @param resource $resultset Resultset of request - * @return array Array + * @return false|array Array */ function fetch_row($resultset) { @@ -569,8 +569,8 @@ class DoliDBPgsql extends DoliDB /** * Return number of lines for result of a SELECT * - * @param Resultset $resultset Resulset of requests - * @return int Nb of lines + * @param resourse $resultset Resulset of requests + * @return int Nb of lines, -1 on error * @see affected_rows */ function num_rows($resultset) @@ -583,7 +583,7 @@ class DoliDBPgsql extends DoliDB /** * Renvoie le nombre de lignes dans le resultat d'une requete INSERT, DELETE ou UPDATE * - * @param Resultset $resultset Result set of request + * @param resource $resultset Result set of request * @return int Nb of lines * @see num_rows */ @@ -600,10 +600,10 @@ class DoliDBPgsql extends DoliDB /** * Libere le dernier resultset utilise sur cette connexion * - * @param Resultset $resultset Result set of request + * @param resource $resultset Result set of request * @return void */ - function free($resultset=0) + function free($resultset=null) { // If resultset not provided, we take the last used by connexion if (! is_resource($resultset)) { $resultset=$this->_results; } @@ -746,7 +746,7 @@ class DoliDBPgsql extends DoliDB * * @param string $tab Table name concerned by insert. Ne sert pas sous MySql mais requis pour compatibilite avec Postgresql * @param string $fieldid Field name - * @return int Id of row + * @return string Id of row */ function last_insert_id($tab,$fieldid='rowid') { @@ -827,7 +827,7 @@ class DoliDBPgsql extends DoliDB * @param string $charset Charset used to store data * @param string $collation Charset used to sort data * @param string $owner Username of database owner - * @return resource resource defined if OK, null if KO + * @return false|resource resource defined if OK, null if KO */ function DDLCreateDb($database,$charset='',$collation='',$owner='') { @@ -910,11 +910,13 @@ class DoliDBPgsql extends DoliDB * @param string $type Type de la table * @param array $unique_keys Tableau associatifs Nom de champs qui seront clef unique => valeur * @param array $fulltext_keys Tableau des Nom de champs qui seront indexes en fulltext - * @param string $keys Tableau des champs cles noms => valeur + * @param array $keys Tableau des champs cles noms => valeur * @return int <0 if KO, >=0 if OK */ - function DDLCreateTable($table,$fields,$primary_key,$type,$unique_keys="",$fulltext_keys="",$keys="") + function DDLCreateTable($table,$fields,$primary_key,$type,$unique_keys=null,$fulltext_keys=null,$keys=null) { + // FIXME: $fulltext_keys parameter is unused + // cles recherchees dans le tableau des descriptions (fields) : type,value,attribute,null,default,extra // ex. : $fields['rowid'] = array('type'=>'int','value'=>'11','null'=>'not null','extra'=> 'auto_increment'); $sql = "create table ".$table."("; @@ -944,7 +946,7 @@ class DoliDBPgsql extends DoliDB if($primary_key != "") $pk = "primary key(".$primary_key.")"; - if($unique_keys != "") + if(is_array($unique_keys)) { $i = 0; foreach($unique_keys as $key => $value) @@ -953,7 +955,7 @@ class DoliDBPgsql extends DoliDB $i++; } } - if($keys != "") + if(is_array($keys)) { $i = 0; foreach($keys as $key => $value) @@ -965,9 +967,9 @@ class DoliDBPgsql extends DoliDB $sql .= implode(',',$sqlfields); if($primary_key != "") $sql .= ",".$pk; - if($unique_keys != "") + if(is_array($unique_keys)) $sql .= ",".implode(',',$sqluq); - if($keys != "") + if(is_array($keys)) $sql .= ",".implode(',',$sqlk); $sql .=") type=".$type; @@ -1007,7 +1009,7 @@ class DoliDBPgsql extends DoliDB * * @param string $table Name of table * @param string $field Optionnel : Name of field if we want description of field - * @return resource Resultset x (x->attname) + * @return false|resource Resultset x (x->attname) */ function DDLDescTable($table,$field="") { @@ -1052,8 +1054,7 @@ class DoliDBPgsql extends DoliDB dol_syslog($sql,LOG_DEBUG); if(! $this -> query($sql)) - return -1; - else + return -1; return 1; } @@ -1078,8 +1079,7 @@ class DoliDBPgsql extends DoliDB dol_syslog($sql,LOG_DEBUG); if (! $this->query($sql)) - return -1; - else + return -1; return 1; } @@ -1099,7 +1099,7 @@ class DoliDBPgsql extends DoliDB $this->error=$this->lasterror(); return -1; } - else return 1; + return 1; } /** diff --git a/htdocs/core/db/sqlite.class.php b/htdocs/core/db/sqlite.class.php index c1819151a35..647cd3a6798 100644 --- a/htdocs/core/db/sqlite.class.php +++ b/htdocs/core/db/sqlite.class.php @@ -37,7 +37,7 @@ class DoliDBSqlite extends DoliDB const LABEL='PDO Sqlite'; //! Version min database const VERSIONMIN='3.0.0'; - //! Resultset of last query + /** @var PDOStatement Resultset of last query */ private $_results; /** @@ -54,7 +54,7 @@ class DoliDBSqlite extends DoliDB */ function __construct($type, $host, $user, $pass, $name='', $port=0) { - global $conf,$langs; + global $conf; // Note that having "static" property for "$forcecharset" and "$forcecollate" will make error here in strict mode, so they are not static if (! empty($conf->db->character_set)) $this->forcecharset=$conf->db->character_set; @@ -70,8 +70,8 @@ class DoliDBSqlite extends DoliDB /*if (! function_exists("sqlite_query")) { - $this->connected = 0; - $this->ok = 0; + $this->connected = false; + $this->ok = false; $this->error="Sqlite PHP functions for using Sqlite driver are not available in this version of PHP. Try to use another driver."; dol_syslog(get_class($this)."::DoliDBSqlite : Sqlite PHP functions for using Sqlite driver are not available in this version of PHP. Try to use another driver.",LOG_ERR); return $this->ok; @@ -79,8 +79,8 @@ class DoliDBSqlite extends DoliDB /*if (! $host) { - $this->connected = 0; - $this->ok = 0; + $this->connected = false; + $this->ok = false; $this->error=$langs->trans("ErrorWrongHostParameter"); dol_syslog(get_class($this)."::DoliDBSqlite : Erreur Connect, wrong host parameters",LOG_ERR); return $this->ok; @@ -92,9 +92,9 @@ class DoliDBSqlite extends DoliDB if ($this->db) { - $this->connected = 1; - $this->ok = 1; - $this->database_selected = 1; + $this->connected = true; + $this->ok = true; + $this->database_selected = true; $this->database_name = $name; $this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); @@ -102,15 +102,15 @@ class DoliDBSqlite extends DoliDB else { // host, login ou password incorrect - $this->connected = 0; - $this->ok = 0; - $this->database_selected = 0; + $this->connected = false; + $this->ok = false; + $this->database_selected = false; $this->database_name = ''; //$this->error=sqlite_connect_error(); dol_syslog(get_class($this)."::DoliDBSqlite : Erreur Connect ".$this->error,LOG_ERR); } - return $this->ok; + return (int) $this->ok; } @@ -285,6 +285,7 @@ class DoliDBSqlite extends DoliDB function select_db($database) { dol_syslog(get_class($this)."::select_db database=".$database, LOG_DEBUG); + // FIXME: sqlite_select_db() does not exist return sqlite_select_db($this->db,$database); } @@ -297,12 +298,12 @@ class DoliDBSqlite extends DoliDB * @param string $passwd password * @param string $name name of database (not used for mysql, used for pgsql) * @param integer $port Port of database server - * @return resource Database access handler + * @return PDO Database access handler * @see close */ function connect($host, $login, $passwd, $name, $port=0) { - global $conf,$main_data_dir; + global $main_data_dir; dol_syslog(get_class($this)."::connect name=".$name,LOG_DEBUG); @@ -352,7 +353,7 @@ class DoliDBSqlite extends DoliDB /** * Close database connexion * - * @return boolean True if disconnect successfull, false otherwise + * @return bool True if disconnect successfull, false otherwise * @see connect */ function close() @@ -360,7 +361,7 @@ class DoliDBSqlite extends DoliDB if ($this->db) { if ($this->transaction_opened > 0) dol_syslog(get_class($this)."::close Closing a connection with an opened transaction depth=".$this->transaction_opened,LOG_ERR); - $this->connected=0; + $this->connected=false; $this->db=null; // Clean this->db return true; } @@ -374,13 +375,11 @@ class DoliDBSqlite extends DoliDB * @param int $usesavepoint 0=Default mode, 1=Run a savepoint before and a rollbock to savepoint if error (this allow to have some request with errors inside global transactions). * Note that with Mysql, this parameter is not used as Myssql can already commit a transaction even if one request is in error, without using savepoints. * @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...) - * @return resource Resultset of answer + * @return PDOStatement Resultset of answer */ function query($query,$usesavepoint=0,$type='auto') { - $errmsg=''; - - $ret=''; + $ret=null; $query = trim($query); $this->error = 0; @@ -429,8 +428,8 @@ class DoliDBSqlite extends DoliDB /** * Renvoie la ligne courante (comme un objet) pour le curseur resultset * - * @param Resultset $resultset Curseur de la requete voulue - * @return Object Object result line or false if KO or end of cursor + * @param PDOStatement $resultset Curseur de la requete voulue + * @return false|object Object result line or false if KO or end of cursor */ function fetch_object($resultset) { @@ -443,8 +442,8 @@ class DoliDBSqlite extends DoliDB /** * Return datas as an array * - * @param Resultset $resultset Resultset of request - * @return array Array + * @param PDOStatement $resultset Resultset of request + * @return false|array Array or false if KO or end of cursor */ function fetch_array($resultset) { @@ -456,8 +455,8 @@ class DoliDBSqlite extends DoliDB /** * Return datas as an array * - * @param resource $resultset Resultset of request - * @return array Array + * @param PDOStatement $resultset Resultset of request + * @return false|array Array or false if KO or end of cursor */ function fetch_row($resultset) { @@ -477,7 +476,7 @@ class DoliDBSqlite extends DoliDB /** * Return number of lines for result of a SELECT * - * @param Resultset $resultset Resulset of requests + * @param PDOStatement $resultset Resulset of requests * @return int Nb of lines * @see affected_rows */ @@ -491,7 +490,7 @@ class DoliDBSqlite extends DoliDB /** * Return number of lines for result of a SELECT * - * @param Resultset $resultset Resulset of requests + * @param PDOStatement $resultset Resulset of requests * @return int Nb of lines * @see affected_rows */ @@ -508,10 +507,10 @@ class DoliDBSqlite extends DoliDB /** * Free last resultset used. * - * @param integer $resultset Curseur de la requete voulue + * @param PDOStatement $resultset Curseur de la requete voulue * @return void */ - function free($resultset=0) + function free($resultset=null) { // If resultset not provided, we take the last used by connexion if (! is_object($resultset)) { $resultset=$this->_results; } @@ -709,7 +708,7 @@ class DoliDBSqlite extends DoliDB * @param string $charset Charset used to store data * @param string $collation Charset used to sort data * @param string $owner Username of database owner - * @return resource resource defined if OK, null if KO + * @return PDOStatement resource defined if OK, null if KO */ function DDLCreateDb($database,$charset='',$collation='',$owner='') { @@ -786,11 +785,13 @@ class DoliDBSqlite extends DoliDB * @param string $type Type de la table * @param array $unique_keys Tableau associatifs Nom de champs qui seront clef unique => valeur * @param array $fulltext_keys Tableau des Nom de champs qui seront indexes en fulltext - * @param string $keys Tableau des champs cles noms => valeur + * @param array $keys Tableau des champs cles noms => valeur * @return int <0 if KO, >=0 if OK */ - function DDLCreateTable($table,$fields,$primary_key,$type,$unique_keys="",$fulltext_keys="",$keys="") + function DDLCreateTable($table,$fields,$primary_key,$type,$unique_keys=null,$fulltext_keys=null,$keys=null) { + // FIXME: $fulltext_keys parameter is unused + // cles recherchees dans le tableau des descriptions (fields) : type,value,attribute,null,default,extra // ex. : $fields['rowid'] = array('type'=>'int','value'=>'11','null'=>'not null','extra'=> 'auto_increment'); $sql = "create table ".$table."("; @@ -820,7 +821,7 @@ class DoliDBSqlite extends DoliDB if($primary_key != "") $pk = "primary key(".$primary_key.")"; - if($unique_keys != "") + if(is_array($unique_keys)) { $i = 0; foreach($unique_keys as $key => $value) @@ -829,7 +830,7 @@ class DoliDBSqlite extends DoliDB $i++; } } - if($keys != "") + if(is_array($keys)) { $i = 0; foreach($keys as $key => $value) @@ -841,9 +842,9 @@ class DoliDBSqlite extends DoliDB $sql .= implode(',',$sqlfields); if($primary_key != "") $sql .= ",".$pk; - if($unique_keys != "") + if(is_array($unique_keys)) $sql .= ",".implode(',',$sqluq); - if($keys != "") + if(is_array($keys)) $sql .= ",".implode(',',$sqlk); $sql .=") type=".$type; diff --git a/htdocs/core/db/sqlite3.class.php b/htdocs/core/db/sqlite3.class.php index 1024dafd0cc..68d7ab672db 100644 --- a/htdocs/core/db/sqlite3.class.php +++ b/htdocs/core/db/sqlite3.class.php @@ -4,6 +4,7 @@ * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2015 Raphaël Doursenaud * * 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 @@ -21,13 +22,13 @@ /** * \file htdocs/core/db/sqlite.class.php - * \brief Class file to manage Dolibarr database access for a Sqlite database + * \brief Class file to manage Dolibarr database access for a SQLite database */ require_once DOL_DOCUMENT_ROOT .'/core/db/DoliDB.class.php'; /** - * Class to manage Dolibarr database access for a Sqlite database + * Class to manage Dolibarr database access for a SQLite database */ class DoliDBSqlite3 extends DoliDB { @@ -37,8 +38,8 @@ class DoliDBSqlite3 extends DoliDB const LABEL='Sqlite3'; //! Version min database const VERSIONMIN='3.0.0'; - //! Resultset of last query - private $_results; + /** @var SQLite3Result Resultset of last query */ + private $_results; const WEEK_MONDAY_FIRST=1; const WEEK_YEAR = 2; @@ -58,7 +59,7 @@ class DoliDBSqlite3 extends DoliDB */ function __construct($type, $host, $user, $pass, $name='', $port=0) { - global $conf,$langs; + global $conf; // Note that having "static" property for "$forcecharset" and "$forcecollate" will make error here in strict mode, so they are not static if (! empty($conf->db->character_set)) $this->forcecharset=$conf->db->character_set; @@ -74,8 +75,8 @@ class DoliDBSqlite3 extends DoliDB /*if (! function_exists("sqlite_query")) { - $this->connected = 0; - $this->ok = 0; + $this->connected = false; + $this->ok = false; $this->error="Sqlite PHP functions for using Sqlite driver are not available in this version of PHP. Try to use another driver."; dol_syslog(get_class($this)."::DoliDBSqlite3 : Sqlite PHP functions for using Sqlite driver are not available in this version of PHP. Try to use another driver.",LOG_ERR); return $this->ok; @@ -83,8 +84,8 @@ class DoliDBSqlite3 extends DoliDB /*if (! $host) { - $this->connected = 0; - $this->ok = 0; + $this->connected = false; + $this->ok = false; $this->error=$langs->trans("ErrorWrongHostParameter"); dol_syslog(get_class($this)."::DoliDBSqlite3 : Erreur Connect, wrong host parameters",LOG_ERR); return $this->ok; @@ -96,9 +97,9 @@ class DoliDBSqlite3 extends DoliDB if ($this->db) { - $this->connected = 1; - $this->ok = 1; - $this->database_selected = 1; + $this->connected = true; + $this->ok = true; + $this->database_selected = true; $this->database_name = $name; $this->addCustomFunction('IF'); @@ -114,9 +115,9 @@ class DoliDBSqlite3 extends DoliDB else { // host, login ou password incorrect - $this->connected = 0; - $this->ok = 0; - $this->database_selected = 0; + $this->connected = false; + $this->ok = false; + $this->database_selected = false; $this->database_name = ''; //$this->error=sqlite_connect_error(); dol_syslog(get_class($this)."::DoliDBSqlite3 : Error Connect ".$this->error,LOG_ERR); @@ -304,6 +305,7 @@ class DoliDBSqlite3 extends DoliDB function select_db($database) { dol_syslog(get_class($this)."::select_db database=".$database, LOG_DEBUG); + // FIXME: sqlite_select_db() does not exist return sqlite_select_db($this->db,$database); } @@ -316,12 +318,12 @@ class DoliDBSqlite3 extends DoliDB * @param string $passwd password * @param string $name name of database (not used for mysql, used for pgsql) * @param integer $port Port of database server - * @return resource Database access handler + * @return SQLite3 Database access handler * @see close */ function connect($host, $login, $passwd, $name, $port=0) { - global $conf,$main_data_dir; + global $main_data_dir; dol_syslog(get_class($this)."::connect name=".$name,LOG_DEBUG); @@ -372,7 +374,7 @@ class DoliDBSqlite3 extends DoliDB /** * Close database connexion * - * @return boolean True if disconnect successfull, false otherwise + * @return bool True if disconnect successfull, false otherwise * @see connect */ function close() @@ -380,9 +382,9 @@ class DoliDBSqlite3 extends DoliDB if ($this->db) { if ($this->transaction_opened > 0) dol_syslog(get_class($this)."::close Closing a connection with an opened transaction depth=".$this->transaction_opened,LOG_ERR); - $this->connected=0; + $this->connected=false; $this->db->close(); - $this->db=null; // Clean this->db + unset($this->db); // Clean this->db return true; } return false; @@ -395,13 +397,11 @@ class DoliDBSqlite3 extends DoliDB * @param int $usesavepoint 0=Default mode, 1=Run a savepoint before and a rollbock to savepoint if error (this allow to have some request with errors inside global transactions). * Note that with Mysql, this parameter is not used as Myssql can already commit a transaction even if one request is in error, without using savepoints. * @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...) - * @return resource Resultset of answer + * @return SQLite3Result Resultset of answer */ function query($query,$usesavepoint=0,$type='auto') { - $errmsg=''; - - $ret=''; + $ret=null; $query = trim($query); $this->error = 0; @@ -492,8 +492,8 @@ class DoliDBSqlite3 extends DoliDB /** * Renvoie la ligne courante (comme un objet) pour le curseur resultset * - * @param Resultset $resultset Curseur de la requete voulue - * @return Object Object result line or false if KO or end of cursor + * @param SQLite3Result $resultset Curseur de la requete voulue + * @return false|object Object result line or false if KO or end of cursor */ function fetch_object($resultset) { @@ -504,14 +504,15 @@ class DoliDBSqlite3 extends DoliDB if ($ret) { return (object) $ret; } + return false; } /** * Return datas as an array * - * @param Resultset $resultset Resultset of request - * @return array Array + * @param SQLite3Result $resultset Resultset of request + * @return false|array Array or false if KO or end of cursor */ function fetch_array($resultset) { @@ -519,16 +520,14 @@ class DoliDBSqlite3 extends DoliDB if (! is_object($resultset)) { $resultset=$this->_results; } //return $resultset->fetch(PDO::FETCH_ASSOC); $ret = $resultset->fetchArray(SQLITE3_ASSOC); - if ($ret) { - return (array) $ret; - } + return $ret; } /** * Return datas as an array * - * @param resource $resultset Resultset of request - * @return array Array + * @param SQLite3Result $resultset Resultset of request + * @return false|array Array or false if KO or end of cursor */ function fetch_row($resultset) { @@ -541,19 +540,21 @@ class DoliDBSqlite3 extends DoliDB else { // si le curseur est un booleen on retourne la valeur 0 - return 0; + return false; } } /** * Return number of lines for result of a SELECT * - * @param Resultset $resultset Resulset of requests + * @param SQLite3Result $resultset Resulset of requests * @return int Nb of lines * @see affected_rows */ function num_rows($resultset) { + // FIXME: SQLite3Result does not have a queryString member + // If resultset not provided, we take the last used by connexion if (! is_object($resultset)) { $resultset=$this->_results; } if (preg_match("/^SELECT/i", $resultset->queryString)) { @@ -565,12 +566,14 @@ class DoliDBSqlite3 extends DoliDB /** * Return number of lines for result of a SELECT * - * @param Resultset $resultset Resulset of requests + * @param SQLite3Result $resultset Resulset of requests * @return int Nb of lines * @see affected_rows */ function affected_rows($resultset) { + // FIXME: SQLite3Result does not have a queryString member + // If resultset not provided, we take the last used by connexion if (! is_object($resultset)) { $resultset=$this->_results; } if (preg_match("/^SELECT/i", $resultset->queryString)) { @@ -585,10 +588,10 @@ class DoliDBSqlite3 extends DoliDB /** * Free last resultset used. * - * @param integer $resultset Curseur de la requete voulue + * @param SQLite3Result $resultset Curseur de la requete voulue * @return void */ - function free($resultset=0) + function free($resultset=null) { // If resultset not provided, we take the last used by connexion if (! is_object($resultset)) { $resultset=$this->_results; } @@ -789,7 +792,7 @@ class DoliDBSqlite3 extends DoliDB * @param string $charset Charset used to store data * @param string $collation Charset used to sort data * @param string $owner Username of database owner - * @return resource resource defined if OK, null if KO + * @return SQLite3Result resource defined if OK, null if KO */ function DDLCreateDb($database,$charset='',$collation='',$owner='') { @@ -866,11 +869,13 @@ class DoliDBSqlite3 extends DoliDB * @param string $type Type de la table * @param array $unique_keys Tableau associatifs Nom de champs qui seront clef unique => valeur * @param array $fulltext_keys Tableau des Nom de champs qui seront indexes en fulltext - * @param string $keys Tableau des champs cles noms => valeur + * @param array $keys Tableau des champs cles noms => valeur * @return int <0 if KO, >=0 if OK */ - function DDLCreateTable($table,$fields,$primary_key,$type,$unique_keys="",$fulltext_keys="",$keys="") + function DDLCreateTable($table,$fields,$primary_key,$type,$unique_keys=null,$fulltext_keys=null,$keys=null) { + // FIXME: $fulltext_keys parameter is unused + // cles recherchees dans le tableau des descriptions (fields) : type,value,attribute,null,default,extra // ex. : $fields['rowid'] = array('type'=>'int','value'=>'11','null'=>'not null','extra'=> 'auto_increment'); $sql = "create table ".$table."("; @@ -900,7 +905,7 @@ class DoliDBSqlite3 extends DoliDB if($primary_key != "") $pk = "primary key(".$primary_key.")"; - if($unique_keys != "") + if(is_array($unique_keys)) { $i = 0; foreach($unique_keys as $key => $value) @@ -909,7 +914,7 @@ class DoliDBSqlite3 extends DoliDB $i++; } } - if($keys != "") + if(is_array($keys)) { $i = 0; foreach($keys as $key => $value) @@ -921,16 +926,15 @@ class DoliDBSqlite3 extends DoliDB $sql .= implode(',',$sqlfields); if($primary_key != "") $sql .= ",".$pk; - if($unique_keys != "") + if(is_array($unique_keys)) $sql .= ",".implode(',',$sqluq); - if($keys != "") + if(is_array($keys)) $sql .= ",".implode(',',$sqlk); $sql .=") type=".$type; dol_syslog($sql,LOG_DEBUG); if(! $this -> query($sql)) - return -1; - else + return -1; return 1; } @@ -939,7 +943,7 @@ class DoliDBSqlite3 extends DoliDB * * @param string $table Name of table * @param string $field Optionnel : Name of field if we want description of field - * @return resource Resource + * @return SQLite3Result Resource */ function DDLDescTable($table,$field="") { @@ -990,10 +994,7 @@ class DoliDBSqlite3 extends DoliDB { return -1; } - else - { - return 1; - } + return 1; } /** @@ -1014,8 +1015,7 @@ class DoliDBSqlite3 extends DoliDB dol_syslog(get_class($this)."::DDLUpdateField ".$sql,LOG_DEBUG); if (! $this->query($sql)) - return -1; - else + return -1; return 1; } @@ -1035,7 +1035,7 @@ class DoliDBSqlite3 extends DoliDB $this->error=$this->lasterror(); return -1; } - else return 1; + return 1; } @@ -1082,7 +1082,6 @@ class DoliDBSqlite3 extends DoliDB { return -1; } - return 1; } @@ -1141,6 +1140,7 @@ class DoliDBSqlite3 extends DoliDB */ function getPathOfDump() { + // FIXME: not for SQLite $fullpathofdump='/pathtomysqldump/mysqldump'; $resql=$this->query('SHOW VARIABLES LIKE \'basedir\''); @@ -1160,6 +1160,7 @@ class DoliDBSqlite3 extends DoliDB */ function getPathOfRestore() { + // FIXME: not for SQLite $fullpathofimport='/pathtomysql/mysql'; $resql=$this->query('SHOW VARIABLES LIKE \'basedir\''); @@ -1425,10 +1426,10 @@ class DoliDBSqlite3 extends DoliDB /** * calc_daynr * - * @param string $year Year - * @param string $month Month - * @param string $day Day - * @return string La date formatee. + * @param int $year Year + * @param int $month Month + * @param int $day Day + * @return int Formatted date */ private static function calc_daynr($year, $month, $day) { $y = $year; @@ -1446,8 +1447,9 @@ class DoliDBSqlite3 extends DoliDB /** * calc_weekday * - * @param string $daynr ??? - * @param string $sunday_first_day_of_week ??? + * @param int $daynr ??? + * @param bool $sunday_first_day_of_week ??? + * @return int */ private static function calc_weekday($daynr, $sunday_first_day_of_week) { $ret = floor(($daynr + 5 + ($sunday_first_day_of_week ? 1 : 0)) % 7); diff --git a/htdocs/core/filemanagerdol/browser/default/frmactualfolder.php b/htdocs/core/filemanagerdol/browser/default/frmactualfolder.php index d1dccba42c4..38ee8909216 100644 --- a/htdocs/core/filemanagerdol/browser/default/frmactualfolder.php +++ b/htdocs/core/filemanagerdol/browser/default/frmactualfolder.php @@ -106,7 +106,7 @@ window.onload = function()   - / + /       diff --git a/htdocs/core/filemanagerdol/browser/default/frmfolders.php b/htdocs/core/filemanagerdol/browser/default/frmfolders.php index 6dce1154dff..5feb1fedf70 100644 --- a/htdocs/core/filemanagerdol/browser/default/frmfolders.php +++ b/htdocs/core/filemanagerdol/browser/default/frmfolders.php @@ -220,7 +220,7 @@ window.onload = function() - +
diff --git a/htdocs/core/filemanagerdol/browser/default/frmresourceslist.php b/htdocs/core/filemanagerdol/browser/default/frmresourceslist.php index 19d0df5c346..cf6306f9672 100644 --- a/htdocs/core/filemanagerdol/browser/default/frmresourceslist.php +++ b/htdocs/core/filemanagerdol/browser/default/frmresourceslist.php @@ -77,7 +77,7 @@ oListManager.GetFolderRowHtml = function( folderName, folderPath ) '' + sLink + '<\/a>' + - '<\/td> ' + + '<\/td> ' + sLink + folderName + '<\/a>' + @@ -100,7 +100,7 @@ oListManager.GetFileRowHtml = function( fileName, fileUrl, fileSize ) sLink + fileName + '<\/a>' + - '<\/td> ' + + '<\/td> ' + fileSize + ' KB' + '<\/td><\/tr>' ; diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 8d6bc704e21..0b119ada66a 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -132,7 +132,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt // Disable an element if (options.option_disabled) { if (ui.item.disabled) { - $("#" + options.option_disabled).attr("disabled", "disabled"); + $("#" + options.option_disabled).prop("disabled", true); if (options.error) { $.jnotify(options.error, "error", true); // Output with jnotify the error message } @@ -145,7 +145,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt } if (options.disabled) { $.each(options.disabled, function(key, value) { - $("#" + value).attr("disabled", "disabled"); + $("#" + value).prop("disabled", true); }); } if (options.show) { @@ -524,7 +524,7 @@ function ajax_object_onoff($object, $code, $field, $text_on, $text_off, $input=a // Disable another element if (input.disabled && input.disabled.length > 0) { $.each(input.disabled, function(key,value) { - $("#" + value).attr("disabled", true); + $("#" + value).prop("disabled", true); if ($("#" + value).hasClass("butAction") == true) { $("#" + value).removeClass("butAction"); $("#" + value).addClass("butActionRefused"); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index adc5b916f63..27ea19e971d 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2804,7 +2804,7 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so print "\n"; print "\n"; - print ''; + print '
'; // Left if ($picto && $titre) print ''; @@ -2824,43 +2824,44 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so $pagelist = ''; if ($page > 0 || $num > $conf->liste_limit) { - if ($totalnboflines) + if ($totalnboflines) // If we know total nb of lines { $maxnbofpage=10; $nbpages=ceil($totalnboflines/$conf->liste_limit); $cpt=($page-$maxnbofpage); if ($cpt < 0) { $cpt=0; } - $pagelist.=$langs->trans('Page'); + if ($cpt>=1) { - $pagelist.=' 1'; - if ($cpt >= 2) $pagelist.=' ...'; + $pagelist.= '
  • 1
  • '."\n"; + if ($cpt >= 2) $pagelist.='
  • ...
  • '; } do { if ($cpt==$page) { - $pagelist.= ' '.($page+1).''; + $pagelist.= '
  • '.($page+1).'
  • '."\n"; } else { - $pagelist.= ' '.($cpt+1).''; + $pagelist.= '
  • '.($cpt+1).'
  • '."\n"; } $cpt++; } while ($cpt < $nbpages && $cpt<=$page+$maxnbofpage); if ($cpt<$nbpages) { - if ($cpt<$nbpages-1) $pagelist.= ' ...'; - $pagelist.= ' '.$nbpages.''; + if ($cpt<$nbpages-1) $pagelist.= '
  • ...
  • '; + $pagelist.= '
  • '.$nbpages.'
  • '."\n"; } } else { - $pagelist.= $langs->trans('Page').' '.($page+1); + $pagelist.= '
  • '.($page+1)."
  • \n"; } } + print "\n"; print_fleche_navigation($page,$file,$options,$nextpage,$pagelist); if ($morehtml) print $morehtml; print ''; @@ -2870,12 +2871,12 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so } /** - * Fonction servant a afficher les fleches de navigation dans les pages de listes + * Function to show navigation arrows into lists * * @param int $page Number of page - * @param string $file Lien - * @param string $options Autres parametres d'url a propager dans les liens ("" par defaut) - * @param integer $nextpage Do we show a next page button + * @param string $file Page + * @param string $options Other url paramaters to propagate ("" by default) + * @param integer $nextpage Do we show a next page button * @param string $betweenarrows HTML Content to show between arrows * @return void */ @@ -2883,17 +2884,20 @@ function print_fleche_navigation($page,$file,$options='',$nextpage=0,$betweenarr { global $conf, $langs; + print ''."\n"; } diff --git a/htdocs/core/lib/report.lib.php b/htdocs/core/lib/report.lib.php index e6fbd7e59bc..4fcb087ba18 100644 --- a/htdocs/core/lib/report.lib.php +++ b/htdocs/core/lib/report.lib.php @@ -41,6 +41,8 @@ function report_header($nom,$variante,$period,$periodlink,$description,$builddat { global $langs, $hselected; + if (empty($hselected)) $hselected='report'; + print "\n\n\n"; $h=0; diff --git a/htdocs/core/lib/salaries.lib.php b/htdocs/core/lib/salaries.lib.php index cff64bbf31f..8f74066de01 100644 --- a/htdocs/core/lib/salaries.lib.php +++ b/htdocs/core/lib/salaries.lib.php @@ -33,7 +33,7 @@ function salaries_prepare_head($object) { $head[$h][0] = DOL_URL_ROOT.'/compta/salaries/card.php?id='.$object->id; $head[$h][1] = $langs->trans("Card"); - $head[$h][2] = 'salaries'; + $head[$h][2] = 'card'; $h++; // Show more tabs from modules @@ -42,11 +42,13 @@ function salaries_prepare_head($object) { // $this->tabs = array('entity:-tabname); to remove a tab complete_head_from_modules($conf,$langs,$object,$head,$h,'salaries'); + /* $head[$h][0] = DOL_URL_ROOT.'/compta/salaries/info.php?id='.$object->id; $head[$h][1] = $langs->trans("Info"); $head[$h][2] = 'info'; $h++; - + */ + complete_head_from_modules($conf,$langs,$object,$head,$h,'salaries', 'remove'); return $head; diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 644e2702a74..0879fc814b7 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -102,21 +102,21 @@ function dol_hash($chain,$type=0) * @param User $user User to check * @param string $features Features to check (it must be module name. Examples: 'societe', 'contact', 'produit&service', 'produit|service', ...) * @param int $objectid Object ID if we want to check a particular record (optional) is linked to a owned thirdparty (optional). - * @param string $dbtablename 'TableName&SharedElement' with Tablename is table where object is stored. SharedElement is an optional key to define where to check entity. Not used if objectid is null (optional) + * @param string $tableandshare 'TableName&SharedElement' with Tablename is table where object is stored. SharedElement is an optional key to define where to check entity. Not used if objectid is null (optional) * @param string $feature2 Feature to check, second level of permission (optional). Can be or check with 'level1|level2'. * @param string $dbt_keyfield Field name for socid foreign key if not fk_soc. Not used if objectid is null (optional) * @param string $dbt_select Field name for select if not rowid. Not used if objectid is null (optional) * @param Canvas $objcanvas Object canvas * @return int Always 1, die process if not allowed */ -function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $objcanvas=null) +function restrictedArea($user, $features, $objectid=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $objcanvas=null) { global $db, $conf; //dol_syslog("functions.lib:restrictedArea $feature, $objectid, $dbtablename,$feature2,$dbt_socfield,$dbt_select"); //print "user_id=".$user->id.", features=".$features.", feature2=".$feature2.", objectid=".$objectid; //print ", dbtablename=".$dbtablename.", dbt_socfield=".$dbt_keyfield.", dbt_select=".$dbt_select; - //print ", perm: ".$features."->".$feature2."=".$user->rights->$features->$feature2->lire."
    "; + //print ", perm: ".$features."->".$feature2."=".($user->rights->$features->$feature2->lire)."
    "; // If we use canvas, we try to use function that overlod restrictarea if provided with canvas if (is_object($objcanvas)) @@ -135,7 +135,7 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature if (! empty($feature2)) $feature2 = explode("|", $feature2); // More parameters - $params = explode('&', $dbtablename); + $params = explode('&', $tableandshare); $dbtablename=(! empty($params[0]) ? $params[0] : ''); $sharedelement=(! empty($params[1]) ? $params[1] : $dbtablename); @@ -331,7 +331,7 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature // is linked to a company allowed to $user. if (! empty($objectid) && $objectid > 0) { - $ok = checkUserAccessToObject($user, $featuresarray,$objectid,$dbtablename,$feature2,$dbt_keyfield,$dbt_select); + $ok = checkUserAccessToObject($user, $featuresarray, $objectid, $tableandshare, $feature2, $dbt_keyfield, $dbt_select); return $ok ? 1 : accessforbidden(); } @@ -344,19 +344,19 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature * @param User $user User to check * @param array $featuresarray Features/modules to check * @param int $objectid Object ID if we want to check a particular record (optional) is linked to a owned thirdparty (optional). - * @param string $dbtablename 'TableName&SharedElement' with Tablename is table where object is stored. SharedElement is an optional key to define where to check entity. Not used if objectid is null (optional) + * @param string $tableandshare 'TableName&SharedElement' with Tablename is table where object is stored. SharedElement is an optional key to define where to check entity. Not used if objectid is null (optional) * @param string $feature2 Feature to check, second level of permission (optional). Can be or check with 'level1|level2'. * @param string $dbt_keyfield Field name for socid foreign key if not fk_soc. Not used if objectid is null (optional) * @param string $dbt_select Field name for select if not rowid. Not used if objectid is null (optional) * * @return bool True if user has access, False otherwise */ -function checkUserAccessToObject($user, $featuresarray, $objectid=0, $dbtablename='', $feature2='', $dbt_keyfield='', $dbt_select='') +function checkUserAccessToObject($user, $featuresarray, $objectid=0, $tableandshare='', $feature2='', $dbt_keyfield='', $dbt_select='') { global $db, $conf; // More parameters - $params = explode('&', $dbtablename); + $params = explode('&', $tableandshare); $dbtablename=(! empty($params[0]) ? $params[0] : ''); $sharedelement=(! empty($params[1]) ? $params[1] : $dbtablename); diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php old mode 100755 new mode 100644 index d2cdb71e429..641ceb43e8f --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -1,5 +1,6 @@ + * Copyright (C) 2015 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,16 +24,16 @@ */ require_once DOL_DOCUMENT_ROOT.'/core/modules/expensereport/modules_expensereport.php'; -require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php"); -require_once(DOL_DOCUMENT_ROOT."/core/lib/functions2.lib.php"); -require_once(DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'); +require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; /** - * Classe permettant de generer les factures au modele Crabe + * Class to generate expense report based on standard model */ class pdf_standard extends ModeleExpenseReport { @@ -252,7 +253,7 @@ class pdf_standard extends ModeleExpenseReport $tab_height = 110; $tab_height_newpage = 110; - // Affiche notes + // Show notes $notetoshow=empty($object->note_public)?'':$object->note_public; if (! empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE)) { @@ -308,7 +309,7 @@ class pdf_standard extends ModeleExpenseReport $showpricebeforepagebreak=1; - // Piece comptable + // Accountancy piece $pdf->SetFont('','', $default_font_size - 1); $pdf->writeHTMLCell($this->posxcomment-$this->posxpiece-1, 3, $this->posxpiece-1, $curY, $piece_comptable, 0, 1); @@ -334,17 +335,18 @@ class pdf_standard extends ModeleExpenseReport $pdf->SetXY($this->posxtype, $curY); $pdf->MultiCell($this->posxprojet-$this->posxtype-1, 3,$outputlangs->transnoentities($object->lines[$i]->type_fees_code), 0, 'C'); - // Projet + // Project $pdf->SetFont('','', $default_font_size - 1); $pdf->SetXY($this->posxprojet, $curY); $pdf->MultiCell($this->posxtva-$this->posxprojet-1, 3,$object->lines[$i]->projet_ref, 0, 'C'); // VAT Rate + $vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails); $pdf->SetFont('','', $default_font_size - 1); $pdf->SetXY($this->posxtva, $curY); - $pdf->MultiCell($this->posxup-$this->posxtva-1, 3,vatrate($object->lines[$i]->tva_taux,true), 0, 'R'); + $pdf->MultiCell($this->posxup-$this->posxtva-1, 3,$vat_rate, 0, 'R'); - // UP + // Unit price $pdf->SetFont('','', $default_font_size - 1); $pdf->SetXY($this->posxup, $curY); $pdf->MultiCell($this->posxqty-$this->posxup-1, 3,price($object->lines[$i]->value_unit), 0, 'R'); @@ -354,7 +356,7 @@ class pdf_standard extends ModeleExpenseReport $pdf->SetXY($this->posxqty, $curY); $pdf->MultiCell($this->postotalttc-$this->posxqty, 3,$object->lines[$i]->qty, 0, 'C'); - // TotalTTC + // Total with all taxes $pdf->SetFont('','', $default_font_size - 1); $pdf->SetXY($this->postotalttc-2, $curY); $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalttc, 3, price($object->lines[$i]->total_ttc), 0, 'R'); @@ -439,6 +441,13 @@ class pdf_standard extends ModeleExpenseReport $pdf->MultiCell($this->page_largeur - $this->marge_gauche - 160, 5, price($object->total_ht), 1, 'R'); $pdf->SetFillColor(248,248,248); + $posy+=5; + $pdf->SetXY(100, $posy); + $pdf->SetTextColor(0,0,60); + $pdf->MultiCell(60, 5, $outputlangs->transnoentities("TotalVAT"), 1,'L'); + $pdf->SetXY(160, $posy); + $pdf->MultiCell($this->page_largeur - $this->marge_gauche - 160, 5, price($object->total_tva),1, 'R'); + $posy+=5; $pdf->SetXY(100, $posy); $pdf->SetFont('','B', 10); @@ -507,7 +516,7 @@ class pdf_standard extends ModeleExpenseReport pdf_pagehead($pdf,$outputlangs,$this->page_hauteur); */ - // Filligrane brouillon + // Draft watermark if ($object->fk_statut==1 && ! empty($conf->global->EXPENSEREPORT_FREE_TEXT)) { pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->EXPENSEREPORT_FREE_TEXT); @@ -551,25 +560,25 @@ class pdf_standard extends ModeleExpenseReport $pdf->SetFont('','', $default_font_size -1); - // Réf complète + // Ref complete $posy+=8; $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); $pdf->MultiCell($this->page_largeur-$this->marge_droite-$posx, 3, $outputlangs->transnoentities("Ref")." : " . $object->ref, '', 'L'); - // Date début période + // Date start period $posy+=5; $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); $pdf->MultiCell($this->page_largeur-$this->marge_droite-$posx, 3, $outputlangs->transnoentities("DateStart")." : " . ($object->date_debut>0?dol_print_date($object->date_debut,"day",false,$outpulangs):''), '', 'L'); - // Date fin période + // Date end period $posy+=5; $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); $pdf->MultiCell($this->page_largeur-$this->marge_droite-$posx, 3, $outputlangs->transnoentities("DateEnd")." : " . ($object->date_fin>0?dol_print_date($object->date_fin,"day",false,$outpulangs):''), '', 'L'); - // Statut NDF + // Status Expense Report $posy+=6; $pdf->SetXY($posx,$posy); $pdf->SetFont('','B',18); @@ -581,7 +590,7 @@ class pdf_standard extends ModeleExpenseReport $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->convToOutputCharset($this->emetteur->address); $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->convToOutputCharset($this->emetteur->zip).' '.$outputlangs->convToOutputCharset($this->emetteur->town); $carac_emetteur .= "\n"; - // Tel + // Phone if ($this->emetteur->phone) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Phone")." : ".$outputlangs->convToOutputCharset($this->emetteur->phone); // Fax if ($this->emetteur->fax) $carac_emetteur .= ($carac_emetteur ? ($this->emetteur->tel ? " - " : "\n") : '' ).$outputlangs->transnoentities("Fax")." : ".$outputlangs->convToOutputCharset($this->emetteur->fax); @@ -734,46 +743,46 @@ class pdf_standard extends ModeleExpenseReport $pdf->SetFont('','',8); - //Piece comptable + // Accountancy piece $pdf->SetXY($this->posxpiece-1, $tab_top+1); $pdf->MultiCell($this->posxdesc-$this->posxpiece-1,1,'','','R'); - //Comments + // Comments $pdf->line($this->posxdesc-1, $tab_top, $this->posxdesc-1, $tab_top + $tab_height); $pdf->SetXY($this->posxdesc-1, $tab_top+1); $pdf->MultiCell($this->posxdate-$this->posxdesc-1,1,$outputlangs->transnoentities("Description"),'','L'); - //Date + // Date $pdf->line($this->posxdate-1, $tab_top, $this->posxdate-1, $tab_top + $tab_height); $pdf->SetXY($this->posxdate-1, $tab_top+1); $pdf->MultiCell($this->posxtype-$this->posxdate-1,2, $outputlangs->transnoentities("Date"),'','C'); - //Type + // Type $pdf->line($this->posxtype-1, $tab_top, $this->posxtype-1, $tab_top + $tab_height); $pdf->SetXY($this->posxtype-1, $tab_top+1); $pdf->MultiCell($this->posxprojet-$this->posxtype-1,2, $outputlangs->transnoentities("Type"),'','C'); - // Projet + // Project $pdf->line($this->posxprojet-1, $tab_top, $this->posxprojet-1, $tab_top + $tab_height); $pdf->SetXY($this->posxprojet-1, $tab_top+1); $pdf->MultiCell($this->posxtva-$this->posxprojet-1,2, $outputlangs->transnoentities("Project"),'','C'); - //TVA + // VAT $pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height); $pdf->SetXY($this->posxtva-1, $tab_top+1); $pdf->MultiCell($this->posxup-$this->posxtva-1,2, $outputlangs->transnoentities("VAT"),'','C'); - //PU + // Unit price $pdf->line($this->posxup-1, $tab_top, $this->posxup-1, $tab_top + $tab_height); $pdf->SetXY($this->posxup-1, $tab_top+1); - $pdf->MultiCell($this->posxqty-$this->posxup-1,2, $outputlangs->transnoentities("UP"),'','C'); + $pdf->MultiCell($this->posxqty-$this->posxup-1,2, $outputlangs->transnoentities("PriceU"),'','C'); - //QTY + // Quantity $pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height); $pdf->SetXY($this->posxqty-1, $tab_top+1); $pdf->MultiCell($this->postotalttc-$this->posxqty,2, $outputlangs->transnoentities("Qty"),'','R'); - //TOTALTTC + // Total with all taxes $pdf->line($this->postotalttc, $tab_top, $this->postotalttc, $tab_top + $tab_height); $pdf->SetXY($this->postotalttc-1, $tab_top+1); $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalttc, 2, $outputlangs->transnoentities("TotalTTC"),'','R'); diff --git a/htdocs/core/modules/expensereport/modules_expensereport.php b/htdocs/core/modules/expensereport/modules_expensereport.php old mode 100755 new mode 100644 diff --git a/htdocs/core/modules/export/export_excel.modules.php b/htdocs/core/modules/export/export_excel.modules.php index 734b38f601a..05a2c68f5d9 100644 --- a/htdocs/core/modules/export/export_excel.modules.php +++ b/htdocs/core/modules/export/export_excel.modules.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2006-2015 Laurent Destailleur * Copyright (C) 2012 Marcos García * * This program is free software; you can redistribute it and/or modify @@ -65,8 +65,21 @@ class ExportExcel extends ModeleExports $this->version='1.30'; // Driver version // If driver use an external library, put its name here - $this->label_lib='PhpExcel'; - $this->version_lib='1.7.8'; + if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL)) + { + require_once PHP_WRITEEXCEL_PATH.'class.writeexcel_workbookbig.inc.php'; + require_once PHP_WRITEEXCEL_PATH.'class.writeexcel_worksheet.inc.php'; + require_once PHP_WRITEEXCEL_PATH.'functions.writeexcel_utility.inc.php'; + $this->label_lib='PhpWriteExcel'; + $this->version_lib='unknown'; + } + else + { + require_once PHPEXCEL_PATH.'PHPExcel.php'; + require_once PHPEXCEL_PATH.'PHPExcel/Style/Alignment.php'; + $this->label_lib='PhpExcel'; + $this->version_lib='1.8.0'; // No way to get info from library + } $this->disabled = (in_array(constant('PHPEXCEL_PATH'),array('disabled','disabled/'))?1:0); // A condition to disable module (used for native debian packages) diff --git a/htdocs/core/modules/export/export_excel2007.modules.php b/htdocs/core/modules/export/export_excel2007.modules.php index 4f37a2e323e..dcb649e780d 100644 --- a/htdocs/core/modules/export/export_excel2007.modules.php +++ b/htdocs/core/modules/export/export_excel2007.modules.php @@ -64,10 +64,23 @@ class ExportExcel2007 extends ExportExcel $this->picto='mime/xls'; // Picto $this->version='1.30'; // Driver version - // If driver use an external library, put its name here - $this->label_lib='PhpExcel'; - $this->version_lib='1.7.8'; - + // If driver use an external library, put its name here + if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL)) + { + require_once PHP_WRITEEXCEL_PATH.'class.writeexcel_workbookbig.inc.php'; + require_once PHP_WRITEEXCEL_PATH.'class.writeexcel_worksheet.inc.php'; + require_once PHP_WRITEEXCEL_PATH.'functions.writeexcel_utility.inc.php'; + $this->label_lib='PhpWriteExcel'; + $this->version_lib='unknown'; + } + else + { + require_once PHPEXCEL_PATH.'PHPExcel.php'; + require_once PHPEXCEL_PATH.'PHPExcel/Style/Alignment.php'; + $this->label_lib='PhpExcel'; + $this->version_lib='1.8.0'; // No way to get info from library + } + $this->disabled = (in_array(constant('PHPEXCEL_PATH'),array('disabled','disabled/'))?1:0); // A condition to disable module (used for native debian packages) $this->row=0; diff --git a/htdocs/core/modules/modExpenseReport.class.php b/htdocs/core/modules/modExpenseReport.class.php old mode 100755 new mode 100644 diff --git a/htdocs/core/modules/modSalaries.class.php b/htdocs/core/modules/modSalaries.class.php index 2144c95b1b3..038d11f4eba 100644 --- a/htdocs/core/modules/modSalaries.class.php +++ b/htdocs/core/modules/modSalaries.class.php @@ -133,6 +133,19 @@ class modSalaries extends DolibarrModules //-------- $r=0; + $r++; + $this->export_code[$r]=$this->rights_class.'_'.$r; + $this->export_label[$r]='Salaries and payments'; + $this->export_permission[$r]=array(array("salary","export")); + $this->export_fields_array[$r]=array('u.firstname'=>"Firstname",'u.lastname'=>"Lastname",'u.login'=>"Login",'u.salary'=>'CurrentSalary','p.rowid'=>'PaymentId','p.datep'=>'DatePayment','p.datesp'=>'DateStartPeriod','p.dateep'=>'DateEndPeriod','p.amount'=>'AmountPayment','p.num_paiement'=>'Numero','p.label'=>'Label','p.note'=>'Note'); + $this->export_TypeFields_array[$r]=array('u.firstname'=>"Text",'u.lastname'=>"Text",'u.login'=>'Text','u.salary'=>"Number",'p.datep'=>'Date','p.datesp'=>'Date','p.dateep'=>'Date','p.amount'=>'Number','p.num_paiement'=>'Number','p.label'=>'Text'); + $this->export_entities_array[$r]=array('u.firstname'=>'user','u.lastname'=>'user','u.login'=>'user','u.salary'=>'user','p.datep'=>'payment','p.datesp'=>'payment','p.dateep'=>'payment','p.amount'=>'payment','p.label'=>'payment','p.note'=>'payment','p.num_paiement'=>'payment'); + + $this->export_sql_start[$r]='SELECT DISTINCT '; + $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'user as u'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'paiementsalary as p ON p.fk_user = u.rowid'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as cp ON p.fk_typepaiement = cp.rowid'; + $this->export_sql_end[$r] .=' AND u.entity IN ('.getEntity('user',1).')'; } diff --git a/htdocs/core/tpl/admin_extrafields_add.tpl.php b/htdocs/core/tpl/admin_extrafields_add.tpl.php index 293a363edfd..44de526942f 100644 --- a/htdocs/core/tpl/admin_extrafields_add.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_add.tpl.php @@ -42,27 +42,27 @@ if (GETPOST('type') == "separate") { - print "jQuery('#size, #unique, #required, #default_value').val('').attr('disabled','disabled');"; + print "jQuery('#size, #unique, #required, #default_value').val('').prop('disabled', true);"; print 'jQuery("#value_choice").hide();'; } ?> - if (type == 'date') { size.val('').attr('disabled','disabled'); unique.removeAttr('disabled','disabled'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); } - else if (type == 'datetime') { size.val('').attr('disabled','disabled'); unique.removeAttr('disabled','disabled'); jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();} + if (type == 'date') { size.val('').prop('disabled', true); unique.removeAttr('disabled'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); } + else if (type == 'datetime') { size.val('').prop('disabled', true); unique.removeAttr('disabled'); jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();} else if (type == 'double') { size.val('24,8').removeAttr('disabled'); unique.removeAttr('disabled','disabled'); jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();} - else if (type == 'int') { size.val('10').removeAttr('disabled'); unique.removeAttr('disabled','disabled'); jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();} - else if (type == 'text') { size.val('2000').removeAttr('disabled'); unique.attr('disabled','disabled').removeAttr('checked'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); } + else if (type == 'int') { size.val('10').removeAttr('disabled'); unique.removeAttr('disabled'); jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();} + else if (type == 'text') { size.val('2000').removeAttr('disabled'); unique.prop('disabled', true).removeAttr('checked'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); } else if (type == 'varchar') { size.val('255').removeAttr('disabled'); unique.removeAttr('disabled','disabled'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); } - else if (type == 'boolean') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();} - else if (type == 'price') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();} - else if (type == 'select') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} - else if (type == 'link') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").show();} - else if (type == 'sellist') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").show();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} - else if (type == 'radio') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} - else if (type == 'checkbox') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} - else if (type == 'chkbxlst') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").show();jQuery("#helplink").hide();} - else if (type == 'separate') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); required.val('').attr('disabled','disabled'); default_value.val('').attr('disabled','disabled'); jQuery("#value_choice").hide();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} - else size.val('').attr('disabled','disabled'); + else if (type == 'boolean') { size.val('').prop('disabled', true); unique.prop('disabled', true); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();} + else if (type == 'price') { size.val('').prop('disabled', true); unique.prop('disabled', true); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();} + else if (type == 'select') { size.val('').prop('disabled', true); unique.prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} + else if (type == 'link') { size.val('').prop('disabled', true); unique.prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").show();} + else if (type == 'sellist') { size.val('').prop('disabled', true); unique.prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").show();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} + else if (type == 'radio') { size.val('').prop('disabled', true); unique.prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} + else if (type == 'checkbox') { size.val('').prop('disabled', true); unique.prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} + else if (type == 'chkbxlst') { size.val('').prop('disabled', true); unique.prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").show();jQuery("#helplink").hide();} + else if (type == 'separate') { size.val('').prop('disabled', true); unique.prop('disabled', true); required.val('').prop('disabled', true); default_value.val('').prop('disabled', true); jQuery("#value_choice").hide();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} + else size.val('').prop('disabled', true); } init_typeoffields(''); jQuery("#type").change(function() { diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php index 91b861381ae..9c283b83867 100644 --- a/htdocs/core/tpl/admin_extrafields_edit.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php @@ -25,15 +25,15 @@ var size = jQuery("#size"); var unique = jQuery("#unique"); var required = jQuery("#required"); - if (type == 'date') { size.attr('disabled','disabled'); } - else if (type == 'datetime') { size.attr('disabled','disabled'); } + if (type == 'date') { size.prop('disabled', true); } + else if (type == 'datetime') { size.prop('disabled', true); } else if (type == 'double') { size.removeAttr('disabled'); } else if (type == 'int') { size.removeAttr('disabled'); } - else if (type == 'text') { size.removeAttr('disabled'); unique.attr('disabled','disabled').removeAttr('checked'); } + else if (type == 'text') { size.removeAttr('disabled'); unique.prop('disabled', true).removeAttr('checked'); } else if (type == 'varchar') { size.removeAttr('disabled'); } - else if (type == 'boolean') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled');} - else if (type == 'price') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled');} - else size.val('').attr('disabled','disabled'); + else if (type == 'boolean') { size.val('').prop('disabled', true); unique.prop('disabled', true);} + else if (type == 'price') { size.val('').prop('disabled', true); unique.prop('disabled', true);} + else size.val('').prop('disabled', true); } init_typeoffields(jQuery("#type").val()); }); diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 0d18cd9b8b5..9c6cfd2e1be 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -583,8 +583,8 @@ function setforfree() { jQuery("#idprod").val(''); jQuery("#idprodfournprice").val('0'); // Set cursor on not selected product jQuery("#search_idprodfournprice").val(''); - jQuery("#prod_entry_mode_free").attr('checked',true); - jQuery("#prod_entry_mode_predef").attr('checked',false); + jQuery("#prod_entry_mode_free").prop('checked',true); + jQuery("#prod_entry_mode_predef").prop('checked',false); jQuery("#price_ht").show(); jQuery("#price_ttc").show(); // May no exists jQuery("#tva_tx").show(); @@ -601,8 +601,8 @@ function setforfree() { } function setforpredef() { jQuery("#select_type").val(-1); - jQuery("#prod_entry_mode_free").attr('checked',false); - jQuery("#prod_entry_mode_predef").attr('checked',true); + jQuery("#prod_entry_mode_free").prop('checked',false); + jQuery("#prod_entry_mode_predef").prop('checked',true); jQuery("#price_ht").hide(); jQuery("#title_up_ht").hide(); jQuery("#price_ttc").hide(); // May no exists diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index bc23438dfbc..d64ef7a2b3e 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -99,7 +99,7 @@ $coldisplay=-1; // We remove first td $doleditor=new DolEditor('product_desc',$line->description,'',164,$toolbarname,'',false,true,$enable,$nbrows,'98%'); $doleditor->Create(); } else { - print ''; + print ''; } ?> @@ -113,19 +113,19 @@ $coldisplay=-1; // We remove first td if ($this->situation_counter == 1 || !$this->situation_cycle_ref) { print ''; } else { - print ''; + print ''; } $coldisplay++; print ''; if ($inputalsopricewithtax) { $coldisplay++; print ''; } ?> @@ -136,7 +136,7 @@ $coldisplay=-1; // We remove first td // must also not be output for most entities (proposal, intervention, ...) //if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." "; print 'situation_counter > 1) print ' readonly="readonly"'; + if ($this->situation_counter > 1) print ' readonly'; print '>'; } else { ?>   @@ -152,10 +152,10 @@ $coldisplay=-1; // We remove first td } ?> - '; + print ''; } if (! empty($usemargins)) { diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 593421fe527..0ca056cfbb4 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -148,7 +148,7 @@ if (empty($usemargins)) $usemargins=0; global->PRODUCT_USE_UNITS) { - print ''; + print ''; } if ($usemargins && ! empty($conf->margin->enabled) && empty($user->societe_id)) diff --git a/htdocs/don/card.php b/htdocs/don/card.php index cfe28532637..cf710807043 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013 Florian Henry * Copyright (C) 2015 Alexandre Spangaro @@ -64,6 +64,7 @@ $hookmanager->initHooks(array('doncard','globalcard')); /* * Actions */ + $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -227,6 +228,7 @@ if ($action == 'set_paid') /* * Build doc */ + if ($action == 'builddoc') { $object = new Don($db); @@ -265,21 +267,17 @@ $formfile = new FormFile($db); $formcompany = new FormCompany($db); -/* ************************************************************************** */ -/* */ -/* Donation card in create mode */ -/* */ -/* ************************************************************************** */ - if ($action == 'create') { print_fiche_titre($langs->trans("AddDonation")); print '
    '; print ''; - print '
    '.img_picto('', $picto, '', $pictoisfullpath).'' . $form->load_tva('tva_tx',$line->tva_tx,$seller,$buyer,0,$line->info_bits,$line->product_type) . '%%situation_counter > 1) print ' readonly="readonly"'; + if ($this->situation_counter > 1) print ' readonly'; print '>situation_counter > 1) print ' readonly="readonly"'; + if ($this->situation_counter > 1) print ' readonly'; print '> + info_bits & 2) != 2) { print 'situation_counter > 1) print ' readonly="readonly"'; + if ($this->situation_counter > 1) print ' readonly'; print '>%'; } else { ?>   @@ -164,7 +164,7 @@ $coldisplay=-1; // We remove first td situation_cycle_ref) { $coldisplay++; - print '%%'; + print ''; $label = $line->getLabelOfUnit('short'); if ($label !== '') { print $langs->trans($label); @@ -169,7 +169,7 @@ if (empty($usemargins)) $usemargins=0; if ($this->situation_cycle_ref) { $coldisplay++; - print '' . $line->situation_percent . '%' . $line->situation_percent . '%
    '; - print ''; + + dol_fiche_head(''); + + print '
    '; $nbrows=11; if (! empty($conf->projet->enabled)) $nbrows++; @@ -343,7 +341,7 @@ if ($action == 'create') $formproject=new FormProjets($db); print "\n"; } @@ -356,7 +354,11 @@ if ($action == 'create') } print "
    ".$langs->trans("Project").""; - $formproject->select_projects(-1, GETPOST("fk_projet"),'fk_projet', 0, 1, 0, 1); + $formproject->select_projects(-1, GETPOST("fk_projet"),'fk_projet', 0, 0, 1, 1); print "
    \n"; - print '
       
    '; + + dol_fiche_end(); + + print '
       
    '; + print "\n"; } diff --git a/htdocs/don/index.php b/htdocs/don/index.php index b276e21dc50..e157c465a9b 100644 --- a/htdocs/don/index.php +++ b/htdocs/don/index.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -98,7 +98,7 @@ foreach ($listofstatus as $status) if ($conf->use_javascript_ajax) { - print ''; + print ''; $data=array('series'=>$dataseries); dol_print_graph('stats',300,180,$data,1,'pie',1); print ''; diff --git a/htdocs/expedition/index.php b/htdocs/expedition/index.php index 5ecd563a613..2d5d0e207c6 100644 --- a/htdocs/expedition/index.php +++ b/htdocs/expedition/index.php @@ -93,7 +93,7 @@ if ($resql) { $var=!$var; $obj = $db->fetch_object($resql); - print ""; + print "'; $shipment->id=$obj->rowid; $shipment->ref=$obj->ref; print $shipment->getNomUrl(1); diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index d29dc513e5c..1d8f8c7444d 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -546,7 +546,7 @@ if ($id > 0 || ! empty($ref)) } print "\n"; - // Show subproducts details + // Show subproducts lines if ($objp->fk_product > 0 && ! empty($conf->global->PRODUIT_SOUSPRODUITS)) { // Set tree of subproducts in product->sousprods @@ -560,20 +560,16 @@ if ($id > 0 || ! empty($ref)) { foreach($prods_arbo as $key => $value) { - print ''; - $img=''; if ($value['stock'] < $value['stock_alert']) { $img=img_warning($langs->trans("StockTooLow")); } - print '      -> '.$value['fullpath'].' ('.$value['nb'].')'; + print '      -> '.$value['fullpath'].' ('.$value['nb'].')'; print ' '.$value['nb_total'].''; print ' '; print ' '; print ''.$value['stock'].' '.$img.''."\n"; - - print ''."\n"; } } } diff --git a/htdocs/expensereport/ajax/ajaxprojet.php b/htdocs/expensereport/ajax/ajaxprojet.php old mode 100755 new mode 100644 diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php old mode 100755 new mode 100644 index 476a8862041..a9ccf2471db --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -828,9 +828,8 @@ if ($action == "addline") $object_ligne->fk_c_type_fees = GETPOST('fk_c_type_fees'); - $vatrate=GETPOST('vatrate'); - $object_ligne->fk_c_tva = $vatrate; - $object_ligne->vatrate = $vatrate; + $object_ligne->fk_c_tva = GETPOST('fk_c_tva'); + $object_ligne->vatrate = price2num(GETPOST('vatrate')); $object_ligne->fk_projet = $fk_projet; @@ -878,8 +877,8 @@ if ($action == "addline") $type = 0; // TODO What if service $tmp = calcul_price_total($qty, $up, 0, $vatrate, 0, 0, 0, 'TTC', 0, $type); + $object_ligne->vatrate = price2num(GETPOST('vatrate')); $object_ligne->total_ttc = $tmp[2]; - $object_ligne->tva_taux = GETPOST('vatrate'); $object_ligne->total_ht = $tmp[0]; $object_ligne->total_tva = $tmp[1]; @@ -906,11 +905,11 @@ if ($action == 'confirm_delete_line' && GETPOST("confirm") == "yes") $object->fetch($id); $object_ligne = new ExpenseReportLine($db); - $object_ligne->fetch($_GET["rowid"]); + $object_ligne->fetch(GETPOST("rowid")); $total_ht = $object_ligne->total_ht; $total_tva = $object_ligne->total_tva; - $result=$object->deleteline($_GET["rowid"]); + $result=$object->deleteline(GETPOST("rowid")); if ($result >= 0) { if ($result > 0) @@ -950,12 +949,13 @@ if ($action == "updateligne" ) $rowid = $_POST['rowid']; $type_fees_id = GETPOST('fk_c_type_fees'); - $c_tva=GETPOST('vatrate'); - $object_ligne->fk_c_tva = $c_tva; + $object_ligne->fk_c_tva = GETPOST('fk_c_tva'); + $object_ligne->vatrate = price2num(GETPOST('vatrate')); $projet_id = $fk_projet; $comments = GETPOST('comments'); $qty = GETPOST('qty'); $value_unit = GETPOST('value_unit'); + $vatrate = GETPOST('vatrate'); if (! GETPOST('fk_c_type_fees') > 0) { @@ -972,7 +972,7 @@ if ($action == "updateligne" ) if (! $error) { - $result = $object->updateline($rowid, $type_fees_id, $projet_id, $c_tva, $comments, $qty, $value_unit, $date, $object_id); + $result = $object->updateline($rowid, $type_fees_id, $projet_id, $vatrate, $comments, $qty, $value_unit, $date, $id); if ($result >= 0) { if ($result > 0) @@ -995,8 +995,9 @@ if ($action == "updateligne" ) } } - $object->recalculer($object_id); - header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object_id); + $result = $object->recalculer($id); + + header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); exit; } else @@ -1008,9 +1009,9 @@ if ($action == "updateligne" ) /* - * Generer ou regenerer le document PDF + * Generate or regenerate the PDF document */ -if ($action == 'builddoc') // En get ou en post +if ($action == 'builddoc') // GET or POST { $depl = new ExpenseReport($db, 0, $_GET['id']); $depl->fetch($id); @@ -1370,7 +1371,7 @@ else if ($action == 'delete_line') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id."&rowid=".$_GET['rowid'],$langs->trans("DeleteLine"),$langs->trans("ConfirmDeleteLine"),"confirm_delete_line",'','yes',1); + $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id."&rowid=".GETPOST('rowid'),$langs->trans("DeleteLine"),$langs->trans("ConfirmDeleteLine"),"confirm_delete_line",'','yes',1); if ($ret == 'html') print '
    '; } @@ -1528,7 +1529,7 @@ else // Fetch Lines of current expense report $sql = 'SELECT fde.rowid, fde.fk_expensereport, fde.fk_c_type_fees, fde.fk_projet, fde.date,'; - $sql.= ' fde.fk_c_tva as vatrate, fde.comments, fde.qty, fde.value_unit, fde.total_ht, fde.total_tva, fde.total_ttc,'; + $sql.= ' fde.fk_c_tva as fk_c_tva, fde.tva_tx as vatrate, fde.comments, fde.qty, fde.value_unit, fde.total_ht, fde.total_tva, fde.total_ttc,'; $sql.= ' ctf.code as type_fees_code, ctf.label as type_fees_libelle,'; $sql.= ' pjt.rowid as projet_id, pjt.title as projet_title, pjt.ref as projet_ref'; $sql.= ' FROM '.MAIN_DB_PREFIX.'expensereport_det as fde'; @@ -1636,10 +1637,10 @@ else // Select project print ''; - $formproject->select_projects(-1, $objp->fk_projet,'fk_projet', 0, 0, 0, 1); + $formproject->select_projects(-1, $objp->fk_projet,'fk_projet', 0, 0, 1, 1); print ''; - // Sélect type + // Select type print ''; select_type_fees_id($objp->type_fees_code,'fk_c_type_fees'); print ''; @@ -1649,17 +1650,17 @@ else print ''; print ''; - // Sélection TVA + // VAT print ''; - print $form->load_tva('fk_c_tva', (isset($_POST["fk_c_tva"])?$_POST["fk_c_tva"]:$objp->tva_taux), $mysoc, ''); + print $form->load_tva('vatrate', (isset($_POST["vatrate"])?$_POST["vatrate"]:$objp->vatrate), $mysoc, ''); print ''; - // Prix unitaire + // Unit price print ''; print ''; print ''; - // Quantité + // Quantity print ''; print ''; print ''; @@ -1712,7 +1713,7 @@ else print ''; print ''; - print ''; + print ''; // Select date print ''; @@ -1744,7 +1745,7 @@ else print ''; print ''; - // Prix unitaire + // Unit price print ''; print ''; print ''; @@ -1805,7 +1806,7 @@ if ($action != 'create' && $action != 'edit') { if ($object->fk_user_author == $user->id) { - // Modifier + // Modify print ''.$langs->trans('Modify').''; // Validate @@ -1816,7 +1817,7 @@ if ($action != 'create' && $action != 'edit') if ($user->rights->expensereport->supprimer) { - // Supprimer + // Delete print ''.$langs->trans('Delete').''; } } @@ -1831,7 +1832,7 @@ if ($action != 'create' && $action != 'edit') { if ($user->id == $object->fk_user_author || $user->id == $object->fk_user_valid) { - // Modifier + // Modify print ''.$langs->trans('Modify').''; // Brouillonner (le statut refusée est identique à brouillon) @@ -1841,7 +1842,7 @@ if ($action != 'create' && $action != 'edit') if ($user->rights->expensereport->supprimer) { - // Supprimer + // Delete print ''.$langs->trans('Delete').''; } } @@ -1874,9 +1875,9 @@ if ($action != 'create' && $action != 'edit') { //if($object->fk_user_validator==$user->id) //{ - // Valider + // Validate print ''.$langs->trans('Approve').''; - // Refuser + // Deny print ''.$langs->trans('Deny').''; //} @@ -1888,7 +1889,7 @@ if ($action != 'create' && $action != 'edit') if($user->rights->expensereport->supprimer) { - // Supprimer + // Delete print ''.$langs->trans('Delete').''; } } @@ -1899,7 +1900,7 @@ if ($action != 'create' && $action != 'edit') */ if ($user->rights->expensereport->to_paid && $object->fk_statut == 5) { - // Payer + // Pay print ''.$langs->trans('TO_PAID').''; // Cancel @@ -1910,7 +1911,7 @@ if ($action != 'create' && $action != 'edit') if($user->rights->expensereport->supprimer) { - // Supprimer + // Delete print ''.$langs->trans('Delete').''; } } @@ -1922,11 +1923,11 @@ if ($action != 'create' && $action != 'edit') */ if ($user->rights->expensereport->approve && $user->rights->expensereport->to_paid && $object->fk_statut==6) { - // Annuler + // Cancel print ''.$langs->trans('Cancel').''; if($user->rights->expensereport->supprimer) { - // Supprimer + // Delete print ''.$langs->trans('Delete').''; } } @@ -1944,7 +1945,7 @@ if ($action != 'create' && $action != 'edit') print ''.$langs->trans('ReOpen').''; } - // Supprimer + // Delete print ''.$langs->trans('Delete').''; } @@ -1959,7 +1960,7 @@ print '
    '; print '
    '; /* - * Documents generes + * Generate documents */ if($user->rights->expensereport->export && $object->fk_statut>0 && $action != 'edit') { diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php old mode 100755 new mode 100644 index 63924d9c952..3a0a15d6d81 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -282,7 +282,7 @@ class ExpenseReport extends CommonObject */ function fetch($id, $ref='') { - global $conf,$db; + global $conf; $sql = "SELECT d.rowid, d.ref, d.note_public, d.note_private,"; // DEFAULT $sql.= " d.detail_refuse, d.detail_cancel, d.fk_user_refuse, d.fk_user_cancel,"; // ACTIONS @@ -298,10 +298,10 @@ class ExpenseReport extends CommonObject $sql.= $restrict; dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); - $result = $db->query($sql) ; - if ($result) + $resql = $this->db->query($sql) ; + if ($resql) { - $obj = $db->fetch_object($result); + $obj = $this->db->fetch_object($resql); if ($obj) { $this->id = $obj->rowid; @@ -367,7 +367,7 @@ class ExpenseReport extends CommonObject $result=$this->fetch_lines(); - return 1; + return $result; } else { @@ -376,7 +376,7 @@ class ExpenseReport extends CommonObject } else { - $this->error=$db->lasterror(); + $this->error=$this->db->lasterror(); return -1; } } @@ -539,8 +539,7 @@ class ExpenseReport extends CommonObject $line->total_tva=20; $line->total_ttc=120; $line->qty=1; - $line->fk_c_tva=20; - $line->tva_taux=20; + $line->vatrate=20; $line->value_unit=120; $line->fk_expensereport=0; $line->type_fees_code='TRA'; @@ -664,6 +663,7 @@ class ExpenseReport extends CommonObject /** * recalculer + * TODO Replace this with call to update_price if not already done * * @param int $id Id of expense report * @return int <0 if KO, >0 if OK @@ -724,7 +724,7 @@ class ExpenseReport extends CommonObject $this->lines=array(); $sql = ' SELECT de.rowid, de.comments, de.qty, de.value_unit, de.date,'; - $sql.= ' de.'.$this->fk_element.', de.fk_c_type_fees, de.fk_projet, de.fk_c_tva,'; + $sql.= ' de.'.$this->fk_element.', de.fk_c_type_fees, de.fk_projet, de.fk_c_tva, de.tva_tx as vatrate,'; $sql.= ' de.total_ht, de.total_tva, de.total_ttc,'; $sql.= ' ctf.code as code_type_fees, ctf.label as libelle_type_fees,'; $sql.= ' p.ref as ref_projet, p.title as title_projet'; @@ -734,14 +734,15 @@ class ExpenseReport extends CommonObject $sql.= ' WHERE de.'.$this->fk_element.' = '.$this->id; dol_syslog('ExpenseReport::fetch_lines sql='.$sql, LOG_DEBUG); - $result = $this->db->query($sql); - if ($result) + $resql = $this->db->query($sql); + if ($resql) { - $num = $this->db->num_rows($result); + $num = $this->db->num_rows($resql); $i = 0; while ($i < $num) { - $objp = $this->db->fetch_object($result); + $objp = $this->db->fetch_object($resql); + $deplig = new ExpenseReportLine($this->db); $deplig->rowid = $objp->rowid; @@ -761,7 +762,7 @@ class ExpenseReport extends CommonObject $deplig->type_fees_code = $objp->code_type_fees; $deplig->type_fees_libelle = $objp->libelle_type_fees; - $deplig->tva_taux = $objp->taux_tva; + $deplig->vatrate = $objp->vatrate; $deplig->projet_ref = $objp->ref_projet; $deplig->projet_title = $objp->title_projet; @@ -770,13 +771,13 @@ class ExpenseReport extends CommonObject $i++; } - $this->db->free($result); + $this->db->free($resql); return 1; } else { $this->error=$this->db->lasterror(); - dol_syslog('ExpenseReport::fetch_lines: Error '.$this->error,LOG_ERR); + dol_syslog('ExpenseReport::fetch_lines: Error '.$this->error, LOG_ERR); return -3; } } @@ -1199,30 +1200,36 @@ class ExpenseReport extends CommonObject } - - function updateline($rowid, $type_fees_id, $projet_id, $c_tva, $comments, $qty, $value_unit, $date, $expensereport_id) + /** + * updateline + * + * @param int $rowid Line to edit + * @param int $type_fees_id Type payment + * @param int $projet_id Project id + * @param double $vatrate Vat rate + * @param string $comments Description + * @param real $qty Qty + * @param double $value_unit Value init + * @param int $date Date + * @param int $expensereport_id Expense report id + * @return int <0 if KO, >0 if OK + */ + function updateline($rowid, $type_fees_id, $projet_id, $vatrate, $comments, $qty, $value_unit, $date, $expensereport_id) { + global $user; + if ($this->fk_statut==0 || $this->fk_statut==99) { $this->db->begin(); - // Select du taux de tva par rapport au code - $sql = "SELECT t.taux as taux_tva"; - $sql.= " FROM ".MAIN_DB_PREFIX."c_tva as t"; - $sql.= " WHERE t.rowid = ".$c_tva; - $result = $this->db->query($sql); - $objp_tva = $this->db->fetch_object($result); - // calcul de tous les totaux de la ligne - $total_ttc = $qty*$value_unit; - $total_ttc = number_format($total_ttc,2,'.',''); + $total_ttc = price2num($qty*$value_unit, 'MT'); - $tx_tva = $objp_tva->taux_tva/100; + $tx_tva = $vatrate / 100; $tx_tva = $tx_tva + 1; - $total_ht = $total_ttc/$tx_tva; - $total_ht = number_format($total_ht,2,'.',''); + $total_ht = price2num($total_ttc/$tx_tva, 'MT'); - $total_tva = $total_ttc - $total_ht; + $total_tva = price2num($total_ttc - $total_ht, 'MT'); // fin calculs $ligne = new ExpenseReportLine($this->db); @@ -1231,15 +1238,14 @@ class ExpenseReport extends CommonObject $ligne->value_unit = $value_unit; $ligne->date = $date; - $ligne->fk_expensereport = $expensereport_id; + $ligne->fk_expensereport= $expensereport_id; $ligne->fk_c_type_fees = $type_fees_id; $ligne->fk_projet = $projet_id; - $ligne->fk_c_tva = $c_tva; $ligne->total_ht = $total_ht; $ligne->total_tva = $total_tva; $ligne->total_ttc = $total_ttc; - $ligne->tva_taux = $objp_tva->taux_tva; + $ligne->vatrate = price2num($vatrate); $ligne->rowid = $rowid; // Select des infos sur le type fees @@ -1260,16 +1266,19 @@ class ExpenseReport extends CommonObject $ligne->projet_ref = $objp_projet->ref_projet; $ligne->projet_title = $objp_projet->title_projet; - $result = $ligne->update(); - if ($result > 0): - $this->db->commit(); - return 1; - else: - $this->error=$ligne->error; - $this->db->rollback(); - return -2; - endif; - + $result = $ligne->update($user); + if ($result > 0) + { + $this->db->commit(); + return 1; + } + else + { + $this->error=$ligne->error; + $this->errors=$ligne->errors; + $this->db->rollback(); + return -2; + } } } @@ -1487,8 +1496,7 @@ class ExpenseReportLine var $projet_ref; var $projet_title; - var $tva_taux; - + var $vatrate; var $total_ht; var $total_tva; var $total_ttc; @@ -1512,7 +1520,7 @@ class ExpenseReportLine function fetch($rowid) { $sql = 'SELECT fde.rowid, fde.fk_expensereport, fde.fk_c_type_fees, fde.fk_projet, fde.date,'; - $sql.= ' fde.fk_c_tva as tva_taux, fde.comments, fde.qty, fde.value_unit, fde.total_ht, fde.total_tva, fde.total_ttc,'; + $sql.= ' fde.fk_c_tva as fk_c_tva, fde.tva_tx as vatrate, fde.comments, fde.qty, fde.value_unit, fde.total_ht, fde.total_tva, fde.total_ttc,'; $sql.= ' ctf.code as type_fees_code, ctf.label as type_fees_libelle,'; $sql.= ' pjt.rowid as projet_id, pjt.title as projet_title, pjt.ref as projet_ref'; $sql.= ' FROM '.MAIN_DB_PREFIX.'expensereport_det as fde'; @@ -1539,7 +1547,7 @@ class ExpenseReportLine $this->type_fees_libelle = $objp->type_fees_libelle; $this->projet_ref = $objp->projet_ref; $this->projet_title = $objp->projet_title; - $this->tva_taux = $objp->tva_taux; + $this->vatrate = $objp->vatrate; $this->total_ht = $objp->total_ht; $this->total_tva = $objp->total_tva; $this->total_ttc = $objp->total_ttc; @@ -1568,15 +1576,17 @@ class ExpenseReportLine $this->comments=trim($this->comments); if (!$this->value_unit_HT) $this->value_unit_HT=0; $this->qty = price2num($this->qty); + $this->vatrate = price2num($this->vatrate); $this->db->begin(); $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'expensereport_det'; $sql.= ' (fk_expensereport, fk_c_type_fees, fk_projet,'; - $sql.= ' fk_c_tva, comments, qty, value_unit, total_ht, total_tva, total_ttc, date)'; + $sql.= ' fk_c_tva, tva_tx, comments, qty, value_unit, total_ht, total_tva, total_ttc, date)'; $sql.= " VALUES (".$this->fk_expensereport.","; $sql.= " ".$this->fk_c_type_fees.","; $sql.= " ".($this->fk_projet>0?$this->fk_projet:'null').","; + $sql.= " ".($this->fk_c_tva?$this->fk_c_tva:"null").","; $sql.= " ".$this->vatrate.","; $sql.= " '".$this->db->escape($this->comments)."',"; $sql.= " ".$this->qty.","; @@ -1633,6 +1643,7 @@ class ExpenseReportLine // Clean parameters $this->comments=trim($this->comments); + $this->vatrate = price2num($this->vatrate); $this->db->begin(); @@ -1641,14 +1652,11 @@ class ExpenseReportLine $sql.= " comments='".$this->db->escape($this->comments)."'"; $sql.= ",value_unit=".$this->value_unit.""; $sql.= ",qty=".$this->qty.""; - if ($this->date) { - $sql.= ",date='".$this->date."'"; - } - else { $sql.=',date=null'; - } + $sql.= ",date='".$this->db->idate($this->date)."'"; $sql.= ",total_ht=".$this->total_ht.""; $sql.= ",total_tva=".$this->total_tva.""; $sql.= ",total_ttc=".$this->total_ttc.""; + $sql.= ",tva_tx=".$this->vatrate; if ($this->fk_c_type_fees) $sql.= ",fk_c_type_fees=".$this->fk_c_type_fees; else $sql.= ",fk_c_type_fees=null"; if ($this->fk_projet) $sql.= ",fk_projet=".$this->fk_projet; @@ -1662,16 +1670,30 @@ class ExpenseReportLine $resql=$this->db->query($sql); if ($resql) { - $tmpparent=new ExpenseReport($db); - $tmpparent->fetch($this->fk_expensereport); - $result = $tmpparent->update_price(); - if ($result < 0) + $tmpparent=new ExpenseReport($this->db); + $result = $tmpparent->fetch($this->fk_expensereport); + if ($result > 0) + { + $result = $tmpparent->update_price(); + if ($result < 0) + { + $error++; + $this->error = $tmpparent->error; + $this->errors = $tmpparent->errors; + } + } + else { $error++; $this->error = $tmpparent->error; $this->errors = $tmpparent->errors; } } + else + { + $error++; + dol_print_error($this->db); + } if (! $error) { diff --git a/htdocs/expensereport/export_csv.php b/htdocs/expensereport/export_csv.php old mode 100755 new mode 100644 diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php old mode 100755 new mode 100644 index ca33fc34f0f..0974ce0f31c --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -177,7 +177,7 @@ if ($resql) if ($search_amount_ht) $param.="&search_amount_ht=".$search_amount_ht; if ($search_amount_ttc) $param.="&search_amount_ttc=".$search_amount_ttc; if ($search_status >= 0) $param.="&search_status=".$search_status; - + print_barre_liste($langs->trans("ListTripsAndExpenses"), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords); print '
    '."\n"; print ''; @@ -221,9 +221,9 @@ if ($resql) // Amount with no taxe print ''; - + print ''; - + // Amount with all taxes print ''; @@ -288,7 +288,7 @@ if ($resql) } else { - print ''; + print ''.''; } print "
     '.$langs->trans("NoRecordFound").'
    '.$langs->trans("NoRecordFound").'
    "; diff --git a/htdocs/expensereport/stats/index.php b/htdocs/expensereport/stats/index.php old mode 100755 new mode 100644 diff --git a/htdocs/expensereport/synchro_compta.php b/htdocs/expensereport/synchro_compta.php old mode 100755 new mode 100644 diff --git a/htdocs/exports/index.php b/htdocs/exports/index.php index d76c6f506d5..bf002ccde96 100644 --- a/htdocs/exports/index.php +++ b/htdocs/exports/index.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2005-2015 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 @@ -52,7 +52,7 @@ print $langs->trans("FormatedExportDesc3").'
    '; print '
    '; -print '
    '; +print '
    '; // List export set @@ -110,7 +110,7 @@ if (count($export->array_export_code)) print '
    '; print '
    '; -print '
    '; +print '
    '; // List of available export format diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 437bb05f29f..dac78d9ae3b 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -1018,6 +1018,8 @@ if ($action == 'create') print ''; print ''; + dol_fiche_head(''); + print ''; print ''; @@ -1122,7 +1124,9 @@ if ($action == 'create') print ''; } - print '
    '; + dol_fiche_end(); + + print '
    '; print ''; print '
    '; @@ -1130,6 +1134,8 @@ if ($action == 'create') } else { + dol_fiche_head(''); + print ''; print '
    '; print ''; print '
    '.$langs->trans("ThirdParty").''; @@ -1137,7 +1143,9 @@ if ($action == 'create') print '
    '; - print '
    '; + dol_fiche_end(); + + print '
    '; print ''; print ''; print '
    '; diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php old mode 100755 new mode 100644 diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 45670766788..6511bb569e0 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1478,6 +1478,8 @@ if ($action=='create') print ''; print ''; + dol_fiche_head(''); + print ''; // Ref @@ -1600,7 +1602,9 @@ if ($action=='create') // Bouton "Create Draft" print "
    \n"; - print '
    '; + dol_fiche_end(); + + print '
    '; print "\n"; diff --git a/htdocs/fourn/commande/orderstoinvoice.php b/htdocs/fourn/commande/orderstoinvoice.php index 88e473ad88a..24a481be61f 100644 --- a/htdocs/fourn/commande/orderstoinvoice.php +++ b/htdocs/fourn/commande/orderstoinvoice.php @@ -386,10 +386,10 @@ if (($action != 'create' && $action != 'add') && !$error) { diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 8092c1e0f9d..73832e9f3b7 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2004 Christophe Combelles * Copyright (C) 2005 Marc Barilley * Copyright (C) 2005-2013 Regis Houssin @@ -1318,6 +1318,8 @@ if ($action == 'create') $datedue=($datetmp==''?-1:$datetmp); } + dol_fiche_head(); + print '
    '; print ''; print ''; @@ -1572,7 +1574,9 @@ if ($action == 'create') // Bouton "Create Draft" print "\n"; - print '
    '; + dol_fiche_end(); + + print '
    '; print "
    \n"; diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 0ebd93a9ad8..887fa7c6fab 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -7,7 +7,8 @@ * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2015 Marcos García * Copyright (C) 2015 juanjo Menent - * + * Copyright (C) 2015 Abbes Bahfir + * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or diff --git a/htdocs/holiday/view_log.php b/htdocs/holiday/view_log.php index 5f18a524acc..bb9b2c430be 100644 --- a/htdocs/holiday/view_log.php +++ b/htdocs/holiday/view_log.php @@ -88,8 +88,8 @@ foreach($cp->logs as $logs_CP) print ''.$user_action->getNomUrl(1).''; print ''.$user_update->getNomUrl(1).''; print ''.$logs_CP['type_action'].''; - print ''.$logs_CP['prev_solde'].' '.$langs->trans('days').''; - print ''.$logs_CP['new_solde'].' '.$langs->trans('days').''; + print ''.price2num($logs_CP['prev_solde'],8).' '.$langs->trans('days').''; + print ''.price2num($logs_CP['new_solde'],8).' '.$langs->trans('days').''; print ''."\n"; } diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index c2dbcae5a37..c46854ec5c1 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -1,7 +1,7 @@ +/* Copyright (C) 2005-2015 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2012 Christophe Battarel + * Copyright (C) 2012 Christophe Battarel * * 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 diff --git a/htdocs/imports/index.php b/htdocs/imports/index.php index ada73d97559..360e713f9ab 100644 --- a/htdocs/imports/index.php +++ b/htdocs/imports/index.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2005-2015 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 @@ -48,7 +48,7 @@ print $langs->trans("FormatedImportDesc2").'
    '; print '
    '; -print '
    '; +print '
    '; // List of import set @@ -101,7 +101,7 @@ print '
    '; print '
    '; -print '
    '; +print '
    '; // List of available import format diff --git a/htdocs/includes/restler/iCache.php b/htdocs/includes/restler/iCache.php old mode 100755 new mode 100644 diff --git a/htdocs/install/check.php b/htdocs/install/check.php index 15ba736acd5..4149691302e 100644 --- a/htdocs/install/check.php +++ b/htdocs/install/check.php @@ -296,9 +296,9 @@ else $conf->db->user = $dolibarr_main_db_user; $conf->db->pass = $dolibarr_main_db_pass; $db=getDoliDBInstance($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name,$conf->db->port); - if ($db->connected == 1 && $db->database_selected == 1) + if ($db->connected && $db->database_selected) { - $ok=1; + $ok=true; } } } diff --git a/htdocs/install/etape1.php b/htdocs/install/etape1.php index 32f85a0860d..5817af81e9b 100644 --- a/htdocs/install/etape1.php +++ b/htdocs/install/etape1.php @@ -637,7 +637,7 @@ if (! $error && $db->connected && $action == "set") $db=getDoliDBInstance($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name,$conf->db->port); - if ($db->connected == 1) + if ($db->connected) { dolibarr_install_syslog("etape1: connexion to server by user ".$conf->db->user." is ok", LOG_DEBUG); print ""; @@ -648,7 +648,7 @@ if (! $error && $db->connected && $action == "set") print ""; // si acces serveur ok et acces base ok, tout est ok, on ne va pas plus loin, on a meme pas utilise le compte root. - if ($db->database_selected == 1) + if ($db->database_selected) { dolibarr_install_syslog("etape1: connexion to database : ".$conf->db->name.", by user : ".$conf->db->user." is ok", LOG_DEBUG); print ""; diff --git a/htdocs/install/etape2.php b/htdocs/install/etape2.php index 8c0e3f8ab5c..8de44812222 100644 --- a/htdocs/install/etape2.php +++ b/htdocs/install/etape2.php @@ -88,7 +88,7 @@ if ($action == "set") $db=getDoliDBInstance($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name,$conf->db->port); - if ($db->connected == 1) + if ($db->connected) { print ""; print $langs->trans("ServerConnection")." : ".$conf->db->host.'Ok'; @@ -101,7 +101,7 @@ if ($action == "set") if ($ok) { - if($db->database_selected == 1) + if($db->database_selected) { dolibarr_install_syslog("etape2: Connexion successful to database : ".$conf->db->name); } @@ -139,7 +139,7 @@ if ($action == "set") // To say sql requests are escaped for mysql so we need to unescape them - $db->unescapeslashquot=1; + $db->unescapeslashquot=true; /************************************************************************************** diff --git a/htdocs/install/etape4.php b/htdocs/install/etape4.php index 54639505701..fc4f47f4611 100644 --- a/htdocs/install/etape4.php +++ b/htdocs/install/etape4.php @@ -71,7 +71,7 @@ print ''; $db=getDoliDBInstance($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name,$conf->db->port); -if ($db->ok == 1) +if ($db->ok) { print ''; diff --git a/htdocs/install/etape5.php b/htdocs/install/etape5.php index d6a5d086b31..da871508176 100644 --- a/htdocs/install/etape5.php +++ b/htdocs/install/etape5.php @@ -159,7 +159,7 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action)) $result=$objMod->init(); if (! $result) print 'ERROR in activating module file='.$file; - if ($db->connected == 1) + if ($db->connected) { $conf->setValues($db); @@ -255,7 +255,7 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action)) // If upgrade elseif (empty($action) || preg_match('/upgrade/i',$action)) { - if ($db->connected == 1) + if ($db->connected) { $conf->setValues($db); diff --git a/htdocs/install/fileconf.php b/htdocs/install/fileconf.php index 1256c5b215a..97a52ff6c34 100644 --- a/htdocs/install/fileconf.php +++ b/htdocs/install/fileconf.php @@ -487,8 +487,8 @@ jQuery(document).ready(function() { function init_needroot() { - /*alert(jQuery("#db_create_database").attr("checked")); */ - if (jQuery("#db_create_database").attr("checked") || jQuery("#db_create_user").attr("checked")) + /*alert(jQuery("#db_create_database").prop("checked")); */ + if (jQuery("#db_create_database").is(":checked") || jQuery("#db_create_user").is(":checked")) { jQuery(".hideroot").show(); jQuery(".needroot").removeAttr('disabled'); @@ -496,7 +496,7 @@ jQuery(document).ready(function() { else { jQuery(".hideroot").hide(); - jQuery(".needroot").attr('disabled','disabled'); + jQuery(".needroot").prop('disabled', true); } } diff --git a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql index 28f4ab69f71..62657944a31 100755 --- a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql +++ b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql @@ -78,6 +78,15 @@ ALTER TABLE llx_extrafields ADD COLUMN list integer DEFAULT 0 after perms; ALTER TABLE llx_payment_salary ADD COLUMN salary real after datev; +ALTER TABLE llx_payment_salary ADD INDEX idx_payment_salary_ref (num_payment); +ALTER TABLE llx_payment_salary ADD INDEX idx_payment_salary_user (fk_user, entity); +ALTER TABLE llx_payment_salary ADD INDEX idx_payment_salary_datep (datep); +ALTER TABLE llx_payment_salary ADD INDEX idx_payment_salary_datesp (datesp); +ALTER TABLE llx_payment_salary ADD INDEX idx_payment_salary_dateep (dateep); + +ALTER TABLE llx_payment_salary ADD CONSTRAINT fk_payment_salary_user FOREIGN KEY (fk_user) REFERENCES llx_user (rowid); + + UPDATE llx_projet_task_time SET task_datehour = task_date where task_datehour IS NULL; ALTER TABLE llx_projet_task_time ADD COLUMN task_date_withhour integer DEFAULT 0 after task_datehour; @@ -235,8 +244,8 @@ CREATE TABLE llx_expensereport_det rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY, fk_expensereport integer NOT NULL, fk_c_type_fees integer NOT NULL, - fk_projet integer NOT NULL, - fk_c_tva integer NOT NULL, + fk_projet integer, + fk_c_tva integer, comments text NOT NULL, product_type integer DEFAULT -1, qty real NOT NULL, @@ -259,6 +268,9 @@ CREATE TABLE llx_expensereport_det import_key varchar(14) ) ENGINE=innodb; +ALTER TABLE llx_expensereport_det MODIFY COLUMN fk_projet integer NULL; +ALTER TABLE llx_expensereport_det MODIFY COLUMN fk_c_tva integer NULL; + ALTER TABLE llx_projet ADD COLUMN budget_amount double(24,8); diff --git a/htdocs/install/mysql/tables/llx_expensereport_det.sql b/htdocs/install/mysql/tables/llx_expensereport_det.sql index 418f1ce6cc5..ef9f03b9bbb 100644 --- a/htdocs/install/mysql/tables/llx_expensereport_det.sql +++ b/htdocs/install/mysql/tables/llx_expensereport_det.sql @@ -28,7 +28,7 @@ CREATE TABLE llx_expensereport_det qty real NOT NULL, value_unit real NOT NULL, remise_percent real, - tva_tx double(6,3), -- Vat rat + tva_tx double(6,3), -- Vat rate localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate localtax1_type varchar(10) NULL, -- localtax1 type localtax2_tx double(6,3) DEFAULT 0, -- localtax2 rate diff --git a/htdocs/install/mysql/tables/llx_payment_salary.key.sql b/htdocs/install/mysql/tables/llx_payment_salary.key.sql new file mode 100644 index 00000000000..d1df789eebe --- /dev/null +++ b/htdocs/install/mysql/tables/llx_payment_salary.key.sql @@ -0,0 +1,27 @@ +-- ============================================================================ +-- Copyright (C) 2015 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 +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- ============================================================================ + + +ALTER TABLE llx_payment_salary ADD INDEX idx_payment_salary_ref (num_payment); +ALTER TABLE llx_payment_salary ADD INDEX idx_payment_salary_user (fk_user, entity); +ALTER TABLE llx_payment_salary ADD INDEX idx_payment_salary_datep (datep); +ALTER TABLE llx_payment_salary ADD INDEX idx_payment_salary_datesp (datesp); +ALTER TABLE llx_payment_salary ADD INDEX idx_payment_salary_dateep (dateep); + +ALTER TABLE llx_payment_salary ADD CONSTRAINT fk_payment_salary_user FOREIGN KEY (fk_user) REFERENCES llx_user (rowid); + diff --git a/htdocs/install/mysql/tables/llx_payment_salary.sql b/htdocs/install/mysql/tables/llx_payment_salary.sql index 2498c771ba6..5bda961c274 100644 --- a/htdocs/install/mysql/tables/llx_payment_salary.sql +++ b/htdocs/install/mysql/tables/llx_payment_salary.sql @@ -22,14 +22,14 @@ create table llx_payment_salary tms timestamp, fk_user integer NOT NULL, datep date, -- date de paiement - datev date, -- date de valeur + datev date, -- date de valeur (this field should not be here, only into bank tables) salary real, -- salary of user when payment was done amount real NOT NULL DEFAULT 0, fk_typepayment integer NOT NULL, - num_payment varchar(50), + num_payment varchar(50), -- ref label varchar(255), - datesp date, -- date de début de la période - dateep date, -- date de fin de la période + datesp date, -- date start period + dateep date, -- date end period entity integer DEFAULT 1 NOT NULL, -- multi company id note text, fk_bank integer, diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php index a8bbfdd09af..786a8efb430 100644 --- a/htdocs/install/repair.php +++ b/htdocs/install/repair.php @@ -101,7 +101,7 @@ $conf->db->dolibarr_main_db_cryptkey = isset($dolibarr_main_db_cryptkey)?$doliba $db=getDoliDBInstance($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name,$conf->db->port); -if ($db->connected == 1) +if ($db->connected) { print '"; @@ -117,7 +117,7 @@ else if ($ok) { - if($db->database_selected == 1) + if($db->database_selected) { print '"; diff --git a/htdocs/install/upgrade.php b/htdocs/install/upgrade.php index c001a771f06..9c2832f3623 100644 --- a/htdocs/install/upgrade.php +++ b/htdocs/install/upgrade.php @@ -141,7 +141,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action'))) include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; $hookmanager=new HookManager($db); - if ($db->connected == 1) + if ($db->connected) { print '\n"; @@ -157,7 +157,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action'))) if ($ok) { - if($db->database_selected == 1) + if($db->database_selected) { print '\n"; diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 8d63f02ddc8..70ebd8550c5 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -134,7 +134,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action'))) include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; $hookmanager=new HookManager($db); - if ($db->connected != 1) + if (!$db->connected) { print ''; dolibarr_install_syslog('upgrade2: Failed to connect to database : '.$conf->db->name.' on '.$conf->db->host.' for user '.$conf->db->user, LOG_ERR); @@ -143,7 +143,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action'))) if (! $error) { - if($db->database_selected == 1) + if($db->database_selected) { dolibarr_install_syslog('upgrade2: Database connection successfull : '.$dolibarr_main_db_name); } @@ -1292,7 +1292,7 @@ function migrate_price_facture($db,$langs,$conf) print ''.$langs->trans('MigrationInvoice')."
    \n"; // Liste des lignes facture non a jour - $sql = "SELECT fd.rowid, fd.qty, fd.subprice, fd.remise_percent, fd.tva_tx as tva_taux, fd.total_ttc, fd.info_bits,"; + $sql = "SELECT fd.rowid, fd.qty, fd.subprice, fd.remise_percent, fd.tva_tx as vatrate, fd.total_ttc, fd.info_bits,"; $sql.= " f.rowid as facid, f.remise_percent as remise_percent_global, f.total_ttc as total_ttc_f"; $sql.= " FROM ".MAIN_DB_PREFIX."facturedet as fd, ".MAIN_DB_PREFIX."facture as f"; $sql.= " WHERE fd.fk_facture = f.rowid"; @@ -1314,7 +1314,7 @@ function migrate_price_facture($db,$langs,$conf) $rowid = $obj->rowid; $qty = $obj->qty; $pu = $obj->subprice; - $txtva = $obj->tva_taux; + $vatrate = $obj->vatrate; $remise_percent = $obj->remise_percent; $remise_percent_global = $obj->remise_percent_global; $total_ttc_f = $obj->total_ttc_f; @@ -1324,7 +1324,7 @@ function migrate_price_facture($db,$langs,$conf) $facligne= new FactureLigne($db); $facligne->fetch($rowid); - $result=calcul_price_total($qty,$pu,$remise_percent,$txtva, 0, 0,$remise_percent_global,'HT',$info_bits,0); + $result=calcul_price_total($qty,$pu,$remise_percent,$vatrate, 0, 0,$remise_percent_global,'HT',$info_bits,0); $total_ht = $result[0]; $total_tva = $result[1]; $total_ttc = $result[2]; @@ -1333,7 +1333,7 @@ function migrate_price_facture($db,$langs,$conf) $facligne->total_tva = $total_tva; $facligne->total_ttc = $total_ttc; - dolibarr_install_syslog("upgrade2: Line $rowid: facid=$obj->facid pu=$pu qty=$qty tva_taux=$txtva remise_percent=$remise_percent remise_global=$remise_percent_global -> $total_ht, $total_tva, $total_ttc"); + dolibarr_install_syslog("upgrade2: Line $rowid: facid=$obj->facid pu=$pu qty=$qty vatrate=$vatrate remise_percent=$remise_percent remise_global=$remise_percent_global -> $total_ht, $total_tva, $total_ttc"); print ". "; $facligne->update_total(); @@ -1406,7 +1406,7 @@ function migrate_price_propal($db,$langs,$conf) print ''.$langs->trans('MigrationProposal')."
    \n"; // Liste des lignes propal non a jour - $sql = "SELECT pd.rowid, pd.qty, pd.subprice, pd.remise_percent, pd.tva_tx as tva_taux, pd.info_bits,"; + $sql = "SELECT pd.rowid, pd.qty, pd.subprice, pd.remise_percent, pd.tva_tx as vatrate, pd.info_bits,"; $sql.= " p.rowid as propalid, p.remise_percent as remise_percent_global"; $sql.= " FROM ".MAIN_DB_PREFIX."propaldet as pd, ".MAIN_DB_PREFIX."propal as p"; $sql.= " WHERE pd.fk_propal = p.rowid"; @@ -1427,7 +1427,7 @@ function migrate_price_propal($db,$langs,$conf) $rowid = $obj->rowid; $qty = $obj->qty; $pu = $obj->subprice; - $txtva = $obj->tva_taux; + $vatrate = $obj->vatrate; $remise_percent = $obj->remise_percent; $remise_percent_global = $obj->remise_percent_global; $info_bits = $obj->info_bits; @@ -1436,7 +1436,7 @@ function migrate_price_propal($db,$langs,$conf) $propalligne= new PropaleLigne($db); $propalligne->fetch($rowid); - $result=calcul_price_total($qty,$pu,$remise_percent,$txtva,0,0,$remise_percent_global,'HT',$info_bits,0); + $result=calcul_price_total($qty,$pu,$remise_percent,$vatrate,0,0,$remise_percent_global,'HT',$info_bits,0); $total_ht = $result[0]; $total_tva = $result[1]; $total_ttc = $result[2]; @@ -1445,7 +1445,7 @@ function migrate_price_propal($db,$langs,$conf) $propalligne->total_tva = $total_tva; $propalligne->total_ttc = $total_ttc; - dolibarr_install_syslog("upgrade2: Line $rowid: propalid=$obj->rowid pu=$pu qty=$qty tva_taux=$txtva remise_percent=$remise_percent remise_global=$remise_percent_global -> $total_ht, $total_tva, $total_ttc"); + dolibarr_install_syslog("upgrade2: Line $rowid: propalid=$obj->rowid pu=$pu qty=$qty vatrate=$vatrate remise_percent=$remise_percent remise_global=$remise_percent_global -> $total_ht, $total_tva, $total_ttc"); print ". "; $propalligne->update_total(); @@ -1515,7 +1515,7 @@ function migrate_price_contrat($db,$langs,$conf) print ''.$langs->trans('MigrationContract')."
    \n"; // Liste des lignes contrat non a jour - $sql = "SELECT cd.rowid, cd.qty, cd.subprice, cd.remise_percent, cd.tva_tx as tva_taux, cd.info_bits,"; + $sql = "SELECT cd.rowid, cd.qty, cd.subprice, cd.remise_percent, cd.tva_tx as vatrate, cd.info_bits,"; $sql.= " c.rowid as contratid"; $sql.= " FROM ".MAIN_DB_PREFIX."contratdet as cd, ".MAIN_DB_PREFIX."contrat as c"; $sql.= " WHERE cd.fk_contrat = c.rowid"; @@ -1536,7 +1536,7 @@ function migrate_price_contrat($db,$langs,$conf) $rowid = $obj->rowid; $qty = $obj->qty; $pu = $obj->subprice; - $txtva = $obj->tva_taux; + $vatrate = $obj->vatrate; $remise_percent = $obj->remise_percent; $info_bits = $obj->info_bits; @@ -1545,7 +1545,7 @@ function migrate_price_contrat($db,$langs,$conf) //$contratligne->fetch($rowid); Non requis car le update_total ne met a jour que chp redefinis $contratligne->id=$rowid; - $result=calcul_price_total($qty,$pu,$remise_percent,$txtva,0,0,0,'HT',$info_bits,0,$tmpmysoc); + $result=calcul_price_total($qty,$pu,$remise_percent,$vatrate,0,0,0,'HT',$info_bits,0,$tmpmysoc); $total_ht = $result[0]; $total_tva = $result[1]; $total_ttc = $result[2]; @@ -1554,7 +1554,7 @@ function migrate_price_contrat($db,$langs,$conf) $contratligne->total_tva = $total_tva; $contratligne->total_ttc = $total_ttc; - dolibarr_install_syslog("upgrade2: Line $rowid: contratdetid=$obj->rowid pu=$pu qty=$qty tva_taux=$txtva remise_percent=$remise_percent -> $total_ht, $total_tva, $total_ttc"); + dolibarr_install_syslog("upgrade2: Line $rowid: contratdetid=$obj->rowid pu=$pu qty=$qty vatrate=$vatrate remise_percent=$remise_percent -> $total_ht, $total_tva, $total_ttc"); print ". "; $contratligne->update_total(); @@ -1600,7 +1600,7 @@ function migrate_price_commande($db,$langs,$conf) print ''.$langs->trans('MigrationOrder')."
    \n"; // Liste des lignes commande non a jour - $sql = "SELECT cd.rowid, cd.qty, cd.subprice, cd.remise_percent, cd.tva_tx as tva_taux, cd.info_bits,"; + $sql = "SELECT cd.rowid, cd.qty, cd.subprice, cd.remise_percent, cd.tva_tx as vatrate, cd.info_bits,"; $sql.= " c.rowid as commandeid, c.remise_percent as remise_percent_global"; $sql.= " FROM ".MAIN_DB_PREFIX."commandedet as cd, ".MAIN_DB_PREFIX."commande as c"; $sql.= " WHERE cd.fk_commande = c.rowid"; @@ -1621,7 +1621,7 @@ function migrate_price_commande($db,$langs,$conf) $rowid = $obj->rowid; $qty = $obj->qty; $pu = $obj->subprice; - $txtva = $obj->tva_taux; + $vatrate = $obj->vatrate; $remise_percent = $obj->remise_percent; $remise_percent_global = $obj->remise_percent_global; $info_bits = $obj->info_bits; @@ -1630,7 +1630,7 @@ function migrate_price_commande($db,$langs,$conf) $commandeligne= new OrderLine($db); $commandeligne->fetch($rowid); - $result=calcul_price_total($qty,$pu,$remise_percent,$txtva,0,0,$remise_percent_global,'HT',$info_bits,0); + $result=calcul_price_total($qty,$pu,$remise_percent,$vatrate,0,0,$remise_percent_global,'HT',$info_bits,0); $total_ht = $result[0]; $total_tva = $result[1]; $total_ttc = $result[2]; @@ -1639,7 +1639,7 @@ function migrate_price_commande($db,$langs,$conf) $commandeligne->total_tva = $total_tva; $commandeligne->total_ttc = $total_ttc; - dolibarr_install_syslog("upgrade2: Line $rowid: commandeid=$obj->rowid pu=$pu qty=$qty tva_taux=$txtva remise_percent=$remise_percent remise_global=$remise_percent_global -> $total_ht, $total_tva, $total_ttc"); + dolibarr_install_syslog("upgrade2: Line $rowid: commandeid=$obj->rowid pu=$pu qty=$qty vatrate=$vatrate remise_percent=$remise_percent remise_global=$remise_percent_global -> $total_ht, $total_tva, $total_ttc"); print ". "; $commandeligne->update_total(); @@ -1714,7 +1714,7 @@ function migrate_price_commande_fournisseur($db,$langs,$conf) print ''.$langs->trans('MigrationSupplierOrder')."
    \n"; // Liste des lignes commande non a jour - $sql = "SELECT cd.rowid, cd.qty, cd.subprice, cd.remise_percent, cd.tva_tx as tva_taux, cd.info_bits,"; + $sql = "SELECT cd.rowid, cd.qty, cd.subprice, cd.remise_percent, cd.tva_tx as vatrate, cd.info_bits,"; $sql.= " c.rowid as commandeid, c.remise_percent as remise_percent_global"; $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd, ".MAIN_DB_PREFIX."commande_fournisseur as c"; $sql.= " WHERE cd.fk_commande = c.rowid"; @@ -1735,7 +1735,7 @@ function migrate_price_commande_fournisseur($db,$langs,$conf) $rowid = $obj->rowid; $qty = $obj->qty; $pu = $obj->subprice; - $txtva = $obj->tva_taux; + $vatrate = $obj->vatrate; $remise_percent = $obj->remise_percent; $remise_percent_global = $obj->remise_percent_global; $info_bits = $obj->info_bits; @@ -1744,7 +1744,7 @@ function migrate_price_commande_fournisseur($db,$langs,$conf) $commandeligne= new CommandeFournisseurLigne($db); $commandeligne->fetch($rowid); - $result=calcul_price_total($qty,$pu,$remise_percent,$txtva,0,0,$remise_percent_global,'HT',$info_bits,0); + $result=calcul_price_total($qty,$pu,$remise_percent,$vatrate,0,0,$remise_percent_global,'HT',$info_bits,0); $total_ht = $result[0]; $total_tva = $result[1]; $total_ttc = $result[2]; @@ -1753,7 +1753,7 @@ function migrate_price_commande_fournisseur($db,$langs,$conf) $commandeligne->total_tva = $total_tva; $commandeligne->total_ttc = $total_ttc; - dolibarr_install_syslog("upgrade2: Line $rowid: commandeid=$obj->rowid pu=$pu qty=$qty tva_taux=$txtva remise_percent=$remise_percent remise_global=$remise_percent_global -> $total_ht, $total_tva, $total_ttc"); + dolibarr_install_syslog("upgrade2: Line $rowid: commandeid=$obj->rowid pu=$pu qty=$qty vatrate=$vatrate remise_percent=$remise_percent remise_global=$remise_percent_global -> $total_ht, $total_tva, $total_ttc"); print ". "; $commandeligne->update_total(); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index e5604ffdb20..42dbfd9079b 100755 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -492,8 +492,8 @@ Module400Name=Projects/Opportunities/Leads Module400Desc=Management of projects, opportunities or leads. You can then assign any element (invoice, order, proposal, intervention, ...) to a project and get a transversal view from the project view. Module410Name=Webcalendar Module410Desc=Webcalendar integration -Module500Name=Special expenses (tax, social contributions, dividends) -Module500Desc=Management of special expenses like taxes, social contribution, dividends and salaries +Module500Name=Special expenses +Module500Desc=Management of special expenses (taxes, social contribution, dividends) Module510Name=Salaries Module510Desc=Management of employees salaries and payments Module520Name=Loan diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang index 5cb000408da..83cb5c7e428 100644 --- a/htdocs/langs/en_US/other.lang +++ b/htdocs/langs/en_US/other.lang @@ -204,6 +204,7 @@ ClickHereToGoTo=Click here to go to %s YouMustClickToChange=You must however first click on the following link to validate this password change ForgetIfNothing=If you didn't request this change, just forget this email. Your credentials are kept safe. IfAmountHigherThan=If amount higher than %s +SourcesRepository=Repository for sources ##### Calendar common ##### AddCalendarEntry=Add entry in calendar %s diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index 6fc649c272e..0215f20e3c6 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -22,9 +22,8 @@ /** - * \class FormProduct - * \brief Class with static methods for building HTML components related to products - * \remarks Only common components must be here. + * Class with static methods for building HTML components related to products + * Only components common to products and services must be here. */ class FormProduct { @@ -34,9 +33,6 @@ class FormProduct // Cache arrays var $cache_warehouses=array(); - var $tva_taux_value; - var $tva_taux_libelle; - /** * Constructor @@ -109,7 +105,7 @@ class FormProduct * @param int $empty 1=Can be empty, 0 if not * @param int $disabled 1=Select is disabled * @param int $fk_product Add quantity of stock in label for product with id fk_product. Nothing if 0. - * @param string $empty_label Empty label if needed (only if $empty=1) + * @param string $empty_label Empty label if needed (only if $empty=1) * @return string HTML select */ function selectWarehouses($selected='',$htmlname='idwarehouse',$filtertype='',$empty=0,$disabled=0,$fk_product=0,$empty_label='') @@ -120,7 +116,7 @@ class FormProduct $this->loadWarehouses($fk_product); $nbofwarehouses=count($this->cache_warehouses); - + $out=''; diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index f63c36ffc9e..a56de8ec84b 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -609,7 +609,7 @@ $langs->load("bills"); $langs->load("orders"); $langs->load("proposals"); $langs->load("margins"); -print_fiche_titre($langs->trans("Profit"),''); +print_fiche_titre($langs->trans("Profit"),'','title_accountancy'); print '
    '.$langs->trans("DolibarrAdminLogin").' :'; print '
    '; print $langs->trans("ServerConnection")." : $dolibarr_main_db_host".$langs->trans("OK")."
    '; print $langs->trans("DatabaseConnection")." : ".$dolibarr_main_db_name."".$langs->trans("OK")."
    '; print $langs->trans("ServerConnection")." : $dolibarr_main_db_host".$langs->trans("OK")."
    '; print $langs->trans("DatabaseConnection")." : ".$dolibarr_main_db_name."".$langs->trans("OK")."
    '.$langs->trans("ErrorFailedToConnectToDatabase",$conf->db->name).''.$langs->trans('Error').'
    '.$langs->trans("Description").''; + print ''.$langs->trans("Description").''; print nl2br($object->description); print '
    '; print ''; print ''; diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index cd544b4fd83..d49520f2f19 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2014 Laurent Destailleur + * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -38,6 +38,7 @@ $action = GETPOST('action', 'alpha'); $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); $backtopage=GETPOST('backtopage','alpha'); +$cancel=GETPOST('cancel'); $mode = GETPOST('mode', 'alpha'); $mine = ($mode == 'mine' ? 1 : 0); @@ -48,7 +49,7 @@ $taskstatic = new Task($db); $extrafields_project = new ExtraFields($db); $extrafields_task = new ExtraFields($db); -include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not includ_once +include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once if ($id > 0 || ! empty($ref)) { @@ -85,7 +86,7 @@ if ($action == 'createtask' && $user->rights->projet->creer) $date_start = dol_mktime($_POST['dateohour'],$_POST['dateomin'],0,$_POST['dateomonth'],$_POST['dateoday'],$_POST['dateoyear'],'user'); $date_end = dol_mktime($_POST['dateehour'],$_POST['dateemin'],0,$_POST['dateemonth'],$_POST['dateeday'],$_POST['dateeyear'],'user'); - if (empty($_POST["cancel"])) + if (! $cancel) { if (empty($label)) { @@ -271,10 +272,11 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third print ''; print ''; print ''; - if (! empty($object->id)) print ''; if (! empty($mode)) print ''; + dol_fiche_head(''); + print '
    '.$langs->trans("Element").'
    '; $defaultref=''; @@ -342,7 +344,9 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third print '
    '; - print '

    '; + dol_fiche_end(); + + print '
    '; print ''; print '     '; print ''; diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index 0dbcc007db1..e6dd2792118 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -464,7 +464,7 @@ if ($id > 0 || ! empty($ref)) print ''; // Icon update et delete - print ''; + print ''; if ($user->rights->projet->creer) { print ' '; diff --git a/htdocs/theme/eldy/img/logout.png b/htdocs/theme/eldy/img/logout.png index 26ae717bc1a..e2e2e5d973d 100644 Binary files a/htdocs/theme/eldy/img/logout.png and b/htdocs/theme/eldy/img/logout.png differ diff --git a/htdocs/theme/eldy/img/printer.png b/htdocs/theme/eldy/img/printer.png index 3a5e7b2dfa0..6e8bcbf98a5 100644 Binary files a/htdocs/theme/eldy/img/printer.png and b/htdocs/theme/eldy/img/printer.png differ diff --git a/htdocs/theme/eldy/img/search.png b/htdocs/theme/eldy/img/search.png index 4c52b1e401e..f0d4e975775 100644 Binary files a/htdocs/theme/eldy/img/search.png and b/htdocs/theme/eldy/img/search.png differ diff --git a/htdocs/theme/eldy/img/searchclear.png b/htdocs/theme/eldy/img/searchclear.png index 203a85e10c4..12437f84823 100644 Binary files a/htdocs/theme/eldy/img/searchclear.png and b/htdocs/theme/eldy/img/searchclear.png differ diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index ff91803c96e..e7ae83cbe3e 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -119,7 +119,8 @@ if (empty($conf->global->THEME_ELDY_ENABLE_PERSONALIZED)) $conf->global->THEME_ELDY_VERMENU_BACK1='255,255,255'; // vmenu $conf->global->THEME_ELDY_VERMENU_BACK1b='230,232,232'; // vmenu (not menu) $conf->global->THEME_ELDY_VERMENU_BACK2='240,240,240'; - $conf->global->THEME_ELDY_BACKTITLE1='140,160,185'; // title of arrays + $conf->global->THEME_ELDY_BACKTITLE1='140,160,185'; // title of arrays TO MATCH ELDY + //$conf->global->THEME_ELDY_BACKTITLE1='240,240,240'; // title of arrays TO MATCH BOOTSTRAP $conf->global->THEME_ELDY_BACKTITLE2='230,230,230'; $conf->global->THEME_ELDY_BACKTABCARD1='255,255,255'; $conf->global->THEME_ELDY_BACKTABCARD2='210,210,210'; // card @@ -438,6 +439,9 @@ textarea.centpercent { { border-right: 1px solid #DDD; } +#formuserfile { + margin-top: 4px; +} #formuserfile_link { margin-left: 1px; } @@ -557,23 +561,27 @@ margin : 0px auto; +div#id-top { + height: px; + background: rgb(); + + background-image: linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(0,0,0,.3) 100%); + background-image: -o-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(0,0,0,.3) 100%); + background-image: -moz-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(0,0,0,.3) 100%); + background-image: -webkit-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(0,0,0,.3) 100%); + background-image: -ms-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(0,0,0,.3) 100%); + background-image: -webkit-gradient( linear, left top, left bottom, color-stop(0, rgba(255,255,255,.3)), color-stop(1, rgba(0,0,0,.3)) ); +} + div#tmenu_tooltip { display:none; height: px; padding-: 100px; - background: ; - box-shadow: 0 0 6px rgba(0, 0, 0, .4) !important; - background-image: linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(128,128,128,.3) 100%); - background-image: -o-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(128,128,128,.3) 100%); - background-image: -moz-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(128,128,128,.3) 100%); - background-image: -webkit-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(128,128,128,.3) 100%); - background-image: -ms-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(128,128,128,.3) 100%); - background-image: -webkit-gradient( linear, left top, left bottom, color-stop(0, rgba(255,255,255,.3)), color-stop(1, rgba(128,128,128,.3)) ); } @@ -630,7 +638,7 @@ ul.tmenu { /* t r b l */ padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px; list-style: none; - box-shadow: 0 0 6px rgba(0, 0, 0, .4) !important; + /* box-shadow: 0 0 6px rgba(0, 0, 0, .4) !important; */ } ul.tmenu li { background: rgb(); @@ -922,6 +930,9 @@ div.login_block { display: none; } +div.login_block a { + color: #fff; +} div.login_block table { display: inline; } @@ -1548,7 +1559,7 @@ span.butAction, span.butActionDelete { cursor: pointer; } -/* Preapre for bootstrap look +/* Prepare for bootstrap look .butAction, .butActionDelete, .butActionRefused { border-color: #c5c5c5; border-color: rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.25); @@ -1680,8 +1691,15 @@ table.border, table.dataTable, .table-border, .table-border-col, .table-key-bord .border tbody tr, .border tbody tr td { height: 20px; } -div.tabBar table.border tr { - height: 20px; +div.tabBar table.border tr, div.tabBar table.border tr td, div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border-col, div.tabBar div.border .table-val-border-col { + height: 24px; +} +div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border-col, div.tabBar .table-val-border-col { + vertical-align: middle; +} +div.tabBar .tdtop { + vertical-align: top; + padding-top: 6px; } table.border td, div.border div div.tagtd { @@ -1713,6 +1731,10 @@ table.noborder, table.formdoc, div.noborder { border-collapse: separate !important; border-spacing: 0px; + border-top-width: 1px; + border-top-color: #CCC; + border-top-style: solid; + border-right-width: 1px; border-right-color: #CCC; border-right-style: solid; @@ -1759,7 +1781,7 @@ table.nobordernopadding tr { } table.nobordernopadding tr td { border: 0px; - padding: 0 3px 0 0 !important; + padding: 0 3px 0 0; } table.border tr td table.nobordernopadding tr td { padding-top: 0px; @@ -1781,6 +1803,10 @@ table.liste { border-collapse: collapse; border-top-color: #FEFEFE; + border-top-width: 1px; + border-top-color: #CCC; + border-top-style: solid; + border-right-width: 1px; border-right-color: #CCC; border-right-style: solid; @@ -1810,6 +1836,85 @@ table.liste td { .tagtd, .table-border-col, .table-key-border-col, .table-val-border-col { display: table-cell; } +/* Pagination */ + +div.pagination a { + font-weight: normal; +} +div.pagination ul, div.pagination li +{ + list-style: none; + display: inline-block; + padding-left: 0px; +} + +div.pagination li { + display: inline; +} +.pagination { + display: inline-block; + padding-left: 0; + border-radius: 4px; +} + +div.pagination li a, +div.pagination li span { + position: relative; + float: left; + padding: 6px 12px; + margin-left: -1px; + line-height: 1.42857143; + color: #000; + text-decoration: none; + background-color: #fff; + border: 1px solid #ddd; +} +div.pagination li:first-child a, +div.pagination li:first-child span { + margin-left: 0; + border-top-left-radius: 4px; + border-bottom-left-radius: 4px; +} +div.pagination li:last-child a, +div.pagination li:last-child span { + border-top-right-radius: 4px; + border-bottom-right-radius: 4px; +} +div.pagination li a:hover, +div.pagination li span:hover, +div.pagination li a:focus, +div.pagination li span:focus { + color: #000; + background-color: #eee; + border-color: #ddd; +} +div.pagination li .active a, +div.pagination li .active span, +div.pagination li .active a:hover, +div.pagination li .active span:hover, +div.pagination li .active a:focus, +div.pagination li .active span:focus { + z-index: 2; + color: #fff; + cursor: default; + background-color: ; + border-color: #337ab7; +} +div.pagination .disabled span, +div.pagination .disabled span:hover, +div.pagination .disabled span:focus, +div.pagination .disabled a, +div.pagination .disabled a:hover, +div.pagination .disabled a:focus { + color: #777; + cursor: not-allowed; + background-color: #fff; + border-color: #ddd; +} +div.pagination li .active { + text-decoration: underline; +} + /* Prepare to remove class pair - impair .noborder > tbody > tr:nth-child(even) td { background: linear-gradient(bottom, rgb() 85%, rgb() 100%); @@ -1856,7 +1961,9 @@ table.liste td { background: #ffffff; } - +#GanttChartDIV { + background: #ffffff; +} .even, .pair, .nohover .even:hover, .nohover .pair:hover, tr.even td.nohover, tr.pair td.nohover { font-family: ; @@ -1887,6 +1994,22 @@ div.liste_titre .tagtd { } div.liste_titre { min-height: 26px !important; /* We cant use height because it's a div and it should be higher if content is more. but min-height doe not work either for div */ + + padding-left: 3px; + padding-top: 2px; + padding-bottom: 2px; + + border-right-width: 1px; + border-right-color: #CCC; + border-right-style: solid; + + border-left-width: 1px; + border-left-color: #CCC; + border-left-style: solid; + + border-top-width: 1px; + border-top-color: #CCC; + border-top-style: solid; } tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.liste_titre_sel, table.dataTable.tr { @@ -1894,15 +2017,19 @@ tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.liste_titre_sel, tabl } div.liste_titre, tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.liste_titre_sel, table.dataTable thead tr { - background: rgb(); - background-repeat: repeat-x; + /* TO MATCH BOOTSTRAP */ + /*background: #ddd; + color: #000 !important;*/ + /* TO MATCH ELDY */ + background: rgb(); background-image: -o-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%); background-image: -moz-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%); background-image: -webkit-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%); background-image: -ms-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%); background-image: linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%); - font-weight: bold; + + font-weight: bold; color: #; font-family: ; @@ -1917,7 +2044,7 @@ tr.liste_titre th, th.liste_titre, tr.liste_titre td, td.liste_titre, form.liste { font-family: ; font-weight: bold; - text-shadow: 1px 0px 1px #; + /* text-shadow: 1px 0px 1px #; */ vertical-align: middle; } tr.liste_titre th a, th.liste_titre a, tr.liste_titre td a, td.liste_titre a, form.liste_titre div a, div.liste_titre a { @@ -1927,16 +2054,13 @@ tr.liste_titre th a, th.liste_titre a, tr.liste_titre td a, td.liste_titre a, fo text-shadow: none !important; color: #; } -div.liste_titre { - padding-left: 3px; -} tr.liste_titre_sel th, th.liste_titre_sel, tr.liste_titre_sel td, td.liste_titre_sel, form.liste_titre_sel div { font-family: ; font-weight: normal; border-bottom: 1px solid #FDFFFF; text-decoration: underline; - text-shadow: 1px 0px 1px #; + /* text-shadow: 1px 0px 1px #; */ } input.liste_titre { background: transparent; @@ -2014,18 +2138,21 @@ div.tabBar .noborder { tr.box_titre { height: 26px; - background: rgb(); - background-repeat: repeat-x; - background-image: linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(0,0,0,.3) 100%); - background-image: -o-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(0,0,0,.3) 100%); - background-image: -moz-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(0,0,0,.3) 100%); - background-image: -webkit-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(0,0,0,.3) 100%); - background-image: -ms-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(0,0,0,.3) 100%); - background-image: -webkit-gradient( linear, left top, left bottom, color-stop(0, rgba(255,255,255,.3)), color-stop(1, rgba(0,0,0,.3)) ); + /* TO MATCH BOOTSTRAP */ + /*background: #ddd; + color: #000 !important;*/ - color: #; - text-shadow: 1px 0px 1px #; + /* TO MATCH ELDY */ + background: rgb(); + background-image: -o-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%); + background-image: -moz-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%); + background-image: -webkit-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%); + background-image: -ms-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%); + background-image: linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%); + + color: #; + // text-shadow: 1px 0px 1px #; font-family: , sans-serif; font-weight: bold; border-bottom: 1px solid #FDFFFF; @@ -2269,24 +2396,25 @@ table.valid { /* ============================================================================== */ #tooltip { -position: absolute; -width: px; -border-top: solid 1px #BBBBBB; -border-: solid 1px #BBBBBB; -border-: solid 1px #444444; -border-bottom: solid 1px #444444; -padding: 2px; -z-index: 3000; -background-color: #EFCFAA; -opacity: 1; --moz-border-radius:6px; --webkit-border-radius: 6px; -border-radius: 6px; + position: absolute; + width: px; + border-top: solid 1px #BBBBBB; + border-: solid 1px #BBBBBB; + border-: solid 1px #444444; + border-bottom: solid 1px #444444; + padding: 2px; + z-index: 3000; + background-color: #FFF; + opacity: 1; + -moz-border-radius:6px; + -webkit-border-radius: 6px; + border-radius: 6px; } #tiptip_content { - background-color: rgb(252,248,246); - background-color: rgba(252,248,246,0.95); + background-color: rgb(255,255,255); + background-color: rgba(255,255,255,0.95); line-height: 1.4em; + min-width: 200px; } /* ============================================================================== */ diff --git a/htdocs/theme/md_exp/style.css.php b/htdocs/theme/md_exp/style.css.php index ee46a7f1aaa..a0b62419971 100644 --- a/htdocs/theme/md_exp/style.css.php +++ b/htdocs/theme/md_exp/style.css.php @@ -4,6 +4,7 @@ * Copyright (C) 2007-2012 Regis Houssin * Copyright (C) 2011 Philippe Grand * Copyright (C) 2012 Juanjo Menent + * Copyright (C) 2015 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,8 +21,8 @@ */ /** - * \file htdocs/theme/eldy/style.css.php - * \brief File for CSS style sheet Eldy + * \file htdocs/theme/md_exp/style.css.php + * \brief File for CSS style sheet Md (Material Design) */ //if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled because need to load personalized language @@ -272,7 +273,7 @@ select.flat, form.flat select { font-weight: normal; } input:disabled { - background:#ddd; + background:#f4f4f4; } input.liste_titre { @@ -283,7 +284,7 @@ input.removedfile { border: 0px !important; } textarea:disabled { - background:#ddd; + background:#f4f4f4; } input[type=checkbox] { background-color: transparent; border: none; box-shadow: none; } input[type=radio] { background-color: transparent; border: none; box-shadow: none; } @@ -302,7 +303,7 @@ input:-moz-placeholder { color:#ccc; } legend { margin-bottom: 8px; } -fieldset { border: 1px solid #AAAAAA !important; box-shadow: 2px 2px 3px #DDD; } +fieldset { border: 1px solid #AAAAAA !important; box-shadow: 2px 2px 3px #f4f4f4; } .button, sbmtConnexion { @@ -440,7 +441,7 @@ textarea.centpercent { .borderrightlight { - border-right: 1px solid #DDD; + border-right: 1px solid #f4f4f4; } #formuserfile_link { margin-left: 1px; @@ -958,7 +959,7 @@ table.login_table_securitycode tr td { min-width: 60px; } #img_securitycode { - border: 1px solid #DDDDDD; + border: 1px solid #f4f4f4; } #img_logo { max-width: 200px; @@ -1084,7 +1085,7 @@ div.blockvmenupair, div.blockvmenuimpair, div.blockvmenubookmarks margin: 1px 0px 8px 0px; padding-bottom: 10px; - border-bottom: 1px solid #DDD; + border-bottom: 1px solid #f4f4f4; } div.blockvmenusearch @@ -1100,7 +1101,7 @@ div.blockvmenusearch margin: 1px 0px 8px 0px; padding-bottom: 10px; - border-bottom: 1px solid #DDD; + border-bottom: 1px solid #f4f4f4; } div.blockvmenuhelp @@ -1180,9 +1181,9 @@ td.photo { -moz-border-radius: 2px 2px 2px 2px !important; -webkit-border-radius: 2px 2px 2px 2px !important; border-radius: 2px 2px 2px 2px !important; - -moz-box-shadow: 2px 2px 4px #DDD; - -webkit-box-shadow: 2px 2px 4px #DDD; - box-shadow: 2px 2px 4px #DDD; + -moz-box-shadow: 2px 2px 4px #f4f4f4; + -webkit-box-shadow: 2px 2px 4px #f4f4f4; + box-shadow: 2px 2px 4px #f4f4f4; padding: 0 4px 0 4px !important; min-height: 32px; @@ -1245,7 +1246,7 @@ img.toolbarbutton { otherwise color shifts while dragging when bar can't keep up with mouse */ /*.ui-layout-resizer-open-hover ,*/ /* hover-color to 'resize' */ .ui-layout-resizer-dragging { /* resizer beging 'dragging' */ - background: #DDD; + background: #f4f4f4; width: dol_optimize_smallscreen)?'8':'24'); ?>px; } .ui-layout-resizer-dragging { /* CLONED resizer being dragged */ @@ -1257,7 +1258,7 @@ img.toolbarbutton { background: #E1A4A4; /* red */ } .ui-layout-resizer-closed { - background-color: #DDDDDD; + background-color: #f4f4f4; } .ui-layout-resizer-closed:hover { background-color: #EEDDDD; @@ -1286,7 +1287,7 @@ img.toolbarbutton { border-top: 1px solid #AAA; /* match pane-border */ border-right: 1px solid #AAA; /* match pane-border */ border-bottom: 1px solid #AAA; /* match pane-border */ - background-color: #DDD; + background-color: #f4f4f4; top: 5px !important; diplay: none; @@ -1426,9 +1427,9 @@ div.tabBar { background: rgb(); - -moz-box-shadow: 3px 3px 4px #DDD; - -webkit-box-shadow: 3px 3px 4px #DDD; - box-shadow: 3px 3px 4px #DDD; + -moz-box-shadow: 3px 3px 4px #f4f4f4; + -webkit-box-shadow: 3px 3px 4px #f4f4f4; + box-shadow: 3px 3px 4px #f4f4f4; } @@ -1471,7 +1472,7 @@ a.tab:link, a.tab:visited, a.tab:hover, a.tab#active { border-bottom: none; border-right: 1px solid #CCCCCC; - border-left: 1px solid #D0D0D0; + border-left: 1px solid #f4f4f4; border-top: 1px solid #D8D8D8; */ @@ -1480,7 +1481,7 @@ a.tab:link, a.tab:visited, a.tab:hover, a.tab#active { .tabactive, a.tab#active { border-right: 1px solid #CCCCCC; - border-left: 1px solid #D0D0D0; + border-left: 1px solid #f4f4f4; border-top: 1px solid #D8D8D8; -moz-border-radius:3px 3px 0px 0px; @@ -1555,9 +1556,9 @@ div.divButAction { margin-bottom: 1.4em; } -moz-border-radius:0px 2px 0px 2px; -webkit-border-radius:0px 2px 0px 2px; border-radius:0px 2px 0px 2px; - -moz-box-shadow: 2px 2px 3px #DDD; - -webkit-box-shadow: 2px 2px 3px #DDD; - box-shadow: 2px 2px 3px #DDD; + -moz-box-shadow: 2px 2px 3px #f4f4f4; + -webkit-box-shadow: 2px 2px 3px #f4f4f4; + box-shadow: 2px 2px 3px #f4f4f4; } .butAction:hover { @@ -1587,9 +1588,9 @@ div.divButAction { margin-bottom: 1.4em; } -moz-border-radius:0px 2px 0px 2px; -webkit-border-radius:0px 2px 0px 2px; border-radius:0px 2px 0px 2px; - -moz-box-shadow: 3px 3px 4px #DDD; - -webkit-box-shadow: 3px 3px 4px #DDD; - box-shadow: 3px 3px 4px #DDD; + -moz-box-shadow: 3px 3px 4px #f4f4f4; + -webkit-box-shadow: 3px 3px 4px #f4f4f4; + box-shadow: 3px 3px 4px #f4f4f4; } global->MAIN_BUTTON_HIDE_UNAUTHORIZED)) { ?> @@ -1602,7 +1603,7 @@ span.butAction, span.butActionDelete { cursor: pointer; } -/* Preapre for bootstrap look +/* Prepare for bootstrap look .butAction, .butActionDelete, .butActionRefused { border-color: #c5c5c5; border-color: rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.25); @@ -1726,7 +1727,7 @@ tr.nocellnopadd td.nobordernopadding, tr.nocellnopadd td.nocellnopadd table.border, table.dataTable, .table-border, .table-border-col, .table-key-border-col, .table-val-border-col, div.border { - border: 1px solid #D0D0D0; + border: 1px solid #f4f4f4; border-collapse: collapse; padding: 1px 2px 1px 3px; /* t r b l */ } @@ -1740,7 +1741,7 @@ div.tabBar table.border tr { table.border td, div.border div div.tagtd { padding: 2px 2px 2px 2px; - border: 1px solid #D0D0D0; + border: 1px solid #f4f4f4; border-collapse: collapse; } @@ -1923,7 +1924,7 @@ table.dataTable td { } tr.even td, tr.pair td, tr.odd td, tr.impair td, form.odd div.tagtd, form.impair div.tagtd, form.pair div.tagtd, div.impair div.tagtd, div.pair div.tagtd, div.liste_titre div.tagtd { padding: 5px 2px 5px 3px; - border-bottom: 1px solid #ddd; + border-bottom: 1px solid #f4f4f4; } tr.even td .nobordernopadding tr td, tr.pair td .nobordernopadding tr td, tr.impair td .nobordernopadding tr td, tr.odd td .nobordernopadding tr td { border-bottom: 0px !important; @@ -1946,12 +1947,14 @@ div.liste_titre, tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.list background: rgb(); background-repeat: repeat-x; + /* background-image: -o-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%); background-image: -moz-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%); background-image: -webkit-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%); background-image: -ms-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%); background-image: linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%); - font-weight: bold; + */ + font-weight: bold; color: #; font-family: ; @@ -1996,7 +1999,7 @@ input.liste_titre { background: #F0F0F0; } .noborder tr.liste_total td, tr.liste_total td, form.liste_total div { - border-top: 1px solid #DDDDDD; + border-top: 1px solid #f4f4f4; color: #332266; font-weight: normal; white-space: nowrap; @@ -2018,15 +2021,15 @@ input.liste_titre { /* Disable shadows */ .noshadow { - -moz-box-shadow: 0px 0px 0px #DDD !important; - -webkit-box-shadow: 0px 0px 0px #DDD !important; - box-shadow: 0px 0px 0px #DDD !important; + -moz-box-shadow: 0px 0px 0px #f4f4f4 !important; + -webkit-box-shadow: 0px 0px 0px #f4f4f4 !important; + box-shadow: 0px 0px 0px #f4f4f4 !important; } div.tabBar .noborder { - -moz-box-shadow: 0px 0px 0px #DDD !important; - -webkit-box-shadow: 0px 0px 0px #DDD !important; - box-shadow: 0px 0px 0px #DDD !important; + -moz-box-shadow: 0px 0px 0px #f4f4f4 !important; + -webkit-box-shadow: 0px 0px 0px #f4f4f4 !important; + box-shadow: 0px 0px 0px #f4f4f4 !important; } @@ -2038,9 +2041,9 @@ div.tabBar .noborder { margin: 3px; padding: 3px; - /*-moz-box-shadow: 3px 3px 4px #DDD; - -webkit-box-shadow: 3px 3px 4px #DDD; - box-shadow: 3px 3px 4px #DDD; + /*-moz-box-shadow: 3px 3px 4px #f4f4f4; + -webkit-box-shadow: 3px 3px 4px #f4f4f4; + box-shadow: 3px 3px 4px #f4f4f4; margin-bottom: 8px !important;*/ border: 1px solid #AAA; text-align: center; @@ -2048,9 +2051,9 @@ div.tabBar .noborder { } .boxtable { - -moz-box-shadow: 3px 3px 4px #DDD; - -webkit-box-shadow: 3px 3px 4px #DDD; - box-shadow: 3px 3px 4px #DDD; + -moz-box-shadow: 3px 3px 4px #f4f4f4; + -webkit-box-shadow: 3px 3px 4px #f4f4f4; + box-shadow: 3px 3px 4px #f4f4f4; margin-bottom: 8px !important; } @@ -2100,7 +2103,7 @@ tr.box_pair { tr.box_pair td, tr.box_impair td { padding: 4px; - border-bottom: 1px solid #ddd; + border-bottom: 1px solid #f4f4f4; } .formboxfilter { @@ -2356,8 +2359,8 @@ img.datecallink { padding-left: 2px !important; padding-right: 2px !important; } table.dp { width: 180px; background-color: #FFFFFF; - border-top: solid 2px #DDDDDD; - border-: solid 2px #DDDDDD; + border-top: solid 2px #f4f4f4; + border-: solid 2px #f4f4f4; border-: solid 1px #222222; border-bottom: solid 1px #222222; padding: 0px; @@ -2389,14 +2392,14 @@ table.dp { .dpToday,.dpReg,.dpSelected{ cursor:pointer; } -.dpToday{font-weight:bold; color:black; background-color:#DDDDDD;} +.dpToday{font-weight:bold; color:black; background-color:#f4f4f4;} .dpReg:Hover,.dpToday:Hover{background-color:black;color:white} /* Jour courant */ .dpSelected{background-color:#0B63A2;color:white;font-weight:bold; } -.tpHour{border-top:1px solid #DDDDDD; border-right:1px solid #DDDDDD;} -.tpHour td {border-left:1px solid #DDDDDD; border-bottom:1px solid #DDDDDD; cursor:pointer;} +.tpHour{border-top:1px solid #f4f4f4; border-right:1px solid #f4f4f4;} +.tpHour td {border-left:1px solid #f4f4f4; border-bottom:1px solid #f4f4f4; cursor:pointer;} .tpHour td:Hover {background-color:black;color:white;} .tpMinute {margin-top:5px;} @@ -2729,9 +2732,9 @@ a.cke_dialog_ui_button -moz-border-radius:0px 2px 0px 2px !important; -webkit-border-radius:0px 2px 0px 2px !important; border-radius:0px 2px 0px 2px !important; - -moz-box-shadow: 3px 3px 4px #DDD !important; - -webkit-box-shadow: 3px 3px 4px #DDD !important; - box-shadow: 3px 3px 4px #DDD !important; + -moz-box-shadow: 3px 3px 4px #f4f4f4 !important; + -webkit-box-shadow: 3px 3px 4px #f4f4f4 !important; + box-shadow: 3px 3px 4px #f4f4f4 !important; } .cke_dialog_ui_hbox_last { @@ -2837,7 +2840,7 @@ ul.filedirelem li { text-align: center; display: block; float: ; - border: solid 1px #DDDDDD; + border: solid 1px #f4f4f4; } ui-layout-north { @@ -3190,12 +3193,12 @@ border-top-right-radius: 6px; text-shadow: 1px 0px 1px #; } .lilevel1 { - background-image: -webkit-gradient(linear,left top,left bottom,from( #ddd ),to( #d1d1d1 )) !important; - background-image: -webkit-linear-gradient( #ddd,#d1d1d1 ) !important; - background-image: -moz-linear-gradient( #ddd,#d1d1d1 ) !important; - background-image: -ms-linear-gradient( #ddd,#d1d1d1 ) !important; - background-image: -o-linear-gradient( #ddd,#d1d1d1 ) !important; - background-image: linear-gradient( #ddd,#d1d1d1 ) !important; + background-image: -webkit-gradient(linear,left top,left bottom,from( #f4f4f4 ),to( #d1d1d1 )) !important; + background-image: -webkit-linear-gradient( #f4f4f4,#d1d1d1 ) !important; + background-image: -moz-linear-gradient( #f4f4f4,#d1d1d1 ) !important; + background-image: -ms-linear-gradient( #f4f4f4,#d1d1d1 ) !important; + background-image: -o-linear-gradient( #f4f4f4,#d1d1d1 ) !important; + background-image: linear-gradient( #f4f4f4,#d1d1d1 ) !important; } .lilevel2 { diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 0320f44916e..332684a3238 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -75,7 +75,7 @@ if ($user->societe_id > 0) $socid = $user->societe_id; $feature2='user'; if ($user->id == $id) { $feature2=''; $canreaduser=1; } // A user can always read its own card if (!$canreaduser) { - $result = restrictedArea($user, 'user', $id, '&user', $feature2); + $result = restrictedArea($user, 'user', $id, 'user&user', $feature2); } if ($user->id <> $id && ! $canreaduser) accessforbidden(); @@ -723,7 +723,7 @@ if (($action == 'create') || ($action == 'adduserldap')) print ''; // Lastname - print ''.$langs->trans("Lastname").''; + print ''.$langs->trans("Lastname").''; print ''; if (! empty($ldap_lastname)) { @@ -737,7 +737,7 @@ if (($action == 'create') || ($action == 'adduserldap')) print ''; // Firstname - print ''.$langs->trans("Firstname").''; + print ''.$langs->trans("Firstname").''; print ''; if (! empty($ldap_firstname)) { @@ -751,13 +751,13 @@ if (($action == 'create') || ($action == 'adduserldap')) print ''; // Position/Job - print ''.$langs->trans("PostOrFunction").''; + print ''.$langs->trans("PostOrFunction").''; print ''; print ''; print ''; // Login - print ''.$langs->trans("Login").''; + print ''.$langs->trans("Login").''; print ''; if (! empty($ldap_login)) { @@ -784,7 +784,7 @@ if (($action == 'create') || ($action == 'adduserldap')) $password=$generated_password; // Password - print ''.$langs->trans("Password").''; + print ''.$langs->trans("Password").''; print ''; if (! empty($ldap_sid)) { @@ -808,7 +808,7 @@ if (($action == 'create') || ($action == 'adduserldap')) // Administrator if (! empty($user->admin)) { - print ''.$langs->trans("Administrator").''; + print ''.$langs->trans("Administrator").''; print ''; print $form->selectyesno('admin',GETPOST('admin'),1); @@ -821,22 +821,22 @@ if (($action == 'create') || ($action == 'adduserldap')) $("select[name=admin]").change(function() { if ( $(this).val() == 0 ) { $("input[name=superadmin]") - .attr("disabled", true) - .attr("checked", false); + .prop("disabled", true) + .prop("checked", false); $("select[name=entity]") - .attr("disabled", false); + .prop("disabled", false); } else { $("input[name=superadmin]") - .attr("disabled", false); + .prop("disabled", false); } }); $("input[name=superadmin]").change(function() { - if ( $(this).attr("checked") == "checked" ) { + if ( $(this).is(":checked") ) { $("select[name=entity]") - .attr("disabled", true); + .prop("disabled", true); } else { $("select[name=entity]") - .attr("disabled", false); + .prop("disabled", false); } }); }); @@ -850,13 +850,13 @@ if (($action == 'create') || ($action == 'adduserldap')) } // Type - print ''.$langs->trans("Type").''; + print ''.$langs->trans("Type").''; print ''; print $form->textwithpicto($langs->trans("Internal"),$langs->trans("InternalExternalDesc")); print ''; // Tel - print ''.$langs->trans("PhonePro").''; + print ''.$langs->trans("PhonePro").''; print ''; if (! empty($ldap_phone)) { @@ -870,7 +870,7 @@ if (($action == 'create') || ($action == 'adduserldap')) print ''; // Tel portable - print ''.$langs->trans("PhoneMobile").''; + print ''.$langs->trans("PhoneMobile").''; print ''; if (! empty($ldap_mobile)) { @@ -884,7 +884,7 @@ if (($action == 'create') || ($action == 'adduserldap')) print ''; // Fax - print ''.$langs->trans("Fax").''; + print ''.$langs->trans("Fax").''; print ''; if (! empty($ldap_fax)) { @@ -900,7 +900,7 @@ if (($action == 'create') || ($action == 'adduserldap')) // Skype if (! empty($conf->skype->enabled)) { - print ''.$langs->trans("Skype").''; + print ''.$langs->trans("Skype").''; print ''; if (! empty($ldap_skype)) { @@ -915,7 +915,7 @@ if (($action == 'create') || ($action == 'adduserldap')) } // EMail - print 'global->USER_MAIL_REQUIRED)?' class="fieldrequired"':'').'>'.$langs->trans("EMail").''; + print 'global->USER_MAIL_REQUIRED)?' class="fieldrequired"':'').'>'.$langs->trans("EMail").''; print ''; if (! empty($ldap_mail)) { @@ -929,7 +929,7 @@ if (($action == 'create') || ($action == 'adduserldap')) print ''; // Signature - print ''.$langs->trans("Signature").''; + print ''.$langs->trans("Signature").''; print ''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor=new DolEditor('signature',GETPOST('signature'),'',138,'dolibarr_mailings','In',true,true,empty($conf->global->FCKEDITOR_ENABLE_USERSIGN)?0:1,ROWS_4,90); @@ -941,7 +941,7 @@ if (($action == 'create') || ($action == 'adduserldap')) { if (empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity && is_object($mc)) { - print "".''.$langs->trans("Entity").''; + print "".''.$langs->trans("Entity").''; print "".$mc->select_entities($conf->entity); print "\n"; } @@ -952,7 +952,7 @@ if (($action == 'create') || ($action == 'adduserldap')) } // Hierarchy - print ''.$langs->trans("HierarchicalResponsible").''; + print ''.$langs->trans("HierarchicalResponsible").''; print ''; print $form->select_dolusers($object->fk_user,'fk_user',1,array($object->id),0,'',0,$conf->entity); print ''; @@ -963,21 +963,21 @@ if (($action == 'create') || ($action == 'adduserldap')) $langs->load("salaries"); // THM - print ''.$langs->trans("THM").''; + print ''.$langs->trans("THM").''; print ''; print ''; print ''; print "\n"; // TJM - print ''.$langs->trans("TJM").''; + print ''.$langs->trans("TJM").''; print ''; print ''; print ''; print "\n"; // Salary - print ''.$langs->trans("Salary").''; + print ''.$langs->trans("Salary").''; print ''; print ''; print ''; @@ -985,7 +985,7 @@ if (($action == 'create') || ($action == 'adduserldap')) } // Weeklyhours - print ''.$langs->trans("WeeklyHours").''; + print ''.$langs->trans("WeeklyHours").''; print ''; print ''; print ''; @@ -994,7 +994,7 @@ if (($action == 'create') || ($action == 'adduserldap')) // Accountancy code if ($conf->salaries->enabled) { - print ''.$langs->trans("AccountancyCode").''; + print ''.$langs->trans("AccountancyCode").''; print ''; print ''; print ''; @@ -1003,14 +1003,14 @@ if (($action == 'create') || ($action == 'adduserldap')) // User color if (! empty($conf->agenda->enabled)) { - print ''.$langs->trans("ColorUser").''; + print ''.$langs->trans("ColorUser").''; print ''; print $formother->selectColor(GETPOST('color')?GETPOST('color'):$object->color, 'color', 'usercolorconfig', 1, '', 'hideifnotset'); print ''; } // Note - print ''; + print ''; print $langs->trans("Note"); print ''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; @@ -1149,7 +1149,7 @@ else print ''; // Ref - print ''; + print ''; print ''; @@ -1163,7 +1163,7 @@ else if (! empty($conf->agenda->enabled)) $rowspan++; // Lastname - print ''; + print ''; print ''; // Photo @@ -1174,17 +1174,17 @@ else print ''."\n"; // Firstname - print ''; + print ''; print ''; print ''."\n"; // Position/Job - print ''; + print ''; print ''; print ''."\n"; // Login - print ''; + print ''; if (! empty($object->ldap_sid) && $object->statut==0) { print ''; @@ -1196,7 +1196,7 @@ else print ''."\n"; // Password - print ''; + print ''; if (! empty($object->ldap_sid)) { if ($passDoNotExpire) @@ -1230,7 +1230,7 @@ else print ''."\n"; // Administrator - print ''."\n"; // Type - print ''."\n"; } // Tel pro - print ''; + print ''; print ''; print ''."\n"; // Tel mobile - print ''; + print ''; print ''; print ''."\n"; // Fax - print ''; + print ''; print ''; print ''."\n"; // Skype if (! empty($conf->skype->enabled)) { - print ''; + print ''; print ''; print "\n"; } // EMail - print ''; + print ''; print ''; print "\n"; // Signature - print '\n"; // Hierarchy - print ''; + print ''; print ''; + print ''; print ''; print "\n"; // TJM - print ''; + print ''; print ''; print "\n"; // Salary - print ''; + print ''; print ''; @@ -1333,7 +1333,7 @@ else } // Weeklyhours - print ''; + print ''; print ''; @@ -1342,14 +1342,14 @@ else // Accountancy code if ($conf->salaries->enabled) { - print ''; + print ''; print ''; } // Color user if (! empty($conf->agenda->enabled)) { - print ''; + print ''; print ''; @@ -1357,23 +1357,23 @@ else } // Status - print ''; + print ''; print ''; print ''."\n"; - print ''; + print ''; print ''; print "\n"; - print ''; + print ''; print ''; print "\n"; if (isset($conf->file->main_authentication) && preg_match('/openid/',$conf->file->main_authentication) && ! empty($conf->global->MAIN_OPENIDURL_PERUSER)) { - print ''; + print ''; print ''; print "\n"; } @@ -1381,7 +1381,7 @@ else // Company / Contact if (! empty($conf->societe->enabled)) { - print ''; + print ''; print ''; + print ''; print ''; + print ''; print "
    '.$langs->trans("Ref").'
    '.$langs->trans("Ref").''; print $form->showrefnav($object,'id','',$user->rights->user->user->lire || $user->admin); print '
    '.$langs->trans("Lastname").'
    '.$langs->trans("Lastname").''.$object->lastname.'
    '.$langs->trans("Firstname").'
    '.$langs->trans("Firstname").''.$object->firstname.'
    '.$langs->trans("PostOrFunction").'
    '.$langs->trans("PostOrFunction").''.$object->job.'
    '.$langs->trans("Login").'
    '.$langs->trans("Login").''.$langs->trans("LoginAccountDisableInDolibarr").'
    '.$langs->trans("Password").'
    '.$langs->trans("Password").'
    '.$langs->trans("Administrator").''; + print '
    '.$langs->trans("Administrator").''; if (! empty($conf->multicompany->enabled) && $object->admin && ! $object->entity) { print $form->textwithpicto(yn($object->admin),$langs->trans("SuperAdministratorDesc"),1,"superadmin"); @@ -1246,7 +1246,7 @@ else print '
    '.$langs->trans("Type").''; + print '
    '.$langs->trans("Type").''; $type=$langs->trans("Internal"); if ($object->societe_id) $type=$langs->trans("External"); print $form->textwithpicto($type,$langs->trans("InternalExternalDesc")); @@ -1256,46 +1256,46 @@ else // Ldap sid if ($object->ldap_sid) { - print '
    '.$langs->trans("Type").''; + print '
    '.$langs->trans("Type").''; print $langs->trans("DomainUser",$ldap->domainFQDN); print '
    '.$langs->trans("PhonePro").'
    '.$langs->trans("PhonePro").''.dol_print_phone($object->office_phone,'',0,0,1).'
    '.$langs->trans("PhoneMobile").'
    '.$langs->trans("PhoneMobile").''.dol_print_phone($object->user_mobile,'',0,0,1).'
    '.$langs->trans("Fax").'
    '.$langs->trans("Fax").''.dol_print_phone($object->office_fax,'',0,0,1).'
    '.$langs->trans("Skype").'
    '.$langs->trans("Skype").''.dol_print_skype($object->skype,0,0,1).'
    '.$langs->trans("EMail").'
    '.$langs->trans("EMail").''.dol_print_email($object->email,0,0,1).'
    '.$langs->trans('Signature').''; + print '
    '.$langs->trans('Signature').''; print dol_htmlentitiesbr($object->signature); print "
    '.$langs->trans("HierarchicalResponsible").'
    '.$langs->trans("HierarchicalResponsible").''; if (empty($object->fk_user)) print $langs->trans("None"); else { @@ -1311,21 +1311,21 @@ else $langs->load("salaries"); // THM - print '
    '.$langs->trans("THM").'
    '.$langs->trans("THM").''; print ($object->thm!=''?price($object->thm,'',$langs,1,-1,-1,$conf->currency):''); print '
    '.$langs->trans("TJM").'
    '.$langs->trans("TJM").''; print ($object->tjm!=''?price($object->tjm,'',$langs,1,-1,-1,$conf->currency):''); print '
    '.$langs->trans("Salary").'
    '.$langs->trans("Salary").''; print ($object->salary!=''?price($object->salary,'',$langs,1,-1,-1,$conf->currency):''); print '
    '.$langs->trans("WeeklyHours").'
    '.$langs->trans("WeeklyHours").''; print price2num($object->weeklyhours); print '
    '.$langs->trans("AccountancyCode").'
    '.$langs->trans("AccountancyCode").''.$object->accountancy_code.'
    '.$langs->trans("ColorUser").'
    '.$langs->trans("ColorUser").''; if ($object->color) print ''; print '
    '.$langs->trans("Status").'
    '.$langs->trans("Status").''; print $object->getLibStatut(4); print '
    '.$langs->trans("LastConnexion").'
    '.$langs->trans("LastConnexion").''.dol_print_date($object->datelastlogin,"dayhour").'
    '.$langs->trans("PreviousConnexion").'
    '.$langs->trans("PreviousConnexion").''.dol_print_date($object->datepreviouslogin,"dayhour").'
    '.$langs->trans("OpenIDURL").'
    '.$langs->trans("OpenIDURL").''.$object->openid.'
    '.$langs->trans("LinkToCompanyContact").'
    '.$langs->trans("LinkToCompanyContact").''; if (isset($object->societe_id) && $object->societe_id > 0) { @@ -1409,7 +1409,7 @@ else if (! empty($conf->adherent->enabled)) { $langs->load("members"); - print '
    '.$langs->trans("LinkedToDolibarrMember").'
    '.$langs->trans("LinkedToDolibarrMember").''; if ($object->fk_member) { @@ -1432,7 +1432,7 @@ else { if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity) { - print '
    '.$langs->trans("Entity").''; + print '
    '.$langs->trans("Entity").''; if (empty($object->entity)) { print $langs->trans("AllEntities"); @@ -1578,7 +1578,7 @@ else { if ($conf->entity == 1 && $conf->multicompany->transverse_mode) { - print ''.$langs->trans("Entity").''.$langs->trans("Entity").'".$mc->select_entities($conf->entity); } else @@ -1691,7 +1691,7 @@ else print ''; - print ''; + print ''; print ''; @@ -1699,7 +1699,7 @@ else // Lastname print ""; - print ''; + print ''; print ''; // Firstname - print "".''; + print "".''; print ''; // Position/Job - print ''; + print ''; print ''; // Login - print "".''; + print "".''; print ''; // Pass - print ''; + print ''; print '\n"; // Administrator - print ''; + print ''; if ($object->societe_id > 0) { $langs->load("admin"); @@ -1822,32 +1822,32 @@ else var admin = $("select[name=admin]").val(); if (admin == 0) { $("input[name=superadmin]") - .attr("disabled", true) - .attr("checked", false); + .prop("disabled", true) + .prop("checked", false); } - if ($("input[name=superadmin]").attr("checked") == "checked") { + if ($("input[name=superadmin]").is(":checked")) { $("select[name=entity]") - .attr("disabled", true); + .prop("disabled", true); } $("select[name=admin]").change(function() { if ( $(this).val() == 0 ) { $("input[name=superadmin]") - .attr("disabled", true) - .attr("checked", false); + .prop("disabled", true) + .prop("checked", false); $("select[name=entity]") - .attr("disabled", false); + .prop("disabled", false); } else { $("input[name=superadmin]") - .attr("disabled", false); + .prop("disabled", false); } }); $("input[name=superadmin]").change(function() { - if ( $(this).attr("checked") == "checked" ) { + if ( $(this).is(":checked")) { $("select[name=entity]") - .attr("disabled", true); + .prop("disabled", true); } else { $("select[name=entity]") - .attr("disabled", false); + .prop("disabled", false); } }); }); @@ -1870,7 +1870,7 @@ else } // Type - print ''; + print ''; print ''; // Tel pro - print "".''; + print "".''; print ''; // Tel mobile - print "".''; + print "".''; print ''; // Fax - print "".''; + print "".''; print ''; + print ''; print '".''; + print "".'global->USER_MAIL_REQUIRED)?' class="fieldrequired"':'').'>'.$langs->trans("EMail").''; print ''; // Signature - print "".''; + print "".''; print '".''; + print "".''; print ''; + print ''; print ''; + print ''; print ''; print "\n"; // TJM - print ''; + print ''; print ''; print "\n"; // Salary - print ''; + print ''; print ''; @@ -2037,7 +2037,7 @@ else } // Weeklyhours - print ''; + print ''; print ''; @@ -2047,7 +2047,7 @@ else if ($conf->salaries->enabled) { print ""; - print ''; + print ''; print ''; + print ''; print ''; } // Status - print ''; + print ''; print ''; @@ -2080,7 +2080,7 @@ else // Company / Contact if (! empty($conf->societe->enabled)) { - print ''; + print ''; print ''; + print ''; print '".''; + print "".''; print "\n"; } diff --git a/htdocs/user/clicktodial.php b/htdocs/user/clicktodial.php index 93d6587ef1e..7aaaebbac3e 100644 --- a/htdocs/user/clicktodial.php +++ b/htdocs/user/clicktodial.php @@ -39,7 +39,7 @@ if ($user->id == $id) // A user can always read its own card { $feature2=''; } -$result = restrictedArea($user, 'user', $id, '&user', $feature2); +$result = restrictedArea($user, 'user', $id, 'user&user', $feature2); /* diff --git a/htdocs/user/document.php b/htdocs/user/document.php index 2659b9427c8..fc09667f6ed 100644 --- a/htdocs/user/document.php +++ b/htdocs/user/document.php @@ -68,7 +68,7 @@ if ($user->societe_id > 0) $socid = $user->societe_id; $feature2='user'; if ($user->id == $id) { $feature2=''; $canreaduser=1; } // A user can always read its own card if (!$canreaduser) { - $result = restrictedArea($user, 'user', $id, '&user', $feature2); + $result = restrictedArea($user, 'user', $id, 'user&user', $feature2); } if ($user->id <> $id && ! $canreaduser) accessforbidden(); diff --git a/htdocs/user/hierarchy.php b/htdocs/user/hierarchy.php index b2090501789..a1118242a66 100644 --- a/htdocs/user/hierarchy.php +++ b/htdocs/user/hierarchy.php @@ -1,7 +1,7 @@ * Copyright (C) 2005 Eric Seigne - * Copyright (C) 2006-2011 Laurent Destailleur + * Copyright (C) 2006-2015 Laurent Destailleur * Copyright (C) 2007 Patrick Raguin * Copyright (C) 2005-2012 Regis Houssin * @@ -116,7 +116,7 @@ $nbofentries=(count($data) - 1); if ($nbofentries > 0) { - print ''; } diff --git a/htdocs/user/index.php b/htdocs/user/index.php index 97c93316330..97b6feac508 100644 --- a/htdocs/user/index.php +++ b/htdocs/user/index.php @@ -45,6 +45,7 @@ $search_login=GETPOST('search_login','alpha'); $search_lastname=GETPOST('search_lastname','alpha'); $search_firstname=GETPOST('search_firstname','alpha'); $search_statut=GETPOST('search_statut','alpha'); +$search_thirdparty=GETPOST('search_thirdparty','alpha'); $sortfield = GETPOST('sortfield','alpha'); $sortorder = GETPOST('sortorder','alpha'); @@ -90,19 +91,14 @@ else { $sql.= " WHERE u.entity IN (".getEntity('user',1).")"; } -if (! empty($socid)) $sql.= " AND u.fk_soc = ".$socid; -if (! empty($search_user)) -{ - $sql.= " AND (u.login LIKE '%".$db->escape($search_user)."%' OR u.lastname LIKE '%".$db->escape($search_user)."%' OR u.firstname LIKE '%".$db->escape($search_user)."%')"; -} +if ($socid > 0) $sql.= " AND u.fk_soc = ".$socid; +if ($search_user != '') $sql.=natural_search(array('u.login', 'u.lastname', 'u.firstname'), $search_user); +if ($search_thirdparty != '') $sql.=natural_search(array('s.nom'), $search_thirdparty); if ($search_login != '') $sql.= natural_search("u.login", $search_login); if ($search_lastname != '') $sql.= natural_search("u.lastname", $search_lastname); if ($search_firstname != '') $sql.= natural_search("u.firstname", $search_firstname); -if ($search_statut != '' && $search_statut >= 0) -{ - $sql.= " AND (u.statut=".$search_statut.")"; -} -if ($sall) $sql.= " AND (u.login LIKE '%".$db->escape($sall)."%' OR u.lastname LIKE '%".$db->escape($sall)."%' OR u.firstname LIKE '%".$db->escape($sall)."%' OR u.email LIKE '%".$db->escape($sall)."%' OR u.note LIKE '%".$db->escape($sall)."%')"; +if ($search_statut != '' && $search_statut >= 0) $sql.= " AND (u.statut=".$search_statut.")"; +if ($sall) $sql.= natural_search(array('u.login', 'u.lastname', 'u.firstname', 'u.email', 'u.note'), $sall); $sql.=$db->order($sortfield,$sortorder); $result = $db->query($sql); @@ -133,13 +129,14 @@ if ($result) print_liste_field_titre(''); print "\n"; - // SearchBar - $colspan=4; + // Search bar + $colspan=3; if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode)) $colspan++; print ''; print ''; print ''; print ''; + print ''; print ''; // Status diff --git a/htdocs/user/info.php b/htdocs/user/info.php index fd74a0ca95d..454ac080cbc 100644 --- a/htdocs/user/info.php +++ b/htdocs/user/info.php @@ -42,7 +42,7 @@ if ($user->id == $id) // A user can always read its own card { $feature2=''; } -$result = restrictedArea($user, 'user', $id, '&user', $feature2); +$result = restrictedArea($user, 'user', $id, 'user&user', $feature2); // If user is not user read and no permission to read other users, we stop if (($fuser->id != $user->id) && (! $user->rights->user->user->lire)) diff --git a/htdocs/user/ldap.php b/htdocs/user/ldap.php index 87a0dec31e2..6ef0b4db688 100644 --- a/htdocs/user/ldap.php +++ b/htdocs/user/ldap.php @@ -39,7 +39,7 @@ $socid=0; if ($user->societe_id > 0) $socid = $user->societe_id; $feature2 = (($socid && $user->rights->user->self->creer)?'':'user'); if ($user->id == $id) $feature2=''; // A user can always read its own card -$result = restrictedArea($user, 'user', $id, '&user', $feature2); +$result = restrictedArea($user, 'user', $id, 'user&user', $feature2); $fuser = new User($db); $fuser->fetch($id); diff --git a/htdocs/user/note.php b/htdocs/user/note.php index 2a992aa3212..7fb4ae06ed6 100644 --- a/htdocs/user/note.php +++ b/htdocs/user/note.php @@ -46,7 +46,7 @@ $socid=0; if ($user->societe_id > 0) $socid = $user->societe_id; $feature2 = (($socid && $user->rights->user->self->creer)?'':'user'); if ($user->id == $id) $feature2=''; // A user can always read its own card -$result = restrictedArea($user, 'user', $id, '&user', $feature2); +$result = restrictedArea($user, 'user', $id, 'user&user', $feature2); diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php index 4f8259bc007..e749f2891fb 100644 --- a/htdocs/user/param_ihm.php +++ b/htdocs/user/param_ihm.php @@ -55,7 +55,7 @@ if ($user->id == $id) // A user can always read its own card $feature2=''; $canreaduser=1; } -$result = restrictedArea($user, 'user', $id, '&user', $feature2); +$result = restrictedArea($user, 'user', $id, 'user&user', $feature2); if ($user->id <> $id && ! $canreaduser) accessforbidden(); $dirtop = "../core/menus/standard"; @@ -155,11 +155,11 @@ if ($action == 'edit') print ''; diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index a01b5ffa7ab..a1c7fbff5ea 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -64,7 +64,7 @@ if ($user->id == $id && (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user- $canreaduser=1; } -$result = restrictedArea($user, 'user', $id, '&user', $feature2); +$result = restrictedArea($user, 'user', $id, 'user&user', $feature2); if ($user->id <> $id && ! $canreaduser) accessforbidden();
    '.$langs->trans("Ref").'
    '.$langs->trans("Ref").''; print $object->id; print '
    '.$langs->trans("Lastname").''.$langs->trans("Lastname").''; if ($caneditfield && !$object->ldap_sid) { @@ -1728,7 +1728,7 @@ else print '
    '.$langs->trans("Firstname").'
    '.$langs->trans("Firstname").''; if ($caneditfield && !$object->ldap_sid) { @@ -1742,7 +1742,7 @@ else print '
    '.$langs->trans("PostOrFunction").'
    '.$langs->trans("PostOrFunction").''; if ($caneditfield) { @@ -1756,7 +1756,7 @@ else print '
    '.$langs->trans("Login").'
    '.$langs->trans("Login").''; if ($user->admin && !$object->ldap_sid) { @@ -1771,7 +1771,7 @@ else print '
    '.$langs->trans("Password").'
    '.$langs->trans("Password").''; if ($object->ldap_sid) { @@ -1793,7 +1793,7 @@ else print "
    '.$langs->trans("Administrator").'
    '.$langs->trans("Administrator").'
    '.$langs->trans("Type").'
    '.$langs->trans("Type").''; if ($user->id == $object->id || ! $user->admin) { @@ -1889,7 +1889,7 @@ else print '
    '.$langs->trans("PhonePro").'
    '.$langs->trans("PhonePro").''; if ($caneditfield && empty($object->ldap_sid)) { @@ -1903,7 +1903,7 @@ else print '
    '.$langs->trans("PhoneMobile").'
    '.$langs->trans("PhoneMobile").''; if ($caneditfield && empty($object->ldap_sid)) { @@ -1917,7 +1917,7 @@ else print '
    '.$langs->trans("Fax").'
    '.$langs->trans("Fax").''; if ($caneditfield && empty($object->ldap_sid)) { @@ -1933,7 +1933,7 @@ else // Skype if (! empty($conf->skype->enabled)) { - print '
    '.$langs->trans("Skype").'
    '.$langs->trans("Skype").''; if ($caneditfield && empty($object->ldap_sid)) { @@ -1948,7 +1948,7 @@ else } // EMail - print "
    global->USER_MAIL_REQUIRED)?' class="fieldrequired"':'').'>'.$langs->trans("EMail").'
    '; if ($caneditfield && empty($object->ldap_sid)) { @@ -1962,7 +1962,7 @@ else print '
    '.$langs->trans("Signature").'
    '.$langs->trans("Signature").''; if ($caneditfield) { @@ -1979,7 +1979,7 @@ else // OpenID url if (isset($conf->file->main_authentication) && preg_match('/openid/',$conf->file->main_authentication) && ! empty($conf->global->MAIN_OPENIDURL_PERUSER)) { - print "
    '.$langs->trans("OpenIDURL").'
    '.$langs->trans("OpenIDURL").''; if ($caneditfield) { @@ -1994,7 +1994,7 @@ else } // Hierarchy - print '
    '.$langs->trans("HierarchicalResponsible").'
    '.$langs->trans("HierarchicalResponsible").''; if ($caneditfield) { @@ -2015,21 +2015,21 @@ else $langs->load("salaries"); // THM - print '
    '.$langs->trans("THM").'
    '.$langs->trans("THM").''; print ''; print '
    '.$langs->trans("TJM").'
    '.$langs->trans("TJM").''; print ''; print '
    '.$langs->trans("Salary").'
    '.$langs->trans("Salary").''; print ''; print '
    '.$langs->trans("WeeklyHours").'
    '.$langs->trans("WeeklyHours").''; print ''; print '
    '.$langs->trans("AccountancyCode").''.$langs->trans("AccountancyCode").''; if ($caneditfield) { @@ -2065,14 +2065,14 @@ else // User color if (! empty($conf->agenda->enabled)) { - print '
    '.$langs->trans("ColorUser").'
    '.$langs->trans("ColorUser").''; print $formother->selectColor(GETPOST('color')?GETPOST('color'):$object->color, 'color', 'usercolorconfig', 1, '', 'hideifnotset'); print '
    '.$langs->trans("Status").'
    '.$langs->trans("Status").''; print $object->getLibStatut(4); print '
    '.$langs->trans("LinkToCompanyContact").'
    '.$langs->trans("LinkToCompanyContact").''; if ($object->societe_id > 0) { @@ -2107,7 +2107,7 @@ else if (! empty($conf->adherent->enabled)) { $langs->load("members"); - print '
    '.$langs->trans("LinkedToDolibarrMember").'
    '.$langs->trans("LinkedToDolibarrMember").''; if ($object->fk_member) { @@ -2129,7 +2129,7 @@ else { if (empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity) { - print "
    '.$langs->trans("Entity").'
    '.$langs->trans("Entity").'".$mc->select_entities($object->entity, 'entity', '', 0, 1); // last parameter 1 means, show also a choice 0=>'all entities' print "
    '; + print '
    '; tree_recur($data,$data[0],0); print '