Skip to content

Commit

Permalink
[Core] add: hide object lines details configuration variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Théo David committed Jun 13, 2022
1 parent 45e1094 commit d50a3d7
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 4 deletions.
26 changes: 25 additions & 1 deletion admin/registrationcertificate.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,31 @@
print $langs->trans("RegistrationCertificateShowFieldsDescription");
print '</td>';
print '<td class="center">';
print ajax_constantonoff('DOLICAR_HIDE_REGISTRATIONCERTIFICATE');
print ajax_constantonoff('DOLICAR_HIDE_REGISTRATIONCERTIFICATE_FIELDS');
print '</td>';
print '</tr>';
print '</form>';

print '</table>';
print '</div>';

print load_fiche_titre($langs->trans("ProductBatch"), '', '');

print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>' . $langs->trans("Parameters") . '</td>';
print '<td class="center">' . $langs->trans("ShortInfo") . '</td>';
print '<td class="center">' . $langs->trans("Status") . '</td>';
print '</tr>';

// Show logo for company
print '<tr class="oddeven"><td>' . $langs->trans("HideObjectDetsDolicarDetails") . '</td>';
print '<td class="center">';
print $langs->trans("HideObjectDetsDolicarDetailsDescription");
print '</td>';
print '<td class="center">';
print ajax_constantonoff('DOLICAR_HIDE_OBJECT_DET_DOLICAR_DETAILS');
print '</td>';
print '</tr>';
print '</form>';
Expand Down
33 changes: 32 additions & 1 deletion class/actions_dolicar.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,16 @@ public function printCommonFooter($parameters)
jQuery('.facturedet_extras_registrationcertificatefr').not('.valuefieldlinecreate').html(<?php echo json_encode($registration_certificate->getNomUrl()) ?>)
</script>
<?php
if ($conf->global->DOLICAR_HIDE_OBJECT_DET_DOLICAR_DETAILS) :
?>
<script>
jQuery('.facturedet_extras_registrationcertificatefr').hide()
jQuery('.facturedet_extras_mileage').hide()
jQuery('.facturedet_extras_vehicle_model').hide()
jQuery('.facturedet_extras_registration_number').hide()
</script>
<?php
endif;
} elseif (GETPOST('action') == 'create'){
?>
<script>
Expand Down Expand Up @@ -161,6 +171,16 @@ public function printCommonFooter($parameters)
jQuery('.propaldet_extras_registrationcertificatefr').not('.valuefieldlinecreate').html(<?php echo json_encode($registration_certificate->getNomUrl()) ?>)
</script>
<?php
if ($conf->global->DOLICAR_HIDE_OBJECT_DET_DOLICAR_DETAILS) :
?>
<script>
jQuery('.propaldet_extras_registrationcertificatefr').hide()
jQuery('.propaldet_extras_mileage').hide()
jQuery('.propaldet_extras_vehicle_model').hide()
jQuery('.propaldet_extras_registration_number').hide()
</script>
<?php
endif;
} elseif (GETPOST('action') == 'create'){
?>
<script>
Expand Down Expand Up @@ -197,6 +217,16 @@ public function printCommonFooter($parameters)
jQuery('.commandedet_extras_registrationcertificatefr').not('.valuefieldlinecreate').html(<?php echo json_encode($registration_certificate->getNomUrl()) ?>)
</script>
<?php
if ($conf->global->DOLICAR_HIDE_OBJECT_DET_DOLICAR_DETAILS) :
?>
<script>
jQuery('.commandedet_extras_registrationcertificatefr').hide()
jQuery('.commandedet_extras_mileage').hide()
jQuery('.commandedet_extras_vehicle_model').hide()
jQuery('.commandedet_extras_registration_number').hide()
</script>
<?php
endif;
} elseif (GETPOST('action') == 'create'){
?>
<script>
Expand All @@ -205,7 +235,8 @@ public function printCommonFooter($parameters)
</script>
<?php
}
} else if ($parameters['currentcontext'] == 'productlotcard' && GETPOST('action') != 'create') {
} else
if ($parameters['currentcontext'] == 'productlotcard' && GETPOST('action') != 'create') {
require_once __DIR__ . '/../class/registrationcertificatefr.class.php';
require_once __DIR__ . '/../../../compta/facture/class/facture.class.php';
require_once __DIR__ . '/../../../commande/class/commande.class.php';
Expand Down
3 changes: 2 additions & 1 deletion core/modules/modDoliCar.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ public function __construct($db)
5 => array('DOLICAR_DEFAULT_VEHICLE', 'integer', 0, '', 0, 'current'),
6 => array('DOLICAR_VEHICLE_TAG', 'integer', 0, '', 0, 'current'),
7 => array('DOLICAR_MENU_DEFAULT_VEHICLE_UPDATED', 'integer', 0, '', 0, 'current'),
8 => array('DOLICAR_HIDE_REGISTRATIONCERTIFICATE', 'integer', 1, '', 0, 'current'),
8 => array('DOLICAR_HIDE_REGISTRATIONCERTIFICATE_FIELDS', 'integer', 1, '', 0, 'current'),
9 => array('DOLICAR_HIDE_OBJECT_DET_DOLICAR_DETAILS', 'integer', 1, '', 0, 'current'),
);

if (!isset($conf->dolicar) || !isset($conf->dolicar->enabled)) {
Expand Down
3 changes: 3 additions & 0 deletions langs/fr_FR/dolicar.lang
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ Object = Objet
DefaultBrand = Marque par défaut
RegistrationCertificateShowFields = Cacher les champs de la carte grise
RegistrationCertificateShowFieldsDescription = Cette option permet de cacher/afficher une partie des champs de la carte grise
HideObjectDetsDolicarDetails = Cacher le détail de Dolicar des lignes d'objets
HideObjectDetsDolicarDetailsDescription = Cette option permet de cacher/afficher le kilométrage, la plaque d'immatriculation et le modèle de véhicule sur les lignes des factures/propales/commandes

#
# Other
Expand All @@ -149,3 +151,4 @@ DefaultVehicle = Véhicule par défaut
facture = Facture
commande = Commande
propal = Proposition commerciale
ProductBatch = Numéro de lot/série
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@
print dol_get_fiche_end();

print $form->buttonsSaveCancel("Create");
if ($conf->global->DOLICAR_HIDE_REGISTRATIONCERTIFICATE) :
if ($conf->global->DOLICAR_HIDE_REGISTRATIONCERTIFICATE_FIELDS) :
?>
<script>
$('.field_b_first_registration_date').hide()
Expand Down

0 comments on commit d50a3d7

Please sign in to comment.