From 537599eab12656e8d1ec40b085b687714483f4fc Mon Sep 17 00:00:00 2001 From: polo Date: Sun, 27 Nov 2022 16:26:54 +0100 Subject: =?UTF-8?q?r=C3=A9organisation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.php | 57 ++++++++++----- data/ordipolo.sqlite | Bin 0 -> 28672 bytes index.php | 190 ++------------------------------------------------ php/main.php | 193 +++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 240 insertions(+), 200 deletions(-) create mode 100644 data/ordipolo.sqlite create mode 100755 php/main.php diff --git a/config.php b/config.php index c34309d..754a887 100644 --- a/config.php +++ b/config.php @@ -6,14 +6,32 @@ $business_name = 'ORDIPOLO'; -// $receipts = '~/ORDIPOLO/Applis_PHP/LaTeX/'; +// $db_name = "ordipolo"; +$db_name = "ordipolo"; + +// défaut = racine de l'appli = dossier parent de celui du code source +// $db_place = '../'; +$db_place = '../data/'; + + +// $receipts = 'LaTeX/'; $receipts = 'LaTeX/'; +$receiptsStorageLaTeX = '~ORDIPOLO/factures/LaTeX/'; +$receiptsStoragePDF = '~ORDIPOLO/factures/PDF/'; -// $quotations = '~/ORDIPOLO/Applis_PHP/LaTeX/'; +// $quotations = 'LaTeX/'; $quotations = 'LaTeX/'; +$quotationsStorageLaTeX = '~ORDIPOLO/devis/LaTeX/'; +$quotationsStoragePDF = '~ORDIPOLO/devis/PDF/'; + +// $envelopes = 'LaTeX/'; +$envelopes = 'LaTeX/'; +$envelopesStorageLaTeX = '~ORDIPOLO/enveloppes/LaTeX/'; +$envelopesStoragePDF = '~ORDIPOLO/enveloppes/PDF/'; -// $pub = "~/ORDIPOLO/PUB/"; -$pub = "pub/"; + +// $pub = "~/ORDIPOLO/PUB/"; // dossier extérieur au choix +$pub = "../pub/"; // dossier pub inclu dans l'appli // $flyer = "flyer.xcf"; $flyer = "flyer.xcf"; @@ -21,24 +39,29 @@ $flyer = "flyer.xcf"; // $business_card = "carte.sla"; $business_card = "carte.sla"; -// $envelopes = '~/ORDIPOLO/Applis_PHP/LaTeX/'; -$envelopes = 'LaTeX/'; - -// $db_name = "ordipolo"; -$db_name = "ordipolo"; - -// $db_place = '~/ORDIPOLO/Appli_PHP/'; -$db_place = ''; - // $image_editor = 'gimp'; $image_editor = 'gimp'; // $publishing = 'scribus'; $publishing = 'scribus'; -// $x_terminal = 'xterm'; + //$x_terminal = 'xterm'; -// les terminaux disponibles sont: xterm... +// -- état actuel du programme -- +// les terminaux gérés sont: xterm, urxvt, lxterminal, xfce4-terminal, gnome-terminal, konsole, Terminal (MAC, désactivé tant que non testé) +// ajouter à l'accaz: i3-sensible-terminal (pour i3), lxterminal-qt (pour LXQT, et donc lubuntu) +// le choix est automatique en prenant le 1er terminal disponible, ceux-ci sont testés un par un dans l'ordre de la liste ci-dessus + + +//~ $SGBD = 'sqlite'; +//~ $dsn = ''; +//~ if($SGBD == 'sqlite') +//~ { + //~ $dsn = 'sqlite:' . $db_name . '.sqlite'; +//~ } +//~ // pour la portabilité, ce serait pas mal de fournir le binaire de sqlite (dossier lib) +//~ $sqliteBin = '../lib/sqlite_linux'; +//~ $sqliteBin = '../lib/sqlite_win.exe'; + -// vérification des variables -// dans config_check.php +// vérification des variables dans ../php/config_check.php diff --git a/data/ordipolo.sqlite b/data/ordipolo.sqlite new file mode 100644 index 0000000..6138c54 Binary files /dev/null and b/data/ordipolo.sqlite differ diff --git a/index.php b/index.php index 7bcb87c..dbcf0e2 100755 --- a/index.php +++ b/index.php @@ -2,189 +2,13 @@ get()); - - // enregistrement - if($choix_niv1 == 'Nouvelle prestation') - { - // est ce que le client est déjà dans la base? - if(exec($QuestionNouveauClient->get()) == 0) // $? = 0 signifie oui - { - // saisie du nom du client et recherche - $client_saisie = exec($RechercheClient->get()); - - // sélection parmi les résultats - $ResultatsRechercheClient->set_entries(recherche_client($client_saisie)); - $choix_niv2 = exec($ResultatsRechercheClient->get()); - if($choix_niv2 != '') - { - echo "client trouvé\n"; - } - else // chaîne vide - { - echo "client pas trouvé\n"; - exec($NouveauClient->get()); - - // enregistrement dans la BDD - - } - - // récupération des infos dans la BDD - - } - else - { - echo "nouveau client\n"; - exec($NouveauClient->get()); - - // enregistrement dans la BDD - - } - - // infos sur la prestation - $choix_niv2 = exec($MenuEnregistrement->get()); - $continuer = true; - if($choix_niv2 == "Devis") - { - $type = 'DEVIS'; - } - elseif($choix_niv2 == "Facture") - { - $type = 'FACTURE'; - } - elseif($choix_niv2 == "CESU") - { - $type = 'CESU'; - } - elseif($choix_niv2 == "Pas de prestation") - { - $type = ''; - } - else - { - $continuer = false; // retour menu principal - } - - if($continuer) - { - exec($Calendrier->get()); - exec($FormulairePrestation->get()); - // enregistrement date et prestation en BDD - exec($CommentairePrestation->get()); - // enregistrement commentaire en BDD - } - } - - elseif($choix_niv1 == 'Fichier clients') - { - // quel affichage? un grand tableau avec zenity? une page web? un document LaTeX? - } - - // documents à imprimer - elseif($choix_niv1 == 'Créer/imprimer un document') - { - $choix_niv2 = exec($MenuDocuments->get()); - if($choix_niv2 == 'Devis') - { - - } - elseif($choix_niv2 == 'Facture') - { - - } - elseif($choix_niv2 == 'Lettre avec adresse') - { - - } - elseif($choix_niv2 == 'Livre des recettes') - { - - } - elseif($choix_niv2 == "Registre des achats") - { - - } - elseif($choix_niv2 == "Bilan annuel") - { - - } - else - { - // retour menu principal - } - } - - // Supports de communication - elseif($choix_niv1 == 'Communication') - { - $choix_niv2 = exec($MenuCommunication->get()); - if($choix_niv2 == 'Flyer (nécessite gimp)') - { - exec(window_app_command('gimp', $flyer)); - } - elseif($choix_niv2 == 'Carte de visite (nécessite scribus)') - { - exec(window_app_command('scribus', $business_card)); - } - elseif($choix_niv2 == 'Explorateur de fichiers') - { - exec(window_app_command($file_explorer, $pub)); - } - else - { - // retour menu principal - } - } - - // BDD - elseif($choix_niv1 == 'Base de données') - { - if($sqlitebrowser_enable) - { - exec(window_app_command('sqlitebrowser', $db_place)); - } - else - { - exec($x_term_command . ' ' . $sqlite_cli . ' ' . $db_place); // correpond à priori à: xterm -e sqlite3 ~/ORDIPOLO/Appli_PHP/ordipolo.sqlite - } - } - else - { - $boucle = false; // byebye - } -} - -// sauvegarder la base de données +// contenu de AppliGestionPHP.sh +//~ #!/bin/sh +//~ php php/main.php diff --git a/php/main.php b/php/main.php new file mode 100755 index 0000000..934f718 --- /dev/null +++ b/php/main.php @@ -0,0 +1,193 @@ +#!/bin/php +get()); + + // enregistrement + if($choix_niv1 == 'Nouvelle prestation') + { + // est ce que le client est déjà dans la base? + if(exec($QuestionNouveauClient->get()) == 0) // $? = 0 signifie oui + { + // saisie du nom du client et recherche + $client_saisie = exec($RechercheClient->get()); + + // sélection parmi les résultats + $ResultatsRechercheClient->set_entries(recherche_client($client_saisie)); + $choix_niv2 = exec($ResultatsRechercheClient->get()); + if($choix_niv2 != '') + { + echo "client trouvé\n"; + } + else // chaîne vide + { + echo "client pas trouvé\n"; + exec($NouveauClient->get()); + + // enregistrement dans la BDD + + } + + // récupération des infos dans la BDD + + } + else + { + echo "nouveau client\n"; + exec($NouveauClient->get()); + + // enregistrement dans la BDD + + } + + // infos sur la prestation + $choix_niv2 = exec($MenuEnregistrement->get()); + $continuer = true; + if($choix_niv2 == "Devis") + { + $type = 'DEVIS'; + } + elseif($choix_niv2 == "Facture") + { + $type = 'FACTURE'; + } + elseif($choix_niv2 == "CESU") + { + $type = 'CESU'; + } + elseif($choix_niv2 == "Pas de prestation") + { + $type = ''; + } + else + { + $continuer = false; // retour menu principal + } + + if($continuer) + { + exec($Calendrier->get()); + exec($FormulairePrestation->get()); + // enregistrement date et prestation en BDD + exec($CommentairePrestation->get()); + // enregistrement commentaire en BDD + } + } + + elseif($choix_niv1 == 'Fichier clients') + { + // quel affichage? un grand tableau avec zenity? une page web? un document LaTeX? + } + + // documents à imprimer + elseif($choix_niv1 == 'Créer/imprimer un document') + { + $choix_niv2 = exec($MenuDocuments->get()); + if($choix_niv2 == 'Devis') + { + + } + elseif($choix_niv2 == 'Facture') + { + + } + elseif($choix_niv2 == 'Lettre avec adresse') + { + + } + elseif($choix_niv2 == 'Livre des recettes') + { + + } + elseif($choix_niv2 == "Registre des achats") + { + + } + elseif($choix_niv2 == "Bilan annuel") + { + + } + else + { + // retour menu principal + } + } + + // Supports de communication + elseif($choix_niv1 == 'Communication') + { + $choix_niv2 = exec($MenuCommunication->get()); + if($choix_niv2 == 'Flyer (nécessite gimp)') + { + exec(window_app_command('gimp', $flyer)); + } + elseif($choix_niv2 == 'Carte de visite (nécessite scribus)') + { + exec(window_app_command('scribus', $business_card)); + } + elseif($choix_niv2 == 'Explorateur de fichiers') + { + exec(window_app_command($file_explorer, $pub)); + } + else + { + // retour menu principal + } + } + + // BDD + elseif($choix_niv1 == 'Base de données') + { + if($sqlitebrowser_enable) + { + exec(window_app_command('sqlitebrowser', $db_place)); + } + else + { + exec($x_term_command . ' ' . $sqlite_cli . ' ' . $db_place); // correpond à priori à: xterm -e sqlite3 ~/ORDIPOLO/Appli_PHP/ordipolo.sqlite + } + } + else + { + $boucle = false; // byebye + } +} + +// sauvegarder la base de données -- cgit v1.2.3