55 $this->family =
"financial";
57 $this->
name = preg_replace(
'/^mod/i',
'', get_class($this));
64 $this->const_name =
'MAIN_MODULE_'.strtoupper($this->
name);
65 $this->picto =
'salary';
68 $this->dirs = array(
"/salaries/temp");
71 $this->module_parts = array(
78 $this->config_page_url = array(
'salaries.php@salaries');
81 $this->hidden =
false;
82 $this->depends = array();
83 $this->requiredby = array();
84 $this->conflictwith = array();
85 $this->phpmin = array(7, 0);
86 $this->langfiles = array(
"salaries",
"bills");
91 "SALARIES_ACCOUNTING_ACCOUNT_PAYMENT",
98 "SALARIES_ACCOUNTING_ACCOUNT_CHARGE",
107 $this->boxes = array();
110 $this->rights = array();
111 $this->rights_class =
'salaries';
115 $this->rights[$r][0] = 511;
116 $this->rights[$r][1] =
'Read employee salaries and payments (yours only)';
117 $this->rights[$r][2] =
'r';
118 $this->rights[$r][3] = 0;
119 $this->rights[$r][4] =
'read';
120 $this->rights[$r][5] =
'';
123 $this->rights[$r][0] = 512;
124 $this->rights[$r][1] =
'Read employee salaries and payments (yours and of your subordinates)';
125 $this->rights[$r][2] =
'r';
126 $this->rights[$r][3] = 0;
127 $this->rights[$r][4] =
'readchild';
128 $this->rights[$r][5] =
'';
131 $this->rights[$r][0] = 513;
132 $this->rights[$r][1] =
'Create/modify payments of empoyee salaries';
133 $this->rights[$r][2] =
'w';
134 $this->rights[$r][3] = 0;
135 $this->rights[$r][4] =
'write';
136 $this->rights[$r][5] =
'';
139 $this->rights[$r][0] = 514;
140 $this->rights[$r][1] =
'Delete payments of employee salary';
141 $this->rights[$r][2] =
'd';
142 $this->rights[$r][3] = 0;
143 $this->rights[$r][4] =
'delete';
144 $this->rights[$r][5] =
'';
147 $this->rights[$r][0] = 517;
148 $this->rights[$r][1] =
'Read salaries and payments (of all employees)';
149 $this->rights[$r][2] =
'r';
150 $this->rights[$r][3] = 0;
151 $this->rights[$r][4] =
'readall';
154 $this->rights[$r][0] = 519;
155 $this->rights[$r][1] =
'Export payments of employee salaries';
156 $this->rights[$r][2] =
'r';
157 $this->rights[$r][3] = 0;
158 $this->rights[$r][4] =
'export';
159 $this->rights[$r][5] =
'';
173 $this->export_code[$r] = $this->rights_class.
'_'.$r;
174 $this->export_label[$r] =
'SalariesAndPayments';
175 $this->export_icon[$r] =
'salary';
176 $this->export_permission[$r] = array(array(
"salaries",
"export"));
177 $this->export_fields_array[$r] = array(
's.rowid' =>
'SalaryID',
's.label'=>
'Label',
's.datesp'=>
'DateStartPeriod',
's.dateep'=>
'DateEndPeriod',
's.amount' =>
'SalaryAmount',
's.paye' =>
'Status',
'u.firstname'=>
"Firstname",
'u.lastname'=>
"Lastname",
'u.login'=>
"Login",
'u.salary'=>
'CurrentSalary',
'p.datep'=>
'DatePayment',
'p.amount'=>
'AmountPayment',
'p.num_payment'=>
'Numero',
'p.note'=>
'Note');
178 $this->export_TypeFields_array[$r] = array(
's.rowid' =>
'Numeric',
's.label'=>
'Text',
's.amount' =>
'Numeric',
's.paye' =>
'Numeric',
'u.firstname'=>
"Text",
'u.lastname'=>
"Text",
'u.login'=>
'Text',
'u.salary'=>
"Numeric",
'p.datep'=>
'Date',
's.datesp'=>
'Date',
's.dateep'=>
'Date',
'p.amount'=>
'Numeric',
'p.num_payment'=>
'Numeric');
179 $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_payment'=>
'payment');
181 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
182 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'salary as s';
183 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user as u ON s.fk_user = u.rowid';
184 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'payment_salary as p ON p.fk_salary = s.rowid';
185 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_paiement as cp ON p.fk_typepayment = cp.id';
186 $this->export_sql_end[$r] .=
' WHERE s.entity IN ('.getEntity(
'salary').
')';
187 if (is_object($user) && !$user->hasRight(
'salaries',
'readall')) {
188 $childids = $user->getAllChildIds(1);
189 $this->export_sql_end[$r] .=
' AND s.fk_user IN ('.$this->db->sanitize(implode(
',', $childids)).
')';
191 if (is_object($user) && !$user->hasRight(
'salaries',
'readchild')) {
192 $this->export_sql_end[$r] .=
' AND s.fk_user = '.((int) $user->id);