From 8e09f54a4658cd764c8bf964288ba091dabd2db4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 13 May 2015 07:46:12 +0200 Subject: [PATCH 1/5] Minor fixes --- htdocs/admin/system/about.php | 2 +- .../modules/export/export_excel.modules.php | 19 ++++++++++++++--- .../export/export_excel2007.modules.php | 21 +++++++++++++++---- htdocs/exports/index.php | 6 +++--- htdocs/imports/import.php | 4 ++-- htdocs/imports/index.php | 6 +++--- htdocs/langs/en_US/other.lang | 1 + htdocs/user/hierarchy.php | 4 ++-- htdocs/user/index.php | 21 ++++++++----------- 9 files changed, 54 insertions(+), 30 deletions(-) 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/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/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/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/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/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 ''; + print ''; tree_recur($data,$data[0],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 From 43b5209192907430cc5ee8a4297897ec637b29ef Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 13 May 2015 08:57:00 +0200 Subject: [PATCH 2/5] NEW Clean code into salary module, debug and add indexes NEW Can filter on user list and salary payments on user with naural search. --- htdocs/compta/charges/index.php | 16 +-- htdocs/compta/salaries/card.php | 111 ++++++++++-------- htdocs/compta/salaries/index.php | 21 ++-- htdocs/compta/salaries/info.php | 4 +- .../class/paymentsocialcontribution.class.php | 4 +- htdocs/core/lib/salaries.lib.php | 6 +- htdocs/core/modules/modSalaries.class.php | 13 ++ .../install/mysql/migration/3.7.0-3.8.0.sql | 9 ++ .../mysql/tables/llx_payment_salary.key.sql | 27 +++++ .../mysql/tables/llx_payment_salary.sql | 8 +- htdocs/langs/en_US/admin.lang | 4 +- 11 files changed, 145 insertions(+), 78 deletions(-) create mode 100644 htdocs/install/mysql/tables/llx_payment_salary.key.sql 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/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 '
'.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)."
'; 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/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/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/install/mysql/migration/3.7.0-3.8.0.sql b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql index 28f4ab69f71..a2c19c71211 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; 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/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 From b327b5fb9dfffae60a70a6da8781136eac06089d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 13 May 2015 09:32:54 +0200 Subject: [PATCH 3/5] Save regressions --- htdocs/core/lib/security.lib.php | 16 ++++++++-------- htdocs/user/card.php | 2 +- htdocs/user/clicktodial.php | 2 +- htdocs/user/document.php | 2 +- htdocs/user/info.php | 2 +- htdocs/user/ldap.php | 2 +- htdocs/user/note.php | 2 +- htdocs/user/param_ihm.php | 2 +- htdocs/user/perms.php | 2 +- 9 files changed, 16 insertions(+), 16 deletions(-) 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/user/card.php b/htdocs/user/card.php index 1cbeb6e653d..7ad0f048a69 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(); 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/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 77e03728af6..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"; 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(); From 5937cd7f70e110b6737fa46b63995240223a9adb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 13 May 2015 17:53:25 +0200 Subject: [PATCH 4/5] NEW Forms are using the tab look, even in creation mode. --- htdocs/commande/card.php | 8 +++- htdocs/compta/facture.php | 6 ++- htdocs/compta/facture/list.php | 2 +- htdocs/compta/facture/mergepdftool.php | 6 +-- htdocs/compta/resultat/bilan.php | 57 -------------------------- htdocs/compta/resultat/clientfourn.php | 3 ++ htdocs/compta/resultat/compteres.php | 52 ----------------------- htdocs/compta/resultat/index.php | 3 ++ htdocs/core/lib/report.lib.php | 2 + htdocs/don/card.php | 24 ++++++----- htdocs/don/index.php | 4 +- htdocs/fichinter/card.php | 12 +++++- htdocs/fourn/commande/card.php | 6 ++- htdocs/fourn/facture/card.php | 8 +++- 14 files changed, 59 insertions(+), 134 deletions(-) delete mode 100644 htdocs/compta/resultat/bilan.php delete mode 100644 htdocs/compta/resultat/compteres.php 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/compta/facture.php b/htdocs/compta/facture.php index 556da5db0ce..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 ''; // Ref @@ -2472,8 +2474,10 @@ if ($action == 'create') print "
\n"; + dol_fiche_end(); + // Button "Create Draft" - print '
'; + print '
'; print ''; print '     '; print ''; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index e888941e95e..a396d9fdf1d 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -300,7 +300,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('AmountHT'),$_SERVER['PHP_SELF'],'f.total','',$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('AmountVAT'),$_SERVER['PHP_SELF'],'f.tva','',$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('AmountTTC'),$_SERVER['PHP_SELF'],'f.total_ttc','',$param,'align="right"',$sortfield,$sortorder); diff --git a/htdocs/compta/facture/mergepdftool.php b/htdocs/compta/facture/mergepdftool.php index 2a998c07a53..ff1bde24466 100644 --- a/htdocs/compta/facture/mergepdftool.php +++ b/htdocs/compta/facture/mergepdftool.php @@ -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 ''; - $form->select_types_paiements($search_paymentmode, 'search_paymentmode'); + $form->select_types_paiements($search_paymentmode, 'search_paymentmode', '', 0, 0, 1); print ''; print ''; print ' '; @@ -799,7 +799,7 @@ if ($resql) print ''; // Remain to receive - print ''.((! empty($objp->am) || ! empty($cn) || ! empty($dep))?price($objp->total_ttc-$objp->am-$cn-$dep):' ').''; + print ''.(((! 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):' ').''; // Status of invoice print ''; 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/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/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 ''; - 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/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/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/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"; From 976211b70fa4dc73cf4bd469a5bdfe37957f4283 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 15 May 2015 12:53:14 +0200 Subject: [PATCH 5/5] Look enhancement --- htdocs/compta/bank/account.php | 101 ++++++++++++++++---------------- htdocs/compta/bank/annuel.php | 30 +++++----- htdocs/compta/bank/graph.php | 5 +- htdocs/compta/bank/releve.php | 5 +- htdocs/compta/bank/treso.php | 9 +-- htdocs/expedition/shipment.php | 8 +-- htdocs/theme/eldy/style.css.php | 2 +- 7 files changed, 78 insertions(+), 82 deletions(-) diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index 75e650d69b8..1aea3e27c1b 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -324,8 +324,54 @@ if ($id > 0 || ! empty($ref)) 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') @@ -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 182340a2baa..990b32524a5 100644 --- a/htdocs/compta/bank/annuel.php +++ b/htdocs/compta/bank/annuel.php @@ -186,12 +186,14 @@ print ''; 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/graph.php b/htdocs/compta/bank/graph.php index d0afdee61bb..6f885e12bde 100644 --- a/htdocs/compta/bank/graph.php +++ b/htdocs/compta/bank/graph.php @@ -813,6 +813,9 @@ print ''; print '
'.$langs->trans("CurrentBalance")."'.price($balance).'
'; +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 f82139d1f3a..eb56a95f96a 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -139,11 +139,10 @@ if (empty($num)) print ''; - 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 ''; diff --git a/htdocs/compta/bank/treso.php b/htdocs/compta/bank/treso.php index 4643b367630..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'); @@ -109,14 +105,15 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) print '
'; - print '
'; + dol_fiche_end(); + $solde = $acct->solde(0); /* * Affiche tableau des echeances a venir */ - print ''; + print '
'; // Ligne de titre tableau des ecritures print ''; 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 ''; + print ''; print ''; print ''; print ''; print ''."\n"; - - print ''."\n"; } } } diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 8854e8f3477..e7ae83cbe3e 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -1781,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;
'; - $img=''; if ($value['stock'] < $value['stock_alert']) { $img=img_warning($langs->trans("StockTooLow")); } - print '
      -> '.$value['fullpath'].' ('.$value['nb'].')
      -> '.$value['fullpath'].' ('.$value['nb'].') '.$value['nb_total'].'  '.$value['stock'].' '.$img.'