Ajout champ note à la fiche client
This commit is contained in:
parent
4ee3f65d0a
commit
950a6b8b2c
@ -17,27 +17,28 @@ if (!$c)
|
|||||||
}
|
}
|
||||||
|
|
||||||
$form->runIf(f('save') && !$form->hasErrors(),
|
$form->runIf(f('save') && !$form->hasErrors(),
|
||||||
function () use ($client, $id, $form)
|
function () use ($client, $id, $form)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$r = $client->edit($id,[
|
$r = $client->edit($id,[
|
||||||
'nom' => f('nom'),
|
'nom' => f('nom'),
|
||||||
'adresse' => f('adresse'),
|
'adresse' => f('adresse'),
|
||||||
'code_postal' => f('code_postal'),
|
'code_postal' => f('code_postal'),
|
||||||
'ville' => f('ville'),
|
'ville' => f('ville'),
|
||||||
'siret' => f('siret'),
|
'siret' => f('siret'),
|
||||||
'telephone' => f('telephone'),
|
'telephone' => f('telephone'),
|
||||||
'email' => f('email')
|
'email' => f('email'),
|
||||||
]);
|
'note' => f('note')
|
||||||
|
]);
|
||||||
|
|
||||||
$r ? Utils::redirect(PLUGIN_ADMIN_URL . 'client.php?id='.(int)$id):'';
|
$r ? Utils::redirect(PLUGIN_ADMIN_URL . 'client.php?id='.(int)$id):'';
|
||||||
}
|
}
|
||||||
catch (UserException $e)
|
catch (UserException $e)
|
||||||
{
|
{
|
||||||
$form->addError($e->getMessage());
|
$form->addError($e->getMessage());
|
||||||
}
|
}
|
||||||
}, 'edit_client');
|
}, 'edit_client');
|
||||||
|
|
||||||
|
|
||||||
$tpl->assign('client', $c);
|
$tpl->assign('client', $c);
|
||||||
|
@ -18,7 +18,8 @@ $form->runIf(f('add') && !$form->hasErrors(),
|
|||||||
'ville' => f('ville'),
|
'ville' => f('ville'),
|
||||||
'siret' => f('siret'),
|
'siret' => f('siret'),
|
||||||
'telephone' => f('telephone'),
|
'telephone' => f('telephone'),
|
||||||
'email' => f('email')
|
'email' => f('email'),
|
||||||
|
'note' => f('note')
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$id ? Utils::redirect(PLUGIN_ADMIN_URL . 'client.php?id='.(int)$id):'';
|
$id ? Utils::redirect(PLUGIN_ADMIN_URL . 'client.php?id='.(int)$id):'';
|
||||||
|
@ -24,7 +24,8 @@ CREATE TABLE IF NOT EXISTS plugin_facturation_clients (
|
|||||||
siret TEXT,
|
siret TEXT,
|
||||||
date_creation TEXT NOT NULL DEFAULT CURRENT_DATE CHECK (date(date_creation) IS NOT NULL AND date(date_creation) = date_creation), -- Date d\'inscription
|
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,
|
telephone TEXT,
|
||||||
email TEXT
|
email TEXT,
|
||||||
|
note TEXT
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,7 +17,8 @@ class Client
|
|||||||
'ville',
|
'ville',
|
||||||
'siret',
|
'siret',
|
||||||
'telephone',
|
'telephone',
|
||||||
'email'
|
'email',
|
||||||
|
'note'
|
||||||
];
|
];
|
||||||
|
|
||||||
private $config = [
|
private $config = [
|
||||||
@ -136,6 +137,9 @@ class Client
|
|||||||
'email' => [
|
'email' => [
|
||||||
'label' => 'E-Mail',
|
'label' => 'E-Mail',
|
||||||
],
|
],
|
||||||
|
'note' => [
|
||||||
|
'label' => 'Note',
|
||||||
|
],
|
||||||
'nb_documents' => [
|
'nb_documents' => [
|
||||||
'label' => 'Nombre de documents',
|
'label' => 'Nombre de documents',
|
||||||
'select' => '(SELECT COUNT(*) FROM plugin_facturation_factures WHERE receveur_id = c.id)',
|
'select' => '(SELECT COUNT(*) FROM plugin_facturation_factures WHERE receveur_id = c.id)',
|
||||||
|
@ -48,6 +48,15 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
|
<dt>Note</dt>
|
||||||
|
<dd>
|
||||||
|
{if empty($client.note)}
|
||||||
|
<em>(Non renseigné)</em>
|
||||||
|
{else}
|
||||||
|
{$client.note}
|
||||||
|
{/if}
|
||||||
|
</dd>
|
||||||
|
|
||||||
<dt>Date d'ajout</dt>
|
<dt>Date d'ajout</dt>
|
||||||
<dd>{$client.date_creation|date:'d/m/Y'}</dd>
|
<dd>{$client.date_creation|date:'d/m/Y'}</dd>
|
||||||
|
|
||||||
@ -94,4 +103,4 @@
|
|||||||
<p class="alert block">Ce client n'a pas de document associé.</p>
|
<p class="alert block">Ce client n'a pas de document associé.</p>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{include file="_foot.tpl"}
|
{include file="_foot.tpl"}
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
{input type="text" name="siret" label="SIREN/SIRET" source=$client}
|
{input type="text" name="siret" label="SIREN/SIRET" source=$client}
|
||||||
{input type="tel" name="telephone" label="Téléphone" 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="email" name="email" label="Adresse e-mail" source=$client}
|
||||||
|
{input type="textarea" cols="60" rows="3" name="note" label="Note" source=$client}
|
||||||
</dl>
|
</dl>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
@ -24,4 +25,4 @@
|
|||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
||||||
{include file="_foot.tpl"}
|
{include file="_foot.tpl"}
|
||||||
|
@ -61,6 +61,7 @@
|
|||||||
{input type="text" name="siret" label="SIREN/SIRET"}
|
{input type="text" name="siret" label="SIREN/SIRET"}
|
||||||
{input type="tel" name="telephone" label="Téléphone"}
|
{input type="tel" name="telephone" label="Téléphone"}
|
||||||
{input type="email" name="email" label="Adresse e-mail"}
|
{input type="email" name="email" label="Adresse e-mail"}
|
||||||
|
{input type="textarea" cols="60" rows="3" name="note" label="Note"}
|
||||||
</dl>
|
</dl>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
53
upgrade.php
53
upgrade.php
@ -12,7 +12,7 @@ error_log("upgrade::version = " . $old_version);
|
|||||||
if (version_compare($old_version, '0.2.0', '<'))
|
if (version_compare($old_version, '0.2.0', '<'))
|
||||||
{
|
{
|
||||||
$r = (array) DB::getInstance()->get('SELECT * FROM plugin_facturation_factures');
|
$r = (array) DB::getInstance()->get('SELECT * FROM plugin_facturation_factures');
|
||||||
|
|
||||||
foreach ($r as $e) {
|
foreach ($r as $e) {
|
||||||
$e->contenu =json_encode(unserialize((string) $e->contenu));
|
$e->contenu =json_encode(unserialize((string) $e->contenu));
|
||||||
$db->update('plugin_facturation_factures', $e, $db->where('id', (int)$e->id));
|
$db->update('plugin_facturation_factures', $e, $db->where('id', (int)$e->id));
|
||||||
@ -33,7 +33,7 @@ if (version_compare($old_version, '0.3.0', '<'))
|
|||||||
$db->exec('DROP TABLE `plugin_facturation_config`;');
|
$db->exec('DROP TABLE `plugin_facturation_config`;');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0.4.0 -
|
// 0.4.0 -
|
||||||
if (version_compare($old_version, '0.4.0', '<'))
|
if (version_compare($old_version, '0.4.0', '<'))
|
||||||
{
|
{
|
||||||
$db->exec(<<<EOT
|
$db->exec(<<<EOT
|
||||||
@ -52,7 +52,7 @@ if (version_compare($old_version, '0.4.0', '<'))
|
|||||||
INSERT OR IGNORE INTO plugin_facturation_paiement (code, nom) VALUES ('VI', 'Virement');
|
INSERT OR IGNORE INTO plugin_facturation_paiement (code, nom) VALUES ('VI', 'Virement');
|
||||||
INSERT OR IGNORE INTO plugin_facturation_paiement (code, nom) VALUES ('AU', 'Autre');
|
INSERT OR IGNORE INTO plugin_facturation_paiement (code, nom) VALUES ('AU', 'Autre');
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS plugin_facturation_factures_tmp
|
CREATE TABLE IF NOT EXISTS plugin_facturation_factures_tmp
|
||||||
(
|
(
|
||||||
id INTEGER PRIMARY KEY,
|
id INTEGER PRIMARY KEY,
|
||||||
@ -78,7 +78,7 @@ EOT
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0.6.0 -
|
// 0.6.0 -
|
||||||
if (version_compare($old_version, '0.6.0', '<'))
|
if (version_compare($old_version, '0.6.0', '<'))
|
||||||
{
|
{
|
||||||
define('DEVIS', 0);
|
define('DEVIS', 0);
|
||||||
@ -106,7 +106,7 @@ if (version_compare($old_version, '0.6.0', '<'))
|
|||||||
contenu TEXT NOT NULL,
|
contenu TEXT NOT NULL,
|
||||||
total INTEGER DEFAULT 0
|
total INTEGER DEFAULT 0
|
||||||
);
|
);
|
||||||
|
|
||||||
INSERT INTO plugin_facturation_factures_tmp SELECT * FROM plugin_facturation_factures;
|
INSERT INTO plugin_facturation_factures_tmp SELECT * FROM plugin_facturation_factures;
|
||||||
DROP TABLE plugin_facturation_factures;
|
DROP TABLE plugin_facturation_factures;
|
||||||
ALTER TABLE plugin_facturation_factures_tmp RENAME TO plugin_facturation_factures;
|
ALTER TABLE plugin_facturation_factures_tmp RENAME TO plugin_facturation_factures;
|
||||||
@ -119,7 +119,7 @@ EOT
|
|||||||
foreach($f->contenu as $line => $content)
|
foreach($f->contenu as $line => $content)
|
||||||
{
|
{
|
||||||
// Petit bug qui peut arriver avec des contenus mal enregistrés en db
|
// Petit bug qui peut arriver avec des contenus mal enregistrés en db
|
||||||
if (is_int($content))
|
if (is_int($content))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -143,7 +143,7 @@ EOT
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0.6.2 -
|
// 0.6.2 -
|
||||||
if (version_compare($old_version, '0.6.2', '<'))
|
if (version_compare($old_version, '0.6.2', '<'))
|
||||||
{
|
{
|
||||||
define('DEVIS', 0);
|
define('DEVIS', 0);
|
||||||
@ -168,14 +168,14 @@ if (version_compare($old_version, '0.6.2', '<'))
|
|||||||
INSERT OR IGNORE INTO plugin_facturation_txt_cerfa
|
INSERT OR IGNORE INTO plugin_facturation_txt_cerfa
|
||||||
("id","menu","texte") VALUES ('0','Aucun','');
|
("id","menu","texte") VALUES ('0','Aucun','');
|
||||||
INSERT OR IGNORE INTO plugin_facturation_txt_cerfa
|
INSERT OR IGNORE INTO plugin_facturation_txt_cerfa
|
||||||
("id","menu","texte")
|
("id","menu","texte")
|
||||||
VALUES ('1','HelloAsso','Don via HelloAsso');
|
VALUES ('1','HelloAsso','Don via HelloAsso');
|
||||||
INSERT OR IGNORE INTO plugin_facturation_txt_cerfa
|
INSERT OR IGNORE INTO plugin_facturation_txt_cerfa
|
||||||
("id","menu","texte")
|
("id","menu","texte")
|
||||||
VALUES ('2','Frais de déplacement',
|
VALUES ('2','Frais de déplacement',
|
||||||
'Renonciation aux remboursements de frais de déplacement');
|
'Renonciation aux remboursements de frais de déplacement');
|
||||||
INSERT OR IGNORE INTO plugin_facturation_txt_cerfa
|
INSERT OR IGNORE INTO plugin_facturation_txt_cerfa
|
||||||
("id","menu","texte")
|
("id","menu","texte")
|
||||||
VALUES ('3','Don en nature','Don en nature');
|
VALUES ('3','Don en nature','Don en nature');
|
||||||
EOT
|
EOT
|
||||||
);
|
);
|
||||||
@ -251,3 +251,36 @@ if (version_compare($old_version, '0.12', '<'))
|
|||||||
EOT
|
EOT
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// version 0.15 (?) Ajout champ note à la table client
|
||||||
|
if (version_compare($old_version, '0.15', '<'))
|
||||||
|
{
|
||||||
|
$db->exec(<<<EOT
|
||||||
|
CREATE TABLE IF NOT EXISTS plugin_facturation_clients_tmp
|
||||||
|
(
|
||||||
|
id INTEGER PRIMARY KEY,
|
||||||
|
nom TEXT NOT NULL,
|
||||||
|
adresse TEXT NOT NULL,
|
||||||
|
code_postal TEXT NOT NULL,
|
||||||
|
ville TEXT NOT NULL,
|
||||||
|
siret TEXT,
|
||||||
|
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,
|
||||||
|
note TEXT
|
||||||
|
);
|
||||||
|
EOT
|
||||||
|
);
|
||||||
|
// copier les clients dans la table temporaire
|
||||||
|
$sql = 'SELECT * FROM plugin_facturation_clients';
|
||||||
|
foreach ($db->iterate($sql) as $client)
|
||||||
|
{
|
||||||
|
$db->insert('plugin_facturation_clients_tmp', $client);
|
||||||
|
}
|
||||||
|
// remplacer l'ancienne table par la nouvelle
|
||||||
|
$db->exec(<<<EOT
|
||||||
|
DROP TABLE plugin_facturation_clients;
|
||||||
|
ALTER TABLE plugin_facturation_clients_tmp RENAME TO plugin_facturation_clients;
|
||||||
|
EOT
|
||||||
|
);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user