Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1647 [Control] add: labels for sheet and other object types #1809

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions class/actions_digiquali.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -414,4 +414,26 @@ public function saturneAdminObjectConst(array $parameters): int

return 0; // or return 1 to replace standard code.
}

public function getNomUrl($parameters, $object, $action): int {
if (strpos($parameters['context'], 'controlcard') !== false) {
$metadata = saturne_get_objects_metadata($object->element);
$fields = preg_split("/[\s,]+/", $metadata['name_field']);
$result = '';

if ($object->element == 'product' || $object->element == 'project_task') {
$result .= '<span class="opacitymedium">' . ' - ' . $object->label . '</span>';
} else {
if (count($fields) > 1 && property_exists($object, $fields[1])) {
$field = $fields[1];
$result .= '<span class="opacitymedium">' . ' - ' . $object->$field . '</span>';
}
}

if (!str_contains($parameters['getnomurl'], $result)) {
$this->resprints = $result;
}
}
return 0;
}
}
7 changes: 7 additions & 0 deletions view/control/control_card.php
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,13 @@
print dol_strlen($object->verdict) > 0 ? '<div class="wpeo-button button-' . $verdictColor . '">' . $object->fields['verdict']['arrayofkeyval'][(!empty($object->verdict)) ? $object->verdict : 3] . '</div>' : 'N/A';
print '</td>';

print '<tr class="field_fk_sheet"><td class="titlefield fieldname_fk_sheet">';
print $langs->trans('Sheet');
print '</td><td class="valuefield fieldname_fk_sheet">';
print $object->showOutputField($object->fields['fk_sheet'], 'fk_sheet', $object->fk_sheet, '', '', '', 0) . '<span class="opacitymedium">' . ' - ' . $sheet->label . '</span>';

unset($object->fields['fk_sheet']);

Comment on lines +612 to +614
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Si tu unset le field, on peut plus le manager par la suite

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fk_sheet est utilisé dans commonfields_view.tpl.php, ce qui crée un double du champ Modèle. Je ne vois pas comment empêche le doublon sans unset.

require_once DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php';

// Categories
Expand Down