Ajout champ contact à la fiche client
This commit is contained in:
parent
aff20099aa
commit
4aafa3f44f
@ -344,6 +344,7 @@ $tpl->assign('date', $date->format('d/m/Y'));
|
||||
$tpl->assign(compact('liste', 'radio', 'step', 'designations', 'prix', 'from_user', 'identite', 'csrf_key', 'doc'));
|
||||
$tpl->assign('users', toArray($db->get('SELECT id, '.$identite.' FROM users WHERE id_category != -2 NOT IN (SELECT id FROM users_categories WHERE hidden = 1) ORDER BY ' .$identite. ';'), 'id', " "));
|
||||
$tpl->assign('clients', $db->getAssoc('SELECT id, nom FROM plugin_facturation_clients;'));
|
||||
$tpl->assign('contacts', $db->getAssoc('SELECT id, nom_contact FROM plugin_facturation_clients;'));
|
||||
$tpl->assign('require_number', $require_number);
|
||||
$tpl->assign('number_pattern', PATTERNS_LIST[$plugin->getConfig('pattern')]);
|
||||
|
||||
|
@ -29,6 +29,7 @@ $form->runIf(f('save') && !$form->hasErrors(),
|
||||
'siret' => f('siret'),
|
||||
'telephone' => f('telephone'),
|
||||
'email' => f('email'),
|
||||
'nom_contact' => f('nom_contact'),
|
||||
'note' => f('note')
|
||||
]);
|
||||
|
||||
|
@ -19,6 +19,7 @@ $form->runIf(f('add') && !$form->hasErrors(),
|
||||
'siret' => f('siret'),
|
||||
'telephone' => f('telephone'),
|
||||
'email' => f('email'),
|
||||
'nom_contact' => f('nom_contact'),
|
||||
'note' => f('note')
|
||||
]);
|
||||
|
||||
|
@ -28,6 +28,7 @@ CREATE TABLE IF NOT EXISTS plugin_facturation_clients (
|
||||
date_creation TEXT NOT NULL DEFAULT CURRENT_DATE CHECK (date(date_creation) IS NOT NULL AND date(date_creation) = date_creation), -- Date d\'inscription
|
||||
telephone TEXT,
|
||||
email TEXT,
|
||||
nom_contact TEXT,
|
||||
note TEXT
|
||||
);
|
||||
|
||||
|
@ -18,6 +18,7 @@ class Client
|
||||
'siret',
|
||||
'telephone',
|
||||
'email',
|
||||
'nom_contact',
|
||||
'note'
|
||||
];
|
||||
|
||||
@ -41,7 +42,7 @@ class Client
|
||||
{
|
||||
$data[$key] = trim($data[$key]);
|
||||
|
||||
if($data[$key] == '' && ($key != 'siret' && $key != 'telephone' && $key != 'email'))
|
||||
if($data[$key] == '' && ! in_array($key, ['siret', 'telephone', 'email', 'nom_contact', 'note']))
|
||||
{
|
||||
throw new UserException('Le champs '.$key.' doit être renseigné.');
|
||||
}
|
||||
@ -137,6 +138,9 @@ class Client
|
||||
'email' => [
|
||||
'label' => 'E-Mail',
|
||||
],
|
||||
'nom_contact' => [
|
||||
'label' => 'Contact',
|
||||
],
|
||||
'note' => [
|
||||
'label' => 'Note',
|
||||
],
|
||||
|
@ -2,7 +2,7 @@ name="Facturation"
|
||||
description="Permet d'éditer des factures et devis à ses membres ainsi qu'à une base de clients supplémentaire."
|
||||
author="zou ; adapté par jce"
|
||||
url="https://git.roflcopter.fr/lesanges/paheko-plugin-facturation"
|
||||
version="0.14"
|
||||
version="0.15"
|
||||
menu=true
|
||||
restrict_section="accounting"
|
||||
restrict_level="read"
|
||||
|
@ -70,12 +70,12 @@
|
||||
</dl>
|
||||
|
||||
<dl class="type_membre">
|
||||
{input type="select" name="membre" label="Membre" options=$users required=1 source=$doc}
|
||||
{input type="select" name="membre" label="Membre" options=$users required=1 source=$doc default_empty="— Choisir un membre —"}
|
||||
</dl>
|
||||
|
||||
{if !empty($clients)}
|
||||
<dl class="type_client">
|
||||
{input type="select" name="client" label="Client" options=$clients required=1 class="type_client" source=$doc}
|
||||
{input type="select" name="client" label="Client" options=$clients required=1 class="type_client" source=$doc default_empty="— Choisir un client —"}
|
||||
</dl>
|
||||
{else}
|
||||
<input type="hidden" name="base_receveur" value="membre" />
|
||||
@ -85,6 +85,9 @@
|
||||
<fieldset data-types="t0 t1">
|
||||
<legend>Autres informations</legend>
|
||||
{input type="text" name="nom_contact" label="Nom du contact" source=$doc}
|
||||
<div class="hidden">
|
||||
{input type="select" name="contact_list" options=$contacts}
|
||||
</div>
|
||||
<div data-types="t1">
|
||||
{input type="text" name="numero_commande" label="Numéro de commande" source=$doc}
|
||||
{input type="text" name="reference_acheteur" label="Référence acheteur" source=$doc}
|
||||
|
@ -51,6 +51,18 @@
|
||||
}
|
||||
}
|
||||
|
||||
function modifierContact(client, idlist, idcontact)
|
||||
{
|
||||
let contactlist = document.querySelector(idlist);
|
||||
let options = contactlist.querySelectorAll('option');
|
||||
for (i=0; i < options.length; ++i) {
|
||||
if (options[i].value == client.value) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
document.querySelector(idcontact).value = options[i].textContent;
|
||||
}
|
||||
|
||||
const form = document.querySelector('#f_numero_facture').form;
|
||||
changeTypeSaisie(form.base_receveur.value);
|
||||
|
||||
@ -63,6 +75,11 @@
|
||||
};
|
||||
}
|
||||
|
||||
const selclient = document.querySelector('#f_client');
|
||||
selclient.addEventListener("change", () => {
|
||||
modifierContact(selclient, '#f_contact_list', '#f_nom_contact');
|
||||
});
|
||||
|
||||
} ());
|
||||
|
||||
|
||||
|
@ -48,6 +48,15 @@
|
||||
{/if}
|
||||
</dd>
|
||||
|
||||
<dt>Nom du contact</dt>
|
||||
<dd>
|
||||
{if empty($client.nom_contact)}
|
||||
<em>(Non renseigné)</em>
|
||||
{else}
|
||||
{$client.nom_contact}
|
||||
{/if}
|
||||
</dd>
|
||||
|
||||
<dt>Note</dt>
|
||||
<dd>
|
||||
{if empty($client.note)}
|
||||
|
@ -14,6 +14,7 @@
|
||||
{input type="text" name="siret" label="SIREN/SIRET" source=$client}
|
||||
{input type="tel" name="telephone" label="Téléphone" source=$client}
|
||||
{input type="email" name="email" label="Adresse e-mail" source=$client}
|
||||
{input type="text" name="nom_contact" label="Nom du contact" source=$client}
|
||||
{input type="textarea" cols="60" rows="3" name="note" label="Note" source=$client}
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
@ -61,6 +61,7 @@
|
||||
{input type="text" name="siret" label="SIREN/SIRET"}
|
||||
{input type="tel" name="telephone" label="Téléphone"}
|
||||
{input type="email" name="email" label="Adresse e-mail"}
|
||||
{input type="text" name="nom_contact" label="Nom contact"}
|
||||
{input type="textarea" cols="60" rows="3" name="note" label="Note"}
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
@ -252,10 +252,10 @@ EOT
|
||||
);
|
||||
}
|
||||
|
||||
// version 0.14
|
||||
// Ajout champ note à la table clients
|
||||
// version 0.15
|
||||
// Ajout champs note et contact à la table clients
|
||||
// Ajout divers champs à la table factures
|
||||
if (version_compare($old_version, '0.14', '<'))
|
||||
if (version_compare($old_version, '0.15', '<'))
|
||||
{
|
||||
$db->exec(<<<EOT
|
||||
CREATE TABLE IF NOT EXISTS plugin_facturation_clients_tmp
|
||||
@ -269,6 +269,7 @@ if (version_compare($old_version, '0.14', '<'))
|
||||
date_creation TEXT NOT NULL DEFAULT CURRENT_DATE CHECK (date(date_creation) IS NOT NULL AND date(date_creation) = date_creation),
|
||||
telephone TEXT,
|
||||
email TEXT,
|
||||
nom_contact TEXT,
|
||||
note TEXT
|
||||
);
|
||||
EOT
|
||||
|
Loading…
Reference in New Issue
Block a user