diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 77ac39628e3..48f9a089747 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -116,8 +116,9 @@ class Adherent extends CommonObject /** - * Adherent - * @param DB base de donnees + * Constructor + * + * @param DoliDB $DB Database handler */ function Adherent($DB) { diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 782949a2f92..3793be3b38d 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -49,8 +49,9 @@ class AdherentType extends CommonObject /** - * \brief AdherentType - * \param DB handler acces base de donnees + * Constructor + * + * @param DoliDB $DB Database handler */ function AdherentType($DB) { @@ -194,6 +195,7 @@ class AdherentType extends CommonObject /** * Return list of members' type + * * @return array List of types of members */ function liste_array() @@ -233,11 +235,12 @@ class AdherentType extends CommonObject /** - * \brief Renvoie nom clicable (avec eventuellement le picto) - * \param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul - * \param maxlen length max libelle - * \param option Page lien - * \return string Chaine avec URL + * Renvoie nom clicable (avec eventuellement le picto) + * + * @param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul + * @param maxlen length max libelle + * @param option Page lien + * @return string Chaine avec URL */ function getNomUrl($withpicto=0,$maxlen=0) { @@ -260,6 +263,7 @@ class AdherentType extends CommonObject /** * getMailOnValid + * * @return Return mail model */ function getMailOnValid() @@ -278,6 +282,7 @@ class AdherentType extends CommonObject /** * getMailOnSubscription + * * @return Return mail model */ function getMailOnSubscription() @@ -296,6 +301,7 @@ class AdherentType extends CommonObject /** * getMailOnResiliate + * * @return Return mail model */ function getMailOnResiliate() diff --git a/htdocs/adherents/class/adherentstats.class.php b/htdocs/adherents/class/adherentstats.class.php index 6ad16b59fdb..5ea122c80d3 100755 --- a/htdocs/adherents/class/adherentstats.class.php +++ b/htdocs/adherents/class/adherentstats.class.php @@ -45,12 +45,12 @@ class AdherentStats extends Stats /** - * Constructor + * Constructor * - * @param $DB Database handler - * @param $socid Id third party - * @param $userid Id user for filter - * @return AdherentStats + * @param DoliDB $DB Database handler + * @param int $socid Id third party + * @param int $userid Id user for filter + * @return AdherentStats */ function AdherentStats($DB, $socid=0, $userid=0) { diff --git a/htdocs/adherents/class/cotisation.class.php b/htdocs/adherents/class/cotisation.class.php index 7ce4ca1d80d..75c7749e465 100644 --- a/htdocs/adherents/class/cotisation.class.php +++ b/htdocs/adherents/class/cotisation.class.php @@ -49,8 +49,9 @@ class Cotisation extends CommonObject /** - * \brief Constructor - * \param DB Handler base de donnees + * Constructor + * + * @param DoliDB $DB Database handler */ function Cotisation($DB) { @@ -59,9 +60,10 @@ class Cotisation extends CommonObject /** - * \brief Fonction qui permet de creer la cotisation - * \param userid userid de celui qui insere - * \return int <0 si KO, Id cotisation cree si OK + * Fonction qui permet de creer la cotisation + * + * @param userid userid de celui qui insere + * @return int <0 si KO, Id cotisation cree si OK */ function create($userid) { @@ -95,9 +97,10 @@ class Cotisation extends CommonObject /** - * \brief Fonction qui permet de recuperer une cotisation - * \param rowid Id cotisation - * \return int <0 si KO, =0 si OK mais non trouve, >0 si OK + * Fonction qui permet de recuperer une cotisation + * + * @param rowid Id cotisation + * @return int <0 si KO, =0 si OK mais non trouve, >0 si OK */ function fetch($rowid) { @@ -144,10 +147,11 @@ class Cotisation extends CommonObject /** - * \brief Met a jour en base la cotisation - * \param user Objet user qui met a jour - * \param notrigger 0=Desactive les triggers - * \param int <0 if KO, >0 if OK + * Met a jour en base la cotisation + * + * @param user Objet user qui met a jour + * @param notrigger 0=Desactive les triggers + * @param int <0 if KO, >0 if OK */ function update($user,$notrigger=0) { @@ -184,9 +188,10 @@ class Cotisation extends CommonObject } /** - * \brief Delete a subscription - * \param rowid Id cotisation - * \return int <0 si KO, 0 si OK mais non trouve, >0 si OK + * Delete a subscription + * + * @param rowid Id cotisation + * @return int <0 si KO, 0 si OK mais non trouve, >0 si OK */ function delete($user) { @@ -250,9 +255,10 @@ class Cotisation extends CommonObject /** - * \brief Renvoie nom clicable (avec eventuellement le picto) - * \param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul - * \return string Chaine avec URL + * Renvoie nom clicable (avec eventuellement le picto) + * + * @param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul + * @return string Chaine avec URL */ function getNomUrl($withpicto=0) { @@ -274,8 +280,9 @@ class Cotisation extends CommonObject /** - * \brief Charge les informations d'ordre info dans l'objet cotisation - * \param id Id adhesion a charger + * Charge les informations d'ordre info dans l'objet cotisation + * + * @param id Id adhesion a charger */ function info($id) { diff --git a/htdocs/adherents/stats/geo.php b/htdocs/adherents/stats/geo.php index fc7e09f60b6..5ac68ded510 100755 --- a/htdocs/adherents/stats/geo.php +++ b/htdocs/adherents/stats/geo.php @@ -168,7 +168,7 @@ dol_fiche_head($head, $tab, $langs->trans("Statistics"), 0, 'user'); // Print title -if ($mode && ! sizeof($data)) +if ($mode && ! count($data)) { print $langs->trans("NoValidatedMemberYet").'
'; print '
'; @@ -202,7 +202,7 @@ if ($mode == 'memberbycountry') print "function drawMap() {\n\tvar data = new google.visualization.DataTable();\n"; // Get the total number of rows - print "\tdata.addRows(".sizeof($data).");\n"; + print "\tdata.addRows(".count($data).");\n"; print "\tdata.addColumn('string', 'Country');\n"; print "\tdata.addColumn('number', 'Number');\n"; diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php index 5e95f3366ca..dd47597da4e 100644 --- a/htdocs/admin/barcode.php +++ b/htdocs/admin/barcode.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2009 Laurent Destailleur + * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -18,9 +18,9 @@ */ /** - * \file htdocs/includes/modules/barcode/admin/barcode.php + * \file htdocs/admin/barcode.php * \ingroup barcode - * \brief Page d'administration/configuration du module Code barre + * \brief Page to setup barcode module */ require("../main.inc.php"); diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 0d89e763953..29d37ca6c06 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -2094,7 +2094,7 @@ class Propal extends CommonObject $this->nbtodolate++; } } - // \todo Definir regle des propales a facturer en retard + // TODO Definir regle des propales a facturer en retard // if ($mode == 'signed' && ! sizeof($this->FactureListeArray($obj->rowid))) $this->nbtodolate++; } return 1; diff --git a/htdocs/compta/bank/admin/bank.php b/htdocs/compta/bank/admin/bank.php index 4c33f0e3bd5..4d1608b7bd2 100644 --- a/htdocs/compta/bank/admin/bank.php +++ b/htdocs/compta/bank/admin/bank.php @@ -47,7 +47,7 @@ if ($action == 'set_BANK_CHEQUERECEIPT_FREE_TEXT') { $free = GETPOST("BANK_CHEQUERECEIPT_FREE_TEXT"); $res = dolibarr_set_const($db, "BANK_CHEQUERECEIPT_FREE_TEXT",$free,'chaine',0,'',$conf->entity); - + if (! $res > 0) $error++; if (! $error) @@ -78,7 +78,7 @@ if ($action == 'setbankorder') * view */ -llxHeader("",""); +llxHeader("",$langs->trans("BankSetupModule")); $html=new Form($db); @@ -144,7 +144,8 @@ $bankorder[1][2]='BankCode DeskCode BankAccountNumberKey AccountNumber'; $var = true; $i=0; -while ($i < sizeof($bankorder)) +$nbofbank=count($bankorder); +while ($i < $nbofbank) { $var = !$var; @@ -174,11 +175,11 @@ while ($i < sizeof($bankorder)) print ''; } print ' '; - print "\n"; + print ''."\n"; $i++; } -print "\n"; +print ''."\n"; dol_htmloutput_mesg($mesg); diff --git a/htdocs/compta/prelevement/class/ligne-prelevement.class.php b/htdocs/compta/prelevement/class/ligne-prelevement.class.php index a9ec795657b..e286e5a2fa2 100644 --- a/htdocs/compta/prelevement/class/ligne-prelevement.class.php +++ b/htdocs/compta/prelevement/class/ligne-prelevement.class.php @@ -19,7 +19,7 @@ */ /** - * \file htdocs/compta/prelevement/ligne-prelevement.class.php + * \file htdocs/compta/prelevement/class/ligne-prelevement.class.php * \ingroup prelevement * \brief Fichier de la classe des lignes de prelevements */ @@ -46,12 +46,12 @@ class LignePrelevement function LignePrelevement($DB, $user) { global $conf,$langs; - + $this->db = $DB ; $this->user = $user; // List of language codes for status - + $langs->load("withdrawals"); $this->statuts[0]=$langs->trans("StatusWaiting"); $this->statuts[2]=$langs->trans("StatusCredited"); @@ -107,7 +107,7 @@ class LignePrelevement return $result; } - + /** * Return status label of object * @param mode 0=Label, 1=Picto + label, 2=Picto, 3=Label + Picto @@ -132,7 +132,7 @@ class LignePrelevement { return $langs->trans($this->statuts[$statut]); } - + if ($mode == 1) { if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]); @@ -145,7 +145,7 @@ class LignePrelevement if ($statut==2) return img_picto($langs->trans($this->statuts[$statut]),'statut4'); if ($statut==3) return img_picto($langs->trans($this->statuts[$statut]),'statut8'); } - + if ($mode == 3) { if ($statut==0) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut0'); diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php index c98a7b4e1eb..338a47a5d85 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -401,7 +401,7 @@ print ""; print '
'; // Factures non reglees - // \todo Y a bug ici. Il faut prendre le reste a payer et non le total des factures non reglees ! + // Y a bug ici. Il faut prendre le reste a payer et non le total des factures non reglees ! $sql = "SELECT f.facnumber, f.rowid, s.nom, s.rowid as socid, f.total_ttc, sum(pf.amount) as am"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f left join ".MAIN_DB_PREFIX."paiement_facture as pf on f.rowid=pf.fk_facture"; diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index 02312e6d45b..8417972d104 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -511,7 +511,7 @@ class Tva extends CommonObject $result = $this->db->query($sql); if ($result) { - $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."tva"); // \todo devrait s'appeler paiementtva + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."tva"); // TODO devrait s'appeler paiementtva if ($this->id > 0) { $ok=1; diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 05dd38b43c1..1856b452608 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -630,58 +630,6 @@ class FormMail return $out; } - - - /** - * \brief Affiche la partie de formulaire pour saisie d'un mail - * \param withtopic 1 pour proposer a la saisie le sujet - * \param withbody 1 pour proposer a la saisie le corps du message - * \param withfile 1 pour proposer a la saisie l'ajout d'un fichier joint - * \todo Fonction a virer quand fichier /comm/mailing.php vire (= quand ecran dans /comm/mailing prets) - */ - function mail_topicmessagefile($withtopic=1,$withbody=1,$withfile=1,$defaultbody) - { - global $langs; - - $langs->load("other"); - - print "
"; - - // Topic - if ($withtopic) - { - print ""; - print ""; - print ""; - } - - // Message - if ($withbody) - { - print ""; - print ""; - print ""; - } - - // Si fichier joint - if ($withfile) - { - print ""; - print ""; - print ""; - } - - print "
".$langs->trans("MailTopic").""; - print ""; - print "
".$langs->trans("MailText").""; - print ""; - print "
".$langs->trans("MailFile").""; - print "trans("Upload")."\"/>"; - print "
"; - } - } ?> diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index 6bc26636542..155ca106014 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2008 Laurent Destailleur + * Copyright (C) 2004-2011 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 @@ -42,13 +42,11 @@ class Notify var $fk_project; // Les codes actions sont definis dans la table llx_notify_def - // \todo utiliser des codes texte plutot que numerique - // 1 = Validation fiche inter - // 2 = Validation facture /** - * \brief Constructeur - * \param DB Handler acces base + * Constructor + * + * @param DoliDB $DB Database handler */ function Notify($DB) { diff --git a/htdocs/core/class/smtps.php b/htdocs/core/class/smtps.class.php similarity index 98% rename from htdocs/core/class/smtps.php rename to htdocs/core/class/smtps.class.php index d4d37affff1..f4a8c4008a8 100755 --- a/htdocs/core/class/smtps.php +++ b/htdocs/core/class/smtps.class.php @@ -2103,7 +2103,7 @@ class SMTPs * @return void * */ - function setAttachment ( $strContent, $strFileName = 'unknown', $strMimeType = 'unknown' ) + function setAttachment($strContent, $strFileName = 'unknown', $strMimeType = 'unknown') { if ( $strContent ) { @@ -2120,21 +2120,23 @@ class SMTPs // DOL_CHANGE LDR + /** - * Method public void setImageInline( string ) - * - * Image attachments are added to the content array as sub-arrays, - * allowing for multiple images for each outbound email - * - * @param string $strContent Image data to attach to message - * @param string $strImageName Image Name to give to attachment - * @param string $strMimeType Image Mime Type of attachment - * @return void - * - */ - function setImageInline ( $strContent, $strImageName = 'unknown', $strMimeType = 'unknown', $strImageCid = 'unknown' ) + * Method public void setImageInline( string ) + * + * Image attachments are added to the content array as sub-arrays, + * allowing for multiple images for each outbound email + * + * @param string $strContent Image data to attach to message + * @param string $strImageName Image Name to give to attachment + * @param string $strMimeType Image Mime Type of attachment + * @param string $strImageCid CID + * @return void + * + */ + function setImageInline($strContent, $strImageName = 'unknown', $strMimeType = 'unknown', $strImageCid = 'unknown') { - if ( $strContent ) + if ($strContent) { $this->_msgContent['image'][$strImageName]['mimeType'] = $strMimeType; $this->_msgContent['image'][$strImageName]['imageName'] = $strImageName; @@ -2170,7 +2172,7 @@ class SMTPs * @return void * */ - function setSensitivity ( $_value = 0 ) + function setSensitivity($_value = 0) { if ( ( is_numeric ($_value) ) && ( ( $_value >= 0 ) && ( $_value <= 3 ) ) ) @@ -2516,7 +2518,10 @@ class SMTPs // ** CSV Version Control Info /** - * $Log: smtps.php,v $ + * $Log: smtps.class.php,v $ + * Revision 1.1 2011/09/03 00:14:27 eldy + * Doxygen + * * Revision 1.4 2011/08/28 14:24:23 eldy * Doxygen * diff --git a/htdocs/lib/CMailFile.class.php b/htdocs/lib/CMailFile.class.php index 2a719fc4085..307c2f7391c 100644 --- a/htdocs/lib/CMailFile.class.php +++ b/htdocs/lib/CMailFile.class.php @@ -234,7 +234,7 @@ class CMailFile // Use SMTPS library // ------------------------------------------ - require_once(DOL_DOCUMENT_ROOT."/core/class/smtps.php"); + require_once(DOL_DOCUMENT_ROOT."/core/class/smtps.class.php"); $smtps = new SMTPs(); $smtps->setCharSet($conf->file->character_set_client); diff --git a/htdocs/lib/tax.lib.php b/htdocs/lib/tax.lib.php index 1cd19bc8765..29bf272ebd6 100644 --- a/htdocs/lib/tax.lib.php +++ b/htdocs/lib/tax.lib.php @@ -64,7 +64,7 @@ function vat_by_thirdparty($db, $y, $date_start, $date_end, $modetax, $direction // If vat paid on due invoices (non draft) if ($conf->global->MAIN_MODULE_ACCOUNTING) { - // \todo a ce jour on se sait pas la compter car le montant tva d'un payment + // TODO a ce jour on se sait pas la compter car le montant tva d'un payment // n'est pas stocke dans la table des payments. // Seul le module compta expert peut resoudre ce probleme. // (Il faut quand un payment a lieu, stocker en plus du montant du paiement le @@ -102,7 +102,7 @@ function vat_by_thirdparty($db, $y, $date_start, $date_end, $modetax, $direction if ($conf->global->MAIN_MODULE_ACCOUNTING) { // If vat paid on payments - // \todo a ce jour on se sait pas la compter car le montant tva d'un payment + // TODO a ce jour on se sait pas la compter car le montant tva d'un payment // n'est pas stocke dans la table des payments. // Seul le module compta expert peut resoudre ce probleme. // (Il faut quand un payment a lieu, stocker en plus du montant du paiement le @@ -215,7 +215,7 @@ function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction, { if ($conf->global->MAIN_MODULE_ACCOUNTING) { - // \todo a ce jour on se sait pas la compter car le montant tva d'un payment + // TODO a ce jour on se sait pas la compter car le montant tva d'un payment // n'est pas stocke dans la table des payments. // Seul le module compta expert peut resoudre ce probleme. // (Il faut quand un payment a lieu, stocker en plus du montant du paiement le @@ -261,7 +261,7 @@ function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction, { if ($conf->global->MAIN_MODULE_ACCOUNTING) { - // \todo a ce jour on se sait pas la compter car le montant tva d'un payment + // TODO a ce jour on se sait pas la compter car le montant tva d'un payment // n'est pas stocke dans la table des payments. // Seul le module compta expert peut resoudre ce probleme. // (Il faut quand un payment a lieu, stocker en plus du montant du paiement le @@ -376,7 +376,7 @@ function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction, if ($conf->global->MAIN_MODULE_ACCOUNTING) { // Count on invoice date - // \todo a ce jour on se sait pas la compter car le montant tva d'un payment + // TODO a ce jour on se sait pas la compter car le montant tva d'un payment // n'est pas stocke dans la table des payments. // Seul le module compta expert peut resoudre ce probleme. // (Il faut quand un payment a lieu, stocker en plus du montant du paiement le @@ -423,7 +423,7 @@ function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction, if ($conf->global->MAIN_MODULE_ACCOUNTING) { // Count on payments date - // \todo a ce jour on se sait pas la compter car le montant tva d'un payment + // TODO a ce jour on se sait pas la compter car le montant tva d'un payment // n'est pas stocke dans la table des payments. // Seul le module compta expert peut resoudre ce probleme. // (Il faut quand un paiement a lieu, stocker en plus du montant du paiement le diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index b803dce5844..1babd5f2e19 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2485,7 +2485,7 @@ class Product extends CommonObject if (file_exists($dir_osencoded)) { // Cree fichier en taille vignette - // \todo A faire + // TODO A faire // Cree fichier en taille origine $content = @file_get_contents($file); diff --git a/htdocs/societe/notify/fiche.php b/htdocs/societe/notify/fiche.php index 4222a4dacab..13f9dd0dcc0 100644 --- a/htdocs/societe/notify/fiche.php +++ b/htdocs/societe/notify/fiche.php @@ -52,6 +52,8 @@ $pagenext = $page + 1; if (! $sortorder) $sortorder="ASC"; if (! $sortfield) $sortfield="c.name"; +$now=dol_now(); + /* * Actions @@ -60,33 +62,61 @@ if (! $sortfield) $sortfield="c.name"; // Add a notification if ($action == 'add') { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def"; - $sql .= " WHERE fk_soc=".$socid." AND fk_contact=".$_POST["contactid"]." AND fk_action=".$_POST["actionid"]; - if ($db->query($sql)) - { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."notify_def (datec,fk_soc, fk_contact, fk_action)"; - $sql .= " VALUES (".$db->idate(mktime()).",".$socid.",".$_POST["contactid"].",".$_POST["actionid"].")"; + $error=0; - if ($db->query($sql)) - { + if (empty($contactid)) + { + $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Contact")).'
'; + $error++; + } + if ($actionid <= 0) + { + $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Action")).'
'; + $error++; + } - } - else - { - dol_print_error($db); - } - } - else - { - dol_print_error($db); - } + if (! $error) + { + $db->begin(); + + $sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def"; + $sql .= " WHERE fk_soc=".$socid." AND fk_contact=".$contactid." AND fk_action=".$actionid; + if ($db->query($sql)) + { + $sql = "INSERT INTO ".MAIN_DB_PREFIX."notify_def (datec,fk_soc, fk_contact, fk_action)"; + $sql .= " VALUES ('".$db->idate($now)."',".$socid.",".$contactid.",".$actionid.")"; + + if ($db->query($sql)) + { + + } + else + { + $error++; + dol_print_error($db); + } + } + else + { + dol_print_error($db); + } + + if (! $error) + { + $db->commit(); + } + else + { + $db->rollback(); + } + } } // Remove a notification if ($action == 'delete') { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def where rowid=".$_GET["actid"].";"; - $db->query($sql); + $sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def where rowid=".$_GET["actid"].";"; + $db->query($sql); } @@ -99,80 +129,106 @@ $form = new Form($db); llxHeader(); -$soc = new Societe($db); -$result=$soc->fetch($socid); +$object = new Societe($db); +$result=$object->fetch($socid); if ($result > 0) { - $html = new Form($db); - $langs->load("other"); + $html = new Form($db); + $langs->load("other"); - $head = societe_prepare_head($soc); + $head = societe_prepare_head($object); - dol_fiche_head($head, 'notify', $langs->trans("ThirdParty"),0,'company'); + dol_fiche_head($head, 'notify', $langs->trans("ThirdParty"),0,'company'); - print ''; + print '
'; - print ''; + print ''; - print ''; - print ''; - print '
'.$langs->trans("ThirdPartyName").''; - print $form->showrefnav($soc,'socid','',($user->societe_id?0:1),'rowid','nom'); - print '
'.$langs->trans("ThirdPartyName").''; + print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom'); + print '
'.$langs->trans("NbOfActiveNotifications").''; - $sql = "SELECT COUNT(n.rowid) as nb"; - $sql.= " FROM ".MAIN_DB_PREFIX."notify_def as n"; - $sql.= " WHERE fk_soc = ".$soc->id; - $resql=$db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - while ($i < $num) - { - $obj = $db->fetch_object($resql); - $nb=$obj->nb; - $i++; - } - } - else { - dol_print_error($db); - } - print $nb; - print '
'; + // Prefix + if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field + { + print ''.$langs->trans('Prefix').''.$object->prefix_comm.''; + } - print ''; + if ($object->client) + { + print ''; + print $langs->trans('CustomerCode').''; + print $object->code_client; + if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; + print ''; + } + + if ($object->fournisseur) + { + print ''; + print $langs->trans('SupplierCode').''; + print $object->code_fournisseur; + if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; + print ''; + } + + print ''.$langs->trans("NbOfActiveNotifications").''; + print ''; + $sql = "SELECT COUNT(n.rowid) as nb"; + $sql.= " FROM ".MAIN_DB_PREFIX."notify_def as n"; + $sql.= " WHERE fk_soc = ".$object->id; + $resql=$db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + $i = 0; + while ($i < $num) + { + $obj = $db->fetch_object($resql); + $nb=$obj->nb; + $i++; + } + } + else { + dol_print_error($db); + } + print $nb; + print ''; + print ''; + + // Help + print '
'.$langs->trans("NotificationsDesc").'
'; - // Help - print $langs->trans("NotificationsDesc").'

'; + dol_fiche_end(); - print "\n"; + print "\n"; - // Add notification form - print_fiche_titre($langs->trans("AddNewNotification"),'',''); + // Add notification form + print_fiche_titre($langs->trans("AddNewNotification"),'',''); - print '
'; - print ''; + print ''; + print ''; + print ''; - // Line with titles - print ''; - print ''; - $param="&socid=".$socid; - print_liste_field_titre($langs->trans("Contact"),"fiche.php","c.name",'',$param,'"width="45%"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Action"),"fiche.php","a.titre",'',$param,'"width="35%"',$sortfield,$sortorder); + $param="&socid=".$socid; + + // Line with titles + print '
'; + print ''; + print_liste_field_titre($langs->trans("Contact"),"fiche.php","c.name",'',$param,'"width="45%"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Action"),"fiche.php","a.titre",'',$param,'"width="35%"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Type"),"fiche.php","",'',$param,'"width="10%"',$sortfield,$sortorder); - print_liste_field_titre(''); - print ''; + print_liste_field_titre(''); + print ''; - $var=false; - $listofemails=$soc->thirdparty_and_contact_email_array(); - if (count($listofemails) > 0) - { - $actions=array(); + $var=false; + $listofemails=$object->thirdparty_and_contact_email_array(); + if (count($listofemails) > 0) + { + $actions=array(); // Load array of available notifications $notificationtrigger=new InterfaceNotification($db); @@ -183,172 +239,172 @@ if ($result > 0) $label=$langs->trans("Notify_".$notifiedevent['code'])!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label']; $actions[$notifiedevent['rowid']]=$label; } - print ''; - print ''; - print ''; + print ''; + print ''; print ''; - print ''; - print ''; - } - else - { - print ''; - } + print ''; + print ''; + } + else + { + print ''; + } - print '
'; - print $html->selectarray("contactid",$listofemails); - print ''; - print $html->selectarray("actionid",$actions,'',1); - print '
'; + print $html->selectarray("contactid",$listofemails); + print ''; + print $html->selectarray("actionid",$actions,'',1); + print ''; $type=array('email'=>$langs->trans("EMail")); print $html->selectarray("typeid",$type); print '
'; - print $langs->trans("YouMustCreateContactFirst"); - print '
'; + print $langs->trans("YouMustCreateContactFirst"); + print '
'; + print ''; - print '
'; - print '
'; + print ''; + print '
'; + dol_htmloutput_mesg($mesg); - // List of active notifications - print_fiche_titre($langs->trans("ListOfActiveNotifications"),'',''); - $var=true; + // List of active notifications + print_fiche_titre($langs->trans("ListOfActiveNotifications"),'',''); + $var=true; - // Line with titles - print ''; - print ''; - print_liste_field_titre($langs->trans("Contact"),"fiche.php","c.name",'',$param,'"width="45%"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Action"),"fiche.php","a.titre",'',$param,'"width="35%"',$sortfield,$sortorder); + // Line with titles + print '
'; + print ''; + print_liste_field_titre($langs->trans("Contact"),"fiche.php","c.name",'',$param,'"width="45%"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Action"),"fiche.php","a.titre",'',$param,'"width="35%"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Type"),"fiche.php","",'',$param,'"width="10%"',$sortfield,$sortorder); - print_liste_field_titre('','',''); - print ''; + print_liste_field_titre('','',''); + print ''; - // List of notifications for contacts - $sql = "SELECT n.rowid, n.type,"; - $sql.= " a.code, a.label,"; + // List of notifications for contacts + $sql = "SELECT n.rowid, n.type,"; + $sql.= " a.code, a.label,"; $sql.= " c.rowid as contactid, c.name, c.firstname, c.email"; - $sql.= " FROM ".MAIN_DB_PREFIX."c_action_trigger as a,"; - $sql.= " ".MAIN_DB_PREFIX."notify_def as n,"; - $sql.= " ".MAIN_DB_PREFIX."socpeople c"; - $sql.= " WHERE a.rowid = n.fk_action"; - $sql.= " AND c.rowid = n.fk_contact"; - $sql.= " AND c.fk_soc = ".$soc->id; + $sql.= " FROM ".MAIN_DB_PREFIX."c_action_trigger as a,"; + $sql.= " ".MAIN_DB_PREFIX."notify_def as n,"; + $sql.= " ".MAIN_DB_PREFIX."socpeople c"; + $sql.= " WHERE a.rowid = n.fk_action"; + $sql.= " AND c.rowid = n.fk_contact"; + $sql.= " AND c.fk_soc = ".$object->id; - $resql=$db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; + $resql=$db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + $i = 0; - $contactstatic=new Contact($db); + $contactstatic=new Contact($db); - while ($i < $num) - { - $var = !$var; + while ($i < $num) + { + $var = !$var; - $obj = $db->fetch_object($resql); + $obj = $db->fetch_object($resql); - $contactstatic->id=$obj->contactid; - $contactstatic->name=$obj->name; - $contactstatic->firstname=$obj->firstname; - print ''; - print ''; + $contactstatic->id=$obj->contactid; + $contactstatic->name=$obj->name; + $contactstatic->firstname=$obj->firstname; + print ''; + print ''; print ''; print ''; - print ''; - $i++; - } - $db->free($resql); - } - else - { - dol_print_error($db); - } + print ''; + $i++; + } + $db->free($resql); + } + else + { + dol_print_error($db); + } - print '
'.$contactstatic->getNomUrl(1); - if ($obj->type == 'email') - { - if (isValidEmail($obj->email)) - { - print ' <'.$obj->email.'>'; - } - else - { - $langs->load("errors"); - print '   '.img_warning().' '.$langs->trans("ErrorBadEMail",$obj->email); - } - } - print ''; - $label=($langs->trans("Notify_".$obj->code)!="Notify_".$obj->code?$langs->trans("Notify_".$obj->code):$obj->label); - print $label; - print '
'.$contactstatic->getNomUrl(1); + if ($obj->type == 'email') + { + if (isValidEmail($obj->email)) + { + print ' <'.$obj->email.'>'; + } + else + { + $langs->load("errors"); + print '   '.img_warning().' '.$langs->trans("ErrorBadEMail",$obj->email); + } + } + print ''; + $label=($langs->trans("Notify_".$obj->code)!="Notify_".$obj->code?$langs->trans("Notify_".$obj->code):$obj->label); + print $label; + print ''; if ($obj->type == 'email') print $langs->trans("Email"); if ($obj->type == 'sms') print $langs->trans("SMS"); print ''.img_delete().'
'; - print '
'; + print ''; + print '
'; - // List of notifications done - print_fiche_titre($langs->trans("ListOfNotificationsDone"),'',''); - $var=true; + // List of notifications done + print_fiche_titre($langs->trans("ListOfNotificationsDone"),'',''); + $var=true; - // Line with titles - print ''; - print ''; - print_liste_field_titre($langs->trans("Contact"),"fiche.php","c.name",'',"&socid=$socid",'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Action"),"fiche.php","a.titre",'',"&socid=$socid",'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Date"),"fiche.php","a.titre",'',"&socid=$socid",'align="right"',$sortfield,$sortorder); - print ''; + // Line with titles + print '
'; + print ''; + print_liste_field_titre($langs->trans("Contact"),"fiche.php","c.name",'',$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Action"),"fiche.php","a.titre",'',$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Date"),"fiche.php","a.daten",'',$param,'align="right"',$sortfield,$sortorder); + print ''; - // List - $sql = "SELECT n.rowid, n.daten, n.email, n.objet_type, n.objet_id,"; - $sql.= " c.rowid as id, c.name, c.firstname, c.email,"; - $sql.= " a.code, a.label"; - $sql.= " FROM ".MAIN_DB_PREFIX."c_action_trigger as a,"; - $sql.= " ".MAIN_DB_PREFIX."notify as n, "; + // List + $sql = "SELECT n.rowid, n.daten, n.email, n.objet_type, n.objet_id,"; + $sql.= " c.rowid as id, c.name, c.firstname, c.email,"; + $sql.= " a.code, a.label"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_action_trigger as a,"; + $sql.= " ".MAIN_DB_PREFIX."notify as n, "; $sql.= " ".MAIN_DB_PREFIX."socpeople as c"; $sql.= " WHERE a.rowid = n.fk_action"; $sql.= " AND c.rowid = n.fk_contact"; - $sql.= " AND c.fk_soc = ".$soc->id; + $sql.= " AND c.fk_soc = ".$object->id; - $resql=$db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; + $resql=$db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + $i = 0; - $contactstatic=new Contact($db); + $contactstatic=new Contact($db); - while ($i < $num) - { - $var = !$var; + while ($i < $num) + { + $var = !$var; - $obj = $db->fetch_object($resql); + $obj = $db->fetch_object($resql); - $contactstatic->id=$obj->id; - $contactstatic->name=$obj->name; - $contactstatic->firstname=$obj->firstname; - print ''; - print ''; - // TODO Add link to object here - // print - print''; - print ''; - $i++; - } - $db->free($resql); - } - else - { - dol_print_error($db); - } + $contactstatic->id=$obj->id; + $contactstatic->name=$obj->name; + $contactstatic->firstname=$obj->firstname; + print ''; + print ''; + // TODO Add link to object here + // print + print''; + print ''; + $i++; + } + $db->free($resql); + } + else + { + dol_print_error($db); + } - print '
'.$contactstatic->getNomUrl(1); - print $obj->email?' <'.$obj->email.'>':$langs->trans("NoMail"); - print ''; - $label=($langs->trans("Notify_".$obj->code)!="Notify_".$obj->code?$langs->trans("Notify_".$obj->code):$obj->label); - print $label; - print ''.dol_print_date($db->jdate($obj->daten), 'dayhour').'
'.$contactstatic->getNomUrl(1); + print $obj->email?' <'.$obj->email.'>':$langs->trans("NoMail"); + print ''; + $label=($langs->trans("Notify_".$obj->code)!="Notify_".$obj->code?$langs->trans("Notify_".$obj->code):$obj->label); + print $label; + print ''.dol_print_date($db->jdate($obj->daten), 'dayhour').'
'; + print ''; } else dol_print_error('','RecordNotFound');