Browse Source

Clean code

Laurent Destailleur 8 years ago
parent
commit
4e7353f8a0

+ 4 - 3
htdocs/core/lib/usergroups.lib.php

@@ -141,16 +141,17 @@ function user_prepare_head($object)
     // $this->tabs = array('entity:-tabname);   												to remove a tab
     complete_head_from_modules($conf,$langs,$object,$head,$h,'user');
 
-	if (! empty($conf->hrm->enabled) && $user->rights->hrm->employee->read)
+    if ((! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read))
+       || (! empty($conf->hrm->enabled) && ! empty($user->rights->hrm->employee->read)))
     {
 		// Bank
     	$head[$h][0] = DOL_URL_ROOT.'/user/bank.php?id='.$object->id;
-    	$head[$h][1] = $langs->trans("HR");
+    	$head[$h][1] = $langs->trans("HRAndBank");
     	$head[$h][2] = 'bank';
     	$h++;
 	}
 
-    //Info on users is visible only by internal user
+    // Such info on users is visible only by internal user
     if (empty($user->societe_id))
     {
 		// Notes

+ 1 - 1
htdocs/core/modules/modHRM.class.php

@@ -45,7 +45,7 @@ class modHRM extends DolibarrModules
 		$this->family = "hr";
 		// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
 		$this->name = preg_replace( '/^mod/i', '', get_class($this));
-		$this->description = "Management of employees carrier and feelings";
+		$this->description = "Management of employees carrier and feelings (department, employment contract)";
 		
 		// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
 		$this->version = 'development';

+ 1 - 1
htdocs/core/modules/modSalaries.class.php

@@ -54,7 +54,7 @@ class modSalaries extends DolibarrModules
 		// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
 		$this->name = preg_replace('/^mod/i','',get_class($this));
 		// Module description used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
-		$this->description = "Employees contracts and salaries management";
+		$this->description = "Payment of salaries";
 
 		// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
 		$this->version = 'dolibarr';

+ 1 - 1
htdocs/hrm/admin/admin_establishment.php

@@ -74,7 +74,7 @@ print load_fiche_titre($langs->trans("HRMSetup"), $linkback);
 
 // Configuration header
 $head = hrm_admin_prepare_head();
-dol_fiche_head($head, 'establishments', $langs->trans("HRM"), 0, "user");
+dol_fiche_head($head, 'establishments', $langs->trans("HRM"), -1, "user");
 
 $sql = "SELECT e.rowid, e.name, e.address, e.zip, e.town, e.status";
 $sql.= " FROM ".MAIN_DB_PREFIX."establishment as e";

+ 1 - 1
htdocs/hrm/admin/admin_hrm.php

@@ -78,7 +78,7 @@ print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
 print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
 print '<input type="hidden" name="action" value="update">';
 
-dol_fiche_head($head, 'parameters', $langs->trans("HRM"), 0, "user");
+dol_fiche_head($head, 'parameters', $langs->trans("HRM"), -1, "user");
 
 print '<table class="noborder" width="100%">';
 print '<tr class="liste_titre">';

+ 2 - 0
htdocs/hrm/class/establishment.class.php

@@ -96,6 +96,7 @@ class Establishment extends CommonObject
 		$sql.= ", entity";
 		$sql.= ", datec";
 		$sql.= ", fk_user_author";
+		$sql.= ", fk_user_mod";
 		$sql.= ") VALUES (";
 		$sql.= " '".$this->db->escape($this->name)."'";
 		$sql.= ", '".$this->db->escape($this->address)."'";
@@ -106,6 +107,7 @@ class Establishment extends CommonObject
 		$sql.= ", ".$conf->entity;
 		$sql.= ", '".$this->db->idate($now)."'";
 		$sql.= ", ". $user->id;
+		$sql.= ", ". $user->id;
 		$sql.= ")";
 
 		dol_syslog(get_class($this)."::create", LOG_DEBUG);

+ 1 - 1
htdocs/hrm/establishment/info.php

@@ -44,7 +44,7 @@ if ($id)
 
 	$head = establishment_prepare_head($object);
 
-	dol_fiche_head($head, 'info', $langs->trans("Establishment"), 0, 'building');
+	dol_fiche_head($head, 'info', $langs->trans("Establishment"), -1, 'building');
 
     print '<table width="100%"><tr><td>';
     dol_print_object_info($object);

+ 3 - 3
htdocs/langs/en_US/admin.lang

@@ -519,8 +519,8 @@ Module410Name=Webcalendar
 Module410Desc=Webcalendar integration
 Module500Name=Special expenses
 Module500Desc=Management of special expenses (taxes, social or fiscal taxes, dividends)
-Module510Name=Employee contracts and salaries
-Module510Desc=Management of employees contracts, salaries and payments
+Module510Name=Payment of employee wages
+Module510Desc=Record and follow payment of your employee wages
 Module520Name=Loan
 Module520Desc=Management of loans
 Module600Name=Notifications
@@ -563,7 +563,7 @@ Module2900Desc=GeoIP Maxmind conversions capabilities
 Module3100Name=Skype
 Module3100Desc=Add a Skype button into users / third parties / contacts / members cards
 Module4000Name=HRM
-Module4000Desc=Human resources management
+Module4000Desc=Human resources management (mangement of department, employee contracts and feelings)
 Module5000Name=Multi-company
 Module5000Desc=Allows you to manage multiple companies
 Module6000Name=Workflow

+ 1 - 0
htdocs/langs/en_US/main.lang

@@ -772,6 +772,7 @@ SetMultiCurrencyCode=Set currency
 BulkActions=Bulk actions
 ClickToShowHelp=Click to show tooltip help
 HR=HR
+HRAndBank=HR and Bank
 # Week day
 Monday=Monday
 Tuesday=Tuesday

+ 22 - 9
htdocs/user/bank.php

@@ -24,7 +24,7 @@
 /**
  *	    \file       htdocs/user/bank.php
  *      \ingroup    HRM
- *		\brief      BAN tab for users
+ *		\brief      Tab for HRM
  */
 
 require '../main.inc.php';
@@ -47,7 +47,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&user', $feature2);
+$result = restrictedArea($user, 'salaries|hrm', $id, 'user&user', $feature2);
 
 $object = new User($db);
 if ($id > 0 || ! empty($ref))
@@ -155,14 +155,27 @@ if ($account->id && $action != 'edit')
         
     print '<div class="fichecenter">';
 
+    print '<div class="underbanner clearboth"></div>';
+    
+    print '<table class="border centpercent">';
+    
+    print '<tr><td class="titlefield">'.$langs->trans("xxx").'</td>';
+    print '<td></td></tr>';
+    
+    print '</table>';
+    
+    print '</br>';
+    
+    print load_fiche_titre($langs->trans("BAN"));
+    
     print '<div class="underbanner clearboth"></div>';
     print '<table class="border centpercent">';
 
     print '<tr><td class="titlefield">'.$langs->trans("LabelRIB").'</td>';
-    print '<td colspan="4">'.$account->label.'</td></tr>';
+    print '<td>'.$account->label.'</td></tr>';
 
 	print '<tr><td>'.$langs->trans("BankName").'</td>';
-	print '<td colspan="4">'.$account->bank.'</td></tr>';
+	print '<td>'.$account->bank.'</td></tr>';
 
 	// Show fields of bank account
 	foreach ($account->getFieldsToShow() as $val) {
@@ -182,7 +195,7 @@ if ($account->id && $action != 'edit')
 	}
 
 	print '<tr><td class="tdtop">'.$langs->trans("IBAN").'</td>';
-	print '<td colspan="4">'.$account->iban . '&nbsp;';
+	print '<td>'.$account->iban . '&nbsp;';
     if (! empty($account->iban)) {
         if (! checkIbanForAccount($account)) {
             print img_picto($langs->trans("IbanNotValid"),'warning');
@@ -193,7 +206,7 @@ if ($account->id && $action != 'edit')
     print '</td></tr>';
 
 	print '<tr><td class="tdtop">'.$langs->trans("BIC").'</td>';
-	print '<td colspan="4">'.$account->bic.'&nbsp;';
+	print '<td>'.$account->bic.'&nbsp;';
     if (! empty($account->bic)) {
         if (! checkSwiftForAccount($account)) {
             print img_picto($langs->trans("SwiftNotValid"),'warning');
@@ -203,15 +216,15 @@ if ($account->id && $action != 'edit')
     }
     print '</td></tr>';
 
-	print '<tr><td class="tdtop">'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="4">';
+	print '<tr><td class="tdtop">'.$langs->trans("BankAccountDomiciliation").'</td><td>';
 	print $account->domiciliation;
 	print "</td></tr>\n";
 
-	print '<tr><td class="tdtop">'.$langs->trans("BankAccountOwner").'</td><td colspan="4">';
+	print '<tr><td class="tdtop">'.$langs->trans("BankAccountOwner").'</td><td>';
 	print $account->proprio;
 	print "</td></tr>\n";
 
-	print '<tr><td class="tdtop">'.$langs->trans("BankAccountOwnerAddress").'</td><td colspan="4">';
+	print '<tr><td class="tdtop">'.$langs->trans("BankAccountOwnerAddress").'</td><td>';
 	print $account->owner_address;
 	print "</td></tr>\n";
 

+ 7 - 3
htdocs/user/card.php

@@ -1028,6 +1028,8 @@ if (($action == 'create') || ($action == 'adduserldap'))
         print '</td></tr>';
     }
     
+    // TODO Move this into tab RH (HierarchicalResponsible must be on both tab)
+    
     // Hierarchy
     print '<tr><td>'.$langs->trans("HierarchicalResponsible").'</td>';
     print '<td>';
@@ -1264,7 +1266,7 @@ else
          */
         if ($action != 'edit')
         {
-			dol_fiche_head($head, 'user', $title, 0, 'user');
+			dol_fiche_head($head, 'user', $title, -1, 'user');
 
             dol_banner_tab($object,'id',$linkback,$user->rights->user->user->lire || $user->admin);
 
@@ -1386,8 +1388,8 @@ else
                 print '<td>'.$object->accountancy_code.'</td></tr>';
             }
             
-            // TODO Move this into RH Tab (visible if RH module on)
-            
+            // TODO Move this into tab RH, visible when salarie or RH is visible (HierarchicalResponsible must be on both tab)
+
             // Hierarchy
             print '<tr><td>'.$langs->trans("HierarchicalResponsible").'</td>';
             print '<td>';
@@ -2279,6 +2281,8 @@ else
                 print "</tr>";
             }
             
+            // TODO Move this into tab RH (HierarchicalResponsible must be on both tab)
+            
             // Hierarchy
             print '<tr><td>'.$langs->trans("HierarchicalResponsible").'</td>';
             print '<td>';