From 74908715c3d803bdc0fa9282f3c5626502584a3d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Oct 2009 16:17:58 +0000 Subject: [PATCH] Qual: Move independant external modules to the repository of modules. --- ChangeLog | 2 + htdocs/energie/EnergieCompteur.class.php | 231 -- htdocs/energie/EnergieGroupe.class.php | 95 - htdocs/energie/compteur.php | 228 -- htdocs/energie/compteur_graph.php | 108 - htdocs/energie/compteur_groupe.php | 121 - htdocs/energie/graph.php | 126 -- htdocs/energie/groupe.php | 159 -- htdocs/energie/index.php | 107 - htdocs/energie/pre.inc.php | 53 - htdocs/energie/releve.php | 144 -- htdocs/includes/menus/init_menu_auguria.sql | 2 - htdocs/includes/modules/modEnergie.class.php | 116 - htdocs/includes/modules/modImport.class.php | 3 +- .../includes/modules/modTelephonie.class.php | 315 --- htdocs/telephonie/adsl/fiche.php | 917 -------- .../telephonie/adsl/fournisseurxdsl.class.php | 129 -- htdocs/telephonie/adsl/history.php | 136 -- htdocs/telephonie/adsl/index.php | 116 - htdocs/telephonie/adsl/ligneadsl.class.php | 298 --- htdocs/telephonie/adsl/liste.php | 157 -- htdocs/telephonie/adsl/pre.inc.php | 51 - htdocs/telephonie/adsl/productxdsl.class.php | 129 -- htdocs/telephonie/adsl/statut-1.png | Bin 198 -> 0 bytes htdocs/telephonie/adsl/statut1.png | Bin 197 -> 0 bytes htdocs/telephonie/adsl/statut2.png | Bin 191 -> 0 bytes htdocs/telephonie/adsl/statut3.png | Bin 223 -> 0 bytes htdocs/telephonie/adsl/statut4.png | Bin 193 -> 0 bytes htdocs/telephonie/adsl/statut5.png | Bin 198 -> 0 bytes htdocs/telephonie/adsl/statut6.png | Bin 198 -> 0 bytes htdocs/telephonie/adsl/statut7.png | Bin 193 -> 0 bytes htdocs/telephonie/adsl/statut8.png | Bin 209 -> 0 bytes htdocs/telephonie/adsl/statut9.png | Bin 221 -> 0 bytes htdocs/telephonie/ca/gain.php | 111 - htdocs/telephonie/ca/index.php | 99 - htdocs/telephonie/ca/pre.inc.php | 70 - htdocs/telephonie/ca/ratiofourn.php | 95 - htdocs/telephonie/client/commentaires.php | 201 -- htdocs/telephonie/client/contacts.php | 152 -- htdocs/telephonie/client/facture.php | 732 ------- htdocs/telephonie/client/factures.php | 176 -- htdocs/telephonie/client/fiche.php | 242 -- htdocs/telephonie/client/index.php | 237 -- htdocs/telephonie/client/lignes.php | 202 -- htdocs/telephonie/client/liste.php | 133 -- htdocs/telephonie/client/my.php | 140 -- htdocs/telephonie/client/new.php | 864 -------- htdocs/telephonie/client/permissions.php | 244 --- htdocs/telephonie/client/pre.inc.php | 77 - htdocs/telephonie/client/remises.php | 133 -- htdocs/telephonie/client/remisesdone.php | 136 -- htdocs/telephonie/client/stats.php | 197 -- htdocs/telephonie/client/tarifs.php | 343 --- htdocs/telephonie/communication.class.php | 250 --- htdocs/telephonie/config/compta.php | 104 - .../telephonie/config/concurrents/index.php | 0 .../telephonie/config/concurrents/liste.php | 135 -- .../telephonie/config/concurrents/pre.inc.php | 65 - htdocs/telephonie/config/index.php | 239 -- htdocs/telephonie/config/mail.php | 96 - htdocs/telephonie/config/perms.php | 119 - htdocs/telephonie/config/pre.inc.php | 71 - htdocs/telephonie/config/xdsl.php | 123 -- htdocs/telephonie/config/xdsl_product.php | 136 -- htdocs/telephonie/config/xdsl_wkf.php | 154 -- htdocs/telephonie/contrat/fiche.php | 1128 ---------- htdocs/telephonie/contrat/index.php | 226 -- htdocs/telephonie/contrat/info.php | 208 -- htdocs/telephonie/contrat/liste.php | 159 -- htdocs/telephonie/contrat/pre.inc.php | 77 - htdocs/telephonie/contrat/services.php | 334 --- htdocs/telephonie/contrat/stats.php | 199 -- htdocs/telephonie/contrat/statut0.png | Bin 198 -> 0 bytes htdocs/telephonie/contrat/statut1.png | Bin 197 -> 0 bytes htdocs/telephonie/contrat/statut2.png | Bin 191 -> 0 bytes htdocs/telephonie/contrat/statut3.png | Bin 193 -> 0 bytes htdocs/telephonie/contrat/statut4.png | Bin 198 -> 0 bytes htdocs/telephonie/contrat/statut5.png | Bin 198 -> 0 bytes htdocs/telephonie/contrat/statut6.png | Bin 193 -> 0 bytes htdocs/telephonie/contrat/statut7.png | Bin 5 -> 0 bytes htdocs/telephonie/distributeurs/comm/ca.php | 100 - .../distributeurs/comm/commercial.php | 146 -- .../telephonie/distributeurs/comm/index.php | 0 .../telephonie/distributeurs/comm/pre.inc.php | 152 -- .../telephonie/distributeurs/commissions.php | 195 -- htdocs/telephonie/distributeurs/contrat.php | 127 -- .../telephonie/distributeurs/distributeur.php | 288 --- htdocs/telephonie/distributeurs/fiche.php | 161 -- htdocs/telephonie/distributeurs/index.php | 111 - htdocs/telephonie/distributeurs/po.php | 166 -- htdocs/telephonie/distributeurs/pre.inc.php | 134 -- htdocs/telephonie/distributeurs/remav.php | 201 -- htdocs/telephonie/distributeurs/remconso.php | 203 -- .../telephonie/distributeurs/remuneration.php | 308 --- htdocs/telephonie/distributeurs/stats.php | 131 -- htdocs/telephonie/distributeurtel.class.php | 193 -- htdocs/telephonie/dolibarrmail.class.php | 292 --- .../facturation/FacturationCalcul.class.php | 550 ----- .../facturation/FacturationEmission.class.php | 1010 --------- .../FacturationImportCdr.class.php | 330 --- .../facturation/FacturationVerifCdr.class.php | 101 - htdocs/telephonie/facturation/batch.php | 158 -- htdocs/telephonie/facturation/calcul.php | 72 - htdocs/telephonie/facturation/cdr-import.php | 93 - htdocs/telephonie/facturation/cdr.php | 156 -- htdocs/telephonie/facturation/emission.php | 77 - htdocs/telephonie/facturation/facture.php | 112 - htdocs/telephonie/facturation/files.php | 130 -- htdocs/telephonie/facturation/index.php | 170 -- htdocs/telephonie/facturation/pre.inc.php | 73 - htdocs/telephonie/facturation/stats.php | 76 - htdocs/telephonie/facture/index.php | 76 - htdocs/telephonie/facture/liste.php | 195 -- htdocs/telephonie/facture/pre.inc.php | 75 - htdocs/telephonie/facturetel.class.php | 152 -- .../cdrformat/cdrformat.fructidor.class.php | 106 - .../cdrformat/cdrformat.messidor.class.php | 89 - .../fournisseur/cdrformat/index.php | 0 .../commande/commande.tableur.class.php | 361 --- .../commande/commande.text.class.php | 233 -- .../commande/commande.textp.class.php | 221 -- .../commande/commande.web.class.php | 179 -- .../telephonie/fournisseur/commande/index.php | 0 .../commande/methode.commande.class.php | 66 - htdocs/telephonie/fournisseur/fiche.php | 306 --- htdocs/telephonie/fournisseur/index.php | 128 -- htdocs/telephonie/fournisseur/pre.inc.php | 65 - htdocs/telephonie/fournisseurtel.class.php | 298 --- htdocs/telephonie/graph-1.png | Bin 198 -> 0 bytes htdocs/telephonie/graph1.png | Bin 197 -> 0 bytes htdocs/telephonie/graph2.png | Bin 191 -> 0 bytes htdocs/telephonie/graph3.png | Bin 193 -> 0 bytes htdocs/telephonie/graph4.png | Bin 198 -> 0 bytes htdocs/telephonie/graph5.png | Bin 198 -> 0 bytes htdocs/telephonie/graph6.png | Bin 193 -> 0 bytes htdocs/telephonie/graph7.png | Bin 209 -> 0 bytes htdocs/telephonie/graph8.png | Bin 222 -> 0 bytes htdocs/telephonie/index.php | 199 -- htdocs/telephonie/interdit.png | Bin 1679 -> 0 bytes htdocs/telephonie/ligne/commande.php | 125 -- htdocs/telephonie/ligne/commande/archives.php | 113 - .../ligne/commande/commandetableur.class.php | 339 --- htdocs/telephonie/ligne/commande/fiche.php | 186 -- .../telephonie/ligne/commande/historique.php | 168 -- htdocs/telephonie/ligne/commande/index.php | 163 -- htdocs/telephonie/ligne/commande/liste.php | 183 -- htdocs/telephonie/ligne/commande/pre.inc.php | 76 - .../ligne/commande/retour/atraiter.php | 103 - .../ligne/commande/retour/fichiers.php | 104 - .../ligne/commande/retour/index.php | 215 -- .../ligne/commande/retour/liste.php | 109 - .../ligne/commande/retour/pre.inc.php | 54 - htdocs/telephonie/ligne/commentaires.php | 239 -- htdocs/telephonie/ligne/communications.php | 154 -- htdocs/telephonie/ligne/conso.php | 279 --- htdocs/telephonie/ligne/factures.php | 219 -- htdocs/telephonie/ligne/fiche.php | 1384 ------------ htdocs/telephonie/ligne/graph-1.png | Bin 198 -> 0 bytes htdocs/telephonie/ligne/graph1.png | Bin 197 -> 0 bytes htdocs/telephonie/ligne/graph2.png | Bin 191 -> 0 bytes htdocs/telephonie/ligne/graph3.png | Bin 193 -> 0 bytes htdocs/telephonie/ligne/graph4.png | Bin 198 -> 0 bytes htdocs/telephonie/ligne/graph5.png | Bin 198 -> 0 bytes htdocs/telephonie/ligne/graph6.png | Bin 193 -> 0 bytes htdocs/telephonie/ligne/graph7.png | Bin 209 -> 0 bytes htdocs/telephonie/ligne/graph8.png | Bin 222 -> 0 bytes htdocs/telephonie/ligne/graph9.png | Bin 207 -> 0 bytes htdocs/telephonie/ligne/groupe.php | 188 -- htdocs/telephonie/ligne/history.php | 271 --- htdocs/telephonie/ligne/index.php | 279 --- htdocs/telephonie/ligne/infoc.php | 227 -- htdocs/telephonie/ligne/liste.php | 219 -- htdocs/telephonie/ligne/listecommande.php | 156 -- htdocs/telephonie/ligne/numdata.php | 212 -- htdocs/telephonie/ligne/pre.inc.php | 85 - htdocs/telephonie/ligne/remises.php | 160 -- htdocs/telephonie/ligne/stat.php | 220 -- htdocs/telephonie/lignetel.class.php | 971 --------- htdocs/telephonie/pdf/index.php | 0 .../pdf/pdfdetail_nodet.modules.php | 576 ----- .../pdf/pdfdetail_papier.modules.php | 444 ---- .../pdf/pdfdetail_papier1.modules.php | 411 ---- .../pdf/pdfdetail_standard.modeles.php | 153 -- .../pdf/pdfdetail_standard.modules.php | 496 ----- .../pdf/xlsdetail_nodet.modules.php | 116 - htdocs/telephonie/pre.inc.php | 87 - htdocs/telephonie/script/affect-id-ligne.php | 102 - htdocs/telephonie/script/analyse-traffic.php | 112 - htdocs/telephonie/script/api/index.php | 0 .../script/api/presel-activation-manuelle.php | 146 -- .../api/presel-resiliation-manuelle.php | 146 -- .../script/api/presel-resiliation.php | 188 -- htdocs/telephonie/script/api/presel-view.php | 199 -- htdocs/telephonie/script/bascule.php | 100 - htdocs/telephonie/script/commande_presel.php | 369 ---- .../script/commande_presel_statut.php | 326 --- .../script/commande_presel_statut_view.php | 151 -- htdocs/telephonie/script/commission.php | 653 ------ htdocs/telephonie/script/cron/index.php | 0 .../script/cron/presel-resiliation.php | 194 -- htdocs/telephonie/script/delete_presel.php | 186 -- .../script/envoi-emails-speciaux.php | 283 --- .../telephonie/script/etude-facturation.php | 102 - .../telephonie/script/facturation-alerte.php | 322 --- .../telephonie/script/facturation-analyse.php | 244 --- .../telephonie/script/facturation-calcul.php | 548 ----- .../script/facturation-consolidation.php | 299 --- .../script/facturation-correction-import.php | 58 - .../script/facturation-details-tableur.php | 172 -- .../telephonie/script/facturation-details.php | 152 -- .../script/facturation-emission.php | 1015 --------- .../script/facturation-import-cdr.php | 289 --- .../script/facturation-impression.php | 235 -- .../script/facturation-pre-consolidation.php | 60 - .../telephonie/script/facturation-verif.php | 105 - .../facture-detail-tableur-one.class.php | 157 -- .../facture-detail-tableur-two.class.php | 149 -- htdocs/telephonie/script/getcdr.php | 180 -- htdocs/telephonie/script/graph-contrat.php | 32 - .../script/graph-statistiques-analyse.php | 697 ------ .../script/graph-statistiques-ca.php | 335 --- .../script/graph-statistiques-clients.php | 74 - .../script/graph-statistiques-commerciaux.php | 237 -- .../graph-statistiques-communications.php | 160 -- .../script/graph-statistiques-contrats.php | 77 - .../script/graph-statistiques-destination.php | 79 - .../graph-statistiques-distributeurs.php | 208 -- .../graph-statistiques-fournisseurs.php | 189 -- .../script/graph-statistiques-lignes.php | 96 - .../script/graph-statistiques-makedir.php | 261 --- .../script/graph-statistiques-tempsreels.php | 127 -- .../script/graph-statistiques-test.php | 63 - .../script/graph-statistiques-week.php | 253 --- .../telephonie/script/graph-statistiques.php | 507 ----- htdocs/telephonie/script/import-cdr-bt.php | 433 ---- htdocs/telephonie/script/import-cdr-ftp.php | 437 ---- htdocs/telephonie/script/import-cdr.php | 291 --- .../telephonie/script/import-rename-cdr.php | 97 - htdocs/telephonie/script/index.php | 0 htdocs/telephonie/script/lignes-resiliees.php | 159 -- htdocs/telephonie/script/pdfdetail.php | 78 - htdocs/telephonie/script/plan-facturation.php | 186 -- .../telephonie/script/presel_active_view.php | 199 -- htdocs/telephonie/script/presel_view.php | 157 -- htdocs/telephonie/script/rapport.php | 1038 --------- .../telephonie/script/recap-commande-week.php | 259 --- htdocs/telephonie/script/recap-commande.php | 263 --- htdocs/telephonie/script/retour-check.php | 145 -- .../telephonie/script/retour-traitement.php | 240 -- htdocs/telephonie/script/retour.php | 155 -- htdocs/telephonie/script/simulation.php | 134 -- .../script/tarifs-commerciaux-grille.php | 59 - .../tools/correction-tarifs-clients.php | 168 -- .../script/tools/export-adsl-actives.php | 81 - .../script/tools/export-comms-client52.php | 88 - .../export-communications-temporaires.php | 84 - .../script/tools/export-recap-client52.php | 91 - .../script/tools/graph-conso-jour.php | 109 - htdocs/telephonie/script/tools/index.php | 0 .../telephonie/script/tools/permissions.php | 158 -- .../script/tools/recalcul-facture.php | 164 -- .../tools/search-line-reject-with-traffic.php | 139 -- .../script/tools/search-line-wo-traffic.php | 69 - .../script/tools/tarif-copie_grille.php | 74 - .../script/tools/tarifs-clients-copy.php | 127 -- .../script/tools/update-contrat-contact.php | 103 - .../tools/verif-contrat-contact-services.php | 91 - .../script/tools/verif-ligne-attente.php | 108 - htdocs/telephonie/script/tools/viper.hook.php | 240 -- .../script/update-contrat-statut.php | 63 - htdocs/telephonie/script/update_presel.php | 184 -- htdocs/telephonie/script/verif-import-cdr.php | 67 - htdocs/telephonie/service/contrats.php | 170 -- htdocs/telephonie/service/fiche.php | 252 --- htdocs/telephonie/service/index.php | 87 - htdocs/telephonie/service/liste.php | 121 - .../modules/ServiceFactureTableur.class.php | 191 -- htdocs/telephonie/service/modules/index.php | 0 htdocs/telephonie/service/pre.inc.php | 65 - htdocs/telephonie/service/vendus.php | 182 -- htdocs/telephonie/showfacture.php | 37 - htdocs/telephonie/showgraph.php | 34 - htdocs/telephonie/sql/Makefile | 30 - htdocs/telephonie/sql/data/data.sql | 4 - htdocs/telephonie/sql/data/index.php | 0 htdocs/telephonie/sql/index.php | 0 htdocs/telephonie/sql/llx_societe_consult.sql | 31 - htdocs/telephonie/sql/llx_societe_perms.sql | 31 - .../llx_telephonie_adsl_fournisseur.key.sql | 30 - .../sql/llx_telephonie_adsl_fournisseur.sql | 29 - .../sql/llx_telephonie_adsl_ligne.sql | 40 - .../sql/llx_telephonie_adsl_ligne_statut.sql | 36 - .../sql/llx_telephonie_adsl_type.sql | 29 - .../sql/llx_telephonie_alertecounter.sql | 28 - .../llx_telephonie_analyse_fournisseur.sql | 32 - .../sql/llx_telephonie_client_presta.sql | 37 - .../sql/llx_telephonie_client_remise.sql | 35 - .../sql/llx_telephonie_client_statistique.sql | 32 - .../sql/llx_telephonie_client_stats.key.sql | 26 - .../sql/llx_telephonie_client_stats.sql | 34 - .../llx_telephonie_client_stats_mensuel.sql | 36 - .../sql/llx_telephonie_commande.key.sql | 27 - .../sql/llx_telephonie_commande.sql | 31 - .../sql/llx_telephonie_commande_ligne.key.sql | 27 - .../sql/llx_telephonie_commande_ligne.sql | 28 - .../sql/llx_telephonie_commande_retour.sql | 37 - .../sql/llx_telephonie_commission.sql | 29 - .../sql/llx_telephonie_commission_avance.sql | 35 - .../sql/llx_telephonie_commission_conso.sql | 36 - .../sql/llx_telephonie_commission_detail.sql | 32 - .../sql/llx_telephonie_commission_regul.sql | 31 - .../llx_telephonie_communications_details.sql | 54 - .../sql/llx_telephonie_concurrents.sql | 28 - .../llx_telephonie_contact_facture.key.sql | 10 - .../sql/llx_telephonie_contact_facture.sql | 34 - .../telephonie/sql/llx_telephonie_contrat.sql | 51 - .../sql/llx_telephonie_contrat_consult.sql | 29 - ...llx_telephonie_contrat_contact_facture.sql | 35 - .../sql/llx_telephonie_contrat_priseordre.sql | 40 - .../sql/llx_telephonie_contrat_service.sql | 36 - .../sql/llx_telephonie_distributeur.sql | 35 - ...elephonie_distributeur_commerciaux.key.sql | 35 - ...lx_telephonie_distributeur_commerciaux.sql | 28 - ...lx_telephonie_distributeur_responsable.sql | 28 - .../sql/llx_telephonie_facturation_batch.sql | 32 - .../sql/llx_telephonie_facture.key.sql | 32 - .../telephonie/sql/llx_telephonie_facture.sql | 43 - .../sql/llx_telephonie_facture_consol.key.sql | 32 - .../sql/llx_telephonie_facture_consol.sql | 58 - .../sql/llx_telephonie_fournisseur.sql | 36 - .../sql/llx_telephonie_fournisseur_consol.sql | 33 - .../sql/llx_telephonie_groupe_ligne.key.sql | 37 - .../sql/llx_telephonie_groupe_ligne.sql | 35 - .../sql/llx_telephonie_groupeligne.sql | 32 - .../sql/llx_telephonie_import_cdr.sql | 41 - .../sql/llx_telephonie_ligne_statistique.sql | 12 - .../sql/llx_telephonie_prefix.key.sql | 26 - .../telephonie/sql/llx_telephonie_prefix.sql | 31 - .../telephonie/sql/llx_telephonie_service.sql | 40 - .../telephonie/sql/llx_telephonie_simul.sql | 30 - .../sql/llx_telephonie_simul_comm.sql | 39 - .../llx_telephonie_societe_commentaire.sql | 33 - .../sql/llx_telephonie_societe_fournid.sql | 34 - .../sql/llx_telephonie_societe_ligne.key.sql | 47 - .../sql/llx_telephonie_societe_ligne.sql | 63 - .../llx_telephonie_societe_ligne_comments.sql | 34 - .../llx_telephonie_societe_ligne_remise.sql | 35 - ...lx_telephonie_societe_ligne_statut.key.sql | 27 - .../llx_telephonie_societe_ligne_statut.sql | 41 - .../sql/llx_telephonie_societe_options.sql | 35 - .../telephonie/sql/llx_telephonie_stats.sql | 34 - .../sql/llx_telephonie_stats_destination.sql | 32 - .../telephonie/sql/llx_telephonie_tarif.sql | 35 - .../sql/llx_telephonie_tarif_client.key.sql | 31 - .../sql/llx_telephonie_tarif_client.sql | 33 - .../sql/llx_telephonie_tarif_client_log.sql | 32 - .../llx_telephonie_tarif_fournisseur.key.sql | 29 - .../sql/llx_telephonie_tarif_fournisseur.sql | 32 - .../sql/llx_telephonie_tarif_grille.sql | 29 - ...lx_telephonie_tarif_grille_commerciaux.sql | 29 - .../llx_telephonie_tarif_grille_rights.sql | 33 - .../sql/llx_telephonie_tarif_montant.key.sql | 28 - .../sql/llx_telephonie_tarif_montant.sql | 41 - .../sql/llx_telephonie_tarif_montant_log.sql | 33 - .../sql/llx_telephonie_workflow.sql | 33 - htdocs/telephonie/sql/llx_vtiger_users.sql | 30 - .../stats/ProcessGraphClients.class.php | 176 -- .../stats/ProcessGraphContrats.class.php | 215 -- .../stats/ProcessGraphLignes.class.php | 218 -- htdocs/telephonie/stats/clients/alerte.php | 132 -- .../stats/clients/clients.month.class.php | 165 -- .../stats/clients/clients.week.class.php | 185 -- .../clients/clientsmoyenne.week.class.php | 169 -- htdocs/telephonie/stats/clients/gain.php | 118 - htdocs/telephonie/stats/clients/index.php | 133 -- htdocs/telephonie/stats/clients/pre.inc.php | 42 - htdocs/telephonie/stats/commerciaux/ca.php | 122 -- .../stats/commerciaux/commercial.ca.class.php | 113 - .../commerciaux/commercial.gain.class.php | 111 - .../stats/commerciaux/commercial.php | 128 -- .../stats/commerciaux/commercial.po.class.php | 66 - .../stats/commerciaux/commercialca.php | 141 -- .../stats/commerciaux/commercialpo.php | 162 -- .../commerciaux/commerciaux.po.class.php | 170 -- .../stats/commerciaux/contrats.class.php | 93 - .../telephonie/stats/commerciaux/contrats.php | 70 - .../commerciaux/groupes/groupe.ca.class.php | 105 - .../commerciaux/groupes/groupe.gain.class.php | 105 - .../stats/commerciaux/groupes/groupe.php | 150 -- .../stats/commerciaux/groupes/pre.inc.php | 42 - htdocs/telephonie/stats/commerciaux/index.php | 172 -- .../telephonie/stats/commerciaux/lignes.php | 75 - .../telephonie/stats/commerciaux/mensuel.php | 128 -- .../telephonie/stats/commerciaux/pre.inc.php | 43 - .../stats/communications/analyse.php | 84 - .../stats/communications/destmonth.php | 114 - .../telephonie/stats/communications/index.php | 132 -- .../stats/communications/lastmonth.php | 112 - .../stats/communications/pre.inc.php | 42 - .../stats/communications/rentabilite.php | 118 - .../telephonie/stats/consultation/index.php | 94 - .../telephonie/stats/consultation/onglets.php | 34 - .../telephonie/stats/consultation/pre.inc.php | 42 - htdocs/telephonie/stats/contrats/index.php | 90 - .../stats/contrats/modereglement.class.php | 76 - htdocs/telephonie/stats/contrats/onglets.php | 34 - htdocs/telephonie/stats/contrats/pre.inc.php | 42 - .../telephonie/stats/destinations/index.php | 104 - .../telephonie/stats/destinations/pre.inc.php | 42 - .../stats/distributeurs/commercial.php | 124 -- .../stats/distributeurs/commercialca.php | 84 - .../distributeurs/distributeur.ca.class.php | 146 -- .../distributeur.commission.class.php | 128 -- .../distributeurs/distributeur.gain.class.php | 140 -- .../stats/distributeurs/distributeur.php | 217 -- .../distributeur.po.month.class.php | 83 - .../distributeur.resultat.class.php | 135 -- .../telephonie/stats/distributeurs/index.php | 147 -- .../telephonie/stats/distributeurs/lignes.php | 75 - .../stats/distributeurs/pre.inc.php | 43 - .../stats/distributeurs/resultats.php | 194 -- htdocs/telephonie/stats/factures/gain.php | 78 - htdocs/telephonie/stats/factures/index.php | 124 -- .../telephonie/stats/factures/lastmonth.php | 103 - htdocs/telephonie/stats/factures/marge.php | 84 - htdocs/telephonie/stats/factures/pre.inc.php | 39 - htdocs/telephonie/stats/factures/type.php | 119 - .../telephonie/stats/fournisseurs/index.php | 82 - .../telephonie/stats/fournisseurs/pre.inc.php | 43 - .../stats/graph/SimpleBar.class.php | 76 - .../stats/graph/appelsdureemoyenne.class.php | 126 -- htdocs/telephonie/stats/graph/bar.class.php | 131 -- .../telephonie/stats/graph/baracc.class.php | 105 - .../stats/graph/baraccumul.class.php | 174 -- .../telephonie/stats/graph/barmoy.class.php | 96 - .../telephonie/stats/graph/brouzouf.class.php | 78 - htdocs/telephonie/stats/graph/ca.class.php | 116 - .../stats/graph/camenbert.class.php | 83 - .../telephonie/stats/graph/camoyen.class.php | 136 -- .../stats/graph/comm.nbmensuel.class.php | 118 - .../stats/graph/comm.nbminutes.class.php | 116 - htdocs/telephonie/stats/graph/gain.class.php | 160 -- .../stats/graph/heureappel.class.php | 73 - htdocs/telephonie/stats/graph/index.php | 0 .../stats/graph/joursemaine.class.php | 74 - htdocs/telephonie/stats/graph/line.class.php | 99 - htdocs/telephonie/stats/graph/pie.class.php | 93 - htdocs/telephonie/stats/index.php | 61 - .../telephonie/stats/lignes/actives.class.php | 178 -- htdocs/telephonie/stats/lignes/commande.php | 62 - .../stats/lignes/commandes.class.php | 92 - .../stats/lignes/commandes.week.class.php | 185 -- htdocs/telephonie/stats/lignes/index.php | 57 - htdocs/telephonie/stats/lignes/onglets.php | 43 - htdocs/telephonie/stats/lignes/pre.inc.php | 42 - .../stats/lignes/rejet.week.class.php | 126 -- .../telephonie/stats/lignes/resiliation.php | 62 - .../stats/lignes/resiliation.week.class.php | 126 -- .../telephonie/stats/lignes/statut.class.php | 108 - htdocs/telephonie/stats/menus.php | 59 - htdocs/telephonie/stats/pre.inc.php | 43 - htdocs/telephonie/stats/tools.lib.php | 59 - .../telephonie/tarifs/config/data/index.php | 0 .../telephonie/tarifs/config/data/prefix.sql | 1938 ----------------- .../telephonie/tarifs/config/data/tarif.sql | 565 ----- htdocs/telephonie/tarifs/config/grille.php | 63 - htdocs/telephonie/tarifs/config/grilles.php | 172 -- htdocs/telephonie/tarifs/config/index.php | 173 -- .../telephonie/tarifs/config/permissions.php | 271 --- htdocs/telephonie/tarifs/config/pre.inc.php | 80 - htdocs/telephonie/tarifs/config/prefixs.php | 153 -- htdocs/telephonie/tarifs/config/tarif.php | 251 --- htdocs/telephonie/tarifs/config/tarifs.php | 121 - htdocs/telephonie/tarifs/fiche.php | 152 -- .../telephonie/tarifs/grille-export-achat.php | 239 -- htdocs/telephonie/tarifs/grille-export.php | 115 - htdocs/telephonie/tarifs/grille.php | 293 --- htdocs/telephonie/tarifs/grilles.php | 95 - htdocs/telephonie/tarifs/index.php | 173 -- htdocs/telephonie/tarifs/permissions.php | 271 --- htdocs/telephonie/tarifs/pre.inc.php | 77 - htdocs/telephonie/tarifs/prefix.php | 145 -- htdocs/telephonie/tarifs/tarif-log.php | 188 -- htdocs/telephonie/tarifs/tarif.php | 220 -- htdocs/telephonie/telephonie-tarif.class.php | 187 -- htdocs/telephonie/telephonie.client.class.php | 69 - .../telephonie.commercial.class.php | 115 - .../telephonie/telephonie.contrat.class.php | 653 ------ htdocs/telephonie/telephonie.css | 20 - .../telephonie/telephonie.service.class.php | 173 -- htdocs/telephonie/telephonie.tarif.class.php | 298 --- .../telephonie.tarif.grille.class.php | 426 ---- .../telephonie.tarif.prefix.class.php | 117 - htdocs/telephonie/workflowtel.class.php | 146 -- 494 files changed, 4 insertions(+), 69450 deletions(-) delete mode 100644 htdocs/energie/EnergieCompteur.class.php delete mode 100644 htdocs/energie/EnergieGroupe.class.php delete mode 100644 htdocs/energie/compteur.php delete mode 100644 htdocs/energie/compteur_graph.php delete mode 100644 htdocs/energie/compteur_groupe.php delete mode 100644 htdocs/energie/graph.php delete mode 100644 htdocs/energie/groupe.php delete mode 100644 htdocs/energie/index.php delete mode 100644 htdocs/energie/pre.inc.php delete mode 100644 htdocs/energie/releve.php delete mode 100644 htdocs/includes/modules/modEnergie.class.php delete mode 100644 htdocs/includes/modules/modTelephonie.class.php delete mode 100644 htdocs/telephonie/adsl/fiche.php delete mode 100644 htdocs/telephonie/adsl/fournisseurxdsl.class.php delete mode 100644 htdocs/telephonie/adsl/history.php delete mode 100644 htdocs/telephonie/adsl/index.php delete mode 100644 htdocs/telephonie/adsl/ligneadsl.class.php delete mode 100644 htdocs/telephonie/adsl/liste.php delete mode 100644 htdocs/telephonie/adsl/pre.inc.php delete mode 100644 htdocs/telephonie/adsl/productxdsl.class.php delete mode 100644 htdocs/telephonie/adsl/statut-1.png delete mode 100644 htdocs/telephonie/adsl/statut1.png delete mode 100644 htdocs/telephonie/adsl/statut2.png delete mode 100644 htdocs/telephonie/adsl/statut3.png delete mode 100644 htdocs/telephonie/adsl/statut4.png delete mode 100644 htdocs/telephonie/adsl/statut5.png delete mode 100644 htdocs/telephonie/adsl/statut6.png delete mode 100644 htdocs/telephonie/adsl/statut7.png delete mode 100644 htdocs/telephonie/adsl/statut8.png delete mode 100644 htdocs/telephonie/adsl/statut9.png delete mode 100644 htdocs/telephonie/ca/gain.php delete mode 100644 htdocs/telephonie/ca/index.php delete mode 100644 htdocs/telephonie/ca/pre.inc.php delete mode 100644 htdocs/telephonie/ca/ratiofourn.php delete mode 100644 htdocs/telephonie/client/commentaires.php delete mode 100644 htdocs/telephonie/client/contacts.php delete mode 100644 htdocs/telephonie/client/facture.php delete mode 100644 htdocs/telephonie/client/factures.php delete mode 100644 htdocs/telephonie/client/fiche.php delete mode 100644 htdocs/telephonie/client/index.php delete mode 100644 htdocs/telephonie/client/lignes.php delete mode 100644 htdocs/telephonie/client/liste.php delete mode 100644 htdocs/telephonie/client/my.php delete mode 100644 htdocs/telephonie/client/new.php delete mode 100644 htdocs/telephonie/client/permissions.php delete mode 100644 htdocs/telephonie/client/pre.inc.php delete mode 100644 htdocs/telephonie/client/remises.php delete mode 100644 htdocs/telephonie/client/remisesdone.php delete mode 100644 htdocs/telephonie/client/stats.php delete mode 100644 htdocs/telephonie/client/tarifs.php delete mode 100644 htdocs/telephonie/communication.class.php delete mode 100644 htdocs/telephonie/config/compta.php delete mode 100644 htdocs/telephonie/config/concurrents/index.php delete mode 100644 htdocs/telephonie/config/concurrents/liste.php delete mode 100644 htdocs/telephonie/config/concurrents/pre.inc.php delete mode 100644 htdocs/telephonie/config/index.php delete mode 100644 htdocs/telephonie/config/mail.php delete mode 100644 htdocs/telephonie/config/perms.php delete mode 100644 htdocs/telephonie/config/pre.inc.php delete mode 100644 htdocs/telephonie/config/xdsl.php delete mode 100644 htdocs/telephonie/config/xdsl_product.php delete mode 100644 htdocs/telephonie/config/xdsl_wkf.php delete mode 100644 htdocs/telephonie/contrat/fiche.php delete mode 100644 htdocs/telephonie/contrat/index.php delete mode 100644 htdocs/telephonie/contrat/info.php delete mode 100644 htdocs/telephonie/contrat/liste.php delete mode 100644 htdocs/telephonie/contrat/pre.inc.php delete mode 100644 htdocs/telephonie/contrat/services.php delete mode 100644 htdocs/telephonie/contrat/stats.php delete mode 100644 htdocs/telephonie/contrat/statut0.png delete mode 100644 htdocs/telephonie/contrat/statut1.png delete mode 100644 htdocs/telephonie/contrat/statut2.png delete mode 100644 htdocs/telephonie/contrat/statut3.png delete mode 100644 htdocs/telephonie/contrat/statut4.png delete mode 100644 htdocs/telephonie/contrat/statut5.png delete mode 100644 htdocs/telephonie/contrat/statut6.png delete mode 100644 htdocs/telephonie/contrat/statut7.png delete mode 100644 htdocs/telephonie/distributeurs/comm/ca.php delete mode 100644 htdocs/telephonie/distributeurs/comm/commercial.php delete mode 100644 htdocs/telephonie/distributeurs/comm/index.php delete mode 100644 htdocs/telephonie/distributeurs/comm/pre.inc.php delete mode 100644 htdocs/telephonie/distributeurs/commissions.php delete mode 100644 htdocs/telephonie/distributeurs/contrat.php delete mode 100644 htdocs/telephonie/distributeurs/distributeur.php delete mode 100644 htdocs/telephonie/distributeurs/fiche.php delete mode 100644 htdocs/telephonie/distributeurs/index.php delete mode 100644 htdocs/telephonie/distributeurs/po.php delete mode 100644 htdocs/telephonie/distributeurs/pre.inc.php delete mode 100644 htdocs/telephonie/distributeurs/remav.php delete mode 100644 htdocs/telephonie/distributeurs/remconso.php delete mode 100644 htdocs/telephonie/distributeurs/remuneration.php delete mode 100644 htdocs/telephonie/distributeurs/stats.php delete mode 100644 htdocs/telephonie/distributeurtel.class.php delete mode 100644 htdocs/telephonie/dolibarrmail.class.php delete mode 100644 htdocs/telephonie/facturation/FacturationCalcul.class.php delete mode 100644 htdocs/telephonie/facturation/FacturationEmission.class.php delete mode 100644 htdocs/telephonie/facturation/FacturationImportCdr.class.php delete mode 100644 htdocs/telephonie/facturation/FacturationVerifCdr.class.php delete mode 100644 htdocs/telephonie/facturation/batch.php delete mode 100644 htdocs/telephonie/facturation/calcul.php delete mode 100644 htdocs/telephonie/facturation/cdr-import.php delete mode 100644 htdocs/telephonie/facturation/cdr.php delete mode 100644 htdocs/telephonie/facturation/emission.php delete mode 100644 htdocs/telephonie/facturation/facture.php delete mode 100644 htdocs/telephonie/facturation/files.php delete mode 100644 htdocs/telephonie/facturation/index.php delete mode 100644 htdocs/telephonie/facturation/pre.inc.php delete mode 100644 htdocs/telephonie/facturation/stats.php delete mode 100644 htdocs/telephonie/facture/index.php delete mode 100644 htdocs/telephonie/facture/liste.php delete mode 100644 htdocs/telephonie/facture/pre.inc.php delete mode 100644 htdocs/telephonie/facturetel.class.php delete mode 100644 htdocs/telephonie/fournisseur/cdrformat/cdrformat.fructidor.class.php delete mode 100644 htdocs/telephonie/fournisseur/cdrformat/cdrformat.messidor.class.php delete mode 100644 htdocs/telephonie/fournisseur/cdrformat/index.php delete mode 100644 htdocs/telephonie/fournisseur/commande/commande.tableur.class.php delete mode 100644 htdocs/telephonie/fournisseur/commande/commande.text.class.php delete mode 100644 htdocs/telephonie/fournisseur/commande/commande.textp.class.php delete mode 100644 htdocs/telephonie/fournisseur/commande/commande.web.class.php delete mode 100644 htdocs/telephonie/fournisseur/commande/index.php delete mode 100644 htdocs/telephonie/fournisseur/commande/methode.commande.class.php delete mode 100644 htdocs/telephonie/fournisseur/fiche.php delete mode 100644 htdocs/telephonie/fournisseur/index.php delete mode 100644 htdocs/telephonie/fournisseur/pre.inc.php delete mode 100644 htdocs/telephonie/fournisseurtel.class.php delete mode 100644 htdocs/telephonie/graph-1.png delete mode 100644 htdocs/telephonie/graph1.png delete mode 100644 htdocs/telephonie/graph2.png delete mode 100644 htdocs/telephonie/graph3.png delete mode 100644 htdocs/telephonie/graph4.png delete mode 100644 htdocs/telephonie/graph5.png delete mode 100644 htdocs/telephonie/graph6.png delete mode 100644 htdocs/telephonie/graph7.png delete mode 100644 htdocs/telephonie/graph8.png delete mode 100644 htdocs/telephonie/index.php delete mode 100644 htdocs/telephonie/interdit.png delete mode 100644 htdocs/telephonie/ligne/commande.php delete mode 100644 htdocs/telephonie/ligne/commande/archives.php delete mode 100644 htdocs/telephonie/ligne/commande/commandetableur.class.php delete mode 100644 htdocs/telephonie/ligne/commande/fiche.php delete mode 100644 htdocs/telephonie/ligne/commande/historique.php delete mode 100644 htdocs/telephonie/ligne/commande/index.php delete mode 100644 htdocs/telephonie/ligne/commande/liste.php delete mode 100644 htdocs/telephonie/ligne/commande/pre.inc.php delete mode 100644 htdocs/telephonie/ligne/commande/retour/atraiter.php delete mode 100644 htdocs/telephonie/ligne/commande/retour/fichiers.php delete mode 100644 htdocs/telephonie/ligne/commande/retour/index.php delete mode 100644 htdocs/telephonie/ligne/commande/retour/liste.php delete mode 100644 htdocs/telephonie/ligne/commande/retour/pre.inc.php delete mode 100644 htdocs/telephonie/ligne/commentaires.php delete mode 100644 htdocs/telephonie/ligne/communications.php delete mode 100644 htdocs/telephonie/ligne/conso.php delete mode 100644 htdocs/telephonie/ligne/factures.php delete mode 100644 htdocs/telephonie/ligne/fiche.php delete mode 100644 htdocs/telephonie/ligne/graph-1.png delete mode 100644 htdocs/telephonie/ligne/graph1.png delete mode 100644 htdocs/telephonie/ligne/graph2.png delete mode 100644 htdocs/telephonie/ligne/graph3.png delete mode 100644 htdocs/telephonie/ligne/graph4.png delete mode 100644 htdocs/telephonie/ligne/graph5.png delete mode 100644 htdocs/telephonie/ligne/graph6.png delete mode 100644 htdocs/telephonie/ligne/graph7.png delete mode 100644 htdocs/telephonie/ligne/graph8.png delete mode 100644 htdocs/telephonie/ligne/graph9.png delete mode 100644 htdocs/telephonie/ligne/groupe.php delete mode 100644 htdocs/telephonie/ligne/history.php delete mode 100644 htdocs/telephonie/ligne/index.php delete mode 100644 htdocs/telephonie/ligne/infoc.php delete mode 100644 htdocs/telephonie/ligne/liste.php delete mode 100644 htdocs/telephonie/ligne/listecommande.php delete mode 100644 htdocs/telephonie/ligne/numdata.php delete mode 100644 htdocs/telephonie/ligne/pre.inc.php delete mode 100644 htdocs/telephonie/ligne/remises.php delete mode 100644 htdocs/telephonie/ligne/stat.php delete mode 100644 htdocs/telephonie/lignetel.class.php delete mode 100644 htdocs/telephonie/pdf/index.php delete mode 100644 htdocs/telephonie/pdf/pdfdetail_nodet.modules.php delete mode 100644 htdocs/telephonie/pdf/pdfdetail_papier.modules.php delete mode 100644 htdocs/telephonie/pdf/pdfdetail_papier1.modules.php delete mode 100644 htdocs/telephonie/pdf/pdfdetail_standard.modeles.php delete mode 100644 htdocs/telephonie/pdf/pdfdetail_standard.modules.php delete mode 100644 htdocs/telephonie/pdf/xlsdetail_nodet.modules.php delete mode 100644 htdocs/telephonie/pre.inc.php delete mode 100644 htdocs/telephonie/script/affect-id-ligne.php delete mode 100644 htdocs/telephonie/script/analyse-traffic.php delete mode 100644 htdocs/telephonie/script/api/index.php delete mode 100644 htdocs/telephonie/script/api/presel-activation-manuelle.php delete mode 100644 htdocs/telephonie/script/api/presel-resiliation-manuelle.php delete mode 100644 htdocs/telephonie/script/api/presel-resiliation.php delete mode 100644 htdocs/telephonie/script/api/presel-view.php delete mode 100644 htdocs/telephonie/script/bascule.php delete mode 100644 htdocs/telephonie/script/commande_presel.php delete mode 100644 htdocs/telephonie/script/commande_presel_statut.php delete mode 100644 htdocs/telephonie/script/commande_presel_statut_view.php delete mode 100644 htdocs/telephonie/script/commission.php delete mode 100644 htdocs/telephonie/script/cron/index.php delete mode 100644 htdocs/telephonie/script/cron/presel-resiliation.php delete mode 100644 htdocs/telephonie/script/delete_presel.php delete mode 100644 htdocs/telephonie/script/envoi-emails-speciaux.php delete mode 100644 htdocs/telephonie/script/etude-facturation.php delete mode 100644 htdocs/telephonie/script/facturation-alerte.php delete mode 100644 htdocs/telephonie/script/facturation-analyse.php delete mode 100644 htdocs/telephonie/script/facturation-calcul.php delete mode 100644 htdocs/telephonie/script/facturation-consolidation.php delete mode 100644 htdocs/telephonie/script/facturation-correction-import.php delete mode 100644 htdocs/telephonie/script/facturation-details-tableur.php delete mode 100644 htdocs/telephonie/script/facturation-details.php delete mode 100644 htdocs/telephonie/script/facturation-emission.php delete mode 100644 htdocs/telephonie/script/facturation-import-cdr.php delete mode 100644 htdocs/telephonie/script/facturation-impression.php delete mode 100644 htdocs/telephonie/script/facturation-pre-consolidation.php delete mode 100644 htdocs/telephonie/script/facturation-verif.php delete mode 100644 htdocs/telephonie/script/facture-detail-tableur-one.class.php delete mode 100644 htdocs/telephonie/script/facture-detail-tableur-two.class.php delete mode 100644 htdocs/telephonie/script/getcdr.php delete mode 100644 htdocs/telephonie/script/graph-contrat.php delete mode 100644 htdocs/telephonie/script/graph-statistiques-analyse.php delete mode 100644 htdocs/telephonie/script/graph-statistiques-ca.php delete mode 100644 htdocs/telephonie/script/graph-statistiques-clients.php delete mode 100644 htdocs/telephonie/script/graph-statistiques-commerciaux.php delete mode 100644 htdocs/telephonie/script/graph-statistiques-communications.php delete mode 100644 htdocs/telephonie/script/graph-statistiques-contrats.php delete mode 100644 htdocs/telephonie/script/graph-statistiques-destination.php delete mode 100644 htdocs/telephonie/script/graph-statistiques-distributeurs.php delete mode 100644 htdocs/telephonie/script/graph-statistiques-fournisseurs.php delete mode 100644 htdocs/telephonie/script/graph-statistiques-lignes.php delete mode 100644 htdocs/telephonie/script/graph-statistiques-makedir.php delete mode 100644 htdocs/telephonie/script/graph-statistiques-tempsreels.php delete mode 100644 htdocs/telephonie/script/graph-statistiques-test.php delete mode 100644 htdocs/telephonie/script/graph-statistiques-week.php delete mode 100644 htdocs/telephonie/script/graph-statistiques.php delete mode 100644 htdocs/telephonie/script/import-cdr-bt.php delete mode 100644 htdocs/telephonie/script/import-cdr-ftp.php delete mode 100644 htdocs/telephonie/script/import-cdr.php delete mode 100644 htdocs/telephonie/script/import-rename-cdr.php delete mode 100644 htdocs/telephonie/script/index.php delete mode 100644 htdocs/telephonie/script/lignes-resiliees.php delete mode 100644 htdocs/telephonie/script/pdfdetail.php delete mode 100644 htdocs/telephonie/script/plan-facturation.php delete mode 100644 htdocs/telephonie/script/presel_active_view.php delete mode 100644 htdocs/telephonie/script/presel_view.php delete mode 100644 htdocs/telephonie/script/rapport.php delete mode 100644 htdocs/telephonie/script/recap-commande-week.php delete mode 100644 htdocs/telephonie/script/recap-commande.php delete mode 100644 htdocs/telephonie/script/retour-check.php delete mode 100644 htdocs/telephonie/script/retour-traitement.php delete mode 100644 htdocs/telephonie/script/retour.php delete mode 100644 htdocs/telephonie/script/simulation.php delete mode 100644 htdocs/telephonie/script/tarifs-commerciaux-grille.php delete mode 100644 htdocs/telephonie/script/tools/correction-tarifs-clients.php delete mode 100644 htdocs/telephonie/script/tools/export-adsl-actives.php delete mode 100644 htdocs/telephonie/script/tools/export-comms-client52.php delete mode 100644 htdocs/telephonie/script/tools/export-communications-temporaires.php delete mode 100644 htdocs/telephonie/script/tools/export-recap-client52.php delete mode 100644 htdocs/telephonie/script/tools/graph-conso-jour.php delete mode 100644 htdocs/telephonie/script/tools/index.php delete mode 100644 htdocs/telephonie/script/tools/permissions.php delete mode 100644 htdocs/telephonie/script/tools/recalcul-facture.php delete mode 100644 htdocs/telephonie/script/tools/search-line-reject-with-traffic.php delete mode 100644 htdocs/telephonie/script/tools/search-line-wo-traffic.php delete mode 100644 htdocs/telephonie/script/tools/tarif-copie_grille.php delete mode 100644 htdocs/telephonie/script/tools/tarifs-clients-copy.php delete mode 100644 htdocs/telephonie/script/tools/update-contrat-contact.php delete mode 100644 htdocs/telephonie/script/tools/verif-contrat-contact-services.php delete mode 100644 htdocs/telephonie/script/tools/verif-ligne-attente.php delete mode 100644 htdocs/telephonie/script/tools/viper.hook.php delete mode 100644 htdocs/telephonie/script/update-contrat-statut.php delete mode 100644 htdocs/telephonie/script/update_presel.php delete mode 100644 htdocs/telephonie/script/verif-import-cdr.php delete mode 100644 htdocs/telephonie/service/contrats.php delete mode 100644 htdocs/telephonie/service/fiche.php delete mode 100644 htdocs/telephonie/service/index.php delete mode 100644 htdocs/telephonie/service/liste.php delete mode 100644 htdocs/telephonie/service/modules/ServiceFactureTableur.class.php delete mode 100644 htdocs/telephonie/service/modules/index.php delete mode 100644 htdocs/telephonie/service/pre.inc.php delete mode 100644 htdocs/telephonie/service/vendus.php delete mode 100644 htdocs/telephonie/showfacture.php delete mode 100644 htdocs/telephonie/showgraph.php delete mode 100644 htdocs/telephonie/sql/Makefile delete mode 100644 htdocs/telephonie/sql/data/data.sql delete mode 100644 htdocs/telephonie/sql/data/index.php delete mode 100644 htdocs/telephonie/sql/index.php delete mode 100644 htdocs/telephonie/sql/llx_societe_consult.sql delete mode 100644 htdocs/telephonie/sql/llx_societe_perms.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_adsl_fournisseur.key.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_adsl_fournisseur.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_adsl_ligne.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_adsl_ligne_statut.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_adsl_type.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_alertecounter.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_analyse_fournisseur.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_client_presta.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_client_remise.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_client_statistique.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_client_stats.key.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_client_stats.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_client_stats_mensuel.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_commande.key.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_commande.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_commande_ligne.key.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_commande_ligne.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_commande_retour.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_commission.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_commission_avance.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_commission_conso.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_commission_detail.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_commission_regul.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_communications_details.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_concurrents.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_contact_facture.key.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_contact_facture.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_contrat.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_contrat_consult.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_contrat_contact_facture.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_contrat_priseordre.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_contrat_service.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_distributeur.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_distributeur_commerciaux.key.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_distributeur_commerciaux.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_distributeur_responsable.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_facturation_batch.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_facture.key.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_facture.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_facture_consol.key.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_facture_consol.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_fournisseur.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_fournisseur_consol.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_groupe_ligne.key.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_groupe_ligne.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_groupeligne.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_import_cdr.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_ligne_statistique.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_prefix.key.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_prefix.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_service.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_simul.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_simul_comm.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_societe_commentaire.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_societe_fournid.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_societe_ligne.key.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_societe_ligne.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_societe_ligne_comments.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_societe_ligne_remise.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_societe_ligne_statut.key.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_societe_ligne_statut.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_societe_options.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_stats.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_stats_destination.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_tarif.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_tarif_client.key.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_tarif_client.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_tarif_client_log.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_tarif_fournisseur.key.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_tarif_fournisseur.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_tarif_grille.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_tarif_grille_commerciaux.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_tarif_grille_rights.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_tarif_montant.key.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_tarif_montant.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_tarif_montant_log.sql delete mode 100644 htdocs/telephonie/sql/llx_telephonie_workflow.sql delete mode 100644 htdocs/telephonie/sql/llx_vtiger_users.sql delete mode 100644 htdocs/telephonie/stats/ProcessGraphClients.class.php delete mode 100644 htdocs/telephonie/stats/ProcessGraphContrats.class.php delete mode 100644 htdocs/telephonie/stats/ProcessGraphLignes.class.php delete mode 100644 htdocs/telephonie/stats/clients/alerte.php delete mode 100644 htdocs/telephonie/stats/clients/clients.month.class.php delete mode 100644 htdocs/telephonie/stats/clients/clients.week.class.php delete mode 100644 htdocs/telephonie/stats/clients/clientsmoyenne.week.class.php delete mode 100644 htdocs/telephonie/stats/clients/gain.php delete mode 100644 htdocs/telephonie/stats/clients/index.php delete mode 100644 htdocs/telephonie/stats/clients/pre.inc.php delete mode 100644 htdocs/telephonie/stats/commerciaux/ca.php delete mode 100644 htdocs/telephonie/stats/commerciaux/commercial.ca.class.php delete mode 100644 htdocs/telephonie/stats/commerciaux/commercial.gain.class.php delete mode 100644 htdocs/telephonie/stats/commerciaux/commercial.php delete mode 100644 htdocs/telephonie/stats/commerciaux/commercial.po.class.php delete mode 100644 htdocs/telephonie/stats/commerciaux/commercialca.php delete mode 100644 htdocs/telephonie/stats/commerciaux/commercialpo.php delete mode 100644 htdocs/telephonie/stats/commerciaux/commerciaux.po.class.php delete mode 100644 htdocs/telephonie/stats/commerciaux/contrats.class.php delete mode 100644 htdocs/telephonie/stats/commerciaux/contrats.php delete mode 100644 htdocs/telephonie/stats/commerciaux/groupes/groupe.ca.class.php delete mode 100644 htdocs/telephonie/stats/commerciaux/groupes/groupe.gain.class.php delete mode 100644 htdocs/telephonie/stats/commerciaux/groupes/groupe.php delete mode 100644 htdocs/telephonie/stats/commerciaux/groupes/pre.inc.php delete mode 100644 htdocs/telephonie/stats/commerciaux/index.php delete mode 100644 htdocs/telephonie/stats/commerciaux/lignes.php delete mode 100644 htdocs/telephonie/stats/commerciaux/mensuel.php delete mode 100644 htdocs/telephonie/stats/commerciaux/pre.inc.php delete mode 100644 htdocs/telephonie/stats/communications/analyse.php delete mode 100644 htdocs/telephonie/stats/communications/destmonth.php delete mode 100644 htdocs/telephonie/stats/communications/index.php delete mode 100644 htdocs/telephonie/stats/communications/lastmonth.php delete mode 100644 htdocs/telephonie/stats/communications/pre.inc.php delete mode 100644 htdocs/telephonie/stats/communications/rentabilite.php delete mode 100644 htdocs/telephonie/stats/consultation/index.php delete mode 100644 htdocs/telephonie/stats/consultation/onglets.php delete mode 100644 htdocs/telephonie/stats/consultation/pre.inc.php delete mode 100644 htdocs/telephonie/stats/contrats/index.php delete mode 100644 htdocs/telephonie/stats/contrats/modereglement.class.php delete mode 100644 htdocs/telephonie/stats/contrats/onglets.php delete mode 100644 htdocs/telephonie/stats/contrats/pre.inc.php delete mode 100644 htdocs/telephonie/stats/destinations/index.php delete mode 100644 htdocs/telephonie/stats/destinations/pre.inc.php delete mode 100644 htdocs/telephonie/stats/distributeurs/commercial.php delete mode 100644 htdocs/telephonie/stats/distributeurs/commercialca.php delete mode 100644 htdocs/telephonie/stats/distributeurs/distributeur.ca.class.php delete mode 100644 htdocs/telephonie/stats/distributeurs/distributeur.commission.class.php delete mode 100644 htdocs/telephonie/stats/distributeurs/distributeur.gain.class.php delete mode 100644 htdocs/telephonie/stats/distributeurs/distributeur.php delete mode 100644 htdocs/telephonie/stats/distributeurs/distributeur.po.month.class.php delete mode 100644 htdocs/telephonie/stats/distributeurs/distributeur.resultat.class.php delete mode 100644 htdocs/telephonie/stats/distributeurs/index.php delete mode 100644 htdocs/telephonie/stats/distributeurs/lignes.php delete mode 100644 htdocs/telephonie/stats/distributeurs/pre.inc.php delete mode 100644 htdocs/telephonie/stats/distributeurs/resultats.php delete mode 100644 htdocs/telephonie/stats/factures/gain.php delete mode 100644 htdocs/telephonie/stats/factures/index.php delete mode 100644 htdocs/telephonie/stats/factures/lastmonth.php delete mode 100644 htdocs/telephonie/stats/factures/marge.php delete mode 100644 htdocs/telephonie/stats/factures/pre.inc.php delete mode 100644 htdocs/telephonie/stats/factures/type.php delete mode 100644 htdocs/telephonie/stats/fournisseurs/index.php delete mode 100644 htdocs/telephonie/stats/fournisseurs/pre.inc.php delete mode 100644 htdocs/telephonie/stats/graph/SimpleBar.class.php delete mode 100644 htdocs/telephonie/stats/graph/appelsdureemoyenne.class.php delete mode 100644 htdocs/telephonie/stats/graph/bar.class.php delete mode 100644 htdocs/telephonie/stats/graph/baracc.class.php delete mode 100644 htdocs/telephonie/stats/graph/baraccumul.class.php delete mode 100644 htdocs/telephonie/stats/graph/barmoy.class.php delete mode 100644 htdocs/telephonie/stats/graph/brouzouf.class.php delete mode 100644 htdocs/telephonie/stats/graph/ca.class.php delete mode 100644 htdocs/telephonie/stats/graph/camenbert.class.php delete mode 100644 htdocs/telephonie/stats/graph/camoyen.class.php delete mode 100644 htdocs/telephonie/stats/graph/comm.nbmensuel.class.php delete mode 100644 htdocs/telephonie/stats/graph/comm.nbminutes.class.php delete mode 100644 htdocs/telephonie/stats/graph/gain.class.php delete mode 100644 htdocs/telephonie/stats/graph/heureappel.class.php delete mode 100644 htdocs/telephonie/stats/graph/index.php delete mode 100644 htdocs/telephonie/stats/graph/joursemaine.class.php delete mode 100644 htdocs/telephonie/stats/graph/line.class.php delete mode 100644 htdocs/telephonie/stats/graph/pie.class.php delete mode 100644 htdocs/telephonie/stats/index.php delete mode 100644 htdocs/telephonie/stats/lignes/actives.class.php delete mode 100644 htdocs/telephonie/stats/lignes/commande.php delete mode 100644 htdocs/telephonie/stats/lignes/commandes.class.php delete mode 100644 htdocs/telephonie/stats/lignes/commandes.week.class.php delete mode 100644 htdocs/telephonie/stats/lignes/index.php delete mode 100644 htdocs/telephonie/stats/lignes/onglets.php delete mode 100644 htdocs/telephonie/stats/lignes/pre.inc.php delete mode 100644 htdocs/telephonie/stats/lignes/rejet.week.class.php delete mode 100644 htdocs/telephonie/stats/lignes/resiliation.php delete mode 100644 htdocs/telephonie/stats/lignes/resiliation.week.class.php delete mode 100644 htdocs/telephonie/stats/lignes/statut.class.php delete mode 100644 htdocs/telephonie/stats/menus.php delete mode 100644 htdocs/telephonie/stats/pre.inc.php delete mode 100644 htdocs/telephonie/stats/tools.lib.php delete mode 100644 htdocs/telephonie/tarifs/config/data/index.php delete mode 100644 htdocs/telephonie/tarifs/config/data/prefix.sql delete mode 100644 htdocs/telephonie/tarifs/config/data/tarif.sql delete mode 100644 htdocs/telephonie/tarifs/config/grille.php delete mode 100644 htdocs/telephonie/tarifs/config/grilles.php delete mode 100644 htdocs/telephonie/tarifs/config/index.php delete mode 100644 htdocs/telephonie/tarifs/config/permissions.php delete mode 100644 htdocs/telephonie/tarifs/config/pre.inc.php delete mode 100644 htdocs/telephonie/tarifs/config/prefixs.php delete mode 100644 htdocs/telephonie/tarifs/config/tarif.php delete mode 100644 htdocs/telephonie/tarifs/config/tarifs.php delete mode 100644 htdocs/telephonie/tarifs/fiche.php delete mode 100644 htdocs/telephonie/tarifs/grille-export-achat.php delete mode 100644 htdocs/telephonie/tarifs/grille-export.php delete mode 100644 htdocs/telephonie/tarifs/grille.php delete mode 100644 htdocs/telephonie/tarifs/grilles.php delete mode 100644 htdocs/telephonie/tarifs/index.php delete mode 100644 htdocs/telephonie/tarifs/permissions.php delete mode 100644 htdocs/telephonie/tarifs/pre.inc.php delete mode 100644 htdocs/telephonie/tarifs/prefix.php delete mode 100644 htdocs/telephonie/tarifs/tarif-log.php delete mode 100644 htdocs/telephonie/tarifs/tarif.php delete mode 100644 htdocs/telephonie/telephonie-tarif.class.php delete mode 100644 htdocs/telephonie/telephonie.client.class.php delete mode 100644 htdocs/telephonie/telephonie.commercial.class.php delete mode 100644 htdocs/telephonie/telephonie.contrat.class.php delete mode 100644 htdocs/telephonie/telephonie.css delete mode 100644 htdocs/telephonie/telephonie.service.class.php delete mode 100644 htdocs/telephonie/telephonie.tarif.class.php delete mode 100644 htdocs/telephonie/telephonie.tarif.grille.class.php delete mode 100644 htdocs/telephonie/telephonie.tarif.prefix.class.php delete mode 100644 htdocs/telephonie/workflowtel.class.php diff --git a/ChangeLog b/ChangeLog index 6ce6b8391e8..a5bc6ec1f86 100644 --- a/ChangeLog +++ b/ChangeLog @@ -80,6 +80,8 @@ For developers: - Can use an alternate document_root directory to develop with sources on two repositories. - Removed useless code of old commercial module. +- Move some modules into the CVS modules repository dolibarrmod. This reduces + amount of code in main branch. - Updated wiki documentation. - Better W3C standard. - Can add init data when enabling a module. diff --git a/htdocs/energie/EnergieCompteur.class.php b/htdocs/energie/EnergieCompteur.class.php deleted file mode 100644 index 5d2ffed8774..00000000000 --- a/htdocs/energie/EnergieCompteur.class.php +++ /dev/null @@ -1,231 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -/** - \file htdocs/energie/EnergieCompteur.class.php - \ingroup energie - \brief Fichier des classes de compteur - \version $Revision$ - */ - - -/** - \class Compteur - \brief Classe de gestion des compteurs - */ - -class EnergieCompteur -{ - var $db ; - var $id ; - var $user; - - /** \brief Constructeur - */ - function EnergieCompteur($DB, $user) - { - global $langs; - - $this->db = $DB; - $this->user = $user; - - $this->energies[1] = $langs->trans("Electricity"); - $this->energies[2] = $langs->trans("Water"); - $this->energies[3] = $langs->trans("NaturalGaz"); - - $this->couleurs[1] = "gray"; - $this->couleurs[2] = "blue"; - $this->couleurs[3] = "yellow"; - } - - - /** - * Lecture - * - */ - function fetch ($id) - { - $sql = "SELECT c.rowid, c.libelle, fk_energie"; - $sql .= " FROM ".MAIN_DB_PREFIX."energie_compteur as c"; - $sql .= " WHERE c.rowid = ".$id; - - $resql = $this->db->query($sql) ; - - if ( $resql ) - { - $obj = $this->db->fetch_object($resql); - - $this->id = $obj->rowid; - $this->libelle = $obj->libelle; - $this->energie = $obj->fk_energie; - $this->db->free(); - - return 0; - } - else - { - dol_syslog(""); - return -1; - } - } - - /** - * Lecture - * - */ - function Create ($libelle, $energie) - { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."energie_compteur"; - $sql .= " (libelle, datec, fk_user_author, fk_energie, note)"; - $sql .= " VALUES ("; - $sql .= "'".trim($libelle)."'"; - $sql .= ",now()"; - $sql .= ",'".$this->user->id."'"; - $sql .= ",'".$energie."'"; - $sql .= ",'');"; - - $resql = $this->db->query($sql) ; - - if ( $resql ) - { - $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."energie_compteur"); - - return 0; - } - else - { - dol_syslog("EnergieCompteur::Create Erreur 1"); - dol_syslog($this->db->error()); - return -1; - } - } - - /** - * Ajout d'une valeur relev�e - * - */ - function AjoutReleve ($date_releve, $valeur) - { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."energie_compteur_releve"; - $sql .= " (fk_compteur, date_releve, valeur, datec, fk_user_author)"; - $sql .= " VALUES ("; - $sql .= "'".$this->id."'"; - $sql .= ",'".$this->db->idate($date_releve)."'"; - $sql .= ",'".$valeur."'"; - $sql .= ",now()"; - $sql .= ",'".$this->user->id."');"; - - $resql = $this->db->query($sql) ; - - if ( $resql ) - { - return 0; - } - else - { - dol_syslog("EnergieCompteur::AjoutReleve Erreur 1"); - dol_syslog($this->db->error()); - return -1; - } - } - /** - * Suppression d'une valeur relev�e - * - */ - function DeleteReleve ($rowid) - { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."energie_compteur_releve"; - $sql .= " WHERE rowid = '".$rowid."';"; - - $resql = $this->db->query($sql) ; - - if ( $resql ) - { - return 0; - } - else - { - dol_syslog("EnergieCompteur::AjoutReleve Erreur 1"); - dol_syslog($this->db->error()); - return -1; - } - } - /** - * Ajout d'une valeur relev�e - * - */ - function AddGroup ($groupe) - { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."energie_compteur_groupe"; - $sql .= " (fk_energie_compteur, fk_energie_groupe)"; - $sql .= " VALUES ('".$this->id."','".$groupe."');"; - - $resql = $this->db->query($sql); - - if ( $resql ) - { - return 0; - } - else - { - dol_syslog("EnergieCompteur::AddGroup Erreur 1"); - dol_syslog($this->db->error()); - return -1; - } - } - /** - * - * - */ - function GroupsAvailable () - { - $this->groups_available = array(); - - $sql = "SELECT g.rowid, g.libelle"; - $sql .= " FROM ".MAIN_DB_PREFIX."energie_groupe as g"; - - $resql = $this->db->query($sql) ; - - if ( $resql ) - { - $num = $this->db->num_rows($resql); - $i = 0; - - while ($i < $num) - { - $obj = $this->db->fetch_object($resql); - - $this->groups_available[$obj->rowid] = $obj->libelle; - $i++; - } - $this->db->free(); - - return 0; - } - else - { - dol_syslog(""); - return -1; - } - } -} -?> diff --git a/htdocs/energie/EnergieGroupe.class.php b/htdocs/energie/EnergieGroupe.class.php deleted file mode 100644 index 777c793c448..00000000000 --- a/htdocs/energie/EnergieGroupe.class.php +++ /dev/null @@ -1,95 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -class EnergieGroupe -{ - var $db ; - var $user ; - - /** \brief Constructeur - */ - function EnergieGroupe($DB, $user) - { - $this->db = $DB; - $this->user = $user; - } - - /** - * Lecture - * - */ - function fetch ($id) - { - $sql = "SELECT c.rowid, c.libelle"; - $sql .= " FROM ".MAIN_DB_PREFIX."energie_groupe as c"; - $sql .= " WHERE c.rowid = ".$id; - - $resql = $this->db->query($sql) ; - - if ( $resql ) - { - $obj = $this->db->fetch_object($resql); - - $this->id = $obj->rowid; - $this->libelle = $obj->libelle; - - $this->db->free(); - return 0; - } - else - { - dol_syslog("EnergieGroupe::fetch Erreur"); - return -1; - } - } - - /** - * Creation - * - */ - function Create ($libelle) - { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."energie_groupe"; - $sql .= " (libelle, datec, fk_user_author, note)"; - $sql .= " VALUES ("; - $sql .= "'".trim($libelle)."'"; - $sql .= ",now()"; - $sql .= ",'".$this->user->id."'"; - $sql .= ",'".$libelle."');"; - - $resql = $this->db->query($sql) ; - - if ( $resql ) - { - $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."energie_groupe"); - - return 0; - } - else - { - dol_syslog("EnergieGroupe::Create Erreur 1"); - dol_syslog($this->db->error()); - return -1; - } - } -} -?> diff --git a/htdocs/energie/compteur.php b/htdocs/energie/compteur.php deleted file mode 100644 index 6015caaee3c..00000000000 --- a/htdocs/energie/compteur.php +++ /dev/null @@ -1,228 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -/** - * \file htdocs/energie/compteur.php - * \ingroup energie - * \brief Fiche compteur - * \version $Revision$ - */ - -require("./pre.inc.php"); - -/* - * Actions - */ - -if ($_POST["action"] == 'add') -{ - $compteur = new EnergieCompteur($db, $user); - - if ( $compteur->create($_POST["libelle"],$_POST["energie"]) == 0) - { - Header("Location: compteur.php?id=".$compteur->id); - } - else - { - Header("Location: compteur.php?action=create"); - } -} - - -if ($_POST["action"] == 'addvalue') -{ - if ($_POST["releve"] > 0) - { - $compteur = new EnergieCompteur($db, $user); - if ( $compteur->fetch($_GET["id"]) == 0) - { - $date = mktime(12, - 0 , - 0, - $_POST["remonth"], - $_POST["reday"], - $_POST["reyear"]); - - $compteur->AjoutReleve($date, $_POST["releve"]); - Header("Location: compteur.php?id=".$_GET["id"]); - } - } -} - - - -/* - * Views - */ - -llxHeader($langs, '',$langs->trans("Compteur"),"Compteur"); - -/********************************************************************* - * - * Mode creation - * - ************************************************************************/ -if ($_GET["action"] == 'create') -{ - $head[0][0] = DOL_URL_ROOT.'/energie/compteur.php?action=create'; - $head[0][1] = "Nouveau compteur"; - $h++; - $a = 0; - - dol_fiche_head($head, $a, $soc->nom); - - $html = new Form($db); - $compteur = new EnergieCompteur($db, $user); - - print '
'; - print ''; - print ''; - - print ''; - - print ""; - - print ''; - - print ''; - - print ""; - print ''; - - print ''; - - print "
'.$langs->trans("Label").'
Energie'; - print $html->select_array("energie", $compteur->energies); - print '
"; - print ''; - -} -else -/* *************************************************************************** */ -/* */ -/* Mode vue */ -/* */ -/* *************************************************************************** */ -{ - if ($_GET["id"] > 0) - { - $compteur = new EnergieCompteur($db, $user); - if ( $compteur->fetch($_GET["id"]) == 0) - { - - $head[0][0] = DOL_URL_ROOT.'/energie/compteur.php?id='.$compteur->id; - $head[0][1] = $langs->trans("Compteur"); - $h++; - $a = 0; - - $head[$h][0] = DOL_URL_ROOT.'/energie/compteur_graph.php?id='.$compteur->id; - $head[$h][1] = $langs->trans("Graph"); - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/energie/releve.php?id='.$compteur->id; - $head[$h][1] = $langs->trans("Releves"); - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/energie/compteur_groupe.php?id='.$compteur->id; - $head[$h][1] = $langs->trans("Groups"); - $h++; - - dol_fiche_head($head, $a, $soc->nom); - - - print ''; - print ""; - print '"; - print "
".$langs->trans("Compteur")."'; - print $compteur->libelle; - print "

"; - - - $html = new Form($db); - print '
'; - print ''; - print ''; - print ''; - - $var=!$var; - print ""; - - print ''; - - print ''; - print ''; - print "
Date'; - print $html->select_date('','','','','',"addvalue"); - print 'Valeur relevee

"; - - print ''; - print '
'; - $file = "all.".$compteur->id.".png"; - print ''; - print '
'; - - print ''; - - print ''; - print ''; - print ''; - - $sql = "SELECT ".$db->pdate("date_releve")." as date_releve, valeur"; - $sql .= " FROM ".MAIN_DB_PREFIX."energie_compteur_releve as ecr"; - $sql .= " WHERE ecr.fk_compteur = '".$compteur->id."'"; - $sql .= " ORDER BY ecr.date_releve DESC LIMIT 5"; - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - $var=True; - while ($i < $num) - { - $obj = $db->fetch_object($resql); - $var=!$var; - print "'; - - $i++; - } - } - print '
'.$langs->trans("Date").''.$langs->trans("Releve").'
"; - print dol_print_date($obj->date_releve,'%a %d %B %Y'); - print ''.$obj->valeur.'
'; - print "
\n"; - } - else - { - /* Commande non trouv�e */ - print "Compteur inexistant"; - } - } - else - { - print "Compteur inexistant"; - } -} - -$db->close(); - -llxFooter('$Date$ - $Revision$'); -?> diff --git a/htdocs/energie/compteur_graph.php b/htdocs/energie/compteur_graph.php deleted file mode 100644 index 1cea34103f0..00000000000 --- a/htdocs/energie/compteur_graph.php +++ /dev/null @@ -1,108 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/** - * \file htdocs/energie/compteur_graph.php - * \ingroup energie - * \brief Fiche de gestion des graphs des compteurs - * \version $Id$ - */ - -require("./pre.inc.php"); - - -/* - * View - */ - -llxHeader($langs, '',$langs->trans("Compteur"),"Compteur"); - -/* *************************************************************************** */ -/* */ -/* Mode vue */ -/* */ -/* *************************************************************************** */ - -if ($_GET["id"] > 0) -{ - $compteur = new EnergieCompteur($db, $user); - if ( $compteur->fetch($_GET["id"]) == 0) - { - $head[0][0] = DOL_URL_ROOT.'/energie/compteur.php?id='.$compteur->id; - $head[0][1] = $langs->trans("Compteur"); - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/energie/compteur_graph.php?id='.$compteur->id; - $head[$h][1] = $langs->trans("Graph"); - $a = $h; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/energie/releve.php?id='.$compteur->id; - $head[$h][1] = $langs->trans("Releves"); - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/energie/compteur_groupe.php?id='.$compteur->id; - $head[$h][1] = $langs->trans("Groups"); - $h++; - - dol_fiche_head($head, $a, $soc->nom); - - print ''; - print ""; - print '"; - print "
".$langs->trans("Compteur")."'; - print $compteur->libelle; - print "

"; - - print ''; - - print ''; - - print ''; - - print '
'; - $file = "day.".$compteur->id.".png"; - print ''; - print '
'; - $file = "week.".$compteur->id.".png"; - print ''; - print '
'; - $file = "month.".$compteur->id.".png"; - print ''; - print ''; - $file = "year.".$compteur->id.".png"; - print ''; - print '

'; - print ''; - } - else - { - /* Compteur non trouv�e */ - print "Compteur inexistant"; - } -} -else -{ - print "Compteur inexistant"; -} - - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/energie/compteur_groupe.php b/htdocs/energie/compteur_groupe.php deleted file mode 100644 index e4a7ce0fbee..00000000000 --- a/htdocs/energie/compteur_groupe.php +++ /dev/null @@ -1,121 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/** - * \file htdocs/energie/compteur_groupe.php - * \ingroup energie - * \brief Fiche de gestion des groupes des compteurs - * \version $Id$ - */ - -require("./pre.inc.php"); - - -/* - * Actions - */ - -if ($_POST["action"] == 'addvalue') -{ - $compteur = new EnergieCompteur($db, $user); - if ( $compteur->fetch($_GET["id"]) == 0) - { - if ( $compteur->AddGroup($_POST["groupe"]) == 0) - { - Header("Location: compteur.php?id=".$_GET["id"]); - } - } -} - - - -/* - * View - */ - -llxHeader($langs, '',$langs->trans("Compteur"),"Compteur"); - -if ($_GET["id"] > 0) -{ - $compteur = new EnergieCompteur($db, $user); - if ( $compteur->fetch($_GET["id"]) == 0) - { - - $head[0][0] = DOL_URL_ROOT.'/energie/compteur.php?id='.$compteur->id; - $head[0][1] = $langs->trans("Compteur"); - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/energie/compteur_graph.php?id='.$compteur->id; - $head[$h][1] = $langs->trans("Graph"); - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/energie/releve.php?id='.$compteur->id; - $head[$h][1] = $langs->trans("Releves"); - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/energie/compteur_groupe.php?id='.$compteur->id; - $head[$h][1] = $langs->trans("Groups"); - $a = $h; - $h++; - - dol_fiche_head($head, $a, $soc->nom); - - - print ''; - print ""; - print '"; - print "
".$langs->trans("Compteur")."'; - print $compteur->libelle; - print "

"; - - $html = new Form($db); - print '
'; - print ''; - print ''; - print ''; - - $var=!$var; - print ""; - - $compteur->GroupsAvailable(); - - print ''; - - print ''; - - print "
Groupe'; - print $html->select_array("groupe", $compteur->groups_available); - print '

"; - print ''; - print "
\n"; - } - else - { - /* Commande non trouv�e */ - print "Compteur inexistant"; - } -} -else -{ - print "Compteur inexistant"; -} - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/energie/graph.php b/htdocs/energie/graph.php deleted file mode 100644 index 750d333a110..00000000000 --- a/htdocs/energie/graph.php +++ /dev/null @@ -1,126 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -/** - \file htdocs/commande/fiche.php - \ingroup commande - \brief Fiche commande - \version $Revision$ -*/ - -require("./pre.inc.php"); - -/* - * - */ -if ($_POST["action"] == 'addvalue') -{ - if ($_POST["releve"] > 0) - { - $compteur = new EnergieCompteur($db, $user); - if ( $compteur->fetch($_GET["id"]) == 0) - { - $date = mktime(12, - 0 , - 0, - $_POST["remonth"], - $_POST["reday"], - $_POST["reyear"]); - - $compteur->AjoutReleve($date, $_POST["releve"]); - Header("Location: compteur.php?id=".$_GET["id"]); - } - } -} -/* - * - */ - -llxHeader($langs, '',$langs->trans("Compteur"),"Compteur"); - -if ($_GET["period"] == '') -{ - $period = "day"; -} -else -{ - $period = $_GET["period"]; -} - -$head[0][0] = DOL_URL_ROOT.'/energie/graph.php?period=day'; -$head[0][1] = $langs->trans("Day"); -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/energie/graph.php?period=week'; -$head[$h][1] = $langs->trans("Week"); -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/energie/graph.php?period=month'; -$head[$h][1] = $langs->trans("Month"); -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/energie/graph.php?period=year'; -$head[$h][1] = $langs->trans("Year"); -$h++; - -$as["day"] = 0; -$as["week"] = 1; -$as["month"] = 2; -$as["year"] = 3; - -dol_fiche_head($head, $as[$period], $soc->nom); - -print ''; - -$sql = "SELECT c.rowid, c.libelle"; -$sql .= " FROM ".MAIN_DB_PREFIX."energie_compteur as c"; -$sql .= " ORDER BY c.libelle DESC"; -$resql = $db->query($sql); -if ( $resql) -{ - $num = $db->num_rows($resql); - if ($num) - { - $i = 0; - - $var = True; - while ($i < $num) - { - $var=!$var; - $obj = $db->fetch_object($resql); - - print ''; - - $i++; - } - - } -} -print '
'; - $file = $period.".".$obj->rowid.".png"; - print ''; - print '

'; - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/energie/groupe.php b/htdocs/energie/groupe.php deleted file mode 100644 index 071e053bd70..00000000000 --- a/htdocs/energie/groupe.php +++ /dev/null @@ -1,159 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -/** - * \file htdocs/energie/groupe.php - * \ingroup energie - * \brief Fiche groupe - * \version $Revision$ - */ - -require("./pre.inc.php"); - -/* - * Actions - */ - -if ($_POST["action"] == 'add') -{ - $groupe = new EnergieGroupe($db, $user); - - if ( $groupe->create($_POST["libelle"]) == 0) - { - Header("Location: groupe.php?id=".$groupe->id); - } - else - { - Header("Location: groupe.php?action=create"); - } -} - - -/* - * View - */ - -llxHeader($langs, '',$langs->trans("Group"), "Group"); - -/********************************************************************* - * - * Mode creation - * - * - ************************************************************************/ -if ($_GET["action"] == 'create') -{ - $head[0][0] = DOL_URL_ROOT.'/energie/groupe.php?action=create'; - $head[0][1] = $langs->trans("NewGroup"); - $h++; - $a = 0; - - dol_fiche_head($head, $a, $soc->nom); - - $html = new Form($db); - - print '
'; - print ''; - print ''; - - print ''; - print ""; - print ''; - - print ''; - - print ''; - - print "
'.$langs->trans("Label").'
"; - - print ''; - -} -else -/* *************************************************************************** */ -/* */ -/* Mode vue */ -/* */ -/* *************************************************************************** */ -{ - if ($_GET["id"] > 0) - { - $groupe = new EnergieGroupe($db, $user); - if ( $groupe->fetch($_GET["id"]) == 0) - { - - $head[0][0] = DOL_URL_ROOT.'/energie/groupe.php?id='.$commande->id; - $head[0][1] = $langs->trans("Group"); - $h++; - $a = 0; - - dol_fiche_head($head, $a, $soc->nom); - - print ''; - print ""; - print '"; - print "
".$langs->trans("Group")."'; - print $groupe->libelle; - print "

"; - - /* - * - */ - - - print ''; - - print ''; - - print '
'; - $file = "groupe.day.".$groupe->id.".png"; - print ''; - print ''; - $file = "groupe.week.".$groupe->id.".png"; - print ''; - print '
'; - $file = "groupe.month.".$groupe->id.".png"; - print ''; - print ''; - $file = "groupe.year.".$groupe->id.".png"; - print ''; - print '

'; - - print ''; - print "
\n"; - } - else - { - /* Commande non trouv�e */ - print "Groupe inexistant"; - } - } - else - { - print "Groupe inexistant"; - } -} - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/energie/index.php b/htdocs/energie/index.php deleted file mode 100644 index 41fc6c1e909..00000000000 --- a/htdocs/energie/index.php +++ /dev/null @@ -1,107 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -/** - \file htdocs/commande/index.php - \ingroup compta - \brief Page acceuil zone comptabilité - \version $Revision$ -*/ - -require("./pre.inc.php"); - -llxHeader($langs,"",$langs->trans("Energy"),$langs->trans("Energy")); - -print_fiche_titre($langs->trans("Energy")); - -print ''; - -print '
'; - -/* - * Groupe - */ -$sql = "SELECT c.rowid, c.libelle"; -$sql .= " FROM ".MAIN_DB_PREFIX."energie_groupe as c"; -$sql .= " ORDER BY c.libelle DESC"; -$resql = $db->query($sql); -if ( $resql) -{ - $num = $db->num_rows($resql); - if ($num) - { - $i = 0; - print ''; - print ''; - print ''; - $var = True; - while ($i < $num) - { - $var=!$var; - $obj = $db->fetch_object($resql); - print ""; - print ''; - $i++; - } - print "
'.$langs->trans("Groupes").'
rowid\">".$obj->libelle."

"; - } -} - -/* - * Compteurs - */ -$sql = "SELECT c.rowid, c.libelle"; -$sql .= " FROM ".MAIN_DB_PREFIX."energie_compteur as c"; -$sql .= " ORDER BY c.libelle DESC"; -$resql = $db->query($sql); -if ( $resql) -{ - $num = $db->num_rows($resql); - if ($num) - { - $i = 0; - print ''; - print ''; - print ''; - $var = True; - while ($i < $num) - { - $var=!$var; - $obj = $db->fetch_object($resql); - print ""; - print ''; - $i++; - } - print "
'.$langs->trans("Compteurs").'
rowid\">".$obj->libelle."

"; - } -} - -print '
'; - -print '

'."\n"; - -print '
'; - -$db->close(); - -llxFooter('$Date$ - $Revision$'); -?> diff --git a/htdocs/energie/pre.inc.php b/htdocs/energie/pre.inc.php deleted file mode 100644 index 23ca65b51d7..00000000000 --- a/htdocs/energie/pre.inc.php +++ /dev/null @@ -1,53 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -/** - \file htdocs/energie/pre.inc.php - \ingroup energie - \brief Gestionnaire du menu energie - \version $Revision$ -*/ - -require("../main.inc.php"); -require("./EnergieCompteur.class.php"); -require("./EnergieGroupe.class.php"); - -$langs->load("energy"); - -function llxHeader($langs, $head = "", $title="", $help_url='') -{ - - top_menu($head, $title); - - $menu = new Menu(); - - $menu->add(DOL_URL_ROOT."/energie/", $langs->trans("Energy")); - - $menu->add_submenu(DOL_URL_ROOT."/energie/compteur.php?action=create", $langs->trans("NewCounter")); - $menu->add_submenu(DOL_URL_ROOT."/energie/groupe.php?action=create", $langs->trans("NewGroup")); - - $menu->add_submenu(DOL_URL_ROOT."/energie/graph.php", $langs->trans("Statistics")); - - - left_menu($menu->liste, $help_url); -} -?> diff --git a/htdocs/energie/releve.php b/htdocs/energie/releve.php deleted file mode 100644 index 2b7cfd63bf8..00000000000 --- a/htdocs/energie/releve.php +++ /dev/null @@ -1,144 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -/** - * \file htdocs/energie/compteur.php - * \ingroup energie - * \brief Fiche compteur - * \version $Revision$ - */ - -require("./pre.inc.php"); - - -/* - * Actions - */ - -if ($_GET["action"] == 'delete') -{ - if ($_GET["rowid"] > 0) - { - $compteur = new EnergieCompteur($db, $user); - if ( $compteur->fetch($_GET["id"]) == 0) - { - $compteur->DeleteReleve($_GET["rowid"]); - } - } -} - - -/* - * View - */ - -llxHeader($langs, '',$langs->trans("Compteur"),"Compteur"); - - -if ($_GET["id"] > 0) -{ - $compteur = new EnergieCompteur($db, $user); - if ( $compteur->fetch($_GET["id"]) == 0) - { - - $head[0][0] = DOL_URL_ROOT.'/energie/compteur.php?id='.$compteur->id; - $head[0][1] = $langs->trans("Compteur"); - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/energie/compteur_graph.php?id='.$compteur->id; - $head[$h][1] = $langs->trans("Graph"); - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/energie/releve.php?id='.$compteur->id; - $head[$h][1] = $langs->trans("Releves"); - $h++; - $a = 2; - - $head[$h][0] = DOL_URL_ROOT.'/energie/compteur_groupe.php?id='.$compteur->id; - $head[$h][1] = $langs->trans("Groups"); - $h++; - - dol_fiche_head($head, $a, $soc->nom); - - print ''; - print ""; - print '"; - print "
".$langs->trans("Compteur")."'; - print $compteur->libelle; - print "

"; - print ''; - - $page = $_GET["page"]; - $limit = $conf->liste_limit; - $offset = $limit * $page ; - - $sql = "SELECT ".$db->pdate("date_releve")." as date_releve, valeur, rowid"; - $sql .= " FROM ".MAIN_DB_PREFIX."energie_compteur_releve as ecr"; - $sql .= " WHERE ecr.fk_compteur = '".$compteur->id."'"; - - $sql .= " ORDER BY ecr.date_releve DESC"; - $sql .= $db->plimit($limit + 1 ,$offset); - - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - $var=True; - - print_barre_liste("Releves", $page, "", "&id=".$compteur->id, $sortfield, $sortorder,'',$num, 0, ''); - - print ''; - print ''; - print ''; - - while ($i < $num) - { - $obj = $db->fetch_object($resql); - $var=!$var; - print "'; - print ''; - $i++; - } - } - print '
'.$langs->trans("Date").''.$langs->trans("Releve").'
"; - print dol_print_date($obj->date_releve,'%a %d %B %Y'); - print ''.$obj->valeur.''; - print img_delete().'
'; - print "
\n"; - } - else - { - /* Commande non trouv�e */ - print "Compteur inexistant"; - } -} -else -{ - print "Compteur inexistant"; -} - - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/includes/menus/init_menu_auguria.sql b/htdocs/includes/menus/init_menu_auguria.sql index 7133103fbfb..feb6a423b31 100644 --- a/htdocs/includes/menus/init_menu_auguria.sql +++ b/htdocs/includes/menus/init_menu_auguria.sql @@ -20,8 +20,6 @@ insert into `llx_menu` (`enabled`, `rowid`, `menu_handler`, `type`, `mainmenu`, insert into `llx_menu` (`enabled`, `rowid`, `menu_handler`, `type`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position, entity) values ('$conf->compta->enabled || $conf->accounting->enabled || $conf->banque->enabled || $conf->facture->enabled', 6__+MAX_llx_menu__, 'auguria', 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&leftmenu=', 'MenuFinancial', -1, 'compta', '$user->rights->compta->resultat->lire || $user->rights->accounting->plancompte->lire || $user->rights->commande->lire || $user->rights->facture->lire || $user->rights->banque->lire', '', 2, 6, __ENTITY__); insert into `llx_menu` (`enabled`, `rowid`, `menu_handler`, `type`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position, entity) values ('$conf->projet->enabled', 7__+MAX_llx_menu__, 'auguria', 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 0, 7, __ENTITY__); insert into `llx_menu` (`enabled`, `rowid`, `menu_handler`, `type`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position, entity) values ('$conf->mailing->enabled || $conf->export->enabled || $conf->global->MAIN_MODULE_IMPORT || $conf->global->MAIN_MODULE_DOMAIN', 8__+MAX_llx_menu__, 'auguria', 'top', 'tools', '', 0, '/index.php?mainmenu=tools&leftmenu=', 'Tools', -1, 'other', '$user->rights->mailing->lire || $user->rights->bookmark->lire || $user->rights->export->lire', '', 2, 8, __ENTITY__); -insert into `llx_menu` (`enabled`, `rowid`, `menu_handler`, `type`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position, entity) values ('! empty($conf->telephonie->enabled) && $user->rights->telephonie->lire', 9__+MAX_llx_menu__, 'auguria', 'top', 'telephony', '', 0, '/telephonie/index.php?mainmenu=telephony&leftmenu=', 'Telephony', -1, 'telephony', '$user->rights->telephonie->lire', '', 2, 9, __ENTITY__); -insert into `llx_menu` (`enabled`, `rowid`, `menu_handler`, `type`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position, entity) values ('! empty($conf->energie->enabled)', 10__+MAX_llx_menu__, 'auguria', 'top', 'energy', '', 0, '/energie/index.php?mainmenu=energy&leftmenu=', 'Energy', -1, 'energy', '', '', 2, 10, __ENTITY__); insert into `llx_menu` (`enabled`, `rowid`, `menu_handler`, `type`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position, entity) values ('! empty($conf->boutique->enabled)', 11__+MAX_llx_menu__, 'auguria', 'top', 'shop', '', 0, '/boutique/index.php?mainmenu=shop&leftmenu=', 'OSCommerce', -1, 'shop', '', '', 0, 11, __ENTITY__); insert into `llx_menu` (`enabled`, `rowid`, `menu_handler`, `type`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position, entity) values ('! empty($conf->oscommercews->enabled)', 12__+MAX_llx_menu__, 'auguria', 'top', 'shop', '', 0, '/oscommerce_ws/index.php?mainmenu=shop&leftmenu=', 'OSCommerce', -1, 'shop', '', '', 0, 12, __ENTITY__); insert into `llx_menu` (`enabled`, `rowid`, `menu_handler`, `type`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position, entity) values ('$conf->adherent->enabled', 13__+MAX_llx_menu__, 'auguria', 'top', 'members', '', 0, '/adherents/index.php?mainmenu=members&leftmenu=', 'Members', -1, 'members', '', '', 2, 15, __ENTITY__); diff --git a/htdocs/includes/modules/modEnergie.class.php b/htdocs/includes/modules/modEnergie.class.php deleted file mode 100644 index b4b1807497c..00000000000 --- a/htdocs/includes/modules/modEnergie.class.php +++ /dev/null @@ -1,116 +0,0 @@ - - * Copyright (C) 2006-2007 Laurent Destailleur - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/** - * \defgroup energie Module energy - * \brief Module pour le suivi de la consommation d'energie - * \version $Id$ - */ - -/** - * \file htdocs/includes/modules/modEnergie.class.php - * \ingroup energie - * \brief Fichier de description et activation du module Energie - */ - -include_once(DOL_DOCUMENT_ROOT ."/includes/modules/DolibarrModules.class.php"); - - -/** - * \class modEnergie - * \brief Classe de description et activation du module Energie - */ - -class modEnergie extends DolibarrModules -{ - - /** - * \brief Constructeur. Definit les noms, constantes et boites - * \param DB handler d'acces base - */ - function modEnergie($DB) - { - $this->db = $DB ; - $this->numero = 23 ; - - $this->family = "other"; - // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) - $this->name = eregi_replace('^mod','',get_class($this)); - $this->description = "Suivi de la consommation des energies"; - - // Possible values for version are: 'development', 'experimental', 'dolibarr' or version - $this->version = 'dolibarr'; - - $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 3; - $this->picto='energie'; - - // Data directories to create when module is enabled - $this->dirs = array('/energie/temp','/energie/graph'); - - // Dependances - $this->depends = array(); - - // Config pages - $this->config_page_url = array("energie.php"); - - // Constantes - $this->const = array(); - - // Boxes - $this->boxes = array(); - $r=0; - $this->boxes[$r][1] = "box_energie_releve.php"; - $r++; - $this->boxes[$r][1] = "box_energie_graph.php"; - $r++; - - // Permissions - $this->rights = array(); - - } - - - /** - * \brief Fonction appelee lors de l'activation du module. Insere en base les constantes, boites, permissions du module. - * Definit egalement les repertoires de donnees a creer pour ce module. - */ - function init() - { - global $conf; - // Permissions et valeurs par defaut - $this->remove(); - - $sql = array(); - - return $this->_init($sql); - } - - /** - * \brief Fonction appelee lors de la desactivation d'un module. - * Supprime de la base les constantes, boites et permissions du module. - */ - function remove() - { - $sql = array(); - - return $this->_remove($sql); - } -} -?> diff --git a/htdocs/includes/modules/modImport.class.php b/htdocs/includes/modules/modImport.class.php index be67c3d8b42..2a1d6e11e01 100644 --- a/htdocs/includes/modules/modImport.class.php +++ b/htdocs/includes/modules/modImport.class.php @@ -50,7 +50,8 @@ class modImport extends DolibarrModules // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = eregi_replace('^mod','',get_class($this)); $this->description = "Outils d'imports de donnees Dolibarr (via un assistant)"; - $this->version = 'development'; // 'experimental' or 'dolibarr' or version + // Possible values for version are: 'experimental' or 'dolibarr' or version + $this->version = 'experimental'; // 'experimental' or 'dolibarr' or version $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); $this->special = 0; $this->picto = ''; diff --git a/htdocs/includes/modules/modTelephonie.class.php b/htdocs/includes/modules/modTelephonie.class.php deleted file mode 100644 index c20b352f909..00000000000 --- a/htdocs/includes/modules/modTelephonie.class.php +++ /dev/null @@ -1,315 +0,0 @@ - - * Copyright (C) 2006-2007 Laurent Destailleur - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/** - \defgroup telephonie Module telephonie - \brief Module pour gerer la telephonie - */ - -/** - \file htdocs/includes/modules/modTelephonie.class.php - \ingroup telephonie - \brief Fichier de description et activation du module de Telephonie - \version $Id$ - */ - -include_once(DOL_DOCUMENT_ROOT."/includes/modules/DolibarrModules.class.php"); -require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php"); - - -/** - \class modTelephonie - \brief Classe de description et activation du module Telephonie - */ - -class modTelephonie extends DolibarrModules -{ - - /** - * \brief Constructeur. Definit les noms, constantes et boites - * \param DB handler d'acces base - */ - function modTelephonie($DB) - { - $this->db = $DB ; - $this->numero = 56 ; - - $this->family = "other"; - // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) - $this->name = eregi_replace('^mod','',get_class($this)); - $this->description = "Gestion de la Telephonie"; - - // Possible values for version are: 'development', 'experimental', 'dolibarr' or version - $this->version = 'dolibarr'; - - $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 3; - $this->picto='phoning'; - - // Relative path to module style sheet if exists - $this->style_sheet = '/telephonie/telephonie.css'; - - // Data directories to create when module is enabled - $this->dirs = array("/telephonie/temp", - "/telephonie/graph", - "/telephonie/logs", - "/telephonie/client", - "/telephonie/rapports", - "/telephonie/ligne/commande/retour/traite", - "/telephonie/cdr/archives", - "/telephonie/cdr/atraiter"); - - // Dependancies - $this->depends = array(); - $this->requiredby = array(); - - // Constants - $this->const = array(); - - // Boxes - $this->boxes = array(); - - // Permissions - $this->rights = array(); - $this->rights_class = 'telephonie'; - - $this->rights[1][0] = 211; // id de la permission - $this->rights[1][1] = 'Consulter la telephonie'; // libelle de la permission - $this->rights[1][2] = 'r'; // type de la permission (deprecie a ce jour) - $this->rights[1][3] = 1; // La permission est-elle une permission par defaut - $this->rights[1][4] = 'lire'; - - $this->rights[2][0] = 212; // id de la permission - $this->rights[2][1] = 'Commander les lignes'; // libelle de la permission - $this->rights[2][2] = 'w'; // type de la permission (deprecie a ce jour) - $this->rights[2][3] = 0; // La permission est-elle une permission par defaut - $this->rights[2][4] = 'ligne_commander'; - - $this->rights[3][0] = 213; - $this->rights[3][1] = 'Activer une ligne'; - $this->rights[3][2] = 'w'; - $this->rights[3][3] = 0; - $this->rights[3][4] = 'ligne_activer'; - - $this->rights[4][0] = 214; // id de la permission - $this->rights[4][1] = 'Configurer la telephonie'; // libelle de la permission - $this->rights[4][2] = 'w'; - $this->rights[4][3] = 0; - $this->rights[4][4] = 'configurer'; - - $this->rights[5][0] = 215; - $this->rights[5][1] = 'Configurer les fournisseurs'; - $this->rights[5][2] = 'w'; - $this->rights[5][3] = 0; - $this->rights[5][4] = 'fournisseur'; - $this->rights[5][5] = 'config'; - - $this->rights[6][0] = 192; - $this->rights[6][1] = 'Creer des lignes'; - $this->rights[6][2] = 'w'; - $this->rights[6][3] = 0; - $this->rights[6][4] = 'ligne'; - $this->rights[6][5] = 'creer'; - - $this->rights[7][0] = 202; - $this->rights[7][1] = 'Creer des liaisons ADSL'; - $this->rights[7][2] = 'w'; - $this->rights[7][3] = 0; - $this->rights[7][4] = 'adsl'; - $this->rights[7][5] = 'creer'; - - $this->rights[8][0] = 203; - $this->rights[8][1] = "Demander la commande des liaisons"; - $this->rights[8][2] = 'w'; - $this->rights[8][3] = 0; - $this->rights[8][4] = 'adsl'; - $this->rights[8][5] = 'requete'; - - $this->rights[9][0] = 204; - $this->rights[9][1] = 'Commander les liaisons'; - $this->rights[9][2] = 'w'; - $this->rights[9][3] = 0; - $this->rights[9][4] = 'adsl'; - $this->rights[9][5] = 'commander'; - - $this->rights[10][0] = 205; - $this->rights[10][1] = 'Gerer les liaisons'; - $this->rights[10][2] = 'w'; - $this->rights[10][3] = 0; - $this->rights[10][4] = 'adsl'; - $this->rights[10][5] = 'gerer'; - $r = 10; - - $r++; - - - $this->rights[$r][0] = 271; - $this->rights[$r][1] = 'Consulter le CA'; - $this->rights[$r][2] = 'w'; - $this->rights[$r][3] = 0; - $this->rights[$r][4] = 'ca'; - $this->rights[$r][5] = 'lire'; - $r++; - - $this->rights[$r][0] = 272; - $this->rights[$r][1] = 'Consulter les factures'; - $this->rights[$r][2] = 'r'; - $this->rights[$r][3] = 0; - $this->rights[$r][4] = 'facture'; - $this->rights[$r][5] = 'lire'; - $r++; - - $this->rights[$r][0] = 273; - $this->rights[$r][1] = 'Emmettre les factures'; - $this->rights[$r][2] = 'r'; - $this->rights[$r][3] = 0; - $this->rights[$r][4] = 'facture'; - $this->rights[$r][5] = 'ecrire'; - $r++; - - $this->rights[$r][0] = 206; - $this->rights[$r][1] = 'Consulter les liaisons'; - $this->rights[$r][2] = 'w'; - $this->rights[$r][3] = 0; - $this->rights[$r][4] = 'adsl'; - $this->rights[$r][5] = 'lire'; - $r++; - - $this->rights[$r][0] = 231; - $this->rights[$r][1] = 'Definir le mode de reglement'; - $this->rights[$r][2] = 'w'; - $this->rights[$r][3] = 0; - $this->rights[$r][4] = 'contrat'; - $this->rights[$r][5] = 'paiement'; - $r++; - - $this->rights[$r][0] = 193; - $this->rights[$r][1] = 'Resilier des lignes'; - $this->rights[$r][2] = 'w'; - $this->rights[$r][3] = 0; - $this->rights[$r][4] = 'ligne'; - $this->rights[$r][5] = 'resilier'; - $r++; - - $this->rights[$r][0] = 194; - $this->rights[$r][1] = 'Consulter la marge des lignes'; - $this->rights[$r][2] = 'r'; - $this->rights[$r][3] = 0; - $this->rights[$r][4] = 'ligne'; - $this->rights[$r][5] = 'gain'; - $r++; - - $this->rights[$r][0] = 146; - $this->rights[$r][1] = 'Consulter les fournisseurs'; - $this->rights[$r][2] = 'w'; - $this->rights[$r][3] = 0; - $this->rights[$r][4] = 'fournisseur'; - $this->rights[$r][5] = 'lire'; - $r++; - - $this->rights[$r][0] = 147; - $this->rights[$r][1] = 'Consulter les stats'; - $this->rights[$r][2] = 'w'; - $this->rights[$r][3] = 0; - $this->rights[$r][4] = 'stats'; - $this->rights[$r][5] = 'lire'; - $r++; - - $this->rights[$r][0] = 311; - $this->rights[$r][1] = 'Consulter les services'; - $this->rights[$r][2] = 'w'; - $this->rights[$r][3] = 0; - $this->rights[$r][4] = 'service'; - $this->rights[$r][5] = 'lire'; - $r++; - - $this->rights[$r][0] = 312; - $this->rights[$r][1] = 'Affecter des services a un contrat'; - $this->rights[$r][2] = 'w'; - $this->rights[$r][3] = 0; - $this->rights[$r][4] = 'service'; - $this->rights[$r][5] = 'affecter'; - $r++; - - $this->rights[$r][0] = 291; - $this->rights[$r][1] = 'Consulter les tarifs'; - $this->rights[$r][2] = 'w'; - $this->rights[$r][3] = 0; - $this->rights[$r][4] = 'tarifs'; - $this->rights[$r][5] = 'lire'; - $r++; - - $this->rights[$r][0] = 292; - $this->rights[$r][1] = 'Definir les permissions sur les tarifs'; - $this->rights[$r][2] = 'w'; - $this->rights[$r][3] = 0; - $this->rights[$r][4] = 'tarif'; - $this->rights[$r][5] = 'permission'; - $r++; - - $this->rights[$r][0] = 293; - $this->rights[$r][1] = 'Modifier les tarifs clients'; - $this->rights[$r][2] = 'w'; - $this->rights[$r][3] = 0; - $this->rights[$r][4] = 'tarif'; - $this->rights[$r][5] = 'client_modifier'; - $r++; - } - - /** - * \brief Fonction appelee lors de l'activation du module. Insere en base les constantes, boites, permissions du module. - * Definit egalement les repertoires de donnees a creer pour ce module. - */ - function init() - { - global $conf; - - // Permissions - $this->remove(); - - // - $this->load_tables(); - // - return $this->_init($sql); - } - - /** - \brief Fonction appelee lors de la desactivation d'un module. - Supprime de la base les constantes, boites et permissions du module. - */ - function remove() - { - $sql = array(); - - return $this->_remove($sql); - } - - /** - * \brief Create tables and keys required by module - * Files mymodule.sql and mymodule.key.sql with create table and create keys - * commands must be stored in directory /mymodule/sql/. - * This function is called by this->init. - * \return int <=0 if KO, >0 if OK - */ - function load_tables() - { - return $this->_load_tables('/telephonie/sql/'); - } -} -?> diff --git a/htdocs/telephonie/adsl/fiche.php b/htdocs/telephonie/adsl/fiche.php deleted file mode 100644 index 090870bb29f..00000000000 --- a/htdocs/telephonie/adsl/fiche.php +++ /dev/null @@ -1,917 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require("./pre.inc.php"); - -if (!$user->rights->telephonie->adsl->lire) accessforbidden(); - -$mesg = ''; - -$dt = time(); - -$h = strftime("%H",$dt); -$m = strftime("%M",$dt); -$s = strftime("%S",$dt); - -if ($_POST["action"] == 'add') -{ - $ligne = new LigneAdsl($db); - - $ligne->numero = $_POST["numero"]; - $ligne->client = $_POST["client"]; - $ligne->client_install = $_POST["client_install"]; - $ligne->client_facture = $_POST["client_facture"]; - $ligne->contrat = $_POST["contrat"]; - $ligne->fournisseur = $_POST["fournisseur"]; - $ligne->commercial = $_POST["commercial"]; - $ligne->type = $_POST["type"]; - $ligne->note = $_POST["note"]; - - - if ( $ligne->create($user) == 0) - { - Header("Location: fiche.php?id=".$ligne->id); - } - else - { - $_GET["action"] = 'create_line'; - $_GET["client"] = $_POST["client"]; - } - -} - -if ($_GET["action"] == 'delete' && $user->rights->telephonie->adsl->creer) -{ - $ligne = new LigneAdsl($db); - - if ( $ligne->delete($_GET["id"]) == 0) - { - Header("Location: liste.php"); - } - -} - -if ($_GET["action"] == 'ordertech') -{ - $ligne = new LigneAdsl($db); - $ligne->fetch_by_id($_GET["id"]); - - if ( $ligne->set_statut($user, 1) == 0) - { - Header("Location: fiche.php?id=".$ligne->id); - } - -} - -if ($_GET["action"] == 'cancelordertech') -{ - $ligne = new LigneAdsl($db); - $ligne->fetch_by_id($_GET["id"]); - - if ( $ligne->set_statut($user, -1) == 0) - { - Header("Location: fiche.php?id=".$ligne->id); - } - -} - -if ($_GET["action"] == 'refuse') -{ - $ligne = new LigneAdsl($db); - $ligne->fetch_by_id($_GET["id"]); - - $datea = $db->idate(mktime($h, $m , $s, - $_POST["remonth"], - $_POST["reday"], - $_POST["reyear"])); - - if ( $ligne->set_statut($user, 7, $datea, $_POST["commentaire"]) == 0) - { - Header("Location: fiche.php?id=".$ligne->id); - } - -} - -if ($_GET["action"] == 'resilier') -{ - $ligne = new LigneAdsl($db); - $ligne->fetch_by_id($_GET["id"]); - - $datea = $db->idate(mktime($h, $m , $s, - $_POST["remonth"], - $_POST["reday"], - $_POST["reyear"])); - - if ( $user->rights->telephonie->adsl->gerer && $ligne->statut == 4) - { - if ( $ligne->set_statut($user, 5, $datea, $_POST["commentaire"]) == 0) - { - Header("Location: fiche.php?id=".$ligne->id); - } - } - else - { - Header("Location: fiche.php?id=".$ligne->id); - } -} - -if ($_GET["action"] == 'annuleresilier') -{ - $ligne = new LigneAdsl($db); - $ligne->fetch_by_id($_GET["id"]); - - if ( $user->rights->telephonie->adsl->gerer && $ligne->statut == 5) - { - if ( $ligne->set_statut($user, 4) == 0) - { - Header("Location: fiche.php?id=".$ligne->id); - } - } - else - { - Header("Location: fiche.php?id=".$ligne->id); - } -} - -if ($_GET["action"] == 'resilierfourn') -{ - $ligne = new LigneAdsl($db); - $ligne->fetch_by_id($_GET["id"]); - - $datea = $db->idate(mktime($h, $m , $s, - $_POST["remonth"], - $_POST["reday"], - $_POST["reyear"])); - - if ( $user->rights->telephonie->adsl->gerer && $ligne->statut == 5) - { - if ( $ligne->set_statut($user, 6, $datea, $_POST["commentaire"]) == 0) - { - Header("Location: fiche.php?id=".$ligne->id); - } - } - else - { - Header("Location: fiche.php?id=".$ligne->id); - } -} - -if ($_GET["action"] == 'acquitresilierfourn') -{ - $ligne = new LigneAdsl($db); - $ligne->fetch_by_id($_GET["id"]); - - $datea = $db->idate(mktime($h, $m , $s, - $_POST["remonth"], - $_POST["reday"], - $_POST["reyear"])); - - if ( $user->rights->telephonie->adsl->gerer && $ligne->statut == 6) - { - if ( $ligne->set_statut($user, 7, $datea, $_POST["commentaire"]) == 0) - { - Header("Location: fiche.php?id=".$ligne->id); - } - } - else - { - Header("Location: fiche.php?id=".$ligne->id); - } -} - -if ($_GET["action"] == 'commandefourn' && $user->rights->telephonie->adsl->commander) -{ - $ligne = new LigneAdsl($db); - $ligne->fetch_by_id($_GET["id"]); - - $datea = $db->idate(mktime($h, $m , $s, - $_POST["remonth"], - $_POST["reday"], - $_POST["reyear"])); - - if ( $ligne->set_statut($user, 2, $datea, $_POST["commentaire"]) == 0) - { - Header("Location: fiche.php?id=".$ligne->id); - } -} - -if ($_GET["action"] == 'activefourn' && $user->rights->telephonie->adsl->gerer) -{ - $ligne = new LigneAdsl($db); - $ligne->fetch_by_id($_GET["id"]); - - $datea = $db->idate(mktime($h, $m , $s, - $_POST["remonth"], - $_POST["reday"], - $_POST["reyear"])); - - $ligne->update_info($_POST["ip"], $_POST["login"], $_POST["password"]); - - - if ( $ligne->set_statut($user, 3, $datea, $_POST["commentaire"]) == 0) - { - Header("Location: fiche.php?id=".$ligne->id); - } -} - -if ($_GET["action"] == 'livraison' && $user->rights->telephonie->adsl->gerer) -{ - $ligne = new LigneAdsl($db); - $ligne->fetch_by_id($_GET["id"]); - - $datea = $db->idate(mktime($h, $m , $s, - $_POST["remonth"], - $_POST["reday"], - $_POST["reyear"])); - - if ( $ligne->set_statut($user, 4, $datea, $_POST["commentaire"]) == 0) - { - Header("Location: fiche.php?id=".$ligne->id); - } -} - -if ($_GET["action"] == 'backbone' && $user->rights->telephonie->adsl->gerer) -{ - $ligne = new LigneAdsl($db); - $ligne->fetch_by_id($_GET["id"]); - - $datea = $db->idate(mktime($h, $m , $s, - $_POST["remonth"], - $_POST["reday"], - $_POST["reyear"])); - - if ( $ligne->set_statut($user, 9, $datea, $_POST["commentaire"]) == 0) - { - Header("Location: fiche.php?id=".$ligne->id); - } -} - -if ($_GET["action"] == 'acommander') -{ - $ligne = new LigneAdsl($db); - $ligne->fetch_by_id($_GET["id"]); - - if ( $ligne->set_statut($user, 1, '', $_POST["commentaire"]) == 0) - { - Header("Location: fiche.php?id=".$ligne->id); - } -} - - -if ($_POST["action"] == 'update' && $_POST["cancel"] <> $langs->trans("Cancel")) -{ - $ligne = new LigneAdsl($db); - $ligne->id = $_GET["id"]; - - $ligne->numero = $_POST["numero"]; - $ligne->client_comm = $_POST["client_comm"]; - $ligne->client = $_POST["client"]; - $ligne->client_facture = $_POST["client_facture"]; - $ligne->fournisseur = $_POST["fournisseur"]; - $ligne->commercial = $_POST["commercial"]; - $ligne->concurrent = $_POST["concurrent"]; - $ligne->remise = $_POST["remise"]; - $ligne->note = $_POST["note"]; - - if ( $ligne->update($user) ) - - { - $action = ''; - $mesg = 'Fiche mise � jour'; - } - else - { - $action = 're-edit'; - $mesg = 'Fiche non mise � jour !' . "
" . $entrepot->mesg_error; - } -} - -llxHeader("","","Fiche Liaison"); - -if ($cancel == $langs->trans("Cancel")) -{ - $action = ''; -} - -/* - * Cr�ation en 2 �tape - * - */ -if ($_GET["action"] == 'create') -{ - $form = new Form($db); - print_titre("Nouvelle liaison ADSL"); - - if (is_object($ligne)) - { - // La cr�ation a �chou�e - print $ligne->error_message; - } - else - { - $ligne = new LigneAdsl($db); - } - - print '
'; - print ''; - - print ''; - - print ''; - - print ''."\n"; - print '
Client'; - $ff = array(); - $sql = "SELECT rowid, nom, ville FROM ".MAIN_DB_PREFIX."societe WHERE client=1 ORDER BY nom "; - $resql = $db->query($sql); - if ( $resql ) - { - $num = $db->num_rows($resql); - if ( $num > 0 ) - { - $i = 0; - while ($i < $num) - { - $row = $db->fetch_row($resql); - $ff[$row[0]] = stripslashes($row[1]) . " (".$row[2].")"; - $i++; - } - } - $db->free($resql); - } - $form->select_array("client",$ff,$ligne->client_comm); - print '
 
'."\n"; - print '
'; -} -elseif ($_GET["action"] == 'create_line' && $_GET["client"] > 0) -{ - $form = new Form($db); - print_titre("Nouvelle liaison ADSL"); - - if (is_object($ligne)) - { - // La cr�ation a �chou�e - print '
'.$ligne->error_message.'
'; - } - else - { - $ligne = new LigneAdsl($db); - $ligne->client_install_id = $_GET["client"]; - $ligne->client_facture_id = $_GET["client"]; - } - - $socc = new Societe($db); - if ( $socc->fetch($_GET["client"]) == 1) - { - - if (strlen($socc->code_client) == 0) - { - print ''; - print ''; - - print ''; - print '
Client'; - print ''.$socc->nom.''; - print '
Code client'; - print $socc->code_client; - print '


'; - print 'Impossible de cr�er une ligne pour cette societe, vous devez au prealablement lui affecter un code client.'; - } - elseif (strlen($socc->code_client) > 0 && $socc->check_codeclient() <> 0) - { - print ''; - print ''; - - print ''; - print '
Client'; - print ''.$socc->nom.''; - print '
Code client'; - print $socc->code_client; - print '


'; - print 'Le code client de cette societe est incorrect, vous devez lui affecter un code client correct.'; - } - else - { - print "
\n"; - print ''; - print ''; - print ''."\n"; - if ($_GET['contratid'] > 0) - { - print ''."\n"; - } - - print ''; - print ''; - - print ''; - } - elseif($i == 1) - { - print $contrats[0][1]; - print ''; - print ''."\n"; - } - else - { - $form->select_array("contrat",$contrats_id); - print ''; - } - - // On continue si il existe des contrats - if (sizeof($contrats) > 0) - { - print ''; - - print '"; - - print ''; - - /* - * Type - */ - - print ''; - /* - * Fournisseur - */ - print ''; - - /* - * Commercial - */ - print ''; - - print ''."\n"; - - print ''."\n"; - print '
Client'; - print "$socc->nom ($socc->code_client)"; - print '
Contrat'; - - $contrats = array(); - $contrats_id = array(); - $sql = "SELECT rowid, ref FROM ".MAIN_DB_PREFIX."telephonie_contrat WHERE fk_soc = ".$socc->id.";"; - if ( $resql = $db->query( $sql) ) - { - $i = 0; - while ($row = $db->fetch_row($resql)) - { - $contrats[$i] = $row; - $contrats_id[$row[0]] = $row[1]; - $i++; - } - $db->free($resql); - } - - if ($i == 0) - { - print "Pas de contrat en cours"; - print '
Num�ro de la ligne t�l�phonique
Client (Agence/Filiale)'; - $ff = array(); - $sql = "SELECT rowid, nom, ville FROM ".MAIN_DB_PREFIX."societe WHERE client=1 ORDER BY nom "; - if ( $db->query( $sql) ) - { - $num = $db->num_rows(); - if ( $num > 0 ) - { - $i = 0; - while ($i < $num) - { - $row = $db->fetch_row(); - $ff[$row[0]] = stripslashes($row[1]) . " (".$row[2].")"; - $i++; - } - } - $db->free(); - } - $form->select_array("client_install",$ff,$ligne->client_install_id); - print " (Correspond � l'adresse d'installation)
Client � facturer'; - $ff = array(); - $sql = "SELECT rowid, nom, ville FROM ".MAIN_DB_PREFIX."societe WHERE client=1 ORDER BY nom "; - if ( $db->query( $sql) ) - { - $num = $db->num_rows(); - if ( $num > 0 ) - { - $i = 0; - while ($i < $num) - { - $row = $db->fetch_row(); - $ff[$row[0]] = stripslashes($row[1]) . " (".$row[2].")"; - $i++; - } - } - $db->free(); - } - $form->select_array("client_facture",$ff,$ligne->client_facture_id); - print '
D�bit de la ligne'; - $ff = array(); - $sql = "SELECT rowid, intitule FROM ".MAIN_DB_PREFIX."telephonie_adsl_type WHERE commande_active = 1 ORDER BY intitule "; - if ( $db->query( $sql) ) - { - $num = $db->num_rows(); - if ( $num > 0 ) - { - $i = 0; - while ($i < $num) - { - $row = $db->fetch_row(); - $ff[$row[0]] = $row[1]; - $i++; - } - } - $db->free(); - - } - $form->select_array("type",$ff,$ligne->type); - print '
Fournisseur'; - $ff = array(); - $sql = "SELECT f.rowid, f.nom FROM ".MAIN_DB_PREFIX."societe as f"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_adsl_fournisseur as fa"; - $sql .= " WHERE fa.commande_active = 1 AND fa.fk_soc = f.rowid ORDER BY f.nom "; - if ( $db->query( $sql) ) - { - $num = $db->num_rows(); - if ( $num > 0 ) - { - $i = 0; - while ($i < $num) - { - $row = $db->fetch_row(); - $ff[$row[0]] = stripslashes($row[1]); - $i++; - } - } - $db->free(); - } - else - { - print $db->error(); - } - $form->select_array("fournisseur",$ff,$ligne->fournisseur); - print '
Commercial'; - $ff = array(); - $sql = "SELECT rowid, name, firstname FROM ".MAIN_DB_PREFIX."user ORDER BY name "; - if ( $db->query( $sql) ) - { - $num = $db->num_rows(); - if ( $num > 0 ) - { - $i = 0; - while ($i < $num) - { - $row = $db->fetch_row($i); - $ff[$row[0]] = stripslashes($row[1]) . " " . stripslashes($row[2]); - $i++; - } - } - $db->free(); - - } - - $form->select_array("commercial",$ff,$ligne->commercial); - - print '
Note'."\n"; - print '
 
'."\n"; - print '
'; - } - else - { - print ''."\n"; - print ''; - print 'Nouveau contrat'; - } - - - } - - } - else - { - print "Erreur"; - } -} -else -{ - if ($_GET["id"] or $_GET["numero"]) - { - if ($_GET["action"] <> 're-edit') - { - $ligne = new LigneAdsl($db); - if ($_GET["id"]) - { - $result = $ligne->fetch_by_id($_GET["id"]); - } - if ($_GET["numero"]) - { - $result = $ligne->fetch($_GET["numero"]); - } - } - - if ( $result ) - { - if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit') - { - - $h=0; - $head[$h][0] = DOL_URL_ROOT."/telephonie/adsl/fiche.php?id=".$ligne->id; - $head[$h][1] = $langs->trans("Liaison ADSL"); - $hselected = $h; - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/adsl/history.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Historique'); - $h++; - - dol_fiche_head($head, $hselected, 'Liaison ADSL : '.$ligne->numero); - - print_fiche_titre('Fiche Liaison ADSL', $mesg); - - print ''; - - $client = new Societe($db, $ligne->client_id); - $client->fetch($ligne->client_id); - - print ''; - - print ''; - print ''; - - print ''; - print ''; - - $client_install = new Societe($db, $ligne->client_install_id); - $client_install->fetch($ligne->client_install_id); - - print ''; - - $client_facture = new Societe($db); - $client_facture->fetch($ligne->client_facture_id); - - print ''; - print ''; - print ''; - - $commercial = new User($db, $ligne->commercial_id); - $commercial->fetch(); - - print ''; - print ''; - - - if ( $user->rights->telephonie->adsl->gerer) - { - print ''; - print ''; - print ''; - } - - print ''; - - - - print "
Client'; - print ''; - - print $client->nom.''.$client->code_client; - print '
Num�ro'.dol_print_phone($ligne->numero,0,0,true).' 
D�bit de la liaison'.$ligne->type.'Prix de vente : '.price($ligne->prix).' euros HT
Client (Agence/Filiale)'; - print $client_install->nom.'
'; - - print $client_install->cp . " " .$client_install->ville; - print '
Client Factur�'; - print $client_facture->nom.'
'; - print $client_facture->cp . " " .$client_facture->ville; - - print '
'; - - if ($ligne->mode_paiement == 'pre') - { - print 'RIB : '.$client_facture->display_rib(); - } - else - { - print 'Paiement par virement'; - } - - print '
Contrat'; - print substr("00000000".$ligne->contrat_id,-8).'
Commercial'.$commercial->fullname.'
IP'.$ligne->ip.'
Login'.$ligne->login.'
Password'.$ligne->password.'
Statut'; - print ' '; - print $ligne->statuts[$ligne->statut]; - print '
"; - } - - print ''; - - } - } - else - { - print "Error"; - } -} - -$form = new Form($db); - -if ( $user->rights->telephonie->adsl->commander && $ligne->statut == 1) -{ - /** - * - */ - - print '
'; - - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print '
Commande chez le fournisseur'; - print '
Date de la commande'; - print $form->select_date('','','','','',"commandefourn"); - print '
Commentaire
'; - - print '
'; - - print ' 
'; -} - -if ( $user->rights->telephonie->adsl->gerer && $ligne->statut == 2) -{ - /** - * - */ - - print '
'; - - print '
'; - print ''; - print ''; - print ''; - - print ''; - - print ''; - print ''; - print ''; - - print ''; - - print '
Activ�e chez le fournisseur'; - print "
Date de l'activation"; - print $form->select_date('','','','','',"activefourn"); - print '
Commentaire
Adresse IP affect�e
Login
Password
'; - - print '
'; - - print ' 
'; -} - -if ( $user->rights->telephonie->adsl->gerer && $ligne->statut == 3) -{ - print '
'; - - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print '
Programm� sur le backbone'; - print "
Date de la programmation"; - print $form->select_date('','','','','',"backbone"); - print '
Commentaire
'; - print '
'; - print ' 
'; -} - -if ( $user->rights->telephonie->adsl->gerer && $ligne->statut == 9) -{ - print '
'; - - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print '
Livr�e au client'; - print "
Date de la livraison client"; - print $form->select_date('','','','','',"livraison"); - print '
Commentaire
'; - print '
'; - print ' 
'; -} - -if ( $user->rights->telephonie->adsl->gerer && $ligne->statut == 4) -{ - print '
'; - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print '
A r�silier'; - print '
Date de r�siliation demand�e'; - print $form->select_date('','','','','',"resilier"); - print '
Commentaire
'; - print ' 
'; -} - -if ( $user->rights->telephonie->adsl->gerer && $ligne->statut == 5) -{ - print '
'; - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print '
Demande de r�siliatin fournisseur'; - print '
Date de la demande de r�siliation'; - print $form->select_date('','','','','',"resilierfourn"); - print '
Commentaire
'; - print ' 
'; -} - -if ( $user->rights->telephonie->adsl->gerer && $ligne->statut == 6) -{ - print '
'; - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print '
Confirmation de r�siliatin fournisseur'; - print '
Date de la confirmation de r�siliation'; - print $form->select_date('','','','','',"acquitresilierfourn"); - print '
Commentaire
'; - print ' 
'; -} - -/* ************************************************************************** */ -/* */ -/* Barre d'action */ -/* */ -/* ************************************************************************** */ - -print "\n
\n
\n"; - -if ($_GET["action"] == '') -{ - - if ( $user->rights->telephonie->adsl->requete && $ligne->statut == -1) - { - print "id\">".$langs->trans("Commander").""; - } - - if ( $user->rights->telephonie->adsl->requete && $ligne->statut == 1) - { - print "id\">".$langs->trans("Annuler la commande").""; - - } - - if ( $user->rights->telephonie->adsl->requete && $ligne->statut == 5) - { - print "id\">".$langs->trans("Annuler la demande de r�siliation").""; - - } - - if ( $user->rights->telephonie->adsl->creer && $ligne->statut == -1) - { - print "id\">".$langs->trans("Delete").""; - - } -} - -print "
"; - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/adsl/fournisseurxdsl.class.php b/htdocs/telephonie/adsl/fournisseurxdsl.class.php deleted file mode 100644 index f04773ee232..00000000000 --- a/htdocs/telephonie/adsl/fournisseurxdsl.class.php +++ /dev/null @@ -1,129 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -class FournisseurXdsl { - var $db; - var $id; - - /** - * Constructeur de la classe - * - */ - function FournisseurXdsl($DB, $id=0, $user=0) - { - global $config; - $this->id = $id; - $this->db = $DB; - $this->error_message = ''; - - return 1; - } - /** - * Cree le fournisseur dans la base de donnees - * - */ - function Create($user) - { - if ($this->socid > 0) - { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_adsl_fournisseur"; - $sql .= " (fk_soc, commande_active)"; - $sql .= " VALUES ("; - $sql .= " $this->socid,1)"; - - $resql = $this->db->query($sql); - - if ( $resql ) - { - $this->id = $this->db->last_insert_id($resql); - return 0; - } - else - { - dol_syslog("FournisseurXdsl::Create Error -3"); - return -3; - } - } - else - { - dol_syslog("FournisseurXdsl::Create Error -2"); - return -2; - } - } - /** - * - * - */ - function SwitchCommandeActive($id) - { - $sql= "UPDATE ".MAIN_DB_PREFIX."telephonie_adsl_fournisseur as f"; - $sql.= " SET commande_active = abs(commande_active -1) WHERE f.rowid =".$id.";"; - - $resql=$this->db->query($sql); - - if ($resql) - { - return 0; - } - else - { - dol_syslog("FournisseurXdsl::SwithCommandeActive Error -20", LOG_ERR); - return -20; - } - - } - /** - * Retourne la liste des fournisseurs - * - */ - function ListArray() - { - $arr = array(); - - $sql = "SELECT f.rowid, s.nom, f.commande_active"; - $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."telephonie_adsl_fournisseur as f"; - $sql.= " WHERE s.fournisseur = 1 AND s.rowid=f.fk_soc"; - - $resql=$this->db->query($sql); - - if ($resql) - { - while ($obj=$this->db->fetch_object($resql)) - { - $arr[$obj->rowid]['rowid'] = $obj->rowid; - $arr[$obj->rowid]['name'] = stripslashes($obj->nom); - $arr[$obj->rowid]['commande_active'] = $obj->commande_active; - } - - } - else - { - dol_print_error($this->db); - $this->error=$this->db->error(); - - } - - return $arr; - } - -} -?> diff --git a/htdocs/telephonie/adsl/history.php b/htdocs/telephonie/adsl/history.php deleted file mode 100644 index 2fa4f2fc66f..00000000000 --- a/htdocs/telephonie/adsl/history.php +++ /dev/null @@ -1,136 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require("./pre.inc.php"); - -if (!$user->rights->telephonie->adsl->lire) accessforbidden(); - -$mesg = ''; - -llxHeader("","","Historique Liaison ADSL"); - -/* - * Affichage - * - */ - -if ($_GET["id"]) -{ - if ($_GET["action"] <> 're-edit') - { - $ligne = new LigneADSL($db); - - $result = $ligne->fetch_by_id($_GET["id"]); - } - - if ( $result ) - { - $h=0; - $head[$h][0] = DOL_URL_ROOT."/telephonie/adsl/fiche.php?id=".$ligne->id; - $head[$h][1] = $langs->trans("Liaison ADSL"); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/adsl/history.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Historique'); - $hselected = $h; - $h++; - - dol_fiche_head($head, $hselected, 'Liaison ADSL : '.$ligne->numero); - - print ''; - - print ''; - - - $client = new Societe($db, $ligne->client_id); - $client->fetch($ligne->client_id); - - print ''; - - print ''; - - print ''; - - /* historique */ - - $sql = "SELECT ".$db->pdate("l.tms").", l.statut, l.fk_user, u.name, u.firstname, l.comment"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_adsl_ligne_statut as l"; - $sql .= ",".MAIN_DB_PREFIX."user as u"; - $sql .= " WHERE u.rowid = l.fk_user AND l.fk_ligne = ".$ligne->id; - $sql .= " ORDER BY l.tms DESC "; - - $resql = $db->query($sql); - - if ( $resql ) - { - $num = $db->num_rows($resql); - if ( $num > 0 ) - { - $i = 0; - while ($i < $num) - { - $row = $db->fetch_row($resql); - - print ''; - - print '"; - $i++; - } - } - $db->free($resql); - } - else - { - print $sql; - } - - /* Fin Contacts */ - - print "
Num�ro de support'.dol_print_phone($ligne->numero,0,0,true).'
Client'.$client->nom.'
Statut'; - print ' '; - print $ligne->statuts[$ligne->statut]; - print '
Historique
'.strftime("%a %d %B %Y %H:%M:%S",$row[0]).' '; - print $ligne->statuts[$row[1]]; - if ($row[5]) - { - print '
'.$row[5]; - } - - print '
'.$row[4] . " " . $row[3] . "
"; - } - - /* - * - * - * - */ - -} -else -{ - print "Error"; -} - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/adsl/index.php b/htdocs/telephonie/adsl/index.php deleted file mode 100644 index 076d1f17aaa..00000000000 --- a/htdocs/telephonie/adsl/index.php +++ /dev/null @@ -1,116 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if (!$user->rights->telephonie->adsl->lire) accessforbidden(); - -llxHeader('','Telephonie'); - -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -/* - * Mode Liste - * - */ - -print ''; - -print ''; - -print '
'; - -print '
'; -print ''; -print ''; -print "\n"; -print ""; -print ''; -print '
Recherche ligne
Numéro
'; - -print '
'; - - -$sql = "SELECT distinct statut, count(*) as cc"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_adsl_ligne as l"; -$sql .= " GROUP BY statut"; - -if ($db->query($sql)) -{ - $num = $db->num_rows(); - $i = 0; - $ligne = new LigneAdsl($db); - - print ''; - print ''; - print "\n"; - $var=True; - - while ($i < min($num,$conf->liste_limit)) - { - $obj = $db->fetch_object(); - $values[$obj->statut] = $obj->cc; - $i++; - } - - foreach ($ligne->statuts_order as $keyo => $statut) - { - $var=!$var; - $key = $statut; - print ""; - print "\n"; - print "\n"; - print ''; - print "\n"; - } - - print "
Liaisons StatutsNb 
".$ligne->statuts[$statut]."".$values[$key]."
"; - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - -print '
'; - -/* - * - * - */ - -print '
'; - -print '
'; - - - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/adsl/ligneadsl.class.php b/htdocs/telephonie/adsl/ligneadsl.class.php deleted file mode 100644 index 79496cbd5e8..00000000000 --- a/htdocs/telephonie/adsl/ligneadsl.class.php +++ /dev/null @@ -1,298 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require_once(DOL_DOCUMENT_ROOT.'/telephonie/workflowtel.class.php'); - -class LigneAdsl { - var $db; - - var $id; - var $ligne; - - function LigneAdsl($DB, $id=0) - { - global $config; - $this->id = $id; - - $this->db = $DB; - $this->error_message = ''; - $this->statuts[-1] = "En attente"; - $this->statuts[1] = "A commander"; - $this->statuts[2] = "Commandée chez le fournisseur"; - $this->statuts[3] = "Activée chez le fournisseur"; - $this->statuts[4] = "Installée chez le client"; - $this->statuts[5] = "A résilier"; - $this->statuts[6] = "Résiliation demandée"; - $this->statuts[7] = "Résiliée"; - $this->statuts[8] = "Rejetée"; - $this->statuts[9] = "Backbone programmé"; - - $this->statuts_order[0] = -1; - $this->statuts_order[1] = 1; - $this->statuts_order[2] = 2; - $this->statuts_order[3] = 3; - $this->statuts_order[4] = 9; - $this->statuts_order[5] = 4; - $this->statuts_order[6] = 5; - $this->statuts_order[7] = 6; - $this->statuts_order[8] = 7; - $this->statuts_order[9] = 8; - - return 1; - } - /* - * - * - */ - function update($user) - { - $sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_societe_ligne"; - $sql .= " SET "; - $sql .= " fk_client_comm = $this->client_comm, "; - $sql .= " fk_soc = $this->client, "; - $sql .= " ligne = '$this->numero', "; - $sql .= " fk_soc_facture = $this->client_facture, "; - $sql .= " fk_fournisseur = $this->fournisseur, "; - $sql .= " fk_commercial = $this->commercial, "; - $sql .= " fk_concurrent = $this->concurrent, "; - $sql .= " note = '$this->note',"; - $sql .= " remise = '$this->remise'"; - $sql .= " WHERE rowid = $this->id"; - - if ( $this->db->query($sql) ) - { - return 1; - } - else - { - print $this->db->error(); - print $sql ; - return 0; - } - } - - /* - * - * - */ - function create($user) - { - if (strlen(trim($this->numero)) == 10) - { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_adsl_ligne"; - $sql .= " (fk_client, fk_client_install, fk_client_facture, fk_contrat, numero_ligne, fk_type, fk_fournisseur, note, fk_commercial, statut, fk_user_creat)"; - $sql .= " VALUES ("; - $sql .= " $this->client,$this->client_install,$this->client_facture,'$this->contrat','$this->numero',$this->type,$this->fournisseur, '$this->note',$this->commercial, -1,$user->id)"; - - $resql = $this->db->query($sql); - - if ( $resql ) - { - $this->id = $this->db->last_insert_id($resql); - - // Appel le workflow - $wkf = new WorkflowTelephonie($this->db); - $wkf->notify('xdsl', -1, $this->numero); - - return 0; - } - else - { - $lex = new LigneAdsl($this->db); - if ($lex->fetch($this->numero) == 1) - { - $this->error_message = "Echec de la création de la ligne, cette ligne existe déjà !"; - dol_syslog("LigneAdsl::Create Error -3"); - return -3; - } - else - { - $this->error_message = "Echec de la création de la ligne"; - dol_syslog("LigneAdsl::Create Error -1"); - dol_syslog("LigneAdsl::Create $sql"); - return -1; - } - } - } - else - { - $this->error_message = "Echec de la création de la ligne, le numéro de la ligne est incorrect !"; - dol_syslog("LigneAdsl::Create Error -2"); - return -2; - } - } - /* - * - * - */ - function fetch_by_id($id) - { - return $this->fetch(0, $id); - } - - function delete($id) - { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_adsl_ligne_statut"; - $sql .= " WHERE fk_ligne = ".$id; - - if ($this->db->query($sql)) - { - - $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_adsl_ligne"; - $sql .= " WHERE rowid = ".$id; - - if ($this->db->query($sql)) - { - return 0; - } - else - { - dol_syslog("LigneAdsl::Delete Error -1"); - return -1; - } - } - else - { - dol_syslog("LigneAdsl::Delete Error -2"); - return -2; - } - } - - function fetch($ligne, $id = 0) - { - $sql = "SELECT l.rowid, l.fk_client, l.fk_client_install, l.fk_client_facture, l.fk_fournisseur, l.numero_ligne, l.note, l.statut, l.fk_commercial"; - $sql .= ", l.ip, l.login, l.password, l.prix, l.fk_contrat"; - $sql .= " , t.intitule AS type"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_adsl_ligne as l"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_adsl_type as t"; - $sql .= " WHERE t.rowid = l.fk_type"; - - if ($id > 0) - { - $sql .= " AND l.rowid = ".$id; - } - else - { - $sql .= " AND l.numero_ligne = ".$ligne; - } - $resql = $this->db->query($sql); - if ($resql) - { - if ($this->db->num_rows($resql)) - { - $obj = $this->db->fetch_object($resql); - - $this->id = $obj->rowid; - $this->socid = $obj->fk_soc; - $this->numero = $obj->numero_ligne; - $this->remise = $obj->remise; - $this->client_id = $obj->fk_client; - $this->client_install_id = $obj->fk_client_install; - $this->client_facture_id = $obj->fk_client_facture; - $this->fournisseur_id = $obj->fk_fournisseur; - $this->commercial_id = $obj->fk_commercial; - $this->contrat_id = $obj->fk_contrat; - $this->type = $obj->type; - $this->prix = $obj->prix; - $this->statut = $obj->statut; - - $this->ip = $obj->ip; - $this->login = $obj->login; - $this->password = $obj->password; - - $this->mode_paiement = 'pre'; - - $result = 1; - } - else - { - $result = -2; - } - - $this->db->free($resql); - } - else - { - /* Erreur select SQL */ - print $this->db->error(); - $result = -1; - } - - return $result; - } - - /** - * - * - * - */ - - function update_info($ip, $login, $password) - { - $sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_adsl_ligne"; - $sql .= " SET ip = '".$ip ."'"; - $sql .= " , login = '".$login."'" ; - $sql .= " , password = '".$password."'" ; - - $sql .= " WHERE rowid =".$this->id; - - $this->db->query($sql); - } - - /** - * Change le statut de la ligne - * - */ - function set_statut($user, $statut, $datea='', $commentaire='') - { - $sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_adsl_ligne"; - $sql .= " SET statut = ".$statut ; - - $sql .= " WHERE rowid =".$this->id; - - $this->db->query($sql); - - if ($datea <> '') - { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_adsl_ligne_statut"; - $sql .= " (tms,fk_ligne, fk_user, statut, comment) "; - $sql .= " VALUES ($datea,$this->id, $user->id, $statut, '$commentaire' )"; - - $this->db->query($sql); - } - else - { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_adsl_ligne_statut"; - $sql .= " (tms, fk_ligne, fk_user, statut, comment) "; - $sql .= " VALUES (now(), $this->id, $user->id, $statut, '$commentaire' )"; - - $this->db->query($sql); - } - - // Appel le workflow - $wkf = new WorkflowTelephonie($this->db); - $wkf->notify('xdsl', $statut, $this->numero, $commentaire); - - return 0; - } - -} -?> diff --git a/htdocs/telephonie/adsl/liste.php b/htdocs/telephonie/adsl/liste.php deleted file mode 100644 index c7857c6d914..00000000000 --- a/htdocs/telephonie/adsl/liste.php +++ /dev/null @@ -1,157 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if (!$user->rights->telephonie->adsl->lire) accessforbidden(); - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; -$sortfield = $_GET["sortfield"]; - -llxHeader('','Telephonie - Ligne - Liste'); -/* - * S�curit� acc�s client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -/* - * Recherche - * - * - */ - -$offset = $conf->liste_limit * $page ; -if ($sortorder == "") $sortorder="ASC"; -if ($sortfield == "") $sortfield="la.statut ASC, s.nom"; - -/* - * Mode Liste - * - * - */ - -$sql = "SELECT la.rowid, fk_client, s.nom as nom, la.numero_ligne, la.statut, t.intitule"; -$sql .= " , s.rowid as socid"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_adsl_ligne as la"; -$sql .= " , ".MAIN_DB_PREFIX."societe as s"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_adsl_type as t"; -$sql .= " WHERE la.fk_client = s.rowid"; -$sql .= " AND t.rowid = la.fk_type"; - -if ($_GET["search_ligne"]) -{ - $sel =urldecode($_GET["search_ligne"]); - $sel = ereg_replace("\.","",$sel); - $sel = ereg_replace(" ","",$sel); - $sql .= " AND la.numero_ligne LIKE '%".$sel."%'"; -} - -if ($_GET["search_client"]) -{ - $sel =urldecode($_GET["search_client"]); - $sql .= " AND s.nom LIKE '%".$sel."%'"; -} - -if (strlen($_GET["statut"])) -{ - $sql .= " AND la.statut = ".$_GET["statut"]; -} - -$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); - -$resql = $db->query($sql); -if ($resql) -{ - $num = $db->num_rows($resql); - $i = 0; - - $urladd= "&statut=".$_GET["statut"]; - - print_barre_liste("Liaisons ADSL", $page, "liste.php", $urladd, $sortfield, $sortorder, '', $num); - print"\n\n"; - print ''; - print ''; - - print_liste_field_titre("Ligne","liste.php","l.ligne"); - print_liste_field_titre("Client","liste.php","s.nom"); - - print ''; - print ''; - - print "\n"; - - print ''; - print ''; - print ''; - print ''; - print ''; - - print ''; - print ''; - print ''; - - - $var=True; - - $ligne = new LigneAdsl($db); - - while ($i < min($num,$conf->liste_limit)) - { - $obj = $db->fetch_object($resql); - $var=!$var; - - print "\n"; - - print ''; - print ''; - - print '\n"; - - print "\n"; - $i++; - } - print "
TypeStatut
 
"; - - print ' '; - - print ''; - print img_file(); - print ' '; - - print ''.dol_print_phone($obj->numero_ligne,0,0,true)."'.img_object($langs->trans("Fiche Compta"),"bill")." "; - - print ' '.$obj->nom.''.$obj->intitule.''.$ligne->statuts[$obj->statut]."
"; - $db->free($resql); -} -else -{ - print $db->error($resql) . ' ' . $sql; -} - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/adsl/pre.inc.php b/htdocs/telephonie/adsl/pre.inc.php deleted file mode 100644 index ced2dd1662c..00000000000 --- a/htdocs/telephonie/adsl/pre.inc.php +++ /dev/null @@ -1,51 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("../../main.inc.php"); -require(DOL_DOCUMENT_ROOT."/telephonie/adsl/ligneadsl.class.php"); -$user->getrights('telephonie'); - -function llxHeader($head = "", $title="") { - global $user, $conf; - - /* - * - * - */ - top_menu($head, $title); - - $menu = new Menu(); - - $menu->add(DOL_URL_ROOT."/telephonie/adsl/index.php", "Liens xDSL"); - - $menu->add_submenu(DOL_URL_ROOT."/telephonie/adsl/liste.php", "Liste"); - - $menu->add_submenu(DOL_URL_ROOT."/telephonie/adsl/fiche.php?action=create", "Nouvelle liaison"); - - $menu->add(DOL_URL_ROOT."/telephonie/index.php", "Telephonie"); - - if ($user->rights->telephonie->configurer) - $menu->add(DOL_URL_ROOT."/telephonie/config/xdsl_product.php", "Configuration"); - - left_menu($menu->liste); -} - -?> diff --git a/htdocs/telephonie/adsl/productxdsl.class.php b/htdocs/telephonie/adsl/productxdsl.class.php deleted file mode 100644 index 308faf9c3e6..00000000000 --- a/htdocs/telephonie/adsl/productxdsl.class.php +++ /dev/null @@ -1,129 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -class ProductXdsl { - var $db; - var $id; - - /** - * Constructeur de la classe - * - */ - function ProductXdsl($DB, $id=0, $user=0) - { - global $config; - $this->id = $id; - $this->db = $DB; - $this->error_message = ''; - - return 1; - } - /** - * Cree le product dans la base de donnees - * - */ - function Create($user) - { - if ($this->prodid > 0) - { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_adsl_type"; - $sql .= " (fk_product, commande_active, intitule)"; - $sql .= " VALUES ("; - $sql .= " $this->prodid,1,'".addslashes($this->intitule)."')"; - - $resql = $this->db->query($sql); - - if ( $resql ) - { - $this->id = $this->db->last_insert_id($resql); - return 0; - } - else - { - dol_syslog("ProductXdsl::Create Error -3"); - return -3; - } - } - else - { - dol_syslog("ProductXdsl::Create Error -2"); - return -2; - } - } - /** - * - * - */ - function SwitchCommandeActive($id) - { - $sql= "UPDATE ".MAIN_DB_PREFIX."telephonie_adsl_type as t"; - $sql.= " SET commande_active = abs(commande_active -1) WHERE t.rowid =".$id.";"; - - $resql=$this->db->query($sql); - - if ($resql) - { - return 0; - } - else - { - dol_syslog("ProductXdsl::SwithCommandeActive Error -20", LOG_ERR); - return -20; - } - - } - /** - * Retourne la liste des produits - * - */ - function ListArray() - { - $arr = array(); - - $sql = "SELECT t.rowid, t.intitule, t.commande_active"; - $sql.= " FROM ".MAIN_DB_PREFIX."product as p,".MAIN_DB_PREFIX."telephonie_adsl_type as t"; - $sql.= " WHERE p.rowid=t.fk_product;"; - - $resql=$this->db->query($sql); - - if ($resql) - { - while ($obj=$this->db->fetch_object($resql)) - { - $arr[$obj->rowid]['rowid'] = $obj->rowid; - $arr[$obj->rowid]['intitule'] = stripslashes($obj->intitule); - $arr[$obj->rowid]['commande_active'] = $obj->commande_active; - } - - } - else - { - dol_print_error($this->db); - $this->error=$this->db->error(); - - } - - return $arr; - } - -} -?> diff --git a/htdocs/telephonie/adsl/statut-1.png b/htdocs/telephonie/adsl/statut-1.png deleted file mode 100644 index 7a8fb19836863bc7b7f7eee1f809db6adf2fc626..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 198 zcmeAS@N?(olHy`uVBq!ia0vp^JRr=$1|-8uW1a&kwj^(N7l!`~4GjPP3v~Pgif|Tq zL>2>eTxVe5JHn{gn6eot$X?><>&kwGi=9VV&|ki)3@9X9;u=xnoS&PUnpeW$T$Gwv zlA5AWo>`Ki5R#Fq;O^-g@IFN~52#Sf)5S5Q;#P7>Lc)*p4onG&2|&jG`4+Z4Jv}@= lJSt6ryv@$c$}2sY87}9risv)*uLbI2@O1TaS?83{1OPk+H@pA< diff --git a/htdocs/telephonie/adsl/statut1.png b/htdocs/telephonie/adsl/statut1.png deleted file mode 100644 index 134f1b74b305154a2e4ab14812c4ffa37f6c9035..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 197 zcmeAS@N?(olHy`uVBq!ia0vp^JRr=$1|-8uW1a&kwj^(N7l!{JxM1({$v_d#0*}aI zppNSd417lz6&q7F0|nVjJbhi+uW+$)vg%Z1?^gy2$(FcAlsM<-=BDPAFgO>bCYGe8 zD3oWGWGIAWq$;?3`UbpDQOyG?)bw<545_%4oRX06n*WJ_ElN}Tg^b5rw57@Uhz6H8K4 z6v{J8G895GQWe}ieFNU7sOA9`I(xb}hG?8mPDx1kao&L`p)ugdtHhLqBn3f%^$+cp zIi(hKbzW{*GGhaq$*a3 L)z4*}Q$iB}cQ{96 diff --git a/htdocs/telephonie/adsl/statut4.png b/htdocs/telephonie/adsl/statut4.png deleted file mode 100644 index c302208de8f4f9cf3378248ce8187df1561dcc62..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 193 zcmeAS@N?(olHy`uVBq!ia0vp^JRr=$1|-8uW1a&kwj^(N7l!{JxM1({$v_d#0*}aI zppNSd417lz6&q7F0|nVjJbhi+ud{P<$eI~3?VSJ=k}YwKC~?lu%}vcKVQ?-=O)N=G zQ7F$W$xsN%NL6t6^bL5QqM8R(sOstB7@~1LIVBbCYGe8 zD3oWGWGIAWq$;?3`UbpDQOyG?)bez345_%4oRX06gTe~DWM4f+%-8K diff --git a/htdocs/telephonie/adsl/statut7.png b/htdocs/telephonie/adsl/statut7.png deleted file mode 100644 index 4d8f59be1c226e76c2ddc5a89f5bde2f7de5da8e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 193 zcmeAS@N?(olHy`uVBq!ia0vp^JRr=$1|-8uW1a&kwj^(N7l!{JxM1({$v_d#0*}aI zppNSd417lz6&q7F0|nVjJbhi+uW+&RC~7F_O!xy7k}YwKC~?lu%}vcKVQ?-=O)N=G zQ7F$W$xsN%NL6t6^bL5QqM8R(sOstB7*cU7IVBZOB%3JUOAoFUl*+*Fxn1%h!w7D+FqJxR0yKO#>Rh;OXk;vd$@?2>{d!Kmh;% diff --git a/htdocs/telephonie/adsl/statut9.png b/htdocs/telephonie/adsl/statut9.png deleted file mode 100644 index b02747c3f7f18bf6fedc4eeaa8332be6bac3b5d9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 221 zcmeAS@N?(olHy`uVBq!ia0vp^JRr=$1|-8uW1a&kwj^(N7l!{JxM1({$v_d#0*}aI zppNSd417lz6&q7F0|nVjJbhi+ud{P<$SXEKkGcvJk}YwKC~?lu%}vcKVQ?-=O)N=G zQ7F$W$xsN%NL6t6^bL5QqM8R(=;-O<7@~1LIVB - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -/* - * Sécurité accés client - */ - -if (!$user->rights->telephonie->ca->lire) accessforbidden(); - -llxHeader('','Telephonie - CA par client'); - -/* - * - * - * - */ -print ''; - -print ''; -print '
'; - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; -$sortfield = $_GET["sortfield"]; -$offset = $conf->liste_limit * $page ; -$pageprev = $page - 1; -$pagenext = $page + 1; - -if ($sortorder == "") $sortorder="DESC"; -if ($sortfield == "") $sortfield="ca"; - -$sql = "SELECT nom, ca, gain, cout, marge, fk_client_comm"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_client_stats"; -$sql .= " , " .MAIN_DB_PREFIX."societe"; -$sql .= " WHERE rowid = fk_client_comm"; -$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); -$resql = $db->query($sql); -if ($resql) -{ - $num = $db->num_rows($resql); - $i = 0; - - print_barre_liste("CA cumulé par client", $page, "gain.php", $urladd, $sortfield, $sortorder, '', $num); - - print ''; - print ''; - print ''; - - print_liste_field_titre("Marge","gain.php","marge",'','','align="right"'); - print "\n"; - $var=True; - - while ($i < min($num,$conf->liste_limit)) - { - $row = $db->fetch_row($resql); - $var=!$var; - - $marge = $row[4]; - - print ""; - print '\n"; - print '\n"; - print '\n"; - print '\n"; - if ($marge < 0) - { - print ''; - } - else - { - print ''; - } - print "\n"; - $i++; - } - print "
ClientChiffre d\'affaireGain 
'.$row[0]."'.price($row[1])." HT'.price($row[2])." HT'.number_format(round($marge), 2, '.', ' ')." %!! 
"; - $db->free($resql); -} -else -{ - print $db->error() . ' ' . $sql; -} - -//print 'Gain moyen par client

'; - -print '
'; - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/ca/index.php b/htdocs/telephonie/ca/index.php deleted file mode 100644 index a10b55b310b..00000000000 --- a/htdocs/telephonie/ca/index.php +++ /dev/null @@ -1,99 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; - -if (!$user->rights->telephonie->ca->lire) - accessforbidden(); - -llxHeader('','Telephonie'); - -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -/* - * Mode Liste - * - * - * - */ - -print ''; - -print '\n"; -print '
'; - -$sql = "SELECT date, sum(cout_vente), sum(gain), count(ligne)"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture"; -$sql .= " GROUP BY date DESC"; -$resql = $db->query($sql); -if ($resql) -{ - $num = $db->num_rows($resql); - $i = 0; - $ligne = new LigneTel($db); - - print ''; - print ''; - print ''; - print "\n"; - $var=True; - - while ($i < min($num,$conf->liste_limit)) - { - $row = $db->fetch_row($resql); - $var=!$var; - - print ""; - print "\n"; - print '\n"; - print '\n"; - print '\n"; - print "\n"; - $i++; - } - print "
MoisChiffre d\'affaireGainMarge
".substr($row[0],5,2)." ".substr($row[0],0,4)."'.price($row[1])." HT'.price($row[2])." HT'.number_format(round(($row[2]/$row[1])*100,2),2)." %
"; - $db->free($resql); -} -else -{ - dol_print_error($db); -} - -print '
'."\n"; - -print 'CA Mensuel

'; - -print "\n
'; - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/ca/pre.inc.php b/htdocs/telephonie/ca/pre.inc.php deleted file mode 100644 index 78107cd29ba..00000000000 --- a/htdocs/telephonie/ca/pre.inc.php +++ /dev/null @@ -1,70 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("../../main.inc.php"); -require(DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); -$user->getrights('telephonie'); - -function llxHeader($head = "", $title="") { - global $user, $conf; - - top_menu($head, $title); - - $menu = new Menu(); - - $menu->add(DOL_URL_ROOT."/telephonie/index.php", "Telephonie"); - - if (TELEPHONIE_MODULE_SIMULATION == 1) - { - $menu->add(DOL_URL_ROOT."/telephonie/simulation/fiche.php", "Simulation"); - $menu->add_submenu(DOL_URL_ROOT."/telephonie/simulation/fiche.php?action=create", "Nouvelle"); - } - - $menu->add(DOL_URL_ROOT."/telephonie/client/index.php", "Clients"); - - $menu->add(DOL_URL_ROOT."/telephonie/contrat/", "Contrats"); - - $menu->add(DOL_URL_ROOT."/telephonie/ligne/index.php", "Lignes"); - - if ($user->rights->telephonie->ligne_commander) - $menu->add(DOL_URL_ROOT."/telephonie/ligne/commande/", "Commande"); - - if ($user->rights->telephonie->stats->lire) - $menu->add(DOL_URL_ROOT."/telephonie/stats/", "Statistiques"); - - $menu->add(DOL_URL_ROOT."/telephonie/facture/", "Factures"); - - $menu->add(DOL_URL_ROOT."/telephonie/tarifs/", "Tarifs"); - - if ($user->rights->telephonie->fournisseur->lire) - $menu->add(DOL_URL_ROOT."/telephonie/fournisseur/", "Fournisseurs"); - - if ($user->rights->telephonie->ca->lire) - { - $menu->add(DOL_URL_ROOT."/telephonie/ca/", "Chiffre d'affaire"); - $menu->add_submenu(DOL_URL_ROOT."/telephonie/ca/ratiofourn.php", "Ratio fournisseur"); - $menu->add_submenu(DOL_URL_ROOT."/telephonie/ca/gain.php", "Gain par client"); - } - - left_menu($menu->liste); -} - -?> diff --git a/htdocs/telephonie/ca/ratiofourn.php b/htdocs/telephonie/ca/ratiofourn.php deleted file mode 100644 index ee3a3335289..00000000000 --- a/htdocs/telephonie/ca/ratiofourn.php +++ /dev/null @@ -1,95 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -/* - * Sécurité accés client - */ - -if (!$user->rights->telephonie->ca->lire) accessforbidden(); - -llxHeader('','Telephonie - Ratio fournisseur'); - -/* - * - * - * - */ -print ''; - -print ''; -print '
'; - -$page = $_GET["page"]; -$offset = $conf->liste_limit * $page ; - -$sql = "SELECT s.nom, af.mois, af.achat, af.vente"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_analyse_fournisseur as af"; - -$sql .= " , " .MAIN_DB_PREFIX."telephonie_fournisseur as s"; -$sql .= " WHERE s.rowid = af.fk_fournisseur"; -$sql .= " ORDER BY mois DESC " . $db->plimit($conf->liste_limit+1, $offset); - -$resql = $db->query($sql); - -if ($resql) -{ - $num = $db->num_rows($resql); - $i = 0; - - print_barre_liste("Ratio fournisseur", $page, "ratiofourn.php", $urladd, $sortfield, $sortorder, '', $num); - - print ''; - print ''; - print ''; - print "\n"; - $var=True; - - while ($i < min($num,$conf->liste_limit)) - { - $row = $db->fetch_row($resql); - $var=!$var; - - print ""; - print '\n"; - print "\n"; - print '\n"; - print '\n"; - print "\n"; - $i++; - } - print "
MoisFournisseurAchatRevente
'.strftime ("%B %Y",mktime(12,0,0,substr($row[1],-2),1,substr($row[1],0,4)))."".$row[0]."'.price($row[2])." HT'.price($row[3])." HT
"; - $db->free($resql); -} -else -{ - print $db->error() . ' ' . $sql; -} - -//print 'Gain moyen par client

'; - -print '
'; - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/client/commentaires.php b/htdocs/telephonie/client/commentaires.php deleted file mode 100644 index 152bc4c76a2..00000000000 --- a/htdocs/telephonie/client/commentaires.php +++ /dev/null @@ -1,201 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require("./pre.inc.php"); - -$mesg = ''; - -llxHeader("","","Fiche client"); - -if ($cancel == $langs->trans("Cancel")) -{ - $action = ''; -} -/* - * Affichage - * - */ - -if ($_GET["id"]) -{ - $soc = new Societe($db); - $result = $soc->fetch($_GET["id"], $user); - - if ($_GET["action"] == 'add') - { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_societe_commentaire"; - $sql .= " (fk_soc, fk_user, commentaire,datec)"; - $sql .= " VALUES ('".$soc->id."','".$user->id."','".$_POST["comment"]."',now());"; - $db->query($sql); - } - - if ($_GET["action"] == 'del') - { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_societe_commentaire"; - $sql .= " WHERE rowid = '".$_GET["commid"]."'"; - $sql .= " AND fk_user = '".$user->id."';"; - $db->query($sql); - } - - if (!$soc->perm_read) - { - print "Lecture non authoris�e"; - } - - if ( $result == 1 && $soc->perm_read) - { - - $h=0; - $head[$h][0] = DOL_URL_ROOT."/telephonie/client/fiche.php?id=".$soc->id; - $head[$h][1] = $langs->trans("Contrats"); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/client/lignes.php?id=".$soc->id; - $head[$h][1] = $langs->trans("Lignes"); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/client/factures.php?id=".$soc->id; - $head[$h][1] = $langs->trans("Factures"); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/client/stats.php?id=".$soc->id; - $head[$h][1] = $langs->trans("Stats"); - $h++; - - $sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."telephonie_tarif_client"; - $sql .= " WHERE fk_client = '".$soc->id."';"; - $resql = $db->query($sql); - - if ($resql) - { - $row = $db->fetch_row($resql); - $db->free($resql); - } - - $head[$h][0] = DOL_URL_ROOT."/telephonie/client/tarifs.php?id=".$soc->id; - $head[$h][1] = $langs->trans("Tarifs (".$row[0].")"); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/client/commentaires.php?id=".$soc->id; - $head[$h][1] = $langs->trans("Commentaires"); - $hselected = $h; - $h++; - - if ($soc->perm_perms) - { - $head[$h][0] = DOL_URL_ROOT."/telephonie/client/permissions.php?id=".$soc->id; - $head[$h][1] = $langs->trans("Permissions"); - $h++; - } - - dol_fiche_head($head, $hselected, 'Client : '.$soc->nom); - - print ''; - print ''; - - print ""; - - print ''; - print ''; - - print ''; - - print '
'.$langs->trans('Name').''.$soc->nom.''.$langs->trans('Code client').''.$soc->code_client.'
".$langs->trans('Address')."".nl2br($soc->adresse)."
".$soc->cp." ".$soc->ville." ".$soc->pays."
'.$langs->trans('Phone').''.dol_print_phone($soc->tel,$soc->pays_code,0,$soc->id).''.$langs->trans('Fax').''.dol_print_phone($soc->fax,$soc->pays_code,0,$soc->id).'
'.img_edit() ." "; - print $langs->trans('RIB').''; - print $soc->display_rib(); - print '

'; - - print '
'; - print ''; - print ''; - print ''; - print ''; - print "
Nouveau
commentaire'; - print '

"; - - print ''; - - /* Commentaires */ - - $sql = "SELECT c.commentaire, u.firstname, u.name, u.login, c.rowid, c.fk_user"; - $sql .= " , ".$db->pdate("c.datec") ." as datec"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_commentaire as c"; - $sql .= " , ".MAIN_DB_PREFIX."user as u"; - $sql .= " WHERE fk_soc = ".$soc->id; - $sql .= " AND c.fk_user = u.rowid"; - $sql .= " ORDER BY c.datec DESC"; - - $resql = $db->query($sql); - - if ($resql) - { - print ''; - print "\n"; - - while ($obj = $db->fetch_object($resql)) - { - print "\n"; - print '\n"; - print '\n"; - print '\n"; - $var=!$var; - } - $db->free($resql); - } - else - { - print $sql; - } - print "
Date'; - print 'CommentaireAuteur 
".strftime("%d/%m/%y %H:%M",$obj->datec); - print "'.nl2br(stripslashes($obj->commentaire))."'.$obj->login." '; - if ($obj->fk_user == $user->id) - { - print ''; - print img_delete().''; - } - print "
"; - } -} -else -{ - print "Error"; -} - - -print ''; - -/* ************************************************************************** */ -/* */ -/* Barre d'action */ -/* */ -/* ************************************************************************** */ -/* -print "\n
\n"; -*/ - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/client/contacts.php b/htdocs/telephonie/client/contacts.php deleted file mode 100644 index af898650b24..00000000000 --- a/htdocs/telephonie/client/contacts.php +++ /dev/null @@ -1,152 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; -$sortfield = $_GET["sortfield"]; - -llxHeader('','Telephonie - Clients - Contacts'); -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -if ($sortorder == "") { - $sortorder="ASC"; -} -if ($sortfield == "") { - $sortfield="s.nom"; -} - -/* - * Recherche - * - * - */ - -if ($page == -1) { $page = 0 ; } - -$offset = $conf->liste_limit * $page ; -$pageprev = $page - 1; -$pagenext = $page + 1; -/* - * Mode Liste - * - */ -$sql = "SELECT distinct cont.email, cont.rowid, cont.name, cont.firstname, s.nom, s.rowid as socid"; -$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; - -$sql .= ",".MAIN_DB_PREFIX."societe_perms as sp"; -$sql .= ",".MAIN_DB_PREFIX."telephonie_contrat_contact_facture as cf"; -$sql .= ",".MAIN_DB_PREFIX."socpeople as cont"; - -$sql .= " WHERE cont.fk_soc = s.rowid "; -$sql .= " AND cf.fk_contact = cont.rowid"; - -$sql .= " AND s.rowid = sp.fk_soc"; -$sql .= " AND sp.fk_user = ".$user->id." AND sp.pread = 1"; - -if ($_GET["search_client"]) -{ - $sel = urldecode($_GET["search_client"]); - $sql .= " AND s.nom LIKE '%".$sel."%'"; -} - -if ($_GET["search_email"]) -{ - $sel = urldecode($_GET["search_email"]); - $sql .= " AND cont.email LIKE '%".$sel."%'"; -} - -//$sql .= " GROUP BY s.rowid"; -$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); - -$result = $db->query($sql); -if ($result) -{ - $num = $db->num_rows(); - $i = 0; - - $urladd= "&statut=".$_GET["statut"]; - - print_barre_liste("Clients", $page, "liste.php", $urladd, $sortfield, $sortorder, '', $num); - - print ''; - print ''; - print_liste_field_titre("Client","contacts.php","s.nom","","",' width="50%"'); - print ''; - - print_liste_field_titre("Email","contacts.php","cont.email","","",' width="50%"'); - print "\n"; - - print ''; - print ''; - print ''; - print ''; - print ''; - - print ''; - print ''; - - - $var=True; - - $ligne = new LigneTel($db); - - while ($i < min($num,$conf->liste_limit)) - { - $obj = $db->fetch_object($i); - $var=!$var; - - print "'; - print '\n"; - - print '\n"; - - print "\n"; - $i++; - } - print "
Prénom Nom
 '; - print ' 
"; - - print ''; - print img_file(); - print ' '; - print ''.$obj->nom.''.$obj->firstname.' '.$obj->name."'; - print $obj->email."
"; - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/client/facture.php b/htdocs/telephonie/client/facture.php deleted file mode 100644 index e8d26fe8b7c..00000000000 --- a/htdocs/telephonie/client/facture.php +++ /dev/null @@ -1,732 +0,0 @@ - - * Copyright (C) 2004-2006 Laurent Destailleur - * Copyright (C) 2004 �ric Seigne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - */ - -/** - \file htdocs/telephonie/client/facture.php - \ingroup telephonie/facture - \brief Page de visualisation d'une facture - \version $Revision$ -*/ -require("./pre.inc.php"); - -$user->getrights('facture'); -$user->getrights('banque'); - -$langs->load("bills"); - -$warning_delay=31*24*60*60; // Delai affichage warning retard (si retard paiement facture > delai) - -require_once DOL_DOCUMENT_ROOT."/facture.class.php"; -require_once DOL_DOCUMENT_ROOT."/paiement.class.php"; -require_once DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php"; -include_once DOL_DOCUMENT_ROOT."/contact.class.php"; -include_once DOL_DOCUMENT_ROOT."/actioncomm.class.php"; - -if ($_GET["socid"]) { $socid=$_GET["socid"]; } -if (isset($_GET["msg"])) { $msg=urldecode($_GET["msg"]); } - -// S�curit� acc�s client -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -/* - * Action envoi de mail - */ -if ($_POST["action"] == 'send' || $_POST["action"] == 'relance') -{ - $langs->load("mails"); - - $fac = new Facture($db,"",$_POST["facid"]); - if ( $fac->fetch($_POST["facid"]) ) - { - $facref = dol_sanitizeFileName($fac->ref); - $file = $conf->facture->dir_output . "/" . $facref . "/" . $facref . ".pdf"; - - if (is_readable($file)) - { - $soc = new Societe($db, $fac->socid); - - if ($_POST["sendto"]) { - // Le destinataire a �t� fourni via le champ libre - $sendto = $_POST["sendto"]; - $sendtoid = 0; - } - elseif ($_POST["receiver"]) { - // Le destinataire a �t� fourni via la liste d�roulante - $sendto = $soc->contact_get_email($_POST["receiver"]); - $sendtoid = $_POST["receiver"]; - } - - if (strlen($sendto)) - { - $from = $_POST["fromname"] . " <" . $_POST["frommail"] .">"; - $replyto = $_POST["replytoname"]. " <" . $_POST["replytomail"].">"; - $message = $_POST["message"]; - if ($_POST["action"] == 'send') { - $subject = $langs->trans("Bill")." $fac->ref"; - $actiontypeid=9; - $actionmsg ="Mail envoy� par ".$from." � ".$sendto.".\n"; - if ($message) { - $actionmsg.="Texte utilis� dans le corps du message:\n"; - $actionmsg.=$message; - } - $actionmsg2="Envoi facture par mail"; - } - if ($_POST["action"] == 'relance') { - $subject = "Relance facture $fac->ref"; - $actiontypeid=9; - $actionmsg="Mail envoy� par ".$from." � ".$sendto.".\n"; - if ($message) { - $actionmsg.="Texte utilis� dans le corps du message:\n"; - $actionmsg.=$message; - } - $actionmsg2="Relance facture par mail"; - } - - $filepath[0] = $file; - $filename[0] = $fac->ref.".pdf"; - $mimetype[0] = "application/pdf"; - $filepath[1] = $_FILES['addedfile']['tmp_name']; - $filename[1] = $_FILES['addedfile']['name']; - $mimetype[1] = $_FILES['addedfile']['type']; - - $dir = $conf->facture->dir_output . "/" . $fac->ref . "/"; - $handle=opendir($dir); - $ifi = 2; - while (($dfile = readdir($handle))!==false) - { - if (is_readable($dir.$dfile) && substr($dfile, -10) == 'detail.pdf') - { - $filepath[$ifi] = $conf->facture->dir_output . "/" . $fac->ref . "/" . $dfile; - $filename[$ifi] = $dfile; - $mimetype[$ifi] = "application/pdf"; - $ifi++; - } - } - - - // Envoi de la facture - $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc); - - if ($mailfile->sendfile()) - { - $msg='
'.$langs->trans("MailSuccessfulySent",$from,$sendto).'.
'; - - // Renvoie sur la fiche - Header("Location: facture.php?facid=".$fac->id."&msg=".urlencode($msg)); - exit; - } - else - { - $msg='
'.$langs->trans("ErrorFailedToSendMail",$from,$sendto).' !
'; - } - } - else - { - $msg='
'.$langs->trans("ErrorMailRecipientIsEmpty").'
'; - dol_syslog("Le mail du destinataire est vide"); - } - - } - else - { - dol_syslog("Impossible de lire :".$file); - } - } - else - { - dol_syslog("Impossible de lire les donn�es de la facture. Le fichier facture n'a peut-�tre pas �t� g�n�r�."); - } -} - -llxHeader('',$langs->trans("Bill"),'Facture'); - -$html = new Form($db); - -if ($_GET["facid"] > 0) -{ - if ($msg) print "$msg
"; - - $fac = New Facture($db); - if ( $fac->fetch($_GET["facid"], $user->societe_id) > 0) - { - $soc = new Societe($db, $fac->socid); - $soc->fetch($fac->socid, $user); - - if (!$soc->perm_read) - { - print "Lecture non authoris�e"; - } - - if ($soc->perm_read) - { - $author = new User($db); - $author->id = $fac->user_author; - $author->fetch(); - - $h = 0; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/client/fiche.php?id='.$soc->id; - $head[$h][1] = $langs->trans("Fiche client"); - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/client/factures.php?id='.$soc->id; - $head[$h][1] = $langs->trans("Factures"); - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/client/facture.php?facid='.$fac->id; - $head[$h][1] = $langs->trans("CardBill"); - $hselected = $h; - $h++; - - dol_fiche_head($head, $hselected, $langs->trans("Bill")." : $fac->ref"); - - /* - * Facture - */ - print ''; - print ''; - print ''; - - print ""; - - print ''; - print "\n"; - print '"; - - print ''; - - // Projet - if ($conf->projet->enabled) - { - $langs->load("projects"); - print '"; - } else { - print ''; - } - - print '"; - - print ""; - - print ''; - if ($fac->brouillon == 1 && $user->rights->facture->creer) - { - print ''; - print ''; - print ''; - print ''; - print ''; - } - else - { - print ''; - } - print ''; - - print ''; - print ''; - print ''; - - print ''; - print ''; - print ''; - print ''; - - print ''; - - if ($fac->note) - { - print '"; - } - else { - print ''; - } - - print "
'.$langs->trans("Company").''; - print ''.$soc->nom.'Conditions de r�glement" . $fac->cond_reglement ."
'.$langs->trans("Date").'".dol_print_date($fac->date,"dayhourtext")."'.$langs->trans("DateMaxPayment").'' . dol_print_date($fac->date_lim_reglement,"dayhourtext"); - print "
'; - print ''; - if ($_GET["action"] != "classer") print ''; - print '
'; - print $langs->trans("Project"); - print '
'; - print '
'; - if ($_GET["action"] == "classer") - { - $html->form_project("facture.php?facid=$fac->id",$fac->fk_soc,$fac->projetid,"projetid"); - } - else - { - $html->form_project("facture.php?facid=$fac->id",$fac->fk_soc,$fac->projetid,"none"); - } - print "  '; - - /* - * Paiements - */ - print $langs->trans("Payments").' :
'; - $sql = "SELECT ".$db->pdate("datep")." as dp, pf.amount,"; - $sql.= " c.libelle as paiement_type, p.num_paiement, p.rowid"; - $sql.= " FROM ".MAIN_DB_PREFIX."paiement as p, ".MAIN_DB_PREFIX."c_paiement as c, ".MAIN_DB_PREFIX."paiement_facture as pf"; - $sql.= " WHERE pf.fk_facture = ".$fac->id." AND p.fk_paiement = c.id AND pf.fk_paiement = p.rowid"; - $sql.= " ORDER BY dp DESC"; - - $result = $db->query($sql); - - if ($result) - { - $num = $db->num_rows($result); - $i = 0; $total = 0; - print ''; - print ''; - print ''; - - $var=True; - while ($i < $num) - { - $objp = $db->fetch_object($result); - $var=!$var; - print "\n"; - print "\n"; - print '\n"; - print ""; - $totalpaye += $objp->amount; - $i++; - } - - if ($fac->paye == 0) - { - print "\n"; - print "\n"; - - $resteapayer = $fac->total_ttc - $totalpaye; - - print ""; - print "\n"; - } - print "
'.$langs->trans("Date").''.$langs->trans("Type").''.$langs->trans("Amount").' 
"; - print " ".strftime("%d %B %Y",$objp->dp)."$objp->paiement_type $objp->num_paiement'.price($objp->amount)."".$langs->trans("Currency".$conf->monnaie)."
".$langs->trans("AlreadyPaid")." :".price($totalpaye)."".$langs->trans("Currency".$conf->monnaie)."
Factur� :".price($fac->total_ttc)."".$langs->trans("Currency".$conf->monnaie)."
".$langs->trans("RemainderToPay")." :".price($resteapayer)."".$langs->trans("Currency".$conf->monnaie)."
"; - $db->free($result); - } else { - dol_print_error($db); - } - - print "
".$langs->trans("Author")."$author->fullname
'.$langs->trans("GlobalDiscount").'
% '; - print ''.$fac->remise_percent.'%
'.$langs->trans("AmountHT").''.price($fac->total_ht).''.$langs->trans("Currency".$conf->monnaie).'
'.$langs->trans("VAT").''.price($fac->total_tva).''.$langs->trans("Currency".$conf->monnaie).'
'.$langs->trans("AmountTTC").''.price($fac->total_ttc).''.$langs->trans("Currency".$conf->monnaie).'
'.$langs->trans("Status").''.($fac->getLibStatut()).'
'.$langs->trans("Note").' : '.nl2br($fac->note)."
 

"; - - /* - * Lignes de factures - * - */ - $sql = "SELECT l.fk_product, l.description, l.price, l.qty, l.rowid, l.tva_taux"; - $sql .= " , l.remise_percent, l.subprice,"; - $sql .= $db->pdate("l.date_start")." as date_start"; - $sql .= " , ".$db->pdate("l.date_end")." as date_end, "; - $sql .= " p.fk_product_type"; - $sql .= " FROM ".MAIN_DB_PREFIX."facturedet as l "; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product p ON l.fk_product=p.rowid"; - $sql .= " WHERE l.fk_facture = ".$fac->id; - $sql .= " ORDER BY l.rang ASC, l.rowid"; - - $resql = $db->query($sql); - if ($resql) - { - $num_lignes = $db->num_rows($resql); - $i = 0; $total = 0; - - print ''; - if ($num_lignes) - { - print ""; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; - } - $var=True; - while ($i < $num_lignes) - { - $objp = $db->fetch_object($resql); - $var=!$var; - - // Update ligne de facture - if ($_GET["action"] != 'editline' || $_GET["rowid"] != $objp->rowid) - { - - print ""; - if ($objp->fk_product > 0) - { - print ''; - } - else - { - print "\n"; - } - - print ''; - print '\n"; - print ''; - if ($objp->remise_percent > 0) - { - print '\n"; - } - else - { - print ''; - } - print '\n"; - - // Icone d'edition et suppression - if ($fac->statut == 0 && $user->rights->facture->creer) - { - print ''; - print ''; - - print ''; - } - } - else - { - print ''; - } - print ""; - - } - - $total = $total + ($objp->qty * $objp->price); - $i++; - } - - $db->free($resql); - } - else - { - dol_print_error($db); - } - /* - * Ajouter une ligne - */ - - print "
'.$langs->trans("Description").''.$langs->trans("VAT").''.$langs->trans("PriceUHT").''.$langs->trans("Qty").''.$langs->trans("Discount").''.$langs->trans("AmountHT").' 
'; - if ($objp->fk_product_type==1) print img_object($langs->trans("ShowService"),"service"); - else print img_object($langs->trans("ShowProduct"),"product"); - print ' '.stripslashes(nl2br($objp->description)).''; - if ($objp->date_start && $objp->date_end) { print " (Du ".dol_print_date($objp->date_start)." au ".dol_print_date($objp->date_end).")"; } - if ($objp->date_start && ! $objp->date_end) { print " (A partir du ".dol_print_date($objp->date_start).")"; } - if (! $objp->date_start && $objp->date_end) { print " (Jusqu'au ".dol_print_date($objp->date_end).")"; } - print '".stripslashes(nl2br($objp->description)); - if ($objp->date_start && $objp->date_end) { print " (Du ".dol_print_date($objp->date_start)." au ".dol_print_date($objp->date_end).")"; } - if ($objp->date_start && ! $objp->date_end) { print " (A partir du ".dol_print_date($objp->date_start).")"; } - if (! $objp->date_start && $objp->date_end) { print " (Jusqu'au ".dol_print_date($objp->date_end).")"; } - print "'.$objp->tva_taux.'%'.price($objp->subprice)."'.$objp->qty.''.$objp->remise_percent."% '.price($objp->subprice*$objp->qty*(100-$objp->remise_percent)/100)."'; - print img_edit(); - print ''; - print img_delete(); - print ''; - if ($i > 0) - { - print ''; - print img_up(); - print ''; - } - if ($i < $num_lignes-1) - { - print ''; - print img_down(); - print ' 
\n"; - print "\n"; - - /* - * Boutons actions - */ - - if ($user->societe_id == 0 && $_GET["action"] <> 'valid' && $_GET["action"] <> 'editline') - { - print "
\n"; - - // Envoyer - if ($fac->statut == 1 && $user->rights->facture->envoyer) - { - print " id&action=presend&mode=init\">".$langs->trans("Send")."\n"; - } - - // Envoyer une relance - /* - if ($fac->statut == 1 && price($resteapayer) > 0 && $user->rights->facture->envoyer) - { - print " id&action=prerelance&mode=init\">".$langs->trans("SendRemind")."\n"; - } - */ - - print "
\n"; - - } - - print '
'; - - /* - * Documents g�n�r�s - * Le fichier de facture d�taill�e est de la forme - * REFFACTURE-XXXXXX-detail.pdf ou XXXXX est une forme diverse - */ - - $facref = dol_sanitizeFileName($fac->ref); - $file = $conf->facture->dir_output . "/" . $facref . "/" . $facref . ".pdf"; - $relativepath = "${facref}/${facref}.pdf"; - - $var=true; - - if (file_exists($file)) - { - print "
\n"; - print_titre("Documents"); - print ''; - - print ""; - - print ''; - print ''; - print ''; - print ''; - - $dir = $conf->facture->dir_output . "/" . $facref . "/"; - $handle=opendir($dir); - - while (($file = readdir($handle))!==false) - { - if (is_readable($dir.$file) && substr($file, -10) == 'detail.pdf') - { - print ""; - $relativepathdetail = "${facref}/$file"; - - print ''; - print ''; - print ''; - print ''; - } - } - print "
".$langs->trans("Bill")." PDF'.$fac->ref.'.pdf'.filesize($file). ' bytes'.strftime("%d %b %Y %H:%M:%S",filemtime($file)).'
Facture d�taill�e'.$file.''.filesize($dir.$file). ' bytes'.strftime("%d %b %Y %H:%M:%S",filemtime($dir.$file)).'
\n"; - } - - - /* - * Propales - */ - $sql = "SELECT ".$db->pdate("p.datep")." as dp, p.price, p.ref, p.rowid as propalid"; - $sql .= " FROM ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."fa_pr as fp WHERE fp.fk_propal = p.rowid AND fp.fk_facture = $fac->id"; - - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - if ($num) - { - $i = 0; $total = 0; - print "
"; - print_titre($langs->trans("RelatedCommercialProposals")); - - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; - - $var=True; - while ($i < $num) - { - $objp = $db->fetch_object($resql); - $var=!$var; - print ""; - print ''; - print "\n"; - print ''; - print ""; - $total = $total + $objp->price; - $i++; - } - print "\n"; - print "
'.$langs->trans("Ref").''.$langs->trans("Date").''.$langs->trans("Price").'
'.img_object($langs->trans("ShowPropal"),"propal").' '.$objp->ref.'".dol_print_date($objp->dp)."'.price($objp->price).'
 ".$langs->trans("TotalHT")."".price($total)."
"; - } - } - else - { - dol_print_error($db); - } - - - print '
'; - - /* - * Liste des actions propres � la facture - */ - $sql = "SELECT id, ".$db->pdate("a.datep")." as da, a.label, a.note"; - $sql .= ", u.login"; - $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."user as u "; - $sql .= " WHERE a.fk_user_author = u.rowid "; - $sql .= " AND a.fk_action in (9,10) "; - $sql .= " AND a.fk_soc = ".$fac->socid ; - $sql .= " AND a.fk_facture = ".$fac->id; - - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - if ($num) - { - print "
\n"; - print_titre($langs->trans("ActionsOnBill")); - - $i = 0; $total = 0; - print ''; - print ''; - print "\n"; - - $var=True; - while ($i < $num) - { - $objp = $db->fetch_object($resql); - $var=!$var; - print ""; - print ''; - print '\n"; - print ''; - print ''; - print "\n"; - $i++; - } - print "
'.$langs->trans("Ref").''.$langs->trans("Date").''.$langs->trans("Action").''.$langs->trans("By").'
'.img_object($langs->trans("ShowTask"),"task").' '.$objp->id.''.dol_print_date($objp->da)."'.stripslashes($objp->label).''.$objp->login.'
\n"; - } - } - else - { - dol_print_error($db); - } - - print "
"; - - - /* - * Affiche formulaire mail - */ - if ($_GET["action"] == 'presend') - { - print '
'; - print_titre($langs->trans("SendBillByMail")); - - // Cree l'objet formulaire mail - include_once(DOL_DOCUMENT_ROOT."/html.formmail.class.php"); - $formmail = new FormMail($db); - $formmail->fromname = $user->fullname; - $formmail->frommail = $user->email; - $formmail->withfrom=1; - $formmail->withto=empty($_POST["sendto"])?1:$_POST["sendto"]; - $formmail->withtosocid=$soc->id; - $formmail->withtocc=1; - $formmail->withtoccsocid=0; - $formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC; - $formmail->withtocccsocid=0; - $formmail->withtopic=$langs->trans("SendBillRef","__FACREF__"); - $formmail->withfile=1; - $formmail->withbody=1; - // Tableau des substitutions - $formmail->substit["__FACREF__"]=$fac->ref; - // Tableau des param�tres compl�mentaires du post - $formmail->param["action"]="send"; - $formmail->param["models"]="facture_send"; - $formmail->param["facid"]=$fac->id; - $formmail->param["returnurl"]=DOL_URL_ROOT."/telephonie/client/facture.php?facid=$fac->id"; - - // Init list of files - if (! empty($_REQUEST["mode"]) && $_REQUEST["mode"]=='init') - { - $formmail->clear_attached_files(); - } - - $formmail->show_form(); - - print '
'; - } - - if ($_GET["action"] == 'prerelance') - { - print '
'; - print_titre($langs->trans("SendReminderBillByMail")); - - $liste[0]=" "; - foreach ($soc->contact_email_array() as $key=>$value) - { - $liste[$key]=$value; - } - - // Cr�� l'objet formulaire mail - include_once("../html.formmail.class.php"); - $formmail = new FormMail($db); - $formmail->fromname = $user->fullname; - $formmail->frommail = $user->email; - $formmail->withfrom=1; - $formmail->withto=$liste; - $formmail->withtocc=1; - $formmail->withtopic=$langs->trans("SendReminderBillRef","__FACREF__"); - $formmail->withfile=1; - $formmail->withbody=1; - // Tableau des substitutions - $formmail->substit["__FACREF__"]=$fac->ref; - // Tableau des param�tres compl�mentaires - $formmail->param["action"]="relance"; - $formmail->param["models"]="facture_relance"; - $formmail->param["facid"]=$fac->id; - $formmail->param["returnurl"]=DOL_URL_ROOT."/compta/facture.php?facid=$fac->id"; - - // Init list of files - if (! empty($_REQUEST["mode"]) && $_REQUEST["mode"]=='init') - { - $formmail->clear_attached_files(); - } - - $formmail->show_form(); - - print '
'; - } - - } - } - else - { - /* Facture non trouv�e */ - print $langs->trans("ErrorBillNotFound",$_GET["facid"]); - } -} - -$db->close(); - -llxFooter('$Date$ - $Revision$'); -?> diff --git a/htdocs/telephonie/client/factures.php b/htdocs/telephonie/client/factures.php deleted file mode 100644 index 3440f85ba9b..00000000000 --- a/htdocs/telephonie/client/factures.php +++ /dev/null @@ -1,176 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require("./pre.inc.php"); - -llxHeader("","T�l�phonie - Factures client"); - -if ($cancel == $langs->trans("Cancel")) -{ - $action = ''; -} -/* - * Affichage - * - */ - -if ($_GET["id"]) -{ - $soc = new Societe($db); - $result = $soc->fetch($_GET["id"], $user); - - if (!$soc->perm_read) - { - print "Lecture non authoris�e"; - } - - if ( $result == 1 && $soc->perm_read) - { - if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit') - { - $h=0; - $head[$h][0] = DOL_URL_ROOT."/telephonie/client/fiche.php?id=".$soc->id; - $head[$h][1] = $langs->trans("Contrats"); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/client/lignes.php?id=".$soc->id; - $head[$h][1] = $langs->trans("Lignes"); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/client/factures.php?id=".$soc->id; - $head[$h][1] = $langs->trans("Factures"); - $hselected = $h; - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/client/stats.php?id=".$soc->id; - $head[$h][1] = $langs->trans("Stats"); - $h++; - - $sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."telephonie_tarif_client"; - $sql .= " WHERE fk_client = '".$soc->id."';"; - $resql = $db->query($sql); - - if ($resql) - { - $row = $db->fetch_row($resql); - $db->free($resql); - } - - $head[$h][0] = DOL_URL_ROOT."/telephonie/client/tarifs.php?id=".$soc->id; - $head[$h][1] = $langs->trans("Tarifs (".$row[0].")"); - $h++; - - dol_fiche_head($head, $hselected, 'Client : '.$soc->nom); - - print ''; - print ''; - - print ""; - - print ''; - print ''; - - print '
'.$langs->trans('Name').''.$soc->nom.''.$langs->trans('Code Client').''.$soc->code_client.'
".$langs->trans('Address')."".nl2br($soc->adresse)."
".$soc->cp." ".$soc->ville." ".$soc->pays."
'.$langs->trans('Phone').''.dol_print_phone($soc->tel,$soc->pays_code,0,$soc->id).''.$langs->trans('Fax').''.dol_print_phone($soc->fax,$soc->pays_code,0,$soc->id).'

'; - - /* - * Factures - * - */ - - if ($page == -1) { $page = 0 ; } - - if ($sortorder == "") { - $sortorder="DESC"; - } - if ($sortfield == "") { - $sortfield="f.date"; - } - $offset = $conf->liste_limit * $page ; - $pageprev = $page - 1; - $pagenext = $page + 1; - - $sql = "SELECT f.rowid, f.date, sum(f.cout_vente) as cout_vente, f.fk_facture"; - $sql .= " ,s.nom, s.rowid as socid"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture as f"; - $sql .= " , ".MAIN_DB_PREFIX."societe as s"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; - - $sql .= " WHERE s.rowid = l.fk_soc_facture AND l.rowid = f.fk_ligne"; - $sql .= " AND s.rowid = ".$soc->id; - $sql .= " GROUP BY f.fk_facture"; - $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); - - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - - print ''; - print ''; - print ''; - print ''; - print "\n"; - - $var=True; - - while ($i < min($num,$conf->liste_limit)) - { - $obj = $db->fetch_object($resql); - $var=!$var; - - print ""; - - print '\n"; - print '\n"; - - print '\n"; - print "\n"; - $i++; - } - print "
DateMontant HTFacture
'.$obj->date."'.sprintf("%01.4f",$obj->cout_vente)."'.$obj->fk_facture."
"; - $db->free($resql); - } - else - { - print $db->error() . ' ' . $sql; - } - } - } -} -else -{ - print "Error"; -} - -print ''; - -/* ************************************************************************** */ -/* */ -/* Barre d'action */ -/* */ -/* ************************************************************************** */ - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/client/fiche.php b/htdocs/telephonie/client/fiche.php deleted file mode 100644 index 5cdc2e911c3..00000000000 --- a/htdocs/telephonie/client/fiche.php +++ /dev/null @@ -1,242 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require("./pre.inc.php"); - -$mesg = ''; - -llxHeader("","","Fiche client"); - -if ($cancel == $langs->trans("Cancel")) -{ - $action = ''; -} -/* - * Affichage - * - */ - -if ($_GET["id"]) -{ - $soc = new TelephonieClient($db); - $result = $soc->fetch($_GET["id"], $user); - - if (!$soc->perm_read) - { - print "Lecture non authoris�e"; - } - - if ( $result == 1 && $soc->perm_read) - { - $soc->log_consult($user,'r'); - - - if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit') - { - /* Commentaires */ - $sql = "SELECT c.commentaire, ".$db->pdate("c.datec") ." as datec"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_commentaire as c"; - $sql .= " WHERE fk_soc = ".$soc->id; - $sql .= " ORDER BY c.datec DESC"; - $resql = $db->query($sql); - - if ($resql) - { - $num_comments = $db->num_rows($resql); - $db->free($resql); - } - /* Fin Commentaires */ - - $h=0; - $head[$h][0] = DOL_URL_ROOT."/telephonie/client/fiche.php?id=".$soc->id; - $head[$h][1] = $langs->trans("Contrats"); - $hselected = $h; - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/client/lignes.php?id=".$soc->id; - $head[$h][1] = $langs->trans("Lignes"); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/client/factures.php?id=".$soc->id; - $head[$h][1] = $langs->trans("Factures"); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/client/stats.php?id=".$soc->id; - $head[$h][1] = $langs->trans("Stats"); - $h++; - - $sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."telephonie_tarif_client"; - $sql .= " WHERE fk_client = '".$soc->id."';"; - $resql = $db->query($sql); - - if ($resql) - { - $row = $db->fetch_row($resql); - $db->free($resql); - } - - $head[$h][0] = DOL_URL_ROOT."/telephonie/client/tarifs.php?id=".$soc->id; - $head[$h][1] = $langs->trans("Tarifs (".$row[0].")"); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/client/commentaires.php?id=".$soc->id; - $head[$h][1] = $langs->trans("Commentaires"); - if ($num_comments > 0) - { - $head[$h][1] = $langs->trans("Commentaires ($num_comments)"); - } - $h++; - - if ($soc->perm_perms) - { - $head[$h][0] = DOL_URL_ROOT."/telephonie/client/permissions.php?id=".$soc->id; - $head[$h][1] = $langs->trans("Permissions"); - $h++; - } - - dol_fiche_head($head, $hselected, 'Client : '.$soc->nom); - - print ''; - print ''; - - print '"; - - print ''; - print ''; - - print ''; - - print '
'.$langs->trans('Name').''.$soc->nom.''.$langs->trans('Code client').''.$soc->code_client.'
'.$langs->trans('Address')."".nl2br($soc->adresse)."
".$soc->cp." ".$soc->ville." ".$soc->pays."
'.$langs->trans('Phone').''.dol_print_phone($soc->tel,$soc->pays_code,0,$soc->id).''.$langs->trans('Fax').''.dol_print_phone($soc->fax,$soc->pays_code,0,$soc->id).'
'.img_edit() ." "; - print $langs->trans('RIB').''; - print $soc->display_rib(); - print '

'; - - /* Commentaires */ - $sql = "SELECT c.commentaire"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_commentaire as c"; - $sql .= " WHERE c.fk_soc = ".$soc->id; - $sql .= " ORDER BY c.datec DESC LIMIT 2"; - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - if ($num > 0) - { - print ''; - print ''; - while ($obj = $db->fetch_object($resql)) - { - $var=!$var; - print "\n"; - print "\n"; - } - print "
2 Derniers commentaires
"; - print stripslashes($obj->commentaire)."

"; - } - $db->free($resql); - } - else - { - print $db->error() . ' ' . $sql; - } - - - /* Contrats */ - print ''; - $sql = "SELECT count(l.rowid) as cc, c.rowid, c.ref, c.statut"; - $sql .= ", ss.nom as agence, ss.code_client, ss.ville"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_contrat as c"; - $sql .= " , ".MAIN_DB_PREFIX."societe as ss"; - $sql .= " WHERE c.fk_client_comm = ".$soc->id; - $sql .= " AND c.fk_soc = ss.rowid "; - $sql .= " AND l.fk_contrat = c.rowid"; - $sql .= " GROUP BY c.rowid"; - $sql .= " ORDER BY ss.rowid ASC"; - - $resql = $db->query($sql); - - if ($resql) - { - $num = $db->num_rows($resql); - if ( $num > 0 ) - { - $i = 0; - - $ligne = new LigneTel($db); - - print ''; - print "\n"; - - while ($i < $num) - { - $obj = $db->fetch_object($resql); - $var=!$var; - - print "\n"; - - print '\n"; - print '\n"; - print '\n"; - print '\n"; - print "\n"; - $i++; - } - } - $db->free($resql); - - } - else - { - print $sql; - } - - print "
Contrat'; - print 'Agence/FilialeNb Lignes
"; - - print ' '; - - print ''; - print img_file(); - - print ' '; - - print ''.$obj->ref."'.$obj->code_client."'.$obj->agence."'.$obj->ville."'.$obj->cc."
"; - } - } -} -else -{ - print "Error"; -} -print ''; -print '
$Revision$
'; -/* ************************************************************************** */ -/* */ -/* Barre d'action */ -/* */ -/* ************************************************************************** */ - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/client/index.php b/htdocs/telephonie/client/index.php deleted file mode 100644 index 26ff56e19c6..00000000000 --- a/htdocs/telephonie/client/index.php +++ /dev/null @@ -1,237 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if (!$user->rights->telephonie->lire) - accessforbidden(); - -llxHeader('','Telephonie - Clients'); - -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -/* - * Mode Liste - * - * - * - */ - -print ''; - -print ''; -print '
'; - -print '
'; -print ''; -print ''; -print "\n"; -print ""; -print ''; -print '
Recherche client
Nom
'; - -print '
'; - -$sql = "SELECT distinct s.rowid as socid "; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; -$sql .= " , ".MAIN_DB_PREFIX."societe as s"; -$sql .= " WHERE s.rowid = l.fk_client_comm "; -$sql .= " AND l.fk_commercial_suiv = ".$user->id; -$resql = $db->query($sql); -if ($resql) -{ - $num = $db->num_rows($resql); - $i = 0; - - print ''; - print ''; - print "\n"; - $var=True; - - $row = $db->fetch_row($resql); - - print ""; - print ''; - print "\n"; - print "\n"; - print "
ClientsNb
Mes clients suivis".$num."
"; - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - -print '
'; - -/* - * Liste - * - */ -$sql = "SELECT s.rowid as socid, s.nom, max(sc.datec) as dam"; -$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; -$sql .= ",".MAIN_DB_PREFIX."societe_consult as sc"; -$sql .= " WHERE s.rowid = sc.fk_soc"; -$sql .= " AND sc.fk_user = ".$user->id; -$sql .= " GROUP BY s.rowid"; -$sql .= " ORDER BY dam DESC LIMIT 10"; - -$resql = $db->query($sql); -if ($resql) -{ - $num = $db->num_rows($resql); - print ''; - print ''; - $var=True; - - while ($obj = $db->fetch_object($resql)) - { - print "'; - - print "\n"; - $var=!$var; - } - print "
'.min(10,$num).' dernières fiches clients consultées
"; - print ''; - print img_file(); - print ' '; - $nom = $obj->nom; - if (strlen($obj->nom) > 33) - $nom = substr($obj->nom,0,30)."..."; - - print ''.stripslashes($nom).'
"; - $db->free($resql); -} -else -{ - print $db->error() . ' ' . $sql; -} - - -print '
'; - -/* - * Liste - * - */ -$sql = "SELECT s.rowid as socid, s.nom, count(l.ligne) as ligne"; -$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; -$sql .= ",".MAIN_DB_PREFIX."societe_perms as sp"; - -$sql .= " WHERE l.fk_client_comm = s.rowid "; -$sql .= " AND s.rowid = sp.fk_soc"; -$sql .= " AND sp.fk_user = ".$user->id." AND sp.pread = 1"; -$sql .= " GROUP BY s.rowid"; -$sql .= " ORDER BY s.datec DESC LIMIT 10"; - -$resql = $db->query($sql); -if ($resql) -{ - $num = $db->num_rows($resql); - $i = 0; - - print ''; - print ''; - print '\n"; - - $var=True; - - $ligne = new LigneTel($db); - - while ($i < $num) - { - $obj = $db->fetch_object($resql); - $var=!$var; - - print "'; - print '\n"; - - print "\n"; - $i++; - } - print "
'.min(10,$num).' derniers nouveaux clientsNb Lignes'; - print "
"; - - print ''; - print img_file(); - print ' '; - - print ''.stripslashes($obj->nom).''.$obj->ligne."
"; - $db->free($resql); -} -else -{ - print $db->error() . ' ' . $sql; -} - -print "
"; -/* Commentaires */ - -$sql = "SELECT s.rowid as socid, s.nom, c.commentaire"; -$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."telephonie_societe_commentaire as c"; -$sql .= ",".MAIN_DB_PREFIX."societe_perms as sp"; - -$sql .= " WHERE c.fk_soc = s.rowid "; -$sql .= " AND s.rowid = sp.fk_soc"; -$sql .= " AND sp.fk_user = ".$user->id." AND sp.pread = 1"; -$sql .= " ORDER BY c.datec DESC LIMIT 10"; - -$resql = $db->query($sql); -if ($resql) -{ - print ''; - print ''; - - while ($obj = $db->fetch_object($resql)) - { - $var=!$var; - print "'; - print '\n"; - print "\n"; - } - print "
'.min(10,$num).' derniers commentaires
"; - print ''; - print img_file(); - print ' '; - $nom = $obj->nom; - if (strlen($obj->nom) > 33) - $nom = substr($obj->nom,0,30)."..."; - print ''.stripslashes($nom).''.stripslashes($obj->commentaire)."
"; - $db->free($resql); -} -else -{ - print $db->error() . ' ' . $sql; -} - -print '
'; - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/client/lignes.php b/htdocs/telephonie/client/lignes.php deleted file mode 100644 index d6c9ae6fe6d..00000000000 --- a/htdocs/telephonie/client/lignes.php +++ /dev/null @@ -1,202 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require("./pre.inc.php"); - -$mesg = ''; - -llxHeader("","","Fiche client"); - -if ($cancel == $langs->trans("Cancel")) -{ - $action = ''; -} -/* - * Affichage - * - */ - -if ($_GET["id"]) -{ - $soc = new TelephonieClient($db); - $result = $soc->fetch($_GET["id"], $user); - - if (!$soc->perm_read) - { - print "Lecture non authoris�e"; - } - - if ( $result == 1 && $soc->perm_read) - { - if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit') - { - $h=0; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/client/fiche.php?id=".$soc->id; - $head[$h][1] = $langs->trans("Contrats"); - $hselected = $h; - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/client/lignes.php?id=".$soc->id; - $head[$h][1] = $langs->trans("Lignes"); - $hselected = $h; - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/client/factures.php?id=".$soc->id; - $head[$h][1] = $langs->trans("Factures"); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/client/stats.php?id=".$soc->id; - $head[$h][1] = $langs->trans("Stats"); - $h++; - - $sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."telephonie_tarif_client"; - $sql .= " WHERE fk_client = '".$soc->id."';"; - $resql = $db->query($sql); - - if ($resql) - { - $row = $db->fetch_row($resql); - $db->free($resql); - } - - $head[$h][0] = DOL_URL_ROOT."/telephonie/client/tarifs.php?id=".$soc->id; - $head[$h][1] = $langs->trans("Tarifs (".$row[0].")"); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/client/commentaires.php?id=".$soc->id; - $head[$h][1] = $langs->trans("Commentaires"); - $num_comments = $soc->count_comment(); - if ($num_comments > 0) - { - $head[$h][1] = $langs->trans("Commentaires ($num_comments)"); - } - $h++; - - - dol_fiche_head($head, $hselected, 'Client : '.$soc->nom); - - print ''; - print ''; - - - print ""; - - print ''; - print ''; - - print '
'.$langs->trans('Name').''.$soc->nom.''.$langs->trans('Code client').''.$soc->code_client.'
".$langs->trans('Address')."".nl2br($soc->adresse)."
".$soc->cp." ".$soc->ville." ".$soc->pays."
'.$langs->trans('Phone').''.dol_print_phone($soc->tel,$soc->pays_code,0,$soc->id).''.$langs->trans('Fax').''.dol_print_phone($soc->fax,$soc->pays_code,0,$soc->id).'

'; - - print ''; - - //print ''; - //print ''; - - /* Lignes */ - - $sql = "SELECT s.rowid as socid, f.nom as fournisseur, s.nom"; - $sql .= ", ss.nom as agence, ss.ville, ss.code_client"; - $sql .= " , l.ligne, l.statut, l.rowid, l.remise"; - $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; - $sql .= " , ".MAIN_DB_PREFIX."societe as ss"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_fournisseur as f"; - $sql .= " WHERE l.fk_client_comm = s.rowid AND l.fk_fournisseur = f.rowid"; - $sql .= " AND l.fk_soc = ss.rowid "; - $sql .= " AND s.rowid = ".$soc->id; - $sql .= " ORDER BY ss.rowid ASC"; - - $resql = $db->query($sql); - - if ($resql) - { - $num = $db->num_rows($resql); - if ( $num > 0 ) - { - $i = 0; - - $ligne = new LigneTel($db); - - print ''; - print ''; - if ($user->rights->telephonie->fournisseur->lire) - print ''; - - print "\n"; - - while ($i < $num) - { - $obj = $db->fetch_object($resql); - $var=!$var; - - print "\n"; - - print '\n"; - print '\n"; - print '\n"; - - print '\n"; - if ($user->rights->telephonie->fournisseur->lire) - print "\n"; - print "\n"; - $i++; - } - } - $db->free($resql); - - } - else - { - print $sql; - } - - print "
Num�ro'.dol_print_phone($ligne->numero).'Factur�e : '.$ligne->facturable.'
Ligne'; - print 'Agence/FilialeRemise LMNFournisseur
"; - - print ' '; - - print ''; - print img_file(); - - print ' '; - - print ''.dol_print_phone($obj->ligne,0,0,true)."'.$obj->code_client."'.$obj->agence."'.$obj->ville."'.$obj->remise." %".$obj->fournisseur."
"; - } - } -} -else -{ - print "Error"; -} - - -print ''; - -/* ************************************************************************** */ -/* */ -/* Barre d'action */ -/* */ -/* ************************************************************************** */ - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/client/liste.php b/htdocs/telephonie/client/liste.php deleted file mode 100644 index 27c15f1d989..00000000000 --- a/htdocs/telephonie/client/liste.php +++ /dev/null @@ -1,133 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; -$sortfield = $_GET["sortfield"]; - -llxHeader('','Telephonie - Ligne - Liste'); -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -if ($sortorder == "") { - $sortorder="ASC"; -} -if ($sortfield == "") { - $sortfield="s.nom"; -} - -/* - * Recherche - * - */ - -if ($page == -1) { $page = 0 ; } - -$offset = $conf->liste_limit * $page ; -$pageprev = $page - 1; -$pagenext = $page + 1; - -/* - * Mode Liste - * - * - */ -$sql = "SELECT s.rowid as socid, s.nom, count(l.ligne) as ligne, cs.ca"; -$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; -$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_perms as sp ON sp.fk_soc = s.rowid "; -$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."telephonie_client_stats as cs ON cs.fk_client_comm = s.rowid"; -$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."telephonie_societe_ligne as l ON l.fk_client_comm = s.rowid"; - -$sql .= " WHERE sp.fk_user = ".$user->id." AND sp.pread = 1"; - -if ($_GET["search_client"]) -{ - $sel = urldecode($_GET["search_client"]); - $sql .= " AND s.nom LIKE '%".$sel."%'"; -} - -$sql .= " GROUP BY s.rowid"; -$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); - -$result = $db->query($sql); -if ($result) -{ - $num = $db->num_rows(); - $i = 0; - - $urladd= "&statut=".$_GET["statut"]; - - print_barre_liste("Clients", $page, "liste.php", $urladd, $sortfield, $sortorder, '', $num); - - print ''; - print ''; - print_liste_field_titre("Client","liste.php","s.nom","","",' width="50%"'); - print ''; - print "\n"; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - $var=True; - - while ($i < min($num,$conf->liste_limit)) - { - $obj = $db->fetch_object($i); - $var=!$var; - - print "'; - print '\n"; - - print '\n"; - print "\n"; - $i++; - } - print "
Nb Lignes'; - print 'CA
 
"; - - print ''; - print img_file(); - print ' '; - - print ''.$obj->nom.''.$obj->ligne."'.price($obj->ca)." euros HT
"; - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/client/my.php b/htdocs/telephonie/client/my.php deleted file mode 100644 index b0a4b90c6da..00000000000 --- a/htdocs/telephonie/client/my.php +++ /dev/null @@ -1,140 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; -$sortfield = $_GET["sortfield"]; - -llxHeader('','Telephonie - Mes clients'); -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -if ($sortorder == "") { - $sortorder="ASC"; -} -if ($sortfield == "") { - $sortfield="s.nom"; -} - -/* - * Recherche - * - * - */ -if ($page == -1) { $page = 0 ; } - -$offset = $conf->liste_limit * $page ; -$pageprev = $page - 1; -$pagenext = $page + 1; - -/* - * Mode Liste - * - * - */ -$sql = "SELECT s.rowid as socid, s.nom, count(l.ligne) as ligne, cs.ca"; -$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; -$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."telephonie_societe_ligne AS l ON l.fk_client_comm = s.rowid"; -$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."telephonie_client_stats as cs ON cs.fk_client_comm = s.rowid"; -$sql .= " WHERE l.fk_commercial_suiv = ".$user->id; - -if ($_GET["search_client"]) -{ - $sel = urldecode($_GET["search_client"]); - $sql .= " AND s.nom LIKE '%".$sel."%'"; -} - -$sql .= " GROUP BY s.rowid"; -$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); - -$result = $db->query($sql); -if ($result) -{ - $num = $db->num_rows(); - $i = 0; - - $urladd= "&statut=".$_GET["statut"]; - - $titre = "Les clients de ".$user->fullname; - - print_barre_liste($titre, $page, "my.php", $urladd, $sortfield, $sortorder, '', $num); - - //print 'Exporter dans un tableur'; - - print ''; - print ''; - print_liste_field_titre("Client","my.php","s.nom","","",' width="50%"'); - print ''; - print "\n"; - - print ''; - print ''; - print ''; - print ''; - - print ''; - print ''; - - $var=True; - - $ligne = new LigneTel($db); - - while ($i < min($num,$conf->liste_limit)) - { - $obj = $db->fetch_object($i); - $var=!$var; - - print "'; - print '\n"; - - print '\n"; - - - print "\n"; - $i++; - } - print "
Nb Lignes'; - print 'Chiffre d\'affaire
 
"; - - print ''; - print img_file(); - print ' '; - - print ''.$obj->nom.''.$obj->ligne."'.price($obj->ca)." euros HT
"; - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/client/new.php b/htdocs/telephonie/client/new.php deleted file mode 100644 index d11d08ad12a..00000000000 --- a/htdocs/telephonie/client/new.php +++ /dev/null @@ -1,864 +0,0 @@ - - * Copyright (C) 2003 Brian Fraval - * Copyright (C) 2004-2005 Laurent Destailleur - * Copyright (C) 2005 Eric Seigne - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/** - \file htdocs/telephonie/client/new.php - \ingroup telephonie - \brief Creation d'un nouveau client - \version $Id$ - */ - -require("pre.inc.php"); -require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php"); -require_once(DOL_DOCUMENT_ROOT.'/contact.class.php'); -require_once(DOL_DOCUMENT_ROOT.'/companybankaccount.class.php'); -require_once(DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); -require_once(DOL_DOCUMENT_ROOT."/telephonie/telephonie.contrat.class.php"); - -if (!$user->rights->telephonie->ligne->creer) accessforbidden(); - -$user->getrights('societe'); -$langs->load("companies"); - -$soc = new Societe($db); -$contact = new Contact($db); -$rib = new CompanyBankAccount($db); - - -/* - * Actions - */ - -if ($_POST["action"] == 'add') -{ - $error = 0; - $verif = "ok"; - $mesg = ''; - - - $contact->name = $_POST["cnom"]; - $contact->firstname = $_POST["cprenom"]; - $contact->email = strtolower($_POST["cmail"]); - - if (strlen(trim($_POST["nom"])) == 0) - { - $mesg = "Nom de société incorrect"; - $verif = "nok"; - } - - if (strlen(trim($_POST["code_client"])) <> 6 && $verif == 'ok') - { - $mesg = "Code client incorrect"; - $verif = "nok"; - } - - if (strlen(trim($_POST["adresse"])) == 0 && $verif == 'ok') - { - $mesg = "Adresse de société manquante"; - $verif = "nok"; - } - - if (strlen(trim($_POST["cp"])) == 0 && $verif == 'ok') - { - $mesg = "Code postal manquant"; - $verif = "nok"; - } - - if (strlen(trim($_POST["ville"])) == 0 && $verif == 'ok') - { - $mesg = "Ville manquante"; - $verif = "nok"; - } - - $rib->code_banque = $_POST["rib_banque"]; - $rib->code_guichet = $_POST["rib_guichet"]; - $rib->number = $_POST["rib_compte"]; - $rib->cle_rib = $_POST["rib_cle"]; - $rib->iban_prefix = $_POST["rib_iban"]; - $rib->iban = $_POST["rib_iban"]; - $rib->proprio = $_POST["titulaire"]; - - - if ((strlen(trim($_POST["rib_banque"])) + strlen(trim($_POST["rib_guichet"])) + strlen(trim($_POST["rib_compte"])) + strlen(trim($_POST["rib_cle"])))<> 0 && $verif == 'ok') - { - if (strlen(trim($_POST["rib_banque"])) <> 5 && $verif == 'ok') - { - $mesg = "Rib code banque incomplet"; - $verif = "nok"; - } - - if (strlen(trim($_POST["rib_guichet"])) <> 5 && $verif == 'ok') - { - $mesg = "Rib code agence incomplet"; - $verif = "nok"; - } - - if (strlen(trim($_POST["titulaire"])) == 0 && $verif == 'ok') - { - $mesg = "Vous devez indiquer le titulaire du compte"; - $verif = "nok"; - } - - if ($rib->verif() <> 1 && $verif == 'ok') - { - $mesg = "Rib incorrect ".$rib->error_message; - $verif = "nok"; - } - } - - if (strlen(trim($_POST["cmail"])) > 0 && $verif == 'ok') - { - - if (strlen(trim($_POST["cnom"])) == 0 && $verif == 'ok') - { - $mesg = "Nom de contact manquant"; - $verif = "nok"; - } - - if (! isValidEmail(trim($contact->email)) && $verif == 'ok') - { - $mesg = "Email invalide"; - $verif = "nok"; - } - - if (! isValidMailDomain(trim($contact->email)) && $verif == 'ok') - { - $mesg = "Email invalide (domaine invalide)"; - $verif = "nok"; - } - } - - - if (strlen(trim($_POST["cli"])) <> 9 && $verif == 'ok') - { - $mesg = "Numéro de ligne #1 (0".$_POST["cli"].") incorrect"; - $verif = "nok"; - } - - if (strlen(trim($_POST["cliend"])) > 0 && strlen(trim($_POST["cliend"])) <> 9 && $verif == 'ok') - { - $mesg = "Numéro de ligne dernier SDA (0".$_POST["cliend"].") incorrect"; - $verif = "nok"; - } - - $p = array("1","2","3","4","5"); - - if (!in_array(substr(trim($_POST["cli"]),0,1), $p) && $verif == 'ok') - { - $mesg = "Numéro de ligne #1 (0".$_POST["cli"].") incorrect"; - $verif = "nok"; - } - - $ligne = new LigneTel($db); - $ligne->fetch("0".trim($_POST["cli"])); - if ($ligne->id > 0 && $verif == 'ok') - { - $mesg = "La ligne #1 : 0".$_POST["cli"]." existe déjà !"; - $verif = "nok"; - } - - - /* Ligne #2 */ - - if (strlen(trim($_POST["cli2"])) > 0 && $verif == 'ok') - { - if (strlen(trim($_POST["cli2"])) <> 9 && $verif == 'ok') - { - $mesg = "Numéro de ligne #2 (0".$_POST["cli2"].") incorrect"; - $verif = "nok"; - } - - if (!in_array(substr(trim($_POST["cli2"]),0,1), $p) && $verif == 'ok') - { - $mesg = "Numéro de ligne #2 (0".$_POST["cli2"].") incorrect"; - $verif = "nok"; - } - - $ligne = new LigneTel($db); - $ligne->fetch("0".trim($_POST["cli2"])); - if ($ligne->id > 0 && $verif == 'ok') - { - $mesg = "La ligne #2 : 0".$_POST["cli2"]." existe déjà !"; - $verif = "nok"; - } - } - /* Ligne #3 */ - - if (strlen(trim($_POST["cli3"])) > 0 && $verif == 'ok') - { - if (strlen(trim($_POST["cli3"])) <> 9 && $verif == 'ok') - { - $mesg = "Numéro de ligne #3 (0".$_POST["cli3"].") incorrect"; - $verif = "nok"; - } - - if (!in_array(substr(trim($_POST["cli3"]),0,1), $p) && $verif == 'ok') - { - $mesg = "Numéro de ligne #3 (0".$_POST["cli3"].") incorrect"; - $verif = "nok"; - } - - $ligne = new LigneTel($db); - $ligne->fetch("0".trim($_POST["cli3"])); - if ($ligne->id > 0 && $verif == 'ok') - { - $mesg = "La ligne #3 : 0".$_POST["cli3"]." existe déjà !"; - $verif = "nok"; - } - } - - /* Verif Tarif */ - if (strlen(trim($_POST["france"])) > 0 && $verif == "ok") - { - $temporel = ereg_replace(",",".",trim($_POST["france"])); - - if(! is_numeric($temporel)) - { - $error = 1030; - $verif = "nok"; - $mesg .= "Tarif France Invalide"; - } - else - { - if ($temporel > 0.04 ) - { - $error = 1031; - $verif = "nok"; - $mesg .= "Tarif France Invalide : $temporel > 0.04 !"; - } - - if ($temporel < 0.016 ) - { - $error = 1031; - $verif = "nok"; - $mesg .= "Tarif France Invalide : $temporel < 0.016 !"; - } - } - } - if (strlen(trim($_POST["mobil"])) > 0 && $verif == "ok") - { - $temporel = ereg_replace(",",".",trim($_POST["mobil"])); - - if(! is_numeric($temporel)) - { - $error++; - $verif = "nok"; - $mesg .= "Tarif Mobile Invalide"; - } - else - { - if ($temporel > 0.40 ) - { - $error = 1033; - $verif = "nok"; - $mesg .= "Tarif Mobile Invalide : $temporel > 0.40 !"; - } - if ($temporel < 0.14 ) - { - $error = 1034; - $verif = "nok"; - $mesg .= "Tarif Mobile Invalide : $temporel < 0.14 !"; - } - } - } - - /* Fin Verif Tarif */ - - $soc->nom = $_POST["nom"]; - $soc->adresse = $_POST["adresse"]; - $soc->cp = $_POST["cp"]; - $soc->ville = $_POST["ville"]; - $soc->pays_id = $_POST["pays_id"]; - $soc->tel = $_POST["tel"]; - $soc->fax = $_POST["fax"]; - $soc->url = ereg_replace( "http://", "", $_POST["url"] ); - $soc->code_client = $_POST["code_client"]; - $soc->code_fournisseur = $_POST["code_fournisseur"]; - $soc->codeclient_modifiable = $_POST["codeclient_modifiable"]; - $soc->codefournisseur_modifiable = $_POST["codefournisseur_modifiable"]; - $soc->client = 1; - $soc->fournisseur = 0; - - if (!$error && $verif == "ok") - { - $soc->code_client = $_POST["code_client"]."00"; - $result = $soc->create($user); - - if ($result == 0) - { - $soc->AddPerms(1,1,1,1); - $soc->AddPerms(5,1,1,1); - $soc->AddPerms(9,1,1,1); - $soc->AddPerms($user->id,1,1,1); - $soc->AddPerms($_POST["commercial_sign"],1,0,0); - } - else - { - $mesg = nl2br($soc->error) . " (result $result)\n"; - $error = 1035; - } - } - - if (!$error && $verif == "ok") - { - $contact->socid = $soc->id; - - if ( $contact->create($user) > 0) - { - - } - else - { - $error = 1024; - } - } - - - if ((strlen(trim($_POST["rib_banque"])) + strlen(trim($_POST["rib_guichet"])) + strlen(trim($_POST["rib_compte"])) + strlen(trim($_POST["rib_cle"])))<> 0 && $verif == 'ok' && !$error) - { - $rib->socid = $soc->id; - if ( $rib->update($user) > 0) - { - - } - else - { - $error = 1025; - } - } - - if (!$error && $verif == "ok") - { - $contrat = new TelephonieContrat($db); - - $contrat->client_comm = $soc->id; - $contrat->client = $soc->id; - $contrat->client_facture = $soc->id; - $contrat->commercial_sign = $_POST["commercial_sign"]; - - if ( $contrat->create($user,'oui',$_POST["mode_paiement"]) == 0) - { - $contrat->add_contact_facture($contact->id); - } - else - { - $error = 1026; - } - } - - if(!$error && $verif == "ok") - { - $contrat->commercial_sign_id = $_POST["commercial_sign"]; - $contrat->addpo($_POST["montantpo"], $user); - } - - /* Ligne 1 */ - - $ligne = new LigneTel($db); - $ligne->contrat = $contrat->id; - $ligne->numero = "0".$_POST["cli"]; - $ligne->client_comm = $soc->id; - $ligne->client = $soc->id; - $ligne->client_facture = $soc->id; - $ligne->fournisseur = $_POST["fournisseur"]; - $ligne->commercial_sign = $_POST["commercial_sign"]; - $ligne->commercial_suiv = $_POST["commercial_sign"]; - $ligne->concurrent = $_POST["concurrent"]; - $ligne->remise = "0"; - $ligne->note = $_POST["note"]; - - if(!$error && $verif == "ok") - { - if (strlen(trim($_POST["cli"])) == 9) - { - - if ( $ligne->create($user, $_POST["mode_paiement"]) == 0) - { - - } - else - { - $error = 1027; - $mesg.= "Impossible de créer la ligne #1 0".$_POST["cli"]; - } - } - } - - /* SDA */ - - if(!$error && $verif == "ok") - { - if (strlen(trim($_POST["cli"])) == 9 && strlen(trim($_POST["cliend"])) == 9) - { - $cbegin = trim($_POST["cli"]) + 1; - $cend = trim($_POST["cliend"]); - - $cli = $cbegin; - - while ($cli <= $cend) - { - $ligne = new LigneTel($db); - $ligne->contrat = $contrat->id; - $ligne->numero = "0".$cli; - $ligne->client_comm = $soc->id; - $ligne->client = $soc->id; - $ligne->client_facture = $soc->id; - $ligne->fournisseur = $_POST["fournisseur"]; - $ligne->commercial_sign = $_POST["commercial_sign"]; - $ligne->commercial_suiv = $_POST["commercial_sign"]; - $ligne->concurrent = $_POST["concurrent"]; - $ligne->remise = "0"; - $ligne->note = $_POST["note"]; - - if ( $ligne->create($user, $_POST["mode_paiement"]) == 0) - { - - } - else - { - $error = 1027; - $mesg.= "Impossible de créer la ligne 0$cli"; - } - - $cli++; - } - } - } - - /* Ligne 2 */ - - $ligne = new LigneTel($db); - $ligne->contrat = $contrat->id; - $ligne->numero = "0".$_POST["cli2"]; - $ligne->client_comm = $soc->id; - $ligne->client = $soc->id; - $ligne->client_facture = $soc->id; - $ligne->fournisseur = $_POST["fournisseur"]; - $ligne->commercial_sign = $_POST["commercial_sign"]; - $ligne->commercial_suiv = $_POST["commercial_sign"]; - $ligne->concurrent = $_POST["concurrent"]; - $ligne->remise = "0"; - $ligne->note = $_POST["note"]; - - if(!$error && $verif == "ok") - { - if (strlen(trim($_POST["cli2"])) == 9) - { - - if ( $ligne->create($user, $_POST["mode_paiement"]) == 0) - { - - } - else - { - //$error++; - $error = 1028; - $mesg.= "Impossible de créer la ligne #2 0".$_POST["cli2"]; - } - } - } - - /* Ligne 3 */ - $ligne = new LigneTel($db); - $ligne->contrat = $contrat->id; - $ligne->numero = "0".$_POST["cli3"]; - $ligne->client_comm = $soc->id; - $ligne->client = $soc->id; - $ligne->client_facture = $soc->id; - $ligne->fournisseur = $_POST["fournisseur"]; - $ligne->commercial_sign = $_POST["commercial_sign"]; - $ligne->commercial_suiv = $_POST["commercial_sign"]; - $ligne->concurrent = $_POST["concurrent"]; - $ligne->remise = "0"; - $ligne->note = $_POST["note"]; - - if(!$error && $verif == "ok") - { - if (strlen(trim($_POST["cli3"])) == 9) - { - - if ( $ligne->create($user, $_POST["mode_paiement"]) == 0) - { - - } - else - { - //$error++; - $error = 1029; - $mesg.= "Impossible de créer la ligne #3 0".$_POST["cli3"]; - } - } - } - - /* DEBUT TARIFS */ - if (strlen(trim($_POST["france"])) > 0 && $verif == "ok") - { - $temporel = ereg_replace(",",".",trim($_POST["france"])); - - if (!$error) - { - $db->begin(); - - $sql = "REPLACE INTO ".MAIN_DB_PREFIX."telephonie_tarif_client"; - $sql .= " (fk_tarif, fk_client, temporel, fixe, fk_user) VALUES "; - $sql .= " (1293,".$soc->id.",'".$temporel."','0',".$user->id.")"; - - if (! $db->query($sql) ) - { - $error++; - } - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_tarif_client_log"; - $sql .= " (fk_tarif, fk_client, temporel, fixe, fk_user, datec) VALUES "; - $sql .= " (1293,".$soc->id.",'".$temporel."','0',".$user->id.",now())"; - - if (! $db->query($sql) ) - { - $error++; - } - - if ( $error == 0 ) - { - $db->commit(); - } - else - { - $db->rollback(); - $mesg = "Erreur tarifs !"; - } - } - } - - /* mobiles */ - if (strlen(trim($_POST["mobil"])) > 0 && $verif == "ok") - { - $mobil_ids = array(1289,1290,1291,1292); - foreach ($mobil_ids as $mobil_id) - { - $temporel = ereg_replace(",",".",trim($_POST["mobil"])); - - if (!$error) - { - $db->begin(); - - $sql = "REPLACE INTO ".MAIN_DB_PREFIX."telephonie_tarif_client"; - $sql .= " (fk_tarif, fk_client, temporel, fixe, fk_user) VALUES "; - $sql .= " (".$mobil_id.",".$soc->id.",'".$temporel."','0',".$user->id.")"; - - if (! $db->query($sql) ) - { - $error++; - } - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_tarif_client_log"; - $sql .= " (fk_tarif, fk_client, temporel, fixe, fk_user, datec) VALUES "; - $sql .= " (".$mobil_id.",".$soc->id.",'".$temporel."','0',".$user->id.",now())"; - - if (! $db->query($sql) ) - { - $error++; - } - - if ( $error == 0 ) - { - $db->commit(); - } - else - { - $db->rollback(); - $mesg = "Erreur tarifs !"; - } - } - } - } - - /* FIN TARIFS */ - - if (!$error && $verif == "ok") - { - Header("Location: ".DOL_URL_ROOT."/telephonie/contrat/fiche.php?id=".$contrat->id); - } - else - { - $mesg .= " (numéro erreur : $error)"; - } - -} - -/** - * - * - */ - -llxHeader(); - -$form = new Form($db); - -if ($user->rights->telephonie->ligne->creer) -{ - - dol_fiche_head($head, $hselected, 'Nouveau client'); - /* - - */ - - if ($mesg) - { - print '
'; - print $mesg; - print '
'; - } - else - { - - } - - $focus = " onfocus=\"this.className='focus';\" onblur=\"this.className='normal';\" "; - - - print '
'; - print ''; - print ''; - print ''; - print ''; - - print '
'; - print '
'; - print "Société\n"; - - print ''; - - print '"; - - // On positionne pays_id, pays_code et libelle du pays choisi - $soc->pays_id=$_POST["pays_id"]?$_POST["pays_id"]:(defined(MAIN_INFO_SOCIETE_PAYS)?MAIN_INFO_SOCIETE_PAYS:''); - if ($soc->pays_id) - { - $sql = "SELECT code, libelle from ".MAIN_DB_PREFIX."c_pays where rowid = ".$soc->pays_id; - $resql=$db->query($sql); - if ($resql) - { - $obj = $db->fetch_object($resql); - } - else - { - dol_print_error($db); - } - $soc->pays_code=$obj->code; - $soc->pays=$obj->libelle; - } - - print ''; - - print ''; - - print ''; - - print ''; - print ''; - - print "
'.$langs->trans('Name').''; - print ''; - - print "Attention ce formulaire n'est a utiliser uniquement pour les nouveaux clients.
'.$langs->trans('CustomerCode').''; - - print '00
'.$langs->trans('Address').'
'.$langs->trans('Zip').''; - print ' '; - - print $langs->trans('Town').' 
'.$langs->trans('Phone').''.$langs->trans('Fax').'
\n"; - print "

\n"; - print '
'; - print "Coordonnées bancaires\n"; - print ''; - - print ''; - - print ''; - - print ''; - - print "
Titulaire du compte
RIB'; - print ''; - print ''; - print ''; - print ''; - print '  IBAN  '; - print ''; - print '
Règlement'; - print ''; - print '
\n"; - print "

\n"; - - print '
'; - print "Contact\n"; - print ''; - - print ''; - print ''; - print ''; - - print "
'.$langs->trans('Name').''.$langs->trans('Firstname').'
'.$langs->trans('Mail').'
\n"; - print "

\n"; - - print '
'; - print "Commercial\n"; - print ''; - print ''; - - print ''; - print ''; - - print "
Commercial Signature'; - $ff = array(); - $sql = "SELECT u.rowid, u.firstname, u.name"; - $sql .= " FROM ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."usergroup_user as ug"; - $sql .= " WHERE u.rowid = ug.fk_user"; - $sql .= " AND ug.fk_usergroup = '".TELEPHONIE_GROUPE_COMMERCIAUX_ID."'"; - $sql .= " ORDER BY name "; - if ( $db->query( $sql) ) - { - $num = $db->num_rows(); - if ( $num > 0 ) - { - while ($row = $db->fetch_row($resql)) - { - $ff[$row[0]] = $row[1] . " " . $row[2]; - } - } - $db->free(); - - } - - $form->select_array("commercial_sign",$ff,$ligne->commercial_sign); - - print 'PO mensuelle'; - print ' euros HT
\n"; - print "

\n"; - - print '
'; - print "Lignes téléphoniques à présélectionner\n"; - - print ''; - - print ''; - - print ''; - - - - print ''; - - print ''; - - print ''; - - print ''; - - print "
Ligne téléphonique #10Derniere SDA0
Ligne téléphonique #20
Ligne téléphonique #30
Fournisseur'; - $ff = array(); - $sql = "SELECT rowid, nom FROM ".MAIN_DB_PREFIX."telephonie_fournisseur WHERE commande_active = 1 ORDER BY nom "; - $resql = $db->query($sql); - if ($resql) - { - while ($row = $db->fetch_row($resql)) - { - $ff[$row[0]] = $row[1]; - } - $db->free($resql); - } - - $def =$ligne->fournisseur?$ligne->fournisseur:TELEPHONIE_FOURNISSEUR_DEFAUT_ID; - - $form->select_array("fournisseur",$ff,$def); - print 'Fournisseur précédent'; - $ff = array(); - $sql = "SELECT rowid, nom FROM ".MAIN_DB_PREFIX."telephonie_concurrents ORDER BY rowid "; - $resql = $db->query( $sql) ; - if ($resql) - { - $num = $db->num_rows($resql); - if ( $num > 0 ) - { - while ($row = $db->fetch_row($resql)) - { - $ff[$row[0]] = $row[1]; - } - } - $db->free(); - - } - $form->select_array("concurrent",$ff,$ligne->concurrent); - print '
\n"; - print "

\n"; - - /* DEBUT TARIFS */ - - print '
'; - print "Tarifs\n"; - if ($user->rights->telephonie->tarif->client_modifier) - { - print ''; - - print ''; - - print ''; - - print "
FranceLaissez vide si tarifs par défaut
MobilesTous réseaux confondus
\n"; - } - else - { - print "Vous n'avez pas les droits pour modifier les tarifs"; - } - print "

\n"; - - /* FIN TARIFS */ - - print ''."\n"; - - print ''."\n"; - print "
\n"; -} - - -$db->close(); - - -llxFooter('$Date$ - $Revision$'); -?> - diff --git a/htdocs/telephonie/client/permissions.php b/htdocs/telephonie/client/permissions.php deleted file mode 100644 index 45ee050e3c5..00000000000 --- a/htdocs/telephonie/client/permissions.php +++ /dev/null @@ -1,244 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require("./pre.inc.php"); - -$mesg = ''; - -$soc = new Societe($db); - -if ($_GET["id"]) -{ - $result = $soc->fetch($_GET["id"], $user); -} - -if (!$soc->perm_read) - accessforbidden(); - -if (!$soc->perm_perms) - accessforbidden(); - -if ($_GET["action"] == 'inv') -{ - $sql = "UPDATE ".MAIN_DB_PREFIX."societe_perms"; - $sql .= " SET p".$_GET["p"]." = !p".$_GET["p"]; - $sql .= " WHERE fk_user=".$_GET["u"]." AND fk_soc=".$_GET["id"]; - - if ($resql = $db->query($sql)) - { - Header("Location: permissions.php?id=$soc->id"); - } -} - -if ($_POST["action"] == 'add') -{ - $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_perms"; - $sql .= " (fk_soc,fk_user,pread,pwrite,pperms) VALUES"; - $sql .= " (".$_GET["id"].",".$_POST["new_user"].","; - $sql .= $_POST["read"]=='on'?"1,":"0,"; - $sql .= $_POST["read"]=='on'?"1,":"0,"; - $sql .= $_POST["read"]=='on'?"1);":"0);"; - - if ($resql = $db->query($sql)) - { - Header("Location: permissions.php?id=$soc->id"); - } -} - -llxHeader("","","Fiche client"); - -/* - * Affichage - * - */ - -if ($soc->id) -{ - $h=0; - $form = new Form($db); - - $head[$h][0] = DOL_URL_ROOT."/telephonie/client/fiche.php?id=".$soc->id; - $head[$h][1] = $langs->trans("Contrats"); - $hselected = $h; - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/client/lignes.php?id=".$soc->id; - $head[$h][1] = $langs->trans("Lignes"); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/client/factures.php?id=".$soc->id; - $head[$h][1] = $langs->trans("Factures"); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/client/ca.php?id=".$soc->id; - $head[$h][1] = $langs->trans("CA"); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/client/tarifs.php?id=".$soc->id; - $head[$h][1] = $langs->trans("Tarifs"); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/client/permissions.php?id=".$soc->id; - $head[$h][1] = $langs->trans("Permissions"); - $hselected = $h; - $h++; - - dol_fiche_head($head, $hselected, 'Client : '.$soc->nom); - - print ''; - print ''; - - print ""; - - print ''; - print ''; - - print '
'.$langs->trans('Name').''.$soc->nom.''.$langs->trans('Code client').''.$soc->code_client.'
".$langs->trans('Address')."".nl2br($soc->adresse)."
".$soc->cp." ".$soc->ville." ".$soc->pays."
'.$langs->trans('Phone').''.dol_print_phone($soc->tel,$soc->pays_code,0,$soc->id).''.$langs->trans('Fax').''.dol_print_phone($soc->fax,$soc->pays_code,0,$soc->id).'

'; - print '
'; - print ''; - print ''; - print ''; - - /* Permissions du user en cours */ - $sql = "SELECT p.pread, p.pwrite, p.pperms"; - $sql .= " FROM ".MAIN_DB_PREFIX."societe_perms as p"; - $sql .= " WHERE p.fk_soc=".$soc->id." AND p.fk_user=".$user->id.";"; - - if ($resql = $db->query($sql)) - { - $num = $db->num_rows($resql); - if ( $num > 0 ) - { - $obj = $db->fetch_object($resql); - $read = $obj->pread; - $write = $obj->pwrite; - $perms = $obj->pperms; - } - $db->free($resql); - } - else - { - print $sql; - } - - /* Ajout un user */ - $uss = array(); - $sql = "SELECT u.rowid, u.firstname, u.name"; - $sql .= " FROM ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."usergroup_user as ug"; - $sql .= " WHERE u.rowid = ug.fk_user"; - $sql .= " AND ug.fk_usergroup = '".TELEPHONIE_GROUPE_COMMERCIAUX_ID."'"; - $sql .= " ORDER BY name "; - if ( $resql = $db->query( $sql) ) - { - while ($row = $db->fetch_row($resql)) - { - $uss[$row[0]] = $row[1] . " " . $row[2]; - } - $db->free($resql); - } - - /* Permissions */ - $sql = "SELECT u.rowid,u.firstname, u.name, p.pread, p.pwrite, p.pperms"; - $sql .= " FROM ".MAIN_DB_PREFIX."societe_perms as p"; - $sql .= " , ".MAIN_DB_PREFIX."user as u"; - $sql .= " WHERE p.fk_user = u.rowid AND p.fk_soc = ".$soc->id; - $sql .= " ORDER BY u.name ASC"; - - $resql = $db->query($sql); - - if ($resql) - { - $num = $db->num_rows($resql); - if ( $num > 0 ) - { - $i = 0; - $ligne = new LigneTel($db); - - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; - - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; - - while ($i < $num) - { - $obj = $db->fetch_object($resql); - $var=!$var; - - print ""; - print '\n"; - - if ($perms == 1) - { - print '\n"; - print '\n"; - print '\n"; - } - else - { - print '\n"; - print '\n"; - print '\n"; - } - print "\n"; - $i++; - } - } - $db->free($resql); - - } - else - { - print $sql; - } - print "
UtilisateurLectureEcriturePermissions 
'; - $form->select_array("new_user",$uss); - print '
'.$obj->firstname." ".$obj->name."'.img_allow($obj->pread)."'.img_allow($obj->pwrite)."'.img_allow($obj->pperms)."'.img_allow($obj->pread)."'.img_allow($obj->pwrite)."'.img_allow($obj->pperms)." 
"; -} -else -{ - print "Error"; -} - - -print ''; - -/* ************************************************************************** */ -/* */ -/* Barre d'action */ -/* */ -/* ************************************************************************** */ - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/client/pre.inc.php b/htdocs/telephonie/client/pre.inc.php deleted file mode 100644 index 9218b85267d..00000000000 --- a/htdocs/telephonie/client/pre.inc.php +++ /dev/null @@ -1,77 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("../../main.inc.php"); -require(DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); -require(DOL_DOCUMENT_ROOT."/telephonie/telephonie.client.class.php"); - -$user->getrights('telephonie'); - -function llxHeader($head = "", $title="") { - global $user; - - /* - * - * - */ - top_menu($head, $title); - - $menu = new Menu(); - - $menu->add(DOL_URL_ROOT."/telephonie/index.php", "Telephonie"); - - if (TELEPHONIE_MODULE_SIMULATION == 1) - $menu->add(DOL_URL_ROOT."/telephonie/simulation/fiche.php", "Simulation"); - - $menu->add(DOL_URL_ROOT."/telephonie/client/index.php", "Clients"); - if ($user->rights->telephonie->ligne->creer) - $menu->add_submenu(DOL_URL_ROOT."/telephonie/client/new.php", "Nouveau client"); - - $menu->add_submenu(DOL_URL_ROOT."/telephonie/client/my.php", "Mes clients"); - $menu->add_submenu(DOL_URL_ROOT."/telephonie/client/liste.php", "Liste"); - $menu->add_submenu(DOL_URL_ROOT."/telephonie/client/contacts.php", "Contacts"); - $menu->add_submenu(DOL_URL_ROOT."/telephonie/client/remises.php", "Remises à faire"); - $menu->add_submenu(DOL_URL_ROOT."/telephonie/client/remisesdone.php", "Remises faites"); - - //$menu->add_submenu(DOL_URL_ROOT."/telephonie/client/rapports", "Rapports"); - - $menu->add(DOL_URL_ROOT."/telephonie/contrat/", "Contrats"); - - $menu->add(DOL_URL_ROOT."/telephonie/ligne/index.php", "Lignes"); - - if ($user->rights->telephonie->ligne_commander) - $menu->add(DOL_URL_ROOT."/telephonie/ligne/commande/", "Commandes"); - - if ($user->rights->telephonie->stats->lire) - $menu->add(DOL_URL_ROOT."/telephonie/stats/", "Statistiques"); - - if ($user->rights->telephonie->facture->lire) - $menu->add(DOL_URL_ROOT."/telephonie/facture/", "Factures"); - - $menu->add(DOL_URL_ROOT."/telephonie/tarifs/", "Tarifs"); - - if ($user->rights->telephonie->fournisseur->lire) - $menu->add(DOL_URL_ROOT."/telephonie/fournisseur/", "Fournisseurs"); - - left_menu($menu->liste); -} - -?> diff --git a/htdocs/telephonie/client/remises.php b/htdocs/telephonie/client/remises.php deleted file mode 100644 index 39edce05975..00000000000 --- a/htdocs/telephonie/client/remises.php +++ /dev/null @@ -1,133 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; -$sortfield = $_GET["sortfield"]; - -llxHeader('','Telephonie - Clients - Remises à faire'); -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -if ($sortorder == "") { - $sortorder="ASC"; -} -if ($sortfield == "") { - $sortfield="s.nom"; -} - -if ($page == -1) { $page = 0 ; } - -$offset = $conf->liste_limit * $page ; -$pageprev = $page - 1; -$pagenext = $page + 1; - -/* - * Mode Liste - * - * - * - */ - -$sql = "SELECT s.rowid as socid, s.nom, r.amount"; -$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; -$sql .= ",".MAIN_DB_PREFIX."telephonie_client_remise as r"; -$sql .= ",".MAIN_DB_PREFIX."societe_perms as sp"; - -$sql .= " WHERE r.fk_client = s.rowid "; -$sql .= " AND r.fk_facture = 0"; -$sql .= " AND s.rowid = sp.fk_soc"; -$sql .= " AND sp.fk_user = ".$user->id." AND sp.pread = 1"; - -if ($_GET["search_client"]) -{ - $sel = urldecode($_GET["search_client"]); - $sql .= " AND s.nom LIKE '%".$sel."%'"; -} - -$sql .= " ORDER BY r.fk_facture ASC, $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); - -$result = $db->query($sql); -if ($result) -{ - $num = $db->num_rows(); - $i = 0; - - $urladd= "&statut=".$_GET["statut"]; - - print_barre_liste("Remises sur prochaines factures", $page, "remises.php", $urladd, $sortfield, $sortorder, '', $num); - - print ''; - print ''; - print_liste_field_titre("Client","remises.php","s.nom","","",' width="50%"'); - print ''; - print "\n"; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - $var=True; - - $ligne = new LigneTel($db); - - while ($i < min($num,$conf->liste_limit)) - { - $obj = $db->fetch_object($i); - $var=!$var; - - print "'; - - print '\n"; - - print "\n"; - $i++; - } - print "
Remise'; - print '
"; - - print ''; - print img_file(); - print ' '; - - print ''.$obj->nom.''.price($obj->amount)." euros HT
"; - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/client/remisesdone.php b/htdocs/telephonie/client/remisesdone.php deleted file mode 100644 index 3733125482f..00000000000 --- a/htdocs/telephonie/client/remisesdone.php +++ /dev/null @@ -1,136 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; -$sortfield = $_GET["sortfield"]; - -llxHeader('','Telephonie - Clients - Remises'); -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -if ($sortorder == "") { - $sortorder="DESC"; -} -if ($sortfield == "") { - $sortfield="r.fk_facture"; -} - -if ($page == -1) { $page = 0 ; } - -$offset = $conf->liste_limit * $page ; -$pageprev = $page - 1; -$pagenext = $page + 1; - -/* - * Mode Liste - * - * - * - */ - -$sql = "SELECT s.rowid as socid, s.nom, r.amount, f.facnumber, r.fk_facture"; -$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; -$sql .= ",".MAIN_DB_PREFIX."telephonie_client_remise as r"; -$sql .= ",".MAIN_DB_PREFIX."societe_perms as sp"; -$sql .= ",".MAIN_DB_PREFIX."facture as f"; - -$sql .= " WHERE r.fk_client = s.rowid "; -$sql .= " AND r.fk_facture > 0"; -$sql .= " AND r.fk_facture = f.rowid"; -$sql .= " AND s.rowid = sp.fk_soc"; -$sql .= " AND sp.fk_user = ".$user->id." AND sp.pread = 1"; - -if ($_GET["search_client"]) -{ - $sel = urldecode($_GET["search_client"]); - $sql .= " AND s.nom LIKE '%".$sel."%'"; -} - -$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); - -$result = $db->query($sql); -if ($result) -{ - $num = $db->num_rows(); - $i = 0; - - $urladd= "&statut=".$_GET["statut"]; - - print_barre_liste("Remises commerciales", $page, "remisesdone.php", $urladd, $sortfield, $sortorder, '', $num); - - print ''; - print ''; - print_liste_field_titre("Client","remisesdone.php","s.nom","","",' width="50%"'); - print ''; - print "\n"; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - $var=True; - - $ligne = new LigneTel($db); - - while ($i < min($num,$conf->liste_limit)) - { - $obj = $db->fetch_object($i); - $var=!$var; - - print "'; - - print '\n"; - print '\n"; - - print "\n"; - $i++; - } - print "
Remise'; - print 'Facture
 
"; - - print ''; - print img_file(); - print ' '; - - print ''.$obj->nom.''.price($obj->amount)." euros HT'.$obj->facnumber."
"; - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/client/stats.php b/htdocs/telephonie/client/stats.php deleted file mode 100644 index f46144457ee..00000000000 --- a/htdocs/telephonie/client/stats.php +++ /dev/null @@ -1,197 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require("./pre.inc.php"); - -$mesg = ''; - -llxHeader("","Téléphonie - Client"); - -if ($cancel == $langs->trans("Cancel")) -{ - $action = ''; -} -/* - * Affichage - * - */ - -if ($_GET["id"]) -{ - $soc = new Societe($db); - $result = $soc->fetch($_GET["id"], $user); - - if (!$soc->perm_read) - { - print "Lecture non authorisée"; - } - - if ( $result == 1 && $soc->perm_read) - { - if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit') - { - $h=0; - $head[$h][0] = DOL_URL_ROOT."/telephonie/client/fiche.php?id=".$soc->id; - $head[$h][1] = $langs->trans("Contrats"); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/client/lignes.php?id=".$soc->id; - $head[$h][1] = $langs->trans("Lignes"); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/client/factures.php?id=".$soc->id; - $head[$h][1] = $langs->trans("Factures"); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/client/stats.php?id=".$soc->id; - $head[$h][1] = $langs->trans("Stats"); - $hselected = $h; - $h++; - - $sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."telephonie_tarif_client"; - $sql .= " WHERE fk_client = '".$soc->id."';"; - $resql = $db->query($sql); - - if ($resql) - { - $row = $db->fetch_row($resql); - $db->free($resql); - } - - $head[$h][0] = DOL_URL_ROOT."/telephonie/client/tarifs.php?id=".$soc->id; - $head[$h][1] = $langs->trans("Tarifs (".$row[0].")"); - $h++; - - dol_fiche_head($head, $hselected, 'Client : '.$soc->nom); - - print ''; - print ''; - print ''; - - print ""; - - - print '
'.$langs->trans('Name').''.$soc->nom.''.$soc->code_client.'
".$langs->trans('Address')."".nl2br($soc->adresse)."
".$soc->cp." ".$soc->ville." ".$soc->pays."

'; - print ''; - - print ''; - print ''; - print '
'; - - $mesg_no_graph = 'Nous avons pas assez de données à ce jour pour générer ce graphique.'; - - $img_root = DOL_DATA_ROOT."/graph/".substr($soc->id,-1)."/telephonie/client/"; - - $file = $img_root.$soc->id."/graphca.png"; - - if (file_exists($file)) - { - print 'CA Mensuel'; - } - else - { - print $mesg_no_graph; - } - - print ''; - - $file = $img_root.$soc->id."/graphgain.png"; - if (file_exists($file) && $user->rights->telephonie->ligne->gain) - { - print 'CA Mensuel'; - } - else - { - print $mesg_no_graph; - } - - print '
'; - - $file = $img_root.$soc->id."/nb-minutes-mensuel.png"; - - if (file_exists($file)) - { - print 'CA Mensuel'; - } - else - { - print $mesg_no_graph; - } - - print ''; - - $file = $img_root.$soc->id."/nb-comm-mensuel.png"; - - if (file_exists($file)) - { - print 'CA Mensuel'; - } - else - { - print $mesg_no_graph; - } - print '
'; - - $file = $img_root.$soc->id."/graphappelsdureemoyenne.png"; - - if (file_exists($file)) - { - print 'Duree moyenne'; - } - else - { - print $mesg_no_graph; - } - - print ''; - - $file = $img_root.$soc->id."/nb-comm-menTOTOsuel.png"; - - if (file_exists($file)) - { - //print 'CA Mensuel'; - } - else - { - //print $mesg_no_graph; - } - print '
'; - } - } -} -else -{ - print "Error"; -} - -print ''; - -/* ************************************************************************** */ -/* */ -/* Barre d'action */ -/* */ -/* ************************************************************************** */ - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/client/tarifs.php b/htdocs/telephonie/client/tarifs.php deleted file mode 100644 index c3d302a97b2..00000000000 --- a/htdocs/telephonie/client/tarifs.php +++ /dev/null @@ -1,343 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require("./pre.inc.php"); - -$message_erreur = ''; - - -if ($_POST["action"] == 'addtarif' && $user->rights->telephonie->tarif->client_modifier) -{ - $error = 0; - $saisieok = 1; - - if (strlen(trim($_POST["temporel"])) == 0 OR strlen(trim($_POST["fixe"])) == 0) - { - $saisieok = 0; - } - else - { - $temporel = ereg_replace(",",".",trim($_POST["temporel"])); - $fixe = ereg_replace(",",".",trim($_POST["fixe"])); - } - - if(! is_numeric($temporel)) - { - $saisieok = 0; - } - - if(! is_numeric($fixe)) - { - $saisieok = 0; - } - - if ($temporel < 0 OR $fixe < 0) - { - $saisieok = 0; - } - - if ($saisieok) - { - - $db->begin(); - - $sql = "REPLACE INTO ".MAIN_DB_PREFIX."telephonie_tarif_client"; - $sql .= " (fk_tarif, fk_client, temporel, fixe, fk_user) VALUES "; - $sql .= " (".$_POST["tarifid"].",".$_GET["id"].",'".$temporel."','".$fixe."',".$user->id.")"; - - if (! $db->query($sql) ) - { - $error++; - } - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_tarif_client_log"; - $sql .= " (fk_tarif, fk_client, temporel, fixe, fk_user, datec) VALUES "; - $sql .= " (".$_POST["tarifid"].",".$_GET["id"].",'".$temporel."','".$fixe."',".$user->id.",now())"; - - if (! $db->query($sql) ) - { - $error++; - } - - if ( $error == 0 ) - { - $db->commit(); - Header("Location: tarifs.php?id=".$_GET["id"]); - } - else - { - $db->rollback(); - print $db->error(); - } - } - else - { - $message_erreur = " Saisie invalide"; - } -} - - -/* -if ($_GET["special"] == 'done') -{ - - $sql = "SELECT DISTINCT(fk_tarif), fixe, temporel FROM llx_telephonie_prefix as p, llx_telephonie_tarif_vente as v where p.prefix=v.prefix and fixe= 0.14; "; - - if ( $db->query( $sql) ) - { - $tt = array(); - - $num = $db->num_rows(); - if ( $num > 0 ) - { - $i = 0; - - while ($i < $num) - { - $row = $db->fetch_row(); - - $tt[$row[0]] = $row[2]; - - $i++; - } - } - - $db->free(); - - foreach($tt as $key=>$value) - { - $sql = "REPLACE INTO ".MAIN_DB_PREFIX."telephonie_tarif_client"; - $sql .= " (fk_tarif, fk_client, temporel, fixe, fk_user) VALUES "; - $sql .= " (".$key.",".$_GET["id"].",'".$value."','0.07',".$user->id.")"; - } - - } -} -*/ - -if ($_GET["action"] == 'delete' && $user->rights->telephonie->tarif->client_modifier) -{ - - if (strlen(trim($_GET["tid"])) > 0) - { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_tarif_client"; - $sql .= " WHERE rowid = ".$_GET["tid"]; - - if ( $db->query($sql) ) - { - Header("Location: tarifs.php?id=".$_GET["id"]); - } - else - { - print $db->error(); - } - } -} - -llxHeader("","T�l�phonie - Fiche Tarif client"); - -if ($cancel == $langs->trans("Cancel")) -{ - $action = ''; -} - -/* - * - * - */ - -if ($_GET["id"]) -{ - $soc = new Societe($db); - $result = $soc->fetch($_GET["id"], $user); - - if (!$soc->perm_read) - { - print "Lecture non authoris�e"; - } - - if ( $result == 1 && $soc->perm_read) - { - if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit') - { - $h=0; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/client/fiche.php?id=".$soc->id; - $head[$h][1] = $langs->trans("Contrats"); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/client/lignes.php?id=".$soc->id; - $head[$h][1] = $langs->trans("Lignes"); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/client/factures.php?id=".$soc->id; - $head[$h][1] = $langs->trans("Factures"); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/client/stats.php?id=".$soc->id; - $head[$h][1] = $langs->trans("Stats"); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/client/tarifs.php?id=".$soc->id; - $head[$h][1] = $langs->trans("Tarifs"); - $hselected = $h; - $h++; - - dol_fiche_head($head, $hselected, 'Client : '.$soc->nom); - - print ''; - print ''; - - print ""; - - print ''; - print ''; - - print "
'.$langs->trans('Name').''.$soc->nom.''.$langs->trans('Code client').''.$soc->code_client.'
".$langs->trans('Address')."".nl2br($soc->adresse)."
".$soc->cp." ".$soc->ville." ".$soc->pays."
'.$langs->trans('Phone').''.dol_print_phone($soc->tel,$soc->pays_code,0,$soc->id).''.$langs->trans('Fax').''.dol_print_phone($soc->fax,$soc->pays_code,0,$soc->id).'
\n
\n"; - - print '
'; - print ''; - print ''; - - print ''; - - print ''; - if ($user->rights->telephonie->tarif->client_modifier) - { - print ''; - } - print ''; - print "\n"; - - if($message_erreur) - { - print ''; - } - - if ($user->rights->telephonie->tarif->client_modifier) - { - print "\n"; - - print ''; - print ''; - print ''; - print "\n"; - } - - /* Tarifs */ - - $sql = "SELECT t.rowid , t.libelle, tc.temporel, tc.fixe, u.login, tc.rowid"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_tarif as t"; - $sql .= "," . MAIN_DB_PREFIX."telephonie_tarif_client as tc"; - $sql .= "," . MAIN_DB_PREFIX."societe as s"; - $sql .= "," . MAIN_DB_PREFIX."user as u"; - - $sql .= " WHERE t.rowid = tc.fk_tarif AND tc.fk_client = s.rowid"; - $sql .= " AND u.rowid = tc.fk_user"; - $sql .= " AND s.rowid = ".$soc->id; - $sql .= " ORDER BY t.libelle ASC"; - - if ( $db->query( $sql) ) - { - $num = $db->num_rows(); - if ( $num > 0 ) - { - $i = 0; - - $ligne = new LigneTel($db); - - while ($i < $num) - { - $obj = $db->fetch_object($i); - $var=!$var; - - print "\n"; - - print '\n"; - print '\n"; - - if ($user->rights->telephonie->tarif->client_modifier) - { - print '\n"; - } - print '\n"; - print ''; - - $i++; - } - } - $db->free(); - - } - else - { - print $sql; - } - - print "
Tarif (co�t en euros par minutes)'; - print 'TemporelFixe  
'.$message_erreur.'
\n"; - print ' 
\n"; - - print $obj->libelle."'.$obj->temporel."'.$obj->fixe."'; - print img_delete()."'.$obj->login."
\n
\n"; - } - } -} -else -{ - print "Error"; -} - - -print ''; - -/* ************************************************************************** */ -/* */ -/* Barre d'action */ -/* */ -/* ************************************************************************** */ - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/communication.class.php b/htdocs/telephonie/communication.class.php deleted file mode 100644 index a698fec49e9..00000000000 --- a/htdocs/telephonie/communication.class.php +++ /dev/null @@ -1,250 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -class CommunicationTelephonique { - - var $index; - var $ligne; - var $date; - var $duree; - var $dest; - var $numero; - var $montant; - var $messages; - /** - * Constructeur - * - */ - function CommunicationTelephonique() - { - $this->messages = array(); - return 1; - } - - /** - * Calcul le cout de la communication - * - */ - function cout($tarif_achat, $tarif_vente, $ligne, $_db) - { - $error = 0; - /* - if (substr($this->numero,0,2) == '00') - { - $nbinter++; - $duree_international += $objp->duree; - - $num = $this->numero; - - $this->remise = 0; - } - elseif (substr($this->numero,0,2) == '06') - { - $dureemob += $objp->duree; - $nbmob++; - - $num = "0033".substr($this->numero,1); - - $this->remise = $ligne->remise; - } - */ - /* Tarif Local */ - /* - elseif (substr($this->numero,0,4) == substr($objp->client,0,4) ) - { - $dureenat += $objp->duree; - $nbnat++; - $num = "0033999".substr($this->numero, 1); - $this->remise = $ligne->remise; - }*/ - //else - //{ - $dureenat += $objp->duree; - $nbnat++; - - $num = "00".$this->numero; - - $this->remise = $ligne->remise; - //} - - /* - * - * - */ - /* Numeros speciaux */ - /* - if (substr($num,4,1) == 8) - { - $this->remise = 0; - $this->cout_temp_vente = 0; - $this->tarif_libelle_vente = "Numeros speciaux"; - $this->cout_fixe_vente = ereg_replace(",",".", $this->montant); - } - else - { - */ - /* Fin Numeros speciaux */ - if ($tarif_achat->cout($num, $this->cout_temp_achat, $this->cout_fixe_achat, $tarif_libelle_achat) == 0) - { - dol_syslog("CommunicationTelephonique::Cout Tarif achat manquant pour $num"); - array_push($this->messages, array('warning',"Tarif achat manquant pour le numero $this->numero")); - //$error++; - } - - if ($tarif_vente->cout($num, $this->cout_temp_vente, $this->cout_fixe_vente, $this->tarif_libelle_vente) == 0) - { - dol_syslog("CommunicationTelephonique::Cout Tarif vente manquant pour $num"); - array_push($this->messages, array('error',"Tarif vente manquant pour le numero $this->numero")); - $error++; - } - //} - /* Specification VoIP */ - if ($ligne->techno == 'voip') - { - if (substr($num,4,1) < 6) - { - $lignedest = new LigneTel($_db); - - if ($lignedest->fetch("0".substr($num, -9)) == 1) - { - if ($lignedest->techno == 'voip' && ($ligne->client_comm_id == $lignedest->client_comm_id)) - { - $this->remise = 0; - $this->cout_fixe_vente = 0; - $this->cout_temp_vente = 0; - $this->tarif_libelle_vente = "Appel Interne VoIP"; - } - } - } - } - /* Fin VoIP */ - - $this->cout_achat = ( ($this->duree * $this->cout_temp_achat / 60) + $this->cout_fixe_achat); - - if ($ligne->facturable == 1) - { - $this->cout_vente = ( ($this->duree * $this->cout_temp_vente / 60)); - - $this->cout_vente = ( $this->cout_vente * ( 1 - ($this->remise / 100))); - /* Ajouté round le 2/12/05 */ - $this->cout_vente = round(($this->cout_vente + $this->cout_fixe_vente), 3); - } - else - { - $this->cout_vente = 0; - } - - return $error; - } - - /* - * Enregistre la ligne de communications dans - * llx_telephonie_communications_details - * - */ - - function logsql($db) - { - - $this->cout_achat = ereg_replace(",",".", $this->cout_achat); - $this->cout_vente = ereg_replace(",",".", $this->cout_vente); - $this->remise = ereg_replace(",",".", $this->remise); - $this->montant = ereg_replace(",",".", $this->montant); - - $this->dateheure = mktime(substr($this->heure, 0,2), - substr($this->heure, 3,2), - substr($this->heure, 6,2), - substr($this->date, 3,2), - substr($this->date, 0,2), - substr($this->date, 6,4)); - - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_communications_details"; - $sql .= " (fk_ligne,ligne, date, numero, duree"; - $sql .= ", tarif_achat_temp, tarif_achat_fixe, tarif_vente_temp, tarif_vente_fixe"; - $sql .= ", cout_achat, cout_vente, remise,dest, fourn_montant"; - $sql .= " , fichier_cdr, fk_fournisseur, fk_telephonie_facture,ym)"; - - $sql .= " VALUES ("; - $sql .= $this->fk_ligne.","; - $sql .= "'$this->ligne','".$db->idate($this->dateheure)."','$this->numero','$this->duree'"; - - $sql .= ", '$this->cout_temp_achat','$this->cout_fixe_achat','$this->cout_temp_vente','$this->cout_fixe_vente'"; - $sql .= ", '$this->cout_achat','$this->cout_vente', '$this->remise'"; - $sql .= ",'".addslashes($this->tarif_libelle_vente)."','$this->montant'"; - $sql .= ",'".$this->fichier_cdr."','".$this->fournisseur."'"; - $sql .= ",'".$this->facture_id."','".strftime("%y%m",$this->dateheure)."')"; - - if (! $db->query($sql)) - { - dol_syslog("CommunicationTelephonique::logsql Erreur"); - dol_syslog("CommunicationTelephonique::logsql ".$db->error()); - return 1; - } - else - { - return 0; - } - } - - /* - * - */ - - function _log( $text) - { - if ($this->file_details) - { - fputs($this->file_details, $text); - } - } - - /* - * - */ - - function loghtml($file) - { - $this->file_details = $file; - - $this->_log( ''); - $this->_log( "$this->index"); - $this->_log( "$this->ligne"); - $this->_log( "".$this->dest); - $this->_log( "".$this->duree); - $this->_log( "".$this->montant); - $this->_log( "".$cout_calcul); - - if (round($cout_calcul,3) <> $objp->montant) - { - _log($file_details, "".round($cout_calcul,3)); - $err++; - } - else - { - _log($file_details, "".round($cout_calcul,3)); - } - _log($file_details, "$err"); - - } -} -?> diff --git a/htdocs/telephonie/config/compta.php b/htdocs/telephonie/config/compta.php deleted file mode 100644 index 9faa111dae6..00000000000 --- a/htdocs/telephonie/config/compta.php +++ /dev/null @@ -1,104 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - */ - -/** - \file htdocs/telephonie/config/index.php - \ingroup telephonie - \brief Page configuration telephonie - \version $Revision$ -*/ - -require("./pre.inc.php"); -require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php"); - -$langs->load("admin"); - -if (!$user->admin) accessforbidden(); - -if ($_GET["action"] == "set") -{ - - dolibarr_set_const($db, 'TELEPHONIE_COMPTE_VENTILATION', $_POST["cg"],'chaine',0,'',$conf->entity); - - - Header("Location: compta.php"); -} - -/* - * - * - * - */ -llxHeader('','Telephonie - Configuration'); -print_titre("Configuration du module de Telephonie"); - -print "
"; - -/* - * - * - */ -print_titre("Emails"); -print '
'; -print ''; -print ''; -print ''; -print ''; -print ''; -print "\n"; - -print ''; - -$sql = "SELECT rowid, numero, intitule"; -$sql .= " FROM ".MAIN_DB_PREFIX."compta_compte_generaux"; -$sql .= " ORDER BY numero ASC"; - -$result = $db->query($sql); -if ($result) -{ - $num = $db->num_rows($result); - $i = 0; - - while ($i < $num) - { - $row = $db->fetch_row($result); - $cgs[$row[0]] = '['.$row[0].'] '.$row[1] . ' ' . $row[2]; - $i++; - } -} - -$html = new Form($db); -print ''; - -print '
NomValeur  
'; -print 'Compte de ventilation'; -print TELEPHONIE_COMPTE_VENTILATION; -print 'TELEPHONIE_EMAIL_FACTURATION_EMAIL
Compte'; - -print $html->select_array("cg",$cgs); - -print '
'; -print '
'; - -$db->close(); - -llxFooter(); -?> diff --git a/htdocs/telephonie/config/concurrents/index.php b/htdocs/telephonie/config/concurrents/index.php deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/telephonie/config/concurrents/liste.php b/htdocs/telephonie/config/concurrents/liste.php deleted file mode 100644 index dacb79dce11..00000000000 --- a/htdocs/telephonie/config/concurrents/liste.php +++ /dev/null @@ -1,135 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; -$sortfield = $_GET["sortfield"]; - -llxHeader('','Telephonie - Ligne - Liste'); -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -if ($sortorder == "") { - $sortorder="ASC"; -} -if ($sortfield == "") { - $sortfield="c.nom"; -} - -/* - * Recherche - * - * - */ - -if ($page == -1) { $page = 0 ; } - -$offset = $conf->liste_limit * $page ; -$pageprev = $page - 1; -$pagenext = $page + 1; - -/* - * Mode Liste - * - * - * - */ - -$sql = "SELECT c.rowid, c.nom"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_concurrents as c"; -$sql .= " WHERE active = 1"; - -if ($_GET["search_ligne"]) -{ - $sel =urldecode($_GET["search_ligne"]); - $sel = ereg_replace("\.","",$sel); - $sel = ereg_replace(" ","",$sel); - $sql .= " AND l.ligne LIKE '%".$sel."%'"; -} - -if ($_GET["search_client"]) -{ - $sel =urldecode($_GET["search_client"]); - $sql .= " AND s.nom LIKE '%".$sel."%'"; -} - -if (strlen($_GET["statut"])) -{ - $sql .= " AND l.statut = ".$_GET["statut"]; -} - -$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); - -$result = $db->query($sql); -if ($result) -{ - $num = $db->num_rows(); - $i = 0; - - $urladd= "&statut=".$_GET["statut"]; - - print_barre_liste("Concurrents", $page, "liste.php", $urladd, $sortfield, $sortorder, '', $num); - - print ''; - print ''; - - - print "\n"; - - - $var=True; - - $ligne = new LigneTel($db); - - while ($i < min($num,$conf->liste_limit)) - { - $obj = $db->fetch_object($i); - $var=!$var; - - print "\n"; - - - print "\n"; - $i++; - } - print "
Nom
"; - - print $obj->nom."
"; - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/config/concurrents/pre.inc.php b/htdocs/telephonie/config/concurrents/pre.inc.php deleted file mode 100644 index 8041008c9c4..00000000000 --- a/htdocs/telephonie/config/concurrents/pre.inc.php +++ /dev/null @@ -1,65 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("../../../main.inc.php"); -require(DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); -$user->getrights('telephonie'); - -function llxHeader($head = "", $title="") { - global $user, $conf; - - /* - * - * - */ - top_menu($head, $title); - - $menu = new Menu(); - - $menu->add(DOL_URL_ROOT."/telephonie/index.php", "Telephonie"); - - $menu->add(DOL_URL_ROOT."/telephonie/simulation/fiche.php", "Simulation"); - - $menu->add(DOL_URL_ROOT."/telephonie/tarifs/liste.php", "Tarifs"); - - $menu->add(DOL_URL_ROOT."/telephonie/ligne/index.php", "Lignes"); - - $menu->add(DOL_URL_ROOT."/telephonie/ligne/commande/", "Commande"); - - $menu->add(DOL_URL_ROOT."/telephonie/facture/liste.php", "Factures"); - - $menu->add(DOL_URL_ROOT."/telephonie/fournisseurs.php", "Fournisseurs"); - - $menu->add(DOL_URL_ROOT."/telephonie/config/", "Configuration"); - - $menu->add_submenu(DOL_URL_ROOT."/telephonie/config/compta.php", "Compta"); - - $menu->add_submenu(DOL_URL_ROOT."/telephonie/config/mail.php", "Mails"); - - $menu->add_submenu(DOL_URL_ROOT."/telephonie/config/concurrents/liste.php", "Concurrents"); - - if ($user->rights->telephonie->adsl->lire && TELEPHONIE_MODULE_ADSL == 1) - $menu->add_submenu(DOL_URL_ROOT."/telephonie/config/xdsl.php", "Liens xDSL"); - - left_menu($menu->liste); -} - -?> diff --git a/htdocs/telephonie/config/index.php b/htdocs/telephonie/config/index.php deleted file mode 100644 index cca6164e0d8..00000000000 --- a/htdocs/telephonie/config/index.php +++ /dev/null @@ -1,239 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - */ - -/** - \file htdocs/telephonie/config/index.php - \ingroup telephonie - \brief Page configuration telephonie - \version $Revision$ -*/ - -require("./pre.inc.php"); -require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php"); - -$langs->load("admin"); - -if (!$user->admin) accessforbidden(); - -if ($_GET["action"] == "set") -{ - for ($i = 1 ; $i < 5 ; $i++) - { - dolibarr_set_const($db, $_POST["nom$i"], $_POST["value$i"],'chaine',0,'',$conf->entity); - } - - Header("Location: index.php"); -} - -if ($_GET["action"] == "switch") -{ - dolibarr_set_const($db, $_GET["name"], $_GET["value"],'chaine',0,'',$conf->entity); - - Header("Location: index.php"); -} - -/* - * - * - * - */ -llxHeader('','Telephonie - Configuration'); -print_titre("Configuration du module de Telephonie"); - -print "
"; - -/* - * - * - */ -print_titre("Emails"); -print '
'; -print ''; -print ''; -print ''; -print ''; -print ''; -print "\n"; - - -print ''; - -print ''; - -print ''; - - -print ''; - -$form = new Form($db); - -/* ***************************************** */ - -print ''; -print ''; -print ''; - -/* ***************************************** */ - - -print ''; -print ''; - -print ''; - -$gg = array(); -$gg[0] = "Aucune grille definie"; -$sql = "SELECT d.rowid,d.libelle"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_tarif_grille as d"; -$sql .= " WHERE d.type_tarif='vente'"; -$sql .= " ORDER BY d.libelle"; - -$resql = $db->query($sql); -if ($resql) -{ - while ($row = $db->fetch_row($resql)) - { - $gg[$row[0]] = $row[1]; - } - $db->free($resql); -} - - -print ''; -print ''; -print ''; - - -print ''; -print ''; -print ''; -print "\n"; - -print ''; -print ''; - - -print ''; -print ''; - - -print ''; -print ''; - -/* ***************************************** */ - -print ''; -print ''; - - -print '
NomValeur Constante
'; -print 'Marge minimale'; -print ''; -print '%'; - -print 'TELEPHONIE_MARGE_MINI
'; -print 'Compte de ventilation'; -print TELEPHONIE_COMPTE_VENTILATION; -print '-TELEPHONIE_COMPTE_VENTILATION
'; -print 'Email facturation FROM'; -print TELEPHONIE_EMAIL_FACTURATION_EMAIL; -print '-TELEPHONIE_EMAIL_FACTURATION_EMAIL
'; -print 'Email facturation BCC'; -print TELEPHONIE_LIGNE_COMMANDE_EMAIL_BCC; -print '-TELEPHONIE_LIGNE_COMMANDE_EMAIL_BCC
Groupes des commerciaux'; - -$ff = array(); -$ff[0] = "Aucun groupe defini"; -$sql = "SELECT rowid, nom FROM ".MAIN_DB_PREFIX."usergroup ORDER BY nom ASC;"; -$resql = $db->query($sql); -if ($resql) -{ - while ($row = $db->fetch_row($resql)) - { - $ff[$row[0]] = $row[1]; - } - $db->free($resql); -} -$form->select_array("value4",$ff,TELEPHONIE_GROUPE_COMMERCIAUX_ID); - -print ''; -print 'TELEPHONIE_GROUPE_COMMERCIAUX_ID
Fournisseur par d�faut'; -$ff = array(); -$sql = "SELECT rowid, nom FROM ".MAIN_DB_PREFIX."telephonie_fournisseur WHERE commande_active = 1 ORDER BY nom "; -$resql = $db->query($sql); -if ($resql) -{ - while ($row = $db->fetch_row($resql)) - { - $ff[$row[0]] = $row[1]; - } - $db->free($resql); -} -$form->select_array("value2",$ff,TELEPHONIE_FOURNISSEUR_DEFAUT_ID); - -print ''; -print 'TELEPHONIE_FOURNISSEUR_DEFAUT_ID
Grille vente par d�faut'; - -$form->select_array("value3",$gg,TELEPHONIE_GRILLE_VENTE_DEFAUT_ID); - -print 'TELEPHONIE_GRILLE_VENTE_DEFAUT_ID
NomValeur Constante
Module ADSL'; -if (TELEPHONIE_MODULE_ADSL == 1) -{ - print 'ouiChanger'; -} -else -{ - print 'nonChanger'; -} -print 'TELEPHONIE_MODULE_ADSL
Module SIMULATION'; -if (TELEPHONIE_MODULE_SIMULATION == 1) -{ - print 'ouiChanger'; -} -else -{ - print 'nonChanger'; -} -print 'TELEPHONIE_MODULE_SIMULATION
Module GROUPES'; -if (TELEPHONIE_MODULE_GROUPES == 1) -{ - print 'ouiChanger'; -} -else -{ - print 'nonChanger'; -} -print 'TELEPHONIE_MODULE_GROUPES
Module NUMDATA'; -if (TELEPHONIE_MODULE_NUMDATA == 1) -{ - print 'ouiChanger'; -} -else -{ - print 'nonChanger'; -} -print 'TELEPHONIE_MODULE_NUMDATA
'; -print '
'; - -$db->close(); - -llxFooter(); -?> diff --git a/htdocs/telephonie/config/mail.php b/htdocs/telephonie/config/mail.php deleted file mode 100644 index 7dd1dc3e63b..00000000000 --- a/htdocs/telephonie/config/mail.php +++ /dev/null @@ -1,96 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - */ - -/** - \file htdocs/telephonie/config/index.php - \ingroup telephonie - \brief Page configuration telephonie - \version $Revision$ -*/ - -require("./pre.inc.php"); -require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php"); - -$langs->load("admin"); - -if (!$user->admin) accessforbidden(); - -if ($_GET["action"] == "set") -{ - - dolibarr_set_const($db, 'TELEPHONIE_MAIL_FACTURATION_SUJET', $_POST["sujet"],'chaine',0,'',$conf->entity); - - dolibarr_set_const($db, 'TELEPHONIE_MAIL_FACTURATION_SIGNATURE', $_POST["signature"],'chaine',0,'',$conf->entity); - - Header("Location: mail.php"); -} - -/* - * - * - * - */ -llxHeader('','Telephonie - Configuration'); -print_titre("Configuration du module de Telephonie"); - -print "
"; - -/* - * - * - */ -print_titre("Emails"); -print '
'; -print ''; -print ''; -print ''; -print ''; -print ''; -print "\n"; - -print ''; -print ''; - -$html = new Form($db); - -print ''; - -print ''; - -print ''; - -print '
NomValeur  
'; -print 'Compte de ventilation'; -print TELEPHONIE_MAIL_FACTURATION_SUJET; -print 'TELEPHONIE_MAIL_FACTURATION_SUJET
'; -print 'Compte de ventilation'; -print nl2br(TELEPHONIE_MAIL_FACTURATION_SIGNATURE); -print 'TELEPHONIE_MAIL_FACTURATION_SIGNATURE
Sujet'; - -print '
Signature'; - -print '
'; -print '
'; - -$db->close(); - -llxFooter(); -?> diff --git a/htdocs/telephonie/config/perms.php b/htdocs/telephonie/config/perms.php deleted file mode 100644 index f8ae4ff20e0..00000000000 --- a/htdocs/telephonie/config/perms.php +++ /dev/null @@ -1,119 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - */ - -/** - \file htdocs/telephonie/config/xdsl.php - \ingroup telephonie - \brief Page configuration telephonie - \version $Revision$ -*/ - -require("./pre.inc.php"); -require_once(DOL_DOCUMENT_ROOT.'/fourn/fournisseur.class.php'); -require_once(DOL_DOCUMENT_ROOT.'/telephonie/adsl/fournisseurxdsl.class.php'); - -$langs->load("admin"); -$langs->load("suppliers"); -$langs->load("products"); - -if (!$user->admin) accessforbidden(); - -if ($_GET["action"] == "all") -{ - - $sql_d = "DELETE FROM ".MAIN_DB_PREFIX."societe_perms;"; - - if ($resql_d = $db->query( $sql_d) ) - { - $socs = array(); - - $sql_s = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe;"; - - if ( $resql_s = $db->query( $sql_s) ) - { - while ($row_s = $db->fetch_row($resql_s)) - { - array_push($socs, $row_s[0]); - } - $db->free($resql); - } - - $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."user;"; - - if ( $resql = $db->query( $sql) ) - { - while ($row = $db->fetch_row($resql)) - { - - foreach ($socs as $soc) - { - $sql_i = "INSERT INTO ".MAIN_DB_PREFIX."societe_perms "; - $sql_i.= " (fk_soc,fk_user,pread,pwrite,pperms) "; - $sql_i.= " VALUES ($soc,$row[0],1,1,1) "; - - $resql_i = $db->query( $sql_i ); - } - - } - $db->free($resql); - } - } - - Header("Location: perms.php"); -} - -/* - * - * - * - */ -llxHeader('','Téléphonie - Configuration - Permissions'); - -$h=0; -$head[$h][0] = DOL_URL_ROOT."/telephonie/config/perms.php"; -$head[$h][1] = $langs->trans("Specials"); -$hselected = $h; -$h++; - -dol_fiche_head($head, $hselected, "Definitions des permissions"); - -print_titre("Actions speciales"); - -print ''; - -print ''; -print ''; -print ''; -print "\n"; - - -$var=!$var; -print ""; -print ''; - -print '
Actions-
Toutes les permissions a tout le mondeAppliquer'; -print '
'; -print ''; - -$db->close(); - -llxFooter(); -?> diff --git a/htdocs/telephonie/config/pre.inc.php b/htdocs/telephonie/config/pre.inc.php deleted file mode 100644 index a1be75bc267..00000000000 --- a/htdocs/telephonie/config/pre.inc.php +++ /dev/null @@ -1,71 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("../../main.inc.php"); -require(DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); -$user->getrights('telephonie'); - -function llxHeader($head = "", $title="") { - global $user, $conf; - - /* - * - * - */ - top_menu($head, $title); - - $menu = new Menu(); - - if ($user->rights->telephonie->adsl->lire && TELEPHONIE_MODULE_ADSL == 1) - $menu->add(DOL_URL_ROOT."/telephonie/adsl/", "Liens xDSL"); - - $menu->add(DOL_URL_ROOT."/telephonie/index.php", "Telephonie"); - - if (TELEPHONIE_MODULE_SIMULATION == 1) - $menu->add(DOL_URL_ROOT."/telephonie/simulation/fiche.php", "Simulation"); - - $menu->add(DOL_URL_ROOT."/telephonie/tarifs/", "Tarifs"); - - $menu->add(DOL_URL_ROOT."/telephonie/ligne/index.php", "Lignes"); - - $menu->add(DOL_URL_ROOT."/telephonie/ligne/commande/", "Commande"); - - $menu->add(DOL_URL_ROOT."/telephonie/facture/liste.php", "Factures"); - - $menu->add(DOL_URL_ROOT."/telephonie/fournisseur/", "Fournisseurs"); - - $menu->add(DOL_URL_ROOT."/telephonie/config/", "Configuration"); - - $menu->add_submenu(DOL_URL_ROOT."/telephonie/config/compta.php", "Compta"); - - $menu->add_submenu(DOL_URL_ROOT."/telephonie/config/mail.php", "Mails"); - - $menu->add_submenu(DOL_URL_ROOT."/telephonie/config/concurrents/liste.php", "Concurrents"); - - $menu->add_submenu(DOL_URL_ROOT."/telephonie/config/perms.php", "Permissions"); - - if ($user->rights->telephonie->adsl->lire && TELEPHONIE_MODULE_ADSL == 1) - $menu->add_submenu(DOL_URL_ROOT."/telephonie/config/xdsl.php", "Liens xDSL"); - - left_menu($menu->liste); -} - -?> diff --git a/htdocs/telephonie/config/xdsl.php b/htdocs/telephonie/config/xdsl.php deleted file mode 100644 index baacc781d74..00000000000 --- a/htdocs/telephonie/config/xdsl.php +++ /dev/null @@ -1,123 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - */ - -/** - \file htdocs/telephonie/config/xdsl.php - \ingroup telephonie - \brief Page configuration telephonie - \version $Revision$ -*/ - -require("./pre.inc.php"); -require_once(DOL_DOCUMENT_ROOT.'/fourn/fournisseur.class.php'); -require_once(DOL_DOCUMENT_ROOT.'/telephonie/adsl/fournisseurxdsl.class.php'); - -$langs->load("admin"); -$langs->load("suppliers"); -$langs->load("products"); - -if (!$user->admin) accessforbidden(); - -if ($_GET["action"] == "addfourn") -{ - - $fourn = new FournisseurXdsl($db); - $fourn->socid = $_POST["fourn"]; - $fourn->create($user); - - Header("Location: xdsl.php"); -} - -if ($_GET["action"] == "switch") -{ - $fourn = new FournisseurXdsl($db); - $fourn->SwitchCommandeActive($_GET['id']); - - Header("Location: xdsl.php"); -} - -/* - * - * - * - */ -llxHeader('','Téléphonie - Configuration - Liens xDSL'); - -$h=0; -$head[$h][0] = DOL_URL_ROOT."/telephonie/config/xdsl.php"; -$head[$h][1] = $langs->trans("Suppliers"); -$hselected = $h; -$h++; - -$head[$h][0] = DOL_URL_ROOT."/telephonie/config/xdsl_product.php"; -$head[$h][1] = $langs->trans("Products"); -$h++; - -$head[$h][0] = DOL_URL_ROOT."/telephonie/config/xdsl_wkf.php"; -$head[$h][1] = $langs->trans("Workflow"); -$h++; - - -dol_fiche_head($head, $hselected, "Configuration des liens xDSL"); - -print_titre("Fournisseurs"); -print '
'; -print ''; -print ''; - -$form = new Form($db); -$fourn = new Fournisseur($db,0,$user); -$fourns = $fourn->ListArray(); - -$xfourn = new FournisseurXdsl($db,0,$user); -$xfourns = $xfourn->ListArray(); - -/* ***************************************** */ - -print ''; -print ''; - -print ''; -print ''; -print ''; -print "\n"; - -foreach ($xfourns as $id => $name) -{ - $var=!$var; - print "'; - print ''; - print ''; -} - -print '
Ajouter un fournisseur'; - -$form->select_array("fourn",$fourns); - -print ''; -print '
NomCommande possible 
".$name['name'].''.$langs->trans($yesno[$name['commande_active']]).'Changer'; - print '
'; -print '
'; - -$db->close(); - -llxFooter(); -?> diff --git a/htdocs/telephonie/config/xdsl_product.php b/htdocs/telephonie/config/xdsl_product.php deleted file mode 100644 index ecd81fb4534..00000000000 --- a/htdocs/telephonie/config/xdsl_product.php +++ /dev/null @@ -1,136 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - */ - -/** - \file htdocs/telephonie/config/xdsl.php - \ingroup telephonie - \brief Page configuration telephonie - \version $Revision$ -*/ - -require("./pre.inc.php"); -require_once(DOL_DOCUMENT_ROOT.'/fourn/fournisseur.class.php'); -require_once(DOL_DOCUMENT_ROOT.'/telephonie/adsl/productxdsl.class.php'); - -$langs->load("admin"); -$langs->load("suppliers"); -$langs->load("products"); - -if (!$user->admin) accessforbidden(); - -if ($_GET["action"] == "addproduct") -{ - $fourn = new ProductXdsl($db); - $fourn->prodid = $_POST["prod"]; - $fourn->intitule = $_POST["intitule"]; - $fourn->create($user); - - Header("Location: xdsl_product.php"); -} - -if ($_GET["action"] == "switch") -{ - $fourn = new ProductXdsl($db); - $fourn->SwitchCommandeActive($_GET['id']); - - Header("Location: xdsl_product.php"); -} - -/* - * - * - * - */ -llxHeader('','Téléphonie - Configuration - Liens xDSL'); - -$h=0; -$head[$h][0] = DOL_URL_ROOT."/telephonie/config/xdsl.php"; -$head[$h][1] = $langs->trans("Suppliers"); -$h++; - -$head[$h][0] = DOL_URL_ROOT."/telephonie/config/xdsl_product.php"; -$head[$h][1] = $langs->trans("Products"); -$hselected = $h; -$h++; - -$head[$h][0] = DOL_URL_ROOT."/telephonie/config/xdsl_wkf.php"; -$head[$h][1] = $langs->trans("Workflow"); -$h++; - - -dol_fiche_head($head, $hselected, "Configuration des liens xDSL"); -$form = new Form($db); -print_titre($langs->trans("Products")); -print '
'; -print ''; -print ''; - -$prods = array(); - -$sql = "SELECT rowid, label"; -$sql.= " FROM ".MAIN_DB_PREFIX."product as p"; -$sql.= " WHERE p.fk_product_type = 1"; - -$resql=$db->query($sql); -if ($resql) -{ - while ($obj=$db->fetch_object($resql)) - { - $prods[$obj->rowid]=stripslashes($obj->label); - } -} -$db->free($resql); - - -$xfourn = new ProductXdsl($db,0,$user); -$xfourns = $xfourn->ListArray(); - -/* ***************************************** */ - -print ''; -print ''; - -print ''; -print ''; -print ''; -print "\n"; - -foreach ($xfourns as $id => $name) -{ - $var=!$var; - print "'; - print ''; - print ''; -} - -print '
Ajouter un liens depuis les services'; -print ''; -$form->select_array("prod",$prods); - -print ''; -print '
NomCommande possible  
".$name['intitule'].''.$langs->trans($yesno[$name['commande_active']]).'Changer'; - print ' 
'; -print '
'; - -$db->close(); - -llxFooter(); -?> diff --git a/htdocs/telephonie/config/xdsl_wkf.php b/htdocs/telephonie/config/xdsl_wkf.php deleted file mode 100644 index ab8d361ba50..00000000000 --- a/htdocs/telephonie/config/xdsl_wkf.php +++ /dev/null @@ -1,154 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - */ - -/** - \file htdocs/telephonie/config/xdsl.php - \ingroup telephonie - \brief Page configuration telephonie - \version $Revision$ -*/ - -require("./pre.inc.php"); -require_once(DOL_DOCUMENT_ROOT.'/fourn/fournisseur.class.php'); -require_once(DOL_DOCUMENT_ROOT.'/telephonie/adsl/ligneadsl.class.php'); -require_once(DOL_DOCUMENT_ROOT.'/telephonie/adsl/fournisseurxdsl.class.php'); -require_once(DOL_DOCUMENT_ROOT.'/telephonie/workflowtel.class.php'); - -$langs->load("admin"); -$langs->load("suppliers"); -$langs->load("products"); - -if (!$user->admin) accessforbidden(); - -$ligne = new LigneAdsl($db); - -if ($_GET["action"] == "add") -{ - $wkf = new WorkflowTelephonie($db); - $wkf->create("xdsl",$_POST["wkf_user"],$_POST["wkf_statut"]); - - Header("Location: xdsl_wkf.php"); -} - -if ($_GET["action"] == "delete") -{ - $wkf = new WorkflowTelephonie($db); - $wkf->delete("xdsl",$_GET["wkf_user"],$_GET["wkf_statut"]); - - Header("Location: xdsl_wkf.php"); -} - -/* - * - * - * - */ -llxHeader('','Téléphonie - Configuration - Liens xDSL - Workflow'); - -$h=0; -$head[$h][0] = DOL_URL_ROOT."/telephonie/config/xdsl.php"; -$head[$h][1] = $langs->trans("Suppliers"); -$h++; - -$head[$h][0] = DOL_URL_ROOT."/telephonie/config/xdsl_product.php"; -$head[$h][1] = $langs->trans("Products"); -$h++; - -$head[$h][0] = DOL_URL_ROOT."/telephonie/config/xdsl_wkf.php"; -$head[$h][1] = $langs->trans("Workflow"); -$hselected = $h; -$h++; - - -dol_fiche_head($head, $hselected, "Configuration des liens xDSL"); - -print_titre("Workflow"); -print '
'; -print ''; -print ''; - -$form = new Form($db); -$fourn = new Fournisseur($db,0,$user); -$fourns = $fourn->ListArray(); - -$xfourn = new FournisseurXdsl($db,0,$user); -$xfourns = $xfourn->ListArray(); - -$uss = array(); -$sql = "SELECT u.rowid, u.firstname, u.name"; -$sql .= " FROM ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."usergroup_user as ug"; -$sql .= " WHERE u.rowid = ug.fk_user"; -$sql .= " AND ug.fk_usergroup = '".TELEPHONIE_GROUPE_COMMERCIAUX_ID."'"; -$sql .= " ORDER BY name "; -if ( $resql = $db->query( $sql) ) -{ - while ($row = $db->fetch_row($resql)) - { - $uss[$row[0]] = $row[1] . " " . $row[2]; - } - $db->free($resql); -} - -/* ***************************************** */ - -print ''; -print ''; - -print ''; -print ''; -print ''; -print "\n"; - -$sql = "SELECT u.rowid, u.firstname, u.name, u.email, w.fk_statut"; -$sql .= " FROM ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."telephonie_workflow as w"; -$sql .= " WHERE u.rowid = w.fk_user AND w.module = 'xdsl'"; -$sql .= " ORDER BY u.name, u.firstname "; -if ( $resql = $db->query( $sql) ) -{ - while ($row = $db->fetch_row($resql)) - { - $var=!$var; - print ""; - print ''; - print ''; - print ''; - print ''; - } - $db->free($resql); -} - - -print '
Ajouter une alerte pour l\'utilisateur'; - -$form->select_array("wkf_user",$uss); -print ' sur l\'action '; -$form->select_array("wkf_statut",$ligne->statuts); - -print ''; -print '
UtilisateurEmailStatut notifie 
'.$row[1].' '.$row[2].''.$row[3].''.$ligne->statuts[$row[4]].''; - print img_delete(); - print '
'; -print '
'; - -$db->close(); - -llxFooter(); -?> diff --git a/htdocs/telephonie/contrat/fiche.php b/htdocs/telephonie/contrat/fiche.php deleted file mode 100644 index d002d03339d..00000000000 --- a/htdocs/telephonie/contrat/fiche.php +++ /dev/null @@ -1,1128 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require "./pre.inc.php"; -require_once DOL_DOCUMENT_ROOT."/telephonie/dolibarrmail.class.php"; - -$mesg = ''; - -if ($_POST["action"] == 'add' && $user->rights->telephonie->ligne->creer) -{ - $contrat = new TelephonieContrat($db); - - $contrat->client_comm = $_POST["client_comm"]; - $contrat->client = $_POST["client"]; - $contrat->client_facture = $_POST["client_facture"]; - $contrat->commercial_sign = $_POST["commercial_sign"]; - $contrat->note = $_POST["note"]; - - if ( $contrat->create($user) == 0) - { - $soc = new Societe($db); - $soc->id = $_POST["client_comm"]; - $soc->AddPerms($user->id,1,1,1); - $soc->AddPerms($_POST["commercial_sign"],1,1,1); - - Header("Location: fiche.php?id=".$contrat->id); - } - else - { - $_GET["action"] = 'create'; - } - -} - -if ($_POST["action"] == 'update' && $_POST["cancel"] <> $langs->trans("Cancel") && $user->rights->telephonie->ligne->creer) -{ - $contrat = new TelephonieContrat($db); - $contrat->id = $_GET["id"]; - - $contrat->client = $_POST["client"]; - $contrat->client_facture = $_POST["client_facture"]; - $contrat->fournisseur = $_POST["fournisseur"]; - $contrat->commercial = $_POST["commercial"]; - $contrat->concurrent = $_POST["concurrent"]; - $contrat->note = $_POST["note"]; - $contrat->mode_paiement = $_POST["mode_paiement"]; - $contrat->grille_tarif_id = $_POST["grille_tarif_id"]; - - $contrat->commercial_suiv_id = $_POST["commercial_suiv"]; - - if ( $contrat->update($user) == 0) - { - $action = ''; - $mesg = 'Fiche mise � jour'; - Header("Location: fiche.php?id=".$contrat->id); - } - else - { - $action = 're-edit'; - $mesg = 'Fiche non mise � jour !' . "
" . $entrepot->mesg_error; - } -} - -if ($_POST["action"] == 'addcontact' && $user->rights->telephonie->ligne->creer) -{ - $contrat = new TelephonieContrat($db); - $contrat->id = $_GET["id"]; - - if ( $contrat->add_contact_facture($_POST["contact_id"]) ) - { - Header("Location: fiche.php?id=".$contrat->id); - } -} - -if ($_POST["action"] == 'addpo' && $user->rights->telephonie->ligne->creer) -{ - $contrat = new TelephonieContrat($db); - $contrat->fetch($_GET["id"]); - - $contrat->addpo($_POST["montant"], $user); - Header("Location: fiche.php?id=".$contrat->id); -} - - -if ($_GET["action"] == 'delcontact' && $user->rights->telephonie->ligne->creer) -{ - $contrat = new TelephonieContrat($db); - $contrat->id = $_GET["id"]; - - if ( $contrat->del_contact_facture($_GET["contact_id"]) ) - { - Header("Location: fiche.php?id=".$contrat->id); - } -} - -if ($_GET["action"] == 'delete' && $user->rights->telephonie->ligne->creer) -{ - $contrat = new TelephonieContrat($db); - $contrat->id = $_GET["id"]; - - $contrat->delete() ; - Header("Location: index.php"); -} - - - -llxHeader("","","Fiche Contrat"); - -if ($cancel == $langs->trans("Cancel")) -{ - $action = ''; -} - -/* - * Cr�ation en 2 �tape - * - */ -if ($_GET["action"] == 'create' && $user->rights->telephonie->ligne->creer) -{ - $form = new Form($db); - print_titre("Nouveau contrat"); - - if (is_object($ligne)) - { - // La cr�ation a �chou�e - print $ligne->error_message; - } - else - { - $ligne = new LigneTel($db); - } - - print '
'; - print ''; - - print ''; - - print ''; - - print ''."\n"; - print '
Client'; - $ff = array(); - $sql = "SELECT rowid, nom, ville FROM ".MAIN_DB_PREFIX."societe WHERE client=1 AND (parent = 0 OR parent IS NULL) ORDER BY nom "; - if ( $db->query( $sql) ) - { - $num = $db->num_rows(); - if ( $num > 0 ) - { - $i = 0; - while ($i < $num) - { - $row = $db->fetch_row($i); - $ff[$row[0]] = $row[1] . " (".$row[2].")"; - - $i++; - } - } - $db->free(); - } - $form->select_array("client_comm",$ff,$ligne->client_comm); - print '
 
'."\n"; - print '
'; -} -elseif ($_GET["action"] == 'create_line' && $_GET["client_comm"] > 0 && $user->rights->telephonie->ligne->creer) -{ - $form = new Form($db); - print_titre("Nouveau contrat"); - - if (is_object($ligne)) - { - // La cr�ation a �chou�e - print $ligne->error_message; - } - else - { - $ligne = new LigneTel($db); - } - - $socc = new Societe($db); - $socc->fetch($_GET["client_comm"]); - - if ( $socc->id > 0) - { - - if (strlen($socc->code_client) == 0) - { - print ''; - print ''; - - print ''; - print '
Client'; - print ''.$socc->nom.''; - print '
Code client'; - print $socc->code_client; - print '


'; - print 'Impossible de cr�er un contrat pour cette societe, vous devez au prealablement lui affecter un code client.'; - } - elseif (strlen($socc->code_client) > 0 && $socc->check_codeclient() <> 0) - { - print ''; - print ''; - - print ''; - print '
Client'; - print ''.$socc->nom.''; - print '
Code client'; - print $socc->code_client; - print '


'; - print 'Le code client de cette societe est incorrect, vous devez lui affecter un code client correct.'; - } - else - { - print "
\n"; - print ''; - print ''; - print ''."\n"; - - print ''; - print ''; - - print ''; - - print ''; - - print ''; - - /* - * Commercial - */ - - print ''; - - print ''."\n"; - - print ''."\n"; - print '
Client'; - print $socc->nom; - print '
Code client'; - print $socc->code_client; - print '
Client (Agence/Filiale)'; - $ff = array(); - $sql = "SELECT rowid, nom, ville FROM ".MAIN_DB_PREFIX."societe"; - $sql .= " WHERE client=1"; - $sql .= " AND (rowid = ".$socc->id." OR parent = ".$socc->id.")"; - $sql .= " ORDER BY nom "; - - if ( $db->query( $sql) ) - { - $num = $db->num_rows(); - if ( $num > 0 ) - { - $i = 0; - while ($i < $num) - { - $row = $db->fetch_row(); - $ff[$row[0]] = $row[1] . " (".$row[2].")"; - $i++; - } - } - $db->free(); - } - else - { - print $sql; - } - $form->select_array("client",$ff,$ligne->client); - print '
Client � facturer'; - $ff = array(); - $sql = "SELECT rowid, nom, ville FROM ".MAIN_DB_PREFIX."societe WHERE client=1"; - $sql .= " AND (rowid = ".$socc->id." OR parent = ".$socc->id.")"; - $sql .= " ORDER BY nom "; - if ( $db->query( $sql) ) - { - $num = $db->num_rows(); - if ( $num > 0 ) - { - $i = 0; - while ($i < $num) - { - $row = $db->fetch_row(); - $ff[$row[0]] = $row[1] . " (".$row[2].")"; - $i++; - } - } - $db->free(); - } - $form->select_array("client_facture",$ff,$ligne->client_facture); - print '
Commercial Signature'; - $ff = array(); - $sql = "SELECT u.rowid, u.firstname, u.name"; - $sql .= " FROM ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."usergroup_user as ug"; - $sql .= " WHERE u.rowid = ug.fk_user"; - $sql .= " AND ug.fk_usergroup = '".TELEPHONIE_GROUPE_COMMERCIAUX_ID."'"; - $sql .= " ORDER BY name "; - if ( $db->query( $sql) ) - { - $num = $db->num_rows(); - if ( $num > 0 ) - { - $i = 0; - while ($i < $num) - { - $row = $db->fetch_row($i); - $ff[$row[0]] = $row[1] . " " . $row[2]; - $i++; - } - } - $db->free(); - - } - - $form->select_array("commercial_sign",$ff,$ligne->commercial); - - print '
Note'."\n"; - print '
 
'."\n"; - print '
'; - - /* - * Contrats existants - */ - $sql = "SELECT c.rowid, c.ref, s.rowid as socid, s.nom "; - $sql .= ", sf.rowid as sfidp, sf.nom as sfnom"; - $sql .= ", sa.rowid as saidp, sa.nom as sanom"; - $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; - $sql .= " , ".MAIN_DB_PREFIX."societe as sf"; - $sql .= " , ".MAIN_DB_PREFIX."societe as sa"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_contrat as c"; - $sql .= " WHERE c.fk_client_comm = s.rowid"; - $sql .= " AND c.fk_soc = sa.rowid"; - $sql .= " AND c.fk_soc_facture = sf.rowid"; - $sql .= " AND s.rowid = ".$_GET["client_comm"]; - - $result = $db->query($sql); - if ($result) - { - $num = $db->num_rows(); - $i = 0; - if ($num > 0) - { - print"
\n\n"; - print_titre("Contrats existants"); - print '
'; - print ''; - print ''; - print ''; - print "\n"; - - $var=True; - - while ($i < $num) - { - $obj = $db->fetch_object(); - $var=!$var; - - print "\n"; - - print ''; - - print ''; - print ''; - - print "\n"; - $i++; - } - print "
R�fClientClient (Agence/Filiale)Client factur�
"; - print ''; - print img_file(); - print ' '; - print ''.$obj->ref."'.stripslashes($obj->nom).''.stripslashes($obj->sanom).''.stripslashes($obj->sfnom).'
"; - } - - $db->free(); - } - else - { - print $db->error() . ' ' . $sql; - } - } - } - else - { - print "Erreur"; - } -} -else -{ - /* Consultation */ - if ($_GET["id"]) - { - if ($_GET["action"] <> 're-edit') - { - $contrat = new TelephonieContrat($db); - - if ($contrat->fetch($_GET["id"]) == 0) - { - $result = 1; - } - } - - if ($result == 1) - { - $client_comm = new TelephonieClient($db); - $client_comm->fetch($contrat->client_comm_id, $user); - } - - if (!$client_comm->perm_read) - { - print "Lecture non authoris�e"; - } - - if ( $result && $client_comm->perm_read) - { - - $contrat->log_consult($user,'r'); - - if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit') - { - - $h=0; - $head[$h][0] = DOL_URL_ROOT."/telephonie/contrat/fiche.php?id=".$contrat->id; - $head[$h][1] = $langs->trans("Contrat"); - $hselected = $h; - $h++; - - $nser = $contrat->count_associated_services(); - - $head[$h][0] = DOL_URL_ROOT."/telephonie/contrat/services.php?id=".$contrat->id; - if ($nser > 0) - { - $head[$h][1] = $langs->trans("Services")." (".$nser.")"; - } - else - { - $head[$h][1] = $langs->trans("Services"); - } - $h++; - - /* - * Mise en place de l'interface greffon - */ - if($conf->global->TELEPHONIE_CONTRAT_PLUGIN) - { - require_once DOL_DOCUMENT_ROOT.'/telephonie/contrat/modules/'.$conf->global->TELEPHONIE_CONTRAT_PLUGIN.'.php'; - $var = $conf->global->TELEPHONIE_CONTRAT_PLUGIN; - $plugin = new $var; - if($plugin->tabs($head,$h)) - $h++; - else - dol_syslog("$var::tabs error"); - } - - $head[$h][0] = DOL_URL_ROOT."/telephonie/contrat/stats.php?id=".$contrat->id; - $head[$h][1] = $langs->trans("Stats"); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/contrat/info.php?id=".$contrat->id; - $head[$h][1] = $langs->trans("Infos"); - $h++; - - $contrat->load_previous_next_id(); - $previous_ref = $contrat->ref_previous?''.img_previous().'':''; - $next_ref = $contrat->ref_next?''.img_next().'':''; - dol_fiche_head($head, $hselected, 'Contrat : '.$contrat->ref); - - //print_fiche_titre('Fiche Contrat', $mesg); - - print ''; - print '
Fiche Contrat'.$product->ref.''; - print ''.$previous_ref.''.$next_ref.'

'; - - print ''; - - //$client_comm = new Societe($db); - //$client_comm->fetch($contrat->client_comm_id); - - print ''; - print ''; - print ''; - - if ($contrat->client_id <> $contrat->client_comm_id) - { - $client = new Societe($db, $contrat->client_id); - $client->fetch($contrat->client_id); - - print ''; - } - - $client_facture = new Societe($db); - $client_facture->fetch($contrat->client_facture_id); - - print ''; - - $commercial = new User($db, $contrat->commercial_sign_id); - $commercial->fetch(); - - print ''; - print ''; - - print ''; - - $commercial_suiv = new User($db, $contrat->commercial_suiv_id); - $commercial_suiv->fetch(); - - print ''; - print ''; - - /* Prise d'ordre */ - print ''; - $po = $contrat->priseordre_totale(); - print ''; - - /* - print ''; - */ - - /* Contacts */ - print ''; - print ''; - /* Fin Contacts */ - - print "
R�f�rence'.$contrat->ref.'Factur� : '.$contrat->facturable.''; - print ' '; - print $contrat->statuts[$contrat->statut].'
Client'; - print ''; - - print $client_comm->nom.''.$client_comm->code_client; - print '
Client (Agence/Filiale)'; - print $client->nom.'
'; - print $client->cp . " " .$client->ville; - print '
'.$client->code_client; - print '
Client Factur�'; - print ''; - print $client_facture->nom.'
'; - print $client_facture->cp . " " .$client_facture->ville; - - print '
'.$client_facture->code_client; - print ''; - - - - if ($contrat->mode_paiement == 'pre') - { - print 'RIB : '.$client_facture->display_rib(); - } - else - { - print 'Paiement par virement'; - } - - print '
Commercial Signature'.$commercial->fullname.'Grille tarif'.$contrat->grille_tarif_nom.'
Commercial Suivi'.$commercial_suiv->fullname.'
Prise d\'ordre mensuelle'.$po.' euros HT
Statut'; - print ' '; - print $contrat->statuts[$contrat->statut]; - print '
Contact facture'; - - $sql = "SELECT c.rowid, c.name, c.firstname, c.email "; - $sql .= "FROM ".MAIN_DB_PREFIX."socpeople as c"; - $sql .= ",".MAIN_DB_PREFIX."telephonie_contrat_contact_facture as cf"; - $sql .= " WHERE c.rowid = cf.fk_contact AND cf.fk_contrat = ".$contrat->id." ORDER BY name "; - if ( $db->query( $sql) ) - { - $num = $db->num_rows(); - if ( $num > 0 ) - { - $i = 0; - while ($i < $num) - { - $row = $db->fetch_row($i); - - print $row[1] . " " . $row[2] . " <".$row[3].">
"; - $i++; - } - } - $db->free(); - - } - else - { - print $sql; - } - print '

"; - - /* Lignes */ - print ''; - - $sql = "SELECT l.ligne, l.statut, l.rowid, l.remise, l.techno, f.nom as fournisseur"; - $sql .= ", ss.code_client, ss.nom as agence, l.support"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; - $sql .= " , ".MAIN_DB_PREFIX."societe as ss"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_fournisseur as f"; - $sql .= " WHERE l.fk_fournisseur = f.rowid"; - $sql .= " AND l.fk_soc = ss.rowid "; - $sql .= " AND l.fk_contrat = ".$contrat->id; - $sql .= " ORDER BY l.statut ASC, l.ligne ASC"; - - if ( $db->query( $sql) ) - { - $numlignes = $db->num_rows(); - if ( $numlignes > 0 ) - { - $i = 0; - - $ligne = new LigneTel($db); - - print ''; - if ($user->rights->telephonie->fournisseur->lire) - print ''; - - print "\n"; - - while ($i < $numlignes) - { - $obj = $db->fetch_object($i); - $var=!$var; - - print "\n"; - - print '\n"; - print '\n"; - - print '\n"; - - if ($user->rights->telephonie->fournisseur->lire) - { - print "\n"; - } - print "\n"; - $i++; - } - } - $db->free(); - - } - else - { - print $db->error(); - print $sql; - } - - print "
Ligne'; - print 'Agence/FilialeStatutSupport'; - print 'Fournisseur
"; - - print ' '; - - print ''; - print img_file(); - - print ' '; - - print ''.dol_print_phone($obj->ligne,0,0,true)."'.$obj->code_client." ".$obj->agence."'.$ligne->statuts[$obj->statut]."'.$obj->support."".$obj->fournisseur." - \n"; - print $obj->techno."

"; - - /* Liens xDSL */ - - require_once DOL_DOCUMENT_ROOT.'/telephonie/adsl/ligneadsl.class.php'; - - $sql = "SELECT l.rowid, l.numero_ligne, l.statut, t.intitule"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_adsl_ligne as l"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_adsl_type as t"; - $sql .= " WHERE l.fk_contrat=".$contrat->id; - $sql .= " AND t.rowid = l.fk_type"; - $sql .= " ORDER BY l.statut ASC;"; - $resql = $db->query($sql); - if ( $resql ) - { - $numlignes = $db->num_rows($resql); - if ( $numlignes > 0 ) - { - $i = 0; - - $ligne = new LigneAdsl($db); - - print ''; - print ''; - print "\n"; - - while ($i < $numlignes) - { - $obj = $db->fetch_object($i); - $var=!$var; - - print "\n"; - - print '\n"; - print '\n"; - print "\n"; - $i++; - } - print "
Liens xDSL'; - print 'Numero supportStatut
"; - - print ' '; - - print ''; - print img_file(); - - print ' '; - - print ''.stripslashes($obj->intitule)."'.$obj->numero_ligne."'.$ligne->statuts[$obj->statut]."
"; - } - $db->free($resql); - - - - } - else - { - print $db->error(); - print $sql; - } - - - } - - /* - * Edition - * - * - * - */ - - if ($_GET["action"] == 'edit' || $action == 're-edit') - { - - $h=0; - $head[$h][0] = DOL_URL_ROOT."/telephonie/contrat/fiche.php?id=".$contrat->id; - $head[$h][1] = $langs->trans("Contrat"); - $hselected = $h; - $h++; - - dol_fiche_head($head, $hselected, 'Contrat : '.$contrat->ref); - - print_fiche_titre('Edition du contrat', $mesg); - - print '
'; - print ''; - print ''; - - print ''; - - print ''; - print ''; - - $client_comm = new Societe($db, $contrat->client_comm_id); - $client_comm->fetch($contrat->client_comm_id); - - print ''; - - - print ''; - - print ''; - - /* - * - */ - print ''; - print ''; - - - /* - * Commercial - */ - - $commercial = new User($db, $contrat->commercial_sign_id); - $commercial->fetch(); - - print ''; - print ''; - - print "\n".''; - /* - * - */ - print "\n".''; - /* - * - * - */ - print '"; - - print ''; - print '
R�f�rence'.$contrat->ref.'Factur� : '.$contrat->facturable.'
Client'; - print ''; - - print $client_comm->nom.''.$client_comm->code_client; - print '
Client (Agence/Filiale)'; - print '
Client � facturer'."\n"; - print '
Mode de r�glement'; - - if ($user->rights->telephonie->contrat->paiement) - { - print ''; - } - else - { - print ''; - - if ($contrat->mode_paiement == 'pre') - { - print 'Pr�l�vement'; - } - else - { - print 'Virement'; - } - } - - - print '
Commercial Signature'.$commercial->fullname.'
Commercial Suivi'; - print '
Grille de tarif'; - print '
Note'; - print '
'; - print 'Annuler
'."\n"; - print '
'."\n"; - - } - - /* - * Contact - * - * - */ - if ($_GET["action"] == 'contact') - { - print_fiche_titre('Ajouter un contact', $mesg); - - print '
'; - print ''; - print ''; - - print ''; - - $sql = "SELECT c.rowid, c.name, c.firstname, c.email "; - $sql .= "FROM ".MAIN_DB_PREFIX."socpeople as c"; - $sql .= ",".MAIN_DB_PREFIX."telephonie_contrat_contact_facture as cf"; - $sql .= " WHERE c.rowid = cf.fk_contact "; - $sql .= " AND cf.fk_contrat = ".$contrat->id." ORDER BY name "; - - if ( $db->query( $sql) ) - { - $num = $db->num_rows(); - if ( $num > 0 ) - { - $i = 0; - while ($i < $num) - { - $row = $db->fetch_row($i); - - print ''; - print '"; - $i++; - } - } - $db->free(); - - } - else - { - print $sql; - } - - - print ''; - - print ''; - print '
Contact facture '.$i.''.$row[1] . " " . $row[2] . " <".$row[3].">"; - print ''; - print ''; - print img_delete(); - print "
Contact'; - - $sql = "SELECT rowid, name, firstname, email "; - $sql .= " FROM ".MAIN_DB_PREFIX."socpeople "; - $sql .= " WHERE fk_soc in (".$contrat->client_facture_id.",".$contrat->client_id.")"; - $sql .= " ORDER BY name "; - - if ( $db->query( $sql) ) - { - print ''; - } - else - { - print $sql; - } - - print '

Contact auquel est envoy� la facture par email

'; - if ($num > 0) - { - print ''; - } - print 'Annuler
'; - print '
'; - - } - - /* - * Prise d'ordre - * - * - */ - if ($_GET["action"] == 'po' && $po == 0) - { - print_fiche_titre('Ajouter une prise d\'ordre mensuelle'); - - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print '
Montant mensuel'; - print ' euros HT
'; - print ''; - - print 'Annuler
'; - print '
'; - - } - /* - * - */ - print ''; - - /* ************************************************************************** */ - /* */ - /* Barre d'action */ - /* */ - /* ************************************************************************** */ - - print "\n
\n
\n"; - - if ($_GET["action"] == '') - { - if ($user->rights->telephonie->ligne->creer && $contrat->statut <> 6) - { - print 'Nouveau lien xDSL'; - print 'Nouvelle ligne'; - } - - if ($user->rights->telephonie->ligne->creer && $contrat->statut <> 6) - { - print "id\">".$langs->trans("Contact").""; - } - - if ($user->rights->telephonie->ligne->creer && $po == 0 && $contrat->statut <> 6) - { - print "id\">Ajouter une prise d'ordre"; - } - if ($user->rights->telephonie->ligne->creer && $contrat->statut <> 6) - { - print "id\">".$langs->trans("Modify").""; - } - - if ($user->rights->telephonie->ligne->creer && $numlignes == 0 && $contrat->statut <> 6) - { - print "id\">".$langs->trans("Delete").""; - } - } - - print "
"; - } - } - else - { - print "Error"; - } -} - - - - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/contrat/index.php b/htdocs/telephonie/contrat/index.php deleted file mode 100644 index b06e434890c..00000000000 --- a/htdocs/telephonie/contrat/index.php +++ /dev/null @@ -1,226 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; - -if (!$user->rights->telephonie->lire) - accessforbidden(); - -llxHeader('','Telephonie - Contrats'); - -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -/* - * Mode Liste - * - * - * - */ - -print ''; - -print ''; - - -print '
'; - -print '
'; -print ''; -print ''; -print "\n"; -print ""; -print ''; -print '
Recherche contrat
Numéro
'; - -print '
'; - -/* Consultations */ - -$sql = "SELECT s.rowid as socid, s.nom, max(sc.datec) as dam, c.ref, c.rowid"; -$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; -$sql .= ",".MAIN_DB_PREFIX."telephonie_contrat as c"; -$sql .= ",".MAIN_DB_PREFIX."telephonie_contrat_consult as sc"; -$sql .= " WHERE s.rowid = c.fk_soc"; -$sql .= " AND c.rowid = sc.fk_contrat"; -$sql .= " AND sc.fk_user = ".$user->id; -$sql .= " GROUP BY c.rowid"; -$sql .= " ORDER BY dam DESC LIMIT 10"; - -$resql = $db->query($sql); -if ($resql) -{ - $num = $db->num_rows($resql); - print ''; - print ''; - $var=True; - - while ($obj = $db->fetch_object($resql)) - { - print "'; - - print ''; - - print "\n"; - $var=!$var; - } - print "
'.min(10,$num).' dernières fiche contrat consultées
"; - print ''; - print img_file(); - print ' '; - $nom = $obj->nom; - if (strlen($obj->nom) > 33) - $nom = substr($obj->nom,0,30)."..."; - - print ''.stripslashes($nom).''.$obj->ref.'
"; - $db->free($resql); -} -else -{ - print $db->error() . ' ' . $sql; -} - -/* ===== */ -print '
'; - -$sql = "SELECT distinct statut, count(*) as cc"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat as l"; -$sql .= ",".MAIN_DB_PREFIX."societe_perms as sp"; -$sql .= " WHERE l.fk_client_comm = sp.fk_soc"; -$sql .= " AND sp.fk_user = ".$user->id." AND sp.pread = 1"; -$sql .= " GROUP BY statut"; - -if ($db->query($sql)) -{ - $num = $db->num_rows(); - $i = 0; - - print ''; - print ''; - print "\n"; - $var=True; - - $contrat = new TelephonieContrat($db); - - while ($i < $num) - { - $obj = $db->fetch_object(); - - $var=!$var; - print ""; - print "\n"; - print '\n"; - print ''; - print "\n"; - - $values[$obj->statut] = $obj->cc; - $i++; - } - print "
ContratsNb 
".$contrat->statuts[$obj->statut]."'.$obj->cc."'; - print '
"; - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - -print '
'; - -$sql = "SELECT c.ref, c.rowid, c.statut"; -$sql .= " ,s.rowid as socid, sf.rowid as sfidp, sf.nom as nom_facture,s.nom"; -$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; -$sql .= " , ".MAIN_DB_PREFIX."societe as sf"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_contrat as c"; -$sql .= " , ".MAIN_DB_PREFIX."societe_perms as sp"; - -$sql .= " WHERE c.fk_soc = s.rowid"; -$sql .= " AND c.fk_soc_facture = sf.rowid"; - -$sql .= " AND s.rowid = sp.fk_soc"; - -$sql .= " AND sp.fk_user = ".$user->id." AND sp.pread = 1"; - -$sql .= " ORDER BY date_creat DESC LIMIT 10;"; - -$result = $db->query($sql); -if ($result) -{ - $num = $db->num_rows(); - $i = 0; - - print"\n\n"; - print ''; - print ''; - - print ''; - print ''; - print ''; - print "\n"; - - $var=True; - - while ($i < min($num,$conf->liste_limit)) - { - $obj = $db->fetch_object($i); - $var=!$var; - - print "\n"; - - print ''; - print ''; - - print "\n"; - $i++; - } - print "
RéférenceClient (Agence/Filiale)Client facturé
"; - print ' '; - print ''; - print img_file(); - print ' '; - - print ''.$obj->ref."'.stripslashes($obj->nom).''.stripslashes($obj->nom_facture).'
"; - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - - - -print '
'; - - - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/contrat/info.php b/htdocs/telephonie/contrat/info.php deleted file mode 100644 index 516e9f7d67e..00000000000 --- a/htdocs/telephonie/contrat/info.php +++ /dev/null @@ -1,208 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require "./pre.inc.php"; -require_once DOL_DOCUMENT_ROOT."/telephonie/dolibarrmail.class.php"; - -$mesg = ''; - -llxHeader("","","Fiche Contrat"); - -if ($_GET["id"]) -{ - $client_comm = new Societe($db); - $contrat = new TelephonieContrat($db); - - if ($contrat->fetch($_GET["id"]) == 0) - { - $result = 1; - $client_comm->fetch($contrat->client_comm_id, $user); - } - else - { - print "Erreur"; - } - - if (!$client_comm->perm_read) - { - print "Lecture non authorisée"; - } - - if ( $result && $client_comm->perm_read) - { - if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit') - { - - $h=0; - $head[$h][0] = DOL_URL_ROOT."/telephonie/contrat/fiche.php?id=".$contrat->id; - $head[$h][1] = $langs->trans("Contrat"); - $h++; - - $nser = $contrat->count_associated_services(); - - $head[$h][0] = DOL_URL_ROOT."/telephonie/contrat/services.php?id=".$contrat->id; - if ($nser > 0) - { - $head[$h][1] = $langs->trans("Services")." (".$nser.")"; - } - else - { - $head[$h][1] = $langs->trans("Services"); - } - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/contrat/stats.php?id=".$contrat->id; - $head[$h][1] = $langs->trans("Stats"); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/contrat/info.php?id=".$contrat->id; - $head[$h][1] = $langs->trans("Infos"); - $hselected = $h; - $h++; - - dol_fiche_head($head, $hselected, 'Contrat : '.$contrat->ref); - - print_fiche_titre('Fiche Contrat', $mesg); - - print ''; - - $client_comm = new Societe($db, $contrat->client_comm_id); - $client_comm->fetch($contrat->client_comm_id); - - print ''; - print ''; - - print ''; - - $commercial = new User($db, $contrat->commercial_sign_id); - $commercial->fetch(); - - print ''; - print ''; - - $commercial_suiv = new User($db, $contrat->commercial_suiv_id); - $commercial_suiv->fetch(); - - print ''; - print ''; - - $cuser_suiv = new User($db, $contrat->user_creat); - $cuser_suiv->fetch(); - - print ''; - print ''; - - print ''; - print ''; - - print "
Référence'.$contrat->ref.'Facturé : '.$contrat->facturable.'
Client'; - print ''; - - print $client_comm->nom.''.$client_comm->code_client; - print '
Commercial Signature'.$commercial->fullname.'
Commercial Suivi'.$commercial_suiv->fullname.'
Créé par'.$cuser_suiv->fullname; - print '
Créé le'.strftime("%e %B %Y",$contrat->date_creat); - print '

"; - - - $sql = "SELECT s.rowid as socid, s.nom, p.fk_contrat, p.montant, p.avance_duree, p.avance_pourcent"; - $sql .= ", p.rem_pour_prev, p.rem_pour_autr, p.mode_paiement"; - $sql .= ", u.name, u.firstname, u.login"; - $sql .= " , ".$db->pdate("p.datepo") . " as datepo"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat_priseordre as p"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_contrat as c"; - $sql .= " , ".MAIN_DB_PREFIX."societe as s"; - $sql .= " , ".MAIN_DB_PREFIX."user as u"; - - $sql .= " WHERE p.fk_commercial =u.rowid"; - $sql .= " AND p.fk_user =u.rowid"; - $sql .= " AND c.fk_soc = s.rowid"; - $sql .= " AND p.fk_contrat = c.rowid"; - $sql .= " AND c.rowid =".$_GET["id"]; - - - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - - print_barre_liste("Prises d'ordre", $page, "commercialpo.php","&commid=".$_GET["commid"], $sortfield, $sortorder, '', $num); - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; - - $var=True; - - while ($i < min($num,$conf->liste_limit)) - { - $obj = $db->fetch_object($resql); - $var=!$var; - - print ""; - - print '\n"; - - print '\n"; - - print '\n"; - - if ($obj->mode_paiement == 'pre') - { - print ''; - } - else - { - print ''; - } - print ''; - - print "\n"; - $i++; - } - print "
Affecté àDateMontantMdPSaisi par
'.$obj->firstname.' '.$obj->name."'.strftime("%e %b %Y",$obj->datepo)."'.sprintf("%01.2f",$obj->montant)."PrelevAutre'.$obj->login.'
"; - $db->free(); - } - else - { - print $db->error() . ' ' . $sql; - } - - - } - } -} - -/* ************************************************************************** */ -/* */ -/* Barre d'action */ -/* */ -/* ************************************************************************** */ - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/contrat/liste.php b/htdocs/telephonie/contrat/liste.php deleted file mode 100644 index 0956db8e2e9..00000000000 --- a/htdocs/telephonie/contrat/liste.php +++ /dev/null @@ -1,159 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; -$sortfield = $_GET["sortfield"]; - -llxHeader('','Telephonie - Contrats - Liste'); - -/* - * - * - */ - -if ($page == -1) { $page = 0 ; } -if ($sortorder == "") $sortorder="ASC"; -if ($sortfield == "") $sortfield="c.statut"; - -$offset = $conf->liste_limit * $page ; -$pageprev = $page - 1; -$pagenext = $page + 1; - -/* - * Mode Liste - * - * - * - */ -$sql = "SELECT c.rowid, c.ref, s.rowid as socid, c.statut, s.nom "; -$sql .= ", sf.rowid as sfidp, sf.nom as sfnom"; -$sql .= ", sa.rowid as saidp, sa.nom as sanom"; -$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; -$sql .= " , ".MAIN_DB_PREFIX."societe as sf"; -$sql .= " , ".MAIN_DB_PREFIX."societe as sa"; -$sql .= " , ".MAIN_DB_PREFIX."societe_perms as sp"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_contrat as c"; - -$sql .= " WHERE c.fk_client_comm = s.rowid"; -$sql .= " AND c.fk_soc = sa.rowid"; -$sql .= " AND c.fk_soc_facture = sf.rowid"; - -$sql .= " AND c.fk_client_comm = sp.fk_soc"; -$sql .= " AND sp.fk_user = ".$user->id." AND sp.pread = 1"; - -if ($_GET["search_contrat"]) -{ - $sel = urldecode($_GET["search_contrat"]); - $sql .= " AND c.ref LIKE '%".$sel."%'"; -} - -if ($_GET["search_client"]) -{ - $sel = urldecode($_GET["search_client"]); - $sql .= " AND s.nom LIKE '%".$sel."%'"; -} - -if ($_GET["search_client_facture"]) -{ - $sel =urldecode($_GET["search_client_facture"]); - $sql .= " AND sf.nom LIKE '%".$sel."%'"; -} - -if (strlen($_GET["statut"])) -{ - $sql .= " AND c.statut = ".$_GET["statut"]; -} - -$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); - -$result = $db->query($sql); -if ($result) -{ - $num = $db->num_rows(); - $i = 0; - - $urladd= "&statut=".$_GET["statut"]; - - print_barre_liste("Contrats", $page, "liste.php", $urladd, $sortfield, $sortorder, '', $num); - print"\n\n"; - print '
'."\n"; - print ''; - print ''; - - print_liste_field_titre("Ref","liste.php","c.ref"); - print_liste_field_titre("Client","liste.php","s.nom"); - print_liste_field_titre("Client (Agence/Filiale)","liste.php","sa.nom"); - - print ''; - print ''; - - print "\n"; - - print ''; - print ''; - print ''; - print ''; - print ''; - - - print ''; - print ''; - - $var=True; - - while ($i < min($num,$conf->liste_limit)) - { - $obj = $db->fetch_object(); - $var=!$var; - - print "\n"; - - print ''; - - print ''; - print ''; - - print ''; - print "\n"; - $i++; - } - print "
Client facturé-
"; - print ' '; - print ''; - print img_file(); - print ' '; - - print ''.$obj->ref."'.stripslashes($obj->nom).''.stripslashes($obj->sanom).''.stripslashes($obj->sfnom).'-
"; - print '
'; - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/contrat/pre.inc.php b/htdocs/telephonie/contrat/pre.inc.php deleted file mode 100644 index d70d21aaf51..00000000000 --- a/htdocs/telephonie/contrat/pre.inc.php +++ /dev/null @@ -1,77 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("../../main.inc.php"); - -require(DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); -require(DOL_DOCUMENT_ROOT."/telephonie/telephonie.contrat.class.php"); -require(DOL_DOCUMENT_ROOT."/telephonie/telephonie.client.class.php"); - -$user->getrights('telephonie'); - -function llxHeader($head = "", $title="") { - global $user; - - /* - * - * - */ - top_menu($head, $title); - - $menu = new Menu(); - - $menu->add(DOL_URL_ROOT."/telephonie/index.php", "Telephonie"); - - if (TELEPHONIE_MODULE_SIMULATION == 1) - $menu->add(DOL_URL_ROOT."/telephonie/simulation/fiche.php", "Simulation"); - - $menu->add(DOL_URL_ROOT."/telephonie/client/index.php", "Clients"); - if ($user->rights->telephonie->ligne->creer) - $menu->add_submenu(DOL_URL_ROOT."/telephonie/client/new.php", "Nouveau client"); - - $menu->add(DOL_URL_ROOT."/telephonie/contrat/", "Contrats"); - - $menu->add_submenu(DOL_URL_ROOT."/telephonie/contrat/liste.php", "Liste"); - - if ($user->rights->telephonie->ligne->creer) - $menu->add_submenu(DOL_URL_ROOT."/telephonie/contrat/fiche.php?action=create", "Nouveau contrat"); - $menu->add(DOL_URL_ROOT."/telephonie/ligne/index.php", "Lignes"); - - if ($user->rights->telephonie->ligne_commander) - $menu->add(DOL_URL_ROOT."/telephonie/ligne/commande/", "Commandes"); - - if ($user->rights->telephonie->stats->lire) - $menu->add(DOL_URL_ROOT."/telephonie/stats/", "Statistiques"); - - if ($user->rights->telephonie->facture->lire) - $menu->add(DOL_URL_ROOT."/telephonie/facture/", "Factures"); - - $menu->add(DOL_URL_ROOT."/telephonie/tarifs/", "Tarifs"); - - $menu->add(DOL_URL_ROOT."/telephonie/distributeurs/", "Distributeurs"); - - if ($user->rights->telephonie->ca->lire) - $menu->add(DOL_URL_ROOT."/telephonie/ca/", "Chiffre d'affaire"); - - left_menu($menu->liste); -} - -?> diff --git a/htdocs/telephonie/contrat/services.php b/htdocs/telephonie/contrat/services.php deleted file mode 100644 index 9a5e14d982a..00000000000 --- a/htdocs/telephonie/contrat/services.php +++ /dev/null @@ -1,334 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require "./pre.inc.php"; - -$mesg = ''; - -if ($_POST["action"] == 'addservice' && $user->rights->telephonie->service->affecter) -{ - $contrat = new TelephonieContrat($db); - $contrat->id= $_GET["id"]; - - if ( $contrat->add_service($user, $_POST["service_id"]) == 0) - { - Header("Location: services.php?id=".$contrat->id); - } -} - -if ($_GET["action"] == 'rmservice' && $user->rights->telephonie->service->affecter) -{ - $contrat = new TelephonieContrat($db); - $contrat->id= $_GET["id"]; - - if ( $contrat->remove_service($user, $_GET["service_id"]) == 0) - { - Header("Location: services.php?id=".$contrat->id); - } -} - -llxHeader("","","Fiche Contrat - Services"); - - -if ($_GET["id"]) -{ - $client_comm = new Societe($db); - $contrat = new TelephonieContrat($db); - - if ($contrat->fetch($_GET["id"]) == 0) - { - $result = 1; - $client_comm->fetch($contrat->client_comm_id, $user); - } - else - { - print "Erreur"; - } - - if (!$client_comm->perm_read) - { - print "Lecture non authorisée"; - } - - if ( $result && $client_comm->perm_read) - { - if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit') - { - - $h=0; - $head[$h][0] = DOL_URL_ROOT."/telephonie/contrat/fiche.php?id=".$contrat->id; - $head[$h][1] = $langs->trans("Contrat"); - $h++; - - $nser = $contrat->count_associated_services(); - - $head[$h][0] = DOL_URL_ROOT."/telephonie/contrat/services.php?id=".$contrat->id; - if ($nser > 0) - { - $head[$h][1] = $langs->trans("Services")." (".$nser.")"; - } - else - { - $head[$h][1] = $langs->trans("Services"); - } - $hselected = $h; - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/contrat/stats.php?id=".$contrat->id; - $head[$h][1] = $langs->trans("Stats"); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/contrat/info.php?id=".$contrat->id; - $head[$h][1] = $langs->trans("Infos"); - $h++; - - dol_fiche_head($head, $hselected, 'Contrat : '.$contrat->ref); - - print_fiche_titre('Fiche Contrat', $mesg); - - print ''; - print ''; - print ''; - - print ''; - - if ($contrat->client_comm_id <> $contrat->client_id) - { - $client = new Societe($db, $contrat->client_id); - $client->fetch($contrat->client_id); - print ''; - } - - $commercial = new User($db, $contrat->commercial_sign_id); - $commercial->fetch(); - - print ''; - print ''; - - $commercial_suiv = new User($db, $contrat->commercial_suiv_id); - $commercial_suiv->fetch(); - - print ''; - print ''; - - /* Contacts */ - print ''; - print ''; - /* Fin Contacts */ - - print "
Référence'.$contrat->ref.'Facturé : '.$contrat->facturable.'
Client'; - print ''; - - print $client_comm->nom.''.$client_comm->code_client; - print '
Client (Agence/Filiale)'; - print $client->nom.'
'; - print $client->cp . " " .$client->ville; - print '
Commercial Signature'.$commercial->fullname.'
Commercial Suivi'.$commercial_suiv->fullname.'
Contact facture'; - - $sql = "SELECT c.rowid, c.name, c.firstname, c.email "; - $sql .= "FROM ".MAIN_DB_PREFIX."socpeople as c"; - $sql .= ",".MAIN_DB_PREFIX."telephonie_contrat_contact_facture as cf"; - $sql .= " WHERE c.rowid = cf.fk_contact AND cf.fk_contrat = ".$contrat->id." ORDER BY name "; - if ( $db->query( $sql) ) - { - $num = $db->num_rows(); - if ( $num > 0 ) - { - $i = 0; - while ($i < $num) - { - $row = $db->fetch_row($i); - - print $row[1] . " " . $row[2] . " <".$row[3].">
"; - $i++; - } - } - $db->free(); - - } - else - { - print $sql; - } - print '

"; - - - /* Services */ - - print ''; - - $sql = "SELECT s.libelle, s.statut"; - $sql .= " , cs.rowid as serid, s.montant, cs.montant as montant_fac"; - $sql .= " , ".$db->pdate("cs.date_creat") . " as date_creat"; - $sql .= " , u.name, u.firstname"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat_service as cs"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_service as s"; - $sql .= " , ".MAIN_DB_PREFIX."user as u"; - - $sql .= " WHERE cs.fk_service = s.rowid"; - $sql .= " AND cs.fk_user_creat = u.rowid"; - $sql .= " AND cs.fk_contrat = ".$contrat->id; - - if ( $db->query( $sql) ) - { - $numlignes = $db->num_rows(); - if ( $numlignes > 0 ) - { - $i = 0; - $ligne = new LigneTel($db); - - print ''; - print ''; - print ''; - if ($user->rights->telephonie->service->affecter) - print "\n"; - print ''; - print ''; - - while ($i < $numlignes) - { - $obj = $db->fetch_object($i); - $var=!$var; - - print "\n"; - - print '\n"; - print '\n"; - - if ($user->rights->telephonie->service->affecter) - { - print '"; - } - print ''; - print ''; - print "\n"; - $i++; - } - } - $db->free(); - - } - else - { - print $db->error(); - print $sql; - } - - print "
ServiceMontant FacturéMontant du service Ajouté parAjouté le
"; - - print ' '; - - - print ''.$obj->libelle."'.price($obj->montant_fac)." euros HT'.price($obj->montant)." euros HT'; - print img_delete(); - print "'.$obj->firstname.' '.$obj->name.''.strftime("%d/%m/%y",$obj->date_creat).'
"; - } - /* - * Service - * - * - */ - if ($user->rights->telephonie->service->affecter) - { - print_fiche_titre('Ajouter un service', $mesg); - - print '
'; - print ''; - print ''; - print ''; - print ''; - - print ''; - print '
Service'; - - $sql = "SELECT rowid, libelle "; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_service "; - $sql .= " WHERE statut = 1"; - - if ( $db->query( $sql) ) - { - print ''; - } - else - { - print $sql; - } - - print '
'; - if ($num > 0) - { - print ''; - } - print '
'; - print '
'; - } - /* - * - * - * - */ - - print ''; - - } -} -else -{ - print "Error"; -} - - -/* ************************************************************************** */ -/* */ -/* Barre d'action */ -/* */ -/* ************************************************************************** */ - -print "\n
\n
\n"; - -if ($_GET["action"] == '') -{ - -} - -print "
"; - - - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/contrat/stats.php b/htdocs/telephonie/contrat/stats.php deleted file mode 100644 index ad01e9cf8e2..00000000000 --- a/htdocs/telephonie/contrat/stats.php +++ /dev/null @@ -1,199 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require("./pre.inc.php"); - -llxHeader("","Téléphonie - Contrat"); - -/* Affichage */ - -if ($_GET["id"]) -{ - $client_comm = new Societe($db); - $contrat = new TelephonieContrat($db); - - if ($contrat->fetch($_GET["id"]) == 0) - { - $result = 1; - } - - $client_comm->fetch($contrat->client_comm_id, $user); - - if (!$client_comm->perm_read) - { - print "Lecture non authorisée"; - } - - if ( $result && $client_comm->perm_read) - { - if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit') - { - $h=0; - $head[$h][0] = DOL_URL_ROOT."/telephonie/contrat/fiche.php?id=".$contrat->id; - $head[$h][1] = $langs->trans("Contrat"); - $h++; - - $nser = $contrat->count_associated_services(); - - $head[$h][0] = DOL_URL_ROOT."/telephonie/contrat/services.php?id=".$contrat->id; - if ($nser > 0) - { - $head[$h][1] = $langs->trans("Services")." (".$nser.")"; - } - else - { - $head[$h][1] = $langs->trans("Services"); - } - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/contrat/stats.php?id=".$contrat->id; - $head[$h][1] = $langs->trans("Stats"); - $hselected = $h; - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/contrat/info.php?id=".$contrat->id; - $head[$h][1] = $langs->trans("Infos"); - $h++; - - dol_fiche_head($head, $hselected, 'Contrat : '.$contrat->ref); - - print_fiche_titre('Fiche Contrat', $mesg); - - print ''; - - $client_comm = new Societe($db, $contrat->client_comm_id); - $client_comm->fetch($contrat->client_comm_id); - - print ''; - print ''; - - print ''; - - $commercial = new User($db, $contrat->commercial_sign_id); - $commercial->fetch(); - $commercial_suiv = new User($db, $contrat->commercial_suiv_id); - $commercial_suiv->fetch(); - - print ''; - print ''; - - print "
Référence'.$contrat->ref.'Facturé : '.$contrat->facturable.'
Client'; - print ''; - - print $client_comm->nom.''.$client_comm->code_client; - print '
Commercial Suivi/Signature'.$commercial_suiv->fullname.'/'.$commercial->fullname.'

"; - - - print ''; - - print ''; - print ''; - print '
'; - - $mesg_no_graph = 'Nous avons pas assez de données à ce jour pour générer ce graphique.'; - - $img_root = DOL_DATA_ROOT."/graph/".substr($contrat->id,-1)."/telephonie/contrat/"; - - $file = $img_root.$contrat->id."/graphca.png"; - - if (file_exists($file)) - { - print 'CA Mensuel'; - //print 'CA Mensuel'; - } - else - { - print $mesg_no_graph; - } - - print ''; - - $file = $img_root.$contrat->id."/graphgain.png"; - - if (file_exists($file) && $user->rights->telephonie->ligne->gain) - { - print 'CA Mensuel'; - } - else - { - print $mesg_no_graph; - } - - print '
'; - - $file = $img_root.$contrat->id."/graphappelsdureemoyenne.png"; - - if (file_exists($file)) - { - print 'dureemoyenne'; - } - else - { - print $mesg_no_graph; - } - - print ''; - - print " "; - - print '
'; - - $file = $img_root.$contrat->id."/nb-comm-mensuel.png"; - - if (file_exists($file)) - { - print 'CA Mensuel'; - } - else - { - print $mesg_no_graph; - } - - print ''; - - $file = $img_root.$contrat->id."/nb-minutes-mensuel.png"; - - if (file_exists($file)) - { - print 'CA Mensuel'; - } - else - { - print $mesg_no_graph; - } - - print '
'; - - } - } -} -else -{ - print "Erreur"; -} - -print ''; - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/contrat/statut0.png b/htdocs/telephonie/contrat/statut0.png deleted file mode 100644 index 7a8fb19836863bc7b7f7eee1f809db6adf2fc626..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 198 zcmeAS@N?(olHy`uVBq!ia0vp^JRr=$1|-8uW1a&kwj^(N7l!`~4GjPP3v~Pgif|Tq zL>2>eTxVe5JHn{gn6eot$X?><>&kwGi=9VV&|ki)3@9X9;u=xnoS&PUnpeW$T$Gwv zlA5AWo>`Ki5R#Fq;O^-g@IFN~52#Sf)5S5Q;#P7>Lc)*p4onG&2|&jG`4+Z4Jv}@= lJSt6ryv@$c$}2sY87}9risv)*uLbI2@O1TaS?83{1OPk+H@pA< diff --git a/htdocs/telephonie/contrat/statut1.png b/htdocs/telephonie/contrat/statut1.png deleted file mode 100644 index 134f1b74b305154a2e4ab14812c4ffa37f6c9035..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 197 zcmeAS@N?(olHy`uVBq!ia0vp^JRr=$1|-8uW1a&kwj^(N7l!{JxM1({$v_d#0*}aI zppNSd417lz6&q7F0|nVjJbhi+uW+$)vg%Z1?^gy2$(FcAlsM<-=BDPAFgO>bCYGe8 zD3oWGWGIAWq$;?3`UbpDQOyG?)bw<545_%4oRX06bCYGe8 zD3oWGWGIAWq$;?3`UbpDQOyG?RP}Um45_%4oRX06bCYGe8 zD3oWGWGIAWq$;?3`UbpDQOyG?)bez345_%4oRX06gTe~DWM4f+%-8K diff --git a/htdocs/telephonie/contrat/statut6.png b/htdocs/telephonie/contrat/statut6.png deleted file mode 100644 index 4d8f59be1c226e76c2ddc5a89f5bde2f7de5da8e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 193 zcmeAS@N?(olHy`uVBq!ia0vp^JRr=$1|-8uW1a&kwj^(N7l!{JxM1({$v_d#0*}aI zppNSd417lz6&q7F0|nVjJbhi+uW+&RC~7F_O!xy7k}YwKC~?lu%}vcKVQ?-=O)N=G zQ7F$W$xsN%NL6t6^bL5QqM8R(sOstB7*cU7IVBn+a diff --git a/htdocs/telephonie/distributeurs/comm/ca.php b/htdocs/telephonie/distributeurs/comm/ca.php deleted file mode 100644 index 7e6eb98caf2..00000000000 --- a/htdocs/telephonie/distributeurs/comm/ca.php +++ /dev/null @@ -1,100 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if (!$user->rights->telephonie->lire) accessforbidden(); - -if ($user->distributeur_id && $user->responsable_distributeur_id == 0) -{ - $_GET["id"] = $user->id; -} - -if ($user->responsable_distributeur_id > 0) -{ - if (!in_array($_GET["id"], $user->responsable_distributeur_commerciaux)) - { - accessforbidden(); - } -} - -$year = strftime("%Y",time()); - -llxHeader('','Telephonie - Distributeur - Commercial'); - -/* - * - */ -$h = 0; - -$year = strftime("%Y",time()); -if (strftime("%m",time()) == 1) -{ - $year = $year -1; -} -if ($_GET["year"] > 0) -{ - $year = $_GET["year"]; -} - -if ($_GET["id"] && $_GET["did"]) -{ - $commercial = new User($db, $_GET["id"]); - $commercial->fetch(); - - $distri = new DistributeurTelephonie($db); - $distri->fetch($_GET["did"]); - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/distributeur.php?id='.$distri->id; - $head[$h][1] = $distri->nom; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/comm/commercial.php?id='.$_GET["id"].'&did='.$_GET["did"]; - $head[$h][1] = $commercial->prenom ." ". $commercial->nom; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/comm/ca.php?id='.$commercial->id.'&did='.$_GET["did"]; - $head[$h][1] = "Chiffre d'affaire"; - $hselected = $h; - $h++; - /* - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/stats.php?id='.$distri->id; - $head[$h][1] = "Statistiques"; - $h++; - */ - dol_fiche_head($head, $hselected, "Distributeur"); - - print ''; - - print ''; - print '
'; - - print 'CA

'."\n"; - - print '

'; - - print '
'; - - $db->close(); -} - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/distributeurs/comm/commercial.php b/htdocs/telephonie/distributeurs/comm/commercial.php deleted file mode 100644 index 8a0adb2aaeb..00000000000 --- a/htdocs/telephonie/distributeurs/comm/commercial.php +++ /dev/null @@ -1,146 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if (!$user->rights->telephonie->lire) accessforbidden(); - -if ($user->distributeur_id && $user->responsable_distributeur_id == 0) -{ - $_GET["id"] = $user->id; -} - -if ($user->responsable_distributeur_id > 0) -{ - if (!in_array($_GET["id"], $user->responsable_distributeur_commerciaux)) - { - accessforbidden(); - } -} - -llxHeader('','Telephonie - Distributeur - Commercial'); - -/* - * - */ -$h = 0; -$year = strftime("%Y",time()); - -if ($_GET["id"] && $_GET["did"]) -{ - $commercial = new User($db, $_GET["id"]); - $commercial->fetch(); - - $distri = new DistributeurTelephonie($db); - $distri->fetch($_GET["did"]); - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/distributeur.php?id='.$distri->id; - $head[$h][1] = $distri->nom; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/comm/commercial.php?id='.$_GET["id"].'&did='.$_GET["did"]; - $head[$h][1] = $commercial->prenom ." ". $commercial->nom; - $hselected = $h; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/comm/ca.php?id='.$commercial->id.'&did='.$_GET["did"]; - $head[$h][1] = "Chiffre d'affaire"; - $h++; - /* - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/stats.php?id='.$distri->id; - $head[$h][1] = "Statistiques"; - $h++; - */ - dol_fiche_head($head, $hselected, "Distributeur"); - - print ''; - - print ''; - print '
'; - - print ''; - - print ''; - print '"; - - $sql = "SELECT ".$db->pdate("p.datepo") . " as datepo, sum(p.montant)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat_priseordre as p"; - $sql .= " WHERE p.fk_commercial =".$commercial->id; - $sql .= " GROUP BY date_format(datepo,'%Y%m') DESC"; - - $resql = $db->query($sql); - - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - $total = 0; - - while ($i < $num) - { - $row = $db->fetch_row($resql); - - $var=!$var; - - print ""; - - print ''; - print ''; - - $i++; - } - $db->free($resql); - } - else - { - print $db->error() . ' ' . $sql; - } - print '
Date'."Prise d'ordre mensuelle
'.strftime("%m/%Y",$row[0]).''.price($row[1]).' HT

'; - - print '
'; - - print 'Nouveaux clients (moy)

'."\n"; - - print 'Nouveaux clients

'."\n"; - - print 'Nouveaux clients (moy)

'."\n"; - - print '
'; - - /* ************************************************************************** */ - /* */ - /* Barre d'action */ - /* */ - /* ************************************************************************** */ - print "\n
\n"; - - if ($_GET["action"] == '' && $user->admin) - { - print "id."\">".$langs->trans("Nouveau commercial").""; - } - - print "

"; - - $db->close(); -} - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/distributeurs/comm/index.php b/htdocs/telephonie/distributeurs/comm/index.php deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/telephonie/distributeurs/comm/pre.inc.php b/htdocs/telephonie/distributeurs/comm/pre.inc.php deleted file mode 100644 index d6a44790226..00000000000 --- a/htdocs/telephonie/distributeurs/comm/pre.inc.php +++ /dev/null @@ -1,152 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("../../../main.inc.php"); - -$user->getrights('telephonie'); -$user->distributeur_id = 0; -$user->responsable_distributeur_id = 0; -$user->responsable_distributeur_commerciaux = array(); -require DOL_DOCUMENT_ROOT.'/telephonie/distributeurtel.class.php'; -require DOL_DOCUMENT_ROOT.'/telephonie/telephonie.commercial.class.php'; - -$sql = "SELECT fk_distributeur"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_distributeur_commerciaux"; -$sql .= " WHERE fk_user=".$user->id; - -$resql = $db->query($sql); -if ($resql) -{ - $row = $db->fetch_row($resql); - $user->distributeur_id = $row[0]; -} - -$sql = "SELECT fk_distributeur"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_distributeur_responsable"; -$sql .= " WHERE fk_user=".$user->id; - -$resql = $db->query($sql); -if ($resql) -{ - $row = $db->fetch_row($resql); - $user->responsable_distributeur_id = $row[0]; -} - -if ($user->responsable_distributeur_id > 0) -{ - $sql = "SELECT fk_user"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_distributeur_commerciaux"; - $sql .= " WHERE fk_distributeur=".$user->responsable_distributeur_id; - - $resql = $db->query($sql); - if ($resql) - { - while ($row = $db->fetch_row($resql)) - { - array_push($user->responsable_distributeur_commerciaux, $row[0]); - } - } -} - -function llxHeader($head = "", $title="") { - global $user, $conf, $db; - - /* - * - * - */ - top_menu($head, $title); - - $menu = new Menu(); - - $menu->add(DOL_URL_ROOT."/telephonie/index.php", "Telephonie"); - - $menu->add(DOL_URL_ROOT."/telephonie/client/index.php", "Clients"); - - $menu->add(DOL_URL_ROOT."/telephonie/contrat/", "Contrats"); - - $menu->add(DOL_URL_ROOT."/telephonie/ligne/index.php", "Lignes"); - - if ($user->rights->telephonie->ligne_commander) - $menu->add(DOL_URL_ROOT."/telephonie/ligne/commande/", "Commandes"); - - if ($user->rights->telephonie->facture->lire) - $menu->add(DOL_URL_ROOT."/telephonie/facture/", "Factures"); - - if ($user->rights->telephonie->stats->lire) - { - $menu->add(DOL_URL_ROOT."/telephonie/stats/", "Statistiques"); - $menu->add_submenu(DOL_URL_ROOT."/telephonie/stats/distributeurs/", "Distributeurs"); - } - - $menu->add(DOL_URL_ROOT."/telephonie/tarifs/", "Tarifs"); - - $menu->add(DOL_URL_ROOT."/telephonie/distributeurs/", "Distributeurs"); - - - $sql = "SELECT d.nom, d.rowid"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_distributeur as d"; - - if ($user->distributeur_id) - { - $sql .= " WHERE d.rowid = ".$user->distributeur_id; - } - - $sql .= " ORDER BY d.nom ASC"; - - $resql = $db->query($sql); - - if ($resql) - { - $num = $db->num_rows(); - $i = 0; - $total = 0; - - while ($i < $num) - { - $row = $db->fetch_row($resql); - - $texte = $row[0]; - - if (strlen($texte) > 15) - { - $texte = substr($texte,0,12)."..."; - } - - $menu->add_submenu(DOL_URL_ROOT.'/telephonie/distributeurs/distributeur.php?id='.$row[1], $texte); - - $i++; - } - } - - if ($user->rights->telephonie->fournisseur->lire) - $menu->add(DOL_URL_ROOT."/telephonie/fournisseur/index.php", "Fournisseurs"); - - if ($user->rights->telephonie->service->lire) - $menu->add(DOL_URL_ROOT."/telephonie/service/", "Services"); - - if ($user->rights->telephonie->ca->lire) - $menu->add(DOL_URL_ROOT."/telephonie/ca/", "Chiffre d'affaire"); - - left_menu($menu->liste); -} - -?> diff --git a/htdocs/telephonie/distributeurs/commissions.php b/htdocs/telephonie/distributeurs/commissions.php deleted file mode 100644 index a70095b7388..00000000000 --- a/htdocs/telephonie/distributeurs/commissions.php +++ /dev/null @@ -1,195 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - - -if (!$user->rights->telephonie->lire) accessforbidden(); - -llxHeader('','Telephonie - Statistiques - Distributeur'); - -/* - * - */ -$h = 0; - -if ($user->distributeur_id) -{ - $_GET["id"] = $user->distributeur_id; -} - -if ($_GET["id"]) -{ - $distri = new DistributeurTelephonie($db); - $distri->fetch($_GET["id"]); - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/distributeur.php?id='.$distri->id; - $head[$h][1] = $distri->nom; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/contrat.php?id='.$distri->id; - $head[$h][1] = "Contrat"; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/commissions.php?id='.$distri->id; - $head[$h][1] = "Rémunérations"; - $hselected = $h; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/remav.php?id='.$distri->id; - $head[$h][1] = "Rém. avance"; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/remconso.php?id='.$distri->id; - $head[$h][1] = "Rém. conso"; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/po.php?id='.$distri->id; - $head[$h][1] = "Prises d'ordre"; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/stats.php?id='.$distri->id; - $head[$h][1] = "Statistiques"; - $h++; - - dol_fiche_head($head, $hselected, "Distributeur"); - - - /* Conso */ - $conso_total = 0; - $consos = array(); - - $sql = "SELECT c.date, sum(c.montant)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_commission_conso as c"; - $sql .= " WHERE c.fk_distributeur = ".$_GET["id"]; - $sql .= " AND c.annul = 0"; - $sql .= " GROUP BY c.date DESC"; - - $resql = $db->query($sql); - - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - - while ($i < $num) - { - $row = $db->fetch_row($resql); - $consos[$row[0]] = $row[1]; - $conso_total += $row[1]; - $i++; - } - $db->free($resql); - } - else - { - print $db->error() . ' ' . $sql; - } - - - /* Commission */ - $comm_total = 0; - $commissions = array(); - - $sql = "SELECT c.date, c.montant"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_commission as c"; - $sql .= " WHERE c.fk_distributeur = ".$_GET["id"]; - $sql .= " ORDER BY c.date DESC"; - $resql = $db->query($sql); - - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - - while ($row = $db->fetch_row($resql)) - { - $commissions[$row[0]] = $row[1]; - $comm_total += $row[1]; - } - $db->free($resql); - } - else - { - print $db->error() . ' ' . $sql; - } - - print ''; - print ''; - print '
'; - - print ''; - print ''; - print ''; - print ''; - $var=1; - print ''; - print ''; - - $sql = "SELECT c.date, c.montant"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_commission as c"; - $sql .= " WHERE c.fk_distributeur = ".$_GET["id"]; - - $sql .= " ORDER BY c.date DESC"; - - $resql = $db->query($sql); - - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - $total = 0; - - while ($i < $num) - { - $row = $db->fetch_row($resql); - - $var=!$var; - - print ""; - - print ''; - print ''; - /* - print ''; - print ''; - */ - - $i++; - } - $db->free($resql); - } - else - { - print $db->error() . ' ' . $sql; - } - print '
DateRémunération
Total'.price($comm_total).' HT
'.substr($row[0], -2).'/'.substr($row[0],0,4).''.price($row[1]).' HT'.price($consos[$row[0]]).' HT'.price($consos[$row[0]] - $row[1]).' HT

'; - - - print '
'; - - print '
'; - - $db->close(); -} - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/distributeurs/contrat.php b/htdocs/telephonie/distributeurs/contrat.php deleted file mode 100644 index 6221c6e896c..00000000000 --- a/htdocs/telephonie/distributeurs/contrat.php +++ /dev/null @@ -1,127 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if (!$user->rights->telephonie->lire) accessforbidden(); - -if ($user->distributeur_id && $user->responsable_distributeur_id == 0) -{ - accessforbidden(); -} - -llxHeader('','Telephonie - Statistiques - Distributeurs'); - -/* - * - * - * - */ - -$did = $_GET["id"]; - -if ($user->distributeur_id) -{ - $did = $user->distributeur_id; -} - -$h = 0; - - $distri = new DistributeurTelephonie($db); - $distri->fetch($did); - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/distributeur.php?id='.$distri->id; - $head[$h][1] = $distri->nom; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/contrat.php?id='.$distri->id; - $head[$h][1] = "Contrat"; - $hselected = $h; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/remuneration.php?id='.$distri->id; - $head[$h][1] = "Rémunérations"; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/po.php?id='.$distri->id; - $head[$h][1] = "Prises d'ordre"; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/stats.php?id='.$distri->id; - $head[$h][1] = "Statistiques"; - $h++; - - -dol_fiche_head($head, $hselected, "Distributeurs"); - -print ''; - -print ''; -print '
'; - -print ''; -print ''; -print ''; - -$sql = "SELECT d.nom, d.rowid, d.avance_pourcent, d.rem_pour_prev, d.rem_pour_autr, d.avance_duree"; - -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_distributeur as d"; -$sql .= " WHERE d.rowid = ".$did; -$sql .= " ORDER BY d.rowid ASC"; - -$resql = $db->query($sql); - -if ($resql) -{ - $num = $db->num_rows(); - $i = 0; - $total = 0; - - while ($i < $num) - { - $row = $db->fetch_row($i); - - $var=!$var; - - print ""; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - $i++; - } - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} -print '
DistributeurDurée avan.% Avance% Prélèv% Autre
'.$row[0].''.$row[5].''.$row[2].''.$row[3].''.$row[4].'

'; - -print '
 
'; - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/distributeurs/distributeur.php b/htdocs/telephonie/distributeurs/distributeur.php deleted file mode 100644 index 8abfb553b88..00000000000 --- a/htdocs/telephonie/distributeurs/distributeur.php +++ /dev/null @@ -1,288 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - - -if (!$user->rights->telephonie->lire) accessforbidden(); - -llxHeader('','Telephonie - Statistiques - Distributeur'); - -/* - * - */ -$h = 0; - -if ($user->distributeur_id) -{ - $_GET["id"] = $user->distributeur_id; -} - -if ($_GET["id"]) -{ - $distri = new DistributeurTelephonie($db); - $distri->fetch($_GET["id"]); - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/distributeur.php?id='.$distri->id; - $head[$h][1] = $distri->nom; - $hselected = $h; - $h++; - - if ($user->distributeur_id == 0 || $user->responsable_distributeur_id > 0) - { - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/contrat.php?id='.$distri->id; - $head[$h][1] = "Contrat"; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/remuneration.php?id='.$distri->id; - $head[$h][1] = "Rémunérations"; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/po.php?id='.$distri->id; - $head[$h][1] = "Prises d'ordre"; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/stats.php?id='.$distri->id; - $head[$h][1] = "Statistiques"; - $h++; - } - - dol_fiche_head($head, $hselected, "Distributeur"); - - print ''; - - print ''; - print '
'; - - print ''; - print ''; - - $sql = "SELECT u.rowid, u.firstname, u.name"; - $sql .= " FROM ".MAIN_DB_PREFIX."user as u"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_distributeur_responsable as dc"; - $sql .= " WHERE u.rowid = dc.fk_user "; - $sql .= " AND dc.fk_distributeur = '".$_GET["id"]."'"; - $sql .= " ORDER BY u.name ASC;"; - - $resql = $db->query($sql); - - if ($resql) - { - while ($row = $db->fetch_row($resql)) - { - $var=!$var; - print ""; - print ''; - } - $db->free($resql); - } - else - { - print $db->error() . ' ' . $sql; - } - print '
Responsables
'.$row[1].' '.$row[2].'

'; - - - - $sql = "SELECT u.rowid, u.firstname, u.name, u.email"; - $sql .= " FROM ".MAIN_DB_PREFIX."user as u"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_distributeur_commerciaux as dc"; - $sql .= " WHERE u.rowid = dc.fk_user "; - $sql .= " AND dc.fk_distributeur = '".$_GET["id"]."'"; - $sql .= " ORDER BY u.name ASC;"; - - $resql = $db->query($sql); - - if ($resql) - { - $num = $db->num_rows($resql); - - if ($num > 0 ) - { - print ''; - print ''; - while ($row = $db->fetch_row($resql)) - { - $var=!$var; - print ""; - print ''; - } - - print '
Commerciaux
';; - print $row[1].' '.$row[2].''; - if ($row[3] && $user->distributeur_id == 0) - { - print " <".$row[3].">"; - } - print '

'; - } - $db->free($resql); - } - else - { - print $db->error() . ' ' . $sql; - } - - if ($user->distributeur_id == 0 || $user->responsable_distributeur_id > 0) - { - - print ''; - print ''; - - $sql = "SELECT sum(c.montant)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_commission as c"; - $sql .= " WHERE c.fk_distributeur = ".$_GET["id"]; - - $resql = $db->query($sql); - - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - $total = 0; - $var = 0; - while ($i < $num) - { - $row = $db->fetch_row($resql); - $var=!$var; - print ""; - print ''; - print ''; - - $i++; - } - $db->free($resql); - } - else - { - print $db->error() . ' ' . $sql; - } - print '
Total commission
Total'.price($row[0]).' HT

'; - } - - if ($user->distributeur_id == 0 || $user->responsable_distributeur_id > 0) - { - - print '
'; - - /* comm */ - - - - print ''; - - print ''; - print ''; - - $sql = "SELECT c.date, c.montant"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_commission as c"; - $sql .= " WHERE c.fk_distributeur = ".$_GET["id"]; - $sql .= " ORDER BY c.date DESC"; - - $resql = $db->query($sql); - - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - $total = 0; - - while ($i < $num) - { - $row = $db->fetch_row($resql); - - $var=!$var; - print ""; - print ''; - print ''; - - $i++; - } - $db->free($resql); - } - else - { - print $db->error() . ' ' . $sql; - } - print '
DateRémunérations
'.substr($row[0], -2).'/'.substr($row[0],0,4).''.price($row[1]).' HT

'; - - - print '
'; - print ''; - - print ''; - print '"; - - $sql = "SELECT ".$db->pdate("p.datepo") . " as datepo, sum(p.montant)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat_priseordre as p"; - $sql .= " WHERE p.fk_distributeur =".$distri->id; - $sql .= " GROUP BY date_format(datepo,'%Y%m') DESC"; - - $resql = $db->query($sql); - - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - $total = 0; - - while ($i < $num) - { - $row = $db->fetch_row($resql); - - $var=!$var; - - print ""; - - print ''; - print ''; - - $i++; - } - $db->free($resql); - } - else - { - print $db->error() . ' ' . $sql; - } - print '
Date'."Prise d'ordre mensuelle
'.strftime("%m/%Y",$row[0]).''.price($row[1]).' HT

'; - } - print '
'; - - /* ************************************************************************** */ - /* */ - /* Barre d'action */ - /* */ - /* ************************************************************************** */ - print "\n
\n"; - - if ($_GET["action"] == '' && $user->admin) - { - print "id."\">".$langs->trans("Nouveau commercial").""; - } - - print "

"; - - $db->close(); -} - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/distributeurs/fiche.php b/htdocs/telephonie/distributeurs/fiche.php deleted file mode 100644 index aa9a86412c0..00000000000 --- a/htdocs/telephonie/distributeurs/fiche.php +++ /dev/null @@ -1,161 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if (!$user->rights->telephonie->lire) accessforbidden(); - -$distri = new DistributeurTelephonie($db); -$commercial = new CommercialTelephonie($db); - -if($_POST["action"] == 'add') -{ - $distri->nom = $_POST["nom"]; - $distri->avance = $_POST["avance"]; - $distri->duree = $_POST["duree"]; - $distri->prelev = $_POST["prelev"]; - $distri->autre = $_POST["autre"]; - - if ($distri->create() <> 0) - { - $_GET["action"] = "create"; - } - else - { - Header("Location: index.php"); - } -} - -if($_POST["action"] == 'add_commercial' && $user->admin) -{ - $commercial->nom = $_POST["nom"]; - $commercial->prenom = $_POST["prenom"]; - $commercial->distri = $_GET["distri"]; - $commercial->email = $_POST["email"]; - - if ($commercial->create() <> 0) - { - $_GET["action"] = "create_commercial"; - } - else - { - Header("Location: distributeur.php?id=".$_GET["distri"]); - } -} - -llxHeader('','Telephonie - Statistiques - Distributeurs'); - -/* - * - * - * - */ - -$h = 0; - - -if ($_GET["action"] == 'create_commercial') -{ - $distri = new DistributeurTelephonie($db); - $distri->fetch($_GET["distri"]); - - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/fiche.php?action=create'; - $head[$h][1] = "Nouveau commercial"; - $hselected = $h; - $h++; - - dol_fiche_head($head, $hselected, $distri->nom); - - print '
'; - print ''; - print ''; - - print ''; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - print ''; - print ''; - print ''; - - print ''; - - print '
Prénom'.$commercial->error_string["prenom"].'
Nom'.$commercial->error_string["nom"].'
Email'.$commercial->error_string["email"].'

'; - - print "
"; - -} - -if ($_GET["action"] == 'create') -{ - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/fiche.php?action=create'; -$head[$h][1] = "Nouveau distributeur"; -$hselected = $h; -$h++; - -dol_fiche_head($head, $hselected, "Distributeurs"); - - print '
'; - print ''; - print ''; - - print ''; - - print ''; - print ''; - print ''; - - print ''; - print ''; - print ''; - - print ''; - print ''; - print ''; - - print ''; - print ''; - print ''; - - print ''; - print ''; - - print ''; - - print ''; - - print '
Nom'.$distri->error_string["nom"].'
% avance %'.$distri->error_string["avance"].'
Durée de l\'avance mois'.$distri->error_string["duree"].'
% prélèvement %'.$distri->error_string["prelev"].'
% autre %'.$distri->error_string["autre"].'

'; - - print "
"; - -} - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/distributeurs/index.php b/htdocs/telephonie/distributeurs/index.php deleted file mode 100644 index 0dabf4953a5..00000000000 --- a/htdocs/telephonie/distributeurs/index.php +++ /dev/null @@ -1,111 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if (!$user->rights->telephonie->lire) accessforbidden(); - -llxHeader('','Telephonie - Statistiques - Distributeurs'); - -/* - * - * - * - */ - -$h = 0; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/index.php'; -$head[$h][1] = "Liste"; -$hselected = $h; -$h++; - -dol_fiche_head($head, $hselected, "Distributeurs"); - -print ''; - -print ''; -print '
'; - -print ''; -print ''; -print ''; - -$sql = "SELECT d.nom, d.rowid, d.avance_pourcent, d.rem_pour_prev, d.rem_pour_autr, d.avance_duree"; - -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_distributeur as d"; -if ($user->distributeur_id) -{ - $sql .= " WHERE d.rowid = ".$user->distributeur_id; -} -$sql .= " ORDER BY d.rowid ASC"; - -$resql = $db->query($sql); - -if ($resql) -{ - $num = $db->num_rows(); - $i = 0; - $total = 0; - - while ($i < $num) - { - $row = $db->fetch_row($i); - - $var=!$var; - - print ""; - - print ''; - - print ''; - $i++; - } - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} -print '
Distributeur
'.$row[0].'

'; - -print '
 
'; - -/* ************************************************************************** */ -/* */ -/* Barre d'action */ -/* */ -/* ************************************************************************** */ - -print "\n
\n"; - -if ($_GET["action"] == '' && $user->admin) -{ - print "".$langs->trans("Nouveau").""; -} - -print "

"; - - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/distributeurs/po.php b/htdocs/telephonie/distributeurs/po.php deleted file mode 100644 index 133b6c4295d..00000000000 --- a/htdocs/telephonie/distributeurs/po.php +++ /dev/null @@ -1,166 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if ($user->distributeur_id && $user->responsable_distributeur_id == 0) -{ - accessforbidden(); -} - -if ($user->distributeur_id) -{ - $_GET["id"] = $user->distributeur_id; -} - -llxHeader(); - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; -$sortfield = $_GET["sortfield"]; -if ($sortorder == "") $sortorder="DESC"; -if ($sortfield == "") $sortfield="p.datepo"; - -/* - * - * - */ - -if ($_GET["id"]) -{ - $h = 0; - $distri = new DistributeurTelephonie($db); - $distri->fetch($_GET["id"]); - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/distributeur.php?id='.$distri->id; - $head[$h][1] = $distri->nom; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/contrat.php?id='.$distri->id; - $head[$h][1] = "Contrat"; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/remuneration.php?id='.$distri->id; - $head[$h][1] = "Rémunérations"; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/po.php?id='.$distri->id; - $head[$h][1] = "Prises d'ordre"; - $hselected = $h; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/stats.php?id='.$distri->id; - $head[$h][1] = "Statistiques"; - $h++; - - dol_fiche_head($head, $hselected, "Distributeur"); - - if ($page == -1) { $page = 0 ; } - - $offset = $conf->liste_limit * $page ; - $pageprev = $page - 1; - $pagenext = $page + 1; - - /* - * Mode Liste - * - */ - - $sql = "SELECT s.rowid as socid, s.nom, p.fk_contrat, p.montant, p.avance_duree, p.avance_pourcent"; - $sql .= ", p.rem_pour_prev, p.rem_pour_autr, p.mode_paiement"; - $sql .= " , ".$db->pdate("p.datepo") . " as datepo"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat_priseordre as p"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_contrat as c"; - $sql .= " , ".MAIN_DB_PREFIX."societe as s"; - - $sql .= " WHERE p.fk_distributeur =".$distri->id; - $sql .= " AND c.fk_soc = s.rowid"; - $sql .= " AND p.fk_contrat = c.rowid"; - $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); - - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - $url_opt = "&id=".$_GET["id"]; - print_barre_liste("Prises d'ordre", $page, "po.php", $url_opt, $sortfield, $sortorder, '', $num); - - print ''; - print ''; - print_liste_field_titre("Client","po.php","s.nom","","&id=".$_GET["id"]); - print_liste_field_titre("Contrat","po.php","p.fk_contrat","","&id=".$_GET["id"]); - print ''; - print ''; - print ''; - print ''; - print "\n"; - - $var=True; - - while ($i < min($num,$conf->liste_limit)) - { - $obj = $db->fetch_object($resql); - $var=!$var; - - print ""; - - print '\n"; - print '\n"; - print '\n"; - - print '\n"; - - print '\n"; - print '\n"; - if ($obj->mode_paiement == 'pre') - { - print '\n"; - print ''; - } - else - { - print '\n"; - print ''; - } - - - print "\n"; - $i++; - } - print "
DateMontantAvance DuréeAvance %Rem %MdP
'; - print img_file(); - print ' '; - - print ''.$obj->nom."'.$obj->fk_contrat."'.strftime("%e %b %Y",$obj->datepo)."'.sprintf("%01.2f",$obj->montant)."'.$obj->avance_duree."'.$obj->avance_pourcent." %'.$obj->rem_pour_prev." %Prelev'.$obj->rem_pour_autr." %Autre
"; - $db->free(); - } - else - { - print $db->error() . ' ' . $sql; - } - -} - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/distributeurs/pre.inc.php b/htdocs/telephonie/distributeurs/pre.inc.php deleted file mode 100644 index b37985a4ab6..00000000000 --- a/htdocs/telephonie/distributeurs/pre.inc.php +++ /dev/null @@ -1,134 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("../../main.inc.php"); - -$user->getrights('telephonie'); -$user->distributeur_id = 0; -require DOL_DOCUMENT_ROOT.'/telephonie/distributeurtel.class.php'; -require DOL_DOCUMENT_ROOT.'/telephonie/telephonie.commercial.class.php'; - -$sql = "SELECT fk_distributeur"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_distributeur_commerciaux"; -$sql .= " WHERE fk_user=".$user->id; - -$resql = $db->query($sql); -if ($resql) -{ - $row = $db->fetch_row($resql); - $user->distributeur_id = $row[0]; -} - -$sql = "SELECT fk_distributeur"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_distributeur_responsable"; -$sql .= " WHERE fk_user=".$user->id; - -$resql = $db->query($sql); -if ($resql) -{ - $row = $db->fetch_row($resql); - $user->responsable_distributeur_id = $row[0]; -} - -function llxHeader($head = "", $title="") { - global $user, $conf, $db; - - /* - * - * - */ - top_menu($head, $title); - - $menu = new Menu(); - - $menu->add(DOL_URL_ROOT."/telephonie/index.php", "Telephonie"); - - $menu->add(DOL_URL_ROOT."/telephonie/client/index.php", "Clients"); - - $menu->add(DOL_URL_ROOT."/telephonie/contrat/", "Contrats"); - - $menu->add(DOL_URL_ROOT."/telephonie/ligne/index.php", "Lignes"); - - if ($user->rights->telephonie->ligne_commander) - $menu->add(DOL_URL_ROOT."/telephonie/ligne/commande/", "Commandes"); - - if ($user->rights->telephonie->facture->lire) - $menu->add(DOL_URL_ROOT."/telephonie/facture/", "Factures"); - - if ($user->rights->telephonie->stats->lire) - { - $menu->add(DOL_URL_ROOT."/telephonie/stats/", "Statistiques"); - $menu->add_submenu(DOL_URL_ROOT."/telephonie/stats/distributeurs/", "Distributeurs"); - } - - $menu->add(DOL_URL_ROOT."/telephonie/tarifs/", "Tarifs"); - - $menu->add(DOL_URL_ROOT."/telephonie/distributeurs/", "Distributeurs"); - - - $sql = "SELECT d.nom, d.rowid"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_distributeur as d"; - - if ($user->distributeur_id) - { - $sql .= " WHERE d.rowid = ".$user->distributeur_id; - } - - $sql .= " ORDER BY d.nom ASC"; - - $resql = $db->query($sql); - - if ($resql) - { - $num = $db->num_rows(); - $i = 0; - $total = 0; - - while ($i < $num) - { - $row = $db->fetch_row($resql); - - $texte = $row[0]; - - if (strlen($texte) > 15) - { - $texte = substr($texte,0,12)."..."; - } - - $menu->add_submenu(DOL_URL_ROOT.'/telephonie/distributeurs/distributeur.php?id='.$row[1], $texte); - - $i++; - } - } - - if ($user->rights->telephonie->fournisseur->lire) - $menu->add(DOL_URL_ROOT."/telephonie/fournisseur/index.php", "Fournisseurs"); - - if ($user->rights->telephonie->service->lire) - $menu->add(DOL_URL_ROOT."/telephonie/service/", "Services"); - - if ($user->rights->telephonie->ca->lire) - $menu->add(DOL_URL_ROOT."/telephonie/ca/", "Chiffre d'affaire"); - - left_menu($menu->liste); -} - -?> diff --git a/htdocs/telephonie/distributeurs/remav.php b/htdocs/telephonie/distributeurs/remav.php deleted file mode 100644 index 38aeeff7c75..00000000000 --- a/htdocs/telephonie/distributeurs/remav.php +++ /dev/null @@ -1,201 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if ($user->distributeur_id) -{ - $_GET["id"] = $user->distributeur_id; -} - -llxHeader(); - - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; -$sortfield = $_GET["sortfield"]; -if ($sortorder == "") $sortorder="DESC"; -if ($sortfield == "") $sortfield="p.datepo"; - -/* - * - * - */ - -if ($_GET["id"]) -{ - $h = 0; - $distri = new DistributeurTelephonie($db); - $distri->fetch($_GET["id"]); - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/distributeur.php?id='.$distri->id; - $head[$h][1] = $distri->nom; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/contrat.php?id='.$distri->id; - $head[$h][1] = "Contrat"; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/commissions.php?id='.$distri->id; - $head[$h][1] = "Rémunérations"; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/remav.php?id='.$distri->id; - $head[$h][1] = "Rém. avance"; - $hselected = $h; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/remconso.php?id='.$distri->id; - $head[$h][1] = "Rém. conso"; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/po.php?id='.$distri->id; - $head[$h][1] = "Prises d'ordre"; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/stats.php?id='.$distri->id; - $head[$h][1] = "Statistiques"; - $h++; - - dol_fiche_head($head, $hselected, "Distributeur"); - - print ''; - print '
'; - - if ($page == -1) { $page = 0 ; } - - $offset = $conf->liste_limit * $page ; - $pageprev = $page - 1; - $pagenext = $page + 1; - - /* - * Mode Liste - * - */ - - if ($_GET["month"] > 0) - { - $datetime = mktime(12,12,12,substr($_GET["month"], -2), 1 , substr($_GET["month"],0,4)); - } - else - { - $datetime = time(); - } - - $month = substr("00".strftime("%m", $datetime), -2); - $year = strftime("%Y", $datetime); - $mois = strftime("%B %Y", $datetime); - - $sql = "SELECT s.rowid as socid, s.nom, a.fk_contrat, sum(a.montant) as montant"; - - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_commission_avance as a"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_contrat as c"; - $sql .= " , ".MAIN_DB_PREFIX."societe as s"; - - $sql .= " WHERE a.fk_distributeur =".$distri->id; - $sql .= " AND a.fk_contrat = c.rowid"; - $sql .= " AND c.fk_soc = s.rowid"; - $sql .= " AND a.date ='".$year.$month."'"; - $sql .= " GROUP BY s.rowid"; - $sql .= " ORDER BY s.nom ASC"; - - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - - print_barre_liste("Rémunération sur avance pour $mois", $page, "po.php", "", $sortfield, $sortorder, '', $num); - - print ''; - print ''; - print ''; - print "\n"; - - $var=True; - - while ($i < min($num,$conf->liste_limit)) - { - $obj = $db->fetch_object($resql); - $var=!$var; - - print ""; - print '\n"; - print '\n"; - print "\n"; - $i++; - } - print "
ClientMontant
'; - print img_file(); - print ' '; - print ''.$obj->nom."'.sprintf("%01.2f",$obj->montant)."
"; - $db->free(); - } - else - { - print $db->error() . ' ' . $sql; - } - - - print '
'; - - - $sql = "SELECT distinct(a.date)"; - - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_commission_avance as a"; - $sql .= " ORDER BY a.date DESC"; - - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - print ''; - print ''; - print "\n"; - - $var=True; - - while ( $obj = $db->fetch_object($resql)) - { - $var=!$var; - - print "\n"; - print "\n"; - } - print "
Mois
"; - print ''.$obj->date."
"; - $db->free(); - } - else - { - print $db->error() . ' ' . $sql; - } - - - print '
'; -} - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/distributeurs/remconso.php b/htdocs/telephonie/distributeurs/remconso.php deleted file mode 100644 index 1b500690d76..00000000000 --- a/htdocs/telephonie/distributeurs/remconso.php +++ /dev/null @@ -1,203 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if ($user->distributeur_id) -{ - $_GET["id"] = $user->distributeur_id; -} - -llxHeader(); - - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; -$sortfield = $_GET["sortfield"]; -if ($sortorder == "") $sortorder="DESC"; -if ($sortfield == "") $sortfield="p.datepo"; - -/* - * - * - */ - -if ($_GET["id"]) -{ - $h = 0; - $distri = new DistributeurTelephonie($db); - $distri->fetch($_GET["id"]); - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/distributeur.php?id='.$distri->id; - $head[$h][1] = $distri->nom; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/contrat.php?id='.$distri->id; - $head[$h][1] = "Contrat"; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/commissions.php?id='.$distri->id; - $head[$h][1] = "Rémunérations"; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/remav.php?id='.$distri->id; - $head[$h][1] = "Rém. avance"; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/remconso.php?id='.$distri->id; - $head[$h][1] = "Rém. conso"; - $hselected = $h; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/po.php?id='.$distri->id; - $head[$h][1] = "Prises d'ordre"; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/stats.php?id='.$distri->id; - $head[$h][1] = "Statistiques"; - $h++; - - dol_fiche_head($head, $hselected, "Distributeur"); - - print ''; - print '
'; - - if ($page == -1) { $page = 0 ; } - - $offset = $conf->liste_limit * $page ; - $pageprev = $page - 1; - $pagenext = $page + 1; - - /* - * Mode Liste - * - */ - - if ($_GET["month"] > 0) - { - $datetime = mktime(12,12,12,substr($_GET["month"], -2), 1 , substr($_GET["month"],0,4)); - } - else - { - $datetime = time(); - } - - $month = substr("00".strftime("%m", $datetime), -2); - $year = strftime("%Y", $datetime); - $mois = strftime("%B %Y", $datetime); - - $sql = "SELECT s.rowid as socid, s.nom, a.fk_contrat, sum(a.montant) as montant"; - - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_commission_conso as a"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_contrat as c"; - $sql .= " , ".MAIN_DB_PREFIX."societe as s"; - - $sql .= " WHERE a.fk_distributeur =".$distri->id; - $sql .= " AND a.fk_contrat = c.rowid"; - $sql .= " AND c.fk_soc = s.rowid"; - $sql .= " AND a.date ='".$year.$month."'"; - $sql .= " AND a.avance = 0"; - $sql .= " GROUP BY s.rowid"; - $sql .= " ORDER BY s.nom ASC"; - - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - - print_barre_liste("Rémunération sur consommations pour $mois", $page, "po.php", "", $sortfield, $sortorder, '', $num); - - print ''; - print ''; - print ''; - print "\n"; - - $var=True; - - while ($i < min($num,$conf->liste_limit)) - { - $obj = $db->fetch_object($resql); - $var=!$var; - - print ""; - print '\n"; - print '\n"; - print "\n"; - $i++; - } - print "
ClientMontant
'; - print img_file(); - print ' '; - print ''.$obj->nom."'.sprintf("%01.2f",$obj->montant)."
"; - $db->free(); - } - else - { - print $db->error() . ' ' . $sql; - } - - - print '
'; - - - $sql = "SELECT distinct(a.date)"; - - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_commission_conso as a"; - $sql .= " WHERE a.avance = 0"; - $sql .= " ORDER BY a.date DESC"; - - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - print ''; - print ''; - print "\n"; - - $var=True; - - while ( $obj = $db->fetch_object($resql)) - { - $var=!$var; - - print "\n"; - print "\n"; - } - print "
Mois
"; - print ''.$obj->date."
"; - $db->free(); - } - else - { - print $db->error() . ' ' . $sql; - } - - - print '
'; -} - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/distributeurs/remuneration.php b/htdocs/telephonie/distributeurs/remuneration.php deleted file mode 100644 index 1e98aadf0bf..00000000000 --- a/htdocs/telephonie/distributeurs/remuneration.php +++ /dev/null @@ -1,308 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if ($user->distributeur_id && $user->responsable_distributeur_id == 0) -{ - accessforbidden(); -} - -if ($user->distributeur_id) -{ - $_GET["id"] = $user->distributeur_id; -} - -llxHeader(); - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; -$sortfield = $_GET["sortfield"]; -if ($sortorder == "") $sortorder="DESC"; -if ($sortfield == "") $sortfield="p.datepo"; - -/* - * - * - */ - -if ($_GET["id"]) -{ - $h = 0; - $distri = new DistributeurTelephonie($db); - $distri->fetch($_GET["id"]); - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/distributeur.php?id='.$distri->id; - $head[$h][1] = $distri->nom; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/contrat.php?id='.$distri->id; - $head[$h][1] = "Contrat"; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/remuneration.php?id='.$distri->id; - $head[$h][1] = "Rémunérations"; - $hselected = $h; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/po.php?id='.$distri->id; - $head[$h][1] = "Prises d'ordre"; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/stats.php?id='.$distri->id; - $head[$h][1] = "Statistiques"; - $h++; - - dol_fiche_head($head, $hselected, "Distributeur"); - - print ''; - print '
'; - - if ($page == -1) { $page = 0 ; } - - $offset = $conf->liste_limit * $page ; - $pageprev = $page - 1; - $pagenext = $page + 1; - - /* - * Mode Liste - * - */ - - if ($_GET["month"] > 0) - { - $datetime = mktime(12,12,12,substr($_GET["month"], -2), 1 , substr($_GET["month"],0,4)); - $month = substr("00".strftime("%m", $datetime), -2); - $year = strftime("%Y", $datetime); - $monthprev = $month; - $yearprev = $year; - } - else - { - $datetime = time(); - $month = substr("00".strftime("%m", $datetime), -2); - $year = strftime("%Y", $datetime); - - if ($month == 1) - { - $monthprev = "12"; - $yearprev = $year - 1; - } - else - { - $monthprev = substr("00".($month - 1), -2) ; - $yearprev = $year; - } - } - - $mois = strftime("%B %Y", mktime(12,0,0,$monthprev,1,$yearprev)); - - - $sql = "SELECT s.rowid as socid, s.nom, a.fk_contrat, c.statut, sum(a.montant) as montant"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_commission_avance as a"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_contrat as c"; - $sql .= " , ".MAIN_DB_PREFIX."societe as s"; - - $sql .= " WHERE a.fk_distributeur =".$distri->id; - $sql .= " AND a.fk_contrat = c.rowid"; - $sql .= " AND c.fk_soc = s.rowid"; - $sql .= " AND a.date ='".$yearprev.$monthprev."'"; - $sql .= " GROUP BY s.rowid"; - $sql .= " ORDER BY s.nom ASC"; - - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - - print_barre_liste("Rémunération sur prise d'ordre pour $mois", $page, "po.php", "", $sortfield, $sortorder, '', $num); - - print ''; - print ''; - print ''; - print "\n"; - $total = 0; - $var=True; - - while ($i < min($num,$conf->liste_limit)) - { - $obj = $db->fetch_object($resql); - print ""; - print '\n"; - print '\n"; - print "\n"; - $total += $obj->montant; - $i++; - $var=!$var; - } - print "\n"; - print ''; - print '\n"; - print "\n
ClientMontant
'; - print img_file(); - print ' '; - print ' '; - print ''.$obj->nom."'.sprintf("%01.2f",$obj->montant)."
Total'.sprintf("%01.2f",$total)."
\n"; - $db->free(); - } - else - { - print $db->error() . ' ' . $sql; - } - - - print '
'; - - print_barre_liste("Rémunération sur CA pour $mois", $page, "po.php", "", $sortfield, $sortorder, '', $num); - - print ''; - print ''; - print ''; - print "\n"; - - $total = 0; - - $sql = "SELECT s.rowid as socid, s.nom, a.fk_contrat,c.statut,sum(a.montant) as montant"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_commission_regul as a"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_contrat as c"; - $sql .= " , ".MAIN_DB_PREFIX."societe as s"; - - $sql .= " WHERE a.fk_distributeur =".$distri->id; - $sql .= " AND a.fk_contrat = c.rowid"; - $sql .= " AND c.fk_soc = s.rowid"; - $sql .= " AND a.date ='".$yearprev.$monthprev."'"; - - $sql .= " GROUP BY s.rowid"; - $sql .= " ORDER BY s.nom ASC"; - - $resql = $db->query($sql); - - if ($resql) - { - while ($obj = $db->fetch_object($resql)) - { - print ""; - print '\n"; - print '\n"; - print "\n"; - $var=!$var; - $total += $obj->montant; - } - } - - $sql = "SELECT s.rowid as socid, s.nom, a.fk_contrat, sum(a.montant) as montant, c.statut"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_commission_conso as a"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_contrat as c"; - $sql .= " , ".MAIN_DB_PREFIX."societe as s"; - - $sql .= " WHERE a.fk_distributeur =".$distri->id; - $sql .= " AND a.fk_contrat = c.rowid"; - $sql .= " AND c.fk_soc = s.rowid"; - $sql .= " AND a.date ='".$yearprev.$monthprev."'"; - $sql .= " AND a.avance = 0"; - $sql .= " GROUP BY s.rowid"; - $sql .= " ORDER BY s.nom ASC"; - - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - - while ($i < $num) - { - $obj = $db->fetch_object($resql); - - print ""; - print '\n"; - print '\n"; - print "\n"; - $total += $obj->montant; - $var=!$var; - $i++; - } - print "\n"; - print ''; - print '\n"; - print "\n"; - $db->free(); - } - else - { - print $db->error() . ' ' . $sql; - } - print "
ClientMontant
'; - print img_file(); - print ' '; - print ' '; - print ''.$obj->nom."'.sprintf("%01.2f",$obj->montant)."
'; - print img_file(); - print ' '; - print ' '; - print ''.$obj->nom."'.sprintf("%01.2f",$obj->montant)."
Total'.sprintf("%01.2f",$total)."
\n"; - - - print '
'; - - print_barre_liste("Curseur", $page, "po.php", "", $sortfield, $sortorder, '', $num); - - $sql = "SELECT distinct(a.date)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_commission as a"; - $sql .= " WHERE a.fk_distributeur =".$distri->id; - $sql .= " ORDER BY a.date DESC"; - - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - print ''; - print ''; - print "\n"; - - $var=True; - - while ( $obj = $db->fetch_object($resql)) - { - $var=!$var; - - print "\n"; - print "\n"; - } - print "
Mois
"; - print ''.$obj->date."
"; - $db->free(); - } - else - { - print $db->error() . ' ' . $sql; - } - - - print '
'; -} - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/distributeurs/stats.php b/htdocs/telephonie/distributeurs/stats.php deleted file mode 100644 index 15c7b72fe99..00000000000 --- a/htdocs/telephonie/distributeurs/stats.php +++ /dev/null @@ -1,131 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if ($user->distributeur_id && $user->responsable_distributeur_id == 0) -{ - accessforbidden(); -} - -if (!$user->rights->telephonie->lire) accessforbidden(); - -llxHeader('','Telephonie - Statistiques - Distributeur'); - -if ($user->distributeur_id) -{ - $_GET["id"] = $user->distributeur_id; -} - -/* - * - * - * - */ - -if ($_GET["id"]) -{ - $distri = new DistributeurTelephonie($db); - $distri->fetch($_GET["id"]); - - $h = 0; - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/distributeur.php?id='.$distri->id; - $head[$h][1] = $distri->nom; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/contrat.php?id='.$distri->id; - $head[$h][1] = "Contrat"; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/remuneration.php?id='.$distri->id; - $head[$h][1] = "Rémunérations"; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/po.php?id='.$distri->id; - $head[$h][1] = "Prises d'ordre"; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/stats.php?id='.$distri->id; - $head[$h][1] = "Statistiques"; - $hselected = $h; - $h++; - - dol_fiche_head($head, $hselected, "Distributeur"); - - print ''; - - print ''; - print '
'; - - print ''; - print ''; - print ''; - - $sql = "SELECT sum(p.montant), date_format(datepo, '%m-%Y')"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat_priseordre as p"; - - $sql .= " WHERE p.fk_distributeur = ".$_GET["id"]; - $sql .= " GROUP BY date_format(p.datepo, '%Y%m') DESC"; - - $resql = $db->query($sql); - - if ($resql) - { - $num = $db->num_rows(); - $i = 0; - $total = 0; - - while ($i < $num) - { - $row = $db->fetch_row($i); - - $var=!$var; - - print ""; - - print ''; - - print ''; - $i++; - } - $db->free(); - } - else - { - print $db->error() . ' ' . $sql; - } - print '
MoisPrise d\'ordre
'.$row[1].''.price($row[0]).'

'; - - - print '
'; - - print 'Prise d\'ordre

'."\n"; - - print 'Nouveaux clients

'."\n"; - - - print '
'; - - $db->close(); -} - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/distributeurtel.class.php b/htdocs/telephonie/distributeurtel.class.php deleted file mode 100644 index 9f7e8d00614..00000000000 --- a/htdocs/telephonie/distributeurtel.class.php +++ /dev/null @@ -1,193 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -class DistributeurTelephonie { - var $db; - var $id; - - /** - * Créateur - * - * - */ - function DistributeurTelephonie($DB, $id=0) - { - $this->db = $DB; - $this->id = $id; - - return 0; - } - /** - * - * - */ - function create() - { - $error = 0; - - if (strlen(trim($this->nom)) == 0) - { - $this->error_string["nom"] = "Valeur manquante"; - $error++; - } - if (strlen(trim($this->avance)) == 0) - { - $this->error_string["avance"] = "Valeur manquante"; - $error++; - } - if ($this->avance > 100 or $this->avance < 0) - { - $this->error_string["avance"] = "Valeur incohérente"; - $error++; - } - - - - if (!is_numeric($this->duree)) - { - $this->error_string["duree"] = "Mauvais format"; - $error++; - } - if ($this->duree > 12 or $this->duree < 0) - { - $this->error_string["duree"] = "Valeur incohérente"; - $error++; - } - if (strlen(trim($this->duree)) == 0) - { - $this->error_string["duree"] = "Valeur manquante"; - $error++; - } - - - if ($this->prelev > 100 or $this->prelev < 0) - { - $this->error_string["prelev"] = "Valeur incohérente"; - $error++; - } - if (!is_numeric($this->prelev)) - { - $this->error_string["prelev"] = "Mauvais format"; - $error++; - } - if (strlen(trim($this->prelev)) == 0) - { - $this->error_string["prelev"] = "Valeur manquante"; - $error++; - } - - - if ($this->autre > 100 or $this->autre < 0) - { - $this->error_string["autre"] = "Valeur incohérente"; - $error++; - } - if (!is_numeric($this->autre)) - { - $this->error_string["autre"] = "Mauvais format"; - $error++; - } - if (strlen(trim($this->autre)) == 0) - { - $this->error_string["autre"] = "Valeur manquante"; - $error++; - } - - - if ($error == 0) - { - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_distributeur "; - $sql .= " (grille_tarif, nom, avance_pourcent, avance_duree, rem_pour_prev, rem_pour_autr)"; - - $sql .= " VALUES (2,'".trim($this->nom)."'"; - $sql .= " ,".$this->avance; - $sql .= " ,".$this->duree; - $sql .= " ,".$this->prelev; - $sql .= " ,".$this->autre.")"; - - if ($this->db->query($sql)) - { - - } - else - { - dol_syslog("DistributeurTelephonie::Create"); - $this->error_string["prelev"] = "Erreur SQL : $sql"; - $this->error_string["autre"] = $this->db->error(); - $error++; - } - } - else - { - - } - - return $error; - - } - - /** - * - * - */ - function fetch($id) - { - $this->id = $id; - - $sql = "SELECT d.rowid, d.nom"; - $sql .= " , d.avance_pourcent"; - $sql .= " , d.rem_pour_prev, d.rem_pour_autr"; - - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_distributeur as d"; - $sql .= " WHERE d.rowid = ".$this->id; - - if ($this->db->query($sql)) - { - if ($this->db->num_rows()) - { - $obj = $this->db->fetch_object(0); - - $this->nom = stripslashes($obj->nom); - $this->remun_avance = $obj->remun_avance; - - $this->remun_pourcent_prev = $obj->remun_pourcent_prev; - $this->remun_pourcent_autr = $obj->remun_pourcent_autr; - - return 0; - } - else - { - dol_syslog("DistributeurTelephonie::Fetch Erreur id=".$this->id); - return -1; - } - } - else - { - dol_syslog("DistributeurTelephonie::Fetch Erreur SQL id=".$this->id); - return -2; - } - } - - -} -?> diff --git a/htdocs/telephonie/dolibarrmail.class.php b/htdocs/telephonie/dolibarrmail.class.php deleted file mode 100644 index 98e4ac3a560..00000000000 --- a/htdocs/telephonie/dolibarrmail.class.php +++ /dev/null @@ -1,292 +0,0 @@ - - * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2004-2005 Laurent Destailleur - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * or see http://www.gnu.org/ - * - * $Id$ - * $Source$ - * - * Lots of code inspired from Dan Potter's CMailFile class - */ - -/** - \file htdocs/telephonie/dolibarrmail.class.php - \brief Classe permettant d'envoyer des mail avec attachements, reecriture de CMailFile - \author Dan Potter. - \author Eric Seigne - \author Rodolphe Quiedeville - \author Laurent Destailleur. - \version $Revision$ -*/ - -/** - \class DolibarrMail - \brief Classe permettant d'envoyer des attachements par mail - \deprecated Utiliser CMailFile a la place car plus fiable et plus performant -*/ - -class DolibarrMail -{ - var $subject; - var $addr_to; - var $addr_cc; - var $addr_bcc; - var $text_body; - var $text_encoded; - var $mime_headers; - var $boundary; - var $smtp_headers; - - /** - \brief DolibarrMail - \param subject - \param to - \param from - \param msg - */ - - function DolibarrMail($subject, $to, $from, $msg) - { - $this->subject = $subject; - $this->addr_to = $to; - $this->from = $from; - - $this->message = wordwrap($msg, 78); - - $this->errors_to = $from; - - $this->boundary = md5( uniqid("dolibarr") ); - - $this->addr_bcc = ""; - $this->addr_cc = ""; - $this->reply_to = ""; - - $this->filename_list = array(); - } - - /** - \brief PrepareFile - \param filename_list - \param mimetype_list - \param mimefilename_list - */ - - function PrepareFile($filename_list, $mimetype_list, $mimefilename_list) - { - $this->filename_list = $filename_list; - - $this->mime_headers=""; - - if (count($filename_list)) - { - $this->mime_headers = $this->write_mimeheaders($filename_list, $mimefilename_list); - - $this->text_encoded = $this->attach_file($filename_list, - $mimetype_list, - $mimefilename_list); - } - } - - /** - \brief permet d'attacher un fichier - \param filename_list - \param mimetype_list - \param mimefilename_list - */ - - function attach_file($filename_list,$mimetype_list,$mimefilename_list) - { - for ($i = 0; $i < count($filename_list); $i++) - { - $encoded = $this->encode_file($filename_list[$i]); - - if ($mimefilename_list[$i]) - { - $filename_list[$i] = $mimefilename_list[$i]; - } - - $out = $out . "--".$this->boundary . "\n"; - - if (! $mimetype_list[$i]) - { - $mimetype_list[$i] = "application/octet-stream"; - } - - $out .= "Content-Type: " . $mimetype_list[$i]."\n"; - $out .= ' name="'.$filename_list[$i].'"'."\n"; - $out .= "Content-Transfer-Encoding: base64\n"; - $out .= "Content-Disposition: inline;\n"; - $out .= " filename=\"".$filename_list[$i]."\"\n\n"; - $out .= $encoded . "\n"; - } - $out = $out . "--".$this->boundary . "\n"; - - return $out; - // added -- to notify email client attachment is done - } - - /** - \brief Permet d'encoder un fichier - \param sourcefile - */ - - function encode_file($sourcefile) - { - if (is_readable($sourcefile)) - { - $fd = fopen($sourcefile, "r"); - $contents = fread($fd, filesize($sourcefile)); - $encoded = chunk_split(base64_encode($contents)); - fclose($fd); - } - else - { - dol_syslog("DolibarrMail::encode_file Erreur"); - } - return $encoded; - } - - /** - \brief Envoi le mail - \return boolean vrai si mail envoyé, faux sinon - */ - - function sendfile() - { - - $this->smtp_headers = $this->write_smtpheaders(); - - $this->text_body = $this->write_body(); - - $headers = $this->smtp_headers . $this->mime_headers; - $message_comp = $this->text_body . $this->text_encoded; - - if ($this->errors_to) - { - //dol_syslog("DolibarrMail::sendfile with errorsto : ".$this->errors_to); - $res = mail($this->addr_to,$this->subject,stripslashes($message_comp),$headers,"-f".$this->errors_to); - } - else - { - //dol_syslog("DolibarrMail::sendfile without errorsto"); - $res = mail($this->addr_to,$this->subject,stripslashes($message_comp),$headers); - } - - $this->write_to_file(); - - return $res; - } - - /** - * \brief Ecrit le mail dans un fichier - * Utilisation pour le debuggage - */ - function write_to_file() - { - $this->smtp_headers = $this->write_smtpheaders(); - - $this->text_body = $this->write_body(); - - $headers = $this->smtp_headers . $this->mime_headers; - $message_comp = $this->text_body . $this->text_encoded; - - $fp = fopen("/tmp/mail","w"); - fputs($fp, $headers); - fputs($fp, $message_comp); - fclose($fp); - } - - /** - \brief Permet d'ecrire le corps du message - */ - - function write_body() - { - $out = "\n"; - if (count($this->filename_list)) - { - $out = $out . "--".$this->boundary . "\n"; - $out = $out . 'Content-Type: text/plain; charset="iso-8859-15"'."\n"; - $out .= "Content-Transfer-Encoding: 8bit\n\n"; - } - else - { - //dol_syslog("DolibarrMail::write_body"); - } - - $out = $out . $this->message . "\n\n"; - return $out; - } - - /** - \brief création des headers mime - \param filename_list - \param mimefilename_list - */ - - function write_mimeheaders($filename_list, $mimefilename_list) - { - $out = "MIME-Version: 1.0\n"; - $out = $out . 'Content-type: multipart/mixed; '."\n"; - $out = $out . ' boundary="'.$this->boundary.'"'."\n"; - - // $out = $out . "Content-transfer-encoding: 8BIT\n"; - - for($i = 0; $i < count($filename_list); $i++) - { - if ($mimefilename_list[$i]) - { - $filename_list[$i] = $mimefilename_list[$i]; - } - - //$out = $out . "X-attachments: $filename_list[$i];\n\n"; - } - - return $out; - } - - /** - \brief création des headers smtp - */ - - function write_smtpheaders() - { - $out = "From: $this->from\n"; - - if($this->addr_cc != "") - $out = $out . "Cc: ".$this->addr_cc."\n"; - - if($this->addr_bcc != "") - $out = $out . "BCc: ".$this->addr_bcc."\n"; - - if($this->reply_to != "") - $out = $out . "Reply-To: ".$this->reply_to."\n"; - - // if($this->errors_to != "") - //$out = $out . "Errors-to: ".$this->errors_to."\n"; - - $out = $out . "X-Mailer: Dolibarr version " . DOL_VERSION ."\n"; - $out = $out . "X-Sender: $this->from\n"; - - - return $out; - } - -} - -?> diff --git a/htdocs/telephonie/facturation/FacturationCalcul.class.php b/htdocs/telephonie/facturation/FacturationCalcul.class.php deleted file mode 100644 index 6ad245acb7a..00000000000 --- a/htdocs/telephonie/facturation/FacturationCalcul.class.php +++ /dev/null @@ -1,550 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * - * Script de calcul de la facturation - * - Lit les entrees dans la table import_cdr - * - Verifie que tous les tarifs sont dispos - * - Importe les lignes dans llx_communications_details - * - Calcul la facture telephonique par ligne - */ - -/** - \file htdocs/telephonie/script/facturation-calcul.php - \ingroup telephonie - \brief Calcul des factures - \version $Revision$ -*/ -require_once (DOL_DOCUMENT_ROOT."/societe.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/facturetel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/communication.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/telephonie.tarif.class.php"); - -class FacturationCalcul { - - function FacturationCalcul($dbh) - { - $this->db = $dbh; - $this->messages = array(); - $this->message_bad_file_format = array(); - } - - function Calcul() - { - $error = 0; - $nbcommit = 0; - $datetime = time(); - - $date = strftime("%d%h%Y%Hh%Mm%S",$datetime); - - /* - * On facture les communications du mois precedent - */ - - $month = strftime("%m", $datetime); - $year = strftime("%Y", $datetime); - - if ($month == 1) - { - $month = "12"; - $year = $year - 1; - } - else - { - $month = substr("00".($month - 1), -2) ; - } - - /******************************************************** - * - * Affiche le nombre de comunications a traiter - * - *********************************************************/ - - $sql = "SELECT count(*)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_import_cdr";; - - $resql = $this->db->query($sql); - - if ( $resql ) - { - $num = $this->db->num_rows($resql); - $row = $this->db->fetch_row($resql); - - dol_syslog("FacturationCalcul::Calcul Communications a traiter ".$row[0],LOG_INFO); - $this->db->free($resql); - } - else - { - $error = 1; - dol_syslog("FacturationCalcul Erreur ".$error); - } - - /********************************************************** - * - * - * - ***********************************************************/ - - $sql = "SELECT MAX(rowid) FROM ".MAIN_DB_PREFIX."telephonie_facture"; - - $resql = $this->db->query($sql); - - if ( $resql ) - { - $row = $this->db->fetch_row($resql); - - dol_syslog("FacturationCalcul Max rowid avant facture ".$row[0]); - $this->db->free($resql); - } - else - { - $error = 2; - dol_syslog("FacturationCalcul Erreur ".$error); - } - - /** - * - * Lectures des differentes lignes dans la table d'import - * - */ - - if (!$error) - { - $user = new user($this->db,1); - - $sql = "SELECT distinct(t.fk_ligne)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_import_cdr as t"; - $sql .= " ORDER BY fk_ligne ASC"; - - $lines_keys = array(); - $resql = $this->db->query($sql); - if ( $resql ) - { - $i=0; - while ($row = $this->db->fetch_row($resql)) - { - $lines_keys[$i] = $row[0]; - $i++; - } - $this->db->free($resql); - dol_syslog(sizeof($lines_keys)." lignes trouvees"); - } - else - { - $error = 3; - dol_syslog("FacturationCalcul Erreur ".$error); - } - } - - /********************************************************** - * - * Creation d'un batch de facturation - * - ***********************************************************/ - - if (sizeof($lines_keys) > 0) - { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_facturation_batch"; - $sql .= " (date_batch) VALUES (now())"; - $resql = $this->db->query($sql); - - if ( $resql ) - { - $batch_id = $this->db->last_insert_id(MAIN_DB_PREFIX."telephonie_facturation_batch"); - - dol_syslog("FacturationCalcul Batch ID ".$batch_id); - } - else - { - $error = 20; - dol_syslog("FacturationCalcul Erreur ".$error); - } - } - - /* ***************************************************** */ - /* */ - /* Traitements */ - /* */ - /* */ - /* ***************************************************** */ - - if (!$error) - { - foreach ($lines_keys as $line_key) - { - $error = 0; - $ligne = new LigneTel($this->db); - - if ( $this->db->query("BEGIN") ) - { - if ($ligne->fetch_by_id($line_key) > 0 ) - { - if ($ligne->socid == 0) - { - $error = 4; - dol_syslog("FacturationCalcul Error ($error)"); - } - } - else - { - - $error = 5; - dol_syslog("FacturationCalcul Error ($error): Aucune societe rattachee a la ligne : $line_key"); - } - - - /* - * Recuperation des infos sur la societes - * - */ - if (!$error ) - { - $soc = new Societe($this->db); - if ( $soc->fetch($ligne->socid) ) - { - - } - else - { - $error = 6; - dol_syslog("FacturationCalcul FacturationCalcul Error ($error)"); - } - } - - /* - * - * Creation d'une facture de telephonie si la ligne est facturable - * - */ - - if (!$error) - { - if ($ligne->facturable == 1) - { - $facturable = 'oui'; - } - else - { - $facturable = 'non'; - } - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_facture"; - $sql .= " (fk_ligne, ligne, date, isfacturable, fk_batch, fk_contrat)"; - $sql .= " VALUES (".$ligne->id.","; - $sql .= " '$ligne->numero','".$year."-".$month."-01'"; - $sql .= ", '$facturable',".$batch_id; - $sql .= ", ".$ligne->contrat.")"; - - if ($this->db->query($sql)) - { - $facid = $this->db->last_insert_id(MAIN_DB_PREFIX."telephonie_facture"); - } - else - { - $error++; - dol_syslog("FacturationCalcul Erreur d'insertion dans llx_telephonie_facture"); - dol_syslog($this->db->error()); - dol_syslog($sql); - } - } - /* - * - * Calcul de la facture - * - */ - if (!$error) - { - $total_achat = 0; - $total_vente = 0; - $total_fourn = 0; - - if ($this->CalculateBill($this->db, $ligne, $facid, $total_achat, $total_vente, $total_fourn) <> 0) - { - $error++; - dol_syslog("FacturationCalcul Erreur de calcul de la facture pour la ligne $line_key $ligne->numero"); - array_push($this->messages, array('error',"Erreur de calcul de la facture pour la ligne $ligne->numero (id=$line_key)")); - } - } - - /* - * - * Insertion des donnees dans la base - * - */ - - if (!$error) - { - $total_vente_remise = $total_vente; - - $total_vente_remise = ereg_replace(",",".", $total_vente_remise); - - $gain = ($total_vente_remise - $total_fourn); - - $total_achat = ereg_replace(",",".", $total_achat); - $total_vente = ereg_replace(",",".", $total_vente); - $total_fourn = ereg_replace(",",".", $total_fourn); - - $gain = ereg_replace(",",".", $gain); - - $sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_facture"; - - $sql .= " SET "; - $sql .= " fourn_montant = $total_fourn"; - $sql .= " , cout_achat = $total_achat"; - $sql .= " , cout_vente = $total_vente"; - $sql .= " , remise = $ligne->remise"; - $sql .= " , cout_vente_remise = $total_vente_remise"; - $sql .= " , gain = $gain"; - - $sql .= " WHERE rowid =".$facid; - - if ($this->db->query($sql)) - { - - } - else - { - $error++; - dol_syslog("FacturationCalcul Erreur de mise a jour dans llx_telephonie_facture"); - dol_syslog($this->db->error()); - dol_syslog($sql); - } - } - - /* - * Suppression des donnees de la table d'import - * - */ - - if (!$error) - { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_import_cdr"; - $sql .= " WHERE fk_ligne = $line_key "; - - if (! $this->db->query($sql)) - { - $error++; - dol_syslog("FacturationCalcul Erreur de suppression dans llx_telephonie_import_cdr"); - } - } - - /* - * Commit / Rollback SQL - * - */ - - if (!$error) - { - $this->db->query("COMMIT"); - $nbcommit++; - dol_syslog("FacturationCalcul Ligne $ligne->numero - COMMIT"); - array_push($this->messages, "Facturation ligne ".$ligne->numero." reussie"); - } - else - { - $this->db->query("ROLLBACK"); - dol_syslog("FacturationCalcul Ligne $ligne->numero - ROLLBACK de la transaction"); - } - } - else - { - dol_syslog("FacturationCalcul Erreur ouverture Transaction SQL"); - } - } /* fin de la boucle */ - - /* - * - * - */ - } - - /********************************************************** - * - * - * - ***********************************************************/ - $sql = "SELECT MAX(rowid) FROM ".MAIN_DB_PREFIX."telephonie_facture"; - - $resql = $this->db->query($sql); - - if ( $resql ) - { - $row = $this->db->fetch_row($resql); - - dol_syslog("FacturationCalcul Max rowid après facture ".$row[0]); - $this->db->free($resql); - } - else - { - $error++; - } - - /********************************************************** - * - * - * - ***********************************************************/ - - dol_syslog($nbcommit." facture emises"); - - /********************************************************** - * - * - * - ***********************************************************/ - $sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."telephonie_import_cdr"; - - $resql = $this->db->query($sql); - - if ( $resql ) - { - $row = $this->db->fetch_row($resql); - - dol_syslog($row[0]. " communications restantes dans la table d'import"); - $this->db->free($resql); - } - else - { - $error++; - } - - dol_syslog("FacturationCalcul Fin Batch ID ".$batch_id); - } - /****************************************************************************** - * - * Fonction de calcul de la facture - * - ******************************************************************************/ - - function CalculateBill($db, $ligne, $facture_id, &$total_cout_achat, &$total_cout_vente, &$total_cout_fourn) - { - $error = 0; - - $total = 0; - $nbinter = 0; - $nbmob = 0; - $nbnat = 0; - $duree = 0; - - $tarif_spec = TELEPHONIE_GRILLE_VENTE_DEFAUT_ID ; - - $sql = "SELECT d.grille_tarif"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_distributeur as d"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_distributeur_commerciaux as dc"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; - - $sql .= " WHERE l.rowid = ".$ligne->id; - $sql .= " AND d.rowid = dc.fk_distributeur"; - $sql .= " AND l.fk_commercial_sign = dc.fk_user"; - - $resql = $db->query($sql); - - if ( $resql ) - { - $num_sql = $db->num_rows($resql); - - if ($num_sql > 0) - { - $row = $db->fetch_row($resql); - $tarif_spec = $row[0]; - } - $db->free($resql); - } - - $fournisseur_id = $ligne->fournisseur_id; - - dol_syslog("FacturationCalcul::CalculateBill Utilisation du tarif ".$tarif_spec." pour la ligne ".$ligne->id); - - $tarif_achat = new TelephonieTarif($db, $tarif_spec, "achat", $fournisseur_id); - $tarif_vente = new TelephonieTarif($db, $tarif_spec, "vente", $tarif_spec, $ligne->client_comm_id); - - $comms = array(); - - $sql = "SELECT t.idx, t.fk_ligne, t.ligne, t.montant, t.duree, t.num, t.date, t.heure, t.dest"; - $sql .= " , t.fichier, t.fk_fournisseur"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_import_cdr as t"; - $sql .= " WHERE t.fk_ligne = ".$ligne->id; - - $resql = $db->query($sql); - - if ($resql) - { - $num_sql = $db->num_rows($resql); - $i = 0; - - while ($i < $num_sql && $error == 0) - { - $objp = $db->fetch_object($resql); - - $comm = new CommunicationTelephonique(); - - $comm->index = $objp->idx; - $comm->fk_ligne = $objp->fk_ligne; - $comm->ligne = $objp->ligne; - $comm->date = $objp->date; - $comm->heure = $objp->heure; - $comm->duree = $objp->duree; - $comm->dest = $objp->dest; - $comm->numero = $objp->num; - $comm->montant = $objp->montant; - $comm->fichier_cdr = $objp->fichier; - $comm->fournisseur = $objp->fk_fournisseur; - $comm->facture_id = $facture_id; - - $comms[$i] = $comm; - - $i++; - } - - $db->free($resql); - } - else - { - $error++; - dol_syslog("FacturationCalcul::CalculateBill Erreur dans Calcul() Probleme SQL"); - } - - for ($ii = 0 ; $ii < $num_sql ; $ii++) - { - $comm = $comms[$ii]; - - $error = $error + $comm->cout($tarif_achat, $tarif_vente, $ligne, $db); - - $total_cout_fourn = $total_cout_fourn + $comm->montant; - $total_cout_achat = $total_cout_achat + $comm->cout_achat; - $total_cout_vente = $total_cout_vente + $comm->cout_vente; - - $error = $error + $comm->logsql($db); - - foreach ($comm->messages as $message) - { - array_push($this->messages, $message); - } - } - - - - dol_syslog("FacturationCalcul::CalculateBill return $error", LOG_DEBUG); - return $error; - } - -} -?> diff --git a/htdocs/telephonie/facturation/FacturationEmission.class.php b/htdocs/telephonie/facturation/FacturationEmission.class.php deleted file mode 100644 index 0b0eb73c678..00000000000 --- a/htdocs/telephonie/facturation/FacturationEmission.class.php +++ /dev/null @@ -1,1010 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * - * Script de facturation - * Emets les factures compta en partant des factures téléphonique - * - */ - -/** - \file htdocs/telephonie/script/facturation-emission.php - \ingroup telephonie - \brief Emission des factures - \version $Revision$ -*/ - -require_once (DOL_DOCUMENT_ROOT."/facture.class.php"); -require_once (DOL_DOCUMENT_ROOT."/societe.class.php"); -require_once (DOL_DOCUMENT_ROOT."/paiement.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/dolibarrmail.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/facturetel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/telephonie.contrat.class.php"); - - -class FacturationEmission { - - function FacturationEmission($db, $user) - { - $this->db = $db; - $this->do_validate_facture = 0; - $this->messages = array(); - $this->user = $user; - } - /* - * Compte le nombre de facture a generer - * - */ - function NbFactureToGenerate() - { - $sql = "SELECT count(rowid) FROM ".MAIN_DB_PREFIX."telephonie_facture"; - $sql .= " WHERE fk_facture IS NULL;"; - - $resql = $this->db->query($sql); - - if ( $resql ) - { - $row = $this->db->fetch_row($resql); - - $this->nbfac = $row[0]; - $this->db->free($resql); - $this->error = 0; - } - else - { - $this->error = 1; - dol_syslog("Erreur ".$error); - } - return $this->error; - } - - function Emission() - { - $error = 0; - - $datetime = time(); - $datetimeprev = $datetime; // Date du prélèvement - - $date = strftime("%d%h%Y%Hh%Mm%S",$datetime); - - $month = strftime("%m", $datetime); - $year = strftime("%Y", $datetime); - - if ($month == 1) - { - $month = "12"; - $year = $year - 1; - } - else - { - $month = substr("00".($month - 1), -2) ; - } - - /* - * Lecture du batch - * - */ - - $sql = "SELECT MAX(rowid) FROM ".MAIN_DB_PREFIX."telephonie_facturation_batch"; - - $resql = $this->db->query($sql); - - if ( $resql ) - { - $row = $this->db->fetch_row($resql); - - $batch_id = $row[0]; - - dol_syslog("FacturationEmission::Emission Traitement du batch ".$batch_id); - $this->db->free($resql); - } - else - { - $error = 1; - dol_syslog("FacturationEmission::Emission Erreur ".$error); - } - - /* - * Traitements - * - */ - - if (!$error) - { - /*************************************************************** - * - * Lectures des contrats a traiter - * - * - ***************************************************************/ - - dol_syslog("FacturationEmission::Emission Lecture des contrats",LOG_DEBUG); - - $sql = "SELECT distinct(c.rowid)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture as f"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_contrat as c"; - - $sql .= " WHERE f.fk_facture IS NULL"; - $sql .= " AND f.fk_batch = ".$batch_id; - $sql .= " AND f.isfacturable = 'oui'"; - $sql .= " AND f.fk_ligne = l.rowid "; - $sql .= " AND l.fk_contrat = c.rowid"; - - if (strlen($optcontrat) > 0) - { - $sql .= " AND c.rowid=".$optcontrat; - dol_syslog("Limite sur le contrat : ".$optcontrat); - } - - $contrats = array(); - - $resql = $this->db->query($sql) ; - - if ( $resql ) - { - $i = 0; - while ($row = $this->db->fetch_row($resql)) - { - $contrats[$i] = $row[0]; - $i++; - } - $this->db->free($resql); - } - else - { - $error = 2; - dol_syslog("FacturationEmission::Emission Erreur $error",LOG_ERR); - } - } - /* - * - * - */ - if (!$error) - { - dol_syslog("FacturationEmission::Emission Nombre de contrats à facturer ".sizeof($contrats),LOG_DEBUG); - array_push($this->messages, "Nombre de contrats à facturer : ".sizeof($contrats)); - $xcli = 0; - $xclis = sizeof($contrats); - - foreach ($contrats as $contrat) - { - $xcli++; - - /* Lecture des factures téléphoniques du contrat */ - dol_syslog("FacturationEmission::Emission ".$xcli."/".$xclis." Contrat à facturer id=".$contrat." (".memory_get_usage() .")",LOG_DEBUG); - array_push($this->messages, $xcli."/".$xclis." Contrat à facturer id=".$contrat.",batch=".$batch_id); - $sql = "SELECT f.rowid FROM "; - $sql .= MAIN_DB_PREFIX."telephonie_facture as f"; - $sql .= ",".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_contrat as c"; - $sql .= ",".MAIN_DB_PREFIX."societe as s"; - - $sql .= " WHERE f.fk_batch = ".$batch_id; - $sql .= " AND c.rowid = ".$contrat; - $sql .= " AND l.fk_contrat = c.rowid"; - $sql .= " AND l.rowid = f.fk_ligne"; - $sql .= " AND s.rowid = c.fk_soc_facture "; - $sql .= " AND f.fk_facture IS NULL"; - $sql .= " AND f.isfacturable = 'oui'"; - - $sql .= " ORDER BY l.code_analytique ASC, l.rowid DESC"; - - $numlignes = array(); - $resql = $this->db->query($sql); - if ( $resql ) - { - while ($objp = $this->db->fetch_object($resql)) - { - array_push($numlignes, $objp->rowid); - } - $this->db->free($resql); - - dol_syslog("FacturationEmission::Emission Contrat $contrat, $i factures trouvées à générer", LOG_DEBUG); - array_push($this->messages, "Contrat $contrat, $i factures trouvées à générer"); - - $factures_prev = array(); - $factures_a_mailer = array(); - - if (sizeof($numlignes) > 0) - { - $this->facture_contrat($this->db, $this->user, $contrat, $numlignes, $datetime, $factures_prev, $factures_a_mailer); - } - - if (sizeof($numlignes) > 0) - { - $this->_prelevements($this->db, $this->user, $factures_prev); - } - - if (sizeof($numlignes) > 0) - { - //$this->_emails($this->db, $this->user, $contrat, $factures_a_mailer); - } - } - else - { - $error = 1; - dol_syslog("FacturationEmission::Emission Error ".$error, LOG_ERR); - array_push($this->messages, "Erreur base de donnees"); - } - } - } - } - /** - * - * - * - * - */ - function facture_contrat($db, $user, $contrat_id, $factel_ids, $datetime, &$factures_prev, &$factures_a_mailer) - { - $i = 0; - $error = 0; - - /* Ouverture de la transaction */ - - if (! $db->query("BEGIN") ) - { - $error++; - } - - /* Lecture du contrat */ - - if (!$error) - { - $contrat = new TelephonieContrat($db); - if ( $contrat->fetch($contrat_id) >= 0) - { - - } - else - { - $error++; - dol_syslog("FacturationEmission::facture_contrat Impossible de lire le contrat"); - array_push($this->messages, array('error',"Impossible de lire le contrat : $contrat_id")); - } - } - - /* Lecture de la société */ - - if (!$error) - { - $soc = new Societe($db); - - if ($soc->fetch($contrat->client_facture_id) ) - { - if ($verbose) dol_syslog($soc->nom); - } - else - { - array_push($this->messages, array('error',"Impossible de lire la societe")); - $error = 132; - } - } - - /* Recuperation des infos de factures dans la base - * Creation de la facture - * - */ - if (!$error) - { - if ($verbose) dol_syslog("FacturationEmission::facture_contrat Création facture pour $soc->nom", LOG_DEBUG); - - $fac = new Facture($db, $soc->id); - $cancel_facture = 1; - $fac->date = $datetime; - $fac->cond_reglement_id = 1; - $fac->remise_percent = 0; - - $facid = $fac->create($user); - - if ($facid > 0) - { - - } - else - { - dol_syslog("FacturationEmission::facture_contrat Erreur création objet facture erreur : $facid",LOG_ERR); - array_push($this->messages, array('error',"Erreur création objet facture erreur : $facid")); - $error = 16; - } - } - - /* - * Lecture des différentes lignes rattachées - * - */ - if (!$error) - { - foreach ($factel_ids as $factel_id) - { - /* Lecture de la facture téléphonique */ - - $factel = new FactureTel($db); - if ($factel->fetch($factel_id) == 0) - { - - } - else - { - dol_syslog("FacturationEmission::facture_contrat Erreur lecture facture téléphonique $factel_id"); - array_push($this->messages, array('error',"Erreur lecture facture téléphonique (id=$factel_id)")); - $error = 17; - } - - /* Lecture de la ligne correspondante */ - - $ligne = new LigneTel($db); - if ($ligne->fetch($factel->ligne) == 1) - { - - } - else - { - dol_syslog("ERREUR lecture ligne $factel->ligne"); - $error = 18; - } - - if (!$error && $ligne->facturable) /* Test si on doit facturer ou non la ligne */ - { - $cancel_facture = 0; - - /* Création du lien entre les factures */ - - if ($factel->affect_num_facture_compta($facid) == 0) - { - - } - else - { - $error = 19; - } - - $soca = new Societe($db); - $soca->fetch($ligne->client_id); - - /* Insertion des lignes de factures */ - $libelle = ""; - - if (strlen(trim($ligne->code_analytique)) > 0) - { - $libelle .= "".$ligne->code_analytique." "; - } - - $dm = mktime (1,1,1,strftime("%m",$datetime), -1, strftime("%Y",$datetime)); - - $libelle .= "Communications téléphoniques de la ligne $ligne->numero"; - $libelle .= " mois de ".strftime("%B %Y",$dm); - - if (!$error) - { - $ventil = 0 ; - if (defined("TELEPHONIE_COMPTE_VENTILATION")) - { - if (is_numeric(TELEPHONIE_COMPTE_VENTILATION)) - { - $ventil = TELEPHONIE_COMPTE_VENTILATION; - } - } - - - $result = $fac->addline($facid, - $libelle, - $factel->cout_vente_remise, - 1, - '19.6', - 0, - 0,'','',$ventil); - } - } - - } /* Fin de la boucle des lignes */ - } - - /*********************************/ - /* */ - /* Ajout des services */ - /* */ - /*********************************/ - - if (!$error) - { - $sql = "SELECT s.libelle_facture, sc.montant"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat_service as sc"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_service as s"; - - $sql .= " WHERE sc.fk_contrat = ".$contrat_id; - $sql .= " AND s.rowid = sc.fk_service"; - $sql .= " AND sc.montant > 0"; - - $resql = $db->query($sql) ; - $ventil = 18; - if ( $resql ) - { - $num = $db->num_rows($resql); - $is = 0; - - while ($is < $num) - { - $row = $db->fetch_row($resql); - - $result = $fac->addline($facid, - $row[0], - $row[1], - 1, - '19.6', - 0, - 0, - 0, - '', - $ventil); - - $is++; - } - $db->free($resql); - } - else - { - $error = 20; - dol_syslog("FacturationEmission Erreur $error", LOG_ERR); - } - } - - /*********************************/ - /* */ - /* Ajout rejets de prelevements */ - /* */ - /*********************************/ - if (!$error) - { - $sql = "SELECT pr.rowid,".$db->pdate("pr.date_rejet"); - $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_rejet as pr"; - $sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl"; - $sql .= " WHERE pl.fk_soc = ".$soc->id; - $sql .= " AND pr.fk_prelevement_lignes = pl.rowid"; - $sql .= " AND afacturer = 1 LIMIT 1;"; - $resql = $db->query($sql) ; - $ventil = 10; - if ( $resql ) - { - while ($row = $db->fetch_row($resql)) - { - $result = $fac->addline($facid, - "Frais pour prélèvement rejeté du ".strftime("%d/%m/%Y",$row[1]), - 15, - 1, - '0', - 0, - 0, - 0, - '', - $ventil); - - $sqlu = "UPDATE ".MAIN_DB_PREFIX."prelevement_rejet as pr"; - $sqlu .= " SET afacturer=0"; - $sqlu .= " ,fk_facture=".$facid; - $sqlu .= " WHERE rowid=".$row[0].";"; - - $resqlu = $db->query($sqlu); - } - $db->free($resql); - } - else - { - $error = 21; - dol_syslog($db->error()); - dol_syslog("Erreur rejet prelevement"); - } - } - - /*********************************/ - /* */ - /* Remise exceptionnelle */ - /* */ - /*********************************/ - if (!$error) - { - $remise_exceptionnelle = 0; - - $sql = "SELECT rowid,amount,fk_user"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_client_remise"; - $sql .= " WHERE fk_client = ".$soc->id; - $sql .= " AND fk_facture = 0"; - - $resql = $db->query($sql) ; - if ( $resql ) - { - while ($row = $db->fetch_row($resql)) - { - $remise_id = $row[0]; - $remise_exceptionnelle = $row[1]; - $remise_user = $row[2]; - } - } - else - { - $error = 32; - dol_syslog("Erreur remise exceptionnelle"); - dol_syslog($sql); - } - - //print "remise $remise_exceptionnelle \n"; - //print "total ".$fac->total_ht."\n"; - - if ($remise_exceptionnelle > 0) - { - - // Calcul valeur de remise a appliquer (remise) et reliquat - if ($remise_exceptionnelle > ($fac->total_ht * 0.9)) - { - $remise = floor($fac->total_ht * 0.9); - $reliquat = ($remise_exceptionnelle - $remise); - } - else - { - $remise = $remise_exceptionnelle; - $reliquat=0; - } - - $result_insert = $fac->addline($fac->id, - addslashes('Remise exceptionnelle'), - (0 - $remise), - 1, - '19.6'); - if ($result_insert < 0) - { - $error = 33; - } - - $sql = 'UPDATE '.MAIN_DB_PREFIX.'telephonie_client_remise'; - $sql .= ' SET fk_facture = '.$fac->id; - $sql .= " ,amount = '".ereg_replace(',','.',$remise)."'"; - $sql .= ' WHERE rowid ='.$remise_id; - $sql .= ' AND fk_client ='. $soc->id; - - if (! $db->query( $sql)) - { - $error = 34; - } - - if ($reliquat > 0 && $error == 0) - { - $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'telephonie_client_remise'; - $sql .= ' (fk_client, datec, amount, fk_user) '; - $sql .= ' VALUES '; - $sql .= ' ('.$soc->id; - $sql .= ' ,now()'; - $sql .= " ,'".ereg_replace(',','.',$reliquat)."'"; - $sql .= ' ,'.$remise_user; - $sql .= ')'; - - if (! $db->query( $sql) ) - { - $error = 35; - } - } - } - } - /*********************************/ - /* */ - /* Prestas annexes */ - /* */ - /*********************************/ - if (!$error) - { - $prestas = 0; - - $sql = "SELECT rowid,amount,libelle"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_client_presta"; - $sql .= " WHERE fk_client = ".$soc->id; - $sql .= " AND fk_facture = 0"; - - $resql = $db->query($sql) ; - if ( $resql ) - { - while ($row = $db->fetch_row($resql)) - { - $presta_id[$prestas] = $row[0]; - $presta_amount[$prestas] = $row[1]; - $presta_libelle[$prestas] = $row[2]; - $prestas++; - } - } - else - { - $error = 36; - } - - if ($prestas > 0) - { - $i = 0; - while ($i < $prestas) - { - $result_insert = $fac->addline($fac->id, - addslashes($presta_libelle[$i]), - $presta_amount[$i], - 1, - '19.6'); - if ($result_insert < 0) - { - $error = 37; - } - - $sql = 'UPDATE '.MAIN_DB_PREFIX.'telephonie_client_presta'; - $sql .= ' SET fk_facture = '.$fac->id; - $sql .= ' WHERE rowid ='.$presta_id[$i]; - $sql .= ' AND fk_client ='. $soc->id; - - if (! $db->query( $sql)) - { - $error = 38; - } - $i++; - } - } - } - - - /*********************************/ - /* */ - /* Validation de la facture */ - /* */ - /*********************************/ - if ($this->do_validate_facture) - { - if (!$error && !$cancel_facture) - { - if ($verbose) dol_syslog("Validation de la facture : $facid"); - - $y = substr($year, -1); - $m = substr("00".$month, -2); - - if ( $fac->set_valid($user, $soc) ) - { - $valid_ok = 1; - } - else - { - $valid_ok = 0; - $error = 5; - } - } - } - else - { - $valid_ok = 1; - } - - /**************************************/ - /* */ - /* Factures détaillées */ - /* */ - /**************************************/ - - if (!$error && !$cancel_facture) - { - foreach ($factel_ids as $factel_id) - { - /* Lecture de la facture téléphonique */ - - $factel = new FactureTel($db); - if ($factel->fetch($factel_id) == 0) - { - - } - else - { - dol_syslog("ERREUR lecture facture téléphonique $factel_id"); - $error = 17; - } - - /* Lecture de la ligne correspondante */ - - $ligne = new LigneTel($db); - if ($ligne->fetch($factel->ligne) == 1) - { - - } - else - { - dol_syslog("ERREUR lecture ligne $factel->ligne"); - $error = 18; - } - - /* Facture détaillée standard */ - - if (!$error) - { - $facok = 0; - - // Différents modèles de factures détaillées - - $modele = "standard"; - if (strlen($ligne->pdfdetail) > 0) - { - $modele = $ligne->pdfdetail; - } - - require_once (DOL_DOCUMENT_ROOT."/telephonie/pdf/pdfdetail_".$modele.".modules.php"); - $class = "pdfdetail_".$modele; - - $facdet = new $class($db, $ligne, $year, $month, $factel); - - if ($facdet->write_pdf_file($factel, $factel->ligne) == 0) - { - $facok++; - } - else - { - dol_syslog("FacturationEmission::facture_contrat ERREUR lors de Génération du pdf détaillé ($modele)"); - $error = 19; - } - } - - /* Factures détaillées autres */ - - if (!$error) - { - // Recherche des factures détaillées - // et copie dans le répertoire de la facture - // ID facture telephonique $factel_id - $fdefacid = substr('0000'.$factel_id, -4); - $fdedir = DOL_DATA_ROOT.'/telephonie/facture/'; - - $fdedir .= substr($fdefacid,0,1)."/"; - $fdedir .= substr($fdefacid,1,1)."/"; - $fdedir .= substr($fdefacid,2,1)."/"; - $fdedir .= substr($fdefacid,3,1)."/"; - - $fname = $fdedir . $fdefacid . "-detail.xls"; - - if (file_exists($fname)) - { - $fdefac = new Facture($db,"",$factel->fk_facture); - $fdefac->fetch($factel->fk_facture); - - $dest = FAC_OUTPUTDIR ."/".$fdefac->ref."/".$fdefac->ref."-".$fdefacid."-".$ligne->numero."-detail.xls"; - - copy($fname, $dest); - } - } - } - } - - /*********************************/ - /* */ - /* Creation du pdf de la facture */ - /* */ - /*********************************/ - - if (!$error && !$cancel_facture && $valid_ok == 1) - { - if ($verbose) dol_syslog("Génération du pdf facture : $facid"); - - $fac->fetch($facid); - $fac->fetch_client(); - $fac->client->load_ban(); - - $message = ""; - - if ($fac->client->bank_account->verif() && $ligne->mode_paiement == 'pre') - { - $message .= "Cette facture sera prélevée sur votre compte bancaire numéro : "; - $message .= $fac->client->bank_account->number."\n"; - } - - if ($verbose) dol_syslog("Création du pdf facture : $facid"); - - if (! facture_pdf_create($db, $facid, $message)) - { - $error = 1; - //print "- ERREUR de génération du pdf de la facture\n"; - } - } - - if (!$error && !$cancel_facture) - { - $db->query("COMMIT"); - /* $soc - * $ligne - */ - - if ($contrat->facturable) - { - array_push($factures_a_mailer, $facid); - - if ($soc->verif_rib()) - { - array_push($factures_prev, $facid); - } - else - { - dol_syslog("facture $facid non preleve, RIB incorrect"); - } - } - - if ($verbose) dol_syslog("Commit de la transaction");; - } - else - { - $db->query("ROLLBACK"); - dol_syslog("ROLLBACK de la transaction $error"); - } - } - /** - \brief Emissions des demandes de prelevement - \param db database handler - \param user Object User - \param factures_prev Array factures id - */ - function _prelevements($db, $user, $factures_prev) - { - dol_syslog("FacturationEmission::_prelevements Debut demande de prelevement", LOG_DEBUG); - dol_syslog("FacturationEmission::_prelevements Nombre de factures ".sizeof($factures_prev),LOG_DEBUG); - if (sizeof($factures_prev) > 0) - { - foreach ($factures_prev as $fac) - { - $fact = new Facture($db); - $fact->fetch($fac); - $fact->mode_reglement(3); - $fact->demande_prelevement($user); - } - } - dol_syslog("FacturationEmission::_prelevements Fin demande de prelevement", LOG_DEBUG); - } - - - function _emails($db, $user, $contrat_id, $factures_a_mailer) - { - /******************************************************************** - * * - * Envoi des factures par emails * - * * - ********************************************************************/ - if (sizeof($factures_a_mailer) > 0) - { - foreach ($factures_a_mailer as $fac) - { - $fact = new Facture($db); - $fact->fetch($fac); - - $contrat = new TelephonieContrat($db); - $contrat->fetch($contrat_id); - - $emails = $contrat->get_contact_facture(); - - $ligne = new LigneTel($db); - - if ($ligne->fetch_by_facture_number($fact->id) == 0) - { - - } - - if (sizeof($emails > 0)) - { - $sendto = ""; - for ($k = 0 ; $k < sizeof($emails) ; $k++) - { - $sendto .= html_entity_decode($emails[$k]) . ","; - } - $sendto = substr($sendto,0,strlen($sendto) - 1); - - dol_syslog("[EM] Envoi email à ".html_entity_decode($sendto) ); - - $subject = ereg_replace("#FACREF#",$fact->ref,TELEPHONIE_MAIL_FACTURATION_SUJET); - $subject = ereg_replace("#CONTRAT#",$contrat->ref, $subject); - - $from = TELEPHONIE_EMAIL_FACTURATION_EMAIL; - - $message = "Bonjour,\n\n"; - $message .= "Veuillez trouver ci-joint notre facture numéro $fact->ref du ".strftime("%d/%m/%Y",$fact->date)."."; - - $message .= "\nEgalement joint à ce mail le détails de vos communications.\n\n"; - - $message .= TELEPHONIE_MAIL_FACTURATION_SIGNATURE; - - - $mailfile = new DolibarrMail($subject, - $sendto, - $from, - $message); - - $mailfile->addr_bcc = TELEPHONIE_EMAIL_FACTURATION_EMAIL; - - $arr_file = array(); - $arr_name = array(); - $arr_mime = array(); - - $facfile = FAC_OUTPUTDIR . "/" . $fact->ref . "/" . $fact->ref . ".pdf"; - - /* - * Join la facture - */ - array_push($arr_file, $facfile); - array_push($arr_mime, "application/pdf"); - array_push($arr_name, $fact->ref.".pdf"); - - $dir = FAC_OUTPUTDIR . "/" . $fact->ref . "/"; - - $handle=opendir(FAC_OUTPUTDIR . "/" . $fact->ref . "/"); - /* - * Joint les détails - * - */ - while (($file = readdir($handle))!==false) - { - if (is_readable($dir.$file) && substr($file, -11) == '-detail.pdf') - { - array_push($arr_file, $dir.$file); - array_push($arr_mime, "application/pdf"); - array_push($arr_name, $file); - } - if (is_readable($dir.$file) && substr($file, -11) == '-detail.xls') - { - array_push($arr_file, $dir.$file); - array_push($arr_mime, "application/vns.ms-excel"); - array_push($arr_name, $file); - } - } - - $mailfile->PrepareFile($arr_file, $arr_mime, $arr_name); - - if ( $mailfile->sendfile() ) - { - - for ($kj = 0 ; $kj < sizeof($contrat->contact_facture_id) ; $kj++) - { - $sendtoid = $contrat->contact_facture_id[$kj]; - - $sendtox = $emails[$kj]; - - $actioncode=9; - $actionmsg="Envoyée à $sendtox"; - $actionmsg2="Envoi Facture par mail"; - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm (datea,fk_action,fk_soc,note,fk_facture, fk_contact,fk_user_author, label, percent) VALUES (now(), '$actioncode' ,'$fact->socid' ,'$actionmsg','$fact->id','$sendtoid','$user->id', '$actionmsg2',100);"; - - if (! $db->query($sql) ) - { - //print $db->error(); - } - else - { - //print "TOTO".$sendto. " ". $sendtoid ." \n"; - } - - } - - } - } - else - { - dol_syslog("Aucun email trouvé"); - } - } - } - } - - -} -?> diff --git a/htdocs/telephonie/facturation/FacturationImportCdr.class.php b/htdocs/telephonie/facturation/FacturationImportCdr.class.php deleted file mode 100644 index d06f1f1a73f..00000000000 --- a/htdocs/telephonie/facturation/FacturationImportCdr.class.php +++ /dev/null @@ -1,330 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * Script d'import des CDR - */ -require_once(DOL_DOCUMENT_ROOT."/telephonie/fournisseurtel.class.php"); - -class FacturationImportCdr { - - function FacturationImportCdr($dbh) - { - $this->db = $dbh; - $this->messages = array(); - $this->message_bad_file_format = array(); - } - - function CountDataImport() - { - $nb = 0; - $sql = "SELECT count(*)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_import_cdr"; - if ($this->db->query($sql)) - { - while ($row = $this->db->fetch_row($resql)) - { - $nb = $row[0]; - } - $this->db->free($resql); - } - return $nb; - } - - function Import($id_fourn) - { - $dir = DOL_DATA_ROOT."/telephonie/cdr/atraiter/".$id_fourn."/"; - - /* - * Traitement - */ - $files = array(); - $unknown_lines = array(); - - if (is_dir($dir)) - { - $handle=opendir($dir); - - if ($handle) - { - $i = 0 ; - $var=True; - - while (($xfile = readdir($handle))!==false) - { - if (is_file($dir.$xfile) && substr($xfile, -4) == ".csv") - { - $files[$i] = $dir.$xfile; - dol_syslog("FacturationImportCdr::Import ".$xfile." ajoute"); - $i++; - } - else - { - dol_syslog("FacturationImportCdr::Import ".$xfile." ignore"); - } - } - - closedir($handle); - } - else - { - dol_syslog("FacturationImportCdr::Import Impossible de lire $dir"); - exit ; - } - } - else - { - dol_syslog("FacturationImportCdr::Import Impossible de lire $file"); - exit ; - } - - /* - * Verification du fournisseur - * - */ - $fourn = new FournisseurTelephonie($this->db); - - if ($fourn->fetch($id_fourn) <> 0) - { - dol_syslog("FacturationImportCdr::Import Erreur recherche fournisseur", LOG_ERR); - } - - /* - * Verification des fichiers charges - * - */ - $fichiers = array(); - $sql = "SELECT distinct(fichier)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_import_cdr"; - if ($this->db->query($sql)) - { - while ($row = $this->db->fetch_row($resql)) - { - array_push($fichiers, $row[0]); - } - $this->db->free($resql); - } - else - { - dol_syslog("FacturationImportCdr::Import Erreur recherche si fichiers deja charges"); - } - - /* - * Verification des fichiers traites - * - */ - $sql = "SELECT distinct(fichier_cdr)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; - if ($this->db->query($sql)) - { - while ($row = $this->db->fetch_row($resql)) - { - array_push($fichiers, $row[0]); - } - $this->db->free($resql); - } - else - { - dol_syslog("FacturationImportCdr::Import Erreur recherche si fichiers deja traites"); - } - - /* - * Charge les ID de lignes - * - */ - $sql = "SELECT ligne, rowid "; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne"; - - $resql = $this->db->query($sql); - - if ($resql) - { - $i = 0; - $ligneids = array(); - - while ($row = $this->db->fetch_row($resql)) - { - $ligneids[$row[0]] = $row[1]; - $i++; - } - } - else - { - dol_syslog("FacturationImportCdr::Import Erreur chargement des lignes", LOG_DEBUG); - exit ; - } - - if (strlen($fourn->cdrformat)) - { - if (@require_once(DOL_DOCUMENT_ROOT."/telephonie/fournisseur/cdrformat/cdrformat.".$fourn->cdrformat.".class.php")) - { - $format = "CdrFormat".ucfirst($fourn->cdrformat); - $cdrformat = new $format(); - } - } - - - foreach ($files as $xfile) - { - if (is_readable($xfile)) - { - if ( $this->_verif($this->db, $xfile, $fichiers) == 0) - { - $error = 0; - dol_syslog("FacturationImportCdr::Import Lecture du fichier $xfile", LOG_DEBUG); - array_push($this->messages,array('info',"Fichier ".basename($xfile)." : utilisation format ".$cdrformat->nom)); - - $error = $cdrformat->ReadFile($xfile); - - $this->messages=array_merge($this->messages, $cdrformat->messages); - - - $line = 0; - $line_inserted = 0; - $hf = fopen ($xfile, "r"); - $line = 0; - - if ($this->db->query("BEGIN") && $error == 0) - { - foreach ($cdrformat->datas as $data) - { - $ligne = $data['ligne']; - $duree_secondes = $data['duree']; - - if ($ligneids[$ligne] > 0) - { - if ($duree_secondes > 0) - { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_import_cdr"; - $sql .= "(idx,fk_ligne,ligne,date,heure,num,dest,dureetext,tarif,montant,duree"; - $sql .= ", fichier, fk_fournisseur)"; - $sql .= " VALUES ("; - $sql .= $data['index']; - $sql .= ",'".$ligneids[$ligne]."'"; - $sql .= ",'".$ligne."'"; - $sql .= ",'".$data['date']."'"; - $sql .= ",'".$data['heure']."'"; - $sql .= ",'".$data['numero']."'"; - $sql .= ",'".addslashes(ereg_replace('"','',$data['tarif']))."'"; - $sql .= ",'".ereg_replace('"','',$duree_text)."'"; - $sql .= ",'".ereg_replace('"','',$tarif_fourn)."'"; - $sql .= ",".ereg_replace(',','.',$data['montant']); - $sql .= ",".$duree_secondes; - $sql .= ",'".basename($xfile)."'"; - $sql .= " ,".$id_fourn; - $sql .= ")"; - - if(ereg("^[0-9]+$", $duree_secondes)) - { - if ($this->db->query($sql)) - { - $line_inserted++; - } - else - { - dol_syslog("FacturationImportCdr::Import Erreur de traitement de ligne $index", LOG_ERR); - dol_syslog("FacturationImportCdr::Import $sql", LOG_DEBUG); - $error++; - } - } - else - { - dol_syslog("FacturationImportCdr::Import Ligne : $cont ignoree", LOG_INFO); - $error++; - } - } - else - { - dol_syslog("FacturationImportCdr::Import Duree nulle Ligne : $cont ignoree", LOG_INFO); - } - } - else - { - if (!in_array($ligne, $unknown_lines)) - { - dol_syslog("FacturationImportCdr::Import Ligne $ligne inconnue Ligne : $cont ignoree", LOG_INFO); - array_push($this->messages,array('warning',"Ligne $ligne inconnue")); - } - array_push($unknown_lines, $ligne); - } - $line++; - } - - dol_syslog("FacturationImportCdr::Import $line lignes traitees dans le fichier", LOG_INFO); - $level = ($line > 0) ? 'info':'warning'; - array_push($this->messages,array($level,"$line lignes traitees dans le fichier")); - dol_syslog("FacturationImportCdr::Import $line_inserted insert effectues", LOG_INFO); - $level = ($line_inserted > 0) ? 'info':'warning'; - array_push($this->messages,array($level,"$line_inserted ajout dans la table des CDR a traiter")); - - if (sizeof($this->message_bad_file_format)) - { - foreach ($this->message_bad_file_format as $key => $value) - { - array_push($this->messages,array('warning',"$value ligne(s) au mauvais format dans $key")); - } - } - - if ($error == 0) - { - $this->db->query("COMMIT"); - array_push($this->messages, array('info',"Fichier ".basename($xfile)." : importation reussie")); - } - else - { - $this->db->query("ROLLBACK"); - dol_syslog("ROLLBACK"); - array_push($this->messages, array('error',"Fichier ".basename($xfile)." : echec de l'importation")); - } - } - else - { - array_push($this->messages, array('error',"Fichier ".basename($xfile)." : echec de l'importation")); - } - } - } - else - { - print "Erreur lecture : $xfile"; - dol_syslog($xfile . " not readable"); - array_push($this->messages, "Fichier ".basename($xfile)." not readable"); - } - } - - return $error; - } - - /** - \brief Verifie que le fichier n'a pas deja ete charge/traite - */ - function _verif($db, $file, $fichiers) - { - $result = 0; - - if (in_array (basename($file), $fichiers)) - { - dol_syslog ("Fichier ".basename($file)." deja charge/traite"); - array_push($this->messages, array('warning',"Fichier ".basename($file)." deja charge/traite")); - $result = -1; - } - - return $result; - } - -} diff --git a/htdocs/telephonie/facturation/FacturationVerifCdr.class.php b/htdocs/telephonie/facturation/FacturationVerifCdr.class.php deleted file mode 100644 index c9536b8cd5c..00000000000 --- a/htdocs/telephonie/facturation/FacturationVerifCdr.class.php +++ /dev/null @@ -1,101 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * Script d'verif des CDR - */ -require_once(DOL_DOCUMENT_ROOT."/telephonie/fournisseurtel.class.php"); - -class FacturationVerifCdr { - - function FacturationVerifCdr($dbh) - { - $this->db = $dbh; - $this->messages = array(); - $this->message_bad_file_format = array(); - } - - function Verif() - { - $error = 0; - - $sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."telephonie_import_cdr"; - - if ( $this->db->query($sql) ) - { - $row = $this->db->fetch_row(); - dol_syslog("facturation-verif.php ".$row[0]." lignes de communications a verifier"); - } - - /******************************************************************************* - * - * Verifie la présence des tarifs adequat - * - */ - $grille_vente = TELEPHONIE_GRILLE_VENTE_DEFAUT_ID; - - $tarif_vente = new TelephonieTarif($this->db, $grille_vente, "vente"); - - dol_syslog("facturation-verif.php Grille : $grille contient ".$tarif_vente->num_tarifs." tarifs"); - - $sql = "SELECT distinct(num) FROM ".MAIN_DB_PREFIX."telephonie_import_cdr"; - - $resql = $this->db->query($sql); - - if ( $resql ) - { - $nums = $this->db->num_rows($resql); - - while($row = $this->db->fetch_row($resql) ) - { - $numero = $row[0]; - - /* Reformatage du numéro */ - - if (substr($numero,0,2) == '00') /* International */ - { - } - elseif (substr($numero,0,2) == '06') /* Telephones Mobiles */ - { - $numero = "0033".substr($numero,1); - } - else - { - $numero = "0033".substr($numero, 1); - } - - /* Numéros spéciaux */ - if (substr($numero,4,1) == 8) - { - - } - else - { - if ( $tarif_vente->cout($numero, $x, $y, $z) == 0) - { - print "Tarif vente manquant pour $numero ($row[0]) $x $y dans la grille $grille\n"; - } - } - - } - $this->db->free($resql); - - } - } -} diff --git a/htdocs/telephonie/facturation/batch.php b/htdocs/telephonie/facturation/batch.php deleted file mode 100644 index 68ca96a18ea..00000000000 --- a/htdocs/telephonie/facturation/batch.php +++ /dev/null @@ -1,158 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if (!$user->rights->telephonie->facture->lire) accessforbidden(); - -if ($_GET["action"] == 'delete' && $_GET["id"] > 0) -{ - $id = $_GET["id"]; - $result = 0; - - $db->query("BEGIN"); - - $sql = "SELECT rowid, fk_facture FROM ".MAIN_DB_PREFIX."telephonie_facture WHERE fk_batch=".$id.";"; - $resql = $db->query($sql); - if ($resql > 0) $result += 1 ; - - $facturetel_id = array(); - $facture_id = array(); - while ($row = $db->fetch_row($resql)) - { - array_push($facturetel_id, $row[0]); - } - $db->free($resql); - - foreach($facturetel_id as $tfid) - { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_communications_details WHERE fk_telephonie_facture=".$tfid.";"; - $resql = $db->query($sql); - if ($resql > 0) $result += 1 ; - } - - $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_facture WHERE fk_batch=".$id.";"; - $resql = $db->query($sql); - if ($resql > 0) $result += 1 ; - - $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_facturation_batch WHERE rowid=".$id.";"; - $resql = $db->query($sql); - if ($resql > 0) $result += 1 ; - - $goodres = 3 + sizeof($facturetel_id) + sizeof($facture_id); - - if ($result == $goodres) - { - $db->commit(); - } - else - { - print "$goodres $result"; - $db->rollback(); - } -} - -// FIN DES ACTIONS - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; -$sortfield = $_GET["sortfield"]; - -llxHeader(); - -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -if ($sortorder == "") { - $sortorder=""; -} -if ($sortfield == "") { - $sortfield="date_batch DESC"; -} - -/* - * Recherche - * - * - */ - -if ($page == -1) { $page = 0 ; } - -$offset = $conf->liste_limit * $page ; -$pageprev = $page - 1; -$pagenext = $page + 1; - -/* - * Mode Liste - * - */ - -print_barre_liste("CDR a traiter", $page, "cdr.php", "", $sortfield, $sortorder, '', $num); - -print ''; -print ''; -print ''; - -print "\n"; - -print ''; -print ''; -print ''; -print ''; -print ''; - -$var=True; - -$sql = "SELECT rowid,date_batch"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facturation_batch"; -$sql .= " WHERE 1=1"; -if ($_GET["search_ligne"]) -{ - $sel =urldecode($_GET["search_ligne"]); - $sel = ereg_replace("\.","",$sel); - $sel = ereg_replace(" ","",$sel); - $sql .= " AND ligne LIKE '%".$sel."%'"; -} -$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); -$resql = $db->query($sql); - -while ($obj = $db->fetch_object($resql)) -{ - $var=!$var; - - print ""; - print '\n"; - print '\n"; - print ''; -} -print "
idDateUtilisateur
'.$obj->rowid."'.$obj->date_batch."Supprimer
"; - - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/facturation/calcul.php b/htdocs/telephonie/facturation/calcul.php deleted file mode 100644 index 052a62f3dbd..00000000000 --- a/htdocs/telephonie/facturation/calcul.php +++ /dev/null @@ -1,72 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); -require_once DOL_DOCUMENT_ROOT.'/telephonie/facturation/FacturationCalcul.class.php'; - -if (!$user->rights->telephonie->facture->ecrire) accessforbidden(); - -llxHeader(); - -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} -/* - * - */ -print_barre_liste("Calcul des CDR", $page, "calcul.php", "", $sortfield, $sortorder, '', $num); - -print ''; -print ''; -print ''; - -$var=True; - -$obj = new FacturationCalcul($db); -$obj->Calcul(); - -foreach ($obj->messages as $message) -{ - $var=!$var; - print ""; - if (is_array($message)) - { - $func = 'img_'.$message[0]; - print ''; - print ''; - } - else - { - print ''; - print ''; - } -} -print "
Messages
'.$func().''.$message[1].'
'.img_info().''.$message.'
"; - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/facturation/cdr-import.php b/htdocs/telephonie/facturation/cdr-import.php deleted file mode 100644 index 79e892c39af..00000000000 --- a/htdocs/telephonie/facturation/cdr-import.php +++ /dev/null @@ -1,93 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); -require_once DOL_DOCUMENT_ROOT.'/telephonie/facturation/FacturationImportCdr.class.php'; - -$dir = $conf->telephonie->dir_output."/cdr/atraiter/" ; - -$handle=opendir($dir); - -$files = array(); - -$var=true; -while (($file = readdir($handle))!==false) -{ - if (is_file($dir.'/'.$file)) - array_push($files, $file); -} -closedir($handle); - -if (!$user->rights->telephonie->facture->ecrire) accessforbidden(); - -llxHeader(); - -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - - -/* - * - * - * - */ -print_barre_liste("Importation des fichiers CDR", $page, "files.php", "", $sortfield, $sortorder, '', $num); - -print ''; -print ''; -print ''; - -print "\n"; - -$var=True; - -$obj = new FacturationImportCdr($db); -$obj->Import($_GET["id"]); - -foreach ($obj->messages as $message) -{ - $var=!$var; - print ""; - - if (is_array($message)) - { - $func = 'img_'.$message[0]; - print ''; - print ''; - } - else - { - print ''; - print ''; - } -} -print "
Messages
'.$func().''.$message[1].'
'.img_info().''.$message.'
"; - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/facturation/cdr.php b/htdocs/telephonie/facturation/cdr.php deleted file mode 100644 index 65c19b442b1..00000000000 --- a/htdocs/telephonie/facturation/cdr.php +++ /dev/null @@ -1,156 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if ($_POST["action"] == 'empty' && $_POST["confirm"] == 'yes' && $user->rights->telephonie->facture->ecrire) -{ - $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_import_cdr"; - $db->query($sql); -} - -$dir = $conf->telephonie->dir_output."/cdr/atraiter/" ; - -$handle=opendir($dir); - -$files = array(); - -$var=true; -while (($file = readdir($handle))!==false) -{ - if (is_file($dir.'/'.$file)) - array_push($files, $file); -} -closedir($handle); - - - -if (!$user->rights->telephonie->facture->ecrire) accessforbidden(); - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; -$sortfield = $_GET["sortfield"]; -if ($page == -1) { $page = 0 ; } - -$offset = $conf->liste_limit * $page ; -$pageprev = $page - 1; -$pagenext = $page + 1; - - -llxHeader(); - -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -if ($sortorder == "") { - $sortorder=""; -} -if ($sortfield == "") { - $sortfield="date ASC"; -} - -/* - * Mode Liste - * - */ - -$sql = "SELECT ligne,date,heure,num, montant, duree,fichier"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_import_cdr"; -$sql .= " WHERE 1=1"; -if ($_GET["search_ligne"]) -{ - $sel =urldecode($_GET["search_ligne"]); - $sel = ereg_replace("\.","",$sel); - $sel = ereg_replace(" ","",$sel); - $sql .= " AND ligne LIKE '%".$sel."%'"; -} - -if ($_GET["search_num"]) -{ - $selnum =urldecode($_GET["search_num"]); - $selnum = ereg_replace("\.","",$selnum); - $selnum = ereg_replace(" ","",$selnum); - $sql .= " AND num LIKE '%".$selnum."%'"; -} - -$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); -$resql = $db->query($sql); - -$num = $db->num_rows($resql); - -$urladd= "&search_ligne=".$sel."&search_num=".$selnum; - -print_barre_liste("CDR a traiter", $page, "cdr.php", $urladd, $sortfield, $sortorder, '', $num); - - -if ($_GET["action"] == 'empty_request' ) -{ - $html = new Form($db); - - $html->form_confirm("cdr.php","Suppression des CDR a traiter","Etes-vous sûr de vouloir vider la table des CDR a traiter ?","empty"); - print '
'; -} - - -print ''; -print ''; -print ''; -print ''; -print "\n"; - -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; - -$var=True; - - -while ($obj = $db->fetch_object($resql)) -{ - $var=!$var; - - print ""; - print '\n"; - print '\n"; - print '\n"; - print '\n"; - print '\n"; - print '\n"; - -} -print "
LigneNumeroDateDureeMontantFichier
   
'.$obj->ligne."'.$obj->num."'.$obj->date." ".$obj->heure."'.$obj->duree."'.$obj->montant."'.$obj->fichier."
"; - - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/facturation/emission.php b/htdocs/telephonie/facturation/emission.php deleted file mode 100644 index 01da0a21266..00000000000 --- a/htdocs/telephonie/facturation/emission.php +++ /dev/null @@ -1,77 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - */ - -require("./pre.inc.php"); -require_once DOL_DOCUMENT_ROOT.'/telephonie/facturation/FacturationEmission.class.php'; -require_once(DOL_DOCUMENT_ROOT."/includes/modules/facture/modules_facture.php"); - -if (! $user->rights->telephonie->facture->ecrire ) - accessforbidden(); - -llxHeader(); -/* - * Securite acces client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -/* - * - * - * - */ -print_barre_liste("Emission des factures", $page, "emission.php", "", $sortfield, $sortorder, '', $num); - -print ''; -print ''; -print ''; - -$var=True; - -$obj = new FacturationEmission($db,$user); -$obj->Emission(); - -foreach ($obj->messages as $message) -{ - $var=!$var; - print ""; - - if (is_array($message)) - { - $func = 'img_'.$message[0]; - print ''; - print ''; - } - else - { - print ''; - print ''; - } - -} -print "
Messages
'.$func().''.$message[1].'
'.img_info().''.$message.'
"; - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/facturation/facture.php b/htdocs/telephonie/facturation/facture.php deleted file mode 100644 index 66759dbdbc4..00000000000 --- a/htdocs/telephonie/facturation/facture.php +++ /dev/null @@ -1,112 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if (!$user->rights->telephonie->facture->lire) accessforbidden(); - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; -$sortfield = $_GET["sortfield"]; - -llxHeader(); - -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -if ($sortorder == "") { - $sortorder="DESC"; -} -if ($sortfield == "") { - $sortfield="rowid"; -} - -/* - * Recherche - * - * - */ - -if ($page == -1) { $page = 0 ; } - -$offset = $conf->liste_limit * $page ; -$pageprev = $page - 1; -$pagenext = $page + 1; - -/* - * Mode Liste - * - */ - -print_barre_liste("Factures telephonie", $page, "facture.php", "", $sortfield, $sortorder, '', $num); - -print ''; -print ''; -print ''; -print ''; -print "\n"; - -print ''; -print ''; -print ''; -print ''; -print ''; - -$var=True; - -$sql = "SELECT fk_contrat,ligne,date,cout_vente,fourn_montant"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture"; -$sql .= " WHERE 1=1"; -if ($_GET["search_ligne"]) -{ - $sel =urldecode($_GET["search_ligne"]); - $sel = ereg_replace("\.","",$sel); - $sel = ereg_replace(" ","",$sel); - $sql .= " AND ligne LIKE '%".$sel."%'"; -} -$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); -$resql = $db->query($sql); - -while ($obj = $db->fetch_object($resql)) -{ - $var=!$var; - - print ""; - print '\n"; - print '\n"; - print '\n"; - print '\n"; - - -} -print "
LigneDateMontant HTMontant Fournisseur
  
'.$obj->ligne."'.$obj->date."'.price($obj->cout_vente)."'.price($obj->fourn_montant)."
"; - - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/facturation/files.php b/htdocs/telephonie/facturation/files.php deleted file mode 100644 index f3c80b1d210..00000000000 --- a/htdocs/telephonie/facturation/files.php +++ /dev/null @@ -1,130 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); -require_once DOL_DOCUMENT_ROOT.'/telephonie/fournisseurtel.class.php'; - -if (!$user->rights->telephonie->facture->ecrire) accessforbidden(); - -if ($_GET["action"] == 'archive' && $user->rights->telephonie->facture->ecrire) -{ - $srcdir = $conf->telephonie->dir_output."/cdr/atraiter/" ; - - - $file = urldecode ($_GET["file"]); - - $destdir = $conf->telephonie->dir_output."/cdr/archive/".dirname($file).'/'; - - if (!is_dir($destdir)) - { - @mkdir($destdir); - } - - if (is_dir($destdir) && is_file($srcdir.$file)) - { - rename($srcdir.$file,$destdir.basename($file)); - } -} - -if ($_GET["action"] == 'delete' && $user->rights->telephonie->facture->ecrire) -{ - $srcdir = $conf->telephonie->dir_output."/cdr/atraiter/" ; - $file = urldecode ($_GET["file"]); - - unlink($srcdir.$file); -} - -$dir = $conf->telephonie->dir_output."/cdr/atraiter/" ; - -$files = array(); -$fourn_files = array(); - -$obj = new FournisseurTelephonie($db,$user); -$fourns = $obj->GetActives(); - -foreach ($fourns as $id => $nom) -{ - $fdir = $dir . $id.'/'; - if (is_dir($fdir)) - { - $handle=opendir($fdir); - while (($file = readdir($handle))!==false) - { - if (is_file($fdir.'/'.$file)) - { - array_push($files, $id.'/'.$file); - $fourn_files[$id.'/'.$file] = $nom; - } - } - closedir($handle); - } -} - -llxHeader(); - -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - - -/* - * Mode Liste - */ -print_barre_liste("Fichiers CDR a traiter", $page, "files.php", "", $sortfield, $sortorder, '', $num); - -print ''; -print ''; -print ''; -print ''; -print "\n"; - -$var=True; - -foreach ($files as $file) -{ - $var=!$var; - - print ""; - - print ''; - - print '\n"; - - print ''; - print ''; - print ''; - print ''; -} -print "
FournisseurFichierDateTaille 
'.$fourn_files[$file].''; - print img_file(); - print ' '; - print basename($file)."'.date("d F Y H:i:s", filemtime($dir.$file)).''.filesize($dir.$file).' octetsArchiverSupprimer
"; - - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/facturation/index.php b/htdocs/telephonie/facturation/index.php deleted file mode 100644 index 35b5c4ef56e..00000000000 --- a/htdocs/telephonie/facturation/index.php +++ /dev/null @@ -1,170 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); -require_once DOL_DOCUMENT_ROOT.'/telephonie/facturation/FacturationImportCdr.class.php'; -require_once DOL_DOCUMENT_ROOT.'/telephonie/facturation/FacturationEmission.class.php'; -require_once DOL_DOCUMENT_ROOT.'/telephonie/fournisseurtel.class.php'; - -if (!$user->rights->telephonie->facture->ecrire) accessforbidden(); - -if ( $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) -{ - if ($_POST['fournisseur'] > 0) - { - - $upload_dir = DOL_DATA_ROOT."/telephonie/cdr/atraiter/".$_POST['fournisseur']; - - if (is_dir($upload_dir)) - { - if (dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],1) > 0) - { - $mesg = "Le fichier est valide, et a été téléchargé avec succès.\n"; - } - else - { - $mesg = "Le fichier n'a pas été téléchargé"; - } - - } - } -} - -llxHeader('','Telephonie - Facturation'); - -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -/* - * - */ -$fourn = new FournisseurTelephonie($db); -$fourns = $fourn->getActives(); - -clearstatcache(); - -print ''; -print ''; - - -print '
'; -$var = true; -print ''; -print ''; -foreach ($fourns as $key => $value) -{ - $dir = $conf->telephonie->dir_output."/cdr/atraiter/$key" ; - if (is_dir($dir)) - { - $handle=opendir($dir); - $files = array(); - - while (($file = readdir($handle))!==false) - { - if (is_file($dir.'/'.$file)) - array_push($files, $file); - } - closedir($handle); - $nb = sizeof($files); - } - else - { - $nb = 'Rep Inexistant'; - } - - print ""; - print ""; - print ''; - $var =!$var; -} - -$obj = new FacturationImportCdr($db); -$nbcdr = $obj->CountDataImport(); - -print ""; -print ''; -print ''; - -$obj = new FacturationEmission($db,$user); -$act = $obj->NbFactureToGenerate(); -$nb = $obj->nbfac; -$var =!$var; -print ""; -print ''; -print ''; -print '
Facturation
Fichiers a traiter pour $value'.$nb.''; - if (sizeof($files) > 0) - { - print 'Importer'; - } - print ' 
Donnees a traiter'.$nbcdr.'Traiter
Lignes de facture'.$nb.'Emettre

'; - -print ''; -print ''; -$var =!$var; -print ""; -print ''; -print '
Statistiques
GenerationGenerer
'; - - -print '
'; - -print ''; -print ''; -print ''; - -print ''; -print ''; - -print "\n"; -print '
Charger un fichier CDR
"; - -$form = new Form($db); -$form->select_array("fournisseur",$fourns); - -print '
'; -print '   '; -print '
'; - -print "

'; - -print ''; -print ''; - -if ($nbcdr > 0) -{ - print ""; - print ''; -} -print '
Autres actions
Vider la table des CDR a traiterVider
'; - -print '
'; - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/facturation/pre.inc.php b/htdocs/telephonie/facturation/pre.inc.php deleted file mode 100644 index 8efb78dde35..00000000000 --- a/htdocs/telephonie/facturation/pre.inc.php +++ /dev/null @@ -1,73 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("../../main.inc.php"); -require DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"; -require DOL_DOCUMENT_ROOT."/telephonie/facturetel.class.php"; - -$user->getrights('telephonie'); - -function llxHeader($head = "", $title="") { - global $user, $conf; - - /* - * - * - */ - top_menu($head, $title); - - $menu = new Menu(); - - $menu->add(DOL_URL_ROOT."/telephonie/index.php", "Telephonie"); - - if (TELEPHONIE_MODULE_SIMULATION == 1) - { - $menu->add(DOL_URL_ROOT."/telephonie/simulation/fiche.php", "Simulation"); - $menu->add_submenu(DOL_URL_ROOT."/telephonie/simulation/fiche.php?action=create", "Nouvelle"); - } - - $menu->add(DOL_URL_ROOT."/telephonie/client/index.php", "Clients"); - - $menu->add(DOL_URL_ROOT."/telephonie/contrat/", "Contrats"); - - $menu->add(DOL_URL_ROOT."/telephonie/ligne/index.php", "Lignes"); - - $menu->add(DOL_URL_ROOT."/telephonie/facturation/index.php", "Facturation"); - $menu->add_submenu(DOL_URL_ROOT."/telephonie/facturation/batch.php", "Batch"); - $menu->add_submenu(DOL_URL_ROOT."/telephonie/facturation/files.php", "Fichiers CDR"); - $menu->add_submenu(DOL_URL_ROOT."/telephonie/facturation/cdr.php", "CDR"); - $menu->add_submenu(DOL_URL_ROOT."/telephonie/facturation/facture.php", "Factures"); - - //$menu->add_submenu(DOL_URL_ROOT."/telephonie/facture/check.php", "Verif"); - //$menu->add_submenu(DOL_URL_ROOT."/telephonie/facture/stats.php", "Stats"); - - if ($user->rights->telephonie->fournisseur->lire) - $menu->add(DOL_URL_ROOT."/telephonie/fournisseur/", "Fournisseurs"); - - $menu->add(DOL_URL_ROOT."/telephonie/tarifs/", "Tarifs"); - - if ($user->rights->telephonie->ca->lire) - $menu->add(DOL_URL_ROOT."/telephonie/ca/", "Chiffre d'affaire"); - - left_menu($menu->liste); -} - -?> diff --git a/htdocs/telephonie/facturation/stats.php b/htdocs/telephonie/facturation/stats.php deleted file mode 100644 index 0dca9e9b9a0..00000000000 --- a/htdocs/telephonie/facturation/stats.php +++ /dev/null @@ -1,76 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if (!$user->rights->telephonie->facture->ecrire) accessforbidden(); - - -llxHeader(); - -$messages = array(); - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/ProcessGraphLignes.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/ProcessGraphContrats.class.php"); -$obj = new ProcessGraphLignes($db); -$obj->GenerateAll(); -$messages = array_merge($messages, $obj->messages); -$obj = new ProcessGraphContrats($db); -$obj->GenerateAll(); -$messages = array_merge($messages, $obj->messages); - -/* - * Sécurité accés client - */ - -print_barre_liste("Generation des statistiques", $page, "stats.php", "", $sortfield, $sortorder, '', $num); - -print ''; -print ''; -print ''; - -print "\n"; - -$var=True; - -foreach ($messages as $message) -{ - $var=!$var; - print ""; - - if (is_array($message)) - { - $func = 'img_'.$message[0]; - print ''; - print ''; - } - else - { - print ''; - print ''; - } -} -print "
Messages
'.$func().''.$message[1].'
'.img_info().''.$message.'
"; - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/facture/index.php b/htdocs/telephonie/facture/index.php deleted file mode 100644 index 9476f5a6750..00000000000 --- a/htdocs/telephonie/facture/index.php +++ /dev/null @@ -1,76 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if (!$user->rights->telephonie->facture->lire) accessforbidden(); - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; - -llxHeader('','Telephonie - Factures'); - -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -/* - * Mode Liste - * - * - * - */ - -print ''; - -print ''; - -print '
'; - -print '
'; -print ''; -print ''; -print "\n"; -print ""; -print ''; -print '
Recherche ligne
Numéro
'; - -print '
'; -print ''; -print ''; -print "\n"; -print ""; -print ''; -print '
Recherche facture
Numéro
'; - -print '
'; - -print '
'; - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/facture/liste.php b/htdocs/telephonie/facture/liste.php deleted file mode 100644 index 62d1975a77d..00000000000 --- a/htdocs/telephonie/facture/liste.php +++ /dev/null @@ -1,195 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if (!$user->rights->telephonie->facture->lire) accessforbidden(); - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; -$sortfield = $_GET["sortfield"]; - -llxHeader(); - -/* - * S�curit� acc�s client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -if ($sortorder == "") { - $sortorder=""; -} -if ($sortfield == "") { - $sortfield="f.date DESC, f.gain ASC"; -} - -/* - * Recherche - * - * - */ - -if ($page == -1) { $page = 0 ; } - -$offset = $conf->liste_limit * $page ; -$pageprev = $page - 1; -$pagenext = $page + 1; - -/* - * Mode Liste - * - * - * - */ - -$sql = "SELECT f.rowid, f.date, f.ligne, f.fourn_montant, f.cout_vente, f.gain, f.fk_facture"; -$sql .= " ,s.nom, s.rowid as socid"; -$sql .= " , fac.facnumber as ref"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture as f"; -$sql .= " , ".MAIN_DB_PREFIX."societe as s"; -$sql .= " , ".MAIN_DB_PREFIX."facture as fac"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; -$sql .= ",".MAIN_DB_PREFIX."societe_perms as sp"; - -$sql .= " WHERE s.rowid = l.fk_soc_facture AND l.rowid = f.fk_ligne"; -$sql .= " AND l.fk_soc_facture = s.rowid"; -$sql .= " AND l.fk_client_comm = sp.fk_soc"; -$sql .= " AND sp.fk_user = ".$user->id." AND sp.pread = 1"; - -$sql .= " AND f.fk_facture = fac.rowid"; - -if ($_GET["search_ligne"]) -{ - $sql .= " AND f.ligne LIKE '%".$_GET["search_ligne"]."%'"; -} - -if ($_GET["search_client"]) -{ - $sql .= " AND s.nom LIKE '%".$_GET["search_client"]."%'"; -} - -if ($_GET["search_facture"]) -{ - $sql .= " AND fac.facnumber LIKE '%".$_GET["search_facture"]."%'"; -} - -$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); - -$result = $db->query($sql); -if ($result) -{ - $num = $db->num_rows(); - $i = 0; - - print_barre_liste("Factures", $page, "liste.php", "", $sortfield, $sortorder, '', $num); - - print ''; - print ''; - print_liste_field_titre("Client","liste.php","s.nom"); - - print_liste_field_titre("Ligne","liste.php","l.ligne"); - print ''; - - if ($user->rights->telephonie->ligne->gain) - { - print ''; - print_liste_field_titre("Marge","liste.php","f.gain",'','','align="right"'); - } - print ''; - print "\n"; - - print ''; - print ''; - print ''; - print ''; - - print ''; - - print ''; - - if ($user->rights->telephonie->ligne->gain) - { - print ''; - print ''; - } - - print ''; - print ''; - print ''; - - - $var=True; - - $ligne = new LigneTel($db); - - while ($i < min($num,$conf->liste_limit)) - { - $obj = $db->fetch_object($i); - $var=!$var; - - print ""; - - print '\n"; - print '\n"; - print '\n"; - print '\n"; - - if ($user->rights->telephonie->ligne->gain) - { - print '\n"; - - print '\n"; - } - print '\n"; - print "\n"; - $i++; - } - print "
DateMontant HTCo�t fournisseur HTFacture
   
'; - print img_file(); - print ' '; - - print ''.$obj->nom."'.dol_print_phone($obj->ligne,0,0,true)."'.$obj->date."'.sprintf("%01.4f",$obj->cout_vente)."'.sprintf("%01.4f",$obj->fourn_montant)."'; - if ($obj->gain < 0 && $obj->cout_vente) - { - print ''; - print sprintf("%01.4f",$obj->gain); - print ""; - } - else - { - print sprintf("%01.4f",$obj->gain); - } - print "'.$obj->ref."
"; - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/facture/pre.inc.php b/htdocs/telephonie/facture/pre.inc.php deleted file mode 100644 index a36271b937d..00000000000 --- a/htdocs/telephonie/facture/pre.inc.php +++ /dev/null @@ -1,75 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("../../main.inc.php"); -require DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"; -require DOL_DOCUMENT_ROOT."/telephonie/facturetel.class.php"; - -$user->getrights('telephonie'); - -function llxHeader($head = "", $title="") { - global $user, $conf; - - /* - * - * - */ - top_menu($head, $title); - - $menu = new Menu(); - - $menu->add(DOL_URL_ROOT."/telephonie/index.php", "Telephonie"); - - if (TELEPHONIE_MODULE_SIMULATION == 1) - { - $menu->add(DOL_URL_ROOT."/telephonie/simulation/fiche.php", "Simulation"); - $menu->add_submenu(DOL_URL_ROOT."/telephonie/simulation/fiche.php?action=create", "Nouvelle"); - } - - $menu->add(DOL_URL_ROOT."/telephonie/client/index.php", "Clients"); - - $menu->add(DOL_URL_ROOT."/telephonie/contrat/", "Contrats"); - - $menu->add(DOL_URL_ROOT."/telephonie/ligne/index.php", "Lignes"); - - if ($user->rights->telephonie->ligne_commander) - $menu->add(DOL_URL_ROOT."/telephonie/ligne/commande/", "Commandes"); - - if ($user->rights->telephonie->stats->lire) - $menu->add(DOL_URL_ROOT."/telephonie/stats/", "Statistiques"); - - $menu->add(DOL_URL_ROOT."/telephonie/facture/index.php", "Factures"); - $menu->add_submenu(DOL_URL_ROOT."/telephonie/facture/liste.php", "Liste"); - //$menu->add_submenu(DOL_URL_ROOT."/telephonie/facture/check.php", "Verif"); - //$menu->add_submenu(DOL_URL_ROOT."/telephonie/facture/stats.php", "Stats"); - - $menu->add(DOL_URL_ROOT."/telephonie/tarifs/", "Tarifs"); - - if ($user->rights->telephonie->fournisseur->lire) - $menu->add(DOL_URL_ROOT."/telephonie/fournisseur/", "Fournisseurs"); - - if ($user->rights->telephonie->ca->lire) - $menu->add(DOL_URL_ROOT."/telephonie/ca/", "Chiffre d'affaire"); - - left_menu($menu->liste); -} - -?> diff --git a/htdocs/telephonie/facturetel.class.php b/htdocs/telephonie/facturetel.class.php deleted file mode 100644 index 2350e26c915..00000000000 --- a/htdocs/telephonie/facturetel.class.php +++ /dev/null @@ -1,152 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -class FactureTel { - var $db; - var $id; - - function FactureTel($DB, $id=0) - { - $this->db = $DB; - - return 1; - } - /* - * - * - */ - function fetch($id) - { - $sql = "SELECT rowid, ligne, date, cout_vente, cout_vente_remise, fk_facture"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture as tf"; - $sql .= " WHERE tf.rowid = ".$id; - - $resql = $this->db->query($sql); - - if ($resql) - { - if ($this->db->num_rows($resql)) - { - $obj = $this->db->fetch_object($resql); - - $this->id = $obj->rowid; - $this->ligne = $obj->ligne; - $this->cout_vente = $obj->cout_vente; - $this->cout_vente_remise = $obj->cout_vente_remise; - $this->fk_facture = $obj->fk_facture; - - $result = 0; - } - else - { - dol_syslog("FactureTel::Fetch() Error aucune facture avec cet id=$id", LOG_ERR); - $result = -2; - } - - $this->db->free($resql); - } - else - { - /* Erreur select SQL */ - dol_syslog("FactureTel::Fetch() Error SQL id=$id", LOG_ERR); - $result = -1; - } - - - return $result; - } - - /* - * Met à jout la facture téléphonique avec le numéro de la facture - * comptable - */ - function affect_num_facture_compta($facid) - { - - $sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_facture"; - $sql .= " SET "; - $sql .= " fk_facture = ".$facid ; - $sql .= " WHERE rowid = ".$this->id; - - if ( $this->db->query($sql) ) - { - return 0; - } - else - { - /* Erreur select SQL */ - dol_syslog("FactureTel::affect_num_facture_compta() Error SQL id=$facid", LOG_ERR); - $result = -1; - return 1; - } - } - - /* - * - */ - - function get_comm_min_date($date) - { - $sql = "SELECT ".$this->db->pdate("min(date)"); - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; - $sql .= " WHERE ligne = '".$this->ligne."'"; - $sql .= " AND fk_telephonie_facture =".$this->id; - - $resql = $this->db->query($sql); - - if ($resql) - { - if ($this->db->num_rows($resql)) - { - $row = $this->db->fetch_row($resql); - - return $row[0]; - } - } - - } - - /* - * - */ - - function get_comm_max_date($date) - { - $sql = "SELECT ".$this->db->pdate("max(date)"); - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; - $sql .= " WHERE ligne = '".$this->ligne."'"; - $sql .= " AND fk_telephonie_facture =".$this->id; - - $resql = $this->db->query($sql); - - if ($resql) - { - if ($this->db->num_rows($resql)) - { - $row = $this->db->fetch_row($resql); - - return $row[0]; - } - } - } -} -?> diff --git a/htdocs/telephonie/fournisseur/cdrformat/cdrformat.fructidor.class.php b/htdocs/telephonie/fournisseur/cdrformat/cdrformat.fructidor.class.php deleted file mode 100644 index e3f871c1dd1..00000000000 --- a/htdocs/telephonie/fournisseur/cdrformat/cdrformat.fructidor.class.php +++ /dev/null @@ -1,106 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * Format de CDR Fructidor - * - * 0297500000;05/09/2006;12:50:34;33617000000;France-Mobile-SFR;5;0.0116 - * 0297500001;05/09/2006;12:58:45;33240000000;France national ;124;0.0256 - * 0297500000;27/09/2006;16:18:18;33625000000;France-Mobile-SFR;4;0.0093 - * 0297500000;27/09/2006;16:22:32;33240000000;France national ;14;0.0029 - * - */ -class CdrFormatFructidor -{ - - function CdrFormatFructidor() - { - $this->nom = "Fructidor"; - $this->datas = array(); - $this->messages = array(); - } - - function showSample() - { - $sample = ' -0297500000;05/09/2006;12:50:34;33617000000;France-Mobile-SFR;5;0.0116 -0297500001;05/09/2006;12:58:45;33240000000;France national ;124;0.0256 -0297500000;27/09/2006;16:18:18;33625000000;France-Mobile-SFR;4;0.0093 -0297500000;27/09/2006;16:22:32;33240000000;France national ;14;0.0029'; - - return $sample; - } - - function ReadFile($file) - { - $this->messages = array(); - dol_syslog("CdrFormatFructidor::ReadFile($file)", LOG_DEBUG); - $badformat = 0; - $error = 0; - $i = 0; - $line = 0; - $hf = fopen ($file, "r"); - - while (!feof($hf)) - { - $cont = fgets($hf, 1024); - - if (strlen(trim($cont)) > 0) - { - $tabline = explode(";", $cont); - if (sizeof($tabline) == 7) - { - $this->datas[$i]['index'] = $i; - $this->datas[$i]['ligne'] = ereg_replace('"','',$tabline[0]); - $this->datas[$i]['date'] = $tabline[1]; - $this->datas[$i]['heure'] = $tabline[2]; - $this->datas[$i]['numero'] = ereg_replace('"','',$tabline[3]); - $this->datas[$i]['tarif'] = trim($tabline[4]); - $this->datas[$i]['duree'] = trim($tabline[5]); - $this->datas[$i]['montant'] = trim($tabline[6]); - - if (preg_match("/\D/",$this->datas[$i]['numero'])) - { - array_push($this->messages,array('error',"Une ligne du fichier contient un numero invalide : ".$this->datas[$i]['numero'])); - $error++; - } - - $i++; - } - else - { - dol_syslog("CdrFormatFructidor::ReadFile Mauvais format de fichier ligne $line", LOG_ERR); - $badformat++; - } - $line++; - } - } - fclose($hf); - array_push($this->messages,array('info',"$line lignes lues dans le fichier")); - - if ($badformat > 0) - { - array_push($this->messages,array('error',"$badformat lignes ont un mauvais format dans le fichier")); - } - - dol_syslog("CdrFormatFructidor::ReadFile read $i lines", LOG_DEBUG); - - return $error; - } -} diff --git a/htdocs/telephonie/fournisseur/cdrformat/cdrformat.messidor.class.php b/htdocs/telephonie/fournisseur/cdrformat/cdrformat.messidor.class.php deleted file mode 100644 index d20126674d2..00000000000 --- a/htdocs/telephonie/fournisseur/cdrformat/cdrformat.messidor.class.php +++ /dev/null @@ -1,89 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * Format de CDR Messidor - * - * 1;"0240020000";02/08/2006;12:04:21;"0620770000";FRANCE MOBILE;01mn14;MX2;0,148;60; - * 6;"0240020000";02/08/2006;16:36:45;"0674290000";FRANCE MOBILE;08mn13;MX2;0,986;480; - * 3;"0240020000";02/08/2006;12:32:44;"0620770000";FRANCE MOBILE;02mn10;MX2;0,260;60; - * - */ - -class CdrFormatMessidor -{ - - function CdrFormatMessidor() - { - $this->nom = "Messidor"; - $this->datas = array(); - $this->messages = array(); - } - - function ShowSample() - { - $sample = ' -1;"0240020000";02/08/2006;12:04:21;"0620770000";FRANCE MOBILE;01mn14;MX2;0,148;60; -6;"0240020000";02/08/2006;16:36:45;"0674290000";FRANCE MOBILE;08mn13;MX2;0,986;480; -3;"0240020000";02/08/2006;12:32:44;"0620770000";FRANCE MOBILE;02mn10;MX2;0,260;60;'; - - return $sample; - } - - function ReadFile($file) - { - dol_syslog("CdrFormatMessidor::ReadFile($file)", LOG_DEBUG); - - $error = 0; - $i = 0; - $line = 1; - $hf = fopen ($file, "r"); - - while (!feof($hf)) - { - $cont = fgets($hf, 1024); - - if (strlen(trim($cont)) > 0) - { - $tabline = explode(";", $cont); - if (sizeof($tabline) == 11) - { - $this->datas[$i]['index'] = $tabline[0]; - $this->datas[$i]['ligne'] = ereg_replace('"','',$tabline[1]); - $date = $tabline[2]; - $this->datas[$i]['date'] = $date; - $this->datas[$i]['heure'] = $tabline[3]; - $this->datas[$i]['numero'] = ereg_replace('"','',$tabline[4]); - - $this->datas[$i]['montant'] = trim($tabline[8]); - $this->datas[$i]['duree'] = trim($tabline[9]); - $i++; - } - else - { - dol_syslog("CdrFormatMessidor::ReadFile Mauvais format de fichier ligne $line"); - } - } - $line++; - } - fclose($hf); - array_push($this->messages,array('info',"Fichier ".basename($file)." : $line lignes lues dans le fichier")); - dol_syslog("CdrFormatMessidor::ReadFile read $i lines", LOG_DEBUG); - } -} diff --git a/htdocs/telephonie/fournisseur/cdrformat/index.php b/htdocs/telephonie/fournisseur/cdrformat/index.php deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/telephonie/fournisseur/commande/commande.tableur.class.php b/htdocs/telephonie/fournisseur/commande/commande.tableur.class.php deleted file mode 100644 index 5d2187064b4..00000000000 --- a/htdocs/telephonie/fournisseur/commande/commande.tableur.class.php +++ /dev/null @@ -1,361 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require_once DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_workbook.inc.php"; -require_once DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_worksheet.inc.php"; -require_once DOL_DOCUMENT_ROOT."/telephonie/dolibarrmail.class.php"; -require_once DOL_DOCUMENT_ROOT."/telephonie/fournisseur/commande/methode.commande.class.php"; - -define ('COMMANDETABLEUR_NOEMAIL', -3); - -class CommandeMethodeTableur extends CommandeMethode -{ - - function CommandeMethodeTableur ($DB, $USER=0, $fourn=0) - { - dol_syslog("CommandeMethodeTableur::CommandeMethodeTableur"); - - - $this->nom = "Méthode Tableur joint"; - $this->db = $DB; - $this->user = $USER; - $this->fourn = $fourn; - } - - function info() - { - return "Envoi un fichier tableur contenant la liste des lignes à commander"; - } - - function Create() - { - dol_syslog("CommandeMethodeTableur::Create Fournisseur id : ".$this->fourn->id); - dol_syslog("CommandeMethodeTableur::Create Fournisseur email : ".$this->fourn->email_commande); - - $this->date = time(); - - $this->datef = "commande-".strftime("%d%b%y-%HH%M", $this->date); - - $this->filename = $this->datef.".xls"; - - $fname = DOL_DATA_ROOT ."/telephonie/ligne/commande/".$this->filename; - - if (strlen(trim($this->fourn->email_commande)) == 0) - { - $res = -3; - } - - if (file_exists($fname)) - { - $res = 2 ; - } - else - { - $res = $this->CreateFile($fname); - $res = $res + $this->LogSql(); - $res = $res + $this->MailFile($fname); - } - - dol_syslog("CommandeMethodeTableur::CommandeMethodeTableur Return $res"); - - return $res; - } - /** - * - * - * - * - */ - function MailFile($filename) - { - $sql = "SELECT l.ligne"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; - $sql .= " WHERE l.statut = 2"; - $sql .= " AND l.fk_fournisseur =".$this->fourn->id; - - $result = $this->db->query($sql); - - if ($result) - { - $num = $this->db->num_rows(); - } - - $subject = "Commande de Lignes N° ".$this->commande_id; - - $sendto = $this->fourn->email_commande; - - $from = TELEPHONIE_LIGNE_COMMANDE_EMAIL_BCC; - - $message = "Bonjour,\n\nVeuillez trouver ci-joint notre dernière commande.\n\n"; - $message .= "Nous avons à ce jour $num ligne(s) commandée(s) pour lesquelles nous attendons la confirmation de présélection.\n"; - $message .= "\nCordialement,\n\n"; - - $message .= "-- \n"; - $message .= $this->user->fullname."\n"; - - $mailfile = new DolibarrMail($subject, - $sendto, - $from, - $message); - - $mailfile->addr_bcc = TELEPHONIE_LIGNE_COMMANDE_EMAIL_BCC; - - $mailfile->PrepareFile(array($filename), - array("application/msexcel"), - array($this->datef.".xls")); - - - - $mailfile->write_to_file(); - - if ( $mailfile->sendfile() ) - { - return 0; - } - else - { - dol_syslog("CommandeMethodeTableur::MailFile Erreur send"); - } - - } - - /* - * Création du fichier - * - */ - - function CreateFile($fname) - { - $ligne = new LigneTel($db); - - $workbook = &new writeexcel_workbook($fname); - - $worksheet = &$workbook->addworksheet(); - - $worksheet->write(0, 0, "Commande du ".strftime("%d %B %Y %HH%M", $this->date)); - - $worksheet->set_column('A:A', 20); - $worksheet->set_column('B:B', 40); - $worksheet->set_column('C:C', 15); - $worksheet->set_column('D:D', 9); - $worksheet->set_column('E:E', 16); - $worksheet->set_column('F:F', 18); - $worksheet->set_column('G:G', 24); - - $formatcc =& $workbook->addformat(); - $formatcc->set_align('center'); - $formatcc->set_align('vcenter'); - - $formatccb =& $workbook->addformat(); - $formatccb->set_align('center'); - $formatccb->set_align('vcenter'); - $formatccb->set_bold(); - - $formatccbr =& $workbook->addformat(); - $formatccbr->set_align('center'); - $formatccbr->set_align('vcenter'); - $formatccbr->set_color('red'); - $formatccbr->set_bold(); - - $formatc =& $workbook->addformat(); - $formatc->set_align('vcenter'); - - $formatcb =& $workbook->addformat(); - $formatcb->set_align('vcenter'); - $formatcb->set_bold(); - - $i = 0; - - $this->ligneids = array(); - - $sqlall = "SELECT s.nom, s.rowid as socid, f.nom as fournisseur"; - $sqlall .= ", l.ligne, l.statut, l.rowid, l.remise"; - $sqlall .= ",".$this->db->pdate("l.date_commande") . " as date_commande"; - $sqlall .= " , comm.name, comm.firstname"; - $sqlall .= " FROM ".MAIN_DB_PREFIX."societe as s"; - $sqlall .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; - $sqlall .= " , ".MAIN_DB_PREFIX."societe as r"; - $sqlall .= " , ".MAIN_DB_PREFIX."user as comm"; - $sqlall .= " , ".MAIN_DB_PREFIX."telephonie_fournisseur as f"; - $sqlall .= " WHERE l.fk_soc = s.rowid AND l.fk_fournisseur = f.rowid"; - $sqlall .= " AND l.fk_soc_facture = r.rowid "; - $sqlall .= " AND l.fk_commercial = comm.rowid "; - $sqlall .= " AND f.rowid =".$this->fourn->id; - /* - * - */ - - $sql = $sqlall; - - $sql .= " AND l.statut in (1,4,8)"; - $sql .= " ORDER BY l.statut ASC"; - - $result = $this->db->query($sql); - - if ($result) - { - $num = $this->db->num_rows(); - - $worksheet->write(1, 0, "Clients", $formatc); - $worksheet->write(1, 1, "Adresses", $formatc); - $worksheet->write(1, 2, "CLI", $formatcc); - $worksheet->write(1, 3, "Préfixe", $formatcc); - $worksheet->write(1, 4, "Présélection", $formatcc); - $worksheet->write(1, 5, "Connexion", $formatcc); - $worksheet->write(1, 6, "Date de la demande", $formatcc); - - while ($i < $num) - { - $obj = $this->db->fetch_object(); - - if (strlen($obj->ligne)== 10) - { - - $j = $i + 2; - $k = $j + 1; - - $soc = new Societe($this->db); - $soc->fetch($obj->socid); - - $worksheet->write($j, 0, $obj->nom, $formatc); - $worksheet->write($j, 1, $soc->adresse. " " . $soc->cp . " " . $soc->ville, $formatc); - - $worksheet->write_string($j, 2, "$obj->ligne", $formatcc); - - $worksheet->write_string($j, 3, "Non", $formatcc); - $worksheet->write_string($j, 4, "Oui", $formatcc); - - if ($obj->statut == 1) - { - $worksheet->write($j, 5, "Ajouter", $formatccb); - $worksheet->write($j, 6, strftime("%d/%m/%y",$this->date), $formatcc); - } - elseif ($obj->statut == 8) - { - $worksheet->write($j, 5, "Ajouter", $formatccb); - $worksheet->write($j, 6, strftime("%d/%m/%y",$this->date), $formatcc); - } - elseif($obj->statut == 4) - { - $worksheet->write($j, 5, "A Résilier", $formatccbr); - $worksheet->write($j, 6, strftime("%d/%m/%y",$this->date), $formatcc); - } - else - { - $worksheet->write($j, 5, "", $formatccb); - $worksheet->write($j, 6, "", $formatccb); - } - - - array_push($this->ligneids, $obj->rowid); - } - $i++; - } - - $this->db->free(); - } - else - { - dol_syslog("CommandeMethodeTableur::CreateFile Erreur SQL 1"); - } - - /* - * Archives - * Insertion des anciennes lignes dans le fichier Excell - */ - - $sql = $sqlall; - - // $sql .= "AND l.statut > 0 AND l.statut <> 1 AND l.statut <> 4"; - // Modification on ajoute au fichier seulement les lignes en commandes - $sql .= " AND l.statut = 2"; - $sql .= " ORDER BY l.date_commande ASC"; - - $result = $this->db->query($sql); - - if ($result) - { - $num = $this->db->num_rows(); - $i = 0; - while ($i < $num) - { - $obj = $this->db->fetch_object($i); - - $jj = $i + $j + 2; - - $soc = new Societe($this->db); - $soc->fetch($obj->socid); - - $worksheet->write($jj, 0, $obj->nom, $formatc); - $worksheet->write($jj, 1, $soc->adresse. " " . $soc->cp . " " . $soc->ville, $formatc); - - $worksheet->write_string($jj, 2, "$obj->ligne", $formatcc); - - $worksheet->write_string($jj, 3, "Non", $formatcc); - $worksheet->write_string($jj, 4, "Oui", $formatcc); - - $worksheet->write($jj, 5, "", $formatccb); - $worksheet->write($jj, 6, "Commandée le ".strftime("%d/%m/%y",$obj->date_commande), $formatccb); - - - $i++; - } - - $this->db->free(); - } - else - { - dol_syslog("CommandeMethodeTableur::CreateFile Erreur SQL 2"); - } - - $workbook->close(); - - - /* - * Modifie le statut des lignes commandées - * - */ - - foreach ($this->ligneids as $lid) - { - $lint = new LigneTel($this->db); - $lint->fetch_by_id($lid); - if ($lint->statut == 1) - { - $lint->set_statut($this->user, 2); - } - - if ($lint->statut == 4) - { - $lint->set_statut($this->user, 5); - } - - if ($lint->statut == 8) - { - $lint->set_statut($this->user, 2); - } - } - - return 0; - - } -} diff --git a/htdocs/telephonie/fournisseur/commande/commande.text.class.php b/htdocs/telephonie/fournisseur/commande/commande.text.class.php deleted file mode 100644 index caf06202960..00000000000 --- a/htdocs/telephonie/fournisseur/commande/commande.text.class.php +++ /dev/null @@ -1,233 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * Classe de commande de ligne au format Texte - * - * - */ -require_once DOL_DOCUMENT_ROOT."/telephonie/dolibarrmail.class.php"; -require_once DOL_DOCUMENT_ROOT."/telephonie/fournisseur/commande/methode.commande.class.php"; - -define ('COMMANDETEXT_NOEMAIL', -3); - -class CommandeMethodeText extends CommandeMethode -{ - - function CommandeMethodeText ($DB, $USER=0, $fourn=0) - { - $this->nom = "Méthode texte"; - $this->db = $DB; - $this->user = $USER; - $this->fourn = $fourn; - } - - function info() - { - return "Envoi un fichier texte contenant la liste des lignes à commander"; - } - - function Create() - { - $this->date = time(); - - $this->datef = "ndi-".strftime("%d%b%y-%HH%M", $this->date); - - $this->filename = $this->datef.".txt"; - - $fname = DOL_DATA_ROOT ."/telephonie/ligne/commande/".$this->filename; - - if (strlen(trim($this->fourn->email_commande)) == 0) - { - return -3; - } - - if (file_exists($fname)) - { - return 2; - } - else - { - $res = $this->CreateFile($fname); - - if ($res == 0) - { - $res = $res + $this->LogSql(); - $res = $res + $this->MailFile($fname); - } - - return $res; - } - } - /** - * - * - */ - function MailFile($filename) - { - $sql = "SELECT l.ligne"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; - $sql .= " WHERE l.statut = 2"; - $sql .= " AND l.fk_fournisseur =".$this->fourn->id; - - $result = $this->db->query($sql); - - if ($result) - { - $num = $this->db->num_rows(); - } - - $subject = "Commande de Lignes N° ".$this->commande_id; - - $sendto = $this->fourn->email_commande; - - $from = TELEPHONIE_LIGNE_COMMANDE_EMAIL_BCC; - - $message = "Bonjour,\n\nVeuillez trouver ci-joint notre dernière commande.\n\n"; - $message .= "\n\nCordialement,\n\n"; - - $message .= "-- \n"; - $message .= $this->user->fullname."\n"; - - - $mailfile = new DolibarrMail($subject, - $sendto, - $from, - $message); - - $mailfile->addr_bcc = TELEPHONIE_LIGNE_COMMANDE_EMAIL_BCC; - - $mailfile->PrepareFile(array($filename), - array("plain/text"), - array($this->datef.".txt")); - - if ( $mailfile->sendfile() ) - { - return 0; - } - - } - - /** - * Creation du fichier - * - */ - - function CreateFile($fname) - { - $fp = fopen($fname, "w"); - - if ($fp) - { - fwrite ($fp, "Numcli;"); - fwrite ($fp, "nomclient;"); - fwrite ($fp, "NDI\n"); - - $this->ligneids = array(); - - $sqlall = "SELECT s.nom, s.rowid as socid, l.ligne, l.statut, l.rowid"; - $sqlall .= " , comm.name, comm.firstname"; - - $sqlall .= " FROM ".MAIN_DB_PREFIX."societe as s"; - $sqlall .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; - $sqlall .= " , ".MAIN_DB_PREFIX."user as comm"; - $sqlall .= " , ".MAIN_DB_PREFIX."telephonie_fournisseur as f"; - - $sqlall .= " WHERE l.fk_soc = s.rowid AND l.fk_fournisseur = f.rowid"; - - $sqlall .= " AND l.fk_commercial = comm.rowid "; - $sqlall .= " AND f.rowid =".$this->fourn->id; - /* - * - */ - $sql = $sqlall; - - $sql .= " AND l.statut in (1,4,8)"; - $sql .= " ORDER BY l.statut ASC"; - - $result = $this->db->query($sql); - - if ($result) - { - $i = 0; - $num = $this->db->num_rows(); - - while ($i < $num) - { - $obj = $this->db->fetch_object(); - - if (strlen($obj->ligne)== 10) - { - $soc = new Societe($this->db); - $soc->fetch($obj->socid); - - fwrite ($fp, $this->fourn->num_client); - fwrite ($fp, ";"); - fwrite ($fp, $obj->nom); - fwrite ($fp, ";"); - fwrite ($fp, $obj->ligne); - fwrite ($fp, "\n"); - - array_push($this->ligneids, $obj->rowid); - } - $i++; - } - - $this->db->free(); - } - else - { - print $this->db->error() . ' ' . $sql; - } - - fclose($fp); - - /* - * - * - */ - - foreach ($this->ligneids as $lid) - { - - $lint = new LigneTel($this->db); - $lint->fetch_by_id($lid); - if ($lint->statut == 1) - { - $lint->set_statut($this->user, 2); - } - if ($lint->statut == 4) - { - $lint->set_statut($this->user, 5); - } - if ($lint->statut == 8) - { - $lint->set_statut($this->user, 2); - } - } - - return 0; - - } - else - { - return -1; - } - } -} diff --git a/htdocs/telephonie/fournisseur/commande/commande.textp.class.php b/htdocs/telephonie/fournisseur/commande/commande.textp.class.php deleted file mode 100644 index 293867b9701..00000000000 --- a/htdocs/telephonie/fournisseur/commande/commande.textp.class.php +++ /dev/null @@ -1,221 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * Classe de commande de ligne au format Texte - * - * - */ -require_once DOL_DOCUMENT_ROOT."/telephonie/dolibarrmail.class.php"; -require_once DOL_DOCUMENT_ROOT."/telephonie/fournisseur/commande/methode.commande.class.php"; - -define ('COMMANDETEXT_NOEMAIL', -3); - -class CommandeMethodeTextP extends CommandeMethode -{ - - function CommandeMethodeTextP ($DB, $USER=0, $fourn=0) - { - $this->nom = "Méthode texte, variante sur le nom de fichier"; - $this->db = $DB; - $this->user = $USER; - $this->fourn = $fourn; - } - - function info() - { - return "Envoi un fichier texte contenant la liste des lignes à commander"; - } - - function Create() - { - $this->date = time(); - - $this->datef = "ndi-premium-".strftime("%d%b%y-%HH%M", $this->date); - - $this->filename = $this->datef.".txt"; - - $fname = DOL_DATA_ROOT ."/telephonie/ligne/commande/".$this->filename; - - if (strlen(trim($this->fourn->email_commande)) == 0) - { - return -3; - } - - if (file_exists($fname)) - { - return 2; - } - else - { - $res = $this->CreateFile($fname); - - if ($res == 0) - { - $res = $res + $this->LogSql(); - $res = $res + $this->MailFile($fname); - } - - return $res; - } - } - /** - * - * - */ - function MailFile($filename) - { - $subject = "Commande de Lignes Numero : ".$this->commande_id; - - $sendto = $this->fourn->email_commande; - - $from = TELEPHONIE_LIGNE_COMMANDE_EMAIL_BCC; - - $message = "Bonjour,\n\nVeuillez trouver ci-joint notre commande num : ".$this->commande_id.".\n\n"; - $message .= "\n\nCordialement,\n\n"; - - $message .= "-- \n"; - $message .= $this->user->fullname."\n"; - - - $mailfile = new DolibarrMail($subject, - $sendto, - $from, - $message); - - $mailfile->addr_bcc = TELEPHONIE_LIGNE_COMMANDE_EMAIL_BCC; - - $mailfile->PrepareFile(array($filename), - array("plain/text"), - array($this->datef.".txt")); - - if ( $mailfile->sendfile() ) - { - return 0; - } - - } - - /** - * Creation du fichier - * - */ - - function CreateFile($fname) - { - $fp = fopen($fname, "w"); - - if ($fp) - { - fwrite ($fp, "Numcli;"); - fwrite ($fp, "nomclient;"); - fwrite ($fp, "NDI\n"); - - $this->ligneids = array(); - - $sqlall = "SELECT s.nom, s.rowid as socid, l.ligne, l.statut, l.rowid"; - $sqlall .= " , comm.name, comm.firstname"; - - $sqlall .= " FROM ".MAIN_DB_PREFIX."societe as s"; - $sqlall .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; - $sqlall .= " , ".MAIN_DB_PREFIX."user as comm"; - $sqlall .= " , ".MAIN_DB_PREFIX."telephonie_fournisseur as f"; - - $sqlall .= " WHERE l.fk_soc = s.rowid AND l.fk_fournisseur = f.rowid"; - - $sqlall .= " AND l.fk_commercial = comm.rowid "; - $sqlall .= " AND f.rowid =".$this->fourn->id; - /* - * - */ - $sql = $sqlall; - - $sql .= " AND l.statut in (1,4,8)"; - $sql .= " ORDER BY l.statut ASC"; - - $resql = $this->db->query($sql); - - if ($resql) - { - $i = 0; - $num = $this->db->num_rows($resql); - - while ($i < $num) - { - $obj = $this->db->fetch_object($resql); - - if (strlen($obj->ligne)== 10) - { - $soc = new Societe($this->db); - $soc->fetch($obj->socid); - - fwrite ($fp, $this->fourn->num_client); - fwrite ($fp, ";"); - fwrite ($fp, $obj->nom); - fwrite ($fp, ";"); - fwrite ($fp, $obj->ligne); - fwrite ($fp, "\n"); - - array_push($this->ligneids, $obj->rowid); - } - $i++; - } - - $this->db->free($resql); - } - else - { - print $this->db->error() . ' ' . $sql; - } - - fclose($fp); - - /* - * - * - */ - - foreach ($this->ligneids as $lid) - { - - $lint = new LigneTel($this->db); - $lint->fetch_by_id($lid); - if ($lint->statut == 1) - { - $lint->set_statut($this->user, 2); - } - if ($lint->statut == 4) - { - $lint->set_statut($this->user, 5); - } - if ($lint->statut == 8) - { - $lint->set_statut($this->user, 2); - } - } - - return 0; - - } - else - { - return -1; - } - } -} diff --git a/htdocs/telephonie/fournisseur/commande/commande.web.class.php b/htdocs/telephonie/fournisseur/commande/commande.web.class.php deleted file mode 100644 index 2441a82b3dc..00000000000 --- a/htdocs/telephonie/fournisseur/commande/commande.web.class.php +++ /dev/null @@ -1,179 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * Classe de commande de ligne au format Texte - * - * - */ -require_once DOL_DOCUMENT_ROOT."/telephonie/dolibarrmail.class.php"; -require_once DOL_DOCUMENT_ROOT."/telephonie/fournisseur/commande/methode.commande.class.php"; - -define ('COMMANDETEXT_NOEMAIL', -3); - -class CommandeMethodeWeb extends CommandeMethode -{ - - function CommandeMethodeWeb ($DB, $USER=0, $fourn=0) - { - $this->nom = "Méthode web"; - $this->db = $DB; - $this->user = $USER; - $this->fourn = $fourn; - } - - function info() - { - return "Commande les lignes au travers du web"; - } - - function Create() - { - $this->date = time(); - - $this->datef = "comm-".$this->fourn->id."-".strftime("%d%b%y-%H:%M:%S", $this->date); - - $this->filename = $this->datef.".txt"; - - $fname = DOL_DATA_ROOT ."/telephonie/ligne/commande/".$this->filename; - - if (strlen(trim($this->fourn->email_commande)) == 0) - { - return -3; - } - - if (file_exists($fname)) - { - return 2; - } - else - { - $res = $this->CreateFile($fname); - - if ($res == 0) - { - $res = $res + $this->LogSql(); - } - - return $res; - } - } - - /** - * Creation du fichier - * - */ - - function CreateFile($fname) - { - $fp = fopen($fname, "w"); - - if ($fp) - { - fwrite ($fp, "Numcli;"); - fwrite ($fp, "nomclient;"); - fwrite ($fp, "NDI\n"); - - $this->ligneids = array(); - - $sqlall = "SELECT s.nom, s.rowid as socid, l.ligne, l.statut, l.rowid"; - $sqlall .= " , comm.name, comm.firstname"; - - $sqlall .= " FROM ".MAIN_DB_PREFIX."societe as s"; - $sqlall .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; - $sqlall .= " , ".MAIN_DB_PREFIX."user as comm"; - $sqlall .= " , ".MAIN_DB_PREFIX."telephonie_fournisseur as f"; - - $sqlall .= " WHERE l.fk_soc = s.rowid AND l.fk_fournisseur = f.rowid"; - - $sqlall .= " AND l.fk_commercial = comm.rowid "; - $sqlall .= " AND f.rowid =".$this->fourn->id; - /* - * - */ - $sql = $sqlall; - - $sql .= " AND l.statut in (1,8)"; - $sql .= " ORDER BY l.statut ASC"; - - $resql = $this->db->query($sql); - - if ($resql) - { - $i = 0; - $num = $this->db->num_rows($resql); - - while ($i < $num) - { - $obj = $this->db->fetch_object($resql); - - if (strlen($obj->ligne)== 10) - { - $soc = new Societe($this->db); - $soc->fetch($obj->socid); - - fwrite ($fp, $this->fourn->num_client); - fwrite ($fp, ";"); - fwrite ($fp, $obj->nom); - fwrite ($fp, ";"); - fwrite ($fp, $obj->ligne); - fwrite ($fp, "\n"); - - array_push($this->ligneids, $obj->rowid); - } - $i++; - } - - $this->db->free($resql); - } - else - { - print $this->db->error() . ' ' . $sql; - } - - fclose($fp); - - /* - * - * - */ - - foreach ($this->ligneids as $lid) - { - - $lint = new LigneTel($this->db); - $lint->fetch_by_id($lid); - if ($lint->statut == 1) - { - $lint->set_statut($this->user, 9); - } - if ($lint->statut == 8) - { - $lint->set_statut($this->user, 9); - } - } - - return 0; - } - else - { - return -1; - } - } -} diff --git a/htdocs/telephonie/fournisseur/commande/index.php b/htdocs/telephonie/fournisseur/commande/index.php deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/telephonie/fournisseur/commande/methode.commande.class.php b/htdocs/telephonie/fournisseur/commande/methode.commande.class.php deleted file mode 100644 index 714d3e95205..00000000000 --- a/htdocs/telephonie/fournisseur/commande/methode.commande.class.php +++ /dev/null @@ -1,66 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -class CommandeMethode -{ - - function LogSql() - { - $error = 0; - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_commande"; - $sql .= " (datec, fk_user_creat, fk_fournisseur, filename)"; - $sql .= " VALUES (now(),".$this->user->id.",".$this->fourn->id.",'".$this->filename."')"; - - $resql = $this->db->query($sql); - - if ($resql) - { - $this->commande_id = $this->db->last_insert_id(MAIN_DB_PREFIX."telephonie_commande"); - - /* - * Modifie le statut des lignes commandées - * - */ - foreach ($this->ligneids as $lid) - { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_commande_ligne"; - $sql .= " (fk_commande, fk_ligne)"; - $sql .= " VALUES (".$this->commande_id.",".$lid.")"; - - if (! $this->db->query($sql) ) - { - $error++; - dol_syslog($sql); - } - } - } - else - { - $error++; - dol_syslog($sql); - } - - return $error; - - } -} diff --git a/htdocs/telephonie/fournisseur/fiche.php b/htdocs/telephonie/fournisseur/fiche.php deleted file mode 100644 index 6dafd4423a7..00000000000 --- a/htdocs/telephonie/fournisseur/fiche.php +++ /dev/null @@ -1,306 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require("./pre.inc.php"); -require_once(DOL_DOCUMENT_ROOT.'/telephonie/telephonie.tarif.grille.class.php'); - -if (!$user->rights->telephonie->fournisseur->lire) - accessforbidden(); - -$mesg = ''; - -if ($_POST["action"] == 'add') -{ - $fourn = new FournisseurTelephonie($db); - - $fourn->nom = $_POST["nom"]; - $fourn->email_commande = $_POST["email_commande"]; - $fourn->methode_commande = $_POST["methode"]; - $fourn->cdrformat = $_POST["cdrformat"]; - $fourn->grille = $_POST["grille"]; - - if ( $fourn->create($user) == 0) - { - Header("Location: index.php"); - } -} - -if ($_POST["action"] == 'update' && $_GET["id"]) -{ - $fourn = new FournisseurTelephonie($db); - - if ($fourn->fetch($_GET["id"]) == 0) - { - - $fourn->num_client = $_POST["num_client"]; - $fourn->email_commande = $_POST["email_commande"]; - $fourn->methode_commande = $_POST["methode"]; - $fourn->cdrformat = $_POST["cdrformat"]; - $fourn->commande_bloque = $_POST["commande_bloque"]; - $fourn->grille = $_POST["grille"]; - - if ( $fourn->update($user) == 0) - { - Header("Location: fiche.php?id=".$fourn->id); - } - } -} - -if ($_GET["action"] == 'active') -{ - $fourn = new FournisseurTelephonie($db); - $fourn->id = $_GET["id"]; - - if ( $fourn->active($user) == 0) - { - Header("Location: index.php"); - } -} - -if ($_GET["action"] == 'desactive') -{ - $fourn = new FournisseurTelephonie($db); - $fourn->id = $_GET["id"]; - - if ( $fourn->desactive($user) == 0) - { - Header("Location: index.php"); - } -} - -llxHeader("","Telephonie - Fournisseur"); - -if ($cancel == $langs->trans("Cancel")) -{ - $action = ''; -} - -$ta = new TelephonieTarifGrille($db); -$ta->GetListe($user,'achat'); - -/* - * Création - * - */ - -if ($_GET["action"] == 'create') -{ - $fourn = new FournisseurTelephonie($db); - print "
\n"; - print ''; - print ''; - - print_titre("Nouveau fournisseur"); - - print ''; - - print ''; - print ''; - - $html = new Form($db); - - $arr = $fourn->array_methode(); - $cdr = $fourn->array_cdrformat(); - - print ''; - print ''; - print ''; - - print ''; - print ''; - print ''; - - $ta->liste_name[0] = ' Creer une nouvelle grille'; - asort($ta->liste_name); - print ''; - print ''; - print ''; - - print ''; - print '
Nom
Email de commandeadresse email à laquelle sont envoyées les commandes de lignes
Méthode de commande'; - print $html->select_array("methode",$arr,$fourn->class_commande); - print 'méthode utilisée pour les commandes de lignes
Format de CDR'; - print $html->select_array("cdrformat",$cdr,$fourn->cdrformat); - print 'Format des fichiers CDR
Grille de tarif'; - print $html->select_array("grille",$ta->liste_name); - print 'Grille de tarif
 
'; - print '
'; -} - -/* - * Visualisation & Edition - * - */ -if ($_GET["id"] > 0) -{ - $art[0] = "non"; - $art[1] = "oui"; - - $fourn = new FournisseurTelephonie($db); - if ($fourn->fetch($_GET["id"]) == 0) - { - - if ($_GET["action"] == "edit" && $user->rights->telephonie->fournisseur->config) - { - /* - * Edition - * - */ - print_titre("Modification fournisseur"); - - print '
'; - print ''; - print ''; - - print ''; - - print ''; - - print ''; - print ''; - print ''; - - print ''; - print ''; - print ''; - - $html = new Form($db); - - $arr = $fourn->array_methode(); - $cdr = $fourn->array_cdrformat(); - - print ''; - print ''; - print ''; - - print ''; - print ''; - print ''; - - print ''; - print ''; - print ''; - - - - print ''; - print ''; - print ''; - - print ''; - print '
Nom'.$fourn->nom.'
Numéro ClientNotre numéro de client
Email de commandeadresse email à laquelle sont envoyées les commandes de lignes
Méthode de commande'; - print $html->select_array("methode",$arr,$fourn->class_commande); - print 'méthode utilisée pour les commandes de lignes
Format de CDR'; - print $html->select_array("cdrformat",$cdr,$fourn->cdrformat); - print 'Format des fichiers CDR
Blocage des commandes'; - - print $html->select_array("commande_bloque",$art,$fourn->commande_bloque); - print 'Les commandes vers ce fournisseur sont bloquées
Grille de tarif'; - print $html->select_array("grille",$ta->liste_name, $fourn->grille); - print 'Grille de tarif

'; - } - else - { - /* - * Visualisation - * - */ - $h = 0; - $head[$h][0] = DOL_URL_ROOT."/telephonie/fournisseur/fiche.php?id=".$fourn->id; - $head[$h][1] = $langs->trans("Fiche"); - $hselected = $h; - $h++; - /* - $head[$h][0] = DOL_URL_ROOT."/telephonie/fournisseur/cdr.php?id=".$fourn->id; - $head[$h][1] = $langs->trans("CDR"); - $h++; - */ - dol_fiche_head($head, $hselected, 'Fournisseur : '.$fourn->nom); - - print ''; - - print ''; - - print ''; - print ''; - print ''; - - print ''; - print ''; - print ''; - - print ''; - print ''; - print ''; - - print ''; - print ''; - print ''; - - print ''; - print ''; - print ''; - - print ''; - print ''; - print ''; - print '
Nom'.$fourn->nom.'
Numéro Client'.$fourn->num_client.'Notre numéro de client
Email de commande'.$fourn->email_commande.'adresse email à laquelle sont envoyées les commandes de lignes
Méthode de commande'.$fourn->class_commande.'méthode utilisée pour les commandes de lignes
Format de CDR'.$fourn->cdrformat.'Format des fichiers CDR
Blocage des commandes'.$art[$fourn->commande_bloque].'Les commandes sont bloquées
Grille de tarif'.$ta->liste_name[$fourn->grille].'Grille de tarif

'; - print 'Format de CDR
'; - - if (strlen($fourn->cdrformat)) - { - if (@require_once(DOL_DOCUMENT_ROOT."/telephonie/fournisseur/cdrformat/cdrformat.".$fourn->cdrformat.".class.php")) - { - $format = "CdrFormat".ucfirst($fourn->cdrformat); - $cdrformat = new $format(); - print '
'.$cdrformat->ShowSample().'
'; - } - } - print ''; - - } - } -} - -/* ************************************************************************** */ -/* */ -/* Barre d'action */ -/* */ -/* ************************************************************************** */ - -print "\n
\n"; - -if ($_GET["action"] == '') -{ - if($user->rights->telephonie->fournisseur->config) - - { - print ''.$langs->trans("Modify").''; - } -} - -print "
"; - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/fournisseur/index.php b/htdocs/telephonie/fournisseur/index.php deleted file mode 100644 index 4783f38ef0e..00000000000 --- a/htdocs/telephonie/fournisseur/index.php +++ /dev/null @@ -1,128 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -$user->getrights('telephonie'); - -if (!$user->rights->telephonie->fournisseur->lire) - accessforbidden(); - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; - -llxHeader(); - -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -if ($sortorder == "") { - $sortorder="ASC"; -} -if ($sortfield == "") { - $sortfield="f.nom"; -} - -if ($page == -1) { $page = 0 ; } - -$offset = $conf->liste_limit * $page ; -$pageprev = $page - 1; -$pagenext = $page + 1; - -/* - * Mode Liste - * - */ - -$sql = "SELECT f.rowid, f.nom, f.email_commande, f.commande_active"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_fournisseur as f"; - -$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); - -$result = $db->query($sql); -if ($result) -{ - $num = $db->num_rows(); - $i = 0; - - print_barre_liste("Fournisseurs", $page, "fournisseurs.php", "", $sortfield, $sortorder, '', $num); - - print ''; - print ''; - print ''; - print_liste_field_titre("Société","fournisseurs.php","s.nom"); - print ''; - print ''; - - if($user->rights->telephonie->fournisseur->config) - { - print ''; - } - - print "\n"; - $var=True; - - while ($i < min($num,$conf->liste_limit)) - { - $obj = $db->fetch_object($i); - $var=!$var; - - print ""; - print "\n"; - print '\n"; - print "\n"; - print '\n"; - - if($user->rights->telephonie->fournisseur->config) - { - print ''; - } - - print "\n"; - $i++; - } - print "
Id.Email de commandeCommande possible 
".$obj->rowid."'.stripslashes($obj->nom)."".$obj->email_commande."'.$langs->trans($yesno[$obj->commande_active])."'; - if ($obj->commande_active) - { - print 'Désactive'; - } - else - { - print 'Active'; - } - print '
"; - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/fournisseur/pre.inc.php b/htdocs/telephonie/fournisseur/pre.inc.php deleted file mode 100644 index da0e336e814..00000000000 --- a/htdocs/telephonie/fournisseur/pre.inc.php +++ /dev/null @@ -1,65 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("../../main.inc.php"); -require(DOL_DOCUMENT_ROOT."/telephonie/fournisseurtel.class.php"); -$user->getrights('telephonie'); - -function llxHeader($head = "", $title="") { - global $user; - - /* - * - * - */ - top_menu($head, $title); - - $menu = new Menu(); - - $menu->add(DOL_URL_ROOT."/telephonie/index.php", "Telephonie"); - - $menu->add(DOL_URL_ROOT."/telephonie/client/index.php", "Clients"); - - $menu->add(DOL_URL_ROOT."/telephonie/contrat/", "Contrats"); - - $menu->add(DOL_URL_ROOT."/telephonie/ligne/index.php", "Lignes"); - - if ($user->rights->telephonie->ligne_commander) - $menu->add(DOL_URL_ROOT."/telephonie/ligne/commande/", "Commandes"); - - if ($user->rights->telephonie->stats->lire) - $menu->add(DOL_URL_ROOT."/telephonie/stats/", "Statistiques"); - - $menu->add(DOL_URL_ROOT."/telephonie/facture/", "Factures"); - - $menu->add(DOL_URL_ROOT."/telephonie/tarifs/", "Tarifs"); - - $menu->add(DOL_URL_ROOT."/telephonie/fournisseur/index.php", "Fournisseurs"); - - if($user->rights->telephonie->fournisseur->config) - { - $menu->add_submenu(DOL_URL_ROOT."/telephonie/fournisseur/fiche.php?action=create", "Nouveau"); - } - - left_menu($menu->liste); -} - -?> diff --git a/htdocs/telephonie/fournisseurtel.class.php b/htdocs/telephonie/fournisseurtel.class.php deleted file mode 100644 index 44edd61bf57..00000000000 --- a/htdocs/telephonie/fournisseurtel.class.php +++ /dev/null @@ -1,298 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require_once(DOL_DOCUMENT_ROOT.'/telephonie/telephonie.tarif.grille.class.php'); - -class FournisseurTelephonie { - var $db; - var $id; - - /** - * Créateur - * - * - */ - function FournisseurTelephonie($DB, $id=0) - { - $this->db = $DB; - $this->id = $id; - $this->classdir = DOL_DOCUMENT_ROOT.'/telephonie/fournisseur/commande/'; - $this->cdrformatdir = DOL_DOCUMENT_ROOT.'/telephonie/fournisseur/cdrformat/'; - return 1; - } - /** - * - * - */ - function create($user) - { - $res = 0; - - if ($this->grille == 0) - { - $grille = new TelephonieTarifGrille($this->db); - - if ($grille->CreateGrille($user, $this->nom, 'achat') <> 0) - { - $res = -2; - } - $this->grille = $grille->id; - } - - if ($res == 0) - { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_fournisseur"; - $sql .= " (nom, email_commande, commande_active, class_commande,fk_tarif_grille,cdrformat)"; - $sql .= " VALUES ('".$this->nom."','".$this->email_commande."',1,'".$this->methode_commande."','".$this->grille."','".$this->cdrformat."');"; - - if ($this->db->query($sql) ) - { - $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."telephonie_fournisseur"); - @mkdir(DOL_DATA_ROOT."/telephonie/cdr/atraiter/".$this->id); - } - else - { - $res = -1; - } - } - return $res; - } - /** - * Mets a jour les informations dans la base de donnees - * - */ - function update() - { - $res = 0; - - $sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_fournisseur"; - $sql .= " SET "; - $sql .= " email_commande = '".$this->email_commande."'"; - $sql .= ", num_client = '".$this->num_client."'"; - $sql .= ", class_commande = '".$this->methode_commande."'"; - $sql .= ", commande_bloque = '".$this->commande_bloque."'"; - $sql .= ", cdrformat = '".$this->cdrformat."'"; - $sql .= ", fk_tarif_grille='".$this->grille."'"; - $sql .= " WHERE rowid = ".$this->id; - - if (! $this->db->query($sql) ) - { - $res = -1; - } - - /* Cree le repertoire d'upload des CDR */ - if (!is_dir(DOL_DATA_ROOT."/telephonie/cdr/atraiter/".$this->id)) - { - @mkdir(DOL_DATA_ROOT."/telephonie/cdr/atraiter/".$this->id); - } - - - return $res; - } - /** - * - * - */ - function fetch($id) - { - $this->id = $id; - - $sql = "SELECT f.rowid, f.nom, f.email_commande, f.commande_active"; - $sql .= ", f.class_commande, f.commande_bloque, f.fk_tarif_grille"; - $sql .= ", f.num_client, f.cdrformat"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_fournisseur as f"; - $sql .= " WHERE f.rowid = ".$this->id; - - if ($this->db->query($sql)) - { - if ($this->db->num_rows()) - { - $obj = $this->db->fetch_object(0); - - $this->nom = stripslashes($obj->nom); - $this->num_client = $obj->num_client; - $this->email_commande = $obj->email_commande; - $this->commande_enable = $obj->commande_active; - $this->class_commande = $obj->class_commande; - $this->commande_bloque = $obj->commande_bloque; - $this->cdrformat = $obj->cdrformat; - $this->grille = $obj->fk_tarif_grille; - - return 0; - } - else - { - dol_syslog("FournisseurTelephonie::Fetch Erreur id=".$this->id); - return -1; - } - } - else - { - dol_syslog("FournisseurTelephonie::Fetch Erreur SQL id=".$this->id); - return -2; - } - } - /** - * - * - */ - function active() - { - $res = 0; - $sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_fournisseur"; - $sql .= " SET commande_active = 1"; - $sql .= " WHERE rowid = ".$this->id; - - if (! $this->db->query($sql) ) - { - $res = -1; - } - return $res; - } - /** - * - * - */ - function desactive() - { - $res = 0; - $sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_fournisseur"; - $sql .= " SET commande_active = 0"; - $sql .= " WHERE rowid = ".$this->id; - - if (! $this->db->query($sql) ) - { - $res = -1; - } - return $res; - } - /** - * Retourne la liste des classe de format de commande - * - * - * - */ - function array_methode() - { - clearstatcache(); - $handle=opendir($this->classdir); - $arr = array(); - - while (($file = readdir($handle))!==false) - { - if (is_readable($this->classdir.$file) && substr($file, 0, 8) == 'commande' && substr($file, -10) == '.class.php') - { - - $name = substr($file, 9, strlen($file) -19); - - $filebis = $this->classdir . $file; - - // Chargement de la classe de numérotation - $classname = "CommandeMethode".ucfirst($name); - - require_once($filebis); - - $obj = new $classname($this->db); - - $arr[$name] = $obj->nom; - } - - } - return $arr; - } - /** - * Retourne la liste des classe de format de commande - */ - function array_cdrformat() - { - clearstatcache(); - $handle=opendir($this->cdrformatdir); - $arr = array(); - - while (($file = readdir($handle))!==false) - { - if (is_readable($this->cdrformatdir.$file) && substr($file, 0, 9) == 'cdrformat' && substr($file, -10) == '.class.php') - { - $name = substr($file, 10, strlen($file) -20); - $filebis = $this->classdir . $file; - - // Chargement de la classe de numérotation - $classname = "CdrFormat".ucfirst($name); - - require_once($this->cdrformatdir.$file); - - $obj = new $classname($this->db); - - $arr[$name] = $obj->nom; - } - - } - return $arr; - } - /** - * Crée une commande pour ce fournisseur - * - * - * - */ - function CreateCommande($user) - { - dol_syslog("FournisseurTelephonie::CreateCommande User:$user->id"); - - $fileclass = $this->classdir.'commande.'.$this->class_commande.'.class.php'; - - require_once($fileclass); - - $classname = "CommandeMethode".ucfirst($this->class_commande); - - dol_syslog("FournisseurTelephonie::CreateCommande user $classname"); - - $ct = new $classname($this->db, $user, $this); - - $result = $ct->create(); - - return $result; - } - /** - * Retourne un tableau des founisseurs actifs - * - * - */ - function getActives() - { - $fourns = array(); - $sql = "SELECT rowid, nom FROM ".MAIN_DB_PREFIX."telephonie_fournisseur"; - $resql = $this->db->query($sql); - - if ($resql) - { - while ($obj = $this->db->fetch_object($resql)) - { - $fourns[$obj->rowid] = stripslashes($obj->nom); - } - } - - $this->db->free($resql); - - return $fourns; - } -} -?> diff --git a/htdocs/telephonie/graph-1.png b/htdocs/telephonie/graph-1.png deleted file mode 100644 index 7a8fb19836863bc7b7f7eee1f809db6adf2fc626..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 198 zcmeAS@N?(olHy`uVBq!ia0vp^JRr=$1|-8uW1a&kwj^(N7l!`~4GjPP3v~Pgif|Tq zL>2>eTxVe5JHn{gn6eot$X?><>&kwGi=9VV&|ki)3@9X9;u=xnoS&PUnpeW$T$Gwv zlA5AWo>`Ki5R#Fq;O^-g@IFN~52#Sf)5S5Q;#P7>Lc)*p4onG&2|&jG`4+Z4Jv}@= lJSt6ryv@$c$}2sY87}9risv)*uLbI2@O1TaS?83{1OPk+H@pA< diff --git a/htdocs/telephonie/graph1.png b/htdocs/telephonie/graph1.png deleted file mode 100644 index 134f1b74b305154a2e4ab14812c4ffa37f6c9035..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 197 zcmeAS@N?(olHy`uVBq!ia0vp^JRr=$1|-8uW1a&kwj^(N7l!{JxM1({$v_d#0*}aI zppNSd417lz6&q7F0|nVjJbhi+uW+$)vg%Z1?^gy2$(FcAlsM<-=BDPAFgO>bCYGe8 zD3oWGWGIAWq$;?3`UbpDQOyG?)bw<545_%4oRX06bCYGe8 zD3oWGWGIAWq$;?3`UbpDQOyG?RP}Um45_%4oRX06bCYGe8 zD3oWGWGIAWq$;?3`UbpDQOyG?)bez345_%4oRX06gTe~DWM4f+%-8K diff --git a/htdocs/telephonie/graph6.png b/htdocs/telephonie/graph6.png deleted file mode 100644 index 4d8f59be1c226e76c2ddc5a89f5bde2f7de5da8e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 193 zcmeAS@N?(olHy`uVBq!ia0vp^JRr=$1|-8uW1a&kwj^(N7l!{JxM1({$v_d#0*}aI zppNSd417lz6&q7F0|nVjJbhi+uW+&RC~7F_O!xy7k}YwKC~?lu%}vcKVQ?-=O)N=G zQ7F$W$xsN%NL6t6^bL5QqM8R(sOstB7*cU7IVBZOB%3JUOAoFUl*+*Fxn1%h!w7D+FqJxR0yKO#>Rh;OXk;vd$@?2>{d!Kmh;% diff --git a/htdocs/telephonie/graph8.png b/htdocs/telephonie/graph8.png deleted file mode 100644 index 16a0e14fe2bd441c0821b8e338e811852a30b566..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 222 zcmeAS@N?(olHy`uVBq!ia0vp^JRr=$1|-8uW1a&kwj^(N7l!{JxM1({$v_d#0*}aI zppNSd417lz6&q7F0|nVjJbhi+ud?v+S{TK}s&fK`WJ_ElN}Tg^b5rw57@Uhz6H8K4 z6v{J8G895GQWe}ieFNU7sOA9`I(fP{hG?9hI?0iX!GPoNrA`0qE3MzCbVQu@oVcpN z+kldpz>MP#8W|_zO)z_l2+Ohb!-vg}|dHK`#9%JT}=Mle?$+sG48iS{+ KpUXO@geCy^bwz>z diff --git a/htdocs/telephonie/index.php b/htdocs/telephonie/index.php deleted file mode 100644 index d8ccee9fbfd..00000000000 --- a/htdocs/telephonie/index.php +++ /dev/null @@ -1,199 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if (!$user->rights->telephonie->lire) accessforbidden(); - -llxHeader('','Telephonie'); - -/* - * - * - * - */ - -print ''; -print ''; - -print ''; -print '
'; - -print '
'; -print ''; -print ''; -print "\n"; -print ""; -print ''; -print '
Recherche ligne
Numéro

'; - -print '
'; -print ''; -print ''; -print "\n"; -print ""; -print ''; -print '
Recherche contrat
Numéro

'; - -print '
'; -print ''; -print ''; -print "\n"; -print ""; -print ''; -print '
Recherche client
Nom
'; - -print '
'; - - - - -print '
'; - -$sql = "SELECT distinct statut, count(*) as cc"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; -$sql .= ",".MAIN_DB_PREFIX."societe_perms as sp"; -$sql .= " WHERE l.fk_client_comm = sp.fk_soc"; -$sql .= " AND sp.fk_user = ".$user->id." AND sp.pread = 1"; -$sql .= " GROUP BY statut"; - -$resql = $db->query($sql); - -if ($resql) -{ - $num = $db->num_rows($resql); - $i = 0; - $ligne = new LigneTel($db); - - print ''; - print ''; - print "\n"; - $var=True; - - while ($i < $num) - { - $obj = $db->fetch_object($resql); - $var=!$var; - - print ""; - print "\n"; - print '\n"; - print ''; - print "\n"; - $i++; - } - - print "
Lignes StatutsNb 
".$ligne->statuts[$obj->statut]."'.$obj->cc."
"; - $db->free($resql); -} -else -{ - print $db->error() . ' ' . $sql; -} - -print '
'; - -print '
'; - -if ($user->rights->telephonie->fournisseur->lire) -{ - print '
'; - - /* - * Fournisseurs - * - */ - $statuts = array(); - $sql = "SELECT count(*), l.fk_fournisseur, l.statut"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; - $sql .= " ,".MAIN_DB_PREFIX."societe_perms as sp"; - $sql .= " WHERE l.fk_client_comm = sp.fk_soc"; - $sql .= " AND sp.fk_user = ".$user->id." AND sp.pread = 1"; - $sql .= " GROUP BY l.fk_fournisseur, l.statut"; - $resql = $db->query($sql); - - if ($resql) - { - while ($row = $db->fetch_row($resql)) - { - $statuts[$row[1]][$row[2]] = $row[0]; - } - } - - $sql = "SELECT distinct f.nom as fournisseur, f.rowid, count(*) as cc"; - $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; - $sql .= " ,".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; - $sql .= " ,".MAIN_DB_PREFIX."telephonie_fournisseur as f"; - $sql .= " ,".MAIN_DB_PREFIX."societe_perms as sp"; - $sql .= " WHERE l.fk_soc = s.rowid AND l.fk_fournisseur = f.rowid"; - $sql .= " AND l.fk_client_comm = sp.fk_soc"; - $sql .= " AND sp.fk_user = ".$user->id." AND sp.pread = 1"; - $sql .= " GROUP BY f.nom"; - - $resql = $db->query($sql); - - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - - print ''; - print ''; - for ($j = -1 ; $j < 10 ; $j++) - { - print ''; - } - print "\n"; - $var=True; - - while ($i < min($num,$conf->liste_limit)) - { - $obj = $db->fetch_object($resql); - $var=!$var; - - print ""; - print ''; - print '\n"; - - for ($k = -1 ; $k < 10 ; $k++) - { - print ''; - } - - print "\n"; - $i++; - } - print "
FournisseurNb lignes
'; - print $obj->fournisseur.''.$obj->cc."'.$statuts[$obj->rowid][$k].'
"; - $db->free($resql); - } - else - { - print $db->error() . ' ' . $sql; - } -} - -print '
'; - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/interdit.png b/htdocs/telephonie/interdit.png deleted file mode 100644 index 2f61e5a4133b24402c34f59255c5822c2945e1a4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1679 zcmdUw`#Tc~9LAU2N@S*4bkH7AxolC^maH_n#AJyb*Btljq~&s4Iz_IHOHqP!y86V|$`(zrO(hD1p9e7l2#_*$EYhc8=BxoIUbNamj(VuA^`w-IXldGm$-?QsSX0p z>(EcDFv2;w8u7PE{opZs_3(S72j+FMQ@Sc!yS#!8(#a5o1Nu)x?^G8*q85O?fjDG@&Is(2Rmjw<>2cnY$HK##UmegN*w6kKz>%iW!mW z7^XMfdj`#oWJou+I2=y9vi9UL`62XVUGDRShU*`ukd#)@R#PykQo5dF5dUe>xg(`l zWl#+78g6Owrc=)*xMDm_xG!JYn-tY>`33g#bG^CME}=0oPw61BR^f)gsvM3+!=NK0 zBT35I6DTsph@p4;$b;cWVT9dI6vX1p6jXmY10 zaQ2J1ipw!l5ueMr+Qgqd(V|pY_=YH*m`8V->;9?6L3;hRy$mB2U?Fo{#&uuL^1?)hHM+L;d&X(XK+xdB0@i%= zvoD``BNaBeS$!*$jGNfu;FDMi>IjtS|6o3C$h~*iN14mq;B)CqnjtcnwpbS&aj6=ln?Rpa57#KrquKIviw;dL8NqK2<_ zdAr)o>m%a>`c5`^q_B|itFWl$D((`qw`}`!RPS0M*k3ATmMA- zhmo-{Z>n*o9f9%)5ZBN5gf_K!)?I_gy&s_9s!x_(-!c>nie4=Nv%A-LBL=htv1O-M zZ^s<1o$w49vpm)sD@cQ5lih+H@K7~HS@|i2A(qEJl;G7|VQFX+nKiF%nYg$bhxwC7 z1ZQ_|Y8&_-1i2nnSIcwIH|ww8n2r`oB?J*W4MBLVSG%fcSju)c0y8G3lW)9;>fHD& ztjaijC`WrxxW4KKMBdu6@Fn$%VY$7H&CSJw??IWV&M;sMMO`DiyT*;4B`z$D)G+Z> z%^RemwbpTIOsS=J!(UW;5C~*mYFxxpjytj#w)R0HMIaCfi953%h6Xl{-!}y3OMGkn zzC%XqY3I7ta17n*AX^cSZaQrmBc>EU1#uagDnSbcgbhIC1 z(iqHodO(&UtfkXyG>{AUxfAh(Tk9L5FklIptU2)RY>7iwUw^+t4QFZoYWYs(JP$@B zaJ2aDR^YC|13O^7SZBQmtf-ID55HB#$GipBdpPYl^+l9I@6vB~y69+B9x)8&n8 z1MiY5yKw5(n_XI6doGPfu-GqB6ueBh-Psy~*X - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require("./pre.inc.php"); -require(DOL_DOCUMENT_ROOT."/telephonie/fournisseurtel.class.php"); -$mesg = ''; - -llxHeader("","","Fiche Ligne"); - -if ($_GET["id"] or $_GET["numero"]) -{ - if ($_GET["action"] <> 're-edit') - { - $ligne = new LigneTel($db); - if ($_GET["id"]) - { - $result = $ligne->fetch_by_id($_GET["id"]); - } - if ($_GET["numero"]) - { - $result = $ligne->fetch($_GET["numero"]); - } - } - - if ( $result ) - { - - $h=0; - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/fiche.php?id=".$ligne->id; - $head[$h][1] = $langs->trans("Ligne"); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/commande.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Commande'); - $hselected = $h; - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/infoc.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Infos'); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/history.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Historique'); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/conso.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Conso'); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/stat.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Stats'); - $h++; - - dol_fiche_head($head, $hselected, 'Ligne : '.$ligne->numero); - - print_fiche_titre('Factures Ligne', $mesg); - - print ''; - - print ''; - - $client = new Societe($db, $ligne->client_id); - $client->fetch($ligne->client_id); - - print ''; - - $client_facture = new Societe($db); - $client_facture->fetch($ligne->client_facture_id); - - print ''; - print '
Num�ro'.dol_print_phone($ligne->numero,0,0,true).'
Client'; - - print ''; - print $client->nom.'
Client Factur�'.$client_facture->nom.'
'; - - $ftx = new FournisseurTelephonie($db, $ligne->fournisseur_id); - $ftx->fetch($ligne->fournisseur_id); - - if (strlen($ligne->numero) <> 10) - { - $ok_commande = 0; - } - else - { - $ok_commande = 1; - } - - print ''; - print "'; - print "'; - print "'; - print "'; - print "'; - print '
Numero correct ".$ok_commande .'
Commandes ouvertes aupres du fournisseur ".$ftx->commande_enable .'
Permission pour l'utilisateur de commander des lignes ".$user->rights->telephonie->ligne_commander.'
Statut de la ligne compatible ".($ligne->statut == 1 or $ligne->statut == -1) .'
Rib ok ou mode de reglement par virement ".($client_facture->verif_rib() or $ligne->mode_paiement == 'vir').'
'; - - } -} -else -{ - print "Error"; -} - -$db->close(); - -llxFooter('$Date$ - $Revision$'); -?> diff --git a/htdocs/telephonie/ligne/commande/archives.php b/htdocs/telephonie/ligne/commande/archives.php deleted file mode 100644 index 2204aa7f9d0..00000000000 --- a/htdocs/telephonie/ligne/commande/archives.php +++ /dev/null @@ -1,113 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) - accessforbidden(); - - -llxHeader("","Telephonie - Commande - Archives"); - -/* ***************************************** */ -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; -$sortfield = $_GET["sortfield"]; - -if ($sortorder == "") { - $sortorder="DESC"; -} -if ($sortfield == "") { - $sortfield="c.datec"; -} - -if ($page == -1) { $page = 0 ; } - -$offset = $conf->liste_limit * $page ; -$pageprev = $page - 1; -$pagenext = $page + 1; - -$sql = "SELECT c.filename, u.name, u.firstname, f.nom,".$db->pdate("c.datec"). " as datec"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_commande as c"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_fournisseur as f"; -$sql .= " ,".MAIN_DB_PREFIX."user as u"; -$sql .= " WHERE c.fk_user_creat = u.rowid AND c.fk_fournisseur = f.rowid"; - -$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); - -$result = $db->query($sql); -if ($result) -{ - $num = $db->num_rows(); - $i = 0; - - print_barre_liste("Commandes archives", $page, "archives.php", "", $sortfield, $sortorder, '', $num); - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - $var=True; - - while ($i < min($num,$conf->liste_limit)) - { - $obj = $db->fetch_object($i); - $var=!$var; - - print ""; - print "\n"; - - print "\n"; - print "\n"; - - $dir = $conf->telephonie->dir_output . "/ligne/commande/"; - $relativepath = urlencode("ligne/commande/".$obj->filename); - - if (substr($obj->filename, -3) == 'txt') - { - print ''; - } - else - { - print ''; - } - - print "\n"; - $i++; - } - print "
DateUtilisateurFournisseurFichier
".strftime("%a %d %b %Y %HH%M",$obj->datec)."".$obj->firstname . " ".$obj->name."".$obj->nom."'.$obj->filename.''.$obj->filename.'
"; - $db->free(); -} -else -{ - dol_print_error($db); -} - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/ligne/commande/commandetableur.class.php b/htdocs/telephonie/ligne/commande/commandetableur.class.php deleted file mode 100644 index 847ca641466..00000000000 --- a/htdocs/telephonie/ligne/commande/commandetableur.class.php +++ /dev/null @@ -1,339 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require_once DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_workbook.inc.php"; -require_once DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_worksheet.inc.php"; -require_once DOL_DOCUMENT_ROOT."/telephonie/dolibarrmail.class.php"; - -define ('COMMANDETABLEUR_NOEMAIL', -3); - -class CommandeTableur -{ - - function CommandeTableur ($DB, $USER, $fourn) - { - $this->db = $DB; - $this->user = $USER; - $this->fournisseur = $fourn; - } - - function Create() - { - - $this->date = time(); - - $this->datef = "commande-".strftime("%d%b%y-%HH%M", $this->date); - - $fname = $conf->telephonie->dir_output . "/ligne/commande/".$this->datef.".xls"; - - if (strlen(trim($this->fournisseur->email_commande)) == 0) - { - return -3; - } - - if (file_exists($fname)) - { - return 2; - } - else - { - $res = $this->CreateFile($fname); - $res = $res + $this->LogSql(); - $res = $res + $this->MailFile($fname); - - return $res; - } - } - /** - * - * - * - * - */ - function MailFile($filename) - { - $sql = "SELECT l.ligne"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; - $sql .= " WHERE l.statut = 2"; - - $result = $this->db->query($sql); - - if ($result) - { - $num = $this->db->num_rows(); - } - - $subject = "Commande de Lignes"; - - $sendto = $this->fournisseur->email_commande; - - $from = TELEPHONIE_LIGNE_COMMANDE_EMAIL_BCC; - - $message = "Bonjour,\n\nVeuillez trouver ci-joint notre dernière commande.\n\n"; - $message .= "Nous avons à ce jour $num ligne(s) commandée(s) pour lesquelles nous attendons la confirmation de présélection.\n\n\n"; - $message .= "\n\nCordialement,\n\n"; - - $message .= "-- \n"; - $message .= $this->user->fullname."\n"; - - - $mailfile = new DolibarrMail($subject, - $sendto, - $from, - $message); - - $mailfile->addr_bcc = TELEPHONIE_LIGNE_COMMANDE_EMAIL_BCC; - - $mailfile->PrepareFile(array($filename), - array("application/msexcel"), - array($this->datef.".xls")); - - if ( $mailfile->sendfile() ) - { - return 0; - } - - } - - function LogSql() - { - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_commande"; - $sql .= " (datec, fk_user_creat, fk_fournisseur, filename)"; - $sql .= " VALUES (now(),".$this->user->id.",".$this->fournisseur->id.",'".$this->datef.".xls')"; - - $result = $this->db->query($sql); - - if ($result) - { - return 0; - } - - } - - - function CreateFile($fname) - { - - $ligne = new LigneTel($db); - - $workbook = &new writeexcel_workbook($fname); - - $worksheet = &$workbook->addworksheet(); - - $worksheet->write(0, 0, "Commande du ".strftime("%d %B %Y %HH%M", $this->date)); - - $worksheet->set_column('A:A', 20); - $worksheet->set_column('B:B', 40); - $worksheet->set_column('C:C', 15); - $worksheet->set_column('D:D', 9); - $worksheet->set_column('E:E', 16); - $worksheet->set_column('F:F', 18); - $worksheet->set_column('G:G', 20); - - $formatcc =& $workbook->addformat(); - $formatcc->set_align('center'); - $formatcc->set_align('vcenter'); - - $formatccb =& $workbook->addformat(); - $formatccb->set_align('center'); - $formatccb->set_align('vcenter'); - $formatccb->set_bold(); - - $formatccbr =& $workbook->addformat(); - $formatccbr->set_align('center'); - $formatccbr->set_align('vcenter'); - $formatccbr->set_color('red'); - $formatccbr->set_bold(); - - $formatc =& $workbook->addformat(); - $formatc->set_align('vcenter'); - - $formatcb =& $workbook->addformat(); - $formatcb->set_align('vcenter'); - $formatcb->set_bold(); - - $i = 0; - - $ligneids = array(); - - $sqlall = "SELECT s.nom, s.rowid as socid, l.ligne, f.nom as fournisseur, l.statut, l.rowid"; - $sqlall .= " , comm.name, comm.firstname, l.remise"; - $sqlall .= " FROM ".MAIN_DB_PREFIX."societe as s"; - $sqlall .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; - $sqlall .= " , ".MAIN_DB_PREFIX."societe as r"; - $sqlall .= " , ".MAIN_DB_PREFIX."user as comm"; - $sqlall .= " , ".MAIN_DB_PREFIX."telephonie_fournisseur as f"; - $sqlall .= " WHERE l.fk_soc = s.rowid AND l.fk_fournisseur = f.rowid"; - $sqlall .= " AND l.fk_soc_facture = r.rowid "; - $sqlall .= " AND l.fk_commercial = comm.rowid "; - /* - * - */ - - $sql = $sqlall; - - $sql .= " AND l.statut in (1,4)"; - $sql .= " ORDER BY l.statut ASC"; - - $result = $this->db->query($sql); - - if ($result) - { - $num = $this->db->num_rows(); - - $worksheet->write(1, 0, "Clients", $formatc); - $worksheet->write(1, 1, "Adresses", $formatc); - $worksheet->write(1, 2, "CLI", $formatcc); - $worksheet->write(1, 3, "Préfixe", $formatcc); - $worksheet->write(1, 4, "Présélection", $formatcc); - $worksheet->write(1, 5, "Connexion", $formatcc); - $worksheet->write(1, 6, "Date de la demande", $formatcc); - - while ($i < $num) - { - $obj = $this->db->fetch_object(); - - if (strlen($obj->ligne)== 10) - { - - $j = $i + 2; - $k = $j + 1; - - $soc = new Societe($this->db); - $soc->fetch($obj->socid); - - $worksheet->write($j, 0, $obj->nom, $formatc); - $worksheet->write($j, 1, $soc->adresse. " " . $soc->cp . " " . $soc->ville, $formatc); - - $worksheet->write_string($j, 2, "$obj->ligne", $formatcc); - - $worksheet->write_string($j, 3, "Non", $formatcc); - $worksheet->write_string($j, 4, "Oui", $formatcc); - - if ($obj->statut == 1) - { - $worksheet->write($j, 5, "Ajouter", $formatccb); - $worksheet->write($j, 6, strftime("%d/%m/%y",$this->date), $formatcc); - } - elseif($obj->statut == 4) - { - $worksheet->write($j, 5, "A Résilier", $formatccbr); - $worksheet->write($j, 6, strftime("%d/%m/%y",$this->date), $formatcc); - } - else - { - $worksheet->write($j, 5, "", $formatccb); - $worksheet->write($j, 6, "", $formatccb); - } - - - array_push($ligneids, $obj->rowid); - } - $i++; - } - - $this->db->free(); - } - else - { - print $this->db->error() . ' ' . $sql; - } - - /* - * Archives - * Insertion des anciennes lignes dans le fichier Excell - */ - - $sql = $sqlall; - - $sql .= "AND l.statut > 0 AND l.statut <> 1 AND l.statut <> 4"; - $sql .= " ORDER BY l.statut ASC"; - - $result = $this->db->query($sql); - - if ($result) - { - $num = $this->db->num_rows(); - $i = 0; - while ($i < $num) - { - $obj = $this->db->fetch_object($i); - - $jj = $i + $j + 2; - $k = $jj + 1; - - $soc = new Societe($this->db); - $soc->fetch($obj->socid); - - $worksheet->write($jj, 0, $obj->nom, $formatc); - $worksheet->write($jj, 1, $soc->adresse. " " . $soc->cp . " " . $soc->ville, $formatc); - - $worksheet->write_string($jj, 2, "$obj->ligne", $formatcc); - - $worksheet->write_string($jj, 3, "Non", $formatcc); - $worksheet->write_string($jj, 4, "Oui", $formatcc); - - $worksheet->write($jj, 5, "", $formatccb); - $worksheet->write($jj, 6, "", $formatccb); - - array_push($ligneids, $obj->rowid); - - $i++; - } - - $this->db->free(); - } - else - { - print $this->db->error() . ' ' . $sql; - } - - - /* - * - * - */ - - foreach ($ligneids as $lid) - { - - $lint = new LigneTel($this->db); - $lint->fetch_by_id($lid); - if ($lint->statut == 1) - { - $lint->set_statut($this->user, 2); - } - if ($lint->statut == 4) - { - $lint->set_statut($this->user, 5); - } - } - - - $workbook->close(); - - - return 0; - - } -} diff --git a/htdocs/telephonie/ligne/commande/fiche.php b/htdocs/telephonie/ligne/commande/fiche.php deleted file mode 100644 index 9f4dd46a0d4..00000000000 --- a/htdocs/telephonie/ligne/commande/fiche.php +++ /dev/null @@ -1,186 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -$mesg_erreur = ""; - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; -$sortfield = $_GET["sortfield"]; - -if ($user->rights->telephonie->ligne_commander) -{ - if ($_GET["action"] == "create" && $_GET["fournid"] > 0) - { - $fourn = new FournisseurTelephonie($db); - - $result = $fourn->fetch($_GET["fournid"]); - - if ($result == 0) - { - $result = $fourn->CreateCommande($user); - } - } -} - - -llxHeader("","Telephonie - Ligne - Commande"); - -print $mesg_erreur; - -/* - * S�curit� acc�s client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -/* - * Mode Liste - * - * - * - */ - -$sql = "SELECT count(l.ligne), f.rowid, f.nom, f.commande_bloque"; -$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; -$sql .= ",".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; -$sql .= ",".MAIN_DB_PREFIX."telephonie_fournisseur as f"; -$sql .= ",".MAIN_DB_PREFIX."societe as sf"; -$sql .= " WHERE l.fk_soc = s.rowid AND l.fk_fournisseur = f.rowid "; -$sql .= " AND l.statut IN (1,4,8) "; -$sql .= " AND l.fk_soc_facture = sf.rowid"; -$sql .= " GROUP BY f.rowid, f.nom ASC"; - -$result = $db->query($sql); -if ($result) -{ - $num = $db->num_rows(); - $i = 0; - - print_barre_liste("Commande", $page, "liste.php", "", $sortfield, $sortorder, '', $num); - - print ''; - print ''; - print ''; - print "\n"; - - $var=True; - - $ligne = new LigneTel($db); - - while ($i < $num) - { - $row = $db->fetch_row(); - $var=!$var; - - $fournisseur = new FournisseurTelephonie($db); - $fournisseur->fetch($row[1]); - - print ""; - print ''; - print '\n"; - print '\n"; - $i++; - } - print "
FournisseurNb Lignes Email envoy� �
'.$row[2].''.$row[0]."'; - if ($row[3] == 1) - { - print "Les commandes sont bloqu�es"; - } - else - { - print 'Cr�er la commande'; - } - print "\n"; - print $fournisseur->email_commande; - print "

"; - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - -/* - * - * - */ - -$sql = "SELECT sf.rowid as sfidp, sf.nom as sfnom, s.rowid as socid, s.nom, l.ligne, f.nom as fournisseur, l.statut, l.rowid"; -$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_fournisseur as f"; -$sql .= " , ".MAIN_DB_PREFIX."societe as sf"; -$sql .= " WHERE l.fk_soc = s.rowid AND l.fk_fournisseur = f.rowid"; -$sql .= " AND l.statut IN (1,4,8) "; -$sql .= " AND l.fk_soc_facture = sf.rowid"; -$sql .= " ORDER BY s.nom ASC "; - -if ($db->query($sql)) -{ - $num = $db->num_rows(); - $i = 0; - - print ''; - print ''; - print "\n"; - - $var=True; - - $ligne = new LigneTel($db); - - while ($i < $num) - { - $obj = $db->fetch_object($i); - $var=!$var; - - $socf = new Societe($db); - $socf->fetch($obj->sfidp); - - print ""; - print '\n"; - print '\n"; - print ''; - print ''; - print ''; - print "\n"; - print "\n"; - $i++; - } - print "
Ligne'; - print 'StatutClient'; - print 'Client Factur�Rib OKFournisseur
'.dol_print_phone($obj->ligne,0,0,true)."'.$ligne->statuts[$obj->statut]."'.$obj->nom.''.$obj->sfnom.''.$socf->verif_rib().'".$obj->fournisseur."
"; - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/ligne/commande/historique.php b/htdocs/telephonie/ligne/commande/historique.php deleted file mode 100644 index 98a65ba59cf..00000000000 --- a/htdocs/telephonie/ligne/commande/historique.php +++ /dev/null @@ -1,168 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; -$sortfield = $_GET["sortfield"]; - -llxHeader('','Telephonie - Ligne - Liste'); -/* - * S�curit� acc�s client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -if ($sortorder == "") { - $sortorder="DESC"; -} -if ($sortfield == "") { - $sortfield="ls.tms"; -} - -/* - * Recherche - * - * - */ - -if ($page == -1) { $page = 0 ; } - -$offset = $conf->liste_limit * $page ; -$pageprev = $page - 1; -$pagenext = $page + 1; - -/* - * Mode Liste - * - * - * - */ - -$sql = "SELECT s.rowid as socid, s.nom, l.ligne, f.nom as fournisseur, l.statut, l.rowid, l.remise"; -$sql .= " , ".$db->pdate("ls.tms")." as dc"; -$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; -$sql .= " ,".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne_statut as ls"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_fournisseur as f"; -$sql .= " WHERE l.fk_soc = s.rowid AND l.fk_fournisseur = f.rowid"; -$sql .= " AND ls.fk_ligne = l.rowid"; -$sql .= " AND ls.statut = 2"; - -if ($_GET["search_ligne"]) -{ - $sel =urldecode($_GET["search_ligne"]); - $sel = ereg_replace("\.","",$sel); - $sel = ereg_replace(" ","",$sel); - $sql .= " AND l.ligne LIKE '%".$sel."%'"; -} - -if ($_GET["search_client"]) -{ - $sel =urldecode($_GET["search_client"]); - $sql .= " AND s.nom LIKE '%".$sel."%'"; -} - -$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); - -$result = $db->query($sql); -if ($result) -{ - $num = $db->num_rows(); - $i = 0; - - $urladd= "&statut=".$_GET["statut"]; - - print_barre_liste("Lignes", $page, "historique.php", $urladd, $sortfield, $sortorder, '', $num); - print"\n\n"; - print ''; - print ''; - - print ''; - - print_liste_field_titre("Ligne","historique.php","l.ligne"); - print_liste_field_titre("Client (Agence/Filiale)","historique.php","s.nom"); - - print ''; - - print ''; - - print "\n"; - - print ''; - print ''; - print ''; - print ''; - - print ''; - - print ''; - print ''; - - print ''; - print ''; - - - $var=True; - - $ligne = new LigneTel($db); - - while ($i < min($num,$conf->liste_limit)) - { - $obj = $db->fetch_object(); - $var=!$var; - - print ""; - print ''; - print '\n"; - - print ''; - - - print '\n"; - - - print "\n"; - print "\n"; - $i++; - } - print "
 StatutFournisseur
   
'.strftime("%d/%m/%Y %H:%M", $obj->dc).' '; - - print ''; - print img_file(); - print ' '; - - print ''.dol_print_phone($obj->ligne,0,0,true)."'.$obj->nom.''.$ligne->statuts[$obj->statut]."".$obj->fournisseur."
"; - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/ligne/commande/index.php b/htdocs/telephonie/ligne/commande/index.php deleted file mode 100644 index 6a834ee6500..00000000000 --- a/htdocs/telephonie/ligne/commande/index.php +++ /dev/null @@ -1,163 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; - -if (!$user->rights->telephonie->ligne_commander) - accessforbidden(); - -llxHeader('','Telephonie - Ligne - Commande'); - - - -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -/* - * Mode Liste - * - * - * - */ - -print ''; - -print ''; -print '
'; - - -$sql = "SELECT distinct statut, count(*) as cc"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; -$sql .= " GROUP BY statut"; - -if ($db->query($sql)) -{ - $num = $db->num_rows(); - $i = 0; - $ligne = new LigneTel($db); - print_titre("Commandes"); - - print ''; - print ''; - print "\n"; - $var=True; - - while ($i < min($num,$conf->liste_limit)) - { - $obj = $db->fetch_object($i); - $var=!$var; - - print ""; - print "\n"; - print "\n"; - print "\n"; - $i++; - } - print "
Lignes StatutsNb
".$ligne->statuts[$obj->statut]."".$obj->cc."
"; - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - -if ($user->rights->telephonie->ligne_commander) -{ - print '
'; - - print ''; - print ''; - print ""; - print ''; - print "\n"; - print '
Nouvelle commande
'.img_edit().''; - print ' Créer une nouvelle commande
'; -} - -print '
'; - -/* - * Seconde colonne - * - */ -$sql = "SELECT "; -$sql .= " cli,mode,situation,date_mise_service,date_resiliation,motif_resiliation,commentaire,fichier, traite "; - -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_commande_retour"; -$sql .= " WHERE traite = 0 AND mode = 'PRESELECTION'"; - -if ($db->query($sql)) -{ - $num = $db->num_rows(); - $i = 0; - - print_titre("Retour"); - - print ''; - print ''; - print ''; - print "\n"; - $var=True; - - while ($i < $num) - { - $obj = $db->fetch_object(); - $var=!$var; - - $ligne = new LigneTel($db); - - if ( $ligne->fetch($obj->cli) == 1); - { - print "\n"; - print '\n"; - print '\n"; - print '\n"; - print "\n"; - } - $i++; - } - print "
Lignes StatutsResultatDateCommentaire
"; - print ' '; - print ''; - print $obj->cli."'.$obj->situation."'.$obj->date_mise_service."'.$obj->commentaire."
"; - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - - -print '
'; - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/ligne/commande/liste.php b/htdocs/telephonie/ligne/commande/liste.php deleted file mode 100644 index c36aeadd8cb..00000000000 --- a/htdocs/telephonie/ligne/commande/liste.php +++ /dev/null @@ -1,183 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if (!$user->rights->telephonie->ligne_commander) - accessforbidden(); - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; -$sortfield = $_GET["sortfield"]; - -if ($_GET["action"] == "commande" && $user->rights->telephonie->ligne_commander) -{ - $ltel = new LigneTel($db); - $ltel->fetch_by_id($_GET["lid"]); - - if ($_GET["statut"] == 1) - { - $ltel->set_a_commander($user); - } - - if ($_GET["statut"] == -1) - { - $ltel->set_en_attente($user); - } - - Header("Location: liste.php"); -} - - -llxHeader("","Telephonie - Ligne - Commande"); - -/* - * S�curit� acc�s client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -if ($sortorder == "") { - $sortorder="DESC"; -} -if ($sortfield == "") { - $sortfield="l.statut"; -} - -if ($page == -1) { $page = 0 ; } - -$offset = $conf->liste_limit * $page ; -$pageprev = $page - 1; -$pagenext = $page + 1; - -/* - * Mode Liste - * - * - * - */ - -$sql = "SELECT sf.rowid as sfidp, sf.nom as sfnom, s.rowid as socid, s.nom, l.ligne, f.nom as fournisseur, l.statut, l.rowid, f.rowid as fournid, l.mode_paiement"; -$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; -$sql .= ",".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; -$sql .= ",".MAIN_DB_PREFIX."telephonie_fournisseur as f"; -$sql .= ",".MAIN_DB_PREFIX."societe as sf"; -$sql .= " WHERE l.fk_soc = s.rowid "; -$sql .= " AND l.fk_fournisseur = f.rowid "; -$sql .= " AND l.statut IN (-1,1,4) "; -$sql .= " AND l.techno = 'presel'"; -$sql .= " AND l.fk_soc_facture = sf.rowid"; -$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); - -$result = $db->query($sql); -if ($result) -{ - $num = $db->num_rows(); - $i = 0; - - print_barre_liste("Commande", $page, "liste.php", "", $sortfield, $sortorder, '', $num); - - print ''; - print ''; - print_liste_field_titre("Ligne","liste.php","l.ligne"); - print ''; - print_liste_field_titre("Client","liste.php","s.nom"); - print ''; - print "\n"; - - $var=True; - - $ligne = new LigneTel($db); - - while ($i < min($num,$conf->liste_limit)) - { - $obj = $db->fetch_object($i); - $var=!$var; - - $fourntels = array(); - - if (!array_key_exists($obj->fournid, $fourntels)) - { - $ft = new FournisseurTelephonie($db, $obj->fournid); - $ft->fetch($obj->fournid); - $fourntels[$obj->fournid] = $ft; - } - - - $socf = new Societe($db); - $socf->fetch($obj->sfidp); - - print ""; - print '\n"; - - $ftx = $fourntels[$obj->fournid]; - - if ($ok_commande && $ftx->commande_enable && $user->rights->telephonie->ligne_commander && ($obj->statut == 1 or $obj->statut == -1) && ( $socf->verif_rib() or $obj->mode_paiement == 'vir')) - { - $nst = ($obj->statut * -1); - print '\n"; - } - else - { - print '\n"; - } - - print ''; - print ''; - - print ''; - print "\n"; - print "\n"; - $i++; - } - print "
StatutClient Factur�Rib OKFournisseur
'; - print ' '; - - if (strlen($obj->ligne) <> 10) - { - print "Erreur"; - $ok_commande = 0; - } - else - { - print dol_print_phone($obj->ligne,0,0,true); - $ok_commande = 1; - } - - print "'; - print img_edit(); - print ' '; - print $ligne->statuts[$obj->statut]; - print "'.$ligne->statuts[$obj->statut]."'.stripslashes($obj->nom).''.stripslashes($obj->sfnom).''.$yesno[$socf->verif_rib()].'".$obj->fournisseur."
"; - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/ligne/commande/pre.inc.php b/htdocs/telephonie/ligne/commande/pre.inc.php deleted file mode 100644 index 57125098b01..00000000000 --- a/htdocs/telephonie/ligne/commande/pre.inc.php +++ /dev/null @@ -1,76 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("../../../main.inc.php"); -require(DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); -require(DOL_DOCUMENT_ROOT."/telephonie/fournisseurtel.class.php"); -require(DOL_DOCUMENT_ROOT."/telephonie/ligne/commande/commandetableur.class.php"); - -$user->getrights('telephonie'); - -function llxHeader($head = "", $title="") { - global $user; - - /* - * - * - */ - top_menu($head, $title); - - $menu = new Menu(); - - $menu->add(DOL_URL_ROOT."/telephonie/index.php", "Telephonie"); - - - $menu->add(DOL_URL_ROOT."/telephonie/client/index.php", "Clients"); - $menu->add(DOL_URL_ROOT."/telephonie/contrat/", "Contrats"); - $menu->add(DOL_URL_ROOT."/telephonie/ligne/index.php", "Lignes"); - - if ($user->rights->telephonie->ligne_commander) - { - $menu->add(DOL_URL_ROOT."/telephonie/ligne/commande/", "Commandes"); - $menu->add_submenu(DOL_URL_ROOT."/telephonie/ligne/commande/liste.php", "Lignes"); - } - - if ($user->rights->telephonie->ligne_commander) - { - $menu->add_submenu(DOL_URL_ROOT."/telephonie/ligne/commande/fiche.php", "Nouvelle"); - } - - $menu->add_submenu(DOL_URL_ROOT."/telephonie/ligne/commande/archives.php", "Archives"); - $menu->add_submenu(DOL_URL_ROOT."/telephonie/ligne/commande/historique.php", "Historique"); - - $menu->add_submenu(DOL_URL_ROOT."/telephonie/ligne/commande/retour/", "Retour"); - - if ($user->rights->telephonie->stats->lire) - $menu->add(DOL_URL_ROOT."/telephonie/stats/", "Statistiques"); - - $menu->add(DOL_URL_ROOT."/telephonie/facture/", "Factures"); - - $menu->add(DOL_URL_ROOT."/telephonie/tarifs/", "Tarifs"); - - $menu->add(DOL_URL_ROOT."/telephonie/fournisseur/", "Fournisseurs"); - - - left_menu($menu->liste); -} - -?> diff --git a/htdocs/telephonie/ligne/commande/retour/atraiter.php b/htdocs/telephonie/ligne/commande/retour/atraiter.php deleted file mode 100644 index 93bf80ef63b..00000000000 --- a/htdocs/telephonie/ligne/commande/retour/atraiter.php +++ /dev/null @@ -1,103 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if (!$user->rights->telephonie->lire) accessforbidden(); - -llxHeader('','Telephonie - Ligne - Commande - Retour'); - - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; - -if ($page == -1) { $page = 0 ; } - -$offset = $conf->liste_limit * $page ; -$pageprev = $page - 1; -$pagenext = $page + 1; - -if ($sortorder == "") { - $sortorder="DESC"; -} -if ($sortfield == "") { - $sortfield="rowid"; -} - -/* - * - */ -$sql = "SELECT "; -$sql .= " cli,mode,situation,date_mise_service,date_resiliation,motif_resiliation,commentaire,fichier, traite "; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_commande_retour"; -$sql .= " WHERE traite = 0"; -$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); - -$resql = $db->query($sql); - -if ($resql) -{ - $num = $db->num_rows($resql); - $i = 0; - - print_barre_liste("Retours Fournisseurs", $page, "atraiter.php", "", $sortfield, $sortorder, '', $num); - - print ''; - print ''; - print ''; - print "\n"; - $var=True; - - while ($i < min($num,$conf->liste_limit)) - { - $obj = $db->fetch_object($resql); - $var=!$var; - - $ligne = new LigneTel($db); - - if ( $ligne->fetch($obj->cli) == 1); - { - print "\n"; - print '\n"; - print '\n"; - print '\n"; - print '\n"; - print '\n"; - print "\n"; - } - $i++; - } - print "
Lignes StatutsModeResultatDateR�silCommentaire
"; - print ' '; - print ''; - print dol_print_phone($obj->cli,0,0,true)."'.$obj->mode."'.$obj->situation."'.$obj->date_mise_service."'.$obj->date_resiliation."'.$obj->commentaire."
"; - $db->free($resql); -} -else -{ - print $db->error() . ' ' . $sql; -} - - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/ligne/commande/retour/fichiers.php b/htdocs/telephonie/ligne/commande/retour/fichiers.php deleted file mode 100644 index 35fd6bc0d89..00000000000 --- a/htdocs/telephonie/ligne/commande/retour/fichiers.php +++ /dev/null @@ -1,104 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; - -if (!$user->rights->telephonie->lire) - accessforbidden(); - - -$upload_dir = DOL_DATA_ROOT."/telephonie/ligne/commande/retour/traite"; - -llxHeader('','Telephonie - Ligne - Commande - Retour - Fichiers'); - -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -/* - * Mode Liste - * - * - * - */ - - -print_titre("20 derniers Fichiers traités"); - -$upload_dir = $upload_dir."/"; -$handle=opendir($upload_dir); - -$files = array(); -$i = 0; -while (($file = readdir($handle))!==false) -{ - if (is_readable($upload_dir.$file) && is_file($upload_dir.$file)) - { - $files[$i][0] = $file; - $files[$i][1] = filesize($upload_dir.$file); - $files[$i][2] = filemtime($upload_dir.$file); - $i++; - } -} - - -print ''; -print ''; -print "\n"; -$var=True; - -sort($files, 2); - -$n = min(20, sizeof($files)); - -for ($i = 0 ; $i < $n ; $i++) -{ - $var=!$var; - - print ""; - print ''; - - print ''; - print ''; - print ''; -} - - - - - - -print "
FichierTailleDate
'; - print $files[$i][0].''.$files[$i][1]. ' bytes'.strftime("%A %d %b %Y %H:%M:%S", $files[$i][2]).'
"; - - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/ligne/commande/retour/index.php b/htdocs/telephonie/ligne/commande/retour/index.php deleted file mode 100644 index 0e5a3295e07..00000000000 --- a/htdocs/telephonie/ligne/commande/retour/index.php +++ /dev/null @@ -1,215 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if (!$user->rights->telephonie->lire) accessforbidden(); - -$upload_dir = DOL_DATA_ROOT."/telephonie/ligne/commande/retour"; - -if (! is_dir($upload_dir)) -{ - umask(0); - if (! mkdir($upload_dir, 0755)) - { - print "Impossible de créer $upload_dir"; - } -} - -if ( $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) -{ - if (is_dir($upload_dir)) - { - - $nextname = $upload_dir .'/backup'; - - - if (dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],1) > 0) - { - $mesg = "Le fichier est valide, et a été téléchargé avec succès.\n"; - } - else - { - $mesg = "Le fichier n'a pas été téléchargé"; - } - - } -} - -llxHeader('','Telephonie - Ligne - Commande - Retour'); - -/* - * - * - * - */ -print ''; - -print ''; -print '
'; - -$sql = "SELECT distinct statut, count(*) as cc"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; -$sql .= " GROUP BY statut"; - -if ($db->query($sql)) -{ - $num = $db->num_rows(); - $i = 0; - $ligne = new LigneTel($db); - print_titre("Retour Commandes"); - - print ''; - print ''; - print "\n"; - $var=True; - - while ($i < min($num,$conf->liste_limit)) - { - $obj = $db->fetch_object(); - $var=!$var; - - print ""; - print "\n"; - print "\n"; - print "\n"; - $i++; - } - print "
Lignes StatutsNb
".$ligne->statuts[$obj->statut]."".$obj->cc."
"; - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - -print '
'; - -print '
'; -print ''; -print ''; - -print ''; -print ''; - -print "\n"; -print '
Charger un fichier de retour
"; -print '
'; -print '   '; -print '
'; - -print "
'; -print '
'; - -/* - * Seconde colonne - * - */ - -$sql = "SELECT "; -$sql .= " cli,mode,situation,date_mise_service,date_resiliation,motif_resiliation,commentaire,fichier, traite "; - -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_commande_retour"; -$sql .= " WHERE traite = 0 AND mode = 'PRESELECTION'"; -$sql .= " LIMIT 10"; - -if ($db->query($sql)) -{ - $num = $db->num_rows(); - - if ($num) - { - - $i = 0; - - print_titre("Retour"); - - print ''; - print ''; - print ''; - print "\n"; - $var=True; - - while ($i < $num) - { - $obj = $db->fetch_object(); - $var=!$var; - - $ligne = new LigneTel($db); - - if ( $ligne->fetch($obj->cli) == 1); - { - print "\n"; - print '\n"; - print '\n"; - print '\n"; - print "\n"; - } - $i++; - } - print "
Lignes StatutsResultatDateCommentaire
"; - print ' '; - print ''; - print $obj->cli."'.$obj->situation."'.$obj->date_mise_service."'.$obj->commentaire."

"; - } - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - -print_titre("Fichiers retour en attente de traitement"); - -print ''; -print ''; -print "\n"; -$var=True; - -$upload_dir = $upload_dir."/"; - -$handle=opendir($upload_dir); - -while (($file = readdir($handle))!==false) -{ - if (is_readable($upload_dir.$file) && is_file($upload_dir.$file)) - { - $var=!$var; - - print ""; - print ''; - - print ''; - print ''; - - print ''; - } -} - -print "
FichierTailleDate
'; - print $file.''.filesize($upload_dir.$file). ' bytes'.strftime("%A %d %b %Y %H:%M:%S",filemtime($upload_dir.$file)).'
"; - -print '
'; - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/ligne/commande/retour/liste.php b/htdocs/telephonie/ligne/commande/retour/liste.php deleted file mode 100644 index 88666c1fef4..00000000000 --- a/htdocs/telephonie/ligne/commande/retour/liste.php +++ /dev/null @@ -1,109 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if (!$user->rights->telephonie->lire) accessforbidden(); - -llxHeader('','Telephonie - Ligne - Commande - Retour'); - - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; - -if ($page == -1) { $page = 0 ; } - -$offset = $conf->liste_limit * $page ; -$pageprev = $page - 1; -$pagenext = $page + 1; - -if ($sortorder == "") { - $sortorder="DESC"; -} -if ($sortfield == "") { - $sortfield="rowid"; -} - -/* - * - */ -$sql = "SELECT "; -$sql .= " cli,mode,situation,date_mise_service,date_resiliation,motif_resiliation,commentaire,fichier, traite "; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_commande_retour"; -$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); - -if ($db->query($sql)) -{ - $num = $db->num_rows(); - $i = 0; - - print_barre_liste("Retours Fournisseurs", $page, "liste.php", "", $sortfield, $sortorder, '', $num); - - print ''; - print ''; - print ''; - print "\n"; - $var=True; - - while ($i < min($num,$conf->liste_limit)) - { - $obj = $db->fetch_object(); - $var=!$var; - - $ligne = new LigneTel($db); - - if ( $ligne->fetch($obj->cli) == 1); - { - print "\n"; - print '\n"; - print '\n"; - print '\n"; - print '\n"; - print '\n"; - print "\n"; - } - $i++; - } - print "
Lignes StatutsModeResultatDateCommentaire-
"; - print ' '; - print ''; - print dol_print_phone($obj->cli,0,0,true)."'.$obj->mode."'.$obj->situation."'.$obj->date_mise_service."'.$obj->commentaire."'; - if ($obj->traite == 0) - { - print "A traiter"; - } - else - { - print "-"; - } - print "
"; - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/ligne/commande/retour/pre.inc.php b/htdocs/telephonie/ligne/commande/retour/pre.inc.php deleted file mode 100644 index ff1792cbe38..00000000000 --- a/htdocs/telephonie/ligne/commande/retour/pre.inc.php +++ /dev/null @@ -1,54 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("../../../../main.inc.php"); -require(DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); -require(DOL_DOCUMENT_ROOT."/telephonie/fournisseurtel.class.php"); -require(DOL_DOCUMENT_ROOT."/telephonie/ligne/commande/commandetableur.class.php"); - -$user->getrights('telephonie'); - -function llxHeader($head = "", $title="") { - global $user, $conf; - - /* - * - * - */ - top_menu($head, $title); - - $menu = new Menu(); - - $menu->add(DOL_URL_ROOT."/telephonie/index.php", "Telephonie"); - - $menu->add(DOL_URL_ROOT."/telephonie/ligne/commande/retour/", "Retour"); - $menu->add_submenu(DOL_URL_ROOT."/telephonie/ligne/commande/retour/liste.php", "Liste"); - $menu->add_submenu(DOL_URL_ROOT."/telephonie/ligne/commande/retour/atraiter.php", "A traiter"); - $menu->add_submenu(DOL_URL_ROOT."/telephonie/ligne/commande/retour/fichiers.php", "Fichiers"); - - - $menu->add(DOL_URL_ROOT."/telephonie/ligne/commande/", "Commandes"); - $menu->add_submenu(DOL_URL_ROOT."/telephonie/ligne/commande/liste.php", "Lignes"); - - left_menu($menu->liste); -} - -?> diff --git a/htdocs/telephonie/ligne/commentaires.php b/htdocs/telephonie/ligne/commentaires.php deleted file mode 100644 index e63fa65c3d5..00000000000 --- a/htdocs/telephonie/ligne/commentaires.php +++ /dev/null @@ -1,239 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require("./pre.inc.php"); -require_once DOL_DOCUMENT_ROOT.'/telephonie/telephonie.contrat.class.php'; -$mesg = ''; - -llxHeader("","","Fiche client"); - -if ($cancel == $langs->trans("Cancel")) -{ - $action = ''; -} -/* - * Affichage - * - */ - -if ($_GET["id"]) -{ - - $ligne = new LigneTel($db); - $result = $ligne->fetch_by_id($_GET["id"]); - - if ($result == 1) - { - $client_comm = new Societe($db); - $client_comm->fetch($ligne->client_comm_id, $user); - } - - $soc = new Societe($db); - $result = $soc->fetch($ligne->client_comm_id, $user); - - if ($_GET["action"] == 'add') - { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_societe_ligne_comments"; - $sql .= " (fk_ligne, fk_user, commentaire,datec)"; - $sql .= " VALUES ('".$ligne->id."','".$user->id."','".addslashes($_POST["comment"])."',now());"; - $db->query($sql); - } - - if ($_GET["action"] == 'del') - { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne_comments"; - $sql .= " WHERE rowid = '".$_GET["commid"]."'"; - $sql .= " AND fk_user = '".$user->id."';"; - $db->query($sql); - } - - if (!$soc->perm_read) - { - print "Lecture non authoris�e"; - } - - if ( $result == 1 && $soc->perm_read) - { - - $h=0; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/fiche.php?id=".$ligne->id; - $head[$h][1] = $langs->trans("Ligne"); - $h++; - - if ($ligne->statut == -1) - { - if ($user->rights->telephonie->ligne->creer) - { - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/commande.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Commande'); - $h++; - } - } - else - { - if ($user->rights->telephonie->facture->lire) - { - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/factures.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Factures'); - $h++; - } - } - - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/infoc.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Infos'); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/history.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Historique'); - $h++; - - - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/commentaires.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Commentaires'); - $numc = $ligne->num_comments(); - if ($numc > 0) - { - $head[$h][1] = $langs->trans("Commentaires ($numc)"); - } - $hselected = $h; - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/conso.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Conso'); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/stat.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Stats'); - $h++; - - dol_fiche_head($head, $hselected, 'Ligne : '.$ligne->numero); - - - print ''; - - if ($ligne->contrat) - { - $contrat = new TelephonieContrat($db); - $contrat->fetch($ligne->contrat); - - print ''; - } - - print ''; - - print ''; - print ''; - - $client = new Societe($db, $ligne->client_id); - $client->fetch($ligne->client_id); - - print '
Contrat'.$contrat->ref_url.''; - print ' '; - print $ligne->statuts[$ligne->statut]; - print '
Client'; - print ''; - - print $client_comm->nom.''.$client_comm->code_client; - print '
Num�ro'.dol_print_phone($ligne->numero,0,0,true).'Factur�e : '.$ligne->facturable.'
Client (Agence/Filiale)'; - print $client->nom.'
'; - - print $client->cp . " " .$client->ville; - print '
'; - - print '
'; - - print '
'; - print ''; - print ''; - print ''; - print ''; - print "
Nouveau
commentaire'; - print '

"; - - print ''; - - /* Commentaires */ - - $sql = "SELECT c.commentaire, u.firstname, u.name, u.login, c.rowid, c.fk_user"; - $sql .= " , ".$db->pdate("c.datec") ." as datec"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne_comments as c"; - $sql .= " , ".MAIN_DB_PREFIX."user as u"; - $sql .= " WHERE fk_ligne = ".$ligne->id; - $sql .= " AND c.fk_user = u.rowid"; - $sql .= " ORDER BY c.datec DESC"; - - $resql = $db->query($sql); - - if ($resql) - { - print ''; - print "\n"; - - while ($obj = $db->fetch_object($resql)) - { - print "\n"; - print '\n"; - print '\n"; - print '\n"; - $var=!$var; - } - $db->free($resql); - } - else - { - print $sql; - } - print "
Date'; - print 'CommentaireAuteur 
".strftime("%d/%m/%y %H:%M",$obj->datec); - print "'.nl2br(stripslashes($obj->commentaire))."'.$obj->login." '; - if ($obj->fk_user == $user->id) - { - print ''; - print img_delete().''; - } - print "
"; - } -} -else -{ - print "Error"; -} - - -print ''; - -/* ************************************************************************** */ -/* */ -/* Barre d'action */ -/* */ -/* ************************************************************************** */ -/* -print "\n
\n"; -*/ - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/ligne/communications.php b/htdocs/telephonie/ligne/communications.php deleted file mode 100644 index c6070e558ae..00000000000 --- a/htdocs/telephonie/ligne/communications.php +++ /dev/null @@ -1,154 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; - -llxHeader(); - -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -if ($sortorder == "") { - $sortorder="DESC"; -} -if ($sortfield == "") { - $sortfield="l.date"; -} - -if ($page == -1) { $page = 0 ; } - -$offset = $conf->liste_limit * $page ; -$pageprev = $page - 1; -$pagenext = $page + 1; - -/* - * Mode Liste - * - * - * - */ - -$sql = "SELECT ligne, numero, date, fourn_cout, fourn_montant, duree, tarif_achat_temp, tarif_achat_fixe, tarif_vente_temp, tarif_vente_fixe, cout_achat, cout_vente, remise"; - -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details as l"; - -if ($_GET["ligne"]) -{ - $sql .= " WHERE ligne like '%".$_GET["ligne"]."%'"; - - if ($_GET["numero"]) - { - $sql .= " AND numero like '%".$_GET["numero"]."%'"; - - } -} - -//$sql .= " WHERE fourn_montant > cout_vente AND cout_vente > 0"; - - -$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); - -$result = $db->query($sql); -if ($result) -{ - $num = $db->num_rows(); - $i = 0; - - print_barre_liste("Communications", $page, "communications.php", '&ligne='.$_GET["ligne"], $sortfield, $sortorder, '', $num); - - print ''; - print ''; - print_liste_field_titre("Ligne","communications.php","l.ligne"); - print '"; - print ''; - - print ''; - print ''; - print ''; - print "\n"; - - print ''; - print ''; - print ''; - print ''; - print ''; - - print ''; - - - - print ''; - print ''; - - print ''; - print ''; - - - $var=True; - - while ($i < min($num,$conf->liste_limit)) - { - $obj = $db->fetch_object($i); - $var=!$var; - - print ""; - print "\n"; - print '\n"; - print '\n"; - print '\n"; - - print '\n"; - print '\n"; - - print '\n"; - print '\n"; - - print '\n"; - print '\n"; - - print '\n"; - - print "\n"; - $i++; - } - print "
DateNuméro'; - print "DuréePrix VenteCout AchatVente /secVente FixeAchat /secAchat Fixe'.$langs->trans("Discount").'
  Tarifs
".$obj->ligne."'.$obj->date."'.$obj->numero."'.$obj->duree."'.sprintf("%01.4f",$obj->cout_vente)."'.sprintf("%01.4f",$obj->cout_achat)."'.sprintf("%01.4f",$obj->tarif_vente_temp)."'.sprintf("%01.4f",$obj->tarif_vente_fixe)."'.sprintf("%01.4f",$obj->tarif_achat_temp)."'.sprintf("%01.4f",$obj->tarif_achat_fixe)."'.$obj->remise." %
"; - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/ligne/conso.php b/htdocs/telephonie/ligne/conso.php deleted file mode 100644 index 8872994a6be..00000000000 --- a/htdocs/telephonie/ligne/conso.php +++ /dev/null @@ -1,279 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require("./pre.inc.php"); - -$mesg = ''; - -llxHeader("","","Fiche Ligne"); - -if ($_GET["id"] or $_GET["numero"]) -{ - - $ligne = new LigneTel($db); - if ($_GET["id"]) - { - $result = $ligne->fetch_by_id($_GET["id"]); - } - if ($_GET["numero"]) - { - $result = $ligne->fetch($_GET["numero"]); - } - - if ($result == 1) - { - $client_comm = new Societe($db); - $client_comm->fetch($ligne->client_comm_id, $user); - } - - if (!$client_comm->perm_read) - { - print "Lecture non authoris�e"; - } - - if ($result == 1 && $client_comm->perm_read) - { - if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit') - { - - $h=0; - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/fiche.php?id=".$ligne->id; - $head[$h][1] = $langs->trans("Ligne"); - $h++; - - if ($user->rights->telephonie->facture->lire) - { - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/factures.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Factures'); - $h++; - } - - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/infoc.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Infos'); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/history.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Historique'); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/commentaires.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Commentaires'); - $numc = $ligne->num_comments(); - if ($numc > 0) - { - $head[$h][1] = $langs->trans("Commentaires ($numc)"); - } - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/conso.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Conso'); - $hselected = $h; - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/stat.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Stats'); - $h++; - - dol_fiche_head($head, $hselected, 'Ligne : '.$ligne->numero); - - print_fiche_titre('Fiche Ligne', $mesg); - - print ''; - - print ''; - print ''; - - $client = new Societe($db, $ligne->client_id); - $client->fetch($ligne->client_id); - - print ''; - - $client_facture = new Societe($db); - $client_facture->fetch($ligne->client_facture_id); - - print ''; - - - print ''; - - $sql = "SELECT max(".$db->pdate("date").")"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; - $sql .= " WHERE fk_ligne = ".$ligne->id; - - $resql = $db->query( $sql); - - if ( $resql ) - { - $num = $db->num_rows($resql); - if ( $num > 0 ) - { - $i = 0; - while ($i < $num) - { - $row = $db->fetch_row($resql); - - print ''; - print ''; - print ''; - $i++; - } - } - $db->free(); - } - else - { - //print $sql; - } - - print '
Num�ro'.dol_print_phone($ligne->numero,0,0,true).'Factur�e : '.$ligne->facturable.' 
Client'; - - print ''; - print $client->nom.'Client Factur�'.$client_facture->nom.'
Statut'; - print 'statut '; - print $ligne->statuts[$ligne->statut]; - print '
Date de la derni�re communication'.strftime("%A %d %B %Y",$row[0]).'
'; - - print 'liste
'; - print '
'; - - print "
"; - - - $img_root = DOL_DATA_ROOT."/graph/".substr($ligne->id,-1)."/telephonie/ligne/"; - - $file = $img_root.$ligne->id."/conso.png"; - - if (file_exists($file)) - { - print '
Conso'; - } - else - { - print $mesg_no_graph; - } - - /* - * Mode Liste - * - */ - - $sql = "SELECT date,numero, cout_vente, duree,fichier_cdr"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; - $sql .= " WHERE fk_ligne=".$ligne->id; - - if (isset($_GET["search_num"])) - $selnum = urldecode($_GET["search_num"]); - - if (isset($_POST["search_num"])) - $selnum = urldecode($_POST["search_num"]); - - - if ($selnum) - { - $selnum = ereg_replace("\.","",$selnum); - $selnum = ereg_replace(" ","",$selnum); - $sql .= " AND numero LIKE '%".$selnum."%'"; - } - - $page = $_GET["page"]; - if ($page == -1) { $page = 0 ; } - - $sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:'DESC'; - $sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:'date'; - - $offset = $conf->liste_limit * $page ; - $pageprev = $page - 1; - $pagenext = $page + 1; - - - $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); - $resql = $db->query($sql); - - if ($resql) - { - $num = $db->num_rows($resql); - - $urladd= "&id=".$ligne->id."&search_ligne=".$sel."&search_num=".$selnum; - - print_barre_liste("CDR", $page, "conso.php", $urladd, $sortfield, $sortorder, '', $num); - - print '
'."\n"; - print ''; - print ''."\n"; - print ''; - print ''; - print ''; - print "\n"; - - print ''; - - print ''; - print ''; - print ''; - print ''; - print ''; - - $var=True; - - while ($obj = $db->fetch_object($resql)) - { - $var=!$var; - - print ""; - print '\n"; - print '\n"; - print '\n"; - print '\n"; - print '\n"; - - } - print "
NumeroDateDureeMontantFichier
   
'.$obj->numero."'.$obj->date." ".$obj->heure."'.$obj->duree."'.$obj->cout_vente."'.$obj->fichier_cdr."
"; - } - else - { - print $db->error(); - } - - - } - } - - print ''; - -} -else -{ - print "Error"; -} - - -/* ************************************************************************** */ -/* */ -/* Barre d'action */ -/* */ -/* ************************************************************************** */ - - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/ligne/factures.php b/htdocs/telephonie/ligne/factures.php deleted file mode 100644 index ba20ddc29d7..00000000000 --- a/htdocs/telephonie/ligne/factures.php +++ /dev/null @@ -1,219 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require("./pre.inc.php"); - -$mesg = ''; - -require_once DOL_DOCUMENT_ROOT."/facture.class.php"; - -llxHeader("","","Fiche Ligne"); - -if ($_GET["id"] or $_GET["numero"]) -{ - if ($_GET["action"] <> 're-edit') - { - $ligne = new LigneTel($db); - if ($_GET["id"]) - { - $result = $ligne->fetch_by_id($_GET["id"]); - } - if ($_GET["numero"]) - { - $result = $ligne->fetch($_GET["numero"]); - } - } - - - if ($result == 1) - { - $client_comm = new Societe($db); - $client_comm->fetch($ligne->client_comm_id, $user); - } - - if (!$client_comm->perm_read) - { - print "Lecture non authoris�e"; - } - - - if ($result == 1 && $client_comm->perm_read) - { - - $h=0; - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/fiche.php?id=".$ligne->id; - $head[$h][1] = $langs->trans("Ligne"); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/factures.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Factures'); - $hselected = $h; - $h++; - - /* - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/facturesdet.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Factures d�taill�es'); - $h++; - */ - - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/infoc.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Infos'); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/history.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Historique'); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/conso.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Conso'); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/stat.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Stats'); - $h++; - - - $sql = "SELECT f.fk_facture"; - $sql .= " ,s.nom, s.rowid as socid"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture as f"; - $sql .= " , ".MAIN_DB_PREFIX."societe as s"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; - $sql .= " WHERE s.rowid = l.fk_soc_facture AND l.rowid = f.fk_ligne"; - $sql .= " AND f.ligne ='".$ligne->numero."'"; - $sql .= " ORDER BY f.fk_facture DESC"; - - $i = 1; - $facs = array(); - $result = $db->query($sql); - if ($result) - { - $num = $db->num_rows(); - - while ($i < ($num+1)) - { - $row = $db->fetch_row(); - - $facs[$i] = $row[0]; - - $i++; - } - } - else - { - print $sql; - } - - - if ($_GET["facnum"]) - { - $facnum = $_GET["facnum"]; - } - else - { - $facnum = 1; - } - - dol_fiche_head($head, $hselected, 'Ligne : '.$ligne->numero); - - print_fiche_titre('Factures Ligne', $mesg); - - print ''; - - print ''; - print ''; - - $client = new Societe($db, $ligne->client_id); - $client->fetch($ligne->client_id); - - print ''; - - $client_facture = new Societe($db); - $client_facture->fetch($ligne->client_facture_id); - - print ''; - - $fac = new Facture($db); - $fac->fetch($facs[$facnum]); - - print ''; - - print "
Num�ro'.dol_print_phone($ligne->numero,0,0,true).''; - - if ($facnum > 1) - { - print ''; - print '<- Facture pr�c�dente'; - } - - print " "; - - if ($facnum < sizeof($facs)) - { - print ''; - print 'Facture suivante ->'; - } - - print ' 
Client'; - - print ''; - print $client->nom.'Client Factur�'.$client_facture->nom.'
Facture'.$fac->ref.'
\n"; - - /* - * - * - * - */ - - $file = DOL_DATA_ROOT."/facture/".$fac->ref."/".$fac->ref.".pdf"; - $file_img = DOL_DATA_ROOT."/facture/".$fac->ref."/".$fac->ref.".pdf.png"; - - if (file_exists($file_img)) - { - print '
'; - } - else - { - if (file_exists("/usr/bin/convert")) - { - exec("/usr/bin/convert $file $file_img"); - - if (file_exists($file_img)) - { - print '
'; - } - else - { - print "Erreur "; - } - } - } - } -} -else -{ - print "Error"; -} - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/ligne/fiche.php b/htdocs/telephonie/ligne/fiche.php deleted file mode 100644 index c7a088c59b9..00000000000 --- a/htdocs/telephonie/ligne/fiche.php +++ /dev/null @@ -1,1384 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require "./pre.inc.php"; -require_once DOL_DOCUMENT_ROOT."/telephonie/dolibarrmail.class.php"; -require_once DOL_DOCUMENT_ROOT.'/telephonie/telephonie.contrat.class.php'; - -$mesg = ''; - -$dt = time(); - -$h = strftime("%H",$dt); -$m = strftime("%M",$dt); -$s = strftime("%S",$dt); - -if ($_POST["action"] == 'add' && $user->rights->telephonie->ligne->creer) -{ - $result = 0; - - $cbegin = trim($_POST["numero"]); - $cend = strlen(trim($_POST["numero_end"]))>0?trim($_POST["numero_end"]):trim($_POST["numero"]); - - $cli = $cbegin; - - while ($cli <= $cend) - { - $ligne = new LigneTel($db); - $ligne->contrat = $_POST["contrat"]; - $ligne->numero = "0".$cli; - $ligne->client_comm = $_POST["client_comm"]; - $ligne->client = $_POST["client"]; - $ligne->client_facture = $_POST["client_facture"]; - $ligne->fournisseur = $_POST["fournisseur"]; - $ligne->commercial_sign = $_POST["commercial_sign"]; - $ligne->commercial_suiv = $_POST["commercial_suiv"]; - $ligne->concurrent = $_POST["concurrent"]; - $ligne->remise = $_POST["remise"]; - $ligne->note = $_POST["note"]; - $ligne->techno = $_POST["techno"]; - - $result += $ligne->create($user); - - $cli++; - } - - if ( $result == 0) - { - Header("Location: ../contrat/fiche.php?id=".$ligne->contrat); - } - else - { - $_GET["action"] = 'create'; - $_GET["contratid"] = $_POST["contrat"]; - - $ligne->numero = $_POST["numero"]; - $ligne->numero_end = $_POST["numero_end"]; - } -} - -if ($_GET["action"] == 'transfer' && $user->rights->telephonie->ligne->creer) -{ - $ligne = new LigneTel($db); - $ligne->fetch_by_id($_GET["id"]); - - if ( $ligne->transfer($user,$_POST["fournisseur"]) == 0) - { - Header("Location: fiche.php?id=".$ligne->id); - } -} - -if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes' && $user->rights->telephonie->ligne->creer) -{ - $ligne = new LigneTel($db); - $ligne->fetch_by_id($_GET["id"]); - - if ( $ligne->delete($user) == 0) - { - Header("Location: index.php"); - } -} - -if ($_POST["action"] == 'updateremise' && $user->rights->telephonie->ligne->creer) -{ - $ligne = new LigneTel($db); - $ligne->id = $_GET["id"]; - - if ( $ligne->SetRemise($user, $_POST["remise"], $_POST["comment"]) == 0) - { - Header("Location: fiche.php?id=".$ligne->id); - } - else - { - $_GET["action"] = 'editremise'; - } -} - -if ($_POST["action"] == 'changecontrat' && $user->rights->telephonie->ligne->creer) -{ - $ligne = new LigneTel($db); - $ligne->id = $_GET["id"]; - - if ( $ligne->ChangeContrat($user, $_POST["contrat"]) == 0) - { - Header("Location: fiche.php?id=".$ligne->id); - } -} - -if ($_POST["action"] == 'addcontact' && $user->rights->telephonie->ligne->creer) -{ - $ligne = new LigneTel($db); - $ligne->id = $_GET["id"]; - - if ( $ligne->add_contact($_POST["contact_id"]) ) - { - Header("Location: fiche.php?id=".$ligne->id); - } - -} - - -if ($_GET["action"] == 'delcontact' && $user->rights->telephonie->ligne->creer) -{ - $ligne = new LigneTel($db); - $ligne->id = $_GET["id"]; - - if ( $ligne->del_contact($_GET["contact_id"]) ) - { - Header("Location: fiche.php?id=".$ligne->id); - } - -} - -if ($_GET["action"] == 'active' && $user->rights->telephonie->ligne->creer) -{ - $ligne = new LigneTel($db); - $ligne->fetch_by_id($_GET["id"]); - - $datea = $db->idate(mktime($h, $m , $s, - $_POST["remonth"], - $_POST["reday"], - $_POST["reyear"])); - - if ( $ligne->set_statut($user, 3, $datea) == 0) - { - Header("Location: fiche.php?id=".$ligne->id); - } - -} - -if ($_GET["action"] == 'refuse' && $user->rights->telephonie->ligne->creer) -{ - $ligne = new LigneTel($db); - $ligne->fetch_by_id($_GET["id"]); - - $datea = $db->idate(mktime($h, $m , $s, - $_POST["remonth"], - $_POST["reday"], - $_POST["reyear"])); - - if ( $ligne->set_statut($user, 7, $datea, $_POST["commentaire"]) == 0) - { - Header("Location: fiche.php?id=".$ligne->id); - } -} - -if ($_GET["action"] == 'resilier' && $user->rights->telephonie->ligne->creer) -{ - $ligne = new LigneTel($db); - $ligne->fetch_by_id($_GET["id"]); - - if ( $ligne->set_statut($user, 4) == 0) - { - Header("Location: fiche.php?id=".$ligne->id); - } -} - -if ($_GET["action"] == 'annuleresilier' && $user->rights->telephonie->ligne->creer) -{ - $ligne = new LigneTel($db); - $ligne->fetch_by_id($_GET["id"]); - - if ( $ligne->set_statut($user, 3) == 0) - { - Header("Location: fiche.php?id=".$ligne->id); - } -} - -if ($_GET["action"] == 'confirmresilier' && $user->rights->telephonie->ligne->creer) -{ - $ligne = new LigneTel($db); - $ligne->fetch_by_id($_GET["id"]); - - $datea = $db->idate(mktime($h, $m , $s, - $_POST["remonth"], - $_POST["reday"], - $_POST["reyear"])); - - $comm = new User($db,$ligne->commercial_id); - $comm->fetch(); - - $soc = new Societe($db); - $soc->fetch($ligne->socid); - - if ( $ligne->set_statut($user, 6, $datea, $_POST["commentaire"]) == 0) - { - Header("Location: fiche.php?id=".$ligne->id); - } -} - -if ($_GET["action"] == 'acommander' && $user->rights->telephonie->ligne->creer) -{ - $ligne = new LigneTel($db); - $ligne->fetch_by_id($_GET["id"]); - - if ( $ligne->set_statut($user, 1, '', $_POST["commentaire"]) == 0) - { - Header("Location: fiche.php?id=".$ligne->id); - } -} - - -if ($_POST["action"] == 'update' && $_POST["cancel"] <> $langs->trans("Cancel") && $user->rights->telephonie->ligne->creer) -{ - $ligne = new LigneTel($db); - $ligne->id = $_GET["id"]; - - $ligne->numero = $_POST["numero"]; - $ligne->fournisseur = $_POST["fournisseur"]; - $ligne->concurrent = $_POST["concurrent"]; - $ligne->note = $_POST["note"]; - - if ( $ligne->update($user) ) - - { - $action = ''; - $mesg = 'Fiche mise � jour'; - } - else - { - $action = 're-edit'; - $mesg = 'Fiche non mise � jour !' . "
" . $entrepot->mesg_error; - } -} - - -llxHeader("","","Fiche Ligne"); - -if ($cancel == $langs->trans("Cancel")) -{ - $action = ''; -} - -/* - * Cr�ation en 2 �tape - * - */ -if ($_GET["action"] == 'create1') -{ - $form = new Form($db); - print_titre("Nouvelle ligne"); - - if (is_object($ligne)) - { - // La cr�ation a �chou�e - print $ligne->error_message; - } - else - { - $ligne = new LigneTel($db); - } - - print '
'; - print ''; - - print ''; - - print ''; - - print ''."\n"; - print '
Client'; - $ff = array(); - $sql = "SELECT rowid, nom, ville FROM ".MAIN_DB_PREFIX."societe WHERE client=1 ORDER BY nom "; - if ( $db->query( $sql) ) - { - $num = $db->num_rows(); - if ( $num > 0 ) - { - $i = 0; - while ($i < $num) - { - $row = $db->fetch_row($i); - $ff[$row[0]] = $row[1] . " (".$row[2].")"; - - $i++; - } - } - $db->free(); - } - $form->select_array("client_comm",$ff,$ligne->client_comm); - print '
 
'."\n"; - print '
'; -} -elseif ($_GET["action"] == 'create' && $_GET["contratid"] > 0) -{ - - $contrat = new TelephonieContrat($db); - $contrat->fetch($_GET["contratid"]); - - - $form = new Form($db); - print_titre("Nouvelle(s) ligne(s) sur le contrat : ".$contrat->ref); - - if (is_object($ligne)) - { - // La cr�ation a �chou�e - print $ligne->error_message; - } - else - { - $ligne = new LigneTel($db); - } - - - $socc = new Societe($db); - //if ( $socc->fetch($_GET["client_comm"]) == 1) - if ( $socc->fetch($contrat->client_comm_id) == 1) - { - - if (strlen($socc->code_client) == 0) - { - print ''; - print ''; - - print ''; - print '
Client'; - print ''.$socc->nom.''; - print '
Code client'; - print $socc->code_client; - print '


'; - print 'Impossible de cr�er une ligne pour cette soci�t�, vous devez au pr�alablement lui affecter un code client.'; - } - elseif (strlen($socc->code_client) > 0 && $socc->check_codeclient() <> 0) - { - print ''; - print ''; - - print ''; - print '
Client'; - print ''.$socc->nom.''; - print '
Code client'; - print $socc->code_client; - print '


'; - print 'Le code client de cette soci�t� est incorrect, vous devez lui affecter un code client correct.'; - } - else - { - print '
'; - print ''; - print ''; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - - print ''; - - print ''; - - print ''; - - print ''; - - print ''; - print ''; - - $client = new Societe($db, $contrat->client_id); - $client->fetch($contrat->client_id); - - print ''; - print ''; - - $client_facture = new Societe($db); - $client_facture->fetch($contrat->client_facture_id); - - print ''; - - /* - * Concurrents - */ - - print ''; - - print ''."\n"; - - print ''."\n"; - - print ''."\n"; - print '
Contrat'.$contrat->ref_url.'
Client'.$socc->nom.'
Code client'.$socc->code_client.'
Num�ro00 derniere SDA
Client (Agence/Filiale)'; - print $client->nom.'
'; - - print $client->cp . " " .$client->ville; - print '
Client Factur�'; - print $client_facture->nom.'
'; - print $client_facture->cp . " " .$client_facture->ville; - - print '
'; - print ''; - - print '
Fournisseur'; - $ff = array(); - $sql = "SELECT rowid, nom FROM ".MAIN_DB_PREFIX."telephonie_fournisseur WHERE commande_active = 1 ORDER BY nom "; - if ( $db->query( $sql) ) - { - $num = $db->num_rows(); - if ( $num > 0 ) - { - $i = 0; - while ($i < $num) - { - $row = $db->fetch_row(); - $ff[$row[0]] = $row[1]; - $i++; - } - } - $db->free(); - - } - $form->select_array("fournisseur",$ff,$ligne->fournisseur); - - $tech = array(); - $tech["presel"] = "Pr�s�lection"; - $tech["voip"] = "VoIP"; - print "Technologie : "; - $form->select_array("techno",$tech,"presel"); - - print '
Fournisseur pr�c�dent'; - $ff = array(); - $sql = "SELECT rowid, nom FROM ".MAIN_DB_PREFIX."telephonie_concurrents ORDER BY rowid "; - if ( $db->query( $sql) ) - { - $num = $db->num_rows(); - if ( $num > 0 ) - { - $i = 0; - while ($i < $num) - { - $row = $db->fetch_row($i); - $ff[$row[0]] = $row[1]; - $i++; - } - } - $db->free(); - - } - $form->select_array("concurrent",$ff,$ligne->concurrent); - print '
Remise LMN %
Note'."\n"; - print '
 
'."\n"; - print '
'; - } - } - else - { - print "Erreur"; - } - -} -else -{ - /* - * Mode Visualisation - * - * - */ - if ($_GET["id"] or $_GET["numero"]) - { - if ($_GET["action"] <> 're-edit') - { - $ligne = new LigneTel($db); - if ($_GET["id"]) - { - $result = $ligne->fetch_by_id($_GET["id"]); - } - if ($_GET["numero"]) - { - $result = $ligne->fetch($_GET["numero"]); - } - } - - if ($result == 1) - { - $client_comm = new Societe($db); - $client_comm->fetch($ligne->client_comm_id, $user); - } - - if (!$client_comm->perm_read) - { - print "Lecture non authoris�e"; - } - - - if ($result == 1 && $client_comm->perm_read) - { - if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit') - { - - $h=0; - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/fiche.php?id=".$ligne->id; - $head[$h][1] = $langs->trans("Ligne"); - $hselected = $h; - $h++; - - if ($ligne->statut == -1) - { - if ($user->rights->telephonie->ligne->creer) - { - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/commande.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Commande'); - $h++; - } - } - else - { - if ($user->rights->telephonie->facture->lire) - { - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/factures.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Factures'); - $h++; - } - } - - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/infoc.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Infos'); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/history.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Historique'); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/commentaires.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Commentaires'); - $numc = $ligne->num_comments(); - if ($numc > 0) - { - $head[$h][1] = $langs->trans("Commentaires ($numc)"); - } - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/conso.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Conso'); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/stat.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Stats'); - $h++; - - $ligne->load_previous_next_id(); - - $previous_ref = $ligne->ref_previous?''.img_previous().'':''; - $next_ref = $ligne->ref_next?''.img_next().'':''; - - dol_fiche_head($head, $hselected, 'Ligne : '.$ligne->numero); - - print ''; - print '
Fiche Ligne '.$mesg.''.$product->ref.''; - print ''.$previous_ref.''.$next_ref.'

'; - - /* - * - */ - if ($_GET["action"] == 'delete' && $ligne->statut == -1) - { - $html = new Form($db); - - $html->form_confirm("fiche.php"."?id=".$_GET["id"],"Suppression de ligne","Etes-vous s�r de vouloir supprimer la ligne : ".dol_print_phone($ligne->numero,0,0,true)." ?","confirm_delete"); - print '
'; - } - - /* - * - */ - - print ''; - - if ($ligne->contrat) - { - $contrat = new TelephonieContrat($db); - $contrat->fetch($ligne->contrat); - - print ''; - } - - print ''; - - print ''; - //print " ".$ligne->support. - - print ''; - - $client = new Societe($db, $ligne->client_id); - $client->fetch($ligne->client_id); - - print ''; - - $client_facture = new Societe($db); - $client_facture->fetch($ligne->client_facture_id); - - print ''; - - print ''; - - - - - print ''; - - - - print ''; - - $commercial_suiv = new User($db, $ligne->commercial_suiv_id); - $commercial_suiv->fetch(); - - print ''; - print ''; - print ''; - } - else - { - print $commercial_suiv->fullname.''; - } - - - print ''; - print ''; - - print ''; - - - - /* Contacts */ - - $sql = "SELECT c.rowid, c.name, c.firstname, c.email "; - $sql .= "FROM ".MAIN_DB_PREFIX."socpeople as c"; - $sql .= ",".MAIN_DB_PREFIX."telephonie_contact_facture as cf"; - $sql .= " WHERE c.rowid = cf.fk_contact AND cf.fk_ligne = ".$ligne->id." ORDER BY name "; - if ( $db->query( $sql) ) - { - $num = $db->num_rows(); - if ( $num > 0 ) - { - $i = 0; - while ($i < $num) - { - $row = $db->fetch_row($i); - - print ''; - print '"; - $i++; - } - } - $db->free(); - - } - else - { - print $sql; - } - - /* Fin Contacts */ - if ($ligne->note) - { - print ''."\n"; - } - - print "
Contrat'.$contrat->ref_url.''; - print ' '; - print $ligne->statuts[$ligne->statut]; - print '
Client'; - print ''; - - print $client_comm->nom.''.$client_comm->code_client; - print '
Num�ro'.dol_print_phone($ligne->numero).'Factur�e : '.$ligne->facturable.'
Client (Agence/Filiale)'; - print $client->nom.'
'; - - print $client->cp . " " .$client->ville; - print '
Client Factur�'; - print ''; - print $client_facture->nom.'
'; - print $client_facture->cp . " " .$client_facture->ville; - - print '
'; - - /* Historique */ - - print ''; - print ''; - print ''; - print ''; - if ($user->rights->telephonie->fournisseur->lire) - print ''; - print ''; - print ''; - $ff = array(); - $sql = "SELECT rowid, nom FROM ".MAIN_DB_PREFIX."telephonie_fournisseur"; - $sql .= " ORDER BY nom "; - - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - if ( $num > 0 ) - { - $i = 0; - while ($i < $num) - { - $row = $db->fetch_row($resql); - $ff[$row[0]] = $row[1]; - $i++; - } - } - $db->free($resql); - } - - $sql = "SELECT ".$db->pdate("l.tms").", l.statut, l.fk_user"; - $sql .= ", u.login, l.comment, l.fk_fournisseur"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne_statut as l"; - $sql .= ",".MAIN_DB_PREFIX."user as u"; - $sql .= " WHERE u.rowid = l.fk_user AND l.fk_ligne = ".$ligne->id; - $sql .= " ORDER BY l.tms DESC "; - if ( $db->query( $sql) ) - { - $num = $db->num_rows(); - if ( $num > 0 ) - { - $i = 0; - while ($i < $num) - { - $row = $db->fetch_row($i); - - print ''; - print ''; - - if ($user->rights->telephonie->fournisseur->lire) - print ''; - - print '"; - $i++; - } - } - $db->free(); - } - else - { - print $sql; - } - - print "
DateStatutFournisseurRapporteur
'.strftime("%d/%m/%y",$row[0]).' '; - print $ligne->statuts[$row[1]]; - if (strlen($row[4]) > 0) - { - print '
'.$row[4]; - } - - print '
'.$ff[$row[5]].''. $row[3] . "
"; - - - /* Fin historique */ - - - - print '
Fournisseur'; - if ($user->rights->telephonie->fournisseur->lire) - { - $sql = "SELECT rowid, nom FROM ".MAIN_DB_PREFIX."telephonie_fournisseur"; - $sql .= " WHERE rowid = ".$ligne->fournisseur_id; - - if ( $db->query( $sql) ) - { - $num = $db->num_rows(); - if ( $num > 0 ) - { - $row = $db->fetch_row(); - print $row[1]; - } - $db->free(); - } - - print " - ".$ligne->techno; - - } - else - { - print '-'; - } - print '
PDF d�tail'.$ligne->pdfdetail.'
Remise LMN'.$ligne->remise.' % '; - print '(historique)
Commercial'.$commercial_suiv->fullname.'
Sign� par'; - - - if ($ligne->commercial_suiv_id <> $ligne->commercial_sign_id) - { - $commercial_sign = new User($db, $ligne->commercial_sign_id); - $commercial_sign->fetch(); - - print $commercial_sign->fullname.'
Concurrent pr�c�dent'.$ligne->print_concurrent_nom().'
Factures'; - print 'liste'; - print '
Contact facture '.$i.''.$row[1] . " " . $row[2] . " <".$row[3].">
Note'."\n"; - print nl2br($ligne->note); - print '

"; - - if ($_GET["action"] == "editremise" && $ligne->statut <> 6 && $user->rights->telephonie->ligne->creer) - { - /** - * Edition de la remise - */ - - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - - print ''; - - print ''; - - print '
Modification de la remise Local/Mobile/National
Nouvelle remise LMN'; - print ' %'; - print '
Commentaire

'; - - print '
'; - } - - if ($_GET["action"] == "chgcontrat" && $user->rights->telephonie->ligne->creer) - { - /** - * Edition de la remise - */ - - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - if ($num > 0) - { - print ''; - } - - print '
Migrer vers un autre contrat
Nouveau contrat'; - - - $sql = "SELECT c.rowid, c.ref "; - $sql .= "FROM ".MAIN_DB_PREFIX."telephonie_contrat as c"; - $sql .= " WHERE c.rowid <> ".$ligne->contrat; - $sql .= " AND c.fk_client_comm = ".$ligne->client_comm_id; - $sql .= " AND c.statut <> 6"; // contrat non r�sili� - - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - - if ($num > 0) - { - - print ''; - } - else - { - print "Aucun contrat �ligible"; - } - - $db->free(); - } - else - { - print $sql; - } - - print '

'; - print '
'; - } - } - - /* - * Edition - * - * - * - */ - - if ($_GET["action"] == 'edit' || $action == 're-edit') - { - - $h=0; - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/fiche.php?id=".$ligne->id; - $head[$h][1] = $langs->trans("Ligne"); - $hselected = $h; - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/infoc.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Infos'); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/history.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Historique'); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/conso.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Conso'); - $h++; - - dol_fiche_head($head, $hselected, 'Ligne : '.$ligne->numero); - - print_fiche_titre('Edition de la ligne', $mesg); - - print "
id\" method=\"post\">\n"; - print ''; - print ''; - - print ''; - - $client_comm = new Societe($db, $ligne->client_comm_id); - $client_comm->fetch($ligne->client_comm_id); - - print ''; - print ''."\n"; - - print ''; - - $client = new Societe($db, $ligne->client_id); - $client->fetch($ligne->client_id); - - print ''; - print ''; - - $client_facture = new Societe($db); - $client_facture->fetch($ligne->client_facture_id); - - print ''; - print ''; - - print ''; - - /* - * Commercial - */ - - print ''."\n"; - /* - * - * - */ - print ''; - - print '"; - - print ''; - print '
Client'; - print $client_comm->nom; - print '
Numero'; - if ($ligne->statut == -1) - { - print ''; - } - else - { - print ''; - print dol_print_phone($ligne->numero); - } - print '
Client (Agence/Filiale)'; - print $client->nom.'
'; - - print $client->cp . " " .$client->ville; - print '
Client Factur�'; - print $client_facture->nom.'
'; - print $client_facture->cp . " " .$client_facture->ville; - - print '
Fournisseur'; - - if ($ligne->statut == -1) - { - print ''; - } - else - { - print ''; - - $sql = "SELECT rowid, nom FROM ".MAIN_DB_PREFIX."telephonie_fournisseur"; - $sql .= " WHERE commande_active = 1 AND rowid = ".$ligne->fournisseur_id; - - if ( $db->query( $sql) ) - { - $num = $db->num_rows(); - if ( $num > 0 ) - { - $row = $db->fetch_row(); - print $row[1]; - } - $db->free(); - } - } - - print '
Fournisseur pr�c�dent'; - print '
Remise LMN'.$ligne->remise.' %
Note'; - print '
'; - print 'Annuler
'."\n"; - print '
'."\n"; - - } - - /* - * Contact - * - * - */ - if ($_GET["action"] == 'contact') - { - print_fiche_titre('Ajouter un contact', $mesg); - - print "
id\" method=\"post\">\n"; - print ''; - print ''; - - print ''; - - - $sql = "SELECT c.rowid, c.name, c.firstname, c.email "; - $sql .= "FROM ".MAIN_DB_PREFIX."socpeople as c"; - $sql .= ",".MAIN_DB_PREFIX."telephonie_contact_facture as cf"; - $sql .= " WHERE c.rowid = cf.fk_contact AND cf.fk_ligne = ".$ligne->id." ORDER BY name "; - if ( $db->query( $sql) ) - { - $num = $db->num_rows(); - if ( $num > 0 ) - { - $i = 0; - while ($i < $num) - { - $row = $db->fetch_row($i); - - print ''; - print '"; - $i++; - } - } - $db->free(); - - } - else - { - print $sql; - } - - - print ''; - - print ''; - print '
Contact facture '.$i.''.$row[1] . " " . $row[2] . " <".$row[3].">"; - print ''; - print ''; - print img_delete(); - print "
Contact'; - - $sql = "SELECT rowid, name, firstname, email FROM ".MAIN_DB_PREFIX."socpeople WHERE fk_soc = ".$ligne->client_facture_id." ORDER BY name "; - if ( $db->query( $sql) ) - { - print ''; - } - else - { - print $sql; - } - - print '

Contact auquel est envoy� la facture par email

 '; - if ($num > 0) - { - print ''; - } - print 'Annuler
'; - print '
'; - - } - - - /* - * - * - * - */ - - print ''; - - } - } - else - { - print "Error"; - } -} - -if ( $user->rights->telephonie->ligne_commander && $ligne->statut == 3 ) -{ - $ff = array(); - $sql = "SELECT rowid, nom FROM ".MAIN_DB_PREFIX."telephonie_fournisseur WHERE commande_active = 1 ORDER BY nom "; - if ( $db->query( $sql) ) - { - $num = $db->num_rows(); - if ( $num > 0 ) - { - $i = 0; - while ($i < $num) - { - $row = $db->fetch_row(); - if ($row[0] <> $ligne->fournisseur_id) - { - $ff[$row[0]] = $row[1]; - } - $i++; - } - } - $db->free(); - } - - if (sizeof($ff) > 0 && $ligne->techno == 'presel') - { - /** - * Transferer chez un autre fournisseur - */ - $form = new Form($db); - print '
'; - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - - print ''; - print '
Commander la ligne chez un autre fournisseur
Fournisseur'; - $form->select_array("fournisseur",$ff,$ligne->fournisseur); - print '
'; - print '
'; - print ' 
'; - } -} - - - -if ( $user->rights->telephonie->ligne_activer && $ligne->statut == 2 && $ligne->techno == 'presel') -{ - $form = new Form($db); - - print '
'; - - print '
'; - print ''; - print ''; - print ''; - print ''; - print '
Activer'; - print '
Date'; - print $form->select_date('','','','','',"active"); - print '
'; - - print '
'; - - - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print '
Refuser'; - print '
Date'; - print $form->select_date('','','','','',"refuse"); - print '
Commentaire
'; - - print '
'; -} - -if ( $user->rights->telephonie->ligne_activer && ( $ligne->statut == 5 || $ligne->statut == 3) && $ligne->techno == 'presel') -{ - /** - * Resiliation demandee - */ - $form = new Form($db); - - print '
'; - - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print '
Confirmation de la r�siliation'; - print '
Date'; - print $form->select_date('','','','','',"confirmresilier"); - print '
Commentaire
'; - - print '
'; - - print ' 
'; -} - - -if ( $user->rights->telephonie->ligne->creer && $ligne->statut == 6 && $ligne->techno == 'presel') -{ - /** - * A commander - */ - $form = new Form($db); - - print '
'; - - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print '
Recommander la ligne'; - print '
Date'; - print strftime("%e %B %Y", time()); - print '
Commentaire
'; - - print '
'; - - print ' 
'; -} - -/* ************************************************************************** */ -/* */ -/* Barre d'action */ -/* */ -/* ************************************************************************** */ - -print "\n
\n
\n"; - -if ($_GET["action"] == '' && $result == 1 && $client_comm->perm_read) -{ - - if ( $user->rights->telephonie->ligne->resilier && $ligne->statut == 3 && $ligne->techno == 'presel') - { - print "id\">".$langs->trans("Demander la r�siliation").""; - } - - if ( $user->rights->telephonie->ligne->resilier && $ligne->statut == 4 && $ligne->techno == 'presel') - { - print "id\">".$langs->trans("Annuler la demande de r�siliation").""; - } - - if ( $user->rights->telephonie->ligne_activer && $ligne->statut <> 6) - { - print "id\">".$langs->trans("Contact").""; - } - - if ( $user->rights->telephonie->ligne->creer && $ligne->statut < 4) - { - print "id\">".$langs->trans("Changer de contrat").""; - } - - if ( $user->rights->telephonie->ligne->creer && $ligne->statut < 4) - { - print "id\">".$langs->trans("Changer la remise").""; - } - - if ( $user->rights->telephonie->ligne_activer && $ligne->statut == -1) - { - print "id\">".$langs->trans("Modify").""; - } - - if ( $user->rights->telephonie->ligne->creer && $ligne->statut == -1) - { - print "id\">".$langs->trans("Delete").""; - } - -} - -print "
"; - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/ligne/graph-1.png b/htdocs/telephonie/ligne/graph-1.png deleted file mode 100644 index 7a8fb19836863bc7b7f7eee1f809db6adf2fc626..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 198 zcmeAS@N?(olHy`uVBq!ia0vp^JRr=$1|-8uW1a&kwj^(N7l!`~4GjPP3v~Pgif|Tq zL>2>eTxVe5JHn{gn6eot$X?><>&kwGi=9VV&|ki)3@9X9;u=xnoS&PUnpeW$T$Gwv zlA5AWo>`Ki5R#Fq;O^-g@IFN~52#Sf)5S5Q;#P7>Lc)*p4onG&2|&jG`4+Z4Jv}@= lJSt6ryv@$c$}2sY87}9risv)*uLbI2@O1TaS?83{1OPk+H@pA< diff --git a/htdocs/telephonie/ligne/graph1.png b/htdocs/telephonie/ligne/graph1.png deleted file mode 100644 index 134f1b74b305154a2e4ab14812c4ffa37f6c9035..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 197 zcmeAS@N?(olHy`uVBq!ia0vp^JRr=$1|-8uW1a&kwj^(N7l!{JxM1({$v_d#0*}aI zppNSd417lz6&q7F0|nVjJbhi+uW+$)vg%Z1?^gy2$(FcAlsM<-=BDPAFgO>bCYGe8 zD3oWGWGIAWq$;?3`UbpDQOyG?)bw<545_%4oRX06bCYGe8 zD3oWGWGIAWq$;?3`UbpDQOyG?RP}Um45_%4oRX06bCYGe8 zD3oWGWGIAWq$;?3`UbpDQOyG?)bez345_%4oRX06gTe~DWM4f+%-8K diff --git a/htdocs/telephonie/ligne/graph6.png b/htdocs/telephonie/ligne/graph6.png deleted file mode 100644 index 4d8f59be1c226e76c2ddc5a89f5bde2f7de5da8e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 193 zcmeAS@N?(olHy`uVBq!ia0vp^JRr=$1|-8uW1a&kwj^(N7l!{JxM1({$v_d#0*}aI zppNSd417lz6&q7F0|nVjJbhi+uW+&RC~7F_O!xy7k}YwKC~?lu%}vcKVQ?-=O)N=G zQ7F$W$xsN%NL6t6^bL5QqM8R(sOstB7*cU7IVBZOB%3JUOAoFUl*+*Fxn1%h!w7D+FqJxR0yKO#>Rh;OXk;vd$@?2>{d!Kmh;% diff --git a/htdocs/telephonie/ligne/graph8.png b/htdocs/telephonie/ligne/graph8.png deleted file mode 100644 index 16a0e14fe2bd441c0821b8e338e811852a30b566..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 222 zcmeAS@N?(olHy`uVBq!ia0vp^JRr=$1|-8uW1a&kwj^(N7l!{JxM1({$v_d#0*}aI zppNSd417lz6&q7F0|nVjJbhi+ud?v+S{TK}s&fK`WJ_ElN}Tg^b5rw57@Uhz6H8K4 z6v{J8G895GQWe}ieFNU7sOA9`I(fP{hG?9hI?0iX!GPoNrA`0qE3MzCbVQu@oVcpN z+kldpz>MP#8W|_zO)z_l2+Ohb!-vg}|dHK`#9%JT}=Mle?$+sG48iS{+ KpUXO@geCy^bwz>z diff --git a/htdocs/telephonie/ligne/graph9.png b/htdocs/telephonie/ligne/graph9.png deleted file mode 100644 index 5a0f623043531a6aea5d35eb768ee6842552e436..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 207 zcmeAS@N?(olHy`uVBq!ia0vp^JRr=$1|-8uW1a&kwj^(N7l!{JxM1({$v_d#0*}aI zppNSd417lz6&q7F0|nVjJbhi+uW|` - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; -$sortfield = $_GET["sortfield"]; - -llxHeader('','Telephonie - Ligne - Liste'); -/* - * S�curit� acc�s client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -if ($sortorder == "") { - $sortorder="ASC"; -} -if ($sortfield == "") { - $sortfield="l.statut"; -} - -/* - * Recherche - * - * - */ - -if ($page == -1) { $page = 0 ; } - -$offset = $conf->liste_limit * $page ; -$pageprev = $page - 1; -$pagenext = $page + 1; - -/* - * Mode Liste - * - * - * - */ - -$sql = "SELECT g.nom as gnom, s.rowid as socid, sf.rowid as sfidp, sf.nom as nom_facture,s.nom, l.ligne, l.statut, l.rowid, l.remise"; -$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; -$sql .= " , ".MAIN_DB_PREFIX."societe as sf"; - - -$sql .= " , ".MAIN_DB_PREFIX."telephonie_groupeligne as g"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_groupe_ligne as gl"; - - -$sql .= " WHERE l.fk_soc = s.rowid "; - -$sql .= " AND g.rowid = gl.fk_groupe"; -$sql .= " AND gl.fk_ligne = l.rowid"; - - -$sql .= " AND l.fk_soc_facture = sf.rowid"; - -if ($_GET["search_ligne"]) -{ - $sel =urldecode($_GET["search_ligne"]); - $sel = ereg_replace("\.","",$sel); - $sel = ereg_replace(" ","",$sel); - $sql .= " AND l.ligne LIKE '%".$sel."%'"; -} - -if ($_GET["search_client"]) -{ - $sel =urldecode($_GET["search_client"]); - $sql .= " AND s.nom LIKE '%".$sel."%'"; -} - -if ($_GET["search_client_facture"]) -{ - $sel =urldecode($_GET["search_client_facture"]); - $sql .= " AND sf.nom LIKE '%".$sel."%'"; -} - -if (strlen($_GET["statut"])) -{ - $sql .= " AND l.statut = ".$_GET["statut"]; -} - -$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); - -$result = $db->query($sql); -if ($result) -{ - $num = $db->num_rows(); - $i = 0; - - $urladd= "&statut=".$_GET["statut"]; - - print_barre_liste("Lignes", $page, "groupe.php", $urladd, $sortfield, $sortorder, '', $num); - print"\n\n"; - print ''; - print ''; - - print_liste_field_titre("Ligne","groupe.php","l.ligne"); - print_liste_field_titre("Client","groupe.php","s.nom"); - - print ''; - print ''; - - print_liste_field_titre("Remise LMN","groupe.php","l.remise","","",' align="center"'); - - print "\n"; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - print ''; - - print ''; - - print ''; - print ''; - - - $var=True; - - $ligne = new LigneTel($db); - - while ($i < min($num,$conf->liste_limit)) - { - $obj = $db->fetch_object(); - $var=!$var; - - print ""; - - print "\n"; - - print ''; - print ''; - - print '\n"; - - print '\n"; - - print "\n"; - $i++; - } - print "
GroupeClient factur�Statut
  
".$obj->gnom."\n"; - - print ' '; - - print ''; - print img_file(); - print ' '; - - print ''.dol_print_phone($obj->ligne,0,0,true)."'.$obj->nom.''.$obj->nom_facture.''.$ligne->statuts[$obj->statut]."'.$obj->remise." %
"; - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/ligne/history.php b/htdocs/telephonie/ligne/history.php deleted file mode 100644 index aea2d00b2b1..00000000000 --- a/htdocs/telephonie/ligne/history.php +++ /dev/null @@ -1,271 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require("./pre.inc.php"); - -$mesg = ''; - -llxHeader("","","Historique Ligne"); - -/* - * Affichage - * - */ - - if ($_GET["id"] or $_GET["numero"]) - { - if ($_GET["action"] <> 're-edit') - { - $ligne = new LigneTel($db); - if ($_GET["id"]) - { - $result = $ligne->fetch_by_id($_GET["id"]); - } - if ($_GET["numero"]) - { - $result = $ligne->fetch($_GET["numero"]); - } - } - - - if ($result == 1) - { - $client_comm = new Societe($db); - $client_comm->fetch($ligne->client_comm_id, $user); - } - - if (!$client_comm->perm_read) - { - print "Lecture non authoris�e"; - } - - - if ($result == 1 && $client_comm->perm_read) - { - if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit') - { - - $h=0; - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/fiche.php?id=".$ligne->id; - $head[$h][1] = $langs->trans("Ligne"); - $h++; - - if ($user->rights->telephonie->facture->lire) - { - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/factures.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Factures'); - $h++; - } - - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/infoc.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Infos'); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/history.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Historique'); - $hselected = $h; - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/conso.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Conso'); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/stat.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Stats'); - $h++; - - dol_fiche_head($head, $hselected, 'Ligne : '.$ligne->numero); - - print_fiche_titre('Fiche Ligne', $mesg); - - print ''; - - print ''; - - $client = new Societe($db, $ligne->client_id); - $client->fetch($ligne->client_id); - - print ''; - - print ''; - - if ($ligne->user_creat) - { - print ''; - } - if ($ligne->user_commande) - { - print ''; - } - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - /* historique */ - $ff = array(); - $sql = "SELECT rowid, nom FROM ".MAIN_DB_PREFIX."telephonie_fournisseur"; - $sql .= " WHERE commande_active = 1 ORDER BY nom "; - - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - if ( $num > 0 ) - { - $i = 0; - while ($i < $num) - { - $row = $db->fetch_row($resql); - $ff[$row[0]] = $row[1]; - $i++; - } - } - $db->free($resql); - } - - $sql = "SELECT ".$db->pdate("l.tms").", l.statut, l.fk_user"; - $sql .= ", u.name, u.firstname, l.comment, l.fk_fournisseur"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne_statut as l"; - $sql .= ",".MAIN_DB_PREFIX."user as u"; - $sql .= " WHERE u.rowid = l.fk_user AND l.fk_ligne = ".$ligne->id; - $sql .= " ORDER BY l.tms DESC "; - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - if ( $num > 0 ) - { - $i = 0; - while ($i < $num) - { - $row = $db->fetch_row($resql); - - print ''; - print '"; - $i++; - } - } - $db->free($resql); - } - else - { - print $sql; - } - - print "
Num�ro'.dol_print_phone($ligne->numero,0,0,true).'
Client'; - print ''; - print $client_comm->nom.'
Statut actuel'; - print ' '; - print $ligne->statuts[$ligne->statut]; - print '
Cr�� par'; - - $cuser = new User($db, $ligne->user_creat); - $cuser->fetch(); - - print $cuser->fullname; - print '
Command� par'; - - $couser = new User($db, $ligne->user_commande); - $couser->fetch(); - - print $couser->fullname; - print '
DateStatutFournisseurRapporteur
'.strftime("%a %d %B %Y %H:%M:%S",$row[0]).' '; - print $ligne->statuts[$row[1]]; - if ($row[5]) - { - print '
'.$row[5]; - } - - print '
('.$row[6].') '.$ff[$row[6]]; - print ''.$row[4] . " " . $row[3] . "
"; - } - - /* - * - */ - print '
'; - print_titre("Retours Fournisseurs"); - $sql = "SELECT "; - $sql .= " cli,mode,situation,date_mise_service,date_resiliation,motif_resiliation,commentaire,fichier, traite "; - $sql .= ",".$db->pdate("date_traitement")." as dt, fk_fournisseur"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_commande_retour"; - $sql .= " WHERE cli = ".$ligne->numero; - $sql .= " ORDER BY rowid DESC " . $db->plimit($conf->liste_limit+1, $offset); - - $resql = $db->query($sql); - if ($resql) - { - print ''; - print ''; - print ''; - print "\n"; - $var=True; - - while ($obj = $db->fetch_object($resql)) - { - $var=!$var; - - print ""; - print '\n"; - print '\n"; - print '\n"; - print '\n"; - print '\n"; - if ($obj->fichier) - { - print '\n"; - } - else - { - print '\n"; - } - print "\n"; - } - print "
ModeResultatDate MeSR�silCommentaireD.T. / Fichier
('.$obj->fk_fournisseur.") ".$obj->mode."'.$obj->situation."'.$obj->date_mise_service."'.$obj->date_resiliation."'.$obj->commentaire."'.$obj->fichier."'.strftime("%d/%m/%y %H:%M",$obj->dt)."
"; - $db->free($resql); - } - else - { - print $db->error() . ' ' . $sql; - } - - /* - * - * - * - */ - } - } -else -{ - print "Error"; -} - - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/ligne/index.php b/htdocs/telephonie/ligne/index.php deleted file mode 100644 index 904d60e69ec..00000000000 --- a/htdocs/telephonie/ligne/index.php +++ /dev/null @@ -1,279 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if (!$user->rights->telephonie->lire) - accessforbidden(); - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; - -llxHeader('','Telephonie - Lignes'); - -/* - * S�curit� acc�s client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -/* - * Mode Liste - * - * - * - */ -print '
'; -print ''; - -print '\n"; -print "
'; - - -print ''; -print ''; -print "\n"; -print ""; -print ''; -print '
Recherche ligne
Num�ro
'; - -print '
'; - - -$sql = "SELECT distinct statut, count(*) as cc"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; -$sql .= ",".MAIN_DB_PREFIX."societe_perms as sp"; -$sql .= " WHERE l.fk_client_comm = sp.fk_soc"; -$sql .= " AND sp.fk_user = ".$user->id." AND sp.pread = 1"; -$sql .= " GROUP BY statut"; - -$resql = $db->query($sql); -if ($resql) -{ - $num = $db->num_rows($resql); - $i = 0; - $ligne = new LigneTel($db); - - print ''; - print ''; - print "\n"; - $var=True; - - while ($i < min($num,$conf->liste_limit)) - { - $obj = $db->fetch_object($resql); - $values[$obj->statut] = $obj->cc; - $i++; - } - - foreach ($ligne->statuts as $key => $statut) - { - $var=!$var; - print ""; - print "\n"; - print "\n"; - print ''; - print "\n"; - } - - print "
Lignes StatutsNb 
".$statut."".$values[$key]."
"; - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - - - -if ($user->rights->telephonie->fournisseur->lire) -{ - print '
'; - $sql = "SELECT distinct f.nom as fournisseur, f.rowid, count(*) as cc"; - $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_fournisseur as f"; - $sql .= " WHERE l.fk_soc = s.rowid AND l.fk_fournisseur = f.rowid"; - if ($user->rights->telephonie->ligne->lire_restreint) - { - $sql .= " AND l.fk_commercial_suiv = ".$user->id; - } - $sql .= " GROUP BY f.nom"; - - if ($db->query($sql)) - { - $num = $db->num_rows(); - $i = 0; - - print ''; - print ''; - print "\n"; - $var=True; - - while ($i < $num) - { - $obj = $db->fetch_object($i); - $var=!$var; - - print ""; - print ''; - print "\n"; - print "\n"; - $i++; - } - print "
FournisseurNb
'; - print $obj->fournisseur.'".$obj->cc."
"; - $db->free(); - } - else - { - print $db->error() . ' ' . $sql; - } -} - -print '
'; - -$sql = "SELECT s.rowid as socid, sf.rowid as sfidp, sf.nom as nom_facture,s.nom, l.ligne, f.nom as fournisseur, l.statut, l.rowid, l.remise"; -$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; -$sql .= ",".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; -$sql .= " , ".MAIN_DB_PREFIX."societe as sf"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_fournisseur as f"; - -$sql .= ",".MAIN_DB_PREFIX."societe_perms as sp"; - -$sql .= " WHERE l.fk_soc = s.rowid AND l.fk_fournisseur = f.rowid"; - -$sql .= " AND s.rowid = sp.fk_soc"; -$sql .= " AND sp.fk_user = ".$user->id." AND sp.pread = 1"; - -$sql .= " AND l.fk_soc_facture = sf.rowid"; - -$sql .= " ORDER BY rowid DESC LIMIT 10"; - -$resql = $db->query($sql); -if ($resql) -{ - $num = $db->num_rows($resql); - $i = 0; - - - print"\n\n"; - print ''; - print ''; - print ''; - print ''; - print ''; - - if ($user->rights->telephonie->fournisseur->lire) - print ''; - - print "\n"; - - $var=True; - - $ligne = new LigneTel($db); - - while ($i < $num) - { - $obj = $db->fetch_object(); - $var=!$var; - - print "\n"; - - $nom = stripslashes($obj->nom); - if (strlen(stripslashes($obj->nom)) > 20) - { - $nom = substr(stripslashes($obj->nom),0,20)."..."; - } - - print ''; - - print '\n"; - - if ($user->rights->telephonie->fournisseur->lire) - print "\n"; - print "\n"; - $i++; - } - print "
'.min(10,$num).' Derni�res lignesClient (Agence/Filiale)StatutFournisseur
"; - print ' '; - - print ''; - print img_file(); - print ' '; - - print ''.dol_print_phone($obj->ligne,0,0,true)."'.$nom.''.$ligne->statuts[$obj->statut]."".$obj->fournisseur."

"; - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - - - -$sql = "SELECT distinct c.nom as concurrent, count(*) as cc"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_concurrents as c,".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; - -$sql .= ",".MAIN_DB_PREFIX."societe_perms as sp"; -$sql .= " WHERE l.fk_client_comm = sp.fk_soc"; -$sql .= " AND sp.fk_user = ".$user->id." AND sp.pread = 1"; -$sql .= " AND l.fk_concurrent = c.rowid"; - -$sql .= " GROUP BY c.nom"; - -if ($db->query($sql)) -{ - $num = $db->num_rows(); - $i = 0; - - print ''; - print ''; - print "\n"; - $var=True; - - while ($i < $num) - { - $obj = $db->fetch_object($i); - $var=!$var; - - print ""; - print "\n"; - print "\n"; - print "\n"; - $i++; - } - print "
ConcurrentsNb
".$obj->concurrent."".$obj->cc."
"; - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - -print "
\n
\n"; - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/ligne/infoc.php b/htdocs/telephonie/ligne/infoc.php deleted file mode 100644 index 90f82b88a76..00000000000 --- a/htdocs/telephonie/ligne/infoc.php +++ /dev/null @@ -1,227 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -/** \file htdocs/telephonie/ligne/infoc.php - \ingroup telephonie - \brief Lignes telephonie - \version $Revision$ -*/ - -require("./pre.inc.php"); - -$mesg = ''; - -if ($_POST["action"] == 'update' && $_POST["cancel"] <> $langs->trans("Cancel") && $user->rights->telephonie->ligne->creer) -{ - $ligne = new LigneTel($db); - $ligne->id = $_GET["id"]; - - $ligne->code_analytique = $_POST["code_ana"]; - - if ( $ligne->update_infoc($user) ) - - { - $action = ''; - $mesg = 'Fiche mise � jour'; - Header("Location: infoc.php?id=".$ligne->id); - } - else - { - $action = 're-edit'; - $mesg = 'Fiche non mise � jour !' . "
" . $entrepot->mesg_error; - } -} - - -llxHeader("","","Fiche Ligne"); - -if ($cancel == $langs->trans("Cancel")) -{ - $action = ''; -} -/* - * Affichage - * - */ - - -if ($_GET["id"] or $_GET["numero"]) -{ - if ($_GET["action"] <> 're-edit') - { - $ligne = new LigneTel($db); - if ($_GET["id"]) - { - $result = $ligne->fetch_by_id($_GET["id"]); - } - if ($_GET["numero"]) - { - $result = $ligne->fetch($_GET["numero"]); - } - } - - if ($result == 1) - { - $client_comm = new Societe($db); - $client_comm->fetch($ligne->client_comm_id, $user); - } - - if (!$client_comm->perm_read) - { - print "Lecture non authoris�e"; - } - - - if ($result == 1 && $client_comm->perm_read) - { - if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit') - { - - $h=0; - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/fiche.php?id=".$ligne->id; - $head[$h][1] = $langs->trans("Ligne"); - $h++; - - if ($user->rights->telephonie->facture->lire) - { - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/factures.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Factures'); - $h++; - } - - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/infoc.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Infos'); - $hselected = $h; - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/history.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Historique'); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/conso.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Conso'); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/stat.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Stats'); - $h++; - - dol_fiche_head($head, $hselected, 'Ligne : '.$ligne->numero); - - print_fiche_titre('Informations compl�mentaires', $mesg); - - print ''; - - print ''; - print ''; - - $client = new Societe($db, $ligne->client_id); - $client->fetch($ligne->client_id); - - print ''; - - $client_facture = new Societe($db); - $client_facture->fetch($ligne->client_facture_id); - - - print ''; - - $cuser = new User($db, $ligne->user_creat); - if ($ligne->user_creat) - { - $cuser->fetch(); - } - - print ''; - - - print ''; - - print ''; - - - print "
Num�ro'.dol_print_phone($ligne->numero,0,0,true).'Factur�e : '.$ligne->facturable.'
Client'.$client->nom.'
Remise LMN'.$ligne->remise.' %
Ligne creee par'.$cuser->fullname.'
Code analytique'.$ligne->code_analytique.' 
Modele de facture utilise'.$ligne->pdfdetail.'
"; - } - - - if ($_GET["action"] == 'edit' || $action == 're-edit') - { - print_fiche_titre('Edition des informations complementaires de la ligne', $mesg); - - print "
id\" method=\"post\">\n"; - print ''; - print ''; - - print ''; - - print ''; - - $client = new Societe($db, $ligne->client_id); - $client->fetch($ligne->client_id); - - print ''; - - print ''; - - print ''; - - print ''; - print '
Numero'.$ligne->numero.'
Client'.$client->nom; - print '
Remise LMN'.$ligne->remise.' %
Code Analytique 
 '; - print 'Annuler
'; - print '
'; - } - - /* - * - * - * - */ - - print ''; - - /* ************************************************************************** */ - /* */ - /* Barre d'action */ - /* */ - /* ************************************************************************** */ - - print "
\n"; - - if ($_GET["action"] == '') - { - print "id\">".$langs->trans("Modify").""; - } - - print "
"; - } - -} -else -{ - print "Error"; -} - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/ligne/liste.php b/htdocs/telephonie/ligne/liste.php deleted file mode 100644 index a1e3142304f..00000000000 --- a/htdocs/telephonie/ligne/liste.php +++ /dev/null @@ -1,219 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if (!$user->rights->telephonie->lire) accessforbidden(); - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; -$sortfield = $_GET["sortfield"]; - -llxHeader('','Telephonie - Ligne - Liste'); -/* - * S�curit� acc�s client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -if ($sortorder == "") { - $sortorder="ASC"; -} -if ($sortfield == "") { - $sortfield="l.statut"; -} - -/* - * Recherche - * - * - */ - -if ($page == -1) { $page = 0 ; } - -$offset = $conf->liste_limit * $page ; -$pageprev = $page - 1; -$pagenext = $page + 1; - -/* - * Mode Liste - * - * - * - */ - -$sql = "SELECT s.rowid as socid, sf.rowid as sfidp, sf.nom as nom_facture,s.nom, l.ligne, f.nom as fournisseur, l.statut, l.rowid, l.remise"; -$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; -$sql .= ",".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; -$sql .= ",".MAIN_DB_PREFIX."societe as sf"; -$sql .= ",".MAIN_DB_PREFIX."telephonie_fournisseur as f"; -$sql .= ",".MAIN_DB_PREFIX."societe_perms as sp"; -$sql .= " WHERE l.fk_soc = s.rowid AND l.fk_fournisseur = f.rowid"; -$sql .= " AND l.fk_soc_facture = sf.rowid"; -$sql .= " AND l.fk_client_comm = sp.fk_soc"; -$sql .= " AND sp.fk_user = ".$user->id." AND sp.pread = 1"; - -if ($_GET["search_ligne"]) -{ - $sel =urldecode($_GET["search_ligne"]); - $sel = ereg_replace("\.","",$sel); - $sel = ereg_replace(" ","",$sel); - $sql .= " AND l.ligne LIKE '%".$sel."%'"; -} - -if ($_GET["search_client"]) -{ - $sel =urldecode($_GET["search_client"]); - $sql .= " AND s.nom LIKE '%".$sel."%'"; -} - -if ($_GET["commercial_suiv"]) -{ - $sql .= " AND l.fk_commercial_suiv ='".$_GET["commercial_suiv"]."'"; -} - -if ($_GET["commercial_sign"]) -{ - $sql .= " AND l.fk_commercial_sign ='".$_GET["commercial_sign"]."'"; -} - - -if ($_GET["search_client_facture"]) -{ - $sel =urldecode($_GET["search_client_facture"]); - $sql .= " AND sf.nom LIKE '%".$sel."%'"; -} - -if (strlen($_GET["statut"])) -{ - $sql .= " AND l.statut = ".$_GET["statut"]; -} - -if ($_GET["fournisseur"]) -{ - $sql .= " AND l.fk_fournisseur ='".$_GET["fournisseur"]."'"; -} - - -$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); - -$result = $db->query($sql); -if ($result) -{ - $num = $db->num_rows(); - $i = 0; - - $urladd= "&statut=".$_GET["statut"]; - - $titre = "Lignes"; - - if ($_GET["commercial_suiv"]) - { - $cuser = new User($db, $_GET["commercial_suiv"]); - $cuser->fetch(); - $titre = "Lignes suivies par ".$cuser->fullname; - $urladd .= "&commercial_suiv=". $_GET["commercial_suiv"]; - } - - if ($_GET["commercial_sign"]) - { - $cuser = new User($db, $_GET["commercial_sign"]); - $cuser->fetch(); - $titre = "Lignes sign�es par ".$cuser->fullname; - $urladd .= "&commercial_sign=". $_GET["commercial_sign"]; - } - - print_barre_liste($titre, $page, "liste.php", $urladd, $sortfield, $sortorder, '', $num); - print"\n\n"; - print ''; - print ''; - - print_liste_field_titre("Ligne","liste.php","l.ligne"); - print_liste_field_titre("Client (Agence/Filiale)","liste.php","s.nom"); - - //print ''; - print ''; - - if ($user->rights->telephonie->fournisseur->lire) - print ''; - - print "\n"; - - print ''; - print ''; - print ''; - print ''; - //print ''; - - print ''; - - - if ($user->rights->telephonie->fournisseur->lire) - print ''; - - print ''; - print ''; - - - $var=True; - - $ligne = new LigneTel($db); - - while ($i < min($num,$conf->liste_limit)) - { - $obj = $db->fetch_object(); - $var=!$var; - - print "\n"; - - print ''; - //print ''; - - print '\n"; - - if ($user->rights->telephonie->fournisseur->lire) - print "\n"; - print "\n"; - $i++; - } - print "
Client factur�StatutFournisseur
 
"; - - print ' '; - - print ''; - print img_file(); - print ' '; - - print ''.dol_print_phone($obj->ligne,0,0,true)."'.stripslashes($obj->nom).''.stripslashes($obj->nom_facture).''.$ligne->statuts[$obj->statut]."".$obj->fournisseur."
"; - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/ligne/listecommande.php b/htdocs/telephonie/ligne/listecommande.php deleted file mode 100644 index 9c954c11715..00000000000 --- a/htdocs/telephonie/ligne/listecommande.php +++ /dev/null @@ -1,156 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -/** \file htdocs/telephonie/ligne/listecommande.php - \ingroup telephonie - \brief Liste commandes - \version $Revision$ -*/ - -require("./pre.inc.php"); - - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; -$sortfield = $_GET["sortfield"]; - -llxHeader('','Telephonie - Ligne - Liste'); -/* - * S�curit� acc�s client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -if ($sortorder == "") { - $sortorder="ASC"; -} -if ($sortfield == "") { - $sortfield="l.date_commande_last"; -} - -/* - * Recherche - * - * - */ - -if ($page == -1) { $page = 0 ; } - -$offset = $conf->liste_limit * $page ; -$pageprev = $page - 1; -$pagenext = $page + 1; - -/* - * Mode Liste - * - * - * - */ - -$sql = "SELECT s.rowid as socid, l.date_commande_last, s.nom, l.ligne, f.nom as fournisseur, l.statut, l.rowid, l.remise"; -$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; -$sql .= " ,".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_fournisseur as f"; -$sql .= " WHERE l.statut = 2 AND l.fk_soc = s.rowid AND l.fk_fournisseur = f.rowid"; - -if ($_GET["search_ligne"]) -{ - $sel =urldecode($_GET["search_ligne"]); - $sel = ereg_replace("\.","",$sel); - $sel = ereg_replace(" ","",$sel); - $sql .= " AND l.ligne LIKE '%".$sel."%'"; -} - -if ($_GET["search_client"]) -{ - $sel =urldecode($_GET["search_client"]); - $sql .= " AND s.nom LIKE '%".$sel."%'"; -} - -$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); - -$resql = $db->query($sql); -if ($resql) -{ - $num = $db->num_rows($resql); - $i = 0; - - print_barre_liste("Lignes", $page, "listecommande.php", "", $sortfield, $sortorder, '', $num); - - print ''; - print ''; - print_liste_field_titre("Ligne","listecommande.php","l.ligne"); - print_liste_field_titre("Client (Agence/Filiale)","listecommande.php","s.nom"); - - print ''; - print ''; - print "\n"; - - print ''; - print ''; - print ''; print ''; - - print ''; - - print ''; - print ''; - print ''; - - $var=True; - - while ($i < min($num,$conf->liste_limit)) - { - $obj = $db->fetch_object($resql); - $var=!$var; - - print "\n"; - print ''; - print '\n"; - - print "\n"; - print "\n"; - $i++; - } - print "
DateFournisseur
 
"; - - print ' '; - - print ''; - print img_file(); - - print ' '; - - print ''.dol_print_phone($obj->ligne,0,0,true)."'.$obj->nom.''.$obj->date_commande_last."".$obj->fournisseur."
"; - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/ligne/numdata.php b/htdocs/telephonie/ligne/numdata.php deleted file mode 100644 index 0f27d073acc..00000000000 --- a/htdocs/telephonie/ligne/numdata.php +++ /dev/null @@ -1,212 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -/** \file htdocs/telephonie/ligne/numdata.php - \ingroup telephonie - \brief Num data - \version $Revision$ -*/ - -require("./pre.inc.php"); - - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; -$sortfield = $_GET["sortfield"]; - -if ($_POST["action"] == 'addnum') -{ - - if (strlen(trim($_POST["numero"])) > 0) - { - $sql = "REPLACE INTO ".MAIN_DB_PREFIX."telephonie_numdata"; - $sql .= " (fk_groupe, numero,fk_user) VALUES "; - $sql .= " (".$_POST["groupeid"].",'".$_POST["numero"]."',".$user->id.")"; - - if ( $db->query($sql) ) - { - //Header("Location: numdata.php?id=".$ligne->id); - Header("Location: numdata.php?id=".$ligne->id); - } - else - { - print $db->error(); - } - } -} - -if ($_GET["action"] == 'delete') -{ - - if (strlen(trim($_GET["id"])) > 0) - { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_numdata"; - $sql .= " WHERE rowid = ".$_GET["id"]; - - if ( $db->query($sql) ) - { - Header("Location: numdata.php"); - } - else - { - print $db->error(); - } - } -} - -llxHeader('','Telephonie - Ligne - Liste'); -/* - * S�curit� acc�s client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - - -/* - * Recherche - * - * - */ - -if ($page == -1) { $page = 0 ; } - -$offset = $conf->liste_limit * $page ; -$pageprev = $page - 1; -$pagenext = $page + 1; - -/* - * Mode Liste - * - * - * - */ - - -print_barre_liste("Num�ros data", $page, "numdata.php", $urladd, $sortfield, $sortorder, '', $num); - -print ''; -print ''; -print_liste_field_titre("Num�ro","numdata.php","l.ligne"); - -print_liste_field_titre("Client","numdata.php","s.nom"); -print ''; - -print "\n"; - -print ''; -print ''; -print ''; print ''; - -print ''; - -print ''; -print ''; - - -print ''; -print ''; -print ''; -print ''; -print ''; - -print ''; -print ''; - -print ''; -print ''; - - -$sql = "SELECT g.nom, n.numero, n.rowid"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_groupeligne as g"; -$sql .= ",".MAIN_DB_PREFIX."telephonie_numdata as n"; - -$sql .= " WHERE n.fk_groupe = g.rowid"; - -if ($sortorder == "") { - $sortorder="ASC"; -} -if ($sortfield == "") { - $sortfield="g.nom"; -} - - -$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); - -$result = $db->query($sql); -if ($result) -{ - $num = $db->num_rows(); - $i = 0; - - $var=True; - - $ligne = new LigneTel($db); - - while ($i < min($num,$conf->liste_limit)) - { - $obj = $db->fetch_object($i); - $var=!$var; - - print "\n"; - print ''; - - print ''; - - print "\n"; - $i++; - } - - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - - print "
 
"; - - print dol_print_phone($obj->numero,0,0,true)."'.$obj->nom.''; - print img_delete(); - print '
"; - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/ligne/pre.inc.php b/htdocs/telephonie/ligne/pre.inc.php deleted file mode 100644 index c797bec5ff0..00000000000 --- a/htdocs/telephonie/ligne/pre.inc.php +++ /dev/null @@ -1,85 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("../../main.inc.php"); -require(DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); - -$user->getrights('telephonie'); - -function llxHeader($head = "", $title="") { - global $user, $conf; - - /* - * - * - */ - top_menu($head, $title); - - $menu = new Menu(); - - $menu->add(DOL_URL_ROOT."/telephonie/index.php", "Telephonie"); - - if (TELEPHONIE_MODULE_SIMULATION == 1) - { - $menu->add(DOL_URL_ROOT."/telephonie/simulation/fiche.php", "Simulation"); - $menu->add_submenu(DOL_URL_ROOT."/telephonie/simulation/fiche.php?action=create", "Nouvelle"); - } - - $menu->add(DOL_URL_ROOT."/telephonie/client/index.php", "Clients"); - - $menu->add(DOL_URL_ROOT."/telephonie/contrat/", "Contrats"); - - $menu->add(DOL_URL_ROOT."/telephonie/ligne/index.php", "Lignes"); - $menu->add_submenu(DOL_URL_ROOT."/telephonie/ligne/liste.php", "Liste"); - if ($user->rights->telephonie->ligne_commander) - $menu->add_submenu(DOL_URL_ROOT."/telephonie/ligne/commande/liste.php", "A commander"); - if ($user->rights->telephonie->ligne_commander) - $menu->add_submenu(DOL_URL_ROOT."/telephonie/ligne/listecommande.php", "En commande"); - - // $menu->add_submenu(DOL_URL_ROOT."/telephonie/ligne/communications.php", "Communications"); - - if (TELEPHONIE_MODULE_GROUPES == 1 && $user->rights->telephonie->configurer) - $menu->add_submenu(DOL_URL_ROOT."/telephonie/ligne/groupe.php", "Groupes"); - - if (TELEPHONIE_MODULE_NUMDATA == 1 && $user->rights->telephonie->configurer) - $menu->add_submenu(DOL_URL_ROOT."/telephonie/ligne/numdata.php", "Numéros data"); - - if ($user->rights->telephonie->ligne_commander) - $menu->add(DOL_URL_ROOT."/telephonie/ligne/commande/", "Commandes"); - - if ($user->rights->telephonie->stats->lire) - $menu->add(DOL_URL_ROOT."/telephonie/stats/", "Statistiques"); - - if ($user->rights->telephonie->facture->lire) - $menu->add(DOL_URL_ROOT."/telephonie/facture/", "Factures"); - - $menu->add(DOL_URL_ROOT."/telephonie/tarifs/", "Tarifs"); - - if ($user->rights->telephonie->fournisseur->lire) - $menu->add(DOL_URL_ROOT."/telephonie/fournisseur/", "Fournisseurs"); - - if ($user->rights->telephonie->ca->lire) - $menu->add(DOL_URL_ROOT."/telephonie/ca/", "Chiffre d'affaire"); - - left_menu($menu->liste); -} - -?> diff --git a/htdocs/telephonie/ligne/remises.php b/htdocs/telephonie/ligne/remises.php deleted file mode 100644 index 60af17d5bf3..00000000000 --- a/htdocs/telephonie/ligne/remises.php +++ /dev/null @@ -1,160 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require("./pre.inc.php"); - -$mesg = ''; - -llxHeader("","","Historique Remises"); - -if ($cancel == $langs->trans("Cancel")) -{ - $action = ''; -} -/* - * Affichage - * - */ - -if ($_GET["id"]) -{ - $ligne = new LigneTel($db); - $result = $ligne->fetch_by_id($_GET["id"]); -} - -if ($result == 1) -{ - $client_comm = new Societe($db); - $client_comm->fetch($ligne->client_comm_id, $user); -} - -if (!$client_comm->perm_read) -{ - print "Lecture non authoris�e"; -} - -if ($result == 1 && $client_comm->perm_read) -{ - if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit') - { - $h=0; - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/fiche.php?id=".$ligne->id; - $head[$h][1] = $langs->trans("Ligne"); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/remises.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Discounts'); - $hselected=$h; - $h++; - - dol_fiche_head($head, $hselected, 'Ligne : '.$ligne->numero); - - print_fiche_titre('Fiche Ligne', $mesg); - - print ''; - - print ''; - - $client = new Societe($db, $ligne->client_id); - $client->fetch($ligne->client_id); - - print ''; - - print ''; - - if ($ligne->user_creat) - { - print ''; - } - if ($ligne->user_commande) - { - print ''; - } - - print '
Num�ro'.dol_print_phone($ligne->numero,0,0,true).'
Client'; - print ''; - print $client_comm->nom.'
Statut actuel'; - print ' '; - print $ligne->statuts[$ligne->statut]; - print '
Cr�� par'; - - $cuser = new User($db, $ligne->user_creat); - $cuser->fetch(); - - print $cuser->fullname; - print '
Command� par'; - - $couser = new User($db, $ligne->user_commande); - $couser->fetch(); - - print $couser->fullname; - print '

'; - print ''; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - /* historique */ - - $sql = "SELECT ".$db->pdate("r.tms").", r.remise, r.fk_user, r.comment, u.name, u.firstname"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne_remise as r"; - $sql .= ",".MAIN_DB_PREFIX."user as u"; - $sql .= " WHERE u.rowid = r.fk_user AND r.fk_ligne = ".$ligne->id; - $sql .= " ORDER BY r.tms DESC "; - if ( $db->query( $sql) ) - { - $num = $db->num_rows(); - if ( $num > 0 ) - { - $i = 0; - while ($i < $num) - { - $row = $db->fetch_row($i); - - print ''; - - print ''; - print ''; - - print '"; - $i++; - } - } - $db->free(); - } - else - { - print $sql; - } - - print "
Date'.$langs->trans("Discount").''.$langs->trans("Comment").''.$langs->trans("User").'
'.strftime("%a %d %B %Y %H:%M:%S",$row[0]).''.$row[1].' %'.stripslashes($row[3]).' '.$row[5] . " " . $row[4] . "
"; - } -} - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/ligne/stat.php b/htdocs/telephonie/ligne/stat.php deleted file mode 100644 index 30d2130ddd2..00000000000 --- a/htdocs/telephonie/ligne/stat.php +++ /dev/null @@ -1,220 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require("./pre.inc.php"); - -llxHeader("","","Fiche Ligne"); - -if ($_GET["id"] or $_GET["numero"]) -{ - $ligne = new LigneTel($db); - if ($_GET["id"]) - { - $result = $ligne->fetch_by_id($_GET["id"]); - } - if ($_GET["numero"]) - { - $result = $ligne->fetch($_GET["numero"]); - } - - if ($result == 1) - { - $client_comm = new Societe($db); - $client_comm->fetch($ligne->client_comm_id, $user); - } - - if (!$client_comm->perm_read) - { - print "Lecture non authoris�e"; - } - - - if ($result == 1 && $client_comm->perm_read) - { - if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit') - { - - $h=0; - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/fiche.php?id=".$ligne->id; - $head[$h][1] = $langs->trans("Ligne"); - $h++; - - if ($user->rights->telephonie->facture->lire) - { - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/factures.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Factures'); - $h++; - } - - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/infoc.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Infos'); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/history.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Historique'); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/conso.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Conso'); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/stat.php?id=".$ligne->id; - $head[$h][1] = $langs->trans('Stats'); - $hselected = $h; - $h++; - - $ligne->load_previous_next_id(); - - $previous_ref = $ligne->ref_previous?''.img_previous().'':''; - $next_ref = $ligne->ref_next?''.img_next().'':''; - - dol_fiche_head($head, $hselected, 'Statistiques ligne'); - - print ''; - print '
Statistiques '.$mesg.''.$product->ref.''; - print ''.$previous_ref.''.$next_ref.'

'; - - print ''; - - print ''; - print ''; - - $client = new Societe($db, $ligne->client_id); - $client->fetch($ligne->client_id); - - print ''; - - $client_facture = new Societe($db); - $client_facture->fetch($ligne->client_facture_id); - - print ''; - - print '
Num�ro'.dol_print_phone($ligne->numero,0,0,true).'Factur�e : '.$ligne->facturable.' 
Client'; - - print ''; - print $client->nom.'Client Factur�'.$client_facture->nom.'
Statut'; - print ' '; - print $ligne->statuts[$ligne->statut]; - print "
"; - - /* - * - * - */ - - print ''; - - print ''; - - - print ''; - print '
'; - - $mesg_no_graph = 'Nous avons pas assez de donn�es � ce jour pour g�n�rer ce graphique.'; - - $img_root = DOL_DATA_ROOT."/graph/".substr($ligne->id,-1)."/telephonie/ligne/"; - - $file = $img_root.$ligne->id."/graphca.png"; - - if (file_exists($file)) - { - print 'CA Mensuel'; - } - else - { - print $mesg_no_graph; - } - - print ''; - - $file = $img_root.$ligne->id."/graphgain.png"; - if (file_exists($file) && $user->rights->telephonie->ligne->gain) - { - print 'CA Mensuel'; - } - else - { - print $mesg_no_graph; - } - - print '
'; - - $file = $img_root.$ligne->id."/nb-comm-mensuel.png"; - - if (file_exists($file)) - { - print 'CA Mensuel'; - } - else - { - print $mesg_no_graph; - } - - print ''; - - $file = $img_root.$ligne->id."/nb-minutes-mensuel.png"; - - if (file_exists($file)) - { - print 'CA Mensuel'; - } - else - { - print $mesg_no_graph; - } - - print '
'; - - $file = $img_root.$ligne->id."/graphappelsdureemoyenne.png"; - - if (file_exists($file)) - { - print 'CA Mensuel'; - } - else - { - print $mesg_no_graph; - } - - print ''; - print " "; - print '
'; - } - } -} -else -{ - print "Error"; -} - - -/* ************************************************************************** */ -/* */ -/* Barre d'action */ -/* */ -/* ************************************************************************** */ - - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/lignetel.class.php b/htdocs/telephonie/lignetel.class.php deleted file mode 100644 index 7cf09cba591..00000000000 --- a/htdocs/telephonie/lignetel.class.php +++ /dev/null @@ -1,971 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -class LigneTel { - var $db; - var $id; - var $ligne; - - function LigneTel($DB, $id=0) - { - global $config; - - $this->db = $DB; - $this->error_message = ''; - $this->statuts[-1] = "En attente"; - $this->statuts[1] = "A commander"; - $this->statuts[2] = "Commandée"; - $this->statuts[3] = "Activée"; - $this->statuts[4] = "A résilier"; - $this->statuts[5] = "Résiliation demandée"; - $this->statuts[6] = "Résiliée"; - $this->statuts[7] = "Rejetée"; - $this->statuts[8] = "En transfert"; - $this->statuts[9] = "Commande en cours"; - - return 1; - } - /* - * - * - */ - function update($user) - { - $sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_societe_ligne"; - $sql .= " SET "; - $sql .= " ligne = '$this->numero', "; - $sql .= " fk_fournisseur = $this->fournisseur, "; - $sql .= " fk_concurrent = $this->concurrent, "; - $sql .= " note = '$this->note'"; - $sql .= " WHERE rowid = $this->id"; - - if ( $this->db->query($sql) ) - { - return 1; - } - else - { - print $this->db->error(); - print $sql ; - return 0; - } - } - /* - * Infos complémentaires - * - */ - function update_infoc($user) - { - - $sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_societe_ligne"; - $sql .= " SET "; - $sql .= " code_analytique = '".$this->code_analytique."' "; - - $sql .= " WHERE rowid = ".$this->id; - - if ( $this->db->query($sql) ) - { - return 1; - } - else - { - print $this->db->error(); - print $sql ; - return 0; - } - } - /* - * - * - */ - function num_comments() - { - $num_comments = 0; - - /* Commentaires */ - $sql = "SELECT fk_ligne "; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne_comments"; - $sql .= " WHERE fk_ligne = ".$this->id; - $resql = $this->db->query($sql); - - if ($resql) - { - $num_comments = $this->db->num_rows($resql); - $this->db->free($resql); - } - return $num_comments; - } - /* - * - */ - - function send_mail($user, $commentaire, $statut) - { - /* - * Envoi mail au commercial responsable - * - */ - - $comm = new User($this->db,$this->commercial_id); - $comm->fetch(); - - $soc = new Societe($this->db); - $soc->fetch($this->socid); - - $subject = "Evénement sur la ligne ".$this->numero; - $sendto = $comm->prenom . " " .$comm->nom . "<".$comm->email.">"; - $from = "Dolibarr "; - - $message = "Bonjour,\n\n"; - $message .= "Nous vous informons de l'événement suivant :\n\n"; - - $message .= "Ligne numéro : ".$this->numero."\n"; - $message .= "Société : ".$soc->nom."\n"; - - if ($statut == 6) - { - $message .= "Evénement : Désactivation\n"; - } - - if ($statut == 3) - { - $message .= "Evénement : Activation\n"; - - } - - if (strlen($commentaire)) - { - $message .= "Commentaire : ".$commentaire; - } - - $message .= "\n\n--\n"; - $message .= "Ceci est un message automatique envoyé par Dolibarr\n"; - $message .= "Vous ne pouvez pas y répondre."; - - $mailfile = new DolibarrMail($subject, - $sendto, - $from, - $message); - $mailfile->sendfile(); - } - /* - * - * - */ - function SetRemise($user, $remise, $comment) - { - $remise = ereg_replace(",",".", $remise); - - if (strlen(trim($remise)) <> 0 && is_numeric($remise)) - { - - if (!$this->db->begin()) - { - dol_syslog("LigneTel::SetRemise Error -5"); - $error++; - } - - if (!$error) - { - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_societe_ligne_remise"; - $sql .= " (tms, fk_ligne, remise, fk_user, comment)"; - $sql .= " VALUES (now(),"; - $sql .= " $this->id,'$remise',$user->id, '$comment')"; - - if (! $this->db->query($sql) ) - { - dol_syslog("LigneTel::SetRemise Error -3"); - $error++; - } - } - - if (!$error) - { - $sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_societe_ligne"; - $sql .= " SET remise = '$remise'"; - $sql .= " WHERE rowid = $this->id"; - - if (! $this->db->query($sql) ) - { - dol_syslog("LigneTel::SetRemise Error -4"); - $error++; - } - } - - if (!$error) - { - $this->db->commit(); - return 0; - } - else - { - $this->db->rollback(); - return -1; - } - } - else - { - dol_syslog("LigneTel::SetRemise Error -2"); - return -2; - } - } - - /* - * - * - */ - function create($user, $mode_paiement='pre') - { - if (strlen(trim($this->numero)) == 10) - { - /* - * fk_commercial est encore définit pour supporter la migration en douceur - * à terme cette colonne sera supprimé - * - */ - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_societe_ligne"; - $sql .= " (datec,fk_soc, fk_client_comm, ligne, fk_soc_facture, fk_fournisseur, note, remise, fk_commercial, fk_commercial_sign, fk_commercial_suiv, statut, fk_user_creat, fk_concurrent, fk_contrat, mode_paiement)"; - $sql .= " VALUES ("; - $sql .= "now(),$this->client,$this->client_comm,'$this->numero',$this->client_facture,$this->fournisseur, '$this->note','$this->remise',$this->commercial_sign, $this->commercial_sign, $this->commercial_suiv, -1,$user->id, $this->concurrent, $this->contrat,'$mode_paiement')"; - - if ( $this->db->query($sql) ) - { - $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."telephonie_societe_ligne"); - - $this->SetRemise($user, $this->remise, 'Remise initiale'); - - $this->DefineClientOption(); - - if ($this->techno == 'voip' && $this->id) - { - $sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_societe_ligne"; - $sql .= " SET statut = 3, techno='voip'"; - $sql .= " WHERE rowid=".$this->id; - $this->db->query($sql); - } - - - return 0; - } - else - { - $lex = new LigneTel($this->db); - if ($lex->fetch($this->numero) == 1) - { - $this->error_message = "Echec de la création de la ligne, cette ligne existe déjà !"; - dol_syslog("LigneTel::Create Error -3"); - return -3; - } - else - { - $this->error_message = "Echec de la création de la ligne"; - dol_syslog("LigneTel::Create Error -1"); - dol_syslog("LigneTel::Create ".$this->db->error()); - dol_syslog("LigneTel::Create $sql"); - return -1; - } - } - } - else - { - $this->error_message = "Echec de la création de la ligne, le numéro de la ligne est incorrect !"; - dol_syslog("LigneTel::Create Error -2 ($this->numero)"); - return -2; - } - } - /* - * - * - */ - function DefineClientOption() - { - - $sql = "SELECT propriete, valeur"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_options"; - $sql .= " WHERE type= 'ligne'"; - $sql .= " AND fk_client_comm = '".$this->client_comm."'"; - - $resql = $this->db->query($sql); - - if ($resql) - { - $num = $this->db->num_rows($resql); - $i = 0; - - while ($i < $num) - { - $obj = $this->db->fetch_object($resql); - - $sqlu = "UPDATE ".MAIN_DB_PREFIX."telephonie_societe_ligne"; - $sqlu .= " SET ".$obj->propriete." = '".$obj->valeur."'"; - $sqlu .= " WHERE rowid = '".$this->id."'"; - - $resqlu = $this->db->query($sqlu); - - if (!$resqlu) - { - dol_syslog("LigneTel::DefineClientOption Error"); - dol_syslog("LigneTel::DefineClientOption $sqlu"); - } - - - $i++; - } - } - else - { - dol_syslog("LigneTel::DefineClientOption Error"); - } - } - /* - * - * - */ - function fetch_by_id($id) - { - return $this->fetch(0, $id); - } - /* - * - * - */ - function fetch($ligne, $id = 0) - { - - $sql = "SELECT rowid, fk_client_comm, fk_soc, fk_soc_facture, fk_fournisseur"; - $sql .= " , ligne, remise, note, statut, isfacturable"; - $sql .= " , mode_paiement, fk_concurrent, code_analytique"; - $sql .= " , fk_user_creat, fk_user_commande"; - $sql .= " , fk_contrat "; - $sql .= " , fk_commercial_suiv, fk_commercial_sign"; - $sql .= " , pdfdetail, techno, support, last_comm_date"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne as tl"; - - if ($id > 0) - { - $sql .= " WHERE tl.rowid = ".$id; - } - else - { - $sql .= " WHERE tl.ligne = ".$ligne; - } - - $resql = $this->db->query($sql); - - if ($resql) - { - if ($this->db->num_rows($resql)) - { - $obj = $this->db->fetch_object($resql); - - $this->id = $obj->rowid; - $this->socid = $obj->fk_soc; - $this->numero = $obj->ligne; - $this->contrat = $obj->fk_contrat; - $this->remise = $obj->remise; - $this->client_comm_id = $obj->fk_client_comm; - $this->client_id = $obj->fk_soc; - $this->client_facture_id = $obj->fk_soc_facture; - $this->fournisseur_id = $obj->fk_fournisseur; - $this->commercial_id = $obj->fk_commercial_suiv; - $this->commercial_sign_id = $obj->fk_commercial_sign; - $this->commercial_suiv_id = $obj->fk_commercial_suiv; - $this->concurrent_id = $obj->fk_concurrent; - $this->statut = $obj->statut; - $this->mode_paiement = $obj->mode_paiement; - $this->code_analytique = $obj->code_analytique; - $this->techno = $obj->techno; - $this->support = $obj->support; - $this->user_creat = $obj->fk_user_creat; - $this->user_commande = $obj->fk_user_commande; - $this->last_comm_date = $obj->last_comm_date; - - if ($obj->isfacturable == 'oui') - { - $this->facturable = 1; - } - else - { - $this->facturable = 0; - } - - $this->note = stripslashes($obj->note); - $this->pdfdetail = $obj->pdfdetail; - $result = 1; - } - else - { - $result = -2; - } - - $this->db->free($resql); - } - else - { - /* Erreur select SQL */ - print $this->db->error(); - $result = -1; - } - - return $result; - } - - /** - * - * - * - */ - function print_concurrent_nom() - { - $sql = "SELECT nom"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_concurrents"; - $sql .= " WHERE rowid=".$this->concurrent_id; - - - if ($this->db->query($sql)) - { - if ($this->db->num_rows()) - { - $row = $this->db->fetch_row(0); - - return $row[0]; - } - } - } - - /** - * Change le statut de la ligne en a commander - * - */ - function set_a_commander($user) - { - if ($this->statut == -1) - { - $this->set_statut( $user, 1, $datea, $commentaire); - } - } - - /** - * Transfer la ligne - * - */ - function transfer($user, $fourn_id) - { - if ($this->statut == 3) - { - $this->change_fournisseur($user,$fourn_id); - $this->set_statut($user, 8); - } - } - - function change_fournisseur($user, $fourn_id) - { - $sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_societe_ligne"; - $sql .= " SET fk_fournisseur = ".$fourn_id ; - $sql .= " WHERE rowid = ".$this->id; - - $resql = $this->db->query($sql); - - $this->fournisseur_id = $fourn_id; - } - - - /** - * Change le statut de la ligne en En attente - * - */ - function set_en_attente($user) - { - if ($this->statut == 1) - { - $this->set_statut($user, -1, $datea, $commentaire); - } - } - - /** - * Change le statut de la ligne - * - */ - function set_statut($user, $statut, $datea='', $commentaire='', $fourn=0) - { - if ($statut == 6 || $statut == 3) - { - $this->send_mail($user, $commentaire, $statut); - } - - - $sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_societe_ligne"; - $sql .= " SET statut = ".$statut ; - $sql .= " WHERE rowid =".$this->id; - - if ($fourn > 0) - { - $sql .= " AND fk_fournisseur =".$fourn; - $this->fournisseur_id = $fourn; - } - - $this->db->query($sql); - - if ($statut == 2) - { - $sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_societe_ligne"; - $sql .= " SET date_commande = now()"; - $sql .= ", date_commande_last = now()"; - $sql .= ", fk_user_commande=".$user->id; - $sql .= " WHERE rowid =".$this->id; - $sql .= " AND date_commande IS NULL"; - - if ($fourn > 0) - { - $sql .= " AND fk_fournisseur =".$fourn; - } - - $this->db->query($sql); - - $sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_societe_ligne"; - $sql .= " SET date_commande_last = now()"; - $sql .= ", fk_user_commande=".$user->id; - $sql .= " WHERE rowid =".$this->id; - - if ($fourn > 0) - { - $sql .= " AND fk_fournisseur =".$fourn; - } - - $this->db->query($sql); - } - - if ($datea) - { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_societe_ligne_statut"; - $sql .= " (tms,fk_ligne, fk_user, statut, comment,fk_fournisseur) "; - $sql .= " VALUES ($datea,$this->id, $user->id, $statut, '$commentaire',$this->fournisseur_id)"; - - if (!$this->db->query($sql)) - { - dol_syslog("LigneTel::set_statut Error -5"); - dol_syslog($this->db->error()); - dol_syslog($sql); - } - /* - * Mise à jour des logs - * - */ - $sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_ligne_statistique"; - $sql .= " SET nb = nb - 1"; - $sql .= " WHERE statut = ".$this->statut; - $sql .= " AND dates >= '".$datea ."'"; - - $this->db->query($sql); - - $sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_ligne_statistique"; - $sql .= " SET nb = nb + 1"; - $sql .= " WHERE statut = ".$statut; - $sql .= " AND dates >= '".$datea ."'"; - - $this->db->query($sql); - } - else - { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_societe_ligne_statut"; - $sql .= " (tms, fk_ligne, fk_user, statut, comment,fk_fournisseur) "; - $sql .= " VALUES (now(), $this->id, $user->id, $statut, '$commentaire',$this->fournisseur_id)"; - - if (!$this->db->query($sql)) - { - dol_syslog("LigneTel::set_statut Error -6"); - dol_syslog($this->db->error()); - dol_syslog($sql); - } - } - - - $sql = "SELECT distinct statut, count(*) FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne GROUP BY statut"; - - if ($this->db->query($sql)) - { - $num = $this->db->num_rows(); - $i = 0; - $sl = array(); - while ($i < $num) - { - $row = $this->db->fetch_row($i); - $sl[$i] = $row; - $i++; - } - - $i = 0; - - /* Nettoyage des logs */ - - $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_ligne_statistique"; - $sql .= " WHERE dates = now()"; - if (!$this->db->query($sql)) - { - print $sql; - } - - /* Insertion des nouveaux logs */ - - while ($i < $num) - { - $row = $sl[$i]; - - $sql = "REPLACE INTO ".MAIN_DB_PREFIX."telephonie_ligne_statistique"; - $sql .= " VALUES (now(),".$row[0].",".$row[1].")"; - if (!$this->db->query($sql)) - { - print $sql; - } - $i++; - } - } - else - { - print $sql; - } - - $this->log_clients(); - - - /* Mise à jour du contrat associé */ - - if ($this->contrat > 0) - { - require_once (DOL_DOCUMENT_ROOT."/telephonie/telephonie.contrat.class.php"); - $contrat = new TelephonieContrat($this->db); - $contrat->id = $this->contrat; - $contrat->update_statut(); - } - - return 0; - } - /* - * - * - */ - function log_clients() - { - $sql = "SELECT distinct s.rowid "; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; - $sql .= " , ".MAIN_DB_PREFIX."societe as s"; - $sql .= " WHERE l.statut = 3 AND s.rowid = l.fk_soc "; - - if ($this->db->query($sql)) - { - $num = $this->db->num_rows(); - $nbclients = $num; - $i = 0; - - /* Insertion des nouveaux logs */ - - $sql = "REPLACE INTO ".MAIN_DB_PREFIX."telephonie_client_statistique"; - $sql .= " VALUES (now(),'nbclient',".$num.")"; - if (!$this->db->query($sql)) - { - print $sql; - } - } - else - { - print $sql; - } - /* - * nbligne active / client - * - */ - - $sql = "SELECT count(*) "; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; - $sql .= " WHERE l.statut = 3"; - - if ($this->db->query($sql)) - { - $num = $this->db->num_rows(); - - $row = $this->db->fetch_row(0); - - /* Insertion des nouveaux logs */ - - if ($nbclients > 0) - { - $nblapc = ereg_replace(",",".",round($row[0]/$nbclients,3)); - } - - $sql = "REPLACE INTO ".MAIN_DB_PREFIX."telephonie_client_statistique"; - $sql .= " VALUES (now(),'nblapc','".$nblapc."')"; - if (!$this->db->query($sql)) - { - print $sql; - } - } - else - { - print $sql; - } - - - return 0; - - } - /* - * - * - */ - function add_contact($cid) - { - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_contact_facture"; - $sql .= " (fk_ligne, fk_contact) "; - $sql .= " VALUES ($this->id, $cid )"; - - $this->db->query($sql); - } - /* - * - * - * - */ - function delete($user) - { - $erro = 0; - if ($this->statut == -1) - { - - if ($this->db->begin()) - { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne_remise"; - $sql .= " WHERE fk_ligne=".$this->id; - - if (!$this->db->query($sql)) - { - dol_syslog("LigneTel::Delete Error -5"); - $error++; - } - - $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne_statut"; - $sql .= " WHERE fk_ligne=".$this->id; - - if (!$this->db->query($sql)) - { - dol_syslog("LigneTel::Delete Error -4"); - $error++; - } - - $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_contact_facture"; - $sql .= " WHERE fk_ligne=".$this->id; - - if (!$this->db->query($sql)) - { - dol_syslog("LigneTel::Delete Error -3"); - $error++; - } - - $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne"; - $sql .= " WHERE rowid =".$this->id; - - if (!$this->db->query($sql)) - { - dol_syslog("LigneTel::Delete Error -2"); - $error++; - } - - /*****/ - - if (!$error) - { - $this->db->commit(); - return 0; - } - else - { - $this->db->rollback(); - return -1; - } - } - - } - } - /* - * - * - */ - function del_contact($cid) - { - - $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_contact_facture"; - $sql .= " WHERE fk_ligne=$this->id AND fk_contact=$cid ;"; - - return $this->db->query($sql); - } - /* - * - */ - function get_contact_facture() - { - $this->contact_facture_id = array(); - $res = array(); - $resid = array(); - - - $sql = "SELECT c.rowid, c.name, c.firstname, c.email "; - $sql .= "FROM ".MAIN_DB_PREFIX."socpeople as c"; - $sql .= ",".MAIN_DB_PREFIX."telephonie_contact_facture as cf"; - $sql .= " WHERE c.rowid = cf.fk_contact AND cf.fk_ligne = ".$this->id." ORDER BY name "; - - if ( $this->db->query( $sql) ) - { - $num = $this->db->num_rows(); - if ( $num > 0 ) - { - $i = 0; - while ($i < $num) - { - $row = $this->db->fetch_row($i); - - array_push($res, $row[1] . " " . $row[2] . " <".$row[3].">"); - array_push($resid, $row[0]); - $i++; - } - - $this->db->free(); - } - - } - $this->contact_facture_id = $resid; - return $res; - } - /** - * Recupére le numéro d'une ligne depuis une facture comptable - * - */ - - function fetch_by_facture_number($facnumber) - { - $sql = "SELECT fk_ligne, fk_facture "; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture"; - $sql .= " WHERE fk_facture = ".$facnumber; - - $resql = $this->db->query($sql); - - if ($resql) - { - if ($this->db->num_rows($resql)) - { - $row = $this->db->fetch_row($resql); - - $this->id = $row[0]; - - return 0; - } - else - { - return -1; - } - $this->db->free($resql); - } - else - { - return -2; - } - } - - function ChangeContrat($user, $contrat_id) - { - $sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_societe_ligne"; - $sql .= " SET fk_contrat = ".$contrat_id ; - $sql .= " WHERE rowid = ".$this->id; - - $resql = $this->db->query($sql); - - return 0; - } - - /** - * \brief Charge indicateurs this->nb de tableau de bord - * \return int <0 si ko, >0 si ok - */ - function load_state_board($user) - { - $this->nb=array(); - - $sql = "SELECT count(rowid) as nb"; - $sql.= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne "; - $sql.= " WHERE fk_commercial_sign = ".$user->id; - $resql=$this->db->query($sql); - if ($resql) - { - while ($obj=$this->db->fetch_object($resql)) - { - $this->nb["sign"] = $obj->nb; - } - return 1; - } - else - { - dol_print_error($this->db); - $this->error=$this->db->error(); - return -1; - } - } - /* - * - * - * - */ - function load_previous_next_id($filtre='') - { - $sql = "SELECT rowid"; - $sql.= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne"; - $sql.= " WHERE rowid > ".$this->id.""; - $sql .= " ORDER BY rowid ASC LIMIT 1"; - - $resql = $this->db->query($sql) ; - if ($resql) - { - while ($row = $this->db->fetch_row($resql)) - { - $this->ref_next = $row[0]; - } - } - - $sql = "SELECT rowid"; - $sql.= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne"; - $sql.= " WHERE rowid < ".$this->id.""; - $sql .= " ORDER BY rowid DESC LIMIT 1"; - - $resql = $this->db->query($sql) ; - if ($resql) - { - while ($row = $this->db->fetch_row($resql)) - { - $this->ref_previous = $row[0]; - } - } - - return 1; - } - -} -?> diff --git a/htdocs/telephonie/pdf/index.php b/htdocs/telephonie/pdf/index.php deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/telephonie/pdf/pdfdetail_nodet.modules.php b/htdocs/telephonie/pdf/pdfdetail_nodet.modules.php deleted file mode 100644 index 52caafa9e0b..00000000000 --- a/htdocs/telephonie/pdf/pdfdetail_nodet.modules.php +++ /dev/null @@ -1,576 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * or see http://www.gnu.org/ - * - * $Id$ - * $Source$ - * - * Génère un PDF de la première page de résumé et un tableur des communications - */ - -require_once DOL_DOCUMENT_ROOT."/facture.class.php"; -require_once DOL_DOCUMENT_ROOT."/telephonie/facturetel.class.php"; -require_once DOL_DOCUMENT_ROOT."/telephonie/pdf/pdfdetail_standard.modeles.php"; -require_once DOL_DOCUMENT_ROOT."/telephonie/pdf/xlsdetail_nodet.modules.php"; - - -class pdfdetail_nodet { - - function pdfdetail_nodet ($db=0, $ligne, $year, $month, $factel) - { - $this->db = $db; - $this->description = "Modèle de facture détaillée sans les communications"; - $this->ligne = $ligne; - $this->year = $year; - $this->month = $month; - $this->factel = $factel; - } - - /* - * - * - */ - function write_pdf_file($factel, $ligne) - { - $xpdf = 0; - $this->_write_pdf_file($factel, $ligne, $xpdf, 0); - } - - function _write_pdf_file($factel, $ligne, &$pdf, $output) - { - $fac = new Facture($this->db,"",$factel->fk_facture); - $fac->fetch($factel->fk_facture); - $fac->fetch_client(); - - $objlignetel = new LigneTel($this->db); - - $result = $objlignetel->fetch($ligne); - - if (defined("FAC_OUTPUTDIR")) - { - $dir = FAC_OUTPUTDIR . "/" . $fac->ref . "/" ; - $file = $dir . $fac->ref . "-$ligne-detail.pdf"; - - if (strlen($objlignetel->code_analytique) > 0) - { - $file = $dir . $fac->ref . "-$ligne-$objlignetel->code_analytique-detail.pdf"; - } - - if (! file_exists($dir)) - { - umask(0); - if (! mkdir($dir, 0755)) - { - $this->error="Erreur: Le répertoire '$dir' n'existe pas et Dolibarr n'a pu le créer."; - return 0; - } - } - - if (file_exists($dir) OR $output) - { - if ($output == 0) - { - $pdf = new pdfdetail_standard_modeles('P','mm','A4'); - } - - $pdf->fac = $fac; - - $pdf->factel = $this->factel; - - $pdf->client_nom = $fac->client->nom; - $pdf->client_adresse = $fac->client->adresse; - $pdf->client_cp = $fac->client->cp; - $pdf->client_ville = $fac->client->ville; - - $pdf->ligne = $ligne; - - $pdf->year = $this->year; - $pdf->month = $this->month; - - $pdf->ligne_ville = ''; - if ($objlignetel->code_analytique) - { - $soca = new Societe($this->db); - $soca->fetch($objlignetel->client_id); - - $pdf->ligne = $ligne . " (".$objlignetel->code_analytique.")"; - $pdf->ligne_ville = $soca->ville; - } - - $pdf->AliasNbPages(); - if ($output == 0) - { - $pdf->Open(); - - $pdf->SetTitle($fac->ref); - $pdf->SetSubject("Facture détaillée"); - $pdf->SetCreator("Dolibarr"); - $pdf->SetAuthor(""); - - $pdf->SetMargins(10, 10, 10); - } - $pdf->SetAutoPageBreak(1, 24); - $pdf->SetLineWidth(0.1); - - $pdf->tab_top = 53; - $pdf->tab_height = 222; - - /* - * - */ - $pdf->FirstPage = 1; - $pdf->AddPage(); - $this->Header($pdf, $output); - - $pdf->SetFillColor(230,230,230); - /* - * Détails des comm - * - */ - - $pdf->SetFont('Arial','', 12); - - $Y = $pdf->tab_top + 4; - $pdf->SetXY(10, $Y); - $pdf->MultiCell(100, 4, "Détails de vos communications", 0,'L',0); - - $pdf->SetFont('Arial','', 9); - - $Y = $pdf->GetY(); - - $pdf->SetXY(140, $Y); - $pdf->MultiCell(20, 4, "Durée", 0,'R',0); - - $pdf->SetXY(160, $Y); - $pdf->MultiCell(20, 4, "Nb appels", 0,'R',0); - - $pdf->SetXY(180, $Y); - $pdf->MultiCell(20, 4, "Coût", 0,'R',0); - - $sql = "SELECT count(*) as cc, sum(t.cout_vente) as cout_vente, sum(t.duree) as duree, t.dest"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details as t "; - $sql .= " WHERE t.fk_telephonie_facture =".$factel->id; - $sql .= " GROUP BY t.dest"; - $sql .= " ORDER BY cout_vente DESC"; - $sql .= " LIMIT 10"; - - $resql = $this->db->query($sql); - - $total_duree = 0; - $total_nb = 0; - $total_cout = 0; - - if ( $resql ) - { - $num = $this->db->num_rows($resql); - $i = 0; - - $pdf->SetFont('Arial','', 9); - $var = 0; - $line_height = 4; - - $graph_values = array(); - $graph_values_duree = array(); - $graph_labels = array(); - - while ($i < $num) - { - $obj = $this->db->fetch_object($i); - $var=!$var; - - $Y = $pdf->GetY(); - - $pdf->SetXY(10, $Y); - $pdf->MultiCell(100, $line_height, $obj->dest, 0,'L',$var); - - if ($Y > $pdf->GetY()) - $Y = $pdf->GetY() - $line_height; - - - $h = floor($obj->duree / 3600); - $m = floor(($obj->duree - ($h * 3600)) / 60); - $s = ($obj->duree - ( ($h * 3600 ) + ($m * 60) ) ); - - if ($h > 0) - { - $dt = $h . " h " . $m ." min " . $s ." sec" ; - } - else - { - if ($m > 0) - { - $dt = $m ." min " . $s ." sec" ; - } - else - { - $dt = $s ." sec" ; - } - } - - $pdf->SetXY(110, $Y); - $pdf->MultiCell(50, $line_height,$dt, 0,'R',$var); - - $pdf->SetXY(160, $Y); - $pdf->MultiCell(20, $line_height,$obj->cc, 0,'R',$var); - - $pdf->SetXY(180, $Y); - $pdf->MultiCell(20, $line_height,sprintf("%01.3f",$obj->cout_vente), 0,'R',$var); - - array_push($graph_values, $obj->cc); - array_push($graph_values_duree, $obj->duree); - array_push($graph_labels, $obj->dest); - - $total_duree = $total_duree + $obj->duree; - $total_nb = $total_nb + $obj->cc; - $total_cout = $total_cout + $obj->cout_vente; - - $i++; - } - } - else - { - dol_syslog("Erreur SQl"); - dol_syslog($this->db->error()); - } - - $h = floor($total_duree / 3600); - $m = floor(($total_duree - ($h * 3600)) / 60); - $s = ($total_duree - ( ($h * 3600 ) + ($m * 60) ) ); - - if ($h > 0) - { - $dt = $h . " h " . $m ." min " . $s ." sec" ; - } - else - { - if ($m > 0) - { - $dt = $m ." min " . $s ." sec" ; - } - else - { - $dt = $s ." sec" ; - } - } - - $var=!$var; - - $pdf->SetXY(10, $Y + $line_height); - $pdf->MultiCell(100, $line_height,"Total : ", 0,'R',$var); - - $pdf->SetXY(110, $Y + $line_height); - $pdf->MultiCell(50, $line_height,$dt, 0,'R',$var); - - $pdf->SetXY(160, $Y + $line_height); - $pdf->MultiCell(20, $line_height,$total_nb, 0,'R',$var); - - $pdf->SetXY(180, $Y + $line_height); - $pdf->MultiCell(20, $line_height,sprintf("%01.3f",$total_cout), 0,'R',$var); - - - /* - * Appels les plus important - * - */ - - $pdf->SetFont('Arial','', 12); - - $Y = $pdf->GetY() + 10; - $pdf->SetXY(10, $Y); - $pdf->MultiCell(100, 4, "TOP 10 des numéros appelés en coût", 0,'L',0); - - $pdf->SetFont('Arial','', 9); - - $Y = $pdf->GetY(); - $pdf->SetXY(10, $Y); - $pdf->MultiCell(150, 4, "Destination", 0,'L',0); - - $pdf->SetXY(140, $Y); - $pdf->MultiCell(20, 4, "Durée", 0,'R',0); - - $pdf->SetXY(160, $Y); - $pdf->MultiCell(20, 4, "Nb appels", 0,'R',0); - - $pdf->SetXY(180, $Y); - $pdf->MultiCell(20, 4, "Coût", 0,'R',0); - - $sql = "SELECT count(*) as cc, sum(t.cout_vente) as cout_vente, sum(t.duree) as duree, t.numero, t.dest"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details as t "; - $sql .= " WHERE fk_telephonie_facture =".$factel->id; - $sql .= " GROUP BY t.numero"; - $sql .= " ORDER BY cout_vente DESC"; - $sql .= " LIMIT 10"; - - if ( $this->db->query($sql) ) - { - $num = $this->db->num_rows(); - - $pdf->SetFont('Arial','', 9); - - $i = 0; - $var = 0; - $line_height = 4; - - while ($i < $num) - { - $obj = $this->db->fetch_object($i); - $var=!$var; - - $Y = $pdf->GetY(); - - $pdf->SetXY(10, $Y); - $pdf->MultiCell(80, $line_height, $obj->dest, 0,'L',$var); - - if ($Y > $pdf->GetY()) - $Y = $pdf->GetY() - $line_height; - - $pdf->SetXY(90, $Y); - $pdf->MultiCell(30, $line_height, $obj->numero, 0,'L',$var); - - $h = floor($obj->duree / 3600); - $m = floor(($obj->duree - ($h * 3600)) / 60); - $s = ($obj->duree - ( ($h * 3600 ) + ($m * 60) ) ); - - if ($h > 0) - { - $dt = $h . " h " . $m ." min " . $s ." sec" ; - } - else - { - if ($m > 0) - { - $dt = $m ." min " . $s ." sec" ; - } - else - { - $dt = $s ." sec" ; - } - } - - $pdf->SetXY(120, $Y); - $pdf->MultiCell(40, $line_height,$dt, 0,'R',$var); - - $pdf->SetXY(160, $Y); - $pdf->MultiCell(20, $line_height,$obj->cc, 0,'R',$var); - - $pdf->SetXY(180, $Y); - $pdf->MultiCell(20, $line_height,sprintf("%01.3f",$obj->cout_vente), 0,'R',$var); - - $i++; - } - } - /* - * - * - */ - include_once ("/usr/share/jpgraph/jpgraph.php"); - include_once ("/usr/share/jpgraph/jpgraph_pie.php"); - - $graph = new PieGraph(450,200,"auto"); - $graph->img->SetImgFormat("jpeg"); - $graph->SetFrame(false); - - // Setup title - $graph->title->Set("Répartition des destinations en nombre d'appel"); - $graph->title->SetFont(FF_FONT1,FS_BOLD); - - $p1 = new PiePlot($graph_values); - $p1->SetCenter(0.25,0.5); - - // Label font and color setup - $p1->SetFont(FF_FONT1,FS_BOLD); - $p1->SetFontColor("darkred"); - $p1->SetSize(0.3); - $p1->SetLegends($graph_labels); - $graph->legend->Pos(0.05,0.15); - - $graph->Add($p1); - - $file_graph = "/tmp/graph".$factel->ligne.".jpg"; - - $handle = $graph->Stroke($file_graph); - - $pdf->Image($file_graph, 11, ($pdf->GetY() + 10), 0, 0, 'JPG'); - - /* - * - */ - if ($output == 0) - { - $pdf->Close(); - $pdf->Output($file); - dol_syslog("Write $file"); - } - $this->filename = $file; - - - if(file_exists($file_graph)) - { - unlink($file_graph); - } - - if ($output == 0) - { - /* Génération du tableur */ - $xlsdet = new xlsdetail_nodet($this->db); - $xlsdet->GenerateFile($objlignetel, $fac, $factel); - } - return 0; - } - else - { - $this->error="Erreur: Le répertoire '$dir' n'existe pas et Dolibarr n'a pu le créer."; - return -1; - } - } - else - { - $this->error="Erreur: FAC_OUTPUTDIR non défini !"; - return -2; - } - } - - - - - /* - * Header - */ - - function Header(&$pdf, $output) - { - $pdf->SetXY(10,5); - - // 400x186 - - $logo_file = DOL_DOCUMENT_ROOT."/../documents/logo.jpg"; - - if (file_exists($logo_file)) - { - $pdf->Image($logo_file, 10, 5, 60, 27.9, 'JPG'); - } - - $pdf->SetTextColor(0,90,200); - $pdf->SetFont('Arial','',10); - $pdf->SetXY(11,31); - $pdf->MultiCell(89, 4, "Facture détaillée : ".$pdf->fac->ref); - - $pdf->SetX(11); - $pdf->MultiCell(89, 4, "Ligne : " . $pdf->ligne); - - $pdf->SetX(11); - - $libelle = "Du ".strftime("%d/%m/%Y",$pdf->factel->get_comm_min_date($pdf->year.$pdf->month)); - $libelle .= " au ".strftime("%d/%m/%Y",$pdf->factel->get_comm_max_date($pdf->year.$pdf->month)); - $pdf->MultiCell(89, 4, $libelle, 0); - - $pdf->SetX(11); - if ($output == 0) - { - $pdf->MultiCell(80, 4, "Page : ". $pdf->PageNo() ."/{nb}", 0); - } - - // Clients spéciaux - - if ($pdf->ligne_ville) - { - $pdf->SetX(11); - $pdf->MultiCell(80, 4, "Agence : ". $pdf->ligne_ville, 0); - } - - $pdf->rect(10, 30, 95, 23); - - $pdf->SetTextColor(0,0,0); - $pdf->SetFont('Arial','',10); - - $pdf->SetXY(107, 31); - - $pdf->MultiCell(66,4, $pdf->client_nom); - - $pdf->SetX(107); - $pdf->MultiCell(86,4, $pdf->client_adresse . "\n" . $pdf->client_cp . " " . $pdf->client_ville); - - $pdf->rect(105, 30, 95, 23); - - /* - * On positionne le curseur pour la liste - */ - $pdf->SetXY(10,$pdf->tab_top + 6); - $pdf->colonne = 1; - $pdf->inc = 0; - } - - /* - * Footer - */ - - function Footer(&$pdf) - { - - if ($pdf->FirstPage == 1) - { - $pdf->FirstPage = 0; - } - else - { - - $pdf->SetFont('Arial','',8); - - $pdf->Text(11, $pdf->tab_top + 3,'Date'); - $pdf->Text(106, $pdf->tab_top + 3,'Date'); - - $w = 33; - - $pdf->Text($w+1, $pdf->tab_top + 3,'Numéro'); - $pdf->Text($w+96, $pdf->tab_top + 3,'Numéro'); - - $w = 47; - - $pdf->Text($w+1, $pdf->tab_top + 3,'Destination'); - $pdf->Text($w+96, $pdf->tab_top + 3,'Destination'); - - $w = 86; - - $pdf->Text($w+1, $pdf->tab_top + 3,'Durée'); - $pdf->Text($w+96, $pdf->tab_top + 3,'Durée'); - - $w = 98; - - $pdf->Text($w+1, $pdf->tab_top + 3,'HT'); - $pdf->Text($w+96, $pdf->tab_top + 3,'HT'); - - $pdf->line(10, $pdf->tab_top + 4, 200, $pdf->tab_top + 4 ); - - /* Ligne Médiane */ - - $pdf->line(105, $pdf->tab_top, 105, $pdf->tab_top + $pdf->tab_height); - - } - - $pdf->Rect(10, $pdf->tab_top, 190, $pdf->tab_height); - - } - - - - - - - - -} -?> diff --git a/htdocs/telephonie/pdf/pdfdetail_papier.modules.php b/htdocs/telephonie/pdf/pdfdetail_papier.modules.php deleted file mode 100644 index d16c067e66f..00000000000 --- a/htdocs/telephonie/pdf/pdfdetail_papier.modules.php +++ /dev/null @@ -1,444 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * or see http://www.gnu.org/ - * - * $Id$ - * $Source$ - * - * Génère un PDF de la première page de résumé et un tableur des communications - */ -require_once DOL_DOCUMENT_ROOT."/facture.class.php"; -require_once DOL_DOCUMENT_ROOT."/telephonie/facturetel.class.php"; -require_once DOL_DOCUMENT_ROOT."/telephonie/pdf/pdfdetail_standard.modeles.php"; -require_once DOL_DOCUMENT_ROOT."/telephonie/pdf/xlsdetail_nodet.modules.php"; - -class pdfdetail_papier { - - function pdfdetail_papier ($db=0, $ligne, $year, $month, $factel) - { - $this->db = $db; - $this->description = "Modèle de facture détaillée sans les communications"; - $this->ligne = $ligne; - $this->year = $year; - $this->month = $month; - $this->factel = $factel; - $this->pages = 0; - } - - /* - * - * - */ - function write_pdf_file($factel, $ligne) - { - $xpdf = 0; - $this->_write_pdf_file($factel, $ligne, $xpdf, 0); - } - - function _write_pdf_file($factel, $ligne, &$pdf, $output) - { - $fac = new Facture($this->db,"",$factel->fk_facture); - $fac->fetch($factel->fk_facture); - $fac->fetch_client(); - - $objlignetel = new LigneTel($this->db); - - $result = $objlignetel->fetch($ligne); - - if (defined("FAC_OUTPUTDIR")) - { - $dir = FAC_OUTPUTDIR . "/" . $fac->ref . "/" ; - $file = $dir . $fac->ref . "-$ligne-detail.pdf"; - - if (strlen($objlignetel->code_analytique) > 0) - { - $file = $dir . $fac->ref . "-$ligne-$objlignetel->code_analytique-detail.pdf"; - } - - if (! file_exists($dir)) - { - umask(0); - if (! mkdir($dir, 0755)) - { - $this->error="Erreur: Le répertoire '$dir' n'existe pas et Dolibarr n'a pu le créer."; - return 0; - } - } - - if (file_exists($dir) OR $output) - { - if ($output == 0) - { - $pdf = new pdfdetail_standard_modeles('P','mm','A4'); - } - - $pdf->fac = $fac; - $pdf->factel = $factel; - - $pdf->client_nom = $fac->client->nom; - $pdf->client_adresse = $fac->client->adresse; - $pdf->client_cp = $fac->client->cp; - $pdf->client_ville = $fac->client->ville; - - $pdf->ligne = $ligne; - $pdf->year = $this->year; - $pdf->month = $this->month; - - $pdf->ligne_ville = ''; - if ($objlignetel->code_analytique) - { - $soca = new Societe($this->db); - $soca->fetch($objlignetel->client_id); - - $pdf->ligne = $ligne . " (".$objlignetel->code_analytique.")"; - $pdf->ligne_ville = $soca->ville; - } - - $pdf->SetAutoPageBreak(0, 24); - $pdf->SetLineWidth(0.1); - $pdf->tab_top = 20; - $pdf->tab_height = 222; - $pdf->FirstPage = 1; - /* - * Libelle - */ - - $pdf->libelle = "Du ".strftime("%d/%m/%Y",$factel->get_comm_min_date($this->year.$this->month)); - $pdf->libelle .= " au ".strftime("%d/%m/%Y",$factel->get_comm_max_date($this->year.$this->month)); - - - /* - * Liste des appels - * - */ - $sql = "SELECT t.ligne, ".$this->db->pdate("t.date")." as pdate"; - $sql .= " , t.numero, t.dest, t.duree, t.cout_vente"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details as t "; - $sql .= " WHERE fk_telephonie_facture =".$factel->id; - $sql .= " ORDER BY t.date ASC"; - - $resql = $this->db->query($sql) ; - - if ( $resql ) - { - $num = $this->db->num_rows($resql); - - $pdf->AddPage(); - $this->pages++; - $this->ListHeader($pdf); - $i = 0; - $var = 1; - $line_height = 2; - $this->colonne = 1; - - while ($i < $num) - { - $obj = $this->db->fetch_object($resql); - $Y = $pdf->GetY(); - - if ($this->inc > 132 && $this->colonne == 1) - { - $col = 50; - $Y = $pdf->tab_top + 6; - //$this->inc = 0; - $this->colonne = 2; - $old_dest=''; - $old_date=''; - } - - if ($this->inc > 265 && $this->colonne == 2) - { - $col = 100; - $Y = $pdf->tab_top + 6; - //$this->inc = 0; - $this->colonne = 3; - $old_dest=''; - $old_date=''; - } - - if ($this->inc > 398 && $this->colonne == 3) - { - $col = 150; - $Y = $pdf->tab_top + 6; - //$this->inc = 0; - $this->colonne = 4; - $old_dest=''; - $old_date=''; - } - - if ($this->inc > 531 && $this->colonne == 4) - { - $pdf->AddPage(); - $this->pages++; - $this->ListHeader($pdf); - $var = 0; - $col = 0; - $Y = $pdf->tab_top + 6; - $this->inc = 0; - $old_dest=''; - $old_date=''; - $this->colonne = 1; - } - - $var=!$var; - - $pdf->SetFont('Arial','', 6); - $pdf->SetXY (5 + $col, $Y); - - if ($old_date == strftime("%d/%m/%Y", $obj->pdate)) - { - $date = ""; - } - else - { - $old_date = strftime("%d/%m/%Y", $obj->pdate) ; - $date = strftime("%d",$obj->pdate); - } - - $pdf->MultiCell(5, $line_height, $date, 0,'L',$var); - - if ($Y > $pdf->GetY()) - $Y = $pdf->GetY() - $line_height; - - $pdf->SetXY (9 + $col, $Y); - $heure = strftime("%H%M%S",$obj->pdate); - $pdf->MultiCell(10, $line_height, $heure, 0,'L',$var); - - $pdf->SetXY (18 + $col, $Y); - $numero = ereg_replace("^00","",$obj->numero); - $numero = ereg_replace("^0","",$obj->numero); - $pdf->MultiCell(15, $line_height, $numero, 0,'L',$var); - - $pdf->SetXY (32 + $col, $Y); - - if ($obj->dest == $old_dest) - { - $dest = ' "'; - } - else - { - $old_dest = $obj->dest ; - $dest = $obj->dest; - } - - $xs = explode(" ",$dest); - if (sizeof($xs) == 1) - $small_dest = substr($xs[0],0,4); - - if (sizeof($xs) == 2) - $small_dest = substr($xs[0],0,2).substr($xs[1],0,2); - - if (sizeof($xs) == 3) - $small_dest = substr($xs[0],0,2).substr($xs[1],0,1).substr($xs[2],0,1); - - if (sizeof($xs) == 4) - $small_dest = substr($xs[0],0,1).substr($xs[1],0,1).substr($xs[2],0,1).substr($xs[3],0,1); - - if ($dest == ' "') - $small_dest == ' "'; - - - $pdf->MultiCell(9, $line_height, $small_dest, 0, 'L',$var); - - $pdf->SetXY (39 + $col, $Y); - $pdf->MultiCell(8, $line_height, $obj->duree, 0, 'R',$var); - - $pdf->SetXY (46 + $col, $Y); - $pdf->MultiCell(9, $line_height, sprintf("%01.3f", $obj->cout_vente), 0,'R',$var); - - $i++; - $this->inc++; - } - } - else - { - dol_syslog("Erreur lecture des communications"); - } - - /* - * - */ - - - return 0; - } - else - { - $this->error="Erreur: Le répertoire '$dir' n'existe pas et Dolibarr n'a pu le créer."; - return -1; - } - } - else - { - $this->error="Erreur: FAC_OUTPUTDIR non défini !"; - return -2; - } - } - - /* - * Header - */ - - function Header(&$pdf, $output) - { - $pdf->SetXY(10,5); - $pdf->SetTextColor(0,90,200); - $pdf->SetFont('Arial','',10); - $pdf->SetXY(11,31); - $pdf->MultiCell(89, 4, "Facture détaillée : ".$pdf->fac->ref); - - $pdf->SetX(11); - $pdf->MultiCell(89, 4, "Ligne : " . $pdf->ligne); - - $pdf->SetX(11); - $pdf->MultiCell(89, 4, $pdf->libelle, 0); - - $pdf->SetX(11); - if ($output == 0) - { - $pdf->MultiCell(80, 4, "Page : ". $pdf->PageNo() ."/{nb}", 0); - } - - // Clients spéciaux - - if ($pdf->ligne_ville) - { - $pdf->SetX(11); - $pdf->MultiCell(80, 4, "Agence : ". $pdf->ligne_ville, 0); - } - - $pdf->rect(5, 30, 100, 23); - - $pdf->SetTextColor(0,0,0); - $pdf->SetFont('Arial','',10); - - $pdf->SetXY(107, 31); - - $pdf->MultiCell(66,4, $pdf->client_nom); - - $pdf->SetX(107); - $pdf->MultiCell(86,4, $pdf->client_adresse . "\n" . $pdf->client_cp . " " . $pdf->client_ville); - - $pdf->rect(105, 30, 100, 23); - - /* - * On positionne le curseur pour la liste - */ - $pdf->SetXY(10,$pdf->tab_top + 6); - $pdf->colonne = 1; - $pdf->inc = 0; - } - - /* - * Footer - */ - - function Footer(&$pdf) - { - - if ($pdf->FirstPage == 1) - { - $pdf->FirstPage = 0; - } - else - { - - $pdf->SetFont('Arial','',8); - - $pdf->Text(11, $pdf->tab_top + 3,'Date'); - $pdf->Text(106, $pdf->tab_top + 3,'Date'); - - $w = 33; - - $pdf->Text($w+1, $pdf->tab_top + 3,'Numéro'); - $pdf->Text($w+96, $pdf->tab_top + 3,'Numéro'); - - $w = 47; - - $pdf->Text($w+1, $pdf->tab_top + 3,'Destination'); - $pdf->Text($w+96, $pdf->tab_top + 3,'Destination'); - - $w = 86; - - $pdf->Text($w+1, $pdf->tab_top + 3,'Durée'); - $pdf->Text($w+96, $pdf->tab_top + 3,'Durée'); - - $w = 98; - - $pdf->Text($w+1, $pdf->tab_top + 3,'HT'); - $pdf->Text($w+96, $pdf->tab_top + 3,'HT'); - - $pdf->line(10, $pdf->tab_top + 4, 200, $pdf->tab_top + 4 ); - - /* Ligne Médiane */ - - $pdf->line(105, $pdf->tab_top, 105, $pdf->tab_top + $pdf->tab_height); - - } - - $pdf->Rect(10, $pdf->tab_top, 190, $pdf->tab_height); - } - - function ListHeader(&$pdf) - { - $pdf->SetXY(10,5); - //$pdf->SetTextColor(0,90,200); - $pdf->SetFont('Arial','',10); - $pdf->SetXY(6,5); - $pdf->MultiCell(89, 4, "Facture détaillée : ".$pdf->fac->ref); - - $pdf->SetX(6); - $pdf->MultiCell(89, 4, "Ligne : " . $pdf->ligne); - $pdf->SetX(6); - - $libelle = "Du ".strftime("%d/%m/%Y",$pdf->factel->get_comm_min_date($this->year.$this->month)); - $libelle .= " au ".strftime("%d/%m/%Y",$pdf->factel->get_comm_max_date($this->year.$this->month)); - $pdf->MultiCell(89, 4, $libelle, 0); - - //$pdf->SetX(6); - //$pdf->MultiCell(80, 4, "Page : ". $pdf->PageNo() ."/{nb}", 0); - // Clients spéciaux - - if ($pdf->ligne_ville) - { - $pdf->SetX(6); - $pdf->MultiCell(80, 4, "Agence : ". $pdf->ligne_ville, 0); - } - - $pdf->rect(5, 4, 100, 19); - $pdf->SetTextColor(0,0,0); - $pdf->SetFont('Arial','',10); - - $pdf->SetXY(107, 5); - - $pdf->MultiCell(66,4, $pdf->client_nom); - - $pdf->SetX(107); - $pdf->MultiCell(86,4, $pdf->client_adresse . "\n" . $pdf->client_cp . " " . $pdf->client_ville); - - $pdf->rect(105, 4, 100, 19); - - /* - * On positionne le curseur pour la liste - */ - $pdf->SetXY(10,$pdf->tab_top + 6); - $pdf->colonne = 1; - $pdf->inc = 0; - } - -} -?> diff --git a/htdocs/telephonie/pdf/pdfdetail_papier1.modules.php b/htdocs/telephonie/pdf/pdfdetail_papier1.modules.php deleted file mode 100644 index cd817d5d5ad..00000000000 --- a/htdocs/telephonie/pdf/pdfdetail_papier1.modules.php +++ /dev/null @@ -1,411 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * or see http://www.gnu.org/ - * - * $Id$ - * $Source$ - * - * Génère un PDF de la première page de résumé et un tableur des communications - * - * Version avant reduction - * - */ -require_once DOL_DOCUMENT_ROOT."/facture.class.php"; -require_once DOL_DOCUMENT_ROOT."/telephonie/facturetel.class.php"; -require_once DOL_DOCUMENT_ROOT."/telephonie/pdf/pdfdetail_standard.modeles.php"; -require_once DOL_DOCUMENT_ROOT."/telephonie/pdf/xlsdetail_nodet.modules.php"; - - -class pdfdetail_papier { - - function pdfdetail_papier ($db=0, $ligne, $year, $month, $factel) - { - $this->db = $db; - $this->description = "Modèle de facture détaillée sans les communications"; - $this->ligne = $ligne; - $this->year = $year; - $this->month = $month; - $this->factel = $factel; - $this->pages = 0; - } - - /* - * - * - */ - function write_pdf_file($factel, $ligne) - { - $xpdf = 0; - $this->_write_pdf_file($factel, $ligne, $xpdf, 0); - } - - function _write_pdf_file($factel, $ligne, &$pdf, $output) - { - $fac = new Facture($this->db,"",$factel->fk_facture); - $fac->fetch($factel->fk_facture); - $fac->fetch_client(); - - $objlignetel = new LigneTel($this->db); - - $result = $objlignetel->fetch($ligne); - - if (defined("FAC_OUTPUTDIR")) - { - $dir = FAC_OUTPUTDIR . "/" . $fac->ref . "/" ; - $file = $dir . $fac->ref . "-$ligne-detail.pdf"; - - if (strlen($objlignetel->code_analytique) > 0) - { - $file = $dir . $fac->ref . "-$ligne-$objlignetel->code_analytique-detail.pdf"; - } - - if (! file_exists($dir)) - { - umask(0); - if (! mkdir($dir, 0755)) - { - $this->error="Erreur: Le répertoire '$dir' n'existe pas et Dolibarr n'a pu le créer."; - return 0; - } - } - - if (file_exists($dir) OR $output) - { - if ($output == 0) - { - $pdf = new pdfdetail_standard_modeles('P','mm','A4'); - } - - $pdf->fac = $fac; - $pdf->factel = $factel; - - $pdf->client_nom = $fac->client->nom; - $pdf->client_adresse = $fac->client->adresse; - $pdf->client_cp = $fac->client->cp; - $pdf->client_ville = $fac->client->ville; - - $pdf->ligne = $ligne; - $pdf->year = $this->year; - $pdf->month = $this->month; - - $pdf->ligne_ville = ''; - if ($objlignetel->code_analytique) - { - $soca = new Societe($this->db); - $soca->fetch($objlignetel->client_id); - - $pdf->ligne = $ligne . " (".$objlignetel->code_analytique.")"; - $pdf->ligne_ville = $soca->ville; - } - - $pdf->SetAutoPageBreak(0, 24); - $pdf->SetLineWidth(0.1); - $pdf->tab_top = 20; - $pdf->tab_height = 222; - $pdf->FirstPage = 1; - /* - * Libelle - */ - - $pdf->libelle = "Du ".strftime("%d/%m/%Y",$factel->get_comm_min_date($this->year.$this->month)); - $pdf->libelle .= " au ".strftime("%d/%m/%Y",$factel->get_comm_max_date($this->year.$this->month)); - - - /* - * Liste des appels - * - */ - $sql = "SELECT t.ligne, ".$this->db->pdate("t.date")." as pdate"; - $sql .= " , t.numero, t.dest, t.duree, t.cout_vente"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details as t "; - $sql .= " WHERE fk_telephonie_facture =".$factel->id; - $sql .= " ORDER BY t.date ASC"; - - $resql = $this->db->query($sql) ; - - if ( $resql ) - { - $num = $this->db->num_rows($resql); - - $pdf->AddPage(); - $this->pages++; - $this->ListHeader($pdf); - $i = 0; - $var = 1; - $line_height = 2; - $this->colonne = 1; - - while ($i < $num) - { - $obj = $this->db->fetch_object($resql); - $Y = $pdf->GetY(); - - if ($this->inc > 130 && $this->colonne == 1) - { - $col = 95; - $Y = $pdf->tab_top + 6; - $this->inc = 0; - $this->colonne = 2; - $old_dest=''; - $old_date=''; - } - - if ($this->inc > 130 && $this->colonne == 2) - { - $pdf->AddPage(); - $this->pages++; - $this->ListHeader($pdf); - $var = 0; - $col = 0; - $Y = $pdf->tab_top + 6; - $this->inc = 0; - $old_dest=''; - $old_date=''; - $this->colonne = 1; - } - - $var=!$var; - - $pdf->SetFont('Arial','', 6); - - $pdf->SetXY (10 + $col, $Y); - - if ($old_date == strftime("%d/%m/%Y", $obj->pdate)) - { - $date = ""; - } - else - { - $old_date = strftime("%d/%m/%Y", $obj->pdate) ; - $date = strftime("%d/%m/%y",$obj->pdate); - } - - $pdf->MultiCell(11, $line_height, $date, 0,'L',$var); - - if ($Y > $pdf->GetY()) - $Y = $pdf->GetY() - $line_height; - - $pdf->SetXY (21 + $col, $Y); - $heure = strftime("%H:%M:%S",$obj->pdate); - $pdf->MultiCell(11, $line_height, $heure, 0,'L',$var); - - $pdf->SetXY (32 + $col, $Y); - $numero = ereg_replace("^00","",$obj->numero); - $pdf->MultiCell(17, $line_height, $numero, 0,'L',$var); - - $pdf->SetXY (48 + $col, $Y); - - if ($obj->dest == $old_dest) - { - $dest = ' "'; - } - else - { - $old_dest = $obj->dest ; - $dest = $obj->dest; - } - - $pdf->MultiCell(37, $line_height, $dest, 0, 'L',$var); - - $pdf->SetXY (85 + $col, $Y); - $pdf->MultiCell(10, $line_height, $obj->duree, 0, 'R',$var); - - $pdf->SetXY (95 + $col, $Y); - $pdf->MultiCell(10, $line_height, sprintf("%01.3f", $obj->cout_vente), 0,'R',$var); - - $i++; - $this->inc++; - } - } - else - { - dol_syslog("Erreur lecture des communications"); - } - - /* - * - */ - - - return 0; - } - else - { - $this->error="Erreur: Le répertoire '$dir' n'existe pas et Dolibarr n'a pu le créer."; - return -1; - } - } - else - { - $this->error="Erreur: FAC_OUTPUTDIR non défini !"; - return -2; - } - } - - /* - * Header - */ - - function Header(&$pdf, $output) - { - $pdf->SetXY(10,5); - $pdf->SetTextColor(0,90,200); - $pdf->SetFont('Arial','',10); - $pdf->SetXY(11,31); - $pdf->MultiCell(89, 4, "Facture détaillée : ".$pdf->fac->ref); - - $pdf->SetX(11); - $pdf->MultiCell(89, 4, "Ligne : " . $pdf->ligne); - - $pdf->SetX(11); - $pdf->MultiCell(89, 4, $pdf->libelle, 0); - - $pdf->SetX(11); - if ($output == 0) - { - $pdf->MultiCell(80, 4, "Page : ". $pdf->PageNo() ."/{nb}", 0); - } - - // Clients spéciaux - - if ($pdf->ligne_ville) - { - $pdf->SetX(11); - $pdf->MultiCell(80, 4, "Agence : ". $pdf->ligne_ville, 0); - } - - $pdf->rect(10, 30, 95, 23); - - $pdf->SetTextColor(0,0,0); - $pdf->SetFont('Arial','',10); - - $pdf->SetXY(107, 31); - - $pdf->MultiCell(66,4, $pdf->client_nom); - - $pdf->SetX(107); - $pdf->MultiCell(86,4, $pdf->client_adresse . "\n" . $pdf->client_cp . " " . $pdf->client_ville); - - $pdf->rect(105, 30, 95, 23); - - /* - * On positionne le curseur pour la liste - */ - $pdf->SetXY(10,$pdf->tab_top + 6); - $pdf->colonne = 1; - $pdf->inc = 0; - } - - /* - * Footer - */ - - function Footer(&$pdf) - { - - if ($pdf->FirstPage == 1) - { - $pdf->FirstPage = 0; - } - else - { - - $pdf->SetFont('Arial','',8); - - $pdf->Text(11, $pdf->tab_top + 3,'Date'); - $pdf->Text(106, $pdf->tab_top + 3,'Date'); - - $w = 33; - - $pdf->Text($w+1, $pdf->tab_top + 3,'Numéro'); - $pdf->Text($w+96, $pdf->tab_top + 3,'Numéro'); - - $w = 47; - - $pdf->Text($w+1, $pdf->tab_top + 3,'Destination'); - $pdf->Text($w+96, $pdf->tab_top + 3,'Destination'); - - $w = 86; - - $pdf->Text($w+1, $pdf->tab_top + 3,'Durée'); - $pdf->Text($w+96, $pdf->tab_top + 3,'Durée'); - - $w = 98; - - $pdf->Text($w+1, $pdf->tab_top + 3,'HT'); - $pdf->Text($w+96, $pdf->tab_top + 3,'HT'); - - $pdf->line(10, $pdf->tab_top + 4, 200, $pdf->tab_top + 4 ); - - /* Ligne Médiane */ - - $pdf->line(105, $pdf->tab_top, 105, $pdf->tab_top + $pdf->tab_height); - - } - - $pdf->Rect(10, $pdf->tab_top, 190, $pdf->tab_height); - } - - function ListHeader(&$pdf) - { - $pdf->SetXY(10,5); - //$pdf->SetTextColor(0,90,200); - $pdf->SetFont('Arial','',10); - $pdf->SetXY(11,5); - $pdf->MultiCell(89, 4, "Facture détaillée : ".$pdf->fac->ref); - - $pdf->SetX(11); - $pdf->MultiCell(89, 4, "Ligne : " . $pdf->ligne); - $pdf->SetX(11); - - $libelle = "Du ".strftime("%d/%m/%Y",$pdf->factel->get_comm_min_date($this->year.$this->month)); - $libelle .= " au ".strftime("%d/%m/%Y",$pdf->factel->get_comm_max_date($this->year.$this->month)); - $pdf->MultiCell(89, 4, $libelle, 0); - - //$pdf->SetX(11); - //$pdf->MultiCell(80, 4, "Page : ". $pdf->PageNo() ."/{nb}", 0); - // Clients spéciaux - - if ($pdf->ligne_ville) - { - $pdf->SetX(11); - $pdf->MultiCell(80, 4, "Agence : ". $pdf->ligne_ville, 0); - } - - $pdf->rect(10, 4, 95, 19); - $pdf->SetTextColor(0,0,0); - $pdf->SetFont('Arial','',10); - - $pdf->SetXY(107, 5); - - $pdf->MultiCell(66,4, $pdf->client_nom); - - $pdf->SetX(107); - $pdf->MultiCell(86,4, $pdf->client_adresse . "\n" . $pdf->client_cp . " " . $pdf->client_ville); - - $pdf->rect(105, 4, 95, 19); - - /* - * On positionne le curseur pour la liste - */ - $pdf->SetXY(10,$pdf->tab_top + 6); - $pdf->colonne = 1; - $pdf->inc = 0; - } - -} -?> diff --git a/htdocs/telephonie/pdf/pdfdetail_standard.modeles.php b/htdocs/telephonie/pdf/pdfdetail_standard.modeles.php deleted file mode 100644 index 0068388e06c..00000000000 --- a/htdocs/telephonie/pdf/pdfdetail_standard.modeles.php +++ /dev/null @@ -1,153 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * or see http://www.gnu.org/ - * - * $Id$ - * $Source$ - * - */ - -/*! - \file htdocs/telephonie/pdf/pdfdetail_standard_modeles.pdf - \ingroup telephonie - \brief Fichier de modèle pdf pour les factures détaillées - \version $Revision$ -*/ - -require_once(FPDF_PATH . "fpdf.php"); -require_once(FPDFI_PATH . "fpdi_protection.php"); - -class pdfdetail_standard_modeles extends FPDF { - - var $client_nom; - - /* - * Header - */ - - function Header() - { - $this->SetXY(10,5); - - // 400x186 - - $logo_file = DOL_DOCUMENT_ROOT."/../documents/logo.jpg"; - - if (file_exists($logo_file)) - { - $this->Image($logo_file, 10, 5, 60, 27.9, 'JPG'); - } - - $this->SetTextColor(0,90,200); - $this->SetFont('Arial','',10); - $this->SetXY(11,31); - $this->MultiCell(89, 4, "Facture détaillée : ".$this->fac->ref); - - $this->SetX(11); - $this->MultiCell(89, 4, "Ligne : " . $this->ligne); - - $this->SetX(11); - - $libelle = "Du ".strftime("%d/%m/%Y",$this->factel->get_comm_min_date($this->year.$this->month)); - $libelle .= " au ".strftime("%d/%m/%Y",$this->factel->get_comm_max_date($this->year.$this->month)); - $this->MultiCell(89, 4, $libelle, 0); - - $this->SetX(11); - $this->MultiCell(80, 4, "Page : ". $this->PageNo() ."/{nb}", 0); - - // Clients spéciaux - - if ($this->ligne_ville) - { - $this->SetX(11); - $this->MultiCell(80, 4, "Agence : ". $this->ligne_ville, 0); - } - - $this->rect(10, 30, 95, 23); - - $this->SetTextColor(0,0,0); - $this->SetFont('Arial','',10); - - $this->SetXY(107, 31); - - $this->MultiCell(66,4, $this->client_nom); - - $this->SetX(107); - $this->MultiCell(86,4, $this->client_adresse . "\n" . $this->client_cp . " " . $this->client_ville); - - $this->rect(105, 30, 95, 23); - - /* - * On positionne le curseur pour la liste - */ - $this->SetXY(10,$this->tab_top + 6); - $this->colonne = 1; - $this->inc = 0; - } - - /* - * Footer - */ - - function Footer() - { - - if ($this->FirstPage == 1) - { - $this->FirstPage = 0; - } - else - { - - $this->SetFont('Arial','',8); - - $this->Text(11, $this->tab_top + 3,'Date'); - $this->Text(106, $this->tab_top + 3,'Date'); - - $w = 33; - - $this->Text($w+1, $this->tab_top + 3,'Numéro'); - $this->Text($w+96, $this->tab_top + 3,'Numéro'); - - $w = 47; - - $this->Text($w+1, $this->tab_top + 3,'Destination'); - $this->Text($w+96, $this->tab_top + 3,'Destination'); - - $w = 86; - - $this->Text($w+1, $this->tab_top + 3,'Durée'); - $this->Text($w+96, $this->tab_top + 3,'Durée'); - - $w = 98; - - $this->Text($w+1, $this->tab_top + 3,'HT'); - $this->Text($w+96, $this->tab_top + 3,'HT'); - - $this->line(10, $this->tab_top + 4, 200, $this->tab_top + 4 ); - - /* Ligne Médiane */ - - $this->line(105, $this->tab_top, 105, $this->tab_top + $this->tab_height); - - } - - $this->Rect(10, $this->tab_top, 190, $this->tab_height); - - } -} -?> diff --git a/htdocs/telephonie/pdf/pdfdetail_standard.modules.php b/htdocs/telephonie/pdf/pdfdetail_standard.modules.php deleted file mode 100644 index 964d06fc83a..00000000000 --- a/htdocs/telephonie/pdf/pdfdetail_standard.modules.php +++ /dev/null @@ -1,496 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * or see http://www.gnu.org/ - * - * $Id$ - * $Source$ - * - */ - -require_once DOL_DOCUMENT_ROOT."/facture.class.php"; -require_once DOL_DOCUMENT_ROOT."/telephonie/facturetel.class.php"; -require_once DOL_DOCUMENT_ROOT."/telephonie/pdf/pdfdetail_standard.modeles.php"; - -class pdfdetail_standard { - - function pdfdetail_standard ($db=0, $ligne, $year, $month, $factel) - { - $this->db = $db; - $this->description = "Modèle de facture détaillée standard"; - $this->ligne = $ligne; - $this->year = $year; - $this->month = $month; - $this->factel = $factel; - } - - /* - * - * - */ - - function write_pdf_file($factel, $ligne) - { - - $fac = new Facture($this->db,"",$factel->fk_facture); - $fac->fetch($factel->fk_facture); - $fac->fetch_client(); - - $objlignetel = new LigneTel($this->db); - $result = $objlignetel->fetch($ligne); - - if (defined("FAC_OUTPUTDIR")) - { - $dir = FAC_OUTPUTDIR . "/" . $fac->ref . "/" ; - $file = $dir . $fac->ref . "-$ligne-detail.pdf"; - - if (! file_exists($dir)) - { - umask(0); - if (! mkdir($dir, 0755)) - { - $this->error="Erreur: Le répertoire '$dir' n'existe pas et Dolibarr n'a pu le créer."; - return 0; - } - } - - if (file_exists($dir)) - { - - $this->pdf = new pdfdetail_standard_modeles('P','mm','A4'); - - $this->pdf->fac = $fac; - - $this->pdf->factel = $this->factel; - - $this->pdf->client_nom = $fac->client->nom; - $this->pdf->client_adresse = $fac->client->adresse; - $this->pdf->client_cp = $fac->client->cp; - $this->pdf->client_ville = $fac->client->ville; - - $this->pdf->ligne = $ligne; - - $this->pdf->year = $this->year; - $this->pdf->month = $this->month; - - $this->pdf->ligne_ville = ''; - if ($objlignetel->code_analytique) - { - $soca = new Societe($this->db); - $soca->fetch($objlignetel->client_id); - - $this->pdf->ligne = $ligne . " (".$objlignetel->code_analytique.")"; - $this->pdf->ligne_ville = $soca->ville; - } - - $this->pdf->AliasNbPages(); - $this->pdf->Open(); - - $this->pdf->SetTitle($fac->ref); - $this->pdf->SetSubject("Facture détaillée"); - $this->pdf->SetCreator("Dolibarr"); - $this->pdf->SetAuthor(""); - - $this->pdf->SetMargins(10, 10, 10); - - $this->pdf->SetAutoPageBreak(1, 24); - - $this->pdf->SetLineWidth(0.1); - - $this->pdf->tab_top = 53; - $this->pdf->tab_height = 222; - - /* - * - * - */ - - $this->pdf->FirstPage = 1; - $this->pdf->AddPage(); - - $this->pdf->SetFillColor(230,230,230); - - /* - * Détails des comm - * - */ - - $this->pdf->SetFont('Arial','', 12); - - $Y = $this->pdf->tab_top + 4; - $this->pdf->SetXY(10, $Y); - $this->pdf->MultiCell(100, 4, "Détails de vos communications", 0,'L',0); - - $this->pdf->SetFont('Arial','', 9); - - $Y = $this->pdf->GetY(); - $this->pdf->SetXY(10, $Y); - $this->pdf->MultiCell(150, 4, "10 Destinations les plus coûteuses", 0,'L',0); - - $this->pdf->SetXY(140, $Y); - $this->pdf->MultiCell(20, 4, "Durée", 0,'R',0); - - $this->pdf->SetXY(160, $Y); - $this->pdf->MultiCell(20, 4, "Nb appels", 0,'R',0); - - $this->pdf->SetXY(180, $Y); - $this->pdf->MultiCell(20, 4, "Coût", 0,'R',0); - - $sql = "SELECT count(*) as cc, sum(t.cout_vente) as cout_vente, sum(t.duree) as duree, t.dest"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details as t "; - $sql .= " WHERE t.fk_telephonie_facture =".$factel->id; - $sql .= " GROUP BY t.dest"; - $sql .= " ORDER BY cout_vente DESC"; - $sql .= " LIMIT 10"; - - $resql = $this->db->query($sql); - - if ( $resql ) - { - $num = $this->db->num_rows($resql); - $i = 0; - - $this->pdf->SetFont('Arial','', 9); - $var = 0; - $line_height = 4; - - $graph_values = array(); - $graph_values_duree = array(); - $graph_labels = array(); - - while ($i < $num) - { - $obj = $this->db->fetch_object($i); - $var=!$var; - - $Y = $this->pdf->GetY(); - - $this->pdf->SetXY(10, $Y); - $this->pdf->MultiCell(100, $line_height, $obj->dest, 0,'L',$var); - - if ($Y > $this->pdf->GetY()) - $Y = $this->pdf->GetY() - $line_height; - - - $h = floor($obj->duree / 3600); - $m = floor(($obj->duree - ($h * 3600)) / 60); - $s = ($obj->duree - ( ($h * 3600 ) + ($m * 60) ) ); - - if ($h > 0) - { - $dt = $h . " h " . $m ." min " . $s ." sec" ; - } - else - { - if ($m > 0) - { - $dt = $m ." min " . $s ." sec" ; - } - else - { - $dt = $s ." sec" ; - } - } - - $this->pdf->SetXY(110, $Y); - $this->pdf->MultiCell(50, $line_height,$dt, 0,'R',$var); - - $this->pdf->SetXY(160, $Y); - $this->pdf->MultiCell(20, $line_height,$obj->cc, 0,'R',$var); - - $this->pdf->SetXY(180, $Y); - $this->pdf->MultiCell(20, $line_height,sprintf("%01.3f",$obj->cout_vente), 0,'R',$var); - - array_push($graph_values, $obj->cc); - array_push($graph_values_duree, $obj->duree); - array_push($graph_labels, $obj->dest); - - $i++; - } - } - else - { - dol_syslog("Erreur SQl"); - dol_syslog($this->db->error()); - } - /* - * Appels les plus important - * - */ - - $this->pdf->SetFont('Arial','', 12); - - $Y = $this->pdf->GetY() + 10; - $this->pdf->SetXY(10, $Y); - $this->pdf->MultiCell(100, 4, "TOP 10 des numéros appelés en coût", 0,'L',0); - - $this->pdf->SetFont('Arial','', 9); - - $Y = $this->pdf->GetY(); - $this->pdf->SetXY(10, $Y); - $this->pdf->MultiCell(150, 4, "Destination", 0,'L',0); - - $this->pdf->SetXY(140, $Y); - $this->pdf->MultiCell(20, 4, "Durée", 0,'R',0); - - $this->pdf->SetXY(160, $Y); - $this->pdf->MultiCell(20, 4, "Nb appels", 0,'R',0); - - $this->pdf->SetXY(180, $Y); - $this->pdf->MultiCell(20, 4, "Coût", 0,'R',0); - - $sql = "SELECT count(*) as cc, sum(t.cout_vente) as cout_vente, sum(t.duree) as duree, t.numero, t.dest"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details as t "; - $sql .= " WHERE fk_telephonie_facture =".$factel->id; - $sql .= " GROUP BY t.numero"; - $sql .= " ORDER BY cout_vente DESC"; - $sql .= " LIMIT 10"; - - if ( $this->db->query($sql) ) - { - $num = $this->db->num_rows(); - - $this->pdf->SetFont('Arial','', 9); - - $i = 0; - $var = 0; - $line_height = 4; - - while ($i < $num) - { - $obj = $this->db->fetch_object($i); - $var=!$var; - - $Y = $this->pdf->GetY(); - - $this->pdf->SetXY(10, $Y); - $this->pdf->MultiCell(80, $line_height, $obj->dest, 0,'L',$var); - - if ($Y > $this->pdf->GetY()) - $Y = $this->pdf->GetY() - $line_height; - - $this->pdf->SetXY(90, $Y); - $this->pdf->MultiCell(30, $line_height, $obj->numero, 0,'L',$var); - - $h = floor($obj->duree / 3600); - $m = floor(($obj->duree - ($h * 3600)) / 60); - $s = ($obj->duree - ( ($h * 3600 ) + ($m * 60) ) ); - - if ($h > 0) - { - $dt = $h . " h " . $m ." min " . $s ." sec" ; - } - else - { - if ($m > 0) - { - $dt = $m ." min " . $s ." sec" ; - } - else - { - $dt = $s ." sec" ; - } - } - - $this->pdf->SetXY(120, $Y); - $this->pdf->MultiCell(40, $line_height,$dt, 0,'R',$var); - - $this->pdf->SetXY(160, $Y); - $this->pdf->MultiCell(20, $line_height,$obj->cc, 0,'R',$var); - - $this->pdf->SetXY(180, $Y); - $this->pdf->MultiCell(20, $line_height,sprintf("%01.3f",$obj->cout_vente), 0,'R',$var); - - $i++; - } - } - /* - * - * - */ - include_once ("/usr/share/jpgraph/jpgraph.php"); - include_once ("/usr/share/jpgraph/jpgraph_pie.php"); - - $graph = new PieGraph(450,200,"auto"); - $graph->img->SetImgFormat("jpeg"); - $graph->SetFrame(false); - - // Setup title - $graph->title->Set("Répartition des destinations en nombre d'appel"); - $graph->title->SetFont(FF_FONT1,FS_BOLD); - - $p1 = new PiePlot($graph_values); - $p1->SetCenter(0.25,0.5); - - // Label font and color setup - $p1->SetFont(FF_FONT1,FS_BOLD); - $p1->SetFontColor("darkred"); - $p1->SetSize(0.3); - $p1->SetLegends($graph_labels); - $graph->legend->Pos(0.05,0.15); - - $graph->Add($p1); - - $file_graph = "/tmp/graph".$factel->ligne.".jpg"; - - $handle = $graph->Stroke($file_graph); - - $this->pdf->Image($file_graph, 11, ($this->pdf->GetY() + 10), 0, 0, 'JPG'); - - /* - * Liste des appels - * - * - * - */ - - $sql = "SELECT t.ligne, ".$this->db->pdate("t.date")." as pdate"; - $sql .= " , t.numero, t.dest, t.duree, t.cout_vente"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details as t "; - $sql .= " WHERE fk_telephonie_facture =".$factel->id; - $sql .= " ORDER BY t.date ASC"; - - $resql = $this->db->query($sql) ; - - if ( $resql ) - { - $num = $this->db->num_rows($resql); - - $this->pdf->AddPage(); - - $i = 0; - $var = 1; - $line_height = 2; - $this->colonne = 1; - - while ($i < $num) - { - $obj = $this->db->fetch_object($resql); - - $Y = $this->pdf->GetY(); - - if ($this->inc > 106 && $this->colonne == 1) - { - $col = 95; - $Y = $this->pdf->tab_top + 6; - $this->inc = 0; - $this->colonne = 2; - $old_dest=''; - $old_date=''; - } - - if ($this->inc > 106 && $this->colonne == 2) - { - $this->pdf->AddPage(); - $var = 0; - $col = 0; - $Y = $this->pdf->tab_top + 6; - $this->inc = 0; - $old_dest=''; - $old_date=''; - $this->colonne = 1; - } - - $var=!$var; - - $this->pdf->SetFont('Arial','', 6); - - $this->pdf->SetXY (10 + $col, $Y); - - if ($old_date == strftime("%d/%m/%Y", $obj->pdate)) - { - $date = ""; - } - else - { - $old_date = strftime("%d/%m/%Y", $obj->pdate) ; - $date = strftime("%d/%m/%y",$obj->pdate); - } - - $this->pdf->MultiCell(11, $line_height, $date, 0,'L',$var); - - if ($Y > $this->pdf->GetY()) - $Y = $this->pdf->GetY() - $line_height; - - $this->pdf->SetXY (21 + $col, $Y); - $heure = strftime("%H:%M:%S",$obj->pdate); - $this->pdf->MultiCell(11, $line_height, $heure, 0,'L',$var); - - $this->pdf->SetXY (32 + $col, $Y); - $numero = ereg_replace("^00","",$obj->numero); - $this->pdf->MultiCell(17, $line_height, $numero, 0,'L',$var); - - $this->pdf->SetXY (48 + $col, $Y); - - if ($obj->dest == $old_dest) - { - $dest = ' "'; - } - else - { - $old_dest = $obj->dest ; - $dest = $obj->dest; - } - - $this->pdf->MultiCell(37, $line_height, $dest, 0, 'L',$var); - - $this->pdf->SetXY (85 + $col, $Y); - $this->pdf->MultiCell(10, $line_height, $obj->duree, 0, 'R',$var); - - $this->pdf->SetXY (95 + $col, $Y); - $this->pdf->MultiCell(10, $line_height, sprintf("%01.3f", $obj->cout_vente), 0,'R',$var); - - $i++; - $this->inc++; - } - } - else - { - dol_syslog("Erreur lecture des communications"); - } - - /* - * - */ - - $this->pdf->Close(); - $this->pdf->Output($file); - - $this->filename = $file; - - dol_syslog("Write $file"); - - if(file_exists($file_graph)) - { - unlink($file_graph); - } - - return 0; - } - else - { - $this->error="Erreur: répertoire '$dir' n'existe pas, créa impossible."; - return -1; - } - } - else - { - $this->error="Erreur: FAC_OUTPUTDIR non défini !"; - return -2; - } - } -} -?> diff --git a/htdocs/telephonie/pdf/xlsdetail_nodet.modules.php b/htdocs/telephonie/pdf/xlsdetail_nodet.modules.php deleted file mode 100644 index 40d2028cd73..00000000000 --- a/htdocs/telephonie/pdf/xlsdetail_nodet.modules.php +++ /dev/null @@ -1,116 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * - */ -require_once (DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_workbook.inc.php"); -require_once (DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_worksheet.inc.php"); - -class xlsdetail_nodet { - - Function xlsdetail_nodet($DB) - { - $this->db = $DB; - } - - Function GenerateFile($ligne, $fac, $factel) - { - $this->ligne = $ligne; - $error = 0; - - $dir = FAC_OUTPUTDIR . "/" . $fac->ref . "/" ; - $fname = $dir . $fac->ref . "-".$ligne->numero."-".$ligne->code_analytique."-detail.xls"; - - //dol_syslog("Open file : $fname"); - - $workbook = &new writeexcel_workbook($fname); - - $page = &$workbook->addworksheet($year."/".substr("00".$month,-2)); - - $fnb =& $workbook->addformat(); - $fnb->set_align('vcenter'); - $fnb->set_align('right'); - - $fp =& $workbook->addformat(); - $fp->set_align('vcenter'); - $fp->set_align('right'); - $fp->set_num_format('0.000'); - - $fdest =& $workbook->addformat(); - $fdest->set_align('vcenter'); - - $page->set_column(0,0,12); // A - $page->set_column(1,1,20); // B - $page->set_column(2,2,15); // C - $page->set_column(3,3,30); // D - $page->set_column(6,6,7); // G - $page->set_column(9,9,7); // J - $page->set_column(12,12,7); // M - - $page->write(0, 0, "Ligne", $format_titre_agence1); - $page->write(0, 1, "Date", $format_titre); - $page->write(0, 2, "Numero", $format_titre); - $page->write(0, 3, "Destination", $format_titre); - $page->write(0, 4, "Durée", $format_titre); - $page->write(0, 5, "Cout HT", $format_titre); - - $sql = "SELECT ligne, date, numero, dest, dureetext, duree, cout_vente"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; - $sql .= " WHERE fk_telephonie_facture = '".$factel->id."'"; - $sql .= " ORDER BY date ASC"; - - $resql = $this->db->query($sql); - - if ($resql) - { - $i = 0; - $numsql = $this->db->num_rows($resql); - - //dol_syslog($this->ligne->numero . " : ".$numsql); - - while ($i < $numsql) - { - $obj = $this->db->fetch_object($resql); - - $xx = $i + 1; - - $page->write_string($xx, 0, $obj->ligne, $fdest); - $page->write_string($xx, 1, $obj->date, $fdest); - $page->write_string($xx, 2, $obj->numero, $fdest); - $page->write_string($xx, 3, $obj->dest, $fdest); - $page->write($xx, 4, $obj->duree, $fnb); - $page->write($xx, 5, $obj->cout_vente, $fp); - - $i++; - } - $this->db->free($resql); - } - else - { - dol_syslog($this->db->error()); - } - - $workbook->close(); - //dol_syslog("Close $fname"); - - return $error; - } -} -?> diff --git a/htdocs/telephonie/pre.inc.php b/htdocs/telephonie/pre.inc.php deleted file mode 100644 index 975b66639c5..00000000000 --- a/htdocs/telephonie/pre.inc.php +++ /dev/null @@ -1,87 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("../main.inc.php"); -require(DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); -$user->getrights('telephonie'); - -function llxHeader($head = "", $title="") { - global $user; - - /* - * - * - */ - top_menu($head, $title); - - $menu = new Menu(); - - if ($user->rights->telephonie->adsl->lire && TELEPHONIE_MODULE_ADSL == 1) - $menu->add(DOL_URL_ROOT."/telephonie/adsl/", "Liens xDSL"); - - $menu->add(DOL_URL_ROOT."/telephonie/index.php", "Telephonie"); - - if (TELEPHONIE_MODULE_SIMULATION == 1) - { - $menu->add(DOL_URL_ROOT."/telephonie/simulation/fiche.php", "Simulation"); - $menu->add_submenu(DOL_URL_ROOT."/telephonie/simulation/fiche.php?action=create", "Nouvelle"); - } - - $menu->add(DOL_URL_ROOT."/telephonie/client/index.php", "Clients"); - if ($user->rights->telephonie->ligne->creer) - $menu->add_submenu(DOL_URL_ROOT."/telephonie/client/new.php", "Nouveau client"); - - $menu->add(DOL_URL_ROOT."/telephonie/contrat/", "Contrats"); - - $menu->add(DOL_URL_ROOT."/telephonie/ligne/index.php", "Lignes"); - - if ($user->rights->telephonie->ligne_commander) - $menu->add(DOL_URL_ROOT."/telephonie/ligne/commande/", "Commandes"); - - if ($user->rights->telephonie->facture->lire) - { - $menu->add(DOL_URL_ROOT."/telephonie/facturation/", "Facturation"); - $menu->add(DOL_URL_ROOT."/telephonie/facture/", "Factures"); - } - - if ($user->rights->telephonie->stats->lire) - $menu->add(DOL_URL_ROOT."/telephonie/stats/", "Statistiques"); - - $menu->add(DOL_URL_ROOT."/telephonie/tarifs/", "Tarifs"); - - $menu->add(DOL_URL_ROOT."/telephonie/distributeurs/", "Distributeurs"); - - if ($user->rights->telephonie->fournisseur->lire) - $menu->add(DOL_URL_ROOT."/telephonie/fournisseur/index.php", "Fournisseurs"); - - if ($user->rights->telephonie->service->lire) - $menu->add(DOL_URL_ROOT."/telephonie/service/", "Services"); - - if ($user->rights->telephonie->ca->lire) - $menu->add(DOL_URL_ROOT."/telephonie/ca/", "Chiffre d'affaire"); - - if ($user->rights->telephonie->configurer) - $menu->add(DOL_URL_ROOT."/telephonie/config/", "Configuration"); - - left_menu($menu->liste); -} - -?> diff --git a/htdocs/telephonie/script/affect-id-ligne.php b/htdocs/telephonie/script/affect-id-ligne.php deleted file mode 100644 index 6c61a99d5a8..00000000000 --- a/htdocs/telephonie/script/affect-id-ligne.php +++ /dev/null @@ -1,102 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * - * Synchronise les id dans la tables des comm - * scrip temporaire le temps de ré-écrire la facturation - * - */ -require ("../../master.inc.php"); - -$error = 0; -$stop = 0 ; - -$sql = "SELECT distinct(ligne) as l, count(*)"; -$sql .= " FROM llx_telephonie_societe_ligne"; -$sql .= " GROUP by l DESC "; - -if ($db->query($sql)) -{ - $num = $db->num_rows(); - - if ($num) - { - $row = $db->fetch_row(); - if ( $row[1] > 1) - { - print "Doublons ligne $row[0]\n"; - $stop = 1; - } - } - $db->free(); -} - -if ($stop == 0) -{ - - for ($i = 0 ; $i < 5000 ; $i++) - { - - $sql = "SELECT fk_ligne, ligne"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; - $sql .= " WHERE fk_ligne is null"; - $sql .= " LIMIT 1"; - - if ($db->query($sql)) - { - $num = $db->num_rows(); - - if ($num) - { - $row = $db->fetch_row(); - $ligne = $row[1]; - } - $db->free(); - } - - $sql = "SELECT rowid, ligne"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne"; - $sql .= " WHERE ligne =".$ligne; - - if ($db->query($sql)) - { - $num = $db->num_rows(); - - if ($num) - { - $row = $db->fetch_row(); - $id = $row[0]; - } - $db->free(); - } - - $sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_communications_details"; - $sql .= " SET fk_ligne = ".$id; - $sql .= " WHERE ligne =".$ligne; - - if ($db->query($sql)) - { - print "$ligne -> $id -> "; - print $db->affected_rows()."\n"; - } - } -} - -?> diff --git a/htdocs/telephonie/script/analyse-traffic.php b/htdocs/telephonie/script/analyse-traffic.php deleted file mode 100644 index d4df5080dbb..00000000000 --- a/htdocs/telephonie/script/analyse-traffic.php +++ /dev/null @@ -1,112 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * Recherche les lignes sans traffic - * - */ -print "Mem : ".memory_get_usage() ."\n"; -require ("../../master.inc.php"); - -require_once (DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); - -$error = 0; - -$datetime = time(); -$date = strftime("%d%h%Y%Hh%Mm%S",$datetime); - -$month = strftime("%m", $datetime); -$year = strftime("%Y", $datetime); - -if ($month == 1) -{ - $month = "12"; - $year = $year - 1; -} -else -{ - $month = substr("00".($month - 1), -2) ; -} - - -/* - * Lecture des lignes - * - */ -$lignes = array(); -$lignes_traffic = array(); - -$sql = "SELECT rowid, ligne FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne"; -$sql .= " WHERE statut = 3"; - -$resql = $db->query($sql); - -if ($resql) -{ - $nums = $db->num_rows($resql); - $i = 0; - while($i < $nums) - { - $row = $db->fetch_row($resql); - $lignes[$i] = $row; - $i++; - } - $db->free($resql); -} -dol_syslog(sizeof($lignes)." lignes actives"); -/* - * Lecture des comms - * - */ -$sql = "SELECT distinct(ligne) FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; -$sql .= " WHERE date_format(date,'%Y%m') = ".$year.substr("00".$month, -2); -$resql = $db->query($sql); - -if ($resql) -{ - $nums = $db->num_rows($resql); - $i = 0; - while($i < $nums) - { - $row = $db->fetch_row($resql); - array_push($lignes_traffic, $row[0]); - $i++; - } - $db->free($resql); -} -dol_syslog(sizeof($lignes_traffic)." lignes avec traffic"); - -/* - * Croisement des données - * - */ -$j = 0; -for ($i = 0 ; $i < sizeof($lignes) ; $i++) -{ - if (in_array($lignes[$i][1], $lignes_traffic)) - { - - } - else - { - $j++; - print "$j Pas de traffic en $month/$year sur ".$lignes[$i][1]."\n"; - } -} -?> diff --git a/htdocs/telephonie/script/api/index.php b/htdocs/telephonie/script/api/index.php deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/telephonie/script/api/presel-activation-manuelle.php b/htdocs/telephonie/script/api/presel-activation-manuelle.php deleted file mode 100644 index 0e574526ea1..00000000000 --- a/htdocs/telephonie/script/api/presel-activation-manuelle.php +++ /dev/null @@ -1,146 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * - * Resiliation de lignes par API - * - */ -require ("../../../master.inc.php"); -require_once DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"; - -$verbose = 0; - -$ligne = $argv[1]; - - -$user = new User($db); -$user->id = 1; // C'est sale je sais ! - -$host = CMD_PRESEL_WEB_HOST; -$user_login = CMD_PRESEL_WEB_USER; -$user_passwd = CMD_PRESEL_WEB_PASS; -$user_contract = CMD_PRESEL_WEB_CONTRACT; - -/* - * Lecture des lignes a r販lier - * - */ -$sql = "SELECT s.nom, s.rowid as socid, s.address, s.cp, s.ville"; -$sql .= ", l.ligne, l.statut, l.rowid"; - -$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_fournisseur as f"; -$sql .= " WHERE l.fk_soc = s.rowid AND l.fk_fournisseur = f.rowid"; -$sql .= " AND f.rowid = 4 AND l.ligne = ".$ligne." ORDER BY s.rowid ASC"; - -$resql = $db->query($sql); -$result = 1; -if ($resql) -{ - $i = 0; - $num = $db->num_rows($resql); - - while ($i < $num) - { - $obj = $db->fetch_object($resql); - - $result = ActivationPreselection($host, $user_login, $user_passwd, $obj->ligne, $num_abo); - - if ($result == 0) - { - - } - - $i++; - } -} - -function ActivationPreselection($host, $user_login, $user_passwd, $ligne, $id_person) -{ - $url = "/AzurApp_websvc_b3gdb/account.asmx/UpdatePreselection?"; - - $url .= "user_login=". $user_login; - $url .= "&user_passwd=".$user_passwd; - $url .= "&telnum=".$ligne; - $url .= "&okCollecte=true"; - $url .= "&okPreselection=true"; - - $fp = fsockopen($host, 80, $errno, $errstr, 30); - if (!$fp) - { - dol_syslog("$errstr ($errno)"); - } - else - { - $out = "GET $url HTTP/1.1\r\n"; - $out .= "Host: $host\r\n"; - $out .= "Connection: Close\r\n\r\n"; - - fwrite($fp, $out); - - if ($verbose > 2) - dol_syslog("Data sent, waiting for response"); - - $parse = 0; - $result = "error"; - - $fresult = ""; - - while (!feof($fp)) - { - $line = fgets($fp, 1024); - - if ($verbose > 2) - dol_syslog($line); - - if ($parse == 1) - { - preg_match('/^(.*)<\/string>$/', $line, $results); - - $result = $results[1]; - $parse = 0; - } - - if (substr($line,0,38) == '') - { - $parse = 1; - } - - $fresult .= $line; - - } - fclose($fp); - } - - if (substr($result,0,2) == "OK") - { - dol_syslog("Activation rè´³sie ligne ".$ligne." id client ".$id_person." $result\n"); - return 0; - } - else - { - dol_syslog("Activation 袨ou裠ligne ".$ligne." id client ".$id_person." $result\n"); - - return -1; - } -} - -?> diff --git a/htdocs/telephonie/script/api/presel-resiliation-manuelle.php b/htdocs/telephonie/script/api/presel-resiliation-manuelle.php deleted file mode 100644 index 81273abea37..00000000000 --- a/htdocs/telephonie/script/api/presel-resiliation-manuelle.php +++ /dev/null @@ -1,146 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * - * Resiliation de lignes par API - * - */ -require ("../../../master.inc.php"); -require_once DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"; - -$verbose = 0; - -$ligne = $argv[1]; - - -$user = new User($db); -$user->id = 1; // C'est sale je sais ! - -$host = CMD_PRESEL_WEB_HOST; -$user_login = CMD_PRESEL_WEB_USER; -$user_passwd = CMD_PRESEL_WEB_PASS; -$user_contract = CMD_PRESEL_WEB_CONTRACT; - -/* - * Lecture des lignes a r販lier - * - */ -$sql = "SELECT s.nom, s.rowid as socid, s.address, s.cp, s.ville"; -$sql .= ", l.ligne, l.statut, l.rowid"; - -$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_fournisseur as f"; -$sql .= " WHERE l.fk_soc = s.rowid AND l.fk_fournisseur = f.rowid"; -$sql .= " AND f.rowid = 4 AND l.ligne = ".$ligne." ORDER BY s.rowid ASC"; - -$resql = $db->query($sql); -$result = 1; -if ($resql) -{ - $i = 0; - $num = $db->num_rows($resql); - - while ($i < $num) - { - $obj = $db->fetch_object($resql); - - $result = ActivationPreselection($host, $user_login, $user_passwd, $obj->ligne, $num_abo); - - if ($result == 0) - { - - } - - $i++; - } -} - -function ActivationPreselection($host, $user_login, $user_passwd, $ligne, $id_person) -{ - $url = "/AzurApp_websvc_b3gdb/account.asmx/UpdatePreselection?"; - - $url .= "user_login=". $user_login; - $url .= "&user_passwd=".$user_passwd; - $url .= "&telnum=".$ligne; - $url .= "&okCollecte=false"; - $url .= "&okPreselection=false"; - - $fp = fsockopen($host, 80, $errno, $errstr, 30); - if (!$fp) - { - dol_syslog("$errstr ($errno)"); - } - else - { - $out = "GET $url HTTP/1.1\r\n"; - $out .= "Host: $host\r\n"; - $out .= "Connection: Close\r\n\r\n"; - - fwrite($fp, $out); - - if ($verbose > 2) - dol_syslog("Data sent, waiting for response"); - - $parse = 0; - $result = "error"; - - $fresult = ""; - - while (!feof($fp)) - { - $line = fgets($fp, 1024); - - if ($verbose > 2) - dol_syslog($line); - - if ($parse == 1) - { - preg_match('/^(.*)<\/string>$/', $line, $results); - - $result = $results[1]; - $parse = 0; - } - - if (substr($line,0,38) == '') - { - $parse = 1; - } - - $fresult .= $line; - - } - fclose($fp); - } - - if (substr($result,0,2) == "OK") - { - dol_syslog("Resiliation rè´³sie ligne ".$ligne." id client ".$id_person." $result\n"); - return 0; - } - else - { - dol_syslog("Resiliation 袨ou裠ligne ".$ligne." id client ".$id_person." $result\n"); - - return -1; - } -} - -?> diff --git a/htdocs/telephonie/script/api/presel-resiliation.php b/htdocs/telephonie/script/api/presel-resiliation.php deleted file mode 100644 index e807e4f9f64..00000000000 --- a/htdocs/telephonie/script/api/presel-resiliation.php +++ /dev/null @@ -1,188 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * - * Resiliation de lignes par API - * - */ -require ("../../../master.inc.php"); -require_once DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"; - -$verbose = 0; - -for ($i = 1 ; $i < sizeof($argv) ; $i++) -{ - if ($argv[$i] == "-v") - { - $verbose = 1; - } - if ($argv[$i] == "-vv") - { - $verbose = 2; - } - if ($argv[$i] == "-vvv") - { - $verbose = 3; - } -} - - -$user = new User($db); -$user->id = 1; // C'est sale je sais ! - -$host = CMD_PRESEL_WEB_HOST; -$user_login = CMD_PRESEL_WEB_USER; -$user_passwd = CMD_PRESEL_WEB_PASS; -$user_contract = CMD_PRESEL_WEB_CONTRACT; - -/* - * Lecture des lignes a r販lier - * - */ -$sql = "SELECT s.nom, s.rowid as socid, s.address, s.cp, s.ville"; -$sql .= ", l.ligne, l.statut, l.rowid"; - -$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_fournisseur as f"; -$sql .= " WHERE l.fk_soc = s.rowid AND l.fk_fournisseur = f.rowid"; -$sql .= " AND f.rowid = 4 AND l.statut = 4 ORDER BY s.rowid ASC"; - -$resql = $db->query($sql); -$result = 1; -if ($resql) -{ - $i = 0; - $num = $db->num_rows($resql); - - while ($i < $num) - { - $obj = $db->fetch_object($resql); - - $result = ResiliationPreselection($host, $user_login, $user_passwd, $obj->ligne, $num_abo); - - if ($result == 0) - { - $lint = new LigneTel($db); - $lint->fetch_by_id($obj->rowid); - if ($lint->statut == 4) - { - $lint->set_statut($user, 5); - } - } - - $i++; - } -} - -function ResiliationPreselection($host, $user_login, $user_passwd, $ligne, $id_person) -{ - global $verbose; - //dol_syslog("Appel de DeletePreselection($host, $user_login, ****, $ligne, $id_person)"); - - $url = "/AzurApp_websvc_b3gdb/account.asmx/UpdatePreselection?"; - - $url .= "user_login=". $user_login; - $url .= "&user_passwd=".$user_passwd; - $url .= "&telnum=".$ligne; - $url .= "&okCollecte=false"; - $url .= "&okPreselection=false"; - - if ($verbose > 2) - dol_syslog("$host"); - - if ($verbose > 2) - dol_syslog("$url"); - - $fp = fsockopen($host, 80, $errno, $errstr, 30); - if (!$fp) - { - dol_syslog("$errstr ($errno)"); - } - else - { - if ($verbose > 2) - dol_syslog("Socket Opened send data"); - - $out = "GET $url HTTP/1.1\r\n"; - $out .= "Host: $host\r\n"; - $out .= "Connection: Close\r\n\r\n"; - - fwrite($fp, $out); - - if ($verbose > 2) - dol_syslog("Data sent, waiting for response"); - - $parse = 0; - $result = "error"; - - $fresult = ""; - - while (!feof($fp)) - { - $line = fgets($fp, 1024); - - if ($verbose > 2) - dol_syslog($line); - - if ($parse == 1) - { - preg_match('/^(.*)<\/string>$/', $line, $results); - - $result = $results[1]; - //dol_syslog($line); - $parse = 0; - } - - if (substr($line,0,38) == '') - { - $parse = 1; - } - - $fresult .= $line; - - } - fclose($fp); - } - - if ($verbose > 1) - dol_syslog("result = ".$result); - - if (substr($result,0,2) == "OK") - { - dol_syslog("Resiliation rè´³sie ligne ".$ligne." id client ".$id_person." $result\n"); - return 0; - } - else - { - dol_syslog("Resiliation 袨ou裠ligne ".$ligne." id client ".$id_person." $result\n"); - - $fp = fopen("/tmp/$ligne.delete","w"); - if ($fp) - { - fwrite($fp, $fresult); - fclose($fp); - } - - return -1; - } -} - -?> diff --git a/htdocs/telephonie/script/api/presel-view.php b/htdocs/telephonie/script/api/presel-view.php deleted file mode 100644 index 63f36b9d2a8..00000000000 --- a/htdocs/telephonie/script/api/presel-view.php +++ /dev/null @@ -1,199 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * Visualisation de l'etat des lignes preselectionn�es - * - */ -require ("../../../master.inc.php"); -require_once DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"; -require_once DOL_DOCUMENT_ROOT."/telephonie/dolibarrmail.class.php"; - -$host = CMD_PRESEL_WEB_HOST; -$user_login = CMD_PRESEL_WEB_USER; -$user_passwd = CMD_PRESEL_WEB_PASS; - -$user = new User($db); -$user->id = 1; - -$ids = array(); - -if ($argv[1]) -{ - $debug = 0; - array_push($ids, $argv[1]); -} -else -{ - $sql = "SELECT rowid,ligne"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne"; - $sql .= " WHERE fk_fournisseur = 4"; - $sql .= " AND statut = 3"; - if ($debug) - { - $sql .= " LIMIT 1"; - } - $resql = $db->query($sql); - - if ($resql) - { - while ($row = $db->fetch_row($resql)) - { - array_push($ids, $row[1]); - } - } - else - { - print $db->error(); - exit(1); - } -} - -GetPreselection_byRef($db, $host, $user_login, $user_passwd, $ids, $debug, $user); - -/* - * Fonctions - * - */ - -function GetPreselection_byRef($db, $host, $user_login, $user_passwd, $ids, $debug, $user) -{ - $numcli = sizeof($ids); - $i = 0; - print "Nombre de lignes $numcli\n"; - foreach($ids as $cli) - { - $i++; - $fp = @fsockopen($host, 80, $errno, $errstr, 30); - if (!$fp) - { - print "Impossible de se connecter au server $errstr ($errno)"; - } - else - { - $ligne_numero = ""; - $ligne_service = ""; - $ligne_presel = ""; - - //GetPreselection_byRef - $url = "/AzurApp_websvc_b3gdb/account.asmx/GetPreselection_byRef?"; - - $url .= "user_login=". $user_login; - $url .= "&user_passwd=".$user_passwd; - $url .= "&telnum=".$cli; - - $out = "GET $url HTTP/1.1\r\n"; - $out .= "Host: $host\r\n"; - $out .= "Connection: Close\r\n\r\n"; - - fwrite($fp, $out); - - while (!feof($fp)) - { - $line = fgets($fp, 1024); - if ($debug) - { - print $line; - } - if (preg_match("//",$line)) - { - $results = explode(" ",trim($line)); - //print_r($results); - - $array = array(); - preg_match('/telnum="([0123456789]*)"/', $line, $array); - $ligne_numero = $array[1]; - - $array = array(); - preg_match('/ServiceActive="([\S]*)"/i', $line, $array); - $service_active = $array[1]; - - $array = array(); - preg_match('/PreSelectionActive="([\S]*)"/i', $line, $array); - $presel_active = $array[1]; - - $array = array(); - preg_match('/Service_Statut="([\S]*)"/i', $line, $array); - $ligne_service = $array[1]; - - $array = array(); - preg_match('/PreSelection_Statut="([\S]*)"/i', $line, $array); - $ligne_presel = $array[1]; - - if ($ligne_service.$ligne_presel <> 'TRAITE_OKTRAITE_OK') - { - print "$i/$numcli "; - print $ligne_numero." "; - print "$service_active/$presel_active "; - print substr($ligne_service.str_repeat(" ",20),0,20); - print substr($ligne_presel.str_repeat(" ",20),0,20); - print "\n"; - } - - $situation_key = $ligne_service.' / '.$ligne_presel; - - if ($situation_key == 'TRAITE_OK / ATTENTE') - { - $ligne = new LigneTel($db); - - if ($ligne->fetch($ligne_numero) == 1) - { - if ($ligne->statut == 3) - { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_commande_retour"; - $sql .= " (cli,mode,date_traitement,situation,fk_fournisseur,traite)"; - $sql .= " VALUES ('$ligne_numero','PRESELECTION',now(),'$situation_key',4,1);"; - - $resql = $db->query($sql); - - $statut = 6; - $date_resiliation = time(); - $datea = $db->idate($date_resiliation); - - if ($ligne->set_statut($user, $statut, $datea,'',4) <> 0) - { - $error++; - print "ERROR\n"; - } - } - } - else - { - print "Erreur de lecture\n"; - } - } - - - } - - if (preg_match("//",$line)) - { - $array = array(); - preg_match('/libelle="(.*)" xmlns:d4p1/', $line, $array); - - print "$i/$numcli "; - print "$cli ErreurAPI ".$array[1]."\n"; - } - } - fclose($fp); - } - } -} - -?> diff --git a/htdocs/telephonie/script/bascule.php b/htdocs/telephonie/script/bascule.php deleted file mode 100644 index 3da65d45609..00000000000 --- a/htdocs/telephonie/script/bascule.php +++ /dev/null @@ -1,100 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require ("../../master.inc.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/distributeurtel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); - -$error = 0; -$nbcommit = 0; -$datetime = time(); - -$user = new User($db, 1); -$user->login = "Rodo"; - -$sql = "SELECT rowid "; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat"; -$sql .= " WHERE fk_client_comm = 52"; - -$resql = $db->query($sql); - -if ( $resql ) -{ - $num = $db->num_rows($resql); - $i = 0; - - while ($i < $num) - { - $row = $db->fetch_row($resql); - - print $row[0]; - - $sqll = "SELECT rowid "; - $sqll .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne"; - $sqll .= " WHERE fk_contrat = ".$row[0]; - $sqll .= " AND statut = 3"; - - $resqll = $db->query($sqll); - - if ( $resqll ) - { - $numl = $db->num_rows($resqll); - $j = 0; - - while ($j < $numl) - { - $row_l = $db->fetch_row($resqll); - - print " ".$row_l[0]; - $lignes++; - - $ligne = new LigneTel($db); - $ligne->fetch_by_id($row_l[0]); - - if ( $ligne->transfer($user,4) == 0) - { - - } - else - { - Print "Error ligne $row_l[0]\n"; - } - - $j++; - } - } - - print "\n"; - - $i++; - } - $db->free($resql); -} -else -{ - $error = 1; - dol_syslog("Verification Erreur ".$error); -} - -print "lignes : $lignes\n"; - -?> diff --git a/htdocs/telephonie/script/commande_presel.php b/htdocs/telephonie/script/commande_presel.php deleted file mode 100644 index 36a0698be34..00000000000 --- a/htdocs/telephonie/script/commande_presel.php +++ /dev/null @@ -1,369 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * - * Commandes des lignes par API - * - */ -require ("../../master.inc.php"); -require_once DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"; - -$verbose = 0; - -for ($i = 1 ; $i < sizeof($argv) ; $i++) -{ - if ($argv[$i] == "-v") - { - $verbose = 1; - } - if ($argv[$i] == "-vv") - { - $verbose = 2; - } - if ($argv[$i] == "-vvv") - { - $verbose = 3; - } - if (strlen($argv[$i]) == 10) - { - $ligne = $argv[$i]; - print "Filtre sur la ligne ".$ligne."\n"; - } -} - - -$user = new User($db); -$user->id = 1; // C'est sale je sais ! - -$host = CMD_PRESEL_WEB_HOST; -$user_login = CMD_PRESEL_WEB_USER; -$user_passwd = CMD_PRESEL_WEB_PASS; -$user_contract = CMD_PRESEL_WEB_CONTRACT; - -/* - * Lecture des lignes a commander - * - */ -$sql = "SELECT s.nom, s.rowid as socid, s.address, s.cp, s.ville"; -$sql .= ", l.ligne, l.statut, l.rowid"; - -$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_fournisseur as f"; -$sql .= " WHERE l.fk_soc = s.rowid AND l.fk_fournisseur = f.rowid"; -$sql .= " AND f.rowid = 4 AND l.statut = 9"; -if ($ligne > 0) -{ - $sql .= " AND l.ligne='".$ligne."'"; -} -$sql .= " ORDER BY l.rowid DESC"; -$resql = $db->query($sql); -$result = 1; -if ($resql) -{ - $i = 0; - $num = $db->num_rows($resql); - - if ($verbose > 2) - { - print $num ." lignes a commander\n"; - } - - while ($i < $num) - { - $obj = $db->fetch_object($resql); - - $num_abo = GetNumAbonne($db, $obj->socid, 4); - - if ($num_abo == 0) - { - $societe_nom = $obj->nom; - $societe_adresse = $obj->address; - $societe_codepostal = $obj->cp; - $societe_ville = $obj->ville; - - $num_abo = CreateAbonne($host, - $user_login, - $user_passwd, - $user_contract, - $societe_nom, - $societe_adresse, - $societe_codepostal, - $societe_ville); - - if ($num_abo > 0) - { - $result = SetNumAbonne($db, $obj->socid, $num_abo, 4); - } - else - { - $result = 1; - } - } - else - { - $result = 0; - } - - $lint = new LigneTel($db); - $lint->fetch_by_id($obj->rowid); - - if ($result == 0) - { - $result = CreatePreselection($host, $user_login, $user_passwd, $lint, $num_abo); - } - - if ($result == 0) - { - if ($lint->statut == 9) - { - $lint->set_statut($user, 2); - } - } - - $i++; - } -} - -function CreatePreselection($host, $user_login, $user_passwd, $lint, $id_person) -{ - global $verbose; - - $url = "/AzurApp_websvc_b3gdb/account.asmx/CreatePreselection?"; - - $url .= "user_login=". $user_login; - $url .= "&user_passwd=".$user_passwd; - $url .= "&id_person=".$id_person; - $url .= "&telnum=".$lint->numero; - $url .= "&okCollecte=true"; - if ($lint->support == 'sda') - { - $url .= "&okPreselection=false"; - } - else - { - $url .= "&okPreselection=true"; - } - - if ($verbose > 2) - dol_syslog("$host"); - - if ($verbose > 2) - dol_syslog("$url"); - - $fp = fsockopen($host, 80, $errno, $errstr, 30); - if (!$fp) - { - dol_syslog("$errstr ($errno)"); - } - else - { - if ($verbose > 2) - dol_syslog("Socket Opened send data"); - - $out = "GET $url HTTP/1.1\r\n"; - $out .= "Host: $host\r\n"; - $out .= "Connection: Close\r\n\r\n"; - - fwrite($fp, $out); - - if ($verbose > 2) - dol_syslog("Data sent, waiting for response"); - - $parse = 0; - $result = "error"; - - $fresult = ""; - - while (!feof($fp)) - { - $line = fgets($fp, 1024); - - if ($verbose > 2) - dol_syslog($line); - - if ($parse == 1) - { - preg_match('/^(.*)<\/string>$/', $line, $results); - - $result = $results[1]; - //dol_syslog($line); - $parse = 0; - } - - if (substr($line,0,38) == '') - { - $parse = 1; - } - - $fresult .= $line; - - } - fclose($fp); - } - - if ($verbose > 1) - dol_syslog("result = ".$result); - - if (substr($result,0,2) == "OK") - { - if ($verbose > 1) - dol_syslog("Presel OK ".$lint->numero." ".$lint->support." id client ".$id_person." $result\n"); - return 0; - } - else - { - if ($verbose > 1) - dol_syslog("Presel ERR ".$lint->numero." ".$lint->support." id client ".$id_person." $result\n"); - - $fp = fopen("/tmp/".$lint->numero.".presel","w"); - if ($fp) - { - fwrite($fp, $fresult); - fclose($fp); - } - - return -1; - } -} - -function GetNumAbonne($db, $socid, $fournid) -{ - //dol_syslog("Appel de GetNumAbonne($socid, $fournid)"); - - $sql = "SELECT fourn_id"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_fournid"; - $sql .= " WHERE fk_soc = ".$socid; - $sql .= " AND fk_fourn = ".$fournid; - - $resql = $db->query($sql); - - if ($resql) - { - if ($db->num_rows($resql) > 0) - { - $row = $db->fetch_row($resql); - return $row[0]; - } - else - { - return 0; - } - } - else - { - dol_syslog("Erreur dans GetNumAbonne($socid, $fournid)"); - return -1; - } -} - -function SetNumAbonne($db, $socid, $soc_fourn_id, $fournid) -{ - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_societe_fournid"; - $sql .= " (fk_soc, fourn_id, fk_fourn, datec) "; - $sql .= " VALUES ($socid, $soc_fourn_id, $fournid, now()) ;"; - - $resql = $db->query($sql); - - if ($resql) - { - return 0; - } - else - { - dol_syslog("Erreur dans SetNumAbonne($socid, $soc_fourn_id, $fournid)"); - return -1; - } -} - -function CreateAbonne($host, $user_login, $user_passwd, $user_contract, $societe_nom, $societe_adresse, $societe_codepostal, $societe_ville) -{ - $result = "error"; - - $civilite = 1; - - $url = "/AzurApp_websvc_b3gdb/account.asmx/CreateAbonne?"; - - $url .= "user_login=". $user_login; - $url .= "&user_passwd=".$user_passwd; - $url .= "&civilite=". urlencode($civilite); - $url .= "&id_contract=".$user_contract; - $url .= "&firstname=". urlencode("Societe"); - $url .= "&lastname=". urlencode(ereg_replace("'","",($societe_nom))); - $url .= "&adresse=". urlencode($societe_adresse); - $url .= "&codepostal=". urlencode($societe_codepostal); - $url .= "&ville=". urlencode($societe_ville); - $url .= "&pays=". urlencode("NULL"); - $url .= "&telnum=". urlencode("NULL"); - - $fp = fsockopen($host, 80, $errno, $errstr, 30); - if (!$fp) - { - dol_syslog("$errstr ($errno)"); - } - else - { - $out = "GET $url HTTP/1.1\r\n"; - $out .= "Host: $host\r\n"; - $out .= "Connection: Close\r\n\r\n"; - - fwrite($fp, $out); - - $parse = 0; - - while (!feof($fp)) - { - $line = fgets($fp, 1024); - - if ($parse == 1) - { - //print $line."\n"; - - preg_match('/^(.*):(.*)<\/string>$/', $line, $results); - - $result = $results[1]; - $client_id = $results[2]; - if ($verbose > 1) - dol_syslog($line); - } - - if (substr($line,0,38) == '') - { - $parse = 1; - } - } - fclose($fp); - } - - if ($verbose > 1) - dol_syslog("$result:$client_id"); - - if ($result == "OK") - { - if ($verbose > 1) - dol_syslog("Commande rè´³sie id client ".$client_id); - return $client_id; - } - else - { - return 0; - } -} -?> diff --git a/htdocs/telephonie/script/commande_presel_statut.php b/htdocs/telephonie/script/commande_presel_statut.php deleted file mode 100644 index e9a314dd9e3..00000000000 --- a/htdocs/telephonie/script/commande_presel_statut.php +++ /dev/null @@ -1,326 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * - * Recup�ration des fichiers CDR - * - */ -require ("../../master.inc.php"); -_log($GLOBALS["argv"][0]." Start", LOG_NOTICE); -require_once DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"; -require_once (DOL_DOCUMENT_ROOT."/telephonie/dolibarrmail.class.php"); - -set_time_limit(0); - -$host = CMD_PRESEL_WEB_HOST; -$user_login = CMD_PRESEL_WEB_USER; -$user_passwd = CMD_PRESEL_WEB_PASS; - -_log($GLOBALS["argv"][0]." Lecture des lignes", LOG_NOTICE); - -$sql = "SELECT rowid,ligne"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne"; -$sql .= " WHERE fk_fournisseur = 4"; -$sql .= " AND statut = 2;"; - -$resql = $db->query($sql); - -if ($resql) -{ - $ids = array(); - while ($row = $db->fetch_row($resql)) - { - array_push($ids, $row[1]); - } -} -else -{ - _log($GLOBALS["argv"][0]." Erreur lecture liste des lignes", LOG_ERR); - exit(1); -} - -if (sizeof($ids) == 0) -{ - _log($GLOBALS["argv"][0]. " Aucune lignes � traiter - fin", LOG_NOTICE); - exit(0); -} - -$lignes = array(); -for ($i = 0 ; $i < 10 ; $i++) - $lignes[$i] = array(); - -foreach ($ids as $id) -{ - $idx = substr($id, -1); - array_push($lignes[$idx], $id); -} - -$childrenTotal = 10; -$childrenNow = 0; - -while ( $childrenNow < $childrenTotal ) -{ - $pid = pcntl_fork(); - - if ( $pid == -1 ) - { - die( "error\n" ); - } - elseif ( $pid ) - { - // P�re - $childrenNow++; - } - else - { - if (sizeof($lignes[$childrenNow])) - { - // Fils - GetPreselection_byRef($db, $host, $user_login, $user_passwd, $lignes[$childrenNow]); - } - exit(0); - } -} - -/* - * Fonctions - * - */ - -function GetPreselection_byRef($db, $host, $user_login, $user_passwd, $ids) -{ - - $user = new User($db); - $user->id = 1; - - foreach($ids as $cli) - { - _log("$cli Debut Traitement ligne", LOG_NOTICE); - - $fp = @fsockopen($host, 80, $errno, $errstr, 30); - if (!$fp) - { - _log("Impossible de se connecter au server $errstr ($errno)", LOG_ERR); - } - else - { - $ligne_numero = ""; - $ligne_service = ""; - $ligne_presel = ""; - - //GetPreselection_byRef - $url = "/AzurApp_websvc_b3gdb/account.asmx/GetPreselection_byRef?"; - - $url .= "user_login=". $user_login; - $url .= "&user_passwd=".$user_passwd; - $url .= "&telnum=".$cli; - - $out = "GET $url HTTP/1.1\r\n"; - $out .= "Host: $host\r\n"; - $out .= "Connection: Close\r\n\r\n"; - - fwrite($fp, $out); - - while (!feof($fp)) - { - $line = fgets($fp, 1024); - - if (preg_match("//",$line)) - { - $results = explode(" ",trim($line)); - //print_r($results); - - $array = array(); - preg_match('/telnum="([0123456789]*)"/', $line, $array); - $ligne_numero = $array[1]; - - $array = array(); - preg_match('/Service_Statut="([\S]*)"/i', $line, $array); - $ligne_service = $array[1]; - - $array = array(); - preg_match('/PreSelection_Statut="([\S]*)"/i', $line, $array); - $ligne_presel = $array[1]; - - _log($ligne_numero." ".$ligne_service." / ".$ligne_presel,LOG_NOTICE); - } - - if (preg_match("//",$line)) - { - $array = array(); - preg_match('/libelle="(.*)" xmlns:d4p1/', $line, $array); - _log($cli . " ErreurAPI ".$array[1], LOG_ERR); - } - } - fclose($fp); - - if ($ligne_numero)// && $ligne_service && $ligne_presel) - { - $situation_key = "$ligne_service / $ligne_presel"; - - $sql = "SELECT date_traitement, situation"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_commande_retour"; - $sql .= " WHERE fk_fournisseur = 4"; - $sql .= " AND cli = '".$ligne_numero."'"; - $sql .= " ORDER BY date_traitement DESC LIMIT 1;"; - - $resql = $db->query($sql); - - if ($resql) - { - $num = $db->num_rows($resql); - $insert = 0; - if ($num == 0) - { - $insert = 1; - } - else - { - $row = $db->fetch_row($resql); - if (trim($row[1]) <> trim($situation_key)) - { - $insert = 1; - } - } - } - else - { - _log("$cli lecture etat de ligne ERREUR", LOG_ERR); - } - - _log("$cli log etat de la ligne", LOG_NOTICE); - if ($insert == 1) - { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_commande_retour"; - - if ($situation_key == 'TRAITE_OK / EN_COURS') - { - $sql .= " (cli,mode,date_traitement,situation,fk_fournisseur,traite) "; - $sql .= " VALUES ('$ligne_numero','PRESELECTION',now(),'$situation_key',4,1);"; - } - elseif ($situation_key == 'ATTENTE / EN_COURS') - { - $sql .= " (cli,mode,date_traitement,situation,fk_fournisseur,traite) "; - $sql .= " VALUES ('$ligne_numero','PRESELECTION',now(),'$situation_key',4,1);"; - } - elseif ($situation_key == 'TRAITE_OK / TRAITE_OK') - { - $sql .= " (cli,mode,date_traitement,situation,fk_fournisseur,traite) "; - $sql .= " VALUES ('$ligne_numero','PRESELECTION',now(),'$situation_key',4,1);"; - } - else - { - $sql .= " (cli,mode,date_traitement,situation,fk_fournisseur) "; - $sql .= " VALUES ('$ligne_numero','PRESELECTION',now(),'$situation_key',4);"; - } - - $resql = $db->query($sql); - - if ($resql) - { - _log("$cli log etat de la ligne SUCCESS", LOG_NOTICE); - - if ($situation_key == 'TRAITE_OK / TRAITE_OK') - { - $ligne = new LigneTel($db); - - if ($ligne->fetch($cli) == 1) - { - if ($ligne->statut == 2) - { - $statut = 3; - $date_mise_service = strftime(time()); - $datea = $db->idate($date_mise_service); - - if ($ligne->set_statut($user, $statut, $datea) <> 0) - { - $error++; - print "ERROR\n"; - } - } - } - else - { - print "Erreur de lecture\n"; - } - } - - if ($situation_key == 'TRAITE_OK / ATTENTE') - { - $ligne = new LigneTel($db); - - if ($ligne->fetch($cli) == 1) - { - if ($ligne->statut == 2) - { - $statut = 7; - $date_mise_service = strftime(time()); - $datea = $db->idate($date_mise_service); - - if ($ligne->set_statut($user, $statut, $datea) <> 0) - { - $error++; - print "ERROR\n"; - } - } - } - else - { - print "Erreur de lecture\n"; - } - } - - } - else - { - _log("$cli log etat de la ligne ERREUR", LOG_ERR); - } - } - else - { - _log("$cli log etat de la ligne IDENTIQUE", LOG_NOTICE); - } - } - else - { - _log("$cli ERREUR impossible de r�cup�rer les infos", LOG_ERR); - } - _log("$cli Fin Traitement ligne", LOG_NOTICE); - } - } -} - -function _log($message, $level) -{ - - if ($level == LOG_ERR) - { - openlog("dolibarr", LOG_PID | LOG_PERROR, LOG_LOCAL3); - } - else - { - openlog("dolibarr", LOG_PID, LOG_LOCAL3); - } - syslog($level, $message); - - closelog(); -} - -?> diff --git a/htdocs/telephonie/script/commande_presel_statut_view.php b/htdocs/telephonie/script/commande_presel_statut_view.php deleted file mode 100644 index 520747c8a47..00000000000 --- a/htdocs/telephonie/script/commande_presel_statut_view.php +++ /dev/null @@ -1,151 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * - * Recup�ration des fichiers CDR - * - */ -require ("../../master.inc.php"); -require_once DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"; - -set_time_limit(0); - -$host = CMD_PRESEL_WEB_HOST; -$user_login = CMD_PRESEL_WEB_USER; -$user_passwd = CMD_PRESEL_WEB_PASS; - -$sql = "SELECT rowid,ligne"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne"; -$sql .= " WHERE fk_fournisseur = 4"; -$sql .= " AND statut = 2;"; - -$resql = $db->query($sql); - -if ($resql) -{ - $ids = array(); - while ($row = $db->fetch_row($resql)) - { - array_push($ids, $row[1]); - } -} -else -{ - exit(1); -} - -GetPreselection_byRef($db, $host, $user_login, $user_passwd, $ids); - -/* - * Fonctions - * - */ - -function GetPreselection_byRef($db, $host, $user_login, $user_passwd, $ids) -{ - $numcli = sizeof($ids); - $i = 0; - - foreach($ids as $cli) - { - $i++; - $fp = @fsockopen($host, 80, $errno, $errstr, 30); - if (!$fp) - { - print "Impossible de se connecter au server $errstr ($errno)"; - } - else - { - $ligne_numero = ""; - $ligne_service = ""; - $ligne_presel = ""; - - //GetPreselection_byRef - $url = "/AzurApp_websvc_b3gdb/account.asmx/GetPreselection_byRef?"; - - $url .= "user_login=". $user_login; - $url .= "&user_passwd=".$user_passwd; - $url .= "&telnum=".$cli; - - $out = "GET $url HTTP/1.1\r\n"; - $out .= "Host: $host\r\n"; - $out .= "Connection: Close\r\n\r\n"; - - if (fwrite($fp, $out) ) - { - while (!feof($fp)) - { - $line = fgets($fp, 1024); - - if (preg_match("//",$line)) - { - $results = explode(" ",trim($line)); - //print_r($results); - - $array = array(); - preg_match('/telnum="([0123456789]*)"/', $line, $array); - $ligne_numero = $array[1]; - - $array = array(); - preg_match('/ServiceActive="([\S]*)"/i', $line, $array); - $service_active = $array[1]; - - $array = array(); - preg_match('/PreSelectionActive="([\S]*)"/i', $line, $array); - $presel_active = $array[1]; - - $array = array(); - preg_match('/Service_Statut="([\S]*)"/i', $line, $array); - $ligne_service = $array[1]; - - $array = array(); - preg_match('/PreSelection_Statut="([\S]*)"/i', $line, $array); - $ligne_presel = $array[1]; - - print "$i/$numcli "; - print $ligne_numero." "; - print "$service_active/$presel_active "; - print substr($ligne_service.str_repeat(" ",20),0,20); - print substr($ligne_presel.str_repeat(" ",20),0,20); - print "\n"; - } - - if (preg_match("//",$line)) - { - $array = array(); - preg_match('/libelle="(.*)" xmlns:d4p1/', $line, $array); - - print "$i/$numcli "; - print "$cli ErreurAPI ".$array[1]."\n"; - } - } - } - else - { - print "Impossible d'ecrire sur la socket\n"; - print "Host : $host\n"; - print "URL : $url\n"; - } - fclose($fp); - } - } -} - -?> diff --git a/htdocs/telephonie/script/commission.php b/htdocs/telephonie/script/commission.php deleted file mode 100644 index 3ad1143d52e..00000000000 --- a/htdocs/telephonie/script/commission.php +++ /dev/null @@ -1,653 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * Calcul des commissions des distributeurs - */ - -require ("../../master.inc.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/distributeurtel.class.php"); - -$error = 0; -$nbcommit = 0; -$datetime = time(); -$space = str_repeat(" ",28); -$user = new User($db, 1); -$user->login = "Rodo"; - -$opt = getopt("m:"); - -if ($opt['m'] > 0) -{ - $datetime = mktime(10,10,10,$opt['m'],10,2005); -} - -$date = strftime("%d%h%Y%Hh%Mm%S",$datetime); - -/* - * On facture les communications du mois précédent - */ - -$month = strftime("%m", $datetime); -$year = strftime("%Y", $datetime); - -if ($month == 1) -{ - $month_prev = "12"; - $year_prev = $year - 1; -} -else -{ - $month_prev = $month - 1; - $year_prev = $year ; -} - -$month_prev = substr("00".$month_prev, -2) ; - - -$dir = DOL_DATA_ROOT.'/telephonie/log/'; -if (!file_exists($dir)) - create_dir($dir); - -$dir = DOL_DATA_ROOT.'/telephonie/log/commission/'; -if (!file_exists($dir)) - create_dir($dir); - -function create_dir($dir) -{ - if (! file_exists($dir)) - { - umask(0); - if (! @mkdir($dir, 0755)) - { - die ("Erreur: Le répertoire ".$dir." n'existe pas et Dolibarr n'a pu le créer."); - } - } -} - -if (! $db->begin()) die ; - -$fp = fopen($dir."/$month.$year.log","w+"); -fputs($fp,"Commissions $month/$year\n"); -/******************************************************** - * - * Verification des données - * - * - *********************************************************/ - -$distributeurs = array(); - -$sql = "SELECT distinct fk_distributeur"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat_priseordre"; -$sql .= " WHERE fk_distributeur <> 0"; - -$resql = $db->query($sql); - -if ( $resql ) -{ - while ($row = $db->fetch_row($resql)) - { - array_push($distributeurs, $row[0]); - } - $db->free($resql); -} -else -{ - $error = 1; - dol_syslog("Verification Erreur ".$error); -} - -/******************************************************** - * - * Calcul des avances - * - * - ********************************************************/ -dol_syslog("Calcul avance"); -$sql = "SELECT rowid, fk_distributeur, fk_contrat, datepo, montant"; -$sql .= " , avance_pourcent, rem_pour_prev, rem_pour_autr, mode_paiement"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat_priseordre"; -$sql .= " WHERE date_format(datepo, '%Y%m') = '".$year_prev.$month_prev."'"; -$sql .= " AND fk_distributeur > 0"; - -$resql = $db->query($sql); - -if ( $resql ) -{ - $num = $db->num_rows($resql); - $i = 0; - - while ($i < $num) - { - $obj = $db->fetch_object($resql); - - if ($obj->mode_paiement == 'pre') - { - $pourcent = $obj->rem_pour_prev; - } - else - { - $pourcent = $obj->rem_pour_autr; - } - $avance_pourcent = $obj->avance_pourcent; - - $avance = $obj->montant * 12 * $avance_pourcent * $pourcent; - - $avance = round($avance * 0.0001, 2); - - fputs($fp, "DIS : ".$obj->fk_distributeur); - fputs($fp, " av avance po ".substr($space.$obj->rowid,-4)); - fputs($fp, " : ".substr($space.$avance,-8)."\n"); - - $sqli = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_commission_avance"; - $sqli .= " (date, fk_distributeur, fk_po,fk_contrat, montant, pourcentage, avance)"; - $sqli .= " VALUES ('".$year_prev.$month_prev."'"; - $sqli .= ",".$obj->fk_distributeur.",".$obj->rowid.",".$obj->fk_contrat; - $sqli .= ",".ereg_replace(",",".",$avance); - $sqli .= ",".ereg_replace(",",".",$pourcent); - $sqli .= ",1)"; - - if (! $db->query($sqli)) - { - $error = 2; - dol_syslog("Calcul avance Erreur "); - dol_syslog($db->error()); - dol_syslog("$sqli"); - } - - $i++; - } - $db->free($resql); -} -else -{ - $error = 3; - dol_syslog("Erreur ".$db->error()); -} - - -/******************************************************** - * - * Calculs des commissions basées sur les consommations - * - * - *********************************************************/ - -$sql = "SELECT p.rowid, p.fk_contrat, p.fk_distributeur"; -$sql .= " , p.avance_pourcent, p.rem_pour_prev, p.rem_pour_autr"; -$sql .= " , p.avance_duree, p.mode_paiement"; -$sql .= " , date_format(p.datepo + INTERVAL p.avance_duree MONTH, '%Y%m') as date_regul"; -$sql .= " , f.cout_vente,l.rowid as ligne"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat_priseordre as p"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_contrat as c"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_facture as f"; - -$sql .= " WHERE p.fk_contrat = c.rowid"; -$sql .= " AND l.fk_contrat = c.rowid"; -$sql .= " AND f.fk_ligne = l.rowid"; -$sql .= " AND date_format(f.date, '%Y%m') = '".$year_prev.$month_prev."'"; -$sql .= " AND date_format(p.datepo, '%Y%m') <= '".$year_prev.$month_prev."'"; -$sql .= " AND fk_distributeur > 0"; - -$resql = $db->query($sql); -//print $sql; -if ( $resql ) -{ - $num = $db->num_rows($resql); - $i = 0; - - while ($i < $num) - { - $obj = $db->fetch_object($resql); - - if ($obj->mode_paiement == 'pre') - { - $pourcent = $obj->rem_pour_prev; - } - else - { - $pourcent = $obj->rem_pour_autr; - } - - $comm = round($obj->cout_vente * $pourcent * 0.01, 2) ; - - $sqli = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_commission_conso"; - $sqli .= " (date, fk_distributeur, fk_contrat, fk_ligne, montant, pourcentage, avance)"; - $sqli .= " VALUES ('".$year_prev.$month_prev."'"; - $sqli .= ",".$obj->fk_distributeur.",".$obj->fk_contrat.",".$obj->ligne; - $sqli .= ",".ereg_replace(",",".",$comm); - $sqli .= ",".ereg_replace(",",".",$pourcent); - - if ($obj->date_regul < $year_prev.$month_prev) - { - $sqli .= ",0)"; - $avan = 0; - } - else - { - $sqli .= ",1)"; - $avan = 1; - } - - fputs($fp, "DIS : ".$obj->fk_distributeur); - fputs($fp, " CON : ".$obj->fk_contrat); - fputs($fp, " REM : ".$pourcent."%"); - fputs($fp, " conso : $comm avance $avan\n"); - - if (! $db->query($sqli)) - { - $error = 4; - dol_syslog("Calcul conso Erreur"); - dol_syslog($db->error()); - dol_syslog("$sqli"); - } - - //dol_syslog("Conso po : ".$obj->rowid . " ".$comm); - - $i++; - } - $db->free($resql); -} -else -{ - $error = 5; - dol_syslog("Erreur ".$db->error()); -} - -/******************************************************** - * - * Régulation sur contrats annulés - * - * - *********************************************************/ - - -/******************************************************** - * - * Régulation des avances - * - * - *********************************************************/ -$distri_av = array(); - -$sql = "SELECT distinct fk_distributeur"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_commission_avance"; -$sql .= " WHERE fk_distributeur <> 0"; - -$resql = $db->query($sql); - -if ( $resql ) -{ - while ($row = $db->fetch_row($resql)) - { - array_push($distri_av, $row[0]); - } - $db->free($resql); -} -else -{ - $error = 6; - dol_syslog("Erreur regul avances ".$error); -} - -$avan_regul = array(); -$comm_regul = array(); - -foreach ($distri_av as $distributeur_id) -{ - $avan_regul[$distributeur_id] = 0; - $comm_regul[$distributeur_id] = 0; - - $sqla = "SELECT rowid, ".$db->pdate("datepo").", avance_duree"; - $sqla .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat_priseordre"; - $sqla .= " WHERE fk_distributeur = ".$distributeur_id; - $sqla .= " AND date_format(datepo + INTERVAL avance_duree MONTH, '%Y%m')='".$year_prev.$month_prev."';"; - - $resqla = $db->query($sqla); - - if ( $resqla ) - { - $numa = $db->num_rows($resqla); - $ia = 0; - - while ($ia < $numa) - { - $rowa = $db->fetch_row($resqla); - dol_syslog("* Regul des avances de la po " .$rowa[0] . " ".strftime("%Y%m",$rowa[1])); - $ia++; - - /* Calcul des sommes avancées */ - $sql = "SELECT a.montant, a.fk_contrat, c.statut"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_commission_avance as a"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_contrat as c"; - $sql .= " WHERE a.fk_distributeur = ".$distributeur_id; - $sql .= " AND c.rowid = a.fk_contrat"; - $sql .= " AND a.fk_po = ".$rowa[0]; - - $resql = $db->query($sql); - - if ( $resql ) - { - $num = $db->num_rows($resql); - dol_syslog("* Regul des avances de la po ".$rowa[0]." ".strftime("%Y%m",$rowa[1]).", $num avances"); - $i = 0; - while ($i < $num) - { - $row = $db->fetch_row($resql); - - $avan_regul[$distributeur_id] = $avan_regul[$distributeur_id] + $row[0]; - - fputs($fp, "DIS : ".$distributeur_id); - fputs($fp, " av regul po ".substr($space.$rowa[0],-4)); - fputs($fp, " : ".substr($space.$row[0],-8)."\n"); - - $sqlir = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_commission_regul"; - $sqlir .= " (date, fk_distributeur, fk_contrat, montant, type)"; - $sqlir .= " VALUES ('".$year_prev.$month_prev."'"; - $sqlir .= ",'".$distributeur_id."','".$row[1]; - $sqlir .= "','-".ereg_replace(",",".",$row[0]); - $sqlir .= "','avan')"; - $resqlir = $db->query($sqlir); - if (!$resqlir) - { - $error = 32; - dol_syslog("Erreur insertion regul avances (error $error)"); - dol_syslog($sqlir); - } - - dol_syslog("* Avance ".$row[0] . " statut : ".$row[2]); - - /* Communications relatives */ - $datup = $year_prev.$month_prev; - $datdo = strftime("%Y%m",$rowa[1]); - if ($row[2] <> 6) - { - dol_syslog("* Communications <= $datup >= $datdo "); - $sqlc = "SELECT sum(montant)"; - $sqlc .= " FROM ".MAIN_DB_PREFIX."telephonie_commission_conso"; - $sqlc .= " WHERE fk_contrat = ". $row[1]; - $sqlc .= " AND date <= '".$datup."' AND date >= '".$datdo."'"; - - $resqlc = $db->query($sqlc); - - if ( $resqlc ) - { - while ($rowc = $db->fetch_row($resqlc)) - { - $comm_regul[$distributeur_id] = $comm_regul[$distributeur_id] + $rowc[0]; - dol_syslog("* Conso générée ".$rowc[0]); - - $sqlir = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_commission_regul"; - $sqlir .= " (date, fk_distributeur, fk_contrat, montant, type)"; - $sqlir .= " VALUES ('".$year_prev.$month_prev."'"; - $sqlir .= ",'".$distributeur_id."','".$row[1]; - $sqlir .= "','".ereg_replace(",",".",$rowc[0]); - $sqlir .= "','comm')"; - $resqlir = $db->query($sqlir); - if (!$resqlir) - { - $error = 31; - dol_syslog("Erreur insertion regul avances conso (error $error)"); - dol_syslog($sqlir); - } - } - $db->free($resqlc); - } - else - { - $error = 10; - dol_syslog("Erreur regul avances conso ".$error); - } - } - else - { - /* - * Contrats résiliés - * - */ - fputs($fp, "DIS : ".$obj->fk_distributeur); - fputs($fp, " CON : ".$row[1] . " ANNULE\n"); - - $sqlc = "UPDATE ".MAIN_DB_PREFIX."telephonie_commission_conso"; - $sqlc .= " SET annul = '".$year_prev.$month_prev."'"; - $sqlc .= " WHERE fk_contrat = ".$row[1]; - $sqlc .= " AND date <= '".$datup."' AND date >= '".$datdo."'"; - - $resqlc = $db->query($sqlc); - - if (! $resqlc ) - { - $error = 11; - dol_syslog("Erreur regul avances conso ".$error); - } - } - - $i++; - } - $db->free($resql); - } - else - { - $error = 12; - dol_syslog("Erreur regul avances ".$db->error()); - } - } - } - else - { - $error = 13; - dol_syslog("Erreur regul avances aaaa".$db->error()); - dol_syslog($sqla); - } -} - -/******************************************************** - * - * Calcul des consos - * - * - *********************************************************/ -$distri_co = array(); - -$sql = "SELECT distinct fk_distributeur"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_commission_conso"; -$sql .= " WHERE fk_distributeur <> 0"; - -$resql = $db->query($sql); - -if ( $resql ) -{ - while ($row = $db->fetch_row($resql)) - { - array_push($distri_co, $row[0]); - } - $db->free($resql); -} -else -{ - $error = 14; - dol_syslog("Erreur calcul des commission sur conso ".$error); -} - -$comm_conso = array(); - -foreach ($distri_co as $distributeur_id) -{ - $comm_conso[$distributeur_id] = 0; - - $sqla = "SELECT rowid, ".$db->pdate("datepo").", fk_contrat"; - $sqla .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat_priseordre"; - $sqla .= " WHERE fk_distributeur = ".$distributeur_id; - $sqla .= " AND date_format(datepo + INTERVAL avance_duree MONTH, '%Y%m')<'".$year_prev.$month_prev."';"; - - $resqla = $db->query($sqla); - - if ( $resqla ) - { - $numa = $db->num_rows($resqla); - $ia = 0; - - while ($ia < $numa) - { - $rowa = $db->fetch_row($resqla); - dol_syslog("** Calcul des consos po " .$rowa[0] . " ".strftime("%Y%m",$rowa[1])); - $ia++; - - /* Communications relatives */ - - $datup = $year_prev.$month_prev; - - dol_syslog("** Communications $datup"); - - $sqlc = "SELECT sum(montant)"; - $sqlc .= " FROM ".MAIN_DB_PREFIX."telephonie_commission_conso"; - $sqlc .= " WHERE fk_contrat = ". $rowa[2]; - $sqlc .= " AND date = '".$datup."';"; - - $resqlc = $db->query($sqlc); - - if ( $resqlc ) - { - if ( $rowc = $db->fetch_row($resqlc) ) - { - $comm_conso[$distributeur_id] = $comm_conso[$distributeur_id] + $rowc[0]; - dol_syslog("** Conso générée ".$rowc[0]); - } - else - { - $error = 151; - dol_syslog("Erreur regul conso"); - } - $db->free($resqlc); - } - else - { - $error = 15; - dol_syslog("Erreur regul conso"); - } - } - } - else - { - $error = 16; - dol_syslog("Erreur regul conso".$db->error()); - dol_syslog($sqla); - } -} - -/******************************************************** - * - * - * - ********************************************************/ - -foreach ($distributeurs as $distributeur_id) -{ - $distributeur = new DistributeurTelephonie($db); - $distributeur->fetch($distributeur_id); - - dol_syslog($distributeur->nom . " : ".$month_prev."-".$year_prev); - - $amount = 0; - - $amount = $amount + $comm_regul[$distributeur_id]; - $amount = $amount - $avan_regul[$distributeur_id]; - $amount = $amount + $comm_conso[$distributeur_id]; - - fputs($fp, "DIS : ".$distributeur_id); - fputs($fp, " ".str_repeat("-",35)."\n"); - - fputs($fp, "DIS : ".$distributeur_id); - fputs($fp, " Comm Regul : ".substr($space.$comm_regul[$distributeur_id],-15)."\n"); - - fputs($fp, "DIS : ".$distributeur_id); - fputs($fp, " Comm Conso : ".substr($space.$comm_conso[$distributeur_id],-15)."\n"); - - /******************************************************** - * - * Somme des commissions - * - * - *********************************************************/ - - $sql = "SELECT sum(montant)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_commission_avance"; - $sql .= " WHERE fk_distributeur = ".$distributeur->id; - $sql .= " AND date = '".$year_prev.$month_prev."';"; - - $resql = $db->query($sql); - - if ( $resql ) - { - if ($row = $db->fetch_row($resql)) - { - fputs($fp, "DIS : ".$distributeur_id); - fputs($fp, " Avances : ".substr($space.$row[0],-15)."\n"); - - fputs($fp, "DIS : ".$distributeur_id); - fputs($fp, " Avan Regul : ".substr($space."-".$avan_regul[$distributeur_id],-15)."\n"); - - $amount = $amount + $row[0]; - /* commission finale */ - $sqli = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_commission"; - $sqli .= " (date, fk_distributeur, montant)"; - $sqli .= " VALUES ('".$year_prev.$month_prev."'"; - $sqli .= ",".$distributeur->id; - $sqli .= ",".ereg_replace(",",".",$amount).")"; - - if (! $db->query($sqli)) - { - $error = 17; - dol_syslog("Erreur insertion Commission finale"); - } - - dol_syslog("Commission finale ".$amount); - - fputs($fp, "DIS : ".$distributeur_id); - fputs($fp, " Comm final : ".substr($space.$amount,-15)."\n"); - } - else - { - $error = 18; - dol_syslog("Erreur lecture avances"); - } - $db->free($resql); - } - else - { - $error = 19; - dol_syslog("Erreur ".$error); - } -} - -if ($error == 0) -{ - $db->commit(); - dol_syslog("Commit"); -} -else -{ - $db->rollback(); - dol_syslog("Rollback", LOG_ERR); -} -dol_syslog("----------------"); -fclose($fp); -?> diff --git a/htdocs/telephonie/script/cron/index.php b/htdocs/telephonie/script/cron/index.php deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/telephonie/script/cron/presel-resiliation.php b/htdocs/telephonie/script/cron/presel-resiliation.php deleted file mode 100644 index a28a78ab6b1..00000000000 --- a/htdocs/telephonie/script/cron/presel-resiliation.php +++ /dev/null @@ -1,194 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * - * Resiliation de lignes par API - * - */ -require ("../../../master.inc.php"); -require_once DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"; - -$verbose = 0; - -for ($i = 1 ; $i < sizeof($argv) ; $i++) -{ - if ($argv[$i] == "-v") - { - $verbose = 1; - } - if ($argv[$i] == "-vv") - { - $verbose = 2; - } - if ($argv[$i] == "-vvv") - { - $verbose = 3; - } -} - - -$user = new User($db); -$user->id = 1; // C'est sale je sais ! - -$host = CMD_PRESEL_WEB_HOST; -$user_login = CMD_PRESEL_WEB_USER; -$user_passwd = CMD_PRESEL_WEB_PASS; -$user_contract = CMD_PRESEL_WEB_CONTRACT; - -/* - * Lecture des lignes a r販lier - * - */ -$sql = "SELECT s.nom, s.rowid as socid, s.address, s.cp, s.ville"; -$sql .= ", l.ligne, l.statut, l.rowid"; - -$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_fournisseur as f"; -$sql .= " WHERE l.fk_soc = s.rowid AND l.fk_fournisseur = f.rowid"; -$sql .= " AND f.rowid = 4 AND l.statut = 4 ORDER BY s.rowid ASC"; - -$resql = $db->query($sql); -$result = 1; -if ($resql) -{ - $i = 0; - $num = $db->num_rows($resql); - - while ($i < $num) - { - $obj = $db->fetch_object($resql); - - $result = ResiliationPreselection($db, $user, $host, $user_login, $user_passwd, $obj->ligne, $num_abo, $verbose); - - if ($result == 0) - { - $lint = new LigneTel($db); - $lint->fetch_by_id($obj->rowid); - if ($lint->statut == 4) - { - $lint->set_statut($user, 5); - } - } - - $i++; - } -} - -function ResiliationPreselection($db, $user, $host, $user_login, $user_passwd, $ligne_num, $id_person, $verbose) -{ - if ($verbose) - dol_syslog("Appel de DeletePreselection($host, $user_login, ****, $ligne_num, $id_person)"); - - $url = "/AzurApp_websvc_b3gdb/account.asmx/UpdatePreselection?"; - - $url .= "user_login=". $user_login; - $url .= "&user_passwd=".$user_passwd; - $url .= "&telnum=".$ligne_num; - $url .= "&okCollecte=false"; - $url .= "&okPreselection=false"; - - if ($verbose > 2) - dol_syslog("$host"); - - if ($verbose > 2) - dol_syslog("$url"); - - $fp = fsockopen($host, 80, $errno, $errstr, 30); - if (!$fp) - { - dol_syslog("$errstr ($errno)"); - } - else - { - if ($verbose > 2) - dol_syslog("Socket Opened send data"); - - $out = "GET $url HTTP/1.1\r\n"; - $out .= "Host: $host\r\n"; - $out .= "Connection: Close\r\n\r\n"; - - fwrite($fp, $out); - - if ($verbose > 2) - dol_syslog("Data sent, waiting for response"); - - $parse = 0; - $result = "error"; - - $fresult = ""; - - while (!feof($fp)) - { - $line = fgets($fp, 1024); - - if ($verbose > 2) - dol_syslog($line); - - if ($parse == 1) - { - preg_match('/^(.*)<\/string>$/', $line, $results); - - $result = $results[1]; - //dol_syslog($line); - $parse = 0; - } - - if (substr($line,0,38) == '') - { - $parse = 1; - } - - $fresult .= $line; - - } - fclose($fp); - } - - if ($verbose > 1) - dol_syslog("result = ".$result); - - if (substr($result,0,2) == "OK") - { - if ($verbose) - dol_syslog("Resiliation rè´³sie ligne ".$ligne_num." id client ".$id_person." $result\n"); - - $ligne = new LigneTel($db); - $ligne->fetch($ligne_num); - $ligne->set_statut($user, 5,'','cron', 4); - - return 0; - } - else - { - dol_syslog("Resiliation 袨ou裠ligne ".$ligne_num." id client ".$id_person." $result\n"); - - $fp = fopen("/tmp/$ligne.delete","w"); - if ($fp) - { - fwrite($fp, $fresult); - fclose($fp); - } - - return -1; - } -} - -?> diff --git a/htdocs/telephonie/script/delete_presel.php b/htdocs/telephonie/script/delete_presel.php deleted file mode 100644 index 493053df067..00000000000 --- a/htdocs/telephonie/script/delete_presel.php +++ /dev/null @@ -1,186 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * - * Commandes des lignes par API - * - */ -require ("../../master.inc.php"); -require_once DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"; - -$verbose = 0; - -for ($i = 1 ; $i < sizeof($argv) ; $i++) -{ - if ($argv[$i] == "-v") - { - $verbose = 1; - } - if ($argv[$i] == "-vv") - { - $verbose = 2; - } - if ($argv[$i] == "-vvv") - { - $verbose = 3; - } -} - - -$user = new User($db); -$user->id = 1; // C'est sale je sais ! - -$host = CMD_PRESEL_WEB_HOST; -$user_login = CMD_PRESEL_WEB_USER; -$user_passwd = CMD_PRESEL_WEB_PASS; -$user_contract = CMD_PRESEL_WEB_CONTRACT; - -/* - * Lecture des lignes a r販lier - * - */ -$sql = "SELECT s.nom, s.rowid as socid, s.address, s.cp, s.ville"; -$sql .= ", l.ligne, l.statut, l.rowid"; - -$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_fournisseur as f"; -$sql .= " WHERE l.fk_soc = s.rowid AND l.fk_fournisseur = f.rowid"; -$sql .= " AND f.rowid = 4 AND l.statut = 4 ORDER BY s.rowid ASC"; - -$resql = $db->query($sql); -$result = 1; -if ($resql) -{ - $i = 0; - $num = $db->num_rows($resql); - - while ($i < $num) - { - $obj = $db->fetch_object($resql); - - $result = DeletePreselection($host, $user_login, $user_passwd, $obj->ligne, $num_abo); - - if ($result == 0) - { - $lint = new LigneTel($db); - $lint->fetch_by_id($obj->rowid); - if ($lint->statut == 4) - { - $lint->set_statut($user, 5); - } - } - - $i++; - } -} - -function DeletePreselection($host, $user_login, $user_passwd, $ligne, $id_person) -{ - global $verbose; - //dol_syslog("Appel de DeletePreselection($host, $user_login, ****, $ligne, $id_person)"); - - $url = "/AzurApp_websvc_b3gdb/account.asmx/DeletePreselection?"; - - $url .= "user_login=". $user_login; - $url .= "&user_passwd=".$user_passwd; - $url .= "&telnum=".$ligne; - - if ($verbose > 2) - dol_syslog("$host"); - - if ($verbose > 2) - dol_syslog("$url"); - - $fp = fsockopen($host, 80, $errno, $errstr, 30); - if (!$fp) - { - dol_syslog("$errstr ($errno)"); - } - else - { - if ($verbose > 2) - dol_syslog("Socket Opened send data"); - - $out = "GET $url HTTP/1.1\r\n"; - $out .= "Host: $host\r\n"; - $out .= "Connection: Close\r\n\r\n"; - - fwrite($fp, $out); - - if ($verbose > 2) - dol_syslog("Data sent, waiting for response"); - - $parse = 0; - $result = "error"; - - $fresult = ""; - - while (!feof($fp)) - { - $line = fgets($fp, 1024); - - if ($verbose > 2) - dol_syslog($line); - - if ($parse == 1) - { - preg_match('/^(.*)<\/string>$/', $line, $results); - - $result = $results[1]; - //dol_syslog($line); - $parse = 0; - } - - if (substr($line,0,38) == '') - { - $parse = 1; - } - - $fresult .= $line; - - } - fclose($fp); - } - - if ($verbose > 1) - dol_syslog("result = ".$result); - - if (substr($result,0,2) == "OK") - { - dol_syslog("Delete rè´³si ligne ".$ligne." id client ".$id_person." $result\n"); - return 0; - } - else - { - dol_syslog("Delete 袨ou矬igne ".$ligne." id client ".$id_person." $result\n"); - - $fp = fopen("/tmp/$ligne.delete","w"); - if ($fp) - { - fwrite($fp, $fresult); - fclose($fp); - } - - return -1; - } -} - -?> diff --git a/htdocs/telephonie/script/envoi-emails-speciaux.php b/htdocs/telephonie/script/envoi-emails-speciaux.php deleted file mode 100644 index f2414ed2370..00000000000 --- a/htdocs/telephonie/script/envoi-emails-speciaux.php +++ /dev/null @@ -1,283 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * - * Envoie les factures par emails pour un client special - * Scrip non générique utilisé par Rodolphe pour un besoin spécifique - * - */ - -require ("../../master.inc.php"); - -require_once (DOL_DOCUMENT_ROOT."/compta/prelevement/bon-prelevement.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/facturetel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/telephonie-tarif.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/communication.class.php"); -require_once (DOL_DOCUMENT_ROOT."/facture.class.php"); -require_once (DOL_DOCUMENT_ROOT."/societe.class.php"); -require_once (DOL_DOCUMENT_ROOT."/paiement.class.php"); -require_once (DOL_DOCUMENT_ROOT."/contrat/contrat.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/pdfdetail_ibreizh.modules.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/dolibarrmail.class.php"); - -dol_syslog("Debut envoie de mail"); - -$clientid = 52; -$contactid = 151; - -$year = "2005"; -$month = "02"; - -$emails = array(); -$factures_a_mailer = array(); -$factures_lignes = array(); - -/* - * Lecture de l'email - */ -$sql = "SELECT sc.email FROM "; -$sql .= MAIN_DB_PREFIX."socpeople as sc"; -$sql .= " WHERE sc.rowid = ".$contactid; - -$resql = $db->query($sql); - -if ($resql) -{ - $row = $db->fetch_row($resql); - dol_syslog($row[0]); - - array_push($emails, $row[0]); - - $db->free($resql); -} -else -{ - print $db->error(); -} -/* - * Lecture des factures - * - */ -$sql = "SELECT distinct(f.fk_facture) FROM "; -$sql .= MAIN_DB_PREFIX."telephonie_facture as f"; -$sql .= " , ".MAIN_DB_PREFIX."societe as s"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; - -$sql .= " WHERE s.rowid = l.fk_client_comm"; -$sql .= " AND f.fk_facture IS NOT NULL"; -$sql .= " AND l.rowid = f.fk_ligne"; -$sql .= " AND s.rowid = ".$clientid; -$sql .= " AND date_format(date,'%Y%m') = ".$year.$month; -$sql .= " ORDER BY f.fk_facture ASC"; - -$resql = $db->query($sql); - -if ($resql) -{ - $num = $db->num_rows($resql); - $i = 0; - dol_syslog($num . " Factures"); - - while ($i < $num) - { - $row = $db->fetch_row($resql); - - $factures_a_mailer[$i] = $row[0]; - - $i++; - } - -} -else -{ - print $db->error(); -} - -/* - * Association lignes / factures - * - */ -$sql = "SELECT f.fk_facture, f.fk_ligne FROM "; -$sql .= MAIN_DB_PREFIX."telephonie_facture as f"; -$sql .= " , ".MAIN_DB_PREFIX."societe as s"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; - -$sql .= " WHERE s.rowid = l.fk_client_comm"; -$sql .= " AND f.fk_facture IS NOT NULL"; -$sql .= " AND l.rowid = f.fk_ligne"; -$sql .= " AND s.rowid = ".$clientid; -$sql .= " AND date_format(date,'%Y%m') = ".$year.$month; -$sql .= " ORDER BY f.fk_facture ASC"; - -$resql = $db->query($sql); - -if ($resql) -{ - $num = $db->num_rows($resql); - $i = 0; - dol_syslog($num . " Factures"); - - while ($i < $num) - { - $row = $db->fetch_row($resql); - - $factures_lignes[$row[0]] = $row[1]; - $i++; - } -} -else -{ - print $db->error(); -} - - - -/* - * - */ - -if (sizeof($factures_a_mailer) > 0) -{ - for ($i = 0 ; $i < sizeof($factures_a_mailer) ; $i++) - { - $fact = new Facture($db); - - dol_syslog("Facture ".$factures_a_mailer[$i]); - dol_syslog("ligne ".$factures_lignes[$factures_a_mailer[$i]]); - - if ($fact->fetch($factures_a_mailer[$i]) == 1) - { - - $ligne = new LigneTel($db); - $ligne->fetch_by_id($factures_lignes[$factures_a_mailer[$i]]); - - if (sizeof($emails > 0)) - { - $sendto = ""; - for ($k = 0 ; $k < sizeof($emails) ; $k++) - { - $sendto .= html_entity_decode($emails[$k]) . ","; - } - $sendto = substr($sendto,0,strlen($sendto) - 1); - - dol_syslog("Envoi email à ".html_entity_decode($sendto) ); - - - $subject = "Facture ibreizh "; - $subject .= "(".$ligne->code_analytique.") "; - $subject .= "$fact->ref"; - - $from = TELEPHONIE_EMAIL_FACTURATION_EMAIL; - - $message = "Bonjour,\n\n"; - $message .= "Code Agence : ".$ligne->code_analytique."\n"; - $message .= "Veuillez trouver ci-joint notre facture numéro $fact->ref du ".strftime("%d/%m/%Y",$fact->date)."."; - - $message .= "\nEgalement joint à ce mail le détails de vos communications."; - - $message .= "\n\nCordialement,"; - $message .= "\n\n--"; - $message .= "\niBreizh"; - $message .= "\n106 Avenue de la Marne 56000 Vannes"; - $message .= "\nTél : 0811 60 23 13"; - $message .= "\nFax : 02 97 46 80 19"; - - - $mailfile = new DolibarrMail($subject, - $sendto, - $from, - $message); - - $mailfile->addr_bcc = TELEPHONIE_EMAIL_FACTURATION_EMAIL; - - $arr_file = array(); - $arr_name = array(); - $arr_mime = array(); - - $facfile = FAC_OUTPUTDIR . "/" . $fact->ref . "/" . $fact->ref . ".pdf"; - - /* - * Join la facture - */ - array_push($arr_file, $facfile); - array_push($arr_mime, "application/pdf"); - array_push($arr_name, $fact->ref.".pdf"); - - - - $dir = FAC_OUTPUTDIR . "/" . $fact->ref . "/"; - - $handle=opendir(FAC_OUTPUTDIR . "/" . $fact->ref . "/"); - /* - * Joint les détails - * - */ - while (($file = readdir($handle))!==false) - { - if (is_readable($dir.$file) && substr($file, -11) == '-detail.pdf') - { - array_push($arr_file, $dir.$file); - array_push($arr_mime, "application/pdf"); - array_push($arr_name, $file); - } - } - - $mailfile->PrepareFile($arr_file, $arr_mime, $arr_name); - - if ( $mailfile->sendfile() ) - { - - for ($kj = 0 ; $kj < sizeof($emails) ; $kj++) - { - $sendtoid = $contactid; - - $sendtox = $emails[$kj]; - - $actioncode=9; - $actionmsg="Envoyée à $sendtox"; - $actionmsg2="Envoi Facture par mail"; - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm (datea,fk_action,fk_soc,note,fk_facture, fk_contact,fk_user_author, label, percent) VALUES (now(), '$actioncode' ,'$fact->socid' ,'$actionmsg','$fact->id','$sendtoid','$user->id', '$actionmsg2',100);"; - - if (! $db->query($sql) ) - { - print $db->error(); - } - else - { - //print "TOTO".$sendto. " ". $sendtoid ." \n"; - } - - } - - } - } - else - { - print "Aucun email trouvé\n"; - dol_syslog("import.php aucun email trouvé"); - } - } - } -} - - -?> diff --git a/htdocs/telephonie/script/etude-facturation.php b/htdocs/telephonie/script/etude-facturation.php deleted file mode 100644 index 1e5c41821ff..00000000000 --- a/htdocs/telephonie/script/etude-facturation.php +++ /dev/null @@ -1,102 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * - * Script de facturation - * Verification des factures négatives - * - */ - -/** - \file htdocs/telephonie/script/facturation-analyse.php - \ingroup telephonie - \brief Analyse de la facturation - \version $Revision$ -*/ - - -require ("../../master.inc.php"); - -/* - * - */ - -$datetime = time(); -$date = strftime("%d%h%Y%Hh%Mm%S",$datetime); -$month = strftime("%m", $datetime); -$year = strftime("%Y", $datetime); - -if ($month == 1) -{ - $month = "12"; - $year = $year - 1; -} -else -{ - $month = substr("00".($month - 1), -2) ; -} - -$sql = "SELECT fk_tarif, fk_client, temporel, fixe, fk_user, datec "; -$sql .= " FROM llx_telephonie_tarif_client_log"; -$sql .= " WHERE date_format(datec,'%m%Y')='".$month.year."'"; -$sql .= " ORDER BY datec ASC;"; - -$re2sql = $db->query($sql) ; - -if ( $re2sql ) -{ - $nu2m = $db->num_rows($re2sql); - print "$nu2m tarifs modifiés\n"; - $j = 0; - while ($j < $nu2m) - { - $row = $db->fetch_row($re2sql); - - $sqli = "SELECT fk_tarif, fk_client, temporel, fixe, fk_user, datec "; - $sqli .= " FROM llx_telephonie_tarif_client_log"; - $sqli .= " WHERE fk_tarif = ".$row[0]; - $sqli .= " AND fk_client = ".$row[1]; - $sqli .= " ORDER BY datec ASC"; - - $resqli = $db->query($sqli) ; - - if ($resqli ) - { - $numi = $db->num_rows($resqli); - if ($numi > 2) - { - while ( $rowi = $db->fetch_row($resqli)) - { - print $rowi[0]." ".$rowi[2]."\n"; - } - } - } - - $j++; - } -} -else -{ - print $db->error(); -} - - -$db->close(); -?> diff --git a/htdocs/telephonie/script/facturation-alerte.php b/htdocs/telephonie/script/facturation-alerte.php deleted file mode 100644 index d787f7c79f6..00000000000 --- a/htdocs/telephonie/script/facturation-alerte.php +++ /dev/null @@ -1,322 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * - * Script de facturation - * Verification des factures négatives - * - */ - -/** - \file htdocs/telephonie/script/facturation-emission.php - \ingroup telephonie - \brief Emission des factures - \version $Revision$ -*/ - - -require ("../../master.inc.php"); - -$opt = getopt("l:c:"); - -$limit = $opt['l']; -$optcontrat = $opt['c']; - -require_once (DOL_DOCUMENT_ROOT."/societe.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/dolibarrmail.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/facturetel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/telephonie.contrat.class.php"); -require_once (DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_workbook.inc.php"); -require_once (DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_worksheet.inc.php"); - - -$error = 0; - -/* - * Lecture du batch - * - */ - -$sql = "SELECT MAX(rowid) FROM ".MAIN_DB_PREFIX."telephonie_facturation_batch"; - -$resql = $db->query($sql); - -if ( $resql ) -{ - $row = $db->fetch_row($resql); - - $batch_id = $row[0]; - - $db->free($resql); -} -else -{ - $error = 1; - dol_syslog("Erreur ".$error); -} - -/* - * Traitements - * - */ - - - -$dir = "/tmp/"; -$error = 0; - -$fname = $dir . "alertes-factures.xls"; - -dol_syslog("Open $fname"); - -$workbook = &new writeexcel_workbook($fname); - -$page = &$workbook->addworksheet("Pertes"); - -$fnb =& $workbook->addformat(); -$fnb->set_align('vcenter'); -$fnb->set_align('right'); - -$fns =& $workbook->addformat(); -$fns->set_align('vcenter'); -$fns->set_align('left'); - -$fnc =& $workbook->addformat(); -$fnc->set_align('vcenter'); -$fnc->set_align('center'); - -$fn =& $workbook->addformat(); -$fn->set_align('vcenter'); - -$page->set_column(0,0,36); // A -$page->set_column(1,1,16); // A -$page->set_column(2,2,20); // A - -$page->write(1, 0, "Client", $fns); -$page->write(1, 1, "Contrat", $fnc); -$page->write(1, 2, "Ligne", $fnc); -$page->write(1, 3, "Perte", $fn); -$page->write(1, 4, "Fournisseur", $fn); -$page->write(1, 5, "iBreizh", $fn); - -if (!$error) -{ - $sql = "SELECT f.fourn_montant, f.cout_vente"; - $sql .= " , c.ref, s.nom, l.ligne as numero"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture as f"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_contrat as c"; - $sql .= " , ".MAIN_DB_PREFIX."societe as s"; - - $sql .= " WHERE f.fk_facture IS NOT NULL"; - $sql .= " AND f.fk_batch = ".$batch_id; - $sql .= " AND f.isfacturable = 'oui'"; - $sql .= " AND f.fk_ligne = l.rowid "; - $sql .= " AND l.fk_contrat = c.rowid"; - $sql .= " AND c.fk_client_comm = s.rowid"; - $sql .= " AND f.fourn_montant > f.cout_vente"; - $sql .= " ORDER BY s.rowid ASC, c.rowid ASC"; - - $resql = $db->query($sql) ; - - if ( $resql ) - { - $num = $db->num_rows($resql); - $i = 0; - $j = 2; - - while ($i < $num) - { - $obj = $db->fetch_object($resql); - - if ($i == 0) - { - $oldc = $obj->ref; - $total = 0; - } - - if ($oldc <> $obj->ref) - { - $page->write($j, 3, $total, $fnb); - $total = 0; - $j++; - $oldc = $obj->ref; - } - - $page->write_string($j, 0, $obj->nom, $fns); - $page->write_string($j, 1, $obj->ref, $fnc); - $page->write_string($j, 2, $obj->numero, $fnc); - - $perte = ($obj->fourn_montant - $obj->cout_vente); - $total += $perte; - - $page->write($j, 3, $perte, $fn); - $page->write($j, 4, $obj->fourn_montant, $fn); - $page->write($j, 5, $obj->cout_vente, $fn); - - - $j++; - $i++; - - print $obj->nom . " " . $perte ."\n"; - - } - $db->free(); - } - else - { - $error = 2; - dol_syslog("Erreur $error ".$db->error()); - } -} -/* - * - * - */ - -if (!$error) -{ - $sql = "SELECT distinct(s.rowid), s.nom"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture as f"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_contrat as c"; - $sql .= " , ".MAIN_DB_PREFIX."societe as s"; - - $sql .= " WHERE f.fk_facture IS NOT NULL"; - $sql .= " AND f.fk_batch = ".$batch_id; - $sql .= " AND f.isfacturable = 'oui'"; - $sql .= " AND f.fk_ligne = l.rowid "; - $sql .= " AND l.fk_contrat = c.rowid"; - $sql .= " AND c.fk_client_comm = s.rowid"; - $sql .= " AND f.fourn_montant > f.cout_vente"; - $sql .= " GROUP BY s.nom ASC"; - - $resql = $db->query($sql) ; - - if ( $resql ) - { - $num = $db->num_rows($resql); - $i = 0; - - while ($i < $num) - { - $row = $db->fetch_row($resql); - - $page = &$workbook->addworksheet($row[1]); - - $fnb =& $workbook->addformat(); - $fnb->set_align('vcenter'); - $fnb->set_align('right'); - - $fns =& $workbook->addformat(); - $fns->set_align('vcenter'); - $fns->set_align('left'); - - $fnc =& $workbook->addformat(); - $fnc->set_align('vcenter'); - $fnc->set_align('center'); - - $fn =& $workbook->addformat(); - $fn->set_align('vcenter'); - - $page->set_column(0,0,10); // A - $page->set_column(1,1,16); // A - $page->set_column(2,2,22); // A - - $clients = array(); - - $page->write(1, 0, "Date", $fnc); - $page->write(1, 1, "Contrat", $fnc); - $page->write(1, 2, "Ligne", $fnc); - $page->write(1, 3, "Perte", $fn); - $page->write(1, 4, "Fournisseur", $fn); - $page->write(1, 5, "iBreizh", $fn); - - - $sql = "SELECT f.fourn_montant, f.cout_vente, f.date"; - $sql .= " , c.ref, s.nom, l.ligne as numero"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture as f"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_contrat as c"; - $sql .= " , ".MAIN_DB_PREFIX."societe as s"; - - $sql .= " WHERE f.fk_facture IS NOT NULL"; - $sql .= " AND s.rowid = ".$row[0]; - $sql .= " AND f.isfacturable = 'oui'"; - $sql .= " AND f.fk_ligne = l.rowid "; - $sql .= " AND l.fk_contrat = c.rowid"; - $sql .= " AND c.fk_client_comm = s.rowid"; - $sql .= " ORDER BY f.date DESC"; - - $re2sql = $db->query($sql) ; - - if ( $re2sql ) - { - $nu2m = $db->num_rows($re2sql); - $j = 0; - $k=2; - while ($j < $nu2m) - { - $obj = $db->fetch_object($re2sql); - - $page->write_string($k, 0, $obj->date, $fns); - $page->write_string($k, 1, $obj->ref, $fnc); - $page->write_string($k, 2, $obj->numero, $fnc); - - $perte = ($obj->cout_vente - $obj->fourn_montant ); - $total += $perte; - - $ki = $k+1; - - $page->write($k, 3, "=E$ki-F$ki", $fn); - $page->write($k, 4, $obj->fourn_montant, $fn); - $page->write($k, 5, $obj->cout_vente, $fn); - - $k++; - $j++; - } - } - - - $i++; - - print $obj->nom . " " . $perte ."\n"; - - } - - } - else - { - $error = 2; - dol_syslog("Erreur $error ".$db->error()); - } -} - - - - -/* - * - * - */ -$workbook->close(); -$db->close(); -?> diff --git a/htdocs/telephonie/script/facturation-analyse.php b/htdocs/telephonie/script/facturation-analyse.php deleted file mode 100644 index 22de45153bb..00000000000 --- a/htdocs/telephonie/script/facturation-analyse.php +++ /dev/null @@ -1,244 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * - * Script de facturation - * Analyse de la facturation - * - */ - -/** - \file htdocs/telephonie/script/facturation-analyse.php - \ingroup telephonie - \brief Analyse de la facturation - \version $Revision$ -*/ - -require ("../../master.inc.php"); - -$verbose = 0; -$month = 0; -$year = 0; - -//loop through our arguments and see what the user selected -for ($i = 1; $i < sizeof($GLOBALS["argv"]); $i++) -{ - switch($GLOBALS["argv"][$i]) - { - case "--month": - $month = $GLOBALS["argv"][$i+1]; - break; - case "--year": - $year = $GLOBALS["argv"][$i+1]; - break; - case "-v": - $verbose = 1; - break; - case "-vv": - $verbose = 2; - break; - case "--no-xls": - $no_xls = 1; - break; - case "--version": - echo $GLOBALS['argv'][0]." $Revision$\n"; - exit; - break; - case "--help": - print $GLOBALS['argv'][0]. - "\n\t--help\t\tprint this help\n". - "\t--version\tprint version\n". - "\t-v\t\tverbose mode\n". - "\t--month int\n". - "\t--year int\n"; - "\t--no-xls int\n"; - break; - } -} - -/* - * Analyse ratio cout fournisseur - * - */ - -$datetime = time(); -$date = strftime("%d%h%Y%Hh%Mm%S",$datetime); -if ($month == 0) - $month = strftime("%m", $datetime); -if ($year == 0) - $year = strftime("%Y", $datetime); - -if ($month == 1) -{ - $month = "12"; - $year = $year - 1; -} -else -{ - $month = substr("00".($month - 1), -2) ; -} - -$month = substr("00".$month, -2) ; - -if ($verbose > 0) - print "Analyse $month/$year\n"; - -$sql = "SELECT cd.fk_fournisseur, sum(cd.fourn_montant), sum(cd.cout_vente)"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture as tf"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_communications_details as cd"; - -$sql .= " WHERE tf.date = '".$year."-".$month."-01'"; -$sql .= " AND tf.rowid = cd.fk_telephonie_facture"; -$sql .= " GROUP BY cd.fk_fournisseur"; - -$re2sql = $db->query($sql) ; - -if ($verbose > 1) - print $sql."\n"; - -if ( $re2sql ) -{ - $nu2m = $db->num_rows($re2sql); - if ($verbose > 1) - print "Num $nu2m\n"; - $j = 0; - while ($j < $nu2m) - { - $row = $db->fetch_row($re2sql); - - $sqli = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_analyse_fournisseur"; - $sqli.= " (fk_fournisseur,mois,achat,vente)"; - $sqli .= " VALUES (".$row[0].",'".$year.$month."',".$row[1].",".$row[2].")"; - - $resqli = $db->query($sqli) ; - - if ($verbose > 1) - print $resqli."\n"; - - if (! $resqli ) - { - print $db->error($resqli); - } - - $j++; - } -} -else -{ - print $db->error(); -} - - -if($no_xls) - exit; - -/* - * Partie 2 - * - */ - -require_once (DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_workbook.inc.php"); -require_once (DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_worksheet.inc.php"); - -$error = 0; -$dir = "/tmp/"; - -$fname = $dir . "facturation-analyse.xls"; - -if ($verbose > 0) - dol_syslog("Open $fname"); - -$workbook = &new writeexcel_workbook($fname); - -$page = &$workbook->addworksheet("Analyse"); - -$fnb =& $workbook->addformat(); -$fnb->set_align('vcenter'); -$fnb->set_align('right'); - -$fns =& $workbook->addformat(); -$fns->set_align('vcenter'); -$fns->set_align('left'); - -$fnc =& $workbook->addformat(); -$fnc->set_align('vcenter'); -$fnc->set_align('center'); - -$fn =& $workbook->addformat(); -$fn->set_align('vcenter'); - -$page->set_column(0,0,10); // A -$page->set_column(1,4,16); // A - -$clients = array(); - -$page->write(1, 0, "Date", $fnc); -$page->write(1, 1, "Gain", $fnc); -$page->write(1, 2, "CA iBreizh", $fnc); -$page->write(1, 3, "Coût fournisseurs", $fnc); - - - -$sql = "SELECT sum(f.fourn_montant) as fourn_montant, sum(f.cout_vente) as cout_vente, f.date"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture as f"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_contrat as c"; - -$sql .= " WHERE f.fk_facture IS NOT NULL"; -$sql .= " AND f.isfacturable = 'oui'"; -$sql .= " AND f.fk_ligne = l.rowid "; -$sql .= " AND l.fk_contrat = c.rowid"; -$sql .= " GROUP BY f.date DESC"; - -$re2sql = $db->query($sql) ; - -if ( $re2sql ) -{ - $nu2m = $db->num_rows($re2sql); - $j = 0; - $k=2; - while ($j < $nu2m) - { - $obj = $db->fetch_object($re2sql); - - $page->write_string($k, 0, $obj->date, $fns); - - $ki = $k+1; - $page->write($k, 1, "=C$ki-D$ki", $fn); - - $page->write($k, 2, $obj->cout_vente, $fn); - $page->write($k, 3, $obj->fourn_montant, $fn); - - - $k++; - $j++; - } -} -else -{ - print $db->error(); -} -/* - * - * - */ -$workbook->close(); -$db->close(); -?> diff --git a/htdocs/telephonie/script/facturation-calcul.php b/htdocs/telephonie/script/facturation-calcul.php deleted file mode 100644 index 61937f356a6..00000000000 --- a/htdocs/telephonie/script/facturation-calcul.php +++ /dev/null @@ -1,548 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * - * Script de calcul de la facturation - * - Lit les entrées dans la table import_cdr - * - Verifie que tous les tarifs sont dispos - * - Importe les lignes dans llx_communications_details - * - Calcul la facture téléphonique par ligne - */ - -/** - \file htdocs/telephonie/script/facturation-calcul.php - \ingroup telephonie - \brief Calcul des factures - \version $Revision$ -*/ - - -require ("../../master.inc.php"); - -require_once (DOL_DOCUMENT_ROOT."/societe.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/facturetel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/communication.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/telephonie.tarif.class.php"); - - -$error = 0; -$nbcommit = 0; -$datetime = time(); - -$date = strftime("%d%h%Y%Hh%Mm%S",$datetime); - -/* - * On facture les communications du mois précédent - */ - -$month = strftime("%m", $datetime); -$year = strftime("%Y", $datetime); - -if ($month == 1) -{ - $month = "12"; - $year = $year - 1; -} -else -{ - $month = substr("00".($month - 1), -2) ; -} - -/******************************************************** - * - * Affiche le nombre de comunications a traiter - * - *********************************************************/ - -$sql = "SELECT count(*)"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_import_cdr";; - -$resql = $db->query($sql); - -if ( $resql ) -{ - $num = $db->num_rows($resql); - $row = $db->fetch_row($resql); - - dol_syslog("Communications à traiter ".$row[0]); - $db->free($resql); -} -else -{ - $error = 1; - dol_syslog("Erreur ".$error); -} - -/********************************************************** -* -* -* -***********************************************************/ - -$sql = "SELECT MAX(rowid) FROM ".MAIN_DB_PREFIX."telephonie_facture"; - -$resql = $db->query($sql); - -if ( $resql ) -{ - $row = $db->fetch_row($resql); - - dol_syslog("Max rowid avant facture ".$row[0]); - $db->free($resql); -} -else -{ - $error = 2; - dol_syslog("Erreur ".$error); -} - -/** - * - * Lectures des différentes lignes dans la table d'import - * - */ - -if (!$error) -{ - $user = new user($db,1); - - $sql = "SELECT distinct(t.fk_ligne)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_import_cdr as t"; - $sql .= " ORDER BY fk_ligne ASC"; - - $lines_keys = array(); - - if ( $db->query($sql) ) - { - $num = $db->num_rows(); - - $i = 0; - - while ($i < $num) - { - $row = $db->fetch_row(); - - $lines_keys[$i] = $row[0]; - - $i++; - } - $db->free(); - dol_syslog(sizeof($lines_keys)." lignes trouvées"); - } - else - { - $error = 3; - dol_syslog("Erreur ".$error); - } -} - - - - -/********************************************************** -* -* Création d'un batch de facturation -* -***********************************************************/ - -if (sizeof($lines_keys) > 0) -{ - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_facturation_batch"; - $sql .= " (date_batch) VALUES (now())"; - $resql = $db->query($sql); - - if ( $resql ) - { - $batch_id = $db->last_insert_id(MAIN_DB_PREFIX."telephonie_facturation_batch"); - - dol_syslog("Batch ID ".$batch_id); - } - else - { - $error = 20; - dol_syslog("Erreur ".$error); - } -} - -/* ***************************************************** */ -/* */ -/* Traitements */ -/* */ -/* */ -/* ***************************************************** */ - -if (!$error) -{ - - foreach ($lines_keys as $line_key) - { - $error = 0; - $ligne = new LigneTel($db); - - if ( $db->query("BEGIN") ) - { - if ($ligne->fetch_by_id($line_key) > 0 ) - { - if ($ligne->socid == 0) - { - $error = 4; - dol_syslog("Error ($error)"); - } - } - else - { - - $error = 5; - dol_syslog("Error ($error): Aucune société rattachée à la ligne : $line_key"); - } - - - /* - * Récupération des infos sur la sociétés - * - */ - if (!$error ) - { - $soc = new Societe($db); - if ( $soc->fetch($ligne->socid) ) - { - - } - else - { - $error = 6; - dol_syslog("Error ($error)"); - } - } - - /* - * - * Création d'une facture de telephonie si la ligne est facturable - * - */ - - if (!$error) - { - if ($ligne->facturable == 1) - { - $facturable = 'oui'; - } - else - { - $facturable = 'non'; - } - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_facture"; - $sql .= " (fk_ligne, ligne, date, isfacturable, fk_batch, fk_contrat)"; - $sql .= " VALUES (".$ligne->id.","; - $sql .= " '$ligne->numero','".$year."-".$month."-01'"; - $sql .= ", '$facturable',".$batch_id; - $sql .= ", ".$ligne->contrat.")"; - - if ($db->query($sql)) - { - $facid = $db->last_insert_id(MAIN_DB_PREFIX."telephonie_facture"); - } - else - { - $error++; - dol_syslog("Erreur d'insertion dans llx_telephonie_facture"); - dol_syslog($db->error()); - dol_syslog($sql); - } - } - /* - * - * Calcul de la facture - * - */ - if (!$error) - { - $total_achat = 0; - $total_vente = 0; - $total_fourn = 0; - - if (calcul($db, $ligne, $facid, $total_achat, $total_vente, $total_fourn) <> 0) - { - $error++; - dol_syslog("Erreur de calcul de la facture pour la ligne $line_key $ligne->numero"); - } - } - - /* - * - * Insertion des données dans la base - * - */ - - if (!$error) - { - $total_vente_remise = $total_vente; - - $total_vente_remise = ereg_replace(",",".", $total_vente_remise); - - $gain = ($total_vente_remise - $total_fourn); - - $total_achat = ereg_replace(",",".", $total_achat); - $total_vente = ereg_replace(",",".", $total_vente); - $total_fourn = ereg_replace(",",".", $total_fourn); - - $gain = ereg_replace(",",".", $gain); - - $sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_facture"; - - $sql .= " SET "; - $sql .= " fourn_montant = $total_fourn"; - $sql .= " , cout_achat = $total_achat"; - $sql .= " , cout_vente = $total_vente"; - $sql .= " , remise = $ligne->remise"; - $sql .= " , cout_vente_remise = $total_vente_remise"; - $sql .= " , gain = $gain"; - - $sql .= " WHERE rowid =".$facid; - - if ($db->query($sql)) - { - - } - else - { - $error++; - dol_syslog("Erreur de mise à jour dans llx_telephonie_facture"); - dol_syslog($db->error()); - dol_syslog($sql); - } - } - - /* - * Suppression des données de la table d'import - * - */ - - if (!$error) - { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_import_cdr"; - $sql .= " WHERE fk_ligne = $line_key "; - - if (! $db->query($sql)) - { - $error++; - dol_syslog("Erreur de suppression dans llx_telephonie_import_cdr"); - } - } - - /* - * Commit / Rollback SQL - * - */ - - if (!$error) - { - $db->query("COMMIT"); - $nbcommit++; - dol_syslog("Ligne $ligne->numero - COMMIT"); - } - else - { - $db->query("ROLLBACK"); - dol_syslog("Ligne $ligne->numero - ROLLBACK de la transaction"); - } - } - else - { - dol_syslog("Erreur ouverture Transaction SQL"); - } - } /* fin de la boucle */ - - /* - * - * - */ -} - -/********************************************************** -* -* -* -***********************************************************/ -$sql = "SELECT MAX(rowid) FROM ".MAIN_DB_PREFIX."telephonie_facture"; - -$resql = $db->query($sql); - -if ( $resql ) -{ - $row = $db->fetch_row($resql); - - dol_syslog("Max rowid après facture ".$row[0]); - $db->free($resql); -} -else -{ - $error++; -} - -/********************************************************** -* -* -* -***********************************************************/ - -dol_syslog($nbcommit." facture émises"); - -/********************************************************** -* -* -* -***********************************************************/ -$sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."telephonie_import_cdr"; - -$resql = $db->query($sql); - -if ( $resql ) -{ - $row = $db->fetch_row($resql); - - dol_syslog($row[0]. " communications restantes dans la table d'import"); - $db->free($resql); -} -else -{ - $error++; -} - - -$db->close(); - -dol_syslog("Fin Batch ID ".$batch_id); - -// FIN - -/****************************************************************************** - * - * Fonction de calcul de la facture - * - ******************************************************************************/ - -function calcul($db, $ligne, $facture_id, &$total_cout_achat, &$total_cout_vente, &$total_cout_fourn) -{ - $error = 0; - - $total = 0; - $nbinter = 0; - $nbmob = 0; - $nbnat = 0; - $duree = 0; - - $fournisseur_id = TELEPHONIE_GRILLE_VENTE_DEFAUT_ID ; - - $tarif_spec = TELEPHONIE_GRILLE_VENTE_DEFAUT_ID ; - - $sql = "SELECT d.grille_tarif"; - - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_distributeur as d"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_distributeur_commerciaux as dc"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; - - $sql .= " WHERE l.rowid = ".$ligne->id; - $sql .= " AND d.rowid = dc.fk_distributeur"; - $sql .= " AND l.fk_commercial_sign = dc.fk_user"; - - $resql = $db->query($sql); - - if ( $resql ) - { - $num_sql = $db->num_rows($resql); - - if ($num_sql > 0) - { - $row = $db->fetch_row($resql); - $tarif_spec = $row[0]; - } - $db->free($resql); - } - - dol_syslog("Utilisation du tarif ".$tarif_spec." pour la ligne ".$ligne->id); - - $tarif_achat = new TelephonieTarif($db, $tarif_spec, "achat", $fournisseur_id); - $tarif_vente = new TelephonieTarif($db, $tarif_spec, "vente", $tarif_spec, $ligne->client_comm_id); - - $comms = array(); - - $sql = "SELECT t.idx, t.fk_ligne, t.ligne, t.montant, t.duree, t.num, t.date, t.heure, t.dest"; - $sql .= " , t.fichier, t.fk_fournisseur"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_import_cdr as t"; - $sql .= " WHERE t.fk_ligne = ".$ligne->id; - - $resql = $db->query($sql); - - if ($resql) - { - $num_sql = $db->num_rows($resql); - $i = 0; - - while ($i < $num_sql && $error == 0) - { - $objp = $db->fetch_object($resql); - - $comm = new CommunicationTelephonique(); - - $comm->index = $objp->idx; - $comm->fk_ligne = $objp->fk_ligne; - $comm->ligne = $objp->ligne; - $comm->date = $objp->date; - $comm->heure = $objp->heure; - $comm->duree = $objp->duree; - $comm->dest = $objp->dest; - $comm->numero = $objp->num; - $comm->montant = $objp->montant; - $comm->fichier_cdr = $objp->fichier; - $comm->fournisseur = $objp->fk_fournisseur; - $comm->facture_id = $facture_id; - - $comms[$i] = $comm; - - $i++; - } - - $db->free($resql); - } - else - { - $error++; - dol_syslog("Erreur dans Calcul() Problème SQL"); - } - - for ($ii = 0 ; $ii < $num_sql ; $ii++) - { - $comm = $comms[$ii]; - - $error = $error + $comm->cout($tarif_achat, $tarif_vente, $ligne, $db); - - $total_cout_fourn = $total_cout_fourn + $comm->montant; - $total_cout_achat = $total_cout_achat + $comm->cout_achat; - $total_cout_vente = $total_cout_vente + $comm->cout_vente; - - $error = $error + $comm->logsql($db); - } - - return $error; -} -?> diff --git a/htdocs/telephonie/script/facturation-consolidation.php b/htdocs/telephonie/script/facturation-consolidation.php deleted file mode 100644 index 2f782dcbe82..00000000000 --- a/htdocs/telephonie/script/facturation-consolidation.php +++ /dev/null @@ -1,299 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * Prépare les factures à imprimer - */ - -/** - \file htdocs/telephonie/script/facturation-consolidation.php - \ingroup telephonie - \brief Consolidation des données de facturation - \version $Revision$ -*/ - -require ("../../master.inc.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); - -$ligne = new LigneTel($db); - -if ($opt['m'] > 0) -{ - $datetime = mktime(10,10,10,$opt['m'],10,2006); -} -else -{ - $datetime = time(); -} - -$paye[0] = 'non'; -$paye[1] = 'oui'; - -$fourn[1] = "STR"; -$fourn[2] = "BT"; -$fourn[3] = "BTP"; -$fourn[4] = "B3G"; - -$month = strftime("%m", $datetime); -$year = strftime("%y", $datetime); - -if ($month == 1) -{ - $month = "12"; - $year = $year - 1; -} -else -{ - $month = substr("00".($month - 1), -2) ; -} - -if (! $db->query("DELETE FROM ".MAIN_DB_PREFIX."telephonie_facture_consol") ) -{ - print $db->error(); - die(); -} - -if (! $db->query("DELETE FROM ".MAIN_DB_PREFIX."telephonie_fournisseur_consol") ) -{ - print $db->error(); - die(); -} - - -/* Fournisseur */ -$sqls = "SELECT round(sum(fourn_montant)),date_format(date,'%y%m'),fk_fournisseur "; -$sqls .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; -$sqls .= " GROUP BY fk_fournisseur,date_format(date,'%y%m') DESC ;"; -$resqls = $db->query($sqls); - -if ( $resqls ) -{ - while ($rows = $db->fetch_row($resqls)) - { - $sqlu = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_fournisseur_consol"; - $sqlu .= " (nom,mois,montant) VALUES ('"; - $sqlu .= $fourn[$rows[2]]."','".$rows[1]."','".$rows[0]."');"; - if (! $resqlu = $db->query($sqlu)) - { - die($db->error()); - } - } -} -else -{ - print $db->error(); - die(); -} - -$sql = "SELECT groupe.nom, agence.nom, l.ligne, l.statut, u.firstname,u.name,u.rowid "; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_contrat as c"; -$sql .= " , ".MAIN_DB_PREFIX."societe as groupe"; -$sql .= " , ".MAIN_DB_PREFIX."societe as agence"; -$sql .= " , ".MAIN_DB_PREFIX."user as u"; -$sql .= " WHERE l.fk_contrat = c.rowid"; -$sql .= " AND c.fk_client_comm = groupe.rowid"; -$sql .= " AND c.fk_soc = agence.rowid"; -$sql .= " AND c.fk_commercial_sign = u.rowid"; -//$sql .= " LIMIT 20"; -$resql = $db->query($sql); - -if ( $resql ) -{ - $num = $db->num_rows(); - - while ($row = $db->fetch_row($resql)) - { - //print $row[0]."\t".$row[1]."\t".$row[2]."\t".$ligne->statuts[$row[3]]."\t".$row[4]."\n"; - - $sqli = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_facture_consol"; - $sqli .= " (groupe,agence,ligne,statut,repre_ib) VALUES "; - $sqli .= " ('".addslashes($row[0])."','".addslashes($row[1])."','$row[2]',"; - $sqli .= "'".$ligne->statuts[$row[3]]."',"; - $sqli .= "'".$row[4]." ".$row[5]."')"; - - $resqli = $db->query($sqli); - - if ($resqli) - { - - /* Distributeur */ - $sqls = "SELECT d.nom "; - $sqls .= " FROM ".MAIN_DB_PREFIX."telephonie_distributeur as d"; - $sqls .= " , ".MAIN_DB_PREFIX."telephonie_distributeur_commerciaux as dc"; - $sqls .= " WHERE dc.fk_user = '$row[6]'"; - $sqls .= " AND dc.fk_distributeur = d.rowid"; - $resqls = $db->query($sqls); - - if ( $resqls ) - { - while ($rows = $db->fetch_row($resqls)) - { - $sqlu = "UPDATE ".MAIN_DB_PREFIX."telephonie_facture_consol"; - $sqlu .= " SET distri='".addslashes($rows[0])."'"; - $sqlu .= " WHERE ligne = '$row[2]'"; - if (! $resqlu = $db->query($sqlu)) - { - die($db->error()); - } - } - } - else - { - die($db->error()); - } - - $m = 0; - $mc = $month + 1; - $yc = $year; - - while ($m < 7) - { - $mc = $mc - 1; - - if ($mc == 0) - { - $mc = 12; - $yc = $yc - 1; - } - - $msc = substr("00".$mc, -2) ; - $ysc = substr("00".$yc, -2) ; - - $sqls = "SELECT round(sum(cout_vente),2) "; - $sqls .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; - $sqls .= " WHERE ligne = '$row[2]'"; - $sqls .= " AND ym = '".$ysc.$msc."'"; - $sqls .= " AND num_prefix = '06'"; - $resqls = $db->query($sqls); - //print "$sqls\n"; - if ( $resqls ) - { - while ($rows = $db->fetch_row($resqls)) - { - $sqlu = "UPDATE ".MAIN_DB_PREFIX."telephonie_facture_consol"; - $sqlu .= " SET mobi_m".$m."='".$rows[0]."'"; - $sqlu .= " WHERE ligne = '$row[2]'"; - if (! $resqlu = $db->query($sqlu)) - { - die($db->error()); - } - - } - } - else - { - die($db->error()); - } - - /* Fixes */ - $sqls = "SELECT round(sum(cout_vente),2) "; - $sqls .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; - $sqls .= " WHERE ligne = '$row[2]'"; - $sqls .= " AND ym = '".$ysc.$msc."'"; - $sqls .= " AND num_prefix in ('01','02','03','04','05')"; - $resqls = $db->query($sqls); - - if ( $resqls ) - { - while ($rows = $db->fetch_row($resqls)) - { - $sqlu = "UPDATE ".MAIN_DB_PREFIX."telephonie_facture_consol"; - $sqlu .= " SET fixe_m".$m."='".$rows[0]."'"; - $sqlu .= " WHERE ligne = '$row[2]'"; - if (! $resqlu = $db->query($sqlu)) - { - die($db->error()); - } - } - } - else - { - die($db->error()); - } - - /* Facture Payé */ - $sqls = "SELECT paye "; - $sqls .= " FROM ".MAIN_DB_PREFIX."telephonie_facture as tf"; - $sqls .= " , ".MAIN_DB_PREFIX."facture as f"; - $sqls .= " WHERE ligne = '$row[2]'"; - $sqls .= " AND date_format(date,'%y%m') = '".$ysc.$msc."'"; - $sqls .= " AND tf.fk_facture = f.rowid"; - $resqls = $db->query($sqls); - - if ( $resqls ) - { - while ($rows = $db->fetch_row($resqls)) - { - $sqlu = "UPDATE ".MAIN_DB_PREFIX."telephonie_facture_consol"; - $sqlu .= " SET paye_m".$m."='".$paye[$rows[0]]."'"; - $sqlu .= " WHERE ligne = '$row[2]'"; - if (! $resqlu = $db->query($sqlu)) - { - die($db->error()); - } - } - } - else - { - die($db->error()); - } - - /* Fournisseur */ - $sqls = "SELECT fk_fournisseur "; - $sqls .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; - $sqls .= " WHERE ligne = '$row[2]'"; - $sqls .= " ORDER BY date DESC LIMIT 1;"; - $resqls = $db->query($sqls); - - if ( $resqls ) - { - while ($rows = $db->fetch_row($resqls)) - { - $sqlu = "UPDATE ".MAIN_DB_PREFIX."telephonie_facture_consol"; - $sqlu .= " SET fournisseur='".$fourn[$rows[0]]."'"; - $sqlu .= " WHERE ligne = '$row[2]'"; - if (! $resqlu = $db->query($sqlu)) - { - die($db->error()); - } - } - } - else - { - die($db->error()); - } - - $m++; - } - } - else - { - print $db->error(); - die(); - } - } -} -else -{ - print $db->error(); -} - -$db->close(); -?> diff --git a/htdocs/telephonie/script/facturation-correction-import.php b/htdocs/telephonie/script/facturation-correction-import.php deleted file mode 100644 index 71c0d559d22..00000000000 --- a/htdocs/telephonie/script/facturation-correction-import.php +++ /dev/null @@ -1,58 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * - * Script de vérification avant facturation - */ - -require ("../../master.inc.php"); - -$error = 0; - -$sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_import_cdr"; -$sql .= " WHERE num in (1014,1015,1013,1016)"; -$db->query($sql); -/* - * Mauvais formatage de Bretagne Telecom - * - */ -$sql = "SELECT num "; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_import_cdr"; -$sql .= " WHERE num like '8%';"; - -$resql = $db->query($sql) ; - -if ( $resql ) -{ - while ($row = $db->fetch_row($resql)) - { - $sqlu = "UPDATE ".MAIN_DB_PREFIX."telephonie_import_cdr"; - $sqlu .= " SET num = '0".$row[0]."' WHERE num = '".$row[0]."';"; - - $resqlu = $db->query($sqlu) ; - } - $db->free($resql); -} -else -{ - dol_syslog("Erreur SQL"); -} - -?> diff --git a/htdocs/telephonie/script/facturation-details-tableur.php b/htdocs/telephonie/script/facturation-details-tableur.php deleted file mode 100644 index 591ae7f290e..00000000000 --- a/htdocs/telephonie/script/facturation-details-tableur.php +++ /dev/null @@ -1,172 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * - * Génération des détails de facture en tableur - * - */ -require ("../../master.inc.php"); - -require_once (DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/facturetel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/telephonie-tarif.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/communication.class.php"); -require_once (DOL_DOCUMENT_ROOT."/facture.class.php"); -require_once (DOL_DOCUMENT_ROOT."/societe.class.php"); -require_once (DOL_DOCUMENT_ROOT."/contrat/contrat.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/script/facture-detail-tableur-one.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/script/facture-detail-tableur-two.class.php"); - -$error = 0; - -/* - * - * - */ -$sql = "SELECT max(date_format(date,'%Y%m')) "; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details" ; - -$resql = $db->query($sql); - -if ( $resql) -{ - $row = $db->fetch_row($resql); - - $year = substr($row[0],0,4); - $month = substr($row[0],4,2); -} -else -{ - $error++; -} - -//loop through our arguments and see what the user selected -for ($i = 1; $i < sizeof($GLOBALS["argv"]); $i++) -{ - switch($GLOBALS["argv"][$i]) - { - case "--month": - $month = $GLOBALS["argv"][$i+1]; - break; - case "--year": - $year = $GLOBALS["argv"][$i+1]; - break; - } -} - - -dol_syslog("Mois $month Année $year"); - -/* - * Lectures de différentes lignes - */ - -if (!$error) -{ - $sql = "SELECT fk_contrat as contrat"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat_service"; - $sql .= " WHERE fk_service = 3"; - - $contrats = array(); - - if ( $db->query($sql) ) - { - $num = $db->num_rows(); - - $i = 0; - - while ($i < $num) - { - $objp = $db->fetch_object( $i); - - $contrats[$i] = $objp->contrat; - - $i++; - } - $db->free(); - } - else - { - $error = 1; - dol_syslog($db->error()); - } -} - -/* - * Traitements - * - */ - -if (!$error) -{ - foreach ($contrats as $contrat) - { - $facdet = new FactureDetailTableurTwo($db); - $resg = $facdet->GenerateFile ($contrat, $year, $month); - - if ($resg <> 0) - { - dol_syslog("ERREUR lors de Génération du détail tableur two"); - $error = 19; - } - - $sql = "SELECT rowid as ligne"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne"; - $sql .= " WHERE fk_contrat = ".$contrat; - - $resql= $db->query($sql) ; - - if ($resql) - { - $num = $db->num_rows($resql); - - $i = 0; - - while ($i < $num) - { - $obj = $db->fetch_object($resql); - - $contrats[$i] = $objp->contrat; - - $facdet = new FactureDetailTableurOne($db); - $resg = $facdet->GenerateFile ($obj->ligne, $year, $month); - - if ($resg <> 0) - { - dol_syslog("ERREUR lors de Génération du détail tableur one"); - $error = 19; - } - - $i++; - } - $db->free(); - } - else - { - $error = 1; - dol_syslog($db->error()); - } - } -} - -$db->close(); - -dol_syslog("Conso mémoire ".memory_get_usage() ); -?> diff --git a/htdocs/telephonie/script/facturation-details.php b/htdocs/telephonie/script/facturation-details.php deleted file mode 100644 index b7181d13d34..00000000000 --- a/htdocs/telephonie/script/facturation-details.php +++ /dev/null @@ -1,152 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * - * Génération des factures détaillées - * - * Génère les factures détaillées du dernier mois. - * - * - */ - -require ("../../master.inc.php"); - -require_once (DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/facturetel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/telephonie-tarif.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/communication.class.php"); -require_once (DOL_DOCUMENT_ROOT."/contrat/contrat.class.php"); - -$error = 0; - -$datetime = time(); - -/* - * - */ - -$sql = "SELECT max(date) FROM ".MAIN_DB_PREFIX."telephonie_facture"; - -$resql = $db->query($sql); - -if ( $resql ) -{ - $num = $db->num_rows($resql); - - $row = $db->fetch_row($resql); - - $date = $row[0]; -} -else -{ - $error++; -} - -dol_syslog("Génère les factures détaillées pour : ".$date); - -/* - * Lectures de différentes factures - * Basé sur le dernier mois de facturation - */ - -if (!$error) -{ - $user = new user($db,1); - - $sql = "SELECT rowid"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture"; - $sql .= " WHERE date='".$date."'"; - $sql .= " AND fk_facture IS NOT NULL"; - - $factures = array(); - - $resql = $db->query($sql); - - if ( $resql ) - { - $num = $db->num_rows($resql); - $i = 0; - - while ($i < $num) - { - $objp = $db->fetch_object($resql); - $factures[$i] = $objp->rowid; - $i++; - } - $db->free($resql); - dol_syslog("$i lignes trouvées"); - } - else - { - $error = 1; - dol_syslog($db->error()); - } -} - -/* - * Traitements - * - */ - -if (!$error && sizeof($factures)) -{ - $facok = 0; - - foreach ($factures as $facid) - { - $error = 0; - - /* Creation des factures détaillée */ - - $factel = new FactureTel($db); - if ($factel->fetch($facid) == 0) - { - $objligne = new LigneTel($db); - - if ($objligne->fetch($factel->ligne) == 1) - { - // Différents modèles de factures détaillées - - $modele = "standard"; - - require_once (DOL_DOCUMENT_ROOT."/telephonie/pdf/pdfdetail_".$modele.".modules.php"); - $class = "pdfdetail_".$modele; - - $facdet = new $class($db, $ligne, $year, $month, $factel); - - if ($facdet->write_pdf_file($factel, $factel->ligne) == 0) - { - $facok++; - } - else - { - dol_syslog("ERREUR lors de Génération du pdf détaillé"); - $error = 19; - } - } - } - } - - dol_syslog(sizeof($factures)." factures traitées"); - dol_syslog($facok." factures générées"); -} - -$db->close(); -?> diff --git a/htdocs/telephonie/script/facturation-emission.php b/htdocs/telephonie/script/facturation-emission.php deleted file mode 100644 index 8c238524db9..00000000000 --- a/htdocs/telephonie/script/facturation-emission.php +++ /dev/null @@ -1,1015 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * - * Script de facturation - * Emets les factures compta en partant des factures téléphonique - * - */ - -/** - \file htdocs/telephonie/script/facturation-emission.php - \ingroup telephonie - \brief Emission des factures - \version $Revision$ -*/ - - -require ("../../master.inc.php"); - -$opt = getopt("l:c:"); - -$limit = $opt['l']; -$optcontrat = $opt['c']; - -if (strlen($limit) == 0 && strlen($optcontrat) == 0) -{ - print "Usage :\n php facturation-emission.php -l \n"; - exit; -} - -require_once (DOL_DOCUMENT_ROOT."/facture.class.php"); -require_once (DOL_DOCUMENT_ROOT."/societe.class.php"); -require_once (DOL_DOCUMENT_ROOT."/paiement.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/dolibarrmail.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/facturetel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/telephonie.contrat.class.php"); - - -$error = 0; - -$datetime = time(); -$datetimeprev = $datetime; // Date du prélèvement - -$date = strftime("%d%h%Y%Hh%Mm%S",$datetime); - -$user = new User($db, 1); - -$month = strftime("%m", $datetime); -$year = strftime("%Y", $datetime); - -if ($month == 1) -{ - $month = "12"; - $year = $year - 1; -} -else -{ - $month = substr("00".($month - 1), -2) ; -} - -/* - * Lecture du batch - * - */ - -$sql = "SELECT MAX(rowid) FROM ".MAIN_DB_PREFIX."telephonie_facturation_batch"; - -$resql = $db->query($sql); - -if ( $resql ) -{ - $row = $db->fetch_row($resql); - - $batch_id = $row[0]; - - dol_syslog("Traitement du batch ".$batch_id); - $db->free($resql); -} -else -{ - $error = 1; - dol_syslog("Erreur ".$error); -} - -/* - * Traitements - * - */ - -if (!$error) -{ - /*************************************************************** - * - * Lectures des contrats a traiter - * - * - ***************************************************************/ - - dol_syslog("Lecture des contrats"); - - $sql = "SELECT distinct(c.rowid)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture as f"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_contrat as c"; - - $sql .= " WHERE f.fk_facture IS NULL"; - $sql .= " AND f.fk_batch = ".$batch_id; - $sql .= " AND f.isfacturable = 'oui'"; - $sql .= " AND f.fk_ligne = l.rowid "; - $sql .= " AND l.fk_contrat = c.rowid"; - - if (strlen($optcontrat) > 0) - { - $sql .= " AND c.rowid=".$optcontrat; - dol_syslog("Limite sur le contrat : ".$optcontrat); - } - else - { - $sql .= " LIMIT $limit"; - } - - $contrats = array(); - - $resql = $db->query($sql) ; - - if ( $resql ) - { - $num = $db->num_rows($resql); - $i = 0; - - while ($i < $num) - { - $row = $db->fetch_row($resql); - $contrats[$i] = $row[0]; - $i++; - } - $db->free(); - } - else - { - $error = 2; - dol_syslog("Erreur $error"); - } -} -/* - * - * - */ -if (!$error) -{ - dol_syslog("Nombre de contrats à facturer ".sizeof($contrats)); - - $xcli = 0; - $xclis = sizeof($contrats); - - foreach ($contrats as $contrat) - { - $xcli++; - - /* Lecture des factures téléphoniques du contrat */ - dol_syslog($xcli."/".$xclis." Contrat à facturer id=".$contrat." (".memory_get_usage() .")"); - - $sql = "SELECT f.rowid, s.rowid as socid"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture as f"; - $sql .= ",".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_contrat as c"; - $sql .= ",".MAIN_DB_PREFIX."societe as s"; - - $sql .= " WHERE f.fk_batch = ".$batch_id; - $sql .= " AND c.rowid = ".$contrat; - $sql .= " AND l.fk_contrat = c.rowid"; - $sql .= " AND l.rowid = f.fk_ligne"; - $sql .= " AND s.rowid = c.fk_soc_facture "; - $sql .= " AND f.fk_facture IS NULL"; - $sql .= " AND f.isfacturable = 'oui'"; - - $sql .= " ORDER BY l.code_analytique ASC, l.rowid DESC"; - - $numlignes = array(); - - if ( $db->query($sql) ) - { - $num = $db->num_rows(); - - $i = 0; - - while ($i < $num) - { - $objp = $db->fetch_object(); - - $numlignes[$i] = $objp->rowid; - - $i++; - } - $db->free(); - - dol_syslog("Contrat $contrat : $i factures trouvées à générer"); - - $factures_prev = array(); - $factures_a_mailer = array(); - - if (sizeof($numlignes) > 0) - { - facture_contrat($db, $user, $contrat, $numlignes, $datetime, $factures_prev, $factures_a_mailer); - } - - if (sizeof($numlignes) > 0) - { - _prelevements($db, $user, $factures_prev); - } - - if (sizeof($numlignes) > 0) - { - _emails($db, $user, $contrat, $factures_a_mailer); - } - - } - else - { - $error = 1; - print $db->error(); - } - } -} - - -function facture_contrat($db, $user, $contrat_id, $factel_ids, $datetime, &$factures_prev, &$factures_a_mailer) -{ - /* - * Traitements - * - */ - - $i = 0; - $error = 0; - - /* Ouverture de la transaction */ - - if (! $db->query("BEGIN") ) - { - $error++; - } - - /* Lecture du contrat */ - - if (!$error) - { - $contrat = new TelephonieContrat($db); - if ( $contrat->fetch($contrat_id) >= 0) - { - - } - else - { - $error++; - dol_syslog("Impossible de lire le contrat"); - } - } - - /* Lecture de la société */ - - if (!$error) - { - $soc = new Societe($db); - - if ($soc->fetch($contrat->client_facture_id) ) - { - if ($verbose) dol_syslog($soc->nom); - } - else - { - $error = 132; - } - } - - /* Recuperation des infos de factures dans la base - * Creation de la facture - * - */ - if (!$error) - { - if ($verbose) dol_syslog("Création facture pour $soc->nom"); - - $fac = new Facture($db, $soc->id); - $cancel_facture = 1; - $fac->date = $datetime; - $fac->cond_reglement_id = 1; - $fac->remise_percent = 0; - - $facid = $fac->create($user); - - if ($facid > 0) - { - - } - else - { - dol_syslog("Erreur création objet facture erreur : $facid"); - $error = 16; - } - } - - /* - * Lecture des différentes lignes rattachées - * - */ - if (!$error) - { - foreach ($factel_ids as $factel_id) - { - /* Lecture de la facture téléphonique */ - - $factel = new FactureTel($db); - if ($factel->fetch($factel_id) == 0) - { - - } - else - { - dol_syslog("ERREUR lecture facture téléphonique $factel_id"); - $error = 17; - } - - /* Lecture de la ligne correspondante */ - - $ligne = new LigneTel($db); - if ($ligne->fetch($factel->ligne) == 1) - { - - } - else - { - dol_syslog("ERREUR lecture ligne $factel->ligne"); - $error = 18; - } - - if (!$error && $ligne->facturable) /* Test si on doit facturer ou non la ligne */ - { - $cancel_facture = 0; - - /* Création du lien entre les factures */ - - if ($factel->affect_num_facture_compta($facid) == 0) - { - - } - else - { - $error = 19; - } - - $soca = new Societe($db); - $soca->fetch($ligne->client_id); - - /* Insertion des lignes de factures */ - $libelle = ""; - - if (strlen(trim($ligne->code_analytique)) > 0) - { - $libelle .= "".$ligne->code_analytique." "; - } - - $dm = mktime (1,1,1,strftime("%m",$datetime), -1, strftime("%Y",$datetime)); - - $libelle .= "Communications téléphoniques de la ligne $ligne->numero"; - $libelle .= " mois de ".strftime("%B %Y",$dm); - if (trim($soca->ville)) - { - $libelle .= " (".$soca->ville.")"; - } - - if (!$error) - { - $ventil = 0 ; - if (defined("TELEPHONIE_COMPTE_VENTILATION")) - { - if (is_numeric(TELEPHONIE_COMPTE_VENTILATION)) - { - $ventil = TELEPHONIE_COMPTE_VENTILATION; - } - } - - - $result = $fac->addline($facid, - $libelle, - $factel->cout_vente_remise, - 1, - '19.6', - 0, - 0,'','',$ventil); - } - } - - } /* Fin de la boucle des lignes */ - } - - /*********************************/ - /* */ - /* Ajout des services */ - /* */ - /*********************************/ - - if (!$error) - { - $sql = "SELECT s.libelle_facture, sc.montant"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat_service as sc"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_service as s"; - - $sql .= " WHERE sc.fk_contrat = ".$contrat_id; - $sql .= " AND s.rowid = sc.fk_service"; - $sql .= " AND sc.montant > 0"; - - $resql = $db->query($sql) ; - $ventil = 18; - if ( $resql ) - { - $num = $db->num_rows($resql); - $is = 0; - - while ($is < $num) - { - $row = $db->fetch_row($resql); - - $result = $fac->addline($facid, - $row[0], - $row[1], - 1, - '19.6', - 0, - 0, - 0, - '', - $ventil); - - $is++; - } - $db->free(); - } - else - { - $error = 20; - dol_syslog("Erreur $error"); - } - } - - /*********************************/ - /* */ - /* Ajout rejets de prelevements */ - /* */ - /*********************************/ - if (!$error) - { - $sql = "SELECT pr.rowid,".$db->pdate("pr.date_rejet"); - $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_rejet as pr"; - $sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl"; - $sql .= " WHERE pl.fk_soc = ".$soc->id; - $sql .= " AND pr.fk_prelevement_lignes = pl.rowid"; - $sql .= " AND afacturer = 1 LIMIT 1;"; - $resql = $db->query($sql) ; - $ventil = 10; - if ( $resql ) - { - while ($row = $db->fetch_row($resql)) - { - $result = $fac->addline($facid, - "Frais pour prélèvement rejeté du ".strftime("%d/%m/%Y",$row[1]), - 15, - 1, - '0', - 0, - 0, - 0, - '', - $ventil); - - $sqlu = "UPDATE ".MAIN_DB_PREFIX."prelevement_rejet as pr"; - $sqlu .= " SET afacturer=0"; - $sqlu .= " ,fk_facture=".$facid; - $sqlu .= " WHERE rowid=".$row[0].";"; - - $resqlu = $db->query($sqlu); - } - $db->free($resql); - } - else - { - $error = 21; - dol_syslog($db->error()); - dol_syslog("Erreur rejet prelevement"); - } - } - - /*********************************/ - /* */ - /* Remise exceptionnelle */ - /* */ - /*********************************/ - if (!$error) - { - $remise_exceptionnelle = 0; - - $sql = "SELECT rowid,amount,fk_user"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_client_remise"; - $sql .= " WHERE fk_client = ".$soc->id; - $sql .= " AND fk_facture = 0"; - - $resql = $db->query($sql) ; - if ( $resql ) - { - while ($row = $db->fetch_row($resql)) - { - $remise_id = $row[0]; - $remise_exceptionnelle = $row[1]; - $remise_user = $row[2]; - } - } - else - { - $error = 32; - dol_syslog("Erreur remise exceptionnelle"); - dol_syslog($sql); - } - - print "remise $remise_exceptionnelle \n"; - print "total ".$fac->total_ht."\n"; - - if ($remise_exceptionnelle > 0) - { - - // Calcul valeur de remise a appliquer (remise) et reliquat - if ($remise_exceptionnelle > ($fac->total_ht * 0.9)) - { - $remise = floor($fac->total_ht * 0.9); - $reliquat = ($remise_exceptionnelle - $remise); - } - else - { - $remise = $remise_exceptionnelle; - $reliquat=0; - } - - $result_insert = $fac->addline($fac->id, - addslashes('Remise exceptionnelle'), - (0 - $remise), - 1, - '19.6'); - if ($result_insert < 0) - { - $error = 33; - } - - $sql = 'UPDATE '.MAIN_DB_PREFIX.'telephonie_client_remise'; - $sql .= ' SET fk_facture = '.$fac->id; - $sql .= " ,amount = '".ereg_replace(',','.',$remise)."'"; - $sql .= ' WHERE rowid ='.$remise_id; - $sql .= ' AND fk_client ='. $soc->id; - - if (! $db->query( $sql)) - { - $error = 34; - } - - if ($reliquat > 0 && $error == 0) - { - $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'telephonie_client_remise'; - $sql .= ' (fk_client, datec, amount, fk_user) '; - $sql .= ' VALUES '; - $sql .= ' ('.$soc->id; - $sql .= ' ,now()'; - $sql .= " ,'".ereg_replace(',','.',$reliquat)."'"; - $sql .= ' ,'.$remise_user; - $sql .= ')'; - - if (! $db->query( $sql) ) - { - $error = 35; - } - } - } - } - /*********************************/ - /* */ - /* Prestas annexes */ - /* */ - /*********************************/ - if (!$error) - { - $prestas = 0; - - $sql = "SELECT rowid,amount,libelle"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_client_presta"; - $sql .= " WHERE fk_client = ".$soc->id; - $sql .= " AND fk_facture = 0"; - - $resql = $db->query($sql) ; - if ( $resql ) - { - while ($row = $db->fetch_row($resql)) - { - $presta_id[$prestas] = $row[0]; - $presta_amount[$prestas] = $row[1]; - $presta_libelle[$prestas] = $row[2]; - $prestas++; - } - } - else - { - $error = 36; - } - - if ($prestas > 0) - { - $i = 0; - while ($i < $prestas) - { - $result_insert = $fac->addline($fac->id, - addslashes($presta_libelle[$i]), - $presta_amount[$i], - 1, - '19.6'); - if ($result_insert < 0) - { - $error = 37; - } - - $sql = 'UPDATE '.MAIN_DB_PREFIX.'telephonie_client_presta'; - $sql .= ' SET fk_facture = '.$fac->id; - $sql .= ' WHERE rowid ='.$presta_id[$i]; - $sql .= ' AND fk_client ='. $soc->id; - - if (! $db->query( $sql)) - { - $error = 38; - } - $i++; - } - } - } - - - /*********************************/ - /* */ - /* Validation de la facture */ - /* */ - /*********************************/ - - if (!$error && !$cancel_facture) - { - if ($verbose) dol_syslog("Validation de la facture : $fac->id"); - - $y = substr($year, -1); - $m = substr("00".$month, -2); - - if ( $fac->set_valid($user, $soc) ) - { - $valid_ok = 1; - } - else - { - $valid_ok = 0; - $error = 5; - } - } - - /**************************************/ - /* */ - /* Factures détaillées */ - /* */ - /**************************************/ - - if (!$error && !$cancel_facture) - { - foreach ($factel_ids as $factel_id) - { - /* Lecture de la facture téléphonique */ - - $factel = new FactureTel($db); - if ($factel->fetch($factel_id) == 0) - { - - } - else - { - dol_syslog("ERREUR lecture facture téléphonique $factel_id"); - $error = 17; - } - - /* Lecture de la ligne correspondante */ - - $ligne = new LigneTel($db); - if ($ligne->fetch($factel->ligne) == 1) - { - - } - else - { - dol_syslog("ERREUR lecture ligne $factel->ligne"); - $error = 18; - } - - /* Facture détaillée standard */ - - if (!$error) - { - $facok = 0; - - // Différents modèles de factures détaillées - - $modele = "standard"; - if (strlen($ligne->pdfdetail) > 0) - { - $modele = $ligne->pdfdetail; - } - - require_once (DOL_DOCUMENT_ROOT."/telephonie/pdf/pdfdetail_".$modele.".modules.php"); - $class = "pdfdetail_".$modele; - - $facdet = new $class($db, $ligne, $year, $month, $factel); - - if ($facdet->write_pdf_file($factel, $factel->ligne) == 0) - { - $facok++; - } - else - { - dol_syslog("ERREUR lors de Génération du pdf détaillé"); - $error = 19; - } - } - - /* Factures détaillées autres */ - - if (!$error) - { - // Recherche des factures détaillées - // et copie dans le répertoire de la facture - // ID facture telephonique $factel_id - $fdefacid = substr('0000'.$factel_id, -4); - $fdedir = DOL_DATA_ROOT.'/telephonie/facture/'; - - $fdedir .= substr($fdefacid,0,1)."/"; - $fdedir .= substr($fdefacid,1,1)."/"; - $fdedir .= substr($fdefacid,2,1)."/"; - $fdedir .= substr($fdefacid,3,1)."/"; - - $fname = $fdedir . $fdefacid . "-detail.xls"; - - if (file_exists($fname)) - { - $fdefac = new Facture($db,"",$factel->fk_facture); - $fdefac->fetch($factel->fk_facture); - - $dest = FAC_OUTPUTDIR ."/".$fdefac->ref."/".$fdefac->ref."-".$fdefacid."-".$ligne->numero."-detail.xls"; - - copy($fname, $dest); - } - } - } - } - - /*********************************/ - /* */ - /* Creation du pdf de la facture */ - /* */ - /*********************************/ - - if (!$error && !$cancel_facture && $valid_ok == 1) - { - if ($verbose) dol_syslog("Génération du pdf facture : $facid"); - - $fac->fetch($facid); - $fac->fetch_client(); - $fac->client->load_ban(); - - $message = ""; - - if ($fac->client->bank_account->verif() && $ligne->mode_paiement == 'pre') - { - $message .= "Cette facture sera prélevée sur votre compte bancaire numéro : "; - $message .= $fac->client->bank_account->number."\n"; - } - - if ($verbose) dol_syslog("Création du pdf facture : $facid"); - - if (! facture_pdf_create($db, $facid, $message)) - { - $error = 1; - print "- ERREUR de génération du pdf de la facture\n"; - } - } - - if (!$error && !$cancel_facture) - { - $db->commit(); - - /* $soc - * $ligne - */ - - if ($contrat->facturable) - { - array_push($factures_a_mailer, $facid); - - if ($soc->verif_rib()) - { - array_push($factures_prev, $facid); - } - else - { - dol_syslog("facture $facid non preleve, RIB incorrect"); - } - } - - if ($verbose) dol_syslog("Commit de la transaction");; - } - else - { - $db->rollback(); - } -} - -function _prelevements($db, $user, $factures_prev) -{ - /******************************************************************** - * * - * * - * Emissions des demandes de prelevement * - * * - * * - ********************************************************************/ - //dol_syslog("[PR] Debut demande de prelevement"); - //dol_syslog("[PR] Nombre de factures ".sizeof($factures_prev)); - if (sizeof($factures_prev) > 0) - { - foreach ($factures_prev as $fac) - { - $fact = new Facture($db); - $fact->fetch($fac); - $fact->mode_reglement(3); - $fact->demande_prelevement($user); - } - } - //dol_syslog("[PR] Fin demande de prelevement"); -} - - - -function _emails($db, $user, $contrat_id, $factures_a_mailer) -{ - /******************************************************************** - * * - * * - * Envoi des factures par emails * - * * - * * - ********************************************************************/ - if (sizeof($factures_a_mailer) > 0) - { - foreach ($factures_a_mailer as $fac) - { - $fact = new Facture($db); - $fact->fetch($fac); - - $contrat = new TelephonieContrat($db); - $contrat->fetch($contrat_id); - - $emails = $contrat->get_contact_facture(); - - $ligne = new LigneTel($db); - - if ($ligne->fetch_by_facture_number($fact->id) == 0) - { - - } - - if (sizeof($emails > 0)) - { - $sendto = ""; - for ($k = 0 ; $k < sizeof($emails) ; $k++) - { - $sendto .= html_entity_decode($emails[$k]) . ","; - } - $sendto = substr($sendto,0,strlen($sendto) - 1); - - - dol_syslog("[EM] Envoi email à ".html_entity_decode($sendto) ); - - $subject = ereg_replace("#FACREF#",$fact->ref,TELEPHONIE_MAIL_FACTURATION_SUJET); - $subject = ereg_replace("#CONTRAT#",$contrat->ref, $subject); - - $from = TELEPHONIE_EMAIL_FACTURATION_EMAIL; - - $message = "Bonjour,\n\n"; - $message .= "Veuillez trouver ci-joint notre facture numéro $fact->ref du ".strftime("%d/%m/%Y",$fact->date)."."; - - $message .= "\nEgalement joint à ce mail le détails de vos communications.\n\n"; - - $message .= TELEPHONIE_MAIL_FACTURATION_SIGNATURE; - - - $mailfile = new DolibarrMail($subject, - $sendto, - $from, - $message); - - $mailfile->addr_bcc = TELEPHONIE_EMAIL_FACTURATION_EMAIL; - - $arr_file = array(); - $arr_name = array(); - $arr_mime = array(); - - $facfile = FAC_OUTPUTDIR . "/" . $fact->ref . "/" . $fact->ref . ".pdf"; - - /* - * Joint le fichier commercial supplémentaire - */ - //array_push($arr_file, "/home/www/dolibarr/documents/hp65152.pdf"); - //array_push($arr_mime, "application/pdf"); - //array_push($arr_name, "hp65152.pdf"); - - /* - * Join la facture - */ - array_push($arr_file, $facfile); - array_push($arr_mime, "application/pdf"); - array_push($arr_name, $fact->ref.".pdf"); - - $dir = FAC_OUTPUTDIR . "/" . $fact->ref . "/"; - - $handle=opendir(FAC_OUTPUTDIR . "/" . $fact->ref . "/"); - /* - * Joint les détails - * - */ - while (($file = readdir($handle))!==false) - { - if (is_readable($dir.$file) && substr($file, -11) == '-detail.pdf') - { - array_push($arr_file, $dir.$file); - array_push($arr_mime, "application/pdf"); - array_push($arr_name, $file); - } - if (is_readable($dir.$file) && substr($file, -11) == '-detail.xls') - { - array_push($arr_file, $dir.$file); - array_push($arr_mime, "application/vns.ms-excel"); - array_push($arr_name, $file); - } - } - - $mailfile->PrepareFile($arr_file, $arr_mime, $arr_name); - - if ( $mailfile->sendfile() ) - { - - for ($kj = 0 ; $kj < sizeof($contrat->contact_facture_id) ; $kj++) - { - $sendtoid = $contrat->contact_facture_id[$kj]; - - $sendtox = $emails[$kj]; - - $actioncode=9; - $actionmsg="Envoyée à $sendtox"; - $actionmsg2="Envoi Facture par mail"; - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm (datea,fk_action,fk_soc,note,fk_facture, fk_contact,fk_user_author, label, percent) VALUES (now(), '$actioncode' ,'$fact->socid' ,'$actionmsg','$fact->id','$sendtoid','$user->id', '$actionmsg2',100);"; - - if (! $db->query($sql) ) - { - print $db->error(); - } - else - { - //print "TOTO".$sendto. " ". $sendtoid ." \n"; - } - - } - - } - } - else - { - dol_syslog("Aucun email trouvé"); - } - } - } -} -/* - * FIN - * - */ - -$db->close(); - -dol_syslog("Conso mémoire ".memory_get_usage() ); - -?> diff --git a/htdocs/telephonie/script/facturation-import-cdr.php b/htdocs/telephonie/script/facturation-import-cdr.php deleted file mode 100644 index 0668f920f83..00000000000 --- a/htdocs/telephonie/script/facturation-import-cdr.php +++ /dev/null @@ -1,289 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * Script d'import des CDR des fournisseurs - */ - -require ("../../master.inc.php"); - -$opt = getopt("f:i:"); - -$file = $opt['f']; -$id_fourn = $opt['i']; - -if (strlen($file) == 0 || strlen($id_fourn) == 0) -{ - print "Usage :\n php import-cdr.php -f -i \n"; - exit; -} - -/* - * Vérification du fournisseur - * - */ - -$sql = "SELECT f.rowid, f.nom"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_fournisseur as f"; -$sql .= " WHERE f.rowid = ".$id_fourn; - -if ($db->query($sql)) -{ - $num = $db->num_rows(); - - if ($num == 1) - { - $row = $db->fetch_row(); - dol_syslog ("facturation-import-cdr.php Import fichier ".$file); - dol_syslog("facturation-import-cdr.php Fournisseur [".$row[0]."] ".$row[1]); - } - else - { - dol_syslog("facturation-import-cdr.php Erreur Fournisseur inexistant : ".$id_fourn); - exit ; - } -} -else -{ - dol_syslog("facturation-import-cdr.php Erreur recherche fournisseur"); - exit ; -} - -/* - * Vérifie que le fichier n'a pas déjà été chargé - * - */ - -$sql = "SELECT count(fichier)"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_import_cdr"; -$sql .= " WHERE fichier = '".basename($file)."'"; - -if ($db->query($sql)) -{ - $num = $db->num_rows(); - - if ($num == 1) - { - $row = $db->fetch_row(); - if ($row[0] > 0) - { - dol_syslog ("facturation-import-cdr.php Fichier ".$file." déjà chargé dans import-log"); - - exit ; - } - } - else - { - dol_syslog("facturation-import-cdr.php Erreur vérif du fichier"); - exit ; - } -} -else -{ - dol_syslog("facturation-import-cdr.php Erreur SQL vérification du fichier"); - exit ; -} - -/* - * Vérifie que le fichier n'a pas déjà été traité - * - */ - -$sql = "SELECT count(fichier_cdr)"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; -$sql .= " WHERE fichier_cdr = '".basename($file)."'"; - -if ($db->query($sql)) -{ - $num = $db->num_rows(); - - if ($num == 1) - { - $row = $db->fetch_row(); - if ($row[0] > 0) - { - dol_syslog ("facturation-import-cdr.php Fichier ".$file." déjà traité"); - exit ; - } - } - else - { - dol_syslog("facturation-import-cdr.php Erreur vérif du fichier dans les comm"); - exit ; - } -} -else -{ - dol_syslog("facturation-import-cdr.php Erreur SQL vérification du fichier dans les comm"); - dol_syslog("facturation-import-cdr.php ".$sql); - exit ; -} - -/* - * Charge les ID de lignes - * - */ - -$sql = "SELECT ligne, rowid "; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne"; - -$resql = $db->query($sql); - -if ($resql) -{ - $num = $db->num_rows($resql); - dol_syslog ("facturation-import-cdr.php ".$num." lignes chargées"); - $i = 0; - $ligneids = array(); - - while ($i < $num) - { - $row = $db->fetch_row($resql); - $ligneids[$row[0]] = $row[1]; - $i++; - } -} -else -{ - dol_syslog("facturation-import-cdr.php Erreur chargement des lignes"); - dol_syslog($sql); - exit ; -} - -/* - * Traitement - * - */ - -if (is_readable($file)) -{ - dol_syslog("facturation-import-cdr.php Lecture du fichier $file"); - - $error = 0; - $line = 0; - $hf = fopen ($file, "r"); - $line = 0; - - if ($db->query("BEGIN")) - { - while (!feof($hf) ) - { - $cont = fgets($hf, 1024); - - if (strlen(trim($cont)) > 0) - { - $tabline = explode(";", $cont); - if (sizeof($tabline) == 11) - { - $index = $tabline[0]; - $ligne = ereg_replace('"','',$tabline[1]); - $date = $tabline[2]; - $heure = $tabline[3]; - $numero = $tabline[4]; - $tarif = $tabline[5]; - $duree_text = $tabline[6]; - $tarif_fourn = $tabline[7]; - $montant = $tabline[8]; - $duree_secondes = ereg_replace('"','',$tabline[9]); - - if ($ligneids[$ligne] > 0) - { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_import_cdr"; - - $sql .= "(idx,fk_ligne,ligne,date,heure,num,dest,dureetext,tarif,montant,duree"; - $sql .= ", fichier, fk_fournisseur)"; - - $sql .= " VALUES ("; - $sql .= "$index"; - $sql .= ",'".$ligneids[$ligne]."'"; - $sql .= ",'".$ligne."'"; - $sql .= ",'".ereg_replace('"','',$date)."'"; - $sql .= ",'".ereg_replace('"','',$heure)."'"; - $sql .= ",'".ereg_replace('"','',$numero)."'"; - $sql .= ",'".addslashes(ereg_replace('"','',$tarif))."'"; - $sql .= ",'".ereg_replace('"','',$duree_text)."'"; - $sql .= ",'".ereg_replace('"','',$tarif_fourn)."'"; - $sql .= ",".ereg_replace(',','.',$montant); - $sql .= ",".$duree_secondes; - $sql .= ",'".basename($file)."'"; - $sql .= " ,".$id_fourn; - $sql .= ")"; - - if(ereg("^[0-9]+$", $duree_secondes)) - { - if ($db->query($sql)) - { - $line_inserted++; - } - else - { - dol_syslog("facturation-import-cdr.php Erreur de traitement de ligne $index"); - dol_syslog("facturation-import-cdr.php ".$db->error()); - dol_syslog("facturation-import-cdr.php ".$sql); - $error++; - } - } - else - { - print "Ligne : $cont ignorée\n"; - } - - } - else - { - dol_syslog("facturation-import-cdr.php Ligne : $ligne ignorée!"); - $error++; - } - - } - else - { - dol_syslog("facturation-import-cdr.php Mauvais format de fichier ligne $line"); - $error++; - } - } - $line++; - } - - dol_syslog("facturation-import-cdr.php ".($line -1 )." lignes traitées dans le fichier"); - dol_syslog("facturation-import-cdr.php ".$line_inserted." insert effectués"); - - if ($error == 0) - { - $db->query("COMMIT"); - dol_syslog("facturation-import-cdr.php COMMIT"); - } - else - { - $db->query("ROLLBACK"); - dol_syslog("facturation-import-cdr.php ROLLBACK"); - } - - } - - fclose($hf); -} -else -{ - print "Erreur lecture : $file"; - dol_syslog("facturation-import-cdr.php ".$file." not readable"); -} - - -return $error; diff --git a/htdocs/telephonie/script/facturation-impression.php b/htdocs/telephonie/script/facturation-impression.php deleted file mode 100644 index db03a16833f..00000000000 --- a/htdocs/telephonie/script/facturation-impression.php +++ /dev/null @@ -1,235 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * Prépare les factures à imprimer - */ - -/** - \file htdocs/telephonie/script/facturation-emission.php - \ingroup telephonie - \brief Emission des factures - \version $Revision$ -*/ - -require ("../../master.inc.php"); -require_once (DOL_DOCUMENT_ROOT."/facture.class.php"); -require_once (DOL_DOCUMENT_ROOT."/societe.class.php"); -require_once (DOL_DOCUMENT_ROOT."/paiement.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/dolibarrmail.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/facturetel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/telephonie.contrat.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/pdf/pdfdetail_papier.modules.php"); -require_once (DOL_DOCUMENT_ROOT."/includes/modules/facture/modules_facture.php"); -require_once (DOL_DOCUMENT_ROOT."/includes/modules/facture/pdf_ibreizh.modules.php"); - -$error = 0; -$total_feuilles = 0; -$pages = 0; -$pages_facture = 0; -$opt = getopt("m:"); - -if ($opt['m'] > 0) -{ - $datetime = mktime(10,10,10,$opt['m'],10,2005); -} -else -{ - $datetime = time(); -} -$date = strftime("%d%h%Y%Hh%Mm%S",$datetime); - -$user = new User($db, 1); - -$month = strftime("%m", $datetime); -$year = strftime("%Y", $datetime); - -if ($month == 1) -{ - $month = "12"; - $year = $year - 1; -} -else -{ - $month = substr("00".($month - 1), -2) ; -} - -$sql = "SELECT distinct(f.fk_facture), ff.facnumber "; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat_service as cs"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_facture as f"; -$sql .= " , ".MAIN_DB_PREFIX."facture as ff"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; -$sql .= " WHERE l.fk_contrat = cs.fk_contrat"; -$sql .= " AND f.fk_ligne = l.rowid"; -$sql .= " AND f.fk_facture = ff.rowid"; -$sql .= " AND date_format(f.date,'%m%Y') = '".$month.$year."'"; - -$resql = $db->query($sql); - -dol_syslog("Impression des factures de ".$month.$year); - -if ( $resql ) -{ - $num = $db->num_rows($resql); - $i = 0; - - dol_syslog("$num factures a imprimer"); - - $pdf = new FPDI_Protection('P','mm','A4'); - - // Protection et encryption du pdf - if ($conf->global->PDF_SECURITY_ENCRYPTION) - { - $pdfrights = array('print'); // Ne permet que l'impression du document - $pdfuserpass = ''; // Mot de passe pour l'utilisateur final - $pdfownerpass = NULL; // Mot de passe du propriétaire, créé aléatoirement si pas défini - $pdf->SetProtection($pdfrights,$pdfuserpass,$pdfownerpass); - } - - $pdf->Open(); - $pdf->SetMargins(10, 10, 10); - $pdf->SetAutoPageBreak(1,0); - $file = "/tmp/$year-$month-fac.pdf"; - - while ($i < $num) - { - $row = $db->fetch_row($resql); - - //print "$i/$num ".$row[1]." ".$row[0]."\n"; - - $xx = new pdf_ibreizh($db); - - $pql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."prelevement_facture"; - $pql .= " WHERE fk_facture = ".$row[0]; - $repql = $db->query($pql); - if ( $repql ) - { - $pow = $db->fetch_row($repql); - $db->free($repql); - } - - if ($pow[0] > 0) - { - $xx->message = "Cette facture sera prélevée sur votre compte bancaire."; - } - - - - $xx->_write_pdf_file($row[0], &$pdf, 1); - - $feuilles = 0; - $feuilles = $feuilles + $xx->pages; - $pages = $pages + $xx->pages; - $pages_facture = $pages_facture + $xx->pages; - - $fql = "SELECT rowid, ligne"; - $fql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture as f"; - $fql .= " WHERE f.fk_facture = ".$row[0]; - - $refql = $db->query($fql); - - if ( $refql ) - { - while ($fow = $db->fetch_row($refql)) - { - $obj_factel = new FactureTel($db); - $obj_factel->fetch($fow[0]); - $ligne_id = $fow[1]; - $yy = new pdfdetail_papier ($db, $ligne_id, $year, $month, $obj_factel); - $yy->_write_pdf_file($obj_factel, $ligne_id, $pdf, 1); - $pages = $pages + $yy->pages; - $feuilles = $feuilles + $yy->pages; - } - } - $total_feuilles = $total_feuilles + ceil($feuilles / 2); - $i++; - } - - $pdf->Close(); - $pdf->Output($file); - dol_syslog("Generation de ".$pages_facture." envois"); - dol_syslog("Generation de ".$pages." pages"); - dol_syslog("Generation de ".$total_feuilles." feuilles"); - dol_syslog("Ecriture de : ".$file); - $db->free($resql); -} -else -{ - $error = 1; - dol_syslog("Erreur ".$error); - dol_syslog($db->error()); -} - -$db->close(); - -/* - * Ancienne méthode - * - */ - -exit; - -$sql = "SELECT distinct(f.fk_facture), ff.facnumber "; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat_service as cs"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_facture as f"; -$sql .= " , ".MAIN_DB_PREFIX."facture as ff"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; -$sql .= " WHERE l.fk_contrat = cs.fk_contrat"; -$sql .= " AND f.fk_ligne = l.rowid"; -$sql .= " AND f.fk_facture = ff.rowid"; -$sql .= " AND date_format(f.date,'%m%Y') = '".$month.$year."'"; - -$resql = $db->query($sql); - -dol_syslog("Impression des factures de ".$month.$year); - -if ( $resql ) -{ - $num = $db->num_rows($resql); - $i = 0; - - dol_syslog("$num factures a imprimer"); - - while ($i < $num) - { - $row = $db->fetch_row($resql); - - $file = DOL_DATA_ROOT."/facture/".$row[1]."/".$row[1].".pdf"; - - if (! copy($file,"/tmp/facture/".$row[1].".pdf")) - { - dol_syslog("Error copy $file"); - } - - $i++; - } - - $db->free($resql); -} -else -{ - $error = 1; - dol_syslog("Erreur ".$error); - dol_syslog($db->error()); -} - -$db->close(); - -?> diff --git a/htdocs/telephonie/script/facturation-pre-consolidation.php b/htdocs/telephonie/script/facturation-pre-consolidation.php deleted file mode 100644 index 294e7ab1cf5..00000000000 --- a/htdocs/telephonie/script/facturation-pre-consolidation.php +++ /dev/null @@ -1,60 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * Prépare les factures à imprimer - */ - -/** - \file htdocs/telephonie/script/facturation-pre-consolidation.php - \ingroup telephonie - \brief Consolidation des données de facturation - \version $Revision$ -*/ - -require ("../../master.inc.php"); - -$sql = "UPDATE "; -$sql .= " ".MAIN_DB_PREFIX."telephonie_communications_details"; -$sql .= " SET num_prefix = numero WHERE num_prefix IS NULL;"; - -$resql = $db->query($sql); - -if (! $resql ) -{ - $error = 1; - dol_syslog("Erreur ".$error); - dol_syslog($db->error()); -} - -$sql = "UPDATE "; -$sql .= " ".MAIN_DB_PREFIX."telephonie_communications_details"; -$sql .= " SET ym = date_format(date,'%y%m') WHERE ym IS NULL;"; - -$resql = $db->query($sql); - -if (! $resql ) -{ - $error = 1; - dol_syslog("Erreur ".$error); - dol_syslog($db->error()); -} - -$db->close(); -?> diff --git a/htdocs/telephonie/script/facturation-verif.php b/htdocs/telephonie/script/facturation-verif.php deleted file mode 100644 index addc771fb76..00000000000 --- a/htdocs/telephonie/script/facturation-verif.php +++ /dev/null @@ -1,105 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * - * Script de vérification avant facturation - */ - -require ("../../master.inc.php"); - -dol_syslog("facturation-verif.php BEGIN"); - -require_once (DOL_DOCUMENT_ROOT."/societe.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/facturetel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/telephonie.tarif.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/communication.class.php"); - -$error = 0; - -$sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."telephonie_import_cdr"; - -if ( $db->query($sql) ) -{ - $row = $db->fetch_row(); - dol_syslog("facturation-verif.php ".$row[0]." lignes de communications a verifier"); -} - -/******************************************************************************* - * - * Verifie la présence des tarifs adequat - * - */ -$grille_vente = TELEPHONIE_GRILLE_VENTE_DEFAUT_ID; - -$tarif_vente = new TelephonieTarif($db, $grille_vente, "vente"); - -dol_syslog("facturation-verif.php Grille : $grille contient ".$tarif_vente->num_tarifs." tarifs"); - -$sql = "SELECT distinct(num) FROM ".MAIN_DB_PREFIX."telephonie_import_cdr"; - -$resql = $db->query($sql); - -if ( $resql ) -{ - $nums = $db->num_rows($resql); - - while($row = $db->fetch_row($resql) ) - { - $numero = $row[0]; - - /* Reformatage du numéro */ - - if (substr($numero,0,2) == '00') /* International */ - { - } - elseif (substr($numero,0,2) == '06') /* Telephones Mobiles */ - { - $numero = "0033".substr($numero,1); - } - elseif (substr($numero,0,4) == substr($objp->client,0,4) ) /* Tarif Local */ - { - $numero = "0033999".substr($numero, 1); - } - else - { - $numero = "0033".substr($numero, 1); - } - - /* Numéros spéciaux */ - if (substr($numero,4,1) == 8) - { - - } - else - { - if ( $tarif_vente->cout($numero, $x, $y, $z) == 0) - { - print "Tarif vente manquant pour $numero ($row[0]) $x $y dans la grille $grille\n"; - } - } - - } - $db->free($resql); -} -dol_syslog($error ." erreurs trouvées"); - -dol_syslog("facturation-verif.php END"); -?> diff --git a/htdocs/telephonie/script/facture-detail-tableur-one.class.php b/htdocs/telephonie/script/facture-detail-tableur-one.class.php deleted file mode 100644 index b8b540836ae..00000000000 --- a/htdocs/telephonie/script/facture-detail-tableur-one.class.php +++ /dev/null @@ -1,157 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * - */ -require_once (DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_workbook.inc.php"); -require_once (DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_worksheet.inc.php"); - -class FactureDetailTableurOne { - - Function FactureDetailTableurOne($DB) - { - $this->db = $DB; - } - - Function GenerateFile($ligne_id, $year, $month) - { - $this->ligne = new LigneTel($db); - $this->ligne->id = $ligne_id; - - $dir = "/tmp"; - $error = 0; - - $sql = "SELECT rowid"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture"; - $sql .= " WHERE fk_ligne = '".$this->ligne->id."'"; - $sql .= " AND date = '".$year."-".$month."-01';"; - - $resql = $this->db->query($sql); - - if ($resql) - { - if ($row = $this->db->fetch_row($resql)) - { - $facid = substr('0000'.$row[0], -4); - } - else - { - //dol_syslog("Pas de facture pour ".$this->ligne->id); - } - } - else - { - dol_syslog("Error"); - } - - - if ($facid > 0) - { - - $dir = DOL_DATA_ROOT.'/telephonie/facture/'; - - $dir .= substr($facid,0,1)."/"; - $dir .= substr($facid,1,1)."/"; - $dir .= substr($facid,2,1)."/"; - $dir .= substr($facid,3,1)."/"; - - create_exdir($dir); - - $fname = $dir . $facid . "-detail.xls"; - - dol_syslog("Open ".$facid."-detail.xls"); - - $workbook = &new writeexcel_workbook($fname); - - $page = &$workbook->addworksheet($year."/".substr("00".$month,-2)); - - $fnb =& $workbook->addformat(); - $fnb->set_align('vcenter'); - $fnb->set_align('right'); - - $fp =& $workbook->addformat(); - $fp->set_align('vcenter'); - $fp->set_align('right'); - $fp->set_num_format('0.000'); - - $fdest =& $workbook->addformat(); - $fdest->set_align('vcenter'); - - $page->set_column(0,0,12); // A - $page->set_column(1,1,20); // B - $page->set_column(2,2,15); // C - - $page->set_column(3,3,30); // D - $page->set_column(6,6,7); // G - $page->set_column(9,9,7); // J - $page->set_column(12,12,7); // M - - $page->write(0, 0, "Ligne", $format_titre_agence1); - $page->write(0, 1, "Date", $format_titre); - $page->write(0, 2, "Numero", $format_titre); - $page->write(0, 3, "Destination", $format_titre); - $page->write(0, 4, "Duree", $format_titre); - $page->write(0, 5, "Cout", $format_titre); - - $sql = "SELECT ligne, date, numero, dest, dureetext, duree, cout_vente"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; - $sql .= " WHERE fk_ligne = '".$this->ligne->id."'"; - $sql .= " AND fk_telephonie_facture = ".$facid; - $sql .= " ORDER BY date ASC"; - - $resql = $this->db->query($sql); - - if ($resql) - { - $i = 0; - $numsql = $this->db->num_rows($resql); - - dol_syslog("Ligne : ".$this->ligne->id . " : ".$numsql); - - while ($i < $numsql) - { - $obj = $this->db->fetch_object($resql); - - $xx = $i + 1; - - $page->write_string($xx, 0, $obj->ligne, $fdest); - $page->write_string($xx, 1, $obj->date, $fdest); - $page->write_string($xx, 2, $obj->numero, $fdest); - $page->write_string($xx, 3, $obj->dest, $fdest); - $page->write($xx, 4, $obj->duree, $fnb); - $page->write($xx, 5, $obj->cout_vente, $fp); - - $i++; - } - $this->db->free($resql); - } - else - { - dol_syslog($this->db->error()); - } - - $workbook->close(); - //dol_syslog("Close $fname"); - } - - return $error; - } -} -?> diff --git a/htdocs/telephonie/script/facture-detail-tableur-two.class.php b/htdocs/telephonie/script/facture-detail-tableur-two.class.php deleted file mode 100644 index 2df9c9f96af..00000000000 --- a/htdocs/telephonie/script/facture-detail-tableur-two.class.php +++ /dev/null @@ -1,149 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * Créé un ou plusieurs fichiers xls avec les communications - * d'un contrat - * - */ -require_once (DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_workbook.inc.php"); -require_once (DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_worksheet.inc.php"); - -class FactureDetailTableurTwo { - - Function FactureDetailTableurTwo($DB) - { - $this->db = $DB; - } - - Function GenerateFile($contrat_id, $year, $month) - { - $error = 0; - - - $contrat_id = substr("0000".$contrat_id, -4); - - - $dir = DOL_DATA_ROOT.'/telephonie/contrat/'; - - $dir .= substr($contrat_id,0,1)."/"; - $dir .= substr($contrat_id,1,1)."/"; - $dir .= substr($contrat_id,2,1)."/"; - $dir .= substr($contrat_id,3,1)."/"; - - create_exdir($dir); - - $fname = $dir . $contrat_id . "-$month-$year-detail.xls"; - - dol_syslog("Open ".$fname); - - $workbook = &new writeexcel_workbook($fname); - - $page = &$workbook->addworksheet($year."/".substr("00".$month,-2)); - - $fnb =& $workbook->addformat(); - $fnb->set_align('vcenter'); - $fnb->set_align('right'); - - $fp =& $workbook->addformat(); - $fp->set_align('vcenter'); - $fp->set_align('right'); - $fp->set_num_format('0.000'); - - $fdest =& $workbook->addformat(); - $fdest->set_align('vcenter'); - - $page->set_column(0,0,12); // A - $page->set_column(1,1,20); // B - $page->set_column(2,2,15); // C - - $page->set_column(3,3,30); // D - $page->set_column(6,6,7); // G - $page->set_column(9,9,7); // J - $page->set_column(12,12,7); // M - - $page->write(0, 0, "Ligne", $format_titre_agence1); - $page->write(0, 1, "Date", $format_titre); - $page->write(0, 2, "Numero", $format_titre); - $page->write(0, 3, "Destination", $format_titre); - $page->write(0, 4, "Duree", $format_titre); - $page->write(0, 5, "Cout", $format_titre); - - $sql = "SELECT f.rowid, l.rowid"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture as f"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; - $sql .= " WHERE f.fk_ligne = l.rowid"; - $sql .= " AND l.fk_contrat = ".$contrat_id; - $sql .= " AND f.date = '".$year."-".$month."-01';"; - - $resql = $this->db->query($sql); - - if ($resql) - { - $num = $this->db->num_rows($resql); - $total = 0; - dol_syslog($num." lignes trouvées"); - $xx = 1; - while ($row = $this->db->fetch_row($resql)) - { - $sq = "SELECT ligne, date, numero, dest, dureetext, duree, cout_vente"; - $sq .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; - $sq .= " WHERE fk_ligne = '".$row[1]."'"; - $sq .= " AND fk_telephonie_facture = ".$row[0]; - $sq .= " ORDER BY date ASC"; - - $resq = $this->db->query($sq); - - if ($resq) - { - $i = 0; - $numsq = $this->db->num_rows($resq); - $total = $total + $numsq; - dol_syslog("Ligne : ".$row[1] . " : ".$numsq . " Total : ".$total); - - while ($i < $numsq) - { - $obj = $this->db->fetch_object($resq); - - $page->write_string($xx, 0, $obj->ligne, $fdest); - $page->write_string($xx, 1, $obj->date, $fdest); - $page->write_string($xx, 2, $obj->numero, $fdest); - $page->write_string($xx, 3, $obj->dest, $fdest); - $page->write($xx, 4, $obj->duree, $fnb); - $page->write($xx, 5, $obj->cout_vente, $fp); - - $i++; - $xx++; - } - $this->db->free($resq); - } - else - { - dol_syslog($this->db->error()); - } - } - - $workbook->close(); - //dol_syslog("Close $fname"); - } - - return $error; - } -} -?> diff --git a/htdocs/telephonie/script/getcdr.php b/htdocs/telephonie/script/getcdr.php deleted file mode 100644 index 6caa6a15d09..00000000000 --- a/htdocs/telephonie/script/getcdr.php +++ /dev/null @@ -1,180 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * - * Recupération des fichiers CDR - * - */ -require ("../../master.inc.php"); - -$nbdays = 1; - -for ($i = 1 ; $i < sizeof($argv) ; $i++) -{ - if ($argv[$i] == "-n") - { - $nbdays = $argv[$i+1]; - } - if ($argv[$i] == "-v") - { - $verbose = 1; - } -} - -if (! is_numeric($nbdays)) -{ - die("Bad argument $nbdays\n"); -} - -$ftp_server = GETCDR_FTP_SERVER; -$ftp_user_name = GETCDR_FTP_USER; -$ftp_user_pass = GETCDR_FTP_PASS; - -// Mise en place d'une connexion basique -$conn_id = ftp_connect($ftp_server); - -// Identification avec un nom d'utilisateur et un mot de passe -$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); - -// Vérification de la connexion -if (!$conn_id) -{ - echo "La connexion FTP a échouée !"; - echo "Tentative de connexion au serveur $ftp_server"; - exit; -} - -// Vérification de la connexion -if (!$login_result) -{ - echo "L'authentification FTP a échouée !"; - echo "Tentative de connexion au serveur $ftp_server pour l'utilisateur $ftp_user_name"; - exit; -} - -if (!file_exists(DOL_DATA_ROOT.'/telephonie/CDR/temp/')) -{ - create_dir(DOL_DATA_ROOT.'/telephonie/CDR/temp/'); -} - -$date = time() - (24 * 3600 * $nbdays); - -$file = "daily_report_".strftime("%Y%m%d", $date).".zip"; - -$remote_file = 'cdr/'.$file; - -$remote_size = ftp_size($conn_id, $remote_file); -if ($verbose) - echo "Récupération de ".$remote_size." Ko\n"; - -$local_file = DOL_DATA_ROOT.'/telephonie/CDR/temp/'.$file; -$handle = fopen($local_file, 'w'); - -if (ftp_fget($conn_id, $handle, $remote_file, FTP_BINARY, 0)) -{ - if ($verbose) - echo "Le chargement a réussi dans ".$local_file."\n"; -} -else -{ - echo "Echec de recuperation du fichier ".$remote_file."\n"; -} - -// Fermeture du flux FTP -ftp_close($conn_id); - -$local_size = filesize($local_file); - -if (file_exists($local_file) && $local_size === $remote_size && $local_size > 0) -{ - // Dezippage du fichier - $zip = zip_open($local_file); - - if ($zip) { - - while ($zip_entry = zip_read($zip)) - { - if ($verbose) - { - echo "Nom du fichier : " . zip_entry_name($zip_entry) . "\n"; - echo "Taille réelle : " . zip_entry_filesize($zip_entry) . "\n"; - echo "Taille compressée : " . zip_entry_compressedsize($zip_entry) . "\n"; - echo "Méthode : " . zip_entry_compressionmethod($zip_entry) . "\n"; - } - - if (zip_entry_open($zip, $zip_entry, "r")) - { - if ($verbose) - echo "Decompression dans ".DOL_DATA_ROOT.'/telephonie/CDR/atraiter/'.zip_entry_name($zip_entry)."\n"; - - $fp = fopen(DOL_DATA_ROOT.'/telephonie/CDR/atraiter/'.zip_entry_name($zip_entry),"w"); - - if ($fp) - { - $buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry)); - - if (fwrite($fp, $buf) === FALSE) - { - echo "Erreur d'ecriture\n"; - } - fclose($fp); - } - zip_entry_close($zip_entry); - } - } - zip_close($zip); - } - - // Archivage du fichier - -} -else -{ - print "Erreur de récupération du fichier ".$local_file."\n"; - print "Remote size ".$remote_size."\n"; - print "Local size ".$local_size."\n"; -} - -if (!file_exists(DOL_DATA_ROOT.'/telephonie/CDR/archive/')) -{ - create_dir(DOL_DATA_ROOT.'/telephonie/CDR/archive/'); -} - -$dir = DOL_DATA_ROOT.'/telephonie/CDR/archive/'.strftime("%Y", $date); -if (!file_exists($dir)) - create_dir($dir); - -$dir = DOL_DATA_ROOT.'/telephonie/CDR/archive/'.strftime("%Y", $date).'/'.strftime("%m", $date); -if (!file_exists($dir)) - create_dir($dir); - -function create_dir($dir) -{ - if (! file_exists($dir)) - { - umask(0); - if (! @mkdir($dir, 0755)) - { - die ("Erreur: Le répertoire ".$dir." n'existe pas et Dolibarr n'a pu le créer."); - } - } -} - -?> diff --git a/htdocs/telephonie/script/graph-contrat.php b/htdocs/telephonie/script/graph-contrat.php deleted file mode 100644 index 88314893da7..00000000000 --- a/htdocs/telephonie/script/graph-contrat.php +++ /dev/null @@ -1,32 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * - * Generation des graphiques pour un contrat particulier - * - * - */ -require ("../../master.inc.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/ProcessGraphContrats.class.php"); - -$process = new ProcessGraphContrats( $childrenNow, $clientPerChild ); -$process->go(269); - -?> diff --git a/htdocs/telephonie/script/graph-statistiques-analyse.php b/htdocs/telephonie/script/graph-statistiques-analyse.php deleted file mode 100644 index 5252bca595b..00000000000 --- a/htdocs/telephonie/script/graph-statistiques-analyse.php +++ /dev/null @@ -1,697 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * - * Generation des graphiques - * - * - * - */ -require ("../../master.inc.php"); - -require_once (DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/facturetel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/telephonie-tarif.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/communication.class.php"); - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/bar.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/camenbert.class.php"); - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/ca.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/gain.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/heureappel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/joursemaine.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/camoyen.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/appelsdureemoyenne.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/comm.nbmensuel.class.php"); - -$error = 0; - -$datetime = time(); - -$date = strftime("%d%h%Y%Hh%Mm%S",$datetime); - -$month = strftime("%m", $datetime); -$year = strftime("%Y", $datetime); - -if ($month == 1) -{ - $month = "12"; - $year = $year - 1; -} -else -{ - $month = substr("00".($month - 1), -2) ; -} - - -$img_root = DOL_DATA_ROOT."/graph/telephonie/"; - -/***********************************************************************/ -/* -/* Chiffre d'affaire mensuel -/* -/***********************************************************************/ - -$file = $img_root . "ca/ca.mensuel.png"; -print "Graph : Chiffre d'affaire mensuel $file\n"; -$graphca = new GraphCa($db, $file); -$graphca->GraphDraw(); - -/************************************************************************/ -/* -/* Chiffre d'affaire moyen -/* -/* -/************************************************************************/ - -print "\nGraph ca moyen\n"; - -$file = $img_root . "ca/gain_moyen_par_client.png"; -$graphgain = new GraphCaMoyen ($db, $file); - -$graphgain->show_console = 0 ; -$graphgain->GraphDraw(); - -/*************************************************************************/ -/* -/* Stats sur les communications -/* -/* -/*************************************************************************/ - -$sql = "SELECT ".$db->pdate("date")." as date, duree"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; - -if ($db->query($sql)) -{ - $heure_appel = array(); - $jour_semaine_nb = array(); - $jour_semaine_duree = array(); - - $num = $db->num_rows(); - print "$num lignes de comm a traiter\n"; - $i = 0; - - while ($i < $num) - { - $obj = $db->fetch_object(); - - $h = strftime("%H",$obj->date) * 1; // suppression du 0 - - $heure_appel_nb[$h]++; - $heure_appel_duree[$h] += $obj->duree; - - $u = strftime("%u",$obj->date) - 1; // 1 pour Lundi - - $jour_semaine_nb[$u]++; - $jour_semaine_duree[$u] += $obj->duree; - - $i++; - } -} - -$file = $img_root . "communications/heure_appel_nb.png"; -$graphha = new GraphHeureAppel ($db, $file); -$graphha->GraphDraw($heure_appel_nb); - - -$file = $img_root . "communications/joursemaine_nb.png"; -$graphha = new GraphJourSemaine ($db, $file); -$graphha->GraphDraw($jour_semaine_nb); - -repart_comm($db); - -$year = strftime("%Y", $datetime); -$month = strftime("%m", $datetime); - -for ($i = 1 ; $i < 4 ; $i++) -{ - $month = $month - 1; - - if ($month == 0) - { - $year = $year - 1; - $month = 12; - } - - repart($db,$year, $month); - repart_comm($db,$year, $month); - -} - - -function repart_comm($db, $year = 0, $month = 0) -{ - print "Répartition des communications\n"; - - $sql = "SELECT duree, numero"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; - - if ($year && $month) - { - print "Répartition des communications pour $month/$year\n"; - $month = substr("00".$month, -2); - $sql .= " WHERE date_format(date,'%Y%m') = '$year$month'"; - } - - if ($db->query($sql)) - { - $labels_duree = array(); - $repart_duree = array(0,0,0,0,0,0); - $repart_dureelong = array(0,0); - - $labels_dest= array(); - $repart_dest = array(0,0,0); - $repart_dest_temps = array(0,0,0); - - $num = $db->num_rows(); - - $i = 0; - - while ($i < $num) - { - $row = $db->fetch_row(); - - if ($row[0] < 10) - { - $repart_duree[0]++; - } - elseif ($row[0] >= 10 && $row[0] < 30) - { - $repart_duree[1]++; - } - elseif ($row[0] >= 30 && $row[0] < 60) - { - $repart_duree[2]++; - } - elseif ($row[0] >= 60 && $row[0] < 120) - { - $repart_duree[3]++; - } - elseif ($row[0] >= 120 && $row[0] < 300) - { - $repart_duree[4]++; - } - else - { - $repart_duree[5]++; - } - - if ($row[0] < 600) - { - $repart_dureelong[0]++; - } - else - { - $repart_dureelong[1]++; - } - - if (substr($row[1],0,2) == '00') - { - $repart_dest[0]++; - $repart_dest_temps[0] += $row[0]; - } - elseif (substr($row[1],0,2) == '06') - { - $repart_dest[1]++; - $repart_dest_temps[1] += $row[0]; - } - else - { - $repart_dest[2]++; - $repart_dest_temps[2] += $row[0]; - } - $i++; - } - } - else - { - print $sql ; - } - - if ($num > 0) - { - $labels_duree[0] = "< 10 sec"; - $labels_duree[1] = "10-30 sec"; - $labels_duree[2] = "30-60 sec"; - $labels_duree[3] = "60-120 sec"; - $labels_duree[4] = "120-300 sec"; - $labels_duree[5] = "> 300 sec"; - - $labels_dureelong[0] = "< 600 sec"; - $labels_dureelong[1] = "> 600 sec"; - - $labels_dest[0] = 'International'; - $labels_dest[1] = 'Mobile'; - $labels_dest[2] = 'Local/National'; - - $filem = DOL_DOCUMENT_ROOT."/telephonie/stats/communications/duree_repart.png"; - $filec = DOL_DOCUMENT_ROOT."/telephonie/stats/communications/dureelong_repart.png"; - $filed = DOL_DOCUMENT_ROOT."/telephonie/stats/communications/dest_repart.png"; - $filedt = DOL_DOCUMENT_ROOT."/telephonie/stats/communications/dest_temps_repart.png"; - - if ($year && $month) - { - $filem = DOL_DOCUMENT_ROOT."/telephonie/stats/communications/duree_repart-$year$month.png"; - $filec = DOL_DOCUMENT_ROOT."/telephonie/stats/communications/dureelong_repart-$year$month.png"; - $filed = DOL_DOCUMENT_ROOT."/telephonie/stats/communications/dest_repart-$year$month.png"; - $filedt = DOL_DOCUMENT_ROOT."/telephonie/stats/communications/dest_temps_repart-$year$month.png"; - } - - $graphm = new GraphCamenbert ($db, $filem); - $graphc = new GraphCamenbert ($db, $filec); - $graphd = new GraphCamenbert ($db, $filed); - $graphdt = new GraphCamenbert ($db, $filedt); - - $graphm->titre = "Répartition du nombre de communications par duree"; - $graphc->titre = "Répartition du nombre de communications par duree"; - $graphd->titre = "Répartition du nombre de communications par destination"; - $graphdt->titre = "Répartition du nombre de communications par destination"; - - if ($year && $month) - { - $graphm->titre = "Répart. du nbre de communications par duree $month/$year"; - $graphc->titre = "Répart. du nbre de communications par duree $month/$year"; - $graphd->titre = "Répart. du nbre de communications par destination $month/$year"; - $graphdt->titre = "Répart. du temps de communications par destination $month/$year"; - } - - $graphm->colors= array('#993333','#66cc99','#6633ff','#33ff33','#336699','#00ffff'); - $graphd->colors= array('#FFC0FF','#FF00FF','#C000C0'); - $graphdt->colors= array('#FFFFC0','#FFFF0F','#C0C000'); - - $graphm->GraphDraw($repart_duree, $labels_duree); - $graphc->GraphDraw($repart_dureelong, $labels_dureelong); - $graphd->GraphDraw($repart_dest, $labels_dest); - $graphdt->GraphDraw($repart_dest_temps, $labels_dest); - } -} - -/***************************************************************************/ -$sql = "SELECT date_format(date, '%Y%m'), count(distinct(ligne))"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; -$sql .= " GROUP BY date_format(date, '%Y%m') ASC"; - -if ($db->query($sql)) -{ - $nblignes = array(); - - $num = $db->num_rows(); - - $i = 0; - - while ($i < $num) - { - $row = $db->fetch_row(); - $nblignes[$i] = $row[1]; - $i++; - } -} - -/* - * - * - */ - -$sql = "SELECT date_format(date, '%Y%m'), sum(duree), count(duree)"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; -$sql .= " GROUP BY date_format(date, '%Y%m') ASC"; - -$resql = $db->query($sql); - -if ($resql) -{ - $durees = array(); - $kilomindurees = array(); - $durees_moyenne = array(); - $nombres = array(); - $labels = array(); - - $num = $db->num_rows($resql); - - $i = 0; - - while ($i < $num) - { - $row = $db->fetch_row($resql); - $labels[$i] = substr($row[0],4,2) . '/'.substr($row[0],2,2); - $durees[$i] = $row[1]; - $kilomindurees[$i] = ($row[1]/60000); - $durees_moyenne[$i] = ($row[1] / $row[2]); - $nombres[$i] = $row[2]; - - $nbappels_ligne[$i] = ($nombres[$i] / $nblignes[$i]); - - $i++; - } -} - - - -$file = $img_root . "communications/nbappelsparligne.png"; -$graphgain = new GraphBar ($db, $file); -$graphgain->show_console = 0 ; -$graphgain->titre = "Nb appels moyen par ligne"; -print $graphgain->titre."\n"; -$graphgain->barcolor = "pink"; -$graphgain->GraphDraw($file, $nbappels_ligne, $labels); - -$file = $img_root . "communications/dureemoyenne.png"; -$graphgain = new GraphBar ($db, $file); -$graphgain->show_console = 0 ; -$graphgain->titre = "Durée moyenne d'un appel"; -print $graphgain->titre."\n"; -$graphgain->barcolor = "yellow"; -$graphgain->GraphDraw($file, $durees_moyenne, $labels); - -$file = $img_root . "communications/nombre.png"; -$graphgain = new GraphBar ($db, $file); -$graphgain->show_console = 0 ; -$graphgain->titre = "Nombres d'appel mensuels"; -print $graphgain->titre."\n"; -$graphgain->GraphDraw($file, $nombres, $labels); - -/* ---------------------------------------------- */ - -$sql = "SELECT date_format(date, '%Y%m'), sum(duree), count(duree)"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; -$sql .= " WHERE numero like '06%'"; -$sql .= " GROUP BY date_format(date, '%Y%m') ASC"; - -if ($db->query($sql)) -{ - $durees = array(); - $kilomindurees = array(); - $durees_moyenne = array(); - $nombres = array(); - $labels = array(); - - $num = $db->num_rows(); - - $i = 0; - - while ($i < $num) - { - $row = $db->fetch_row(); - $labels[$i] = substr($row[0],4,2) . '/'.substr($row[0],2,2); - $durees[$i] = $row[1]; - $kilomindurees_mob[$i] = ($row[1]/60000); - - $i++; - } -} - - - -/* ---------------------------------------------- */ - -$sql = "SELECT date_format(date, '%Y%m'), sum(duree), count(duree)"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; -$sql .= " WHERE numero like '00%'"; -$sql .= " GROUP BY date_format(date, '%Y%m') ASC"; - -if ($db->query($sql)) -{ - $durees = array(); - $kilomindurees_inter = array(); - $durees_moyenne = array(); - $nombres = array(); - $labels = array(); - - $num = $db->num_rows(); - - $i = 0; - - while ($i < $num) - { - $row = $db->fetch_row(); - $labels[$i] = substr($row[0],4,2) . '/'.substr($row[0],2,2); - $durees[$i] = $row[1]; - $kilomindurees_inter[$i] = ($row[1]/60000); - - $i++; - } -} - -$file = $img_root . "communications/duree_inter.png"; -$graphgain = new GraphBar ($db, $file); -$graphgain->show_console = 0 ; -$graphgain->titre = "Nb minutes -> inter (milliers)"; -print $graphgain->titre."\n"; -$graphgain->GraphDraw($file, $kilomindurees_inter, $labels); - -/* ---------------------------------------------- */ - -$sql = "SELECT date_format(date, '%Y%m'), sum(duree)"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; -$sql .= " WHERE substring(numero, 1, 2) <> '00'"; -$sql .= " AND substring(numero, 1, 2) <> '06'"; -$sql .= " GROUP BY date_format(date, '%Y%m') ASC"; - -if ($db->query($sql)) -{ - $kilomindurees_loc = array(); - $labels = array(); - $num = $db->num_rows(); - $i = 0; - - while ($i < $num) - { - $row = $db->fetch_row(); - $labels[$i] = substr($row[0],4,2) . '/'.substr($row[0],2,2); - $kilomindurees_loc[$i] = ($row[1]/60000); - - $i++; - } -} - -$file = $img_root . "communications/duree_loc.png"; -$graphgain = new GraphBar ($db, $file); -$graphgain->show_console = 0 ; -$graphgain->titre = "Nb minutes -> local/national (milliers)"; -print $graphgain->titre."\n"; -$graphgain->GraphDraw($file, $kilomindurees_loc, $labels); - - -/**********************************************************************/ -/* -/* Stats sur les factures -/* -/* -/**********************************************************************/ - -$sql = "SELECT date_format(date,'%Y%m'), sum(cout_vente), sum(cout_achat), sum(gain), count(cout_vente)"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture"; -$sql .= " GROUP BY date_format(date,'%Y%m') ASC "; - -if ($db->query($sql)) -{ - $cout_vente = array(); - $cout_vente_moyen = array(); - $nb_factures = array(); - $jour_semaine_nb = array(); - $jour_semaine_duree = array(); - $gain = array(); - $gain_moyen = array(); - - $num = $db->num_rows(); - print "$num lignes de comm a traiter\n"; - $i = 0; - - while ($i < $num) - { - $row = $db->fetch_row(); - - $cout_vente[$i] = $row[1]; - - $gain[$i] = $row[3]; - $gain_moyen[$i] = ($row[3]/$row[4]); - $cout_vente_moyen[$i] = ($row[1]/$row[4]); - $nb_factures[$i] = $row[4]; - $labels[$i] = substr($row[0],4,2) . '/'.substr($row[0],2,2); - $i++; - } -} - - -$file = $img_root . "/factures/facture_moyenne.png"; -$graph = new GraphBar ($db, $file, $labels); -$graph->titre = "Facture moyenne"; -print $graph->titre."\n"; -$graph->barcolor = "blue"; -$graph->GraphDraw($file, $cout_vente_moyen, $labels); - -$file = $img_root . "/factures/gain_mensuel.png"; -$graph = new GraphBar ($db, $file); -$graph->titre = "Gain par mois en euros HT"; -print $graph->titre."\n"; -$graph->GraphDraw($file, $gain, $labels); - -$file = $img_root . "/factures/gain_moyen.png"; -$graph = new GraphBar ($db, $file); -$graph->titre = "Gain moyen par facture par mois"; -print $graph->titre."\n"; -$graph->barcolor = "blue"; -$graph->GraphDraw($file, $gain_moyen, $labels); - -$file = $img_root . "/factures/nb_facture.png"; -$graph = new GraphBar ($db, $file); -$graph->titre = "Nb de facture mois"; -print $graph->titre."\n"; -$graph->barcolor = "yellow"; -$graph->GraphDraw($file, $nb_factures, $labels); - -/* - * Répartition des factures - * - * - */ -repart($db); - -function repart($db, $year = 0, $month = 0) -{ - print "Répartition des factures\n"; - - $sql = "SELECT cout_vente, gain"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture"; - - if ($year && $month) - { - print "Répartition des factures pour $month/$year\n"; - $month = substr("00".$month, -2); - $sql .= " WHERE date_format(date,'%Y%m') = '$year$month'"; - } - - if ($db->query($sql)) - { - $labels = array(); - $repart_montant = array(); - $num = $db->num_rows(); - - $i = 0; - - while ($i < $num) - { - $row = $db->fetch_row(); - - if ($row[0] < 10) - { - $repart_montant[0]++; - } - elseif ($row[0] >= 10 && $row[0] < 20) - { - $repart_montant[1]++; - } - elseif ($row[0] >= 20 && $row[0] < 40) - { - $repart_montant[2]++; - } - elseif ($row[0] >= 40 && $row[0] < 70) - { - $repart_montant[3]++; - } - elseif ($row[0] >= 70 && $row[0] < 100) - { - $repart_montant[4]++; - } - else - { - $repart_montant[5]++; - } - - - if ($row[1] < 1) - { - $repart_gain[0]++; - } - elseif ($row[1] >= 1 && $row[1] < 5) - { - $repart_gain[1]++; - } - elseif ($row[1] >= 5 && $row[1] < 10) - { - $repart_gain[2]++; - } - elseif ($row[1] >= 10 && $row[1] < 20) - { - $repart_gain[3]++; - } - elseif ($row[1] >= 20 && $row[1] < 50) - { - $repart_gain[4]++; - } - else - { - $repart_gain[5]++; - } - $i++; - } - } - else - { - print $sql ; - } - - if ($num > 0) - { - $labels_montant[0] = "< 10"; - $labels_montant[1] = "10-20"; - $labels_montant[2] = "20-40"; - $labels_montant[3] = "40-70"; - $labels_montant[4] = "70-100"; - $labels_montant[5] = "> 100"; - - $labels_gain[0] = "< 1"; - $labels_gain[1] = "1-5"; - $labels_gain[2] = "5-10"; - $labels_gain[3] = "10-20"; - $labels_gain[4] = "20-50"; - $labels_gain[5] = "> 50"; - - $filem = DOL_DOCUMENT_ROOT."/telephonie/stats/factures/montant_repart.png"; - $fileg = DOL_DOCUMENT_ROOT."/telephonie/stats/factures/gain_repart.png"; - - if ($year && $month) - { - $filem = DOL_DOCUMENT_ROOT."/telephonie/stats/factures/montant_repart-$year$month.png"; - $fileg = DOL_DOCUMENT_ROOT."/telephonie/stats/factures/gain_repart-$year$month.png"; - } - - $graphm = new GraphCamenbert ($db, $filem); - $graphg = new GraphCamenbert ($db, $fileg); - - - $graphm->titre = "Répartition du nombre de factures par montant"; - $graphg->titre = "Répartition du nombre de factures par gain"; - - if ($year && $month) - { - $graphm->titre = "Répart. du nbre de factures par montant $month $year"; - $graphg->titre = "Répart. du nbre de factures par gain $month $year"; - } - - $graphm->colors= array('#993333','#66cc99','#6633ff','#33ff33','#336699','#00ffff'); - - // $graphm->GraphDraw($filem, $repart_montant, $labels_montant); - // $graphg->GraphDraw($fileg, $repart_gain, $labels_gain); - } -} -?> diff --git a/htdocs/telephonie/script/graph-statistiques-ca.php b/htdocs/telephonie/script/graph-statistiques-ca.php deleted file mode 100644 index e518ea6d834..00000000000 --- a/htdocs/telephonie/script/graph-statistiques-ca.php +++ /dev/null @@ -1,335 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * Generation de graphiques - * - */ -require ("../../master.inc.php"); - -$verbose = 0; - -$datetime = time(); -$date = strftime("%d%h%Y%Hh%Mm%S",$datetime); -$year = strftime("%Y", $datetime); - -for ($i = 1 ; $i < sizeof($argv) ; $i++) -{ - if ($argv[$i] == "-v") - { - $verbose = 1; - } - if ($argv[$i] == "-vv") - { - $verbose = 2; - } - if ($argv[$i] == "-vvv") - { - $verbose = 3; - } - if ($argv[$i] == "-y") - { - $year = $argv[$i+1]; - } -} - -require_once (DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/facturetel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/telephonie-tarif.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/communication.class.php"); - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/bar.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/baraccumul.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/camenbert.class.php"); - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/ca.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/gain.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/heureappel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/joursemaine.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/camoyen.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/appelsdureemoyenne.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/comm.nbmensuel.class.php"); - -$error = 0; - -$img_root = DOL_DATA_ROOT."/graph/telephonie"; - -$month = array(); -$month[1] = 'J'; -$month[2] = 'F'; -$month[3] = 'M'; -$month[4] = 'A'; -$month[5] = 'M'; -$month[6] = 'J'; -$month[7] = 'J'; -$month[8] = 'A'; -$month[9] = 'S'; -$month[10] = 'O'; -$month[11] = 'N'; -$month[12] = 'D'; - -/**********************************************************************/ -/* -/* Stats sur les factures -/* -/* -/**********************************************************************/ - -$sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_stats"; -$sql .= " WHERE graph IN ('factures.facture_moyenne','factures.ca_mensuel','factures.nb_mensuel')"; -$sql .= " AND legend like '".$year."%';"; -$resql = $db->query($sql); - -$sql = "SELECT date_format(tf.date,'%Y%m'), sum(tf.cout_vente)"; -$sql .= ", sum(tf.cout_achat), sum(tf.gain), count(tf.cout_vente)"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture as tf"; -$sql .= " WHERE date_format(tf.date,'%Y') ='".$year."'"; -$sql .= " GROUP BY date_format(tf.date,'%Y%m') ASC ;"; - -$resql = $db->query($sql); - -if ($resql) -{ - $cout_vente = array_pad(array(),12,0); - $cout_vente_prev = array(); - $cout_vente_autr = array(); - $cout_vente_moyen = array_pad(array(),12,0); - $nb_factures = array_pad(array(),12,0); - $jour_semaine_nb = array(); - $jour_semaine_duree = array(); - $gain = array_pad(array(),12,0); - $gain_moyen = array_pad(array(),12,0); - $labels = array_pad(array(),12,0); - $short_labels = array(1,2,3,4,5,6,7,8,9,10,11,12); - - $num = $db->num_rows($resql); - $i = 0; - - while ($i < $num) - { - $row = $db->fetch_row($resql); - - $cout_vente[$i] = $row[1]; - - if ($row[5] == 3) - { - $cout_vente_prev[$i] = $row[1]; - } - else - { - $cout_vente_autr[$i] = $row[1]; - } - - $gain[$i] = $row[3]; - $gain_moyen[$i] = ($row[3]/$row[4]); - $cout_vente_moyen[$i] = ($row[1]/$row[4]); - $nb_factures[$i] = $row[4]; - $labels[$i] = $row[0]; - $short_labels[$i] = $month[(substr($row[0],-2)*1)]; - - $sqli = " INSERT INTO ".MAIN_DB_PREFIX."telephonie_stats"; - $sqli .= " (graph, ord, legend, valeur) VALUES ("; - $sqli .= "'factures.ca_mensuel','".$i."','".$labels[$i]."','".$cout_vente[$i]."')"; - if (!$resqli = $db->query($sqli)) print $db->error(); - - $sqli = " INSERT INTO ".MAIN_DB_PREFIX."telephonie_stats"; - $sqli .= " (graph, ord, legend, valeur) VALUES ("; - $sqli .= "'factures.nb_mensuel','".$i."','".$labels[$i]."','".$nb_factures[$i]."')"; - if (!$resqli = $db->query($sqli)) print $db->error(); - - $sqli = " INSERT INTO ".MAIN_DB_PREFIX."telephonie_stats"; - $sqli .= " (graph, ord, legend, valeur) VALUES ("; - $sqli .= "'factures.facture_moyenne','".$i."','".$labels[$i]."','".$cout_vente_moyen[$i]."')"; - if (!$resqli = $db->query($sqli)) print $db->error(); - - $i++; - } -} -else -{ - print $db->error(); -} -$file = $img_root . "/factures/ca_mensuel.$year.png"; -if ($verbose) print "Graph $file\n"; -$graph = new GraphBar ($db, $file); -$graph->titre = "Chiffre d'affaire par mois en euros HT"; -$graph->width = 440; -$graph->GraphDraw($file, $cout_vente, $short_labels); - -$file = $img_root . "/factures/facture_moyenne.$year.png"; -if ($verbose) print "Graph $file\n"; -$graph = new GraphBar ($db, $file, $labels); -$graph->titre = "Facture moyenne"; -$graph->barcolor = "blue"; -$graph->width = 440; -$graph->GraphDraw($file, $cout_vente_moyen, $short_labels); - -$file = $img_root . "/factures/gain_mensuel.$year.png"; -if ($verbose) print "Graph $file\n"; -$graph = new GraphBar ($db, $file); -$graph->titre = "Marge en euros HT $year"; -$graph->width = 440; -$graph->GraphDraw($file, $gain, $short_labels); - -$file = $img_root . "/factures/gain_moyen.$year.png"; -if ($verbose) print "Graph $file\n"; -$graph = new GraphBar ($db, $file); -$graph->titre = "Marge moyenne par facture $year"; -$graph->width = 440; -$graph->barcolor = "blue"; -$graph->GraphDraw($file, $gain_moyen, $short_labels); - -$file = $img_root . "/factures/nb_facture.$year.png"; -if ($verbose) print "Graph $file\n"; -$graph = new GraphBar ($db, $file); -$graph->titre = "Nb de facture mois $year"; -$graph->width = 440; -$graph->barcolor = "yellow"; -$graph->GraphDraw($file, $nb_factures, $short_labels); - - -$sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_stats"; -$sql .= " WHERE graph IN ('factures.ca_mensuel_preleve','factures.ca_mensuel_autre')"; -$resql = $db->query($sql); - - -$sql = "SELECT date_format(tf.date,'%Y%m'), sum(tf.cout_vente)"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture as tf"; -$sql .= " , ".MAIN_DB_PREFIX."facture as f"; -$sql .= " WHERE tf.fk_facture = f.rowid"; -$sql .= " AND f.fk_mode_reglement = 3"; -$sql .= " GROUP BY date_format(tf.date,'%Y%m') ASC "; - -$resql = $db->query($sql); - -if ($resql) -{ - $cvp = array(); - $num = $db->num_rows($resql); - $i = 0; - - while ($i < $num) - { - $row = $db->fetch_row($resql); - - $cvp[$row[0]] = $row[1]; - - $sqli = " INSERT INTO ".MAIN_DB_PREFIX."telephonie_stats"; - $sqli .= " (graph, ord, legend, valeur) VALUES ("; - $sqli .= "'factures.ca_mensuel_preleve','".$i."','".$row[0]."','".$row[1]."')"; - if (!$resqli = $db->query($sqli)) print $db->error(); - - $i++; - } -} -else -{ - print $db->error(); -} - -$sql = "SELECT date_format(tf.date,'%Y%m'), sum(tf.cout_vente)"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture as tf"; -$sql .= " , ".MAIN_DB_PREFIX."facture as f"; -$sql .= " WHERE tf.fk_facture = f.rowid"; -$sql .= " AND f.fk_mode_reglement <> 3"; -$sql .= " GROUP BY date_format(tf.date,'%Y%m') ASC "; - -$resql = $db->query($sql); - -if ($resql) -{ - $cva = array(); - $num = $db->num_rows($resql); - $i = 0; - - while ($i < $num) - { - $row = $db->fetch_row($resql); - - $cva[$row[0]] = $row[1]; - - $sqli = " INSERT INTO ".MAIN_DB_PREFIX."telephonie_stats"; - $sqli .= " (graph, ord, legend, valeur) VALUES ("; - $sqli .= "'factures.ca_mensuel_autre','".$i."','".$row[0]."','".$row[1]."')"; - if (!$resqli = $db->query($sqli)) print $db->error(); - - $i++; - } -} -else -{ - print $db->error(); -} - -$sql = "SELECT date_format(tf.date,'%Y%m'), sum(tf.fourn_montant)"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details as tf"; -$sql .= " GROUP BY date_format(tf.date,'%Y%m') ASC "; - -$resql = $db->query($sql); - -if ($resql) -{ - $cvc = array(); - $num = $db->num_rows($resql); - $i = 0; - - while ($i < $num) - { - $row = $db->fetch_row($resql); - $cvc[$row[0]] = $row[1]; - - $i++; - } -} -else -{ - print $db->error(); -} - -$i = 0; -foreach ($labels as $labl) -{ - $cout_vente_prelev[$i] = $cvp[$labl]; - $cout_vente_autre[$i] = $cva[$labl]; - $cout_achat[$i] = $cvc[$labl]; - $labels[$i] = substr($labl, -2); - $i++; -} - - -$file = $img_root . "/factures/ca_mensuel_preleve.png"; - -$graph = new GraphBarAccumul ($db, $file); -$graph->titre = "Chiffre d'affaire par méthode de réglement"; -$graph->width = 640; -$graph->height = 480; -$graph->barcolor = "yellow"; - -$xdatas[0] = array($cout_vente_prelev, $cout_vente_autre); -$xdatas[1] = array($cout_achat); - -$graph->legend[0][0] = "Factures prélevées"; -$graph->legend[0][1] = "Factures non-prélevées"; -$graph->legend[1][0] = "Coût fournisseur"; - -$graph->add_datas($xdatas); - -$graph->GraphDraw($file, $labels, $cout_vente); - -?> diff --git a/htdocs/telephonie/script/graph-statistiques-clients.php b/htdocs/telephonie/script/graph-statistiques-clients.php deleted file mode 100644 index 5fd959cd434..00000000000 --- a/htdocs/telephonie/script/graph-statistiques-clients.php +++ /dev/null @@ -1,74 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * - * Generation des graphiques clients - * - * - */ -require ("../../master.inc.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/ProcessGraphClients.class.php"); - -$childrenTotal = 5; -$childrenNow = 0; -$clientPerChild = 0; - -$sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_client_stats"; - -if ($db->query($sql)) -{ - -} - -$sql = "SELECT max(s.rowid)"; -$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; - -if ($db->query($sql)) -{ - $row = $db->fetch_row(); - $clientPerChild = ceil($row[0] / $childrenTotal); - $db->free(); -} -else -{ - exit("Erreur selection des clients"); -} - -while ( $childrenNow < $childrenTotal ) -{ - $pid = pcntl_fork(); - - if ( $pid == -1 ) - { - die( "error\n" ); - } - elseif ( $pid ) - { - $childrenNow++; - } - else - { - $process = new ProcessGraphClients( $childrenNow, $clientPerChild ); - $process->go(); - die(); - } -} - -?> diff --git a/htdocs/telephonie/script/graph-statistiques-commerciaux.php b/htdocs/telephonie/script/graph-statistiques-commerciaux.php deleted file mode 100644 index 42d93599bcc..00000000000 --- a/htdocs/telephonie/script/graph-statistiques-commerciaux.php +++ /dev/null @@ -1,237 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * - * Generation des graphiques relatifs aux commerciaux - * - */ -require ("../../master.inc.php"); -$verbose = 0; -for ($i = 1 ; $i <= sizeof($argv) ; $i++) -{ - if ($argv[$i] == "-v") - $verbose = 1; - if ($argv[$i] == "-vv") - $verbose = 2; -} - -require_once (DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/facturetel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/telephonie-tarif.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/communication.class.php"); - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/bar.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/camenbert.class.php"); - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/commerciaux/commercial.ca.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/commerciaux/commercial.gain.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/commerciaux/groupes/groupe.gain.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/commerciaux/groupes/groupe.ca.class.php"); -$year = strftime("%Y",time()); -$error = 0; -if (strftime("%m",time()) == 1) -{ - $year = $year -1; -} -/* - * Création des répertoires - * - */ -$dirs[0] = DOL_DATA_ROOT."/graph/"; -$dirs[1] = DOL_DATA_ROOT."/graph/telephonie/"; -$dirs[2] = DOL_DATA_ROOT."/graph/telephonie/commercials/"; -$dirs[2] = DOL_DATA_ROOT."/graph/telephonie/distributeurs/"; - -$img_root = DOL_DATA_ROOT."/graph/telephonie/"; - -if (is_array($dirs)) -{ - foreach ($dirs as $key => $value) - { - $dir = $value; - - if (! file_exists($dir)) - { - umask(0); - if (! @mkdir($dir, 0755)) - { - print "Erreur: Le répertoire '$dir' n'existe pas et Dolibarr n'a pu le créer."; - } - else - { - print $dir ." créé\n"; - } - } - } -} - -$sql = "SELECT distinct fk_commercial_sign"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne"; - -$resql = $db->query($sql); -if ($resql) -{ - $num = $db->num_rows($resql); - $i = 0; - - while ($i < $num) - { - $row = $db->fetch_row($resql); - - /* Chiffre d'affaire mensuel */ - - $file = $img_root . "commercials/".$row[0]."/ca.mensuel.$year.png"; - if ($verbose) print "CA ".$row[0]."\n"; - $graph = new GraphCommercialChiffreAffaire($db, $file, $year); - $graph->width = 400; - $graph->GraphMakeGraph($row[0]); - - /* Gain */ - - $file = $img_root . "commercials/".$row[0]."/gain.mensuel.$year.png"; - if ($verbose) print "Gain ".$row[0]."\n"; - $graph = new GraphCommercialGain($db, $file, $year); - $graph->width = 400; - $graph->GraphMakeGraph($row[0]); - - /* - * Statut des lignes - * - */ - require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/lignes/statut.class.php"); - - $file = $img_root . "commercials/".$row[0]."/lignes.statut.png"; - if ($verbose) print "Graph : Lignes statut $file\n"; - $graph = new GraphLignesStatut($db, $file); - $graph->GraphMakeGraph($row[0]); - - $i++; - } -} - -/* - * Groupes - * - */ -$sql = "SELECT rowid"; -$sql .= " FROM ".MAIN_DB_PREFIX."usergroup as u"; - -$resql = $db->query($sql); -if ($resql) -{ - $num = $db->num_rows($resql); - $i = 0; - - while ($i < $num) - { - $row = $db->fetch_row($resql); - - /* Gain */ - - $file = $img_root . "commerciaux/groupes/".$row[0]."/gain.mensuel.png"; - if ($verbose) print "Graph : Lignes commandes$file\n"; - $graph = new GraphGroupeGain($db, $file); - $graph->width = 400; - $graph->GraphMakeGraph($row[0]); - - /* Chiffre d'affaire */ - - $file = $img_root . "commerciaux/groupes/".$row[0]."/ca.mensuel.png"; - if ($verbose) print "Graph : Lignes commandes$file\n"; - $graph = new GraphGroupeChiffreAffaire($db, $file); - $graph->width = 400; - $graph->GraphMakeGraph($row[0]); - - $i++; - } -} - -/* - * Contrats - * - */ -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/commerciaux/contrats.class.php"); - -$file = $img_root . "commercials/contrats-suivis.png"; -if ($verbose) print "Graph : Commerciaux contrats $file\n"; -$graph = new GraphCommerciauxContrats($db, $file); -$graph->GraphMakeGraph("suivi"); - -$file = $img_root . "commercials/contrats-signes.png"; -if ($verbose) print "Graph : Commerciaux contrats $file\n"; -$graph = new GraphCommerciauxContrats($db, $file); -$graph->GraphMakeGraph("signe"); - -/* - * Prises d'ordres - * - */ -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/commerciaux/commercial.po.class.php"); - -$sql = "SELECT date_format(datepo,'%Y%m'), sum(montant), fk_commercial, fk_distributeur"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat_priseordre"; -$sql .= " WHERE year(now()) = year(datepo)"; -$sql .= " GROUP BY date_format(datepo,'%Y%m'), fk_commercial, fk_distributeur"; -$sql .= " ORDER BY date_format(datepo,'%Y%m') ASC"; - -$resql = $db->query($sql); -if ($resql) -{ - $datas_comm = array(); - $labels_comm = array(); - - $datas_dist = array(); - $labels_dist = array(); - - while ( $row = $db->fetch_row($resql) ) - { - $datas_comm[$row[2]][$row[0]] += $row[1]; - $datas_dist[$row[3]][$row[0]] += $row[1]; - } - - foreach($datas_comm as $comm => $value) - { - //print $comm."\n"; - - $file = $img_root . "commercials/".$comm."/po.$year.mensuel.png"; - if ($verbose) print "Graph : Lignes commandes$file\n"; - $graph = new GraphCommercialPO($db, $file); - $graph->width = 400; - $graph->GraphMakeGraph($value); - } -} - -function _cdir($dir) -{ - if (! file_exists($dir)) - { - umask(0); - if (! @mkdir($dir, 0755)) - { - print "Erreur: Le répertoire '$dir' n'existe pas et Dolibarr n'a pu le créer."; - } - else - { - //print $dir ." créé\n"; - } - } -} - -?> diff --git a/htdocs/telephonie/script/graph-statistiques-communications.php b/htdocs/telephonie/script/graph-statistiques-communications.php deleted file mode 100644 index cc01f000c3c..00000000000 --- a/htdocs/telephonie/script/graph-statistiques-communications.php +++ /dev/null @@ -1,160 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * - * Generation des graphiques - * - * - * - */ -require ("../../master.inc.php"); - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/bar.class.php"); - -$img_root = DOL_DATA_ROOT."/graph/telephonie/"; - -$verbose = 0; - -$nbval = 14; - -/* - * Remplacé par ...statistiques-fournisseurs.php - * - $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_stats"; - $sql .= " WHERE graph = 'communications.duree'"; - - $resql = $db->query($sql); - - $sql = "SELECT date_format(date, '%m'), sum(duree), count(duree)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; - $sql .= " GROUP BY date_format(date, '%Y%m') ASC"; - $resql = $db->query($sql); - - _deal($db, $resql, "communications.duree", $kilomindurees, $labels); - - $file = $img_root . "communications/duree.png"; - $graphgain = new GraphBar ($db, $file); - $graphgain->show_console = 0 ; - $graphgain->width = 480 ; - $graphgain->titre = "Nb minutes (milliers)"; - print $graphgain->titre."\n"; - $graphgain->GraphDraw($file, $kilomindurees, $labels); -*/ - -/* - * - * - */ - -$sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_stats"; -$sql .= " WHERE graph = 'communications.duree_mobiles'"; - -$resql = $db->query($sql); - -$sql = "SELECT date_format(date, '%m'), sum(duree), count(duree)"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; -$sql .= " WHERE numero like '06%'"; -$sql .= " GROUP BY date_format(date, '%Y%m') ASC"; - -$resql = $db->query($sql); - -if ($resql) -{ - $durees = array(); - $kilomindurees = array(); - $labels = array(); - - $num = $db->num_rows($resql); - $lim = ($num - $nbval); - $i = 0; - $j = 0; - - while ($i < $num) - { - $row = $db->fetch_row($resql); - if ($i >= $lim ) - { - $labels[$j] = $row[0]; - $durees[$j] = $row[1]; - $kilomindurees_mob[$j] = ($row[1]/60000); - - $sqli = " INSERT INTO ".MAIN_DB_PREFIX."telephonie_stats"; - $sqli .= " (graph, ord, legend, valeur) VALUES ("; - $sqli .= "'communications.duree_mobiles','".$j."','".$row[0]."','".($row[1]/60)."')"; - - if (!$resqli = $db->query($sqli)) - { - print $db->error(); - } - $j++; - } - $i++; - } -} - -$file = $img_root . "communications/duree_mob.png"; -$graphgain = new GraphBar ($db, $file); -$graphgain->show_console = 0 ; -$graphgain->width = 480 ; -$graphgain->titre = "Nb minutes -> portables (milliers)"; -if ($verbose) - print $graphgain->titre."\n"; -$graphgain->GraphDraw($file, $kilomindurees_mob, $labels); - - - - - - -function _deal($db, $resql, $graph, &$data, &$labels) -{ - global $nbval; - - if ($resql) - { - $num = $db->num_rows($resql); - $lim = ($num - $nbval); - $i = 0; - $j = 0; - - while ($i < $num) - { - $row = $db->fetch_row($resql); - - if ($i >= $lim ) - { - $labels[$j] = $row[0]; - $data[$j] = ($row[1]/60000); - - $sqli = " INSERT INTO ".MAIN_DB_PREFIX."telephonie_stats"; - $sqli .= " (graph, ord, legend, valeur) VALUES ("; - $sqli .= "'".$graph."','".$j."','".$row[0]."','".($row[1]/60)."')"; - - if (!$resqli = $db->query($sqli)) - { - print $db->error(); - } - $j++; - } - $i++; - } - } -} -?> diff --git a/htdocs/telephonie/script/graph-statistiques-contrats.php b/htdocs/telephonie/script/graph-statistiques-contrats.php deleted file mode 100644 index 6e2b745f7f7..00000000000 --- a/htdocs/telephonie/script/graph-statistiques-contrats.php +++ /dev/null @@ -1,77 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * - * Generation des graphiques contrats - * - * - */ -require ("../../master.inc.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/ProcessGraphContrats.class.php"); - -$verbose = 0; - -$sql = "SELECT max(rowid)"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat"; - -if ($db->query($sql)) -{ - $row = $db->fetch_row(); - $maxid = $row[0]; - $db->free(); -} - -$fork = 0; - -if ($fork == 0) -{ - $process = new ProcessGraphContrats( 0, $maxid, $verbose ); - $process->go(0, $verbose); -} -else -{ - $childrenTotal = 6; - $childrenNow = 0; - $clientPerChild = 0; - - $clientPerChild = ceil($row[0] / $childrenTotal); - - while ( $childrenNow < $childrenTotal ) - { - - $pid = pcntl_fork(); - - if ( $pid == -1 ) - { - die( "error\n" ); - } - elseif ( $pid == 0 ) - { - $childrenNow++; - } - else - { - $process = new ProcessGraphContrats( $childrenNow, $clientPerChild, $verbose ); - $process->go(0, $verbose); - die(); - } - } -} -?> diff --git a/htdocs/telephonie/script/graph-statistiques-destination.php b/htdocs/telephonie/script/graph-statistiques-destination.php deleted file mode 100644 index f63a8665216..00000000000 --- a/htdocs/telephonie/script/graph-statistiques-destination.php +++ /dev/null @@ -1,79 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * - * Generation des graphiques clients - * - * - */ -require "../../master.inc.php"; - - -$sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_stats_destination"; - -if ($db->query($sql)) -{ - -} - -$sql = "SELECT dest, count(cout_vente), sum(cout_vente), sum(duree)"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; -$sql .= " GROUP BY dest"; - -$resql = $db->query($sql); - -$dest = array(); - -if ($resql) -{ - $i = 0; - $num = $db->num_rows($resql); - - while ($i < $num) - { - - $row = $db->fetch_row(); - $dest[$i] = $row; - $i++; - } - $db->free($resql); -} -else -{ - print $db->error(); -} - -for ($i = 0 ; $i < $num ; $i++) -{ - $dm = ($dest[$i][3]/$dest[$i][1]); - - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_stats_destination"; - $sql .= " ( destination, nbappels, ca, duree, duree_moy)"; - $sql .= " VALUES ('".$dest[$i][0]."'"; - $sql .= ",".$dest[$i][1]; - $sql .= ",".$dest[$i][2]; - $sql .= ",".$dest[$i][3]; - $sql .= ",".ereg_replace(",",".",$dm).")"; - - $resql = $db->query($sql); -} - -?> diff --git a/htdocs/telephonie/script/graph-statistiques-distributeurs.php b/htdocs/telephonie/script/graph-statistiques-distributeurs.php deleted file mode 100644 index fc66b0d419f..00000000000 --- a/htdocs/telephonie/script/graph-statistiques-distributeurs.php +++ /dev/null @@ -1,208 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * - * Generation des graphiques relatifs aux distributeurs - * - */ -require ("../../master.inc.php"); -$verbose = 0; - -$year = strftime("%Y",time()); - -for ($i = 1 ; $i <= sizeof($argv) ; $i++) -{ - if ($argv[$i] == "-v") - $verbose = 1; - - if ($argv[$i] == "-vv") - $verbose = 1; - - if ($argv[$i] == "-y") - { - $year = $argv[$i+1]; - } -} - -if ($verbose) print "Année $year\n"; - -require_once (DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/facturetel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/telephonie-tarif.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/communication.class.php"); - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/bar.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/camenbert.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/commerciaux/commercial.ca.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/commerciaux/commercial.gain.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/commerciaux/groupes/groupe.gain.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/commerciaux/groupes/groupe.ca.class.php"); - -$error = 0; - - -/* - * Création des répertoires - * - */ -$dirs[0] = DOL_DATA_ROOT."/graph/"; -$dirs[1] = DOL_DATA_ROOT."/graph/telephonie/"; -$dirs[2] = DOL_DATA_ROOT."/graph/telephonie/distributeurs/"; - -$img_root = DOL_DATA_ROOT."/graph/telephonie/"; - -if (is_array($dirs)) -{ - foreach ($dirs as $key => $value) - { - $dir = $value; - - if (! file_exists($dir)) - { - umask(0); - if (! @mkdir($dir, 0755)) - { - print "Erreur: Le répertoire '$dir' n'existe pas et Dolibarr n'a pu le créer."; - } - else - { - print $dir ." créé\n"; - } - } - } -} -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/distributeurs/distributeur.gain.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/distributeurs/distributeur.ca.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/distributeurs/distributeur.commission.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/distributeurs/distributeur.resultat.class.php"); -/* - * Distributeurs - * - */ -$sql = "SELECT distinct fk_distributeur"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_distributeur_commerciaux"; - -$resql = $db->query($sql); -if ($resql) -{ - while ($row = $db->fetch_row($resql)) - { - /* Ca */ - $dir = $img_root . "distributeurs/".$row[0]."/"; - _cdir($dir); - $file = $dir."ca.mensuel.png"; - if ($verbose) print "Graph : ca distributeur ".$row[0]."\n"; - if ($verbose==2) print "Graph : ca distributeur $file\n"; - $graph = new GraphDistributeurCa($db, $file); - $graph->year = $year; - $graph->width = 500; - $graph->height = 260; - $graph->GraphMakeGraph($row[0]); - - /* Gain */ - $dir = $img_root . "distributeurs/".$row[0]."/"; - _cdir($dir); - $file = $dir."gain.mensuel.png"; - if ($verbose) print "Graph : gain distributeur ".$row[0]."\n"; - $graph = new GraphDistributeurGain($db, $file); - $graph->year = $year; - $graph->width = 500; - $graph->height = 260; - $graph->GraphMakeGraph($row[0]); - - /* Commission */ - $dir = $img_root . "distributeurs/".$row[0]."/"; - _cdir($dir); - $file = $dir."commission.mensuel.png"; - if ($verbose) print "Graph : commission distributeur ".$row[0]."\n"; - $graph = new GraphDistributeurCommission($db, $file); - $graph->year = $year; - $graph->width = 500; - $graph->height = 260; - $graph->GraphMakeGraph($row[0]); - - /* Resultat */ - $dir = $img_root . "distributeurs/".$row[0]."/"; - _cdir($dir); - $file = $dir."resultat.mensuel.png"; - if ($verbose) print "Graph : resultat distributeur ".$row[0]."\n"; - $graph = new GraphDistributeurResultat($db, $file); - $graph->year = $year; - $graph->width = 500; - $graph->height = 260; - $graph->GraphMakeGraph($row[0]); - } -} - -/* - * Globaux - * - */ -/* Gain */ -$file = $img_root . "distributeurs/gain.mensuel.$year.png"; -if ($verbose) print "Graph : gain distributeur $file\n"; -$graph = new GraphDistributeurGain($db, $file); -$graph->year = $year; -$graph->width = 500; -$graph->height = 260; -$graph->GraphMakeGraph(0); - -$file = $img_root . "distributeurs/ca.mensuel.$year.png"; -if ($verbose) print "Graph : ca distributeur $file\n"; -$graph = new GraphDistributeurCa($db, $file); -$graph->year = $year; -$graph->width = 500; -$graph->height = 260; -$graph->GraphMakeGraph(0); - -$file = $img_root . "distributeurs/commission.mensuel.$year.png"; -if ($verbose) print "Graph : commission distributeur $file\n"; -$graph = new GraphDistributeurCommission($db, $file); -$graph->year = $year; -$graph->width = 500; -$graph->height = 260; -$graph->GraphMakeGraph(0); - -$file = $img_root . "distributeurs/resultat.mensuel.$year.png"; -if ($verbose) print "Graph : resultat distributeur $file\n"; -$graph = new GraphDistributeurResultat($db, $file); -$graph->year = $year; -$graph->width = 500; -$graph->height = 260; -$graph->GraphMakeGraph(0); - - -function _cdir($dir) -{ - if (! file_exists($dir)) - { - umask(0); - if (! @mkdir($dir, 0755)) - { - print "Erreur: Le répertoire '$dir' n'existe pas et Dolibarr n'a pu le créer."; - } - else - { - //print $dir ." créé\n"; - } - } -} - -?> diff --git a/htdocs/telephonie/script/graph-statistiques-fournisseurs.php b/htdocs/telephonie/script/graph-statistiques-fournisseurs.php deleted file mode 100644 index da003724bf9..00000000000 --- a/htdocs/telephonie/script/graph-statistiques-fournisseurs.php +++ /dev/null @@ -1,189 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * - * Generation des graphiques sur les founisseurs - * - * - * - */ -require ("../../master.inc.php"); - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/bar.class.php"); - -$img_root = DOL_DATA_ROOT."/graph/telephonie/"; - -$Tfourn = array(); -$sql = "SELECT rowid, nom"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_fournisseur"; -$resql = $db->query($sql); - -if ($resql) -{ - while ($row = $db->fetch_row($resql)) - { - $Tfourn[$row[0]] = $row[1]; - } -} - -$sql = "SELECT distinct date_format(date, '%m%Y')"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; - -$resql = $db->query($sql); - -if ($resql) -{ - $Tdate = array(); - $Tlegends = array(); - while ($row = $db->fetch_row($resql)) - { - array_push($Tdate, $row[0]); - array_push($Tlegends, substr($row[0],0,2)); - } -} - -$sql = "SELECT fk_fournisseur, date_format(date, '%m%Y'), duree, numero"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; - -$resql = $db->query($sql); - -if ($resql) -{ - $Ttotal = array(); - $Tglobal = array(); - $Tinter = array(); - $Tnatio = array(); - $Tmobil = array(); - - $num = $db->num_rows($resql); - $i = 0; - - while ($i < $num) - { - $row = $db->fetch_row($resql); - - if (substr($row[3],0,2) == '00') - { - $Tinter[$row[0]][$row[1]] += $row[2]; - } - elseif (substr($row[3],0,2) == '06') - { - $Tmobil[$row[0]][$row[1]] += $row[2]; - } - else - { - $Tnatio[$row[0]][$row[1]] += $row[2]; - } - - $Ttotal[$row[0]][$row[1]] += $row[2]; - $Tglobal[$row[1]] += $row[2]; - $i++; - } -} -$titres = array(); -$titres["inter"] = "internationales"; -$titres["natio"] = "nationales"; -$titres["mobil"] = "mobiles"; - -$graphs = array("inter","natio","mobil"); -$colors = array("yellow","red","blue","pink","orange","green"); -foreach($graphs as $graph) -{ - $datas = array(); - $globals = array(); - - $tab = "T".$graph; - foreach ($$tab as $key => $value) - { - $j = 0; - foreach($Tdate as $date) - { - $datas[$key][$j] = ($value[$date]/60000); - $j++; - } - - } - $file = $img_root . "communications/fourn_".$graph.".png"; - - $ObjectGraph = new Graph(640,320,"auto"); - $ObjectGraph->SetScale("textlin"); - $ObjectGraph->yaxis->scale->SetGrace(20); - $ObjectGraph->xaxis->scale->SetGrace(20); - $ObjectGraph->img->SetMargin(40,20,20,40); - $ObjectGraph->legend->Pos(0.10,0.12,"left","top"); - $i=0; - $plots = array(); - foreach ($$tab as $key => $value) - { - $bplot = new BarPlot($datas[$key]); - $bplot->SetFillColor($colors[$i]); - $bplot->SetLegend($Tfourn[$key]); - array_push($plots, $bplot); - $i++; - } - - $gbplot = new GroupBarPlot($plots); - - $ObjectGraph->Add($gbplot); - - $ObjectGraph->title->Set("Nombre de minutes ".$titres[$graph]." par fournisseurs (en milliers)"); - $ObjectGraph->xaxis->SetTickLabels($Tlegends); - - $ObjectGraph->img->SetImgFormat("png"); - $ObjectGraph->Stroke($file); -} - -/* - * Sum - */ -$j = 0; -foreach($Tdate as $date) -{ - $globals[$j] = ($Tglobal[$date]/60000); - $j++; -} - -$file = $img_root . "communications/duree.png"; - -$ObjectGraph = new Graph(640,200,"auto"); -$ObjectGraph->SetScale("textlin"); -$ObjectGraph->yaxis->scale->SetGrace(20); -$ObjectGraph->xaxis->scale->SetGrace(20); -$ObjectGraph->img->SetMargin(40,20,20,40); - -$i=0; -$plots = array(); - -$bplot = new BarPlot($globals); -$bplot->SetFillColor("green"); - -array_push($plots, $bplot); - -$gbplot = new GroupBarPlot($plots); - -$ObjectGraph->Add($gbplot); - -$ObjectGraph->title->Set("Nombre de minutes (en milliers)"); -$ObjectGraph->xaxis->SetTickLabels($Tlegends); - -$ObjectGraph->img->SetImgFormat("png"); -$ObjectGraph->Stroke($file); - -?> diff --git a/htdocs/telephonie/script/graph-statistiques-lignes.php b/htdocs/telephonie/script/graph-statistiques-lignes.php deleted file mode 100644 index 3aa75c2422e..00000000000 --- a/htdocs/telephonie/script/graph-statistiques-lignes.php +++ /dev/null @@ -1,96 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * - * Generation des graphiques sur les lignes - * - * - */ -require ("../../master.inc.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/ProcessGraphLignes.class.php"); -$verbose = 0; -$graph_all = 0; - -//loop through our arguments and see what the user selected -for ($i = 1; $i < sizeof($GLOBALS["argv"]); $i++) -{ - switch($GLOBALS["argv"][$i]) - { - case "-v": - $verbose = 1; - break; - case "--version": - echo $GLOBALS['argv'][0]." $Revision$\n"; - exit; - break; - case "--all": - $graph_all = 1; - break; - } -} - -if ($verbose) - print strftime("%H:%M:%S",time())."\n"; - -$datetime = time(); -$month = strftime("%m", $datetime); -$year = strftime("%Y", $datetime); - -if ($month == 1) -{ - $month = "12"; - $year = $year - 1; -} -else -{ - $month = substr("00".($month - 1), -2) ; -} - -$sql = "SELECT distinct(fk_ligne)"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; -if ($graph_all == 0) -{ - $sql .= " WHERE date_format(date,'%m%Y') = '".$month.$year."'"; -} - -$resql = $db->query($sql); - -if ($resql) -{ - $num = $db->num_rows($resql); - $i = 0; - - if ($verbose) - print "$num lignes\n"; - - while ($i < $num) - { - if ($verbose) - print substr("0000".($i+1), -4) . "/".substr("0000".$num, -4)."\n"; - - $row = $db->fetch_row($resql); - - $gr = new ProcessGraphLignes($db); - $gr->go($row[0]); - - $i++; - } -} -?> diff --git a/htdocs/telephonie/script/graph-statistiques-makedir.php b/htdocs/telephonie/script/graph-statistiques-makedir.php deleted file mode 100644 index 09a4eb566a5..00000000000 --- a/htdocs/telephonie/script/graph-statistiques-makedir.php +++ /dev/null @@ -1,261 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * Génération des répertoires - * - * - */ -require ("../../master.inc.php"); - -$img_root = DOL_DATA_ROOT."/graph/telephonie/"; - -/* - * Création des répertoires - * - */ -$dirs[0] = DOL_DATA_ROOT."/graph/"; -$dirs[1] = DOL_DATA_ROOT."/graph/telephonie/"; -$dirs[2] = DOL_DATA_ROOT."/graph/telephonie/ca/"; -$dirs[3] = DOL_DATA_ROOT."/graph/telephonie/client/"; -$dirs[4] = DOL_DATA_ROOT."/graph/telephonie/commercials/"; -$dirs[5] = DOL_DATA_ROOT."/graph/telephonie/communications/"; -$dirs[6] = DOL_DATA_ROOT."/graph/telephonie/contrats/"; -$dirs[7] = DOL_DATA_ROOT."/graph/telephonie/factures/"; -$dirs[8] = DOL_DATA_ROOT."/graph/telephonie/lignes/"; -$dirs[9] = DOL_DATA_ROOT."/graph/telephonie/commerciaux/"; -$dirs[10] = DOL_DATA_ROOT."/graph/telephonie/commerciaux/groupes/"; -$dirs[11] = DOL_DATA_ROOT."/graph/telephonie/distributeurs/"; - -$numdir = (sizeof($dirs) + 2); -$i = $numdir ; - -$sql = "SELECT distinct fk_commercial"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne"; - -if ($db->query($sql)) -{ - $num = $db->num_rows(); - $j = 0; - - while ($j < $num) - { - $row = $db->fetch_row(); - - $dirs[$i] = DOL_DATA_ROOT."/graph/telephonie/commercials/".$row[0]; - - $i++; - $j++; - } -} - -/* Groupes de commerciaux */ - -$sql = "SELECT rowid "; -$sql .= " FROM ".MAIN_DB_PREFIX."usergroup"; - -if ($db->query($sql)) -{ - $num = $db->num_rows(); - $j = 0; - - while ($j < $num) - { - $row = $db->fetch_row(); - - $dirs[$i] = DOL_DATA_ROOT."/graph/telephonie/commerciaux/groupes/".$row[0]; - - $i++; - $j++; - } -} - -/* Distributeurs */ - -$sql = "SELECT rowid "; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_distributeur"; - -if ($db->query($sql)) -{ - $num = $db->num_rows(); - $j = 0; - - while ($j < $num) - { - $row = $db->fetch_row(); - - $dirs[$i] = DOL_DATA_ROOT."/graph/telephonie/distributeurs/".$row[0]; - - $i++; - $j++; - } -} - - -/* Clients */ - -for ($j = 0 ; $j < 10 ; $j++) -{ - $dirs[$i] = DOL_DATA_ROOT."/graph/telephonie/client/".$j; - $i++; -} - -/* - * - */ - -for ($j = 0 ; $j < 10 ; $j++) -{ - $dirs[$i] = DOL_DATA_ROOT."/graph/".$j; - $i++; -} - -for ($j = 0 ; $j < 10 ; $j++) -{ - $dirs[$i] = DOL_DATA_ROOT."/graph/".$j."/telephonie"; - $i++; -} - - -for ($j = 0 ; $j < 10 ; $j++) -{ - $dirs[$i] = DOL_DATA_ROOT."/graph/".$j."/telephonie/client/"; - $i++; - $dirs[$i] = DOL_DATA_ROOT."/graph/".$j."/telephonie/ligne/"; - $i++; - $dirs[$i] = DOL_DATA_ROOT."/graph/".$j."/telephonie/commercial/"; - $i++; - $dirs[$i] = DOL_DATA_ROOT."/graph/".$j."/telephonie/contrat/"; - $i++; -} - -/* - * - */ - -$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe"; - -if ($db->query($sql)) -{ - $num = $db->num_rows(); - $j = 0; - - while ($j < $num) - { - $row = $db->fetch_row(); - - $dirs[$i] = DOL_DATA_ROOT."/graph/telephonie/client/".substr($row[0],0,1)."/".$row[0]."/"; - $i++; - - $dirs[$i] = DOL_DATA_ROOT."/graph/".substr($row[0],-1)."/telephonie/client/".$row[0]."/"; - $i++; - - $j++; - } -} - -$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."telephonie_contrat"; - -if ($db->query($sql)) -{ - $num = $db->num_rows(); - $j = 0; - - while ($j < $num) - { - $row = $db->fetch_row(); - - $dirs[$i] = DOL_DATA_ROOT."/graph/".substr($row[0],-1)."/telephonie/contrat/".$row[0]."/"; - $i++; - - $j++; - } -} - -/* - * - */ -$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne"; - -if ($db->query($sql)) -{ - $num = $db->num_rows(); - $j = 0; - - while ($j < $num) - { - $row = $db->fetch_row(); - - $dirs[$i] = DOL_DATA_ROOT."/graph/".substr($row[0],-1)."/telephonie/ligne/".$row[0]."/"; - $i++; - - $j++; - } -} -/* - * - */ - -if (is_array($dirs)) -{ - foreach ($dirs as $key => $value) - { - $dir = $value; - create_dir($dir); - } -} - -$base_dir = DOL_DATA_ROOT.'/graph/telephonie/lignes/'; - -for ($i = 0 ; $i < 10 ; $i++) -{ - $dir = $base_dir . $i . "/"; - - create_dir($dir); - - for ($j = 0 ; $j < 10 ; $j++) - { - $dir = $base_dir . $i . "/". $j . "/"; - - create_dir($dir); - - for ($k = 0 ; $k < 10 ; $k++) - { - $dir = $base_dir . $i . "/". $j . "/". $k . "/"; - - create_dir($dir); - } - } -} - -function create_dir($dir) -{ - - if (! file_exists($dir)) - { - umask(0); - if (! @mkdir($dir, 0755)) - { - die ("Erreur: Le répertoire ".$dir." n'existe pas et Dolibarr n'a pu le créer."); - } - } - - -} -?> diff --git a/htdocs/telephonie/script/graph-statistiques-tempsreels.php b/htdocs/telephonie/script/graph-statistiques-tempsreels.php deleted file mode 100644 index 47e0f134dc8..00000000000 --- a/htdocs/telephonie/script/graph-statistiques-tempsreels.php +++ /dev/null @@ -1,127 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * Generation de graphiques - * - */ -require ("../../master.inc.php"); -$verbose = 0; -require_once (DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/bar.class.php"); - -$error = 0; - -$img_root = DOL_DATA_ROOT."/graph/telephonie"; - -$month = strftime("%m",time()); -$year = strftime("%Y",time()); - -$sql = "SELECT distinct ligne"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_import_cdr"; - -$resql = $db->query($sql); - -if ($resql) -{ - while ($row = $db->fetch_row($resql)) - { - $ligne = new LigneTel($db); - $ligne->fetch($row[0]); - - $data = array(); - - $sqla = "SELECT date, sum(duree)"; - $sqla .= " FROM ".MAIN_DB_PREFIX."telephonie_import_cdr"; - $sqla .= " WHERE ligne = '".$ligne->numero."'"; - $sqla .= " GROUP BY date ASC;"; - - $resqla = $db->query($sqla); - - if ($resqla) - { - while ($rowa = $db->fetch_row($resqla)) - { - $jour = (substr($rowa[0],0,2) * 1); - $data[$jour] = ($rowa[1]/60); - } - } - $total = 0; - $datas = array(); - $moydatas = array(); - for ($i = 0 ; $i < 31 ; $i++) - { - $j = $i + 1; - $datas[$i] = 0; - $moydatas[$i] = 0; - if ($data[$j]) - $datas[$i] = $data[$j]; - - $total = $total + $datas[$i]; - $moydatas[$i] = $total / $j; - - $labels[$i] = $j; - if (strftime('%u',mktime(12,12,12,$month,$j,$year)) == 6) - { - $labels[$i] = '(S'; - } - if (strftime('%u',mktime(12,12,12,$month,$j,$year)) == 7) - { - $labels[$i] = 'D)'; - } - } - - $img_root = DOL_DATA_ROOT."/graph/".substr($ligne->id,-1)."/telephonie/ligne/"; - - $file = $img_root . $ligne->id."/conso.png"; - //print $ligne->id . " ".$ligne->numero."\n"; - $graph = new Graph(800, 400,"auto"); - $graph->SetScale("textlin"); - $graph->yaxis->scale->SetGrace(20); - $graph->SetFrame(true); - $graph->img->SetMargin(50,20,20,35); - $graph->xaxis->scale->SetGrace(20); - - $graph->title->Set("Consommation en cours (en minutes)"); - $graph->xaxis->SetTickLabels($labels); - - $b2plot = new LinePlot($datas); - $b2plot->SetWeight(2); - $b2plot->SetColor("red"); - $b2plot->SetLegend("réel"); - $graph->Add($b2plot); - - $lineplot = new LinePlot($moydatas); - $lineplot->SetColor("blue"); - $lineplot->SetLegend("moyenne"); - $graph->Add($lineplot); - - $graph->img->SetImgFormat("png"); - - $graph->legend->Pos(0.08,0.08,"left","top"); - - $graph->Stroke($file); - } -} -else -{ - print $db->error(); -} - -?> diff --git a/htdocs/telephonie/script/graph-statistiques-test.php b/htdocs/telephonie/script/graph-statistiques-test.php deleted file mode 100644 index ec14d1ebee3..00000000000 --- a/htdocs/telephonie/script/graph-statistiques-test.php +++ /dev/null @@ -1,63 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * - * Generation des graphiques - * - * Test de charges pour déploiement en cluster - * - */ -require ("../../master.inc.php"); - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/bar.class.php"); - -$img_root = DOL_DATA_ROOT."/graph/telephonie/"; - -$sql = "SELECT SQL_BIG_RESULT date_format(date, '%m'), duree, numero"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; -$sql .= " ORDER BY fk_ligne"; - -$resql = $db->query($sql); - -if ($resql) -{ - $durees = array(); - $kilomindurees = array(); - $labels = array(); - - $num = $db->num_rows($resql); - $lim = ($num - $nbval); - $i = 0; - $j = 0; - - while ($i < $num) - { - $row = $db->fetch_row($resql); - - $labels[$j] = $row[0]; - $durees[$j] = $row[1]; - $kilomindurees_mob[$j] = ($row[1]/60000); - - $i++; - } -} - - -?> diff --git a/htdocs/telephonie/script/graph-statistiques-week.php b/htdocs/telephonie/script/graph-statistiques-week.php deleted file mode 100644 index cd4fb8fc536..00000000000 --- a/htdocs/telephonie/script/graph-statistiques-week.php +++ /dev/null @@ -1,253 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * - * Generation des graphiques des données hébdomadaire - * Ce script doit-être exécuté au minimum une fois par semaine - * - * - */ -require ("../../master.inc.php"); - -require_once (DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/facturetel.class.php"); - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/distributeurs/distributeur.po.month.class.php"); - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/lignes/commandes.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/lignes/commandes.week.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/lignes/resiliation.week.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/lignes/rejet.week.class.php"); - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/clients/clientsmoyenne.week.class.php"); - -$error = 0; - -$img_root = DOL_DATA_ROOT."/graph/telephonie/"; - -/***** - * - * - * - */ -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/commerciaux/commerciaux.po.class.php"); -$file = $img_root . "commerciaux/po.mensuel.png"; - -$graph = new GraphCommerciauxPO($db, $file); -$graph->width = 400; -$graph->GraphMakeGraph(); - -/***********************************************************************/ -/* -/* Contrats -/* -/***********************************************************************/ - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/contrats/modereglement.class.php"); - -$file = $img_root . "contrats/modereglement.png"; -if ($verbose) print "Graph : Contrats Reglement $file\n"; -$graph = new GraphContratModeReglement($db, $file); -$graph->GraphMakeGraph(); - -/***********************************************************************/ -/* -/* Lignes actives -/* -/***********************************************************************/ - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/lignes/actives.class.php"); - -$file = $img_root . "lignes/lignes.actives.png"; -if ($verbose) print "Graph : Lignes actives$file\n"; -$graph = new GraphLignesActives($db, $file); -$graph->GraphMakeGraph(); - -$file = $img_root . "lignes/lignes.commandees.png"; -if ($verbose) print "Graph : Lignes actives$file\n"; -$graph = new GraphLignesCommandees($db, $file); -$graph->GraphMakeGraph(); - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/lignes/statut.class.php"); - -$file = $img_root . "lignes/lignes.statut.png"; -if ($verbose) print "Graph : Lignes statut $file\n"; -$graph = new GraphLignesStatut($db, $file); -$graph->GraphMakeGraph(); - -/***********************************************************************/ -/* -/* Lignes commandes -/* -/***********************************************************************/ - -require_once DOL_DOCUMENT_ROOT."/telephonie/stats/clients/clients.week.class.php"; -require_once DOL_DOCUMENT_ROOT."/telephonie/stats/clients/clients.month.class.php"; - -$file = $img_root . "lignes/commandes.mensuels.png"; -if ($verbose) print "Graph : Lignes commandes$file\n"; -$graph = new GraphLignesCommandes($db, $file); -$graph->width = 400; -$graph->GraphMakeGraph(); - -$file = $img_root . "lignes/commandes.hebdomadaire.png"; -if ($verbose) print "Graph : Lignes commandes$file\n"; -$graph = new GraphLignesCommandesWeek($db, $file); -$graph->width = 400; -$graph->GraphMakeGraph(); - -$file = $img_root . "commercials/clientsmoyenne.hebdomadaire.png"; -if ($verbose) print "Graph : Clients Moyenne $file\n"; -$graph = new GraphClientsMoyenneWeek($db, $file); -$graph->width = 400; -$graph->GraphMakeGraph(); - -$file = $img_root . "commercials/clients.hebdomadaire.png"; -$graph = new GraphClientsWeek($db, $file); -$graph->width = 400; -$graph->GraphMakeGraph(); - -$file = $img_root . "commercials/clients.mensuel.png"; -$graph = new GraphClientsMonth($db, $file); -$graph->width = 400; -$graph->GraphMakeGraph(); - -$sql = "SELECT distinct fk_commercial"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne"; - -if ($db->query($sql)) -{ - $num = $db->num_rows(); - $i = 0; - - while ($i < $num) - { - $row = $db->fetch_row(); - - $file = $img_root . "commercials/".$row[0]."/lignes.commandes.mensuels.png"; - if ($verbose) print "Graph : Lignes commandes$file\n"; - $graph = new GraphLignesCommandes($db, $file); - $graph->width = 400; - $graph->GraphMakeGraph($row[0]); - - $file = $img_root . "commercials/".$row[0]."/lignes.commandes.hebdomadaire.png"; - if ($verbose) print "Graph : Lignes commandes$file\n"; - $graph = new GraphLignesCommandesWeek($db, $file); - $graph->width = 400; - $graph->GraphMakeGraph($row[0]); - - $file = $img_root . "commercials/".$row[0]."/clients.hebdomadaire.png"; - if ($verbose) print "Graph : Lignes commandes$file\n"; - $graph = new GraphClientsWeek($db, $file); - $graph->width = 400; - $graph->commercial = $row[0]; - $graph->GraphMakeGraph(); - - $file = $img_root . "commercials/".$row[0]."/clientsmoyenne.hebdomadaire.png"; - if ($verbose) print "Graph : Moyenne nouveaux clients $file\n"; - $graph = new GraphClientsMoyenneWeek($db, $file); - $graph->width = 400; - $graph->GraphMakeGraph($row[0]); - - $i++; - } - } - -/***********************************************************************/ -/* -/* Prise ordre des distributeur -/* -/***********************************************************************/ -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/contrats/modereglement.class.php"); - -$sql = "SELECT distinct p.fk_distributeur, d.nom"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat_priseordre as p"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_distributeur as d"; -$sql .= " WHERE d.rowid = p.fk_distributeur"; - -$resql = $db->query($sql); - -if ($resql) -{ - $num = $db->num_rows($resql); - $i = 0; - - while ($i < $num) - { - $row = $db->fetch_row($resql); - - $file = $img_root . "distributeurs/".$row[0]."/po.month.png"; - - $graph = new GraphDistributeurPoMensuel($db, $file); - $graph->width = 500; - $graph->GraphMakeGraph($row[0], $row[1]); - $i++; - } -} - - - -/* - * - */ - -$sql = "SELECT rowid"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_distributeur"; -$resql = $db->query($sql); -if ($resql) -{ - $num = $db->num_rows($resql); - $i = 0; - - while ($i < $num) - { - $row = $db->fetch_row($resql); - $file = $img_root . "distributeurs/".$row[0]."/clients.hebdomadaire.png"; - if ($verbose) print "Graph : Lignes commandes$file\n"; - $graph = new GraphClientsWeek($db, $file); - $graph->width = 500; - $graph->distributeur = $row[0]; - $graph->GraphMakeGraph(); - $i++; - } -} - -/***** - * - * - * - */ -$file = $img_root . "lignes/resiliations.hebdomadaire.png"; - -$graph = new GraphLignesResiliationWeek($db, $file); -$graph->width = 400; -$graph->GraphMakeGraph(); -/***** - * - * - * - */ -$file = $img_root . "lignes/rejets.hebdomadaire.png"; - -$graph = new GraphLignesRejetWeek($db, $file); -$graph->width = 400; -$graph->GraphMakeGraph(); - -?> diff --git a/htdocs/telephonie/script/graph-statistiques.php b/htdocs/telephonie/script/graph-statistiques.php deleted file mode 100644 index 4092cdff331..00000000000 --- a/htdocs/telephonie/script/graph-statistiques.php +++ /dev/null @@ -1,507 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * - * Generation des graphiques - * - * - * - */ -require ("../../master.inc.php"); - -$verbose = 0; - -for ($i = 1 ; $i < sizeof($argv) ; $i++) -{ - if ($argv[$i] == "-v") - { - $verbose = 1; - } - if ($argv[$i] == "--verbose") - { - $verbose = 1; - } -} - -require_once (DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/facturetel.class.php"); - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/bar.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/camenbert.class.php"); - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/ca.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/camoyen.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/gain.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/heureappel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/joursemaine.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/appelsdureemoyenne.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/comm.nbmensuel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/lignes/actives.class.php"); - -$error = 0; - -$datetime = time(); - -$date = strftime("%d%h%Y%Hh%Mm%S",$datetime); - -$month = strftime("%m", $datetime); -$year = strftime("%Y", $datetime); - -if ($month == 1) -{ - $month = "12"; - $year = $year - 1; -} -else -{ - $month = substr("00".($month - 1), -2) ; -} - - -$img_root = DOL_DATA_ROOT."/graph/telephonie/"; - - -/***********************************************************************/ -/* -/* Lignes actives -/* -/***********************************************************************/ - -$file = $img_root . "lignes/lignes.actives.png"; -if ($verbose) print "Lignes actives ($file)\n"; -$graph = new GraphLignesActives($db, $file); -$graph->GraphMakeGraph(); - -/***********************************************************************/ -/* -/* Chiffre d'affaire mensuel -/* -/***********************************************************************/ - -$file = $img_root . "ca/ca.mensuel.png"; -if ($verbose) print "Chiffre d'affaire mensuel ($file)\n"; -$graphca = new GraphCa($db, $file); -$graphca->GraphDraw(); - -/************************************************************************/ -/* -/* Chiffre d'affaire moyen -/* -/* -/************************************************************************/ - -$file = $img_root . "ca/gain_moyen_par_client.png"; -if ($verbose) print "Graph ca moyen\n"; -$graphgain = new GraphCaMoyen ($db, $file); -$graphgain->show_console = 0 ; -$graphgain->GraphDraw(); - -/*************************************************************************/ -/* -/* Stats sur les communications -/* -/* -/*************************************************************************/ - -$file = $img_root . "communications/heure_appel_nb.png"; -if ($verbose) print "Heures d'appels\n"; -$graphha = new GraphHeureAppel ($db, $file); -$graphha->GraphDraw(); - -$file = $img_root . "communications/joursemaine_nb.png"; -if ($verbose) print "Jours de semaines\n"; -$graphha = new GraphJourSemaine ($db, $file); -$graphha->GraphDraw(); - -repart_comm($db); - -$year = strftime("%Y", $datetime); -$month = strftime("%m", $datetime); - -for ($i = 1 ; $i < 4 ; $i++) -{ - $month = $month - 1; - - if ($month == 0) - { - $year = $year - 1; - $month = 12; - } - - repart($db,$year, $month); - repart_comm($db,$year, $month); - -} - - -function repart_comm($db, $year = 0, $month = 0) -{ - if ($verbose) print "Répartition des communications\n"; - - $sql = "SELECT duree, numero"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; - - if ($year && $month) - { - if ($verbose) print "Répartition des communications pour $month/$year\n"; - $month = substr("00".$month, -2); - $sql .= " WHERE date_format(date,'%Y%m') = '$year$month'"; - } - - if ($db->query($sql)) - { - $labels_duree = array(); - $repart_duree = array(0,0,0,0,0,0); - $repart_dureelong = array(0,0); - - $labels_dest= array(); - $repart_dest = array(0,0,0); - $repart_dest_temps = array(0,0,0); - - $num = $db->num_rows(); - - $i = 0; - - while ($i < $num) - { - $row = $db->fetch_row(); - - if ($row[0] < 10) - { - $repart_duree[0]++; - } - elseif ($row[0] >= 10 && $row[0] < 30) - { - $repart_duree[1]++; - } - elseif ($row[0] >= 30 && $row[0] < 60) - { - $repart_duree[2]++; - } - elseif ($row[0] >= 60 && $row[0] < 120) - { - $repart_duree[3]++; - } - elseif ($row[0] >= 120 && $row[0] < 300) - { - $repart_duree[4]++; - } - else - { - $repart_duree[5]++; - } - - if ($row[0] < 600) - { - $repart_dureelong[0]++; - } - else - { - $repart_dureelong[1]++; - } - - if (substr($row[1],0,2) == '00') - { - $repart_dest[0]++; - $repart_dest_temps[0] += $row[0]; - } - elseif (substr($row[1],0,2) == '06') - { - $repart_dest[1]++; - $repart_dest_temps[1] += $row[0]; - } - else - { - $repart_dest[2]++; - $repart_dest_temps[2] += $row[0]; - } - $i++; - } - } - else - { - print $sql ; - } - - if ($num > 0) - { - $labels_duree[0] = "< 10 sec"; - $labels_duree[1] = "10-30 sec"; - $labels_duree[2] = "30-60 sec"; - $labels_duree[3] = "60-120 sec"; - $labels_duree[4] = "120-300 sec"; - $labels_duree[5] = "> 300 sec"; - - $labels_dureelong[0] = "< 600 sec"; - $labels_dureelong[1] = "> 600 sec"; - - $labels_dest[0] = 'International'; - $labels_dest[1] = 'Mobile'; - $labels_dest[2] = 'Local/National'; - - - $filem = DOL_DATA_ROOT."/graph/telephonie/communications/duree_repart.png"; - $filec = DOL_DATA_ROOT."/graph/telephonie/communications/dureelong_repart.png"; - $filed = DOL_DATA_ROOT."/graph/telephonie/communications/dest_repart.png"; - $filedt = DOL_DATA_ROOT."/graph/telephonie/communications/dest_temps_repart.png"; - - if ($year && $month) - { - $filem = DOL_DATA_ROOT."/graph/telephonie/communications/duree_repart-$year$month.png"; - $filec = DOL_DATA_ROOT."/graph/telephonie/communications/dureelong_repart-$year$month.png"; - $filed = DOL_DATA_ROOT."/graph/telephonie/communications/dest_repart-$year$month.png"; - $filedt = DOL_DATA_ROOT."/graph/telephonie/communications/dest_temps_repart-$year$month.png"; - } - - $graphm = new GraphCamenbert ($db, $filem); - $graphc = new GraphCamenbert ($db, $filec); - $graphd = new GraphCamenbert ($db, $filed); - $graphdt = new GraphCamenbert ($db, $filedt); - - $graphm->titre = "Répartition du nombre de communications par duree"; - $graphc->titre = "Répartition du nombre de communications par duree"; - $graphd->titre = "Répartition du nombre de communications par destination"; - $graphdt->titre = "Répartition du nombre de communications par destination"; - - if ($year && $month) - { - $graphm->titre = "Répart. du nbre de communications par duree $month/$year"; - $graphc->titre = "Répart. du nbre de communications par duree $month/$year"; - $graphd->titre = "Répart. du nbre de communications par destination $month/$year"; - $graphdt->titre = "Répart. du temps de communications par destination $month/$year"; - } - - $graphm->colors= array('#993333','#66cc99','#6633ff','#33ff33','#336699','#00ffff'); - $graphd->colors= array('#FFC0FF','#FF00FF','#C000C0'); - $graphdt->colors= array('#FFFFC0','#FFFF0F','#C0C000'); - - $graphm->GraphDraw($repart_duree, $labels_duree); - $graphc->GraphDraw($repart_dureelong, $labels_dureelong); - $graphd->GraphDraw($repart_dest, $labels_dest); - $graphdt->GraphDraw($repart_dest_temps, $labels_dest); - } -} - - - -/**********************************************************************/ -/* -/* Stats sur les factures -/* -/* -/**********************************************************************/ - -$sql = "SELECT date_format(date,'%Y%m'), sum(cout_vente), sum(cout_achat), sum(gain), count(cout_vente)"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture"; -$sql .= " GROUP BY date_format(date,'%Y%m') ASC "; - -if ($db->query($sql)) -{ - $cout_vente = array(); - $cout_vente_moyen = array(); - $nb_factures = array(); - $jour_semaine_nb = array(); - $jour_semaine_duree = array(); - $gain = array(); - $gain_moyen = array(); - - $num = $db->num_rows(); - if ($verbose) print "$num lignes de comm a traiter\n"; - $i = 0; - - while ($i < $num) - { - $row = $db->fetch_row(); - - $cout_vente[$i] = $row[1]; - - $gain[$i] = $row[3]; - $gain_moyen[$i] = ($row[3]/$row[4]); - $cout_vente_moyen[$i] = ($row[1]/$row[4]); - $nb_factures[$i] = $row[4]; - $labels[$i] = substr($row[0],4,2) . '/'.substr($row[0],2,2); - $i++; - } -} - - -$file = $img_root . "/factures/facture_moyenne.png"; -$graph = new GraphBar ($db, $file, $labels); -$graph->titre = "Facture moyenne"; -if ($verbose) print $graph->titre."\n"; -$graph->barcolor = "blue"; -$graph->GraphDraw($file, $cout_vente_moyen, $labels); - -$file = $img_root . "/factures/gain_mensuel.png"; -$graph = new GraphBar ($db, $file); -$graph->titre = "Gain par mois en euros HT"; -if ($verbose) print $graph->titre."\n"; -$graph->GraphDraw($file, $gain, $labels); - -$file = $img_root . "/factures/gain_moyen.png"; -$graph = new GraphBar ($db, $file); -$graph->titre = "Gain moyen par facture par mois"; -if ($verbose) print $graph->titre."\n"; -$graph->barcolor = "blue"; -$graph->GraphDraw($file, $gain_moyen, $labels); - -$file = $img_root . "/factures/nb_facture.png"; -$graph = new GraphBar ($db, $file); -$graph->titre = "Nb de facture mois"; -if ($verbose) print $graph->titre."\n"; -$graph->barcolor = "yellow"; -$graph->GraphDraw($file, $nb_factures, $labels); - -/* - * Répartition des factures - * - * - */ -repart($db); - -function repart($db, $year = 0, $month = 0) -{ - if ($verbose) print "Répartition des factures\n"; - - $sql = "SELECT cout_vente, gain"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture"; - - if ($year && $month) - { - if ($verbose) print "Répartition des factures pour $month/$year\n"; - $month = substr("00".$month, -2); - $sql .= " WHERE date_format(date,'%Y%m') = '$year$month'"; - } - - if ($db->query($sql)) - { - $labels = array(); - $repart_montant = array(); - $num = $db->num_rows(); - - $i = 0; - - while ($i < $num) - { - $row = $db->fetch_row(); - - if ($row[0] < 10) - { - $repart_montant[0]++; - } - elseif ($row[0] >= 10 && $row[0] < 20) - { - $repart_montant[1]++; - } - elseif ($row[0] >= 20 && $row[0] < 40) - { - $repart_montant[2]++; - } - elseif ($row[0] >= 40 && $row[0] < 70) - { - $repart_montant[3]++; - } - elseif ($row[0] >= 70 && $row[0] < 100) - { - $repart_montant[4]++; - } - else - { - $repart_montant[5]++; - } - - - if ($row[1] < 1) - { - $repart_gain[0]++; - } - elseif ($row[1] >= 1 && $row[1] < 5) - { - $repart_gain[1]++; - } - elseif ($row[1] >= 5 && $row[1] < 10) - { - $repart_gain[2]++; - } - elseif ($row[1] >= 10 && $row[1] < 20) - { - $repart_gain[3]++; - } - elseif ($row[1] >= 20 && $row[1] < 50) - { - $repart_gain[4]++; - } - else - { - $repart_gain[5]++; - } - $i++; - } - } - else - { - print $sql ; - } - - if ($num > 0) - { - $labels_montant[0] = "< 10"; - $labels_montant[1] = "10-20"; - $labels_montant[2] = "20-40"; - $labels_montant[3] = "40-70"; - $labels_montant[4] = "70-100"; - $labels_montant[5] = "> 100"; - - $labels_gain[0] = "< 1"; - $labels_gain[1] = "1-5"; - $labels_gain[2] = "5-10"; - $labels_gain[3] = "10-20"; - $labels_gain[4] = "20-50"; - $labels_gain[5] = "> 50"; - - $filem = DOL_DATA_ROOT."/graph/telephonie/factures/montant_repart.png"; - $fileg = DOL_DATA_ROOT."/graph/telephonie/factures/gain_repart.png"; - - if ($year && $month) - { - $filem = DOL_DATA_ROOT."/graph/telephonie/factures/montant_repart-$year$month.png"; - $fileg = DOL_DATA_ROOT."/graph/telephonie/factures/gain_repart-$year$month.png"; - } - - $graphm = new GraphCamenbert ($db, $filem); - $graphg = new GraphCamenbert ($db, $fileg); - - - $graphm->titre = "Répartition du nombre de factures par montant"; - $graphg->titre = "Répartition du nombre de factures par gain"; - - if ($year && $month) - { - $graphm->titre = "Répart. du nbre de factures par montant $month $year"; - $graphg->titre = "Répart. du nbre de factures par gain $month $year"; - } - - $graphm->colors= array('#993333','#66cc99','#6633ff','#33ff33','#336699','#00ffff'); - - // $graphm->GraphDraw($filem, $repart_montant, $labels_montant); - // $graphg->GraphDraw($fileg, $repart_gain, $labels_gain); - } -} -?> diff --git a/htdocs/telephonie/script/import-cdr-bt.php b/htdocs/telephonie/script/import-cdr-bt.php deleted file mode 100644 index 867762b5cbe..00000000000 --- a/htdocs/telephonie/script/import-cdr-bt.php +++ /dev/null @@ -1,433 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * Script d'import des CDR BT - */ - -require ("../../master.inc.php"); - -$opt = getopt("f:"); - -$file = $opt['f']; -$id_fourn = 2; - -if (strlen($file) == 0) -{ - print "Usage :\n php import-cdr-bt.php -f \n"; - exit; -} - -/* - * Traitement - * - */ - -$files = array(); - -if (is_dir($file)) -{ - $handle=opendir($file); - - if ($handle) - { - $i = 0 ; - $var=True; - - while (($xfile = readdir($handle))!==false) - { - if (is_file($file.$xfile) ) - { - if (substr($xfile, -4) == ".csv") - { - $files[$i] = $file.$xfile; - dol_syslog($file.$xfile." ajouté"); - $i++; - } - else - { - dol_syslog($file.$xfile." ignoré"); - } - } - } - - closedir($handle); - } - else - { - dol_syslog("Impossible de libre $file"); - exit ; - } -} -elseif (is_file($file)) -{ - $files[0] = $file; -} -else -{ - dol_syslog("Impossible de libre $file"); - exit ; -} - -/* - * Renommage des fichiers - * - */ -$datetime = time(); -$month = strftime("%m", $datetime); -$year = strftime("%y", $datetime); - -if ($month == 1) -{ - $month = "12"; - $year = substr("00".($year - 1), -2) ; -} -else -{ - $month = substr("00".($month - 1), -2) ; -} -$newfiles = array(); -$j = 0; -foreach ($files as $xfile) -{ - if (is_readable($xfile)) - { - dol_syslog("Traitement de ".basename($xfile)); - $newname = str_replace(".csv","-$month$year.csv",$xfile); - if (substr($xfile,-9) <> "-$month$year.csv") - { - if (rename($xfile, $newname)) - { - dol_syslog("Renomme en ".$newname); - $newfiles[$j] = $newname; - $j++; - } - else - { - print "Erreur de renommage de $xfile\n"; - exit; - } - } - else - { - $newfiles[$j] = $xfile; - $j++; - } - } -} - -/* - * Vérification du fournisseur - * - */ - -$sql = "SELECT f.rowid, f.nom"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_fournisseur as f"; -$sql .= " WHERE f.rowid = ".$id_fourn; - -if ($db->query($sql)) -{ - $num = $db->num_rows(); - - if ($num == 1) - { - $row = $db->fetch_row(); - dol_syslog ("Import fichier ".$file); - dol_syslog("Fournisseur [".$row[0]."] ".$row[1]); - } - else - { - dol_syslog("Erreur Fournisseur inexistant : ".$id_fourn); - exit ; - } -} -else -{ - dol_syslog("Erreur recherche fournisseur"); - exit ; -} - - -/* - * Charge les ID de lignes - * - */ - -$sql = "SELECT ligne, rowid "; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne"; - -$resql = $db->query($sql); - -if ($resql) -{ - $num = $db->num_rows($resql); - dol_syslog ($num . " lignes chargées"); - $i = 0; - $ligneids = array(); - - while ($i < $num) - { - $row = $db->fetch_row($resql); - $ligneids[$row[0]] = $row[1]; - $i++; - } -} -else -{ - dol_syslog("Erreur chargement des lignes"); - dol_syslog($sql); - exit ; -} - - -$line_inserted_total = 0; -foreach ($newfiles as $xfile) -{ - if (is_readable($xfile)) - { - if ( _verif($db, $xfile) == 0) - { - dol_syslog("Lecture du fichier $xfile"); - - $error = 0; - $line = 0; - $line_inserted = 0; - $hf = fopen ($xfile, "r"); - $line = 0; - - if ($db->query("BEGIN")) - { - while (!feof($hf) ) - { - $cont = fgets($hf, 1024); - - if (strlen(trim($cont)) > 0) - { - // 297400910,2005-03-23 08:08:08,Appels Mob.-ORANGE,0680301933, 106, .3445 - // 297400910,2005-03-23 09:24:36,Appels Mob.-ORANGE,0675621805, 5, .0162 - // 297400910,2005-03-23 09:36:55,Appels Mob.-ORANGE,0680301933, 57, .1852 - - $tabline = explode(",", $cont); - if (sizeof($tabline) == 6) - { - $index = $line; - $ligne = "0".$tabline[0]; - $date = substr($tabline[1],0,10); - - //Retournment de la date - $date = substr($date, 8,2)."/".substr($date, 5,2)."/".substr($date, 0,4); - - $heure = substr($tabline[1],11,8); - - $numero = $tabline[3]; - $tarif = $tabline[2]; - - $h = floor(trim($tabline[4]) / 3600); - $m = floor((trim($tabline[4]) - ($h * 3600)) / 60); - $s = (trim($tabline[4]) - ( ($h * 3600 ) + ($m * 60) ) ); - - if ($h > 0) - { - $dt = $h . " h " . substr("00".$m, -2) ."mn" . substr("00".$s, -2); - } - else - { - if ($m > 0) - { - $dt = substr("00".$m,-2) ."mn" . substr("00".$s, -2); - } - else - { - $dt = "00mn".substr("00".$s, -2); - } - } - - $duree_text = $dt; - $tarif_fourn = "NONE"; - $montant = trim($tabline[5]); - $duree_secondes = trim($tabline[4]); - - if ($ligneids[$ligne] > 0) - { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_import_cdr"; - - $sql .= "(idx,fk_ligne,ligne,date,heure,num,dest,dureetext,tarif,montant,duree"; - $sql .= ", fichier, fk_fournisseur)"; - - $sql .= " VALUES ("; - $sql .= "$index"; - $sql .= ",'".$ligneids[$ligne]."'"; - $sql .= ",'".$ligne."'"; - $sql .= ",'".ereg_replace('"','',$date)."'"; - $sql .= ",'".ereg_replace('"','',$heure)."'"; - $sql .= ",'".ereg_replace('"','',$numero)."'"; - $sql .= ",'".addslashes(ereg_replace('"','',$tarif))."'"; - $sql .= ",'".ereg_replace('"','',$duree_text)."'"; - $sql .= ",'".ereg_replace('"','',$tarif_fourn)."'"; - $sql .= ",".ereg_replace(',','.',$montant); - $sql .= ",".$duree_secondes; - $sql .= ",'".basename($xfile)."'"; - $sql .= " ,".$id_fourn; - $sql .= ")"; - - if(ereg("^[0-9]+$", $duree_secondes)) - { - if ($db->query($sql)) - { - $line_inserted++; - $line_inserted_total++; - } - else - { - dol_syslog("Erreur de traitement de ligne $index"); - dol_syslog($db->error()); - dol_syslog($sql); - $error++; - } - } - else - { - print "Ligne : $cont ignorée\n"; - $error++; - } - } - else - { - dol_syslog("Ligne : $ligne ignorée!"); - $error++; - } - } - else - { - dol_syslog("Mauvais format de fichier ligne $line ".sizeof($tabline)); - dol_syslog($cont); - $error++; - } - } - $line++; - } - if ($line <> $line_inserted) - { - dol_syslog($line."/".$line_inserted." lignes traitées/insert effectués"); - } - - if ($error == 0) - { - $db->query("COMMIT"); - } - else - { - $db->query("ROLLBACK"); - dol_syslog("ROLLBACK"); - } - } - fclose($hf); - } - } - else - { - print "Erreur lecture : $xfile"; - dol_syslog($xfile . " not readable"); - } -} - -dol_syslog($line_inserted_total." insert effectués total"); - -/* - * Fin - * - */ - -function _verif($db, $file) -{ - $result = 0; - /* - * Vérifie que le fichier n'a pas déjà été chargé - * - */ - - $sql = "SELECT count(fichier)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_import_cdr"; - $sql .= " WHERE fichier = '".basename($file)."'"; - - if ($db->query($sql)) - { - $num = $db->num_rows(); - - if ($num == 1) - { - $row = $db->fetch_row(); - if ($row[0] > 0) - { - dol_syslog ("Fichier ".$file." déjà chargé dans import-log"); - $result = -1; - } - } - else - { - dol_syslog("Erreur vérif du fichier"); - $result = -1; - } - } - else - { - dol_syslog("Erreur SQL vérification du fichier"); - $result = -1; - } - - /* - * Vérifie que le fichier n'a pas déjà été traité - * - */ - - $sql = "SELECT count(fichier_cdr)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; - $sql .= " WHERE fichier_cdr = '".basename($file)."'"; - - if ($db->query($sql)) - { - $num = $db->num_rows(); - - if ($num == 1) - { - $row = $db->fetch_row(); - if ($row[0] > 0) - { - dol_syslog ("Fichier ".$file." déjà traité"); - $result = -1; - } - } - else - { - dol_syslog("Erreur vérif du fichier dans les comm"); - $result = -1; - } - } - else - { - dol_syslog("Erreur SQL vérification du fichier dans les comm"); - dol_syslog($sql); - $result = -1; - } - - return $result; -} - - -return $error; diff --git a/htdocs/telephonie/script/import-cdr-ftp.php b/htdocs/telephonie/script/import-cdr-ftp.php deleted file mode 100644 index 8499c92bbb2..00000000000 --- a/htdocs/telephonie/script/import-cdr-ftp.php +++ /dev/null @@ -1,437 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * Script d'import des CDR - */ - -require ("../../master.inc.php"); - -$opt = getopt("f:i:"); - -/* -$file = $opt['f']; -$id_fourn = $opt['i']; -if (strlen($file) == 0 || strlen($id_fourn) == 0) -{ - print "Usage :\n php import-cdr-bt.php -f -i \n"; - exit; -} -*/ -$file = DOL_DATA_ROOT."/telephonie/CDR/atraiter/"; -$id_fourn = 4; - -/* - * Traitement - * - */ - -$files = array(); - -if (is_dir($file)) -{ - $handle=opendir($file); - - if ($handle) - { - $i = 0 ; - $var=True; - - while (($xfile = readdir($handle))!==false) - { - if (is_file($file.$xfile) && substr($xfile, -4) == ".csv") - { - $files[$i] = $file.$xfile; - dol_syslog($xfile." ajouté"); - $i++; - } - else - { - dol_syslog($xfile." ignoré"); - } - } - - closedir($handle); - } - else - { - dol_syslog("Impossible de libre $file"); - exit ; - } -} -elseif (is_file($file)) -{ - $files[0] = $file; -} -else -{ - dol_syslog("Impossible de libre $file"); - exit ; -} - -/* - * Vérification du fournisseur - * - */ - -$sql = "SELECT f.rowid, f.nom"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_fournisseur as f"; -$sql .= " WHERE f.rowid = ".$id_fourn; - -if ($db->query($sql)) -{ - $num = $db->num_rows(); - - if ($num == 1) - { - $row = $db->fetch_row(); - dol_syslog ("Import fichier ".$file); - dol_syslog("Fournisseur [".$row[0]."] ".$row[1]); - } - else - { - dol_syslog("Erreur Fournisseur inexistant : ".$id_fourn); - exit ; - } -} -else -{ - dol_syslog("Erreur recherche fournisseur"); - exit ; -} - -/* - * Vérification des fichiers traités - * - */ -$fichiers = array(); -$sql = "SELECT distinct(fichier_cdr)"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; -if ($db->query($sql)) -{ - while ($row = $db->fetch_row($resql)) - { - array_push($fichiers, $row[0]); - } - $db->free($resql); -} -else -{ - dol_syslog("Erreur recherche fournisseur"); -} -$sql = "SELECT distinct(fichier)"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_import_cdr"; -if ($db->query($sql)) -{ - while ($row = $db->fetch_row($resql)) - { - array_push($fichiers, $row[0]); - } - $db->free($resql); -} -else -{ - dol_syslog("Erreur recherche fournisseur"); - exit ; -} -/* - * Charge les ID de lignes - * - */ - -$sql = "SELECT ligne, rowid "; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne"; - -$resql = $db->query($sql); - -if ($resql) -{ - $num = $db->num_rows($resql); - dol_syslog ($num . " lignes chargées"); - $i = 0; - $ligneids = array(); - - while ($i < $num) - { - $row = $db->fetch_row($resql); - $ligneids[$row[0]] = $row[1]; - $i++; - } -} -else -{ - dol_syslog("Erreur chargement des lignes"); - dol_syslog($sql); - exit ; -} - -foreach ($files as $xfile) -{ - if (is_readable($xfile)) - { - if ( _verif($db, $xfile, $fichiers) == 0) - { - dol_syslog("Lecture du fichier $xfile"); - - $error = 0; - $line = 0; - $line_inserted = 0; - $hf = fopen ($xfile, "r"); - $line = 0; - - if ($db->query("BEGIN")) - { - while (!feof($hf)) - { - $cont = fgets($hf, 1024); - - if (strlen(trim($cont)) > 0) - { - - if ($line == 0) - { - $headers = array(); - $headers = explode(";",$cont); - //print_r($headers); - } - else - { - $tabline = explode(";", $cont); - if (sizeof($tabline) == 24) - { - //print_r($tabline); - $index = $line; - $ligne = "0".$tabline[11]; - $date = substr($tabline[12],0,10); - $date = substr($date, 8,2)."/".substr($date, 5,2)."/".substr($date, 0,4); - - $heure = substr($tabline[12],11,8); - if ($tabline[8] == "3") - { - $numero = "0".$tabline[9]; - } - - if ($tabline[8] == "4") - { - $numero = "00".$tabline[9]; - } - - $tarif = $tabline[14]; - - $h = floor(trim($tabline[13]) / 3600); - $m = floor((trim($tabline[13]) - ($h * 3600)) / 60); - $s = (trim($tabline[13]) - ( ($h * 3600 ) + ($m * 60) ) ); - - if ($h > 0) - { - $dt = $h . " h " . substr("00".$m, -2) ."mn" . substr("00".$s, -2); - } - else - { - if ($m > 0) - { - $dt = substr("00".$m,-2) ."mn" . substr("00".$s, -2); - } - else - { - $dt = "00mn".substr("00".$s, -2); - } - } - - $duree_text = $dt; - $tarif_fourn = "NONE"; - $montant = trim($tabline[15]); - $duree_secondes = trim($tabline[13]); - - if ($ligneids[$ligne] > 0) - { - if ($duree_secondes > 0) - { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_import_cdr"; - $sql .= "(idx,fk_ligne,ligne,date,heure,num,dest,dureetext,tarif,montant,duree"; - $sql .= ", fichier, fk_fournisseur)"; - $sql .= " VALUES ("; - $sql .= "$index"; - $sql .= ",'".$ligneids[$ligne]."'"; - $sql .= ",'".$ligne."'"; - $sql .= ",'".ereg_replace('"','',$date)."'"; - $sql .= ",'".ereg_replace('"','',$heure)."'"; - $sql .= ",'".ereg_replace('"','',$numero)."'"; - $sql .= ",'".addslashes(ereg_replace('"','',$tarif))."'"; - $sql .= ",'".ereg_replace('"','',$duree_text)."'"; - $sql .= ",'".ereg_replace('"','',$tarif_fourn)."'"; - $sql .= ",".ereg_replace(',','.',$montant); - $sql .= ",".$duree_secondes; - $sql .= ",'".basename($xfile)."'"; - $sql .= " ,".$id_fourn; - $sql .= ")"; - - if(ereg("^[0-9]+$", $duree_secondes)) - { - if ($db->query($sql)) - { - $line_inserted++; - } - else - { - dol_syslog("Erreur de traitement de ligne $index"); - dol_syslog($db->error()); - dol_syslog($sql); - $error++; - } - } - else - { - print "Ligne : $cont ignorée\n"; - $error++; - } - } - } - else - { - dol_syslog("Ligne : $ligne ignorée ! log write in /tmp/$ligne.import"); - $fp = fopen("/tmp/$ligne.import","w"); - if ($fp) - { - fwrite($fp, $cont); - foreach($tabline as $logtab) - { - fwrite($fp, $logtab); - } - fclose($fp); - } - $error++; - } - - } - else - { - dol_syslog("Mauvais format de fichier ligne $line ".sizeof($tabline)); - dol_syslog($cont); - $error++; - } - } - } - $line++; - } - - dol_syslog($line." lignes traitées dans le fichier"); - dol_syslog($line_inserted." insert effectués"); - - if ($error == 0) - { - $db->query("COMMIT"); - } - else - { - $db->query("ROLLBACK"); - dol_syslog("ROLLBACK"); - } - - } - - fclose($hf); - } - } - else - { - print "Erreur lecture : $xfile"; - dol_syslog($xfile . " not readable"); - } -} - - -function _verif($db, $file, $fichiers) -{ - $result = 0; - /* - * Vérifie que le fichier n'a pas déjà été chargé - * - */ - if (in_array (basename($file), $fichiers)) - { - dol_syslog ("Fichier ".basename($file)." déjà chargé/traité"); - $result = -1; - } - - - /* - $sql = "SELECT count(fichier)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_import_cdr"; - $sql .= " WHERE fichier = '".basename($file)."'"; - - if ($db->query($sql)) - { - $num = $db->num_rows(); - - if ($num == 1) - { - $row = $db->fetch_row(); - if ($row[0] > 0) - { - dol_syslog ("Fichier ".$file." déjà chargé dans import-log"); - $result = -1; - } - } - else - { - dol_syslog("Erreur vérif du fichier"); - $result = -1; - } - } - else - { - dol_syslog("Erreur SQL vérification du fichier"); - $result = -1; - } - - $sql = "SELECT count(fichier_cdr)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; - $sql .= " WHERE fichier_cdr = '".basename($file)."'"; - - if ($db->query($sql)) - { - $num = $db->num_rows(); - - if ($num == 1) - { - $row = $db->fetch_row(); - if ($row[0] > 0) - { - dol_syslog ("Fichier ".$file." déjà traité"); - $result = -1; - } - } - else - { - dol_syslog("Erreur vérif du fichier dans les comm"); - $result = -1; - } - } - else - { - dol_syslog("Erreur SQL vérification du fichier dans les comm"); - dol_syslog($sql); - $result = -1; - } - */ - return $result; -} - -return $error; diff --git a/htdocs/telephonie/script/import-cdr.php b/htdocs/telephonie/script/import-cdr.php deleted file mode 100644 index 9a605773d06..00000000000 --- a/htdocs/telephonie/script/import-cdr.php +++ /dev/null @@ -1,291 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * Script d'import des CDR des fournisseurs - */ - -require ("../../master.inc.php"); - -$opt = getopt("f:i:"); - -$file = $opt['f']; -$id_fourn = $opt['i']; - -if (strlen($file) == 0 || strlen($id_fourn) == 0) -{ - print "Usage :\n php import-cdr.php -f -i \n"; - exit; -} - -/* - * Vérification du fournisseur - * - */ - -$sql = "SELECT f.rowid, f.nom"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_fournisseur as f"; -$sql .= " WHERE f.rowid = ".$id_fourn; - -if ($db->query($sql)) -{ - $num = $db->num_rows(); - - if ($num == 1) - { - $row = $db->fetch_row(); - dol_syslog ("Import fichier ".$file); - dol_syslog("Fournisseur [".$row[0]."] ".$row[1]); - } - else - { - dol_syslog("Erreur Fournisseur inexistant : ".$id_fourn); - exit ; - } -} -else -{ - dol_syslog("Erreur recherche fournisseur"); - exit ; -} - -/* - * Vérifie que le fichier n'a pas déjà été chargé - * - */ - -$sql = "SELECT count(fichier)"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_import_cdr"; -$sql .= " WHERE fichier = '".basename($file)."'"; - -if ($db->query($sql)) -{ - $num = $db->num_rows(); - - if ($num == 1) - { - $row = $db->fetch_row(); - if ($row[0] > 0) - { - dol_syslog ("Fichier ".$file." déjà chargé dans import-log"); - - exit ; - } - } - else - { - dol_syslog("Erreur vérif du fichier"); - exit ; - } -} -else -{ - dol_syslog("Erreur SQL vérification du fichier"); - exit ; -} - -/* - * Vérifie que le fichier n'a pas déjà été traité - * - */ - -$sql = "SELECT count(fichier_cdr)"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; -$sql .= " WHERE fichier_cdr = '".basename($file)."'"; - -if ($db->query($sql)) -{ - $num = $db->num_rows(); - - if ($num == 1) - { - $row = $db->fetch_row(); - if ($row[0] > 0) - { - dol_syslog ("Fichier ".$file." déjà traité"); - exit ; - } - } - else - { - dol_syslog("Erreur vérif du fichier dans les comm"); - exit ; - } -} -else -{ - dol_syslog("Erreur SQL vérification du fichier dans les comm"); - dol_syslog($sql); - exit ; -} - -/* - * Charge les ID de lignes - * - */ - -$sql = "SELECT ligne, rowid "; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne"; - -$resql = $db->query($sql); - -if ($resql) -{ - $num = $db->num_rows($resql); - dol_syslog ($num . " lignes chargées"); - $i = 0; - $ligneids = array(); - - while ($i < $num) - { - $row = $db->fetch_row($resql); - $ligneids[$row[0]] = $row[1]; - $i++; - } -} -else -{ - dol_syslog("Erreur chargement des lignes"); - dol_syslog($sql); - exit ; -} - - -/* - * Traitement - * - */ - -if (is_readable($file)) -{ - - dol_syslog("Lecture du fichier $file"); - - $error = 0; - $line = 0; - $hf = fopen ($file, "r"); - $line = 0; - - if ($db->query("BEGIN")) - { - while (!feof($hf) ) - { - $cont = fgets($hf, 1024); - - if (strlen(trim($cont)) > 0) - { - $tabline = explode(";", $cont); - if (sizeof($tabline) == 11) - { - $index = $tabline[0]; - $ligne = ereg_replace('"','',$tabline[1]); - $date = $tabline[2]; - $heure = $tabline[3]; - $numero = $tabline[4]; - $tarif = $tabline[5]; - $duree_text = $tabline[6]; - $tarif_fourn = $tabline[7]; - $montant = $tabline[8]; - $duree_secondes = ereg_replace('"','',$tabline[9]); - - if ($ligneids[$ligne] > 0) - { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_import_cdr"; - - $sql .= "(idx,fk_ligne,ligne,date,heure,num,dest,dureetext,tarif,montant,duree"; - $sql .= ", fichier, fk_fournisseur)"; - - $sql .= " VALUES ("; - $sql .= "$index"; - $sql .= ",'".$ligneids[$ligne]."'"; - $sql .= ",'".$ligne."'"; - $sql .= ",'".ereg_replace('"','',$date)."'"; - $sql .= ",'".ereg_replace('"','',$heure)."'"; - $sql .= ",'".ereg_replace('"','',$numero)."'"; - $sql .= ",'".addslashes(ereg_replace('"','',$tarif))."'"; - $sql .= ",'".ereg_replace('"','',$duree_text)."'"; - $sql .= ",'".ereg_replace('"','',$tarif_fourn)."'"; - $sql .= ",".ereg_replace(',','.',$montant); - $sql .= ",".$duree_secondes; - $sql .= ",'".basename($file)."'"; - $sql .= " ,".$id_fourn; - $sql .= ")"; - - if(ereg("^[0-9]+$", $duree_secondes)) - { - if ($db->query($sql)) - { - $line_inserted++; - } - else - { - dol_syslog("Erreur de traitement de ligne $index"); - dol_syslog($db->error()); - dol_syslog($sql); - $error++; - } - } - else - { - print "Ligne : $cont ignorée\n"; - } - - } - else - { - dol_syslog("Ligne : $ligne ignorée!"); - $error++; - } - - } - else - { - dol_syslog("Mauvais format de fichier ligne $line"); - $error++; - } - } - $line++; - } - - dol_syslog(($line -1 )." lignes traitées dans le fichier"); - dol_syslog($line_inserted." insert effectués"); - - if ($error == 0) - { - $db->query("COMMIT"); - dol_syslog("COMMIT"); - } - else - { - $db->query("ROLLBACK"); - dol_syslog("ROLLBACK"); - } - - } - - fclose($hf); -} -else -{ - print "Erreur lecture : $file"; - dol_syslog($file . " not readable"); -} - - -return $error; diff --git a/htdocs/telephonie/script/import-rename-cdr.php b/htdocs/telephonie/script/import-rename-cdr.php deleted file mode 100644 index 80bace0e590..00000000000 --- a/htdocs/telephonie/script/import-rename-cdr.php +++ /dev/null @@ -1,97 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * Script d'import des CDR BT - */ - -require ("../../master.inc.php"); - -$opt = getopt("f:i:"); - -$file = $opt['f']; -$id_fourn = $opt['i']; - -if (strlen($file) == 0 ) -{ - print "Usage :\n php import-cdr-bt.php -f \n"; - exit; -} - -/* - * Traitement - * - */ - -$files = array(); - -if (is_dir($file)) -{ - $handle=opendir($file); - - if ($handle) - { - $i = 0 ; - $var=True; - - while (($xfile = readdir($handle))!==false) - { - if (is_file($file.$xfile) && substr($xfile, -4) == ".csv") - { - $files[$i] = $file.$xfile; - dol_syslog($file.$xfile." ajouté"); - $i++; - } - else - { - dol_syslog($file.$xfile." ignoré"); - } - } - - closedir($handle); - } - else - { - dol_syslog("Impossible de libre $file"); - exit ; - } -} -elseif (is_file($file)) -{ - $files[0] = $file; -} -else -{ - dol_syslog("Impossible de libre $file"); - exit ; -} - -$datef = strftime("%y%m", (time() - (15*3600*24)) ); - -foreach ($files as $xfile) -{ - if (is_readable($xfile)) - { - $newfile = ereg_replace(".csv","-".$datef.".csv", $xfile); - - rename ($xfile, $newfile); - } -} - -return $error; diff --git a/htdocs/telephonie/script/index.php b/htdocs/telephonie/script/index.php deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/telephonie/script/lignes-resiliees.php b/htdocs/telephonie/script/lignes-resiliees.php deleted file mode 100644 index 0ef14649955..00000000000 --- a/htdocs/telephonie/script/lignes-resiliees.php +++ /dev/null @@ -1,159 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * Calcul des commissions des distributeurs - */ - -require ("../../master.inc.php"); -require_once (DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); - -$error = 0; -$lignes = array(); -$resil = array(); -$datetime = time(); - -$datel = time() - (3600 * 24 * 7); - -/******************************************************** - * - * Verification des données - * - * - *********************************************************/ - -$distributeurs = array(); - -$sql = "SELECT fk_ligne, ".$db->pdate("tms"); -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne_statut"; -$sql .= " WHERE statut = 6"; -$sql .= " AND tms >= '".strftime("%Y-%m-%d",$datel)."';"; - -$resql = $db->query($sql); - -if ( $resql ) -{ - $num = $db->num_rows($resql); - $i = 0; - - while ($i < $num) - { - $row = $db->fetch_row($resql); - array_push($lignes, $row[0]); - $resil[$row[0]] = strftime("%d/%m/%y",$row[1]); - $i++; - } - $db->free($resql); -} -else -{ - $error = 1; -} - -$llig = substr("Ligne".str_repeat(" ",10), 0, 10); -$lsoc = substr("Societe".str_repeat(" ",40), 0, 40); -$lca = substr(str_repeat(" ",10)."CA Moyen", -10); -$lres = substr(str_repeat(" ",10)."Date Resil", -10); - -$message ="Bonjour,\n\n"; -$message .= "Veuillez trouver ci-joint la liste des lignes résiliées ces 7 derniers jours avec le chiffre d'affaire moyen.\n\n"; - -$message .= "$llig $lsoc $lca $lres\n"; -$message .= str_repeat("-",73)."\n"; - -foreach ($lignes as $lid) -{ - // print "$lid\n"; - $ligne = new LigneTel($db); - $ligne->fetch_by_id($lid); - - $sql = "SELECT sum(cout_vente), count(cout_vente)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture"; - $sql .= " WHERE fk_ligne = ".$ligne->id; - - $resql = $db->query($sql); - - if ( $resql ) - { - while ($row = $db->fetch_row($resql)) - { - $sum = $row[0]; - $nb = $row[1]; - } - $db->free($resql); - } - else - { - $error = 1; - } - - $num = $ligne->numero; - - $societe = new Societe($db); - $societe->fetch($ligne->client_comm_id); - $socnom = $societe->nom; - - if (strlen($socnom) > 40) - { - $socnom = substr($socnom, 0, 37) . "..."; - } - - $socnom = substr($socnom.str_repeat(" ",40), 0, 40) ; - - if ($nb > 0) - { - $ca = $sum / $nb; - } - else - { - $ca = 0; - } - - $pm = substr(" ".sprintf("%01.2f",$ca), -10); - - $message .= "$num $socnom $pm ".$resil[$ligne->id]."\n"; -} - - -$message .="\n--\n"; -$message .= "Ceci est un message automatique envoyé par dolibarr auquel vous ne pouvez pas répondre\n"; - -$users = array(1, 32); - -foreach ($users as $xuser) -{ - $cuser = new User($db, $xuser); - $cuser->fetch(); - - $subject ="Liste des lignes résiliées"; - $sendto = $cuser->prenom . " ".$cuser->nom . " <".$cuser->email.">"; - $from = "noreply@noreply.null"; - $message = wordwrap( $message, 76 ); - - $mailfile = new CMailFile($subject, - $sendto, - $from, - $message, array(), array(), array()); - if ( $mailfile->sendfile() ) - { - - } -} -?> diff --git a/htdocs/telephonie/script/pdfdetail.php b/htdocs/telephonie/script/pdfdetail.php deleted file mode 100644 index c8baeaa0cb0..00000000000 --- a/htdocs/telephonie/script/pdfdetail.php +++ /dev/null @@ -1,78 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * Régénère les factures détaillées pour un mois précis - * - */ -require ("../../master.inc.php"); - -require_once (DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); -require_once DOL_DOCUMENT_ROOT."/facture.class.php"; -require_once DOL_DOCUMENT_ROOT."/telephonie/facturetel.class.php"; -require_once DOL_DOCUMENT_ROOT."/telephonie/pdfdetail_ibreizh.modules.php"; - -/* - * Regénération de la facture détaillée - */ - -$year = "2005"; -$month = "01"; - -$sql = "SELECT rowid, fk_facture "; -$sql .= " FROM llx_telephonie_facture"; -$sql .= " WHERE date_format(date, '%Y%m') = '".$year.$month."'"; - -$result = $db->query($sql); - -if ($result) -{ - $num = $db->num_rows(); - $i = 0; - $message = ""; - while ($i < $num) - { - $row = $db->fetch_row(); - - $facid = $row[1]; - $factel_id = $row[0]; - - $factel = new FactureTel($db); - if ($factel->fetch($factel_id) == 0) - { - $ligne = new LigneTel($db); - if ($ligne->fetch($factel->ligne) == 1) - { - $facdet = new pdfdetail_ibreizh($db, $ligne->numero, $year, $month, $factel); - - if (! $facdet->write_pdf_file($facid, $ligne->numero)) - { - print "- ERREUR lors de Génération du pdf détaillé\n"; - $error = 19; - } - else - { - print "Génération du pdf détaillé ligne ".$ligne->numero."\n"; - } - } - } - $i++; - } -} - -$db->close(); - -?> diff --git a/htdocs/telephonie/script/plan-facturation.php b/htdocs/telephonie/script/plan-facturation.php deleted file mode 100644 index 8a53ba550f9..00000000000 --- a/htdocs/telephonie/script/plan-facturation.php +++ /dev/null @@ -1,186 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * Génération du plan de facturation - * - */ -print "Mem : ".memory_get_usage() ."\n"; -require ("../../master.inc.php"); - -require_once (DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/facturetel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/communication.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/numero.class.php"); -require_once (DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_workbook.inc.php"); -require_once (DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_worksheet.inc.php"); - -$error = 0; - -$datetime = time(); - -$date = strftime("%d%h%Y%Hh%Mm%S",$datetime); - -$sql = "SELECT c.rowid, sl.ligne, sl.code_analytique"; - -$sql .= ", s.nom, c.ref, s.code_client, s.address, s.cp, s.ville"; - -$sql .=" FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne as sl"; -$sql .=" , ".MAIN_DB_PREFIX."telephonie_contrat as c"; -$sql .=" , ".MAIN_DB_PREFIX."societe as s"; -$sql .= " WHERE sl.fk_contrat = c.rowid"; -$sql .= " AND c.fk_client_comm = 52"; -$sql .= " AND sl.statut <> 7"; -$sql .= " AND c.fk_soc_facture = s.rowid"; -$sql .= " ORDER BY c.rowid ASC, sl.code_analytique ASC"; - -$resql = $db->query($sql); - -if ($resql) -{ - - $dir = DOL_DATA_ROOT . "/telephonie/rapports/".$keygroupe; - - if (! file_exists($dir)) - { - umask(0); - if (! @mkdir($dir, 0755)) - { - print "Erreur: Le répertoire '$dir' n'existe pas et Dolibarr n'a pu le créer."; - } - } - - $fname = "/tmp/plan-facturation-".strftime("%d-%m-%Y",$datetime).".xls"; - - print "Open $fname\n"; - - $workbook = &new writeexcel_workbook($fname); - - $page2 = &$workbook->addworksheet("Plan"); - - $page2->set_column(0,0,8); - $page2->set_column(1,1,20); - $page2->set_column(2,2,48); - $page2->set_column(4,4,20); - $page2->set_column(5,5,50); - - $formatcc =& $workbook->addformat(); - $formatcc->set_align('center'); - $formatcc->set_align('vcenter'); - - $fclient =& $workbook->addformat(); - $fclient->set_align('left'); - $fclient->set_align('vcenter'); - - $fcode =& $workbook->addformat(); - $fcode->set_align('center'); - $fcode->set_align('vcenter'); - $fcode->set_border(1); - - $fligne =& $workbook->addformat(); - $fligne->set_align('center'); - $fligne->set_align('vcenter'); - $fligne->set_right(6); - $fligne->set_bottom(1); - - $fnb =& $workbook->addformat(); - $fnb->set_align('vcenter'); - $fnb->set_align('center'); - $fnb->set_top(1); - $fnb->set_right(1); - $fnb->set_bottom(1); - $fnb->set_left(6); - - $fduree =& $workbook->addformat(); - $fduree->set_align('center'); - $fduree->set_align('vcenter'); - $fduree->set_border(1); - - $fcout =& $workbook->addformat(); - $fcout->set_align('center'); - $fcout->set_align('vcenter'); - $fcout->set_num_format('0.00'); - $fcout->set_border(1); - - $fb =& $workbook->addformat(); - $fb->set_align('vcenter'); - $fb->set_bold(); - $fb->set_top(2); - - $fc =& $workbook->addformat(); - $fc->set_align('vcenter'); - $fc->set_top(2); - - $fa =& $workbook->addformat(); - $fa->set_align('left'); - $fa->set_align('vcenter'); - $fa->set_top(2); - - $fd =& $workbook->addformat(); - $fd->set_align('center'); - $fd->set_align('vcenter'); - $fd->set_top(2); - - $num = $db->num_rows($resql); - $i = 0; - $b = 0; - $oc = ''; - - while($i < $num) - { - $obj = $db->fetch_object($resql); - - if ($oc <> $obj->ref) - { - $b++; - - $z = $obj->nom . "(".$obj->code_client.")". "\n"; - $z.= $obj->address."\n"; - $z.= $obj->cp . " ".$obj->ville; - - $page2->write_string($i, 0, $b, $fc); - $page2->write_string($i, 1, "Contrat : ".$obj->ref, $fb); - $page2->write_string($i, 2, $z, $fa); - - $oc = $obj->ref; - $a = 0; - - $page2->write_string($i, 3, $obj->code_analytique, $fd); - $page2->write_string($i, 4, $obj->ligne, $fd); - $page2->write_string($i, 5, $obj->nom, $fa); - - } - - else - { - $page2->write_string($i, 3, $obj->code_analytique, $formatcc); - $page2->write_string($i, 4, $obj->ligne, $formatcc); - $page2->write_string($i, 5, $obj->nom, $fclient); - } - - $i++; - $a++; - } - - $workbook->close(); - dol_syslog("Close $fname"); - -} - -?> diff --git a/htdocs/telephonie/script/presel_active_view.php b/htdocs/telephonie/script/presel_active_view.php deleted file mode 100644 index 50ee4a37999..00000000000 --- a/htdocs/telephonie/script/presel_active_view.php +++ /dev/null @@ -1,199 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * Visualisation de l'etat des lignes preselectionn�es - * - */ -require ("../../master.inc.php"); -require_once DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"; -require_once DOL_DOCUMENT_ROOT."/telephonie/dolibarrmail.class.php"; - -$host = CMD_PRESEL_WEB_HOST; -$user_login = CMD_PRESEL_WEB_USER; -$user_passwd = CMD_PRESEL_WEB_PASS; - -$user = new User($db); -$user->id = 1; - -$ids = array(); - -if ($argv[1]) -{ - $debug = 0; - array_push($ids, $argv[1]); -} -else -{ - $sql = "SELECT rowid,ligne"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne"; - $sql .= " WHERE fk_fournisseur = 4"; - $sql .= " AND statut = 3"; - if ($debug) - { - $sql .= " LIMIT 1"; - } - $resql = $db->query($sql); - - if ($resql) - { - while ($row = $db->fetch_row($resql)) - { - array_push($ids, $row[1]); - } - } - else - { - print $db->error(); - exit(1); - } -} - -GetPreselection_byRef($db, $host, $user_login, $user_passwd, $ids, $debug, $user); - -/* - * Fonctions - * - */ - -function GetPreselection_byRef($db, $host, $user_login, $user_passwd, $ids, $debug, $user) -{ - $numcli = sizeof($ids); - $i = 0; - print "Nombre de lignes $numcli\n"; - foreach($ids as $cli) - { - $i++; - $fp = @fsockopen($host, 80, $errno, $errstr, 30); - if (!$fp) - { - print "Impossible de se connecter au server $errstr ($errno)"; - } - else - { - $ligne_numero = ""; - $ligne_service = ""; - $ligne_presel = ""; - - //GetPreselection_byRef - $url = "/AzurApp_websvc_b3gdb/account.asmx/GetPreselection_byRef?"; - - $url .= "user_login=". $user_login; - $url .= "&user_passwd=".$user_passwd; - $url .= "&telnum=".$cli; - - $out = "GET $url HTTP/1.1\r\n"; - $out .= "Host: $host\r\n"; - $out .= "Connection: Close\r\n\r\n"; - - fwrite($fp, $out); - - while (!feof($fp)) - { - $line = fgets($fp, 1024); - if ($debug) - { - print $line; - } - if (preg_match("//",$line)) - { - $results = explode(" ",trim($line)); - //print_r($results); - - $array = array(); - preg_match('/telnum="([0123456789]*)"/', $line, $array); - $ligne_numero = $array[1]; - - $array = array(); - preg_match('/ServiceActive="([\S]*)"/i', $line, $array); - $service_active = $array[1]; - - $array = array(); - preg_match('/PreSelectionActive="([\S]*)"/i', $line, $array); - $presel_active = $array[1]; - - $array = array(); - preg_match('/Service_Statut="([\S]*)"/i', $line, $array); - $ligne_service = $array[1]; - - $array = array(); - preg_match('/PreSelection_Statut="([\S]*)"/i', $line, $array); - $ligne_presel = $array[1]; - - if ($ligne_service.$ligne_presel <> 'TRAITE_OKTRAITE_OK') - { - print "$i/$numcli "; - print $ligne_numero." "; - print "$service_active/$presel_active "; - print substr($ligne_service.str_repeat(" ",20),0,20); - print substr($ligne_presel.str_repeat(" ",20),0,20); - print "\n"; - } - - $situation_key = $ligne_service.' / '.$ligne_presel; - - if ($situation_key == 'TRAITE_OK / ATTENTE') - { - $ligne = new LigneTel($db); - - if ($ligne->fetch($ligne_numero) == 1) - { - if ($ligne->statut == 3) - { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_commande_retour"; - $sql .= " (cli,mode,date_traitement,situation,fk_fournisseur,traite)"; - $sql .= " VALUES ('$ligne_numero','PRESELECTION',now(),'$situation_key',4,1);"; - - $resql = $db->query($sql); - - $statut = 6; - $date_resiliation = time(); - $datea = $db->idate($date_resiliation); - - if ($ligne->set_statut($user, $statut, $datea,'',4) <> 0) - { - $error++; - print "ERROR\n"; - } - } - } - else - { - print "Erreur de lecture\n"; - } - } - - - } - - if (preg_match("//",$line)) - { - $array = array(); - preg_match('/libelle="(.*)" xmlns:d4p1/', $line, $array); - - print "$i/$numcli "; - print "$cli ErreurAPI ".$array[1]."\n"; - } - } - fclose($fp); - } - } -} - -?> diff --git a/htdocs/telephonie/script/presel_view.php b/htdocs/telephonie/script/presel_view.php deleted file mode 100644 index d2a553c9ced..00000000000 --- a/htdocs/telephonie/script/presel_view.php +++ /dev/null @@ -1,157 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * Visualisation de l'etat des lignes preselectionn�es - * - */ -require ("../../master.inc.php"); -require_once DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"; - -$host = CMD_PRESEL_WEB_HOST; -$user_login = CMD_PRESEL_WEB_USER; -$user_passwd = CMD_PRESEL_WEB_PASS; - -$ids = array(); - -if ($argv[1]) -{ - $debug = 0; - array_push($ids, $argv[1]); -} -else -{ - $sql = "SELECT rowid,ligne"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne"; - $sql .= " WHERE fk_fournisseur = 4"; - $sql .= " AND statut = 9"; - if ($debug) - { - $sql .= " LIMIT 1"; - } - $resql = $db->query($sql); - - if ($resql) - { - while ($row = $db->fetch_row($resql)) - { - array_push($ids, $row[1]); - } - } - else - { - print $db->error(); - exit(1); - } -} - -GetPreselection_byRef($db, $host, $user_login, $user_passwd, $ids, $debug); - -/* - * Fonctions - * - */ - -function GetPreselection_byRef($db, $host, $user_login, $user_passwd, $ids, $debug) -{ - $numcli = sizeof($ids); - $i = 0; - print "Nombre de lignes $numcli\n"; - foreach($ids as $cli) - { - $i++; - $fp = @fsockopen($host, 80, $errno, $errstr, 30); - if (!$fp) - { - print "Impossible de se connecter au server $errstr ($errno)"; - } - else - { - $ligne_numero = ""; - $ligne_service = ""; - $ligne_presel = ""; - - //GetPreselection_byRef - $url = "/AzurApp_websvc_b3gdb/account.asmx/GetPreselection_byRef?"; - - $url .= "user_login=". $user_login; - $url .= "&user_passwd=".$user_passwd; - $url .= "&telnum=".$cli; - - $out = "GET $url HTTP/1.1\r\n"; - $out .= "Host: $host\r\n"; - $out .= "Connection: Close\r\n\r\n"; - - fwrite($fp, $out); - - while (!feof($fp)) - { - $line = fgets($fp, 1024); - if ($debug) - { - print $line; - } - if (preg_match("//",$line)) - { - $results = explode(" ",trim($line)); - //print_r($results); - - $array = array(); - preg_match('/telnum="([0123456789]*)"/', $line, $array); - $ligne_numero = $array[1]; - - $array = array(); - preg_match('/ServiceActive="([\S]*)"/i', $line, $array); - $service_active = $array[1]; - - $array = array(); - preg_match('/PreSelectionActive="([\S]*)"/i', $line, $array); - $presel_active = $array[1]; - - $array = array(); - preg_match('/Service_Statut="([\S]*)"/i', $line, $array); - $ligne_service = $array[1]; - - $array = array(); - preg_match('/PreSelection_Statut="([\S]*)"/i', $line, $array); - $ligne_presel = $array[1]; - - print "$i/$numcli "; - print $ligne_numero." "; - print "$service_active/$presel_active "; - print substr($ligne_service.str_repeat(" ",20),0,20); - print substr($ligne_presel.str_repeat(" ",20),0,20); - print "\n"; - } - - if (preg_match("//",$line)) - { - $array = array(); - preg_match('/libelle="(.*)" xmlns:d4p1/', $line, $array); - - print "$i/$numcli "; - print "$cli ErreurAPI ".$array[1]."\n"; - } - } - fclose($fp); - } - } -} - -?> diff --git a/htdocs/telephonie/script/rapport.php b/htdocs/telephonie/script/rapport.php deleted file mode 100644 index a77e87b1713..00000000000 --- a/htdocs/telephonie/script/rapport.php +++ /dev/null @@ -1,1038 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * Génération des rapports - * - */ -print "Mem : ".memory_get_usage() ."\n"; -require ("../../master.inc.php"); - -require_once (DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/facturetel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/telephonie-tarif.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/communication.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/numero.class.php"); -require_once (DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_workbook.inc.php"); -require_once (DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_worksheet.inc.php"); - - -$error = 0; - -$datetime = time(); - -$date = strftime("%d%h%Y%Hh%Mm%S",$datetime); - -$month = strftime("%m", $datetime); -$year = strftime("%Y", $datetime); - -if ($month == 1) -{ - $month = "12"; - $year = $year - 1; -} -else -{ - $month = substr("00".($month - 1), -2) ; -} - -//$month = "02"; -//$year = "2005"; - -/* - * Lecture des groupes de lignes - * - */ -$groupes = array(); -$numdatas = array(); -$lignes = array(); - -$tarif_vente = new TelephonieTarif($db, 1, "vente"); - -$sql = "SELECT rowid, nom FROM ".MAIN_DB_PREFIX."telephonie_groupeligne"; - -$resql = $db->query($sql); - -if ($resql) -{ - $nums = $db->num_rows($resql); - $i = 0; - while($i < $nums) - { - $row = $db->fetch_row($resql); - $groupes[$row[0]] = $row[1]; - print "Mem : ".memory_get_usage() ."\n"; - $i++; - } - $db->free($resql); -} - - -foreach ($groupes as $keygroupe => $groupe) -{ - - $dir = DOL_DATA_ROOT . "/telephonie/rapports/".$keygroupe; - - if (! file_exists($dir)) - { - umask(0); - if (! @mkdir($dir, 0755)) - { - print "Erreur: Le répertoire '$dir' n'existe pas et Dolibarr n'a pu le créer."; - } - } - - - $fname = $dir."/".substr('00'.$month, -2)."-".$year.".xls"; - - print "Open $fname\n"; - - $workbook = &new writeexcel_workbook($fname); - - $formatcc =& $workbook->addformat(); - $formatcc->set_align('center'); - $formatcc->set_align('vcenter'); - - $fclient =& $workbook->addformat(); - $fclient->set_align('left'); - $fclient->set_align('vcenter'); - $fclient->set_border(1); - - $fcode =& $workbook->addformat(); - $fcode->set_align('center'); - $fcode->set_align('vcenter'); - $fcode->set_border(1); - - $fligne =& $workbook->addformat(); - $fligne->set_align('center'); - $fligne->set_align('vcenter'); - $fligne->set_right(6); - $fligne->set_bottom(1); - - $fnb =& $workbook->addformat(); - $fnb->set_align('vcenter'); - $fnb->set_align('center'); - $fnb->set_top(1); - $fnb->set_right(1); - $fnb->set_bottom(1); - $fnb->set_left(6); - - $fduree =& $workbook->addformat(); - $fduree->set_align('center'); - $fduree->set_align('vcenter'); - $fduree->set_border(1); - - $fcout =& $workbook->addformat(); - $fcout->set_align('center'); - $fcout->set_align('vcenter'); - $fcout->set_num_format('0.00'); - $fcout->set_border(1); - - $fmoy =& $workbook->addformat(); - $fmoy->set_align('center'); - $fmoy->set_align('vcenter'); - $fmoy->set_right(6); - $fmoy->set_bottom(1); - $fmoy->set_num_format('0.0000'); - - $format_titre =& $workbook->addformat(); - $format_titre->set_align('center'); - $format_titre->set_align('vcenter'); - $format_titre->set_bold(); - $format_titre->set_border(1); - - $format_titre_nb =& $workbook->addformat(); - $format_titre_nb->set_align('center'); - $format_titre_nb->set_align('vcenter'); - $format_titre_nb->set_bold(); - $format_titre_nb->set_right(1); - $format_titre_nb->set_top(1); - $format_titre_nb->set_bottom(1); - $format_titre_nb->set_left(6); - - $format_titre_moy =& $workbook->addformat(); - $format_titre_moy->set_align('center'); - $format_titre_moy->set_align('vcenter'); - $format_titre_moy->set_bold(); - $format_titre_moy->set_right(1); - $format_titre_moy->set_top(1); - $format_titre_moy->set_bottom(1); - $format_titre_moy->set_right(6); - - $format_titre_agence1 =& $workbook->addformat(); - $format_titre_agence1->set_align('center'); - $format_titre_agence1->set_align('vcenter'); - $format_titre_agence1->set_bold(); - $format_titre_agence1->set_right(1); - $format_titre_agence1->set_left(1); - $format_titre_agence1->set_top(1); - $format_titre_agence1->set_merge(); - - $format_titre_agence2 =& $workbook->addformat(); - $format_titre_agence2->set_align('center'); - $format_titre_agence2->set_align('vcenter'); - $format_titre_agence2->set_bold(); - $format_titre_agence2->set_right(1); - $format_titre_agence2->set_left(1); - $format_titre_agence2->set_bottom(1); - $format_titre_agence2->set_merge(); - - - $format_titre_nat1 =& $workbook->addformat(); - $format_titre_nat1->set_align('center'); - $format_titre_nat1->set_align('vcenter'); - $format_titre_nat1->set_bold(); - $format_titre_nat1->set_left(6); - $format_titre_nat1->set_merge(); - - $format_titre_nat2 =& $workbook->addformat(); - $format_titre_nat2->set_align('center'); - $format_titre_nat2->set_align('vcenter'); - $format_titre_nat2->set_bold(); - $format_titre_nat2->set_merge(); - - $format_titre_nat3 =& $workbook->addformat(); - $format_titre_nat3->set_align('center'); - $format_titre_nat3->set_align('vcenter'); - $format_titre_nat3->set_bold(); - $format_titre_nat3->set_right(6); - $format_titre_nat3->set_merge(); - - $format_titre_total1 =& $workbook->addformat(); - $format_titre_total1->set_align('center'); - $format_titre_total1->set_align('vcenter'); - $format_titre_total1->set_bold(); - $format_titre_total1->set_left(1); - $format_titre_total1->set_top(1); - $format_titre_total1->set_bottom(1); - $format_titre_total1->set_merge(); - - $format_titre_total2 =& $workbook->addformat(); - $format_titre_total2->set_align('center'); - $format_titre_total2->set_align('vcenter'); - $format_titre_total2->set_bold(); - $format_titre_total2->set_top(1); - $format_titre_total2->set_bottom(1); - $format_titre_total2->set_merge(); - - $format_titre_total3 =& $workbook->addformat(); - $format_titre_total3->set_align('center'); - $format_titre_total3->set_align('vcenter'); - $format_titre_total3->set_bold(); - $format_titre_total3->set_right(6); - $format_titre_total3->set_top(1); - $format_titre_total3->set_bottom(1); - $format_titre_total3->set_merge(); - - - $formatc =& $workbook->addformat(); - $formatc->set_align('vcenter'); - - - $fnbBold =& $workbook->addformat(); - $fnbBold->set_align('vcenter'); - $fnbBold->set_bold(); - - $formatr =& $workbook->addformat(); - $formatr->set_align('vcenter'); - $formatr->set_align('right'); - - $fcoutBold =& $workbook->addformat(); - $fcoutBold->set_align('right'); - $fcoutBold->set_num_format('0.00'); - $fcoutBold->set_bold(); - - $fgrey =& $workbook->addformat(); - $fgrey->set_fg_color('yellow'); - $fgrey->set_bold(); - $fgrey->set_align('left'); - $fgrey->set_pattern(0x1); - - $ftotal =& $workbook->addformat(); - $ftotal->set_bold(); - $ftotal->set_align('right'); - $ftotal->set_align('vcenter'); - $ftotal->set_pattern(0x1); - - /* - * Chargement des numéros de datas - * - */ - - $sql = "SELECT n.numero "; - $sql .=" FROM ".MAIN_DB_PREFIX."telephonie_numdata as n"; - $sql .= " WHERE n.fk_groupe = ".$keygroupe; - - $resql = $db->query($sql); - - if ($resql) - { - $nums = $db->num_rows($resql); - $si = 0; - while($si < $nums) - { - $row = $db->fetch_row($resql); - $numdatas[$row[0]] = $row[0]; - $si++; - } - $db->free($resql); - } - else - { - print $db->error(); - } - - /* - * Boucle sur les mois - */ - for ($imonth = 1 ; $imonth <= ($month + 1) ; $imonth++) - { - - if ($imonth > $month) - { - $page2 = &$workbook->addworksheet("Année $year"); - } - else - { - $page2 = &$workbook->addworksheet($year."-.".substr("00".$imonth,-2)); - } - - for ($a = 0 ; $a < 200 ; $a++) - { - $page2->set_row($a,25); // A - } - - $page2->set_column(0,0,40); // A - $page2->set_column(1,1,10); // B - $page2->set_column(2,2,13); // C - - $page2->set_column(3,3,7); // D - $page2->set_column(6,6,7); // G - $page2->set_column(9,9,7); // J - $page2->set_column(12,12,7); // M - - $page2->set_column(4,5,10); // E-F - $page2->set_column(7,8,10); // H-I - $page2->set_column(10,11,10); // K-L - $page2->set_column(13,14,10); // N-O - - $page2->write(0, 0, "Agence/Filiale", $format_titre_agence1); - $page2->write_blank(1, 0, $format_titre_agence2); - - $page2->write(0, 1, "Site", $format_titre); - $page2->write(0, 2, "Ligne", $format_titre); - - $page2->write(0, 3, "Local/National", $format_titre_nat1); - $page2->write_blank(0, 4, $format_titre_nat2); - $page2->write_blank(0, 5, $format_titre_nat3); - - - $page2->write(1, 3, "Nb", $format_titre_nb); - $page2->write(1, 4, "Durée", $format_titre); - $page2->write(1, 5, "Coût", $format_titre); - - - $page2->write(0, 6, "Mobile SFR/Orange", $format_titre_nat1); - $page2->write_blank(0, 7, $format_titre_nat2); - $page2->write_blank(0, 8, $format_titre_nat3); - - - $page2->write(1, 6, "Nb", $format_titre_nb); - $page2->write(1, 7, "Durée", $format_titre); - $page2->write(1, 8, "Coût", $format_titre); - - - $page2->write(0, 9, "Mobile Bouygues", $format_titre_nat1); - $page2->write_blank(0, 10, $format_titre_nat2); - $page2->write_blank(0, 11, $format_titre_nat3); - - $page2->write(1, 9, "Nb", $format_titre_nb); - $page2->write(1, 10, "Durée", $format_titre); - $page2->write(1, 11, "Coût", $format_titre); - - - $page2->write(0, 12, "Données", $format_titre_nat1); - $page2->write_blank(0, 13, $format_titre_nat2); - $page2->write_blank(0, 14, $format_titre_nat3); - - $page2->write(1, 12, "Nb", $format_titre_nb); - $page2->write(1, 13, "Durée", $format_titre); - $page2->write(1, 14, "Coût", $format_titre); - - - $page2->write(0, 15, "Total", $format_titre_nat1); - $page2->write_blank(0, 16, $format_titre_nat2); - $page2->write_blank(0, 17, $format_titre_nat2); - $page2->write_blank(0, 18, $format_titre_nat3); - - $page2->write(1, 15, "Nb", $format_titre_nb); - $page2->write(1, 16, "Durée", $format_titre); - $page2->write(1, 17, "Coût", $format_titre); - $page2->write(1, 18, "Moyenne\ncoût/sec", $format_titre_moy); - - unset ($lignes); - - /* - * - * - */ - $sql = "SELECT sl.rowid, sl.ligne"; - $sql .=" FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne as sl"; - $sql .=" , ".MAIN_DB_PREFIX."telephonie_groupe_ligne as gl"; - - $sql .= " WHERE gl.fk_ligne = sl.rowid"; - $sql .= " AND sl.statut <> 7"; - $sql .= " AND gl.fk_groupe = ".$keygroupe; - - $sql .= " ORDER BY sl.fk_soc_facture ASC"; - - if ( $db->query($sql) ) - { - $nums = $db->num_rows(); - $si = 0; - while($si < $nums) - { - $row = $db->fetch_row(); - - $lignes[$row[0]] = $row[1]; - - //print "Lecture $row[1]\n"; - $si++; - } - $db->free(); - } - else - { - print $db->error(); - } - - /* - * - * - */ - - $xx = 2; - $oldxx = $xx+1; - $oldana = ''; - $oldfk_soc = ''; - $lines = array(); - - $fksoc = 0; - $tg = 0; // permet de gérer l'affichage du total groupe. - - $total_global_nb = 0; - $total_global_duree = 0; - $total_global_cout = 0; - - $total_global_mobile_nb = 0; - $total_global_mobile_duree = 0; - $total_global_mobile_cout = 0; - - $total_global_data_nb = 0; - $total_global_data_duree = 0; - $total_global_data_cout = 0; - - $total_global_inter_nb = 0; - $total_global_inter_duree = 0; - $total_global_inter_cout = 0; - - $total_global_national_nb = 0; - $total_global_national_duree = 0; - $total_global_national_cout = 0; - - $total_groupe_national_nb = 0; - $total_groupe_national_duree = 0; - $total_groupe_national_cout = 0; - - $total_groupe_mobile_sfr_nb = 0; - $total_groupe_mobile_sfr_duree = 0; - $total_groupe_mobile_sfr_cout = 0; - - $total_groupe_mobile_orange_nb = 0; - $total_groupe_mobile_orange_duree = 0; - $total_groupe_mobile_orange_cout = 0; - - $total_groupe_mobile_bouygues_nb = 0; - $total_groupe_mobile_bouygues_duree = 0; - $total_groupe_mobile_bouygues_cout = 0; - - $total_groupe_data_nb = 0; - $total_groupe_data_duree = 0; - $total_groupe_data_cout = 0; - - $total_groupe_duree = 0; - $total_groupe_nb = 0; - $total_groupe_cout = 0; - - foreach ($lignes as $keyligne => $ligne) - { - $lignetel = new LigneTel($db); - $lignetel->fetch_by_id($keyligne); - - $client = new Societe($db); - $client->fetch($lignetel->client_id); - - //print "Traitement ligne $keyligne ". $lignetel->numero."\n"; - - $national_nb = 0; - $national_duree = 0; - $national_cout = 0; - - $mobile_sfr_nb = 0; - $mobile_sfr_duree = 0; - $mobile_sfr_cout = 0; - - $mobile_orange_nb = 0; - $mobile_orange_duree = 0; - $mobile_orange_cout = 0; - - $mobile_bouygues_nb = 0; - $mobile_bouygues_duree = 0; - $mobile_bouygues_cout = 0; - - $inter_nb = 0; - $inter_duree = 0; - $inter_cout = 0; - - $data_nb = 0; - $data_duree = 0; - $data_cout = 0; - - if (($oldfk_soc <> $lignetel->client_facture_id) && ($fksoc > 0)) - { - $page2->write_string($xx, 0, 'Total', $format_titre_total1); - $page2->write_blank($xx, 1, $format_titre_total2); - $page2->write_blank($xx, 2, $format_titre_total3); - - $str = '=SUM(D'.$oldxx.':D'.($xx).')'; - $page2->write_formula($xx, 3, $str, $fnb); - - //$page2->write($xx, 3, $total_groupe_national_nb, $fnb); - $page2->write_string($xx, 4, duree_text($total_groupe_national_duree), $fduree); - - $str = '=SUM(F'.$oldxx.':F'.($xx).')'; - $page2->write_formula($xx, 5, $str, $fcout); - - $str = '=SUM(G'.$oldxx.':G'.($xx).')'; - $page2->write_formula($xx, 6, $str, $fnb); - - $page2->write_string($xx, 7, duree_text(($total_groupe_mobile_sfr_duree + $total_groupe_mobile_orange_duree)), $fduree); - - - $str = '=SUM(I'.$oldxx.':I'.($xx).')'; - $page2->write_formula($xx, 8, $str, $fcout); - - $str = '=SUM(J'.$oldxx.':J'.($xx).')'; - $page2->write_formula($xx, 9, $str, $fnb); - - $page2->write_string($xx, 10, duree_text($total_groupe_mobile_bouygues_duree), $fduree); - - $str = '=SUM(L'.$oldxx.':L'.($xx).')'; - $page2->write_formula($xx, 11, $str, $fcout); - - $str = '=SUM(M'.$oldxx.':M'.($xx).')'; - $page2->write_formula($xx, 12, $str, $fnb); - - $page2->write_string($xx, 13, duree_text($total_groupe_data_duree), $fduree); - - $str = '=SUM(O'.$oldxx.':O'.($xx).')'; - $page2->write_formula($xx, 14, $str, $fcout); - - $tlg_nb = $total_groupe_national_nb + $total_groupe_mobile_sfr_nb + $total_groupe_mobile_orange_nb + $total_groupe_mobile_bouygues_nb + $total_groupe_data_nb; - - $tlg_duree = $total_groupe_national_duree + $total_groupe_mobile_sfr_duree + $total_groupe_mobile_orange_duree + $total_groupe_mobile_bouygues_duree + $total_groupe_data_duree; - - $tlg_cout = $total_groupe_national_cout + $total_groupe_mobile_sfr_cout + $total_groupe_mobile_orange_cout + $total_groupe_mobile_bouygues_cout + $total_groupe_data_cout; - - $str ="=D".($xx+1)."+G".($xx+1)."+J".($xx+1)."+M".($xx+1); - - $page2->write_formula($xx, 15, $str, $fnb); - $page2->write_string($xx, 16, duree_text($tlg_duree), $fduree); - $str ="=F".($xx+1)."+I".($xx+1)."+L".($xx+1)."+O".($xx+1); - $page2->write_formula($xx, 17, $str, $fcout); - - - if ($tlg_duree > 0) - { - $page2->write($xx, 18, round(($tlg_cout/$tlg_duree),4), $fmoy); - } - else - { - $page2->write($xx, 18, 0, $fmoy); - } - - $tg = 0; - $total_groupe_duree = 0; - $total_groupe_nb = 0; - $total_groupe_cout = 0; - - $total_groupe_national_nb = 0; - $total_groupe_national_duree = 0; - $total_groupe_national_cout = 0; - - $total_groupe_mobile_sfr_nb = 0; - $total_groupe_mobile_sfr_duree = 0; - $total_groupe_mobile_sfr_cout = 0; - - $total_groupe_mobile_orange_nb = 0; - $total_groupe_mobile_orange_duree = 0; - $total_groupe_mobile_orange_cout = 0; - - $total_groupe_mobile_bouygues_nb = 0; - $total_groupe_mobile_bouygues_duree = 0; - $total_groupe_mobile_bouygues_cout = 0; - - $total_groupe_data_nb = 0; - $total_groupe_data_duree = 0; - $total_groupe_data_cout = 0; - - $lines = array(); - - $oldfk_soc = $lignetel->client_facture_id; - $xx++; - $oldxx = $xx+1; - } - else - { - if ($tg == 1) - { - // Ecrase le total groupe si la ligne suivante fait partie du même groupe - $tg = 0; - } - } - - $page2->write_string($xx, 1, $lignetel->code_analytique, $fcode); - $page2->write_string($xx, 0, $client->nom, $fclient); - - $total_duree = 0; - $total_cout = 0; - $total_nb=0; - - $page2->write_string($xx, 2, $lignetel->numero, $fligne); - - /* - * Communications - */ - - $sql = "SELECT ligne, numero, date, fourn_cout, fourn_montant, duree, tarif_achat_temp, tarif_achat_fixe, tarif_vente_temp, tarif_vente_fixe, cout_achat, cout_vente, remise"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details as l"; - $sql .= " WHERE ligne = '".$lignetel->numero."'"; - - if ($imonth > $month) - { - $sql .= " AND date_format(date,'%Y') = ".$year; - } - else - { - $sql .= " AND date_format(date,'%Y%m') = ".$year.substr("00".$imonth, -2); - } - $sql .= " ORDER BY date ASC "; - - $result = $db->query($sql); - if ($result) - { - $num = $db->num_rows(); - $i = 0; - - while ($i < $num) - { - $obj = $db->fetch_object(); - - $NumTel = new TelephonieNumero($obj->numero); - $type = $NumTel->NumeroType($lignetel->numero); - - /* - * Type appel - * - */ - - if ($type == 'mobile') - { - $z = ''; - $nnum = '0033'.substr($obj->numero, 1); - // print $nnum; - $tarif_vente->cout($nnum, $x, $y, $z); - // print " ".$z."\n"; - - if ($z == 'FRANCE MOBILE SFR') - { - $type = 'mobile_sfr'; - } - elseif ($z == 'FRANCE MOBILE ORANGE') - { - $type = 'mobile_orange'; - } - elseif ($z == 'FRANCE MOBILE BOUYGUES') - { - $type = 'mobile_bouygues'; - } - else - { - print "ERROR ERROR ERROR ERROR\n"; - exit (1); - } - } - - if (array_key_exists($obj->numero, $numdatas) ) - { - $data_nb++; - $data_duree += $obj->duree; - $data_cout += $obj->cout_vente; - - $total_groupe_data_nb++; - $total_groupe_data_duree += $obj->duree; - $total_groupe_data_cout += $obj->cout_vente; - - $total_global_data_nb++; - $total_global_data_duree += $obj->duree; - $total_global_data_cout += $obj->cout_vente; - } - else - { - if ($type == 'mobile_sfr') - { - $mobile_sfr_nb++; - $mobile_sfr_duree += $obj->duree; - $mobile_sfr_cout += $obj->cout_vente; - - $total_groupe_mobile_sfr_nb++; - $total_groupe_mobile_sfr_duree += $obj->duree; - $total_groupe_mobile_sfr_cout += $obj->cout_vente; - - $total_global_mobile_sfr_nb++; - $total_global_mobile_sfr_duree += $obj->duree; - $total_global_mobile_sfr_cout += $obj->cout_vente; - } - elseif ($type == 'mobile_orange') - { - $mobile_orange_nb++; - $mobile_orange_duree += $obj->duree; - $mobile_orange_cout += $obj->cout_vente; - - $total_groupe_mobile_orange_nb++; - $total_groupe_mobile_orange_duree += $obj->duree; - $total_groupe_mobile_orange_cout += $obj->cout_vente; - - $total_global_mobile_orange_nb++; - $total_global_mobile_orange_duree += $obj->duree; - $total_global_mobile_orange_cout += $obj->cout_vente; - } - elseif ($type == 'mobile_bouygues') - { - $mobile_bouygues_nb++; - $mobile_bouygues_duree += $obj->duree; - $mobile_bouygues_cout += $obj->cout_vente; - - $total_groupe_mobile_bouygues_nb++; - $total_groupe_mobile_bouygues_duree += $obj->duree; - $total_groupe_mobile_bouygues_cout += $obj->cout_vente; - - $total_global_mobile_bouygues_nb++; - $total_global_mobile_bouygues_duree += $obj->duree; - $total_global_mobile_bouygues_cout += $obj->cout_vente; - } - elseif ($type == 'inter') - { - $inter_nb++; - $inter_duree += $obj->duree; - $inter_cout += $obj->cout_vente; - - $total_global_inter_nb++; - $total_global_inter_duree += $obj->duree; - $total_global_inter_cout += $obj->cout_vente; - } - elseif ($type == 'national') - { - $national_nb++; - $national_duree += $obj->duree; - $national_cout += $obj->cout_vente; - - $total_groupe_national_nb++; - $total_groupe_national_duree += $obj->duree; - $total_groupe_national_cout += $obj->cout_vente; - - $total_global_national_nb++; - $total_global_national_duree += $obj->duree; - $total_global_national_cout += $obj->cout_vente; - } - else - { - print "ERROR ERROR ERROR ERROR\n"; - exit (1); - } - } - - $total_nb++; - $total_duree += $obj->duree; - $total_cout += $obj->cout_vente; - - $total_groupe_nb++; - $total_groupe_duree += $obj->duree; - $total_groupe_cout += $obj->cout_vente; - - $total_global_nb++; - $total_global_duree += $obj->duree; - $total_global_cout += $obj->cout_vente; - - $i++; - } - } - else - { - print $db->error(); - } - - /* - $page2->write($xx, 3, $data_nb, $formatc); - $page2->write_string($xx, 4, duree_text($data_duree), $fduree); - $page2->write($xx, 5, $data_cout, $fcout); - */ - - /* Local / National */ - - $page2->write($xx, 3, $national_nb, $fnb); - $page2->write_string($xx, 4, duree_text($national_duree), $fduree); - $page2->write($xx, 5, $national_cout, $fcout); - - /* Mobile SFR + Mobile Orange */ - - $page2->write($xx, 6, ($mobile_sfr_nb + $mobile_orange_nb), $fnb); - $page2->write_string($xx, 7, duree_text($mobile_sfr_duree + $mobile_orange_duree), $fduree); - $page2->write($xx, 8, ($mobile_sfr_cout+$mobile_orange_cout), $fcout); - - /* Mobile Bouygues */ - - $page2->write($xx, 9, $mobile_bouygues_nb, $fnb); - $page2->write_string($xx, 10, duree_text($mobile_bouygues_duree), $fduree); - $page2->write($xx, 11, $mobile_bouygues_cout, $fcout); - - /* Data */ - - $page2->write($xx, 12, $data_nb, $fnb); - $page2->write_string($xx, 13, duree_text($data_duree), $fduree); - $page2->write($xx, 14, $data_cout, $fcout); - - /* Totaux */ - $tl_nb = $national_nb + $mobile_sfr_nb + $mobile_orange_nb + $mobile_bouygues_nb + $data_nb; - $tl_cout = $national_cout + $mobile_sfr_cout + $mobile_orange_cout + $mobile_bouygues_cout + $data_cout; - $tl_duree = $national_duree + $mobile_sfr_duree + $mobile_orange_duree + $mobile_bouygues_duree + $data_duree; - - $str ="=D".($xx+1)."+G".($xx+1)."+J".($xx+1)."+M".($xx+1); - - $page2->write_formula($xx, 15, $str , $fnb); - $page2->write_string($xx, 16, duree_text($tl_duree), $fduree); - - $str ="=F".($xx+1)."+I".($xx+1)."+L".($xx+1)."+O".($xx+1); - - $page2->write($xx, 17, $str, $fcout); - - if ($tl_duree > 0) - { - $page2->write($xx, 18, round(($tl_cout/$tl_duree),4), $fmoy); - } - else - { - $page2->write($xx, 18, 0, $fmoy); - } - - /* - $page2->write($xx, 3, $inter_nb, $formatc); - $page2->write_string($xx, 4, duree_text($inter_duree), $fduree); - $page2->write($xx, 5, $inter_cout, $fcout); - */ - - - /* - $page2->write($xx, 3, $total_nb, $ftotal); - $page2->write_string($xx, 4, duree_text($total_duree), $fdureeBold); - $page2->write($xx, 5, $total_cout, $fcoutBold); - */ - - $xx++; - $fksoc++; - } // Fin de la boucle des lignes - /* - $page2->write_string($xx, 0, 'Total', $format_titre_total1); - $page2->write_blank($xx, 1, $format_titre_total2); - $page2->write_blank($xx, 2, $format_titre_total3); - - $page2->write($xx, 3, $total_groupe_national_nb, $fnb); - $page2->write_string($xx, 4, duree_text($total_groupe_national_duree), $fduree); - $page2->write($xx, 5, $total_groupe_national_cout, $fcout); - - - $page2->write($xx, 6, ($total_groupe_mobile_sfr_nb + $total_groupe_mobile_orange_nb), $fnb); - $page2->write_string($xx, 7, duree_text(($total_groupe_mobile_sfr_duree + $total_groupe_mobile_orange_duree)), $fduree); - - $page2->write($xx, 8, ($total_groupe_mobile_sfr_cout + $total_groupe_mobile_orange_cout), $fcout); - - - $page2->write($xx, 9, $total_groupe_mobile_bouygues_nb, $fnb); - $page2->write_string($xx, 10, duree_text($total_groupe_mobile_bouygues_duree ), $fduree); - - $page2->write($xx, 11, $total_groupe_mobile_bouygues_cout, $fcout); - - - $page2->write($xx, 12, $total_groupe_data_nb, $fnb); - $page2->write_string($xx, 13, duree_text($total_groupe_data_duree), $fduree); - $page2->write($xx, 14, $total_groupe_data_cout, $fcout); - - - $tlg_nb = $total_groupe_national_nb + $total_groupe_mobile_sfr_nb + $total_groupe_mobile_orange_nb + $total_groupe_mobile_bouygues_nb + $total_groupe_data_nb; - - $tlg_duree = $total_groupe_national_duree + $total_groupe_mobile_sfr_duree + $total_groupe_mobile_orange_duree + $total_groupe_mobile_bouygues_duree + $total_groupe_data_duree; - - $tlg_cout = $total_groupe_national_cout + $total_groupe_mobile_sfr_cout + $total_groupe_mobile_orange_cout + $total_groupe_mobile_bouygues_cout + $total_groupe_data_cout; - - $page2->write($xx, 19, $tlg_nb, $fnb); - $page2->write_string($xx, 20, duree_text($tlg_duree), $fduree); - $page2->write($xx, 21, $tlg_cout, $fcout); - $page2->write($xx, 22, ($tlg_cout/$tlg_duree), $fmoy); - - */ - - /******************************/ - - $page2->write_string($xx, 0, 'Total', $format_titre_total1); - $page2->write_blank($xx, 1, $format_titre_total2); - $page2->write_blank($xx, 2, $format_titre_total3); - - $str = '=SUM(D'.$oldxx.':D'.($xx).')'; - $page2->write_formula($xx, 3, $str, $fnb); - - //$page2->write($xx, 3, $total_groupe_national_nb, $fnb); - $page2->write_string($xx, 4, duree_text($total_groupe_national_duree), $fduree); - - $str = '=SUM(F'.$oldxx.':F'.($xx).')'; - $page2->write_formula($xx, 5, $str, $fcout); - - $str = '=SUM(G'.$oldxx.':G'.($xx).')'; - $page2->write_formula($xx, 6, $str, $fnb); - - $page2->write_string($xx, 7, duree_text(($total_groupe_mobile_sfr_duree + $total_groupe_mobile_orange_duree)), $fduree); - - - $str = '=SUM(I'.$oldxx.':I'.($xx).')'; - $page2->write_formula($xx, 8, $str, $fcout); - - $str = '=SUM(J'.$oldxx.':J'.($xx).')'; - $page2->write_formula($xx, 9, $str, $fnb); - - $page2->write_string($xx, 10, duree_text($total_groupe_mobile_bouygues_duree), $fduree); - - $str = '=SUM(L'.$oldxx.':L'.($xx).')'; - $page2->write_formula($xx, 11, $str, $fcout); - - $str = '=SUM(M'.$oldxx.':M'.($xx).')'; - $page2->write_formula($xx, 12, $str, $fnb); - - $page2->write_string($xx, 13, duree_text($total_groupe_data_duree), $fduree); - - $str = '=SUM(O'.$oldxx.':O'.($xx).')'; - $page2->write_formula($xx, 14, $str, $fcout); - - $tlg_nb = $total_groupe_national_nb + $total_groupe_mobile_sfr_nb + $total_groupe_mobile_orange_nb + $total_groupe_mobile_bouygues_nb + $total_groupe_data_nb; - - $tlg_duree = $total_groupe_national_duree + $total_groupe_mobile_sfr_duree + $total_groupe_mobile_orange_duree + $total_groupe_mobile_bouygues_duree + $total_groupe_data_duree; - - $tlg_cout = $total_groupe_national_cout + $total_groupe_mobile_sfr_cout + $total_groupe_mobile_orange_cout + $total_groupe_mobile_bouygues_cout + $total_groupe_data_cout; - - $str ="=D".($xx+1)."+G".($xx+1)."+J".($xx+1)."+M".($xx+1); - - $page2->write_formula($xx, 15, $str, $fnb); - $page2->write_string($xx, 16, duree_text($tlg_duree), $fduree); - $str ="=F".($xx+1)."+I".($xx+1)."+L".($xx+1)."+O".($xx+1); - $page2->write_formula($xx, 17, $str, $fcout); - - if ($tlg_duree > 0) - { - $page2->write($xx, 18, round(($tlg_cout/$tlg_duree),4), $fmoy); - } - else - { - $page2->write($xx, 18, 0, $fmoy); - } - - - - /********************************/ - - - $tg = 0; - $total_groupe_duree = 0; - $total_groupe_nb = 0; - $total_groupe_cout = 0; - - $total_groupe_national_nb = 0; - $total_groupe_national_duree = 0; - $total_groupe_national_cout = 0; - - $total_groupe_mobile_sfr_nb = 0; - $total_groupe_mobile_sfr_duree = 0; - $total_groupe_mobile_sfr_cout = 0; - - $total_groupe_mobile_orange_nb = 0; - $total_groupe_mobile_orange_duree = 0; - $total_groupe_mobile_orange_cout = 0; - - $total_groupe_mobile_bouygues_nb = 0; - $total_groupe_mobile_bouygues_duree = 0; - $total_groupe_mobile_bouygues_cout = 0; - - $total_groupe_data_nb = 0; - $total_groupe_data_duree = 0; - $total_groupe_data_cout = 0; - - $oldfk_soc = $lignetel->client_facture_id; - $xx++; - - } - - $workbook->close(); - dol_syslog("Close $fname"); - -} - -function duree_text($duree) -{ - $h = floor($duree / 3600); - $m = floor(($duree - ($h * 3600)) / 60); - $s = ($duree - ( ($h * 3600 ) + ($m * 60) ) ); - - if ($h > 0) - { - $dt = $h . " h " . $m ." min " . $s ." sec" ; - } - else - { - if ($m > 0) - { - $dt = $m ." min " . $s ." sec" ; - } - else - { - $dt = $s ." sec" ; - } - } - - - return $h.":".substr("00".$m, -2).":".substr("00".$s,-2); -} - -?> diff --git a/htdocs/telephonie/script/recap-commande-week.php b/htdocs/telephonie/script/recap-commande-week.php deleted file mode 100644 index 38e21080fec..00000000000 --- a/htdocs/telephonie/script/recap-commande-week.php +++ /dev/null @@ -1,259 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * - * Génére un tableur des lignes commandées dans la semaine - * On génère sur la semaine précédente, le script étant lancé le lundi - * - */ -require "../../master.inc.php"; -require_once DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"; -require_once DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_workbook.inc.php"; -require_once DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_worksheet.inc.php"; -require_once DOL_DOCUMENT_ROOT."/telephonie/dolibarrmail.class.php"; - -define ('COMMANDETABLEUR_NOEMAIL', -3); - -$opt = getopt("e:"); - -$email = $opt['e']; - -$date = time(); -$date_now = $date; - -$dateg = $date - (86400 * 7) ; // On génére la semaine précédente - -Generate($dateg, $db, $date_now, $email); - -/* - * - * - */ - -function Generate($date_gen, $db, $date_now, $email) -{ - $datef = strftime("%Y-%V", $date_gen); - - $shortname = "recap-semaine-".$datef.".xls"; - $fname = DOL_DATA_ROOT ."/telephonie/ligne/commande/".$shortname; - - $ligne = new LigneTel($db); - - $workbook = &new writeexcel_workbook($fname); - - $worksheet = &$workbook->addworksheet(); - - $worksheet->write(0, 0, "Récapitulatif des commandes semaine ".strftime("%V/%Y",$date_gen)." (généré le ".strftime("%d %B %Y %HH%M", $date_now) . ")"); - - $worksheet->set_column('A:A', 12); - $worksheet->set_column('B:B', 42); - $worksheet->set_column('C:C', 15); - $worksheet->set_column('D:D', 14); - $worksheet->set_column('E:E', 28); - - $formatcc =& $workbook->addformat(); - $formatcc->set_align('center'); - $formatcc->set_align('vcenter'); - - $format[2] =& $workbook->addformat(); - $format[2]->set_align('center'); - $format[2]->set_align('vcenter'); - $format[2]->set_color('blue'); - - $format[3] =& $workbook->addformat(); - $format[3]->set_align('center'); - $format[3]->set_align('vcenter'); - $format[3]->set_color('green'); - - $format[4] =& $workbook->addformat(); - $format[4]->set_align('center'); - $format[4]->set_align('vcenter'); - $format[4]->set_color('pink'); - - $format[5] =& $workbook->addformat(); - $format[5]->set_align('center'); - $format[5]->set_align('vcenter'); - $format[5]->set_color('orange'); - - $format[6] =& $workbook->addformat(); - $format[6]->set_align('center'); - $format[6]->set_align('vcenter'); - $format[6]->set_color('red'); - $format[6]->set_bold(); - - $format[7] =& $workbook->addformat(); - $format[7]->set_align('center'); - $format[7]->set_align('vcenter'); - $format[7]->set_color('red'); - $format[7]->set_bold(); - - $format_left[2] =& $workbook->addformat(); - $format_left[2]->set_align('vcenter'); - $format_left[2]->set_color('blue'); - - $format_left[3] =& $workbook->addformat(); - $format_left[3]->set_align('vcenter'); - $format_left[3]->set_color('green'); - - $format_left[4] =& $workbook->addformat(); - $format_left[4]->set_align('vcenter'); - $format_left[4]->set_color('pink'); - - $format_left[5] =& $workbook->addformat(); - $format_left[5]->set_align('vcenter'); - $format_left[5]->set_color('orange'); - - $format_left[6] =& $workbook->addformat(); - $format_left[6]->set_align('vcenter'); - $format_left[6]->set_color('red'); - $format_left[6]->set_bold(); - - $format_left[7] =& $workbook->addformat(); - $format_left[7]->set_align('vcenter'); - $format_left[7]->set_color('red'); - $format_left[7]->set_bold(); - - - $formatccb =& $workbook->addformat(); - $formatccb->set_align('center'); - $formatccb->set_align('vcenter'); - $formatccb->set_bold(); - - $formatccbr =& $workbook->addformat(); - $formatccbr->set_align('center'); - $formatccbr->set_align('vcenter'); - $formatccbr->set_color('red'); - $formatccbr->set_bold(); - - $formatc =& $workbook->addformat(); - $formatc->set_align('vcenter'); - - $formatcb =& $workbook->addformat(); - $formatcb->set_align('vcenter'); - $formatcb->set_bold(); - - $i = 0; - - $ligneids = array(); - - $sqlall = "SELECT s.code_client, s.nom, s.rowid as socid, l.ligne, f.nom as fournisseur, l.statut, l.rowid"; - $sqlall .= " , comm.name, comm.firstname, l.remise"; - $sqlall .= " , ".$db->pdate("l.date_commande")." as date_commande"; - $sqlall .= " FROM ".MAIN_DB_PREFIX."societe as s"; - $sqlall .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; - $sqlall .= " , ".MAIN_DB_PREFIX."societe as r"; - $sqlall .= " , ".MAIN_DB_PREFIX."user as comm"; - $sqlall .= " , ".MAIN_DB_PREFIX."telephonie_fournisseur as f"; - $sqlall .= " WHERE l.fk_soc = s.rowid AND l.fk_fournisseur = f.rowid"; - $sqlall .= " AND l.fk_soc_facture = r.rowid "; - $sqlall .= " AND l.fk_commercial = comm.rowid "; - $sqlall .= " AND date_format(l.date_commande,'%Y%v') = '".strftime("%Y%V", $date_gen)."'"; - /* - * - */ - - $sql = $sqlall; - - $sql .= " ORDER BY l.date_commande DESC"; - - $result = $db->query($sql); - - if ($result) - { - $num = $db->num_rows(); - - $worksheet->write(1, 0, "Code", $formatc); - $worksheet->write(1, 1, "Client", $formatc); - $worksheet->write(1, 2, "Numéro", $formatcc); - $worksheet->write(1, 3, "Date commande", $formatcc); - $worksheet->write(1, 4, "Statut actuel", $formatcc); - - while ($i < $num) - { - $obj = $db->fetch_object(); - - $j = $i + 3; - - $soc = new Societe($db); - $soc->fetch($obj->socid); - - $worksheet->write($j, 0, $obj->code_client, $format_left[$obj->statut]); - - $worksheet->write($j, 1, $obj->nom, $format_left[$obj->statut]); - - $worksheet->write_string($j, 2, "$obj->ligne", $format[$obj->statut]); - - $worksheet->write($j, 3, strftime("%d/%m/%y",$obj->date_commande), $format[$obj->statut]); - - $worksheet->write($j, 4, $ligne->statuts[$obj->statut], $format[$obj->statut]); - - $i++; - } - - $db->free(); - } - else - { - print $db->error() . ' ' . $sql; - } - - /* - * - * - */ - - $workbook->close(); - /* - * - */ - if (strlen($email)) - { - MailFile($fname, $shortname, $email); - } - -} - - - -function MailFile($filename, $shortname, $to) -{ - $subject = "Recapitulatif hebdomadaire des commandes"; - - $sendto = $to; - - $from = TELEPHONIE_LIGNE_COMMANDE_EMAIL_BCC; - - $message = "Bonjour,\n\nVeuillez trouver ci-joint le dernier récapitulatif des commandes.\n\n"; - $message .= "\n\nCordialement,\n"; - - $mailfile = new DolibarrMail($subject, - $sendto, - $from, - $message); - - $mailfile->PrepareFile(array($filename), - array("application/msexcel"), - array($shortname)); - - if ( $mailfile->sendfile() ) - { - return 0; - } -} diff --git a/htdocs/telephonie/script/recap-commande.php b/htdocs/telephonie/script/recap-commande.php deleted file mode 100644 index 1f589f270fa..00000000000 --- a/htdocs/telephonie/script/recap-commande.php +++ /dev/null @@ -1,263 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * - * Génére un tableur des lignes commandées dans le mois - * - * - */ -require "../../master.inc.php"; -require_once DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"; -require_once DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_workbook.inc.php"; -require_once DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_worksheet.inc.php"; -require_once DOL_DOCUMENT_ROOT."/telephonie/dolibarrmail.class.php"; - -define ('COMMANDETABLEUR_NOEMAIL', -3); - -$opt = getopt("e:"); - -$email = $opt['e']; - -$date = time(); -$date_now = $date; - -Generate($date, $db, $date_now, $email); - -if (strftime("%d", $date_now) < 7) -{ - $date_prev = $date - (86400 * 9); - Generate($date_prev, $db, $date_now, $email); -} - -/* - * - * - */ - -function Generate($date_gen, $db, $date_now, $email) -{ - $datef = strftime("%Y-%m", $date_gen); - - $shortname = "recap-".$datef.".xls"; - $fname = DOL_DATA_ROOT ."/telephonie/ligne/commande/".$shortname; - - $ligne = new LigneTel($db); - - $workbook = &new writeexcel_workbook($fname); - - $worksheet = &$workbook->addworksheet(); - - $worksheet->write(0, 0, "Récapitulatif des commandes du mois de ".strftime("%B %Y",$date_gen)." (généré le ".strftime("%d %B %Y %HH%M", $date_now) . ")"); - - $worksheet->set_column('A:A', 12); - $worksheet->set_column('B:B', 42); - $worksheet->set_column('C:C', 15); - $worksheet->set_column('D:D', 14); - $worksheet->set_column('E:E', 28); - - $formatcc =& $workbook->addformat(); - $formatcc->set_align('center'); - $formatcc->set_align('vcenter'); - - $format[2] =& $workbook->addformat(); - $format[2]->set_align('center'); - $format[2]->set_align('vcenter'); - $format[2]->set_color('blue'); - - $format[3] =& $workbook->addformat(); - $format[3]->set_align('center'); - $format[3]->set_align('vcenter'); - $format[3]->set_color('green'); - - $format[4] =& $workbook->addformat(); - $format[4]->set_align('center'); - $format[4]->set_align('vcenter'); - $format[4]->set_color('pink'); - - $format[5] =& $workbook->addformat(); - $format[5]->set_align('center'); - $format[5]->set_align('vcenter'); - $format[5]->set_color('orange'); - - $format[6] =& $workbook->addformat(); - $format[6]->set_align('center'); - $format[6]->set_align('vcenter'); - $format[6]->set_color('red'); - $format[6]->set_bold(); - - $format[7] =& $workbook->addformat(); - $format[7]->set_align('center'); - $format[7]->set_align('vcenter'); - $format[7]->set_color('red'); - $format[7]->set_bold(); - - $format_left[2] =& $workbook->addformat(); - $format_left[2]->set_align('vcenter'); - $format_left[2]->set_color('blue'); - - $format_left[3] =& $workbook->addformat(); - $format_left[3]->set_align('vcenter'); - $format_left[3]->set_color('green'); - - $format_left[4] =& $workbook->addformat(); - $format_left[4]->set_align('vcenter'); - $format_left[4]->set_color('pink'); - - $format_left[5] =& $workbook->addformat(); - $format_left[5]->set_align('vcenter'); - $format_left[5]->set_color('orange'); - - $format_left[6] =& $workbook->addformat(); - $format_left[6]->set_align('vcenter'); - $format_left[6]->set_color('red'); - $format_left[6]->set_bold(); - - $format_left[7] =& $workbook->addformat(); - $format_left[7]->set_align('vcenter'); - $format_left[7]->set_color('red'); - $format_left[7]->set_bold(); - - - $formatccb =& $workbook->addformat(); - $formatccb->set_align('center'); - $formatccb->set_align('vcenter'); - $formatccb->set_bold(); - - $formatccbr =& $workbook->addformat(); - $formatccbr->set_align('center'); - $formatccbr->set_align('vcenter'); - $formatccbr->set_color('red'); - $formatccbr->set_bold(); - - $formatc =& $workbook->addformat(); - $formatc->set_align('vcenter'); - - $formatcb =& $workbook->addformat(); - $formatcb->set_align('vcenter'); - $formatcb->set_bold(); - - $i = 0; - - $ligneids = array(); - - $sqlall = "SELECT s.code_client, s.nom, s.rowid as socid, l.ligne, f.nom as fournisseur, l.statut, l.rowid"; - $sqlall .= " , comm.name, comm.firstname, l.remise"; - $sqlall .= " , ".$db->pdate("l.date_commande")." as date_commande"; - $sqlall .= " FROM ".MAIN_DB_PREFIX."societe as s"; - $sqlall .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; - $sqlall .= " , ".MAIN_DB_PREFIX."societe as r"; - $sqlall .= " , ".MAIN_DB_PREFIX."user as comm"; - $sqlall .= " , ".MAIN_DB_PREFIX."telephonie_fournisseur as f"; - $sqlall .= " WHERE l.fk_soc = s.rowid AND l.fk_fournisseur = f.rowid"; - $sqlall .= " AND l.fk_soc_facture = r.rowid "; - $sqlall .= " AND l.fk_commercial = comm.rowid "; - $sqlall .= " AND date_format(l.date_commande,'%Y%m') = '".strftime("%Y%m", $date_gen)."'"; - /* - * - */ - - $sql = $sqlall; - - $sql .= " ORDER BY l.date_commande DESC"; - - $result = $db->query($sql); - - if ($result) - { - $num = $db->num_rows(); - - $worksheet->write(1, 0, "Code", $formatc); - $worksheet->write(1, 1, "Client", $formatc); - $worksheet->write(1, 2, "Numéro", $formatcc); - $worksheet->write(1, 3, "Date commande", $formatcc); - $worksheet->write(1, 4, "Statut actuel", $formatcc); - - while ($i < $num) - { - $obj = $db->fetch_object(); - - $j = $i + 3; - - $soc = new Societe($db); - $soc->fetch($obj->socid); - - $worksheet->write($j, 0, $obj->code_client, $format_left[$obj->statut]); - - $worksheet->write($j, 1, $obj->nom, $format_left[$obj->statut]); - - $worksheet->write_string($j, 2, "$obj->ligne", $format[$obj->statut]); - - $worksheet->write($j, 3, strftime("%d/%m/%y",$obj->date_commande), $format[$obj->statut]); - - $worksheet->write($j, 4, $ligne->statuts[$obj->statut], $format[$obj->statut]); - - $i++; - } - - $db->free(); - } - else - { - print $db->error() . ' ' . $sql; - } - - /* - * - * - */ - - $workbook->close(); - /* - * - */ - if ($date_gen == $date_now && strlen($email)) - { - MailFile($fname, $shortname, $email); - } - -} - - - -function MailFile($filename, $shortname, $to) -{ - $subject = "Recapitulatif mensuel des commandes"; - - $sendto = $to; - - $from = TELEPHONIE_LIGNE_COMMANDE_EMAIL_BCC; - - $message = "Bonjour,\n\nVeuillez trouver ci-joint le dernier récapitulatif des commandes.\n\n"; - $message .= "\n\nCordialement,\n"; - - $mailfile = new DolibarrMail($subject, - $sendto, - $from, - $message); - - $mailfile->PrepareFile(array($filename), - array("application/msexcel"), - array($shortname)); - - if ( $mailfile->sendfile() ) - { - return 0; - } -} diff --git a/htdocs/telephonie/script/retour-check.php b/htdocs/telephonie/script/retour-check.php deleted file mode 100644 index 64049347220..00000000000 --- a/htdocs/telephonie/script/retour-check.php +++ /dev/null @@ -1,145 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * Script d'import des retour - * - * Ce script permet de rechercher des lignes inconnues chez nous - * presentes dans les fichiers de retour - * - * - */ -$verbose = 1; -require ("../../master.inc.php"); - -require_once (DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/facturetel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/telephonie-tarif.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/communication.class.php"); -require_once (DOL_DOCUMENT_ROOT."/societe.class.php"); - -$dir = DOL_DATA_ROOT."/telephonie/ligne/commande/retour/"; -$dirdone = DOL_DATA_ROOT."/telephonie/ligne/commande/retour/traite/"; - -$dirback = DOL_DATA_ROOT."/telephonie/ligne/commande/retour/backup/"; - -if (! file_exists($dirback)) -{ - umask(0); - if (! @mkdir($dirback, 0755)) - { - dol_syslog("Erreur: creation '$dir'"); - } -} - - -$handle=opendir($dir); - -if ($verbose) dol_syslog("Lecture repertoire $dir"); - -while (($file = readdir($handle))!==false) -{ - if (is_file($dir.$file)) - { - if (is_readable($dir.$file)) - { - if ($verbose) dol_syslog("Lecture $file"); - - if (! file_exists($dirdone)) - { - umask(0); - if (! @mkdir($dirdone, 0755)) - { - dol_syslog("Erreur: creation '$dirdone'"); - } - } - - /* - * On teste le fichier - */ - check_file($db, $dir, $file); - } - else - { - dol_syslog("Erreur Lecture $file permissions insuffisante"); - } - } -} - -closedir($handle); - -/** - * - * - * - */ - -Function check_file($db,$dir,$file) -{ - $error = 0; - $line = 0; - $hf = fopen ($dir.$file, "r"); - - $ok = 0; - $nok = 0; - - while (!feof($hf)) - { - $cont = fgets($hf, 1024); - - $tabline = explode(";", $cont); - - if (substr($tabline, 0, 3) <> 'CLI') - { - if (sizeof($tabline) == 8) - { - $numero = $tabline[0]; - $mode = $tabline[1]; - $situation = $tabline[2]; - $date_mise_service = $tabline[3]; - $date_resiliation = $tabline[4]; - $motif_resiliation = $tabline[5]; - $commentaire = $tabline[6]; - $fichier = $file; - - $ligne = new LigneTel($db); - if ($ligne->fetch($numero) == 1) - { - print "Ligne : $numero OK\n"; - $ok++; - } - else - { - print "Ligne : $numero ERREUR\n"; - $nok++; - } - } - } - $line++; - } - - fclose($hf); - - print "ok : $ok\n"; - print "erreurs : $nok\n"; - print "lignes : $line\n"; - return $error; - - -} diff --git a/htdocs/telephonie/script/retour-traitement.php b/htdocs/telephonie/script/retour-traitement.php deleted file mode 100644 index b1b3fef34dc..00000000000 --- a/htdocs/telephonie/script/retour-traitement.php +++ /dev/null @@ -1,240 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * Script de traitement des retour de commande - */ - -require ("../../master.inc.php"); - -require_once (DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/facturetel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/telephonie-tarif.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/communication.class.php"); -require_once (DOL_DOCUMENT_ROOT."/societe.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/dolibarrmail.class.php"); - -if ($verbose) dol_syslog("retour-traitement"); - -$user = new User($db, 1); - -$error = 0; - -$sql = "SELECT cli,mode,situation"; -$sql .= " , ".$db->pdate(date_mise_service); -$sql .= " , ".$db->pdate(date_resiliation).",motif_resiliation,commentaire,rowid "; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_commande_retour "; -$sql .= " WHERE traite = 0"; - -if ($db->query($sql)) -{ - $i = 0; - $num = $db->num_rows(); - - while ($i < $num) - { - $row[$i] = $db->fetch_row(); - - $i++; - } -} - -$n = sizeof($row); - -if ($verbose) dol_syslog($n . " lignes à traiter"); - -for ($i = 0 ; $i < $n ; $i++) -{ - $numero = $row[$i][0]; - $mode = $row[$i][1]; - $situation = $row[$i][2]; - $date_mise_service = $row[$i][3]; - $date_resiliation = $row[$i][4]; - $motif_resiliation = $row[$i][5]; - $commentaire = $row[$i][6]; - $rowid = $row[$i][7]; - - $ligne = new LigneTel($db); - - if ($ligne->fetch($numero) == 1) - { - /* - * Activation de la ligne - */ - - if ($mode == 'PRESELECTION' && - $situation == 'CONFIRME' && - $commentaire == 'CONFIRME PAR FT') - { - - if ($ligne->statut == 2) - { - $statut = 3; - $datea = $db->idate($date_mise_service); - - if ($db->query("BEGIN")) - { - $error = 0; - - if ($ligne->set_statut($user, $statut, $datea,'',1) <> 0) - { - $error++; - } - - if (!$error) - { - /* Tag la ligne comme traitée */ - - $sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_commande_retour "; - $sql .= " SET traite = 1, date_traitement=now() "; - $sql .= " WHERE rowid =".$rowid; - - if (! $db->query($sql)) - { - dol_syslog("Erreur de traitement de ligne $numero"); - $error++; - } - } - - if ($error == 0) - { - $db->query("COMMIT"); - dol_syslog("COMMIT"); - } - else - { - $db->query("ROLLBACK"); - dol_syslog("ROLLBACK"); - } - - } - } - else - { - dol_syslog("Ligne $numero déjà active"); - } - } - /* - * Ligne Résiliée - */ - if ($mode == 'PRESELECTION' && - $situation == 'CONFIRME' && - $commentaire == 'CPS DESACTIVE PAR FT' && - $date_resiliation > 0) - { - - if ($ligne->statut == 3) - { - $statut = 6; - $datea = $db->idate($date_resiliation); - - if ($db->query("BEGIN")) - { - $error = 0; - - if ($ligne->set_statut($user, $statut, $datea,'',1) <> 0) - { - $error++; - } - - if (!$error) - { - /* Tag la ligne comme traitée */ - - $sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_commande_retour "; - $sql .= " SET traite = 1, date_traitement=now() "; - $sql .= " WHERE rowid =".$rowid; - - if (! $db->query($sql)) - { - dol_syslog("Erreur de traitement de ligne $numero"); - $error++; - } - } - - if ($error == 0) - { - $db->query("COMMIT"); - dol_syslog("COMMIT"); - } - else - { - $db->query("ROLLBACK"); - dol_syslog("ROLLBACK"); - } - } - } - else - { - dol_syslog("Ligne $numero déjà active"); - } - } - - /* - * - */ - /* - * Prefixe non géré - */ - - if ($mode == 'PREFIXE' && - $situation == 'CONFIRME') - { - if ($db->query("BEGIN")) - { - $error = 0; - - if (!$error) - { - /* Tag la ligne comme traitée */ - - $sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_commande_retour "; - $sql .= " SET traite = 1, date_traitement=now() "; - $sql .= " WHERE rowid =".$rowid; - - if (! $db->query($sql)) - { - dol_syslog("Erreur de traitement de ligne $numero"); - $error++; - } - } - - if ($error == 0) - { - $db->query("COMMIT"); - dol_syslog("COMMIT"); - } - else - { - $db->query("ROLLBACK"); - dol_syslog("ROLLBACK"); - } - - } - } - /* - * Fin mode PREFIXE - * - */ - } - else - { - print "Ligne inconnue : $numero\n"; - } -} diff --git a/htdocs/telephonie/script/retour.php b/htdocs/telephonie/script/retour.php deleted file mode 100644 index 6933f79dee9..00000000000 --- a/htdocs/telephonie/script/retour.php +++ /dev/null @@ -1,155 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * Script d'import des retour - */ - -require ("../../master.inc.php"); - -$dir = DOL_DATA_ROOT."/telephonie/ligne/commande/retour/"; -$dirdone = DOL_DATA_ROOT."/telephonie/ligne/commande/retour/traite/"; - -$dirback = DOL_DATA_ROOT."/telephonie/ligne/commande/retour/backup/"; - -if (! file_exists($dirback)) -{ - umask(0); - if (! @mkdir($dirback, 0755)) - { - dol_syslog("Erreur: creation '$dir'", LOG_ERR); - } -} - - -$handle=opendir($dir); - -if ($verbose) dol_syslog("Lecture repertoire $dir"); - -while (($file = readdir($handle))!==false) -{ - if (is_file($dir.$file)) - { - - if (is_readable($dir.$file)) - { - - if ($verbose) dol_syslog("Lecture $file"); - - if (! file_exists($dirdone)) - { - umask(0); - if (! @mkdir($dirdone, 0755)) - { - dol_syslog("Erreur: creation '$dirdone'", LOG_ERR); - } - } - - /* - * On verifie que le fichier n'a pas déjà été traité - */ - if (! file_exists($dirdone.$file)) - { - if ( import_file($db, $dir, $file) == 0) - { - rename($dir.$file, $dirdone.$file); - } - } - else - { - dol_syslog("Le fichier $file a déjà été traité"); - } - } - else - { - dol_syslog("Erreur Lecture $file permissions insuffisante"); - } - } -} - -closedir($handle); - -/** - * - * - * - */ - -Function import_file($db,$dir,$file) -{ - $error = 0; - $line = 0; - $hf = fopen ($dir.$file, "r"); - - if ($db->query("BEGIN")) - { - - while (!feof($hf)) - { - $cont = fgets($hf, 1024); - - $tabline = explode(";", $cont); - - if (substr($tabline, 0, 3) <> 'CLI') - { - if (sizeof($tabline) == 8) - { - $numero = $tabline[0]; - $mode = $tabline[1]; - $situation = $tabline[2]; - $date_mise_service = $tabline[3]; - $date_resiliation = $tabline[4]; - $motif_resiliation = $tabline[5]; - $commentaire = $tabline[6]; - $fichier = $file; - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_commande_retour "; - - $sql .= " (cli,mode,situation,date_mise_service,date_resiliation,motif_resiliation,commentaire,fichier,fk_fournisseur) "; - $sql .= " VALUES ("; - $sql .= "'$numero','$mode','$situation','$date_mise_service','$date_resiliation','$motif_resiliation','$commentaire','$fichier',1)"; - - if (! $db->query($sql)) - { - dol_syslog("Erreur de traitement de ligne"); - dol_syslog($db->error()); - $error++; - } - } - } - $line++; - } - - if ($error == 0) - { - $db->query("COMMIT"); - dol_syslog("COMMIT"); - } - else - { - $db->query("ROLLBACK"); - dol_syslog("ROLLBACK"); - } - - } - - fclose($hf); - - return $error; -} diff --git a/htdocs/telephonie/script/simulation.php b/htdocs/telephonie/script/simulation.php deleted file mode 100644 index c25d545568f..00000000000 --- a/htdocs/telephonie/script/simulation.php +++ /dev/null @@ -1,134 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * - */ - -require ("../../master.inc.php"); - -$error = 0; - -$datetime = time(); - -$date = strftime("%d %h %Y %Hh %Mm %S",$datetime); - - -$sql = " INSERT INTO ".MAIN_DB_PREFIX."telephonie_simul"; -$sql .= " (description) VALUES ("; -$sql .= " 'Simulation du $date')"; - -if ( $db->query($sql) ) -{ - $simid = $db->last_insert_id(MAIN_DB_PREFIX."telephonie_simul"); -} -print "Simulation : $simid\n"; -/******************************************************************************* - * - * - */ -$sql = "SELECT ligne, date, numero, duree "; -$sql .= " ,fourn_montant"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; - -if ( $db->query($sql) ) -{ - $row = array(); - $nums = $db->num_rows(); - $i = 0; - - while($i < $nums) - { - $row[$i] = $db->fetch_row(); - - print "."; - $i++; - } - $db->free(); -} -print "\n"; - -for ($i = 0 ; $i < sizeof($row) ; $i++) -{ - $numero = $row[$i][2]; - $duree = $row[$i][3]; - $cout_achat = $row[$i][4]; - - if (substr($numero,0,2) == '00') /* International */ - { - $cout_vente = $cout_achat * 2; - } - elseif (substr($numero,0,2) == '06') /* Telephones Mobiles */ - { - $cout_vente = ereg_replace(",",".",$cout_achat + 0.04); - } - else - { - $cout_vente = ereg_replace(",",".",($duree * 0.01)/60 + 0.09); - } - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_simul_comm"; - $sql .= "(fk_simulation, ligne, date, numero, duree, cout_achat, cout_vente)"; - $sql .=" VALUES ('$simid','".$row[$i][0]."'"; - $sql .=" ,'".$row[$i][1]."'"; - $sql .=" ,'".$row[$i][2]."'"; - $sql .=" ,'".$row[$i][3]."'"; - $sql .=" ,'".$row[$i][4]."'"; - $sql .=" ,'".$cout_vente."'"; - $sql .= " )"; - - if (! $db->query($sql) ) - { - print "Error"; - exit ; - } -} - -/* - * - * - */ - -$sql = "SELECT fk_simulation, sum(cout_achat), sum(cout_vente),count(*)"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_simul_comm"; -$sql .= " GROUP BY fk_simulation"; -if ( $db->query($sql) ) -{ - $nums = $db->num_rows(); - $i = 0; - - while($i < $nums) - { - $row = $db->fetch_row(); - - print $row[0]." ".round($row[1],2); - print "\t".round($row[2],2); - print "\t".round(($row[2]-$row[1])/$row[1]*100,2)." %"; - print "\t".round($row[3],2); - print "\t".round($row[1]/$row[3],2); - print "\t".round($row[2]/$row[3],2)."\n"; - - $i++; - } - $db->free(); -} -print "\n"; - - -?> diff --git a/htdocs/telephonie/script/tarifs-commerciaux-grille.php b/htdocs/telephonie/script/tarifs-commerciaux-grille.php deleted file mode 100644 index c3ca13d8f3d..00000000000 --- a/htdocs/telephonie/script/tarifs-commerciaux-grille.php +++ /dev/null @@ -1,59 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * Affecte aux contrats la grille de tarif spécifiaque a un - * commercial - * - */ -require ("../../master.inc.php"); -$error = 0; - -/* - * Lecture des lignes - * - */ -$comms = array(); - -$sql = "SELECT fk_grille, fk_commercial"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_tarif_grille_commerciaux"; - -if ($db->query($sql)) -{ - while($row = $db->fetch_row($resql)) - { - $comms[$row[0]] = $row[1]; - } - $db->free($resql); -} - -foreach ($comms as $key => $value) -{ - $sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_contrat"; - $sql .= " SET grille_tarif = '".$key."'"; - $sql .= " WHERE fk_commercial_sign = '".$value."';"; - - $resql = $db->query($sql); - - if (!$resql) - { - print "Erreur"; - } -} -?> diff --git a/htdocs/telephonie/script/tools/correction-tarifs-clients.php b/htdocs/telephonie/script/tools/correction-tarifs-clients.php deleted file mode 100644 index 31039ea3191..00000000000 --- a/htdocs/telephonie/script/tools/correction-tarifs-clients.php +++ /dev/null @@ -1,168 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * - * Ce script se veut plus un squelette pour effectuer des opérations sur la base - * qu'un réel scrip de production. - * - * Recalcul le montant d'une facture lors d'une erreur de tarif - * - */ - -require ("../../../master.inc.php"); - -require_once (DOL_DOCUMENT_ROOT."/societe.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/facturetel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/telephonie-tarif.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/communication.class.php"); - -$tarifs = array(1290,1291,1292); -$corrections = array(); - -$corrections[1290] = array(); -$corrections[1291] = array(); -$corrections[1292] = array(); - -$clients = array(); - -$sql = "SELECT fk_client FROM ".MAIN_DB_PREFIX."telephonie_tarif_client"; -$sql .= " WHERE fk_tarif = 1289"; - -$resql = $db->query($sql); - -if ( $resql ) -{ - $num = $db->num_rows($resql); - $i = 0; - - print "$num clients trouvés\n"; - - while ($i < $num) - { - $row = $db->fetch_row($resql); - - array_push($clients, $row[0]); - $i++; - } - $db->free($resql); -} -else -{ - $error++; -} - - -foreach ($tarifs as $tarif) -{ - foreach ($clients as $client) - { - $sql = "SELECT fk_client FROM ".MAIN_DB_PREFIX."telephonie_tarif_client"; - $sql .= " WHERE fk_client = ".$client; - $sql .= " AND fk_tarif = ".$tarif; - - $resql = $db->query($sql); - - if ( $resql ) - { - $num = $db->num_rows($resql); - - if ($num == 0) - { - array_push($corrections[$tarif], $client); - - correct_tarif($db, $client, $tarif); - - } - - $db->free($resql); - } - else - { - $error++; - } - } -} - - -foreach ($tarifs as $tarif) -{ - print "Tarif $tarif : ".sizeof($corrections[$tarif])."\n"; -} - -function correct_tarif($db, $client, $tarif) -{ - $error = 0; - - $sql = "SELECT temporel, fixe FROM ".MAIN_DB_PREFIX."telephonie_tarif_client"; - $sql .= " WHERE fk_tarif = 1289"; - $sql .= " AND fk_client = $client"; - - $resql = $db->query($sql); - - if ($resql) - { - $row = $db->fetch_row($resql); - - $temporel = $row[0]; - $fixe = $row[1]; - } - else - { - print $db->error(); - $error++; - } - - $db->begin(); - - $sql = "REPLACE INTO ".MAIN_DB_PREFIX."telephonie_tarif_client"; - $sql .= " (fk_tarif, fk_client, temporel, fixe, fk_user) VALUES "; - $sql .= " (".$tarif.",".$client.",'".$temporel."','".$fixe."',1)"; - - if (! $db->query($sql) ) - { - $error++; - print $db->error(); - } - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_tarif_client_log"; - $sql .= " (fk_tarif, fk_client, temporel, fixe, fk_user, datec) VALUES "; - $sql .= " (".$tarif.",".$client.",'".$temporel."','".$fixe."',1,now())"; - - if (! $db->query($sql) ) - { - $error++; - print $db->error(); - } - - if ( $error == 0 ) - { - $db->commit(); - } - else - { - $db->rollback(); - print $db->error(); - } -} - - -$db->close(); -?> diff --git a/htdocs/telephonie/script/tools/export-adsl-actives.php b/htdocs/telephonie/script/tools/export-adsl-actives.php deleted file mode 100644 index 73114b25a19..00000000000 --- a/htdocs/telephonie/script/tools/export-adsl-actives.php +++ /dev/null @@ -1,81 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * Vérifie les lignes ayant le statut d'attente - * - */ -require ("../../../master.inc.php"); -require_once (DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_workbook.inc.php"); -require_once (DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_worksheet.inc.php"); -/* - * - */ - -$sql = "SELECT la.numero_ligne, s.nom as nom, la.prix, t.intitule"; - -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_adsl_ligne as la"; -$sql .= " , ".MAIN_DB_PREFIX."societe as s"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_adsl_type as t"; -$sql .= " WHERE la.fk_client_facture = s.rowid"; -$sql .= " AND t.rowid = la.fk_type"; - - - -$resql = $db->query($sql); -if ( $resql ) -{ - $fname = "/tmp/export-adsl-active.xls"; - - $workbook = &new writeexcel_workbook($fname); - - $page = &$workbook->addworksheet("Lignes ADSL"); - - $page->write(0, 0, "Ligne", $format_titre_agence1); - $page->write(0, 1, "Client", $format_titre); - $page->write(0, 2, "Prix", $format_titre); - $page->write(0, 3, "Type", $format_titre); - - $fnb =& $workbook->addformat(); - $fnb->set_align('vcenter'); - $fnb->set_align('left'); - - $i = 1; - while ($row = $db->fetch_row($resql)) - { - $xx = $i + 1; - - $page->write_string($xx, 0, $row[0], $fnb); - $page->write_string($xx, 1, $row[1], $fnb); - $page->write_number($xx, 2, $row[2], $fnb); - $page->write_string($xx, 3, $row[3], $fnb); - - $i++; - } - - $workbook->close(); -} - -else -{ - print $db->error(); -} - -$db->close(); -?> diff --git a/htdocs/telephonie/script/tools/export-comms-client52.php b/htdocs/telephonie/script/tools/export-comms-client52.php deleted file mode 100644 index 38ff0267ee5..00000000000 --- a/htdocs/telephonie/script/tools/export-comms-client52.php +++ /dev/null @@ -1,88 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * Export les comms du client 52 pour analyse Birts - * - */ -require ("../../../master.inc.php"); -require_once (DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_workbook.inc.php"); -require_once (DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_worksheet.inc.php"); -/* - * - */ -$sql = "SELECT l.ligne,s.nom,fc.datef, f.cout_vente"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture as f"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_contrat as c"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; -$sql .= " , ".MAIN_DB_PREFIX."societe as s"; -$sql .= " , ".MAIN_DB_PREFIX."facture as fc"; - -$sql .= " WHERE date_format(f.date,'%Y') = '2006'"; -$sql .= " AND l.fk_contrat = c.rowid"; -$sql .= " AND c.fk_client_comm = 52"; -$sql .= " AND f.ligne = l.ligne"; -$sql .= " AND l.fk_soc_facture =s.rowid"; -$sql .= " AND fc.rowid = f.fk_facture"; -$sql .= " ORDER BY f.date ASC, f.fk_ligne ASC"; - -$resql = $db->query($sql); -if ( $resql ) -{ - $fname = "/var/www/export-comms-52.xls"; - - $workbook = &new writeexcel_workbook($fname); - - $page = &$workbook->addworksheet("2006"); - - - $page->write(0, 0, "Ligne", $format_titre_agence1); - $page->write(0, 1, "Client", $format_titre); - $page->write(0, 2, "Cout", $format_titre); - $page->write(0, 3, "Date", $format_titre); - - $fnb =& $workbook->addformat(); - $fnb->set_align('vcenter'); - $fnb->set_align('left'); - - $i = 1; - while ($row = $db->fetch_row($resql)) - { - //print $row[0]. " ".$row[1]." ".$row[3]." ".$row[2]."\n"; - - $xx = $i + 1; - - $page->write_string($xx, 0, $row[0], $fnb); - $page->write_string($xx, 1, $row[1], $fnb); - $page->write_number($xx, 2, $row[3], $fnb); - $page->write_string($xx, 3, $row[2], $fnb); - - $i++; - } - - $workbook->close(); -} - -else -{ - print $db->error(); -} - -$db->close(); -?> diff --git a/htdocs/telephonie/script/tools/export-communications-temporaires.php b/htdocs/telephonie/script/tools/export-communications-temporaires.php deleted file mode 100644 index c4ef86fb72e..00000000000 --- a/htdocs/telephonie/script/tools/export-communications-temporaires.php +++ /dev/null @@ -1,84 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * Export des communications dans import-cdr - * - */ -require ("../../../master.inc.php"); -require_once (DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_workbook.inc.php"); -require_once (DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_worksheet.inc.php"); -/* - * - */ -$sql = "SELECT ligne,date,heure,num,dest,dureetext,montant"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_import_cdr"; -$sql .= " WHERE ligne ='".$argv[1]."'"; -$sql .= " ORDER BY date ASC, heure ASC"; - -$resql = $db->query($sql); -if ( $resql ) -{ - $fname = "/tmp/export-comm-".$argv[1].".xls"; - - $workbook = &new writeexcel_workbook($fname); - $page = &$workbook->addworksheet("Communications"); - - $page->set_column(0,0,12); - $page->set_column(1,1,10); - $page->set_column(3,3,12); - $page->set_column(4,4,40); - - $page->write(0, 0, "Ligne", $format_titre_agence1); - $page->write(0, 1, "Date", $format_titre); - $page->write(0, 2, "Heure", $format_titre); - $page->write(0, 3, "Numéro", $format_titre); - $page->write(0, 4, "Destination", $format_titre); - $page->write(0, 5, "Durée", $format_titre); - $page->write(0, 6, "Coût", $format_titre); - - $fnb =& $workbook->addformat(); - $fnb->set_align('vcenter'); - $fnb->set_align('left'); - - $i = 1; - while ($row = $db->fetch_row($resql)) - { - $page->write_string($i, 0, $row[0], $fnb); - $page->write($i, 1, $row[1], $fnb); - $page->write_string($i, 2, $row[2], $fnb); - $page->write_string($i, 3, $row[3], $fnb); - $page->write_string($i, 4, $row[4], $fnb); - $page->write_string($i, 5, $row[5], $fnb); - $page->write_number($i, 6, $row[6], $fnb); - - $i++; - } - - $workbook->close(); - print ($i -1) ." communications\n"; - print "Write $fname\n"; -} -else -{ - print $db->error(); -} - -$db->close(); -?> diff --git a/htdocs/telephonie/script/tools/export-recap-client52.php b/htdocs/telephonie/script/tools/export-recap-client52.php deleted file mode 100644 index e64b2649fca..00000000000 --- a/htdocs/telephonie/script/tools/export-recap-client52.php +++ /dev/null @@ -1,91 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * Vérifie les lignes ayant le statut d'attente - * - */ -require ("../../../master.inc.php"); -require_once (DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_workbook.inc.php"); -require_once (DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_worksheet.inc.php"); -/* - * - */ -$sql = "SELECT l.ligne,s.nom,fc.datef, f.cout_vente"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture as f"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_contrat as c"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; -$sql .= " , ".MAIN_DB_PREFIX."societe as s"; -$sql .= " , ".MAIN_DB_PREFIX."facture as fc"; - -$sql .= " WHERE date_format(f.date,'%Y') = '2005'"; -$sql .= " AND l.fk_contrat = c.rowid"; -$sql .= " AND c.fk_client_comm = 52"; -$sql .= " AND f.ligne = l.ligne"; -$sql .= " AND l.fk_soc_facture =s.rowid"; -$sql .= " AND fc.rowid = f.fk_facture"; -$sql .= " ORDER BY f.date ASC, f.fk_ligne ASC"; - -$resql = $db->query($sql); -if ( $resql ) -{ - $fname = "/tmp/export-52.xls"; - - $workbook = &new writeexcel_workbook($fname); - - $page = &$workbook->addworksheet("2005"); - - - $page->write(0, 0, "Ligne", $format_titre_agence1); - $page->write(0, 1, "Client", $format_titre); - $page->write(0, 2, "Cout", $format_titre); - $page->write(0, 3, "Date", $format_titre); - - $fnb =& $workbook->addformat(); - $fnb->set_align('vcenter'); - $fnb->set_align('left'); - - $i = 1; - while ($row = $db->fetch_row($resql)) - { - print $row[0]. " ".$row[1]." ".$row[3]." ".$row[2]."\n"; - - $xx = $i + 1; - - $page->write_string($xx, 0, $row[0], $fnb); - $page->write_string($xx, 1, $row[1], $fnb); - $page->write_number($xx, 2, $row[3], $fnb); - $page->write_string($xx, 3, $row[2], $fnb); - - $i++; - } - - $workbook->close(); - -} - -else -{ - print $db->error(); -} - - - -$db->close(); -?> diff --git a/htdocs/telephonie/script/tools/graph-conso-jour.php b/htdocs/telephonie/script/tools/graph-conso-jour.php deleted file mode 100644 index e8c2fbba3b6..00000000000 --- a/htdocs/telephonie/script/tools/graph-conso-jour.php +++ /dev/null @@ -1,109 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * Generation de graphiques - * - */ -require ("../../../master.inc.php"); - -$verbose = 0; - - -require_once (DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/facturetel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/telephonie-tarif.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/communication.class.php"); - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/bar.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/baraccumul.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/camenbert.class.php"); - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/ca.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/gain.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/heureappel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/joursemaine.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/camoyen.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/appelsdureemoyenne.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/comm.nbmensuel.class.php"); - -$error = 0; - -$img_root = DOL_DATA_ROOT."/graph/telephonie"; - - -$colors = array(); -$colors[10] = 'yellow'; -$colors[11] = 'red'; -$months = array(10,11); - -$data = array(); -$moydata = array(); - -print "$month\n"; -$sql = "SELECT date_format(date,'%d'), sum(duree)"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; -$sql .= " WHERE date >= '2005-10-01'"; -$sql .= " GROUP BY date_format(date,'%Y%m%d') ASC ;"; - -$resql = $db->query($sql); -$total = 0; -if ($resql) -{ - $num = $db->num_rows($resql); - $i = 0; - - while ($row = $db->fetch_row($resql)) - { - $data[$i] = ($row[1]/60000); - $total = $total + $data[$i]; - $labels[$i] = $row[0]; - $moydata[$i] = $total / ($i+1); - $i++; - } -} -else -{ - print $db->error(); -} - -$file = "/tmp/conso-jour.png"; - -$graph = new Graph(800, 400,"auto"); -$graph->SetScale("textlin"); -$graph->yaxis->scale->SetGrace(20); -$graph->SetFrame(true); -$graph->img->SetMargin(50,20,20,35); -$graph->xaxis->scale->SetGrace(20); - -$graph->title->Set("Nb minutes en kilos"); -$graph->xaxis->SetTickLabels($labels); - -$b2plot = new LinePlot($data); -$b2plot->SetWeight(2); -$b2plot->SetColor("red"); -$graph->Add($b2plot); - -$lineplot = new LinePlot($moydata); -$lineplot->SetColor("blue"); -$graph->Add($lineplot); - -$graph->img->SetImgFormat("png"); -$graph->Stroke($file); -?> diff --git a/htdocs/telephonie/script/tools/index.php b/htdocs/telephonie/script/tools/index.php deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/telephonie/script/tools/permissions.php b/htdocs/telephonie/script/tools/permissions.php deleted file mode 100644 index b4e9187a170..00000000000 --- a/htdocs/telephonie/script/tools/permissions.php +++ /dev/null @@ -1,158 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * Positionne les permissions sur les societes - */ - -/**************************************************************** - * ATTENTION ce script est un script personnel à NE PAS UTILISER - * sur vos bases sans modification, il est distribué à titre - * d'exemple uniquement ! - ****************************************************************/ -require ("../../../master.inc.php"); - -$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe"; -$resql = $db->query($sql); - -if ( $resql ) -{ - while ($row = $db->fetch_row($resql)) - { - - $sqlu = "REPLACE INTO llx_societe_perms"; - $sqlu .= " (fk_soc, fk_user, pread, pwrite, pperms) "; - $sqlu .= " VALUES (".$row[0].", 1,1,1,1)"; - $resqlu = $db->query($sqlu); - - $sqlu = "REPLACE INTO llx_societe_perms"; - $sqlu .= " (fk_soc, fk_user, pread, pwrite, pperms) "; - $sqlu .= " VALUES (".$row[0].",2,1,0,0)"; - $resqlu = $db->query($sqlu); - - $sqlu = "REPLACE INTO llx_societe_perms"; - $sqlu .= " (fk_soc, fk_user, pread, pwrite, pperms) "; - $sqlu .= " VALUES (".$row[0].", 5,1,1,1)"; - $resqlu = $db->query($sqlu); - - $sqlu = "REPLACE INTO llx_societe_perms"; - $sqlu .= " (fk_soc, fk_user, pread, pwrite, pperms) "; - $sqlu .= " VALUES (".$row[0].", 9,1,1,1)"; - $resqlu = $db->query($sqlu); - - $sqlu = "REPLACE INTO llx_societe_perms"; - $sqlu .= " (fk_soc, fk_user, pread, pwrite, pperms) "; - $sqlu .= " VALUES (".$row[0].",16,1,1,1)"; - $resqlu = $db->query($sqlu); - - $sqlu = "REPLACE INTO llx_societe_perms"; - $sqlu .= " (fk_soc, fk_user, pread, pwrite, pperms) "; - $sqlu .= " VALUES (".$row[0].",18,1,0,0)"; - $resqlu = $db->query($sqlu); - - $sqlu = "REPLACE INTO llx_societe_perms"; - $sqlu .= " (fk_soc, fk_user, pread, pwrite, pperms) "; - $sqlu .= " VALUES (".$row[0].",29,1,0,0)"; - $resqlu = $db->query($sqlu); - - $sqlu = "REPLACE INTO llx_societe_perms"; - $sqlu .= " (fk_soc, fk_user, pread, pwrite, pperms) "; - $sqlu .= " VALUES (".$row[0].",10,1,1,1)"; - $resqlu = $db->query($sqlu); - } - $db->free($resql); -} -else -{ - $error++; -} - -/* Speciaux */ -$sql = "SELECT fk_client_comm, fk_commercial_sign, fk_commercial_suiv FROM ".MAIN_DB_PREFIX."telephonie_contrat"; -$resql = $db->query($sql); - -if ( $resql ) -{ - while ($row = $db->fetch_row($resql)) - { - $sqlu = "INSERT INTO llx_societe_perms"; - $sqlu .= " (fk_soc, fk_user, pread, pwrite, pperms) "; - $sqlu .= " VALUES (".$row[0].",".$row[1].",1,0,0)"; - $resqlu = $db->query($sqlu); - - $sqlu = "INSERT INTO llx_societe_perms"; - $sqlu .= " (fk_soc, fk_user, pread, pwrite, pperms) "; - $sqlu .= " VALUES (".$row[0].",".$row[2].",1,0,0)"; - $resqlu = $db->query($sqlu); - } - $db->free($resql); -} -else -{ - $error++; -} - -/* Speciaux */ -$sql = "SELECT fk_client_comm, fk_commercial_sign "; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat "; -$sql .= ", llx_telephonie_distributeur_commerciaux as c"; -$sql .= " WHERE fk_commercial_sign = c.fk_user"; -$resql = $db->query($sql); - -if ( $resql ) -{ - while ($row = $db->fetch_row($resql)) - { - $sqlu = "INSERT INTO llx_societe_perms"; - $sqlu .= " (fk_soc, fk_user, pread, pwrite, pperms) "; - $sqlu .= " VALUES (".$row[0].",18,1,1,1)"; - $resqlu = $db->query($sqlu); - } - $db->free($resql); -} -else -{ - print $db->error(); -} - -/* Speciaux */ -$sql = "SELECT fk_client_comm, fk_commercial_suiv "; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat "; -$sql .= ", llx_telephonie_distributeur_commerciaux as c"; -$sql .= " WHERE fk_commercial_suiv = c.fk_user"; -$resql = $db->query($sql); - -if ( $resql ) -{ - while ($row = $db->fetch_row($resql)) - { - $sqlu = "INSERT INTO llx_societe_perms"; - $sqlu .= " (fk_soc, fk_user, pread, pwrite, pperms) "; - $sqlu .= " VALUES (".$row[0].",18,1,1,1)"; - $resqlu = $db->query($sqlu); - } - $db->free($resql); -} -else -{ - print $db->error(); -} - -$db->close(); -?> diff --git a/htdocs/telephonie/script/tools/recalcul-facture.php b/htdocs/telephonie/script/tools/recalcul-facture.php deleted file mode 100644 index 8802aa3ede9..00000000000 --- a/htdocs/telephonie/script/tools/recalcul-facture.php +++ /dev/null @@ -1,164 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * - * Ce script se veut plus un squelette pour effectuer des opérations sur la base - * qu'un réel scrip de production. - * - * Recalcul le montant d'une facture lors d'une erreur de tarif - * - */ - -require ("../../../master.inc.php"); - -require_once (DOL_DOCUMENT_ROOT."/societe.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/facturetel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/telephonie-tarif.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/communication.class.php"); - - -$lines = array ('0297754500','0297740033','0297753052','0297754791','0297754790','0297754767','0297754766','0297753788'); - -$facture = 1687; - -$factels = array(); - -$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."telephonie_facture"; -$sql .= " WHERE fk_facture =".$facture; - -$resql = $db->query($sql); - -if ( $resql ) -{ - $num = $db->num_rows($resql); - $i = 0; - - $row = $db->fetch_row($resql); - print "Factures téléphoniques : $row[0]"; - array_push($factels, $row[0]); - $i++; - - while ($i < $num) - { - $row = $db->fetch_row($resql); - - print ", $row[0]"; - array_push($factels, $row[0]); - $i++; - } - $db->free($resql); -} -else -{ - $error++; -} -print "\n"; - -$total = 0; - -foreach ($factels as $factel) -{ - - $sql = "SELECT sum(cout_vente) FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; - $sql .= " WHERE fk_telephonie_facture =".$factel; - - $resql = $db->query($sql); - - if ( $resql ) - { - $row = $db->fetch_row($resql); - $total += $row[0]; - print "Facture $factel - $row[0]\n"; - $db->free($resql); - } - else - { - $error++; - } -} - -print "Total : $total\n"; - -// Analyse - -reset($factels); -foreach ($factels as $factel) -{ - - $sql = "SELECT distinct(dest) FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; - $sql .= " WHERE fk_telephonie_facture =".$factel; - $sql .= " AND tarif_vente_temp = 0.18"; - - $resql = $db->query($sql); - - if ( $resql ) - { - $row = $db->fetch_row($resql); - print "Facture $factel - $row[0]\n"; - $db->free($resql); - } - else - { - $error++; - } -} - -// - -$totale = 0; -$totald = 0; -reset($factels); -foreach ($factels as $factel) -{ - - $sql = "SELECT count(*), sum(cout_vente), sum(duree) FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; - $sql .= " WHERE fk_telephonie_facture =".$factel; - $sql .= " AND tarif_vente_temp = 0.18"; - - $resql = $db->query($sql); - - if ( $resql ) - { - $row = $db->fetch_row($resql); - $totale += $row[1]; - $totald += $row[2]; - print "Facture $factel - $row[0] - $row[1] - $row[2]\n"; - $db->free($resql); - } - else - { - $error++; - } -} -print "Total : $totale duree $totald\n"; - -$coutreel = $totald * 0.015 / 60; - -print "Cout reel à 0.015 : $coutreel\n"; - -$reel = $total - $totale + $coutreel; - -print "Nouvelle facture = $reel\n"; - -$db->close(); - - -?> diff --git a/htdocs/telephonie/script/tools/search-line-reject-with-traffic.php b/htdocs/telephonie/script/tools/search-line-reject-with-traffic.php deleted file mode 100644 index 375620c9b39..00000000000 --- a/htdocs/telephonie/script/tools/search-line-reject-with-traffic.php +++ /dev/null @@ -1,139 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * Recherche des lignes rejetées avec traffic - * - */ -require ("../../../master.inc.php"); -/* - * - */ -$datetime = time(); -$datemax = $datetime - (86400 * 90); - -$sql = "SELECT ligne"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne"; -$sql .= " WHERE statut = 7"; - -$re2sql = $db->query($sql) ; - -if ( $re2sql ) -{ - $nu2m = $db->num_rows($re2sql); - print "$nu2m lignes\n"; - $j = 0; - while ($j < $nu2m) - { - $row = $db->fetch_row($re2sql); - - $sqlc = "SELECT count(*)"; - $sqlc .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; - $sqlc .= " WHERE ligne = '".$row[0]."'"; - - $resqlc = $db->query($sqlc) ; - if ( $resqlc ) - { - $rowc = $db->fetch_row($resqlc); - - if ($rowc[0] > 0) - { - $sqlm = "SELECT unix_timestamp(max(date)) as md"; - $sqlm .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; - $sqlm .= " WHERE ligne = '".$row[0]."'"; - $sqlm .= " AND date > '2006-01-01';"; - - $resqlm = $db->query($sqlm) ; - if ( $resqlm ) - { - $rowm = $db->fetch_row($resqlm); - - print $row[0]." ".strftime("%d/%m/%Y",$rowm[0])." ".$rowc[0]."\n"; - - } - } - } - $j++; - } -} -else -{ - print $db->error(); -} - -/* - * Lignes en commandes - * - * - * - */ -print "Lignes en commande\n"; - -$sql = "SELECT ligne"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne"; -$sql .= " WHERE statut = 2"; - -$re2sql = $db->query($sql) ; - -if ( $re2sql ) -{ - $nu2m = $db->num_rows($re2sql); - print "$nu2m lignes\n"; - $j = 0; - while ($j < $nu2m) - { - $row = $db->fetch_row($re2sql); - - $sqlc = "SELECT count(*)"; - $sqlc .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; - $sqlc .= " WHERE ligne = '".$row[0]."'"; - - $resqlc = $db->query($sqlc) ; - if ( $resqlc ) - { - $rowc = $db->fetch_row($resqlc); - - if ($rowc[0] > 0) - { - $sqlm = "SELECT unix_timestamp(max(date)) as md"; - $sqlm .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; - $sqlm .= " WHERE ligne = '".$row[0]."'"; - $sqlm .= " AND date > '2006-01-01';"; - - $resqlm = $db->query($sqlm) ; - if ( $resqlm ) - { - $rowm = $db->fetch_row($resqlm); - - print $row[0]." ".strftime("%d/%m/%Y",$rowm[0])." ".$rowc[0]."\n"; - - } - } - } - $j++; - } -} -else -{ - print $db->error(); -} - - -$db->close(); -?> diff --git a/htdocs/telephonie/script/tools/search-line-wo-traffic.php b/htdocs/telephonie/script/tools/search-line-wo-traffic.php deleted file mode 100644 index 1b5a5039d3d..00000000000 --- a/htdocs/telephonie/script/tools/search-line-wo-traffic.php +++ /dev/null @@ -1,69 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * Recherche des lignes actives sans traffic - * - */ -require ("../../../master.inc.php"); -/* - * - */ -$datetime = time(); -$datemax = $datetime - (86400 * 90); - -$sql = "SELECT ligne"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne"; -$sql .= " WHERE statut = 3"; -$sql .= " AND unix_timestamp(datec) <".$datemax; - -$re2sql = $db->query($sql) ; - -if ( $re2sql ) -{ - $nu2m = $db->num_rows($re2sql); - print "$nu2m lignes\n"; - $j = 0; - while ($j < $nu2m) - { - $row = $db->fetch_row($re2sql); - - $sqlm = "SELECT unix_timestamp(max(date)) as md"; - $sqlm .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; - $sqlm .= " WHERE ligne = '".$row[0]."'"; - - $resqlm = $db->query($sqlm) ; - if ( $resqlm ) - { - $rowm = $db->fetch_row($resqlm); - if ($rowm[0] < $datemax) - { - print $row[0]." ".strftime("%d/%m/%Y",$rowm[0])."\n"; - } - } - $j++; - } -} -else -{ - print $db->error(); -} - -$db->close(); -?> diff --git a/htdocs/telephonie/script/tools/tarif-copie_grille.php b/htdocs/telephonie/script/tools/tarif-copie_grille.php deleted file mode 100644 index 28f1e361cdd..00000000000 --- a/htdocs/telephonie/script/tools/tarif-copie_grille.php +++ /dev/null @@ -1,74 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * - * Ce script se veut plus un squelette pour effectuer des opérations sur la base - * qu'un réel scrip de production. - * - * Recalcul le montant d'une facture lors d'une erreur de tarif - * - */ - -require ("../../../master.inc.php"); - -$af = 0; - -$source = 5; -$dest = 6; - -$sql = "SELECT fk_tarif, temporel, fixe"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_tarif_montant"; -$sql .= " WHERE fk_tarif_desc=$source"; - -$resql = $db->query($sql); - -if ( $resql ) -{ - $num = $db->num_rows($resql); - $i = 0; - - $sqlu = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_tarif_montant"; - $sqlu .= " WHERE fk_tarif_desc = $dest;"; - - $resqlu = $db->query($sqlu); - - print "$num tarifs trouvés\n"; - - while ($i < $num) - { - $row = $db->fetch_row($resql); - - $sqli = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_tarif_montant"; - $sqli .= " ( fk_tarif_desc, fk_tarif, temporel, fixe, fk_user,tms)"; - $sqli .= " VALUES ('$dest','$row[0]','$row[1]','$row[2]','1',now())"; - - $resqli = $db->query($sqli); - - $i++; - } - $db->free($resql); -} -else -{ - $error++; -} - -$db->close(); -?> diff --git a/htdocs/telephonie/script/tools/tarifs-clients-copy.php b/htdocs/telephonie/script/tools/tarifs-clients-copy.php deleted file mode 100644 index 46bf3b951df..00000000000 --- a/htdocs/telephonie/script/tools/tarifs-clients-copy.php +++ /dev/null @@ -1,127 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * - * Ce script se veut plus un squelette pour effectuer des opérations sur la base - * qu'un réel scrip de production. - * - * Recalcul le montant d'une facture lors d'une erreur de tarif - * - */ - -require ("../../../master.inc.php"); - -require_once (DOL_DOCUMENT_ROOT."/societe.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/facturetel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/telephonie-tarif.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/communication.class.php"); - -$from = 0; -$to = 0; - -//loop through our arguments and see what the user selected -for ($i = 1; $i < sizeof($GLOBALS["argv"]); $i++) -{ - switch($GLOBALS["argv"][$i]) - { - case "--from": - $from = $GLOBALS["argv"][($i+1)]; - break; - case "--to": - $to = $GLOBALS["argv"][($i+1)]; - break; - } -} - -if (($from * $to) == 0) -{ - print "usage --from FROM --to TO\n"; - exit; -} - - -$sql = "SELECT fk_tarif,temporel,fixe,fk_user FROM ".MAIN_DB_PREFIX."telephonie_tarif_client"; -$sql .= " WHERE fk_client = ".$from; - -$resql = $db->query($sql); - -if ( $resql ) -{ - $num = $db->num_rows($resql); - $i = 0; - - print "$num tarifs trouvés\n"; - - while ($i < $num) - { - $row = $db->fetch_row($resql); - $error = 0; - - $db->begin(); - - $sqlr = "REPLACE INTO ".MAIN_DB_PREFIX."telephonie_tarif_client"; - $sqlr .= " (fk_tarif, fk_client, temporel, fixe, fk_user) VALUES "; - $sqlr .= " (".$row[0].",".$to.",'".$row[1]."','".$row[2]."','".$row[3]."')"; - - if (! $db->query($sqlr) ) - { - $error++; - print $db->error(); - } - - $sqli = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_tarif_client_log"; - $sqli .= " (fk_tarif, fk_client, temporel, fixe, fk_user, datec) VALUES "; - $sqli .= " (".$row[0].",".$to.",'".$row[1]."','".$row[2]."','".$row[3]."',now())"; - - if (! $db->query($sqli) ) - { - $error++; - print $db->error(); - } - - if ( $error == 0 ) - { - $db->commit(); - } - else - { - $db->rollback(); - print $db->error(); - } - - $i++; - } - $db->free($resql); -} -else -{ - $error++; -} - - - - - - - - -$db->close(); -?> diff --git a/htdocs/telephonie/script/tools/update-contrat-contact.php b/htdocs/telephonie/script/tools/update-contrat-contact.php deleted file mode 100644 index 4400957eccc..00000000000 --- a/htdocs/telephonie/script/tools/update-contrat-contact.php +++ /dev/null @@ -1,103 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * Mise à jours des contacts des contrats à partir des contacts des lignes - * Script de migration de la nouvelle structure de la base - * - */ - -require ("../../master.inc.php"); - -$contrats = array(); - -$sql = "SELECT c.rowid, cc.rowid FROM llx_telephonie_contrat as c LEFT JOIN llx_telephonie_contrat_contact_facture as cc ON cc.fk_contrat = c.rowid WHERE cc.fk_contact is null"; - -if ($db->query($sql)) -{ - $i = 0; - $num = $db->num_rows(); - - while ($i < $num) - { - $row = $db->fetch_row(); - $contrats[$i] = $row[0]; - $i++; - } - - $db->free(); -} -else -{ - print "Errir"; -} - -dol_syslog("Update contrats ".sizeof($contrats)); - -for ($i = 0 ; $i < sizeof($contrats) ; $i++) -{ - $numc = 0; - - $sql = "SELECT distinct(c.fk_contact) FROM llx_telephonie_contact_facture as c, llx_telephonie_societe_ligne as l"; - $sql .= " WHERE l.rowid = c.fk_ligne"; - $sql .= " AND l.fk_contrat = ".$contrats[$i]; - - - if ($db->query($sql)) - { - $numc = $db->num_rows(); - - if ($numc == 1) - { - $obc = $db->fetch_object(); - $idcon = $obc->fk_contact; - } - $db->free(); - } - else - { - print "Erreur"; - } - - if ($numc == 1) - { - $sql = "INSERT INTO llx_telephonie_contrat_contact_facture"; - $sql .= " (fk_contrat, fk_contact) "; - $sql .= " VALUES (".$contrats[$i].",".$idcon.")"; - - if (!$db->query($sql)) - { - dol_syslog("Erreur "); - } - else - { - dol_syslog("Update contrat ".$contrats[$i]); - } - } - else - { - - if ($numc > 0) - { - print "$contrats[$i] $numc\n"; - print $sql."\n" ; - } - } -} -?> diff --git a/htdocs/telephonie/script/tools/verif-contrat-contact-services.php b/htdocs/telephonie/script/tools/verif-contrat-contact-services.php deleted file mode 100644 index b5d3a7ea27c..00000000000 --- a/htdocs/telephonie/script/tools/verif-contrat-contact-services.php +++ /dev/null @@ -1,91 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * Vérifie que les contrats qui n'ont pas de contact facture correct - * ont au moins un services d'envoi courrier. - * - */ -require ("../../../master.inc.php"); -/* - * - */ - -$sql = "SELECT rowid"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat"; - -$resql = $db->query($sql) ; - -if ( $resql ) -{ - while ($row = $db->fetch_row($resql)) - { - $sqlc = "SELECT count(*)"; - $sqlc .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat_contact_facture"; - $sqlc .= " WHERE fk_contrat =".$row[0]; - - $resqlc = $db->query($sqlc) ; - if ( $resqlc ) - { - $rowc = $db->fetch_row($resqlc); - if ($rowc[0] == 0) - { - $sqls = "SELECT count(*)"; - $sqls .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat_service"; - $sqls .= " WHERE fk_contrat =".$row[0]; - $sqls .= " AND fk_service in (1,2);"; - - $resqls = $db->query($sqls) ; - if ( $resqls ) - { - $rows = $db->fetch_row($resqls); - if ($rows[0] == 0) - { - $sqll = "SELECT count(*)"; - $sqll .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne"; - $sqll .= " WHERE fk_contrat =".$row[0]; - $sqll .= " AND statut = 3;"; - - $resqll = $db->query($sqll) ; - if ( $resqll ) - { - $rowl = $db->fetch_row($resqll); - if ($rowl[0] > 0) - { - print "Contrat ".$row[0]." sans contact ni envoi courrier\n"; - } - } - } - } - } - } - else - { - print $db->error(); - } - - } -} -else -{ - print $db->error(); -} - -$db->close(); -?> diff --git a/htdocs/telephonie/script/tools/verif-ligne-attente.php b/htdocs/telephonie/script/tools/verif-ligne-attente.php deleted file mode 100644 index 7c647b922d8..00000000000 --- a/htdocs/telephonie/script/tools/verif-ligne-attente.php +++ /dev/null @@ -1,108 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * Vérifie les lignes ayant le statut d'attente - * - */ -require ("../../../master.inc.php"); -/* - * - */ -$users = array(); -$sqll = "SELECT rowid,name,firstname,email"; -$sqll .= " FROM ".MAIN_DB_PREFIX."user"; - -$resqll = $db->query($sqll) ; -if ( $resqll ) -{ - while ($row = $db->fetch_row($resqll)) - { - $users[$row[0]] = $row; - } -} - -else -{ - print $db->error(); -} - -$sqll = "SELECT l.datec, l.ligne, l.fk_commercial_sign, l.rowid"; -$sqll .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; -$sqll .= " WHERE statut = -1"; -$sqll .= " AND l.datec + INTERVAL 1 MONTH < now();"; - -$resqll = $db->query($sqll); -if ( $resqll ) -{ - while ($row = $db->fetch_row($resqll)) - { - - $sqlc = "SELECT counter"; - $sqlc .= " FROM ".MAIN_DB_PREFIX."telephonie_alertecounter"; - $sqlc .= " WHERE fk_ligne = ".$row[3]; - $sqlc .= " AND fk_user = ".$row[2]; - - $resqlc = $db->query($sqlc); - if ( $resqlc ) - { - if ($rowc = $db->fetch_row($resqlc)) - { - $count = $rowc[0]; - $sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_alertecounter"; - $sql .= " SET counter=counter+1 WHERE fk_ligne=".$row[3]; - $sql .= " AND fk_user=".$row[2].";"; - $db->query($sql); - } - else - { - $count = 1; - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_alertecounter"; - $sql .= " (fk_ligne,fk_user,counter)"; - $sql .= " VALUES (".$row[3].",".$row[2].",1);"; - $db->query($sql); - } - } - - $mesg = "Bonjour,\n\n"; - $mesg .= "Alerte Ligne ".$row[1]." en attente\n"; - $mesg .= "Depuis le ".$row[0]."\n"; - $mesg .= "Envoi # ".$count."\n\n"; - $mesg .= "--\nmessage automatique en provenance de dolibarr"; - - $headers = 'From: metac@NE_PAS_REPONDRE.com' . "\r\n" . - 'Reply-To: '.$users[$row[2]][3]. "\r\n" . - 'X-Mailer: Dolibarr'; - - $to = $users[$row[2]][3]; - $subject = "Alerte ligne en attente"; - - mail($to,$subject,$mesg, $headers); - } -} - -else -{ - print $db->error(); -} - - - -$db->close(); -?> diff --git a/htdocs/telephonie/script/tools/viper.hook.php b/htdocs/telephonie/script/tools/viper.hook.php deleted file mode 100644 index 3da8db74e63..00000000000 --- a/htdocs/telephonie/script/tools/viper.hook.php +++ /dev/null @@ -1,240 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * - * Ce script se veut plus un squelette pour effectuer des opérations sur la base - * qu'un réel scrip de production. - * - * Recalcul le montant d'une facture lors d'une erreur de tarif - * - */ - -require ("../../../master.inc.php"); - -$month = "11"; -$year = "2005"; - - -$sqls = "SELECT l.rowid,l.ligne,l.fk_commercial_suiv"; -$sqls .= " FROM ".MAIN_DB_PREFIX."telephonie_facture as f,".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; -$sqls .= " WHERE l.rowid =f.fk_ligne AND f.cout_vente < f.fourn_montant"; -$sqls .= " AND f.date ='".$year."-".$month."-01'"; - -$resqls = $db->query($sqls); -if ( $resqls ) -{ - while ($obj = $db->fetch_object($resqls)) - { - $title = "Marge négative ligne ".$obj->ligne." pour $month-$year"; - $desc = "La facturation de la ligne ".$obj->ligne. " présente une marge négative en $month/$year"; - $userlid = $obj->fk_commercial_suiv; - - if ($db->begin()) - { - $result = -1; - - $sql = "SELECT vtiger_id from ".MAIN_DB_PREFIX."vtiger_users"; - $sql .= " WHERE fk_user =".$userlid.";"; - $result = 1; - $resql = $db->query($sql); - if ( $resql ) - { - if ($row = $db->fetch_row($resql)) - { - $user_id = $row[0]; - $result = 0; - } - else - { - print "Error user id missing $userlid in llx_user \n"; - } - } - else - { - print "Error 7\n"; - } - - if ($result == 0) - { - $sql = "UPDATE vtiger.crmentity_seq set id=LAST_INSERT_ID(id+1)"; - $resql = $db->query($sql); - if ( $resql ) - { - $result = 0; - } - else - { - print "Error 1\n"; - } - } - - if ($result == 0) - { - $sql = "SELECT user_name from vtiger.users where id =".$user_id.";"; - $result = 1; - $resql = $db->query($sql); - if ( $resql ) - { - if ($row = $db->fetch_row($resql)) - { - $username = $row[0]; - $result = 0; - } - else - { - print "Error 4 Missing id for $user_id\n"; - } - } - else - { - print "Error 5\n"; - } - } - - - if ($result == 0) - { - $sql = "SELECT id from vtiger.crmentity_seq;"; - $result = 1; - $resql = $db->query($sql); - $tid = 0; - if ( $resql ) - { - if ($row = $db->fetch_row($resql)) - { - $tid = $row[0]; - $result = 0; - } - else - { - print "Error 2\n"; - } - } - else - { - print "Error 3\n"; - } - } - - if ($result == 0 && $tid > 0) - { - $sql = "INSERT INTO vtiger.troubletickets (ticketid, parent_id, priority, product_id, severity, status, category, update_log, title, description, solution) values "; - $sql .= " (".$tid.", '', 'High', '', 'Major', 'Open', 'Big Problem','"; - $sql .= strftime("%A %d %B %Y %H:%M:%S", time())." by dolibarr--//--Ticket created. Assigned to $username--//--'"; - $sql .= ", '".$title."', '".$desc."', '')"; - - $result = 1; - $resql = $db->query($sql); - if ( $resql ) - { - $result = 0; - } - else - { - print $db->error()."\n"; - print "$sql\n"; - } - } - - - - if ($result == 0 && $tid > 0) - { - $sql = "INSERT INTO vtiger.crmentity "; - $sql .= " (crmid,smcreatorid,smownerid,setype,description,createdtime,modifiedtime) "; - $sql .= " VALUES ('".$tid."','$user_id','$user_id','HelpDesk','".$desc."',now(),now())"; - - $resql = $db->query($sql); - $result = 1; - if ( $resql ) - { - $result = 0; - } - else - { - print $db->error()."\n"; - print "$sql\n"; - } - } - - if ($result == 0 && $tid > 0) - { - $sql = "INSERT INTO vtiger.ticketcf (ticketid) values ($tid)"; - $resql = $db->query($sql); - $result = 1; - if ( $resql ) - { - $result = 0; - } - } - - if ($result == 0 ) - { - $sql = "INSERT INTO vtiger.ticketcomments (ticketid, comments) values ($tid, '')"; - $resql = $db->query($sql); - $result = 1; - if ( $resql ) - { - $result = 0; - } - } - - /* - if ($result == 0 ) - { - $sql = "DELETE from vtiger.tracker WHERE user_id='".$user_id."' and item_id='".$tid".'"; - $resql = $db->query($sql); - $result = 1; - if ( $resql ) - { - $result = 0; - } - } - - if ($result == 0 ) - { - $sql = "INSERT INTO vtiger.tracker "; - $sql .= " (user_id, module_name, item_id, item_summary) values "; - $sql .= " ('".$user_id."', 'HelpDesk', '".$tid."', '".$title."')"; - - $resql = $db->query($sql); - $result = 1; - if ( $resql ) - { - $result = 0; - } - } - */ - if ($result == 0) - { - $db->commit(); - print "COMMIT $tid\n"; - } - else - { - $db->rollback(); - print "ROLLBACK $tid\n"; - } - - } - } -} - - diff --git a/htdocs/telephonie/script/update-contrat-statut.php b/htdocs/telephonie/script/update-contrat-statut.php deleted file mode 100644 index 6f5f68180ce..00000000000 --- a/htdocs/telephonie/script/update-contrat-statut.php +++ /dev/null @@ -1,63 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * Mise à jours des statuts des contrats - * Script de migration de la nouvelle structure de la base - * - */ - -require ("../../master.inc.php"); -require(DOL_DOCUMENT_ROOT."/telephonie/telephonie.contrat.class.php"); - -$contrats = array(); - -$sql = "SELECT rowid FROM llx_telephonie_contrat;"; - -if ($db->query($sql)) -{ - $i = 0; - $num = $db->num_rows(); - - while ($i < $num) - { - $row = $db->fetch_row(); - $contrats[$i] = $row[0]; - $i++; - } - - $db->free(); -} -else -{ - die ("Error $sql"); -} - -dol_syslog("Update contrats ".sizeof($contrats)); - -for ($i = 0 ; $i < sizeof($contrats) ; $i++) -{ - $numc = 0; - - $contrat = new TelephonieContrat($db); - $contrat->id = $contrats[$i]; - $contrat->update_statut(); - -} -?> diff --git a/htdocs/telephonie/script/update_presel.php b/htdocs/telephonie/script/update_presel.php deleted file mode 100644 index 93b1f515e3f..00000000000 --- a/htdocs/telephonie/script/update_presel.php +++ /dev/null @@ -1,184 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * - * Commandes des lignes par API - * - */ -require ("../../master.inc.php"); -require_once DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"; - -$verbose = 0; - -for ($i = 1 ; $i < sizeof($argv) ; $i++) -{ - if ($argv[$i] == "-v") - { - $verbose = 1; - } - if ($argv[$i] == "-vv") - { - $verbose = 2; - } - if ($argv[$i] == "-vvv") - { - $verbose = 3; - } -} - - -$user = new User($db); -$user->id = 1; // C'est sale je sais ! - -$host = CMD_PRESEL_WEB_HOST; -$user_login = CMD_PRESEL_WEB_USER; -$user_passwd = CMD_PRESEL_WEB_PASS; -$user_contract = CMD_PRESEL_WEB_CONTRACT; - -/* - * Lecture des lignes a commander - * - */ -$sql = "SELECT s.nom, s.rowid as socid, s.address, s.cp, s.ville"; -$sql .= ", l.ligne, l.statut, l.rowid"; - -$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_fournisseur as f"; -$sql .= " WHERE l.fk_soc = s.rowid AND l.fk_fournisseur = f.rowid"; -$sql .= " AND f.rowid = 4"; -$sql .= " AND l.ligne='".$argv[1]."'"; -$sql .= " ORDER BY l.rowid DESC"; - -$resql = $db->query($sql); -$result = 1; -if ($resql) -{ - $i = 0; - $num = $db->num_rows($resql); - print "$num lignes\n"; - while ($i < $num) - { - $obj = $db->fetch_object($resql); - - $lint = new LigneTel($db); - $lint->fetch_by_id($obj->rowid); - - $result = UpdatePreselection($host, $user_login, $user_passwd, $lint, $num_abo); - - $i++; - } -} - -function UpdatePreselection($host, $user_login, $user_passwd, $lint, $id_person) -{ - global $verbose; - dol_syslog("UpdatePreselection($host, $user_login, ****, $ligne, $id_person)"); - - $url = "/AzurApp_websvc_b3gdb/account.asmx/UpdatePreselection?"; - - $url .= "user_login=". $user_login; - $url .= "&user_passwd=".$user_passwd; - $url .= "&telnum=".$lint->numero; - $url .= "&okCollecte=true"; - $url .= "&okPreselection=true"; - - if ($verbose > 2) - dol_syslog("$host"); - - if ($verbose > 2) - dol_syslog("$url"); - - $fp = fsockopen($host, 80, $errno, $errstr, 30); - if (!$fp) - { - dol_syslog("$errstr ($errno)"); - } - else - { - if ($verbose > 2) - dol_syslog("Socket Opened send data"); - - $out = "GET $url HTTP/1.1\r\n"; - $out .= "Host: $host\r\n"; - $out .= "Connection: Close\r\n\r\n"; - - fwrite($fp, $out); - - if ($verbose > 2) - dol_syslog("Data sent, waiting for response"); - - $parse = 0; - $result = "error"; - - $fresult = ""; - - while (!feof($fp)) - { - $line = fgets($fp, 1024); - - if ($verbose > 2) - dol_syslog($line); - - if ($parse == 1) - { - preg_match('/^(.*)<\/string>$/', $line, $results); - - $result = $results[1]; - dol_syslog($line); - $parse = 0; - } - - if (substr($line,0,38) == '') - { - $parse = 1; - } - - $fresult .= $line; - - } - fclose($fp); - } - - if ($verbose > 1) - dol_syslog("result = ".$result); - - if (substr($result,0,2) == "OK") - { - dol_syslog("Presel OK ".$lint->numero." ".$lint->support." id client ".$id_person." $result\n"); - return 0; - } - else - { - dol_syslog("Presel ERR ".$lint->numero." ".$lint->support." id client ".$id_person." $result\n"); - - $fp = fopen("/tmp/".$lint->numero.".presel","w"); - if ($fp) - { - fwrite($fp, $fresult); - fclose($fp); - } - - return -1; - } -} - - -?> diff --git a/htdocs/telephonie/script/verif-import-cdr.php b/htdocs/telephonie/script/verif-import-cdr.php deleted file mode 100644 index 8c804c4e8f4..00000000000 --- a/htdocs/telephonie/script/verif-import-cdr.php +++ /dev/null @@ -1,67 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * Script de verfication des données dans l'import des CDR - */ -require ("../../master.inc.php"); -require(DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); -/* - * Vérification des lignes présentes - * - */ - -$sql = "SELECT distinct(ligne), fk_fournisseur"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_import_cdr"; -$resql = $db->query($sql); -if ($resql) -{ - $num = $db->num_rows(); - - while ($row = $db->fetch_row($resql)) - { - $ligne = new LigneTel($db); - if ($ligne->fetch($row[0]) >= 0) - { - if ($ligne->fournisseur_id <> $row[1]) - { - print "Ligne $row[0] fournisseur incohérent\n"; - } - - if ($ligne->statut <> 3) - { - print "Ligne $row[0] non activée, comms présentes\n"; - } - } - else - { - print "Ligne $row[0] inconnue\n"; - } - } -} -else -{ - dol_syslog("Erreur recherche fournisseur"); - exit ; -} - - - - -return $error; diff --git a/htdocs/telephonie/service/contrats.php b/htdocs/telephonie/service/contrats.php deleted file mode 100644 index bb8342553cf..00000000000 --- a/htdocs/telephonie/service/contrats.php +++ /dev/null @@ -1,170 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if (!$user->rights->telephonie->service->lire) - accessforbidden(); - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; -$sortfield = $_GET["sortfield"]; - -llxHeader('','Telephonie - Services - Liste'); -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -if ($sortorder == "") { - $sortorder="ASC"; -} -if ($sortfield == "") { - $sortfield="s.nom"; -} - -/* - * Recherche - * - * - */ - -if ($page == -1) { $page = 0 ; } - -$offset = $conf->liste_limit * $page ; -$pageprev = $page - 1; -$pagenext = $page + 1; - -/* - * Mode Liste - * - * - * - */ - -if ($_GET["id"]) -{ - - $service = new TelephonieService($db); - - if ( $service->fetch($_GET["id"]) == 0 ) - { - - - $h=0; - $head[$h][0] = DOL_URL_ROOT."/telephonie/service/fiche.php?id=".$service->id; - $head[$h][1] = $langs->trans("Service"); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/service/contrats.php?id=".$service->id; - $head[$h][1] = "Contrats"; - $hselected = $h; - $h++; - - dol_fiche_head($head, $hselected, 'Service : '.$service->id); - - - $sql = "SELECT s.rowid as socid, s.nom as nom_facture"; - $sql .= " , c.ref, cs.montant, c.rowid as crowid"; - $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_contrat as c"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_contrat_service as cs"; - $sql .= " WHERE cs.fk_service = ".$_GET["id"]; - $sql .= " AND cs.fk_contrat = c.rowid"; - $sql .= " AND s.rowid = c.fk_soc_facture"; - - if ($_GET["search_client"]) - { - $sel =urldecode($_GET["search_client"]); - $sql .= " AND s.nom LIKE '%".$sel."%'"; - } - - $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); - - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - - $urladd= "&id=".$_GET["id"]; - - print_barre_liste("Contrats", $page, "contrats.php", $urladd, $sortfield, $sortorder, '', $num); - print"\n\n"; - print ''; - print ''; - - print_liste_field_titre("Contrat","contrats.php","c.ref","",$urladd); - print_liste_field_titre("Client","contrats.php","s.nom","",$urladd); - - print ''; - - print "\n"; - - /* - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - */ - - $var=True; - - while ($i < min($num,$conf->liste_limit)) - { - $obj = $db->fetch_object($resql); - $var=!$var; - - print "\n"; - - print ''; - - print '\n"; - print "\n"; - $i++; - } - print "
Montant
"; - - print ''; - print img_file(); - print ' '; - - print ''.$obj->ref."'.stripslashes($obj->nom_facture).''.price($obj->montant)."
"; - $db->free(); - } - else - { - print $db->error() . ' ' . $sql; - } - } -} - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/service/fiche.php b/htdocs/telephonie/service/fiche.php deleted file mode 100644 index 7f452f56d38..00000000000 --- a/htdocs/telephonie/service/fiche.php +++ /dev/null @@ -1,252 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require "./pre.inc.php"; - -if (!$user->rights->telephonie->service->lire) - accessforbidden(); - -$mesg = ''; - - -if ($_POST["action"] == 'add') -{ - $service = new TelephonieService($db); - - $service->ref = $_POST["ref"]; - $service->libelle = $_POST["libelle"]; - $service->libelle_facture = $_POST["libelle_facture"]; - $service->montant = $_POST["montant"]; - - if ( $service->create($user) == 0) - { - Header("Location: fiche.php?id=".$service->id); - } - else - { - $_GET["action"] = 'create'; - } - -} - - -if ($_GET["action"] == 'active') -{ - $service = new TelephonieService($db); - $service->id = $_GET["id"]; - - if ( $service->active($user) == 0) - { - Header("Location: fiche.php?id=".$service->id); - } - -} - -if ($_POST["action"] == 'update') -{ - $service = new TelephonieService($db); - $service->id = $_GET["id"]; - - $service->ref = $_POST["ref"]; - $service->libelle = $_POST["libelle"]; - $service->libelle_facture = $_POST["libelle_facture"]; - $service->montant = $_POST["montant"]; - - if ( $service->update($user) == 0) - - { - $action = ''; - $mesg = 'Fiche mise à jour'; - } - else - { - $action = 're-edit'; - $mesg = 'Fiche non mise à jour !' . "
" . $entrepot->mesg_error; - } -} - - -llxHeader("","Téléphonie - Fiche Service"); - -if ($cancel == $langs->trans("Cancel")) -{ - $action = ''; -} - -/* - * Création - * - */ -if ($_GET["action"] == 'create') -{ - $form = new Form($db); - print_titre("Nouveau service"); - - print '
'; - print ''; - print ''; - - print ''; - - print ''; - - print ''; - - print ''; - - print ''."\n"; - print '
Libellé'; - print ''; - print '
Libellé Facture'; - print ''; - print '
Montant HT'; - print ''; - print '  euros HT
 
'."\n"; - print '
'; - - - -} -else -{ - if ($_GET["id"]) - { - - $service = new TelephonieService($db); - - if ( $service->fetch($_GET["id"]) == 0 ) - { - if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit') - { - - $h=0; - $head[$h][0] = DOL_URL_ROOT."/telephonie/service/fiche.php?id=".$service->id; - $head[$h][1] = $langs->trans("Service"); - $hselected = $h; - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/service/contrats.php?id=".$service->id; - $head[$h][1] = "Contrats"; - $h++; - - dol_fiche_head($head, $hselected, 'Service : '.$service->id); - - print_fiche_titre('Fiche Service', $mesg); - - print ''; - - print ''; - print ''; - - print ''; - print ''; - print "
Libellé'.$service->libelle.'
Libellé Facture'.$service->libelle_facture.'
Montant mensuel HT'.$service->montant.'
Statut'.$service->statuts[$service->statut].'

"; - print ''; - } - - - /* - * Edition - * - * - * - */ - - if ($_GET["action"] == 'edit' || $action == 're-edit') - { - - $h=0; - $head[$h][0] = DOL_URL_ROOT."/telephonie/service/fiche.php?id=".$service->id; - $head[$h][1] = $langs->trans("Service"); - $hselected = $h; - $h++; - - dol_fiche_head($head, $hselected, 'Service : '.$service->numero); - - print_fiche_titre('Edition du service', $mesg); - - print "
id\" method=\"post\">\n"; - print ''; - print ''; - - print ''; - - - print ''; - - print ''; - - print ''; - - print ''; - - print '
Libellé'; - print ''; - print '
Libellé Facture'; - print ''; - print '
Montant mensuel HT'; - print '  euros HT'; - print '
'; - print '
'; - - print ''; - - } - } - else - { - print "Error"; - } - } -} - - - -/* ************************************************************************** */ -/* */ -/* Barre d'action */ -/* */ -/* ************************************************************************** */ - -print "\n
\n"; - -if ($_GET["action"] == '' && $service->statut == 0) -{ - print "id\">".$langs->trans("Active").""; -} - - -if ($_GET["action"] == '') -{ - print "id\">".$langs->trans("Modify").""; -} - - - -print "
"; - - - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/service/index.php b/htdocs/telephonie/service/index.php deleted file mode 100644 index 29dbf5f7081..00000000000 --- a/htdocs/telephonie/service/index.php +++ /dev/null @@ -1,87 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if (!$user->rights->telephonie->service->lire) accessforbidden(); - -llxHeader('','Telephonie - Services'); - -/* - * - * - * - */ - -print_titre("Services"); - -print ''; - -print ''; - - -print '
'; - -$sql = "SELECT s.rowid , libelle, count(cs.rowid) "; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_service as s"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_contrat_service as cs"; -$sql .= " WHERE cs.fk_service = s.rowid"; -$sql .= " GROUP by s.rowid DESC"; -//print $sql; -if ($db->query($sql)) -{ - $num = $db->num_rows(); - $i = 0; - - print ''; - print ''; - print "\n"; - $var=True; - - while ($i < min($num,$conf->liste_limit)) - { - $row = $db->fetch_row(); - print '"; - print '"; - $i++; - } - - - - print "
Libellé-
'.stripslashes($row[1])."'.$row[2]."
"; - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - -print '
'; -print '
 '; - -print '
'; - - - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/service/liste.php b/htdocs/telephonie/service/liste.php deleted file mode 100644 index cfe6cedda83..00000000000 --- a/htdocs/telephonie/service/liste.php +++ /dev/null @@ -1,121 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if (!$user->rights->telephonie->service->lire) - accessforbidden(); - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; -$sortfield = $_GET["sortfield"]; - -llxHeader('','Telephonie - Services - Liste'); -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -if ($sortorder == "") { - $sortorder="ASC"; -} -if ($sortfield == "") { - $sortfield="s.statut"; -} - -/* - * Recherche - * - * - */ - -if ($page == -1) { $page = 0 ; } - -$offset = $conf->liste_limit * $page ; -$pageprev = $page - 1; -$pagenext = $page + 1; - -/* - * Mode Liste - * - * - * - */ - -$service = new TelephonieService($db); - -$sql = "SELECT s.rowid, s.libelle, s.montant,s.statut"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_service as s"; - -$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); - -$result = $db->query($sql); -if ($result) -{ - $num = $db->num_rows(); - $i = 0; - - $urladd= "&statut=".$_GET["statut"]; - - print_barre_liste("Services", $page, "liste.php", $urladd, $sortfield, $sortorder, '', $num); - print"\n\n"; - print ''; - print ''; - - print ''; - print ''; - print ''; - - print "\n"; - - $var=True; - - while ($i < min($num,$conf->liste_limit)) - { - $obj = $db->fetch_object(); - $var=!$var; - - print "\n"; - - print '\n"; - - print ''; - print "\n"; - $i++; - } - print "
LibelléMontant HTStatut
"; - - print ''.stripslashes($obj->libelle)."'.price($obj->montant)."'.$service->statuts[$obj->statut].'
"; - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/service/modules/ServiceFactureTableur.class.php b/htdocs/telephonie/service/modules/ServiceFactureTableur.class.php deleted file mode 100644 index e4195fd8170..00000000000 --- a/htdocs/telephonie/service/modules/ServiceFactureTableur.class.php +++ /dev/null @@ -1,191 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * - * Génération des détails de facture en tableur - * - */ - -require_once (DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_workbook.inc.php"); -require_once (DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_worksheet.inc.php"); - -class ServiceFactureTableur -{ - - var $year; - var $month; - - Function Process($contrat) - { - dol_syslog("ServiceFactureTableur::Process Contrat ".$contrat->id); - - $facids = array(); - - /* - * Recherche des factures comptables liées au contrat - * - */ - - $sql2 = "SELECT distinct fk_facture"; - $sql2 .= " FROM ".MAIN_DB_PREFIX."telephonie_facture"; - $sql2 .= " WHERE fk_contrat = ".$contrat->id; - $sql2 .= " AND date = '".$this->year."-".$this->month."-01'"; - - $resql2 = $contrat->db->query($sql2); - - if ( $resql2 ) - { - $j = 0; - $num2 = $contrat->db->num_rows($resql2); - - dol_syslog("ServiceFactureTableur::Process Nb factures ".$num2); - - while ($j < $num2) - { - $row2 = $contrat->db->fetch_row($resql2); - - array_push($facids, $row2[0]); - $j++; - } - } - - /* - * Recherche des facture de téléphonie liée à la facture comptable - * - */ - - foreach ($facids as $facid) - { - $error = 0; - - $facture = new Facture($contrat->db); - $facture->fetch($facid); - - $factels = array(); - - - $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."telephonie_facture"; - $sql .= " WHERE fk_facture =".$facture->id; - - $resql = $contrat->db->query($sql); - - if ( $resql ) - { - $num = $contrat->db->num_rows($resql); - $i = 0; - - while ($i < $num) - { - $row = $contrat->db->fetch_row($resql); - array_push($factels, $row[0]); - $i++; - } - $contrat->db->free($resql); - } - else - { - $error++; - } - - $fname = "/tmp/".$facture->ref.".xls"; - - /* - * Génération du fchier tableur - */ - - $workbook = &new writeexcel_workbook($fname); - - $page = &$workbook->addworksheet("Facture $facture->ref"); - - $fnb =& $workbook->addformat(); - $fnb->set_align('vcenter'); - $fnb->set_align('right'); - - $fp =& $workbook->addformat(); - $fp->set_align('vcenter'); - $fp->set_align('right'); - $fp->set_num_format('0.000'); - - $fdest =& $workbook->addformat(); - $fdest->set_align('vcenter'); - - $page->set_column(0,0,12); // A - $page->set_column(1,1,20); // B - $page->set_column(2,2,15); // C - - $page->set_column(3,3,30); // D - $page->set_column(6,6,7); // G - $page->set_column(9,9,7); // J - $page->set_column(12,12,7); // M - - $page->write(0, 0, "Ligne", $format_titre_agence1); - $page->write(0, 1, "Date", $format_titre); - $page->write(0, 2, "Numero", $format_titre); - $page->write(0, 3, "Destination", $format_titre); - $page->write(0, 4, "Durée", $format_titre); - $page->write(0, 5, "Cout", $format_titre); - - $xx = 1; - - foreach ($factels as $factel) - { - $sql = "SELECT ligne, date, numero, dest, dureetext, duree, cout_vente"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; - $sql .= " WHERE fk_telephonie_facture =".$factel; - $sql .= " ORDER BY date ASC"; - - $resql = $contrat->db->query($sql); - - if ($resql) - { - $i = 0; - $numsql = $contrat->db->num_rows($resql); - - while ($i < $numsql) - { - $obj = $contrat->db->fetch_object($resql); - - $page->write_string($xx, 0, $obj->ligne, $fdest); - $page->write_string($xx, 1, $obj->date, $fdest); - $page->write_string($xx, 2, $obj->numero, $fdest); - $page->write_string($xx, 3, $obj->dest, $fdest); - $page->write($xx, 4, $obj->duree, $fnb); - $page->write($xx, 5, $obj->cout_vente, $fp); - $xx++; - $i++; - } - $contrat->db->free($resql); - } - else - { - dol_syslog($contrat->db->error()); - } - } - - $workbook->close(); - dol_syslog("Close $fname"); - - dol_syslog("Conso mémoire ".memory_get_usage() ); - } - } -} - -?> diff --git a/htdocs/telephonie/service/modules/index.php b/htdocs/telephonie/service/modules/index.php deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/telephonie/service/pre.inc.php b/htdocs/telephonie/service/pre.inc.php deleted file mode 100644 index 24d086105ad..00000000000 --- a/htdocs/telephonie/service/pre.inc.php +++ /dev/null @@ -1,65 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("../../main.inc.php"); -require(DOL_DOCUMENT_ROOT."/telephonie/telephonie.service.class.php"); - -$user->getrights('telephonie'); - -function llxHeader($head = "", $title="") { - global $user; - - /* - * - * - */ - top_menu($head, $title); - - $menu = new Menu(); - - $menu->add(DOL_URL_ROOT."/telephonie/index.php", "Telephonie"); - - $menu->add(DOL_URL_ROOT."/telephonie/client/index.php", "Clients"); - - $menu->add(DOL_URL_ROOT."/telephonie/contrat/", "Contrats"); - - $menu->add(DOL_URL_ROOT."/telephonie/ligne/index.php", "Lignes"); - - if ($user->rights->telephonie->ligne_commander) - $menu->add(DOL_URL_ROOT."/telephonie/ligne/commande/", "Commandes"); - - $menu->add(DOL_URL_ROOT."/telephonie/facture/", "Factures"); - - if ($user->rights->telephonie->stats->lire) - $menu->add(DOL_URL_ROOT."/telephonie/stats/", "Statistiques"); - - if ($user->rights->telephonie->service->lire) - { - $menu->add(DOL_URL_ROOT."/telephonie/service/", "Services"); - $menu->add_submenu(DOL_URL_ROOT."/telephonie/service/liste.php", "Liste"); - $menu->add_submenu(DOL_URL_ROOT."/telephonie/service/fiche.php?action=create", "Nouveau service"); - } - - - left_menu($menu->liste); -} - -?> diff --git a/htdocs/telephonie/service/vendus.php b/htdocs/telephonie/service/vendus.php deleted file mode 100644 index 091471bec98..00000000000 --- a/htdocs/telephonie/service/vendus.php +++ /dev/null @@ -1,182 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if (!$user->rights->telephonie->service->lire) - accessforbidden(); - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; -$sortfield = $_GET["sortfield"]; - -llxHeader('','Telephonie - Services - Liste'); -/* - * S�curit� acc�s client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -if ($sortorder == "") { - $sortorder="ASC"; -} -if ($sortfield == "") { - $sortfield="l.statut"; -} - -/* - * Recherche - * - * - */ - -if ($page == -1) { $page = 0 ; } - -$offset = $conf->liste_limit * $page ; -$pageprev = $page - 1; -$pagenext = $page + 1; - -/* - * Mode Liste - * - * - * - */ - -$sql = "SELECT s.rowid as socid, sf.rowid as sfidp, sf.nom as nom_facture,s.nom, l.ligne, f.nom as fournisseur, l.statut, l.rowid, l.remise"; -$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; -$sql .= " , ".MAIN_DB_PREFIX."societe as sf"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_fournisseur as f"; -$sql .= " WHERE l.fk_soc = s.rowid AND l.fk_fournisseur = f.rowid"; -$sql .= " AND l.fk_soc_facture = sf.rowid"; - -if ($_GET["search_ligne"]) -{ - $sel =urldecode($_GET["search_ligne"]); - $sel = ereg_replace("\.","",$sel); - $sel = ereg_replace(" ","",$sel); - $sql .= " AND l.ligne LIKE '%".$sel."%'"; -} - -if ($_GET["search_client"]) -{ - $sel =urldecode($_GET["search_client"]); - $sql .= " AND s.nom LIKE '%".$sel."%'"; -} - -if ($_GET["search_client_facture"]) -{ - $sel =urldecode($_GET["search_client_facture"]); - $sql .= " AND sf.nom LIKE '%".$sel."%'"; -} - -if (strlen($_GET["statut"])) -{ - $sql .= " AND l.statut = ".$_GET["statut"]; -} - -$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); - -$result = $db->query($sql); -if ($result) -{ - $num = $db->num_rows(); - $i = 0; - - $urladd= "&statut=".$_GET["statut"]; - - print_barre_liste("Contrats", $page, "liste.php", $urladd, $sortfield, $sortorder, '', $num); - print"\n\n"; - print ''; - print ''; - - print_liste_field_titre("Ligne","liste.php","l.ligne"); - print_liste_field_titre("Client (Agence/Filiale)","liste.php","s.nom"); - - print ''; - print ''; - - print_liste_field_titre("Remise LMN","liste.php","l.remise","","",' align="center"'); - - print ''; - - print "\n"; - - print ''; - print ''; - print ''; - print ''; - print ''; - - print ''; - - - print ''; - print ''; - - print ''; - print ''; - - - $var=True; - - $ligne = new LigneTel($db); - - while ($i < min($num,$conf->liste_limit)) - { - $obj = $db->fetch_object($i); - $var=!$var; - - print "\n"; - - print ''; - print ''; - - print '\n"; - - print '\n"; - print "\n"; - print "\n"; - $i++; - } - print "
Client factur�StatutFournisseur
  
"; - - print ' '; - - print ''; - print img_file(); - print ' '; - - print ''.dol_print_phone($obj->ligne,0,0,true)."'.stripslashes($obj->nom).''.stripslashes($obj->nom_facture).''.$ligne->statuts[$obj->statut]."'.$obj->remise." %".$obj->fournisseur."
"; - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/showfacture.php b/htdocs/telephonie/showfacture.php deleted file mode 100644 index 36aa4108372..00000000000 --- a/htdocs/telephonie/showfacture.php +++ /dev/null @@ -1,37 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * or see http://www.gnu.org/ - * - * $Id$ - * $Source$ - * - */ -require '../master.inc.php'; - -$facref = $_GET["facref"]; - -$file_img = DOL_DATA_ROOT."/facture/".$facref."/".$facref.".pdf.png"; - -header('Content-type: image/png'); - -if ($fh = @fopen($file_img, "rb")) -{ - fpassthru($fh); - fclose($fh); -} - -?> diff --git a/htdocs/telephonie/showgraph.php b/htdocs/telephonie/showgraph.php deleted file mode 100644 index aabd88dd03d..00000000000 --- a/htdocs/telephonie/showgraph.php +++ /dev/null @@ -1,34 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * or see http://www.gnu.org/ - * - * $Id$ - * $Source$ - * - */ - -$original_graph = urldecode($_GET["graph"]); - -header('Content-type: image/png'); - -if ($fh = @fopen($original_graph, "rb")) -{ - fpassthru($fh); - fclose($fh); -} - -?> diff --git a/htdocs/telephonie/sql/Makefile b/htdocs/telephonie/sql/Makefile deleted file mode 100644 index 03d0b912cd8..00000000000 --- a/htdocs/telephonie/sql/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright (C) 2004 Rodolphe Quiedeville -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# $Id$ -# $Source$ -# -# Special Makefile for telephonie -# - - -TABLES=$(shell find . -name "*sql") - - - -sql.all: $(TABLES) - find . -name "*sql" |grep -v "key.sql" | xargs cat | grep -v ^-- | cut -d "-" -f 1 > sql.alltable - diff --git a/htdocs/telephonie/sql/data/data.sql b/htdocs/telephonie/sql/data/data.sql deleted file mode 100644 index 2bf5b1ce7af..00000000000 --- a/htdocs/telephonie/sql/data/data.sql +++ /dev/null @@ -1,4 +0,0 @@ -insert into llx_telephonie_concurrents (nom,active) values ('Inconnu',0); -insert into llx_telephonie_concurrents (nom) values ('Cegetel'); -insert into llx_telephonie_concurrents (nom) values ('France Telecom'); -insert into llx_telephonie_concurrents (nom) values ('Neuf Telecom'); diff --git a/htdocs/telephonie/sql/data/index.php b/htdocs/telephonie/sql/data/index.php deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/telephonie/sql/index.php b/htdocs/telephonie/sql/index.php deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/telephonie/sql/llx_societe_consult.sql b/htdocs/telephonie/sql/llx_societe_consult.sql deleted file mode 100644 index 3ff0e4095f3..00000000000 --- a/htdocs/telephonie/sql/llx_societe_consult.sql +++ /dev/null @@ -1,31 +0,0 @@ --- ======================================================================== --- Copyright (C) 2005 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- ======================================================================== - --- --- Le type InnoDB n'est pas nécessaire pour cette table --- -create table llx_societe_consult -( - fk_soc integer, - fk_user integer, - datec timestamp, - action varchar(1) -)type=innodb; - diff --git a/htdocs/telephonie/sql/llx_societe_perms.sql b/htdocs/telephonie/sql/llx_societe_perms.sql deleted file mode 100644 index 68f45c9a36e..00000000000 --- a/htdocs/telephonie/sql/llx_societe_perms.sql +++ /dev/null @@ -1,31 +0,0 @@ --- ======================================================================== --- Copyright (C) 2005 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- ======================================================================== - -create table llx_societe_perms -( - fk_soc integer, - fk_user integer, - pread tinyint unsigned DEFAULT 0, -- permission de lecture - pwrite tinyint unsigned DEFAULT 0, -- permission d'ecriture - pperms tinyint unsigned DEFAULT 0, -- permission sur les permissions - - UNIQUE INDEX(fk_soc, fk_user) -)type=innodb; - diff --git a/htdocs/telephonie/sql/llx_telephonie_adsl_fournisseur.key.sql b/htdocs/telephonie/sql/llx_telephonie_adsl_fournisseur.key.sql deleted file mode 100644 index 230ea98220a..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_adsl_fournisseur.key.sql +++ /dev/null @@ -1,30 +0,0 @@ --- ============================================================================ --- Copyright (C) 2002-2004 Rodolphe Quiedeville --- Copyright (C) 2004 Laurent Destailleur --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ============================================================================ - --- --- -ALTER TABLE llx_telephonie_adsl_fournisseur ADD INDEX (fk_soc); --- --- -ALTER TABLE llx_telephonie_adsl_fournisseur ADD CONSTRAINT fk_telephonie_adsl_fournisseur_societe FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid); - diff --git a/htdocs/telephonie/sql/llx_telephonie_adsl_fournisseur.sql b/htdocs/telephonie/sql/llx_telephonie_adsl_fournisseur.sql deleted file mode 100644 index 671db04fae2..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_adsl_fournisseur.sql +++ /dev/null @@ -1,29 +0,0 @@ --- ======================================================================== --- Copyright (C) 2004-2007 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== - -create table llx_telephonie_adsl_fournisseur ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_soc integer NOT NULL, - email_commande varchar(255), - commande_active tinyint default 0, - UNIQUE(fk_soc) -)type=innodb; diff --git a/htdocs/telephonie/sql/llx_telephonie_adsl_ligne.sql b/htdocs/telephonie/sql/llx_telephonie_adsl_ligne.sql deleted file mode 100644 index e45490c429d..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_adsl_ligne.sql +++ /dev/null @@ -1,40 +0,0 @@ --- ======================================================================== --- Copyright (C) 2004-2007 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== - -create table llx_telephonie_adsl_ligne ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_client integer NOT NULL, - fk_contrat integer NULL, - fk_client_install integer NOT NULL, - fk_client_facture integer NOT NULL, - numero_ligne varchar(20) NOT NULL, - login varchar(255), - ip varchar(20), - password varchar(50), - fk_fournisseur integer, - fk_type integer NOT NULL, - fk_commercial integer NOT NULL, - fk_user_creat integer NOT NULL, - statut smallint DEFAULT -1, - note text, - prix real default 0 -)type=innodb; diff --git a/htdocs/telephonie/sql/llx_telephonie_adsl_ligne_statut.sql b/htdocs/telephonie/sql/llx_telephonie_adsl_ligne_statut.sql deleted file mode 100644 index 5033dc73253..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_adsl_ligne_statut.sql +++ /dev/null @@ -1,36 +0,0 @@ --- ======================================================================== --- Copyright (C) 2004 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- --- Statut des lignes --- --- - -create table llx_telephonie_adsl_ligne_statut ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - tms datetime, - fk_ligne integer NOT NULL, - statut smallint NOT NULL, - fk_user integer, - comment varchar(255) - -)type=innodb; - diff --git a/htdocs/telephonie/sql/llx_telephonie_adsl_type.sql b/htdocs/telephonie/sql/llx_telephonie_adsl_type.sql deleted file mode 100644 index b9e2a08171f..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_adsl_type.sql +++ /dev/null @@ -1,29 +0,0 @@ --- ======================================================================== --- Copyright (C) 2004 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== - -create table llx_telephonie_adsl_type ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - intitule varchar(255), - commande_active smallint DEFAULT 1, - fk_product integer - -)type=innodb; diff --git a/htdocs/telephonie/sql/llx_telephonie_alertecounter.sql b/htdocs/telephonie/sql/llx_telephonie_alertecounter.sql deleted file mode 100644 index 4f6bf2a0269..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_alertecounter.sql +++ /dev/null @@ -1,28 +0,0 @@ --- ======================================================================== --- Copyright (C) 2004 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== - -create table llx_telephonie_alertecounter ( - fk_user integer, - fk_ligne integer, - counter integer - -)type=innodb; diff --git a/htdocs/telephonie/sql/llx_telephonie_analyse_fournisseur.sql b/htdocs/telephonie/sql/llx_telephonie_analyse_fournisseur.sql deleted file mode 100644 index 2bb3589f328..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_analyse_fournisseur.sql +++ /dev/null @@ -1,32 +0,0 @@ --- ======================================================================== --- Copyright (C) 2005 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== - -create table llx_telephonie_analyse_fournisseur ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_fournisseur integer NOT NULL, - mois varchar(6), - achat real, - vente real, - - UNIQUE(fk_fournisseur, mois) - -)type=innodb; diff --git a/htdocs/telephonie/sql/llx_telephonie_client_presta.sql b/htdocs/telephonie/sql/llx_telephonie_client_presta.sql deleted file mode 100644 index c28424cde30..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_client_presta.sql +++ /dev/null @@ -1,37 +0,0 @@ --- ======================================================================== --- Copyright (C) 2005 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- --- Prestattions annexes à facturer --- -create table llx_telephonie_client_presta ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_client integer NOT NULL, -- Client - libelle text, - amount real, - fk_facture integer NOT NULL DEFAULT 0, - fk_user integer, - datec datetime, - description text - -)type=innodb; - - diff --git a/htdocs/telephonie/sql/llx_telephonie_client_remise.sql b/htdocs/telephonie/sql/llx_telephonie_client_remise.sql deleted file mode 100644 index 62fe9cda660..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_client_remise.sql +++ /dev/null @@ -1,35 +0,0 @@ --- ======================================================================== --- Copyright (C) 2005 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- --- -create table llx_telephonie_client_remise ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_client integer NOT NULL, -- Client - amount real, - fk_facture integer NOT NULL DEFAULT 0, - fk_user integer, - datec datetime, - description text - -)type=innodb; - - diff --git a/htdocs/telephonie/sql/llx_telephonie_client_statistique.sql b/htdocs/telephonie/sql/llx_telephonie_client_statistique.sql deleted file mode 100644 index 5de9772c7de..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_client_statistique.sql +++ /dev/null @@ -1,32 +0,0 @@ --- ======================================================================== --- Copyright (C) 2004 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- - -create table llx_telephonie_client_statistique ( - dates date, - stat varchar(15), - nb real, - - UNIQUE (dates, stat) - -)type=innodb; - diff --git a/htdocs/telephonie/sql/llx_telephonie_client_stats.key.sql b/htdocs/telephonie/sql/llx_telephonie_client_stats.key.sql deleted file mode 100644 index dc76e441177..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_client_stats.key.sql +++ /dev/null @@ -1,26 +0,0 @@ --- ======================================================================== --- Copyright (C) 2004 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- --- - - -ALTER TABLE llx_telephonie_client_stats ADD CONSTRAINT fk_telephonie_client_stats_societe FOREIGN KEY (fk_client_comm) REFERENCES llx_societe(rowid); diff --git a/htdocs/telephonie/sql/llx_telephonie_client_stats.sql b/htdocs/telephonie/sql/llx_telephonie_client_stats.sql deleted file mode 100644 index d944ad1423a..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_client_stats.sql +++ /dev/null @@ -1,34 +0,0 @@ --- ======================================================================== --- Copyright (C) 2004 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- --- -create table llx_telephonie_client_stats ( - fk_client_comm integer NOT NULL, -- Client décideur - ca real, - gain real, - cout real, - marge real, - - UNIQUE INDEX(fk_client_comm) -)type=innodb; - - diff --git a/htdocs/telephonie/sql/llx_telephonie_client_stats_mensuel.sql b/htdocs/telephonie/sql/llx_telephonie_client_stats_mensuel.sql deleted file mode 100644 index bb1a8d8f122..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_client_stats_mensuel.sql +++ /dev/null @@ -1,36 +0,0 @@ --- ======================================================================== --- Copyright (C) 2004 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- --- -create table llx_telephonie_client_stats_mensuel ( - fk_client_comm integer NOT NULL, -- Client décideur - year smallint NOT NULL, - month smallint NOT NULL, - ca real, - gain real, - cout real, - marge real, - - UNIQUE INDEX(fk_client_comm, year, month) -)type=innodb; - - diff --git a/htdocs/telephonie/sql/llx_telephonie_commande.key.sql b/htdocs/telephonie/sql/llx_telephonie_commande.key.sql deleted file mode 100644 index e9fc8790034..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_commande.key.sql +++ /dev/null @@ -1,27 +0,0 @@ --- ======================================================================== --- Copyright (C) 2004 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== - -ALTER TABLE llx_telephonie_commande ADD INDEX (fk_user_creat); -ALTER TABLE llx_telephonie_commande ADD INDEX (fk_fournisseur); - -ALTER TABLE llx_telephonie_commande ADD FOREIGN KEY (fk_user_creat) REFERENCES llx_user (rowid); -ALTER TABLE llx_telephonie_commande ADD FOREIGN KEY (fk_fournisseur) REFERENCES llx_telephonie_fournisseur (rowid); diff --git a/htdocs/telephonie/sql/llx_telephonie_commande.sql b/htdocs/telephonie/sql/llx_telephonie_commande.sql deleted file mode 100644 index b2961ea7155..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_commande.sql +++ /dev/null @@ -1,31 +0,0 @@ --- ======================================================================== --- Copyright (C) 2004 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- -create table llx_telephonie_commande ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - datec datetime NOT NULL, - fk_user_creat integer NOT NULL, - fk_fournisseur integer NOT NULL, - filename varchar(255) NOT NULL - - -)type=innodb; diff --git a/htdocs/telephonie/sql/llx_telephonie_commande_ligne.key.sql b/htdocs/telephonie/sql/llx_telephonie_commande_ligne.key.sql deleted file mode 100644 index 5d538f01aed..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_commande_ligne.key.sql +++ /dev/null @@ -1,27 +0,0 @@ --- ======================================================================== --- Copyright (C) 2005 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== - -ALTER TABLE llx_telephonie_commande_ligne ADD INDEX (fk_ligne); -ALTER TABLE llx_telephonie_commande_ligne ADD INDEX (fk_commande); - -ALTER TABLE llx_telephonie_commande_ligne ADD FOREIGN KEY (fk_ligne) REFERENCES llx_telephonie_societe_ligne (rowid); -ALTER TABLE llx_telephonie_commande_ligne ADD FOREIGN KEY (fk_commande) REFERENCES llx_telephonie_commande (rowid); diff --git a/htdocs/telephonie/sql/llx_telephonie_commande_ligne.sql b/htdocs/telephonie/sql/llx_telephonie_commande_ligne.sql deleted file mode 100644 index 769d340d279..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_commande_ligne.sql +++ /dev/null @@ -1,28 +0,0 @@ --- ======================================================================== --- Copyright (C) 2005 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- -create table llx_telephonie_commande_ligne ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_ligne integer NOT NULL, - fk_commande integer NOT NULL - -)type=innodb; diff --git a/htdocs/telephonie/sql/llx_telephonie_commande_retour.sql b/htdocs/telephonie/sql/llx_telephonie_commande_retour.sql deleted file mode 100644 index eec54bb8309..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_commande_retour.sql +++ /dev/null @@ -1,37 +0,0 @@ --- ======================================================================== --- Copyright (C) 2005 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- -create table llx_telephonie_commande_retour ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - cli varchar(255) NOT NULL, - mode varchar(255) NOT NULL, - situation varchar(255) NOT NULL, - date_mise_service datetime, - date_resiliation datetime, - motif_resiliation varchar(255) NOT NULL, - commentaire text NOT NULL, - fichier varchar(255) NOT NULL, - traite smallint DEFAULT 0, - date_traitement datetime, - fk_fournisseur integer NOT NULL - -)type=innodb; diff --git a/htdocs/telephonie/sql/llx_telephonie_commission.sql b/htdocs/telephonie/sql/llx_telephonie_commission.sql deleted file mode 100644 index 76cf96ef42c..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_commission.sql +++ /dev/null @@ -1,29 +0,0 @@ --- ======================================================================== --- Copyright (C) 2005 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- -create table llx_telephonie_commission ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - date varchar(6), - fk_distributeur integer, - montant real - -)type=innodb; diff --git a/htdocs/telephonie/sql/llx_telephonie_commission_avance.sql b/htdocs/telephonie/sql/llx_telephonie_commission_avance.sql deleted file mode 100644 index 15cd365b151..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_commission_avance.sql +++ /dev/null @@ -1,35 +0,0 @@ --- ======================================================================== --- Copyright (C) 2005 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- -create table llx_telephonie_commission_avance ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - date varchar(6), - fk_distributeur integer NOT NULL, - fk_po integer NOT NULL, - fk_contrat integer NOT NULL, - pourcentage real, - montant real, - avance tinyint default 0, - - unique (date, fk_po) - -)type=innodb; diff --git a/htdocs/telephonie/sql/llx_telephonie_commission_conso.sql b/htdocs/telephonie/sql/llx_telephonie_commission_conso.sql deleted file mode 100644 index a4ed377e332..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_commission_conso.sql +++ /dev/null @@ -1,36 +0,0 @@ --- ======================================================================== --- Copyright (C) 2005 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- -create table llx_telephonie_commission_conso ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - date varchar(6), - fk_distributeur integer NOT NULL, - fk_contrat integer NOT NULL, - fk_ligne integer NOT NULL, - pourcentage real, - montant real, - annul tinyint DEFAULT 0, -- indique si les comm sont annulées - avance tinyint DEFAULT 1, -- indique si les comm sont dans la période de l'avance - - UNIQUE (date, fk_ligne) - -)type=innodb; diff --git a/htdocs/telephonie/sql/llx_telephonie_commission_detail.sql b/htdocs/telephonie/sql/llx_telephonie_commission_detail.sql deleted file mode 100644 index 5edbd69eaf9..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_commission_detail.sql +++ /dev/null @@ -1,32 +0,0 @@ --- ======================================================================== --- Copyright (C) 2005 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- -create table llx_telephonie_commission_detail ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - date varchar(6), - fk_distributeur integer, - fk_contrat integer, - pourcentage real, - montant real, - avance tinyint default 0 - -)type=innodb; diff --git a/htdocs/telephonie/sql/llx_telephonie_commission_regul.sql b/htdocs/telephonie/sql/llx_telephonie_commission_regul.sql deleted file mode 100644 index d90c0c21086..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_commission_regul.sql +++ /dev/null @@ -1,31 +0,0 @@ --- ======================================================================== --- Copyright (C) 2005 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- -create table llx_telephonie_commission_regul ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - date varchar(6), - fk_distributeur integer NOT NULL, - fk_contrat integer NOT NULL, - fk_ligne integer NOT NULL, - montant real, - type varchar(4) -)type=innodb; diff --git a/htdocs/telephonie/sql/llx_telephonie_communications_details.sql b/htdocs/telephonie/sql/llx_telephonie_communications_details.sql deleted file mode 100644 index f96c6f29b6d..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_communications_details.sql +++ /dev/null @@ -1,54 +0,0 @@ --- ======================================================================== --- Copyright (C) 2005-2007 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- --- Communications téléphoniques traitées - -create table llx_telephonie_communications_details ( - fk_ligne integer, - ligne varchar(255) NOT NULL, - date datetime, - numero varchar(255), - dest varchar(255), - dureetext varchar(255), - fourn_cout varchar(255), - fourn_montant real, - duree integer, -- duree en secondes - tarif_achat_temp real, - tarif_achat_fixe real, - tarif_vente_temp real, - tarif_vente_fixe real, - cout_achat real, - cout_vente real, - remise real, - fichier_cdr varchar(255), - fk_fournisseur integer, - fk_telephonie_facture integer, - ym char(4), - num_prefix char(2), - - key (fk_fournisseur), - key (fk_ligne), - key (fk_telephonie_facture), - key (ym), - key (num_prefix) - -)type=innodb; diff --git a/htdocs/telephonie/sql/llx_telephonie_concurrents.sql b/htdocs/telephonie/sql/llx_telephonie_concurrents.sql deleted file mode 100644 index aaa8c6e95df..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_concurrents.sql +++ /dev/null @@ -1,28 +0,0 @@ --- ======================================================================== --- Copyright (C) 2004-2007 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== - -create table llx_telephonie_concurrents ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - nom varchar(255) NOT NULL, - active smallint DEFAULT 1 - -)type=innodb; diff --git a/htdocs/telephonie/sql/llx_telephonie_contact_facture.key.sql b/htdocs/telephonie/sql/llx_telephonie_contact_facture.key.sql deleted file mode 100644 index e4795d7c9be..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_contact_facture.key.sql +++ /dev/null @@ -1,10 +0,0 @@ --- --- --- --- - -ALTER TABLE llx_telephonie_contact_facture ADD INDEX (fk_contact); -ALTER TABLE llx_telephonie_contact_facture ADD INDEX (fk_ligne); - -ALTER TABLE llx_telephonie_contact_facture ADD CONSTRAINT fk_telephonie_contact_facture_contact FOREIGN KEY (fk_contact) REFERENCES llx_socpeople (rowid); -ALTER TABLE llx_telephonie_contact_facture ADD CONSTRAINT fk_telephonie_contact_facture_ligne FOREIGN KEY (fk_ligne) REFERENCES llx_telephonie_societe_ligne (rowid); diff --git a/htdocs/telephonie/sql/llx_telephonie_contact_facture.sql b/htdocs/telephonie/sql/llx_telephonie_contact_facture.sql deleted file mode 100644 index 5bbdd180254..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_contact_facture.sql +++ /dev/null @@ -1,34 +0,0 @@ --- ======================================================================== --- Copyright (C) 2004 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- --- --- --- --- -create table llx_telephonie_contact_facture ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_contact integer NOT NULL, - fk_ligne integer NOT NULL, - - UNIQUE (fk_contact, fk_ligne) -)type=innodb; - diff --git a/htdocs/telephonie/sql/llx_telephonie_contrat.sql b/htdocs/telephonie/sql/llx_telephonie_contrat.sql deleted file mode 100644 index e472612b095..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_contrat.sql +++ /dev/null @@ -1,51 +0,0 @@ --- ======================================================================== --- Copyright (C) 2005 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- --- -create table llx_telephonie_contrat ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - ref varchar(25) NOT NULL, - - fk_client_comm integer NOT NULL, -- Client décideur - fk_soc integer NOT NULL, -- Client réel (installation, agence) - fk_soc_facture integer NOT NULL, -- Client facturé - - statut smallint DEFAULT 0, - - fk_commercial_sign integer NOT NULL, - fk_commercial_suiv integer NOT NULL, - - fk_user_creat integer, - date_creat datetime, - - isfacturable enum('oui','non') DEFAULT 'oui', - mode_paiement enum('vir','pre') DEFAULT 'pre', - - grille_tarif integer DEFAULT 1, - - note text, - - UNIQUE (ref) - -)type=innodb; - - diff --git a/htdocs/telephonie/sql/llx_telephonie_contrat_consult.sql b/htdocs/telephonie/sql/llx_telephonie_contrat_consult.sql deleted file mode 100644 index 61a8fafebe5..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_contrat_consult.sql +++ /dev/null @@ -1,29 +0,0 @@ --- ======================================================================== --- Copyright (C) 2005 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- --- -create table llx_telephonie_contrat_consult ( - fk_contrat integer, - fk_user integer, - datec timestamp, - action enum('w','r') -)type=MyISAM; diff --git a/htdocs/telephonie/sql/llx_telephonie_contrat_contact_facture.sql b/htdocs/telephonie/sql/llx_telephonie_contrat_contact_facture.sql deleted file mode 100644 index 900e6bda7c6..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_contrat_contact_facture.sql +++ /dev/null @@ -1,35 +0,0 @@ --- ======================================================================== --- Copyright (C) 2004 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- --- --- Contacts à qui sont envoyés les factures --- --- -create table llx_telephonie_contrat_contact_facture ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_contact integer NOT NULL, - fk_contrat integer NOT NULL, - tms timestamp, - - UNIQUE (fk_contact, fk_contrat) -)type=innodb; - diff --git a/htdocs/telephonie/sql/llx_telephonie_contrat_priseordre.sql b/htdocs/telephonie/sql/llx_telephonie_contrat_priseordre.sql deleted file mode 100644 index fdcc38d882d..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_contrat_priseordre.sql +++ /dev/null @@ -1,40 +0,0 @@ --- ======================================================================== --- Copyright (C) 2005-2007 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- --- -create table llx_telephonie_contrat_priseordre ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_contrat integer NOT NULL, - datepo datetime, - montant real NOT NULL, - fk_commercial integer, - fk_distributeur integer, - fk_user integer, - - avance_pourcent real, - avance_duree smallint, - rem_pour_prev real, - rem_pour_autr real, - mode_paiement enum('vir','pre') default 'pre' -)type=innodb; - - diff --git a/htdocs/telephonie/sql/llx_telephonie_contrat_service.sql b/htdocs/telephonie/sql/llx_telephonie_contrat_service.sql deleted file mode 100644 index 10506fa0ef2..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_contrat_service.sql +++ /dev/null @@ -1,36 +0,0 @@ --- ======================================================================== --- Copyright (C) 2005 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- --- -create table llx_telephonie_contrat_service ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_contrat integer NOT NULL, - fk_service integer NOT NULL, - montant real NOT NULL, - - fk_user_creat integer NOT NULL, - date_creat datetime NOT NULL, - fk_user_modif integer, - date_modif datetime -)type=innodb; - - diff --git a/htdocs/telephonie/sql/llx_telephonie_distributeur.sql b/htdocs/telephonie/sql/llx_telephonie_distributeur.sql deleted file mode 100644 index 88a8e9cec7a..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_distributeur.sql +++ /dev/null @@ -1,35 +0,0 @@ --- ======================================================================== --- Copyright (C) 2005 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- -create table llx_telephonie_distributeur ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - nom varchar(50) NOT NULL, - grille_tarif integer DEFAULT 1, - - avance_pourcent real, - avance_duree smallint, - rem_pour_prev real, - rem_pour_autr real, - - fk_user_create integer, - date_create datetime -)type=innodb; diff --git a/htdocs/telephonie/sql/llx_telephonie_distributeur_commerciaux.key.sql b/htdocs/telephonie/sql/llx_telephonie_distributeur_commerciaux.key.sql deleted file mode 100644 index 9b43f58840b..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_distributeur_commerciaux.key.sql +++ /dev/null @@ -1,35 +0,0 @@ --- ======================================================================== --- Copyright (C) 2005 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- --- -ALTER TABLE llx_telephonie_distributeur_commerciaux ADD INDEX (fk_distributeur); -ALTER TABLE llx_telephonie_distributeur_commerciaux ADD INDEX (fk_user); - --- --- -ALTER TABLE llx_telephonie_distributeur_commerciaux ADD FOREIGN KEY (fk_distributeur) -REFERENCES llx_telephonie_distributeur (rowid); - -ALTER TABLE llx_telephonie_distributeur_commerciaux ADD FOREIGN KEY (fk_user) -REFERENCES llx_user (rowid); - - diff --git a/htdocs/telephonie/sql/llx_telephonie_distributeur_commerciaux.sql b/htdocs/telephonie/sql/llx_telephonie_distributeur_commerciaux.sql deleted file mode 100644 index 22a4faf3c21..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_distributeur_commerciaux.sql +++ /dev/null @@ -1,28 +0,0 @@ --- ======================================================================== --- Copyright (C) 2005 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- -create table llx_telephonie_distributeur_commerciaux ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_distributeur integer NOT NULL, - fk_user integer NOT NULL - -)type=innodb; diff --git a/htdocs/telephonie/sql/llx_telephonie_distributeur_responsable.sql b/htdocs/telephonie/sql/llx_telephonie_distributeur_responsable.sql deleted file mode 100644 index 02439689171..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_distributeur_responsable.sql +++ /dev/null @@ -1,28 +0,0 @@ --- ======================================================================== --- Copyright (C) 2005 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- -create table llx_telephonie_distributeur_responsable ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_distributeur integer NOT NULL, - fk_user integer NOT NULL - -)type=innodb; diff --git a/htdocs/telephonie/sql/llx_telephonie_facturation_batch.sql b/htdocs/telephonie/sql/llx_telephonie_facturation_batch.sql deleted file mode 100644 index d96d2279f48..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_facturation_batch.sql +++ /dev/null @@ -1,32 +0,0 @@ --- ======================================================================== --- Copyright (C) 2004-2005 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- --- Batch de facturation --- - -create table llx_telephonie_facturation_batch ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - date_batch datetime - -)type=innodb; - - diff --git a/htdocs/telephonie/sql/llx_telephonie_facture.key.sql b/htdocs/telephonie/sql/llx_telephonie_facture.key.sql deleted file mode 100644 index 8c5c7464247..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_facture.key.sql +++ /dev/null @@ -1,32 +0,0 @@ --- ======================================================================== --- Copyright (C) 2004 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- --- -ALTER TABLE llx_telephonie_facture ADD INDEX (fk_contrat); -ALTER TABLE llx_telephonie_facture ADD INDEX (fk_facture); -ALTER TABLE llx_telephonie_facture ADD INDEX (fk_ligne); --- --- -ALTER TABLE llx_telephonie_facture ADD FOREIGN KEY (fk_facture) REFERENCES llx_facture (rowid); - -ALTER TABLE llx_telephonie_facture ADD FOREIGN KEY (fk_ligne) REFERENCES llx_telephonie_societe_ligne (rowid); - diff --git a/htdocs/telephonie/sql/llx_telephonie_facture.sql b/htdocs/telephonie/sql/llx_telephonie_facture.sql deleted file mode 100644 index 8d5bbca90ad..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_facture.sql +++ /dev/null @@ -1,43 +0,0 @@ --- ======================================================================== --- Copyright (C) 2004-2005 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- --- Factures de téléphonie --- - -create table llx_telephonie_facture ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_contrat integer NOT NULL, - fk_ligne integer NOT NULL, - ligne varchar(255) NOT NULL, - date varchar(255) NOT NULL, - fourn_montant real, -- montant donné par le fournisseur - cout_achat real, -- cout calculé sur le fournisseur - cout_vente real, -- cout de vente - remise real, - cout_vente_remise real, - gain real, - isfacturable enum('oui','non') DEFAULT 'oui', - fk_facture integer, - fk_batch integer NOT NULL - -)type=innodb; - diff --git a/htdocs/telephonie/sql/llx_telephonie_facture_consol.key.sql b/htdocs/telephonie/sql/llx_telephonie_facture_consol.key.sql deleted file mode 100644 index 29495ceabac..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_facture_consol.key.sql +++ /dev/null @@ -1,32 +0,0 @@ --- ======================================================================== --- Copyright (C) 2006 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- --- Consolidation des factures de téléphonie --- - -ALTER TABLE llx_telephonie_facture_consol ADD INDEX (groupe); -ALTER TABLE llx_telephonie_facture_consol ADD INDEX (agence); -ALTER TABLE llx_telephonie_facture_consol ADD INDEX (ligne); -ALTER TABLE llx_telephonie_facture_consol ADD INDEX (statut); -ALTER TABLE llx_telephonie_facture_consol ADD INDEX (repre); -ALTER TABLE llx_telephonie_facture_consol ADD INDEX (distri); -ALTER TABLE llx_telephonie_facture_consol ADD INDEX (repre_ib); diff --git a/htdocs/telephonie/sql/llx_telephonie_facture_consol.sql b/htdocs/telephonie/sql/llx_telephonie_facture_consol.sql deleted file mode 100644 index ab1647e3d64..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_facture_consol.sql +++ /dev/null @@ -1,58 +0,0 @@ --- ======================================================================== --- Copyright (C) 2006 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- --- Consolidation des factures de téléphonie --- - -create table llx_telephonie_facture_consol ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - groupe varchar(255), - agence varchar(255), - ligne varchar(255) NOT NULL, - statut varchar(255) NOT NULL, - fixe_m0 real, - mobi_m0 real, - paye_m0 enum('oui','non'), - fixe_m1 real, - mobi_m1 real, - paye_m1 enum('oui','non'), - fixe_m2 real, - mobi_m2 real, - paye_m2 enum('oui','non'), - fixe_m3 real, - mobi_m3 real, - paye_m3 enum('oui','non'), - fixe_m4 real, - mobi_m4 real, - paye_m4 enum('oui','non'), - fixe_m5 real, - mobi_m5 real, - paye_m5 enum('oui','non'), - fixe_m6 real, - mobi_m6 real, - paye_m6 enum('oui','non'), - repre varchar(255), - distri varchar(255), - repre_ib varchar(255), - fournisseur char(3) -)type=MyISAM; - diff --git a/htdocs/telephonie/sql/llx_telephonie_fournisseur.sql b/htdocs/telephonie/sql/llx_telephonie_fournisseur.sql deleted file mode 100644 index ded5bd8131d..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_fournisseur.sql +++ /dev/null @@ -1,36 +0,0 @@ --- ======================================================================== --- Copyright (C) 2004-2007 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== - -create table llx_telephonie_fournisseur ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - nom varchar(255), - num_client varchar(255), - email_commande varchar(255), - - commande_active tinyint default 0, - commande_bloque tinyint default 0, - - class_commande varchar(25), -- nom de la classe utilisée pour la commande - cdrformat varchar(25), -- nom du format de CDR - fk_tarif_grille integer - -)type=innodb; diff --git a/htdocs/telephonie/sql/llx_telephonie_fournisseur_consol.sql b/htdocs/telephonie/sql/llx_telephonie_fournisseur_consol.sql deleted file mode 100644 index 415742c2beb..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_fournisseur_consol.sql +++ /dev/null @@ -1,33 +0,0 @@ --- ======================================================================== --- Copyright (C) 2006 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- --- Consolidation des fournisseurs de téléphonie --- - -create table llx_telephonie_fournisseur_consol ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - nom char(3), - mois char(4), - montant integer - -)type=MyISAM; - diff --git a/htdocs/telephonie/sql/llx_telephonie_groupe_ligne.key.sql b/htdocs/telephonie/sql/llx_telephonie_groupe_ligne.key.sql deleted file mode 100644 index 2be09789979..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_groupe_ligne.key.sql +++ /dev/null @@ -1,37 +0,0 @@ --- ======================================================================== --- Copyright (C) 2004 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- --- Groupe de lignes --- --- --- - -ALTER TABLE llx_telephonie_groupe_ligne ADD INDEX (fk_groupe); -ALTER TABLE llx_telephonie_groupe_ligne ADD INDEX (fk_ligne); -ALTER TABLE llx_telephonie_groupe_ligne ADD INDEX (fk_user); - -ALTER TABLE llx_telephonie_groupe_ligne ADD FOREIGN KEY (fk_groupe) REFERENCES llx_telephonie_groupeligne(rowid); -ALTER TABLE llx_telephonie_groupe_ligne ADD FOREIGN KEY (fk_ligne) REFERENCES llx_telephonie_societe_ligne(rowid); - -ALTER TABLE llx_telephonie_groupe_ligne ADD FOREIGN KEY (fk_user) REFERENCES llx_user(rowid); - - diff --git a/htdocs/telephonie/sql/llx_telephonie_groupe_ligne.sql b/htdocs/telephonie/sql/llx_telephonie_groupe_ligne.sql deleted file mode 100644 index b003f054b39..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_groupe_ligne.sql +++ /dev/null @@ -1,35 +0,0 @@ --- ======================================================================== --- Copyright (C) 2004 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- --- Groupe de lignes --- --- --- - -create table llx_telephonie_groupe_ligne ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_groupe integer NOT NULL, -- groupe - fk_ligne integer NOT NULL, -- ligne - fk_user integer NOT NULL, - - UNIQUE INDEX(fk_groupe, fk_ligne) -)type=innodb; diff --git a/htdocs/telephonie/sql/llx_telephonie_groupeligne.sql b/htdocs/telephonie/sql/llx_telephonie_groupeligne.sql deleted file mode 100644 index 67207f65b53..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_groupeligne.sql +++ /dev/null @@ -1,32 +0,0 @@ --- ======================================================================== --- Copyright (C) 2004 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- --- Groupe de lignes --- --- --- -create table llx_telephonie_groupeligne ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - nom varchar(255), - - UNIQUE INDEX(nom) -)type=innodb; diff --git a/htdocs/telephonie/sql/llx_telephonie_import_cdr.sql b/htdocs/telephonie/sql/llx_telephonie_import_cdr.sql deleted file mode 100644 index 14281359578..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_import_cdr.sql +++ /dev/null @@ -1,41 +0,0 @@ --- ======================================================================== --- Copyright (C) 2004-2005 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== - -create table llx_telephonie_import_cdr ( - idx integer, - fk_ligne integer NOT NULL, - ligne varchar(255) NOT NULL, - date varchar(255) NOT NULL, - heure varchar(255) NOT NULL, - num varchar(255) NOT NULL, - dest varchar(255) NOT NULL, - dureetext varchar(255) NOT NULL, - tarif varchar(255) NOT NULL, - montant real NOT NULL, - duree integer NOT NULL, - fichier varchar(255) NOT NULL, - fk_fournisseur integer NOT NULL, - - key (ligne) - -)type=innodb; - diff --git a/htdocs/telephonie/sql/llx_telephonie_ligne_statistique.sql b/htdocs/telephonie/sql/llx_telephonie_ligne_statistique.sql deleted file mode 100644 index 7d7d6f2911f..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_ligne_statistique.sql +++ /dev/null @@ -1,12 +0,0 @@ --- --- --- --- -create table llx_telephonie_ligne_statistique ( - dates date, - statut smallint, - nb integer, - - UNIQUE (dates, statut) -)type=innodb; - diff --git a/htdocs/telephonie/sql/llx_telephonie_prefix.key.sql b/htdocs/telephonie/sql/llx_telephonie_prefix.key.sql deleted file mode 100644 index ea882f2b317..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_prefix.key.sql +++ /dev/null @@ -1,26 +0,0 @@ --- ======================================================================== --- Copyright (C) 2004 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- - -ALTER TABLE llx_telephonie_prefix ADD INDEX (fk_tarif); - -ALTER TABLE llx_telephonie_prefix ADD FOREIGN KEY (fk_tarif) REFERENCES llx_telephonie_tarif (rowid); diff --git a/htdocs/telephonie/sql/llx_telephonie_prefix.sql b/htdocs/telephonie/sql/llx_telephonie_prefix.sql deleted file mode 100644 index 5f895ba1904..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_prefix.sql +++ /dev/null @@ -1,31 +0,0 @@ --- ======================================================================== --- Copyright (C) 2004 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- - -create table llx_telephonie_prefix ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_tarif integer NOT NULL, - prefix varchar(10), - - UNIQUE INDEX(prefix) -)type=innodb; - diff --git a/htdocs/telephonie/sql/llx_telephonie_service.sql b/htdocs/telephonie/sql/llx_telephonie_service.sql deleted file mode 100644 index 1fa8a4161ab..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_service.sql +++ /dev/null @@ -1,40 +0,0 @@ --- ======================================================================== --- Copyright (C) 2005 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- --- -create table llx_telephonie_service ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - ref varchar(25) NOT NULL, - - libelle varchar(255), - libelle_facture varchar(255), - montant real NOT NULL, - statut smallint DEFAULT 0 NOT NULL, - - fk_user_creat integer NOT NULL, - date_creat datetime NOT NULL, - fk_user_modif integer, - date_modif datetime, - module varchar(50) -)type=innodb; - - diff --git a/htdocs/telephonie/sql/llx_telephonie_simul.sql b/htdocs/telephonie/sql/llx_telephonie_simul.sql deleted file mode 100644 index 1f9aa6912ba..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_simul.sql +++ /dev/null @@ -1,30 +0,0 @@ --- ======================================================================== --- Copyright (C) 2005 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== - -create table llx_telephonie_simul ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - description text, - cout_achat real, - cout_vente real - -)type=innodb; - diff --git a/htdocs/telephonie/sql/llx_telephonie_simul_comm.sql b/htdocs/telephonie/sql/llx_telephonie_simul_comm.sql deleted file mode 100644 index 235090870cd..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_simul_comm.sql +++ /dev/null @@ -1,39 +0,0 @@ --- ======================================================================== --- Copyright (C) 2005 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== - -create table llx_telephonie_simul_comm ( - fk_simulation integer, - fk_ligne integer, - ligne varchar(255) NOT NULL, - date datetime, - numero varchar(255), - dest varchar(255), - cout_achat real, - cout_vente real, - duree integer, -- duree en secondes - tarif_achat_temp real, - tarif_achat_fixe real, - tarif_vente_temp real, - tarif_vente_fixe real - -)type=innodb; - diff --git a/htdocs/telephonie/sql/llx_telephonie_societe_commentaire.sql b/htdocs/telephonie/sql/llx_telephonie_societe_commentaire.sql deleted file mode 100644 index 6e071f392ce..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_societe_commentaire.sql +++ /dev/null @@ -1,33 +0,0 @@ --- ======================================================================== --- Copyright (C) 2005 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- --- -create table llx_telephonie_societe_commentaire ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_soc integer NOT NULL, - fk_user integer NOT NULL, - datec datetime, - commentaire text - -)type=innodb; - - diff --git a/htdocs/telephonie/sql/llx_telephonie_societe_fournid.sql b/htdocs/telephonie/sql/llx_telephonie_societe_fournid.sql deleted file mode 100644 index 8bab2e3ee25..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_societe_fournid.sql +++ /dev/null @@ -1,34 +0,0 @@ --- ======================================================================== --- Copyright (C) 2005 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- --- -create table llx_telephonie_societe_fournid ( - - fk_soc integer NOT NULL, - fourn_id integer NOT NULL, - fk_fourn integer NOT NULL, - datec datetime, - - unique (fk_soc, fk_fourn) -)type=innodb; - - diff --git a/htdocs/telephonie/sql/llx_telephonie_societe_ligne.key.sql b/htdocs/telephonie/sql/llx_telephonie_societe_ligne.key.sql deleted file mode 100644 index ec06fcf1001..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_societe_ligne.key.sql +++ /dev/null @@ -1,47 +0,0 @@ --- ======================================================================== --- Copyright (C) 2004 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- --- Statut des lignes --- --- 0 a commander --- 1 commandée --- 2 recue --- 3 probleme --- - -ALTER TABLE llx_telephonie_societe_ligne ADD INDEX (fk_fournisseur); -ALTER TABLE llx_telephonie_societe_ligne ADD INDEX (fk_client_comm); -ALTER TABLE llx_telephonie_societe_ligne ADD INDEX (fk_soc); -ALTER TABLE llx_telephonie_societe_ligne ADD INDEX (fk_soc_facture); -ALTER TABLE llx_telephonie_societe_ligne ADD INDEX (fk_user_creat); -ALTER TABLE llx_telephonie_societe_ligne ADD INDEX (fk_user_commande); -ALTER TABLE llx_telephonie_societe_ligne ADD INDEX (fk_commercial); -ALTER TABLE llx_telephonie_societe_ligne ADD INDEX (fk_concurrent); - -ALTER TABLE llx_telephonie_societe_ligne ADD CONSTRAINT llx_telephonie_societe_ligne_fournisseur FOREIGN KEY (fk_fournisseur) REFERENCES llx_telephonie_fournisseur (rowid); -ALTER TABLE llx_telephonie_societe_ligne ADD CONSTRAINT llx_telephonie_societe_ligne_client_comm FOREIGN KEY (fk_client_comm) REFERENCES llx_societe(rowid); -ALTER TABLE llx_telephonie_societe_ligne ADD CONSTRAINT llx_telephonie_societe_ligne_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe(rowid); -ALTER TABLE llx_telephonie_societe_ligne ADD CONSTRAINT llx_telephonie_societe_ligne_soc_facture FOREIGN KEY (fk_soc_facture) REFERENCES llx_societe(rowid); -ALTER TABLE llx_telephonie_societe_ligne ADD CONSTRAINT llx_telephonie_societe_ligne_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid); -ALTER TABLE llx_telephonie_societe_ligne ADD CONSTRAINT llx_telephonie_societe_ligne_user_commande FOREIGN KEY (fk_user_commande) REFERENCES llx_user(rowid); -ALTER TABLE llx_telephonie_societe_ligne ADD CONSTRAINT llx_telephonie_societe_ligne_commercial FOREIGN KEY (fk_commercial) REFERENCES llx_user(rowid); -ALTER TABLE llx_telephonie_societe_ligne ADD CONSTRAINT llx_telephonie_societe_ligne_concurrent FOREIGN KEY (fk_concurrent) REFERENCES llx_telephonie_concurrents (rowid); diff --git a/htdocs/telephonie/sql/llx_telephonie_societe_ligne.sql b/htdocs/telephonie/sql/llx_telephonie_societe_ligne.sql deleted file mode 100644 index a111acd6028..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_societe_ligne.sql +++ /dev/null @@ -1,63 +0,0 @@ --- ======================================================================== --- Copyright (C) 2004 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- --- Statut des lignes --- --- 0 a commander --- 1 commandée --- 2 recue --- 3 probleme --- -create table llx_telephonie_societe_ligne ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - datec datetime, - fk_contrat integer, - fk_client_comm integer NOT NULL, -- Client décideur - fk_soc integer NOT NULL, - ligne varchar(12) NOT NULL, - fk_soc_facture integer NOT NULL, - statut smallint DEFAULT 0, - fk_fournisseur integer NOT NULL, - remise real DEFAULT 0, - note text, - fk_commercial integer NOT NULL, - fk_commercial_sign integer NOT NULL, - fk_commercial_suiv integer NOT NULL, - fk_concurrent integer DEFAULT 1 NOT NULL, - fk_user_creat integer, - date_commande datetime, - date_commande_last datetime, - fk_user_commande integer, - isfacturable enum('oui','non') DEFAULT 'oui', - mode_paiement enum('vir','pre') DEFAULT 'pre', - - code_analytique varchar(12), - - pdfdetail varchar(50) DEFAULT 'standard' NOT NULL, - techno enum('voip','presel') default 'presel', - support enum('unk','ndi','sda','rtc','nap') default 'unk', - last_comm_date datetime, - - UNIQUE INDEX(fk_soc, ligne) -)type=innodb; - - diff --git a/htdocs/telephonie/sql/llx_telephonie_societe_ligne_comments.sql b/htdocs/telephonie/sql/llx_telephonie_societe_ligne_comments.sql deleted file mode 100644 index 12a213d6f58..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_societe_ligne_comments.sql +++ /dev/null @@ -1,34 +0,0 @@ --- ======================================================================== --- Copyright (C) 2006 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- --- -create table llx_telephonie_societe_ligne_comments ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_ligne integer NOT NULL, - fk_user integer NOT NULL, - datec datetime, - commentaire text, - - INDEX (fk_ligne) -)type=innodb; - - diff --git a/htdocs/telephonie/sql/llx_telephonie_societe_ligne_remise.sql b/htdocs/telephonie/sql/llx_telephonie_societe_ligne_remise.sql deleted file mode 100644 index fd5529133b9..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_societe_ligne_remise.sql +++ /dev/null @@ -1,35 +0,0 @@ --- ======================================================================== --- Copyright (C) 2004 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- --- Log de la remise sur les lignes --- - -create table llx_telephonie_societe_ligne_remise ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - tms datetime, - fk_ligne integer NOT NULL, - remise real NOT NULL, - fk_user integer, - comment varchar(255) - -)type=innodb; - diff --git a/htdocs/telephonie/sql/llx_telephonie_societe_ligne_statut.key.sql b/htdocs/telephonie/sql/llx_telephonie_societe_ligne_statut.key.sql deleted file mode 100644 index a799a380228..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_societe_ligne_statut.key.sql +++ /dev/null @@ -1,27 +0,0 @@ --- ======================================================================== --- Copyright (C) 2004 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== - -ALTER TABLE llx_telephonie_societe_ligne_statut ADD INDEX (fk_ligne); -ALTER TABLE llx_telephonie_societe_ligne_statut ADD INDEX (fk_user); - -ALTER TABLE llx_telephonie_societe_ligne_statut ADD FOREIGN KEY (fk_ligne) REFERENCES llx_telephonie_societe_ligne(rowid); -ALTER TABLE llx_telephonie_societe_ligne_statut ADD FOREIGN KEY (fk_user) REFERENCES llx_user(rowid); diff --git a/htdocs/telephonie/sql/llx_telephonie_societe_ligne_statut.sql b/htdocs/telephonie/sql/llx_telephonie_societe_ligne_statut.sql deleted file mode 100644 index fa607eefe30..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_societe_ligne_statut.sql +++ /dev/null @@ -1,41 +0,0 @@ --- ======================================================================== --- Copyright (C) 2004 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- --- Statut des lignes --- --- 0 a commander --- 1 commandée --- 2 recue --- 3 probleme --- - -create table llx_telephonie_societe_ligne_statut ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - tms datetime, - fk_ligne integer NOT NULL, - statut smallint NOT NULL, - fk_user integer, - comment varchar(255), - fk_fournisseur integer - -)type=innodb; - diff --git a/htdocs/telephonie/sql/llx_telephonie_societe_options.sql b/htdocs/telephonie/sql/llx_telephonie_societe_options.sql deleted file mode 100644 index 8d391c2f272..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_societe_options.sql +++ /dev/null @@ -1,35 +0,0 @@ --- ======================================================================== --- Copyright (C) 2005 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- --- -create table llx_telephonie_societe_options ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - datec datetime, - fk_client_comm integer NOT NULL, -- Client décideur - - type enum('ligne','contrat'), - propriete varchar(255), - valeur varchar(255) - -)type=innodb; - - diff --git a/htdocs/telephonie/sql/llx_telephonie_stats.sql b/htdocs/telephonie/sql/llx_telephonie_stats.sql deleted file mode 100644 index b1b69660e62..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_stats.sql +++ /dev/null @@ -1,34 +0,0 @@ --- ======================================================================== --- Copyright (C) 2005 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- --- -create table llx_telephonie_stats ( - graph varchar(255), - ord smallint, - legend varchar(255), - valeur varchar(255), - - index(graph) - -)type=innodb; - - diff --git a/htdocs/telephonie/sql/llx_telephonie_stats_destination.sql b/htdocs/telephonie/sql/llx_telephonie_stats_destination.sql deleted file mode 100644 index 24e335ea64f..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_stats_destination.sql +++ /dev/null @@ -1,32 +0,0 @@ --- ======================================================================== --- Copyright (C) 2005 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- --- -create table llx_telephonie_stats_destination ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - destination varchar(255), - nbappels real, - ca real - -)type=innodb; - - diff --git a/htdocs/telephonie/sql/llx_telephonie_tarif.sql b/htdocs/telephonie/sql/llx_telephonie_tarif.sql deleted file mode 100644 index 58d803e9fa7..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_tarif.sql +++ /dev/null @@ -1,35 +0,0 @@ --- ======================================================================== --- Copyright (C) 2005 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- --- --- tlink lien vers un tarif, permets la mise à jour par exemple de tous les tarifs --- découpés par pays. - -create table llx_telephonie_tarif ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - libelle varchar(255), - type enum ('INT','NAT','MOB'), - tlink integer DEFAULT 0, - - UNIQUE INDEX(libelle) -)type=innodb; - diff --git a/htdocs/telephonie/sql/llx_telephonie_tarif_client.key.sql b/htdocs/telephonie/sql/llx_telephonie_tarif_client.key.sql deleted file mode 100644 index 237cc78cd5a..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_tarif_client.key.sql +++ /dev/null @@ -1,31 +0,0 @@ --- ======================================================================== --- Copyright (C) 2004 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- --- - -ALTER TABLE llx_telephonie_tarif_client ADD INDEX (fk_tarif); -ALTER TABLE llx_telephonie_tarif_client ADD INDEX (fk_client); -ALTER TABLE llx_telephonie_tarif_client ADD INDEX (fk_user); - -ALTER TABLE llx_telephonie_tarif_client ADD CONSTRAINT llx_telephonie_tarif_client_tarif FOREIGN KEY (fk_tarif) REFERENCES llx_telephonie_tarif (rowid); -ALTER TABLE llx_telephonie_tarif_client ADD CONSTRAINT llx_telephonie_tarif_client_client FOREIGN KEY (fk_client) REFERENCES llx_societe (rowid); -ALTER TABLE llx_telephonie_tarif_client ADD CONSTRAINT llx_telephonie_tarif_client_user FOREIGN KEY (fk_user) REFERENCES llx_user (rowid); diff --git a/htdocs/telephonie/sql/llx_telephonie_tarif_client.sql b/htdocs/telephonie/sql/llx_telephonie_tarif_client.sql deleted file mode 100644 index 0809ae4a3bf..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_tarif_client.sql +++ /dev/null @@ -1,33 +0,0 @@ --- ======================================================================== --- Copyright (C) 2004 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- --- -create table llx_telephonie_tarif_client ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_tarif integer NOT NULL, - fk_client integer NOT NULL, - temporel real default 0, - fixe real default 0, - fk_user integer NOT NULL, - - UNIQUE INDEX(fk_tarif, fk_client) -)type=innodb; diff --git a/htdocs/telephonie/sql/llx_telephonie_tarif_client_log.sql b/htdocs/telephonie/sql/llx_telephonie_tarif_client_log.sql deleted file mode 100644 index 0208faf6758..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_tarif_client_log.sql +++ /dev/null @@ -1,32 +0,0 @@ --- ======================================================================== --- Copyright (C) 2005 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- --- -create table llx_telephonie_tarif_client_log ( - fk_tarif integer NOT NULL, - fk_client integer NOT NULL, - temporel real default 0, - fixe real default 0, - fk_user integer NOT NULL, - datec datetime - -)type=innodb; diff --git a/htdocs/telephonie/sql/llx_telephonie_tarif_fournisseur.key.sql b/htdocs/telephonie/sql/llx_telephonie_tarif_fournisseur.key.sql deleted file mode 100644 index a22383eee69..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_tarif_fournisseur.key.sql +++ /dev/null @@ -1,29 +0,0 @@ --- ======================================================================== --- Copyright (C) 2004 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- - -ALTER TABLE llx_telephonie_tarif_fournisseur ADD INDEX (fk_tarif); -ALTER TABLE llx_telephonie_tarif_fournisseur ADD INDEX (fk_fournisseur); - -ALTER TABLE llx_telephonie_tarif_fournisseur ADD FOREIGN KEY (fk_tarif) REFERENCES llx_telephonie_tarif (rowid); -ALTER TABLE llx_telephonie_tarif_fournisseur ADD FOREIGN KEY (fk_fournisseur) REFERENCES llx_telephonie_fournisseur (rowid); --- diff --git a/htdocs/telephonie/sql/llx_telephonie_tarif_fournisseur.sql b/htdocs/telephonie/sql/llx_telephonie_tarif_fournisseur.sql deleted file mode 100644 index 9a101c2e26d..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_tarif_fournisseur.sql +++ /dev/null @@ -1,32 +0,0 @@ --- ======================================================================== --- Copyright (C) 2004 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- -create table llx_telephonie_tarif_fournisseur ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_tarif integer NOT NULL, - fk_fournisseur integer NOT NULL, - temporel real default 0, - fixe real default 0, - - UNIQUE INDEX(fk_tarif, fk_fournisseur) -)type=innodb; - diff --git a/htdocs/telephonie/sql/llx_telephonie_tarif_grille.sql b/htdocs/telephonie/sql/llx_telephonie_tarif_grille.sql deleted file mode 100644 index 867dff35219..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_tarif_grille.sql +++ /dev/null @@ -1,29 +0,0 @@ --- ======================================================================== --- Copyright (C) 2005-2007 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- --- -create table llx_telephonie_tarif_grille ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - libelle varchar(255), - type_tarif enum('achat','vente') - -)type=innodb; diff --git a/htdocs/telephonie/sql/llx_telephonie_tarif_grille_commerciaux.sql b/htdocs/telephonie/sql/llx_telephonie_tarif_grille_commerciaux.sql deleted file mode 100644 index 43d1f4b1a35..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_tarif_grille_commerciaux.sql +++ /dev/null @@ -1,29 +0,0 @@ --- ======================================================================== --- Copyright (C) 2005 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- --- -create table llx_telephonie_tarif_grille_commerciaux ( - fk_commercial integer, - fk_grille integer, - - unique (fk_commercial, fk_grille) -)type=innodb; diff --git a/htdocs/telephonie/sql/llx_telephonie_tarif_grille_rights.sql b/htdocs/telephonie/sql/llx_telephonie_tarif_grille_rights.sql deleted file mode 100644 index 9ba54b21647..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_tarif_grille_rights.sql +++ /dev/null @@ -1,33 +0,0 @@ --- ======================================================================== --- Copyright (C) 2005 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- --- -create table llx_telephonie_tarif_grille_rights ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_grille integer NOT NULL, - fk_user integer NOT NULL, - pread smallint DEFAULT 0, - pwrite smallint DEFAULT 0, - fk_user_creat integer NOT NULL, - - key (fk_user) -)type=innodb; diff --git a/htdocs/telephonie/sql/llx_telephonie_tarif_montant.key.sql b/htdocs/telephonie/sql/llx_telephonie_tarif_montant.key.sql deleted file mode 100644 index 1422701f224..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_tarif_montant.key.sql +++ /dev/null @@ -1,28 +0,0 @@ --- ======================================================================== --- Copyright (C) 2004 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- --- - -ALTER TABLE llx_telephonie_tarif_montant ADD INDEX (fk_tarif); - -ALTER TABLE llx_telephonie_tarif_montant ADD FOREIGN KEY (fk_tarif) REFERENCES llx_telephonie_tarif (rowid); - diff --git a/htdocs/telephonie/sql/llx_telephonie_tarif_montant.sql b/htdocs/telephonie/sql/llx_telephonie_tarif_montant.sql deleted file mode 100644 index 82850d41325..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_tarif_montant.sql +++ /dev/null @@ -1,41 +0,0 @@ --- ======================================================================== --- Copyright (C) 2004-2007 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- --- - -CREATE TABLE llx_telephonie_tarif_montant ( - rowid int(11) NOT NULL auto_increment, - fk_tarif_desc int(11) NOT NULL default '0', - fk_tarif int(11) NOT NULL default '0', - temporel double default '0', - fixe double default '0', - fk_user int(11) NOT NULL default '0', - tms timestamp(14) NOT NULL, - tmpid int(11) default NULL, - PRIMARY KEY (rowid), - UNIQUE KEY fk_tarif_desc (fk_tarif_desc,fk_tarif) - -) TYPE=InnoDB; - - - - diff --git a/htdocs/telephonie/sql/llx_telephonie_tarif_montant_log.sql b/htdocs/telephonie/sql/llx_telephonie_tarif_montant_log.sql deleted file mode 100644 index bdf80be5031..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_tarif_montant_log.sql +++ /dev/null @@ -1,33 +0,0 @@ --- ======================================================================== --- Copyright (C) 2005 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- --- -create table llx_telephonie_tarif_montant_log ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_tarif_desc integer NOT NULL, - fk_tarif integer NOT NULL, - temporel real default 0, - fixe real default 0, - fk_user integer NOT NULL, - tms timestamp - -)type=innodb; diff --git a/htdocs/telephonie/sql/llx_telephonie_workflow.sql b/htdocs/telephonie/sql/llx_telephonie_workflow.sql deleted file mode 100644 index bbdc7920d7a..00000000000 --- a/htdocs/telephonie/sql/llx_telephonie_workflow.sql +++ /dev/null @@ -1,33 +0,0 @@ --- ======================================================================== --- Copyright (C) 2007 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== - -create table llx_telephonie_workflow ( - module enum('xdsl','pre'), - fk_user integer, - fk_statut integer - - - -)type=innodb; - -ALTER TABLE llx_telephonie_workflow ADD INDEX idx_telephonie_workflow_module (module); -ALTER TABLE llx_telephonie_workflow ADD UNIQUE INDEX uk_telephonie_workflow_user_statut (fk_user,fk_statut,module); \ No newline at end of file diff --git a/htdocs/telephonie/sql/llx_vtiger_users.sql b/htdocs/telephonie/sql/llx_vtiger_users.sql deleted file mode 100644 index bc2248a8209..00000000000 --- a/htdocs/telephonie/sql/llx_vtiger_users.sql +++ /dev/null @@ -1,30 +0,0 @@ --- ======================================================================== --- Copyright (C) 2005 Rodolphe Quiedeville --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- --- $Id$ --- $Source$ --- --- ======================================================================== --- --- -create table llx_vtiger_users ( - fk_user integer, - vtiger_id integer - -)type=innodb; - - diff --git a/htdocs/telephonie/stats/ProcessGraphClients.class.php b/htdocs/telephonie/stats/ProcessGraphClients.class.php deleted file mode 100644 index 1e6415828e7..00000000000 --- a/htdocs/telephonie/stats/ProcessGraphClients.class.php +++ /dev/null @@ -1,176 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * - * Generation des graphiques clients - */ - -require ("../../master.inc.php"); - -require_once (DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/facturetel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/telephonie-tarif.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/communication.class.php"); - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/ca.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/gain.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/heureappel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/joursemaine.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/camoyen.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/appelsdureemoyenne.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/comm.nbmensuel.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/comm.nbminutes.class.php"); -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/camenbert.class.php"); - -/* - * Process - * - */ - -class ProcessGraphClients -{ - var $ident; - - function ProcessGraphClients( $ident , $cpc) - { - global $db; - - $this->ident = $ident; - $this->cpc = $cpc; - $this->db = $db; - } - - function go($id=0) - { - $error = 0; - - $img_root = DOL_DATA_ROOT."/graph/telephonie/"; - - $min = $this->ident * $this->cpc; - $max = ($this->ident + 1 ) * $this->cpc; - - /* - * Lecture des clients - * - */ - $sql = "SELECT s.rowid as socid, s.nom, count(l.ligne) as ligne"; - $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; - $sql .= ",".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; - $sql .= " WHERE l.fk_client_comm = s.rowid "; - if ($id == 0) - { - $sql .= " AND s.rowid >= ".$min; - $sql .= " AND s.rowid < ".$max; - } - else - { - $sql .= " AND l.fk_client_comm = ".$id; - } - - $sql .= " GROUP BY s.rowid"; - - $resql = $this->db->query($sql); - - if ($resql) - { - $clients = array(); - - $num = $this->db->num_rows($resql); - - $i = 0; - - while ($i < $num) - { - $obj = $this->db->fetch_object($resql); - $clients[$i] = $obj->socid; - $i++; - } - $this->db->free($resql); - } - else - { - print $sql; - exit("Erreur recuperation des clients"); - } - - if (sizeof($clients)) - { - foreach ($clients as $client) - { - $img_root = DOL_DATA_ROOT."/graph/".substr($client,-1)."/telephonie/client/"; - - $file = $img_root . $client."/graphca.png"; - $graphca = new GraphCa($this->db, $file); - $graphca->client = $client; - $graphca->GraphDraw(); - - $file = $img_root . $client."/graphgain.png"; - - $graphgain = new GraphGain ($this->db, $file); - $graphgain->client = $client; - $graphgain->show_console = 0 ; - $graphgain->GraphDraw(); - - $marge = 0; - - if ($graphgain->total_ca > 0) - { - $marge = ( $graphgain->total_gain / $graphgain->total_ca * 100); - } - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_client_stats (fk_client_comm, gain, ca, cout, marge)"; - $sql .= " VALUES (".$client.",'".ereg_replace(",",".",$graphgain->total_gain)."'"; - $sql .= ",'".ereg_replace(",",".",$graphgain->total_ca)."'"; - $sql .= ",'".ereg_replace(",",".",$graphgain->total_cout)."'"; - $sql .= ",'".ereg_replace(",",".",$marge)."')"; - - if (($graphgain->total_ca * $graphgain->total_gain * $graphgain->total_cout) <> 0) - { - $this->db->query($sql); - } - - - $file = $img_root . $client."/graphappelsdureemoyenne.png"; - - $graphduree = new GraphAppelsDureeMoyenne ($this->db, $file); - $graphduree->client = $client; - $graphduree->show_console = 0 ; - $graphduree->Graph(); - - $file = $img_root . $client."/nb-comm-mensuel.png"; - - $graphx = new GraphCommNbMensuel ($this->db, $file); - $graphx->client = $client; - $graphx->show_console = 0 ; - $graphx->Graph(); - - - $file = $img_root . $client."/nb-minutes-mensuel.png"; - - $graphx = new GraphCommNbMinutes ($this->db, $file); - $graphx->client = $client; - $graphx->show_console = 0 ; - $graphx->Graph(); - - } - } - } -} -?> diff --git a/htdocs/telephonie/stats/ProcessGraphContrats.class.php b/htdocs/telephonie/stats/ProcessGraphContrats.class.php deleted file mode 100644 index 2b45db485ce..00000000000 --- a/htdocs/telephonie/stats/ProcessGraphContrats.class.php +++ /dev/null @@ -1,215 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * - * Generation des graphiques clients - * - * - */ -require ("../../master.inc.php"); - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/SimpleBar.class.php"); - -/* - * Process - * - */ - -class ProcessGraphContrats -{ - var $ident; - - function ProcessGraphContrats( $ident=0 , $cpc=0) - { - global $db; - - $this->ident = $ident; - $this->cpc = $cpc; - $this->db = $db; - $this->messages = array(); - } - - function GenerateAll() - { - $graph_all = 1; - $datetime = time(); - $month = strftime("%m", $datetime); - $year = strftime("%Y", $datetime); - - - if ($month == 1) - { - $month = "12"; - $year = $year - 1; - } - else - { - $month = substr("00".($month - 1), -2) ; - } - - $ym = substr($year,2,2).$month; - - $this->go($row[0], $ym); - - - } - - - function go($contrat_id = 0, $ym=0, $verbose=0) - { - $error = 0; - $contrats = array(); - /* - * Lecture des contrats - * - */ - $sql = "SELECT c.rowid"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat as c"; - - if ($resql = $this->db->query($sql)) - { - while ($row = $this->db->fetch_row($resql)) - { - array_push($contrats, $row[0]); - } - } - - array_push($this->messages,array('info',sizeof($contrats)." contrats a generer")); - - if (sizeof($contrats)) - { - foreach ($contrats as $contrat) - { - $img_root = DOL_DATA_ROOT."/graph/".substr($contrat,-1)."/telephonie/contrat/"; - - if (!is_dir($img_root)) - { - @mkdir(DOL_DATA_ROOT."/graph/".substr($contrat,-1)); - @mkdir(DOL_DATA_ROOT."/graph/".substr($contrat,-1)."/telephonie/"); - @mkdir(DOL_DATA_ROOT."/graph/".substr($contrat,-1)."/telephonie/contrat/"); - @mkdir(DOL_DATA_ROOT."/graph/".substr($contrat,-1)."/telephonie/contrat/".$contrat); - } - /* Lecture des donnees */ - - $this->GetDatas($contrat, $ym); - - if (sizeof($this->labels) > 0) - { - - /* Chiffre d'affaire */ - $file = $img_root . $contrat."/graphca.png"; - - $graph = new DolibarrSimpleBar ($this->db, $file); - $graph->width = 400; - $graph->titre = "Chiffre d'affaire (euros HT)"; - $graph->barcolor = "blue"; - $graph->show_console = 0 ; - $graph->GraphDraw($file, $this->vente, $this->labels); - - /* Gain */ - $file = $img_root . $contrat."/graphgain.png"; - - $graph = new DolibarrSimpleBar ($this->db, $file); - $graph->width = 400; - $graph->titre = "Gain (euros HT)"; - $graph->barcolor = "green"; - $graph->show_console = 0 ; - $graph->GraphDraw($file, $this->gain, $this->labels); - - - /* Duree moyenne des appels */ - $file = $img_root . $contrat."/graphappelsdureemoyenne.png"; - - $graph = new DolibarrSimpleBar ($this->db, $file); - $graph->width = 400; - $graph->titre = "Durée moyenne d'un appel"; - $graph->yAxisLegend = "minutes"; - $graph->barcolor = "orange"; - $graph->show_console = 0 ; - $graph->GraphDraw($file, $this->duree_moyenne, $this->labels); - - /* Nb de communication */ - $file = $img_root . $contrat."/nb-comm-mensuel.png"; - - $graph = new DolibarrSimpleBar ($this->db, $file); - $graph->width = 400; - $graph->titre = "Nombre de communications"; - $graph->barcolor = "yellow"; - $graph->show_console = 0 ; - $graph->GraphDraw($file, $this->nbcomm, $this->labels); - - /* Nb de minutes */ - $file = $img_root . $contrat."/nb-minutes-mensuel.png"; - - $graph = new DolibarrSimpleBar ($this->db, $file); - $graph->width = 400; - $graph->titre = "Nombre de minutes"; - $graph->barcolor = "pink"; - $graph->show_console = 0 ; - $graph->GraphDraw($file, $this->nbminutes, $this->labels); - } - } - } - } - - Function GetDatas($id, $ym) - { - $sql = "SELECT date_format(td.date,'%m'), sum(duree), count(*), sum(cout_vente), sum(fourn_montant)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details as td"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; - $sql .= " WHERE l.fk_contrat='".$id."' AND l.rowid=td.fk_ligne"; - $sql .= " GROUP BY date_format(td.date,'%Y%m') ASC "; - - $this->labels = array(); - $this->vente = array(); - $this->gain = array(); - $this->nbcomm = array(); - $this->nbminutes = array(); - $this->duree_moyenne = array(); - - if ($resql = $this->db->query($sql)) - { - $num = $this->db->num_rows($resql); - $i = 0; - - while ($i < $num) - { - $row = $this->db->fetch_row(); - - $this->labels[$i] = $row[0]; - $this->nbminutes[$i] = ceil($row[1] / 60); - $this->nbcomm[$i] = $row[2]; - $this->duree_moyenne[$i] = ($this->nbminutes[$i] / $this->nbcomm[$i]); - $this->vente[$i] = $row[3]; - $this->gain[$i] = ($row[3] - $row[4]); - - $i++; - } - $this->db->free($resql); - - } - else - { - dol_syslog("Error"); - } - } - -} -?> diff --git a/htdocs/telephonie/stats/ProcessGraphLignes.class.php b/htdocs/telephonie/stats/ProcessGraphLignes.class.php deleted file mode 100644 index e36fc979376..00000000000 --- a/htdocs/telephonie/stats/ProcessGraphLignes.class.php +++ /dev/null @@ -1,218 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - * - * Generation des graphiques de statistiques des lignes - * - * - */ -require ("../../master.inc.php"); - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/SimpleBar.class.php"); - -/* - * Process - * - */ - -class ProcessGraphLignes -{ - var $ident; - - function ProcessGraphLignes($db) - { - global $conf; - $this->messages = array(); - $this->ident = $ident; - $this->cpc = $cpc; - - $this->db = $db; - $this->labels = array(); - $this->nbminutes = array(); - $this->nbcomm = array(); - $this->duree_moyenne = array(); - $this->vente = array(); - $this->gain = array(); - } - - function GenerateAll() - { - $graph_all = 1; - $datetime = time(); - $month = strftime("%m", $datetime); - $year = strftime("%Y", $datetime); - - if ($month == 1) - { - $month = "12"; - $year = $year - 1; - } - else - { - $month = substr("00".($month - 1), -2) ; - } - - $sql = "SELECT distinct(fk_ligne)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; - if ($graph_all == 0) - { - $sql .= " WHERE date_format(date,'%m%Y') = '".$month.$year."'"; - } - - $resql = $this->db->query($sql); - - if ($resql) - { - $num = $this->db->num_rows($resql); - $i = 0; - array_push($this->messages,array('info',"$num lignes trouvees")); - - while ($row = $this->db->fetch_row($resql)) - { - //if ($verbose) - //print substr("0000".($i+1), -4) . "/".substr("0000".$num, -4)."\n"; - - $this->go($row[0]); - - $i++; - } - } - else - { - array_push($this->messages,array('error','SQL Erreur')); - } - } - - - function go($ligne) - { - dol_syslog("go $ligne"); - $this->ligne = $ligne; - - /* Lecture des donnees */ - $this->GetDatas(); - - $error = 0; - - /* Chiffre d'affaire */ - - $img_root = DOL_DATA_ROOT."/graph/".substr($ligne,-1)."/telephonie/ligne/"; - - @mkdir(DOL_DATA_ROOT."/graph/"); - @mkdir(DOL_DATA_ROOT."/graph/".substr($ligne,-1)); - @mkdir(DOL_DATA_ROOT."/graph/".substr($ligne,-1)."/telephonie/"); - @mkdir(DOL_DATA_ROOT."/graph/".substr($ligne,-1)."/telephonie/ligne/"); - - $file = $img_root . $ligne."/graphca.png"; - - @mkdir(DOL_DATA_ROOT."/graph/".substr($ligne,-1)."/telephonie/ligne/".$ligne); - - $graphx = new DolibarrSimpleBar ($this->db, $file); - $graphx->ligne = $ligne; - $graphx->width = 400; - $graphx->titre = "Chiffre d'affaire (euros HT)"; - $graphx->barcolor = "blue"; - $graphx->show_console = 0 ; - $graphx->GraphDraw($file, $this->vente, $this->labels); - - /* Gain */ - - $file = $img_root . $ligne."/graphgain.png"; - - $graphx = new DolibarrSimpleBar ($this->db, $file); - $graphx->ligne = $ligne; - $graphx->width = 400; - $graphx->titre = "Gain (euros HT)"; - $graphx->barcolor = "green"; - $graphx->show_console = 0 ; - $graphx->GraphDraw($file, $this->gain, $this->labels); - - /* Duree moyenne des appels */ - - $file = $img_root . $ligne."/graphappelsdureemoyenne.png"; - - $graphx = new DolibarrSimpleBar ($this->db, $file); - $graphx->ligne = $ligne; - $graphx->width = 400; - $graphx->titre = "Durée moyenne"; - $graphx->barcolor = "orange"; - $graphx->show_console = 0 ; - $graphx->GraphDraw($file, $this->duree_moyenne, $this->labels); - - /* Nb de communication */ - - $file = $img_root . $ligne."/nb-comm-mensuel.png"; - - $graphx = new DolibarrSimpleBar ($this->db, $file); - $graphx->ligne = $ligne; - $graphx->width = 400; - $graphx->titre = "Nombre de communications"; - $graphx->barcolor = "yellow"; - $graphx->show_console = 0 ; - $graphx->GraphDraw($file, $this->nbcomm, $this->labels); - - /* Nb de minutes */ - - $file = $img_root . $ligne."/nb-minutes-mensuel.png"; - - $graphx = new DolibarrSimpleBar ($this->db, $file); - $graphx->ligne = $ligne; - $graphx->width = 400; - $graphx->show_console = 0 ; - $graphx->titre = "Nombre de minutes"; - $graphx->barcolor = "pink"; - $graphx->GraphDraw($file, $this->nbminutes, $this->labels); - } - - Function GetDatas() - { - $sql = "SELECT date_format(td.date,'%m'), sum(duree), count(*), sum(cout_vente), sum(fourn_montant)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details as td"; - $sql .= " WHERE td.fk_ligne = ".$this->ligne; - $sql .= " GROUP BY date_format(td.date,'%Y%m') ASC "; - - if ($this->db->query($sql)) - { - $num = $this->db->num_rows(); - $i = 0; - - while ($i < $num) - { - $row = $this->db->fetch_row(); - - $this->labels[$i] = $row[0]; - - $this->nbminutes[$i] = ceil($row[1] / 60); - $this->nbcomm[$i] = $row[2]; - $this->duree_moyenne[$i] = ($this->nbminutes[$i] / $this->nbcomm[$i]); - $this->vente[$i] = $row[3]; - $this->gain[$i] = ($row[3] - $row[4]); - - $i++; - } - $this->db->free(); - } - else - { - dol_syslog("Error"); - } - } -} -?> diff --git a/htdocs/telephonie/stats/clients/alerte.php b/htdocs/telephonie/stats/clients/alerte.php deleted file mode 100644 index d5083349066..00000000000 --- a/htdocs/telephonie/stats/clients/alerte.php +++ /dev/null @@ -1,132 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; - -if (!$user->rights->telephonie->lire) - accessforbidden(); - -llxHeader('','Telephonie - Statistiques'); - -$h = 0; -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/clients/index.php'; -$head[$h][1] = "Global"; -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/clients/gain.php'; -$head[$h][1] = "Gain"; -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/clients/alerte.php'; -$head[$h][1] = "Alerte"; -$hselected = $h; -$h++; - -dol_fiche_head($head, $hselected, "Clients"); - -if ($_GET["marge"] > 0) -{ - $marge = $_GET["marge"]; -} -else -{ - $marge = TELEPHONIE_MARGE_MINI; -} -print '
'; -print "Clients dont la marge est inférieure à "; - -print ''; -print '%
'; - -print ''; - -print ''; - -print '
'; - -$sql = "SELECT s.nom, tcs.ca, tcs.gain, tcs.cout, tcs.marge, s.rowid"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_client_stats as tcs"; -$sql .= " , " .MAIN_DB_PREFIX."societe as s"; -$sql .= " WHERE s.rowid = tcs.fk_client_comm"; -$sql .= " AND tcs.marge < ". $marge; -$sql .= " GROUP BY tcs.marge DESC"; - -if ($db->query($sql)) -{ - $num = $db->num_rows(); - $i = 0; - - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; - $var=True; - - while ($i < $num) - { - $row = $db->fetch_row($i); - $var=!$var; - - print ""; - print ''."\n"; - - $marge = round($row[4],2); - - if ($marge < 0) - { - print '\n"; - } - else - { - print '\n"; - } - print '\n"; - print '\n"; - print '\n"; - - print "\n"; - $i++; - } - print "
ClientMargeGain TotalVenteAchat
'.$row[0].''; - printf("%.2f",$marge); - print " %'; - printf("%.2f",$marge); - print " %'.price($row[2])." HT'.price($row[1])." HT'.price($row[3])." HT
"; - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - -print '
'; - - - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/stats/clients/clients.month.class.php b/htdocs/telephonie/stats/clients/clients.month.class.php deleted file mode 100644 index 6c3c4681a51..00000000000 --- a/htdocs/telephonie/stats/clients/clients.month.class.php +++ /dev/null @@ -1,165 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/barmoy.class.php"); - -class GraphClientsMonth extends GraphBarMoy { - - Function GraphClientsMonth($DB, $file) - { - $this->db = $DB; - $this->file = $file; - - $this->client = 0; - $this->titre = "Nouveaux clients par mois"; - - $this->barcolor = "blue"; - $this->showframe = true; - } - - Function GraphMakeGraph($commercial=0) - { - $num = 0; - - $sql = "SELECT fk_client_comm, date_format(date_commande,'%Y%m')"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne"; - $sql .= " WHERE date_commande IS NOT NULL "; - - if ($commercial > 0) - { - $sql .= " AND fk_commercial = ".$commercial; - } - - $sql .= " ORDER BY date_format(date_commande,'%Y%m') ASC"; - - $result = $this->db->query($sql); - - if ($result) - { - $num = $this->db->num_rows(); - - $i = 0; - $j = 0; - $datas = array(); - $labels = array(); - $oldweek = 0; - $clients = array(); - - while ($i < $num) - { - $row = $this->db->fetch_row(); - - if ($oldweek == 0) - { - $oldweek = $row[1]; - array_push($clients, $row[0]); - - $datas[$j] = 1; - $labels[$j] = $row[1]; - } - else - { - - if ($row[1] == $labels[$j]) - { - if (! in_array($row[0], $clients)) - { - array_push($clients, $row[0]); - $datas[$j]++; - } - } - else - { - $j++; - if (! in_array($row[0], $clients)) - { - array_push($clients, $row[0]); - $datas[$j] = 1; - } - else - { - $datas[$j] = 0; - } - - $labels[$j] = $row[1]; - } - - } - - $i++; - } - - $this->db->free(); - } - else - { - print $this->db->error() . ' ' . $sql; - } - - $datas_new = array(); - $labels_new = array(); - $j = 0 ; - - $datas_new[0] = $datas[0]; - $labels_new[0] = ceil(substr($labels[0],-2)); - - for ($i = 1 ; $i < sizeof($labels) ; $i++) - { - if (substr($labels[$i], -2) - substr($labels[$i-1], -2) > 1) - { - for ($k = 1 ; $k < ($labels[$i] - $labels[$i-1]) ; $k++) - { - $datas_new[$i+$j] = 0; - $labels_new[$i+$j] = ceil(substr($labels[$i-1], -2) + $k) ; // suppression du 0 - - $j++; - } - } - - $datas_new[$i+$j] = $datas[$i]; - $labels_new[$i+$j] = ceil(substr($labels[$i], - 2)); - } - - $nbel = sizeof($datas_new); - - $moys = array(); - $moys[0] = $datas_new[0]; - $sum = $moys[0]; - - for ($i = 1 ; $i < $nbel ; $i++) - { - $sum = $sum + $datas_new[$i]; - - $moys[$i] = ($sum / ($i+1)); - } - - for ($i = 0 ; $i < ($nbel - 9) ; $i++) - { - array_shift($datas_new); - array_shift($labels_new); - array_shift($moys); - } - - $this->GraphDraw($this->file, $datas_new, $labels_new, $moys); - } -} -?> diff --git a/htdocs/telephonie/stats/clients/clients.week.class.php b/htdocs/telephonie/stats/clients/clients.week.class.php deleted file mode 100644 index 5a7b86416fc..00000000000 --- a/htdocs/telephonie/stats/clients/clients.week.class.php +++ /dev/null @@ -1,185 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require_once DOL_DOCUMENT_ROOT."/telephonie/stats/graph/barmoy.class.php"; -require_once DOL_DOCUMENT_ROOT.'/telephonie/distributeurtel.class.php'; - -class GraphClientsWeek extends GraphBarMoy { - - Function GraphClientsWeek($DB, $file) - { - $this->db = $DB; - $this->file = $file; - - $this->client = 0; - $this->titre = "Nouveaux clients par semaine"; - - $this->barcolor = "yellow"; - $this->showframe = true; - - $this->commercial = 0; - $this->distributeur = 0; - } - - Function GraphMakeGraph($commercial=0) - { - $num = 0; - - $sql = "SELECT l.fk_client_comm, date_format(l.date_commande,'%x%v')"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; - - if ($this->commercial > 0) - { - $sql .= " WHERE l.date_commande IS NOT NULL "; - $sql .= " AND l.fk_commercial_sign = ".$this->commercial; - } - - - if ($this->distributeur > 0) - { - $distri = new DistributeurTelephonie($this->db); - $distri->fetch($this->distributeur); - - $this->titre = $distri->nom . " Nouveaux clients par semaine"; - - $sql .= " , ".MAIN_DB_PREFIX."telephonie_distributeur_commerciaux as dc"; - - $sql .= " WHERE l.date_commande IS NOT NULL "; - $sql .= " AND l.fk_commercial_sign = dc.fk_user"; - $sql .= " AND dc.fk_distributeur = ".$this->distributeur; - } - - - $sql .= " ORDER BY date_format(l.date_commande,'%x%v') ASC"; - - $result = $this->db->query($sql); - - if ($result) - { - $num = $this->db->num_rows(); - - $i = 0; - $j = 0; - $datas = array(); - $labels = array(); - $oldweek = 0; - $clients = array(); - - while ($i < $num) - { - $row = $this->db->fetch_row(); - - if ($oldweek == 0) - { - $oldweek = $row[1]; - array_push($clients, $row[0]); - - $datas[$j] = 1; - $labels[$j] = $row[1]; - } - else - { - - if ($row[1] == $labels[$j]) - { - if (! in_array($row[0], $clients)) - { - array_push($clients, $row[0]); - $datas[$j]++; - } - } - else - { - $j++; - if (! in_array($row[0], $clients)) - { - array_push($clients, $row[0]); - $datas[$j] = 1; - } - else - { - $datas[$j] = 0; - } - - $labels[$j] = $row[1]; - } - - } - - $i++; - } - - $this->db->free(); - } - else - { - print $this->db->error() . ' ' . $sql; - } - - $datas_new = array(); - $labels_new = array(); - $j = 0 ; - - $datas_new[0] = $datas[0]; - $labels_new[0] = ceil(substr($labels[0],-2)); - - for ($i = 1 ; $i < sizeof($labels) ; $i++) - { - if (substr($labels[$i], -2) - substr($labels[$i-1], -2) > 1) - { - for ($k = 1 ; $k < ($labels[$i] - $labels[$i-1]) ; $k++) - { - $datas_new[$i+$j] = 0; - $labels_new[$i+$j] = ceil(substr($labels[$i-1], -2) + $k) ; // suppression du 0 - - $j++; - } - } - - $datas_new[$i+$j] = $datas[$i]; - $labels_new[$i+$j] = ceil(substr($labels[$i], - 2)); - } - - $nbel = sizeof($datas_new); - - $moys = array(); - $moys[0] = $datas_new[0]; - $sum = $moys[0]; - - for ($i = 1 ; $i < $nbel ; $i++) - { - $sum = $sum + $datas_new[$i]; - - $moys[$i] = ($sum / ($i+1)); - } - - for ($i = 0 ; $i < ($nbel - 18) ; $i++) - { - array_shift($datas_new); - array_shift($labels_new); - array_shift($moys); - } - - $this->GraphDraw($this->file, $datas_new, $labels_new, $moys); - } -} -?> diff --git a/htdocs/telephonie/stats/clients/clientsmoyenne.week.class.php b/htdocs/telephonie/stats/clients/clientsmoyenne.week.class.php deleted file mode 100644 index 87af2d78e90..00000000000 --- a/htdocs/telephonie/stats/clients/clientsmoyenne.week.class.php +++ /dev/null @@ -1,169 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/line.class.php"); - -class GraphClientsMoyenneWeek extends GraphLine { - - Function GraphClientsMoyenneWeek($DB, $file) - { - $this->db = $DB; - $this->file = $file; - - $this->client = 0; - $this->titre = "Nouveaux clients par semaine (moyenne)"; - - $this->barcolor = "yellow"; - $this->showframe = true; - $this->LabelInterval = 1; - } - - Function GraphMakeGraph($commercial=0) - { - $num = 0; - - $sql = "SELECT fk_client_comm, date_format(date_commande,'%x%v')"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne"; - $sql .= " WHERE date_commande IS NOT NULL "; - - if ($commercial > 0) - { - $sql .= " AND fk_commercial = ".$commercial; - } - - $sql .= " ORDER BY date_format(date_commande,'%x%v') ASC"; - - $result = $this->db->query($sql); - - if ($result) - { - $num = $this->db->num_rows(); - - $i = 0; - $j = 0; - $datas = array(); - $labels = array(); - $oldweek = 0; - $clients = array(); - - while ($i < $num) - { - $row = $this->db->fetch_row(); - - if ($oldweek == 0) - { - $oldweek = $row[1]; - array_push($clients, $row[0]); - - $datas[$j] = 1; - $labels[$j] = $row[1]; - } - else - { - - if ($row[1] == $labels[$j]) - { - if (! in_array($row[0], $clients)) - { - array_push($clients, $row[0]); - $datas[$j]++; - } - } - else - { - $j++; - if (! in_array($row[0], $clients)) - { - array_push($clients, $row[0]); - $datas[$j] = 1; - } - else - { - $datas[$j] = 0; - } - - $labels[$j] = $row[1]; - } - - } - - $i++; - } - - $this->db->free(); - } - else - { - print $this->db->error() . ' ' . $sql; - } - - $datas_new = array(); - $labels_new = array(); - $j = 0 ; - - $datas_new[0] = $datas[0]; - $labels_new[0] = ceil(substr($labels[0],-2)); - - for ($i = 1 ; $i < sizeof($labels) ; $i++) - { - if (substr($labels[$i], -2) - substr($labels[$i-1], -2) > 1) - { - for ($k = 1 ; $k < ($labels[$i] - $labels[$i-1]) ; $k++) - { - $datas_new[$i+$j] = 0; - $labels_new[$i+$j] = ceil(substr($labels[$i-1], -2) + $k) ; // suppression du 0 - - $j++; - } - } - - $datas_new[$i+$j] = $datas[$i]; - $labels_new[$i+$j] = ceil(substr($labels[$i], - 2)); - } - - $nbel = sizeof($datas_new); - - $moys = array(); - $moys[0] = $datas_new[0]; - $sum = $moys[0]; - - for ($i = 1 ; $i < $nbel ; $i++) - { - $sum = $sum + $datas_new[$i]; - - $moys[$i] = ($sum / ($i+1)); - } - - for ($i = 0 ; $i < ($nbel - 18) ; $i++) - { - array_shift($datas_new); - array_shift($labels_new); - array_shift($moys); - } - - if (sizeof($moys) > 1) - { - $this->GraphDraw($this->file, $moys, $labels_new); - } - } -} -?> diff --git a/htdocs/telephonie/stats/clients/gain.php b/htdocs/telephonie/stats/clients/gain.php deleted file mode 100644 index 550644faeb4..00000000000 --- a/htdocs/telephonie/stats/clients/gain.php +++ /dev/null @@ -1,118 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if (!$user->rights->telephonie->lire) accessforbidden(); - -llxHeader('','Telephonie - Statistiques'); - -$h = 0; -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/clients/index.php'; -$head[$h][1] = "Global"; -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/clients/gain.php'; -$head[$h][1] = "Gain"; -$hselected = $h; -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/clients/alerte.php'; -$head[$h][1] = "Alerte"; -$h++; - -dol_fiche_head($head, $hselected, "Clients"); - -print ''; - -print ''; - -print '
'; - -$page = $_GET["page"]; -$sortfield = $_GET["sortfield"]; -$sortorder = $_GET["sortorder"]; - -if ($sortorder == "") $sortorder="DESC"; -if ($sortfield == "") $sortfield="marge"; - -$sql = "SELECT s.nom, tcs.ca, tcs.gain, tcs.cout, tcs.marge, s.rowid"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_client_stats as tcs"; -$sql .= " , " .MAIN_DB_PREFIX."societe as s"; -$sql .= " WHERE s.rowid = tcs.fk_client_comm"; -$sql .= " ORDER BY $sortfield $sortorder ";// . $db->plimit($conf->liste_limit+1, $offset); - -if ($db->query($sql)) -{ - $num = $db->num_rows(); - $i = 0; - - print ''; - print ''; - print_liste_field_titre("Client","gain.php","s.nom"); - print_liste_field_titre("Marge","gain.php","tcs.marge",'','','align="right"'); - print_liste_field_titre("Gain Total","gain.php","tcs.gain",'','','align="right"'); - print_liste_field_titre("Vente","gain.php","tcs.ca",'','','align="right"'); - print_liste_field_titre("Achat","gain.php","tcs.cout",'','','align="right"'); - print "\n"; - $var=True; - - while ($i < $num) - { - $row = $db->fetch_row($i); - $var=!$var; - - print ""; - print ''."\n"; - - $marge = round($row[4],2); - - if ($marge < 0) - { - print '\n"; - } - else - { - print '\n"; - } - print '\n"; - print '\n"; - print '\n"; - - print "\n"; - $i++; - } - print "
'.$row[0].''.$marge." %'.$marge." %'.price($row[2])." HT'.price($row[1])." HT'.price($row[3])." HT
"; - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - -print '
'; - - - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/stats/clients/index.php b/htdocs/telephonie/stats/clients/index.php deleted file mode 100644 index 0af6ea0b961..00000000000 --- a/htdocs/telephonie/stats/clients/index.php +++ /dev/null @@ -1,133 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if (!$user->rights->telephonie->lire) accessforbidden(); -if (!$user->rights->telephonie->stats->lire) accessforbidden(); - -llxHeader('','Telephonie - Statistiques - Clients'); - - -$h = 0; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/clients/index.php'; -$head[$h][1] = "Global"; -$hselected = $h; -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/clients/gain.php'; -$head[$h][1] = "Gain"; -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/clients/alerte.php'; -$head[$h][1] = "Alerte"; -$h++; - -dol_fiche_head($head, $hselected, "Clients"); - -print ''; - -print ''; - -print '
'; - -print ''; -print ''; -print "\n"; - -$sql = "SELECT distinct l.fk_client_comm "; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; -$sql .= " WHERE statut = 3"; - -if ($db->query($sql)) -{ - $num = $db->num_rows(); - $i = 0; - $nbclient = $num; - - $var=True; - - $row = $db->fetch_row(0); - - print ""; - print "\n"; - print "\n"; - - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - -$sql = "SELECT count(*) "; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; -$sql .= " WHERE statut = 3"; - -if ($db->query($sql)) -{ - $num = $db->num_rows(); - $i = 0; - - $var=False; - - $row = $db->fetch_row(0); - - $nblignes = $row[0]; - - print ""; - print "\n"; - print "\n"; - print "\n"; - - - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - -print ""; -print "\n"; -print "\n"; -print "\n"; - -print "
StatistiquesNb
Nombre de clients".$num."
Nombre de lignes".$row[0]."
Nombre de lignes par clients".round($nblignes / $nbclient, 2)."
"; - -/* - * - * - */ - -print '
'; - -print 'Nouveaux clients par semaines

'."\n"; - -print 'Nouveaux clients par mois

'."\n"; - -print '
'; - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/stats/clients/pre.inc.php b/htdocs/telephonie/stats/clients/pre.inc.php deleted file mode 100644 index 0113ceba653..00000000000 --- a/htdocs/telephonie/stats/clients/pre.inc.php +++ /dev/null @@ -1,42 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("../../../main.inc.php"); - -$user->getrights('telephonie'); - -function llxHeader($head = "", $title="") { - global $user, $conf; - - /* - * - * - */ - top_menu($head, $title); - - $menu = new Menu(); - - include "../menus.php"; - - left_menu($menu->liste); -} - -?> diff --git a/htdocs/telephonie/stats/commerciaux/ca.php b/htdocs/telephonie/stats/commerciaux/ca.php deleted file mode 100644 index fe532f77c0d..00000000000 --- a/htdocs/telephonie/stats/commerciaux/ca.php +++ /dev/null @@ -1,122 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if (!$user->rights->telephonie->lire) accessforbidden(); - -llxHeader('','Telephonie - Statistiques - Commerciaux'); - -/* - * - * - * - */ - -$h = 0; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/commerciaux/index.php'; -$head[$h][1] = "Global"; -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/commerciaux/ca.php'; -$head[$h][1] = "CA"; -$hselected = $h; -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/commerciaux/mensuel.php'; -$head[$h][1] = "Mensuel"; -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/commerciaux/contrats.php'; -$head[$h][1] = "Contrats"; -$h++; - -dol_fiche_head($head, $hselected, "Commerciaux"); - -print ''; -print ''; - -print ''; - - -print '
'; - -$sql = "SELECT date_format(f.date,'%Y%m'), sum(f.cout_vente)"; -$sql .= ", c.name, c.firstname, c.rowid"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture as f"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; -$sql .= " , ".MAIN_DB_PREFIX."user as c"; - -$sql .= " WHERE l.rowid = f.fk_ligne"; -$sql .= " AND l.fk_commercial_sign = c.rowid"; -$sql .= " GROUP BY date_format(f.date,'%Y%m') DESC, c.rowid DESC"; - -print ''; - -print ''; - -$resql = $db->query($sql); -if ($resql) -{ - $num = $db->num_rows(); - $i = 0; - $datas = array(); - $legends = array(); - $total = 0; - while ($i < $num) - { - $row = $db->fetch_row($i); - - $var=!$var; - - print ""; - - print ''; - print ''; - $total += $row[1]; - $i++; - } - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} -$var=!$var; - -print '
NomDate 
'; - print ''.$row[3]." ". $row[2].''.$row[0].''.price($row[1]).'

'; - - - -print '
'; - - -print '
'; - - - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/stats/commerciaux/commercial.ca.class.php b/htdocs/telephonie/stats/commerciaux/commercial.ca.class.php deleted file mode 100644 index 1eedf789eb3..00000000000 --- a/htdocs/telephonie/stats/commerciaux/commercial.ca.class.php +++ /dev/null @@ -1,113 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/bar.class.php"); - -class GraphCommercialChiffreAffaire extends GraphBar { - - Function GraphCommercialChiffreAffaire($DB, $file, $year=0) - { - $this->db = $DB; - $this->file = $file; - $this->year = $year; - $this->client = 0; - $this->titre = "Chiffre d'affaire"; - if ($this->year > 0) - { - $this->titre .= " ".$year; - } - $this->barcolor = "blue"; - $this->showframe = true; - } - - Function GraphMakeGraph($commercial=0) - { - $num = 0; - - if ($commercial > 0) - { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_stats"; - $sql .= " WHERE graph='commercial.ca.mensuel.".$commercial."'"; - if ($this->year > 0) - { - $sql .= " AND legend like '".$this->year."%'"; - } - $resql = $this->db->query($sql); - } - - - $sql = "SELECT date_format(f.date,'%Y%m'), sum(f.cout_vente)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture as f"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; - $sql .= " WHERE l.rowid = f.fk_ligne"; - $sql .= " AND l.fk_commercial_sign = ".$commercial; - if ($this->year > 0) - { - $sql .= " AND date_format(f.date,'%Y')='".$this->year."'"; - } - $sql .= " GROUP BY date_format(f.date,'%Y%m') ASC"; - - $resql = $this->db->query($sql); - - if ($resql) - { - $num = $this->db->num_rows($resql); - $i = 0; - $j = -1; - $datas = array(); - $labels = array(); - - while ($i < $num) - { - $row = $this->db->fetch_row($resql); - - $datas[$i] = $row[1]; - $labels[$i] = substr($row[0],-2); - - if ($commercial > 0) - { - $sqli = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_stats"; - $sqli .= " (graph,ord,legend,valeur)"; - $sqli .= " VALUES ('commercial.ca.mensuel.".$commercial."'"; - $sqli .= ",'$i','".$row[0]."','".$datas[$i]."');"; - $resqli = $this->db->query($sqli); - } - $i++; - } - - $this->db->free($resql); - } - else - { - print $this->db->error() . ' ' . $sql; - } - - if (sizeof($datas)) - { - $this->GraphDraw($this->file, $datas, $labels); - } - - } - -} - -?> diff --git a/htdocs/telephonie/stats/commerciaux/commercial.gain.class.php b/htdocs/telephonie/stats/commerciaux/commercial.gain.class.php deleted file mode 100644 index dc31d63888b..00000000000 --- a/htdocs/telephonie/stats/commerciaux/commercial.gain.class.php +++ /dev/null @@ -1,111 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/bar.class.php"); - -class GraphCommercialGain extends GraphBar { - - Function GraphCommercialGain($DB, $file, $year=0) - { - $this->db = $DB; - $this->file = $file; - $this->year = $year; - $this->client = 0; - $this->titre = "Marge mensuelle"; - if ($this->year > 0) - { - $this->titre = " ".$this->year; - } - $this->barcolor = "pink"; - $this->showframe = true; - } - - Function GraphMakeGraph($commercial=0) - { - $num = 0; - - if ($commercial > 0) - { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_stats"; - $sql .= " WHERE graph='commercial.gain.mensuel.".$commercial."'"; - if ($this->year > 0) - { - $sql .= " AND legend like '".$this->year."%'"; - } - $resql = $this->db->query($sql); - } - - $sql = "SELECT date_format(f.date,'%Y%m'), sum(f.gain)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture as f"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; - $sql .= " WHERE l.rowid = f.fk_ligne"; - $sql .= " AND l.fk_commercial_sign = ".$commercial; - if ($this->year > 0) - { - $sql .= " AND date_format(f.date,'%Y')='".$this->year."'"; - } - $sql .= " GROUP BY date_format(f.date,'%Y%m') ASC"; - - $resql = $this->db->query($sql); - - if ($resql) - { - $num = $this->db->num_rows($resql); - $i = 0; - $j = -1; - $datas = array(); - $labels = array(); - - while ($i < $num) - { - $row = $this->db->fetch_row($resql); - - $datas[$i] = $row[1]; - $labels[$i] = substr($row[0],-2); - - if ($commercial > 0) - { - $sqli = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_stats"; - $sqli .= " (graph,ord,legend,valeur)"; - $sqli .= " VALUES ('commercial.gain.mensuel.".$commercial."'"; - $sqli .= ",'$i','".$row[0]."','".$datas[$i]."');"; - $resqli = $this->db->query($sqli); - } - - $i++; - } - - $this->db->free($resql); - } - else - { - print $this->db->error() . ' ' . $sql; - } - - if (sizeof($datas)) - { - $this->GraphDraw($this->file, $datas, $labels); - } - - } -} -?> diff --git a/htdocs/telephonie/stats/commerciaux/commercial.php b/htdocs/telephonie/stats/commerciaux/commercial.php deleted file mode 100644 index 07387cd6e9b..00000000000 --- a/htdocs/telephonie/stats/commerciaux/commercial.php +++ /dev/null @@ -1,128 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if (!$user->rights->telephonie->lire) accessforbidden(); - -llxHeader('','Telephonie - Statistiques - Commerciaux'); - -/* - * - * - * - */ - - -$h = 0; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/commerciaux/index.php'; -$head[$h][1] = "Global"; -$h++; - -if ($_GET["commid"]) -{ - $comm = new User($db, $_GET["commid"]); - $comm->fetch(); - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/commerciaux/commercial.php?commid='.$comm->id; - $head[$h][1] = $comm->fullname; - $hselected = $h; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/commerciaux/commercialca.php?commid='.$comm->id; - $head[$h][1] = "CA"; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/commerciaux/lignes.php?commid='.$comm->id; - $head[$h][1] = "Lignes"; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/commerciaux/commercialpo.php?commid='.$comm->id; - $head[$h][1] = "Prises d'ordres"; - $h++; - - dol_fiche_head($head, $hselected, "Commerciaux"); - - print ''; - - print ''; - - print '
'; - - print ''; - - print ''; - - $sql = "SELECT count(*) as cc,date_format(date_commande,'%m %Y')"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; - $sql .= " WHERE l.fk_commercial = ".$comm->id; - $sql .= " AND date_commande IS NOT NULL"; - $sql .= " AND l.statut <> 7"; - $sql .= " GROUP BY date_format(date_commande,'%Y/%m') DESC"; - - $result = $db->query($sql); - if ($result) - { - $num = $db->num_rows(); - $i = 0; - $datas = array(); - $legends = array(); - - while ($i < $num) - { - $row = $db->fetch_row($i); - $var=!$var; - - print ""; - print ''; - $i++; - } - $db->free(); - } - else - { - print $db->error() . ' ' . $sql; - } - - print '
NomNb Lignes
'; - print $row[2]." ". $row[1].''.$row[0].'
'; - - print '
'; - - print 'Commandes de lignes par semaine

'."\n"; - - print 'Commandes de lignes par semaine

'."\n"; - - print 'Commandes de lignes par semaine

'."\n"; - - print 'Commandes de ligne par mois

'."\n"; - - - - print '
'; - - $db->close(); - -} - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/stats/commerciaux/commercial.po.class.php b/htdocs/telephonie/stats/commerciaux/commercial.po.class.php deleted file mode 100644 index 6c7d0026223..00000000000 --- a/htdocs/telephonie/stats/commerciaux/commercial.po.class.php +++ /dev/null @@ -1,66 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/bar.class.php"); - -class GraphCommercialPO extends GraphBar { - - Function GraphCommercialPO($DB, $file) - { - $this->db = $DB; - $this->file = $file; - - $this->client = 0; - $this->titre = "Prise d'ordre mensuelle"; - - $this->barcolor = "green"; - $this->showframe = true; - } - - Function GraphMakeGraph($xdatas) - { - $datas = array(); - $labels = array(); - $i = 0; - foreach($xdatas as $key => $value) - { - if ($i > 1 && ((substr($key, -2) - $labels[$i-1]) > 1) ) - { - $datas[$i] = 0; - $labels[$i] = substr("00".($labels[$i-1] + 1), -2); - $i++; - } - $datas[$i] = $value; - $labels[$i] = substr($key, -2); - $i++; - } - - /* Mise en forme de la légende */ - - if (sizeof($datas)) - { - $this->GraphDraw($this->file, $datas, $labels); - } - } -} - -?> diff --git a/htdocs/telephonie/stats/commerciaux/commercialca.php b/htdocs/telephonie/stats/commerciaux/commercialca.php deleted file mode 100644 index d3331f7f725..00000000000 --- a/htdocs/telephonie/stats/commerciaux/commercialca.php +++ /dev/null @@ -1,141 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if (!$user->rights->telephonie->lire) accessforbidden(); - -llxHeader('','Telephonie - Statistiques - Commerciaux'); - -/* - * - */ -$h = 0; - -$year = strftime("%Y",time()); -if (strftime("%m",time()) == 1) -{ - $year = $year -1; -} -if ($_GET["year"] > 0) -{ - $year = $_GET["year"]; -} -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/commerciaux/index.php'; -$head[$h][1] = "Global"; -$h++; - -if ($_GET["commid"]) -{ - $comm = new User($db, $_GET["commid"]); - $comm->fetch(); - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/commerciaux/commercial.php?commid='.$comm->id; - $head[$h][1] = $comm->fullname; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/commerciaux/commercialca.php?commid='.$comm->id; - $head[$h][1] = "CA"; - $hselected = $h; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/commerciaux/lignes.php?commid='.$comm->id; - $head[$h][1] = "Lignes"; - $h++; - - dol_fiche_head($head, $hselected, "Commerciaux"); - stat_year_bar($year); - - print ''; - - print ''; - print '
'; - - print 'Gain mensuel'."\n"; - - print ''; - - print ''; - print ''; - print ''; - - $sql = "SELECT legend, valeur"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_stats"; - $sql .= " WHERE graph = 'commercial.gain.mensuel.".$_GET["commid"]."'"; - $sql .= " AND legend like '".$year."%'"; - $sql .= " ORDER BY legend ASC;"; - $resql = $db->query($sql); - - if ($resql) - { - while ($row = $db->fetch_row($resql)) - { - $var=!$var; - print "'; - print ''; - } - $db->free($resql); - } - else - { - print $db->error() . ' ' . $sql; - } - print '
MoisMarge
".$row[0].''.price($row[1]).'
'; - - print '
'; - - print 'Chiffre d\'affaire mensuel

'."\n"; - - print '
'; - - print ''; - print ''; - print ''; - - $sql = "SELECT legend, valeur"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_stats"; - $sql .= " WHERE graph = 'commercial.ca.mensuel.".$_GET["commid"]."'"; - $sql .= " AND legend like '".$year."%'"; - $sql .= " ORDER BY legend ASC;"; - $resql = $db->query($sql); - - if ($resql) - { - while ($row = $db->fetch_row($resql)) - { - $var=!$var; - print "'; - print ''; - } - $db->free($resql); - } - else - { - print $db->error() . ' ' . $sql; - } - print '
MoisCA
".$row[0].''.price($row[1]).'
'; - print '
'; - - $db->close(); -} - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/stats/commerciaux/commercialpo.php b/htdocs/telephonie/stats/commerciaux/commercialpo.php deleted file mode 100644 index ef3de89700d..00000000000 --- a/htdocs/telephonie/stats/commerciaux/commercialpo.php +++ /dev/null @@ -1,162 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if ($user->distributeur_id && $user->responsable_distributeur_id == 0) -{ - accessforbidden(); -} - -if ($user->distributeur_id) -{ - $_GET["id"] = $user->distributeur_id; -} - -llxHeader(); - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; -$sortfield = $_GET["sortfield"]; -if ($sortorder == "") $sortorder="DESC"; -if ($sortfield == "") $sortfield="p.datepo"; - -/* - * - * - */ - -if ($_GET["commid"]) -{ - $h = 0; - $comm = new User($db, $_GET["commid"]); - $comm->fetch(); - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/commerciaux/commercial.php?commid='.$comm->id; - $head[$h][1] = $comm->fullname; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/commerciaux/commercialca.php?commid='.$comm->id; - $head[$h][1] = "CA"; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/commerciaux/lignes.php?commid='.$comm->id; - $head[$h][1] = "Lignes"; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/commerciaux/commercialpo.php?commid='.$comm->id; - $head[$h][1] = "Prises d'ordres"; - $hselected = $h; - $h++; - - dol_fiche_head($head, $hselected, "Commerciaux"); - - if ($page == -1) { $page = 0 ; } - - $offset = $conf->liste_limit * $page ; - $pageprev = $page - 1; - $pagenext = $page + 1; - - /* - * Mode Liste - * - */ - - $sql = "SELECT s.rowid as socid, s.nom, p.fk_contrat, p.montant, p.avance_duree, p.avance_pourcent"; - $sql .= ", p.rem_pour_prev, p.rem_pour_autr, p.mode_paiement"; - $sql .= " , ".$db->pdate("p.datepo") . " as datepo"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat_priseordre as p"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_contrat as c"; - $sql .= " , ".MAIN_DB_PREFIX."societe as s"; - - $sql .= " WHERE p.fk_commercial =".$_GET["commid"]; - $sql .= " AND c.fk_soc = s.rowid"; - $sql .= " AND p.fk_contrat = c.rowid"; - $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); - - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - - print_barre_liste("Prises d'ordre", $page, "commercialpo.php","&commid=".$_GET["commid"], $sortfield, $sortorder, '', $num); - - print ''; - print ''; - print_liste_field_titre("Client","commercialpo.php","s.nom","","&commid=".$_GET["commid"]); - print_liste_field_titre("Contrat","commercialpo.php","p.fk_contrat","","&commid=".$_GET["commid"]); - print ''; - print ''; - print ''; - print ''; - print "\n"; - - $var=True; - - while ($i < min($num,$conf->liste_limit)) - { - $obj = $db->fetch_object($resql); - $var=!$var; - - print ""; - - print '\n"; - print '\n"; - print '\n"; - - print '\n"; - - print '\n"; - print '\n"; - if ($obj->mode_paiement == 'pre') - { - print '\n"; - print ''; - } - else - { - print '\n"; - print ''; - } - - - print "\n"; - $i++; - } - print "
DateMontantAvance DuréeAvance %Rem %MdP
'; - print img_file(); - print ' '; - - print ''.$obj->nom."'.$obj->fk_contrat."'.strftime("%e %b %Y",$obj->datepo)."'.sprintf("%01.2f",$obj->montant)."'.$obj->avance_duree."'.$obj->avance_pourcent." %'.$obj->rem_pour_prev." %Prelev'.$obj->rem_pour_autr." %Autre
"; - $db->free(); - } - else - { - print $db->error() . ' ' . $sql; - } - -} - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/stats/commerciaux/commerciaux.po.class.php b/htdocs/telephonie/stats/commerciaux/commerciaux.po.class.php deleted file mode 100644 index 871857fa0a5..00000000000 --- a/htdocs/telephonie/stats/commerciaux/commerciaux.po.class.php +++ /dev/null @@ -1,170 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/graph.class.php"); - -class GraphCommerciauxPO { - - Function GraphCommerciauxPO($DB, $file) - { - $this->db = $DB; - $this->file = $file; - - $this->client = 0; - $this->titre = "Prises d'ordre mensuelle"; - $this->showframe = true; - $this->barcolor = array("green","blue","yellow","pink","orange"); - $this->commerciaux = array(2,5,7,18); - } - - Function GraphMakeGraph() - { - $width = 800; - $height = 300; - $graph = new Graph($width, $height,"auto"); - $graph->SetScale("textlin"); - - $graph->yaxis->scale->SetGrace(20); - $graph->SetFrame($this->showframe); - - $graph->img->SetMargin(50,120,20,35); - $gbspl = array(); - $i = 0; - - $sql = "SELECT rowid, firstname, name"; - $sql .= " FROM ".MAIN_DB_PREFIX."user"; - $resql = $this->db->query($sql); - $comm_names = array(); - if ($resql) - { - while ($row = $this->db->fetch_row($resql)) - { - $comm_names[$row[0]]= $row[1];//." ".$row[2]; - } - } - $datetime = time(); - - - $sql = "SELECT date_format(datepo, '%m'), sum(montant)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat_priseordre as p"; - $sql .= " WHERE p.fk_distributeur > 0"; - $sql .= " AND date_format(datepo, '%Y') = '".strftime('%Y',$datetime)."'"; - $sql .= " GROUP BY date_format(datepo, '%Y%m')"; - $resql = $this->db->query($sql); - $x_dis_datas = array(); - if ($resql) - { - while ($row = $this->db->fetch_row($resql)) - { - $x_dis_datas[$row[0]]= $row[1]; - } - } - else - { - print $sql; - } - - - foreach ($this->commerciaux as $commercial) - { - $datas = array(); - $xdatas = array(); - $sql = "SELECT date_format(datepo, '%m'), sum(montant)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat_priseordre as p"; - $sql .= " WHERE p.fk_commercial = ".$commercial; - $sql .= " AND date_format(datepo, '%Y') = '".strftime('%Y',$datetime)."'"; - $sql .= " GROUP BY date_format(datepo, '%Y%m')"; - $resql = $this->db->query($sql); - - if ($resql) - { - while ($row = $this->db->fetch_row($resql)) - { - $xdatas[$row[0]]= $row[1]; - } - } - else - { - print $sql; - } - - for ($j = 0; $j < 12 ; $j++) - { - $datas[$j] = 0; // on pre-remplit de 0 sinon bug de jpgraph - if ($xdatas[substr("00".($j+1),-2)]) - $datas[$j] = $xdatas[substr("00".($j+1),-2)]; - } - - if ($commercial == 18) - { - for ($j = 0; $j < 12 ; $j++) - { - if ($x_dis_datas[substr("00".($j+1),-2)]) - { - $datas[$j] = $datas[$j] + $x_dis_datas[substr("00".($j+1),-2)]; - } - } - } - - $bplot = new BarPlot($datas); - $bplot->SetFillColor($this->barcolor[$i]); - $bplot->SetLegend($comm_names[$commercial]); - if ($commercial == 18) - { - $bplot->SetLegend($comm_names[$commercial]."+DIS"); - } - //$bplot->value->Show(); - //$bplot->value->SetFont(FF_ARIAL,FS_BOLD,10); - //$bplot->value->SetAngle(45); - //$bplot->value->SetFormat('%0.1f'); - - array_push($gbspl, $bplot); - $i++; - } - - $gbplot = new GroupBarPlot ($gbspl); - - // Adjust the legend position - $graph->legend->Pos(0.86,0.1,"left","top"); - - $graph->Add($gbplot); - - $graph->xaxis->scale->SetGrace(20); - - $graph->title->Set($this->titre); - $labels= array(); - for ($j = 0; $j < 12 ; $j++) - { - $labels[$j] = strtoupper(substr(strftime("%B",mktime(1,1,1,($j+1),1,2005)),0,1)); - } - - - $graph->xaxis->SetTickLabels($labels); - - // Display the graph - $graph->img->SetImgFormat("png"); - - print $graph->Stroke($this->file); - } -} - -?> diff --git a/htdocs/telephonie/stats/commerciaux/contrats.class.php b/htdocs/telephonie/stats/commerciaux/contrats.class.php deleted file mode 100644 index 23e98fd5157..00000000000 --- a/htdocs/telephonie/stats/commerciaux/contrats.class.php +++ /dev/null @@ -1,93 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/pie.class.php"); - -class GraphCommerciauxContrats extends GraphPie { - - Function GraphCommerciauxContrats($DB, $file) - { - $this->db = $DB; - $this->file = $file; - - $this->client = 0; - $this->titre = "Nb de contrat signé par commercial"; - - $this->barcolor = "yellow"; - $this->showframe = true; - } - - Function GraphMakeGraph($type) - { - $num = 0; - - if ($type == 'suivi') - { - $this->titre = "Contrats suivis par commercial"; - } - else - { - $this->titre = "Contrats signés par commercial"; - } - - $sql = "SELECT u.firstname, u.name, count(*) as cc"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat as c"; - $sql .= " , ".MAIN_DB_PREFIX."user as u"; - if ($type == 'suivi') - { - $sql .= " WHERE c.fk_commercial_suiv = u.rowid"; - } - else - { - $sql .= " WHERE c.fk_commercial_sign = u.rowid"; - } - $sql .= " GROUP BY u.rowid ORDER BY CC desc"; - - $result = $this->db->query($sql); - if ($result) - { - $num = $this->db->num_rows(); - $i = 0; - $datas = array(); - $labels = array(); - - while ($i < $num) - { - $row = $this->db->fetch_row(); - - $labels[$i] = $row[0] . " ".$row[1]; - $datas[$i] = $row[2]; - - $i++; - } - - $this->db->free(); - } - else - { - print $this->db->error() . ' ' . $sql; - } - - $this->GraphDraw($this->file, $datas, $labels); - } -} -?> diff --git a/htdocs/telephonie/stats/commerciaux/contrats.php b/htdocs/telephonie/stats/commerciaux/contrats.php deleted file mode 100644 index ef4701b3720..00000000000 --- a/htdocs/telephonie/stats/commerciaux/contrats.php +++ /dev/null @@ -1,70 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if (!$user->rights->telephonie->lire) accessforbidden(); - -llxHeader('','Telephonie - Statistiques - Commerciaux - Contrats'); - -/* - * - * - * - */ - -$h = 0; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/commerciaux/index.php'; -$head[$h][1] = "Global"; -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/commerciaux/mensuel.php'; -$head[$h][1] = "Mensuel"; -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/commerciaux/contrats.php'; -$head[$h][1] = "Contrats"; -$hselected = $h; -$h++; - -dol_fiche_head($head, $hselected, "Commerciaux"); - -print ''; - -print ''; - -print '
'; - -print 'Commandes de ligne par mois

'."\n"; - -print '
'; - -print 'Commandes de ligne par mois

'."\n"; - -print '
'; - - - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/stats/commerciaux/groupes/groupe.ca.class.php b/htdocs/telephonie/stats/commerciaux/groupes/groupe.ca.class.php deleted file mode 100644 index e1eafc83178..00000000000 --- a/htdocs/telephonie/stats/commerciaux/groupes/groupe.ca.class.php +++ /dev/null @@ -1,105 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/bar.class.php"); - -class GraphGroupeChiffreAffaire extends GraphBar { - - Function GraphGroupeChiffreAffaire($DB, $file) - { - $this->db = $DB; - $this->file = $file; - - $this->client = 0; - $this->titre = ""; - - $this->barcolor = "blue"; - $this->showframe = true; - } - - Function GraphMakeGraph($groupe=0) - { - $num = 0; - - $sql = "SELECT nom"; - $sql .= " FROM ".MAIN_DB_PREFIX."usergroup as u"; - $sql .= " WHERE u.rowid = ".$groupe; - - $resql = $this->db->query($sql); - - if ($resql) - { - $row = $this->db->fetch_row($resql); - $nom = $row[0]; - $this->db->free($resql); - } - else - { - print $this->db->error() . ' ' . $sql; - } - - $this->titre = "Chiffre d'affaire mensuel : ".$nom; - - $sql = "SELECT date_format(f.date,'%Y%m'), sum(f.cout_vente)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture as f"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; - $sql .= " , ".MAIN_DB_PREFIX."usergroup_user as ug"; - $sql .= " WHERE l.rowid = f.fk_ligne"; - $sql .= " AND ug.fk_user = l.fk_commercial_sign"; - $sql .= " AND ug.fk_usergroup = ".$groupe; - $sql .= " GROUP BY date_format(f.date,'%Y%m') ASC"; - - $resql = $this->db->query($sql); - - if ($resql) - { - $num = $this->db->num_rows($resql); - $i = 0; - $j = -1; - $datas = array(); - $labels = array(); - - while ($i < $num) - { - $row = $this->db->fetch_row($resql); - - $datas[$i] = $row[1]; - $labels[$i] = substr($row[0],-2)."/".substr($row[0],2,2); - - $i++; - } - - $this->db->free($resql); - } - else - { - print $this->db->error() . ' ' . $sql; - } - - if (sizeof($datas)) - { - $this->GraphDraw($this->file, $datas, $labels); - } - - } -} -?> diff --git a/htdocs/telephonie/stats/commerciaux/groupes/groupe.gain.class.php b/htdocs/telephonie/stats/commerciaux/groupes/groupe.gain.class.php deleted file mode 100644 index 8c590d5b197..00000000000 --- a/htdocs/telephonie/stats/commerciaux/groupes/groupe.gain.class.php +++ /dev/null @@ -1,105 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/bar.class.php"); - -class GraphGroupeGain extends GraphBar { - - Function GraphGroupeGain($DB, $file) - { - $this->db = $DB; - $this->file = $file; - - $this->client = 0; - $this->titre = "Gain mensuel du groupe"; - - $this->barcolor = "pink"; - $this->showframe = true; - } - - Function GraphMakeGraph($groupe=0) - { - $num = 0; - - $sql = "SELECT nom"; - $sql .= " FROM ".MAIN_DB_PREFIX."usergroup as u"; - $sql .= " WHERE u.rowid = ".$groupe; - - $resql = $this->db->query($sql); - - if ($resql) - { - $row = $this->db->fetch_row($resql); - $nom = $row[0]; - $this->db->free($resql); - } - else - { - print $this->db->error() . ' ' . $sql; - } - - $this->titre = "Gain mensuel : ".$nom; - - $sql = "SELECT date_format(f.date,'%Y%m'), sum(f.gain)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture as f"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; - $sql .= " , ".MAIN_DB_PREFIX."usergroup_user as ug"; - $sql .= " WHERE l.rowid = f.fk_ligne"; - $sql .= " AND ug.fk_user = l.fk_commercial_sign"; - $sql .= " AND ug.fk_usergroup = ".$groupe; - $sql .= " GROUP BY date_format(f.date,'%Y%m') ASC"; - - $resql = $this->db->query($sql); - - if ($resql) - { - $num = $this->db->num_rows($resql); - $i = 0; - $j = -1; - $datas = array(); - $labels = array(); - - while ($i < $num) - { - $row = $this->db->fetch_row($resql); - - $datas[$i] = $row[1]; - $labels[$i] = substr($row[0],-2)."/".substr($row[0],2,2); - - $i++; - } - - $this->db->free($resql); - } - else - { - print $this->db->error() . ' ' . $sql; - } - - if (sizeof($datas)) - { - $this->GraphDraw($this->file, $datas, $labels); - } - - } -} -?> diff --git a/htdocs/telephonie/stats/commerciaux/groupes/groupe.php b/htdocs/telephonie/stats/commerciaux/groupes/groupe.php deleted file mode 100644 index 5e4708a8149..00000000000 --- a/htdocs/telephonie/stats/commerciaux/groupes/groupe.php +++ /dev/null @@ -1,150 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if (!$user->rights->telephonie->lire) accessforbidden(); - -llxHeader('','Telephonie - Statistiques - Commerciaux'); - -/* - * - * - * - */ - -$h = 0; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/commerciaux/index.php'; -$head[$h][1] = "Global"; -$hselected = $h; -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/commerciaux/mensuel.php'; -$head[$h][1] = "Mensuel"; -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/commerciaux/contrats.php'; -$head[$h][1] = "Contrats"; -$h++; - -dol_fiche_head($head, $hselected, "Commerciaux"); - -print ''; - -print ''; - -print ''; -print '
'; - -print ''; -print ''; - -$sql = "SELECT rowid, nom"; -$sql .= " FROM ".MAIN_DB_PREFIX."usergroup"; -$sql .= " ORDER BY nom ASC"; - -$resql = $db->query($sql); -if ($resql) -{ - $num = $db->num_rows(); - $i = 0; - while ($i < $num) - { - $row = $db->fetch_row($resql); - - $var=!$var; - - print ""; - - print ''; - - $i++; - } - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} -print '
Nom
'; - print ''.$row[2]." ". $row[1].'

'; - -/* */ - -print ''; -print ''; - -$sql = "SELECT count(*) as cc , c.name, c.firstname, c.rowid"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; -$sql .= " , ".MAIN_DB_PREFIX."user as c"; -$sql .= " , ".MAIN_DB_PREFIX."usergroup_user as ug"; -$sql .= " WHERE c.rowid = l.fk_commercial_sign"; -$sql .= " AND ug.fk_usergroup = ".$_GET["id"]; -$sql .= " AND ug.fk_user = c.rowid"; -$sql .= " AND l.statut <> 7"; -$sql .= " GROUP BY c.name ORDER BY cc DESC"; - -$resql = $db->query($sql); -if ($resql) -{ - $num = $db->num_rows(); - $i = 0; - $datas = array(); - $legends = array(); - - while ($i < $num) - { - $row = $db->fetch_row($i); - - $var=!$var; - - print ""; - - print ''; - $i++; - } - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} -print '
NomNb Lignes
'; - print ''.$row[2]." ". $row[1].''.$row[0].'

'; - - - -print '
'; - -print '

'."\n"; - - -print '

'."\n"; - -print '
'; - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/stats/commerciaux/groupes/pre.inc.php b/htdocs/telephonie/stats/commerciaux/groupes/pre.inc.php deleted file mode 100644 index bb89e8ba1af..00000000000 --- a/htdocs/telephonie/stats/commerciaux/groupes/pre.inc.php +++ /dev/null @@ -1,42 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("../../../../main.inc.php"); - -$user->getrights('telephonie'); - -function llxHeader($head = "", $title="") { - global $user, $conf; - - /* - * - * - */ - top_menu($head, $title); - - $menu = new Menu(); - - include "../../menus.php"; - - left_menu($menu->liste); -} - -?> diff --git a/htdocs/telephonie/stats/commerciaux/index.php b/htdocs/telephonie/stats/commerciaux/index.php deleted file mode 100644 index 5640781dbed..00000000000 --- a/htdocs/telephonie/stats/commerciaux/index.php +++ /dev/null @@ -1,172 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if (!$user->rights->telephonie->lire) accessforbidden(); -if (!$user->rights->telephonie->stats->lire) accessforbidden(); - -llxHeader('','Telephonie - Statistiques - Commerciaux'); - -/* - * - * - * - */ - -$h = 0; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/commerciaux/index.php'; -$head[$h][1] = "Global"; -$hselected = $h; -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/commerciaux/ca.php'; -$head[$h][1] = "CA"; -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/commerciaux/mensuel.php'; -$head[$h][1] = "Mensuel"; -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/commerciaux/contrats.php'; -$head[$h][1] = "Contrats"; -$h++; - -dol_fiche_head($head, $hselected, "Commerciaux"); - -print ''; -print ''; - -print ''; -print '
'; - -/* */ - -$sql = "SELECT count(*) as cc , c.name, c.firstname, c.rowid"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; -$sql .= " , ".MAIN_DB_PREFIX."user as c"; -$sql .= " LEFT JOIN llx_telephonie_distributeur_commerciaux as dc ON dc.fk_user = c.rowid"; - -$sql .= " WHERE c.rowid = l.fk_commercial_suiv"; -$sql .= " AND l.statut <> 7"; -$sql .= " AND dc.fk_distributeur IS NULL"; -$sql .= " GROUP BY c.name ORDER BY cc DESC"; - -print ''; -print ''; -print ''; - -$resql = $db->query($sql); -if ($resql) -{ - $num = $db->num_rows(); - $i = 0; - $datas = array(); - $legends = array(); - $total = 0; - while ($i < $num) - { - $row = $db->fetch_row($i); - - $var=!$var; - - print ""; - - print ''; - print ''; - $total += $row[0]; - $i++; - } - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} -$var=!$var; -print ""; -print ''; -print ''; -print '
Lignes suivies
NomNb Lignes 
'; - print ''.$row[2]." ". $row[1].''.$row[0].'Voir
Total'.$total.' 

'; - -print ''; -print ''; -print ''; - -$sql = "SELECT count(*) as cc , c.name, c.firstname, c.rowid"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; -$sql .= " , ".MAIN_DB_PREFIX."user as c"; -$sql .= " LEFT JOIN llx_telephonie_distributeur_commerciaux as dc ON dc.fk_user = c.rowid"; -$sql .= " WHERE c.rowid = l.fk_commercial_sign"; -$sql .= " AND l.statut <> 7"; -$sql .= " AND dc.fk_distributeur IS NULL"; -$sql .= " GROUP BY c.name ORDER BY cc DESC"; - -$resql = $db->query($sql); -if ($resql) -{ - $num = $db->num_rows(); - $i = 0; - $datas = array(); - $legends = array(); - $total= 0 ; - while ($i < $num) - { - $row = $db->fetch_row($i); - - $var=!$var; - - print ""; - - print ''; - print ''; - $total += $row[0]; - $i++; - } - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} -$var=!$var; -print ""; -print ''; -print ''; -print '
Lignes signées
NomNb Lignes 
'; - print ''.$row[2]." ". $row[1].''.$row[0].'Voir
Total'.$total.' 
'; - -print '
'; - -print 'Commandes de ligne par semaines

'."\n"; - -print 'Commandes de ligne par mois

'."\n"; - -print '
'; - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/stats/commerciaux/lignes.php b/htdocs/telephonie/stats/commerciaux/lignes.php deleted file mode 100644 index e8c76c22c79..00000000000 --- a/htdocs/telephonie/stats/commerciaux/lignes.php +++ /dev/null @@ -1,75 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if (!$user->rights->telephonie->lire) accessforbidden(); - -llxHeader('','Telephonie - Statistiques - Commerciaux'); - -/* - * - * - * - */ - - -$h = 0; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/commerciaux/index.php'; -$head[$h][1] = "Global"; -$h++; - -if ($_GET["commid"]) -{ - $comm = new User($db, $_GET["commid"]); - $comm->fetch(); - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/commerciaux/commercial.php?commid='.$comm->id; - $head[$h][1] = $comm->fullname; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/commerciaux/commercialca.php?commid='.$comm->id; - $head[$h][1] = "CA"; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/commerciaux/lignes.php?commid='.$comm->id; - $head[$h][1] = "Lignes"; - $hselected = $h; - $h++; - - dol_fiche_head($head, $hselected, "Commerciaux"); - - print ''; - - print ''; - print '
'; - - print 'Statuts des lignes

'."\n"; - - print '
'; - - $db->close(); - -} - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/stats/commerciaux/mensuel.php b/htdocs/telephonie/stats/commerciaux/mensuel.php deleted file mode 100644 index a33b7ef7e3f..00000000000 --- a/htdocs/telephonie/stats/commerciaux/mensuel.php +++ /dev/null @@ -1,128 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if (!$user->rights->telephonie->lire) accessforbidden(); -if (!$user->rights->telephonie->stats->lire) accessforbidden(); - -llxHeader('','Telephonie - Statistiques - Commerciaux'); - -/* - * - * - * - */ - -$h = 0; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/commerciaux/index.php'; -$head[$h][1] = "Global"; -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/commerciaux/mensuel.php'; -$head[$h][1] = "Mensuel"; -$hselected = $h; -$h++; - -dol_fiche_head($head, $hselected, "Commerciaux"); - -if (strlen($_GET["month"]) == 0) -{ - $month = strftime("%m%Y",time()); -} -else -{ - $month = $_GET["month"]; -} - -$month_prev = strftime("%m%Y", mktime(12,12,12,substr($month,0,2), 1, substr($month,-4)) - (20*3600*24)); -$month_next = strftime("%m%Y", mktime(12,12,12,substr($month,0,2), 25, substr($month,-4)) + (10*3600*24)); - -print "
Mois de : ".strftime("%B %Y", mktime(12,12,12,substr($month,0,2), 1, substr($month,-4))); -print ' ('.strftime("%B %Y", mktime(12,12,12,substr($month_prev,0,2), 1, substr($month_prev,-4))); -print ' - '.strftime("%B %Y", mktime(12,12,12,substr($month_next,0,2), 1, substr($month_next,-4))).")"; -print "

"; - -print ''; - -print ''; - -print ''; - - -print '
'; - -print ''; - -print ''; - - -$sql = "SELECT count(*) as cc , c.name, c.firstname, c.rowid"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; -$sql .= " , ".MAIN_DB_PREFIX."user as c"; -$sql .= " WHERE c.rowid = l.fk_commercial"; -$sql .= " AND date_format(date_commande, '%m%Y') = '$month'"; -$sql .= " GROUP BY c.name ORDER BY cc DESC"; - -$result = $db->query($sql); -if ($result) -{ - $num = $db->num_rows(); - $i = 0; - $datas = array(); - $legends = array(); - - while ($i < $num) - { - $row = $db->fetch_row($i); - - $var=!$var; - - print ""; - - print ''; - - $i++; - } - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - -print '
NomNb Lignes
'; - print ''.$row[2]." ". $row[1].''.$row[0].'
'; - -print '
'; - - - -print '
'; - - - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/stats/commerciaux/pre.inc.php b/htdocs/telephonie/stats/commerciaux/pre.inc.php deleted file mode 100644 index f7a054cf328..00000000000 --- a/htdocs/telephonie/stats/commerciaux/pre.inc.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("../../../main.inc.php"); -require_once DOL_DOCUMENT_ROOT.'/telephonie/stats/tools.lib.php'; - -$user->getrights('telephonie'); - -function llxHeader($head = "", $title="") { - global $user, $conf; - - /* - * - * - */ - top_menu($head, $title); - - $menu = new Menu(); - - include "../menus.php"; - - left_menu($menu->liste); -} - -?> diff --git a/htdocs/telephonie/stats/communications/analyse.php b/htdocs/telephonie/stats/communications/analyse.php deleted file mode 100644 index 53d0c95d576..00000000000 --- a/htdocs/telephonie/stats/communications/analyse.php +++ /dev/null @@ -1,84 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; - -if (!$user->rights->telephonie->lire) - accessforbidden(); - -llxHeader('','Telephonie - Statistiques'); - -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - - -$h = 0; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/communications/index.php'; -$head[$h][1] = "Global"; -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/communications/lastmonth.php'; -$head[$h][1] = "Durée"; -$h++; -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/communications/destmonth.php'; -$head[$h][1] = "Destinations"; -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/communications/rentabilite.php'; -$head[$h][1] = "Rentabilite"; -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/communications/analyse.php'; -$head[$h][1] = "Analyse"; -$hselected = $h; -$h++; - - -dol_fiche_head($head, $hselected, "Communications"); - -print ''."\n"; - -print ''; - -print '
'; - -print 'Heure appel

'; - -print '
'; - -print 'Jour de la semaine

'; - -print '
'; - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/stats/communications/destmonth.php b/htdocs/telephonie/stats/communications/destmonth.php deleted file mode 100644 index a60b4d7af0f..00000000000 --- a/htdocs/telephonie/stats/communications/destmonth.php +++ /dev/null @@ -1,114 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; - -if (!$user->rights->telephonie->lire) - accessforbidden(); - -llxHeader('','Telephonie - Statistiques'); - -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -$h = 0; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/communications/index.php'; -$head[$h][1] = "Global"; -$h++; -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/communications/lastmonth.php'; -$head[$h][1] = "Durée"; -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/communications/destmonth.php'; -$head[$h][1] = "Destinations"; -$hselected = $h; -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/communications/rentabilite.php'; -$head[$h][1] = "Rentabilite"; -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/communications/analyse.php'; -$head[$h][1] = "Analyse"; -$h++; - -dol_fiche_head($head, $hselected, "Communications"); - -print ''; - -print ''; - -print '
'; - -$now = time(); -$year = strftime("%Y", $now); -$month = strftime("%m", $now); - -for ($i = 1 ; $i < 4 ; $i++) -{ - $month = $month - 1; - - if ($month == 0) - { - $year = $year - 1; - $month = 12; - } - - - print '

'; - -} -print '
'; - -$year = strftime("%Y", $now); -$month = strftime("%m", $now); - -for ($i = 1 ; $i < 4 ; $i++) -{ - $month = $month - 1; - - if ($month == 0) - { - $year = $year - 1; - $month = 12; - } - - - print '

'; - -} - -print '
'; - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/stats/communications/index.php b/htdocs/telephonie/stats/communications/index.php deleted file mode 100644 index 6e1d21e19c5..00000000000 --- a/htdocs/telephonie/stats/communications/index.php +++ /dev/null @@ -1,132 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if (!$user->rights->telephonie->lire) accessforbidden(); -if (!$user->rights->telephonie->stats->lire) accessforbidden(); - -llxHeader('','Telephonie - Statistiques'); -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - - -$h = 0; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/communications/index.php'; -$head[$h][1] = "Global"; -$hselected = $h; -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/communications/lastmonth.php'; -$head[$h][1] = "Durée"; -$h++; -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/communications/destmonth.php'; -$head[$h][1] = "Destinations"; -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/communications/analyse.php'; -$head[$h][1] = "Analyse"; -$h++; - - -dol_fiche_head($head, $hselected, "Communications"); - -print ''."\n"; - -print ''; -print ''; - -print ''; - - - -print '
'."\n"; - -print 'Nb Minutes

'."\n"; - -print '
'."\n"; - -_legend($db, "communications.duree"); - -print '
'."\n"; - -print 'Communications locales

'."\n"; - -print '
'."\n"; - -print '
'."\n"; - -print 'Communications Mobiles

'."\n"; - -print '
'."\n"; - -_legend($db, "communications.duree_mobiles"); -print '
'."\n"; - -print 'Duree Moyenne vers Mobiles

'."\n"; - -print '
'."\n"; - -print '
'; - -$db->close(); - - -function _legend($db, $graph) -{ - print ''; - print '
'; - print ''; - print ''; - $sql = "SELECT legend, valeur"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_stats"; - $sql .= " WHERE graph = '".$graph."'"; - $sql .= " ORDER BY ord DESC"; - - $resql = $db->query($sql); - - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - - while ($i < $num) - { - $row = $db->fetch_row($resql); - $var = !$var; - print ""; - print ''; - - $i++; - } - } - print '
Légende
'.$row[0].''.ceil($row[1]).'
'; -} - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/stats/communications/lastmonth.php b/htdocs/telephonie/stats/communications/lastmonth.php deleted file mode 100644 index 419739fbc35..00000000000 --- a/htdocs/telephonie/stats/communications/lastmonth.php +++ /dev/null @@ -1,112 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; - -if (!$user->rights->telephonie->lire) - accessforbidden(); - -llxHeader('','Telephonie - Statistiques'); - -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -$h = 0; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/communications/index.php'; -$head[$h][1] = "Global"; -$h++; -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/communications/lastmonth.php'; -$head[$h][1] = "Durée"; -$hselected = $h; -$h++; -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/communications/destmonth.php'; -$head[$h][1] = "Destinations"; -$h++; -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/communications/rentabilite.php'; -$head[$h][1] = "Rentabilite"; -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/communications/analyse.php'; -$head[$h][1] = "Analyse"; -$h++; - -dol_fiche_head($head, $hselected, "Communications"); - -print ''; - -print ''; - -print '
'; - -$now = time(); -$year = strftime("%Y", $now); -$month = strftime("%m", $now); - -for ($i = 1 ; $i < 4 ; $i++) -{ - $month = $month - 1; - - if ($month == 0) - { - $year = $year - 1; - $month = 12; - } - - - print '

'; - -} -print '
'; - -$year = strftime("%Y", $now); -$month = strftime("%m", $now); - -for ($i = 1 ; $i < 4 ; $i++) -{ - $month = $month - 1; - - if ($month == 0) - { - $year = $year - 1; - $month = 12; - } - - - print '

'; - -} - -print '
'; - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/stats/communications/pre.inc.php b/htdocs/telephonie/stats/communications/pre.inc.php deleted file mode 100644 index 0113ceba653..00000000000 --- a/htdocs/telephonie/stats/communications/pre.inc.php +++ /dev/null @@ -1,42 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("../../../main.inc.php"); - -$user->getrights('telephonie'); - -function llxHeader($head = "", $title="") { - global $user, $conf; - - /* - * - * - */ - top_menu($head, $title); - - $menu = new Menu(); - - include "../menus.php"; - - left_menu($menu->liste); -} - -?> diff --git a/htdocs/telephonie/stats/communications/rentabilite.php b/htdocs/telephonie/stats/communications/rentabilite.php deleted file mode 100644 index f7153b774b6..00000000000 --- a/htdocs/telephonie/stats/communications/rentabilite.php +++ /dev/null @@ -1,118 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; - -if (!$user->rights->telephonie->lire) - accessforbidden(); - -llxHeader('','Telephonie - Statistiques'); - -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -$h = 0; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/communications/index.php'; -$head[$h][1] = "Global"; -$h++; -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/communications/lastmonth.php'; -$head[$h][1] = "Durée"; -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/communications/destmonth.php'; -$head[$h][1] = "Destinations"; -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/communications/rentabilite.php'; -$head[$h][1] = "Rentabilite"; -$hselected = $h; -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/communications/analyse.php'; -$head[$h][1] = "Analyse"; -$h++; - -dol_fiche_head($head, $hselected, "Communications"); - -print ''; - -print ''; - -print '
'; - -$sql = "SELECT date_format(date, '%Y%m'), avg(cout_vente)"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; -$sql .= " GROUP BY date_format(date, '%Y%m') DESC"; - -if ($db->query($sql)) -{ - $num = $db->num_rows(); - $i = 0; - $ligne = new LigneTel($db); - - print ''; - print ''; - print "\n"; - $var=True; - - while ($i < $num) - { - $row = $db->fetch_row(); - - $var=!$var; - - print ""; - print ''."\n"; - print '\n"; - - - print "\n"; - $i++; - } - print "
MoisMarge
'.$row[0].''.round($row[1],4)."
"; - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - - -print '
'; - - - -print '
'; - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/stats/consultation/index.php b/htdocs/telephonie/stats/consultation/index.php deleted file mode 100644 index c96b79760c3..00000000000 --- a/htdocs/telephonie/stats/consultation/index.php +++ /dev/null @@ -1,94 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if (!$user->rights->telephonie->lire) accessforbidden(); -if (!$user->rights->telephonie->stats->lire) accessforbidden(); - -llxHeader('','Telephonie - Statistiques - Consultations'); - -/* - * - * - */ - -include "./onglets.php"; -dol_fiche_head($head, $hselected, "Consultations"); - -print '
'; - -print ''; -print '
'; - -$sql = "SELECT u.name, u.firstname, count(distinct(sc.fk_soc)) as dam"; -$sql .= " FROM ".MAIN_DB_PREFIX."user as u"; -$sql .= ",".MAIN_DB_PREFIX."societe_consult as sc"; -$sql .= " WHERE sc.fk_user = u.rowid"; -$sql .= " GROUP BY u.rowid"; -$sql .= " ORDER BY dam DESC"; -$resql = $db->query($sql); -print ''; -print ''; -if ($resql) -{ - while ($row = $db->fetch_row($resql)) - { - print ''; - print ''; - } -} -print '
UtilisateurFiches client
'.$row[1].' '.$row[0].''.$row[2].'

'; - -$sql = "SELECT u.name, u.firstname, count(distinct(sc.fk_contrat)) as dam"; -$sql .= " FROM ".MAIN_DB_PREFIX."user as u"; -$sql .= ",".MAIN_DB_PREFIX."telephonie_contrat_consult as sc"; -$sql .= " WHERE sc.fk_user = u.rowid"; -$sql .= " GROUP BY u.rowid"; -$sql .= " ORDER BY dam DESC"; -$resql = $db->query($sql); -print ''; -print ''; -if ($resql) -{ - while ($row = $db->fetch_row($resql)) - { - print ''; - print ''; - } -} -print '
UtilisateurFiches contrat
'.$row[1].' '.$row[0].''.$row[2].'

'; - -print '
'; - - - -/* - * - * - */ - -print '
'; - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/stats/consultation/onglets.php b/htdocs/telephonie/stats/consultation/onglets.php deleted file mode 100644 index 6771842c7ae..00000000000 --- a/htdocs/telephonie/stats/consultation/onglets.php +++ /dev/null @@ -1,34 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -$h = 0; -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/contrats/index.php'; -$head[$h][1] = "Global"; -$h++; - -for ($hii = 0 ; $hii < sizeof($head) ; $hii++) -{ - if ($_SERVER["PHP_SELF"] == $head[$hii][0]) - { - $hselected = $hii; - } -} -?> diff --git a/htdocs/telephonie/stats/consultation/pre.inc.php b/htdocs/telephonie/stats/consultation/pre.inc.php deleted file mode 100644 index 89ee8dfe60a..00000000000 --- a/htdocs/telephonie/stats/consultation/pre.inc.php +++ /dev/null @@ -1,42 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("../../../main.inc.php"); - -$user->getrights('telephonie'); - -function llxHeader($head = "", $title="") { - global $user; - - /* - * - * - */ - top_menu($head, $title); - - $menu = new Menu(); - - include "../menus.php"; - - left_menu($menu->liste); -} - -?> diff --git a/htdocs/telephonie/stats/contrats/index.php b/htdocs/telephonie/stats/contrats/index.php deleted file mode 100644 index 57288ab2111..00000000000 --- a/htdocs/telephonie/stats/contrats/index.php +++ /dev/null @@ -1,90 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if (!$user->rights->telephonie->lire) accessforbidden(); -if (!$user->rights->telephonie->stats->lire) accessforbidden(); - -llxHeader('','Telephonie - Statistiques - Contrats'); - -/* - * - * - */ - -include "./onglets.php"; -dol_fiche_head($head, $hselected, "Contrats"); - -print ''; - -print ''; -print '
'; - -print 'Mode de réglement

'."\n"; - -print '
'; - -$sql = "SELECT date_format(f.date, '%Y%m'), sum(f.cout_vente), c.mode_paiement"; - -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture as f"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_contrat as c"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; - -$sql .= " WHERE f.fk_ligne = l.rowid"; -$sql .= " AND l.fk_contrat = c.rowid"; -$sql .= " AND c.isfacturable = 'oui'"; -$sql .= " GROUP BY date_format(f.date, '%Y%m'), c.mode_paiement"; -$sql .= " ORDER BY date_format(f.date, '%Y%m') DESC"; -$sql .= " LIMIT 10"; -$resql = $db->query($sql); - -print ''; -print ''; -if ($resql) -{ - $num = $db->num_rows(); - $i = 0; - - while ($i < $num) - { - $row = $db->fetch_row($resql); - - print ''; - print ''; - print ''; - - $i++; - } -} -print '
MoisMontantMode
'.$row[0].''.sprintf("%01.2f",$row[1]).''.$row[2].'
'; - -/* - * - * - */ - -print '
'; - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/stats/contrats/modereglement.class.php b/htdocs/telephonie/stats/contrats/modereglement.class.php deleted file mode 100644 index 0377c80f003..00000000000 --- a/htdocs/telephonie/stats/contrats/modereglement.class.php +++ /dev/null @@ -1,76 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/pie.class.php"); - -class GraphContratModeReglement extends GraphPie { - - Function GraphContratModeReglement($DB, $file) - { - $this->db = $DB; - $this->file = $file; - - $this->client = 0; - $this->titre = "Mode de réglement des contrats"; - - $this->barcolor = "yellow"; - $this->showframe = true; - } - - Function GraphMakeGraph() - { - $num = 0; - - $sql = "SELECT mode_paiement, count(*)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat"; - // $sql .= " WHERE statut = 3"; - $sql .= " GROUP BY mode_paiement"; - - $result = $this->db->query($sql); - if ($result) - { - $num = $this->db->num_rows(); - $i = 0; - $datas = array(); - $labels = array(); - - while ($i < $num) - { - $row = $this->db->fetch_row(); - - $datas[$i] = $row[1]; - $labels[$i] = $row[0]; - - $i++; - } - - $this->db->free(); - } - else - { - print $this->db->error() . ' ' . $sql; - } - - $this->GraphDraw($this->file, $datas, $labels); - } -} -?> diff --git a/htdocs/telephonie/stats/contrats/onglets.php b/htdocs/telephonie/stats/contrats/onglets.php deleted file mode 100644 index 6771842c7ae..00000000000 --- a/htdocs/telephonie/stats/contrats/onglets.php +++ /dev/null @@ -1,34 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -$h = 0; -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/contrats/index.php'; -$head[$h][1] = "Global"; -$h++; - -for ($hii = 0 ; $hii < sizeof($head) ; $hii++) -{ - if ($_SERVER["PHP_SELF"] == $head[$hii][0]) - { - $hselected = $hii; - } -} -?> diff --git a/htdocs/telephonie/stats/contrats/pre.inc.php b/htdocs/telephonie/stats/contrats/pre.inc.php deleted file mode 100644 index 89ee8dfe60a..00000000000 --- a/htdocs/telephonie/stats/contrats/pre.inc.php +++ /dev/null @@ -1,42 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("../../../main.inc.php"); - -$user->getrights('telephonie'); - -function llxHeader($head = "", $title="") { - global $user; - - /* - * - * - */ - top_menu($head, $title); - - $menu = new Menu(); - - include "../menus.php"; - - left_menu($menu->liste); -} - -?> diff --git a/htdocs/telephonie/stats/destinations/index.php b/htdocs/telephonie/stats/destinations/index.php deleted file mode 100644 index 2db47ba4c29..00000000000 --- a/htdocs/telephonie/stats/destinations/index.php +++ /dev/null @@ -1,104 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; - -if (!$user->rights->telephonie->lire) accessforbidden(); -if (!$user->rights->telephonie->stats->lire) accessforbidden(); - -llxHeader('','Telephonie - Statistiques'); - -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -$h = 0; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/destinations/index.php'; -$head[$h][1] = "Destinations"; -$hselected = $h; -$h++; - -dol_fiche_head($head, $hselected, "Destinations"); - -print ''; - -print ''; - -print '
'; - -$sql = "SELECT destination, nbappels, ca, duree, duree_moy"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_stats_destination"; -$sql .= " ORDER BY ca DESC"; - -if ($db->query($sql)) -{ - $num = $db->num_rows(); - $i = 0; - - print ''; - print ''; - print ''; - print ''; - $var=True; - - while ($i < $num) - { - $row = $db->fetch_row(); - - $var=!$var; - - print ""; - print ''."\n"; - print '\n"; - print '\n"; - print '\n"; - print '\n"; - - - print "\n"; - $i++; - } - print "
DestinationCANb AppelsDurée (sec)Durée moyenne (sec)
'.$row[0].''.sprintf("%01.2f",$row[2])."'.$row[1]."'.$row[3]."'.sprintf("%01.2f",$row[4])."
"; - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - - -print '
'; - -print '
'; - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/stats/destinations/pre.inc.php b/htdocs/telephonie/stats/destinations/pre.inc.php deleted file mode 100644 index 0113ceba653..00000000000 --- a/htdocs/telephonie/stats/destinations/pre.inc.php +++ /dev/null @@ -1,42 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("../../../main.inc.php"); - -$user->getrights('telephonie'); - -function llxHeader($head = "", $title="") { - global $user, $conf; - - /* - * - * - */ - top_menu($head, $title); - - $menu = new Menu(); - - include "../menus.php"; - - left_menu($menu->liste); -} - -?> diff --git a/htdocs/telephonie/stats/distributeurs/commercial.php b/htdocs/telephonie/stats/distributeurs/commercial.php deleted file mode 100644 index 789f61bffdf..00000000000 --- a/htdocs/telephonie/stats/distributeurs/commercial.php +++ /dev/null @@ -1,124 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if (!$user->rights->telephonie->lire) accessforbidden(); - -llxHeader('','Telephonie - Statistiques - Distributeurs'); - -/* - * - * - * - */ - -$h = 0; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/distributeurs/index.php'; -$head[$h][1] = "Global"; -$h++; - -if ($_GET["id"]) -{ - $comm = new User($db, $_GET["id"]); - $comm->fetch(); - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/distributeurs/commercial.php?id='.$comm->id; - $head[$h][1] = $comm->fullname; - $hselected = $h; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/distributeurs/commercialca.php?id='.$comm->id; - $head[$h][1] = "CA"; - $h++; - - dol_fiche_head($head, $hselected, "Distributeurs"); - - print ''; - - print ''; - print '
'; - - - /* - * - * - */ - print ''; - print ''; - print ''; - - $sql = "SELECT sum(p.montant), date_format(p.datepo, '%m/%Y')"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat_priseordre as p"; - - $sql .= " WHERE p.fk_commercial = ".$_GET["id"]; - $sql .= " GROUP BY date_format(p.datepo, '%y%m') DESC"; - - $resql = $db->query($sql); - - if ($resql) - { - $num = $db->num_rows(); - $i = 0; - $total = 0; - - while ($i < $num) - { - $row = $db->fetch_row($i); - $var=!$var; - print ""; - print ''; - print ''; - $i++; - } - $db->free(); - } - else - { - print $db->error() . ' ' . $sql; - } - - - - print '
DatePrise d\'ordre
'.$row[1].''.price($row[0]).'

'; - - - /* - * - */ - print '
'; - - print 'Commandes de lignes par semaine

'."\n"; - - print 'Commandes de lignes par semaine

'."\n"; - - print 'Commandes de lignes par semaine

'."\n"; - - print 'Commandes de ligne par mois

'."\n"; - - print '
'; - - $db->close(); -} - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/stats/distributeurs/commercialca.php b/htdocs/telephonie/stats/distributeurs/commercialca.php deleted file mode 100644 index 23aebf4ef75..00000000000 --- a/htdocs/telephonie/stats/distributeurs/commercialca.php +++ /dev/null @@ -1,84 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if (!$user->rights->telephonie->lire) accessforbidden(); - -llxHeader('','Telephonie - Statistiques - Distributeurs'); - -/* - * - * - * - */ -$h = 0; -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/distributeurs/index.php'; -$head[$h][1] = "Global"; -$h++; - -$year = strftime("%Y",time()); -if (strftime("%m",time()) == 1) -{ - $year = $year -1; -} -if ($_GET["year"] > 0) -{ - $year = $_GET["year"]; -} - -if ($_GET["id"]) -{ - $comm = new User($db, $_GET["id"]); - $comm->fetch(); - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/distributeurs/commercial.php?id='.$comm->id; - $head[$h][1] = $comm->fullname; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/distributeurs/commercialca.php?id='.$comm->id; - $head[$h][1] = "CA"; - $hselected = $h; - $h++; - - dol_fiche_head($head, $hselected, "Distributeurs"); - stat_year_bar($year); - - print ''; - print '\n"; - print ''; - print '
'; - - print 'Gain mensuel'."\n"; - - print "
'; - print 'Chiffre d\'affaire mensuel'."\n"; - - print '
'; - - $db->close(); - -} - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/stats/distributeurs/distributeur.ca.class.php b/htdocs/telephonie/stats/distributeurs/distributeur.ca.class.php deleted file mode 100644 index 0ed87a63f40..00000000000 --- a/htdocs/telephonie/stats/distributeurs/distributeur.ca.class.php +++ /dev/null @@ -1,146 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/bar.class.php"); - -class GraphDistributeurCa extends GraphBar { - - Function GraphDistributeurCa($DB, $file) - { - $this->db = $DB; - $this->file = $file; - $this->client = 0; - $this->year = strftime("%Y",time()); - $this->barcolor = "blue"; - $this->showframe = true; - } - - Function GraphMakeGraph($distributeur=0) - { - $this->titre = "Chiffre d'affaire ".$this->year; - $num = 0; - - - $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_stats"; - if ($distributeur > 0) - { - $sql .= " WHERE graph='distributeur.ca.mensuel.".$distributeur."';"; - } - else - { - $sql .= " WHERE graph='distributeur.ca.mensuel'"; - } - $resql = $this->db->query($sql); - - - if ($distributeur > 0) { - $sql = "SELECT date_format(f.date,'%Y%m'), sum(f.cout_vente)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture as f"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_distributeur_commerciaux as dc"; - $sql .= " WHERE l.rowid = f.fk_ligne"; - $sql .= " AND l.fk_commercial_sign = dc.fk_user"; - $sql .= " AND dc.fk_distributeur = ".$distributeur; - $sql .= " GROUP BY date_format(f.date,'%Y%m') ASC"; - } else { - $sql = "SELECT legend, sum(valeur)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_stats"; - $sql .= " WHERE graph like 'distributeur.ca.mensuel.%'"; - $sql .= " GROUP BY legend ORDER BY ord ASC"; - } - - $resql = $this->db->query($sql); - - if ($resql) - { - $num = $this->db->num_rows($resql); - $i = 0; - $j = -1; - $datas = array(); - $cas = array(); - $labels = array(); - - while ($i < $num) - { - $row = $this->db->fetch_row($resql); - - $datas[$i] = $row[1]; - $cas[$row[0]] = $row[1]; - $labels[$i] = substr($row[0],-2)."/".substr($row[0],2,2); - - $sqli = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_stats"; - $sqli .= " (graph,ord,legend,valeur)"; - if ($distributeur > 0) { - $sqli .= " VALUES ('distributeur.ca.mensuel.".$distributeur."'"; - } - else { - $sqli .= " VALUES ('distributeur.ca.mensuel'"; - } - $sqli .= ",'$i','".$row[0]."','".$datas[$i]."');"; - - $resqli = $this->db->query($sqli); - - $i++; - } - - $this->db->free($resql); - } - else - { - print $this->db->error() . ' ' . $sql; - } - - $month = array(); - $month[1] = 'J'; - $month[2] = 'F'; - $month[3] = 'M'; - $month[4] = 'A'; - $month[5] = 'M'; - $month[6] = 'J'; - $month[7] = 'J'; - $month[8] = 'A'; - $month[9] = 'S'; - $month[10] = 'O'; - $month[11] = 'N'; - $month[12] = 'D'; - - for ($i = 1 ; $i < 13 ; $i++) - { - $idx = $this->year.substr('0'.$i,-2); - if ($cas[$idx]) - { - $datas[$i-1] = $cas[$idx]; - } - else - { - $datas[$i-1] = 0; - } - $labels[$i-1] = $month[$i]; - } - - if (sizeof($datas)) - { - $this->GraphDraw($this->file, $datas, $labels); - } - } -} -?> diff --git a/htdocs/telephonie/stats/distributeurs/distributeur.commission.class.php b/htdocs/telephonie/stats/distributeurs/distributeur.commission.class.php deleted file mode 100644 index 2b713b3b243..00000000000 --- a/htdocs/telephonie/stats/distributeurs/distributeur.commission.class.php +++ /dev/null @@ -1,128 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/bar.class.php"); - -class GraphDistributeurCommission extends GraphBar { - - Function GraphDistributeurCommission($DB, $file) - { - $this->db = $DB; - $this->file = $file; - $this->year = strftime("%Y",time()); - $this->client = 0; - $this->barcolor = "orange"; - $this->showframe = true; - } - - Function GraphMakeGraph($distributeur=0) - { - $this->titre = "Commissions mensuelles reversées ".$this->year; - - $num = 0; - $this->no_xaxis_title=1; - $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_stats"; - if ($distributeur > 0) { - $sql .= " WHERE graph='distributeur.commission.mensuel.".$distributeur."';"; - } else { - $sql .= " WHERE graph='distributeur.commission.mensuel';"; - } - - $resql = $this->db->query($sql); - - - if ($distributeur > 0) { - $sql = "SELECT date, montant"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_commission"; - $sql .= " WHERE fk_distributeur = ".$distributeur; - $sql .= " ORDER BY date ASC"; - } else { - $sql = "SELECT legend, sum(valeur)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_stats"; - $sql .= " WHERE graph like 'distributeur.commission.mensuel.%'"; - $sql .= " GROUP BY legend ORDER BY ord ASC"; - } - - $resql = $this->db->query($sql); - - if ($resql) - { - $num = $this->db->num_rows($resql); - $i = 0; - $j = -1; - $datas = array(); - $labels = array(); - - while ($i < $num) - { - $row = $this->db->fetch_row($resql); - - $datas[$i] = $row[1]; - $comms[$row[0]] = $row[1]; - $labels[$i] = substr($row[0],-2)."/".substr($row[0],2,2); - - $sqli = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_stats"; - $sqli .= " (graph,ord,legend,valeur)"; - if ($distributeur > 0) { - $sqli .= " VALUES ('distributeur.commission.mensuel.".$distributeur."'"; - } else { - $sqli .= " VALUES ('distributeur.commission.mensuel'"; - } - $sqli .= ",'$i','".$row[0]."','".$datas[$i]."');"; - $resqli = $this->db->query($sqli); - - $i++; - } - $this->db->free($resql); - } - else - { - print $this->db->error() . ' ' . $sql; - } - $month = array(); - $month[1] = 'J'; - $month[2] = 'F'; - $month[3] = 'M'; - $month[4] = 'A'; - $month[5] = 'M'; - $month[6] = 'J'; - $month[7] = 'J'; - $month[8] = 'A'; - $month[9] = 'S'; - $month[10] = 'O'; - $month[11] = 'N'; - $month[12] = 'D'; - - for ($i = 1 ; $i < 13 ; $i++) - { - $idx = $this->year.substr('0'.$i,-2); - $datas[$i-1] = $comms[$idx]; - $labels[$i-1] = $month[$i]; - } - - if (sizeof($datas)) - { - $this->GraphDraw($this->file, $datas, $labels); - } - } -} -?> diff --git a/htdocs/telephonie/stats/distributeurs/distributeur.gain.class.php b/htdocs/telephonie/stats/distributeurs/distributeur.gain.class.php deleted file mode 100644 index e02c3564a55..00000000000 --- a/htdocs/telephonie/stats/distributeurs/distributeur.gain.class.php +++ /dev/null @@ -1,140 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/bar.class.php"); - -class GraphDistributeurGain extends GraphBar { - - Function GraphDistributeurGain($DB, $file) - { - $this->db = $DB; - $this->file = $file; - $this->client = 0; - $this->year = strftime("%Y",time()); - - $this->barcolor = "pink"; - $this->showframe = true; - } - - Function GraphMakeGraph($distributeur=0) - { - $this->titre = "Marges effectuées sur les lignes ".$this->year; - $num = 0; - - - $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_stats"; - if ($distributeur > 0) - { - $sql .= " WHERE graph='distributeur.gain.mensuel.".$distributeur."';"; - } - else - { - $sql .= " WHERE graph='distributeur.gain.mensuel'"; - } - $resql = $this->db->query($sql); - - - if ($distributeur > 0) { - $sql = "SELECT date_format(f.date,'%Y%m'), sum(f.gain)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture as f"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_distributeur_commerciaux as dc"; - $sql .= " WHERE l.rowid = f.fk_ligne"; - $sql .= " AND l.fk_commercial_sign = dc.fk_user"; - $sql .= " AND dc.fk_distributeur = ".$distributeur; - $sql .= " GROUP BY date_format(f.date,'%Y%m') ASC"; - } else { - $sql = "SELECT legend, sum(valeur)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_stats"; - $sql .= " WHERE graph like 'distributeur.gain.mensuel.%'"; - $sql .= " GROUP BY legend ORDER BY ord ASC"; - } - - $resql = $this->db->query($sql); - - if ($resql) - { - $num = $this->db->num_rows($resql); - $i = 0; - $j = -1; - $datas = array(); - $gains = array(); - $labels = array(); - - while ($i < $num) - { - $row = $this->db->fetch_row($resql); - - $datas[$i] = $row[1]; - $gains[$row[0]] = $row[1]; - $labels[$i] = substr($row[0],-2)."/".substr($row[0],2,2); - - $sqli = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_stats"; - $sqli .= " (graph,ord,legend,valeur)"; - if ($distributeur > 0) { - $sqli .= " VALUES ('distributeur.gain.mensuel.".$distributeur."'"; - } - else { - $sqli .= " VALUES ('distributeur.gain.mensuel'"; - } - $sqli .= ",'$i','".$row[0]."','".$datas[$i]."');"; - - $resqli = $this->db->query($sqli); - - $i++; - } - - $this->db->free($resql); - } - else - { - print $this->db->error() . ' ' . $sql; - } - - $month = array(); - $month[1] = 'J'; - $month[2] = 'F'; - $month[3] = 'M'; - $month[4] = 'A'; - $month[5] = 'M'; - $month[6] = 'J'; - $month[7] = 'J'; - $month[8] = 'A'; - $month[9] = 'S'; - $month[10] = 'O'; - $month[11] = 'N'; - $month[12] = 'D'; - - for ($i = 1 ; $i < 13 ; $i++) - { - $idx = $this->year.substr('0'.$i,-2); - $datas[$i-1] = $gains[$idx]; - $labels[$i-1] = $month[$i]; - } - - if (sizeof($datas)) - { - $this->GraphDraw($this->file, $datas, $labels); - } - } -} -?> diff --git a/htdocs/telephonie/stats/distributeurs/distributeur.php b/htdocs/telephonie/stats/distributeurs/distributeur.php deleted file mode 100644 index 12c088999ad..00000000000 --- a/htdocs/telephonie/stats/distributeurs/distributeur.php +++ /dev/null @@ -1,217 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); -require DOL_DOCUMENT_ROOT.'/telephonie/distributeurtel.class.php'; - -if (!$user->rights->telephonie->lire) accessforbidden(); - -llxHeader('','Telephonie - Statistiques - Distributeur'); - -/* - * - * - * - */ - -$h = 0; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/distributeurs/index.php'; -$head[$h][1] = "Global"; -$h++; - -if ($_GET["id"]) -{ - $year = strftime("%Y",time()); - $distri = new DistributeurTelephonie($db); - $distri->fetch($_GET["id"]); - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/distributeurs/distributeur.php?id='.$distri->id; - $head[$h][1] = $distri->nom; - $hselected = $h; - $h++; - - dol_fiche_head($head, $hselected, "Distributeur"); - - print ''; - - print ''; - print '
'; - - print 'Prise d\'ordre

'."\n"; - - print '
'; - - print ''; - print ''; - print ''; - - $sql = "SELECT sum(p.montant), date_format(datepo, '%m-%Y')"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat_priseordre as p"; - $sql .= " WHERE p.fk_distributeur = ".$_GET["id"]; - $sql .= " GROUP BY date_format(p.datepo, '%Y%m') DESC"; - $resql = $db->query($sql); - - if ($resql) - { - $num = $db->num_rows(); - $i = 0; - $total = 0; - - while ($row = $db->fetch_row($resql)) - { - $var=!$var; - print "'; - print ''; - } - $db->free(); - } - else - { - print $db->error() . ' ' . $sql; - } - print '
MoisPrise d\'ordre
".$row[1].''.price($row[0]).'
'; - - print '
'; - print 'Nouveaux clients

'."\n"; - print '
'; - - print '
'; - print 'Resultat

'."\n"; - print '
'; - print ''; - print ''; - - $sql = "SELECT valeur,legend FROM ".MAIN_DB_PREFIX."telephonie_stats"; - $sql .= " WHERE graph = 'distributeur.resultat.mensuel.".$_GET["id"]."'"; - $sql .= " ORDER BY legend DESC"; - $resql = $db->query($sql); - - if ($resql) - { - while ($row = $db->fetch_row($resql)) - { - $var=!$var; - print "'; - print ''; - } - $db->free(); - } - else - { - print $db->error() . ' ' . $sql; - } - print '
MoisResultat
".$row[1].''.price($row[0]).'
'; - - print '
'; - print 'Gain mensuel

'."\n"; - print '
'; - print ''; - print ''; - - $sql = "SELECT valeur,legend FROM ".MAIN_DB_PREFIX."telephonie_stats"; - $sql .= " WHERE graph = 'distributeur.gain.mensuel.".$_GET["id"]."'"; - $sql .= " ORDER BY legend DESC"; - $resql = $db->query($sql); - - if ($resql) - { - while ($row = $db->fetch_row($resql)) - { - $var=!$var; - print "'; - print ''; - } - $db->free(); - } - else - { - print $db->error() . ' ' . $sql; - } - print '
MoisGain
".$row[1].''.price($row[0]).'
'; - - print '
'; - print 'Commission mensuelle

'."\n"; - - print '
'; - - print ''; - print ''; - - $sql = "SELECT valeur,legend FROM ".MAIN_DB_PREFIX."telephonie_stats"; - $sql .= " WHERE graph = 'distributeur.commission.mensuel.".$_GET["id"]."'"; - $sql .= " ORDER BY legend DESC"; - $resql = $db->query($sql); - - if ($resql) - { - while ($row = $db->fetch_row($resql)) - { - $var=!$var; - print "'; - print ''; - } - $db->free(); - } - else - { - print $db->error() . ' ' . $sql; - } - print '
MoisCommission
".$row[1].''.price($row[0]).'
'; - - print '
'; - print 'CA

'."\n"; - - print '
'; - - print ''; - print ''; - - $sql = "SELECT valeur,legend FROM ".MAIN_DB_PREFIX."telephonie_stats"; - $sql .= " WHERE graph = 'distributeur.ca.mensuel.".$_GET["id"]."'"; - $sql .= " ORDER BY legend DESC"; - $resql = $db->query($sql); - - if ($resql) - { - while ($row = $db->fetch_row($resql)) - { - $var=!$var; - print "'; - print ''; - } - $db->free(); - } - else - { - print $db->error() . ' ' . $sql; - } - print '
MoisCA
".$row[1].''.price($row[0]).'
'; - - - - print '
'; - - $db->close(); -} - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/stats/distributeurs/distributeur.po.month.class.php b/htdocs/telephonie/stats/distributeurs/distributeur.po.month.class.php deleted file mode 100644 index 8be1d2d3112..00000000000 --- a/htdocs/telephonie/stats/distributeurs/distributeur.po.month.class.php +++ /dev/null @@ -1,83 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/bar.class.php"); - -class GraphDistributeurPoMensuel extends GraphBar { - - Function GraphDistributeurPoMensuel($DB, $file) - { - $this->db = $DB; - $this->file = $file; - - $this->client = 0; - $this->titre = "Prise d'ordre mensuelle"; - - $this->barcolor = "blue"; - $this->showframe = true; - } - - Function GraphMakeGraph($id=0, $nom='') - { - $num = 0; - - $this->titre = "Prise d'ordre mensuelle pour $nom"; - - $labels = array(); - - - $sql = "SELECT date_format(datepo, '%m-%Y'), sum(p.montant)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat_priseordre as p"; - - $sql .= " WHERE p.fk_distributeur = ".$id; - $sql .= " GROUP BY date_format(p.datepo, '%Y%m') ASC"; - - - if ($this->db->query($sql)) - { - $num = $this->db->num_rows(); - - $i = 0; - $datas = array(); - - while ($i < $num) - { - $row = $this->db->fetch_row(); - array_push($datas, $row[1]); - array_push($labels, $row[0]); - $i++; - } - - $this->db->free(); - } - else - { - dol_syslog($this->db->error()); - } - - if (sizeof($datas) > 0) - { - $this->GraphDraw($this->file, $datas, $labels); - } - } -} -?> diff --git a/htdocs/telephonie/stats/distributeurs/distributeur.resultat.class.php b/htdocs/telephonie/stats/distributeurs/distributeur.resultat.class.php deleted file mode 100644 index 4b9f6fc4618..00000000000 --- a/htdocs/telephonie/stats/distributeurs/distributeur.resultat.class.php +++ /dev/null @@ -1,135 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/bar.class.php"); - -class GraphDistributeurResultat extends GraphBar { - - Function GraphDistributeurResultat($DB, $file) - { - $this->db = $DB; - $this->file = $file; - $this->client = 0; - $this->year = strftime("%Y",time()); - $this->barcolor = "green"; - $this->showframe = true; - } - - Function GraphMakeGraph($distributeur=0) - { - $this->titre = "Resultat mensuel ".$this->year." (marges - commissions)"; - $comms = array(); - $gains = array(); - $num = 0; - $this->no_xaxis_title=1; - - $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_stats"; - if ($distributeur > 0 ){ - $sql .= " WHERE graph='distributeur.resultat.mensuel.".$distributeur."'"; - } else { - $sql .= " WHERE graph='distributeur.resultat.mensuel'"; - } - $sql .= " AND legend like '".$this->year."%';"; - $resql = $this->db->query($sql); - - $sql = "SELECT legend, valeur"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_stats"; - if ($distributeur > 0 ){ - $sql .= " WHERE graph = 'distributeur.gain.mensuel.".$distributeur."'"; - } else { - $sql .= " WHERE graph = 'distributeur.gain.mensuel'"; - } - $sql .= " ORDER BY ord ASC;"; - $resql = $this->db->query($sql); - - if ($resql) - { - while ($row = $this->db->fetch_row($resql)) - { - $gains[$row[0]] = $row[1]; - } - } - - $sql = "SELECT legend, valeur"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_stats"; - if ($distributeur > 0 ){ - $sql .= " WHERE graph = 'distributeur.commission.mensuel.".$distributeur."'"; - } else { - $sql .= " WHERE graph = 'distributeur.commission.mensuel'"; - } - $sql .= " ORDER BY ord ASC"; - $resql = $this->db->query($sql); - - if ($resql) - { - while ($row = $this->db->fetch_row($resql)) - { - $comms[$row[0]] = $row[1]; - } - } - - $datas = array(); - $labels = array(); - - $month = array(); - $month[1] = 'J'; - $month[2] = 'F'; - $month[3] = 'M'; - $month[4] = 'A'; - $month[5] = 'M'; - $month[6] = 'J'; - $month[7] = 'J'; - $month[8] = 'A'; - $month[9] = 'S'; - $month[10] = 'O'; - $month[11] = 'N'; - $month[12] = 'D'; - - for ($i = 1 ; $i < 13 ; $i++) - { - $idx = $this->year.substr('0'.$i,-2); - $datas[$i-1] = $gains[$idx] - $comms[$idx]; - $labels[$i-1] = $month[$i]; - - if ($distributeur > 0 ){ - $sqli = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_stats"; - $sqli .= " (graph,ord,legend,valeur)"; - $sqli .= " VALUES ('distributeur.resultat.mensuel.".$distributeur."'"; - $sqli .= ",'$i','".$idx."','".$datas[$i-1]."');"; - $resqli = $this->db->query($sqli); - } else { - $sqli = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_stats"; - $sqli .= " (graph,ord,legend,valeur)"; - $sqli .= " VALUES ('distributeur.resultat.mensuel'"; - $sqli .= ",'$i','".$idx."','".$datas[$i-1]."');"; - $resqli = $this->db->query($sqli); - } - - } - - if (sizeof($datas)) - { - $this->GraphDraw($this->file, $datas, $labels); - } - } -} -?> diff --git a/htdocs/telephonie/stats/distributeurs/index.php b/htdocs/telephonie/stats/distributeurs/index.php deleted file mode 100644 index 13e29220835..00000000000 --- a/htdocs/telephonie/stats/distributeurs/index.php +++ /dev/null @@ -1,147 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if (!$user->rights->telephonie->lire) accessforbidden(); -if (!$user->rights->telephonie->stats->lire) accessforbidden(); - -llxHeader('','Telephonie - Statistiques - Distributeurs'); - -/* - * - * - * - */ - -$h = 0; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/distributeurs/index.php'; -$head[$h][1] = "Prise d'ordre"; -$hselected = $h; -$h++; -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/distributeurs/resultats.php'; -$head[$h][1] = "Résultats"; -$h++; -dol_fiche_head($head, $hselected, "Distributeurs"); - -print ''; - -print ''; -print '
'; - -print ''; -print ''; -print ''; - -$sql = "SELECT sum(p.montant), d.nom, d.rowid"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_distributeur as d"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_contrat_priseordre as p"; - -$sql .= " WHERE p.fk_distributeur = d.rowid"; -$sql .= " GROUP BY d.rowid"; - -$resql = $db->query($sql); - -if ($resql) -{ - $num = $db->num_rows(); - $i = 0; - $total = 0; - - while ($i < $num) - { - $row = $db->fetch_row($i); - - $var=!$var; - - print ""; - - print ''; - - print ''; - $i++; - } - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} -print '
DistributeurPrise d\'ordre
'.$row[1].''.price($row[0]).'

'; - - -/* - * Commerciaux - * - */ - -print ''; -print ''; -print ''; - -$sql = "SELECT sum(p.montant), d.nom, u.firstname, u.name, u.rowid"; -$sql .= " FROM ".MAIN_DB_PREFIX."user as u"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_distributeur as d"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_contrat_priseordre as p"; -$sql .= " , ".MAIN_DB_PREFIX."telephonie_distributeur_commerciaux as dc"; - -$sql .= " WHERE p.fk_commercial = u.rowid"; -$sql .= " AND dc.fk_user = u.rowid"; -$sql .= " AND p.fk_distributeur = d.rowid"; -$sql .= " GROUP BY u.rowid"; - -$resql = $db->query($sql); - -if ($resql) -{ - $num = $db->num_rows(); - $i = 0; - $total = 0; - - while ($i < $num) - { - $row = $db->fetch_row($i); - $var=!$var; - print ""; - print ''; - print ''; - print ''; - $i++; - } - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - - - -print '
DistributeurCommercialPrise d\'ordre
'.$row[1].''.$row[2]." ".$row[3].''.price($row[0]).'

'; - - -print '
 

'; - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/stats/distributeurs/lignes.php b/htdocs/telephonie/stats/distributeurs/lignes.php deleted file mode 100644 index e0eddeba0bf..00000000000 --- a/htdocs/telephonie/stats/distributeurs/lignes.php +++ /dev/null @@ -1,75 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if (!$user->rights->telephonie->lire) accessforbidden(); - -llxHeader('','Telephonie - Statistiques - Distributeurs'); - -/* - * - * - * - */ - - -$h = 0; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/distributeurs/index.php'; -$head[$h][1] = "Global"; -$h++; - -if ($_GET["commid"]) -{ - $comm = new User($db, $_GET["commid"]); - $comm->fetch(); - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/distributeurs/commercial.php?commid='.$comm->id; - $head[$h][1] = $comm->fullname; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/distributeurs/commercialca.php?commid='.$comm->id; - $head[$h][1] = "CA"; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/distributeurs/lignes.php?commid='.$comm->id; - $head[$h][1] = "Lignes"; - $hselected = $h; - $h++; - - dol_fiche_head($head, $hselected, "Distributeurs"); - - print ''; - - print ''; - print '
'; - - print 'Statuts des lignes

'."\n"; - - print '
'; - - $db->close(); - -} - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/stats/distributeurs/pre.inc.php b/htdocs/telephonie/stats/distributeurs/pre.inc.php deleted file mode 100644 index f7a054cf328..00000000000 --- a/htdocs/telephonie/stats/distributeurs/pre.inc.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("../../../main.inc.php"); -require_once DOL_DOCUMENT_ROOT.'/telephonie/stats/tools.lib.php'; - -$user->getrights('telephonie'); - -function llxHeader($head = "", $title="") { - global $user, $conf; - - /* - * - * - */ - top_menu($head, $title); - - $menu = new Menu(); - - include "../menus.php"; - - left_menu($menu->liste); -} - -?> diff --git a/htdocs/telephonie/stats/distributeurs/resultats.php b/htdocs/telephonie/stats/distributeurs/resultats.php deleted file mode 100644 index 7d6d5e1dd5e..00000000000 --- a/htdocs/telephonie/stats/distributeurs/resultats.php +++ /dev/null @@ -1,194 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); -require DOL_DOCUMENT_ROOT.'/telephonie/distributeurtel.class.php'; - -if (!$user->rights->telephonie->lire) accessforbidden(); - -llxHeader('','Telephonie - Statistiques - Distributeur'); - -/* - * - * - * - */ -$h = 0; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/distributeurs/index.php'; -$head[$h][1] = "Prise d'ordre"; -$h++; -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/distributeurs/resultats.php'; -$head[$h][1] = "Résultats"; -$hselected = $h; -$h++; - -$year = strftime("%Y",time()); -if (strftime("%m",time()) == 1) -{ - $year = $year -1; -} -if ($_GET["year"] > 0) -{ - $year = $_GET["year"]; -} -$total = 0; -$var = True; -dol_fiche_head($head, $hselected, "Distributeurs"); -stat_year_bar($year); - -print ''; - -print ''; - -print '
'; -print 'Resultat mensuel'."\n"; -print ''; -print ''; -print ''; - -$sql = "SELECT valeur,legend FROM ".MAIN_DB_PREFIX."telephonie_stats"; -$sql .= " WHERE graph = 'distributeur.resultat.mensuel'"; -$sql .= " AND legend like '".$year."%'"; -$sql .= " ORDER BY legend DESC"; -$resql = $db->query($sql); - -if ($resql) -{ - while ($row = $db->fetch_row($resql)) - { - print "'; - print ''; - $total += $row[0]; - $var=!$var; - } - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} -print ""; -print ''; -print '
MoisResultat
".$row[1].''.price($row[0]).'
Total'.price($total).'
'; - -print '
'; - -print 'Gain mensuel'."\n"; -print ''; -print ''; -print ''; - -$sql = "SELECT sum(valeur),legend FROM ".MAIN_DB_PREFIX."telephonie_stats"; -$sql .= " WHERE graph = 'distributeur.gain.mensuel'"; -$sql .= " AND legend like '".$year."%'"; -$sql .= " GROUP BY legend DESC"; -$resql = $db->query($sql); -$total = 0; -if ($resql) -{ - while ($row = $db->fetch_row($resql)) - { - print "'; - print ''; - $total += $row[0]; - $var=!$var; - } - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} -print ""; -print ''; -print '
MoisGain
".$row[1].''.price($row[0]).'
Total'.price($total).'
'; - -print '
'; -print 'Commission mensuelle'."\n"; - -print ''; - -print ''; -print ''; - -$sql = "SELECT valeur,legend FROM ".MAIN_DB_PREFIX."telephonie_stats"; -$sql .= " WHERE graph = 'distributeur.commission.mensuel'"; -$sql .= " AND legend like '".$year."%'"; -$sql .= " GROUP BY legend DESC"; -$resql = $db->query($sql); -$total = 0; -if ($resql) -{ - while ($row = $db->fetch_row($resql)) - { - print "'; - print ''; - $total += $row[0]; - $var=!$var; - } - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} -print ""; -print ''; -print '
MoisCommission
".$row[1].''.price($row[0]).'
Total'.price($total).'
'; - -print '
'; - -print 'Ca mensuel'."\n"; -print ''; -print ''; -print ''; - -$sql = "SELECT sum(valeur),legend FROM ".MAIN_DB_PREFIX."telephonie_stats"; -$sql .= " WHERE graph = 'distributeur.ca.mensuel'"; -$sql .= " AND legend like '".$year."%'"; -$sql .= " GROUP BY legend DESC"; -$resql = $db->query($sql); -$total = 0; -if ($resql) -{ - while ($row = $db->fetch_row($resql)) - { - print "'; - print ''; - $total += $row[0]; - $var=!$var; - } - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} -print ""; -print ''; -print '
MoisCa
".$row[1].''.price($row[0]).'
Total'.price($total).'
'; - -print '
'; -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/stats/factures/gain.php b/htdocs/telephonie/stats/factures/gain.php deleted file mode 100644 index 232b55ff1ab..00000000000 --- a/htdocs/telephonie/stats/factures/gain.php +++ /dev/null @@ -1,78 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; - -if (!$user->rights->telephonie->lire) - accessforbidden(); - -llxHeader('','Telephonie - Ligne'); - -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -$h = 0; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/factures/index.php'; -$head[$h][1] = "Global"; -$h++; -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/factures/gain.php'; -$head[$h][1] = "Gain"; -$hselected = $h; -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/factures/type.php'; -$head[$h][1] = "Méthode de paiement"; -$h++; - -dol_fiche_head($head, $hselected, "Satistiques Factures"); - -print ''; - -print ''; - -print '
'; - -print 'Jour de la semaine

'; - -print 'Jour de la semaine

'; - -print 'Jour de la semaine

'; - -print '
'; - -print '

'; - -print '
'; - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/stats/factures/index.php b/htdocs/telephonie/stats/factures/index.php deleted file mode 100644 index 4c90a97810f..00000000000 --- a/htdocs/telephonie/stats/factures/index.php +++ /dev/null @@ -1,124 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if (!$user->rights->telephonie->lire) accessforbidden(); -if (!$user->rights->telephonie->stats->lire) accessforbidden(); - -llxHeader('','Telephonie - Ligne'); - -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -$year = strftime("%Y",time()); -if (strftime("%m",time()) == 1) -{ - $year = $year -1; -} -if ($_GET["year"] > 0) -{ - $year = $_GET["year"]; -} - -$h = 0; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/factures/index.php'; -$head[$h][1] = "Global"; -$hselected = $h; -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/factures/marge.php'; -$head[$h][1] = "Marge"; -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/factures/type.php'; -$head[$h][1] = "Méthode de paiement"; -$h++; - -dol_fiche_head($head, $hselected, "Satistiques Factures"); -stat_year_bar($year); - -print ''; - -print '\n"; -print '\n"; -print '\n"; -print "
'; - -print 'ca_mensuel'; - -print ''; -_legend($db, "factures.ca_mensuel", "%11.2f"); - -print "
'; - -print 'facture_moyenne'; - -print ''; -_legend($db, "factures.facture_moyenne","%01.1f"); - -print "
'; - -print 'nb_facture '.$year.''; - -print ''; -_legend($db, "factures.nb_mensuel","%01.0f"); - -print "
\n"; - -$db->close(); - -function _legend($db, $graph, $format) -{ - print ''; - print ''; - print ''; - $sql = "SELECT legend, valeur"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_stats"; - $sql .= " WHERE graph = '".$graph."'"; - $sql .= " ORDER BY ord DESC"; - - $resql = $db->query($sql); - - if ($resql) - { - while ($row = $db->fetch_row($resql)) - { - $var = !$var; - print ""; - print ''; - } - } - print '
Légende
'.$row[0].''; - print sprintf($format ,$row[1]); - print '
'; -} - - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/stats/factures/lastmonth.php b/htdocs/telephonie/stats/factures/lastmonth.php deleted file mode 100644 index fa31ad4b0e6..00000000000 --- a/htdocs/telephonie/stats/factures/lastmonth.php +++ /dev/null @@ -1,103 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; - -if (!$user->rights->telephonie->lire) - accessforbidden(); - -llxHeader('','Telephonie - Ligne'); - -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -$h = 0; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/factures/index.php'; -$head[$h][1] = "Global"; -$h++; -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/factures/lastmonth.php'; -$head[$h][1] = "3 derniers mois"; -$hselected = $h; -$h++; - - -dol_fiche_head($head, $hselected, "Satistiques Factures"); - -print ''; - -print ''; - -print '
'; - -$now = time(); -$year = strftime("%Y", $now); -$month = strftime("%m", $now); - -for ($i = 1 ; $i < 4 ; $i++) -{ - $month = $month - 1; - - if ($month == 0) - { - $year = $year - 1; - $month = 12; - } - - - print '

'; - -} -print '
'; - -$year = strftime("%Y", $now); -$month = strftime("%m", $now); - -for ($i = 1 ; $i < 4 ; $i++) -{ - $month = $month - 1; - - if ($month == 0) - { - $year = $year - 1; - $month = 12; - } - - - print '

'; - -} - -print '
'; - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/stats/factures/marge.php b/htdocs/telephonie/stats/factures/marge.php deleted file mode 100644 index c199ac3bec2..00000000000 --- a/htdocs/telephonie/stats/factures/marge.php +++ /dev/null @@ -1,84 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; - -if (!$user->rights->telephonie->lire) - accessforbidden(); - -llxHeader('','Telephonie - Ligne'); - -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -$year = ($_GET["year"]>0)?$_GET["year"]:strftime("%Y", time()); - -$h = 0; -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/factures/index.php'; -$head[$h][1] = "Global"; -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/factures/marge.php'; -$head[$h][1] = "Marge"; -$hselected = $h; -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/factures/type.php'; -$head[$h][1] = "Méthode de paiement"; -$h++; - -dol_fiche_head($head, $hselected, "Satistiques Factures $year"); -print '
'; -print '2004'; -print '2005'; -print '2006
'; - -print ''; - -print ''; - -print '
'; - -print 'Marge mensuelle'; - -print '
'; - -print 'Marge moyenne'; - -print '
'; - -print 'Nb de factures'; - -print '
'; - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/stats/factures/pre.inc.php b/htdocs/telephonie/stats/factures/pre.inc.php deleted file mode 100644 index 78329b5eb5f..00000000000 --- a/htdocs/telephonie/stats/factures/pre.inc.php +++ /dev/null @@ -1,39 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("../../../main.inc.php"); -require_once DOL_DOCUMENT_ROOT.'/telephonie/stats/tools.lib.php'; - -$user->getrights('telephonie'); - -function llxHeader($head = "", $title="") { - global $user, $conf; - - top_menu($head, $title); - - $menu = new Menu(); - - include "../menus.php"; - - left_menu($menu->liste); -} - -?> diff --git a/htdocs/telephonie/stats/factures/type.php b/htdocs/telephonie/stats/factures/type.php deleted file mode 100644 index cbdafb7f5c5..00000000000 --- a/htdocs/telephonie/stats/factures/type.php +++ /dev/null @@ -1,119 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; - -if (!$user->rights->telephonie->lire) - accessforbidden(); - -llxHeader('','Telephonie - Ligne'); - -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -$h = 0; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/factures/index.php'; -$head[$h][1] = "Global"; -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/factures/marge.php'; -$head[$h][1] = "Marge"; -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/factures/type.php'; -$head[$h][1] = "Méthode de paiement"; -$hselected = $h; -$h++; - -//$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/factures/lastmonth.php'; -//$head[$h][1] = "3 derniers mois"; -//$h++; - -dol_fiche_head($head, $hselected, "Satistiques Factures"); - -print ''; - -print ''; - - - -print '
'; - -print 'ca_mensuel'; - -print ''; - -_legend($db, "Prélèvement","factures.ca_mensuel_preleve"); -print ''; -_legend($db, "Autres","factures.ca_mensuel_autre"); - -print '
'; - -$db->close(); - - -function _legend($db, $legend, $graph) -{ - global $bc; - print ''; - print ''; - print ''; - $sql = "SELECT legend, valeur"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_stats"; - $sql .= " WHERE graph = '".$graph."'"; - $sql .= " ORDER BY ord DESC"; - - $resql = $db->query($sql); - - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - while ($i < $num) - { - $row = $db->fetch_row($resql); - $var = !$var; - print ""; - print ''; - - $i++; - } - } - print '
'.$legend.'
mois '.$row[0].''.ceil($row[1]).' euros HT
'; -} - - - - - - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/stats/fournisseurs/index.php b/htdocs/telephonie/stats/fournisseurs/index.php deleted file mode 100644 index 9638dc100af..00000000000 --- a/htdocs/telephonie/stats/fournisseurs/index.php +++ /dev/null @@ -1,82 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if (!$user->rights->telephonie->lire) accessforbidden(); -if (!$user->rights->telephonie->stats->lire) accessforbidden(); - -llxHeader('','Telephonie - Statistiques - Fournisseurs'); -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - - -$h = 0; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/communications/index.php'; -$head[$h][1] = "Global"; -$hselected = $h; -$h++; - - -dol_fiche_head($head, $hselected, "Fournisseurs"); - -print ''."\n"; - -print ''; - -print '
'."\n"; - -print 'Duree Moyenne

'."\n"; - -print '
'; - -print ''."\n"; - -print ''; - -print ''; -print ''; - -print '
'."\n"; - -print 'Communications nationales

'."\n"; - -print '
'."\n"; - -print 'Communications mobiles

'."\n"; - -print '
'."\n"; - -print 'Communications internationales

'."\n"; - -print '
'; - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/stats/fournisseurs/pre.inc.php b/htdocs/telephonie/stats/fournisseurs/pre.inc.php deleted file mode 100644 index ca113ce72bf..00000000000 --- a/htdocs/telephonie/stats/fournisseurs/pre.inc.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("../../../main.inc.php"); -require(DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); - -$user->getrights('telephonie'); - -function llxHeader($head = "", $title="") { - global $user; - - /* - * - * - */ - top_menu($head, $title); - - $menu = new Menu(); - - include "../menus.php"; - - left_menu($menu->liste); -} - -?> diff --git a/htdocs/telephonie/stats/graph/SimpleBar.class.php b/htdocs/telephonie/stats/graph/SimpleBar.class.php deleted file mode 100644 index 178854acd4f..00000000000 --- a/htdocs/telephonie/stats/graph/SimpleBar.class.php +++ /dev/null @@ -1,76 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - */ - -require_once (DOL_DOCUMENT_ROOT."/includes/artichow/BarPlot.class.php"); - -class DolibarrSimpleBar { - - Function DolibarrSimpleBar($DB, $file) - { - $this->db = $DB; - $this->file = $file; - $this->barcolor = "green"; - $this->height = 240; - $this->width = 360; - $this->yAxisLegend = ''; - } - - Function GraphDraw($file, $datas, $labels) - { - $group = new PlotGroup; - $group->setPadding(30, 10, NULL, NULL); - - $graph = new Graph($this->width, $this->height); - $graph->border->hide(); - $graph->setAntiAliasing(true); - if (isset($this->titre)) - { - $graph->title->set($this->titre); - $graph->title->setFont(new Tuffy(10)); - } - - $bgcolor= new Color(222,231,236); - $graph->setBackgroundColor($bgcolor); - - - $plot = new BarPlot($datas); - - $plot->barShadow->setSize(2); - $plot->barShadow->setPosition('Shadow::RIGHT_TOP'); - $plot->barShadow->setColor(new Color(160, 160, 160, 10)); - $plot->barShadow->smooth(TRUE); - - $color = new $this->barcolor; - $plot->setBarColor($color); - - $plot->xAxis->setLabelText($labels); - $plot->xAxis->label->setFont(new Tuffy(7)); - - if ($this->yAxisLegend) - { - $plot->yAxis->title->set($this->yAxisLegend); - $plot->yAxis->title->setFont(new Tuffy(7)); - } - - $graph->add($plot); - $graph->draw($file); - } -} -?> diff --git a/htdocs/telephonie/stats/graph/appelsdureemoyenne.class.php b/htdocs/telephonie/stats/graph/appelsdureemoyenne.class.php deleted file mode 100644 index ad4b5277d79..00000000000 --- a/htdocs/telephonie/stats/graph/appelsdureemoyenne.class.php +++ /dev/null @@ -1,126 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/bar.class.php"); - -class GraphAppelsDureeMoyenne extends GraphBar{ - - - Function GraphAppelsDureeMoyenne($DB, $file) - { - $this->db = $DB; - $this->file = $file; - - $this->datas = array(); - $this->labels = array(); - - $this->client = 0; - $this->contrat = 0; - $this->ligne = 0; - - $this->titre = "Durée moyenne des appels par mois"; - $this->showframe = true; - $this->barcolor = "pink"; - } - - Function Graph($datas='', $labels='') - { - $this->GetDatas(); - - $this->width = 360; - - if (sizeof($this->datas)) - { - $this->GraphDraw($this->file, $this->datas, $this->labels); - } - } - - Function GetDatas() - { - $num = 0; - - $sql = "SELECT date_format(td.date,'%Y%m'), sum(td.duree), count(td.duree)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details as td"; - - if ($this->client == 0 && $this->contrat == 0 && $this->ligne == 0) - { - $sql .= " GROUP BY date_format(td.date,'%Y%m') ASC "; - } - elseif ($this->client > 0 && $this->contrat == 0 && $this->ligne == 0) - { - $sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as s"; - - $sql .= " WHERE td.ligne = s.ligne"; - $sql .= " AND s.fk_client_comm = ".$this->client; - $sql .= " GROUP BY date_format(td.date,'%Y%m') ASC "; - } - elseif ($this->client == 0 && $this->contrat > 0 && $this->ligne == 0) - { - - $sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as s"; - - $sql .= " WHERE td.ligne = s.ligne"; - $sql .= " AND s.fk_contrat = ".$this->contrat; - $sql .= " GROUP BY date_format(td.date,'%Y%m') ASC "; - } - elseif ($this->client == 0 && $this->contrat == 0 && $this->ligne > 0) - { - - $sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as s"; - - $sql .= " WHERE td.ligne = s.ligne"; - $sql .= " AND s.rowid = ".$this->ligne; - $sql .= " GROUP BY date_format(td.date,'%Y%m') ASC "; - } - - if ($this->db->query($sql)) - { - $num = $this->db->num_rows(); - $i = 0; - - while ($i < $num) - { - $row = $this->db->fetch_row(); - - $this->labels[$i] = substr($row[0],4,2); - $this->datas[$i] = ($row[1] / $row[2] ) ; - - $i++; - } - - $this->db->free(); - } - else - { - print $this->db->error() . ' ' . $sql; - exit ; - } - - - if ($this->show_console) - { - print $this->client . " " . $cv[$i - 1]."\n"; - } - } - -} -?> diff --git a/htdocs/telephonie/stats/graph/bar.class.php b/htdocs/telephonie/stats/graph/bar.class.php deleted file mode 100644 index 2f1f934cc02..00000000000 --- a/htdocs/telephonie/stats/graph/bar.class.php +++ /dev/null @@ -1,131 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/graph.class.php"); - -class GraphBar extends DolibarrGraph { - - Function GraphBar($DB, $file) - { - $this->db = $DB; - $this->file = $file; - $this->bgcolor = "#DEE7EC"; - $this->barcolor = "green"; - $this->client = 0; - $this->showframe = true; - } - - Function GraphDraw($file, $datas, $labels) - { - // Create the graph. These two calls are always required - - $height = 240; - $width = 320; - - if ($this->width <> $width && $this->width > 0) - $width = $this->width; - - if ($this->height <> $height && $this->height > 0) - $height = $this->height; - - if (sizeof($datas) && sizeof($labels)) - { - $graph = new Graph($width, $height,"auto"); - $graph->SetScale("textlin"); - - $graph->yaxis->scale->SetGrace(20); - - $graph->SetFrame($this->showframe); - - $graph->img->SetMargin(50,20,20,35); - - if ($this->type == 'LinePlot') - { - $b2plot = new LinePlot($datas); - } - else - { - $b2plot = new BarPlot($datas); - } - - $b2plot->SetFillColor($this->barcolor); - - $graph->xaxis->scale->SetGrace(20); - /* - $LabelAngle = 0; - - if ($this->LabelAngle <> $LabelAngle && strlen($this->LabelAngle) > 0) - $LabelAngle = $this->LabelAngle; - - if ($this->LabelAngle > 0) - { - $graph->xaxis->SetLabelAngle($LabelAngle); - $graph->xaxis->SetFont(FF_VERDANA,FS_NORMAL,7); - } - */ - $graph->title->Set($this->titre); - $graph->xaxis->SetTickLabels($labels); - //$graph->title->SetFont(FF_VERDANA,FS_NORMAL); - - if (!$this->no_xaxis_title) - { - $graph->xaxis->title->Set(strftime("%d/%m/%y %H:%M:%S", time())); - } - - $graph->Add($b2plot); - - // Display the graph - - $graph->img->SetImgFormat("png"); - $graph->Stroke($file); - } - else - { - // Setup a basic canvas we can work - $g = new CanvasGraph($width,$height,'auto'); - $g->SetMargin(5,11,6,11); - $g->SetShadow(); - $g->SetMarginColor("teal"); - - // We need to stroke the plotarea and margin before we add the - // text since we otherwise would overwrite the text. - //$g->InitFrame(); - - // Draw a text box in the middle - $txt = "Données manquantes !"; - $t = new Text($txt,ceil($width / 2),ceil($height/2)); - //$t->SetFont(FF_VERDANA, FS_BOLD, 10); - - // How should the text box interpret the coordinates? - $t->Align('center','top'); - $t->SetBox("white","black","gray"); - $t->ParagraphAlign('center'); - - // Stroke the text - $t->Stroke($g->img); - - // Stroke the graph - $g->Stroke($file); - } - } -} -?> diff --git a/htdocs/telephonie/stats/graph/baracc.class.php b/htdocs/telephonie/stats/graph/baracc.class.php deleted file mode 100644 index 1dfe20ba5a2..00000000000 --- a/htdocs/telephonie/stats/graph/baracc.class.php +++ /dev/null @@ -1,105 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/graph.class.php"); - -class GraphBarAcc extends DolibarrGraph { - - Function GraphBarAcc($DB, $file) - { - $this->db = $DB; - $this->file = $file; - $this->bgcolor = "#DEE7EC"; - $this->barcolor = "green"; - $this->client = 0; - $this->showframe = true; - } - - Function GraphDraw($file, $datas, $labels, $moys) - { - // Create the graph. These two calls are always required - - $height = 240; - $width = 320; - - if ($this->width <> $width && $this->width > 0) - $width = $this->width; - - if ($this->height <> $height && $this->height > 0) - $height = $this->height; - - $graph = new Graph($width, $height,"auto"); - $graph->SetScale("textlin"); - - $graph->yaxis->scale->SetGrace(20); - - $graph->SetFrame($this->showframe); - - // Margins : left, right, top, bottom - - $graph->img->SetMargin(40,20,20,35); - - $b2plot = new BarPlot($datas); - - $b2plot->SetFillColor($this->barcolor); - - $graph->xaxis->scale->SetGrace(20); - - $LabelAngle = 45; - if ($this->LabelAngle <> $LabelAngle && strlen($this->LabelAngle) > 0) - { - $LabelAngle = $this->LabelAngle; - } - - if ($this->LabelAngle > 0) - { - $graph->xaxis->SetLabelAngle($LabelAngle); - $graph->xaxis->SetFont(FF_VERDANA,FS_NORMAL,7); - } - - - $b1plot = new BarPlot($moys); - $b1plot->SetFillColor("gray"); - - // Create the accumulated bar plots - $ab1plot = new AccBarPlot(array($b2plot,$b1plot)); - - // ...and add it to the graph - $graph->Add($ab1plot); - - - // Titre - - $graph->title->Set($this->titre); - $graph->title->SetFont(FF_VERDANA,FS_NORMAL); - - $graph->xaxis->SetTickLabels($labels); - - $graph->xaxis->title->Set(strftime("%d/%m/%y %H:%M:%S", time())); - - // Display the graph - - $graph->img->SetImgFormat("png"); - $graph->Stroke($file); - } -} -?> diff --git a/htdocs/telephonie/stats/graph/baraccumul.class.php b/htdocs/telephonie/stats/graph/baraccumul.class.php deleted file mode 100644 index ce38350d325..00000000000 --- a/htdocs/telephonie/stats/graph/baraccumul.class.php +++ /dev/null @@ -1,174 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/graph.class.php"); - -class GraphBarAccumul extends DolibarrGraph { - - Function GraphBarAccumul($DB, $file) - { - $this->db = $DB; - $this->file = $file; - $this->bgcolor = "#DEE7EC"; - $this->barcolor = "green"; - $this->client = 0; - $this->showframe = true; - $this->datas = array(); - - $this->legend = array(); - - $this->datas_color[0][0] = "green"; - $this->datas_color[0][1] = "yellow"; - $this->datas_color[0][2] = "blue"; - $this->datas_color[0][3] = "pink"; - - $this->datas_color[1][0] = "blue"; - $this->datas_color[1][1] = "red"; - $this->datas_color[1][2] = "white"; - $this->datas_color[1][3] = "pink"; - } - - Function add_datas($p_datas) - { - /* - $num = sizeof($this->datas); - - $this->datas[$num] = $p_datas; - */ - $this->datas = $p_datas; - } - - Function GraphDraw($file, $labels, $datas) - { - // Create the graph. These two calls are always required - - $height = 240; - $width = 320; - - if ($this->width <> $width && $this->width > 0) - $width = $this->width; - - if ($this->height <> $height && $this->height > 0) - $height = $this->height; - - if (sizeof($datas) && sizeof($labels)) - { - $graph = new Graph($width, $height,"auto"); - $graph->SetScale("textlin"); - - $graph->yaxis->scale->SetGrace(20); - - $graph->SetFrame($this->showframe); - - $graph->img->SetMargin(40,20,20,35); - - - $graph->xaxis->scale->SetGrace(20); - - $LabelAngle = 45; - - if ($this->LabelAngle <> $LabelAngle && strlen($this->LabelAngle) > 0) - $LabelAngle = $this->LabelAngle; - - if ($this->LabelAngle > 0) - { - $graph->xaxis->SetLabelAngle($LabelAngle); - $graph->xaxis->SetFont(FF_VERDANA,FS_NORMAL,7); - } - - $graph->title->Set($this->titre); - - $graph->title->SetFont(FF_VERDANA,FS_NORMAL); - - - $graph->xaxis->SetTickLabels($labels); - $graph->xaxis->title->Set(strftime("%d/%m/%y %H:%M:%S", time())); - - // - - $gbspl = array(); - - for ($j = 0 ; $j < sizeof($this->datas) ; $j++) - { - $accs = array(); - for ($i = 0 ; $i < sizeof($this->datas[$j]) ; $i++) - { - $b1plot = new BarPlot($this->datas[$j][$i]); - $b1plot->SetFillColor($this->datas_color[$j][$i]); - - $b1plot->SetLegend($this->legend[$j][$i]); - - - array_push($accs, $b1plot); - } - - // Create the accumulated bar plots - $ab1plot = new AccBarPlot($accs); - - array_push($gbspl, $ab1plot); - } - - $gbplot = new GroupBarPlot ($gbspl); - - - - // Adjust the legend position - $graph->legend->Pos(0.14,0.14,"left","center"); - - $graph->Add($gbplot); - - // Display the graph - - $graph->img->SetImgFormat("png"); - $graph->Stroke($file); - } - else - { - // Setup a basic canvas we can work - $g = new CanvasGraph($width,$height,'auto'); - $g->SetMargin(5,11,6,11); - $g->SetShadow(); - $g->SetMarginColor("teal"); - - // We need to stroke the plotarea and margin before we add the - // text since we otherwise would overwrite the text. - //$g->InitFrame(); - - // Draw a text box in the middle - $txt = "Données manquantes !"; - $t = new Text($txt,ceil($width / 2),ceil($height/2)); - $t->SetFont(FF_VERDANA, FS_BOLD, 10); - - // How should the text box interpret the coordinates? - $t->Align('center','top'); - $t->SetBox("white","black","gray"); - $t->ParagraphAlign('center'); - - // Stroke the text - $t->Stroke($g->img); - - // Stroke the graph - $g->Stroke($file); - } - } -} -?> diff --git a/htdocs/telephonie/stats/graph/barmoy.class.php b/htdocs/telephonie/stats/graph/barmoy.class.php deleted file mode 100644 index 15610e84049..00000000000 --- a/htdocs/telephonie/stats/graph/barmoy.class.php +++ /dev/null @@ -1,96 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/graph.class.php"); - -class GraphBarMoy extends DolibarrGraph { - - Function GraphBarMoy($DB, $file) - { - $this->db = $DB; - $this->file = $file; - $this->bgcolor = "#DEE7EC"; - $this->barcolor = "green"; - $this->client = 0; - $this->showframe = true; - } - - Function GraphDraw($file, $datas, $labels, $moys) - { - // Create the graph. These two calls are always required - - $height = 240; - $width = 320; - - if ($this->width <> $width && $this->width > 0) - $width = $this->width; - - if ($this->height <> $height && $this->height > 0) - $height = $this->height; - - $graph = new Graph($width, $height,"auto"); - $graph->SetScale("textlin"); - - $graph->yaxis->scale->SetGrace(20); - - $graph->SetFrame($this->showframe); - - $graph->img->SetMargin(40,20,20,40); - - $b2plot = new BarPlot($datas); - - $b2plot->SetFillColor($this->barcolor); - - $graph->xaxis->scale->SetGrace(20); - - $LabelAngle = 45; - if ($this->LabelAngle <> $LabelAngle && $this->LabelAngle > 0) - $LabelAngle = $this->LabelAngle; - - $graph->xaxis->SetLabelAngle($LabelAngle); - - $graph->xaxis->SetFont(FF_VERDANA,FS_NORMAL,8); - - - $b1plot = new BarPlot($moys); - $b1plot->SetFillColor("gray"); - - $gbplot = new GroupBarPlot(array($b2plot,$b1plot)); - - $graph->Add($gbplot); - - $graph->title->Set($this->titre); - - $graph->title->SetFont(FF_VERDANA,FS_NORMAL); - - $graph->yaxis->title->SetFont(FF_FONT2); - $graph->xaxis->title->SetFont(FF_FONT1); - - $graph->xaxis->SetTickLabels($labels); - - // Display the graph - - $graph->img->SetImgFormat("png"); - $graph->Stroke($file); - } -} -?> diff --git a/htdocs/telephonie/stats/graph/brouzouf.class.php b/htdocs/telephonie/stats/graph/brouzouf.class.php deleted file mode 100644 index d0b8026f9fb..00000000000 --- a/htdocs/telephonie/stats/graph/brouzouf.class.php +++ /dev/null @@ -1,78 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -class GraphBrouzouf { - - Function GraphBrouzouf($DB, $file) - { - $this->db = $DB; - $this->file = $file; - - $this->client = 0; - - } - - Function GraphMakeGraph($datas, $labels) - { - // Create the graph. These two calls are always required - - $height = 240; - $width = 360; - - if ($this->width <> $width && $this->width > 0) - $width = $this->width; - - $graph = new Graph($width, $height,"auto"); - $graph->SetScale("textlin"); - $graph->yaxis->scale->SetGrace(20); - - - $graph->img->SetMargin(50,20,20,40); - - if ($this->type == 'LinePlot') - { - $b2plot = new LinePlot($datas); - } - else - { - $b2plot = new BarPlot($datas); - } - - $b2plot->SetFillColor($this->barcolor); - - $graph->xaxis->scale->SetGrace(20); - //$graph->xaxis->SetLabelAlign('center','bottom'); - - $graph->Add($b2plot); - - $graph->title->Set($this->titre); - - $graph->xaxis->SetTickLabels($labels); - - // Display the graph - - $graph->img->SetImgFormat("png"); - $graph->Stroke($this->file); - } - -} -?> diff --git a/htdocs/telephonie/stats/graph/ca.class.php b/htdocs/telephonie/stats/graph/ca.class.php deleted file mode 100644 index bb5171613c7..00000000000 --- a/htdocs/telephonie/stats/graph/ca.class.php +++ /dev/null @@ -1,116 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/brouzouf.class.php"); - -class GraphCa extends GraphBrouzouf -{ - - Function GraphCa($DB, $file) - { - $this->db = $DB; - $this->file = $file; - - $this->client = 0; - $this->contrat = 0; - $this->ligne = 0; - $this->titre = "Chiffre d'affaire (euros HT)"; - - $this->barcolor = "green"; - } - - - Function GraphDraw() - { - $sql = "SELECT tf.date, sum(tf.gain), sum(tf.cout_vente), sum(tf.fourn_montant)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture as tf"; - - if ($this->client == 0 && $this->contrat == 0 && $this->ligne == 0) - { - $sql .= " WHERE tf.fk_facture is not null"; - } - elseif ($this->client > 0 && $this->contrat == 0 && $this->ligne == 0) - { - $sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as s"; - $sql .= " WHERE fk_facture is not null"; - $sql .= " AND s.rowid = tf.fk_ligne"; - $sql .= " AND s.fk_client_comm = ".$this->client; - } - elseif ($this->client == 0 && $this->contrat > 0 && $this->ligne == 0) - { - - $sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as s"; - $sql .= " WHERE tf.fk_facture is not null"; - $sql .= " AND s.rowid = tf.fk_ligne"; - $sql .= " AND s.fk_contrat = ".$this->contrat; - } - elseif ($this->client == 0 && $this->contrat == 0 && $this->ligne > 0) - { - $sql .= " WHERE tf.fk_facture is not null"; - $sql .= " AND tf.fk_ligne = ".$this->ligne; - } - - $sql .= " GROUP BY tf.date ASC"; - - if ($this->db->query($sql)) - { - $num = $this->db->num_rows(); - $i = 0; - - $labels = array(); - $cf = array(); - $cv = array(); - $gg = array(); - - while ($i < $num) - { - $row = $this->db->fetch_row($i); - - $cf[$i] = $row[3]; - $cv[$i] = $row[2]; - $g[$i] = $row[1]; - $labels[$i] = substr($row[0],5,2); - - $i++; - } - - $this->db->free(); - } - else - { - print $this->db->error() . ' ' . $sql; - } - - - if ($this->show_console) - { - print $this->client . " " . $cv[$i - 1]."\n"; - } - - if ($num > 0) - { - $this->GraphMakeGraph($cv, $labels); - } - } - -} -?> diff --git a/htdocs/telephonie/stats/graph/camenbert.class.php b/htdocs/telephonie/stats/graph/camenbert.class.php deleted file mode 100644 index 5a5a5638ade..00000000000 --- a/htdocs/telephonie/stats/graph/camenbert.class.php +++ /dev/null @@ -1,83 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/graph.class.php"); - -class GraphCamenbert extends DolibarrGraph { - - Function GraphCamenbert($DB, $file) - { - $this->file = $file; - $this->titre = "Camenbert"; - $this->colors = array('pink','yellow','blue','green','red','white','grey'); - } - - Function GraphDraw($datas, $legends) - { - - // Create the graph. These two calls are always required - $graph = new PieGraph(420,260,"auto"); - - $graph->SetColor("gray") ; - - // Create the bar plots - - $pieplot = new PiePlot($datas); - - $pieplot->SetCenter(0.33,0.5); - - // Label font and color setup - $pieplot->SetFont(FF_FONT1,FS_BOLD); - $pieplot->SetFontColor("darkred"); - - // Use absolute values (type==1) - //$pieplot->SetLabelType(0); - - // Label format - //$pieplot->SetLabelFormat("%d%%"); - - $pieplot->SetSliceColors($this->colors); - - //$pieplot->SetStartAngle(45); - //$pieplot->SetLabelPos(0.6); - - // Size of pie in fraction of the width of the graph - $pieplot->SetSize(0.38); - - // Legends - $pieplot->SetLegends($legends); - $graph->legend->Pos(0.05,0.15); - - $graph->Add($pieplot); - - $graph->title->Set($this->titre); - - $graph->title->SetFont(FF_FONT1,FS_BOLD); - - - // Display the graph - - $graph->img->SetImgFormat("png"); - $graph->Stroke($this->file); - } -} -?> diff --git a/htdocs/telephonie/stats/graph/camoyen.class.php b/htdocs/telephonie/stats/graph/camoyen.class.php deleted file mode 100644 index 37e86817bce..00000000000 --- a/htdocs/telephonie/stats/graph/camoyen.class.php +++ /dev/null @@ -1,136 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/brouzouf.class.php"); - -class GraphCaMoyen extends GraphBrouzouf -{ - - Function GraphCaMoyen($DB, $file) - { - $this->db = $DB; - $this->file = $file; - - $this->show_console = 0; - - $this->client = 0; - $this->titre = "Chiffre d'affaire moyen par client (euros HT)"; - - $this->barcolor = "yellow"; - } - - - Function GraphDraw() - { - $ligne = new LigneTel($this->db); - - $sql = "SELECT date, sum(gain), sum(cout_vente), sum(fourn_montant)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture"; - $sql .= " WHERE fk_facture is not null"; - $sql .= " GROUP BY date ASC"; - - if ($this->db->query($sql)) - { - $num1 = $this->db->num_rows(); - $i = 0; - $labels = array(); - $cf = array(); - $cv = array(); - $gg = array(); - - while ($i < $num1) - { - $row = $this->db->fetch_row(); - - $g[$i] = $row[1]; - $cv[$i] = $row[2]; - $cf[$i] = $row[3]; - - $labels[$i] = substr($row[0],5,2)."/".substr($row[0],2,2); - - $i++; - } - - $this->db->free(); - } - else - { - print $this->db->error() . ' ' . $sql; - } - - $sql = "SELECT f.date, count(l.fk_client_comm)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture as f"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; - $sql .= " WHERE f.fk_facture is not null"; - $sql .= " AND l.rowid = f.fk_ligne"; - $sql .= " GROUP BY f.date ASC"; - - if ($this->db->query($sql)) - { - $num2 = $this->db->num_rows(); - $i = 0; - - $nbc = array(); - - while ($i < $num2) - { - $row = $this->db->fetch_row(); - - $nbc[$i] = $row[1]; - - $i++; - } - - $this->db->free(); - } - else - { - print $this->db->error() . ' ' . $sql; - } - - - if ($this->show_console) - { - print $this->client . " " . $cv[$i - 1]."\n"; - } - - - - for ($j = 0 ; $j < sizeof($nbc) ; $j++) - { - $camoy[$j] = $cv[$j] / $nbc[$j]; - - if ($this->show_console) - { - print $labels[$j] . "\t" . $nbc[$j] ."\t" . price($cv[$j]) ."\t\t" . price($camoy[$j]) ."\n"; - } - } - - - if (($num1 * $num2) > 0) - { - $this->GraphMakeGraph($camoy, $labels); - } - } - -} -?> diff --git a/htdocs/telephonie/stats/graph/comm.nbmensuel.class.php b/htdocs/telephonie/stats/graph/comm.nbmensuel.class.php deleted file mode 100644 index e360383cfbc..00000000000 --- a/htdocs/telephonie/stats/graph/comm.nbmensuel.class.php +++ /dev/null @@ -1,118 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/bar.class.php"); - -class GraphCommNbMensuel extends GraphBar{ - - - Function GraphCommNbMensuel($DB, $file) - { - $this->name = "comm.nbmensuel"; - $this->db = $DB; - $this->file = $file; - $this->showframe = true; - $this->client = 0; - $this->contrat = 0; - $this->ligne = 0; - $this->titre = "Nombre de communications par mois"; - - $this->barcolor = "bisque3"; - - $this->datas = array(); - $this->labels = array(); - } - - Function Graph($datas='', $labels='') - { - $this->GetDatas(); - - $this->width = 360; - - if (sizeof($this->datas)) - { - $this->GraphDraw($this->file, $this->datas, $this->labels); - } - } - - Function GetDatas() - { - $sql = "SELECT date_format(td.date,'%Y%m'), count(*)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details as td"; - - if ($this->client == 0 && $this->contrat == 0 && $this->ligne == 0) - { - - $sql .= " GROUP BY date_format(td.date, '%Y%m') ASC"; - } - elseif ($this->client > 0 && $this->contrat == 0 && $this->ligne == 0) - { - - $sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as s"; - - $sql .= " WHERE td.ligne = s.ligne"; - $sql .= " AND s.fk_client_comm = ".$this->client; - - $sql .= " GROUP BY date_format(td.date,'%Y%m') ASC "; - } - elseif ($this->client == 0 && $this->contrat > 0 && $this->ligne == 0) - { - $sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as s"; - - $sql .= " WHERE td.ligne = s.ligne"; - $sql .= " AND s.fk_contrat = ".$this->contrat; - - $sql .= " GROUP BY date_format(td.date,'%Y%m') ASC "; - } - elseif ($this->client == 0 && $this->contrat == 0 && $this->ligne > 0) - { - $sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as s"; - - $sql .= " WHERE td.ligne = s.ligne"; - $sql .= " AND s.rowid = ".$this->ligne; - - $sql .= " GROUP BY date_format(td.date,'%Y%m') ASC "; - } - - if ($this->db->query($sql)) - { - $num = $this->db->num_rows(); - $i = 0; - - while ($i < $num) - { - $row = $this->db->fetch_row(); - - $this->labels[$i] = substr($row[0],4,2); - $this->datas[$i] = $row[1]; - - $i++; - } - $this->db->free(); - } - else - { - dol_syslog("Error"); - } - } -} -?> diff --git a/htdocs/telephonie/stats/graph/comm.nbminutes.class.php b/htdocs/telephonie/stats/graph/comm.nbminutes.class.php deleted file mode 100644 index ea7c807cfda..00000000000 --- a/htdocs/telephonie/stats/graph/comm.nbminutes.class.php +++ /dev/null @@ -1,116 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/bar.class.php"); - -class GraphCommNbMinutes extends GraphBar{ - - - Function GraphCommNbMinutes($DB, $file) - { - $this->name = "comm.nbminutes"; - $this->db = $DB; - $this->file = $file; - $this->showframe = true; - - $this->client = 0; - $this->contrat = 0; - $this->ligne = 0; - - $this->titre = "Nombre de minutes"; - $this->barcolor = "bisque2"; - - $this->datas = array(); - $this->labels = array(); - } - - Function Graph($datas='', $labels='') - { - $this->GetDatas(); - $this->width = 360; - if (sizeof($this->datas)) - { - $this->GraphDraw($this->file, $this->datas, $this->labels); - } - } - - Function GetDatas() - { - - $sql = "SELECT ym, sum(duree)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details as td"; - - if ($this->client == 0 && $this->contrat == 0 && $this->ligne == 0) - { - $sql .= " GROUP BY ym ASC"; - } - elseif ($this->client > 0 && $this->contrat == 0 && $this->ligne == 0) - { - $sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as s"; - - $sql .= " WHERE td.ligne = s.ligne"; - $sql .= " AND s.fk_client_comm = ".$this->client; - - $sql .= " GROUP BY ym ASC "; - } - elseif ($this->client == 0 && $this->contrat > 0 && $this->ligne == 0) - { - $sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as s"; - - $sql .= " WHERE td.ligne = s.ligne"; - $sql .= " AND s.fk_contrat = ".$this->contrat; - - $sql .= " GROUP BY ym ASC "; - } - elseif ($this->client == 0 && $this->contrat == 0 && $this->ligne > 0) - { - $sql .= " WHERE td.fk_ligne = ".$this->ligne; - - $sql .= " GROUP BY ym ASC "; - } - - $resql = $this->db->query($sql); - - if ($resql) - { - $num = $this->db->num_rows($resql); - $i = 0; - - while ($i < $num) - { - $row = $this->db->fetch_row($resql); - - $this->labels[$i] = substr($row[0],2,2); - $this->datas[$i] = ceil($row[1] / 60); - - $i++; - } - $this->db->free($resql); - } - else - { - dol_syslog("Error in GraphCommNbMinutes"); - dol_syslog($sql); - } - } -} -?> diff --git a/htdocs/telephonie/stats/graph/gain.class.php b/htdocs/telephonie/stats/graph/gain.class.php deleted file mode 100644 index 2c5a73f70ab..00000000000 --- a/htdocs/telephonie/stats/graph/gain.class.php +++ /dev/null @@ -1,160 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/brouzouf.class.php"); - -class GraphGain extends GraphBrouzouf{ - - - Function GraphGain($DB, $file) - { - $this->db = $DB; - $this->file = $file; - - $this->client = 0; - $this->contrat = 0; - $this->ligne = 0; - $this->titre = "Gain (euros HT)"; - - $this->barcolor = "blue"; - } - - - Function GraphDraw() - { - $num = 0; - - $sql = "SELECT tf.date, sum(tf.gain), sum(tf.cout_vente), sum(tf.fourn_montant)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture as tf"; - - if ($this->client == 0 && $this->contrat == 0 && $this->ligne == 0) - { - $sql .= " WHERE tf.fk_facture is not null"; - $sql .= " GROUP BY tf.date ASC"; - } - elseif ($this->client > 0 && $this->contrat == 0 && $this->ligne == 0) - { - $sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as s"; - $sql .= " WHERE tf.fk_facture is not null"; - $sql .= " AND s.rowid = tf.fk_ligne"; - $sql .= " AND s.fk_client_comm = ".$this->client; - $sql .= " GROUP BY tf.date ASC"; - } - elseif ($this->client == 0 && $this->contrat > 0 && $this->ligne == 0) - { - $sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as s"; - $sql .= " WHERE tf.fk_facture is not null"; - $sql .= " AND s.rowid = tf.fk_ligne"; - $sql .= " AND s.fk_contrat = ".$this->contrat; - $sql .= " GROUP BY tf.date ASC"; - } - elseif ($this->client == 0 && $this->contrat == 0 && $this->ligne > 0) - { - $sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as s"; - $sql .= " WHERE tf.fk_facture is not null"; - $sql .= " AND s.rowid = tf.fk_ligne"; - $sql .= " AND s.rowid = ".$this->ligne; - $sql .= " GROUP BY tf.date ASC"; - } - - $resql = $this->db->query($sql); - - if ($resql) - { - $num = $this->db->num_rows($resql); - $i = 0; - $labels = array(); - - $this->total_gain = 0; - $this->total_ca = 0; - - while ($i < $num) - { - $row = $this->db->fetch_row($resql); - - $g[$i] = $row[1]; - - $labels[$i] = substr($row[0],5,2); - - $this->total_gain += $row[1]; - $this->total_ca += $row[2]; - $this->total_cout += $row[3]; - - $i++; - } - - $this->db->free($resql); - } - else - { - print $this->db->error() . ' ' . $sql; - } - - if ($this->client > 0) - { - - /* - * Comptage des remises exceptionnelles - * - */ - $sql = "SELECT sr.amount_ht"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne as s"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_facture as tf"; - $sql .= " , ".MAIN_DB_PREFIX."societe_remise_except as sr"; - - $sql .= " WHERE sr.fk_facture = tf.fk_facture"; - $sql .= " AND s.rowid = tf.fk_ligne"; - $sql .= " AND s.fk_client_comm = ".$this->client; - $sql .= " GROUP BY tf.fk_facture"; - - $resql = $this->db->query($sql); - - if ($resql) - { - $numr = $this->db->num_rows($resql); - $i = 0; - - while ($i < $numr) - { - $row = $this->db->fetch_row($resql); - if ( $row[0] > 0) - { - $this->total_gain = ($this->total_gain - $row[0]); - } - $i++; - } - } - } - - if ($this->show_console) - { - print $this->client . " " . $g[$i - 1]."\n"; - } - - if ($num > 0) - { - $this->GraphMakeGraph($g, $labels); - } - } - -} -?> diff --git a/htdocs/telephonie/stats/graph/heureappel.class.php b/htdocs/telephonie/stats/graph/heureappel.class.php deleted file mode 100644 index 5ad64487016..00000000000 --- a/htdocs/telephonie/stats/graph/heureappel.class.php +++ /dev/null @@ -1,73 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/brouzouf.class.php"); - -class GraphHeureAppel extends GraphBrouzouf -{ - Function GraphHeureAppel($DB, $file) - { - $this->db = $DB; - $this->file = $file; - - $this->client = 0; - $this->titre = "Heure d'appel"; - - $this->width = 400; - $this->LabelAngle = 90; - - $this->barcolor = "blue"; - } - - Function GraphDraw() - { - - $sql = "SELECT ".$this->db->pdate("date")." as date, duree"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; - - if ($this->db->query($sql)) - { - $heure_appel = array(); - $num = $this->db->num_rows(); - $i = 0; - - while ($i < $num) - { - $obj = $this->db->fetch_object(); - - $h = ceil(strftime("%H",$obj->date)); // suppression du 0 - - $heure_appel_nb[$h]++; - $heure_appel_duree[$h] += $obj->duree; - - $i++; - } - } - - if ($num > 0) - { - $this->GraphMakeGraph($heure_appel_nb, $labels); - } - } - -} -?> diff --git a/htdocs/telephonie/stats/graph/index.php b/htdocs/telephonie/stats/graph/index.php deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/telephonie/stats/graph/joursemaine.class.php b/htdocs/telephonie/stats/graph/joursemaine.class.php deleted file mode 100644 index ba0e7c73e3f..00000000000 --- a/htdocs/telephonie/stats/graph/joursemaine.class.php +++ /dev/null @@ -1,74 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/brouzouf.class.php"); - -class GraphJoursemaine extends GraphBrouzouf{ - - - Function GraphJoursemaine($DB, $file) - { - $this->db = $DB; - $this->file = $file; - - $this->client = 0; - $this->titre = "Jour de la semaine"; - - $this->width = 400; - $this->LabelAngle = 45; - - $this->barcolor = "green"; - } - - Function GraphDraw() - { - $sql = "SELECT ".$this->db->pdate("date")." as date, duree"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; - - if ($this->db->query($sql)) - { - - $jour_semaine_nb = array(); - $jour_semaine_duree = array(); - - $num = $this->db->num_rows(); - - $i = 0; - - while ($i < $num) - { - $obj = $this->db->fetch_object(); - - $u = strftime("%u",$obj->date) - 1; // 1 pour Lundi - - $jour_semaine_nb[$u]++; - $jour_semaine_duree[$u] += $obj->duree; - - $i++; - } - } - - $this->GraphMakeGraph($jour_semaine_nb,array('Lun','Mar','Mer','Jeu','Ven','Sam','Dim')); - } - -} -?> diff --git a/htdocs/telephonie/stats/graph/line.class.php b/htdocs/telephonie/stats/graph/line.class.php deleted file mode 100644 index 1acb18b494e..00000000000 --- a/htdocs/telephonie/stats/graph/line.class.php +++ /dev/null @@ -1,99 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/graph.class.php"); - -class GraphLine extends DolibarrGraph { - - Function GraphLine($DB, $file) - { - $this->db = $DB; - $this->file = $file; - $this->bgcolor = "#DEE7EC"; - $this->barcolor = "green"; - $this->client = 0; - $this->showframe = true; - } - - Function GraphDraw($file, $datas, $labels) - { - // Create the graph. These two calls are always required - - $height = 240; - $width = 400; - - if ($this->width <> $width && $this->width > 0) - $width = $this->width; - - if ($this->height <> $height && $this->height > 0) - $height = $this->height; - - $graph = new Graph($width, $height,"auto"); - $graph->SetScale("textlin"); - - $graph->yaxis->scale->SetGrace(20); - - $graph->SetFrame($this->showframe); - - $graph->img->SetMargin(40,20,20,40); - - $b2plot = new LinePlot($datas); - - $b2plot->SetFillColor($this->barcolor); - - $graph->xaxis->scale->SetGrace(20); - - $graph->yaxis->scale->SetAutoMin(0); - - - $LabelAngle = 45; - if ($this->LabelAngle <> $LabelAngle && $this->LabelAngle > 0) - $LabelAngle = $this->LabelAngle; - - $graph->xaxis->SetLabelAngle($LabelAngle); - - $graph->xaxis->SetTextLabelInterval($this->LabelInterval); - - $graph->xaxis->SetFont(FF_VERDANA,FS_NORMAL,8); - - $graph->Add($b2plot); - - $graph->title->Set($this->titre); - - $graph->title->SetFont(FF_VERDANA,FS_NORMAL); - - $graph->yaxis->title->SetFont(FF_FONT2); - $graph->xaxis->title->SetFont(FF_FONT1); - - $graph->xaxis->SetTickLabels($labels); - - // Display the graph - - $graph->img->SetImgFormat("png"); - - if (sizeof($datas) > 0) - { - $graph->Stroke($file); - } - } -} -?> diff --git a/htdocs/telephonie/stats/graph/pie.class.php b/htdocs/telephonie/stats/graph/pie.class.php deleted file mode 100644 index f7055b04efa..00000000000 --- a/htdocs/telephonie/stats/graph/pie.class.php +++ /dev/null @@ -1,93 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/graph.class.php"); - -class GraphPie extends DolibarrGraph { - - Function GraphPie($DB, $file) - { - $this->db = $DB; - $this->file = $file; - $this->bgcolor = "#DEE7EC"; - $this->barcolor = "green"; - $this->client = 0; - $this->showframe = true; - } - - Function GraphDraw($file, $datas, $labels) - { - // Create the graph. These two calls are always required - - $height = 240; - $width = 400; - - if ($this->width <> $width && $this->width > 0) - $width = $this->width; - - if ($this->height <> $height && $this->height > 0) - $height = $this->height; - - $graph = new PieGraph($width, $height,"auto"); - - $graph->SetColor("gray") ; - - // Create the bar plots - - $pieplot = new PiePlot($datas); - - $pieplot->SetCenter(0.30,0.53); - - // Label font and color setup - $pieplot->SetFont(FF_FONT1,FS_BOLD); - $pieplot->SetFontColor("darkred"); - - if (is_array($this->colors)) - { - $pieplot->SetSliceColors($this->colors); - } - - // Size of pie in fraction of the width of the graph - $pieplot->SetSize(0.38); - - // Legends - $pieplot->SetLegends($labels); - $graph->legend->Pos(0.04,0.15); - - $graph->Add($pieplot); - - $graph->title->Set($this->titre); - - $graph->title->SetFont(FF_FONT1,FS_BOLD); - - - // Display the graph - - $graph->img->SetImgFormat("png"); - - if (sizeof($datas) > 0) - { - $graph->Stroke($file); - } - } -} -?> diff --git a/htdocs/telephonie/stats/index.php b/htdocs/telephonie/stats/index.php deleted file mode 100644 index 3774b05e35f..00000000000 --- a/htdocs/telephonie/stats/index.php +++ /dev/null @@ -1,61 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if (!$user->rights->telephonie->lire) accessforbidden(); -if (!$user->rights->telephonie->stats->lire) accessforbidden(); - -llxHeader('','Telephonie - Statistiques'); - -/* - * - */ -print ''; - -print ''; -print ''; - -print ''; - -print '
'; - -print 'PO mensuelle par commercial

'."\n"; -print '
'; - -print 'Nouveaux clients par semaines

'."\n"; - -print 'Nouveaux clients par semaines

'."\n"; - -print '
'; - -print 'Nouveaux clients par mois

'."\n"; - -print 'Commandes de ligne par mois

'."\n"; - -print '
'; - - - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/stats/lignes/actives.class.php b/htdocs/telephonie/stats/lignes/actives.class.php deleted file mode 100644 index 2c63827bfa3..00000000000 --- a/htdocs/telephonie/stats/lignes/actives.class.php +++ /dev/null @@ -1,178 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/line.class.php"); - -class GraphLignesActives extends GraphLine { - - Function GraphLignesActives($DB, $file) - { - $this->db = $DB; - $this->file = $file; - - $this->client = 0; - $this->titre = "Lignes en présélections"; - - $this->barcolor = "green"; - $this->showframe = true; - } - - - Function GraphMakeGraph() - { - $num = 0; - - $sql = "SELECT dates, statut,nb"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_ligne_statistique"; - $sql .= " WHERE statut = 3"; - $sql .= " ORDER BY dates ASC"; - - $resql = $this->db->query($sql); - if ($resql) - { - $num = $this->db->num_rows($resql); - $i = 0; - $j = -1; - $attente = array(); - $acommander = array(); - $commandee = array(); - $active = array(); - $last = 0; - - while ($i < $num) - { - $row = $this->db->fetch_row($resql); - - $j++; - $labels[$j] = substr($row[0],5,2)."/".substr($row[0],2,2); - $attente[$j] = 0; - $acommander[$j] = 0; - $commandee[$j] = 0; - $active[$j] = 0; - $last = substr($row[0],5,2)."/".substr($row[0],2,2); - - if ($row[1] == 3) - { - $active[$j] = $row[2]; - } - - $i++; - } - - $this->db->free(); - } - else - { - print $this->db->error() . ' ' . $sql; - } - - $this->LabelInterval = 1; - - $a = round($num / 20,0); - - if ($a > 1) - { - $this->LabelInterval = $a; - } - - $this->GraphDraw($this->file, $active, $labels); - } -} - - -class GraphLignesCommandees extends GraphLine { - - Function GraphLignesCommandees($DB, $file) - { - $this->db = $DB; - $this->file = $file; - - $this->client = 0; - $this->titre = "Lignes en commandes"; - - $this->barcolor = "green"; - $this->showframe = true; - } - - - Function GraphMakeGraph() - { - $num = 0; - - $sql = "SELECT dates, statut,nb"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_ligne_statistique"; - $sql .= " WHERE statut = 2"; - $sql .= " ORDER BY dates ASC"; - - $resql = $this->db->query($sql); - if ($resql) - { - $num = $this->db->num_rows($resql); - $i = 0; - $j = -1; - $attente = array(); - $acommander = array(); - $commandee = array(); - $active = array(); - $last = 0; - - while ($i < $num) - { - $row = $this->db->fetch_row($resql); - - $j++; - $labels[$j] = substr($row[0],5,2)."/".substr($row[0],2,2); - $attente[$j] = 0; - $acommander[$j] = 0; - $commandee[$j] = 0; - $active[$j] = 0; - $last = substr($row[0],5,2)."/".substr($row[0],2,2); - - if ($row[1] == 2) - { - $active[$j] = $row[2]; - } - - $i++; - } - - $this->db->free(); - } - else - { - print $this->db->error() . ' ' . $sql; - } - - $this->LabelInterval = 1; - - $a = round($num / 20,0); - - if ($a > 1) - { - $this->LabelInterval = $a; - } - - $this->GraphDraw($this->file, $active, $labels); - } -} - - -?> diff --git a/htdocs/telephonie/stats/lignes/commande.php b/htdocs/telephonie/stats/lignes/commande.php deleted file mode 100644 index da93753b1ed..00000000000 --- a/htdocs/telephonie/stats/lignes/commande.php +++ /dev/null @@ -1,62 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; - -if (!$user->rights->telephonie->lire) - accessforbidden(); - -llxHeader('','Telephonie - Statistiques - Lignes'); - -/* - * - * - */ - -include "./onglets.php"; -dol_fiche_head($head, $hselected, "Lignes"); - -print ''; - -print ''; - - -print '
'; - -print 'Commandes de lignes par semaine

'."\n"; - -/* - * - * - */ - -print '
'; - - - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/stats/lignes/commandes.class.php b/htdocs/telephonie/stats/lignes/commandes.class.php deleted file mode 100644 index 6bb4dd203ba..00000000000 --- a/htdocs/telephonie/stats/lignes/commandes.class.php +++ /dev/null @@ -1,92 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/bar.class.php"); - -class GraphLignesCommandes extends GraphBar { - - Function GraphLignesCommandes($DB, $file) - { - $this->db = $DB; - $this->file = $file; - - $this->client = 0; - $this->titre = "Commandes Lignes par mois"; - - $this->barcolor = "blue"; - $this->showframe = true; - - $this->LabelAngle = 0; - } - - Function GraphMakeGraph($commercial=0) - { - $num = 0; - - $sql = "SELECT date_format(date_commande,'%Y%m'), count(*)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne"; - $sql .= " WHERE date_commande IS NOT NULL "; - - if ($commercial > 0) - { - $sql .= " AND fk_commercial = ".$commercial; - } - - $sql .= " GROUP BY date_format(date_commande,'%Y%m') ASC"; - - $result = $this->db->query($sql); - - if ($result) - { - $num = $this->db->num_rows(); - $i = 0; - $j = -1; - $attente = array(); - $acommander = array(); - $commandee = array(); - $active = array(); - $last = 0; - - while ($i < $num) - { - $row = $this->db->fetch_row(); - - $datas[$i] = $row[1]; - $labels[$i] = substr($row[0],-2);//."/".substr($row[0],2,2); - - $i++; - } - - $this->db->free(); - } - else - { - print $this->db->error() . ' ' . $sql; - } - - $this->GraphDraw($this->file, $datas, $labels); - - } - -} - -?> diff --git a/htdocs/telephonie/stats/lignes/commandes.week.class.php b/htdocs/telephonie/stats/lignes/commandes.week.class.php deleted file mode 100644 index a59fca1752d..00000000000 --- a/htdocs/telephonie/stats/lignes/commandes.week.class.php +++ /dev/null @@ -1,185 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/baracc.class.php"); - -class GraphLignesCommandesWeek extends GraphBarAcc { - - Function GraphLignesCommandesWeek($DB, $file) - { - $this->db = $DB; - $this->file = $file; - - $this->client = 0; - $this->titre = "Commandes Lignes par semaine"; - - $this->barcolor = "blue"; - $this->showframe = true; - } - - Function GraphMakeGraph($commercial=0) - { - $num = 0; - - $labels = array(); - - $sql = "SELECT date_format(date_commande,'%y%v'), count(*)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne"; - $sql .= " WHERE date_commande IS NOT NULL "; - - if ($commercial > 0) - { - $sql .= " AND fk_commercial = ".$commercial; - } - - $sql .= " GROUP BY date_format(date_commande,'%y%v') ASC"; - - - if ($this->db->query($sql)) - { - $num = $this->db->num_rows(); - - $i = 0; - $datas = array(); - - while ($i < $num) - { - $row = $this->db->fetch_row(); - $datas[$row[0]] = $row[1]; - array_push($labels, $row[0]); - $i++; - } - - $this->db->free(); - } - else - { - dol_syslog($this->db->error()); - } - - /* Lignes rejetées */ - $sql = "SELECT date_format(date_commande,'%y%v'), count(*)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne"; - $sql .= " WHERE date_commande IS NOT NULL "; - $sql .= " AND statut = 7"; - - if ($commercial > 0) - { - $sql .= " AND fk_commercial = ".$commercial; - } - - $sql .= " GROUP BY date_format(date_commande,'%y%v') ASC"; - - if ($this->db->query($sql)) - { - $num = $this->db->num_rows(); - $i = 0; - $datas_rej = array(); - - while ($i < $num) - { - $row = $this->db->fetch_row(); - - $datas_rej[$row[0]] = $row[1]; - array_push($labels, $row[0]); - $i++; - } - - $this->db->free(); - } - else - { - dol_syslog($this->db->error()); - } - - /* == */ - - $datas_new = array(); - $labels_new = array(); - $j = 0 ; - - $max = max($labels); - $week = $max; - $year = substr($week,0,2); - $smwee = substr($max, -2); - - for ($i = 0 ; $i < 18 ; $i++) - { - - $datas_new[$i] = $datas[$year.$smwee] - $datas_rej[$year.$smwee]; - $datas_new_rej[$i] = $datas_rej[$year.$smwee]; - $labels_new[$i] = ceil($smwee); - - if (($smwee - 1) == 0) - { - $smwee = strftime("%V",mktime(12,0,2,12,31,"20".substr("00".($year - 1), -2))); - - if ($smwee == '01') - { - $smwee = 52; - } - - $year = substr("00".($year - 1), -2); - } - else - { - $smwee = substr("00".($smwee -1), -2); - } - } - - $datas_new = array_reverse($datas_new); - $datas_new_rej = array_reverse($datas_new_rej); - $labels_new = array_reverse($labels_new); - - $this->LabelAngle = 0; - - /* - * Insertion Base - * - */ - $type = "commandes.hebdomadaire"; - $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_stats"; - $sql .= " WHERE graph = '".$type."'"; - $this->db->query($sql); - - for ($i = 0 ; $i < sizeof($datas_new) ; $i++) - { - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_stats"; - $sql .= " (graph, ord, valeur) VALUES ("; - $sql .= "'".$type."'"; - $sql .= ",'".$labels_new[$i]."'"; - $sql .= ",'".$datas_new[$i]."');"; - if (! $this->db->query($sql)) - { - print $this->db->error(); - } - } - /* - * - * - */ - - $this->GraphDraw($this->file, $datas_new, $labels_new, $datas_new_rej); - } -} -?> diff --git a/htdocs/telephonie/stats/lignes/index.php b/htdocs/telephonie/stats/lignes/index.php deleted file mode 100644 index 752e4bcaec7..00000000000 --- a/htdocs/telephonie/stats/lignes/index.php +++ /dev/null @@ -1,57 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if (!$user->rights->telephonie->lire) accessforbidden(); -if (!$user->rights->telephonie->stats->lire) accessforbidden(); - -llxHeader('','Telephonie - Statistiques - Lignes'); - -/* - * - * - */ - -include "./onglets.php"; -dol_fiche_head($head, $hselected, "Lignes"); - -print ''; - -print ''; -print '
'; - -print 'Lignes Actives

'."\n"; - -print 'Lignes Actives

'."\n"; - -print '
'; - -print 'Résiliation de lignes

'."\n"; - -print 'Résiliation de lignes

'."\n"; - -print '
'; - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/stats/lignes/onglets.php b/htdocs/telephonie/stats/lignes/onglets.php deleted file mode 100644 index 7ad4c2d1b04..00000000000 --- a/htdocs/telephonie/stats/lignes/onglets.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -$h = 0; -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/lignes/index.php'; -$head[$h][1] = "Global"; -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/lignes/commande.php'; -$head[$h][1] = "Commandes"; -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/lignes/resiliation.php'; -$head[$h][1] = "Résiliations"; -$h++; - - -for ($hii = 0 ; $hii < sizeof($head) ; $hii++) -{ - if ($_SERVER["PHP_SELF"] == $head[$hii][0]) - { - $hselected = $hii; - } -} -?> diff --git a/htdocs/telephonie/stats/lignes/pre.inc.php b/htdocs/telephonie/stats/lignes/pre.inc.php deleted file mode 100644 index 0113ceba653..00000000000 --- a/htdocs/telephonie/stats/lignes/pre.inc.php +++ /dev/null @@ -1,42 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("../../../main.inc.php"); - -$user->getrights('telephonie'); - -function llxHeader($head = "", $title="") { - global $user, $conf; - - /* - * - * - */ - top_menu($head, $title); - - $menu = new Menu(); - - include "../menus.php"; - - left_menu($menu->liste); -} - -?> diff --git a/htdocs/telephonie/stats/lignes/rejet.week.class.php b/htdocs/telephonie/stats/lignes/rejet.week.class.php deleted file mode 100644 index 93d579842e9..00000000000 --- a/htdocs/telephonie/stats/lignes/rejet.week.class.php +++ /dev/null @@ -1,126 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/bar.class.php"); - -class GraphLignesRejetWeek extends GraphBar { - - Function GraphLignesRejetWeek($DB, $file) - { - $this->db = $DB; - $this->file = $file; - - $this->client = 0; - $this->titre = "Lignes rejetées par semaine"; - - $this->barcolor = "red"; - $this->showframe = true; - } - - - Function ReadDatas() - { - $num = 0; - - $sql = "SELECT count(*), date_format(tms,'%y%v')"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne_statut"; - $sql .= " WHERE statut = 7"; - $sql .= " GROUP BY date_format(tms,'%y%v') ASC"; - - if ($this->db->query($sql)) - { - $num = $this->db->num_rows(); - - $i = 0; - $j = 0; - $this->datas = array(); - $this->labels = array(); - $oldweek = 0; - $clients = array(); - - while ($i < $num) - { - $row = $this->db->fetch_row(); - - $this->datas[$row[1]] = $row[0]; - $this->labels[$i] = $row[1]; - - $i++; - } - - $this->db->free(); - } - else - { - print $this->db->error() . ' ' . $sql; - } - } - /* - * - * - */ - Function GraphMakeGraph() - { - - $this->ReadDatas(); - - $datas_new = array(); - $labels_new = array(); - - $max = strftime("%y%V", time()); - $week = $max; - $year = substr($week,0,2); - $smwee = substr($max, -2); - - for ($i = 0 ; $i < 18 ; $i++) - { - - $datas_new[$i] = $this->datas[$year.$smwee]; - - $labels_new[$i] = ceil($smwee); - - if (($smwee - 1) == 0) - { - $smwee = strftime("%V",mktime(12,0,2,12,31,"20".substr("00".($year - 1), -2))); - - if ($smwee == '01') - { - $smwee = 52; - } - - $year = substr("00".($year - 1), -2); - } - else - { - $smwee = substr("00".($smwee -1), -2); - } - } - - $datas_new = array_reverse($datas_new); - $labels_new = array_reverse($labels_new); - - $this->GraphDraw($this->file, $datas_new, $labels_new); - - } -} -?> diff --git a/htdocs/telephonie/stats/lignes/resiliation.php b/htdocs/telephonie/stats/lignes/resiliation.php deleted file mode 100644 index 2ea3ac83a6e..00000000000 --- a/htdocs/telephonie/stats/lignes/resiliation.php +++ /dev/null @@ -1,62 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; - -if (!$user->rights->telephonie->lire) - accessforbidden(); - -llxHeader('','Telephonie - Statistiques - Lignes'); - -/* - * - * - */ - -include "./onglets.php"; -dol_fiche_head($head, $hselected, "Lignes"); - -print ''; - -print ''; - - -print '
'; - -print 'Résiliation de lignes

'."\n"; - -/* - * - * - */ - -print '
'; - - - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/stats/lignes/resiliation.week.class.php b/htdocs/telephonie/stats/lignes/resiliation.week.class.php deleted file mode 100644 index d63e429c4cc..00000000000 --- a/htdocs/telephonie/stats/lignes/resiliation.week.class.php +++ /dev/null @@ -1,126 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/bar.class.php"); - -class GraphLignesResiliationWeek extends GraphBar { - - Function GraphLignesResiliationWeek($DB, $file) - { - $this->db = $DB; - $this->file = $file; - - $this->client = 0; - $this->titre = "Résiliation de lignes par semaine"; - - $this->barcolor = "red"; - $this->showframe = true; - } - - - Function ReadDatas() - { - $num = 0; - - $sql = "SELECT count(*), date_format(tms,'%y%v')"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne_statut"; - $sql .= " WHERE statut = 6"; - $sql .= " GROUP BY date_format(tms,'%y%v') ASC"; - - if ($this->db->query($sql)) - { - $num = $this->db->num_rows(); - - $i = 0; - $j = 0; - $this->datas = array(); - $this->labels = array(); - $oldweek = 0; - $clients = array(); - - while ($i < $num) - { - $row = $this->db->fetch_row(); - - $this->datas[$row[1]] = $row[0]; - $this->labels[$i] = $row[1]; - - $i++; - } - - $this->db->free(); - } - else - { - print $this->db->error() . ' ' . $sql; - } - } - /* - * - * - */ - Function GraphMakeGraph() - { - - $this->ReadDatas(); - - $datas_new = array(); - $labels_new = array(); - - $max = strftime("%y%V", time()); - $week = $max; - $year = substr($week,0,2); - $smwee = substr($max, -2); - - for ($i = 0 ; $i < 18 ; $i++) - { - - $datas_new[$i] = $this->datas[$year.$smwee]; - - $labels_new[$i] = ceil($smwee); - - if (($smwee - 1) == 0) - { - $smwee = strftime("%V",mktime(12,0,2,12,31,"20".substr("00".($year - 1), -2))); - - if ($smwee == '01') - { - $smwee = 52; - } - - $year = substr("00".($year - 1), -2); - } - else - { - $smwee = substr("00".($smwee -1), -2); - } - } - - $datas_new = array_reverse($datas_new); - $labels_new = array_reverse($labels_new); - - $this->GraphDraw($this->file, $datas_new, $labels_new); - - } -} -?> diff --git a/htdocs/telephonie/stats/lignes/statut.class.php b/htdocs/telephonie/stats/lignes/statut.class.php deleted file mode 100644 index 47c4457c716..00000000000 --- a/htdocs/telephonie/stats/lignes/statut.class.php +++ /dev/null @@ -1,108 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/pie.class.php"); - -class GraphLignesStatut extends GraphPie { - - Function GraphLignesStatut($DB, $file) - { - $this->db = $DB; - $this->file = $file; - - $this->client = 0; - $this->titre = "Statuts des lignes"; - - $this->barcolor = "yellow"; - $this->showframe = true; - } - - Function GraphMakeGraph($commercial_id=0) - { - $num = 0; - - if ($commercial_id > 0) - { - $cuser = new User($this->db, $commercial_id); - $cuser->fetch(); - $this->titre = "Statuts des lignes de ".$cuser->fullname; - } - - - $sql = "SELECT statut, count(*)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne"; - $sql .= " WHERE statut in (2,3,6,7)"; - - if ($commercial_id > 0) - { - $sql .= " AND fk_commercial_sign =".$commercial_id; - } - - $sql .= " GROUP BY statut ASC"; - - - $statuts[-1] = "Attente"; - $statuts[1] = "A commander"; - $statuts[2] = "Commandée"; - $statuts[3] = "Activée"; - $statuts[4] = "A résilier"; - $statuts[5] = "Resil en cours"; - $statuts[6] = "Resiliée"; - $statuts[7] = "Rejetée"; - - - $colors_def[2] = 'blue'; - $colors_def[3] = 'green'; - $colors_def[6] = 'red'; - $colors_def[7] = 'black'; - - $this->colors = array(); - - if ($this->db->query($sql)) - { - $num = $this->db->num_rows(); - $i = 0; - $datas = array(); - $labels = array(); - - while ($i < $num) - { - $row = $this->db->fetch_row(); - - $datas[$i] = $row[1]; - $labels[$i] = $statuts[$row[0]]; - array_push($this->colors, $colors_def[$row[0]]); - $i++; - } - - $this->db->free(); - } - else - { - print $this->db->error() . ' ' . $sql; - } - - - $this->GraphDraw($this->file, $datas, $labels); - } -} -?> diff --git a/htdocs/telephonie/stats/menus.php b/htdocs/telephonie/stats/menus.php deleted file mode 100644 index 46513572218..00000000000 --- a/htdocs/telephonie/stats/menus.php +++ /dev/null @@ -1,59 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - - -$menu->add(DOL_URL_ROOT."/telephonie/index.php", "Telephonie"); - -$menu->add(DOL_URL_ROOT."/telephonie/client/index.php", "Clients"); - -$menu->add(DOL_URL_ROOT."/telephonie/contrat/index.php", "Contrats"); - -$menu->add(DOL_URL_ROOT."/telephonie/ligne/index.php", "Lignes"); - -$menu->add(DOL_URL_ROOT."/telephonie/ligne/commande/", "Commandes"); - -$menu->add(DOL_URL_ROOT."/telephonie/stats/", "Statistiques"); - -$menu->add_submenu(DOL_URL_ROOT."/telephonie/stats/clients/", "Clients"); -$menu->add_submenu(DOL_URL_ROOT."/telephonie/stats/contrats/", "Contrats"); -$menu->add_submenu(DOL_URL_ROOT."/telephonie/stats/commerciaux/", "Commerciaux"); -$menu->add_submenu(DOL_URL_ROOT."/telephonie/stats/communications/", "Communications"); -$menu->add_submenu(DOL_URL_ROOT."/telephonie/stats/destinations/", "Destinations"); -$menu->add_submenu(DOL_URL_ROOT."/telephonie/stats/distributeurs/", "Distributeurs"); -$menu->add_submenu(DOL_URL_ROOT."/telephonie/stats/factures/", "Factures"); -$menu->add_submenu(DOL_URL_ROOT."/telephonie/stats/fournisseurs/", "Fournisseurs"); -$menu->add_submenu(DOL_URL_ROOT."/telephonie/stats/lignes/", "Lignes"); -$menu->add_submenu(DOL_URL_ROOT."/telephonie/stats/consultation/", "Consultations"); - -$menu->add(DOL_URL_ROOT."/telephonie/facture/", "Factures"); - -$menu->add(DOL_URL_ROOT."/telephonie/tarifs/", "Tarifs"); - -$menu->add(DOL_URL_ROOT."/telephonie/distributeurs/", "Distributeurs"); - -$menu->add(DOL_URL_ROOT."/telephonie/fournisseur/", "Fournisseurs"); - -$menu->add(DOL_URL_ROOT."/telephonie/ca/", "Chiffre d'affaire"); - - - -?> diff --git a/htdocs/telephonie/stats/pre.inc.php b/htdocs/telephonie/stats/pre.inc.php deleted file mode 100644 index 5d7cd7e5a0c..00000000000 --- a/htdocs/telephonie/stats/pre.inc.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("../../main.inc.php"); -require(DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); - -$user->getrights('telephonie'); - -function llxHeader($head = "", $title="") { - global $user, $conf; - - /* - * - * - */ - top_menu($head, $title); - - $menu = new Menu(); - - include "./menus.php"; - - left_menu($menu->liste); -} - -?> diff --git a/htdocs/telephonie/stats/tools.lib.php b/htdocs/telephonie/stats/tools.lib.php deleted file mode 100644 index 81b2e9a4f3c..00000000000 --- a/htdocs/telephonie/stats/tools.lib.php +++ /dev/null @@ -1,59 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -function stat_year_bar($year) -{ - $cyear = strftime("%Y",time()); - $x = 2005; - $string = ''; - - $query = array(); - $query = explode("&",$_SERVER["QUERY_STRING"]); - - $qs = ''; - foreach($query as $q) - { - if (substr($q,0,4) <> 'year') - { - $qs .= '&'.$q; - } - } - - while ($x <= $cyear) - { - if ($x == $year) - { - $string .= $x.' | '; - } - else - { - $string .= ''.$x.' | '; - } - $x++; - } - print substr($string,0,strlen($string) - 13); -} -?> diff --git a/htdocs/telephonie/tarifs/config/data/index.php b/htdocs/telephonie/tarifs/config/data/index.php deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/telephonie/tarifs/config/data/prefix.sql b/htdocs/telephonie/tarifs/config/data/prefix.sql deleted file mode 100644 index e5c5866808d..00000000000 --- a/htdocs/telephonie/tarifs/config/data/prefix.sql +++ /dev/null @@ -1,1938 +0,0 @@ --- MySQL dump 9.11 --- --- Host: localhost Database: dolixid --- ------------------------------------------------------ --- Server version 4.0.24_Debian-10sarge2-log - --- --- Dumping data for table `llx_telephonie_prefix` --- - -INSERT INTO llx_telephonie_prefix VALUES (3647,1103,'351292'); -INSERT INTO llx_telephonie_prefix VALUES (3648,1103,'351295'); -INSERT INTO llx_telephonie_prefix VALUES (3649,1103,'351296'); -INSERT INTO llx_telephonie_prefix VALUES (3650,1104,'93'); -INSERT INTO llx_telephonie_prefix VALUES (3651,1105,'27'); -INSERT INTO llx_telephonie_prefix VALUES (3652,1106,'2721'); -INSERT INTO llx_telephonie_prefix VALUES (3653,1107,'2711'); -INSERT INTO llx_telephonie_prefix VALUES (3654,1108,'2784'); -INSERT INTO llx_telephonie_prefix VALUES (3655,1108,'2781'); -INSERT INTO llx_telephonie_prefix VALUES (3656,1108,'2782'); -INSERT INTO llx_telephonie_prefix VALUES (3657,1108,'2783'); -INSERT INTO llx_telephonie_prefix VALUES (3658,1108,'2772'); -INSERT INTO llx_telephonie_prefix VALUES (3659,1108,'2773'); -INSERT INTO llx_telephonie_prefix VALUES (3660,1109,'1907'); -INSERT INTO llx_telephonie_prefix VALUES (3661,1110,'355'); -INSERT INTO llx_telephonie_prefix VALUES (3662,1111,'35538'); -INSERT INTO llx_telephonie_prefix VALUES (3663,1112,'213'); -INSERT INTO llx_telephonie_prefix VALUES (3664,1113,'21361'); -INSERT INTO llx_telephonie_prefix VALUES (3665,1113,'213198'); -INSERT INTO llx_telephonie_prefix VALUES (3666,1113,'213199'); -INSERT INTO llx_telephonie_prefix VALUES (3667,1114,'49'); -INSERT INTO llx_telephonie_prefix VALUES (3668,1115,'4930'); -INSERT INTO llx_telephonie_prefix VALUES (3669,1116,'49228'); -INSERT INTO llx_telephonie_prefix VALUES (3670,1117,'49211'); -INSERT INTO llx_telephonie_prefix VALUES (3671,1118,'4969'); -INSERT INTO llx_telephonie_prefix VALUES (3672,1118,'49335'); -INSERT INTO llx_telephonie_prefix VALUES (3673,1119,'4940'); -INSERT INTO llx_telephonie_prefix VALUES (3674,1120,'49511'); -INSERT INTO llx_telephonie_prefix VALUES (3675,1121,'4915'); -INSERT INTO llx_telephonie_prefix VALUES (3676,1121,'4916'); -INSERT INTO llx_telephonie_prefix VALUES (3677,1121,'4917'); -INSERT INTO llx_telephonie_prefix VALUES (3678,1121,'49700'); -INSERT INTO llx_telephonie_prefix VALUES (3679,1121,'49701'); -INSERT INTO llx_telephonie_prefix VALUES (3680,1122,'4989'); -INSERT INTO llx_telephonie_prefix VALUES (3681,1123,'49911'); -INSERT INTO llx_telephonie_prefix VALUES (3682,1124,'491'); -INSERT INTO llx_telephonie_prefix VALUES (3683,1124,'49800'); -INSERT INTO llx_telephonie_prefix VALUES (3684,1124,'49900'); -INSERT INTO llx_telephonie_prefix VALUES (3685,1125,'49711'); -INSERT INTO llx_telephonie_prefix VALUES (3686,1126,'376'); -INSERT INTO llx_telephonie_prefix VALUES (3687,1127,'3763'); -INSERT INTO llx_telephonie_prefix VALUES (3688,1128,'244'); -INSERT INTO llx_telephonie_prefix VALUES (3689,1129,'2449'); -INSERT INTO llx_telephonie_prefix VALUES (3690,1130,'1264'); -INSERT INTO llx_telephonie_prefix VALUES (3691,1130,'1809497'); -INSERT INTO llx_telephonie_prefix VALUES (3692,1131,'672'); -INSERT INTO llx_telephonie_prefix VALUES (3693,1132,'1809461'); -INSERT INTO llx_telephonie_prefix VALUES (3694,1132,'1809462'); -INSERT INTO llx_telephonie_prefix VALUES (3695,1132,'1809463'); -INSERT INTO llx_telephonie_prefix VALUES (3696,1132,'1809464'); -INSERT INTO llx_telephonie_prefix VALUES (3697,1133,'1268'); -INSERT INTO llx_telephonie_prefix VALUES (3698,1134,'1268464'); -INSERT INTO llx_telephonie_prefix VALUES (3699,1134,'1268723'); -INSERT INTO llx_telephonie_prefix VALUES (3700,1134,'1268724'); -INSERT INTO llx_telephonie_prefix VALUES (3701,1134,'1268727'); -INSERT INTO llx_telephonie_prefix VALUES (3702,1134,'1268728'); -INSERT INTO llx_telephonie_prefix VALUES (3703,1134,'1268729'); -INSERT INTO llx_telephonie_prefix VALUES (3704,1134,'1268773'); -INSERT INTO llx_telephonie_prefix VALUES (3705,1135,'599'); -INSERT INTO llx_telephonie_prefix VALUES (3706,1136,'59979'); -INSERT INTO llx_telephonie_prefix VALUES (3707,1136,'5993180'); -INSERT INTO llx_telephonie_prefix VALUES (3708,1136,'599367'); -INSERT INTO llx_telephonie_prefix VALUES (3709,1136,'5994160'); -INSERT INTO llx_telephonie_prefix VALUES (3710,1136,'5994165'); -INSERT INTO llx_telephonie_prefix VALUES (3711,1136,'599520'); -INSERT INTO llx_telephonie_prefix VALUES (3712,1136,'599522'); -INSERT INTO llx_telephonie_prefix VALUES (3713,1136,'599551'); -INSERT INTO llx_telephonie_prefix VALUES (3714,1136,'599552'); -INSERT INTO llx_telephonie_prefix VALUES (3715,1136,'599555'); -INSERT INTO llx_telephonie_prefix VALUES (3716,1136,'599556'); -INSERT INTO llx_telephonie_prefix VALUES (3717,1136,'599557'); -INSERT INTO llx_telephonie_prefix VALUES (3718,1136,'599558'); -INSERT INTO llx_telephonie_prefix VALUES (3719,1136,'599559'); -INSERT INTO llx_telephonie_prefix VALUES (3720,1136,'5996'); -INSERT INTO llx_telephonie_prefix VALUES (3721,1136,'59965'); -INSERT INTO llx_telephonie_prefix VALUES (3722,1136,'59980'); -INSERT INTO llx_telephonie_prefix VALUES (3723,1136,'59996'); -INSERT INTO llx_telephonie_prefix VALUES (3724,1137,'966'); -INSERT INTO llx_telephonie_prefix VALUES (3725,1138,'9664'); -INSERT INTO llx_telephonie_prefix VALUES (3726,1138,'9665'); -INSERT INTO llx_telephonie_prefix VALUES (3727,1138,'9666'); -INSERT INTO llx_telephonie_prefix VALUES (3728,1139,'54'); -INSERT INTO llx_telephonie_prefix VALUES (3729,1140,'5411'); -INSERT INTO llx_telephonie_prefix VALUES (3730,1141,'5426'); -INSERT INTO llx_telephonie_prefix VALUES (3731,1141,'5428'); -INSERT INTO llx_telephonie_prefix VALUES (3732,1141,'5430'); -INSERT INTO llx_telephonie_prefix VALUES (3733,1141,'5440'); -INSERT INTO llx_telephonie_prefix VALUES (3734,1141,'54153'); -INSERT INTO llx_telephonie_prefix VALUES (3735,1141,'54156'); -INSERT INTO llx_telephonie_prefix VALUES (3736,1141,'54167'); -INSERT INTO llx_telephonie_prefix VALUES (3737,1141,'54193'); -INSERT INTO llx_telephonie_prefix VALUES (3738,1141,'54197'); -INSERT INTO llx_telephonie_prefix VALUES (3739,1141,'54414'); -INSERT INTO llx_telephonie_prefix VALUES (3740,1141,'54991'); -INSERT INTO llx_telephonie_prefix VALUES (3741,1141,'5499177'); -INSERT INTO llx_telephonie_prefix VALUES (3742,1141,'54992'); -INSERT INTO llx_telephonie_prefix VALUES (3743,1141,'5499277'); -INSERT INTO llx_telephonie_prefix VALUES (3744,1141,'5414'); -INSERT INTO llx_telephonie_prefix VALUES (3745,1141,'5420'); -INSERT INTO llx_telephonie_prefix VALUES (3746,1141,'5421'); -INSERT INTO llx_telephonie_prefix VALUES (3747,1141,'5422'); -INSERT INTO llx_telephonie_prefix VALUES (3748,1142,'374'); -INSERT INTO llx_telephonie_prefix VALUES (3749,1143,'3749'); -INSERT INTO llx_telephonie_prefix VALUES (3750,1144,'3741'); -INSERT INTO llx_telephonie_prefix VALUES (3751,1145,'297'); -INSERT INTO llx_telephonie_prefix VALUES (3752,1146,'247'); -INSERT INTO llx_telephonie_prefix VALUES (3753,1147,'7505'); -INSERT INTO llx_telephonie_prefix VALUES (3754,1148,'61'); -INSERT INTO llx_telephonie_prefix VALUES (3755,1149,'6114'); -INSERT INTO llx_telephonie_prefix VALUES (3756,1149,'6115'); -INSERT INTO llx_telephonie_prefix VALUES (3757,1149,'6117'); -INSERT INTO llx_telephonie_prefix VALUES (3758,1149,'6118'); -INSERT INTO llx_telephonie_prefix VALUES (3759,1149,'6119'); -INSERT INTO llx_telephonie_prefix VALUES (3760,1149,'6116'); -INSERT INTO llx_telephonie_prefix VALUES (3761,1149,'614'); -INSERT INTO llx_telephonie_prefix VALUES (3762,1149,'615'); -INSERT INTO llx_telephonie_prefix VALUES (3763,1149,'6171'); -INSERT INTO llx_telephonie_prefix VALUES (3764,1150,'612'); -INSERT INTO llx_telephonie_prefix VALUES (3765,1151,'43'); -INSERT INTO llx_telephonie_prefix VALUES (3766,1152,'43650'); -INSERT INTO llx_telephonie_prefix VALUES (3767,1152,'43663'); -INSERT INTO llx_telephonie_prefix VALUES (3768,1152,'43664'); -INSERT INTO llx_telephonie_prefix VALUES (3769,1152,'43669'); -INSERT INTO llx_telephonie_prefix VALUES (3770,1152,'43676'); -INSERT INTO llx_telephonie_prefix VALUES (3771,1152,'43678'); -INSERT INTO llx_telephonie_prefix VALUES (3772,1152,'43686'); -INSERT INTO llx_telephonie_prefix VALUES (3773,1152,'43688'); -INSERT INTO llx_telephonie_prefix VALUES (3774,1152,'43699'); -INSERT INTO llx_telephonie_prefix VALUES (3775,1152,'43666'); -INSERT INTO llx_telephonie_prefix VALUES (3776,1152,'4367'); -INSERT INTO llx_telephonie_prefix VALUES (3777,1152,'4368'); -INSERT INTO llx_telephonie_prefix VALUES (3778,1152,'4369'); -INSERT INTO llx_telephonie_prefix VALUES (3779,1153,'438'); -INSERT INTO llx_telephonie_prefix VALUES (3780,1153,'439'); -INSERT INTO llx_telephonie_prefix VALUES (3781,1154,'431'); -INSERT INTO llx_telephonie_prefix VALUES (3782,1155,'994'); -INSERT INTO llx_telephonie_prefix VALUES (3783,1156,'9945'); -INSERT INTO llx_telephonie_prefix VALUES (3784,1157,'1242'); -INSERT INTO llx_telephonie_prefix VALUES (3785,1157,'18093'); -INSERT INTO llx_telephonie_prefix VALUES (3786,1157,'180932'); -INSERT INTO llx_telephonie_prefix VALUES (3787,1157,'180933'); -INSERT INTO llx_telephonie_prefix VALUES (3788,1157,'1809345'); -INSERT INTO llx_telephonie_prefix VALUES (3789,1157,'1809346'); -INSERT INTO llx_telephonie_prefix VALUES (3790,1157,'1809347'); -INSERT INTO llx_telephonie_prefix VALUES (3791,1157,'1809348'); -INSERT INTO llx_telephonie_prefix VALUES (3792,1157,'1809349'); -INSERT INTO llx_telephonie_prefix VALUES (3793,1157,'1809352'); -INSERT INTO llx_telephonie_prefix VALUES (3794,1157,'1809353'); -INSERT INTO llx_telephonie_prefix VALUES (3795,1157,'1809354'); -INSERT INTO llx_telephonie_prefix VALUES (3796,1157,'1809355'); -INSERT INTO llx_telephonie_prefix VALUES (3797,1157,'1809356'); -INSERT INTO llx_telephonie_prefix VALUES (3798,1157,'1809358'); -INSERT INTO llx_telephonie_prefix VALUES (3799,1157,'1809359'); -INSERT INTO llx_telephonie_prefix VALUES (3800,1157,'180936'); -INSERT INTO llx_telephonie_prefix VALUES (3801,1157,'180937'); -INSERT INTO llx_telephonie_prefix VALUES (3802,1157,'1809392'); -INSERT INTO llx_telephonie_prefix VALUES (3803,1157,'1809393'); -INSERT INTO llx_telephonie_prefix VALUES (3804,1158,'973'); -INSERT INTO llx_telephonie_prefix VALUES (3805,1159,'9739'); -INSERT INTO llx_telephonie_prefix VALUES (3806,1160,'751285'); -INSERT INTO llx_telephonie_prefix VALUES (3807,1161,'880'); -INSERT INTO llx_telephonie_prefix VALUES (3808,1162,'8802'); -INSERT INTO llx_telephonie_prefix VALUES (3809,1163,'8801'); -INSERT INTO llx_telephonie_prefix VALUES (3810,1164,'1246'); -INSERT INTO llx_telephonie_prefix VALUES (3811,1164,'180942'); -INSERT INTO llx_telephonie_prefix VALUES (3812,1164,'180943'); -INSERT INTO llx_telephonie_prefix VALUES (3813,1164,'1809450'); -INSERT INTO llx_telephonie_prefix VALUES (3814,1165,'1246230'); -INSERT INTO llx_telephonie_prefix VALUES (3815,1165,'1246231'); -INSERT INTO llx_telephonie_prefix VALUES (3816,1165,'1246232'); -INSERT INTO llx_telephonie_prefix VALUES (3817,1165,'1246233'); -INSERT INTO llx_telephonie_prefix VALUES (3818,1165,'1246234'); -INSERT INTO llx_telephonie_prefix VALUES (3819,1165,'1246235'); -INSERT INTO llx_telephonie_prefix VALUES (3820,1165,'1246236'); -INSERT INTO llx_telephonie_prefix VALUES (3821,1165,'1246237'); -INSERT INTO llx_telephonie_prefix VALUES (3822,1166,'375'); -INSERT INTO llx_telephonie_prefix VALUES (3823,1167,'3752'); -INSERT INTO llx_telephonie_prefix VALUES (3824,1168,'32'); -INSERT INTO llx_telephonie_prefix VALUES (3825,1169,'323'); -INSERT INTO llx_telephonie_prefix VALUES (3826,1170,'322'); -INSERT INTO llx_telephonie_prefix VALUES (3827,1171,'3241'); -INSERT INTO llx_telephonie_prefix VALUES (3828,1172,'3248'); -INSERT INTO llx_telephonie_prefix VALUES (3829,1172,'3249'); -INSERT INTO llx_telephonie_prefix VALUES (3830,1172,'32446'); -INSERT INTO llx_telephonie_prefix VALUES (3831,1172,'32485'); -INSERT INTO llx_telephonie_prefix VALUES (3832,1172,'32486'); -INSERT INTO llx_telephonie_prefix VALUES (3833,1172,'32494'); -INSERT INTO llx_telephonie_prefix VALUES (3834,1172,'32495'); -INSERT INTO llx_telephonie_prefix VALUES (3835,1172,'32496'); -INSERT INTO llx_telephonie_prefix VALUES (3836,1172,'32497'); -INSERT INTO llx_telephonie_prefix VALUES (3837,1172,'32498'); -INSERT INTO llx_telephonie_prefix VALUES (3838,1172,'3217'); -INSERT INTO llx_telephonie_prefix VALUES (3839,1172,'32452'); -INSERT INTO llx_telephonie_prefix VALUES (3840,1172,'32453'); -INSERT INTO llx_telephonie_prefix VALUES (3841,1172,'32454'); -INSERT INTO llx_telephonie_prefix VALUES (3842,1172,'32458'); -INSERT INTO llx_telephonie_prefix VALUES (3843,1172,'32459'); -INSERT INTO llx_telephonie_prefix VALUES (3844,1172,'3247'); -INSERT INTO llx_telephonie_prefix VALUES (3845,1172,'3295'); -INSERT INTO llx_telephonie_prefix VALUES (3846,1173,'3277'); -INSERT INTO llx_telephonie_prefix VALUES (3847,1173,'32900'); -INSERT INTO llx_telephonie_prefix VALUES (3848,1173,'32901'); -INSERT INTO llx_telephonie_prefix VALUES (3849,1173,'32902'); -INSERT INTO llx_telephonie_prefix VALUES (3850,1173,'32903'); -INSERT INTO llx_telephonie_prefix VALUES (3851,1174,'501'); -INSERT INTO llx_telephonie_prefix VALUES (3852,1175,'229'); -INSERT INTO llx_telephonie_prefix VALUES (3853,1176,'1441'); -INSERT INTO llx_telephonie_prefix VALUES (3854,1176,'180923'); -INSERT INTO llx_telephonie_prefix VALUES (3855,1176,'1809257'); -INSERT INTO llx_telephonie_prefix VALUES (3856,1176,'180929'); -INSERT INTO llx_telephonie_prefix VALUES (3857,1177,'975'); -INSERT INTO llx_telephonie_prefix VALUES (3858,1178,'591'); -INSERT INTO llx_telephonie_prefix VALUES (3859,1179,'5912'); -INSERT INTO llx_telephonie_prefix VALUES (3860,1180,'5911'); -INSERT INTO llx_telephonie_prefix VALUES (3861,1180,'5917'); -INSERT INTO llx_telephonie_prefix VALUES (3862,1181,'5913'); -INSERT INTO llx_telephonie_prefix VALUES (3863,1182,'387'); -INSERT INTO llx_telephonie_prefix VALUES (3864,1183,'38790'); -INSERT INTO llx_telephonie_prefix VALUES (3865,1183,'38761'); -INSERT INTO llx_telephonie_prefix VALUES (3866,1183,'38763'); -INSERT INTO llx_telephonie_prefix VALUES (3867,1183,'38765'); -INSERT INTO llx_telephonie_prefix VALUES (3868,1183,'38766'); -INSERT INTO llx_telephonie_prefix VALUES (3869,1184,'267'); -INSERT INTO llx_telephonie_prefix VALUES (3870,1185,'2677'); -INSERT INTO llx_telephonie_prefix VALUES (3871,1186,'55'); -INSERT INTO llx_telephonie_prefix VALUES (3872,1187,'55489'); -INSERT INTO llx_telephonie_prefix VALUES (3873,1187,'55499'); -INSERT INTO llx_telephonie_prefix VALUES (3874,1187,'55519'); -INSERT INTO llx_telephonie_prefix VALUES (3875,1187,'55539'); -INSERT INTO llx_telephonie_prefix VALUES (3876,1187,'55549'); -INSERT INTO llx_telephonie_prefix VALUES (3877,1187,'55559'); -INSERT INTO llx_telephonie_prefix VALUES (3878,1187,'55619'); -INSERT INTO llx_telephonie_prefix VALUES (3879,1187,'55629'); -INSERT INTO llx_telephonie_prefix VALUES (3880,1187,'55639'); -INSERT INTO llx_telephonie_prefix VALUES (3881,1187,'55659'); -INSERT INTO llx_telephonie_prefix VALUES (3882,1187,'55679'); -INSERT INTO llx_telephonie_prefix VALUES (3883,1187,'55689'); -INSERT INTO llx_telephonie_prefix VALUES (3884,1187,'55699'); -INSERT INTO llx_telephonie_prefix VALUES (3885,1187,'55719'); -INSERT INTO llx_telephonie_prefix VALUES (3886,1187,'55739'); -INSERT INTO llx_telephonie_prefix VALUES (3887,1187,'55749'); -INSERT INTO llx_telephonie_prefix VALUES (3888,1187,'55759'); -INSERT INTO llx_telephonie_prefix VALUES (3889,1187,'55779'); -INSERT INTO llx_telephonie_prefix VALUES (3890,1187,'55799'); -INSERT INTO llx_telephonie_prefix VALUES (3891,1187,'55819'); -INSERT INTO llx_telephonie_prefix VALUES (3892,1187,'55829'); -INSERT INTO llx_telephonie_prefix VALUES (3893,1187,'55839'); -INSERT INTO llx_telephonie_prefix VALUES (3894,1187,'55849'); -INSERT INTO llx_telephonie_prefix VALUES (3895,1187,'55859'); -INSERT INTO llx_telephonie_prefix VALUES (3896,1187,'55869'); -INSERT INTO llx_telephonie_prefix VALUES (3897,1187,'55879'); -INSERT INTO llx_telephonie_prefix VALUES (3898,1187,'55919'); -INSERT INTO llx_telephonie_prefix VALUES (3899,1187,'55929'); -INSERT INTO llx_telephonie_prefix VALUES (3900,1187,'55969'); -INSERT INTO llx_telephonie_prefix VALUES (3901,1187,'55989'); -INSERT INTO llx_telephonie_prefix VALUES (3902,1187,'55110'); -INSERT INTO llx_telephonie_prefix VALUES (3903,1187,'55111'); -INSERT INTO llx_telephonie_prefix VALUES (3904,1187,'55216'); -INSERT INTO llx_telephonie_prefix VALUES (3905,1187,'55217'); -INSERT INTO llx_telephonie_prefix VALUES (3906,1187,'55664'); -INSERT INTO llx_telephonie_prefix VALUES (3907,1187,'5588911'); -INSERT INTO llx_telephonie_prefix VALUES (3908,1187,'5588931'); -INSERT INTO llx_telephonie_prefix VALUES (3909,1187,'5588941'); -INSERT INTO llx_telephonie_prefix VALUES (3910,1187,'5588951'); -INSERT INTO llx_telephonie_prefix VALUES (3911,1187,'5588961'); -INSERT INTO llx_telephonie_prefix VALUES (3912,1187,'55119'); -INSERT INTO llx_telephonie_prefix VALUES (3913,1187,'55129'); -INSERT INTO llx_telephonie_prefix VALUES (3914,1187,'55139'); -INSERT INTO llx_telephonie_prefix VALUES (3915,1187,'55149'); -INSERT INTO llx_telephonie_prefix VALUES (3916,1187,'55159'); -INSERT INTO llx_telephonie_prefix VALUES (3917,1187,'55169'); -INSERT INTO llx_telephonie_prefix VALUES (3918,1187,'55179'); -INSERT INTO llx_telephonie_prefix VALUES (3919,1187,'55189'); -INSERT INTO llx_telephonie_prefix VALUES (3920,1187,'55199'); -INSERT INTO llx_telephonie_prefix VALUES (3921,1187,'55219'); -INSERT INTO llx_telephonie_prefix VALUES (3922,1187,'55249'); -INSERT INTO llx_telephonie_prefix VALUES (3923,1187,'55279'); -INSERT INTO llx_telephonie_prefix VALUES (3924,1187,'55319'); -INSERT INTO llx_telephonie_prefix VALUES (3925,1187,'55329'); -INSERT INTO llx_telephonie_prefix VALUES (3926,1187,'55339'); -INSERT INTO llx_telephonie_prefix VALUES (3927,1187,'55349'); -INSERT INTO llx_telephonie_prefix VALUES (3928,1187,'55359'); -INSERT INTO llx_telephonie_prefix VALUES (3929,1187,'55369'); -INSERT INTO llx_telephonie_prefix VALUES (3930,1187,'55379'); -INSERT INTO llx_telephonie_prefix VALUES (3931,1187,'55389'); -INSERT INTO llx_telephonie_prefix VALUES (3932,1187,'55399'); -INSERT INTO llx_telephonie_prefix VALUES (3933,1187,'55419'); -INSERT INTO llx_telephonie_prefix VALUES (3934,1187,'55429'); -INSERT INTO llx_telephonie_prefix VALUES (3935,1187,'55439'); -INSERT INTO llx_telephonie_prefix VALUES (3936,1187,'55449'); -INSERT INTO llx_telephonie_prefix VALUES (3937,1187,'55459'); -INSERT INTO llx_telephonie_prefix VALUES (3938,1187,'55469'); -INSERT INTO llx_telephonie_prefix VALUES (3939,1187,'55479'); -INSERT INTO llx_telephonie_prefix VALUES (3940,1188,'5521'); -INSERT INTO llx_telephonie_prefix VALUES (3941,1189,'5511'); -INSERT INTO llx_telephonie_prefix VALUES (3942,1190,'673'); -INSERT INTO llx_telephonie_prefix VALUES (3943,1191,'6732'); -INSERT INTO llx_telephonie_prefix VALUES (3944,1191,'6738'); -INSERT INTO llx_telephonie_prefix VALUES (3945,1192,'359'); -INSERT INTO llx_telephonie_prefix VALUES (3946,1192,'359983'); -INSERT INTO llx_telephonie_prefix VALUES (3947,1193,'35948'); -INSERT INTO llx_telephonie_prefix VALUES (3948,1193,'35988'); -INSERT INTO llx_telephonie_prefix VALUES (3949,1193,'35979'); -INSERT INTO llx_telephonie_prefix VALUES (3950,1193,'35987'); -INSERT INTO llx_telephonie_prefix VALUES (3951,1193,'35997'); -INSERT INTO llx_telephonie_prefix VALUES (3952,1193,'35998'); -INSERT INTO llx_telephonie_prefix VALUES (3953,1194,'226'); -INSERT INTO llx_telephonie_prefix VALUES (3954,1195,'257'); -INSERT INTO llx_telephonie_prefix VALUES (3955,1196,'2572'); -INSERT INTO llx_telephonie_prefix VALUES (3956,1196,'2579'); -INSERT INTO llx_telephonie_prefix VALUES (3957,1197,'855'); -INSERT INTO llx_telephonie_prefix VALUES (3958,1198,'85511'); -INSERT INTO llx_telephonie_prefix VALUES (3959,1198,'85512'); -INSERT INTO llx_telephonie_prefix VALUES (3960,1198,'85515'); -INSERT INTO llx_telephonie_prefix VALUES (3961,1198,'85516'); -INSERT INTO llx_telephonie_prefix VALUES (3962,1198,'85517'); -INSERT INTO llx_telephonie_prefix VALUES (3963,1198,'85518'); -INSERT INTO llx_telephonie_prefix VALUES (3964,1199,'237'); -INSERT INTO llx_telephonie_prefix VALUES (3965,1200,'2375'); -INSERT INTO llx_telephonie_prefix VALUES (3966,1200,'2376'); -INSERT INTO llx_telephonie_prefix VALUES (3967,1200,'2377'); -INSERT INTO llx_telephonie_prefix VALUES (3968,1200,'2378'); -INSERT INTO llx_telephonie_prefix VALUES (3969,1200,'2379'); -INSERT INTO llx_telephonie_prefix VALUES (3970,1201,'1430'); -INSERT INTO llx_telephonie_prefix VALUES (3971,1201,'1204'); -INSERT INTO llx_telephonie_prefix VALUES (3972,1201,'1250'); -INSERT INTO llx_telephonie_prefix VALUES (3973,1201,'1306'); -INSERT INTO llx_telephonie_prefix VALUES (3974,1201,'1403'); -INSERT INTO llx_telephonie_prefix VALUES (3975,1201,'1418'); -INSERT INTO llx_telephonie_prefix VALUES (3976,1201,'1450'); -INSERT INTO llx_telephonie_prefix VALUES (3977,1201,'1506'); -INSERT INTO llx_telephonie_prefix VALUES (3978,1201,'1519'); -INSERT INTO llx_telephonie_prefix VALUES (3979,1201,'1600'); -INSERT INTO llx_telephonie_prefix VALUES (3980,1201,'1604'); -INSERT INTO llx_telephonie_prefix VALUES (3981,1201,'1613'); -INSERT INTO llx_telephonie_prefix VALUES (3982,1201,'1647'); -INSERT INTO llx_telephonie_prefix VALUES (3983,1201,'1705'); -INSERT INTO llx_telephonie_prefix VALUES (3984,1201,'1709'); -INSERT INTO llx_telephonie_prefix VALUES (3985,1201,'1780'); -INSERT INTO llx_telephonie_prefix VALUES (3986,1201,'1807'); -INSERT INTO llx_telephonie_prefix VALUES (3987,1201,'1819'); -INSERT INTO llx_telephonie_prefix VALUES (3988,1201,'1867'); -INSERT INTO llx_telephonie_prefix VALUES (3989,1201,'1902'); -INSERT INTO llx_telephonie_prefix VALUES (3990,1201,'1905'); -INSERT INTO llx_telephonie_prefix VALUES (3991,1202,'1514'); -INSERT INTO llx_telephonie_prefix VALUES (3992,1203,'1416'); -INSERT INTO llx_telephonie_prefix VALUES (3993,1204,'34922'); -INSERT INTO llx_telephonie_prefix VALUES (3994,1204,'34928'); -INSERT INTO llx_telephonie_prefix VALUES (3995,1205,'238'); -INSERT INTO llx_telephonie_prefix VALUES (3996,1206,'2389'); -INSERT INTO llx_telephonie_prefix VALUES (3997,1207,'1345'); -INSERT INTO llx_telephonie_prefix VALUES (3998,1207,'1809945'); -INSERT INTO llx_telephonie_prefix VALUES (3999,1207,'1809947'); -INSERT INTO llx_telephonie_prefix VALUES (4000,1207,'1809948'); -INSERT INTO llx_telephonie_prefix VALUES (4001,1207,'1809949'); -INSERT INTO llx_telephonie_prefix VALUES (4002,1207,'1809995'); -INSERT INTO llx_telephonie_prefix VALUES (4003,1208,'56'); -INSERT INTO llx_telephonie_prefix VALUES (4004,1209,'569'); -INSERT INTO llx_telephonie_prefix VALUES (4005,1209,'561'); -INSERT INTO llx_telephonie_prefix VALUES (4006,1209,'56568'); -INSERT INTO llx_telephonie_prefix VALUES (4007,1209,'56569'); -INSERT INTO llx_telephonie_prefix VALUES (4008,1209,'56600'); -INSERT INTO llx_telephonie_prefix VALUES (4009,1210,'562'); -INSERT INTO llx_telephonie_prefix VALUES (4010,1211,'86'); -INSERT INTO llx_telephonie_prefix VALUES (4011,1212,'8610'); -INSERT INTO llx_telephonie_prefix VALUES (4012,1213,'86591'); -INSERT INTO llx_telephonie_prefix VALUES (4013,1214,'8620'); -INSERT INTO llx_telephonie_prefix VALUES (4014,1214,'86660'); -INSERT INTO llx_telephonie_prefix VALUES (4015,1214,'86662'); -INSERT INTO llx_telephonie_prefix VALUES (4016,1214,'86663'); -INSERT INTO llx_telephonie_prefix VALUES (4017,1214,'86668'); -INSERT INTO llx_telephonie_prefix VALUES (4018,1215,'8613'); -INSERT INTO llx_telephonie_prefix VALUES (4019,1215,'86886'); -INSERT INTO llx_telephonie_prefix VALUES (4020,1216,'8621'); -INSERT INTO llx_telephonie_prefix VALUES (4021,1217,'86577'); -INSERT INTO llx_telephonie_prefix VALUES (4022,1218,'6724'); -INSERT INTO llx_telephonie_prefix VALUES (4023,1219,'357'); -INSERT INTO llx_telephonie_prefix VALUES (4024,1220,'35794'); -INSERT INTO llx_telephonie_prefix VALUES (4025,1220,'35795'); -INSERT INTO llx_telephonie_prefix VALUES (4026,1220,'35796'); -INSERT INTO llx_telephonie_prefix VALUES (4027,1220,'35798'); -INSERT INTO llx_telephonie_prefix VALUES (4028,1221,'90392'); -INSERT INTO llx_telephonie_prefix VALUES (4029,1222,'6722'); -INSERT INTO llx_telephonie_prefix VALUES (4030,1222,'619162'); -INSERT INTO llx_telephonie_prefix VALUES (4031,1223,'57'); -INSERT INTO llx_telephonie_prefix VALUES (4032,1224,'5753'); -INSERT INTO llx_telephonie_prefix VALUES (4033,1225,'5710'); -INSERT INTO llx_telephonie_prefix VALUES (4034,1225,'5711'); -INSERT INTO llx_telephonie_prefix VALUES (4035,1225,'5712'); -INSERT INTO llx_telephonie_prefix VALUES (4036,1225,'5713'); -INSERT INTO llx_telephonie_prefix VALUES (4037,1225,'5714'); -INSERT INTO llx_telephonie_prefix VALUES (4038,1225,'5715'); -INSERT INTO llx_telephonie_prefix VALUES (4039,1225,'5716'); -INSERT INTO llx_telephonie_prefix VALUES (4040,1225,'5717'); -INSERT INTO llx_telephonie_prefix VALUES (4041,1226,'5723'); -INSERT INTO llx_telephonie_prefix VALUES (4042,1226,'5724'); -INSERT INTO llx_telephonie_prefix VALUES (4043,1226,'5725'); -INSERT INTO llx_telephonie_prefix VALUES (4044,1226,'5726'); -INSERT INTO llx_telephonie_prefix VALUES (4045,1226,'57288'); -INSERT INTO llx_telephonie_prefix VALUES (4046,1226,'57289'); -INSERT INTO llx_telephonie_prefix VALUES (4047,1227,'5742'); -INSERT INTO llx_telephonie_prefix VALUES (4048,1227,'5743'); -INSERT INTO llx_telephonie_prefix VALUES (4049,1227,'5744'); -INSERT INTO llx_telephonie_prefix VALUES (4050,1227,'5745'); -INSERT INTO llx_telephonie_prefix VALUES (4051,1228,'573'); -INSERT INTO llx_telephonie_prefix VALUES (4052,1229,'7502'); -INSERT INTO llx_telephonie_prefix VALUES (4053,1230,'2690'); -INSERT INTO llx_telephonie_prefix VALUES (4054,1230,'2691'); -INSERT INTO llx_telephonie_prefix VALUES (4055,1230,'2692'); -INSERT INTO llx_telephonie_prefix VALUES (4056,1230,'2693'); -INSERT INTO llx_telephonie_prefix VALUES (4057,1230,'2694'); -INSERT INTO llx_telephonie_prefix VALUES (4058,1230,'2695'); -INSERT INTO llx_telephonie_prefix VALUES (4059,1230,'2697'); -INSERT INTO llx_telephonie_prefix VALUES (4060,1230,'2698'); -INSERT INTO llx_telephonie_prefix VALUES (4061,1230,'2699'); -INSERT INTO llx_telephonie_prefix VALUES (4062,1231,'7503'); -INSERT INTO llx_telephonie_prefix VALUES (4063,1232,'242'); -INSERT INTO llx_telephonie_prefix VALUES (4064,1233,'682'); -INSERT INTO llx_telephonie_prefix VALUES (4065,1234,'68260'); -INSERT INTO llx_telephonie_prefix VALUES (4066,1234,'68261'); -INSERT INTO llx_telephonie_prefix VALUES (4067,1234,'68264'); -INSERT INTO llx_telephonie_prefix VALUES (4068,1234,'68265'); -INSERT INTO llx_telephonie_prefix VALUES (4069,1235,'850'); -INSERT INTO llx_telephonie_prefix VALUES (4070,1236,'82'); -INSERT INTO llx_telephonie_prefix VALUES (4071,1237,'8211'); -INSERT INTO llx_telephonie_prefix VALUES (4072,1237,'8216'); -INSERT INTO llx_telephonie_prefix VALUES (4073,1237,'8217'); -INSERT INTO llx_telephonie_prefix VALUES (4074,1237,'8218'); -INSERT INTO llx_telephonie_prefix VALUES (4075,1237,'8219'); -INSERT INTO llx_telephonie_prefix VALUES (4076,1237,'8210'); -INSERT INTO llx_telephonie_prefix VALUES (4077,1237,'8212'); -INSERT INTO llx_telephonie_prefix VALUES (4078,1237,'8213'); -INSERT INTO llx_telephonie_prefix VALUES (4079,1237,'8214'); -INSERT INTO llx_telephonie_prefix VALUES (4080,1237,'8215'); -INSERT INTO llx_telephonie_prefix VALUES (4081,1238,'822'); -INSERT INTO llx_telephonie_prefix VALUES (4082,1239,'506'); -INSERT INTO llx_telephonie_prefix VALUES (4083,1240,'5063'); -INSERT INTO llx_telephonie_prefix VALUES (4084,1240,'506283'); -INSERT INTO llx_telephonie_prefix VALUES (4085,1240,'506284'); -INSERT INTO llx_telephonie_prefix VALUES (4086,1240,'5061'); -INSERT INTO llx_telephonie_prefix VALUES (4087,1241,'225'); -INSERT INTO llx_telephonie_prefix VALUES (4088,1242,'2250'); -INSERT INTO llx_telephonie_prefix VALUES (4089,1242,'22507'); -INSERT INTO llx_telephonie_prefix VALUES (4090,1242,'22581'); -INSERT INTO llx_telephonie_prefix VALUES (4091,1242,'22582'); -INSERT INTO llx_telephonie_prefix VALUES (4092,1242,'22583'); -INSERT INTO llx_telephonie_prefix VALUES (4093,1242,'22584'); -INSERT INTO llx_telephonie_prefix VALUES (4094,1242,'22585'); -INSERT INTO llx_telephonie_prefix VALUES (4095,1242,'22587'); -INSERT INTO llx_telephonie_prefix VALUES (4096,1242,'22588'); -INSERT INTO llx_telephonie_prefix VALUES (4097,1242,'22589'); -INSERT INTO llx_telephonie_prefix VALUES (4098,1242,'22590'); -INSERT INTO llx_telephonie_prefix VALUES (4099,1242,'22593'); -INSERT INTO llx_telephonie_prefix VALUES (4100,1242,'22595'); -INSERT INTO llx_telephonie_prefix VALUES (4101,1242,'22596'); -INSERT INTO llx_telephonie_prefix VALUES (4102,1242,'22598'); -INSERT INTO llx_telephonie_prefix VALUES (4103,1242,'22599'); -INSERT INTO llx_telephonie_prefix VALUES (4104,1242,'22503'); -INSERT INTO llx_telephonie_prefix VALUES (4105,1242,'22505'); -INSERT INTO llx_telephonie_prefix VALUES (4106,1243,'385'); -INSERT INTO llx_telephonie_prefix VALUES (4107,1244,'38560'); -INSERT INTO llx_telephonie_prefix VALUES (4108,1244,'38591'); -INSERT INTO llx_telephonie_prefix VALUES (4109,1244,'38598'); -INSERT INTO llx_telephonie_prefix VALUES (4110,1244,'38599'); -INSERT INTO llx_telephonie_prefix VALUES (4111,1245,'53'); -INSERT INTO llx_telephonie_prefix VALUES (4112,1246,'5399'); -INSERT INTO llx_telephonie_prefix VALUES (4113,1247,'45'); -INSERT INTO llx_telephonie_prefix VALUES (4114,1248,'453'); -INSERT INTO llx_telephonie_prefix VALUES (4115,1249,'452'); -INSERT INTO llx_telephonie_prefix VALUES (4116,1249,'4530'); -INSERT INTO llx_telephonie_prefix VALUES (4117,1249,'4540'); -INSERT INTO llx_telephonie_prefix VALUES (4118,1249,'4550'); -INSERT INTO llx_telephonie_prefix VALUES (4119,1249,'4551'); -INSERT INTO llx_telephonie_prefix VALUES (4120,1249,'4560'); -INSERT INTO llx_telephonie_prefix VALUES (4121,1249,'4561'); -INSERT INTO llx_telephonie_prefix VALUES (4122,1249,'4570'); -INSERT INTO llx_telephonie_prefix VALUES (4123,1249,'4590'); -INSERT INTO llx_telephonie_prefix VALUES (4124,1250,'246'); -INSERT INTO llx_telephonie_prefix VALUES (4125,1251,'2461'); -INSERT INTO llx_telephonie_prefix VALUES (4126,1251,'2462'); -INSERT INTO llx_telephonie_prefix VALUES (4127,1251,'2464'); -INSERT INTO llx_telephonie_prefix VALUES (4128,1251,'2465'); -INSERT INTO llx_telephonie_prefix VALUES (4129,1251,'2466'); -INSERT INTO llx_telephonie_prefix VALUES (4130,1251,'2467'); -INSERT INTO llx_telephonie_prefix VALUES (4131,1251,'2468'); -INSERT INTO llx_telephonie_prefix VALUES (4132,1252,'253'); -INSERT INTO llx_telephonie_prefix VALUES (4133,1253,'2538'); -INSERT INTO llx_telephonie_prefix VALUES (4134,1254,'1767'); -INSERT INTO llx_telephonie_prefix VALUES (4135,1254,'1809448'); -INSERT INTO llx_telephonie_prefix VALUES (4136,1254,'1809449'); -INSERT INTO llx_telephonie_prefix VALUES (4137,1255,'1767235'); -INSERT INTO llx_telephonie_prefix VALUES (4138,1255,'1767504'); -INSERT INTO llx_telephonie_prefix VALUES (4139,1256,'20'); -INSERT INTO llx_telephonie_prefix VALUES (4140,1257,'203'); -INSERT INTO llx_telephonie_prefix VALUES (4141,1258,'202'); -INSERT INTO llx_telephonie_prefix VALUES (4142,1259,'2010'); -INSERT INTO llx_telephonie_prefix VALUES (4143,1259,'2012'); -INSERT INTO llx_telephonie_prefix VALUES (4144,1260,'503'); -INSERT INTO llx_telephonie_prefix VALUES (4145,1261,'5038'); -INSERT INTO llx_telephonie_prefix VALUES (4146,1261,'5039'); -INSERT INTO llx_telephonie_prefix VALUES (4147,1262,'971'); -INSERT INTO llx_telephonie_prefix VALUES (4148,1263,'97155'); -INSERT INTO llx_telephonie_prefix VALUES (4149,1263,'97156'); -INSERT INTO llx_telephonie_prefix VALUES (4150,1263,'97157'); -INSERT INTO llx_telephonie_prefix VALUES (4151,1263,'97158'); -INSERT INTO llx_telephonie_prefix VALUES (4152,1263,'97177'); -INSERT INTO llx_telephonie_prefix VALUES (4153,1263,'97178'); -INSERT INTO llx_telephonie_prefix VALUES (4154,1263,'97179'); -INSERT INTO llx_telephonie_prefix VALUES (4155,1263,'97181'); -INSERT INTO llx_telephonie_prefix VALUES (4156,1263,'97182'); -INSERT INTO llx_telephonie_prefix VALUES (4157,1263,'97183'); -INSERT INTO llx_telephonie_prefix VALUES (4158,1263,'97184'); -INSERT INTO llx_telephonie_prefix VALUES (4159,1263,'97185'); -INSERT INTO llx_telephonie_prefix VALUES (4160,1263,'97186'); -INSERT INTO llx_telephonie_prefix VALUES (4161,1263,'97187'); -INSERT INTO llx_telephonie_prefix VALUES (4162,1263,'9715068'); -INSERT INTO llx_telephonie_prefix VALUES (4163,1263,'9715069'); -INSERT INTO llx_telephonie_prefix VALUES (4164,1263,'9715079'); -INSERT INTO llx_telephonie_prefix VALUES (4165,1263,'9716'); -INSERT INTO llx_telephonie_prefix VALUES (4166,1263,'97143'); -INSERT INTO llx_telephonie_prefix VALUES (4167,1263,'97144'); -INSERT INTO llx_telephonie_prefix VALUES (4168,1263,'97145'); -INSERT INTO llx_telephonie_prefix VALUES (4169,1263,'97146'); -INSERT INTO llx_telephonie_prefix VALUES (4170,1263,'97147'); -INSERT INTO llx_telephonie_prefix VALUES (4171,1263,'97148'); -INSERT INTO llx_telephonie_prefix VALUES (4172,1263,'97149'); -INSERT INTO llx_telephonie_prefix VALUES (4173,1264,'593'); -INSERT INTO llx_telephonie_prefix VALUES (4174,1265,'59342'); -INSERT INTO llx_telephonie_prefix VALUES (4175,1266,'59399'); -INSERT INTO llx_telephonie_prefix VALUES (4176,1267,'59322'); -INSERT INTO llx_telephonie_prefix VALUES (4177,1268,'291'); -INSERT INTO llx_telephonie_prefix VALUES (4178,1269,'34'); -INSERT INTO llx_telephonie_prefix VALUES (4179,1270,'3493'); -INSERT INTO llx_telephonie_prefix VALUES (4180,1271,'3491'); -INSERT INTO llx_telephonie_prefix VALUES (4181,1272,'346'); -INSERT INTO llx_telephonie_prefix VALUES (4182,1273,'372'); -INSERT INTO llx_telephonie_prefix VALUES (4183,1274,'3725'); -INSERT INTO llx_telephonie_prefix VALUES (4184,1275,'1'); -INSERT INTO llx_telephonie_prefix VALUES (4185,1276,'1800'); -INSERT INTO llx_telephonie_prefix VALUES (4186,1276,'1880'); -INSERT INTO llx_telephonie_prefix VALUES (4187,1276,'1881'); -INSERT INTO llx_telephonie_prefix VALUES (4188,1276,'1882'); -INSERT INTO llx_telephonie_prefix VALUES (4189,1276,'1888'); -INSERT INTO llx_telephonie_prefix VALUES (4190,1277,'251'); -INSERT INTO llx_telephonie_prefix VALUES (4191,1278,'251920'); -INSERT INTO llx_telephonie_prefix VALUES (4192,1278,'251921'); -INSERT INTO llx_telephonie_prefix VALUES (4193,1278,'251922'); -INSERT INTO llx_telephonie_prefix VALUES (4194,1278,'251923'); -INSERT INTO llx_telephonie_prefix VALUES (4195,1278,'251929'); -INSERT INTO llx_telephonie_prefix VALUES (4196,1279,'500'); -INSERT INTO llx_telephonie_prefix VALUES (4197,1280,'298'); -INSERT INTO llx_telephonie_prefix VALUES (4198,1281,'679'); -INSERT INTO llx_telephonie_prefix VALUES (4199,1282,'67913'); -INSERT INTO llx_telephonie_prefix VALUES (4200,1283,'6799'); -INSERT INTO llx_telephonie_prefix VALUES (4201,1284,'358'); -INSERT INTO llx_telephonie_prefix VALUES (4202,1285,'3589'); -INSERT INTO llx_telephonie_prefix VALUES (4203,1286,'3584'); -INSERT INTO llx_telephonie_prefix VALUES (4204,1286,'35850'); -INSERT INTO llx_telephonie_prefix VALUES (4205,1287,'594'); -INSERT INTO llx_telephonie_prefix VALUES (4207,1289,'336'); -INSERT INTO llx_telephonie_prefix VALUES (4208,1290,'33660'); -INSERT INTO llx_telephonie_prefix VALUES (4209,1290,'33661'); -INSERT INTO llx_telephonie_prefix VALUES (4210,1290,'33662'); -INSERT INTO llx_telephonie_prefix VALUES (4211,1290,'33663'); -INSERT INTO llx_telephonie_prefix VALUES (4212,1290,'33664'); -INSERT INTO llx_telephonie_prefix VALUES (4213,1290,'33665'); -INSERT INTO llx_telephonie_prefix VALUES (4214,1290,'33666'); -INSERT INTO llx_telephonie_prefix VALUES (4215,1290,'33667'); -INSERT INTO llx_telephonie_prefix VALUES (4216,1290,'33668'); -INSERT INTO llx_telephonie_prefix VALUES (4217,1290,'33698'); -INSERT INTO llx_telephonie_prefix VALUES (4218,1290,'33699'); -INSERT INTO llx_telephonie_prefix VALUES (4219,1290,'336062'); -INSERT INTO llx_telephonie_prefix VALUES (4220,1290,'336063'); -INSERT INTO llx_telephonie_prefix VALUES (4221,1290,'336064'); -INSERT INTO llx_telephonie_prefix VALUES (4222,1290,'336530'); -INSERT INTO llx_telephonie_prefix VALUES (4223,1290,'336531'); -INSERT INTO llx_telephonie_prefix VALUES (4224,1290,'336532'); -INSERT INTO llx_telephonie_prefix VALUES (4225,1290,'336533'); -INSERT INTO llx_telephonie_prefix VALUES (4226,1290,'336534'); -INSERT INTO llx_telephonie_prefix VALUES (4227,1291,'3368'); -INSERT INTO llx_telephonie_prefix VALUES (4228,1291,'33607'); -INSERT INTO llx_telephonie_prefix VALUES (4229,1291,'33608'); -INSERT INTO llx_telephonie_prefix VALUES (4230,1291,'33631'); -INSERT INTO llx_telephonie_prefix VALUES (4231,1291,'33654'); -INSERT INTO llx_telephonie_prefix VALUES (4232,1291,'33670'); -INSERT INTO llx_telephonie_prefix VALUES (4233,1291,'33671'); -INSERT INTO llx_telephonie_prefix VALUES (4234,1291,'33672'); -INSERT INTO llx_telephonie_prefix VALUES (4235,1291,'33673'); -INSERT INTO llx_telephonie_prefix VALUES (4236,1291,'33674'); -INSERT INTO llx_telephonie_prefix VALUES (4237,1291,'33675'); -INSERT INTO llx_telephonie_prefix VALUES (4238,1291,'33676'); -INSERT INTO llx_telephonie_prefix VALUES (4239,1291,'33677'); -INSERT INTO llx_telephonie_prefix VALUES (4240,1291,'33678'); -INSERT INTO llx_telephonie_prefix VALUES (4241,1292,'3361'); -INSERT INTO llx_telephonie_prefix VALUES (4242,1292,'33603'); -INSERT INTO llx_telephonie_prefix VALUES (4243,1292,'33609'); -INSERT INTO llx_telephonie_prefix VALUES (4244,1292,'33620'); -INSERT INTO llx_telephonie_prefix VALUES (4245,1292,'33621'); -INSERT INTO llx_telephonie_prefix VALUES (4246,1292,'33622'); -INSERT INTO llx_telephonie_prefix VALUES (4247,1292,'33623'); -INSERT INTO llx_telephonie_prefix VALUES (4248,1292,'33655'); -INSERT INTO llx_telephonie_prefix VALUES (4249,1292,'33624'); -INSERT INTO llx_telephonie_prefix VALUES (4250,1292,'33625'); -INSERT INTO llx_telephonie_prefix VALUES (4251,1292,'33626'); -INSERT INTO llx_telephonie_prefix VALUES (4252,1292,'33627'); -INSERT INTO llx_telephonie_prefix VALUES (4253,1293,'331'); -INSERT INTO llx_telephonie_prefix VALUES (4254,1293,'332'); -INSERT INTO llx_telephonie_prefix VALUES (4255,1293,'333'); -INSERT INTO llx_telephonie_prefix VALUES (4256,1293,'334'); -INSERT INTO llx_telephonie_prefix VALUES (4257,1293,'335'); -INSERT INTO llx_telephonie_prefix VALUES (4258,1294,'241'); -INSERT INTO llx_telephonie_prefix VALUES (4259,1295,'2412'); -INSERT INTO llx_telephonie_prefix VALUES (4260,1296,'220'); -INSERT INTO llx_telephonie_prefix VALUES (4261,1297,'995'); -INSERT INTO llx_telephonie_prefix VALUES (4262,1298,'99577'); -INSERT INTO llx_telephonie_prefix VALUES (4263,1298,'99593'); -INSERT INTO llx_telephonie_prefix VALUES (4264,1298,'99599'); -INSERT INTO llx_telephonie_prefix VALUES (4265,1299,'233'); -INSERT INTO llx_telephonie_prefix VALUES (4266,1300,'23324'); -INSERT INTO llx_telephonie_prefix VALUES (4267,1300,'23327'); -INSERT INTO llx_telephonie_prefix VALUES (4268,1300,'23328'); -INSERT INTO llx_telephonie_prefix VALUES (4269,1301,'350'); -INSERT INTO llx_telephonie_prefix VALUES (4270,1302,'35054'); -INSERT INTO llx_telephonie_prefix VALUES (4271,1302,'35056'); -INSERT INTO llx_telephonie_prefix VALUES (4272,1302,'35057'); -INSERT INTO llx_telephonie_prefix VALUES (4273,1302,'35058'); -INSERT INTO llx_telephonie_prefix VALUES (4274,1303,'30'); -INSERT INTO llx_telephonie_prefix VALUES (4275,1304,'301'); -INSERT INTO llx_telephonie_prefix VALUES (4276,1305,'3093'); -INSERT INTO llx_telephonie_prefix VALUES (4277,1305,'3094'); -INSERT INTO llx_telephonie_prefix VALUES (4278,1305,'3095'); -INSERT INTO llx_telephonie_prefix VALUES (4279,1305,'3097'); -INSERT INTO llx_telephonie_prefix VALUES (4280,1305,'309'); -INSERT INTO llx_telephonie_prefix VALUES (4281,1306,'1473'); -INSERT INTO llx_telephonie_prefix VALUES (4282,1306,'1809440'); -INSERT INTO llx_telephonie_prefix VALUES (4283,1306,'1809441'); -INSERT INTO llx_telephonie_prefix VALUES (4284,1306,'1809442'); -INSERT INTO llx_telephonie_prefix VALUES (4285,1306,'1809443'); -INSERT INTO llx_telephonie_prefix VALUES (4286,1306,'1809444'); -INSERT INTO llx_telephonie_prefix VALUES (4287,1306,'1809445'); -INSERT INTO llx_telephonie_prefix VALUES (4288,1306,'1809446'); -INSERT INTO llx_telephonie_prefix VALUES (4289,1306,'1809447'); -INSERT INTO llx_telephonie_prefix VALUES (4290,1307,'299'); -INSERT INTO llx_telephonie_prefix VALUES (4291,1308,'2994'); -INSERT INTO llx_telephonie_prefix VALUES (4292,1308,'2995'); -INSERT INTO llx_telephonie_prefix VALUES (4293,1309,'590'); -INSERT INTO llx_telephonie_prefix VALUES (4294,1309,'59059'); -INSERT INTO llx_telephonie_prefix VALUES (4295,1310,'59080'); -INSERT INTO llx_telephonie_prefix VALUES (4296,1310,'590690'); -INSERT INTO llx_telephonie_prefix VALUES (4297,1310,'59066'); -INSERT INTO llx_telephonie_prefix VALUES (4298,1311,'1671'); -INSERT INTO llx_telephonie_prefix VALUES (4299,1311,'671'); -INSERT INTO llx_telephonie_prefix VALUES (4300,1312,'502'); -INSERT INTO llx_telephonie_prefix VALUES (4301,1313,'50220'); -INSERT INTO llx_telephonie_prefix VALUES (4302,1313,'50221'); -INSERT INTO llx_telephonie_prefix VALUES (4303,1313,'50230'); -INSERT INTO llx_telephonie_prefix VALUES (4304,1313,'50231'); -INSERT INTO llx_telephonie_prefix VALUES (4305,1313,'50240'); -INSERT INTO llx_telephonie_prefix VALUES (4306,1313,'50241'); -INSERT INTO llx_telephonie_prefix VALUES (4307,1313,'50250'); -INSERT INTO llx_telephonie_prefix VALUES (4308,1313,'50251'); -INSERT INTO llx_telephonie_prefix VALUES (4309,1313,'50260'); -INSERT INTO llx_telephonie_prefix VALUES (4310,1313,'50261'); -INSERT INTO llx_telephonie_prefix VALUES (4311,1313,'50270'); -INSERT INTO llx_telephonie_prefix VALUES (4312,1313,'50271'); -INSERT INTO llx_telephonie_prefix VALUES (4313,1313,'50280'); -INSERT INTO llx_telephonie_prefix VALUES (4314,1313,'50281'); -INSERT INTO llx_telephonie_prefix VALUES (4315,1313,'50290'); -INSERT INTO llx_telephonie_prefix VALUES (4316,1313,'50291'); -INSERT INTO llx_telephonie_prefix VALUES (4317,1314,'224'); -INSERT INTO llx_telephonie_prefix VALUES (4318,1315,'245'); -INSERT INTO llx_telephonie_prefix VALUES (4319,1316,'240'); -INSERT INTO llx_telephonie_prefix VALUES (4320,1317,'592'); -INSERT INTO llx_telephonie_prefix VALUES (4321,1318,'594694'); -INSERT INTO llx_telephonie_prefix VALUES (4322,1318,'694'); -INSERT INTO llx_telephonie_prefix VALUES (4323,1319,'509'); -INSERT INTO llx_telephonie_prefix VALUES (4324,1320,'50952'); -INSERT INTO llx_telephonie_prefix VALUES (4325,1320,'50953'); -INSERT INTO llx_telephonie_prefix VALUES (4326,1320,'50954'); -INSERT INTO llx_telephonie_prefix VALUES (4327,1320,'50955'); -INSERT INTO llx_telephonie_prefix VALUES (4328,1320,'509331'); -INSERT INTO llx_telephonie_prefix VALUES (4329,1320,'509332'); -INSERT INTO llx_telephonie_prefix VALUES (4330,1320,'509333'); -INSERT INTO llx_telephonie_prefix VALUES (4331,1320,'509334'); -INSERT INTO llx_telephonie_prefix VALUES (4332,1320,'509401'); -INSERT INTO llx_telephonie_prefix VALUES (4333,1320,'509402'); -INSERT INTO llx_telephonie_prefix VALUES (4334,1320,'509403'); -INSERT INTO llx_telephonie_prefix VALUES (4335,1320,'509404'); -INSERT INTO llx_telephonie_prefix VALUES (4336,1320,'509405'); -INSERT INTO llx_telephonie_prefix VALUES (4337,1320,'509251'); -INSERT INTO llx_telephonie_prefix VALUES (4338,1320,'509330'); -INSERT INTO llx_telephonie_prefix VALUES (4339,1320,'509420'); -INSERT INTO llx_telephonie_prefix VALUES (4340,1320,'509510'); -INSERT INTO llx_telephonie_prefix VALUES (4341,1320,'509851'); -INSERT INTO llx_telephonie_prefix VALUES (4342,1321,'1808'); -INSERT INTO llx_telephonie_prefix VALUES (4343,1322,'504'); -INSERT INTO llx_telephonie_prefix VALUES (4344,1323,'5049'); -INSERT INTO llx_telephonie_prefix VALUES (4345,1323,'50497'); -INSERT INTO llx_telephonie_prefix VALUES (4346,1323,'50498'); -INSERT INTO llx_telephonie_prefix VALUES (4347,1323,'50499'); -INSERT INTO llx_telephonie_prefix VALUES (4348,1324,'852'); -INSERT INTO llx_telephonie_prefix VALUES (4349,1325,'8526'); -INSERT INTO llx_telephonie_prefix VALUES (4350,1325,'8527'); -INSERT INTO llx_telephonie_prefix VALUES (4351,1325,'8529'); -INSERT INTO llx_telephonie_prefix VALUES (4352,1325,'85248'); -INSERT INTO llx_telephonie_prefix VALUES (4353,1325,'85249'); -INSERT INTO llx_telephonie_prefix VALUES (4354,1325,'852901'); -INSERT INTO llx_telephonie_prefix VALUES (4355,1325,'852902'); -INSERT INTO llx_telephonie_prefix VALUES (4356,1325,'852903'); -INSERT INTO llx_telephonie_prefix VALUES (4357,1325,'852904'); -INSERT INTO llx_telephonie_prefix VALUES (4358,1325,'852905'); -INSERT INTO llx_telephonie_prefix VALUES (4359,1325,'852906'); -INSERT INTO llx_telephonie_prefix VALUES (4360,1325,'852907'); -INSERT INTO llx_telephonie_prefix VALUES (4361,1325,'852908'); -INSERT INTO llx_telephonie_prefix VALUES (4362,1325,'852909'); -INSERT INTO llx_telephonie_prefix VALUES (4363,1325,'852910'); -INSERT INTO llx_telephonie_prefix VALUES (4364,1325,'852912'); -INSERT INTO llx_telephonie_prefix VALUES (4365,1325,'852913'); -INSERT INTO llx_telephonie_prefix VALUES (4366,1325,'852914'); -INSERT INTO llx_telephonie_prefix VALUES (4367,1325,'852915'); -INSERT INTO llx_telephonie_prefix VALUES (4368,1325,'852916'); -INSERT INTO llx_telephonie_prefix VALUES (4369,1325,'852917'); -INSERT INTO llx_telephonie_prefix VALUES (4370,1325,'852918'); -INSERT INTO llx_telephonie_prefix VALUES (4371,1325,'852919'); -INSERT INTO llx_telephonie_prefix VALUES (4372,1325,'85292'); -INSERT INTO llx_telephonie_prefix VALUES (4373,1325,'85293'); -INSERT INTO llx_telephonie_prefix VALUES (4374,1325,'85294'); -INSERT INTO llx_telephonie_prefix VALUES (4375,1325,'852955'); -INSERT INTO llx_telephonie_prefix VALUES (4376,1325,'852956'); -INSERT INTO llx_telephonie_prefix VALUES (4377,1325,'852957'); -INSERT INTO llx_telephonie_prefix VALUES (4378,1325,'85296'); -INSERT INTO llx_telephonie_prefix VALUES (4379,1325,'85297'); -INSERT INTO llx_telephonie_prefix VALUES (4380,1325,'85298'); -INSERT INTO llx_telephonie_prefix VALUES (4381,1326,'36'); -INSERT INTO llx_telephonie_prefix VALUES (4382,1327,'3620'); -INSERT INTO llx_telephonie_prefix VALUES (4383,1327,'3630'); -INSERT INTO llx_telephonie_prefix VALUES (4384,1327,'3660'); -INSERT INTO llx_telephonie_prefix VALUES (4385,1327,'3670'); -INSERT INTO llx_telephonie_prefix VALUES (4386,1328,'643'); -INSERT INTO llx_telephonie_prefix VALUES (4387,1329,'6998'); -INSERT INTO llx_telephonie_prefix VALUES (4388,1330,'6993'); -INSERT INTO llx_telephonie_prefix VALUES (4389,1331,'91'); -INSERT INTO llx_telephonie_prefix VALUES (4390,1332,'9180'); -INSERT INTO llx_telephonie_prefix VALUES (4391,1333,'9122'); -INSERT INTO llx_telephonie_prefix VALUES (4392,1334,'9133'); -INSERT INTO llx_telephonie_prefix VALUES (4393,1335,'9144'); -INSERT INTO llx_telephonie_prefix VALUES (4394,1336,'9197'); -INSERT INTO llx_telephonie_prefix VALUES (4395,1336,'9198'); -INSERT INTO llx_telephonie_prefix VALUES (4396,1336,'91351'); -INSERT INTO llx_telephonie_prefix VALUES (4397,1337,'9111'); -INSERT INTO llx_telephonie_prefix VALUES (4398,1338,'62'); -INSERT INTO llx_telephonie_prefix VALUES (4399,1339,'6221'); -INSERT INTO llx_telephonie_prefix VALUES (4400,1340,'6281'); -INSERT INTO llx_telephonie_prefix VALUES (4401,1340,'6282'); -INSERT INTO llx_telephonie_prefix VALUES (4402,1340,'6228'); -INSERT INTO llx_telephonie_prefix VALUES (4403,1340,'628'); -INSERT INTO llx_telephonie_prefix VALUES (4404,1341,'8734'); -INSERT INTO llx_telephonie_prefix VALUES (4405,1342,'8711'); -INSERT INTO llx_telephonie_prefix VALUES (4406,1343,'8721'); -INSERT INTO llx_telephonie_prefix VALUES (4407,1344,'8715'); -INSERT INTO llx_telephonie_prefix VALUES (4408,1345,'871'); -INSERT INTO llx_telephonie_prefix VALUES (4409,1346,'8714'); -INSERT INTO llx_telephonie_prefix VALUES (4410,1347,'874'); -INSERT INTO llx_telephonie_prefix VALUES (4411,1348,'8741'); -INSERT INTO llx_telephonie_prefix VALUES (4412,1349,'8744'); -INSERT INTO llx_telephonie_prefix VALUES (4413,1350,'8713'); -INSERT INTO llx_telephonie_prefix VALUES (4414,1351,'8743'); -INSERT INTO llx_telephonie_prefix VALUES (4415,1352,'87039'); -INSERT INTO llx_telephonie_prefix VALUES (4416,1353,'8733'); -INSERT INTO llx_telephonie_prefix VALUES (4417,1354,'8723'); -INSERT INTO llx_telephonie_prefix VALUES (4418,1355,'8716'); -INSERT INTO llx_telephonie_prefix VALUES (4419,1355,'8717'); -INSERT INTO llx_telephonie_prefix VALUES (4420,1356,'8746'); -INSERT INTO llx_telephonie_prefix VALUES (4421,1357,'8736'); -INSERT INTO llx_telephonie_prefix VALUES (4422,1358,'8726'); -INSERT INTO llx_telephonie_prefix VALUES (4423,1359,'87076'); -INSERT INTO llx_telephonie_prefix VALUES (4424,1360,'87176'); -INSERT INTO llx_telephonie_prefix VALUES (4425,1361,'87476'); -INSERT INTO llx_telephonie_prefix VALUES (4426,1362,'87376'); -INSERT INTO llx_telephonie_prefix VALUES (4427,1363,'873'); -INSERT INTO llx_telephonie_prefix VALUES (4428,1364,'8731'); -INSERT INTO llx_telephonie_prefix VALUES (4429,1365,'872'); -INSERT INTO llx_telephonie_prefix VALUES (4430,1366,'8724'); -INSERT INTO llx_telephonie_prefix VALUES (4431,1367,'87276'); -INSERT INTO llx_telephonie_prefix VALUES (4432,1368,'87030'); -INSERT INTO llx_telephonie_prefix VALUES (4433,1368,'87031'); -INSERT INTO llx_telephonie_prefix VALUES (4434,1368,'87032'); -INSERT INTO llx_telephonie_prefix VALUES (4435,1368,'87033'); -INSERT INTO llx_telephonie_prefix VALUES (4436,1368,'87034'); -INSERT INTO llx_telephonie_prefix VALUES (4437,1368,'87035'); -INSERT INTO llx_telephonie_prefix VALUES (4438,1368,'87036'); -INSERT INTO llx_telephonie_prefix VALUES (4439,1368,'87037'); -INSERT INTO llx_telephonie_prefix VALUES (4440,1368,'87038'); -INSERT INTO llx_telephonie_prefix VALUES (4441,1369,'964'); -INSERT INTO llx_telephonie_prefix VALUES (4442,1370,'98'); -INSERT INTO llx_telephonie_prefix VALUES (4443,1371,'98911'); -INSERT INTO llx_telephonie_prefix VALUES (4444,1372,'353'); -INSERT INTO llx_telephonie_prefix VALUES (4445,1373,'3531'); -INSERT INTO llx_telephonie_prefix VALUES (4446,1374,'35386'); -INSERT INTO llx_telephonie_prefix VALUES (4447,1374,'35387'); -INSERT INTO llx_telephonie_prefix VALUES (4448,1374,'35388'); -INSERT INTO llx_telephonie_prefix VALUES (4449,1374,'35382'); -INSERT INTO llx_telephonie_prefix VALUES (4450,1375,'3531520'); -INSERT INTO llx_telephonie_prefix VALUES (4451,1375,'3531530'); -INSERT INTO llx_telephonie_prefix VALUES (4452,1375,'3531540'); -INSERT INTO llx_telephonie_prefix VALUES (4453,1375,'3531550'); -INSERT INTO llx_telephonie_prefix VALUES (4454,1375,'3531559'); -INSERT INTO llx_telephonie_prefix VALUES (4455,1375,'3531560'); -INSERT INTO llx_telephonie_prefix VALUES (4456,1375,'3531570'); -INSERT INTO llx_telephonie_prefix VALUES (4457,1375,'3531580'); -INSERT INTO llx_telephonie_prefix VALUES (4458,1376,'8816'); -INSERT INTO llx_telephonie_prefix VALUES (4459,1377,'8817'); -INSERT INTO llx_telephonie_prefix VALUES (4460,1378,'8821'); -INSERT INTO llx_telephonie_prefix VALUES (4461,1379,'354'); -INSERT INTO llx_telephonie_prefix VALUES (4462,1380,'354398'); -INSERT INTO llx_telephonie_prefix VALUES (4463,1380,'354399'); -INSERT INTO llx_telephonie_prefix VALUES (4464,1380,'3546'); -INSERT INTO llx_telephonie_prefix VALUES (4465,1380,'35462'); -INSERT INTO llx_telephonie_prefix VALUES (4466,1380,'354649'); -INSERT INTO llx_telephonie_prefix VALUES (4467,1380,'354659'); -INSERT INTO llx_telephonie_prefix VALUES (4468,1380,'35468'); -INSERT INTO llx_telephonie_prefix VALUES (4469,1380,'35469'); -INSERT INTO llx_telephonie_prefix VALUES (4470,1380,'35482'); -INSERT INTO llx_telephonie_prefix VALUES (4471,1380,'35483'); -INSERT INTO llx_telephonie_prefix VALUES (4472,1380,'35484'); -INSERT INTO llx_telephonie_prefix VALUES (4473,1380,'35485'); -INSERT INTO llx_telephonie_prefix VALUES (4474,1380,'35486'); -INSERT INTO llx_telephonie_prefix VALUES (4475,1380,'35487'); -INSERT INTO llx_telephonie_prefix VALUES (4476,1380,'35488'); -INSERT INTO llx_telephonie_prefix VALUES (4477,1380,'35489'); -INSERT INTO llx_telephonie_prefix VALUES (4478,1381,'972'); -INSERT INTO llx_telephonie_prefix VALUES (4479,1382,'97264'); -INSERT INTO llx_telephonie_prefix VALUES (4480,1382,'9725'); -INSERT INTO llx_telephonie_prefix VALUES (4481,1382,'97250'); -INSERT INTO llx_telephonie_prefix VALUES (4482,1382,'97251'); -INSERT INTO llx_telephonie_prefix VALUES (4483,1382,'97252'); -INSERT INTO llx_telephonie_prefix VALUES (4484,1382,'97253'); -INSERT INTO llx_telephonie_prefix VALUES (4485,1382,'97254'); -INSERT INTO llx_telephonie_prefix VALUES (4486,1382,'97255'); -INSERT INTO llx_telephonie_prefix VALUES (4487,1382,'97256'); -INSERT INTO llx_telephonie_prefix VALUES (4488,1382,'97257'); -INSERT INTO llx_telephonie_prefix VALUES (4489,1382,'97258'); -INSERT INTO llx_telephonie_prefix VALUES (4490,1382,'97259'); -INSERT INTO llx_telephonie_prefix VALUES (4491,1382,'97267'); -INSERT INTO llx_telephonie_prefix VALUES (4492,1382,'97268'); -INSERT INTO llx_telephonie_prefix VALUES (4493,1383,'9723'); -INSERT INTO llx_telephonie_prefix VALUES (4494,1384,'39'); -INSERT INTO llx_telephonie_prefix VALUES (4495,1385,'3902'); -INSERT INTO llx_telephonie_prefix VALUES (4496,1386,'39320'); -INSERT INTO llx_telephonie_prefix VALUES (4497,1386,'39328'); -INSERT INTO llx_telephonie_prefix VALUES (4498,1386,'39329'); -INSERT INTO llx_telephonie_prefix VALUES (4499,1386,'39330'); -INSERT INTO llx_telephonie_prefix VALUES (4500,1386,'39333'); -INSERT INTO llx_telephonie_prefix VALUES (4501,1386,'39334'); -INSERT INTO llx_telephonie_prefix VALUES (4502,1386,'39335'); -INSERT INTO llx_telephonie_prefix VALUES (4503,1386,'39336'); -INSERT INTO llx_telephonie_prefix VALUES (4504,1386,'39337'); -INSERT INTO llx_telephonie_prefix VALUES (4505,1386,'39338'); -INSERT INTO llx_telephonie_prefix VALUES (4506,1386,'39339'); -INSERT INTO llx_telephonie_prefix VALUES (4507,1386,'39340'); -INSERT INTO llx_telephonie_prefix VALUES (4508,1386,'39347'); -INSERT INTO llx_telephonie_prefix VALUES (4509,1386,'39348'); -INSERT INTO llx_telephonie_prefix VALUES (4510,1386,'39349'); -INSERT INTO llx_telephonie_prefix VALUES (4511,1386,'39360'); -INSERT INTO llx_telephonie_prefix VALUES (4512,1386,'39368'); -INSERT INTO llx_telephonie_prefix VALUES (4513,1386,'39380'); -INSERT INTO llx_telephonie_prefix VALUES (4514,1386,'39388'); -INSERT INTO llx_telephonie_prefix VALUES (4515,1386,'39389'); -INSERT INTO llx_telephonie_prefix VALUES (4516,1387,'3906'); -INSERT INTO llx_telephonie_prefix VALUES (4517,1388,'379'); -INSERT INTO llx_telephonie_prefix VALUES (4518,1389,'1809985'); -INSERT INTO llx_telephonie_prefix VALUES (4519,1389,'1809986'); -INSERT INTO llx_telephonie_prefix VALUES (4520,1389,'1809987'); -INSERT INTO llx_telephonie_prefix VALUES (4521,1389,'1809988'); -INSERT INTO llx_telephonie_prefix VALUES (4522,1389,'1809992'); -INSERT INTO llx_telephonie_prefix VALUES (4523,1389,'1809993'); -INSERT INTO llx_telephonie_prefix VALUES (4524,1389,'1809994'); -INSERT INTO llx_telephonie_prefix VALUES (4525,1389,'1809996'); -INSERT INTO llx_telephonie_prefix VALUES (4526,1389,'1809997'); -INSERT INTO llx_telephonie_prefix VALUES (4527,1389,'1809998'); -INSERT INTO llx_telephonie_prefix VALUES (4528,1389,'1876'); -INSERT INTO llx_telephonie_prefix VALUES (4529,1389,'1809797'); -INSERT INTO llx_telephonie_prefix VALUES (4530,1389,'180992'); -INSERT INTO llx_telephonie_prefix VALUES (4531,1389,'1809925'); -INSERT INTO llx_telephonie_prefix VALUES (4532,1389,'1809936'); -INSERT INTO llx_telephonie_prefix VALUES (4533,1389,'1809938'); -INSERT INTO llx_telephonie_prefix VALUES (4534,1389,'1809942'); -INSERT INTO llx_telephonie_prefix VALUES (4535,1389,'1809943'); -INSERT INTO llx_telephonie_prefix VALUES (4536,1389,'1809944'); -INSERT INTO llx_telephonie_prefix VALUES (4537,1389,'1809951'); -INSERT INTO llx_telephonie_prefix VALUES (4538,1389,'1809952'); -INSERT INTO llx_telephonie_prefix VALUES (4539,1389,'1809953'); -INSERT INTO llx_telephonie_prefix VALUES (4540,1389,'1809954'); -INSERT INTO llx_telephonie_prefix VALUES (4541,1389,'1809955'); -INSERT INTO llx_telephonie_prefix VALUES (4542,1389,'1809956'); -INSERT INTO llx_telephonie_prefix VALUES (4543,1389,'1809957'); -INSERT INTO llx_telephonie_prefix VALUES (4544,1389,'1809958'); -INSERT INTO llx_telephonie_prefix VALUES (4545,1389,'1809960'); -INSERT INTO llx_telephonie_prefix VALUES (4546,1389,'1809962'); -INSERT INTO llx_telephonie_prefix VALUES (4547,1389,'1809963'); -INSERT INTO llx_telephonie_prefix VALUES (4548,1389,'1809964'); -INSERT INTO llx_telephonie_prefix VALUES (4549,1389,'1809965'); -INSERT INTO llx_telephonie_prefix VALUES (4550,1389,'1809966'); -INSERT INTO llx_telephonie_prefix VALUES (4551,1389,'1809967'); -INSERT INTO llx_telephonie_prefix VALUES (4552,1389,'1809968'); -INSERT INTO llx_telephonie_prefix VALUES (4553,1389,'1809969'); -INSERT INTO llx_telephonie_prefix VALUES (4554,1389,'1809972'); -INSERT INTO llx_telephonie_prefix VALUES (4555,1389,'1809973'); -INSERT INTO llx_telephonie_prefix VALUES (4556,1389,'1809974'); -INSERT INTO llx_telephonie_prefix VALUES (4557,1389,'1809975'); -INSERT INTO llx_telephonie_prefix VALUES (4558,1389,'1809977'); -INSERT INTO llx_telephonie_prefix VALUES (4559,1389,'1809978'); -INSERT INTO llx_telephonie_prefix VALUES (4560,1389,'1809979'); -INSERT INTO llx_telephonie_prefix VALUES (4561,1389,'1809982'); -INSERT INTO llx_telephonie_prefix VALUES (4562,1389,'1809983'); -INSERT INTO llx_telephonie_prefix VALUES (4563,1389,'1809984'); -INSERT INTO llx_telephonie_prefix VALUES (4564,1390,'187621'); -INSERT INTO llx_telephonie_prefix VALUES (4565,1390,'1876781'); -INSERT INTO llx_telephonie_prefix VALUES (4566,1390,'1876782'); -INSERT INTO llx_telephonie_prefix VALUES (4567,1390,'1876783'); -INSERT INTO llx_telephonie_prefix VALUES (4568,1390,'1876784'); -INSERT INTO llx_telephonie_prefix VALUES (4569,1390,'1876790'); -INSERT INTO llx_telephonie_prefix VALUES (4570,1390,'1876791'); -INSERT INTO llx_telephonie_prefix VALUES (4571,1390,'1876793'); -INSERT INTO llx_telephonie_prefix VALUES (4572,1390,'1876796'); -INSERT INTO llx_telephonie_prefix VALUES (4573,1390,'1876797'); -INSERT INTO llx_telephonie_prefix VALUES (4574,1390,'1876798'); -INSERT INTO llx_telephonie_prefix VALUES (4575,1390,'1876799'); -INSERT INTO llx_telephonie_prefix VALUES (4576,1391,'81'); -INSERT INTO llx_telephonie_prefix VALUES (4577,1392,'8110'); -INSERT INTO llx_telephonie_prefix VALUES (4578,1392,'8120'); -INSERT INTO llx_telephonie_prefix VALUES (4579,1392,'8140'); -INSERT INTO llx_telephonie_prefix VALUES (4580,1392,'8150'); -INSERT INTO llx_telephonie_prefix VALUES (4581,1392,'8160'); -INSERT INTO llx_telephonie_prefix VALUES (4582,1392,'8170'); -INSERT INTO llx_telephonie_prefix VALUES (4583,1392,'8180'); -INSERT INTO llx_telephonie_prefix VALUES (4584,1392,'8190'); -INSERT INTO llx_telephonie_prefix VALUES (4585,1393,'8152'); -INSERT INTO llx_telephonie_prefix VALUES (4586,1394,'819'); -INSERT INTO llx_telephonie_prefix VALUES (4587,1395,'816'); -INSERT INTO llx_telephonie_prefix VALUES (4588,1396,'813'); -INSERT INTO llx_telephonie_prefix VALUES (4589,1397,'962'); -INSERT INTO llx_telephonie_prefix VALUES (4590,1398,'96277'); -INSERT INTO llx_telephonie_prefix VALUES (4591,1398,'96279'); -INSERT INTO llx_telephonie_prefix VALUES (4592,1398,'96269'); -INSERT INTO llx_telephonie_prefix VALUES (4593,1398,'9629'); -INSERT INTO llx_telephonie_prefix VALUES (4594,1399,'731'); -INSERT INTO llx_telephonie_prefix VALUES (4595,1399,'732'); -INSERT INTO llx_telephonie_prefix VALUES (4596,1399,'7330'); -INSERT INTO llx_telephonie_prefix VALUES (4597,1399,'731122'); -INSERT INTO llx_telephonie_prefix VALUES (4598,1399,'73152'); -INSERT INTO llx_telephonie_prefix VALUES (4599,1399,'73212'); -INSERT INTO llx_telephonie_prefix VALUES (4600,1399,'73232'); -INSERT INTO llx_telephonie_prefix VALUES (4601,1399,'73272'); -INSERT INTO llx_telephonie_prefix VALUES (4602,1400,'7300'); -INSERT INTO llx_telephonie_prefix VALUES (4603,1400,'7333'); -INSERT INTO llx_telephonie_prefix VALUES (4604,1400,'7570'); -INSERT INTO llx_telephonie_prefix VALUES (4605,1400,'7571'); -INSERT INTO llx_telephonie_prefix VALUES (4606,1401,'254'); -INSERT INTO llx_telephonie_prefix VALUES (4607,1402,'2547'); -INSERT INTO llx_telephonie_prefix VALUES (4608,1402,'25471'); -INSERT INTO llx_telephonie_prefix VALUES (4609,1402,'25472'); -INSERT INTO llx_telephonie_prefix VALUES (4610,1402,'25473'); -INSERT INTO llx_telephonie_prefix VALUES (4611,1403,'996'); -INSERT INTO llx_telephonie_prefix VALUES (4612,1404,'9963'); -INSERT INTO llx_telephonie_prefix VALUES (4613,1404,'996502'); -INSERT INTO llx_telephonie_prefix VALUES (4614,1404,'996517'); -INSERT INTO llx_telephonie_prefix VALUES (4615,1404,'99631'); -INSERT INTO llx_telephonie_prefix VALUES (4616,1404,'99632'); -INSERT INTO llx_telephonie_prefix VALUES (4617,1404,'99634'); -INSERT INTO llx_telephonie_prefix VALUES (4618,1404,'99635'); -INSERT INTO llx_telephonie_prefix VALUES (4619,1404,'99636'); -INSERT INTO llx_telephonie_prefix VALUES (4620,1404,'99637'); -INSERT INTO llx_telephonie_prefix VALUES (4621,1404,'99639'); -INSERT INTO llx_telephonie_prefix VALUES (4622,1404,'99650'); -INSERT INTO llx_telephonie_prefix VALUES (4623,1404,'99651'); -INSERT INTO llx_telephonie_prefix VALUES (4624,1405,'686'); -INSERT INTO llx_telephonie_prefix VALUES (4625,1406,'6863'); -INSERT INTO llx_telephonie_prefix VALUES (4626,1407,'965'); -INSERT INTO llx_telephonie_prefix VALUES (4627,1408,'9659'); -INSERT INTO llx_telephonie_prefix VALUES (4628,1408,'9656'); -INSERT INTO llx_telephonie_prefix VALUES (4629,1408,'96595'); -INSERT INTO llx_telephonie_prefix VALUES (4630,1408,'96596'); -INSERT INTO llx_telephonie_prefix VALUES (4631,1408,'96597'); -INSERT INTO llx_telephonie_prefix VALUES (4632,1408,'96598'); -INSERT INTO llx_telephonie_prefix VALUES (4633,1409,'856'); -INSERT INTO llx_telephonie_prefix VALUES (4634,1410,'266'); -INSERT INTO llx_telephonie_prefix VALUES (4635,1411,'2662'); -INSERT INTO llx_telephonie_prefix VALUES (4636,1411,'266212'); -INSERT INTO llx_telephonie_prefix VALUES (4637,1411,'2668'); -INSERT INTO llx_telephonie_prefix VALUES (4638,1411,'26685'); -INSERT INTO llx_telephonie_prefix VALUES (4639,1411,'26686'); -INSERT INTO llx_telephonie_prefix VALUES (4640,1412,'371'); -INSERT INTO llx_telephonie_prefix VALUES (4641,1413,'3712'); -INSERT INTO llx_telephonie_prefix VALUES (4642,1414,'961'); -INSERT INTO llx_telephonie_prefix VALUES (4643,1415,'9613'); -INSERT INTO llx_telephonie_prefix VALUES (4644,1416,'231'); -INSERT INTO llx_telephonie_prefix VALUES (4645,1417,'23128'); -INSERT INTO llx_telephonie_prefix VALUES (4646,1418,'218'); -INSERT INTO llx_telephonie_prefix VALUES (4647,1419,'423'); -INSERT INTO llx_telephonie_prefix VALUES (4648,1419,'4175'); -INSERT INTO llx_telephonie_prefix VALUES (4649,1420,'4235'); -INSERT INTO llx_telephonie_prefix VALUES (4650,1420,'4236'); -INSERT INTO llx_telephonie_prefix VALUES (4651,1420,'4237'); -INSERT INTO llx_telephonie_prefix VALUES (4652,1420,'42377'); -INSERT INTO llx_telephonie_prefix VALUES (4653,1421,'370'); -INSERT INTO llx_telephonie_prefix VALUES (4654,1422,'370229'); -INSERT INTO llx_telephonie_prefix VALUES (4655,1422,'370610'); -INSERT INTO llx_telephonie_prefix VALUES (4656,1422,'370611'); -INSERT INTO llx_telephonie_prefix VALUES (4657,1422,'370650'); -INSERT INTO llx_telephonie_prefix VALUES (4658,1422,'370651'); -INSERT INTO llx_telephonie_prefix VALUES (4659,1422,'370670'); -INSERT INTO llx_telephonie_prefix VALUES (4660,1422,'370671'); -INSERT INTO llx_telephonie_prefix VALUES (4661,1422,'370680'); -INSERT INTO llx_telephonie_prefix VALUES (4662,1422,'3708'); -INSERT INTO llx_telephonie_prefix VALUES (4663,1422,'3709'); -INSERT INTO llx_telephonie_prefix VALUES (4664,1422,'37098'); -INSERT INTO llx_telephonie_prefix VALUES (4665,1422,'37099'); -INSERT INTO llx_telephonie_prefix VALUES (4666,1423,'352'); -INSERT INTO llx_telephonie_prefix VALUES (4667,1424,'35221'); -INSERT INTO llx_telephonie_prefix VALUES (4668,1424,'35228'); -INSERT INTO llx_telephonie_prefix VALUES (4669,1424,'35291'); -INSERT INTO llx_telephonie_prefix VALUES (4670,1424,'35298'); -INSERT INTO llx_telephonie_prefix VALUES (4671,1424,'352021'); -INSERT INTO llx_telephonie_prefix VALUES (4672,1424,'352028'); -INSERT INTO llx_telephonie_prefix VALUES (4673,1424,'352029'); -INSERT INTO llx_telephonie_prefix VALUES (4674,1424,'352091'); -INSERT INTO llx_telephonie_prefix VALUES (4675,1424,'352098'); -INSERT INTO llx_telephonie_prefix VALUES (4676,1425,'853'); -INSERT INTO llx_telephonie_prefix VALUES (4677,1426,'8536'); -INSERT INTO llx_telephonie_prefix VALUES (4678,1426,'85366'); -INSERT INTO llx_telephonie_prefix VALUES (4679,1426,'85368'); -INSERT INTO llx_telephonie_prefix VALUES (4680,1427,'389'); -INSERT INTO llx_telephonie_prefix VALUES (4681,1428,'3897'); -INSERT INTO llx_telephonie_prefix VALUES (4682,1429,'261'); -INSERT INTO llx_telephonie_prefix VALUES (4683,1430,'2613'); -INSERT INTO llx_telephonie_prefix VALUES (4684,1431,'351291'); -INSERT INTO llx_telephonie_prefix VALUES (4685,1432,'351919'); -INSERT INTO llx_telephonie_prefix VALUES (4686,1433,'60'); -INSERT INTO llx_telephonie_prefix VALUES (4687,1434,'603'); -INSERT INTO llx_telephonie_prefix VALUES (4688,1435,'601'); -INSERT INTO llx_telephonie_prefix VALUES (4689,1436,'265'); -INSERT INTO llx_telephonie_prefix VALUES (4690,1437,'2659'); -INSERT INTO llx_telephonie_prefix VALUES (4691,1438,'960'); -INSERT INTO llx_telephonie_prefix VALUES (4692,1439,'9607'); -INSERT INTO llx_telephonie_prefix VALUES (4693,1440,'223'); -INSERT INTO llx_telephonie_prefix VALUES (4694,1441,'356'); -INSERT INTO llx_telephonie_prefix VALUES (4695,1442,'3569'); -INSERT INTO llx_telephonie_prefix VALUES (4696,1443,'1670'); -INSERT INTO llx_telephonie_prefix VALUES (4697,1444,'212'); -INSERT INTO llx_telephonie_prefix VALUES (4698,1445,'21222'); -INSERT INTO llx_telephonie_prefix VALUES (4699,1446,'2126'); -INSERT INTO llx_telephonie_prefix VALUES (4700,1446,'2121'); -INSERT INTO llx_telephonie_prefix VALUES (4701,1447,'692'); -INSERT INTO llx_telephonie_prefix VALUES (4702,1448,'596'); -INSERT INTO llx_telephonie_prefix VALUES (4703,1448,'596596'); -INSERT INTO llx_telephonie_prefix VALUES (4704,1449,'5962'); -INSERT INTO llx_telephonie_prefix VALUES (4705,1449,'5963'); -INSERT INTO llx_telephonie_prefix VALUES (4706,1449,'5964'); -INSERT INTO llx_telephonie_prefix VALUES (4707,1449,'596696'); -INSERT INTO llx_telephonie_prefix VALUES (4708,1449,'696'); -INSERT INTO llx_telephonie_prefix VALUES (4709,1450,'230'); -INSERT INTO llx_telephonie_prefix VALUES (4710,1451,'222'); -INSERT INTO llx_telephonie_prefix VALUES (4711,1452,'2696'); -INSERT INTO llx_telephonie_prefix VALUES (4712,1453,'52'); -INSERT INTO llx_telephonie_prefix VALUES (4713,1454,'523'); -INSERT INTO llx_telephonie_prefix VALUES (4714,1455,'525'); -INSERT INTO llx_telephonie_prefix VALUES (4715,1456,'5291'); -INSERT INTO llx_telephonie_prefix VALUES (4716,1456,'5292'); -INSERT INTO llx_telephonie_prefix VALUES (4717,1456,'5294'); -INSERT INTO llx_telephonie_prefix VALUES (4718,1456,'5295'); -INSERT INTO llx_telephonie_prefix VALUES (4719,1456,'5296'); -INSERT INTO llx_telephonie_prefix VALUES (4720,1456,'522'); -INSERT INTO llx_telephonie_prefix VALUES (4721,1456,'5252'); -INSERT INTO llx_telephonie_prefix VALUES (4722,1456,'529'); -INSERT INTO llx_telephonie_prefix VALUES (4723,1456,'5290'); -INSERT INTO llx_telephonie_prefix VALUES (4724,1457,'528'); -INSERT INTO llx_telephonie_prefix VALUES (4725,1458,'691'); -INSERT INTO llx_telephonie_prefix VALUES (4726,1459,'373'); -INSERT INTO llx_telephonie_prefix VALUES (4727,1460,'3732'); -INSERT INTO llx_telephonie_prefix VALUES (4728,1460,'3739'); -INSERT INTO llx_telephonie_prefix VALUES (4729,1460,'37391'); -INSERT INTO llx_telephonie_prefix VALUES (4730,1460,'37392'); -INSERT INTO llx_telephonie_prefix VALUES (4731,1460,'37394'); -INSERT INTO llx_telephonie_prefix VALUES (4732,1460,'37395'); -INSERT INTO llx_telephonie_prefix VALUES (4733,1461,'377'); -INSERT INTO llx_telephonie_prefix VALUES (4734,1462,'3774'); -INSERT INTO llx_telephonie_prefix VALUES (4735,1462,'3776'); -INSERT INTO llx_telephonie_prefix VALUES (4736,1463,'976'); -INSERT INTO llx_telephonie_prefix VALUES (4737,1464,'1664'); -INSERT INTO llx_telephonie_prefix VALUES (4738,1464,'1809491'); -INSERT INTO llx_telephonie_prefix VALUES (4739,1465,'1664492'); -INSERT INTO llx_telephonie_prefix VALUES (4740,1466,'258'); -INSERT INTO llx_telephonie_prefix VALUES (4741,1467,'25882'); -INSERT INTO llx_telephonie_prefix VALUES (4742,1468,'95'); -INSERT INTO llx_telephonie_prefix VALUES (4743,1469,'264'); -INSERT INTO llx_telephonie_prefix VALUES (4744,1470,'2648'); -INSERT INTO llx_telephonie_prefix VALUES (4745,1471,'674'); -INSERT INTO llx_telephonie_prefix VALUES (4746,1472,'674888'); -INSERT INTO llx_telephonie_prefix VALUES (4747,1473,'977'); -INSERT INTO llx_telephonie_prefix VALUES (4748,1474,'9779'); -INSERT INTO llx_telephonie_prefix VALUES (4749,1475,'505'); -INSERT INTO llx_telephonie_prefix VALUES (4750,1476,'505776'); -INSERT INTO llx_telephonie_prefix VALUES (4751,1476,'505777'); -INSERT INTO llx_telephonie_prefix VALUES (4752,1476,'505778'); -INSERT INTO llx_telephonie_prefix VALUES (4753,1476,'505779'); -INSERT INTO llx_telephonie_prefix VALUES (4754,1476,'505870'); -INSERT INTO llx_telephonie_prefix VALUES (4755,1476,'505880'); -INSERT INTO llx_telephonie_prefix VALUES (4756,1476,'505881'); -INSERT INTO llx_telephonie_prefix VALUES (4757,1476,'505882'); -INSERT INTO llx_telephonie_prefix VALUES (4758,1476,'505883'); -INSERT INTO llx_telephonie_prefix VALUES (4759,1476,'505884'); -INSERT INTO llx_telephonie_prefix VALUES (4760,1476,'505885'); -INSERT INTO llx_telephonie_prefix VALUES (4761,1476,'505886'); -INSERT INTO llx_telephonie_prefix VALUES (4762,1476,'505887'); -INSERT INTO llx_telephonie_prefix VALUES (4763,1476,'505890'); -INSERT INTO llx_telephonie_prefix VALUES (4764,1476,'505891'); -INSERT INTO llx_telephonie_prefix VALUES (4765,1476,'505892'); -INSERT INTO llx_telephonie_prefix VALUES (4766,1476,'505077'); -INSERT INTO llx_telephonie_prefix VALUES (4767,1476,'505800'); -INSERT INTO llx_telephonie_prefix VALUES (4768,1476,'50583'); -INSERT INTO llx_telephonie_prefix VALUES (4769,1476,'50588'); -INSERT INTO llx_telephonie_prefix VALUES (4770,1476,'5059'); -INSERT INTO llx_telephonie_prefix VALUES (4771,1477,'227'); -INSERT INTO llx_telephonie_prefix VALUES (4772,1478,'2279'); -INSERT INTO llx_telephonie_prefix VALUES (4773,1479,'234'); -INSERT INTO llx_telephonie_prefix VALUES (4774,1480,'2341'); -INSERT INTO llx_telephonie_prefix VALUES (4775,1481,'2341320'); -INSERT INTO llx_telephonie_prefix VALUES (4776,1481,'23480'); -INSERT INTO llx_telephonie_prefix VALUES (4777,1481,'23490'); -INSERT INTO llx_telephonie_prefix VALUES (4778,1482,'683'); -INSERT INTO llx_telephonie_prefix VALUES (4779,1483,'6832'); -INSERT INTO llx_telephonie_prefix VALUES (4780,1483,'6835'); -INSERT INTO llx_telephonie_prefix VALUES (4781,1483,'6836'); -INSERT INTO llx_telephonie_prefix VALUES (4782,1483,'6837'); -INSERT INTO llx_telephonie_prefix VALUES (4783,1483,'6838'); -INSERT INTO llx_telephonie_prefix VALUES (4784,1483,'6839'); -INSERT INTO llx_telephonie_prefix VALUES (4785,1484,'6723'); -INSERT INTO llx_telephonie_prefix VALUES (4786,1485,'67234'); -INSERT INTO llx_telephonie_prefix VALUES (4787,1485,'67235'); -INSERT INTO llx_telephonie_prefix VALUES (4788,1485,'67236'); -INSERT INTO llx_telephonie_prefix VALUES (4789,1486,'47'); -INSERT INTO llx_telephonie_prefix VALUES (4790,1487,'474'); -INSERT INTO llx_telephonie_prefix VALUES (4791,1487,'479'); -INSERT INTO llx_telephonie_prefix VALUES (4792,1488,'4722'); -INSERT INTO llx_telephonie_prefix VALUES (4793,1489,'687'); -INSERT INTO llx_telephonie_prefix VALUES (4794,1490,'6877'); -INSERT INTO llx_telephonie_prefix VALUES (4795,1490,'6878'); -INSERT INTO llx_telephonie_prefix VALUES (4796,1491,'64'); -INSERT INTO llx_telephonie_prefix VALUES (4797,1492,'649'); -INSERT INTO llx_telephonie_prefix VALUES (4798,1493,'64800'); -INSERT INTO llx_telephonie_prefix VALUES (4799,1493,'64900'); -INSERT INTO llx_telephonie_prefix VALUES (4800,1493,'6421'); -INSERT INTO llx_telephonie_prefix VALUES (4801,1493,'6425'); -INSERT INTO llx_telephonie_prefix VALUES (4802,1493,'6427'); -INSERT INTO llx_telephonie_prefix VALUES (4803,1493,'6429'); -INSERT INTO llx_telephonie_prefix VALUES (4804,1493,'64021'); -INSERT INTO llx_telephonie_prefix VALUES (4805,1493,'642'); -INSERT INTO llx_telephonie_prefix VALUES (4806,1493,'6422'); -INSERT INTO llx_telephonie_prefix VALUES (4807,1493,'6423'); -INSERT INTO llx_telephonie_prefix VALUES (4808,1493,'6424'); -INSERT INTO llx_telephonie_prefix VALUES (4809,1493,'6426'); -INSERT INTO llx_telephonie_prefix VALUES (4810,1493,'6428'); -INSERT INTO llx_telephonie_prefix VALUES (4811,1493,'648'); -INSERT INTO llx_telephonie_prefix VALUES (4812,1494,'968'); -INSERT INTO llx_telephonie_prefix VALUES (4813,1495,'256'); -INSERT INTO llx_telephonie_prefix VALUES (4814,1496,'998'); -INSERT INTO llx_telephonie_prefix VALUES (4815,1496,'736'); -INSERT INTO llx_telephonie_prefix VALUES (4816,1496,'736522'); -INSERT INTO llx_telephonie_prefix VALUES (4817,1496,'736622'); -INSERT INTO llx_telephonie_prefix VALUES (4818,1496,'737'); -INSERT INTO llx_telephonie_prefix VALUES (4819,1496,'73712'); -INSERT INTO llx_telephonie_prefix VALUES (4820,1496,'7430'); -INSERT INTO llx_telephonie_prefix VALUES (4821,1496,'7436'); -INSERT INTO llx_telephonie_prefix VALUES (4822,1497,'9989'); -INSERT INTO llx_telephonie_prefix VALUES (4823,1498,'92'); -INSERT INTO llx_telephonie_prefix VALUES (4824,1499,'9221'); -INSERT INTO llx_telephonie_prefix VALUES (4825,1500,'92321'); -INSERT INTO llx_telephonie_prefix VALUES (4826,1500,'92342'); -INSERT INTO llx_telephonie_prefix VALUES (4827,1500,'92343'); -INSERT INTO llx_telephonie_prefix VALUES (4828,1500,'92351'); -INSERT INTO llx_telephonie_prefix VALUES (4829,1500,'92352'); -INSERT INTO llx_telephonie_prefix VALUES (4830,1500,'92361'); -INSERT INTO llx_telephonie_prefix VALUES (4831,1500,'92381'); -INSERT INTO llx_telephonie_prefix VALUES (4832,1500,'92391'); -INSERT INTO llx_telephonie_prefix VALUES (4833,1500,'923'); -INSERT INTO llx_telephonie_prefix VALUES (4834,1500,'92341'); -INSERT INTO llx_telephonie_prefix VALUES (4835,1501,'680'); -INSERT INTO llx_telephonie_prefix VALUES (4836,1502,'970'); -INSERT INTO llx_telephonie_prefix VALUES (4837,1503,'507'); -INSERT INTO llx_telephonie_prefix VALUES (4838,1504,'50761'); -INSERT INTO llx_telephonie_prefix VALUES (4839,1504,'50762'); -INSERT INTO llx_telephonie_prefix VALUES (4840,1504,'50763'); -INSERT INTO llx_telephonie_prefix VALUES (4841,1504,'50767'); -INSERT INTO llx_telephonie_prefix VALUES (4842,1504,'50768'); -INSERT INTO llx_telephonie_prefix VALUES (4843,1504,'50769'); -INSERT INTO llx_telephonie_prefix VALUES (4844,1504,'5076'); -INSERT INTO llx_telephonie_prefix VALUES (4845,1505,'675'); -INSERT INTO llx_telephonie_prefix VALUES (4846,1506,'67520'); -INSERT INTO llx_telephonie_prefix VALUES (4847,1507,'6756'); -INSERT INTO llx_telephonie_prefix VALUES (4848,1508,'595'); -INSERT INTO llx_telephonie_prefix VALUES (4849,1509,'5959'); -INSERT INTO llx_telephonie_prefix VALUES (4850,1510,'31'); -INSERT INTO llx_telephonie_prefix VALUES (4851,1511,'3120'); -INSERT INTO llx_telephonie_prefix VALUES (4852,1512,'3161'); -INSERT INTO llx_telephonie_prefix VALUES (4853,1512,'3162'); -INSERT INTO llx_telephonie_prefix VALUES (4854,1512,'3163'); -INSERT INTO llx_telephonie_prefix VALUES (4855,1512,'3164'); -INSERT INTO llx_telephonie_prefix VALUES (4856,1512,'31641'); -INSERT INTO llx_telephonie_prefix VALUES (4857,1512,'31644'); -INSERT INTO llx_telephonie_prefix VALUES (4858,1512,'31645'); -INSERT INTO llx_telephonie_prefix VALUES (4859,1512,'31646'); -INSERT INTO llx_telephonie_prefix VALUES (4860,1512,'31647'); -INSERT INTO llx_telephonie_prefix VALUES (4861,1512,'31648'); -INSERT INTO llx_telephonie_prefix VALUES (4862,1512,'31650'); -INSERT INTO llx_telephonie_prefix VALUES (4863,1512,'31651'); -INSERT INTO llx_telephonie_prefix VALUES (4864,1512,'31652'); -INSERT INTO llx_telephonie_prefix VALUES (4865,1512,'31653'); -INSERT INTO llx_telephonie_prefix VALUES (4866,1512,'31654'); -INSERT INTO llx_telephonie_prefix VALUES (4867,1512,'31655'); -INSERT INTO llx_telephonie_prefix VALUES (4868,1512,'3165'); -INSERT INTO llx_telephonie_prefix VALUES (4869,1512,'3166'); -INSERT INTO llx_telephonie_prefix VALUES (4870,1512,'3184'); -INSERT INTO llx_telephonie_prefix VALUES (4871,1513,'319'); -INSERT INTO llx_telephonie_prefix VALUES (4872,1514,'3110'); -INSERT INTO llx_telephonie_prefix VALUES (4873,1515,'51'); -INSERT INTO llx_telephonie_prefix VALUES (4874,1516,'511'); -INSERT INTO llx_telephonie_prefix VALUES (4875,1517,'51171'); -INSERT INTO llx_telephonie_prefix VALUES (4876,1517,'51172'); -INSERT INTO llx_telephonie_prefix VALUES (4877,1517,'51173'); -INSERT INTO llx_telephonie_prefix VALUES (4878,1517,'51174'); -INSERT INTO llx_telephonie_prefix VALUES (4879,1517,'51175'); -INSERT INTO llx_telephonie_prefix VALUES (4880,1517,'51179'); -INSERT INTO llx_telephonie_prefix VALUES (4881,1517,'519426'); -INSERT INTO llx_telephonie_prefix VALUES (4882,1517,'51182'); -INSERT INTO llx_telephonie_prefix VALUES (4883,1518,'63'); -INSERT INTO llx_telephonie_prefix VALUES (4884,1519,'632'); -INSERT INTO llx_telephonie_prefix VALUES (4885,1520,'639'); -INSERT INTO llx_telephonie_prefix VALUES (4886,1520,'63242'); -INSERT INTO llx_telephonie_prefix VALUES (4887,1520,'6327'); -INSERT INTO llx_telephonie_prefix VALUES (4888,1520,'63275'); -INSERT INTO llx_telephonie_prefix VALUES (4889,1520,'63291'); -INSERT INTO llx_telephonie_prefix VALUES (4890,1520,'633'); -INSERT INTO llx_telephonie_prefix VALUES (4891,1520,'6385'); -INSERT INTO llx_telephonie_prefix VALUES (4892,1520,'63912'); -INSERT INTO llx_telephonie_prefix VALUES (4893,1520,'63915'); -INSERT INTO llx_telephonie_prefix VALUES (4894,1520,'63917'); -INSERT INTO llx_telephonie_prefix VALUES (4895,1520,'63918'); -INSERT INTO llx_telephonie_prefix VALUES (4896,1520,'63973'); -INSERT INTO llx_telephonie_prefix VALUES (4897,1521,'48'); -INSERT INTO llx_telephonie_prefix VALUES (4898,1522,'4860'); -INSERT INTO llx_telephonie_prefix VALUES (4899,1522,'4890'); -INSERT INTO llx_telephonie_prefix VALUES (4900,1522,'48501'); -INSERT INTO llx_telephonie_prefix VALUES (4901,1522,'48502'); -INSERT INTO llx_telephonie_prefix VALUES (4902,1522,'48503'); -INSERT INTO llx_telephonie_prefix VALUES (4903,1522,'48504'); -INSERT INTO llx_telephonie_prefix VALUES (4904,1522,'48505'); -INSERT INTO llx_telephonie_prefix VALUES (4905,1522,'48506'); -INSERT INTO llx_telephonie_prefix VALUES (4906,1522,'48691'); -INSERT INTO llx_telephonie_prefix VALUES (4907,1522,'4850'); -INSERT INTO llx_telephonie_prefix VALUES (4908,1523,'4822'); -INSERT INTO llx_telephonie_prefix VALUES (4909,1524,'689'); -INSERT INTO llx_telephonie_prefix VALUES (4910,1525,'351'); -INSERT INTO llx_telephonie_prefix VALUES (4911,1526,'35191'); -INSERT INTO llx_telephonie_prefix VALUES (4912,1526,'35193'); -INSERT INTO llx_telephonie_prefix VALUES (4913,1526,'35196'); -INSERT INTO llx_telephonie_prefix VALUES (4914,1526,'351676'); -INSERT INTO llx_telephonie_prefix VALUES (4915,1526,'3519'); -INSERT INTO llx_telephonie_prefix VALUES (4916,1527,'1787'); -INSERT INTO llx_telephonie_prefix VALUES (4917,1527,'1809250'); -INSERT INTO llx_telephonie_prefix VALUES (4918,1527,'1809253'); -INSERT INTO llx_telephonie_prefix VALUES (4919,1527,'1809259'); -INSERT INTO llx_telephonie_prefix VALUES (4920,1527,'1809265'); -INSERT INTO llx_telephonie_prefix VALUES (4921,1527,'1809268'); -INSERT INTO llx_telephonie_prefix VALUES (4922,1527,'1809273'); -INSERT INTO llx_telephonie_prefix VALUES (4923,1527,'1809384'); -INSERT INTO llx_telephonie_prefix VALUES (4924,1527,'1809388'); -INSERT INTO llx_telephonie_prefix VALUES (4925,1527,'1809398'); -INSERT INTO llx_telephonie_prefix VALUES (4926,1527,'180972'); -INSERT INTO llx_telephonie_prefix VALUES (4927,1527,'1809747'); -INSERT INTO llx_telephonie_prefix VALUES (4928,1527,'1809750'); -INSERT INTO llx_telephonie_prefix VALUES (4929,1527,'1809751'); -INSERT INTO llx_telephonie_prefix VALUES (4930,1527,'1809753'); -INSERT INTO llx_telephonie_prefix VALUES (4931,1527,'1809754'); -INSERT INTO llx_telephonie_prefix VALUES (4932,1527,'1809757'); -INSERT INTO llx_telephonie_prefix VALUES (4933,1527,'1809758'); -INSERT INTO llx_telephonie_prefix VALUES (4934,1527,'1809759'); -INSERT INTO llx_telephonie_prefix VALUES (4935,1527,'1809762'); -INSERT INTO llx_telephonie_prefix VALUES (4936,1527,'1809764'); -INSERT INTO llx_telephonie_prefix VALUES (4937,1527,'1809765'); -INSERT INTO llx_telephonie_prefix VALUES (4938,1527,'1809766'); -INSERT INTO llx_telephonie_prefix VALUES (4939,1527,'180978'); -INSERT INTO llx_telephonie_prefix VALUES (4940,1527,'180979'); -INSERT INTO llx_telephonie_prefix VALUES (4941,1527,'18098'); -INSERT INTO llx_telephonie_prefix VALUES (4942,1528,'974'); -INSERT INTO llx_telephonie_prefix VALUES (4943,1529,'9745'); -INSERT INTO llx_telephonie_prefix VALUES (4944,1530,'236'); -INSERT INTO llx_telephonie_prefix VALUES (4945,1531,'1809'); -INSERT INTO llx_telephonie_prefix VALUES (4946,1532,'18092'); -INSERT INTO llx_telephonie_prefix VALUES (4947,1532,'1809474'); -INSERT INTO llx_telephonie_prefix VALUES (4948,1532,'1809537'); -INSERT INTO llx_telephonie_prefix VALUES (4949,1532,'1809540'); -INSERT INTO llx_telephonie_prefix VALUES (4950,1532,'1809563'); -INSERT INTO llx_telephonie_prefix VALUES (4951,1532,'1809683'); -INSERT INTO llx_telephonie_prefix VALUES (4952,1532,'1809695'); -INSERT INTO llx_telephonie_prefix VALUES (4953,1532,'1809221'); -INSERT INTO llx_telephonie_prefix VALUES (4954,1532,'1809222'); -INSERT INTO llx_telephonie_prefix VALUES (4955,1532,'1809227'); -INSERT INTO llx_telephonie_prefix VALUES (4956,1532,'1809240'); -INSERT INTO llx_telephonie_prefix VALUES (4957,1532,'1809241'); -INSERT INTO llx_telephonie_prefix VALUES (4958,1532,'1809299'); -INSERT INTO llx_telephonie_prefix VALUES (4959,1532,'18095'); -INSERT INTO llx_telephonie_prefix VALUES (4960,1532,'1809504'); -INSERT INTO llx_telephonie_prefix VALUES (4961,1532,'1809518'); -INSERT INTO llx_telephonie_prefix VALUES (4962,1532,'1809606'); -INSERT INTO llx_telephonie_prefix VALUES (4963,1532,'180968'); -INSERT INTO llx_telephonie_prefix VALUES (4964,1532,'1809818'); -INSERT INTO llx_telephonie_prefix VALUES (4965,1533,'262'); -INSERT INTO llx_telephonie_prefix VALUES (4966,1533,'262262'); -INSERT INTO llx_telephonie_prefix VALUES (4967,1534,'262692'); -INSERT INTO llx_telephonie_prefix VALUES (4968,1535,'40'); -INSERT INTO llx_telephonie_prefix VALUES (4969,1536,'401'); -INSERT INTO llx_telephonie_prefix VALUES (4970,1537,'409'); -INSERT INTO llx_telephonie_prefix VALUES (4971,1538,'35348'); -INSERT INTO llx_telephonie_prefix VALUES (4972,1538,'44'); -INSERT INTO llx_telephonie_prefix VALUES (4973,1539,'44844'); -INSERT INTO llx_telephonie_prefix VALUES (4974,1539,'44845'); -INSERT INTO llx_telephonie_prefix VALUES (4975,1540,'4455'); -INSERT INTO llx_telephonie_prefix VALUES (4976,1540,'44870'); -INSERT INTO llx_telephonie_prefix VALUES (4977,1540,'44871'); -INSERT INTO llx_telephonie_prefix VALUES (4978,1541,'4420'); -INSERT INTO llx_telephonie_prefix VALUES (4979,1542,'447802'); -INSERT INTO llx_telephonie_prefix VALUES (4980,1542,'447803'); -INSERT INTO llx_telephonie_prefix VALUES (4981,1542,'447808'); -INSERT INTO llx_telephonie_prefix VALUES (4982,1542,'447809'); -INSERT INTO llx_telephonie_prefix VALUES (4983,1542,'447818'); -INSERT INTO llx_telephonie_prefix VALUES (4984,1542,'447831'); -INSERT INTO llx_telephonie_prefix VALUES (4985,1542,'447833'); -INSERT INTO llx_telephonie_prefix VALUES (4986,1542,'447836'); -INSERT INTO llx_telephonie_prefix VALUES (4987,1542,'447850'); -INSERT INTO llx_telephonie_prefix VALUES (4988,1542,'447860'); -INSERT INTO llx_telephonie_prefix VALUES (4989,1542,'447867'); -INSERT INTO llx_telephonie_prefix VALUES (4990,1542,'447879'); -INSERT INTO llx_telephonie_prefix VALUES (4991,1542,'447880'); -INSERT INTO llx_telephonie_prefix VALUES (4992,1542,'447881'); -INSERT INTO llx_telephonie_prefix VALUES (4993,1542,'447885'); -INSERT INTO llx_telephonie_prefix VALUES (4994,1542,'447887'); -INSERT INTO llx_telephonie_prefix VALUES (4995,1542,'447889'); -INSERT INTO llx_telephonie_prefix VALUES (4996,1542,'447899'); -INSERT INTO llx_telephonie_prefix VALUES (4997,1542,'447901'); -INSERT INTO llx_telephonie_prefix VALUES (4998,1542,'447909'); -INSERT INTO llx_telephonie_prefix VALUES (4999,1542,'447930'); -INSERT INTO llx_telephonie_prefix VALUES (5000,1542,'447931'); -INSERT INTO llx_telephonie_prefix VALUES (5001,1542,'447932'); -INSERT INTO llx_telephonie_prefix VALUES (5002,1542,'447939'); -INSERT INTO llx_telephonie_prefix VALUES (5003,1542,'447940'); -INSERT INTO llx_telephonie_prefix VALUES (5004,1542,'447941'); -INSERT INTO llx_telephonie_prefix VALUES (5005,1542,'447944'); -INSERT INTO llx_telephonie_prefix VALUES (5006,1542,'447946'); -INSERT INTO llx_telephonie_prefix VALUES (5007,1542,'447947'); -INSERT INTO llx_telephonie_prefix VALUES (5008,1542,'447953'); -INSERT INTO llx_telephonie_prefix VALUES (5009,1542,'447956'); -INSERT INTO llx_telephonie_prefix VALUES (5010,1542,'447957'); -INSERT INTO llx_telephonie_prefix VALUES (5011,1542,'447958'); -INSERT INTO llx_telephonie_prefix VALUES (5012,1542,'447961'); -INSERT INTO llx_telephonie_prefix VALUES (5013,1542,'447966'); -INSERT INTO llx_telephonie_prefix VALUES (5014,1542,'447967'); -INSERT INTO llx_telephonie_prefix VALUES (5015,1542,'447968'); -INSERT INTO llx_telephonie_prefix VALUES (5016,1542,'447970'); -INSERT INTO llx_telephonie_prefix VALUES (5017,1542,'447971'); -INSERT INTO llx_telephonie_prefix VALUES (5018,1542,'447973'); -INSERT INTO llx_telephonie_prefix VALUES (5019,1542,'447974'); -INSERT INTO llx_telephonie_prefix VALUES (5020,1542,'447976'); -INSERT INTO llx_telephonie_prefix VALUES (5021,1542,'447977'); -INSERT INTO llx_telephonie_prefix VALUES (5022,1542,'447979'); -INSERT INTO llx_telephonie_prefix VALUES (5023,1542,'447980'); -INSERT INTO llx_telephonie_prefix VALUES (5024,1542,'447989'); -INSERT INTO llx_telephonie_prefix VALUES (5025,1542,'447990'); -INSERT INTO llx_telephonie_prefix VALUES (5026,1542,'448360'); -INSERT INTO llx_telephonie_prefix VALUES (5027,1542,'448361'); -INSERT INTO llx_telephonie_prefix VALUES (5028,1542,'448362'); -INSERT INTO llx_telephonie_prefix VALUES (5029,1542,'448363'); -INSERT INTO llx_telephonie_prefix VALUES (5030,1542,'448365'); -INSERT INTO llx_telephonie_prefix VALUES (5031,1542,'448366'); -INSERT INTO llx_telephonie_prefix VALUES (5032,1542,'448367'); -INSERT INTO llx_telephonie_prefix VALUES (5033,1542,'448368'); -INSERT INTO llx_telephonie_prefix VALUES (5034,1542,'44860'); -INSERT INTO llx_telephonie_prefix VALUES (5035,1542,'449307'); -INSERT INTO llx_telephonie_prefix VALUES (5036,1542,'4494'); -INSERT INTO llx_telephonie_prefix VALUES (5037,1542,'44956'); -INSERT INTO llx_telephonie_prefix VALUES (5038,1542,'44958'); -INSERT INTO llx_telephonie_prefix VALUES (5039,1542,'44961'); -INSERT INTO llx_telephonie_prefix VALUES (5040,1542,'44966'); -INSERT INTO llx_telephonie_prefix VALUES (5041,1542,'44973'); -INSERT INTO llx_telephonie_prefix VALUES (5042,1542,'44976'); -INSERT INTO llx_telephonie_prefix VALUES (5043,1542,'44979'); -INSERT INTO llx_telephonie_prefix VALUES (5044,1542,'449797'); -INSERT INTO llx_telephonie_prefix VALUES (5045,1542,'4477'); -INSERT INTO llx_telephonie_prefix VALUES (5046,1542,'4478'); -INSERT INTO llx_telephonie_prefix VALUES (5047,1542,'4479'); -INSERT INTO llx_telephonie_prefix VALUES (5048,1542,'4498'); -INSERT INTO llx_telephonie_prefix VALUES (5049,1542,'44370'); -INSERT INTO llx_telephonie_prefix VALUES (5050,1542,'44374'); -INSERT INTO llx_telephonie_prefix VALUES (5051,1542,'44378'); -INSERT INTO llx_telephonie_prefix VALUES (5052,1542,'44385'); -INSERT INTO llx_telephonie_prefix VALUES (5053,1542,'44390'); -INSERT INTO llx_telephonie_prefix VALUES (5054,1542,'44401'); -INSERT INTO llx_telephonie_prefix VALUES (5055,1542,'44402'); -INSERT INTO llx_telephonie_prefix VALUES (5056,1542,'44403'); -INSERT INTO llx_telephonie_prefix VALUES (5057,1542,'44410'); -INSERT INTO llx_telephonie_prefix VALUES (5058,1542,'44411'); -INSERT INTO llx_telephonie_prefix VALUES (5059,1542,'44421'); -INSERT INTO llx_telephonie_prefix VALUES (5060,1542,'44441'); -INSERT INTO llx_telephonie_prefix VALUES (5061,1542,'44467'); -INSERT INTO llx_telephonie_prefix VALUES (5062,1542,'44468'); -INSERT INTO llx_telephonie_prefix VALUES (5063,1542,'44585'); -INSERT INTO llx_telephonie_prefix VALUES (5064,1542,'44589'); -INSERT INTO llx_telephonie_prefix VALUES (5065,1542,'44802'); -INSERT INTO llx_telephonie_prefix VALUES (5066,1542,'44831'); -INSERT INTO llx_telephonie_prefix VALUES (5067,1542,'44836'); -INSERT INTO llx_telephonie_prefix VALUES (5068,1542,'44850'); -INSERT INTO llx_telephonie_prefix VALUES (5069,1542,'444481'); -INSERT INTO llx_telephonie_prefix VALUES (5070,1542,'441399'); -INSERT INTO llx_telephonie_prefix VALUES (5071,1542,'441426'); -INSERT INTO llx_telephonie_prefix VALUES (5072,1542,'441459'); -INSERT INTO llx_telephonie_prefix VALUES (5073,1542,'441523'); -INSERT INTO llx_telephonie_prefix VALUES (5074,1542,'441893'); -INSERT INTO llx_telephonie_prefix VALUES (5075,1542,'4433'); -INSERT INTO llx_telephonie_prefix VALUES (5076,1542,'4439'); -INSERT INTO llx_telephonie_prefix VALUES (5077,1542,'444'); -INSERT INTO llx_telephonie_prefix VALUES (5078,1542,'447'); -INSERT INTO llx_telephonie_prefix VALUES (5079,1542,'4477007'); -INSERT INTO llx_telephonie_prefix VALUES (5080,1542,'447701'); -INSERT INTO llx_telephonie_prefix VALUES (5081,1542,'447702'); -INSERT INTO llx_telephonie_prefix VALUES (5082,1542,'447703'); -INSERT INTO llx_telephonie_prefix VALUES (5083,1542,'4477050'); -INSERT INTO llx_telephonie_prefix VALUES (5084,1542,'4477090'); -INSERT INTO llx_telephonie_prefix VALUES (5085,1542,'447710'); -INSERT INTO llx_telephonie_prefix VALUES (5086,1542,'447711'); -INSERT INTO llx_telephonie_prefix VALUES (5087,1542,'447712'); -INSERT INTO llx_telephonie_prefix VALUES (5088,1542,'447713'); -INSERT INTO llx_telephonie_prefix VALUES (5089,1542,'447714'); -INSERT INTO llx_telephonie_prefix VALUES (5090,1542,'447715'); -INSERT INTO llx_telephonie_prefix VALUES (5091,1542,'4477177'); -INSERT INTO llx_telephonie_prefix VALUES (5092,1542,'447718'); -INSERT INTO llx_telephonie_prefix VALUES (5093,1542,'447719'); -INSERT INTO llx_telephonie_prefix VALUES (5094,1542,'447720'); -INSERT INTO llx_telephonie_prefix VALUES (5095,1542,'447721'); -INSERT INTO llx_telephonie_prefix VALUES (5096,1542,'447730'); -INSERT INTO llx_telephonie_prefix VALUES (5097,1542,'4477332'); -INSERT INTO llx_telephonie_prefix VALUES (5098,1542,'4477342'); -INSERT INTO llx_telephonie_prefix VALUES (5099,1542,'4477356'); -INSERT INTO llx_telephonie_prefix VALUES (5100,1542,'447740'); -INSERT INTO llx_telephonie_prefix VALUES (5101,1542,'447741'); -INSERT INTO llx_telephonie_prefix VALUES (5102,1542,'4477442'); -INSERT INTO llx_telephonie_prefix VALUES (5103,1542,'4477443'); -INSERT INTO llx_telephonie_prefix VALUES (5104,1542,'4477444'); -INSERT INTO llx_telephonie_prefix VALUES (5105,1542,'4477445'); -INSERT INTO llx_telephonie_prefix VALUES (5106,1542,'447747'); -INSERT INTO llx_telephonie_prefix VALUES (5107,1542,'447750'); -INSERT INTO llx_telephonie_prefix VALUES (5108,1542,'4477552'); -INSERT INTO llx_telephonie_prefix VALUES (5109,1542,'4477553'); -INSERT INTO llx_telephonie_prefix VALUES (5110,1542,'4477554'); -INSERT INTO llx_telephonie_prefix VALUES (5111,1542,'4477555'); -INSERT INTO llx_telephonie_prefix VALUES (5112,1542,'447760'); -INSERT INTO llx_telephonie_prefix VALUES (5113,1542,'4477660'); -INSERT INTO llx_telephonie_prefix VALUES (5114,1542,'447767'); -INSERT INTO llx_telephonie_prefix VALUES (5115,1542,'447768'); -INSERT INTO llx_telephonie_prefix VALUES (5116,1542,'447770'); -INSERT INTO llx_telephonie_prefix VALUES (5117,1542,'447771'); -INSERT INTO llx_telephonie_prefix VALUES (5118,1542,'447773'); -INSERT INTO llx_telephonie_prefix VALUES (5119,1542,'447774'); -INSERT INTO llx_telephonie_prefix VALUES (5120,1542,'447775'); -INSERT INTO llx_telephonie_prefix VALUES (5121,1542,'447778'); -INSERT INTO llx_telephonie_prefix VALUES (5122,1542,'447779'); -INSERT INTO llx_telephonie_prefix VALUES (5123,1542,'447780'); -INSERT INTO llx_telephonie_prefix VALUES (5124,1542,'447781'); -INSERT INTO llx_telephonie_prefix VALUES (5125,1542,'447785'); -INSERT INTO llx_telephonie_prefix VALUES (5126,1542,'447787'); -INSERT INTO llx_telephonie_prefix VALUES (5127,1542,'447788'); -INSERT INTO llx_telephonie_prefix VALUES (5128,1542,'447790'); -INSERT INTO llx_telephonie_prefix VALUES (5129,1542,'4477977'); -INSERT INTO llx_telephonie_prefix VALUES (5130,1542,'447798'); -INSERT INTO llx_telephonie_prefix VALUES (5131,1542,'447800'); -INSERT INTO llx_telephonie_prefix VALUES (5132,1542,'447801'); -INSERT INTO llx_telephonie_prefix VALUES (5133,1543,'4470'); -INSERT INTO llx_telephonie_prefix VALUES (5134,1544,'7'); -INSERT INTO llx_telephonie_prefix VALUES (5135,1544,'707'); -INSERT INTO llx_telephonie_prefix VALUES (5136,1544,'708'); -INSERT INTO llx_telephonie_prefix VALUES (5137,1544,'709'); -INSERT INTO llx_telephonie_prefix VALUES (5138,1544,'734'); -INSERT INTO llx_telephonie_prefix VALUES (5139,1544,'735'); -INSERT INTO llx_telephonie_prefix VALUES (5140,1544,'738'); -INSERT INTO llx_telephonie_prefix VALUES (5141,1544,'739'); -INSERT INTO llx_telephonie_prefix VALUES (5142,1544,'741'); -INSERT INTO llx_telephonie_prefix VALUES (5143,1544,'742'); -INSERT INTO llx_telephonie_prefix VALUES (5144,1544,'746'); -INSERT INTO llx_telephonie_prefix VALUES (5145,1544,'782'); -INSERT INTO llx_telephonie_prefix VALUES (5146,1544,'783'); -INSERT INTO llx_telephonie_prefix VALUES (5147,1544,'784'); -INSERT INTO llx_telephonie_prefix VALUES (5148,1544,'785'); -INSERT INTO llx_telephonie_prefix VALUES (5149,1544,'786'); -INSERT INTO llx_telephonie_prefix VALUES (5150,1544,'787'); -INSERT INTO llx_telephonie_prefix VALUES (5151,1544,'7011'); -INSERT INTO llx_telephonie_prefix VALUES (5152,1544,'7301'); -INSERT INTO llx_telephonie_prefix VALUES (5153,1544,'7302'); -INSERT INTO llx_telephonie_prefix VALUES (5154,1544,'7303'); -INSERT INTO llx_telephonie_prefix VALUES (5155,1544,'7304'); -INSERT INTO llx_telephonie_prefix VALUES (5156,1544,'7305'); -INSERT INTO llx_telephonie_prefix VALUES (5157,1544,'7306'); -INSERT INTO llx_telephonie_prefix VALUES (5158,1544,'7307'); -INSERT INTO llx_telephonie_prefix VALUES (5159,1544,'7308'); -INSERT INTO llx_telephonie_prefix VALUES (5160,1544,'7309'); -INSERT INTO llx_telephonie_prefix VALUES (5161,1544,'7811'); -INSERT INTO llx_telephonie_prefix VALUES (5162,1544,'7814'); -INSERT INTO llx_telephonie_prefix VALUES (5163,1544,'7815'); -INSERT INTO llx_telephonie_prefix VALUES (5164,1544,'7816'); -INSERT INTO llx_telephonie_prefix VALUES (5165,1544,'7817'); -INSERT INTO llx_telephonie_prefix VALUES (5166,1544,'7818'); -INSERT INTO llx_telephonie_prefix VALUES (5167,1545,'7012'); -INSERT INTO llx_telephonie_prefix VALUES (5168,1545,'7901'); -INSERT INTO llx_telephonie_prefix VALUES (5169,1545,'7902'); -INSERT INTO llx_telephonie_prefix VALUES (5170,1545,'7903'); -INSERT INTO llx_telephonie_prefix VALUES (5171,1545,'7013'); -INSERT INTO llx_telephonie_prefix VALUES (5172,1545,'7014'); -INSERT INTO llx_telephonie_prefix VALUES (5173,1545,'7015'); -INSERT INTO llx_telephonie_prefix VALUES (5174,1545,'7016'); -INSERT INTO llx_telephonie_prefix VALUES (5175,1545,'7017'); -INSERT INTO llx_telephonie_prefix VALUES (5176,1545,'7018'); -INSERT INTO llx_telephonie_prefix VALUES (5177,1545,'751121'); -INSERT INTO llx_telephonie_prefix VALUES (5178,1545,'7916'); -INSERT INTO llx_telephonie_prefix VALUES (5179,1545,'7910'); -INSERT INTO llx_telephonie_prefix VALUES (5180,1546,'7096'); -INSERT INTO llx_telephonie_prefix VALUES (5181,1546,'7095'); -INSERT INTO llx_telephonie_prefix VALUES (5182,1547,'7504'); -INSERT INTO llx_telephonie_prefix VALUES (5183,1547,'7511'); -INSERT INTO llx_telephonie_prefix VALUES (5184,1547,'7512'); -INSERT INTO llx_telephonie_prefix VALUES (5185,1548,'7812'); -INSERT INTO llx_telephonie_prefix VALUES (5186,1549,'250'); -INSERT INTO llx_telephonie_prefix VALUES (5187,1550,'250081'); -INSERT INTO llx_telephonie_prefix VALUES (5188,1550,'250082'); -INSERT INTO llx_telephonie_prefix VALUES (5189,1550,'250083'); -INSERT INTO llx_telephonie_prefix VALUES (5190,1550,'250084'); -INSERT INTO llx_telephonie_prefix VALUES (5191,1550,'250085'); -INSERT INTO llx_telephonie_prefix VALUES (5192,1550,'2505'); -INSERT INTO llx_telephonie_prefix VALUES (5193,1550,'25062'); -INSERT INTO llx_telephonie_prefix VALUES (5194,1550,'25064'); -INSERT INTO llx_telephonie_prefix VALUES (5195,1550,'25068'); -INSERT INTO llx_telephonie_prefix VALUES (5196,1550,'25070'); -INSERT INTO llx_telephonie_prefix VALUES (5197,1550,'25089'); -INSERT INTO llx_telephonie_prefix VALUES (5198,1551,'1869'); -INSERT INTO llx_telephonie_prefix VALUES (5199,1551,'1809460'); -INSERT INTO llx_telephonie_prefix VALUES (5200,1551,'1809465'); -INSERT INTO llx_telephonie_prefix VALUES (5201,1551,'1809467'); -INSERT INTO llx_telephonie_prefix VALUES (5202,1552,'378'); -INSERT INTO llx_telephonie_prefix VALUES (5203,1552,'390549'); -INSERT INTO llx_telephonie_prefix VALUES (5204,1553,'508'); -INSERT INTO llx_telephonie_prefix VALUES (5205,1554,'1784'); -INSERT INTO llx_telephonie_prefix VALUES (5206,1554,'1809456'); -INSERT INTO llx_telephonie_prefix VALUES (5207,1554,'1809457'); -INSERT INTO llx_telephonie_prefix VALUES (5208,1554,'1809458'); -INSERT INTO llx_telephonie_prefix VALUES (5209,1554,'1809493'); -INSERT INTO llx_telephonie_prefix VALUES (5210,1555,'1784493'); -INSERT INTO llx_telephonie_prefix VALUES (5211,1555,'1784593'); -INSERT INTO llx_telephonie_prefix VALUES (5212,1556,'290'); -INSERT INTO llx_telephonie_prefix VALUES (5213,1557,'1758'); -INSERT INTO llx_telephonie_prefix VALUES (5214,1557,'1809451'); -INSERT INTO llx_telephonie_prefix VALUES (5215,1557,'1809452'); -INSERT INTO llx_telephonie_prefix VALUES (5216,1557,'1809453'); -INSERT INTO llx_telephonie_prefix VALUES (5217,1557,'1809454'); -INSERT INTO llx_telephonie_prefix VALUES (5218,1557,'1809455'); -INSERT INTO llx_telephonie_prefix VALUES (5219,1557,'1809459'); -INSERT INTO llx_telephonie_prefix VALUES (5220,1557,'1809484'); -INSERT INTO llx_telephonie_prefix VALUES (5221,1558,'1758485'); -INSERT INTO llx_telephonie_prefix VALUES (5222,1558,'1758584'); -INSERT INTO llx_telephonie_prefix VALUES (5223,1559,'677'); -INSERT INTO llx_telephonie_prefix VALUES (5224,1560,'6771'); -INSERT INTO llx_telephonie_prefix VALUES (5225,1560,'6778'); -INSERT INTO llx_telephonie_prefix VALUES (5226,1560,'6779'); -INSERT INTO llx_telephonie_prefix VALUES (5227,1561,'684'); -INSERT INTO llx_telephonie_prefix VALUES (5228,1562,'685'); -INSERT INTO llx_telephonie_prefix VALUES (5229,1563,'239'); -INSERT INTO llx_telephonie_prefix VALUES (5230,1564,'221'); -INSERT INTO llx_telephonie_prefix VALUES (5231,1565,'2216'); -INSERT INTO llx_telephonie_prefix VALUES (5232,1565,'22160'); -INSERT INTO llx_telephonie_prefix VALUES (5233,1565,'22163'); -INSERT INTO llx_telephonie_prefix VALUES (5234,1565,'22164'); -INSERT INTO llx_telephonie_prefix VALUES (5235,1565,'22166'); -INSERT INTO llx_telephonie_prefix VALUES (5236,1565,'22167'); -INSERT INTO llx_telephonie_prefix VALUES (5237,1565,'22168'); -INSERT INTO llx_telephonie_prefix VALUES (5238,1565,'2218'); -INSERT INTO llx_telephonie_prefix VALUES (5239,1566,'248'); -INSERT INTO llx_telephonie_prefix VALUES (5240,1567,'2485'); -INSERT INTO llx_telephonie_prefix VALUES (5241,1567,'2487'); -INSERT INTO llx_telephonie_prefix VALUES (5242,1568,'232'); -INSERT INTO llx_telephonie_prefix VALUES (5243,1569,'2325'); -INSERT INTO llx_telephonie_prefix VALUES (5244,1570,'65'); -INSERT INTO llx_telephonie_prefix VALUES (5245,1571,'659'); -INSERT INTO llx_telephonie_prefix VALUES (5246,1572,'421'); -INSERT INTO llx_telephonie_prefix VALUES (5247,1573,'42190'); -INSERT INTO llx_telephonie_prefix VALUES (5248,1574,'386'); -INSERT INTO llx_telephonie_prefix VALUES (5249,1575,'38631'); -INSERT INTO llx_telephonie_prefix VALUES (5250,1575,'38640'); -INSERT INTO llx_telephonie_prefix VALUES (5251,1575,'38641'); -INSERT INTO llx_telephonie_prefix VALUES (5252,1575,'38650'); -INSERT INTO llx_telephonie_prefix VALUES (5253,1575,'386609'); -INSERT INTO llx_telephonie_prefix VALUES (5254,1576,'252'); -INSERT INTO llx_telephonie_prefix VALUES (5255,1577,'249'); -INSERT INTO llx_telephonie_prefix VALUES (5256,1578,'7501'); -INSERT INTO llx_telephonie_prefix VALUES (5257,1579,'94'); -INSERT INTO llx_telephonie_prefix VALUES (5258,1580,'9470'); -INSERT INTO llx_telephonie_prefix VALUES (5259,1580,'9471'); -INSERT INTO llx_telephonie_prefix VALUES (5260,1580,'9472'); -INSERT INTO llx_telephonie_prefix VALUES (5261,1580,'9474'); -INSERT INTO llx_telephonie_prefix VALUES (5262,1580,'9475'); -INSERT INTO llx_telephonie_prefix VALUES (5263,1580,'9477'); -INSERT INTO llx_telephonie_prefix VALUES (5264,1580,'9478'); -INSERT INTO llx_telephonie_prefix VALUES (5265,1580,'947'); -INSERT INTO llx_telephonie_prefix VALUES (5266,1581,'46'); -INSERT INTO llx_telephonie_prefix VALUES (5267,1582,'4610'); -INSERT INTO llx_telephonie_prefix VALUES (5268,1582,'4670'); -INSERT INTO llx_telephonie_prefix VALUES (5269,1582,'4673'); -INSERT INTO llx_telephonie_prefix VALUES (5270,1582,'4674'); -INSERT INTO llx_telephonie_prefix VALUES (5271,1583,'468'); -INSERT INTO llx_telephonie_prefix VALUES (5272,1584,'41'); -INSERT INTO llx_telephonie_prefix VALUES (5273,1585,'4122'); -INSERT INTO llx_telephonie_prefix VALUES (5274,1586,'4121'); -INSERT INTO llx_telephonie_prefix VALUES (5275,1587,'4176'); -INSERT INTO llx_telephonie_prefix VALUES (5276,1587,'4177'); -INSERT INTO llx_telephonie_prefix VALUES (5277,1587,'4178'); -INSERT INTO llx_telephonie_prefix VALUES (5278,1587,'4179'); -INSERT INTO llx_telephonie_prefix VALUES (5279,1587,'4174'); -INSERT INTO llx_telephonie_prefix VALUES (5280,1587,'41748'); -INSERT INTO llx_telephonie_prefix VALUES (5281,1587,'41763'); -INSERT INTO llx_telephonie_prefix VALUES (5282,1587,'41764'); -INSERT INTO llx_telephonie_prefix VALUES (5283,1587,'41765'); -INSERT INTO llx_telephonie_prefix VALUES (5284,1587,'41786'); -INSERT INTO llx_telephonie_prefix VALUES (5285,1587,'41787'); -INSERT INTO llx_telephonie_prefix VALUES (5286,1587,'41788'); -INSERT INTO llx_telephonie_prefix VALUES (5287,1587,'41789'); -INSERT INTO llx_telephonie_prefix VALUES (5288,1587,'41792'); -INSERT INTO llx_telephonie_prefix VALUES (5289,1587,'41793'); -INSERT INTO llx_telephonie_prefix VALUES (5290,1587,'41794'); -INSERT INTO llx_telephonie_prefix VALUES (5291,1587,'41795'); -INSERT INTO llx_telephonie_prefix VALUES (5292,1587,'41796'); -INSERT INTO llx_telephonie_prefix VALUES (5293,1587,'417971'); -INSERT INTO llx_telephonie_prefix VALUES (5294,1587,'417972'); -INSERT INTO llx_telephonie_prefix VALUES (5295,1587,'417973'); -INSERT INTO llx_telephonie_prefix VALUES (5296,1587,'417974'); -INSERT INTO llx_telephonie_prefix VALUES (5297,1587,'417975'); -INSERT INTO llx_telephonie_prefix VALUES (5298,1587,'417999'); -INSERT INTO llx_telephonie_prefix VALUES (5299,1587,'41860'); -INSERT INTO llx_telephonie_prefix VALUES (5300,1588,'41221'); -INSERT INTO llx_telephonie_prefix VALUES (5301,1588,'41225'); -INSERT INTO llx_telephonie_prefix VALUES (5302,1589,'4190'); -INSERT INTO llx_telephonie_prefix VALUES (5303,1590,'411'); -INSERT INTO llx_telephonie_prefix VALUES (5304,1590,'4144'); -INSERT INTO llx_telephonie_prefix VALUES (5305,1590,'4143'); -INSERT INTO llx_telephonie_prefix VALUES (5306,1591,'597'); -INSERT INTO llx_telephonie_prefix VALUES (5307,1592,'5978'); -INSERT INTO llx_telephonie_prefix VALUES (5308,1593,'268'); -INSERT INTO llx_telephonie_prefix VALUES (5309,1594,'2686'); -INSERT INTO llx_telephonie_prefix VALUES (5310,1595,'963'); -INSERT INTO llx_telephonie_prefix VALUES (5311,1596,'9639'); -INSERT INTO llx_telephonie_prefix VALUES (5312,1597,'992'); -INSERT INTO llx_telephonie_prefix VALUES (5313,1597,'73772'); -INSERT INTO llx_telephonie_prefix VALUES (5314,1598,'9929'); -INSERT INTO llx_telephonie_prefix VALUES (5315,1599,'886'); -INSERT INTO llx_telephonie_prefix VALUES (5316,1600,'88696'); -INSERT INTO llx_telephonie_prefix VALUES (5317,1600,'88699'); -INSERT INTO llx_telephonie_prefix VALUES (5318,1600,'88670'); -INSERT INTO llx_telephonie_prefix VALUES (5319,1600,'88660'); -INSERT INTO llx_telephonie_prefix VALUES (5320,1600,'88690'); -INSERT INTO llx_telephonie_prefix VALUES (5321,1600,'88691'); -INSERT INTO llx_telephonie_prefix VALUES (5322,1600,'88692'); -INSERT INTO llx_telephonie_prefix VALUES (5323,1600,'88693'); -INSERT INTO llx_telephonie_prefix VALUES (5324,1600,'88695'); -INSERT INTO llx_telephonie_prefix VALUES (5325,1601,'8862'); -INSERT INTO llx_telephonie_prefix VALUES (5326,1602,'255'); -INSERT INTO llx_telephonie_prefix VALUES (5327,1603,'2557'); -INSERT INTO llx_telephonie_prefix VALUES (5328,1604,'7513'); -INSERT INTO llx_telephonie_prefix VALUES (5329,1605,'235'); -INSERT INTO llx_telephonie_prefix VALUES (5330,1606,'420'); -INSERT INTO llx_telephonie_prefix VALUES (5331,1607,'42072'); -INSERT INTO llx_telephonie_prefix VALUES (5332,1607,'42073'); -INSERT INTO llx_telephonie_prefix VALUES (5333,1607,'42077'); -INSERT INTO llx_telephonie_prefix VALUES (5334,1607,'42093'); -INSERT INTO llx_telephonie_prefix VALUES (5335,1607,'420601'); -INSERT INTO llx_telephonie_prefix VALUES (5336,1607,'420602'); -INSERT INTO llx_telephonie_prefix VALUES (5337,1607,'420603'); -INSERT INTO llx_telephonie_prefix VALUES (5338,1607,'420604'); -INSERT INTO llx_telephonie_prefix VALUES (5339,1607,'420605'); -INSERT INTO llx_telephonie_prefix VALUES (5340,1607,'420606'); -INSERT INTO llx_telephonie_prefix VALUES (5341,1607,'420607'); -INSERT INTO llx_telephonie_prefix VALUES (5342,1607,'420608'); -INSERT INTO llx_telephonie_prefix VALUES (5343,1607,'420961'); -INSERT INTO llx_telephonie_prefix VALUES (5344,1607,'420962'); -INSERT INTO llx_telephonie_prefix VALUES (5345,1607,'420963'); -INSERT INTO llx_telephonie_prefix VALUES (5346,1607,'420964'); -INSERT INTO llx_telephonie_prefix VALUES (5347,1607,'420965'); -INSERT INTO llx_telephonie_prefix VALUES (5348,1607,'420966'); -INSERT INTO llx_telephonie_prefix VALUES (5349,1608,'66'); -INSERT INTO llx_telephonie_prefix VALUES (5350,1609,'662'); -INSERT INTO llx_telephonie_prefix VALUES (5351,1610,'661'); -INSERT INTO llx_telephonie_prefix VALUES (5352,1610,'669'); -INSERT INTO llx_telephonie_prefix VALUES (5353,1611,'228'); -INSERT INTO llx_telephonie_prefix VALUES (5354,1612,'2289'); -INSERT INTO llx_telephonie_prefix VALUES (5355,1613,'690'); -INSERT INTO llx_telephonie_prefix VALUES (5356,1614,'676'); -INSERT INTO llx_telephonie_prefix VALUES (5357,1615,'67656'); -INSERT INTO llx_telephonie_prefix VALUES (5358,1616,'1868620'); -INSERT INTO llx_telephonie_prefix VALUES (5359,1616,'1868675'); -INSERT INTO llx_telephonie_prefix VALUES (5360,1616,'1868678'); -INSERT INTO llx_telephonie_prefix VALUES (5361,1616,'1868680'); -INSERT INTO llx_telephonie_prefix VALUES (5362,1616,'1868681'); -INSERT INTO llx_telephonie_prefix VALUES (5363,1616,'1868682'); -INSERT INTO llx_telephonie_prefix VALUES (5364,1616,'1868683'); -INSERT INTO llx_telephonie_prefix VALUES (5365,1616,'1868684'); -INSERT INTO llx_telephonie_prefix VALUES (5366,1617,'1868'); -INSERT INTO llx_telephonie_prefix VALUES (5367,1617,'180962'); -INSERT INTO llx_telephonie_prefix VALUES (5368,1617,'180963'); -INSERT INTO llx_telephonie_prefix VALUES (5369,1617,'180964'); -INSERT INTO llx_telephonie_prefix VALUES (5370,1617,'180965'); -INSERT INTO llx_telephonie_prefix VALUES (5371,1617,'180966'); -INSERT INTO llx_telephonie_prefix VALUES (5372,1617,'180967'); -INSERT INTO llx_telephonie_prefix VALUES (5373,1618,'216'); -INSERT INTO llx_telephonie_prefix VALUES (5374,1619,'2169'); -INSERT INTO llx_telephonie_prefix VALUES (5375,1620,'993'); -INSERT INTO llx_telephonie_prefix VALUES (5376,1620,'73632'); -INSERT INTO llx_telephonie_prefix VALUES (5377,1621,'9931'); -INSERT INTO llx_telephonie_prefix VALUES (5378,1621,'9933'); -INSERT INTO llx_telephonie_prefix VALUES (5379,1621,'9934'); -INSERT INTO llx_telephonie_prefix VALUES (5380,1621,'9935'); -INSERT INTO llx_telephonie_prefix VALUES (5381,1621,'9936'); -INSERT INTO llx_telephonie_prefix VALUES (5382,1622,'1649'); -INSERT INTO llx_telephonie_prefix VALUES (5383,1623,'90'); -INSERT INTO llx_telephonie_prefix VALUES (5384,1624,'90312'); -INSERT INTO llx_telephonie_prefix VALUES (5385,1625,'90212'); -INSERT INTO llx_telephonie_prefix VALUES (5386,1625,'90216'); -INSERT INTO llx_telephonie_prefix VALUES (5387,1626,'90522'); -INSERT INTO llx_telephonie_prefix VALUES (5388,1626,'90532'); -INSERT INTO llx_telephonie_prefix VALUES (5389,1626,'90533'); -INSERT INTO llx_telephonie_prefix VALUES (5390,1626,'90534'); -INSERT INTO llx_telephonie_prefix VALUES (5391,1626,'90535'); -INSERT INTO llx_telephonie_prefix VALUES (5392,1626,'90542'); -INSERT INTO llx_telephonie_prefix VALUES (5393,1626,'90543'); -INSERT INTO llx_telephonie_prefix VALUES (5394,1626,'90544'); -INSERT INTO llx_telephonie_prefix VALUES (5395,1626,'90545'); -INSERT INTO llx_telephonie_prefix VALUES (5396,1626,'90546'); -INSERT INTO llx_telephonie_prefix VALUES (5397,1626,'90592'); -INSERT INTO llx_telephonie_prefix VALUES (5398,1626,'905'); -INSERT INTO llx_telephonie_prefix VALUES (5399,1626,'90505'); -INSERT INTO llx_telephonie_prefix VALUES (5400,1626,'90555'); -INSERT INTO llx_telephonie_prefix VALUES (5401,1627,'688'); -INSERT INTO llx_telephonie_prefix VALUES (5402,1628,'6886'); -INSERT INTO llx_telephonie_prefix VALUES (5403,1628,'6887'); -INSERT INTO llx_telephonie_prefix VALUES (5404,1628,'6888'); -INSERT INTO llx_telephonie_prefix VALUES (5405,1629,'380'); -INSERT INTO llx_telephonie_prefix VALUES (5406,1630,'38050'); -INSERT INTO llx_telephonie_prefix VALUES (5407,1630,'38067'); -INSERT INTO llx_telephonie_prefix VALUES (5408,1630,'38068'); -INSERT INTO llx_telephonie_prefix VALUES (5409,1630,'380931'); -INSERT INTO llx_telephonie_prefix VALUES (5410,1631,'598'); -INSERT INTO llx_telephonie_prefix VALUES (5411,1632,'5989'); -INSERT INTO llx_telephonie_prefix VALUES (5412,1633,'678'); -INSERT INTO llx_telephonie_prefix VALUES (5413,1634,'6785'); -INSERT INTO llx_telephonie_prefix VALUES (5414,1634,'6786'); -INSERT INTO llx_telephonie_prefix VALUES (5415,1634,'67871'); -INSERT INTO llx_telephonie_prefix VALUES (5416,1634,'67872'); -INSERT INTO llx_telephonie_prefix VALUES (5417,1634,'67873'); -INSERT INTO llx_telephonie_prefix VALUES (5418,1634,'67874'); -INSERT INTO llx_telephonie_prefix VALUES (5419,1634,'67875'); -INSERT INTO llx_telephonie_prefix VALUES (5420,1634,'67876'); -INSERT INTO llx_telephonie_prefix VALUES (5421,1634,'67877'); -INSERT INTO llx_telephonie_prefix VALUES (5422,1634,'67878'); -INSERT INTO llx_telephonie_prefix VALUES (5423,1635,'58'); -INSERT INTO llx_telephonie_prefix VALUES (5424,1636,'582'); -INSERT INTO llx_telephonie_prefix VALUES (5425,1637,'58412'); -INSERT INTO llx_telephonie_prefix VALUES (5426,1637,'58414'); -INSERT INTO llx_telephonie_prefix VALUES (5427,1637,'58415'); -INSERT INTO llx_telephonie_prefix VALUES (5428,1637,'58416'); -INSERT INTO llx_telephonie_prefix VALUES (5429,1637,'58417'); -INSERT INTO llx_telephonie_prefix VALUES (5430,1637,'58418'); -INSERT INTO llx_telephonie_prefix VALUES (5431,1638,'1340'); -INSERT INTO llx_telephonie_prefix VALUES (5432,1638,'1809752'); -INSERT INTO llx_telephonie_prefix VALUES (5433,1638,'1809767'); -INSERT INTO llx_telephonie_prefix VALUES (5434,1638,'180977'); -INSERT INTO llx_telephonie_prefix VALUES (5435,1639,'1284'); -INSERT INTO llx_telephonie_prefix VALUES (5436,1639,'1809494'); -INSERT INTO llx_telephonie_prefix VALUES (5437,1639,'1809495'); -INSERT INTO llx_telephonie_prefix VALUES (5438,1639,'1809496'); -INSERT INTO llx_telephonie_prefix VALUES (5439,1640,'84'); -INSERT INTO llx_telephonie_prefix VALUES (5440,1641,'848'); -INSERT INTO llx_telephonie_prefix VALUES (5441,1642,'849'); -INSERT INTO llx_telephonie_prefix VALUES (5442,1642,'8480'); -INSERT INTO llx_telephonie_prefix VALUES (5443,1642,'8481'); -INSERT INTO llx_telephonie_prefix VALUES (5444,1642,'8485'); -INSERT INTO llx_telephonie_prefix VALUES (5445,1642,'8489'); -INSERT INTO llx_telephonie_prefix VALUES (5446,1643,'681'); -INSERT INTO llx_telephonie_prefix VALUES (5447,1644,'751001'); -INSERT INTO llx_telephonie_prefix VALUES (5448,1645,'967'); -INSERT INTO llx_telephonie_prefix VALUES (5449,1646,'381'); -INSERT INTO llx_telephonie_prefix VALUES (5450,1647,'3816'); -INSERT INTO llx_telephonie_prefix VALUES (5451,1648,'243'); -INSERT INTO llx_telephonie_prefix VALUES (5452,1649,'2438'); -INSERT INTO llx_telephonie_prefix VALUES (5453,1649,'24397'); -INSERT INTO llx_telephonie_prefix VALUES (5454,1649,'24398'); -INSERT INTO llx_telephonie_prefix VALUES (5455,1649,'24399'); -INSERT INTO llx_telephonie_prefix VALUES (5456,1649,'2435'); -INSERT INTO llx_telephonie_prefix VALUES (5457,1649,'2436'); -INSERT INTO llx_telephonie_prefix VALUES (5458,1649,'24381'); -INSERT INTO llx_telephonie_prefix VALUES (5459,1649,'24386'); -INSERT INTO llx_telephonie_prefix VALUES (5460,1649,'24388'); -INSERT INTO llx_telephonie_prefix VALUES (5461,1650,'260'); -INSERT INTO llx_telephonie_prefix VALUES (5462,1651,'260177'); -INSERT INTO llx_telephonie_prefix VALUES (5463,1651,'260278'); -INSERT INTO llx_telephonie_prefix VALUES (5464,1651,'2609'); -INSERT INTO llx_telephonie_prefix VALUES (5465,1651,'260957'); -INSERT INTO llx_telephonie_prefix VALUES (5466,1652,'263'); -INSERT INTO llx_telephonie_prefix VALUES (5467,1653,'2631'); -INSERT INTO llx_telephonie_prefix VALUES (5468,1653,'2632'); -INSERT INTO llx_telephonie_prefix VALUES (5469,1653,'2639'); -INSERT INTO llx_telephonie_prefix VALUES (5470,1291,'33630'); -INSERT INTO llx_telephonie_prefix VALUES (5471,1291,'33633'); -INSERT INTO llx_telephonie_prefix VALUES (5472,1291,'33679'); -INSERT INTO llx_telephonie_prefix VALUES (5473,1291,'33632'); -INSERT INTO llx_telephonie_prefix VALUES (5474,1291,'33634'); -INSERT INTO llx_telephonie_prefix VALUES (5475,1292,'33628'); -INSERT INTO llx_telephonie_prefix VALUES (5476,1292,'33629'); -INSERT INTO llx_telephonie_prefix VALUES (5477,1534,'33692'); -INSERT INTO llx_telephonie_prefix VALUES (5478,1654,'336968'); -INSERT INTO llx_telephonie_prefix VALUES (5479,1654,'3369684'); -INSERT INTO llx_telephonie_prefix VALUES (5480,1655,'3369690'); -INSERT INTO llx_telephonie_prefix VALUES (5481,1655,'3369691'); -INSERT INTO llx_telephonie_prefix VALUES (5482,1655,'3369692'); -INSERT INTO llx_telephonie_prefix VALUES (5483,1655,'3369693'); -INSERT INTO llx_telephonie_prefix VALUES (5484,1655,'3369694'); -INSERT INTO llx_telephonie_prefix VALUES (5485,1655,'3369695'); -INSERT INTO llx_telephonie_prefix VALUES (5486,1655,'3369696'); -INSERT INTO llx_telephonie_prefix VALUES (5487,1655,'3369697'); -INSERT INTO llx_telephonie_prefix VALUES (5488,1655,'3369698'); -INSERT INTO llx_telephonie_prefix VALUES (5489,1654,'3369699'); -INSERT INTO llx_telephonie_prefix VALUES (5490,1290,'33650'); -INSERT INTO llx_telephonie_prefix VALUES (5491,1654,'336905'); -INSERT INTO llx_telephonie_prefix VALUES (5492,1656,'336065'); -INSERT INTO llx_telephonie_prefix VALUES (5493,1656,'336066'); -INSERT INTO llx_telephonie_prefix VALUES (5494,1656,'336067'); -INSERT INTO llx_telephonie_prefix VALUES (5495,1656,'336068'); -INSERT INTO llx_telephonie_prefix VALUES (5496,1656,'336069'); -INSERT INTO llx_telephonie_prefix VALUES (5497,1654,'3369030'); -INSERT INTO llx_telephonie_prefix VALUES (5498,1654,'3369031'); -INSERT INTO llx_telephonie_prefix VALUES (5499,1654,'3369032'); -INSERT INTO llx_telephonie_prefix VALUES (5500,1654,'3369033'); -INSERT INTO llx_telephonie_prefix VALUES (5501,1654,'3369034'); -INSERT INTO llx_telephonie_prefix VALUES (5502,1654,'3369035'); -INSERT INTO llx_telephonie_prefix VALUES (5503,1655,'3369036'); -INSERT INTO llx_telephonie_prefix VALUES (5504,1654,'3369037'); -INSERT INTO llx_telephonie_prefix VALUES (5505,1654,'3369038'); -INSERT INTO llx_telephonie_prefix VALUES (5506,1654,'3369039'); -INSERT INTO llx_telephonie_prefix VALUES (5507,1654,'3369040'); -INSERT INTO llx_telephonie_prefix VALUES (5508,1654,'3369041'); -INSERT INTO llx_telephonie_prefix VALUES (5509,1655,'3369042'); -INSERT INTO llx_telephonie_prefix VALUES (5510,1655,'3369043'); -INSERT INTO llx_telephonie_prefix VALUES (5511,1655,'3369044'); -INSERT INTO llx_telephonie_prefix VALUES (5512,1655,'3369045'); -INSERT INTO llx_telephonie_prefix VALUES (5513,1655,'3369046'); -INSERT INTO llx_telephonie_prefix VALUES (5514,1654,'3369047'); -INSERT INTO llx_telephonie_prefix VALUES (5515,1654,'3369048'); -INSERT INTO llx_telephonie_prefix VALUES (5516,1654,'3369049'); -INSERT INTO llx_telephonie_prefix VALUES (5517,1654,'336962'); -INSERT INTO llx_telephonie_prefix VALUES (5518,1654,'3369062'); -INSERT INTO llx_telephonie_prefix VALUES (5519,1654,'3369061'); -INSERT INTO llx_telephonie_prefix VALUES (5520,1654,'3369060'); -INSERT INTO llx_telephonie_prefix VALUES (5521,1654,'3369063'); -INSERT INTO llx_telephonie_prefix VALUES (5522,1654,'3369064'); -INSERT INTO llx_telephonie_prefix VALUES (5523,1654,'3369065'); -INSERT INTO llx_telephonie_prefix VALUES (5524,1654,'3369067'); -INSERT INTO llx_telephonie_prefix VALUES (5525,1654,'3369068'); -INSERT INTO llx_telephonie_prefix VALUES (5526,1655,'3369069'); -INSERT INTO llx_telephonie_prefix VALUES (5527,1657,'3369091'); -INSERT INTO llx_telephonie_prefix VALUES (5528,1657,'3369090'); -INSERT INTO llx_telephonie_prefix VALUES (5529,1657,'3369099'); -INSERT INTO llx_telephonie_prefix VALUES (5530,1654,'336963'); -INSERT INTO llx_telephonie_prefix VALUES (5531,1654,'3369420'); -INSERT INTO llx_telephonie_prefix VALUES (5532,1654,'3369421'); -INSERT INTO llx_telephonie_prefix VALUES (5533,1654,'3369422'); -INSERT INTO llx_telephonie_prefix VALUES (5534,1654,'3369423'); -INSERT INTO llx_telephonie_prefix VALUES (5535,1654,'3369424'); -INSERT INTO llx_telephonie_prefix VALUES (5536,1654,'3369426'); -INSERT INTO llx_telephonie_prefix VALUES (5537,1654,'3369440'); -INSERT INTO llx_telephonie_prefix VALUES (5538,1654,'3369441'); -INSERT INTO llx_telephonie_prefix VALUES (5539,1654,'3369442'); -INSERT INTO llx_telephonie_prefix VALUES (5540,1654,'3369443'); -INSERT INTO llx_telephonie_prefix VALUES (5541,1654,'3369444'); -INSERT INTO llx_telephonie_prefix VALUES (5542,1654,'3369445'); -INSERT INTO llx_telephonie_prefix VALUES (5543,1657,'3369446'); -INSERT INTO llx_telephonie_prefix VALUES (5544,1657,'3369447'); -INSERT INTO llx_telephonie_prefix VALUES (5545,1654,'3369075'); -INSERT INTO llx_telephonie_prefix VALUES (5546,1654,'3369076'); -INSERT INTO llx_telephonie_prefix VALUES (5547,1654,'3369074'); -INSERT INTO llx_telephonie_prefix VALUES (5548,1654,'3369073'); -INSERT INTO llx_telephonie_prefix VALUES (5549,1654,'3369072'); -INSERT INTO llx_telephonie_prefix VALUES (5550,1654,'3369071'); -INSERT INTO llx_telephonie_prefix VALUES (5551,1654,'336964'); -INSERT INTO llx_telephonie_prefix VALUES (5552,1657,'336908'); -INSERT INTO llx_telephonie_prefix VALUES (5553,1654,'336960'); -INSERT INTO llx_telephonie_prefix VALUES (5554,1654,'336967'); -INSERT INTO llx_telephonie_prefix VALUES (5555,1654,'336966'); -INSERT INTO llx_telephonie_prefix VALUES (5556,1654,'336965'); -INSERT INTO llx_telephonie_prefix VALUES (5557,1654,'33694'); -INSERT INTO llx_telephonie_prefix VALUES (5558,1654,'33693'); -INSERT INTO llx_telephonie_prefix VALUES (5559,1290,'33669'); -INSERT INTO llx_telephonie_prefix VALUES (5560,1292,'33602'); -INSERT INTO llx_telephonie_prefix VALUES (5561,1657,'336900'); -INSERT INTO llx_telephonie_prefix VALUES (5562,1292,'33601'); -INSERT INTO llx_telephonie_prefix VALUES (5563,1291,'33637'); -INSERT INTO llx_telephonie_prefix VALUES (5564,1654,'336961'); -INSERT INTO llx_telephonie_prefix VALUES (5565,1654,'33691'); -INSERT INTO llx_telephonie_prefix VALUES (5566,1654,'3364'); -INSERT INTO llx_telephonie_prefix VALUES (5567,1654,'33697'); -INSERT INTO llx_telephonie_prefix VALUES (5568,1654,'3365'); -INSERT INTO llx_telephonie_prefix VALUES (5569,1293,'33954'); -INSERT INTO llx_telephonie_prefix VALUES (5570,1293,'33877'); -INSERT INTO llx_telephonie_prefix VALUES (5571,1293,'33874'); -INSERT INTO llx_telephonie_prefix VALUES (5572,1293,'33873'); -INSERT INTO llx_telephonie_prefix VALUES (5573,1293,'33871'); -INSERT INTO llx_telephonie_prefix VALUES (5574,1293,'33875'); - diff --git a/htdocs/telephonie/tarifs/config/data/tarif.sql b/htdocs/telephonie/tarifs/config/data/tarif.sql deleted file mode 100644 index 71ce75a5201..00000000000 --- a/htdocs/telephonie/tarifs/config/data/tarif.sql +++ /dev/null @@ -1,565 +0,0 @@ --- MySQL dump 9.11 --- --- Host: localhost Database: dolixid --- ------------------------------------------------------ --- Server version 4.0.24_Debian-10sarge2-log - --- --- Dumping data for table `llx_telephonie_tarif` --- - -INSERT INTO llx_telephonie_tarif VALUES (1103,'ACORES','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1104,'AFGHANISTAN','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1105,'AFRIQUE DU SUD','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1106,'AFRIQUE DU SUD CAPE TOWN','INT',1105); -INSERT INTO llx_telephonie_tarif VALUES (1107,'AFRIQUE DU SUD JOHANNESBURG','INT',1105); -INSERT INTO llx_telephonie_tarif VALUES (1108,'AFRIQUE DU SUD MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1109,'ALASKA','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1110,'ALBANIE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1111,'ALBANIE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1112,'ALGERIE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1113,'ALGERIE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1114,'ALLEMAGNE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1115,'ALLEMAGNE BERLIN','INT',1114); -INSERT INTO llx_telephonie_tarif VALUES (1116,'ALLEMAGNE BONN','INT',1114); -INSERT INTO llx_telephonie_tarif VALUES (1117,'ALLEMAGNE DISSELDORF','INT',1114); -INSERT INTO llx_telephonie_tarif VALUES (1118,'ALLEMAGNE FRANKFORT','INT',1114); -INSERT INTO llx_telephonie_tarif VALUES (1119,'ALLEMAGNE HAMBOURG','INT',1114); -INSERT INTO llx_telephonie_tarif VALUES (1120,'ALLEMAGNE HANOVRE','INT',1114); -INSERT INTO llx_telephonie_tarif VALUES (1121,'ALLEMAGNE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1122,'ALLEMAGNE MUNICH','INT',1114); -INSERT INTO llx_telephonie_tarif VALUES (1123,'ALLEMAGNE NUREMBOURG','INT',1114); -INSERT INTO llx_telephonie_tarif VALUES (1124,'ALLEMAGNE PREMIUM','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1125,'ALLEMAGNE STUTTGART','INT',1114); -INSERT INTO llx_telephonie_tarif VALUES (1126,'ANDORRE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1127,'ANDORRE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1128,'ANGOLA','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1129,'ANGOLA MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1130,'ANGUILLE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1131,'ANTARTIQUE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1132,'ANTIGAUA','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1133,'ANTIGUA ET BARBUDA','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1134,'ANTIGUA ET BARBUDA MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1135,'ANTILLES NEERLANDAISES','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1136,'ANTILLES NEERLANDAISES MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1137,'ARABIE SAOUDITE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1138,'ARABIE SAOUDITE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1139,'ARGENTINE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1140,'ARGENTINE BUENOS AIRES','INT',1139); -INSERT INTO llx_telephonie_tarif VALUES (1141,'ARGENTINE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1142,'ARMENIE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1143,'ARMENIE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1144,'ARMENIE YEREVAN','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1145,'ARUBA','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1146,'ASCENSION','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1147,'ASTELIT','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1148,'AUSTRALIE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1149,'AUSTRALIE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1150,'AUSTRALIE SYDNEY','INT',1148); -INSERT INTO llx_telephonie_tarif VALUES (1151,'AUTRICHE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1152,'AUTRICHE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1153,'AUTRICHE PREMIUM','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1154,'AUTRICHE VIENNE','INT',1151); -INSERT INTO llx_telephonie_tarif VALUES (1155,'AZERBAIDJAN','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1156,'AZERBAIDJAN MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1157,'BAHAMAS','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1158,'BAHREIN','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1159,'BAHREIN MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1160,'BALTIC COM LTD','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1161,'BANGLADESH','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1162,'BANGLADESH DAKHA','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1163,'BANGLADESH MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1164,'BARBADE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1165,'BARBADE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1166,'BELARUS','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1167,'BELARUS MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1168,'BELGIQUE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1169,'BELGIQUE ANVERS','INT',1168); -INSERT INTO llx_telephonie_tarif VALUES (1170,'BELGIQUE BRUXELLES','INT',1168); -INSERT INTO llx_telephonie_tarif VALUES (1171,'BELGIQUE LIEGE','INT',1168); -INSERT INTO llx_telephonie_tarif VALUES (1172,'BELGIQUE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1173,'BELGIQUE PREMIUM','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1174,'BELIZE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1175,'BENIN','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1176,'BERMUDES','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1177,'BHOUTAN','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1178,'BOLIVIE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1179,'BOLIVIE LA PAZ','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1180,'BOLIVIE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1181,'BOLIVIE SANTA CRUZ','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1182,'BOSNIE HERZEGOVINE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1183,'BOSNIE HERZEGOVINE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1184,'BOTSWANA','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1185,'BOTSWANA MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1186,'BRESIL','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1187,'BRESIL MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1188,'BRESIL RIO DE JANEIRO','INT',1186); -INSERT INTO llx_telephonie_tarif VALUES (1189,'BRESIL SAO PAULO','INT',1186); -INSERT INTO llx_telephonie_tarif VALUES (1190,'BRUNEI','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1191,'BRUNEI MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1192,'BULGARIE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1193,'BULGARIE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1194,'BURKINA FASO','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1195,'BURUNDI','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1196,'BURUNDI MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1197,'CAMBODGE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1198,'CAMBODGE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1199,'CAMEROUN','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1200,'CAMEROUN MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1201,'CANADA','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1202,'CANADA MONTREAL','INT',1201); -INSERT INTO llx_telephonie_tarif VALUES (1203,'CANADA TORONTO','INT',1201); -INSERT INTO llx_telephonie_tarif VALUES (1204,'CANARIES','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1205,'CAP VERT','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1206,'CAP VERT MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1207,'CAYMAN','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1208,'CHILI','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1209,'CHILI MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1210,'CHILI SANTIAGO','INT',1208); -INSERT INTO llx_telephonie_tarif VALUES (1211,'CHINE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1212,'CHINE BEIJING','INT',1211); -INSERT INTO llx_telephonie_tarif VALUES (1213,'CHINE FUZHOU','INT',1211); -INSERT INTO llx_telephonie_tarif VALUES (1214,'CHINE GUANGZHOU','INT',1211); -INSERT INTO llx_telephonie_tarif VALUES (1215,'CHINE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1216,'CHINE SHANGAI','INT',1211); -INSERT INTO llx_telephonie_tarif VALUES (1217,'CHINE WENZHOU','INT',1211); -INSERT INTO llx_telephonie_tarif VALUES (1218,'CHRISTMAS (ILE)','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1219,'CHYPRE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1220,'CHYPRE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1221,'CHYPRE TURQUIE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1222,'COCOS KEELING','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1223,'COLOMBIE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1224,'COLOMBIE BARANGUILLA','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1225,'COLOMBIE BOGOTA','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1226,'COLOMBIE CALI','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1227,'COLOMBIE MEDELLIN','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1228,'COLOMBIE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1229,'COMBELLGA','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1230,'COMORES','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1231,'COMSTAR','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1232,'CONGO','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1233,'COOK (ILES)','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1234,'COOK (ILES) AUDIOTEXT','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1235,'COREE DU NORD','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1236,'COREE DU SUD','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1237,'COREE DU SUD MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1238,'COREE DU SUD SEOUM','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1239,'COSTA RICA','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1240,'COSTA RICA MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1241,'COTE D\'IVOIRE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1242,'COTE D\'IVOIRE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1243,'CROATIE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1244,'CROATIE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1245,'CUBA','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1246,'CUBA GUANTANAMO','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1247,'DANEMARK','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1248,'DANEMARK COPENHAGE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1249,'DANEMARK MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1250,'DIEGO GARCIA','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1251,'DIEGO GARCIA AUDIOTEXT','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1252,'DJIBOUTI','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1253,'DJIBOUTI MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1254,'DOMINIQUE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1255,'DOMINIQUE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1256,'EGYPTE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1257,'EGYPTE ALEXANDRIE','INT',1256); -INSERT INTO llx_telephonie_tarif VALUES (1258,'EGYPTE LE CAIRE','INT',1256); -INSERT INTO llx_telephonie_tarif VALUES (1259,'EGYPTE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1260,'EL SALVADOR','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1261,'EL SALVADOR MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1262,'EMIRATS ARABES UNIS','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1263,'EMIRATS ARABES UNIS MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1264,'EQUATEUR','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1265,'EQUATEUR GUAYAQUIL','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1266,'EQUATEUR MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1267,'EQUATEUR QUITO','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1268,'ERYTHREE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1269,'ESPAGNE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1270,'ESPAGNE BARCELONE','INT',1269); -INSERT INTO llx_telephonie_tarif VALUES (1271,'ESPAGNE MADRID','INT',1269); -INSERT INTO llx_telephonie_tarif VALUES (1272,'ESPAGNE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1273,'ESTONIE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1274,'ESTONIE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1275,'ETATS UNIS','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1276,'ETATS UNIS NUMERO SPECIAL','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1277,'ETHIOPIE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1278,'ETHIOPIE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1279,'FALKLAND (ILES)','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1280,'FEROE (ILES)','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1281,'FIDJI','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1282,'FIDJI AUDIOTEXT','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1283,'FIDJI MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1284,'FINLANDE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1285,'FINLANDE HELSINKI','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1286,'FINLANDE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1287,'FRANCE GUYANE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1289,'FRANCE MOBILE AUTRES','MOB',0); -INSERT INTO llx_telephonie_tarif VALUES (1290,'FRANCE MOBILE BOUYGUES','MOB',0); -INSERT INTO llx_telephonie_tarif VALUES (1291,'FRANCE MOBILE ORANGE','MOB',0); -INSERT INTO llx_telephonie_tarif VALUES (1292,'FRANCE MOBILE SFR','MOB',0); -INSERT INTO llx_telephonie_tarif VALUES (1293,'FRANCE LOCAL NATIONAL','NAT',0); -INSERT INTO llx_telephonie_tarif VALUES (1294,'GABON','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1295,'GABON MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1296,'GAMBIE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1297,'GEORGIE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1298,'GEORGIE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1299,'GHANA','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1300,'GHANA MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1301,'GIBRALTAR','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1302,'GIBRALTAR MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1303,'GRECE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1304,'GRECE ATHENES','INT',1303); -INSERT INTO llx_telephonie_tarif VALUES (1305,'GRECE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1306,'GRENADE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1307,'GROENLAND','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1308,'GROENLAND MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1309,'GUADELOUPE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1310,'GUADELOUPE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1311,'GUAM','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1312,'GUATEMALA','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1313,'GUATEMALA MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1314,'GUINEE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1315,'GUINEE BISSAU','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1316,'GUINEE EQUATORIALE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1317,'GUYANA','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1318,'GUYANE FRANCAISE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1319,'HAITI','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1320,'HAITI MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1321,'HAWAII','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1322,'HONDURAS','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1323,'HONDURAS MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1324,'HONG KONG','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1325,'HONG KONG MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1326,'HONGRIE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1327,'HONGRIE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1328,'ILES CHATHAM','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1329,'ILES MIDWAY','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1330,'ILLES WAKE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1331,'INDE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1332,'INDE BANGALORE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1333,'INDE BOMBAY','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1334,'INDE CALCUTTA','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1335,'INDE MADRAS','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1336,'INDE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1337,'INDE NEW DELHI','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1338,'INDONESIE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1339,'INDONESIE DJAKARTA','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1340,'INDONESIE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1341,'INMARSAT','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1342,'INMARSAT A ATLANTIQUE EST','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1343,'INMARSAT A PACIFIQUE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1344,'INMARSAT AERO ATLANTIQUE EST','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1345,'INMARSAT Atl.Est','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1346,'INMARSAT Atl.Est-C','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1347,'INMARSAT Atl.Ouest','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1348,'INMARSAT Atl.Ouest-A','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1349,'INMARSAT Atl.Ouest-C','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1350,'INMARSAT B ATLANTIQUE EST','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1351,'INMARSAT B ATLANTIQUE OUEST','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1352,'INMARSAT B HSD','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1353,'INMARSAT B INDIEN','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1354,'INMARSAT B PACIFIQUE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1355,'INMARSAT M ATLANTIQUE EST','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1356,'INMARSAT M ATLANTIQUE OUEST','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1357,'INMARSAT M INDIEN','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1358,'INMARSAT M PACIFIQUE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1359,'INMARSAT MINI M','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1360,'INMARSAT MINI M ATLANTIQUE EST','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1361,'INMARSAT MINI M ATLANTIQUE OUEST','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1362,'INMARSAT MINI M INDIEN','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1363,'INMARSAT Oc.Ind','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1364,'INMARSAT Oc.Ind-A','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1365,'INMARSAT Pac','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1366,'INMARSAT Pac-C','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1367,'INMARSAT Pac-Mi.M','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1368,'INMARSAT WORLDWIDE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1369,'IRAK','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1370,'IRAN','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1371,'IRAN MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1372,'IRLANDE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1373,'IRLANDE DUBLIN','INT',1372); -INSERT INTO llx_telephonie_tarif VALUES (1374,'IRLANDE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1375,'IRLANDE PREMIUM','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1376,'IRRIDIUM 1','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1377,'IRRIDIUM 2','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1378,'IRRIDIUM 8821','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1379,'ISLANDE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1380,'ISLANDE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1381,'ISRAEL','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1382,'ISRAEL MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1383,'ISRAEL TEL AVIV','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1384,'ITALIE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1385,'ITALIE MILAN','INT',1384); -INSERT INTO llx_telephonie_tarif VALUES (1386,'ITALIE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1387,'ITALIE ROME','INT',1384); -INSERT INTO llx_telephonie_tarif VALUES (1388,'ITALIE VATICAN','INT',1384); -INSERT INTO llx_telephonie_tarif VALUES (1389,'JAMAIQUE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1390,'JAMAIQUE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1391,'JAPON','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1392,'JAPON MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1393,'JAPON NAGOYA','INT',1391); -INSERT INTO llx_telephonie_tarif VALUES (1394,'JAPON OKINAWA','INT',1391); -INSERT INTO llx_telephonie_tarif VALUES (1395,'JAPON OSAKA','INT',1391); -INSERT INTO llx_telephonie_tarif VALUES (1396,'JAPON TOKYO','INT',1391); -INSERT INTO llx_telephonie_tarif VALUES (1397,'JORDANIE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1398,'JORDANIE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1399,'KAZAKHSTAN','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1400,'KAZAKHSTAN MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1401,'KENYA','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1402,'KENYA MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1403,'KIRGHIZISTAN','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1404,'KIRGHIZISTAN MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1405,'KIRIBATI','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1406,'KIRIBATI MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1407,'KOWEIT','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1408,'KOWEIT MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1409,'LAOS','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1410,'LESOTHO','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1411,'LESOTHO MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1412,'LETTONIE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1413,'LETTONIE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1414,'LIBAN','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1415,'LIBAN MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1416,'LIBERIA','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1417,'LIBERIA MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1418,'LIBYE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1419,'LIECHTENSTEIN','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1420,'LIECHTENSTEIN MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1421,'LITUANIE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1422,'LITUANIE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1423,'LUXEMBOURG','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1424,'LUXEMBOURG MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1425,'MACAO','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1426,'MACAO MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1427,'MACEDOINE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1428,'MACEDOINE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1429,'MADAGASCAR','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1430,'MADAGASCAR MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1431,'MADERE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1432,'MADERE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1433,'MALAISIE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1434,'MALAISIE KUALA LUMPUR','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1435,'MALAISIE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1436,'MALAWI','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1437,'MALAWI MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1438,'MALDIVES','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1439,'MALDIVES MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1440,'MALI','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1441,'MALTE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1442,'MALTE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1443,'MARIANNES (ILES)','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1444,'MAROC','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1445,'MAROC CASABLANCA','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1446,'MAROC MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1447,'MARSHALL (ILES)','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1448,'MARTINIQUE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1449,'MARTINIQUE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1450,'MAURICE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1451,'MAURITANIE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1452,'MAYOTTE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1453,'MEXIQUE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1454,'MEXIQUE GUADALAJARA','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1455,'MEXIQUE MEXICO','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1456,'MEXIQUE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1457,'MEXIQUE MONTERREY','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1458,'MICRONESIE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1459,'MOLDAVIE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1460,'MOLDAVIE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1461,'MONACO','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1462,'MONACO MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1463,'MONGOLIE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1464,'MONTSERRAT','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1465,'MONTSERRAT MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1466,'MOZAMBIQUE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1467,'MOZAMBIQUE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1468,'MYANMAR','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1469,'NAMIBIE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1470,'NAMIBIE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1471,'NAURU','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1472,'NAURU AUDIOTEXT','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1473,'NEPAL','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1474,'NEPAL MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1475,'NICARAGUA','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1476,'NICARAGUA MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1477,'NIGER','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1478,'NIGER MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1479,'NIGERIA','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1480,'NIGERIA LAGOS','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1481,'NIGERIA MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1482,'NIUE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1483,'NIUE AUDIOTEXT','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1484,'NORFOLK (ILE)','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1485,'NORFOLK (ILE) AUDIOTEXT','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1486,'NORVEGE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1487,'NORVEGE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1488,'NORVEGE OSLO','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1489,'NOUVELLE CALEDONIE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1490,'NOUVELLE CALEDONIE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1491,'NOUVELLE ZELANDE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1492,'NOUVELLE ZELANDE AUCKLAND','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1493,'NOUVELLE ZELANDE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1494,'OMAN','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1495,'OUGANDA','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1496,'OUZBEKISTAN','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1497,'OUZBEKISTAN MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1498,'PAKISTAN','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1499,'PAKISTAN KARACHI','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1500,'PAKISTAN MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1501,'PALAU','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1502,'PALESTINE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1503,'PANAMA','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1504,'PANAMA MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1505,'PAPOUASIE NOUVELLE GUINEE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1506,'PAPOUASIE NOUVELLE GUINEE AUDIOTEXT','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1507,'PAPOUASIE NOUVELLE GUINEE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1508,'PARAGUAY','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1509,'PARAGUAY MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1510,'PAYS BAS','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1511,'PAYS BAS AMSTERDAM','INT',1510); -INSERT INTO llx_telephonie_tarif VALUES (1512,'PAYS BAS MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1513,'PAYS BAS PREMIUM','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1514,'PAYS BAS ROTTERDAM','INT',1510); -INSERT INTO llx_telephonie_tarif VALUES (1515,'PEROU','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1516,'PEROU LIMA','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1517,'PEROU MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1518,'PHILIPPINES','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1519,'PHILIPPINES MANILLE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1520,'PHILIPPINES MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1521,'POLOGNE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1522,'POLOGNE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1523,'POLOGNE VARSOVIE','INT',1521); -INSERT INTO llx_telephonie_tarif VALUES (1524,'POLYNESIE FRANCAISE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1525,'PORTUGAL','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1526,'PORTUGAL MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1527,'PUERTO RICO','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1528,'QATAR','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1529,'QATAR MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1530,'REPUBLIQUE CENTRAFRICAINE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1531,'REPUBLIQUE DOMINICAINE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1532,'REPUBLIQUE DOMINICAINE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1533,'REUNION','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1534,'REUNION MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1535,'ROUMANIE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1536,'ROUMANIE BUCHAREST','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1537,'ROUMANIE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1538,'ROYAUME UNI','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1539,'ROYAUME UNI 084','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1540,'ROYAUME UNI 087','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1541,'ROYAUME UNI LONDRE','INT',1538); -INSERT INTO llx_telephonie_tarif VALUES (1542,'ROYAUME UNI MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1543,'ROYAUME UNI MOBILE PESONAL N°','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1544,'RUSSIE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1545,'RUSSIE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1546,'RUSSIE MOSCOU','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1547,'RUSSIE OVERLAY','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1548,'RUSSIE ST PETERSBOURG','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1549,'RWANDA','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1550,'RWANDA MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1551,'SAINT KITTS ET NEVIS','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1552,'SAINT MARIN','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1553,'SAINT PIERRE ET MIQUELON','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1554,'SAINT VINCENT','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1555,'SAINT VINCENT MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1556,'SAINTE HELENE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1557,'SAINTE LUCIE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1558,'SAINTE LUCIE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1559,'SALOMON','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1560,'SALOMON AUDIOTEXT','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1561,'SAMOA AMERICAINES','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1562,'SAMOA OCCIDENTALES','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1563,'SAO TOME ET PRINCIPE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1564,'SENEGAL','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1565,'SENEGAL MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1566,'SEYCHELLES','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1567,'SEYCHELLES MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1568,'SIERRA LEONE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1569,'SIERRA LEONE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1570,'SINGAPOUR','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1571,'SINGAPOUR MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1572,'SLOVAQUIE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1573,'SLOVAQUIE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1574,'SLOVENIE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1575,'SLOVENIE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1576,'SOMALIE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1577,'SOUDAN','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1578,'SOVINTEL','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1579,'SRI LANKA','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1580,'SRI LANKA MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1581,'SUEDE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1582,'SUEDE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1583,'SUEDE STOCKHOLM','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1584,'SUISSE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1585,'SUISSE GENEVE','INT',1584); -INSERT INTO llx_telephonie_tarif VALUES (1586,'SUISSE LAUSANNE','INT',1584); -INSERT INTO llx_telephonie_tarif VALUES (1587,'SUISSE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1588,'SUISSE NUMERO SPECIAL','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1589,'SUISSE PREMIUM','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1590,'SUISSE ZURICH','INT',1584); -INSERT INTO llx_telephonie_tarif VALUES (1591,'SURINAM','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1592,'SURINAM MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1593,'SWAZILAND','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1594,'SWAZILAND MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1595,'SYRIE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1596,'SYRIE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1597,'TADJIKISTAN','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1598,'TADJIKISTAN MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1599,'TAIWAN','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1600,'TAIWAN MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1601,'TAIWAN TAIPEI','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1602,'TANZANIE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1603,'TANZANIE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1604,'TATINKOM','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1605,'TCHAD','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1606,'TCHEQUE (REP)','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1607,'TCHEQUE (REP) MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1608,'THAILANDE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1609,'THAILANDE BANGKOK','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1610,'THAILANDE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1611,'TOGO','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1612,'TOGO MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1613,'TOKELAU','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1614,'TONGA','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1615,'TONGA AUDIOTEXT','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1616,'TRINITE ET TOB MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1617,'TRINITE ET TOBAGO','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1618,'TUNISIE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1619,'TUNISIE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1620,'TURKMENISTAN','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1621,'TURKMENISTAN MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1622,'TURKS ET CAICOS (ILES)','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1623,'TURQUIE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1624,'TURQUIE ANKARA','INT',1623); -INSERT INTO llx_telephonie_tarif VALUES (1625,'TURQUIE ISTANBUL','INT',1623); -INSERT INTO llx_telephonie_tarif VALUES (1626,'TURQUIE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1627,'TUVALU','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1628,'TUVALU AUDIOTEXT','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1629,'UKRAINE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1630,'UKRAINE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1631,'URUGUAY','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1632,'URUGUAY MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1633,'VANUATU','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1634,'VANUATU AUDIOTEXT','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1635,'VENEZUELA','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1636,'VENEZUELA CARACAS','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1637,'VENEZUELA MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1638,'VIERGES AMERICAINES (ILES)','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1639,'VIERGES BRITANNIQUES (ILES)','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1640,'VIETNAM','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1641,'VIETNAM HO CHI MINH VILLE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1642,'VIETNAM MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1643,'WALLIS ET FUTUNA','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1644,'WESTBALT TEL','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1645,'YEMEN','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1646,'YOUGOSLAVIE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1647,'YOUGOSLAVIE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1648,'ZAIRE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1649,'ZAIRE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1650,'ZAMBIE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1651,'ZAMBIE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1652,'ZIMBABWE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1653,'ZIMBABWE MOBILE','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1654,'ORANGE CARAIBES MOBILES','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1655,'BOUYGUES TELECOM CARAIBES','INT',0); -INSERT INTO llx_telephonie_tarif VALUES (1656,'NRJ MOBILE','MOB',0); -INSERT INTO llx_telephonie_tarif VALUES (1657,'OUTREMER TELECOM','INT',0); - diff --git a/htdocs/telephonie/tarifs/config/grille.php b/htdocs/telephonie/tarifs/config/grille.php deleted file mode 100644 index d846a24f826..00000000000 --- a/htdocs/telephonie/tarifs/config/grille.php +++ /dev/null @@ -1,63 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -/* - * - * - */ - -llxHeader(); - -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -$h=0; -$head[$h][0] = DOL_URL_ROOT."/telephonie/tarifs/config/grille.php?id=".$_GET["id"]; -$head[$h][1] = $langs->trans("Grille"); -$hselected = $h; -$h++; - -require_once DOL_DOCUMENT_ROOT."/telephonie/telephonie.tarif.grille.class.php"; - -dol_fiche_head($head, $hselected, "Grille de tarif"); - -$grille = new TelephonieTarifGrille($db); -$grille->fetch($_GET["id"]); - -print '
'; -print '\n"; -print '\n"; -$grille->CountContrats(); -print '\n"; -print '
Nom'.$grille->libelle."
Type'.$grille->type."
Nombre de contrats'.$grille->nb_contrats."
'; - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/tarifs/config/grilles.php b/htdocs/telephonie/tarifs/config/grilles.php deleted file mode 100644 index 2b953321954..00000000000 --- a/htdocs/telephonie/tarifs/config/grilles.php +++ /dev/null @@ -1,172 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if ($_POST["action"] == 'add' && $user->rights->telephonie->tarif->permission) -{ - require_once DOL_DOCUMENT_ROOT."/telephonie/telephonie.tarif.grille.class.php"; - - $obgrille = new TelephonieTarifGrille($db); - - $obgrille->CreateGrille($user, $_POST["nom"], $_POST["type"], $_POST["copy"]); - - Header("Location: grilles.php"); -} - -if ($_POST["action"] == 'remove' && $user->rights->telephonie->tarif->permission) -{ - require_once DOL_DOCUMENT_ROOT."/telephonie/telephonie.tarif.grille.class.php"; - - $obgrille = new TelephonieTarifGrille($db); - - $obgrille->RemoveGrille($user, $_POST["id"], $_POST["replace"]); - - Header("Location: grilles.php"); -} - -llxHeader("","Configuration des grilles tarifs"); - -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -/* - * Mode Liste - * - * - * - */ -print ''; -print '
'; - -$sql = "SELECT d.libelle as tarif_desc, d.rowid, d.type_tarif"; - -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_tarif_grille as d"; -$sql .= "," . MAIN_DB_PREFIX."telephonie_tarif_grille_rights as r"; -$sql .= " WHERE d.rowid = r.fk_grille"; -$sql .= " AND r.fk_user =".$user->id; -$sql .= " AND r.pread = 1"; -$sql .= " ORDER BY d.libelle"; - -$result = $db->query($sql); -if ($result) -{ - $num = $db->num_rows(); - $i = 0; - - while ($i < $num) - { - $obj = $db->fetch_object($i); - $grilles[$obj->rowid][0] = $obj->rowid; - $grilles[$obj->rowid][1] = stripslashes($obj->tarif_desc); - $grilles[$obj->rowid][2] = $obj->type_tarif; - $i++; - } - - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - - -print ''; -print ''; -print ""; -print "\n"; - -$var=True; - -foreach($grilles as $grille) -{ - $var=!$var; - - print ""; - print '\n"; - print '\n"; - print '\n"; - print "\n"; -} -print "
GrilleType 
'.$grille[1]."'.$grille[2]."'.$langs->trans("Delete")."
"; - - -if ($_GET["action"] == 'delete') -{ - print '

'; - print ''; - print ''; - print ''; - print ''; - print ''; - // Nom - print "".''; - - print "".''; - - print '
Supprimer la grille : '.$grilles[$_GET['id']][1].' ?
Utiliser la grille en remplacement de la grille supprimee.
'; -} -else -{ - print '

'; - print ''; - print ''; - - print ''; - - // Nom - print "".''; - print ''; - print "".''; - - print "".''; - - print "".''; - - print '
'.$langs->trans("Lastname").'*'; - - print ''; - - print '
Type de grille
Copier la grille
'; -} - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/tarifs/config/index.php b/htdocs/telephonie/tarifs/config/index.php deleted file mode 100644 index cf21bdb1a47..00000000000 --- a/htdocs/telephonie/tarifs/config/index.php +++ /dev/null @@ -1,173 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -llxHeader(); - -/* - * Securite acces client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - - - -/* - * Recherche - * - * - */ -if ($mode == 'search') { - if ($mode-search == 'soc') { - $sql = "SELECT s.rowid as socid FROM ".MAIN_DB_PREFIX."societe as s "; - $sql .= " WHERE lower(s.nom) like '%".strtolower($socname)."%'"; - } - - if ( $db->query($sql) ) { - if ( $db->num_rows() == 1) { - $obj = $db->fetch_object(0); - $socid = $obj->socid; - } - $db->free(); - } -} - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; -$sortfield = $_GET["sortfield"]; - -if ($sortorder == "") $sortorder="ASC"; -if ($sortfield == "") $sortfield="t.libelle ASC, d.rowid "; - -$offset = $conf->liste_limit * $page ; - -/* - * Mode Liste - * - * - * - */ - -$sql = "SELECT d.rowid as grille, d.libelle as tarif_desc, d.type_tarif"; -$sql .= " , t.libelle as tarif, t.rowid as tarif_id"; -$sql .= " , m.temporel, m.fixe"; -$sql .= " , u.login"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_tarif_grille as d"; -$sql .= "," . MAIN_DB_PREFIX."telephonie_tarif_grille_rights as r"; -$sql .= "," . MAIN_DB_PREFIX."telephonie_tarif_montant as m"; -$sql .= "," . MAIN_DB_PREFIX."telephonie_tarif as t"; -$sql .= "," . MAIN_DB_PREFIX."user as u"; - -$sqlc .= " WHERE d.rowid = m.fk_tarif_desc"; -$sqlc .= " AND m.fk_tarif = t.rowid"; -$sqlc .= " AND m.fk_user = u.rowid"; - -$sqlc .= " AND d.rowid = r.fk_grille"; -$sqlc .= " AND r.fk_user =".$user->id; -$sqlc .= " AND r.pread = 1"; - -if ($_GET["search_libelle"]) -{ - $sqlc .=" AND t.libelle LIKE '%".$_GET["search_libelle"]."%'"; -} - -if ($_GET["search_grille"]) -{ - $sqlc .=" AND d.libelle LIKE '%".$_GET["search_grille"]."%'"; -} - -if ($_GET["type"]) -{ - $sqlc .= " AND d.type_tarif = '".$_GET["type"]."'"; -} - -$sql = $sql . $sqlc . " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); - - -$resql = $db->query($sql); -if ($resql) -{ - $num = $db->num_rows($resql); - $i = 0; - - print_barre_liste("Tarifs", $page, "index.php", "&type=".$_GET["type"], $sortfield, $sortorder, '', $num); - - print ''; - print ''; - - print_liste_field_titre("Grille","index.php","d.libelle"); - - print_liste_field_titre("Tarif","index.php","t.libelle", "&type=".$_GET["type"]); - - print_liste_field_titre("Cout / min","index.php","temporel", "&type=".$_GET["type"]); - print ""; - print ""; - print ''; - print "\n"; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - $var=True; - - while ($i < min($num,$conf->liste_limit)) - { - $obj = $db->fetch_object($resql); - $var=!$var; - - print ""; - - print '\n"; - print '\n"; - print "\n"; - print "\n"; - print '\n"; - print '\n"; - print "\n"; - $i++; - } - print "
Cout fixeTypeUser
   
'; - print $obj->tarif_desc."'; - print $obj->tarif."".sprintf("%01.4f",$obj->temporel)."".sprintf("%01.4f",$obj->fixe)."'.$obj->type_tarif."'.$obj->login."
"; - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/tarifs/config/permissions.php b/htdocs/telephonie/tarifs/config/permissions.php deleted file mode 100644 index 02d21940f98..00000000000 --- a/htdocs/telephonie/tarifs/config/permissions.php +++ /dev/null @@ -1,271 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if (!$user->rights->telephonie->tarif->permission) - accessforbidden(); - -if ($_POST["action"] == 'perms') -{ - - if ($_POST["perms"] == 0) - { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_tarif_grille_rights"; - $sql .= " WHERE fk_user = '".$_POST["user"]."'"; - $sql .= " AND fk_grille = '".$_POST["grille"]."';"; - $db->query($sql); - } - - if ($_POST["perms"] == 1) - { - $sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_tarif_grille_rights"; - $sql .= " SET pread= 1, pwrite = 0, fk_user_creat ='".$user->id."' WHERE fk_user = '".$_POST["user"]."'"; - $sql .= " AND fk_grille = '".$_POST["grille"]."';"; - if ( $db->query($sql) ) - { - if ($db->affected_rows($resql) == 0) - { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_tarif_grille_rights"; - $sql .= " (pread,pwrite, fk_user, fk_grille, fk_user_creat) VALUES "; - $sql .= " (1,0,'".$_POST["user"]."','".$_POST["grille"]."','".$user->id."');"; - if ( $db->query($sql) ) - { - - } - } - } - } - - if ($_POST["perms"] == 2) - { - $sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_tarif_grille_rights"; - $sql .= " SET pread= 1, pwrite = 1, fk_user_creat ='".$user->id."' WHERE fk_user = '".$_POST["user"]."'"; - $sql .= " AND fk_grille = '".$_POST["grille"]."';"; - if ( $db->query($sql) ) - { - - if ($db->affected_rows($resql) == 0) - { - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_tarif_grille_rights"; - $sql .= " (pread,pwrite, fk_user, fk_grille, fk_user_creat) VALUES "; - $sql .= " (1,1,'".$_POST["user"]."','".$_POST["grille"]."','".$user->id."');"; - if ( $db->query($sql) ) - { - - } - else - { - print $sql; - } - } - - } - } - -} - - -llxHeader(); - -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - - - -/* - * - * - */ -$grilles = array(); -$sql = "SELECT d.rowid, d.libelle FROM ".MAIN_DB_PREFIX."telephonie_tarif_grille as d"; -$resql = $db->query($sql); -if ($resql) -{ - while ($row = $db->fetch_row($resql)) - { - $grilles[$row[0]] = $row[1]; - } - $db->free($resql); -} - -$users = array(); - -$sql = "SELECT u.rowid, u.firstname, u.name FROM ".MAIN_DB_PREFIX."user as u"; -$resql = $db->query($sql); -if ($resql) -{ - while ($row = $db->fetch_row($resql)) - { - $users[$row[0]] = $row[1] . ' '.$row[2]; - } - $db->free($resql); -} - -$form = new Form($db); -print '
'; -print ''; -print ''; -print ''; -print ''; -print ''; -print "\n"; - -print ''; -print ''; -print "\n"; -print "\n"; -print "
GrilleUtilisateurPermissions 
'; -print $form->select_array("grille",$grilles); -print ''; -print $form->select_array("user",$users); -print '
\n"; - - -/* - * - * - * - * - */ - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; -$sortfield = $_GET["sortfield"]; - -if ($sortorder == "") $sortorder="ASC"; -if ($sortfield == "") $sortfield="d.libelle ASC, d.rowid "; - -$offset = $conf->liste_limit * $page ; - -/* - * Mode Liste - * - * - * - */ - -$sql = "SELECT d.rowid as grille, d.libelle as tarif_desc, d.type_tarif"; -$sql .= " , u.login, u.name, u.firstname"; -$sql .= " , r.pread, r.pwrite"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_tarif_grille as d"; -$sql .= "," . MAIN_DB_PREFIX."telephonie_tarif_grille_rights as r"; -$sql .= "," . MAIN_DB_PREFIX."user as u"; - -$sqlc .= " WHERE d.rowid = r.fk_grille"; -$sqlc .= " AND r.fk_user = u.rowid"; - -if ($_GET["search_user"]) -{ - $sqlc .=" AND t.libelle LIKE '%".$_GET["search_libelle"]."%'"; -} - -if ($_GET["search_grille"]) -{ - $sqlc .=" AND d.libelle LIKE '%".$_GET["search_grille"]."%'"; -} - - -$sql = $sql . $sqlc . " ORDER BY u.name ASC " . $db->plimit($conf->liste_limit+1, $offset); - -$result = $db->query($sql); -if ($result) -{ - $num = $db->num_rows(); - $i = 0; - - print_barre_liste("Tarifs", $page, "index.php", "&type=".$_GET["type"], $sortfield, $sortorder, '', $num); - - print '
'; - - print ''; - print ''; - - print_liste_field_titre("Tarif","index.php","d.libelle"); - - print ''; - print "\n"; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - $var=True; - - while ($i < min($num,$conf->liste_limit)) - { - $obj = $db->fetch_object($i); - $var=!$var; - - print ""; - - print '\n"; - print '\n"; - - if ($obj->pread == 1) - { - print ''; - } - else - { - print ''; - } - - if ($obj->pwrite == 1) - { - print ''; - } - else - { - print ''; - } - print "\n"; - $i++; - } - print "
UtilisateurLectureEcriture
 
'; - print $obj->tarif_desc."'.$obj->firstname." ".$obj->name."'.img_tick().' '.img_tick().' 
"; - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/tarifs/config/pre.inc.php b/htdocs/telephonie/tarifs/config/pre.inc.php deleted file mode 100644 index 4c3d6b07035..00000000000 --- a/htdocs/telephonie/tarifs/config/pre.inc.php +++ /dev/null @@ -1,80 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("../../../main.inc.php"); - -$user->getrights('telephonie'); - -function llxHeader($head = "", $title="") { - global $user; - - /* - * - * - */ - top_menu($head, $title); - - $menu = new Menu(); - - $menu->add(DOL_URL_ROOT."/telephonie/index.php", "Telephonie"); - - if (TELEPHONIE_MODULE_SIMULATION == 1) - { - - $menu->add(DOL_URL_ROOT."/telephonie/simulation/fiche.php", "Simulation"); - $menu->add_submenu(DOL_URL_ROOT."/telephonie/simulation/fiche.php?action=create", "Nouvelle"); - } - - - $menu->add(DOL_URL_ROOT."/telephonie/client/index.php", "Clients"); - - $menu->add(DOL_URL_ROOT."/telephonie/contrat/", "Contrats"); - - $menu->add(DOL_URL_ROOT."/telephonie/ligne/index.php", "Lignes"); - - if ($user->rights->telephonie->ligne_commander) - $menu->add(DOL_URL_ROOT."/telephonie/ligne/commande/", "Commandes"); - - if ($user->rights->telephonie->stats->lire) - $menu->add(DOL_URL_ROOT."/telephonie/stats/", "Statistiques"); - - if ($user->rights->telephonie->facture->lire) - $menu->add(DOL_URL_ROOT."/telephonie/facture/", "Factures"); - - $menu->add(DOL_URL_ROOT."/telephonie/tarifs/", "Tarifs"); - $menu->add(DOL_URL_ROOT."/telephonie/tarifs/config/", "Tarifs (Configuration)"); - - $menu->add_submenu(DOL_URL_ROOT."/telephonie/tarifs/config/grilles.php", "Grilles"); - - $menu->add_submenu(DOL_URL_ROOT."/telephonie/tarifs/config/tarifs.php", "Tarifs"); - $menu->add_submenu(DOL_URL_ROOT."/telephonie/tarifs/config/prefixs.php", "Prefixs"); - - if ($user->rights->telephonie->tarif->permission) - $menu->add_submenu(DOL_URL_ROOT."/telephonie/tarifs/config/permissions.php", "Permissions"); - - if ($user->rights->telephonie->fournisseur->lire) - $menu->add(DOL_URL_ROOT."/telephonie/fournisseur/", "Fournisseurs"); - - - left_menu($menu->liste); -} - -?> diff --git a/htdocs/telephonie/tarifs/config/prefixs.php b/htdocs/telephonie/tarifs/config/prefixs.php deleted file mode 100644 index af4a84a818c..00000000000 --- a/htdocs/telephonie/tarifs/config/prefixs.php +++ /dev/null @@ -1,153 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -llxHeader(); - -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - - - -/* - * Recherche - * - * - */ -if ($mode == 'search') { - if ($mode-search == 'soc') { - $sql = "SELECT s.rowid as socid FROM ".MAIN_DB_PREFIX."societe as s "; - $sql .= " WHERE lower(s.nom) like '%".strtolower($socname)."%'"; - } - - if ( $db->query($sql) ) { - if ( $db->num_rows() == 1) { - $obj = $db->fetch_object(0); - $socid = $obj->socid; - } - $db->free(); - } -} - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; -$sortfield = $_GET["sortfield"]; - -if ($sortorder == "") $sortorder="ASC"; -if ($sortfield == "") $sortfield="p.prefix "; - -$offset = $conf->liste_limit * $page ; - -/* - * Mode Liste - * - * - * - */ - -$sql = "SELECT t.libelle as tarif, t.rowid as tarif_id"; -$sql .= " , p.prefix"; - -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_prefix as p"; -$sql .= "," . MAIN_DB_PREFIX."telephonie_tarif as t"; - -$sqlc .= " WHERE p.fk_tarif = t.rowid"; - - -if ($_GET["search_libelle"]) -{ - $sqlc .=" AND t.libelle LIKE '%".$_GET["search_libelle"]."%'"; -} - -if ($_GET["search_prefix"]) -{ - $sqlc .=" AND p.prefix LIKE '%".$_GET["search_prefix"]."%'"; -} - -if ($_GET["type"]) -{ - $sqlc .= " AND d.type_tarif = '".$_GET["type"]."'"; -} - -$sql = $sql . $sqlc . " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); - - -$resql = $db->query($sql); -if ($resql) -{ - $num = $db->num_rows($resql); - $i = 0; - - $urladd = "&type=".$_GET["type"]."&search_prefix=".$_GET["search_prefix"]."&search_libelle=".$_GET["search_libelle"]; - - print_barre_liste("Prefixs", $page, "prefixs.php", $urladd, $sortfield, $sortorder, '', $num); - - print ''; - print ''; - - print_liste_field_titre("Prefix","prefixs.php","p.prefix"); - print_liste_field_titre("Tarif","prefixs.php","t.libelle"); - - print "\n"; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - $var=True; - - while ($i < min($num,$conf->liste_limit)) - { - $obj = $db->fetch_object($resql); - $var=!$var; - - print ""; - print "\n"; - print '\n"; - print "\n"; - - $i++; - } - print "
 
".$obj->prefix."'; - print $obj->tarif." 
"; - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/tarifs/config/tarif.php b/htdocs/telephonie/tarifs/config/tarif.php deleted file mode 100644 index 74c0afa15f8..00000000000 --- a/htdocs/telephonie/tarifs/config/tarif.php +++ /dev/null @@ -1,251 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -require_once DOL_DOCUMENT_ROOT."/telephonie/telephonie.tarif.class.php"; -require_once DOL_DOCUMENT_ROOT."/telephonie/telephonie.tarif.prefix.class.php"; -$ta = new TelephonieTarif($db,1,0); -$ta->fetch($_GET["id"]); -$tp = new TelephonieTarifPrefix($db); - -if ($_POST["action"] == 'add_prefix') -{ - $result = $tp->Create($user, $_POST["prefix"], $_GET["id"], $_POST["force"]); - - //Header("Location: tarif.php?id=".$_GET["id"]); -} - -llxHeader(); - - -/* - * Mode Liste - * - */ -print_titre($ta->libelle); -print '
'; - -$sql = "SELECT d.libelle as tarif_desc, d.type_tarif, d.rowid"; -$sql .= " , t.libelle as tarif"; -$sql .= " , m.temporel, m.fixe"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_tarif_grille as d"; -$sql .= "," . MAIN_DB_PREFIX."telephonie_tarif_grille_rights as r"; -$sql .= "," . MAIN_DB_PREFIX."telephonie_tarif_montant as m"; -$sql .= "," . MAIN_DB_PREFIX."telephonie_tarif as t"; - -$sql .= " WHERE d.rowid = m.fk_tarif_desc"; -$sql .= " AND m.fk_tarif = t.rowid"; -$sql .= " AND t.rowid = '".$_GET["id"]."'"; -$sql .= " AND d.type_tarif = 'vente'"; -$sql .= " AND d.rowid = r.fk_grille"; -$sql .= " AND r.fk_user =".$user->id; -$sql .= " AND r.pread = 1"; - -$sql .= " ORDER BY t.libelle asc"; - -$resql = $db->query($sql); -if ($resql) -{ - $num = $db->num_rows(); - $i = 0; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; - - $var=True; - - while ($i < $num) - { - $obj = $db->fetch_object($resql); - $var=!$var; - - print ""; - - print '\n"; - - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - $i++; - } - print "
GrilleTarifCout / minCout fixeType
'; - print $obj->tarif_desc."".$obj->tarif."".sprintf("%01.4f",$obj->temporel)."".sprintf("%01.4f",$obj->fixe)."".$obj->type_tarif."
"; - $db->free($resql); -} -else -{ - print $db->error() . ' ' . $sql; -} - -$sql = "SELECT d.libelle as tarif_desc, d.type_tarif, d.rowid"; -$sql .= " , t.libelle as tarif"; -$sql .= " , m.temporel, m.fixe"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_tarif_grille as d"; -$sql .= "," . MAIN_DB_PREFIX."telephonie_tarif_grille_rights as r"; -$sql .= "," . MAIN_DB_PREFIX."telephonie_tarif_montant as m"; -$sql .= "," . MAIN_DB_PREFIX."telephonie_tarif as t"; - -$sql .= " WHERE d.rowid = m.fk_tarif_desc"; -$sql .= " AND m.fk_tarif = t.rowid"; -$sql .= " AND t.rowid = '".$_GET["id"]."'"; -$sql .= " AND d.type_tarif = 'achat'"; -$sql .= " AND d.rowid = r.fk_grille"; -$sql .= " AND r.fk_user =".$user->id; -$sql .= " AND r.pread = 1"; -$sql .= " ORDER BY t.libelle ASC"; - -$resql = $db->query($sql); -if ($resql) -{ - $num = $db->num_rows($resql); - $i = 0; - - print '
'; - print ''; - - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; - - $var=True; - - while ($i < $num) - { - $obj = $db->fetch_object($resql); - $var=!$var; - - print ""; - - print '\n"; - - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - $i++; - } - print "
GrilleTarifCout / minCout fixeType
'; - print $obj->tarif_desc."".$obj->tarif."".sprintf("%01.4f",$obj->temporel)."".sprintf("%01.4f",$obj->fixe)."".$obj->type_tarif."
"; - $db->free($resql); -} -else -{ - print $db->error() . ' ' . $sql; -} - - -print '
'; - -$sql = "SELECT prefix"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_prefix"; -$sql .= " WHERE fk_tarif = ".$_GET["id"]; -$sql .= " ORDER BY prefix ASC"; - -$resql = $db->query($sql); -if ($resql) -{ - $num = $db->num_rows($resql); - $i = 0; - - print ''; - print ''; - print ''; - print "\n"; - - $var=True; - - while ($i < $num) - { - $obj = $db->fetch_object($resql); - $var=!$var; - - print ""; - print "\n"; - print "\n"; - $i++; - } - print "
Prefix
".$obj->prefix."
"; - $db->free($resql); -} -else -{ - print $db->error() . ' ' . $sql; -} - - -print '
'; -print ''; -print ''; - -print ''; - -// Nom -print ''; -print ''; - -if ($tp->tarif_id > 0) -{ - print ''; - print ''; -} - -print ''; - -print '
Prefix
Forcer la recuperation
'; - - -if ($tp->tarif_id > 0) -{ - - $etarif = new TelephonieTarif($db,1,0); - $etarif->Fetch($tp->tarif_id); - - print '
'; - - print ''; - print ''; - - print '
Erreur
Le prefix '.$_POST["prefix"].' existe deja !
'; - print 'Il est affecte au tarif : '.$etarif->libelle.'
'; - print 'Vous pouvez le reaffecter a ce tarif en cochant la case "Forcer la recuperation"'; - print '
'; - -} - -print '
'; - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/tarifs/config/tarifs.php b/htdocs/telephonie/tarifs/config/tarifs.php deleted file mode 100644 index 5fe741a602b..00000000000 --- a/htdocs/telephonie/tarifs/config/tarifs.php +++ /dev/null @@ -1,121 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; -$sortfield = $_GET["sortfield"]; - -/* - * - * - */ -if ($_POST["action"] == 'add') -{ - - require_once DOL_DOCUMENT_ROOT."/telephonie/telephonie.tarif.class.php"; - - $ob = new TelephonieTarif($db,1,0); - - $ob->CreateTarif($_POST["nom"], $_POST["type"]); - - Header("Location: tarifs.php"); - -} - -llxHeader(); - -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - - -print '
'; -print ''; -print ''; - -print ''; - -// Nom -print "".''; -print ''; -print "".''; -print "".''; - -print '
'.$langs->trans("Lastname").'*'; -print ''; - -print '
Type de grille
'; - - -print '
'; -print '
'; - -$sql = "SELECT tt.libelle as tarif_desc, tt.rowid, tt.type"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_tarif as tt"; -$sql .= " ORDER BY tt.libelle;"; - -$result = $db->query($sql); -if ($result) -{ - $num = $db->num_rows(); - $i = 0; - - print ''; - print ''; - print ""; - print "\n"; - - $var=True; - - while ($i < $num) - { - $obj = $db->fetch_object($i); - $var=!$var; - - print ""; - print '\n"; - print '\n"; - print "\n"; - $i++; - } - print "
TarifsType
'.$obj->tarif_desc."'.$obj->type."
"; - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - -print '
'; - - - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/tarifs/fiche.php b/htdocs/telephonie/tarifs/fiche.php deleted file mode 100644 index 2aa97b46a81..00000000000 --- a/htdocs/telephonie/tarifs/fiche.php +++ /dev/null @@ -1,152 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -require("./pre.inc.php"); - -$mesg = ''; - -llxHeader("","","Fiche Tarif"); - -if ($cancel == $langs->trans("Cancel")) -{ - $action = ''; -} -/* - * Affichage - * - */ -/* - * Cr�ation - * - */ - - -if ($_GET["id"]) -{ - - - $h=0; - $head[$h][0] = DOL_URL_ROOT."/telephonie/tarifs/fiche.php?id=".$soc->id; - $head[$h][1] = $langs->trans("Lignes"); - $hselected = $h; - $h++; - - dol_fiche_head($head, $hselected, 'Tarif : '.$soc->nom); - - print ''; - print ''; - - print ""; - - print ''; - print ''; - print ''; - - print ''; - - print '
'.$langs->trans('Name').''.$soc->nom.''.$langs->trans('Prefix').''.$soc->prefix_comm.'
".$langs->trans('Address')."".nl2br($soc->adresse)."
".$soc->cp." ".$soc->ville." ".$soc->pays."
'.$langs->trans('Phone').''.dol_print_phone($soc->tel,$soc->pays_code,0,$soc->id).''.$langs->trans('Fax').''.dol_print_phone($soc->fax,$soc->pays_code,0,$soc->id).'
'.$langs->trans('Web').''; - if ($soc->url) { print 'http://'.$soc->url.''; } - print '
'.img_edit() ." "; - print $langs->trans('RIB').''; - print $soc->display_rib(); - print '

'; - - print ''; - - //print ''; - //print ''; - - /* Lignes */ - - $sql = "SELECT s.rowid as socid, s.nom, l.ligne, f.nom as fournisseur, l.statut, l.rowid, l.remise"; - $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_fournisseur as f"; - $sql .= " WHERE l.fk_soc = s.rowid AND l.fk_fournisseur = f.rowid"; - $sql .= " AND s.rowid = ".$soc->id; - - if ( $db->query( $sql) ) - { - $num = $db->num_rows(); - if ( $num > 0 ) - { - $i = 0; - - $ligne = new LigneTel($db); - - print ''; - - print "\n"; - - while ($i < $num) - { - $obj = $db->fetch_object($i); - $var=!$var; - - print "\n"; - - print '\n"; - - print '\n"; - print "\n"; - print "\n"; - $i++; - } - } - $db->free(); - - } - else - { - print $sql; - } - - print "
Num�ro'.dol_print_phone($ligne->numero).'Factur�e : '.$ligne->facturable.'
Ligne'; - print 'StatutRemise LMN'; - print 'Fournisseur
"; - - print ' '; - - print ''; - print img_file(); - - print ' '; - - print ''.dol_print_phone($obj->ligne,0,0,true)."'.$ligne->statuts[$obj->statut]."'.$obj->remise." %".$obj->fournisseur."
"; -} -else -{ - print "Error"; -} - - -print ''; - -/* ************************************************************************** */ -/* */ -/* Barre d'action */ -/* */ -/* ************************************************************************** */ - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/tarifs/grille-export-achat.php b/htdocs/telephonie/tarifs/grille-export-achat.php deleted file mode 100644 index ebaccbb2415..00000000000 --- a/htdocs/telephonie/tarifs/grille-export-achat.php +++ /dev/null @@ -1,239 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); -require_once DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_workbook.inc.php"; -require_once DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_worksheet.inc.php"; - -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -$date = time(); - -$fname = ("/tmp/achat-".strftime("%Y-%m-%d", $date).".xls"); -$fna = ("achat-".strftime("%Y-%m-%d", $date).".xls"); -$workbook = &new writeexcel_workbook($fname); - -/* - * Comparatif - * - */ - -$sheetcomp = &$workbook->addworksheet("Comparatif"); - -$sheetcomp->set_column('A:A', 40); -$sheetcomp->set_column('B:F', 10); - - -$num1_format =& $workbook->addformat(array(num_format => '#0.0000')); -$num1_format->set_align('center'); -$num1_format->set_align('vcenter'); - -$num2_format =& $workbook->addformat(array(num_format => '#0.0000')); -$num2_format->set_right(1); -$num2_format->set_align('center'); -$num2_format->set_align('vcenter'); - -$num3_format =& $workbook->addformat(array(num_format => '#0.0000')); -$num3_format->set_left(1); -$num3_format->set_align('center'); -$num3_format->set_align('vcenter'); - -$num3_format_best =& $workbook->addformat(array(num_format => '#0.0000')); -$num3_format_best->set_left(1); -$num3_format_best->set_align('center'); -$num3_format_best->set_align('vcenter'); -$num3_format_best->set_color('green'); - - -$formatcc =& $workbook->addformat(); -$formatcc->set_align('center'); -$formatcc->set_align('vcenter'); -$formatcc->set_border(1); - -$sheetcomp->write(2, 0, "Tarif"); - -$sql = "SELECT d.rowid, d.libelle as grille"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_tarif_grille as d"; -$sql .= " WHERE d.type_tarif = 'achat'"; -$sql .= " ORDER BY d.rowid ASC"; -$resql = $db->query($sql); -if ($resql) -{ - $num = $db->num_rows($resql); - $i = 0; - $a = 1; - - while ($i < $num) - { - $obj = $db->fetch_object($resql); - - $grilles[$i] = $obj->rowid; - - $sheetcomp->write(1, $a, $obj->grille); - - $sheetcomp->write(2, $a, "/min", $formatcc); - $sheetcomp->write(2, ($a+1), "Fixe", $formatcc); - - $a = $a + 2; - $i++; - } -} -else -{ - print $db->error(); -} - -$types = array('NAT','MOB','INT'); - -$j = 3; - -foreach ($types as $type) -{ - $tarifs = array(); - - $sql = "SELECT t.libelle, t.rowid, t.type"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_tarif as t"; - $sql .= " WHERE t.type = '".$type."' ORDER BY t.libelle ASC"; - - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - - while ($i < $num) - { - $obj = $db->fetch_object($i); - - $tid = $obj->rowid; - - $tarifs[$tid][0] = $obj->libelle; - $i++; - } - } - - $ig = 0; - - foreach($grilles as $grille) - { - $sql = "SELECT t.libelle, d.libelle as grille, m.temporel, m.fixe, t.rowid, t.type"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_tarif_grille as d"; - $sql .= "," . MAIN_DB_PREFIX."telephonie_tarif_montant as m"; - $sql .= "," . MAIN_DB_PREFIX."telephonie_tarif as t"; - $sql .= " WHERE d.rowid = m.fk_tarif_desc"; - $sql .= " AND m.fk_tarif = t.rowid AND d.rowid = ".$grille; - $sql .= " AND t.type = '".$type."' ORDER BY d.libelle ASC"; - - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - - while ($i < $num) - { - $obj = $db->fetch_object($i); - - $tid = $obj->rowid; - - $tarifs[$tid][$ig+1] = $obj->temporel; - $tarifs[$tid][$ig+2] = $obj->fixe; - $i++; - } - } - $ig = $ig + 2; - } - - foreach($tarifs as $tarif) - { - $sheetcomp->write($j, 0, $tarif[0]); - - $ig = 0; - - $min = $tarif[$ig+1]; - $igmin = 0; - - foreach($grilles as $grille) - { - $format = $num3_format; - - if ($tarif[$ig+1] < $min) - { - $min = $tarif[$ig+1]; - $igmin = $ig; - } - - $ig = $ig + 2; - } - - $ig = 0; - - foreach($grilles as $grille) - { - $format = $num3_format; - - if ($igmin == $ig) - { - $format = $num3_format_best; - } - - $sheetcomp->write($j, ($ig+1), $tarif[$ig+1], $format); - - if ($tarif[$ig+2] > 0) - { - $sheetcomp->write($j, ($ig+2), $tarif[$ig+2], $num2_format); - } - else - { - $sheetcomp->write_string($j, ($ig+2), "-", $num2_format); - } - $ig = $ig + 2; - } - - $j++; - } - - $sheetcomp->write_blank($j, 1, $num3_format); - $sheetcomp->write_blank($j, 2, $num2_format); - $sheetcomp->write_blank($j, 4, $num2_format); - - $j++; -} - - -$sheetcomp->write(0, 0, "Tarifs d'achats comparés au ".strftime("%d %m %Y",$date) ); - -$workbook->close(); -$db->close(); - -Header("Content-Disposition: attachment; filename=$fna"); -Header("Content-Type: application/x-msexcel"); -$fh=fopen($fname, "rb"); -fpassthru($fh); -//unlink($fname); -?> diff --git a/htdocs/telephonie/tarifs/grille-export.php b/htdocs/telephonie/tarifs/grille-export.php deleted file mode 100644 index 648b8312f79..00000000000 --- a/htdocs/telephonie/tarifs/grille-export.php +++ /dev/null @@ -1,115 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); -require_once DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_workbook.inc.php"; -require_once DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_worksheet.inc.php"; - -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -$date = time(); - -$fname = ("/tmp/tarifs-".strftime("%Y-%m-%d", $date).".xls"); -$workbook = &new writeexcel_workbook($fname); - -$worksheet = &$workbook->addworksheet("Tarif"); - -$worksheet->set_column('A:A', 20); -$worksheet->set_column('B:B', 40); -$worksheet->set_column('C:E', 10); - -$num1_format =& $workbook->addformat(array(num_format => '#0.0000')); - -$formatcc =& $workbook->addformat(); -$formatcc->set_align('center'); -$formatcc->set_align('vcenter'); - -$worksheet->write(2, 0, "Grille"); -$worksheet->write(2, 1, "Tarif"); -$worksheet->write(2, 2, "/min"); -$worksheet->write(2, 3, "Fixe"); -$worksheet->write(2, 4, "Type", $formatcc); - -$types = array('NAT','MOB','INT'); - -$j = 3; - -foreach ($types as $type) -{ - $sql = "SELECT t.libelle, d.libelle as grille, m.temporel, m.fixe, t.rowid, t.type"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_tarif_grille as d"; - $sql .= "," . MAIN_DB_PREFIX."telephonie_tarif_montant as m"; - $sql .= "," . MAIN_DB_PREFIX."telephonie_tarif as t"; - - $sql .= " WHERE d.rowid = m.fk_tarif_desc"; - $sql .= " AND m.fk_tarif = t.rowid"; - - $sql .= " AND d.rowid = '".$_GET["id"]."'"; - $sql .= " AND t.type = '".$type."'"; - $sql .= " ORDER BY d.libelle ASC"; - - - $result = $db->query($sql); - if ($result) - { - $num = $db->num_rows(); - $i = 0; - - while ($i < $num) - { - $obj = $db->fetch_object($i); - - $worksheet->write($j, 0, $obj->grille); - $worksheet->write($j, 1, $obj->libelle); - $worksheet->write($j, 2, $obj->temporel, $num1_format); - $worksheet->write($j, 3, $obj->fixe, $num1_format); - $worksheet->write($j, 4, $obj->type, $formatcc); - $j++; - $i++; - } - - $db->free(); - } - else - { - print $db->error() . ' ' . $sql; - } - $j++; -} - -$worksheet->write(0, 0, "Tarifs au ".strftime("%d %m %Y",$date) ); - -$workbook->close(); -$db->close(); - -Header("Content-Disposition: attachment; filename=$fname"); -header("Content-Type: application/x-msexcel"); -$fh=fopen($fname, "rb"); -fpassthru($fh); -@unlink($fname); -?> diff --git a/htdocs/telephonie/tarifs/grille.php b/htdocs/telephonie/tarifs/grille.php deleted file mode 100644 index 1b3092f9a46..00000000000 --- a/htdocs/telephonie/tarifs/grille.php +++ /dev/null @@ -1,293 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; -$sortfield = $_GET["sortfield"]; - -$sql = "SELECT pwrite, pread "; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_tarif_grille_rights "; -$sql .= " WHERE fk_grille = '".$_GET["id"]."'"; -$sql .= " AND fk_user = ".$user->id; - -$auth_write = 0; - -$resql = $db->query($sql); -if ($resql) -{ - $num = $db->num_rows(); - $i = 0; - - if ($num > 0) - { - $row = $db->fetch_row($resql); - $auth_write = $row[0]; - $auth_read = $row[1]; - } - $db->free($resql); -} - -if ($auth_read == 0) - accessforbidden(); - -/* - * - * - */ -if ($_POST["action"] == 'modif' && $auth_write) -{ - $sortorder = "DESC"; - $sortfield = "m.tms"; - - $temporel = ereg_replace(",",".",$_POST["temporel"]); - $fixe = ereg_replace(",",".",$_POST["fixe"]); - - if ($temporel > 0 or $_POST["gratuit"] == 'on') - { - require_once DOL_DOCUMENT_ROOT."/telephonie/telephonie.tarif.grille.class.php"; - - $obgrille = new TelephonieTarifGrille($db); - - $obgrille->UpdateTarif($_GET["id"], $_POST["tarif"], $temporel, $fixe, $user); - - Header("Location: grille.php?id=".$_GET["id"]); - } -} - -llxHeader(); - -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - - - - -/* - * Mode Liste - * - * - * - */ -print ''; -print '
'; - -$sql = "SELECT d.libelle as tarif_desc, d.type_tarif"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_tarif_grille as d"; -$sql .= " WHERE d.rowid = '".$_GET["id"]."'"; - -$resql = $db->query($sql); -if ($resql) -{ - $num = $db->num_rows(); - $i = 0; - - if ($num > 0) - { - $grille = $db->fetch_row($resql); - } -} - -print "Grille : ".$grille[0]."
"; - -//print 'Export tableur

'; - -if ($auth_write) -{ - - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - - print ''; - print ''; - - print ''; - print ''; - - print ''; - print ''; - - print ''; - print '
Modification
Tarif
Cout minute
Cout connexion
Numero gratuit
'; - -} - - -print '
'; -print ''; - -$sql = "SELECT u.name, u.firstname"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_tarif_grille_rights as r"; -$sql .= " , ".MAIN_DB_PREFIX."user as u"; -$sql .= " WHERE r.fk_grille = '".$_GET["id"]."'"; -$sql .= " AND r.fk_user = u.rowid "; -$sql .= " AND r.pwrite = 1"; - -$resql = $db->query($sql); -if ($resql) -{ - $num = $db->num_rows(); - $i = 0; - while ($i < $num ) - { - $row = $db->fetch_row($resql); - print ''; - $i++; - } -} -print '
Personnes pouvant modifier cette grille :
- '.$row[1] . ' '.$row[0].'
'; - - -print '
'; -print ''; -print ''; -print '
Export :
- fichier format tableur
'; - -print '
'; - - - -if ($sortorder == "") $sortorder="ASC"; -if ($sortfield == "") $sortfield="t.libelle ASC, d.rowid "; - -$offset = $conf->liste_limit * $page ; - - -$sql = "SELECT d.libelle as tarif_desc, d.type_tarif"; -$sql .= " , t.libelle as tarif"; -$sql .= " , m.temporel, m.fixe, t.rowid"; -$sql .= " , u.login"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_tarif_grille as d"; -$sql .= "," . MAIN_DB_PREFIX."telephonie_tarif_montant as m"; -$sql .= "," . MAIN_DB_PREFIX."telephonie_tarif as t"; -$sql .= "," . MAIN_DB_PREFIX."user as u"; - -$sqlc .= " WHERE d.rowid = m.fk_tarif_desc"; -$sqlc .= " AND m.fk_tarif = t.rowid"; -$sqlc .= " AND m.fk_user = u.rowid"; - -$sqlc .= " AND d.rowid = '".$_GET["id"]."'"; - - -if ($_GET["search_libelle"]) -{ - $sqlc .=" AND t.libelle LIKE '%".$_GET["search_libelle"]."%'"; -} - -if ($_GET["search_prefix"]) -{ - $sqlc .=" AND tf.prefix LIKE '%".$_GET["search_prefix"]."%'"; -} - -if ($_GET["type"]) -{ - $sqlc .= " AND d.type_tarif = '".$_GET["type"]."'"; -} - - -$sql = $sql . $sqlc . " ORDER BY $sortfield $sortorder"; - -$result = $db->query($sql); -if ($result) -{ - $num = $db->num_rows(); - $i = 0; - - print ''; - print ''; - - print_liste_field_titre("Grille","grille.php","d.libelle"); - print_liste_field_titre("Tarif","grille.php","t.libelle", "&type=".$_GET["type"]); - print_liste_field_titre("Cout / min","grille.php","temporel", "&type=".$_GET["type"]); - print ""; - print ""; - print ""; - print "\n"; - - $var=True; - - while ($i < $num) - { - $obj = $db->fetch_object($i); - $var=!$var; - - print ""; - - print "\n"; - print '\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - $i++; - } - print "
Cout fixeTypeUser
".$obj->tarif_desc."'.$obj->tarif."".sprintf("%01.4f",$obj->temporel)."".sprintf("%01.4f",$obj->fixe)."".$obj->type_tarif."".$obj->login."
"; - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - -print '
'; - - - - - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/tarifs/grilles.php b/htdocs/telephonie/tarifs/grilles.php deleted file mode 100644 index d6f8d358d1c..00000000000 --- a/htdocs/telephonie/tarifs/grilles.php +++ /dev/null @@ -1,95 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -llxHeader(); - -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -/* - * Mode Liste - * - * - * - */ -print ''; -print '
'; - -$sql = "SELECT d.libelle as tarif_desc, d.rowid, d.type_tarif"; - -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_tarif_grille as d"; -$sql .= "," . MAIN_DB_PREFIX."telephonie_tarif_grille_rights as r"; -$sql .= " WHERE d.rowid = r.fk_grille"; -$sql .= " AND r.fk_user =".$user->id; -$sql .= " AND r.pread = 1"; - - -$sql .= " ORDER BY d.rowid"; - -$result = $db->query($sql); -if ($result) -{ - $num = $db->num_rows(); - $i = 0; - - print ''; - print ''; - print ""; - print "\n"; - - $var=True; - - while ($i < $num) - { - $obj = $db->fetch_object($i); - $var=!$var; - - print ""; - print '\n"; - print '\n"; - print "\n"; - $i++; - } - print "
GrilleType
'.$obj->tarif_desc."'.$obj->type_tarif."
"; - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - -print '
'; - - -print '
Tableur des tarifs d\'achats comparés'; - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/tarifs/index.php b/htdocs/telephonie/tarifs/index.php deleted file mode 100644 index 228de107a06..00000000000 --- a/htdocs/telephonie/tarifs/index.php +++ /dev/null @@ -1,173 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -llxHeader(); - -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - - - -/* - * Recherche - * - * - */ -if ($mode == 'search') { - if ($mode-search == 'soc') { - $sql = "SELECT s.rowid as socid FROM ".MAIN_DB_PREFIX."societe as s "; - $sql .= " WHERE lower(s.nom) like '%".strtolower($socname)."%'"; - } - - if ( $db->query($sql) ) { - if ( $db->num_rows() == 1) { - $obj = $db->fetch_object(0); - $socid = $obj->socid; - } - $db->free(); - } -} - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; -$sortfield = $_GET["sortfield"]; - -if ($sortorder == "") $sortorder="ASC"; -if ($sortfield == "") $sortfield="t.libelle ASC, d.rowid "; - -$offset = $conf->liste_limit * $page ; - -/* - * Mode Liste - * - * - * - */ - -$sql = "SELECT d.rowid as grille, d.libelle as tarif_desc, d.type_tarif"; -$sql .= " , t.libelle as tarif, t.rowid as tarif_id"; -$sql .= " , m.temporel, m.fixe"; -$sql .= " , u.login"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_tarif_grille as d"; -$sql .= "," . MAIN_DB_PREFIX."telephonie_tarif_grille_rights as r"; -$sql .= "," . MAIN_DB_PREFIX."telephonie_tarif_montant as m"; -$sql .= "," . MAIN_DB_PREFIX."telephonie_tarif as t"; -$sql .= "," . MAIN_DB_PREFIX."user as u"; - -$sqlc .= " WHERE d.rowid = m.fk_tarif_desc"; -$sqlc .= " AND m.fk_tarif = t.rowid"; -$sqlc .= " AND m.fk_user = u.rowid"; - -$sqlc .= " AND d.rowid = r.fk_grille"; -$sqlc .= " AND r.fk_user =".$user->id; -$sqlc .= " AND r.pread = 1"; - -if ($_GET["search_libelle"]) -{ - $sqlc .=" AND t.libelle LIKE '%".$_GET["search_libelle"]."%'"; -} - -if ($_GET["search_grille"]) -{ - $sqlc .=" AND d.libelle LIKE '%".$_GET["search_grille"]."%'"; -} - -if ($_GET["type"]) -{ - $sqlc .= " AND d.type_tarif = '".$_GET["type"]."'"; -} - -$sql = $sql . $sqlc . " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); - - -$resql = $db->query($sql); -if ($resql) -{ - $num = $db->num_rows($resql); - $i = 0; - - print_barre_liste("Tarifs", $page, "index.php", "&type=".$_GET["type"], $sortfield, $sortorder, '', $num); - - print ''; - print ''; - - print_liste_field_titre("Tarif","index.php","d.libelle"); - - print_liste_field_titre("Destination","index.php","t.libelle", "&type=".$_GET["type"]); - - print_liste_field_titre("Cout / min","index.php","temporel", "&type=".$_GET["type"]); - print ""; - print ""; - print ''; - print "\n"; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - $var=True; - - while ($i < min($num,$conf->liste_limit)) - { - $obj = $db->fetch_object($resql); - $var=!$var; - - print ""; - - print '\n"; - print '\n"; - print "\n"; - print "\n"; - print '\n"; - print '\n"; - print "\n"; - $i++; - } - print "
Cout fixeTypeUser
   
'; - print $obj->tarif_desc."'; - print $obj->tarif."".sprintf("%01.4f",$obj->temporel)."".sprintf("%01.4f",$obj->fixe)."'.$obj->type_tarif."'.$obj->login."
"; - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/tarifs/permissions.php b/htdocs/telephonie/tarifs/permissions.php deleted file mode 100644 index f63beb8227d..00000000000 --- a/htdocs/telephonie/tarifs/permissions.php +++ /dev/null @@ -1,271 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -if (!$user->rights->telephonie->tarif->permission) - accessforbidden(); - -if ($_POST["action"] == 'perms') -{ - - if ($_POST["perms"] == 0) - { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_tarif_grille_rights"; - $sql .= " WHERE fk_user = '".$_POST["user"]."'"; - $sql .= " AND fk_grille = '".$_POST["grille"]."';"; - $db->query($sql); - } - - if ($_POST["perms"] == 1) - { - $sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_tarif_grille_rights"; - $sql .= " SET pread= 1, pwrite = 0, fk_user_creat ='".$user->id."' WHERE fk_user = '".$_POST["user"]."'"; - $sql .= " AND fk_grille = '".$_POST["grille"]."';"; - if ( $db->query($sql) ) - { - if ($db->affected_rows($resql) == 0) - { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_tarif_grille_rights"; - $sql .= " (pread,pwrite, fk_user, fk_grille, fk_user_creat) VALUES "; - $sql .= " (1,0,'".$_POST["user"]."','".$_POST["grille"]."','".$user->id."');"; - if ( $db->query($sql) ) - { - - } - } - } - } - - if ($_POST["perms"] == 2) - { - $sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_tarif_grille_rights"; - $sql .= " SET pread= 1, pwrite = 1, fk_user_creat ='".$user->id."' WHERE fk_user = '".$_POST["user"]."'"; - $sql .= " AND fk_grille = '".$_POST["grille"]."';"; - if ( $db->query($sql) ) - { - - if ($db->affected_rows($resql) == 0) - { - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_tarif_grille_rights"; - $sql .= " (pread,pwrite, fk_user, fk_grille, fk_user_creat) VALUES "; - $sql .= " (1,1,'".$_POST["user"]."','".$_POST["grille"]."','".$user->id."');"; - if ( $db->query($sql) ) - { - - } - else - { - print $sql; - } - } - - } - } - -} - - -llxHeader(); - -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - - - -/* - * - * - */ -$grilles = array(); -$sql = "SELECT d.rowid, d.libelle FROM ".MAIN_DB_PREFIX."telephonie_tarif_grille as d"; -$resql = $db->query($sql); -if ($resql) -{ - while ($row = $db->fetch_row($resql)) - { - $grilles[$row[0]] = $row[1]; - } - $db->free($resql); -} - -$users = array(); - -$sql = "SELECT u.rowid, u.firstname, u.name FROM ".MAIN_DB_PREFIX."user as u"; -$resql = $db->query($sql); -if ($resql) -{ - while ($row = $db->fetch_row($resql)) - { - $users[$row[0]] = $row[1] . ' '.$row[2]; - } - $db->free($resql); -} - -$form = new Form($db); -print '
'; -print ''; -print ''; -print ''; -print ''; -print ''; -print "\n"; - -print ''; -print ''; -print "\n"; -print "\n"; -print "
GrilleUtilisateurPermissions 
'; -print $form->select_array("grille",$grilles); -print ''; -print $form->select_array("user",$users); -print '
\n"; - - -/* - * - * - * - * - */ - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; -$sortfield = $_GET["sortfield"]; - -if ($sortorder == "") $sortorder="ASC"; -if ($sortfield == "") $sortfield="d.libelle ASC, d.rowid "; - -$offset = $conf->liste_limit * $page ; - -/* - * Mode Liste - * - * - * - */ - -$sql = "SELECT d.rowid as grille, d.libelle as tarif_desc, d.type_tarif"; -$sql .= " , u.login, u.name, u.firstname"; -$sql .= " , r.pread, r.pwrite"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_tarif_grille as d"; -$sql .= "," . MAIN_DB_PREFIX."telephonie_tarif_grille_rights as r"; -$sql .= "," . MAIN_DB_PREFIX."user as u"; - -$sqlc .= " WHERE d.rowid = r.fk_grille"; -$sqlc .= " AND r.fk_user = u.rowid"; - -if ($_GET["search_user"]) -{ - $sqlc .=" AND t.libelle LIKE '%".$_GET["search_libelle"]."%'"; -} - -if ($_GET["search_grille"]) -{ - $sqlc .=" AND d.libelle LIKE '%".$_GET["search_grille"]."%'"; -} - - -$sql = $sql . $sqlc . " ORDER BY u.name ASC " . $db->plimit($conf->liste_limit+1, $offset); - -$result = $db->query($sql); -if ($result) -{ - $num = $db->num_rows(); - $i = 0; - - print_barre_liste("Tarifs", $page, "index.php", "&type=".$_GET["type"], $sortfield, $sortorder, '', $num); - - print '
'; - - print ''; - print ''; - - print_liste_field_titre("Tarif","index.php","d.libelle"); - - print ''; - print "\n"; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - $var=True; - - while ($i < min($num,$conf->liste_limit)) - { - $obj = $db->fetch_object($i); - $var=!$var; - - print ""; - - print '\n"; - print '\n"; - - if ($obj->pread == 1) - { - print ''; - } - else - { - print ''; - } - - if ($obj->pwrite == 1) - { - print ''; - } - else - { - print ''; - } - print "\n"; - $i++; - } - print "
UtilisateurLectureEcriture
 
'; - print $obj->tarif_desc."'.$obj->firstname." ".$obj->name."'.img_tick().' '.img_tick().' 
"; - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/tarifs/pre.inc.php b/htdocs/telephonie/tarifs/pre.inc.php deleted file mode 100644 index 1ae045887ef..00000000000 --- a/htdocs/telephonie/tarifs/pre.inc.php +++ /dev/null @@ -1,77 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("../../main.inc.php"); - -$user->getrights('telephonie'); - -function llxHeader($head = "", $title="") { - global $user; - - /* - * - * - */ - top_menu($head, $title); - - $menu = new Menu(); - - $menu->add(DOL_URL_ROOT."/telephonie/index.php", "Telephonie"); - - if (TELEPHONIE_MODULE_SIMULATION == 1) - { - $menu->add(DOL_URL_ROOT."/telephonie/simulation/fiche.php", "Simulation"); - $menu->add_submenu(DOL_URL_ROOT."/telephonie/simulation/fiche.php?action=create", "Nouvelle"); - } - - - $menu->add(DOL_URL_ROOT."/telephonie/client/index.php", "Clients"); - - $menu->add(DOL_URL_ROOT."/telephonie/contrat/", "Contrats"); - - $menu->add(DOL_URL_ROOT."/telephonie/ligne/index.php", "Lignes"); - - if ($user->rights->telephonie->ligne_commander) - $menu->add(DOL_URL_ROOT."/telephonie/ligne/commande/", "Commandes"); - - if ($user->rights->telephonie->stats->lire) - $menu->add(DOL_URL_ROOT."/telephonie/stats/", "Statistiques"); - - if ($user->rights->telephonie->facture->lire) - $menu->add(DOL_URL_ROOT."/telephonie/facture/", "Factures"); - - $menu->add(DOL_URL_ROOT."/telephonie/tarifs/", "Tarifs"); - - $menu->add_submenu(DOL_URL_ROOT."/telephonie/tarifs/grilles.php", "Grilles"); - - $menu->add_submenu(DOL_URL_ROOT."/telephonie/tarifs/prefix.php", "Prefix"); - - if ($user->rights->telephonie->tarif->permission) - $menu->add_submenu(DOL_URL_ROOT."/telephonie/tarifs/config/", "Configuration"); - - if ($user->rights->telephonie->fournisseur->lire) - $menu->add(DOL_URL_ROOT."/telephonie/fournisseur/", "Fournisseurs"); - - - left_menu($menu->liste); -} - -?> diff --git a/htdocs/telephonie/tarifs/prefix.php b/htdocs/telephonie/tarifs/prefix.php deleted file mode 100644 index 33fd1833b11..00000000000 --- a/htdocs/telephonie/tarifs/prefix.php +++ /dev/null @@ -1,145 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; -$sortfield = $_GET["sortfield"]; - -llxHeader(); - -if ($_GET["type"] == '') -{ - $_GET["type"] = 'achat'; -} - -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} - -if ($sortorder == "") { - $sortorder="ASC"; -} -if ($sortfield == "") { - $sortfield="prefix, libelle, fournisseur"; -} - -/* - * Recherche - * - * - */ - -if ($page == -1) { $page = 0 ; } - -$offset = $conf->liste_limit * $page ; -$pageprev = $page - 1; -$pagenext = $page + 1; - -/* - * Mode Liste - * - * - * - */ - -$sql = "SELECT t.libelle as tarif, p.prefix"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_tarif as t"; -$sql .= "," . MAIN_DB_PREFIX."telephonie_prefix as p"; - -$sql .= " WHERE p.fk_tarif = t.rowid"; - -if ($_GET["search_tarif"]) -{ - $sql .=" AND t.libelle LIKE '%".$_GET["search_tarif"]."%'"; -} - -if ($_GET["search_prefix"]) -{ - $sql .=" AND p.prefix LIKE '%".$_GET["search_prefix"]."%'"; -} - -$sql .= " ORDER BY t.libelle ASC " . $db->plimit($conf->liste_limit+1, $offset); - - -$result = $db->query($sql); -if ($result) -{ - $num = $db->num_rows(); - $i = 0; - - $urladd = "&type=".$_GET["type"]."&search_prefix=".$_GET["search_prefix"]."&search_tarif=".$_GET["search_tarif"]; - - print_barre_liste("Prefix", $page, "prefix.php", $urladd, $sortfield, $sortorder, '', $num); - - print ''; - print ''; - - print_liste_field_titre("Tarif","prefix.php","f.nom","&search_prefix="); - - print_liste_field_titre("Prefix","prefix.php","libelle", "&type=".$_GET["type"]); - print ''; - - print "\n"; - - print ''; - print ''; - print ''; - print ''; - print ''; - - print ''; - print ''; - print ''; - - $var=True; - - while ($i < min($num,$conf->liste_limit)) - { - $obj = $db->fetch_object($i); - $var=!$var; - - print ""; - - print "\n"; - print "\n"; - print ''; - print "\n"; - $i++; - } - print "
 
".$obj->tarif."".$obj->prefix." 
"; - $db->free(); -} -else -{ - print $db->error() . ' ' . $sql; -} - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/tarifs/tarif-log.php b/htdocs/telephonie/tarifs/tarif-log.php deleted file mode 100644 index ae30069bd47..00000000000 --- a/htdocs/telephonie/tarifs/tarif-log.php +++ /dev/null @@ -1,188 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -llxHeader(); - -require_once DOL_DOCUMENT_ROOT."/telephonie/telephonie.tarif.class.php"; -$ta = new TelephonieTarif($db,1,0); -$ta->fetch($_GET["id"]); - - -$h = 0; -$head = array(); - -$head[$h][0] = DOL_URL_ROOT.'tarif.php?id='.$ta->id; -$head[$h][1] = $ta->libelle; -$head[$h][2] = 'card'; -$h++; - -$head[$h][0] = DOL_URL_ROOT.'tarif-log.php?id='.$ta->id; -$head[$h][1] = $langs->trans("Historique"); -$head[$h][2] = 'history'; -$h++; - -dol_fiche_head($head, 'history', $langs->trans("Tarif")); - -/* - * - * - * - */ -print '
'; - -$sql = "SELECT d.libelle as tarif_desc, d.type_tarif, d.rowid"; -$sql .= " , t.libelle as tarif"; -$sql .= " , m.temporel, m.fixe, u.name, u.firstname,".$db->pdate('m.tms')." as date"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_tarif_grille as d"; -$sql .= "," . MAIN_DB_PREFIX."telephonie_tarif_grille_rights as r"; -$sql .= "," . MAIN_DB_PREFIX."telephonie_tarif_montant_log as m"; -$sql .= "," . MAIN_DB_PREFIX."telephonie_tarif as t"; -$sql .= "," . MAIN_DB_PREFIX."user as u"; - -$sql .= " WHERE d.rowid = m.fk_tarif_desc"; -$sql .= " AND m.fk_tarif = t.rowid"; -$sql .= " AND t.rowid = '".$_GET["id"]."'"; -$sql .= " AND d.type_tarif = 'vente'"; -$sql .= " AND d.rowid = r.fk_grille"; -$sql .= " AND r.fk_user =".$user->id; -$sql .= " AND m.fk_user = u.rowid"; -$sql .= " AND r.pread = 1"; - -$sql .= " ORDER BY d.libelle ASC, t.libelle asc, m.tms desc"; - -$resql = $db->query($sql); -if ($resql) -{ - $num = $db->num_rows(); - $i = 0; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; - - $var=True; - - while ($i < $num) - { - $obj = $db->fetch_object($resql); - $var=!$var; - - print ""; - - print '\n"; - - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - $i++; - } - print "
Grille VenteTarifCout / minCout fixe'.$langs->trans('Date').''.$langs->trans('User').'
'; - print $obj->tarif_desc."".$obj->tarif."".sprintf("%01.4f",$obj->temporel)."".sprintf("%01.4f",$obj->fixe)."".dol_print_date($obj->date,'dayhour')."".stripslashes($obj->firstname)." ".stripslashes($obj->name)."
"; - $db->free($resql); -} -else -{ - print $db->error() . ' ' . $sql; -} - - -$sql = "SELECT d.libelle as tarif_desc, d.type_tarif, d.rowid"; -$sql .= " , t.libelle as tarif"; -$sql .= " , m.temporel, m.fixe, u.name, u.firstname,".$db->pdate('m.tms')." as date"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_tarif_grille as d"; -$sql .= "," . MAIN_DB_PREFIX."telephonie_tarif_grille_rights as r"; -$sql .= "," . MAIN_DB_PREFIX."telephonie_tarif_montant_log as m"; -$sql .= "," . MAIN_DB_PREFIX."telephonie_tarif as t"; -$sql .= "," . MAIN_DB_PREFIX."user as u"; - -$sql .= " WHERE d.rowid = m.fk_tarif_desc"; -$sql .= " AND m.fk_tarif = t.rowid"; -$sql .= " AND t.rowid = '".$_GET["id"]."'"; -$sql .= " AND d.type_tarif = 'achat'"; - -$sql .= " AND d.rowid = r.fk_grille"; -$sql .= " AND r.fk_user =".$user->id; -$sql .= " AND r.pread = 1"; -$sql .= " AND m.fk_user = u.rowid"; -$sql .= " ORDER BY t.libelle ASC"; - -$resql = $db->query($sql); -if ($resql) -{ - $num = $db->num_rows($resql); - $i = 0; - - print '
'; - print ''; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; - - $var=True; - - while ($i < $num) - { - $obj = $db->fetch_object($resql); - $var=!$var; - - print ""; - - print '\n"; - - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - $i++; - } - print "
Grille AchatTarifCout / minCout fixe'.$langs->trans('Date').''.$langs->trans('User').'
'; - print $obj->tarif_desc."".$obj->tarif."".sprintf("%01.4f",$obj->temporel)."".sprintf("%01.4f",$obj->fixe)."".dol_print_date($obj->date,'dayhour')."".stripslashes($obj->firstname)." ".stripslashes($obj->name)."
"; - $db->free($resql); -} -else -{ - print $db->error() . ' ' . $sql; -} - -print '
'; - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/tarifs/tarif.php b/htdocs/telephonie/tarifs/tarif.php deleted file mode 100644 index 717fe1839cf..00000000000 --- a/htdocs/telephonie/tarifs/tarif.php +++ /dev/null @@ -1,220 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php"); - -llxHeader(); - -require_once DOL_DOCUMENT_ROOT."/telephonie/telephonie.tarif.class.php"; -$ta = new TelephonieTarif($db,1,0); -$ta->fetch($_GET["id"]); - - -$h = 0; -$head = array(); - -$head[$h][0] = DOL_URL_ROOT.'tarif.php?id='.$ta->id; -$head[$h][1] = $ta->libelle; -$head[$h][2] = 'card'; -$h++; - -$head[$h][0] = DOL_URL_ROOT.'tarif-log.php?id='.$ta->id; -$head[$h][1] = $langs->trans("Historique"); -$head[$h][2] = 'history'; -$h++; - -dol_fiche_head($head, 'card', $langs->trans("Tarif")); - -/* - * - * - * - */ -print '
'; - -$sql = "SELECT d.libelle as tarif_desc, d.type_tarif, d.rowid"; -$sql .= " , t.libelle as tarif"; -$sql .= " , m.temporel, m.fixe"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_tarif_grille as d"; -$sql .= "," . MAIN_DB_PREFIX."telephonie_tarif_grille_rights as r"; -$sql .= "," . MAIN_DB_PREFIX."telephonie_tarif_montant as m"; -$sql .= "," . MAIN_DB_PREFIX."telephonie_tarif as t"; - -$sql .= " WHERE d.rowid = m.fk_tarif_desc"; -$sql .= " AND m.fk_tarif = t.rowid"; -$sql .= " AND t.rowid = '".$_GET["id"]."'"; -$sql .= " AND d.type_tarif = 'vente'"; -$sql .= " AND d.rowid = r.fk_grille"; -$sql .= " AND r.fk_user =".$user->id; -$sql .= " AND r.pread = 1"; - -$sql .= " ORDER BY t.libelle asc"; - -$resql = $db->query($sql); -if ($resql) -{ - $num = $db->num_rows(); - $i = 0; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; - - $var=True; - - while ($i < $num) - { - $obj = $db->fetch_object($resql); - $var=!$var; - - print ""; - - print '\n"; - - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - $i++; - } - print "
Grille venteTarifCout / minCout fixeType
'; - print $obj->tarif_desc."".$obj->tarif."".sprintf("%01.4f",$obj->temporel)."".sprintf("%01.4f",$obj->fixe)."".$obj->type_tarif."
"; - $db->free($resql); -} -else -{ - print $db->error() . ' ' . $sql; -} - - -$sql = "SELECT d.libelle as tarif_desc, d.type_tarif, d.rowid"; -$sql .= " , t.libelle as tarif"; -$sql .= " , m.temporel, m.fixe"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_tarif_grille as d"; -$sql .= "," . MAIN_DB_PREFIX."telephonie_tarif_grille_rights as r"; -$sql .= "," . MAIN_DB_PREFIX."telephonie_tarif_montant as m"; -$sql .= "," . MAIN_DB_PREFIX."telephonie_tarif as t"; - -$sql .= " WHERE d.rowid = m.fk_tarif_desc"; -$sql .= " AND m.fk_tarif = t.rowid"; -$sql .= " AND t.rowid = '".$_GET["id"]."'"; -$sql .= " AND d.type_tarif = 'achat'"; - -$sql .= " AND d.rowid = r.fk_grille"; -$sql .= " AND r.fk_user =".$user->id; -$sql .= " AND r.pread = 1"; - -$sql .= " ORDER BY t.libelle ASC"; - -$resql = $db->query($sql); -if ($resql) -{ - $num = $db->num_rows($resql); - $i = 0; - - print '
'; - print ''; - - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; - - $var=True; - - while ($i < $num) - { - $obj = $db->fetch_object($resql); - $var=!$var; - - print ""; - - print '\n"; - - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - $i++; - } - print "
Grille achatTarifCout / minCout fixeType
'; - print $obj->tarif_desc."".$obj->tarif."".sprintf("%01.4f",$obj->temporel)."".sprintf("%01.4f",$obj->fixe)."".$obj->type_tarif."
"; - $db->free($resql); -} -else -{ - print $db->error() . ' ' . $sql; -} - - -print '
'; - -$sql = "SELECT prefix"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_prefix"; -$sql .= " WHERE fk_tarif = ".$_GET["id"]; -$sql .= " ORDER BY prefix ASC"; - -$resql = $db->query($sql); -if ($resql) -{ - $num = $db->num_rows($resql); - $i = 0; - - print ''; - print ''; - print ''; - print "\n"; - - $var=True; - - while ($i < $num) - { - $obj = $db->fetch_object($resql); - $var=!$var; - - print ""; - print "\n"; - print "\n"; - $i++; - } - print "
Prefix
".$obj->prefix."
"; - $db->free($resql); -} -else -{ - print $db->error() . ' ' . $sql; -} - -print '
'; - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/telephonie/telephonie-tarif.class.php b/htdocs/telephonie/telephonie-tarif.class.php deleted file mode 100644 index 5675bcec7dc..00000000000 --- a/htdocs/telephonie/telephonie-tarif.class.php +++ /dev/null @@ -1,187 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * or see http://www.gnu.org/ - * - * $Id$ - * $Source$ - * - */ - -class TelephonieTarif { - - var $_DB; - var $tarif_fournisseur; - var $prefixes; - var $prefixe_max; - - /* - * Constructeur - * - */ - function TelephonieTarif($_DB, $fournisseur_id, $type, $client_id = 0) - { - $this->db = $_DB; - - $this->tarif_fournisseur = array(); - - $this->prefixes = array(); - - $this->client_id = $client_id; - - - for ($j = 0 ; $j++ ; $j < 10) - { - $this->prefixes[$j] = array(); - $this->prefixe_max = array(); - } - - $this->_load_tarif($fournisseur_id, $type); - - } - - - function _load_tarif($fournisseur_id, $type) - { - - if ($type == 'achat') - { - $sql = "SELECT prefix, temporel, fixe"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_tarif_achat "; - $sql .= " WHERE fk_fournisseur = " . $fournisseur_id; - - } - elseif ($type == 'vente') - { - $sql = "SELECT prefix, temporel, fixe, libelle"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_tarif_vente"; - } - - if ( $this->db->query($sql) ) - { - $num = $this->db->num_rows(); - - //print "$num tarif_fournisseur trouvés\n"; - - $i = 0; - - while ($i < $num) - { - $row = $this->db->fetch_row($i); - - $l = $row[0]; - - $this->tarif_fournisseur[$l] = $row; - - // Tableaux des prefixes découpés en 10 tableaux - - $pref = substr($row[0],0,1); - - $i_pref = sizeof($this->prefixes[$pref]) + 1; - - $this->prefixes[$pref][$i_pref] = $row[0]; - - // Taille maximale du prefixe - $this->prefixe_max[$pref] = max(strlen($row[0]), $this->prefixe_max[$pref]); - - $i++; - } - - $this->db->free(); - } - else - { - dol_syslog("TelephonieTarif::_load_tarif Erreur 1"); - dol_syslog($this->db->error()); - } - - /* - * Tarifs client - * - * - */ - - if ($type == 'vente' && ($this->client_id > 0)) - { - $sql = "SELECT p.prefix, tc.temporel, tc.fixe, t.libelle"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_tarif_client as tc"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_prefix as p "; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_tarif as t"; - $sql .= " WHERE tc.fk_tarif = t.rowid AND p.fk_tarif = t.rowid"; - $sql .= " AND tc.fk_client = ".$this->client_id; - - if ( $this->db->query($sql) ) - { - $num = $this->db->num_rows(); - $i = 0; - - while ($i < $num) - { - $row = $this->db->fetch_row($i); - - $l = $row[0]; - - $this->tarif_fournisseur[$l] = $row; - - $i++; - } - } - else - { - print $this->db->error(); - } - } - } - /* - * - * - * - */ - function cout($number, &$cout_tempo, &$cout_fixe, &$tarif_libelle) - { - $result = 0; - $first_char_in_prefix = substr($number,2,1); - - $k = $this->prefixe_max[$first_char_in_prefix]; - - //print "$first_char_in_prefix\t"; - - $goon = 1; - while ($goon == 1 && $k > 0) - { - - $prefix_to_find = substr($number, 2, $k); - - //print "($k, $prefix_to_find)"; - - if (in_array($prefix_to_find, $this->prefixes[$first_char_in_prefix])) - { - // print "\t$prefix_to_find\n"; - $cout_tempo = $this->tarif_fournisseur[$prefix_to_find][1]; - $cout_fixe = $this->tarif_fournisseur[$prefix_to_find][2]; - $tarif_libelle = $this->tarif_fournisseur[$prefix_to_find][3]; - - $goon = 0; - $result = 1; - } - $k = $k - 1; - } - - return $result; - } -} - -?> diff --git a/htdocs/telephonie/telephonie.client.class.php b/htdocs/telephonie/telephonie.client.class.php deleted file mode 100644 index 5c3d0405b11..00000000000 --- a/htdocs/telephonie/telephonie.client.class.php +++ /dev/null @@ -1,69 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -class TelephonieClient extends Societe { - var $db; - var $id; - - /** - * Créateur - * - */ - function TelephonieClient($DB, $id=0) - { - $this->db = $DB; - $this->id = $id; - - return 0; - } - /** - * - * - * - */ - function log_consult($user,$mode) - { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_consult (fk_soc,fk_user,action)"; - $sql .= " VALUES (".$this->id.",".$user->id.",'".$mode."');"; - $this->db->query($sql); - } - - function count_comment() - { - $num_comments = 0; - - $sql = "SELECT count(rowid)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_commentaire"; - $sql .= " WHERE fk_soc = ".$this->id; - $resql = $this->db->query($sql); - - if ($resql) - { - $row = $this->db->fetch_row($resql); - $num_comments = $row[0]; - $this->db->free($resql); - } - - return $num_comments; - } -} -?> diff --git a/htdocs/telephonie/telephonie.commercial.class.php b/htdocs/telephonie/telephonie.commercial.class.php deleted file mode 100644 index e058294774e..00000000000 --- a/htdocs/telephonie/telephonie.commercial.class.php +++ /dev/null @@ -1,115 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -class CommercialTelephonie { - var $db; - var $id; - - /** - * Créateur - * - * - */ - function CommercialTelephonie($DB, $id=0) - { - $this->db = $DB; - $this->id = $id; - - return 0; - } - /** - * - * - */ - function create() - { - $error = 0; - - if (strlen(trim($this->nom)) == 0) - { - $this->error_string["nom"] = "Valeur manquante"; - $error++; - } - if (strlen(trim($this->prenom)) == 0) - { - $this->error_string["prenom"] = "Valeur manquante"; - $error++; - } - - - if ($error == 0) - { - - $nuser = new User($this->db); - $nuser->nom = trim($this->nom); - $nuser->prenom = trim($this->prenom); - $nuser->admin = 0; - $nuser->email = trim($this->email); - $nuser->login = substr($this->nom,0,3).substr($this->prenom,0,3); - - $uid = $nuser->create(); - - if ($uid > 0) - { - $nuser->SetInGroup(TELEPHONIE_GROUPE_COMMERCIAUX_ID); - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_distributeur_commerciaux "; - $sql .= " (fk_distributeur, fk_user)"; - - $sql .= " VALUES ('".$this->distri."','$uid')"; - - - if ($this->db->query($sql)) - { - - } - else - { - dol_syslog("DistributeurTelephonie::Create"); - $this->error_string["prenom"] = "Erreur SQL : $sql"; - $this->error_string["nom"] = $this->db->error(); - $error++; - } - - } - else - { - $this->error_string["prenom"] = "Erreur création user"; - $this->error_string["nom"] = $user->error(); - $error++; - } - - } - else - { - - } - - return $error; - - } - - - - -} -?> diff --git a/htdocs/telephonie/telephonie.contrat.class.php b/htdocs/telephonie/telephonie.contrat.class.php deleted file mode 100644 index 96df7a216f0..00000000000 --- a/htdocs/telephonie/telephonie.contrat.class.php +++ /dev/null @@ -1,653 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -class TelephonieContrat { - var $db; - var $id; - var $ligne; - - function TelephonieContrat($DB, $id=0) - { - global $config; - - $this->db = $DB; - $this->error_message = ''; - $this->statuts[-1] = "En attente"; - $this->statuts[0] = "En traitement"; - $this->statuts[1] = "A commander"; - $this->statuts[2] = "En commande"; - $this->statuts[3] = "Actif"; - $this->statuts[4] = "A résilier"; - $this->statuts[5] = "Résiliation demandée"; - $this->statuts[6] = "Résilié"; - $this->statuts[7] = "Rejeté"; - - return 1; - } - /* - * Creation du contrat - * Le commercial qui fait le suivi est par defaut le commercial qui a signe - */ - function create($user, $isfacturable='oui', $mode_paiement='pre') - { - $this->mode_paiement = $mode_paiement; - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_contrat"; - $sql .= " (ref, fk_soc, fk_client_comm, fk_soc_facture, note"; - $sql .= " , fk_commercial_sign, fk_commercial_suiv, fk_user_creat, date_creat)"; - - $sql .= " VALUES ('PROV".time()."'"; - - $sql .= ", $this->client,$this->client_comm,$this->client_facture,'$this->note'"; - $sql .= ",$this->commercial_sign, $this->commercial_sign, $user->id, now())"; - - if ( $this->db->query($sql) ) - { - $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."telephonie_contrat"); - - $sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_contrat"; - $sql .= " SET ref='".substr("00000000".$this->id,-8)."'"; - $sql .= " , isfacturable = '".$isfacturable."'"; - $sql .= " , mode_paiement = '".$mode_paiement."'"; - $sql .= " WHERE rowid=".$this->id; - $this->db->query($sql); - - /* - * On applique la grille de tarif du distributeur - * - */ - $grille_tarif = 0; - - $sql = "SELECT d.grille_tarif "; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_distributeur as d"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_distributeur_commerciaux as dc"; - $sql .= " WHERE dc.fk_distributeur = d.rowid"; - $sql .= " AND dc.fk_user = ".$this->commercial_sign; - - $resql = $this->db->query($sql); - - if ($resql) - { - if ($this->db->num_rows($resql)) - { - $row = $this->db->fetch_row($resql); - - $grille_tarif = $row[0]; - } - $this->db->free($resql); - } - - - if ($grille_tarif > 0) - { - $sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_contrat"; - $sql .= " SET grille_tarif =".$grille_tarif; - $sql .= " WHERE rowid=".$this->id; - $this->db->query($sql); - } - - return 0; - } - else - { - $this->error_message = "Echec de la création du contrat"; - dol_syslog("TelephonieContrat::Create Error -1"); - dol_syslog($this->db->error()); - return -1; - } - } - /* - * - * - */ - function update($user) - { - $error = 0 ; - - if (!$this->db->begin()) - { - $error++; - dol_syslog("TelephonieContrat::Update Error -1"); - } - - if (!$error) - { - - $sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_contrat"; - $sql .= " SET "; - $sql .= " fk_soc = ".$this->client ; - $sql .= ", fk_soc_facture = ".$this->client_facture; - $sql .= ", fk_commercial_suiv = ".$this->commercial_suiv_id; - $sql .= ", mode_paiement = '".$this->mode_paiement."'"; - $sql .= ", grille_tarif = '".$this->grille_tarif_id."'"; - $sql .= ", note = '$this->note'"; - - $sql .= " WHERE rowid = ".$this->id; - - if (! $this->db->query($sql) ) - { - $error++; - dol_syslog("TelephonieContrat::Update Error -2"); - } - } - - if (!$error) - { - $sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_societe_ligne"; - $sql .= " SET "; - $sql .= " fk_soc = ".$this->client ; - $sql .= ", fk_soc_facture = ".$this->client_facture; - $sql .= ", fk_commercial_suiv = ".$this->commercial_suiv_id; - $sql .= ", mode_paiement = '".$this->mode_paiement."'"; - $sql .= " WHERE fk_contrat = ".$this->id; - - - if (! $this->db->query($sql) ) - { - $error++; - dol_syslog("TelephonieContrat::Update Error -3"); - } - } - - if (!$error) - { - $this->db->commit(); - return 0; - } - else - { - $this->db->rollback(); - return -1; - } - } - /* - * - * - * - */ - function fetch($id) - { - $sql = "SELECT c.rowid, c.ref, c.fk_client_comm, c.fk_soc, c.fk_soc_facture, c.note"; - $sql .= ", c.fk_commercial_sign, c.fk_commercial_suiv"; - $sql .= ", c.isfacturable, c.mode_paiement, c.statut"; - $sql .= ", c.fk_user_creat, ".$this->db->pdate("c.date_creat") ." as dc"; - $sql .= ", c.grille_tarif"; - - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat as c"; - $sql .= " WHERE c.rowid = ".$id; - - $resql = $this->db->query($sql); - - if ($resql) - { - if ($this->db->num_rows($resql)) - { - $obj = $this->db->fetch_object($resql); - - $this->id = $obj->rowid; - $this->socid = $obj->fk_soc; - $this->ref = $obj->ref; - $this->remise = $obj->remise; - $this->client_comm_id = $obj->fk_client_comm; - $this->client_id = $obj->fk_soc; - $this->client_facture_id = $obj->fk_soc_facture; - - $this->commercial_sign_id = $obj->fk_commercial_sign; - $this->commercial_suiv_id = $obj->fk_commercial_suiv; - - $this->statut = $obj->statut; - $this->mode_paiement = $obj->mode_paiement; - $this->code_analytique = $obj->code_analytique; - - $this->user_creat = $obj->fk_user_creat; - $this->date_creat = $obj->dc; - - $this->grille_tarif_id = $obj->grille_tarif; - - if ($obj->isfacturable == 'oui') - { - $this->facturable = 1; - } - else - { - $this->facturable = 0; - } - - $this->ref_url = ''.$this->ref.''; - - $result = 0; - } - else - { - dol_syslog("TelephonieContrat::Fecth Erreur -2"); - $result = -2; - } - - $this->db->free($resql); - } - else - { - /* Erreur select SQL */ - print $this->db->error(); - $result = -1; - dol_syslog("TelephonieContrat::Fecth Erreur -1"); - } - - $sql = "SELECT libelle"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_tarif_grille"; - $sql .= " WHERE rowid = ".$this->grille_tarif_id; - - $resql = $this->db->query($sql); - - if ($resql) - { - if ($this->db->num_rows($resql)) - { - $obj = $this->db->fetch_object($resql); - - $this->grille_tarif_nom = $obj->libelle; - } - $this->db->free($resql); - } - - - return $result; - } - /* - * - * - */ - function delete() - { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_contrat"; - $sql .= " WHERE rowid = ".$this->id; - - $this->db->query($sql); - } - /* - * - * - * - */ - function load_previous_next_id($filtre='') - { - $sql = "SELECT rowid"; - $sql.= " FROM ".MAIN_DB_PREFIX."telephonie_contrat"; - $sql.= " WHERE rowid > ".$this->id.""; - $sql .= " ORDER BY rowid ASC LIMIT 1"; - - $resql = $this->db->query($sql) ; - if ($resql) - { - while ($row = $this->db->fetch_row($resql)) - { - $this->ref_next = $row[0]; - } - } - - $sql = "SELECT rowid"; - $sql.= " FROM ".MAIN_DB_PREFIX."telephonie_contrat"; - $sql.= " WHERE rowid < ".$this->id.""; - $sql .= " ORDER BY rowid DESC LIMIT 1"; - - $resql = $this->db->query($sql) ; - if ($resql) - { - while ($row = $this->db->fetch_row($resql)) - { - $this->ref_previous = $row[0]; - } - } - - - - - return 1; - } - /* - * - * - * - */ - function add_contact_facture($cid) - { - - $this->del_contact_facture($cid); - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_contrat_contact_facture"; - $sql .= " (fk_contrat, fk_contact) "; - $sql .= " VALUES ($this->id, $cid )"; - - $this->db->query($sql); - } - /* - * - * - */ - function del_contact_facture($cid) - { - - $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_contrat_contact_facture"; - $sql .= " WHERE fk_contrat=".$this->id." AND fk_contact=".$cid; - - return $this->db->query($sql); - } - /* - * - * - */ - function count_associated_services() - { - $num = 0; - $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."telephonie_contrat_service"; - $sql .= " WHERE fk_contrat=".$this->id; - - if ( $this->db->query( $sql) ) - { - $num = $this->db->num_rows(); - } - - return $num; - } - /* - * - * - */ - function add_service($user, $sid) - { - $result = 0; - - $sql = "SELECT montant FROM ".MAIN_DB_PREFIX."telephonie_service"; - $sql .= " WHERE rowid=".$sid; - - $resql = $this->db->query( $sql); - - if ($resql) - { - $row = $this->db->fetch_row($resql); - $montant = $row[0]; - } - else - { - $result = -1; - } - - - if ($result == 0) - { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_contrat_service"; - $sql .= " (fk_contrat, fk_service, fk_user_creat, date_creat, montant) "; - $sql .= " VALUES ($this->id, $sid, $user->id, now(),".$montant.")"; - - $resql = $this->db->query( $sql); - - if ($resql) - { - return 0 ; - } - } - } - /* - * - * - */ - function remove_service($user, $sid) - { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_contrat_service"; - $sql .= " WHERE fk_contrat = ".$this->id; - $sql .= " AND rowid = ".$sid; - - if ($this->db->query($sql) ) - { - return 0 ; - } - } - /* - * - * - */ - function get_contact_facture() - { - $this->contact_facture_id = array(); - $res = array(); - $resid = array(); - - $sql = "SELECT c.rowid, c.name, c.firstname, c.email "; - $sql .= "FROM ".MAIN_DB_PREFIX."socpeople as c"; - $sql .= ",".MAIN_DB_PREFIX."telephonie_contrat_contact_facture as cf"; - $sql .= " WHERE c.rowid = cf.fk_contact "; - $sql .= " AND cf.fk_contrat = ".$this->id." ORDER BY name "; - - $resql = $this->db->query($sql); - - if ( $resql ) - { - $num = $this->db->num_rows($resql); - if ( $num > 0 ) - { - $i = 0; - while ($i < $num) - { - $row = $this->db->fetch_row($resql); - - array_push($res, $row[1] . " " . $row[2] . " <".$row[3].">"); - array_push($resid, $row[0]); - $i++; - } - - $this->db->free($resql); - } - } - $this->contact_facture_id = $resid; - return $res; - } - - /* - * - * - */ - function priseordre_totale() - { - $po = 0; - $sql = "SELECT sum(montant) "; - $sql .= "FROM ".MAIN_DB_PREFIX."telephonie_contrat_priseordre"; - $sql .= " WHERE fk_contrat = ".$this->id; - $resql = $this->db->query($sql); - if ($resql) - { - $num = $this->db->num_rows($resql); - if ( $num > 0 ) - { - $row = $this->db->fetch_row($resql); - $po = $row[0]; - } - $this->db->free(); - - } - else - { - dol_syslog($sql); - } - return $po; - } - - /* - * - * - */ - function addpo($montant, $user) - { - $po = 0; - - $montant = ereg_replace(",",".",$montant); - - if ($montant > 0) - { - $did = 0; - - $sql = "SELECT dc.fk_distributeur "; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_distributeur_commerciaux as dc"; - $sql .= " WHERE dc.fk_user = ".$this->commercial_sign_id; - - $resql = $this->db->query($sql); - - if ($resql) - { - if ($this->db->num_rows($resql)) - { - $row = $this->db->fetch_row($resql); - $did = $row[0]; - } - $this->db->free($resql); - } - - - if ($did > 0) - { - - $sql = "SELECT avance_pourcent, avance_duree, rem_pour_prev, rem_pour_autr"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_distributeur "; - $sql .= " WHERE rowid = ".$did; - - $resql = $this->db->query($sql); - - if ($resql) - { - if ($this->db->num_rows($resql)) - { - $pour = $this->db->fetch_row($resql); - } - $this->db->free($resql); - } - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_contrat_priseordre"; - $sql .= " (fk_contrat, datepo, montant, fk_commercial, fk_distributeur, fk_user"; - $sql .= " , avance_pourcent, avance_duree, rem_pour_prev, rem_pour_autr"; - $sql .= ", mode_paiement)"; - $sql .= " VALUES (".$this->id.",now(), ".$montant; - $sql .= ",".$this->commercial_sign_id.",".$did.",".$user->id; - $sql .= ",".$pour[0].",".$pour[1].",".$pour[2].",".$pour[3]; - $sql .= ",'".$this->mode_paiement."');"; - - $resql = $this->db->query($sql); - if ($resql) - { - - } - else - { - dol_syslog($sql); - } - } - else - { - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_contrat_priseordre"; - $sql .= " (fk_contrat, datepo, montant, fk_commercial, fk_distributeur, fk_user"; - $sql .= ", mode_paiement)"; - $sql .= " VALUES (".$this->id.",now(), ".$montant; - $sql .= ",".$this->commercial_sign_id.",".$did.",".$user->id; - $sql .= ",'".$this->mode_paiement."');"; - $resql = $this->db->query($sql); - if ($resql) - { - - } - else - { - dol_syslog($sql); - } - } - } - } - /* - * - * - */ - function update_statut() - { - $sql = "SELECT statut, count(*) "; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne"; - $sql .= " WHERE fk_contrat = ".$this->id; - $sql .= " GROUP BY statut"; - - $resql = $this->db->query($sql); - - if ($resql) - { - $num = $this->db->num_rows($resql); - if ($num) - { - $i = 0; - while ($i < $num) - { - $row = $this->db->fetch_row($resql); - $lignes[$row[0]] = $row[1]; - $i++; - } - } - $this->db->free($resql); - } - - $statut = 0; - - if ($num > 0) $statut = 1; - - if ($lignes[2] > 0) $statut = 2; - - if ($lignes[7] == $num) $statut = 7; - - if ($lignes[6] > 0) $statut = 6; - - if ($lignes[6] > 0 && $lignes[2] > 0) $statut = 2; - - if ($lignes[3] > 0) $statut = 3; - - if ($num == 1) $statut = $row[0]; - - $sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_contrat"; - $sql .= " SET statut = ".$statut; - $sql .= " WHERE rowid = ".$this->id; - - $resql = $this->db->query($sql); - if ($resql) - { - - } - else - { - dol_syslog("Telephonie::Contrat Error". $sql); - } - } - /* - * Log des consultations - * - */ - function log_consult($user,$mode) - { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_contrat_consult (fk_contrat,fk_user,action)"; - $sql .= " VALUES (".$this->id.",".$user->id.",'".$mode."');"; - $this->db->query($sql); - } - -} -?> diff --git a/htdocs/telephonie/telephonie.css b/htdocs/telephonie/telephonie.css deleted file mode 100644 index 5c3f0cfca8e..00000000000 --- a/htdocs/telephonie/telephonie.css +++ /dev/null @@ -1,20 +0,0 @@ - -/* ============================================================================== */ -/* CSS module telephonie */ -/* ============================================================================== */ - -#corpForm fieldset { /*** Mise en forme des cadres ***/ - margin: 0; - font-style: normal; - padding: 0 1em 1em; - font-size: 12px; -} - -#corpForm .focus { /*** Mise en avant des champs en cours d'utilisation ***/ - background: #FFF0F0; - color: black; -} -#corpForm .normal { /*** Retour à l'état normal après l'utilisation ***/ - background: white; - color: black; -} diff --git a/htdocs/telephonie/telephonie.service.class.php b/htdocs/telephonie/telephonie.service.class.php deleted file mode 100644 index 90358ce2804..00000000000 --- a/htdocs/telephonie/telephonie.service.class.php +++ /dev/null @@ -1,173 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -class TelephonieService { - var $db; - - var $id; - var $ligne; - - function TelephonieService($DB) - { - global $config; - - $this->db = $DB; - $this->error_message = ''; - $this->statuts[0] = "Inactif"; - $this->statuts[1] = "Actif"; - - return 0; - } - /* - * - * - */ - function update($user) - { - $this->montant = ereg_replace(",",".",$this->montant); - - $sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_service"; - $sql .= " SET "; - $sql .= " libelle = '$this->libelle' "; - $sql .= ", libelle_facture = '$this->libelle' "; - $sql .= ", montant = '$this->montant' "; - $sql .= ", fk_user_modif = $user->id "; - $sql .= ", date_modif = now() "; - - $sql .= " WHERE rowid = $this->id"; - - $resql = $this->db->query($sql); - - if ( $resql ) - { - return 0; - } - else - { - print $this->db->error(); - print $sql ; - return -1; - } - } - /* - * - * - */ - function active($user) - { - - $sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_service"; - $sql .= " SET "; - $sql .= " statut = 1"; - $sql .= ", fk_user_modif = $user->id "; - $sql .= ", date_modif = now() "; - - $sql .= " WHERE rowid = $this->id AND statut = 0"; - - $resql = $this->db->query($sql); - - if ( $resql ) - { - return 0; - } - else - { - print $this->db->error(); - print $sql ; - return -1; - } - } - - /* - * - * - */ - function create($user) - { - - $this->montant = ereg_replace(",",".",$this->montant); - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_service"; - $sql .= " (ref, libelle, libelle_facture, montant, fk_user_creat, date_creat)"; - $sql .= " VALUES ("; - $sql .= " '$this->ref','$this->libelle','$this->libelle_facture','$this->montant',$user->id, now())"; - - if ( $this->db->query($sql) ) - { - $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."telephonie_service"); - return 0; - } - else - { - - $this->error_message = "Echec de la création du service !"; - dol_syslog("TelephonieService::Create Error -1"); - return -1; - } - } - /* - * - * - */ - - function fetch($id) - { - $sql = "SELECT s.rowid, s.libelle, s.libelle_facture, s.montant, s.statut"; - $sql .= " , s.ref"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_service as s"; - $sql .= " WHERE s.rowid = ".$id; - - $resql = $this->db->query($sql); - - if ($resql) - { - if ($this->db->num_rows($resql)) - { - $obj = $this->db->fetch_object($resql); - - $this->id = $obj->rowid; - $this->ref = $obj->ref; - $this->libelle = stripslashes($obj->libelle); - $this->libelle_facture = stripslashes($obj->libelle_facture); - $this->montant = $obj->montant; - $this->statut = $obj->statut; - - $result = 0; - } - else - { - $result = -2; - } - - $this->db->free($resql); - } - else - { - /* Erreur select SQL */ - print $this->db->error(); - $result = -1; - } - - return $result; - } -} -?> diff --git a/htdocs/telephonie/telephonie.tarif.class.php b/htdocs/telephonie/telephonie.tarif.class.php deleted file mode 100644 index c7affdb4b7c..00000000000 --- a/htdocs/telephonie/telephonie.tarif.class.php +++ /dev/null @@ -1,298 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * or see http://www.gnu.org/ - * - * $Id$ - * $Source$ - * - */ - -/** - \file htdocs/telephonie.tarif.class.php - \ingroup facture - \brief Fichier de la classe des tarifs telephonies - \version $Revision$ -*/ - - -/** - \class TelephonieTarif - \brief Classe permettant la gestion des tarifs de telephonie -*/ - - -class TelephonieTarif { - - var $_DB; - var $tableau_tarif; - var $prefixes; - var $prefixe_max; - var $messages; - - /* - * Constructeur - * - */ - function TelephonieTarif($_DB, $grille_id, $type, $fournisseur_id = 0 , $client_id = 0) - { - $this->db = $_DB; - - $this->tableau_tarif = array(); - - $this->prefixes = array(); - - $this->fournisseur_id = $fournisseur_id; - $this->client_id = $client_id; - - $this->tarif_spec = $fournisseur_id; - - $this->messages = array(); - - for ($j = 0 ; $j++ ; $j < 10) - { - $this->prefixes[$j] = array(); - $this->prefixe_max = array(); - } - - $this->_load_tarif($grille_id, $type); - } - - function CreateTarif($name, $type) - { - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_tarif"; - $sql .= "(libelle, type)"; - $sql .= " VALUES ('".$name."','".$type."');"; - - if ( $this->db->query($sql) ) - { - - } - else - { - dol_syslog($this->db->error()); - } - - return $result; - } - - /* - * - * - */ - function Fetch($id) - { - $this->id = 0; - - $sql = "SELECT rowid, libelle FROM ".MAIN_DB_PREFIX."telephonie_tarif"; - $sql .= " WHERE rowid = '".$id."';"; - - $resql = $this->db->query($sql); - - if ( $resql ) - { - if ($row = $this->db->fetch_row($resql) ) - { - $this->id = $row[0]; - $this->libelle = stripslashes($row[1]); - } - $this->db->free($resql); - - return 0; - } - else - { - return -1; - } - } - /* - * - * - */ - function _load_tarif($grille_id, $type) - { - if ($type == 'achat') - { - $sql = "SELECT p.prefix, m.temporel, m.fixe"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_tarif_montant as m "; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_prefix as p "; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_fournisseur as f "; - - $sql .= " WHERE p.fk_tarif = m.fk_tarif "; - - $sql .= " AND f.fk_tarif_grille = m.fk_tarif_desc"; - - $sql .= " AND f.rowid = " . $this->fournisseur_id; - - } - elseif ($type == 'vente') - { - $sql = "SELECT p.prefix, m.temporel, m.fixe, t.libelle"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_tarif_montant as m"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_tarif as t"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_prefix as p"; - - $sql .= " WHERE t.rowid = m.fk_tarif"; - $sql .= " AND t.rowid = p.fk_tarif"; - $sql .= " AND m.fk_tarif_desc = ". $grille_id; - } - - if ( $resql = $this->db->query($sql) ) - { - $num = $this->db->num_rows($resql); - - $i = 0; - - while ( $row = $this->db->fetch_row($resql) ) - { - $l = $row[0]; - - $this->tableau_tarif[$l] = $row; - - // Tableaux des prefixes découpés en 10 tableaux - - $pref = substr($row[0],0,1); - - $i_pref = sizeof($this->prefixes[$pref]) + 1; - - $this->prefixes[$pref][$i_pref] = $row[0]; - - // Taille maximale du prefixe - $this->prefixe_max[$pref] = max(strlen($row[0]), $this->prefixe_max[$pref]); - - $i++; - } - $this->num_tarifs = $num; - $this->db->free($resql); - } - else - { - dol_syslog("TelephonieTarif::_load_tarif Erreur SQL 1 (type=$type)", LOG_ERR); - dol_syslog($sql, LOG_DEBUG); - } - /* - * Tarif Spécifique - * - */ - if ($this->tarif_spec <> 1) - { - $sql = "SELECT p.prefix, m.temporel, m.fixe, t.libelle"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_tarif_montant as m"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_tarif as t"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_prefix as p"; - $sql .= " WHERE t.rowid = m.fk_tarif"; - $sql .= " AND t.rowid = p.fk_tarif"; - $sql .= " AND m.fk_tarif_desc = ".$this->tarif_spec; - - $resql = $this->db->query($sql); - - if ($resql) - { - $num = $this->db->num_rows($resql); - $i = 0; - - while ($i < $num) - { - $row = $this->db->fetch_row($resql); - - $l = $row[0]; - $this->tableau_tarif[$l] = $row; - - $i++; - } - - $this->db->free($resql); - } - else - { - dol_syslog("TelephonieTarif::_load_tarif Erreur 59"); - dol_syslog($this->db->error()); - } - } - /* - * Tarifs client - * - * - */ - - if ($type == 'vente' && ($this->client_id > 0)) - { - $sql = "SELECT p.prefix, tc.temporel, tc.fixe, t.libelle"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_tarif_client as tc"; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_prefix as p "; - $sql .= " , ".MAIN_DB_PREFIX."telephonie_tarif as t"; - $sql .= " WHERE tc.fk_tarif = t.rowid AND p.fk_tarif = t.rowid"; - $sql .= " AND tc.fk_client = ".$this->client_id; - - if ( $this->db->query($sql) ) - { - $num = $this->db->num_rows(); - $i = 0; - - while ($i < $num) - { - $row = $this->db->fetch_row($i); - - $l = $row[0]; - - $this->tableau_tarif[$l] = $row; - - $i++; - } - } - else - { - print $this->db->error(); - } - } - } - /* - * - * - * - */ - function cout($number, &$cout_tempo, &$cout_fixe, &$tarif_libelle) - { - $result = 0; - $first_char_in_prefix = substr($number,2,1); - - $k = $this->prefixe_max[$first_char_in_prefix]; - - $goon = 1; - while ($goon == 1 && $k > 0) - { - - $prefix_to_find = substr($number, 2, $k); - - if (in_array($prefix_to_find, $this->prefixes[$first_char_in_prefix])) - { - //print "\t$prefix_to_find\n"; - $cout_tempo = $this->tableau_tarif[$prefix_to_find][1]; - $cout_fixe = $this->tableau_tarif[$prefix_to_find][2]; - $tarif_libelle = $this->tableau_tarif[$prefix_to_find][3]; - - $goon = 0; - $result = 1; - } - $k = $k - 1; - } - - return $result; - } -} - -?> diff --git a/htdocs/telephonie/telephonie.tarif.grille.class.php b/htdocs/telephonie/telephonie.tarif.grille.class.php deleted file mode 100644 index cb27b48dd86..00000000000 --- a/htdocs/telephonie/telephonie.tarif.grille.class.php +++ /dev/null @@ -1,426 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * or see http://www.gnu.org/ - * - * $Id$ - * $Source$ - * - */ - -/** - \file htdocs/telephonie.tarif.class.php - \ingroup facture - \brief Fichier de la classe des tarifs telephonies - \version $Revision$ -*/ - - -/** - \class TelephonieTarif - \brief Classe permettant la gestion des tarifs de telephonie -*/ - - -class TelephonieTarifGrille { - //! Identifiant de la grille - var $id; - var $_DB; - var $tableau_tarif; - var $prefixes; - var $prefixe_max; - - /* - * Constructeur - * - */ - function TelephonieTarifGrille($_DB) - { - $this->db = $_DB; - } - /** - \brief Lecture de l'objet - - */ - function Fetch($id) - { - $sql = "SELECT d.libelle , d.type_tarif"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_tarif_grille as d"; - $sql .=" WHERE rowid = $id;"; - $resql = $this->db->query($sql); - if ($resql) - { - $obj = $this->db->fetch_object($resql); - - $this->id = $id; - $this->libelle = stripslashes($obj->libelle); - $this->type = $obj->type_tarif; - - $this->db->free($resql); - } - - } - /** - \brief Lecture de l'objet - - */ - function CountContrats() - { - $sql = "SELECT count(grille_tarif)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat"; - $sql .=" WHERE grille_tarif='".$this->id."';"; - $resql = $this->db->query($sql); - if ($resql) - { - $row = $this->db->fetch_row($resql); - - $this->nb_contrats = $row[0]; - - $this->db->free($resql); - } - - } - /* - \brief Creation d'une nouvelle grille - */ - function CreateGrille($user, $name, $type, $copy=0) - { - $result = 0; - - if (strlen(trim($name)) > 0) - { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_tarif_grille"; - $sql .= "(libelle, type_tarif)"; - $sql .= " VALUES ('".addslashes($name)."','".$type."');"; - - if ( $this->db->query($sql) ) - { - $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'telephonie_tarif_grille'); - - $this->Perms($user, 2, $user->id); - } - else - { - dol_syslog($this->db->error()); - $result = -1; - } - - if ($copy > 0 && $type == 'vente') - { - $this->CopieGrille($user,$copy); - } - } - else - { - $result = -2; - } - return $result; - } - - /* - - */ - function CopieGrille($user, $ori) - { - $sql = "SELECT fk_tarif,temporel,fixe FROM ".MAIN_DB_PREFIX."telephonie_tarif_montant"; - $sql .= " WHERE fk_tarif_desc= '".$ori."'"; - - $resql = $this->db->query($sql); - - if ($resql) - { - $i = 0; - while ($row = $this->db->fetch_row($resql) ) - { - $tarifs[$i] = $row; - $i++; - } - $this->db->free($resql); - } - else - { - dol_syslog($this->db->error()); - } - - if (sizeof($tarifs) > 0) - { - foreach($tarifs as $tarif) - { - $this->_DBUpdateTarif($this->id, $tarif[0], $tarif[1], $tarif[2], $user); - } - } - - } - /* - \brief Supprime une grille de tarif - */ - function RemoveGrille($user, $id, $replace) - { - $result = 0; - - if ($id > 0 && $replace > 0) - { - $this->db->begin(); - - $sql= "UPDATE ".MAIN_DB_PREFIX."telephonie_contrat"; - $sql.=" SET grille_tarif='$replace'"; - $sql.=" WHERE grille_tarif='$id';"; - - if ( $this->db->query($sql) ) - { - - } - else - { - dol_syslog($this->db->error()); - dol_syslog($sql); - $result = -1; - } - - $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_tarif_grille_rights"; - $sql .= " WHERE fk_grille=$id;"; - - if (! $this->db->query($sql) ) - { - dol_syslog($this->db->error()); - $result = -1; - } - - $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_tarif_montant"; - $sql .= " WHERE fk_tarif_desc=$id;"; - - if (! $this->db->query($sql) ) - { - dol_syslog($this->db->error()); - $result = -1; - } - - $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_tarif_grille"; - $sql .= " WHERE rowid=$id;"; - - if ( $this->db->query($sql) ) - { - - } - else - { - dol_syslog($this->db->error()); - $result = -1; - } - - - if ($result === 0 ) - { - $this->db->commit(); - } - else - { - $this->db->rollback(); - } - - } - else - { - $result = -2; - } - - return $result; - } - - - function Perms($user, $perms, $user_grille) - { - - if ($perms == 0) - { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_tarif_grille_rights"; - $sql .= " WHERE fk_user = '".$user_grille."'"; - $sql .= " AND fk_grille = '".$this->id."';"; - $this->db->query($sql); - } - - if ($perms == 1) - { - $sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_tarif_grille_rights"; - $sql .= " SET pread= 1, pwrite = 0, fk_user_creat ='".$user->id."' WHERE fk_user = '".$user_grille."'"; - $sql .= " AND fk_grille = '".$this->id."';"; - if ( $this->db->query($sql) ) - { - if ($this->db->affected_rows($resql) == 0) - { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_tarif_grille_rights"; - $sql .= " (pread,pwrite, fk_user, fk_grille, fk_user_creat) VALUES "; - $sql .= " (1,0,'".$user_grille."','".$this->id."','".$user->id."');"; - if ( $this->db->query($sql) ) - { - - } - } - } - } - - if ($perms == 2) - { - $sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_tarif_grille_rights"; - $sql .= " SET pread= 1, pwrite = 1, fk_user_creat ='".$user->id."' WHERE fk_user = '".$user_grille."'"; - $sql .= " AND fk_grille = '".$this->id."';"; - if ( $this->db->query($sql) ) - { - - if ($this->db->affected_rows($resql) == 0) - { - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_tarif_grille_rights"; - $sql .= " (pread,pwrite, fk_user, fk_grille, fk_user_creat) VALUES "; - $sql .= " (1,1,'".$user_grille."','".$this->id."','".$user->id."');"; - if ( $this->db->query($sql) ) - { - - } - else - { - print $sql; - } - } - - } - } - - } - - - function UpdateTarif($grille_id, $tarif_id, $temporel, $fixe, $user) - { - $tarifs_linked = array(); - - $this->_DBUpdateTarif($grille_id, $tarif_id, $temporel, $fixe, $user); - // Ci-dessous a reintegrer avec une option de configuration - /* - $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."telephonie_tarif"; - $sql .= " WHERE tlink = ".$tarif_id; - - $resql = $this->db->query($sql); - - if ($resql) - { - $i = 0; - - while ($row = $this->db->fetch_row($resql)) - { - $tarifs_linked[$i] = $row[0]; - $i++; - } - $this->db->free($resql); - } - else - { - dol_syslog($this->db->error()); - } - - foreach($tarifs_linked as $tarif) - { - $this->_DBUpdateTarif($grille_id, $tarif, $temporel, $fixe, $user); - } - */ - return $result; - } - - /* - * - */ - - - function _DBUpdateTarif($grille_id, $tarif_id, $temporel, $fixe, $user) - { - - $sql = "REPLACE INTO ".MAIN_DB_PREFIX."telephonie_tarif_montant"; - $sql .= "(fk_tarif_desc, fk_user, fk_tarif, temporel,fixe)"; - $sql .= " VALUES (".$grille_id.",".$user->id; - $sql .= " ,".$tarif_id; - $sql .= " ,".ereg_replace(",",".",$temporel); - $sql .= " ,".ereg_replace(",",".",$fixe).");"; - - if ( $this->db->query($sql) ) - { - - } - else - { - dol_syslog($this->db->error()); - } - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_tarif_montant_log"; - $sql .= "(fk_tarif_desc, fk_user, fk_tarif, temporel,fixe)"; - - $sql .= " VALUES (".$grille_id.",".$user->id; - $sql .= " ,".$tarif_id; - $sql .= " ,".ereg_replace(",",".",$temporel); - $sql .= " ,".ereg_replace(",",".",$fixe).");"; - - if ( $this->db->query($sql) ) - { - - } - else - { - dol_syslog($this->db->error()); - } - - - return $result; - } - /* - \brief Retourne la liste des grilles - */ - function GetListe($user,$type='') - { - $this->liste = array(); - $this->liste_name = array(); - - $sql = "SELECT d.libelle as tarif_desc, d.rowid, d.type_tarif"; - - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_tarif_grille as d"; - $sql .= "," . MAIN_DB_PREFIX."telephonie_tarif_grille_rights as r"; - $sql .= " WHERE d.rowid = r.fk_grille"; - $sql .= " AND r.fk_user =".$user->id; - $sql .= " AND r.pread = 1"; - - if ($type <> '') - $sql .= " AND d.type_tarif = '".$type."'"; - - $sql .= " ORDER BY d.libelle"; - - $resql = $this->db->query($sql); - if ($resql) - { - while ( $obj = $this->db->fetch_object($resql) ) - { - $this->liste_name[$obj->rowid] = stripslashes($obj->tarif_desc); - $this->liste[$obj->rowid][0] = $obj->rowid; - $this->liste[$obj->rowid][1] = stripslashes($obj->tarif_desc); - $this->liste[$obj->rowid][2] = $obj->type_tarif; - } - - $this->db->free($resql); - } - else - { - print $this->db->error() . ' ' . $sql; - } - } -} - -?> diff --git a/htdocs/telephonie/telephonie.tarif.prefix.class.php b/htdocs/telephonie/telephonie.tarif.prefix.class.php deleted file mode 100644 index 21d1fa362f2..00000000000 --- a/htdocs/telephonie/telephonie.tarif.prefix.class.php +++ /dev/null @@ -1,117 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * or see http://www.gnu.org/ - * - * $Id$ - * $Source$ - * - */ - -/** - \file htdocs/telephonie.tarif.class.php - \ingroup facture - \brief Fichier de la classe des tarifs telephonies - \version $Revision$ -*/ - -/** - \class TelephonieTarif - \brief Classe permettant la gestion des prefix de tarifs de telephonie -*/ - -class TelephonieTarifPrefix { - //! Identifiant de la prefix - var $id; - var $_DB; - - /* - * Constructeur - * - */ - function TelephonieTarifPrefix($_DB) - { - $this->db = $_DB; - } - - function Create($user, $prefix, $tarif_id, $force='off') - { - if ($force == 'on') - { - $sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_prefix"; - $sql .= " SET fk_tarif='".$tarif_id."'"; - $sql .= " WHERE prefix = '".$prefix."';"; - - if ( $this->db->query($sql) ) - { - $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'telephonie_prefix'); - } - else - { - dol_syslog($this->db->error()); - } - } - else - { - $this->fetch($prefix); - - if ($this->tarif_id == 0 && strlen(trim($prefix)) > 0) - { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_prefix"; - $sql .= "(prefix, fk_tarif)"; - $sql .= " VALUES ('".$prefix."','".$tarif_id."');"; - - if ( $this->db->query($sql) ) - { - $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'telephonie_prefix'); - } - else - { - dol_syslog($this->db->error()); - } - } - } - - return $result; - } - - function Fetch($prefix) - { - $this->tarif_id = 0; - - $sql = "SELECT fk_tarif FROM ".MAIN_DB_PREFIX."telephonie_prefix"; - $sql .= " WHERE prefix = '".$prefix."';"; - - $resql = $this->db->query($sql); - - if ( $resql ) - { - if ($row = $this->db->fetch_row($resql) ) - { - $this->tarif_id = $row[0]; - } - $this->db->free($resql); - - return 0; - } - else - { - return -1; - } - } -} - -?> diff --git a/htdocs/telephonie/workflowtel.class.php b/htdocs/telephonie/workflowtel.class.php deleted file mode 100644 index fe6455a6504..00000000000 --- a/htdocs/telephonie/workflowtel.class.php +++ /dev/null @@ -1,146 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require_once(DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php"); - -class WorkflowTelephonie { - var $db; - var $id; - - /** - * Créateur - * - */ - function WorkflowTelephonie($DB, $id=0) - { - $this->db = $DB; - $this->id = $id; - return 0; - } - /** - * - * - */ - function Create($module, $user_id, $statut_id) - { - // $module contient une des valeurs du champs de type enum de la table - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_workflow"; - $sql .= " (module,fk_user,fk_statut)"; - $sql .= " VALUES ('".$module."','".$user_id."','".$statut_id."');"; - - if ($this->db->query($sql) ) - { - $res = 0; - } - else - { - dol_syslog("WorkflowTelephonie::Create ".$this->db->error,LOG_ERR); - $res = -1; - } - - return $res; - } - - function Notify($module, $statut_id, $numero, $commentaire='') - { - dol_syslog("WorkflowTelephonie::Notify statut_id=$statut_id",LOG_DEBUG); - - - $sql = "SELECT u.rowid"; - $sql .= " FROM ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."telephonie_workflow as w"; - $sql .= " WHERE u.rowid = w.fk_user AND w.fk_statut = '".$statut_id."' AND module='".$module."';"; - - if ( $resql = $this->db->query( $sql) ) - { - while ($row = $this->db->fetch_row($resql)) - { - $this->SendMail($row[0],$statut_id, $numero, $commentaire); - } - $this->db->free($resql); - } - else - { - dol_syslog("WorkflowTelephonie::SendMail ".$this->db->error,LOG_ERR); - } - } - - - function SendMail($user_id, $statut_id, $numero, $commentaire='') - { - dol_syslog("WorkflowTelephonie::SendMail user_id=$user_id,statut_id=$statut_id",LOG_DEBUG); - - $comm = new User($this->db,$user_id); - $comm->fetch(); - - - $ligne = new LigneAdsl($this->db); - - $subject = "Evénement sur une ligne xDSL"; - $sendto = $comm->prenom . " " .$comm->nom . "<".$comm->email.">"; - $from = "Unknown"; - - $message = "Bonjour,\n\n"; - $message .= "Nous vous informons de l'événement suivant :\n\n"; - - $message .= "Ligne numéro : ".$numero."\n"; - $message .= "Evénement : ".$ligne->statuts[$statut_id]."\n"; - if (strlen(trim($commentaire))) - $message .= "Commentaire : ".$commentaire."\n"; - - $message .= "\n\n--\n"; - $message .= "Ceci est un message automatique envoyé par Dolibarr\n"; - $message .= "Merci de ne pas y répondre."; - - $mailfile = new CMailFile($subject, - $sendto, - 'unknown', - $message); - $mailfile->sendfile(); - } - /** - * - * - */ - function Delete($module, $user_id, $statut_id) - { - // $module contient une des valeurs du champs de type enum de la table - - $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_workflow"; - $sql .= " WHERE module='".$module."'"; - $sql .= " AND fk_user = '".$user_id."'"; - $sql .= " AND fk_statut = '".$statut_id."';"; - - if ($this->db->query($sql) ) - { - $res = 0; - } - else - { - dol_syslog("WorkflowTelephonie::Delete ".$this->db->error,LOG_ERR); - $res = -1; - } - - return $res; - } - -} -?>