2
0
forked from Wavyzz/dolibarr

Merge branch '14.0' of git@github.com:Dolibarr/dolibarr.git into 14.0

This commit is contained in:
Laurent Destailleur
2021-09-09 14:59:12 +02:00
6 changed files with 34 additions and 4 deletions

View File

@@ -194,6 +194,9 @@ if (empty($reshook) && isset($extrafields->attributes[$object->table_element]['l
if ($object->element == 'contact') {
$permok = $user->rights->societe->contact->creer;
}
if ($object->element == 'salary') {
$permok = $user->rights->salaries->read;
}
$isdraft = ((isset($object->statut) && $object->statut == 0) || (isset($object->status) && $object->status == 0));
if (($isdraft || !empty($extrafields->attributes[$object->table_element]['alwayseditable'][$tmpkeyextra]))

View File

@@ -349,6 +349,9 @@ UPDATE llx_payment_salary SET ref = rowid WHERE ref IS NULL;
ALTER TABLE llx_salary ALTER COLUMN paye set default 0;
UPDATE llx_extrafields SET elementtype = 'salary' WHERE elementtype = 'payment_salary';
ALTER TABLE llx_payment_salary_extrafields RENAME TO llx_salary_extrafields;
DELETE FROM llx_boxes WHERE box_id IN (SELECT rowid FROM llx_boxes_def WHERE file IN ('box_graph_ticket_by_severity', 'box_ticket_by_severity.php', 'box_nb_ticket_last_x_days.php', 'box_nb_tickets_type.php', 'box_new_vs_close_ticket.php'));
DELETE FROM llx_boxes_def WHERE file IN ('box_graph_ticket_by_severity', 'box_ticket_by_severity.php', 'box_nb_ticket_last_x_days.php', 'box_nb_tickets_type.php', 'box_new_vs_close_ticket.php');

View File

@@ -17,4 +17,4 @@
-- ===================================================================
ALTER TABLE llx_payment_salary_extrafields ADD INDEX idx_payment_salary_extrafields (fk_object);
ALTER TABLE llx_salary_extrafields ADD INDEX idx_salary_extrafields (fk_object);

View File

@@ -16,10 +16,10 @@
--
-- ===================================================================
create table llx_payment_salary_extrafields
create table llx_salary_extrafields
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
fk_object integer NOT NULL, -- salary payment id
fk_object integer NOT NULL, -- salary id
import_key varchar(14) -- import key
)ENGINE=innodb;

View File

@@ -42,7 +42,7 @@ foreach ($tmptype2label as $key => $val) {
$action = GETPOST('action', 'aZ09');
$attrname = GETPOST('attrname', 'alpha');
$elementtype = 'payment_salary'; //Must be the $table_element of the class that manage extrafield
$elementtype = 'salary'; //Must be the $table_element of the class that manage extrafield
if (!$user->admin) {
accessforbidden();

View File

@@ -368,6 +368,30 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->salaries-
}
}
// Action to update one extrafield
if ($action == "update_extras" && !empty($user->rights->salaries->read)) {
$object->fetch(GETPOST('id', 'int'));
$attributekey = GETPOST('attribute', 'alpha');
$attributekeylong = 'options_'.$attributekey;
if (GETPOSTISSET($attributekeylong.'day') && GETPOSTISSET($attributekeylong.'month') && GETPOSTISSET($attributekeylong.'year')) {
// This is properties of a date
$object->array_options['options_'.$attributekey] = dol_mktime(GETPOST($attributekeylong.'hour', 'int'), GETPOST($attributekeylong.'min', 'int'), GETPOST($attributekeylong.'sec', 'int'), GETPOST($attributekeylong.'month', 'int'), GETPOST($attributekeylong.'day', 'int'), GETPOST($attributekeylong.'year', 'int'));
//var_dump(dol_print_date($object->array_options['options_'.$attributekey]));exit;
} else {
$object->array_options['options_'.$attributekey] = GETPOST($attributekeylong, 'alpha');
}
$result = $object->insertExtraFields(empty($triggermodname) ? '' : $triggermodname, $user);
if ($result > 0) {
setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
$action = 'view';
} else {
setEventMessages($object->error, $object->errors, 'errors');
$action = 'edit_extras';
}
}
/*
* View