Fix: Error management when adding notification

This commit is contained in:
Laurent Destailleur 2011-09-02 23:41:55 +00:00
parent 2d89e6609e
commit e5988ad241
18 changed files with 151 additions and 118 deletions

View File

@ -116,9 +116,8 @@ class Adherent extends CommonObject
/**
* Constructor
*
* @param DoliDB $DB Database handler
* Adherent
* @param DB base de donnees
*/
function Adherent($DB)
{

View File

@ -49,9 +49,8 @@ class AdherentType extends CommonObject
/**
* Constructor
*
* @param DoliDB $DB Database handler
* \brief AdherentType
* \param DB handler acces base de donnees
*/
function AdherentType($DB)
{
@ -195,7 +194,6 @@ class AdherentType extends CommonObject
/**
* Return list of members' type
*
* @return array List of types of members
*/
function liste_array()
@ -235,12 +233,11 @@ class AdherentType extends CommonObject
/**
* 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
* \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
*/
function getNomUrl($withpicto=0,$maxlen=0)
{
@ -263,7 +260,6 @@ class AdherentType extends CommonObject
/**
* getMailOnValid
*
* @return Return mail model
*/
function getMailOnValid()
@ -282,7 +278,6 @@ class AdherentType extends CommonObject
/**
* getMailOnSubscription
*
* @return Return mail model
*/
function getMailOnSubscription()
@ -301,7 +296,6 @@ class AdherentType extends CommonObject
/**
* getMailOnResiliate
*
* @return Return mail model
*/
function getMailOnResiliate()

View File

@ -45,12 +45,12 @@ class AdherentStats extends Stats
/**
* Constructor
* Constructor
*
* @param DoliDB $DB Database handler
* @param int $socid Id third party
* @param int $userid Id user for filter
* @return AdherentStats
* @param $DB Database handler
* @param $socid Id third party
* @param $userid Id user for filter
* @return AdherentStats
*/
function AdherentStats($DB, $socid=0, $userid=0)
{

View File

@ -49,9 +49,8 @@ class Cotisation extends CommonObject
/**
* Constructor
*
* @param DoliDB $DB Database handler
* \brief Constructor
* \param DB Handler base de donnees
*/
function Cotisation($DB)
{
@ -60,10 +59,9 @@ class Cotisation extends CommonObject
/**
* Fonction qui permet de creer la cotisation
*
* @param userid userid de celui qui insere
* @return int <0 si KO, Id cotisation cree si OK
* \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
*/
function create($userid)
{
@ -97,10 +95,9 @@ class Cotisation extends CommonObject
/**
* 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
* \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
*/
function fetch($rowid)
{
@ -147,11 +144,10 @@ class Cotisation extends CommonObject
/**
* 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
* \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
*/
function update($user,$notrigger=0)
{
@ -188,10 +184,9 @@ class Cotisation extends CommonObject
}
/**
* Delete a subscription
*
* @param rowid Id cotisation
* @return int <0 si KO, 0 si OK mais non trouve, >0 si OK
* \brief Delete a subscription
* \param rowid Id cotisation
* \return int <0 si KO, 0 si OK mais non trouve, >0 si OK
*/
function delete($user)
{
@ -255,10 +250,9 @@ class Cotisation extends CommonObject
/**
* 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
* \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
*/
function getNomUrl($withpicto=0)
{
@ -280,9 +274,8 @@ class Cotisation extends CommonObject
/**
* Charge les informations d'ordre info dans l'objet cotisation
*
* @param id Id adhesion a charger
* \brief Charge les informations d'ordre info dans l'objet cotisation
* \param id Id adhesion a charger
*/
function info($id)
{

View File

@ -168,7 +168,7 @@ dol_fiche_head($head, $tab, $langs->trans("Statistics"), 0, 'user');
// Print title
if ($mode && ! count($data))
if ($mode && ! sizeof($data))
{
print $langs->trans("NoValidatedMemberYet").'<br>';
print '<br>';
@ -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(".count($data).");\n";
print "\tdata.addRows(".sizeof($data).");\n";
print "\tdata.addColumn('string', 'Country');\n";
print "\tdata.addColumn('number', 'Number');\n";

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -18,9 +18,9 @@
*/
/**
* \file htdocs/admin/barcode.php
* \file htdocs/includes/modules/barcode/admin/barcode.php
* \ingroup barcode
* \brief Page to setup barcode module
* \brief Page d'administration/configuration du module Code barre
*/
require("../main.inc.php");

View File

@ -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;

View File

@ -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("",$langs->trans("BankSetupModule"));
llxHeader("","");
$html=new Form($db);
@ -144,8 +144,7 @@ $bankorder[1][2]='BankCode DeskCode BankAccountNumberKey AccountNumber';
$var = true;
$i=0;
$nbofbank=count($bankorder);
while ($i < $nbofbank)
while ($i < sizeof($bankorder))
{
$var = !$var;
@ -175,11 +174,11 @@ while ($i < $nbofbank)
print '</a></td>';
}
print '<td>&nbsp;</td>';
print '</tr>'."\n";
print "</tr>\n";
$i++;
}
print '</table>'."\n";
print "</table>\n";
dol_htmloutput_mesg($mesg);

View File

@ -19,7 +19,7 @@
*/
/**
* \file htdocs/compta/prelevement/class/ligne-prelevement.class.php
* \file htdocs/compta/prelevement/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');

View File

@ -401,7 +401,7 @@ print "</table>";
print '<br><table width="100%" class="noborder">';
// Factures non reglees
// Y a bug ici. Il faut prendre le reste a payer et non le total des factures non reglees !
// \todo 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";

View File

@ -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;

View File

@ -630,6 +630,58 @@ 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 "<table class=\"border\" width=\"100%\">";
// Topic
if ($withtopic)
{
print "<tr>";
print "<td width=\"180\">".$langs->trans("MailTopic")."</td>";
print "<td>";
print "<input type=\"text\" size=\"60\" name=\"subject\" value=\"\">";
print "</td></tr>";
}
// Message
if ($withbody)
{
print "<tr>";
print "<td width=\"180\" valign=\"top\">".$langs->trans("MailText")."</td>";
print "<td>";
print "<textarea rows=\"8\" cols=\"72\" name=\"message\">";
print $defaultbody;
print "</textarea>";
print "</td></tr>";
}
// Si fichier joint
if ($withfile)
{
print "<tr>";
print "<td width=\"180\">".$langs->trans("MailFile")."</td>";
print "<td>";
print "<input type=\"file\" name=\"addedfile\" value=\"".$langs->trans("Upload")."\"/>";
print "</td></tr>";
}
print "</table>";
}
}
?>

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This 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,11 +42,13 @@ 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
/**
* Constructor
*
* @param DoliDB $DB Database handler
* \brief Constructeur
* \param DB Handler acces base
*/
function Notify($DB)
{

View File

@ -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,23 +2120,21 @@ 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
* @param string $strImageCid CID
* @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
* @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;
@ -2172,7 +2170,7 @@ class SMTPs
* @return void
*
*/
function setSensitivity($_value = 0)
function setSensitivity ( $_value = 0 )
{
if ( ( is_numeric ($_value) ) &&
( ( $_value >= 0 ) && ( $_value <= 3 ) ) )
@ -2518,10 +2516,7 @@ class SMTPs
// ** CSV Version Control Info
/**
* $Log: smtps.class.php,v $
* Revision 1.1 2011/09/03 00:14:27 eldy
* Doxygen
*
* $Log: smtps.php,v $
* Revision 1.4 2011/08/28 14:24:23 eldy
* Doxygen
*

View File

@ -234,7 +234,7 @@ class CMailFile
// Use SMTPS library
// ------------------------------------------
require_once(DOL_DOCUMENT_ROOT."/core/class/smtps.class.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/smtps.php");
$smtps = new SMTPs();
$smtps->setCharSet($conf->file->character_set_client);

View File

@ -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

View File

@ -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);

View File

@ -129,8 +129,8 @@ $form = new Form($db);
llxHeader();
$object = new Societe($db);
$result=$object->fetch($socid);
$soc = new Societe($db);
$result=$soc->fetch($socid);
if ($result > 0)
{
@ -138,7 +138,7 @@ if ($result > 0)
$langs->load("other");
$head = societe_prepare_head($object);
$head = societe_prepare_head($soc);
dol_fiche_head($head, 'notify', $langs->trans("ThirdParty"),0,'company');
@ -146,7 +146,7 @@ if ($result > 0)
print '<table class="border"width="100%">';
print '<tr><td width="20%">'.$langs->trans("ThirdPartyName").'</td><td colspan="3">';
print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom');
print $form->showrefnav($soc,'socid','',($user->societe_id?0:1),'rowid','nom');
print '</td></tr>';
// Prefix
@ -177,7 +177,7 @@ if ($result > 0)
print '<td colspan="3">';
$sql = "SELECT COUNT(n.rowid) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."notify_def as n";
$sql.= " WHERE fk_soc = ".$object->id;
$sql.= " WHERE fk_soc = ".$soc->id;
$resql=$db->query($sql);
if ($resql)
{
@ -197,11 +197,11 @@ if ($result > 0)
print '</td></tr>';
print '</table>';
print '</div>';
// Help
print '<br>'.$langs->trans("NotificationsDesc").'<br>';
dol_fiche_end();
print $langs->trans("NotificationsDesc").'<br><br>';
print "\n";
@ -213,11 +213,10 @@ if ($result > 0)
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="add">';
$param="&socid=".$socid;
// Line with titles
print '<table width="100%" class="noborder">';
print '<tr class="liste_titre">';
$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);
print_liste_field_titre($langs->trans("Type"),"fiche.php","",'',$param,'"width="10%"',$sortfield,$sortorder);
@ -225,7 +224,7 @@ if ($result > 0)
print '</tr>';
$var=false;
$listofemails=$object->thirdparty_and_contact_email_array();
$listofemails=$soc->thirdparty_and_contact_email_array();
if (count($listofemails) > 0)
{
$actions=array();
@ -288,7 +287,7 @@ if ($result > 0)
$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;
$sql.= " AND c.fk_soc = ".$soc->id;
$resql=$db->query($sql);
if ($resql)
@ -351,9 +350,9 @@ if ($result > 0)
// Line with titles
print '<table width="100%" class="noborder">';
print '<tr class="liste_titre">';
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_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 '</tr>';
// List
@ -365,7 +364,7 @@ if ($result > 0)
$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 = ".$object->id;
$sql.= " AND c.fk_soc = ".$soc->id;
$resql=$db->query($sql);
if ($resql)