Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2015-04-06 14:11:52 +02:00
commit 683f27f6b1
53 changed files with 537 additions and 469 deletions

View File

@ -44,11 +44,11 @@ Use clear commit messages with the following structure:
<pre>
FIX|Fix #456 Short description (where #456 is number of bug fix, if it exists. In upper case to appear into ChangeLog)
or
CLOSE|Close #456 Short description (where #456 is number feature request, if it exists. In upper case to appear into ChangeLog)
CLOSE|Close #456 Short description (where #456 is number of feature request, if it exists. In upper case to appear into ChangeLog)
or
NEW|New Short description (In upper case to appear into ChangeLog)
NEW|New Short description (In upper case to appear into ChangeLog, use this if you add a feature not tracked, otherwise use CLOSE #456)
or
Short description (when the commit is not introducing feature or closing a bug)
Short description (when the commit is not introducing feature nor closing a bug)
Long description (Can span accross multiple lines).
</pre>

View File

@ -5,7 +5,7 @@
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2014-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
@ -77,7 +77,7 @@ class Adherent extends CommonObject
var $morphy;
var $public;
var $note; // Private note
var $note_private; // Private note
var $statut; // -1:brouillon, 0:resilie, >=1:valide,paye
var $photo;
@ -310,7 +310,7 @@ class Adherent extends CommonObject
$sql.= " VALUES (";
$sql.= " '".$this->db->idate($this->datec)."'";
$sql.= ", ".($this->login?"'".$this->db->escape($this->login)."'":"null");
$sql.= ", ".($user->id>0?$user->id:"null"); // Can be null because member can be createb by a guest or a script
$sql.= ", ".($user->id>0?$user->id:"null"); // Can be null because member can be created by a guest or a script
$sql.= ", null, null, '".$this->morphy."'";
$sql.= ", '".$this->typeid."'";
$sql.= ", ".$conf->entity;
@ -445,9 +445,9 @@ class Adherent extends CommonObject
$sql.= ", email='".$this->email."'";
$sql.= ", skype='".$this->skype."'";
$sql.= ", phone=" .($this->phone?"'".$this->db->escape($this->phone)."'":"null");
$sql.= ", phone_perso=" .($this->phone_perso?"'".$this->db->escape($this->phone_perso)."'":"null");
$sql.= ", phone_perso=" .($this->phone_perso?"'".$this->db->escape($this->phone_perso)."'":"null");
$sql.= ", phone_mobile=" .($this->phone_mobile?"'".$this->db->escape($this->phone_mobile)."'":"null");
$sql.= ", note=" .($this->note?"'".$this->db->escape($this->note)."'":"null");
$sql.= ", note_private=" .($this->note_private?"'".$this->db->escape($this->note_private)."'":"null");
$sql.= ", photo=" .($this->photo?"'".$this->photo."'":"null");
$sql.= ", public='".$this->public."'";
$sql.= ", statut=" .$this->statut;
@ -1053,7 +1053,7 @@ class Adherent extends CommonObject
{
global $langs;
$sql = "SELECT d.rowid, d.ref_ext, d.civility as civility_id, d.firstname, d.lastname, d.societe as company, d.fk_soc, d.statut, d.public, d.address, d.zip, d.town, d.note,";
$sql = "SELECT d.rowid, d.ref_ext, d.civility as civility_id, d.firstname, d.lastname, d.societe as company, d.fk_soc, d.statut, d.public, d.address, d.zip, d.town, d.note_private,";
$sql.= " d.email, d.skype, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass,";
$sql.= " d.photo, d.fk_adherent_type, d.morphy, d.entity,";
$sql.= " d.datec as datec,";
@ -1134,7 +1134,7 @@ class Adherent extends CommonObject
$this->datevalid = $this->db->jdate($obj->datev);
$this->birth = $this->db->jdate($obj->birthday);
$this->note = $obj->note;
$this->note_private = $obj->note_private;
$this->morphy = $obj->morphy;
$this->typeid = $obj->fk_adherent_type;
@ -1801,7 +1801,7 @@ class Adherent extends CommonObject
$this->phone = '0999999999';
$this->phone_perso = '0999999998';
$this->phone_mobile = '0999999997';
$this->note='No comment';
$this->note_private='No comment';
$this->birth=time();
$this->photo='';
$this->public=1;
@ -1874,7 +1874,7 @@ class Adherent extends CommonObject
if ($this->phone_perso && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO] = $this->phone_perso;
if ($this->phone_mobile && ! empty($conf->global->LDAP_MEMBER_FIELD_MOBILE)) $info[$conf->global->LDAP_MEMBER_FIELD_MOBILE] = $this->phone_mobile;
if ($this->fax && ! empty($conf->global->LDAP_MEMBER_FIELD_FAX)) $info[$conf->global->LDAP_MEMBER_FIELD_FAX] = $this->fax;
if ($this->note && ! empty($conf->global->LDAP_MEMBER_FIELD_DESCRIPTION)) $info[$conf->global->LDAP_MEMBER_FIELD_DESCRIPTION] = $this->note;
if ($this->note_private && ! empty($conf->global->LDAP_MEMBER_FIELD_DESCRIPTION)) $info[$conf->global->LDAP_MEMBER_FIELD_DESCRIPTION] = $this->note_private;
if ($this->birth && ! empty($conf->global->LDAP_MEMBER_FIELD_BIRTHDATE)) $info[$conf->global->LDAP_MEMBER_FIELD_BIRTHDATE] = dol_print_date($this->birth,'dayhourldap');
if (isset($this->statut) && ! empty($conf->global->LDAP_FIELD_MEMBER_STATUS)) $info[$conf->global->LDAP_FIELD_MEMBER_STATUS] = $this->statut;
if ($this->datefin && ! empty($conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION)) $info[$conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION] = dol_print_date($this->datefin,'dayhourldap');

View File

@ -19,7 +19,7 @@
/**
* \file htdocs/adherents/note.php
* \ingroup member
* \brief Tabe for note of a member
* \brief Tab for note of a member
*/
require '../main.inc.php';
@ -54,7 +54,7 @@ if ($action == 'update' && $user->rights->adherent->creer && ! $_POST["cancel"])
{
$db->begin();
$res=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
$res=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES), '_private');
if ($res < 0)
{
setEventMessage($object->error, 'errors');
@ -82,7 +82,7 @@ if ($id)
dol_fiche_head($head, 'note', $langs->trans("Member"), 0, 'user');
print "<form method=\"post\" action=\"note.php\">";
print "<form method=\"post\" action=\"".$_SERVER['PHP_SELF']."\">";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="border" width="100%">';
@ -129,7 +129,7 @@ if ($id)
// Status
print '<tr><td>'.$langs->trans("Status").'</td><td class="valeur">'.$object->getLibStatut(4).'</td></tr>';
// Note
// Private note
print '<tr><td valign="top">'.$langs->trans("Note").'</td>';
print '<td valign="top" colspan="3">';
if ($action == 'edit' && $user->rights->adherent->creer)
@ -137,12 +137,12 @@ if ($id)
print "<input type=\"hidden\" name=\"action\" value=\"update\">";
print "<input type=\"hidden\" name=\"id\" value=\"".$object->id."\">";
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('note',$object->note,'',280,'dolibarr_notes','',true,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,10,80);
$doleditor=new DolEditor('note_private',$object->note_private,'',280,'dolibarr_notes','',true,false,$conf->global->FCKEDITOR_ENABLE_SOCIETE,10,80);
$doleditor->Create();
}
else
{
print nl2br($object->note);
print dol_htmlentitiesbr($object->note_private);
}
print "</td></tr>";
@ -150,7 +150,7 @@ if ($id)
{
print '<tr><td colspan="4" align="center">';
print '<input type="submit" class="button" name="update" value="'.$langs->trans("Save").'">';
print '&nbsp; &nbsp;';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</td></tr>';
}

View File

@ -220,8 +220,8 @@ class ICal
}
if (($key == "DTSTAMP") or ($key == "LAST-MODIFIED") or ($key == "CREATED")) $value = $this->ical_date_to_unix($value);
if ($key == "RRULE" ) $value = $this->ical_rrule($value);
//if ($key == "RRULE" ) $value = $this->ical_rrule($value);
if (stristr($key,"DTSTART") or stristr($key,"DTEND") or stristr($key,"DTSTART;VALUE=DATE") or stristr($key,"DTEND;VALUE=DATE"))
{
if (stristr($key,"DTSTART;VALUE=DATE") or stristr($key,"DTEND;VALUE=DATE"))

View File

@ -302,7 +302,7 @@ if (empty($reshook))
$object->modelpdf = GETPOST('model');
$object->author = $user->id; // deprecated
$object->note = GETPOST('note');
$object->statut = 0;
$object->statut = Propal::STATUS_DRAFT;
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
@ -549,7 +549,7 @@ if (empty($reshook))
// Reopen proposal
else if ($action == 'confirm_reopen' && $user->rights->propal->cloturer && ! GETPOST('cancel')) {
// prevent browser refresh from reopening proposal several times
if ($object->statut == 2 || $object->statut == 3 || $object->statut == 4) {
if ($object->statut == Propal::STATUS_SIGNED || $object->statut == Propal::STATUS_NOTSIGNED || $object->statut == Propal::STATUS_BILLED) {
$object->reopen($user, 1);
}
}
@ -561,7 +561,7 @@ if (empty($reshook))
$action = 'statut';
} else {
// prevent browser refresh from closing proposal several times
if ($object->statut == 1) {
if ($object->statut == Propal::STATUS_VALIDATED) {
$object->cloture($user, GETPOST('statut'), GETPOST('note'));
}
}
@ -575,7 +575,7 @@ if (empty($reshook))
// Reopen proposal
else if ($action == 'confirm_reopen' && $user->rights->propal->cloturer && ! GETPOST('cancel')) {
// prevent browser refresh from reopening proposal several times
if ($object->statut == 2 || $object->statut == 3 || $object->statut == 4) {
if ($object->statut == Propal::STATUS_SIGNED || $object->statut == Propal::STATUS_NOTSIGNED || $object->statut == Propal::STATUS_BILLED) {
$object->reopen($user, 1);
}
}
@ -587,7 +587,7 @@ if (empty($reshook))
$action = 'statut';
} else {
// prevent browser refresh from closing proposal several times
if ($object->statut == 1) {
if ($object->statut == Propal::STATUS_VALIDATED) {
$object->cloture($user, GETPOST('statut'), GETPOST('note'));
}
}
@ -1735,7 +1735,7 @@ if ($action == 'create')
$absolute_discount = price2num($absolute_discount, 'MT');
$absolute_creditnote = price2num($absolute_creditnote, 'MT');
if ($absolute_discount) {
if ($object->statut > 0) {
if ($object->statut > Propal::STATUS_DRAFT) {
print $langs->trans("CompanyHasAbsoluteDiscount", price($absolute_discount, 0, $langs, 0, 0, -1, $conf->currency));
} else {
// Remise dispo de type non avoir
@ -1797,7 +1797,7 @@ if ($action == 'create')
} else {
if (! empty($object->fin_validite)) {
print dol_print_date($object->fin_validite, 'daytext');
if ($object->statut == 1 && $object->fin_validite < ($now - $conf->propal->cloture->warning_delay))
if ($object->statut == Propal::STATUS_VALIDATED && $object->fin_validite < ($now - $conf->propal->cloture->warning_delay))
print img_warning($langs->trans("Late"));
} else {
print '&nbsp;';
@ -2081,7 +2081,7 @@ if ($action == 'create')
<input type="hidden" name="id" value="' . $object->id . '">
';
if (! empty($conf->use_javascript_ajax) && $object->statut == 0) {
if (! empty($conf->use_javascript_ajax) && $object->statut == Propal::STATUS_DRAFT) {
include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php';
}
@ -2091,7 +2091,7 @@ if ($action == 'create')
$ret = $object->printObjectLines($action, $mysoc, $soc, $lineid, 1);
// Form to add new line
if ($object->statut == 0 && $user->rights->propal->creer)
if ($object->statut == Propal::STATUS_DRAFT && $user->rights->propal->creer)
{
if ($action != 'editline')
{
@ -2154,7 +2154,7 @@ if ($action == 'create')
if ($action != 'statut' && $action != 'editline')
{
// Validate
if ($object->statut == 0 && $object->total_ttc >= 0 && count($object->lines) > 0 &&
if ($object->statut == Propal::STATUS_DRAFT && $object->total_ttc >= 0 && count($object->lines) > 0 &&
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->propal->creer))
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->propal->propal_advance->validate)))
) {
@ -2168,18 +2168,18 @@ if ($action == 'create')
print '<a class="butAction" href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid . '">' . $langs->trans("AddAction") . '</a>';
}
// Edit
if ($object->statut == 1 && $user->rights->propal->creer) {
if ($object->statut == Propal::STATUS_VALIDATED && $user->rights->propal->creer) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=modif">' . $langs->trans('Modify') . '</a></div>';
}
// ReOpen
if (($object->statut == 2 || $object->statut == 3 || $object->statut == 4) && $user->rights->propal->cloturer) {
if (($object->statut == Propal::STATUS_SIGNED || $object->statut == Propal::STATUS_NOTSIGNED || $object->statut == Propal::STATUS_BILLED) && $user->rights->propal->cloturer) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=reopen' . (empty($conf->global->MAIN_JUMP_TAG) ? '' : '#reopen') . '"';
print '>' . $langs->trans('ReOpen') . '</a></div>';
}
// Send
if ($object->statut == 1 || $object->statut == 2) {
if ($object->statut == Propal::STATUS_VALIDATED || $object->statut == Propal::STATUS_SIGNED) {
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->propal->propal_advance->send) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=presend&amp;mode=init">' . $langs->trans('SendByMail') . '</a></div>';
} else
@ -2187,14 +2187,14 @@ if ($action == 'create')
}
// Create an order
if (! empty($conf->commande->enabled) && $object->statut == 2) {
if (! empty($conf->commande->enabled) && $object->statut == Propal::STATUS_SIGNED) {
if ($user->rights->commande->creer) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/commande/card.php?action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid . '">' . $langs->trans("AddOrder") . '</a></div>';
}
}
// Create contract
if ($conf->contrat->enabled && $object->statut == 2) {
if ($conf->contrat->enabled && $object->statut == Propal::STATUS_SIGNED) {
$langs->load("contracts");
if ($user->rights->contrat->creer) {
@ -2203,7 +2203,7 @@ if ($action == 'create')
}
// Create an invoice and classify billed
if ($object->statut == 2) {
if ($object->statut == Propal::STATUS_SIGNED) {
if (! empty($conf->facture->enabled) && $user->rights->facture->creer)
{
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/compta/facture.php?action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid . '">' . $langs->trans("AddBill") . '</a></div>';
@ -2217,7 +2217,7 @@ if ($action == 'create')
}
// Close
if ($object->statut == 1 && $user->rights->propal->cloturer) {
if ($object->statut == Propal::STATUS_VALIDATED && $user->rights->propal->cloturer) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=statut' . (empty($conf->global->MAIN_JUMP_TAG) ? '' : '#close') . '"';
print '>' . $langs->trans('Close') . '</a></div>';
}

View File

@ -54,19 +54,56 @@ class Propal extends CommonObject
var $id;
var $socid; // Id client
var $client; // Objet societe client (a charger par fetch_client)
/**
* ID of the client
* @var int
*/
var $socid;
/**
* Client (loaded by fetch_client)
* @var Societe
*/
var $client;
var $contactid;
var $fk_project;
var $author;
var $ref;
var $ref_client;
var $statut; // 0 (draft), 1 (validated), 2 (signed), 3 (not signed), 4 (billed)
var $datec; // Date of creation
var $datev; // Date of validation
var $date; // Date of proposal
var $datep; // Same than date
/**
* Status of the quote
* Check the following constants:
* - STATUS_DRAFT
* - STATUS_VALIDATED
* - STATUS_SIGNED
* - STATUS_NOTSIGNED
* - STATUS_BILLED
* @var int
*/
var $statut;
/**
* Date of creation
* @var
*/
var $datec;
/**
* Date of validation
* @var
*/
var $datev;
/**
* Date of the quote
* @var
*/
var $date;
/**
* Same than date ¿?
* @var
*/
var $datep;
var $date_livraison;
var $fin_validite;
@ -79,9 +116,19 @@ class Propal extends CommonObject
var $total_localtax1; // Total Local Taxes 1
var $total_localtax2; // Total Local Taxes 2
var $total_ttc; // Total with tax
var $price; // deprecated (for compatibility)
var $tva; // deprecated (for compatibility)
var $total; // deprecated (for compatibility)
/**
* @deprecated
*/
var $price;
/**
* @deprecated
*/
var $tva;
/**
* @deprecated
*/
var $total;
var $cond_reglement_id;
var $cond_reglement_code;
@ -91,10 +138,16 @@ class Propal extends CommonObject
var $remise;
var $remise_percent;
var $remise_absolue;
var $note; // deprecated (for compatibility)
/**
* @deprecated
*/
var $note;
var $note_private;
var $note_public;
var $fk_delivery_address; // deprecated (for compatibility)
/**
* @deprecated
*/
var $fk_delivery_address;
var $fk_address;
var $address_type;
var $address;
@ -126,6 +179,26 @@ class Propal extends CommonObject
var $location_incoterms;
var $libelle_incoterms; //Used into tooltip
/**
* Draft status
*/
const STATUS_DRAFT = 0;
/**
* Validated status
*/
const STATUS_VALIDATED = 1;
/**
* Signed quote
*/
const STATUS_SIGNED = 2;
/**
* Not signed quote
*/
const STATUS_NOTSIGNED = 3;
/**
* Billed quote
*/
const STATUS_BILLED = 4;
/**
* Constructor
@ -361,7 +434,7 @@ class Propal extends CommonObject
// Check parameters
if ($type < 0) return -1;
if ($this->statut == 0)
if ($this->statut == self::STATUS_DRAFT)
{
$this->db->begin();
@ -525,7 +598,7 @@ class Propal extends CommonObject
if (empty($qty) && empty($special_code)) $special_code=3; // Set option tag
if (! empty($qty) && $special_code == 3) $special_code=0; // Remove option tag
if ($this->statut == 0)
if ($this->statut == self::STATUS_DRAFT)
{
$this->db->begin();
@ -650,7 +723,7 @@ class Propal extends CommonObject
*/
function deleteline($lineid)
{
if ($this->statut == 0)
if ($this->statut == self::STATUS_DRAFT)
{
$line=new PropaleLigne($this->db);
@ -1007,7 +1080,7 @@ class Propal extends CommonObject
}
$this->id=0;
$this->statut=0;
$this->statut=self::STATUS_DRAFT;
if (empty($conf->global->PROPALE_ADDON) || ! is_readable(DOL_DOCUMENT_ROOT ."/core/modules/propale/".$conf->global->PROPALE_ADDON.".php"))
{
@ -1192,7 +1265,7 @@ class Propal extends CommonObject
$this->location_incoterms = $obj->location_incoterms;
$this->libelle_incoterms = $obj->libelle_incoterms;
if ($obj->fk_statut == 0)
if ($obj->fk_statut == self::STATUS_DRAFT)
{
$this->brouillon = 1;
}
@ -1385,8 +1458,8 @@ class Propal extends CommonObject
$sql = "UPDATE ".MAIN_DB_PREFIX."propal";
$sql.= " SET ref = '".$num."',";
$sql.= " fk_statut = 1, date_valid='".$this->db->idate($now)."', fk_user_valid=".$user->id;
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0";
$sql.= " fk_statut = ".self::STATUS_VALIDATED.", date_valid='".$this->db->idate($now)."', fk_user_valid=".$user->id;
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = ".self::STATUS_DRAFT;
dol_syslog(get_class($this)."::valid", LOG_DEBUG);
$resql=$this->db->query($sql);
@ -1441,7 +1514,7 @@ class Propal extends CommonObject
$this->ref=$num;
$this->brouillon=0;
$this->statut = 1;
$this->statut = self::STATUS_VALIDATED;
$this->user_valid_id=$user->id;
$this->datev=$now;
@ -1476,7 +1549,7 @@ class Propal extends CommonObject
if (! empty($user->rights->propal->creer))
{
$sql = "UPDATE ".MAIN_DB_PREFIX."propal SET datep = '".$this->db->idate($date)."'";
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0";
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = ".self::STATUS_DRAFT;
dol_syslog(get_class($this)."::set_date", LOG_DEBUG);
if ($this->db->query($sql) )
@ -1505,7 +1578,7 @@ class Propal extends CommonObject
if (! empty($user->rights->propal->creer))
{
$sql = "UPDATE ".MAIN_DB_PREFIX."propal SET fin_validite = ".($date_fin_validite!=''?"'".$this->db->idate($date_fin_validite)."'":'null');
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0";
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = ".self::STATUS_DRAFT;
if ($this->db->query($sql) )
{
$this->fin_validite = $date_fin_validite;
@ -1655,7 +1728,7 @@ class Propal extends CommonObject
$remise = price2num($remise);
$sql = "UPDATE ".MAIN_DB_PREFIX."propal SET remise_percent = ".$remise;
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0";
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = ".self::STATUS_DRAFT;
if ($this->db->query($sql) )
{
@ -1689,7 +1762,7 @@ class Propal extends CommonObject
$sql = "UPDATE ".MAIN_DB_PREFIX."propal ";
$sql.= " SET remise_absolue = ".$remise;
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0";
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = ".self::STATUS_DRAFT;
if ($this->db->query($sql) )
{
@ -1797,7 +1870,7 @@ class Propal extends CommonObject
$modelpdf=$conf->global->PROPALE_ADDON_PDF_ODT_CLOSED?$conf->global->PROPALE_ADDON_PDF_ODT_CLOSED:$this->modelpdf;
$trigger_name='PROPAL_CLOSE_REFUSED';
if ($statut == 2)
if ($statut == self::STATUS_SIGNED)
{
$trigger_name='PROPAL_CLOSE_SIGNED';
$modelpdf=$conf->global->PROPALE_ADDON_PDF_ODT_TOBILL?$conf->global->PROPALE_ADDON_PDF_ODT_TOBILL:$this->modelpdf;
@ -1814,7 +1887,7 @@ class Propal extends CommonObject
return -2;
}
}
if ($statut == 4)
if ($statut == self::STATUS_BILLED)
{
$trigger_name='PROPAL_CLASSIFY_BILLED';
}
@ -1864,11 +1937,11 @@ class Propal extends CommonObject
*/
function classifyBilled()
{
$sql = 'UPDATE '.MAIN_DB_PREFIX.'propal SET fk_statut = 4';
$sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > 0 ;';
$sql = 'UPDATE '.MAIN_DB_PREFIX.'propal SET fk_statut = '.self::STATUS_BILLED;
$sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > '.self::STATUS_DRAFT.' ;';
if ($this->db->query($sql) )
{
$this->statut=4;
$this->statut=self::STATUS_BILLED;
return 1;
}
else
@ -1896,12 +1969,12 @@ class Propal extends CommonObject
*/
function set_draft($user)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."propal SET fk_statut = 0";
$sql = "UPDATE ".MAIN_DB_PREFIX."propal SET fk_statut = ".self::STATUS_DRAFT;
$sql.= " WHERE rowid = ".$this->id;
if ($this->db->query($sql))
{
$this->statut = 0;
$this->statut = self::STATUS_DRAFT;
$this->brouillon = 1;
return 1;
}
@ -1945,7 +2018,7 @@ class Propal extends CommonObject
$sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
}
if ($socid) $sql.= " AND s.rowid = ".$socid;
if ($draft) $sql.= " AND p.fk_statut = 0";
if ($draft) $sql.= " AND p.fk_statut = ".self::STATUS_DRAFT;
if ($notcurrentuser > 0) $sql.= " AND p.fk_user_author <> ".$user->id;
$sql.= $this->db->order($sortfield,$sortorder);
$sql.= $this->db->plimit($limit,$offset);
@ -2215,7 +2288,7 @@ class Propal extends CommonObject
function availability($availability_id)
{
dol_syslog('Propale::availability('.$availability_id.')');
if ($this->statut >= 0)
if ($this->statut >= self::STATUS_DRAFT)
{
$sql = 'UPDATE '.MAIN_DB_PREFIX.'propal';
$sql .= ' SET fk_availability = '.$availability_id;
@ -2249,7 +2322,7 @@ class Propal extends CommonObject
function demand_reason($demand_reason_id)
{
dol_syslog('Propale::demand_reason('.$demand_reason_id.')');
if ($this->statut >= 0)
if ($this->statut >= self::STATUS_DRAFT)
{
$sql = 'UPDATE '.MAIN_DB_PREFIX.'propal';
$sql .= ' SET fk_input_reason = '.$demand_reason_id;
@ -2356,11 +2429,11 @@ class Propal extends CommonObject
global $langs;
$langs->load("propal");
if ($statut==0) $statuttrans='statut0';
if ($statut==1) $statuttrans='statut1';
if ($statut==2) $statuttrans='statut3';
if ($statut==3) $statuttrans='statut5';
if ($statut==4) $statuttrans='statut6';
if ($statut==self::STATUS_DRAFT) $statuttrans='statut0';
if ($statut==self::STATUS_VALIDATED) $statuttrans='statut1';
if ($statut==self::STATUS_SIGNED) $statuttrans='statut3';
if ($statut==self::STATUS_NOTSIGNED) $statuttrans='statut5';
if ($statut==self::STATUS_BILLED) $statuttrans='statut6';
if ($mode == 0) return $this->labelstatut[$statut];
if ($mode == 1) return $this->labelstatut_short[$statut];
@ -2393,8 +2466,8 @@ class Propal extends CommonObject
$clause = " AND";
}
$sql.= $clause." p.entity = ".$conf->entity;
if ($mode == 'opened') $sql.= " AND p.fk_statut = 1";
if ($mode == 'signed') $sql.= " AND p.fk_statut = 2";
if ($mode == 'opened') $sql.= " AND p.fk_statut = ".self::STATUS_VALIDATED;
if ($mode == 'signed') $sql.= " AND p.fk_statut = ".self::STATUS_SIGNED;
if ($user->societe_id) $sql.= " AND p.fk_soc = ".$user->societe_id;
$resql=$this->db->query($sql);
@ -2405,12 +2478,12 @@ class Propal extends CommonObject
if ($mode == 'opened') {
$delay_warning=$conf->propal->cloture->warning_delay;
$statut = 1;
$statut = self::STATUS_VALIDATED;
$label = $langs->trans("PropalsToClose");
}
if ($mode == 'signed') {
$delay_warning=$conf->propal->facturation->warning_delay;
$statut = 2;
$statut = self::STATUS_SIGNED;
$label = $langs->trans("PropalsToBill");
}
@ -2815,7 +2888,14 @@ class PropaleLigne extends CommonObject
var $fk_parent_line;
var $desc; // Description ligne
var $fk_product; // Id produit predefini
var $product_type = 0; // Type 0 = product, 1 = Service
/**
* Product type.
* Use the following constants:
* - Product::TYPE_PRODUCT
* - Product::TYPE_SERVICE
* @var int
*/
var $product_type = Product::TYPE_PRODUCT;
var $qty;
var $tva_tx;

View File

@ -126,7 +126,7 @@ if ($id > 0 || ! empty($ref))
if ($object->fin_validite)
{
print dol_print_date($object->fin_validite,'daytext');
if ($object->statut == 1 && $object->fin_validite < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late"));
if ($object->statut == Propal::STATUS_VALIDATED && $object->fin_validite < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late"));
}
else
{

View File

@ -51,8 +51,17 @@ class Commande extends CommonOrder
var $id;
var $socid; // Id client
var $client; // Objet societe client (a charger par fetch_client)
/**
* Client ID
* @var int
*/
var $socid;
/**
* Client (loaded by fetch_client)
* @var Societe
*/
var $client;
var $ref;
var $ref_client;
@ -69,31 +78,13 @@ class Commande extends CommonOrder
* - STATUS_CLOSED
* @var int
*/
var $statut; // -1=Canceled, 0=Draft, 1=Validated, (2=Accepted/On process not managed for customer orders), 3=Closed (Delivered=Sent/Received, billed or not)
var $statut;
/**
* @deprecated
*/
var $facturee; // deprecated
var $billed; // billed or not
/**
* Canceled status
*/
const STATUS_CANCELED = -1;
/**
* Draft status
*/
const STATUS_DRAFT = 0;
/**
* Validated status
*/
const STATUS_VALIDATED = 1;
/**
* Accepted/On process not managed for customer orders
*/
const STATUS_ACCEPTED = 2;
/**
* Closed (Sent/Received, billed or not)
*/
const STATUS_CLOSED = 3;
var $brouillon;
var $cond_reglement_id;
var $cond_reglement_code;
@ -153,6 +144,27 @@ class Commande extends CommonOrder
*/
const STOCK_NOT_ENOUGH_FOR_ORDER = -3;
/**
* Canceled status
*/
const STATUS_CANCELED = -1;
/**
* Draft status
*/
const STATUS_DRAFT = 0;
/**
* Validated status
*/
const STATUS_VALIDATED = 1;
/**
* Accepted/On process not managed for customer orders
*/
const STATUS_ACCEPTED = 2;
/**
* Closed (Sent/Received, billed or not)
*/
const STATUS_CLOSED = 3;
/**
* Constructor

View File

@ -61,7 +61,7 @@ class LignePrelevement
* Recupere l'objet prelevement
*
* @param int $rowid id de la facture a recuperer
* @return void|int
* @return integer
*/
function fetch($rowid)
{

View File

@ -516,6 +516,10 @@ class CMailFile
// Encode subject according to RFC 2822 - http://en.wikipedia.org/wiki/MIME#Encoded-Word
/**
* @param string $stringtoencode
*/
function encodetorfc2822($stringtoencode)
{
global $conf;
@ -639,7 +643,7 @@ class CMailFile
/**
* Create SMTP headers (mode = 'mail')
*
* @return smtp headers
* @return string headers
*/
function write_smtpheaders()
{
@ -690,7 +694,7 @@ class CMailFile
*
* @param array $filename_list Array of filenames
* @param array $mimefilename_list Array of mime types
* @return array mime headers
* @return string mime headers
*/
function write_mimeheaders($filename_list, $mimefilename_list)
{

View File

@ -60,6 +60,34 @@ abstract class CommonInvoice extends CommonObject
*/
const TYPE_SITUATION = 5;
/**
* Draft
*/
const STATUS_DRAFT = 0;
/**
* Validated (need to be paid)
*/
const STATUS_VALIDATED = 1;
/**
* Classified paid.
* If paid partially, $this->close_code can be:
* - CLOSECODE_DISCOUNTVAT
* - CLOSECODE_BADDEBT
* If paid completelly, this->close_code will be null
*/
const STATUS_CLOSED = 2;
/**
* Classified abandoned and no payment done.
* $this->close_code can be:
* - CLOSECODE_BADDEBT
* - CLOSECODE_ABANDONED
* - CLOSECODE_REPLACED
*/
const STATUS_ABANDONED = 3;
/**
* Return amount of payments already done
*
@ -188,7 +216,7 @@ abstract class CommonInvoice extends CommonObject
* Return label of object status
*
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto
* @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise)
* @param integer $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise)
* @return string Label
*/
function getLibStatut($mode=0,$alreadypaid=-1)
@ -202,7 +230,7 @@ abstract class CommonInvoice extends CommonObject
* @param int $paye Status field paye
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto
* @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise)
* @param integer $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise)
* @param int $type Type facture
* @return string Libelle du statut
*/
@ -326,7 +354,7 @@ abstract class CommonInvoice extends CommonObject
* Renvoi une date limite de reglement de facture en fonction des
* conditions de reglements de la facture et date de facturation
*
* @param string $cond_reglement Condition of payment (code or id) to use. If 0, we use current condition.
* @param integer $cond_reglement Condition of payment (code or id) to use. If 0, we use current condition.
* @return date Date limite de reglement si ok, <0 si ko
*/
function calculate_date_lim_reglement($cond_reglement=0)

View File

@ -1611,7 +1611,7 @@ abstract class CommonObject
}
if (! in_array($suffix,array('','_public','_private')))
{
dol_syslog(get_class($this)."::upate_note Parameter suffix must be empty, '_private' or '_public'", LOG_ERR);
dol_syslog(get_class($this)."::update_note Parameter suffix must be empty, '_private' or '_public'", LOG_ERR);
return -2;
}

View File

@ -115,7 +115,7 @@ class DolGraph
* Set Y precision
*
* @param float $which_prec Precision
* @return string
* @return boolean
*/
function SetPrecisionY($which_prec)
{
@ -187,7 +187,7 @@ class DolGraph
* Set y label
*
* @param string $label Y label
* @return boolean True
* @return boolean|null True
*/
function SetYLabel($label)
{
@ -198,7 +198,7 @@ class DolGraph
* Set width
*
* @param int $w Width
* @return boolean True
* @return boolean|null True
*/
function SetWidth($w)
{
@ -554,7 +554,7 @@ class DolGraph
/**
* Return min value of all data
*
* @return int Max value of all data
* @return double Max value of all data
*/
function GetFloorMinValue()
{
@ -578,7 +578,7 @@ class DolGraph
*
* @param string $file Image file name to use to save onto disk (also used as javascript unique id)
* @param string $fileurl Url path to show image if saved onto disk
* @return void
* @return integer|null
*/
function draw($file,$fileurl='')
{

View File

@ -18,7 +18,7 @@
/**
* \file htdocs/core/class/dolprintipp.class.php
* \brief A set of functions for using printIPP
* \brief List jobs printed with driver printipp
*/
/**
@ -57,78 +57,6 @@ class dolprintIPP
}
/**
* Return list of available printers
*
* @return array list of printers
*/
function getlist_available_printers()
{
global $conf,$db;
include_once DOL_DOCUMENT_ROOT.'/includes/printipp/CupsPrintIPP.php';
$ipp = new CupsPrintIPP();
$ipp->setLog(DOL_DATA_ROOT.'/printipp.log','file',3); // logging very verbose
$ipp->setHost($this->host);
$ipp->setPort($this->port);
$ipp->setUserName($this->userid);
if (! empty($this->user)) $ipp->setAuthentication($this->user,$this->password);
$ipp->getPrinters();
return $ipp->available_printers;
}
/**
* Print selected file
*
* @param string $file file
* @param string $module module
*
* @return string '' if OK, Error message if KO
*/
function print_file($file, $module)
{
global $conf,$db;
include_once DOL_DOCUMENT_ROOT.'/includes/printipp/CupsPrintIPP.php';
$ipp = new CupsPrintIPP();
$ipp->setLog(DOL_DATA_ROOT.'/dolibarr_printipp.log','file',3); // logging very verbose
$ipp->setHost($this->host);
$ipp->setPort($this->port);
$ipp->setJobName($file,true);
$ipp->setUserName($this->userid);
if (! empty($this->user)) $ipp->setAuthentication($this->user,$this->password);
// select printer uri for module order, propal,...
$sql = 'SELECT rowid,printer_uri,copy FROM '.MAIN_DB_PREFIX.'printer_ipp WHERE module="'.$module.'"';
$result = $this->db->query($sql);
if ($result)
{
$obj = $this->db->fetch_object($result);
if ($obj)
{
$ipp->setPrinterURI($obj->printer_uri);
}
else
{
if (! empty($conf->global->PRINTIPP_URI_DEFAULT))
{
$ipp->setPrinterURI($conf->global->PRINTIPP_URI_DEFAULT);
}
else
{
return 'NoDefaultPrinterDefined';
}
}
}
// Set number of copy
$ipp->setCopies($obj->copy);
$ipp->setData(DOL_DATA_ROOT.'/'.$module.'/'.$file);
$ipp->printJob();
return '';
}
/**
* List jobs print
*
@ -191,25 +119,4 @@ class dolprintIPP
print "</table>";
}
/**
* Get printer detail
*
* @param string $uri URI
* @return array List of attributes
*/
function get_printer_detail($uri)
{
global $conf,$db;
include_once DOL_DOCUMENT_ROOT.'/includes/printipp/CupsPrintIPP.php';
$ipp = new CupsPrintIPP();
$ipp->setLog(DOL_DATA_ROOT.'/printipp.log','file',3); // logging very verbose
$ipp->setHost($this->host);
$ipp->setPort($this->port);
$ipp->setUserName($this->userid);
if (! empty($this->user)) $ipp->setAuthentication($this->user,$this->password);
$ipp->setPrinterURI($uri);
$ipp->getPrinterAttributes();
return $ipp->printer_attributes;
}
}

View File

@ -30,7 +30,7 @@ class InfoBox
/**
* Name of positions 0=Home, 1=...
*
* @return array Array with list of zones
* @return string[] Array with list of zones
*/
static function getListOfPagesForBoxes()
{

View File

@ -349,7 +349,7 @@ class Ldap
/**
* Change ldap protocol version to use.
*
* @return string version
* @return boolean version
*/
function setVersion() {
// LDAP_OPT_PROTOCOL_VERSION est une constante qui vaut 17
@ -360,7 +360,7 @@ class Ldap
/**
* changement du referrals.
*
* @return string referrals
* @return boolean referrals
*/
function setReferrals() {
// LDAP_OPT_REFERRALS est une constante qui vaut ?
@ -1314,7 +1314,7 @@ class Ldap
* Convertit le temps ActiveDirectory en Unix timestamp
*
* @param string $value AD time to convert
* @return string Unix timestamp
* @return integer Unix timestamp
*/
function convert_time($value)
{

View File

@ -26,95 +26,95 @@
interface Database
{
/**
* Format a SQL IF
* Format a SQL IF
*
* @param string $test Test string (example: 'cd.statut=0', 'field IS NULL')
* @param string $resok resultat si test egal
* @param string $resko resultat si test non egal
* @return string SQL string
* @param string $test Test string (example: 'cd.statut=0', 'field IS NULL')
* @param string $resok resultat si test egal
* @param string $resko resultat si test non egal
* @return string SQL string
*/
function ifsql($test, $resok, $resko);
/**
* Return datas as an array
* Return datas as an array
*
* @param resource $resultset Resultset of request
* @return array Array
* @param resource $resultset Resultset of request
* @return array Array
*/
function fetch_row($resultset);
/**
* Convert (by PHP) a GM Timestamp date into a string date with PHP server TZ to insert into a date field.
* Function to use to build INSERT, UPDATE or WHERE predica
* Convert (by PHP) a GM Timestamp date into a string date with PHP server TZ to insert into a date field.
* Function to use to build INSERT, UPDATE or WHERE predica
*
* @param string $param Date TMS to convert
* @return string Date in a string YYYYMMDDHHMMSS
* @param int $param Date TMS to convert
* @return string Date in a string YYYYMMDDHHMMSS
*/
function idate($param);
/**
* Return last error code
* Return last error code
*
* @return string lasterrno
* @return string lasterrno
*/
function lasterrno();
/**
* Start transaction
*
* @return int 1 if transaction successfuly opened or already opened, 0 if error
* @return int 1 if transaction successfuly opened or already opened, 0 if error
*/
function begin();
/**
* Create a new database
* Do not use function xxx_create_db (xxx=mysql, ...) as they are deprecated
* We force to create database with charset this->forcecharset and collate this->forcecollate
* Create a new database
* Do not use function xxx_create_db (xxx=mysql, ...) as they are deprecated
* We force to create database with charset this->forcecharset and collate this->forcecollate
*
* @param string $database Database name to create
* @param string $charset Charset used to store data
* @param string $collation Charset used to sort data
* @param string $owner Username of database owner
* @return resource resource defined if OK, null if KO
* @param string $database Database name to create
* @param string $charset Charset used to store data
* @param string $collation Charset used to sort data
* @param string $owner Username of database owner
* @return resource resource defined if OK, null if KO
*/
function DDLCreateDb($database, $charset = '', $collation = '', $owner = '');
/**
* Return version of database server into an array
* Return version of database server into an array
*
* @return array Version array
* @return array Version array
*/
function getVersionArray();
/**
* Convert a SQL request in Mysql syntax to native syntax
*
* @param string $line SQL request line to convert
* @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...)
* @return string SQL request line converted
* @param string $line SQL request line to convert
* @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...)
* @return string SQL request line converted
*/
static function convertSQLFromMysql($line, $type = 'ddl');
/**
* Renvoie le nombre de lignes dans le resultat d'une requete INSERT, DELETE ou UPDATE
* Renvoie le nombre de lignes dans le resultat d'une requete INSERT, DELETE ou UPDATE
*
* @param resource $resultset Curseur de la requete voulue
* @return int Nombre de lignes
* @see num_rows
* @param resource $resultset Curseur de la requete voulue
* @return int Nombre de lignes
* @see num_rows
*/
function affected_rows($resultset);
/**
* Return description of last error
* Return description of last error
*
* @return string Error text
* @return string Error text
*/
function error();
/**
* Return label of manager
*
* @return string Label
* @return string Label
*/
function getLabel();
@ -128,58 +128,58 @@ interface Database
function DDLListTables($database, $table = '');
/**
* Return last request executed with query()
* Return last request executed with query()
*
* @return string Last query
* @return string Last query
*/
function lastquery();
/**
* Define sort criteria of request
*
* @param string $sortfield List of sort fields
* @param string $sortorder Sort order
* @return string String to provide syntax of a sort sql string
* @param string $sortfield List of sort fields
* @param string $sortorder Sort order
* @return string String to provide syntax of a sort sql string
*/
function order($sortfield = 0, $sortorder = 0);
/**
* Decrypt sensitive data in database
* Decrypt sensitive data in database
*
* @param string $value Value to decrypt
* @return string Decrypted value if used
* @return string Decrypted value if used
*/
function decrypt($value);
/**
* Return datas as an array
*
* @param resource $resultset Resultset of request
* @return array Array
* @param resource $resultset Resultset of request
* @return array Array
*/
function fetch_array($resultset);
/**
* Return last error label
* Return last error label
*
* @return string lasterror
* @return string lasterror
*/
function lasterror();
/**
* Escape a string to insert data
* Escape a string to insert data
*
* @param string $stringtoencode String to escape
* @return string String escaped
* @param string $stringtoencode String to escape
* @return string String escaped
*/
function escape($stringtoencode);
/**
* Get last ID after an insert INSERT
*
* @param string $tab Table name concerned by insert. Ne sert pas sous MySql mais requis pour compatibilite avec Postgresql
* @param string $fieldid Field name
* @return int Id of row
* @param string $tab Table name concerned by insert. Ne sert pas sous MySql mais requis pour compatibilite avec Postgresql
* @param string $fieldid Field name
* @return int Id of row
*/
function last_insert_id($tab, $fieldid = 'rowid');
@ -193,186 +193,186 @@ interface Database
/**
* Annulation d'une transaction et retour aux anciennes valeurs
*
* @param string $log Add more log to default log line
* @return int 1 si annulation ok ou transaction non ouverte, 0 en cas d'erreur
* @param string $log Add more log to default log line
* @return int 1 si annulation ok ou transaction non ouverte, 0 en cas d'erreur
*/
function rollback($log = '');
/**
* Execute a SQL request and return the resultset
*
* @param string $query SQL query string
* @param int $usesavepoint 0=Default mode, 1=Run a savepoint before and a rollbock to savepoint if error (this allow to have some request with errors inside global transactions).
* @param string $query SQL query string
* @param int $usesavepoint 0=Default mode, 1=Run a savepoint before and a rollbock to savepoint if error (this allow to have some request with errors inside global transactions).
* Note that with Mysql, this parameter is not used as Myssql can already commit a transaction even if one request is in error, without using savepoints.
* @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...)
* @return resource Resultset of answer
* @return resource Resultset of answer
*/
function query($query, $usesavepoint = 0, $type = 'auto');
/**
* Connexion to server
*
* @param string $host database server host
* @param string $login login
* @param string $passwd password
* @param string $name name of database (not used for mysql, used for pgsql)
* @param string $port Port of database server
* @return resource Database access handler
* @see close
* @param string $host database server host
* @param string $login login
* @param string $passwd password
* @param string $name name of database (not used for mysql, used for pgsql)
* @param string $port Port of database server
* @return resource Database access handler
* @see close
*/
function connect($host, $login, $passwd, $name, $port = 0);
/**
* Define limits and offset of request
*
* @param int $limit Maximum number of lines returned (-1=conf->liste_limit, 0=no limit)
* @param int $offset Numero of line from where starting fetch
* @return string String with SQL syntax to add a limit and offset
* @param int $limit Maximum number of lines returned (-1=conf->liste_limit, 0=no limit)
* @param int $offset Numero of line from where starting fetch
* @return string String with SQL syntax to add a limit and offset
*/
function plimit($limit = 0, $offset = 0);
/**
* Return value of server parameters
*
* @param string $filter Filter list on a particular value
* @return array Array of key-values (key=>value)
* @param string $filter Filter list on a particular value
* @return array Array of key-values (key=>value)
*/
function getServerParametersValues($filter = '');
/**
* Return value of server status
* Return value of server status
*
* @param string $filter Filter list on a particular value
* @return array Array of key-values (key=>value)
* @param string $filter Filter list on a particular value
* @return array Array of key-values (key=>value)
*/
function getServerStatusValues($filter = '');
/**
* Return collation used in database
* Return collation used in database
*
* @return string Collation value
* @return string Collation value
*/
function getDefaultCollationDatabase();
/**
* Return number of lines for result of a SELECT
* Return number of lines for result of a SELECT
*
* @param resource $resultset Resulset of requests
* @return int Nb of lines
* @see affected_rows
* @param resource $resultset Resulset of requests
* @return int Nb of lines
* @see affected_rows
*/
function num_rows($resultset);
/**
* Return full path of dump program
* Return full path of dump program
*
* @return string Full path of dump program
*/
function getPathOfDump();
/**
* Return version of database client driver
* Return version of database client driver
*
* @return string Version string
*/
function getDriverInfo();
/**
* Return generic error code of last operation.
* Return generic error code of last operation.
*
* @return string Error code (Exemples: DB_ERROR_TABLE_ALREADY_EXISTS, DB_ERROR_RECORD_ALREADY_EXISTS...)
*/
function errno();
/**
* Create a table into database
* Create a table into database
*
* @param string $table Nom de la table
* @param array $fields Tableau associatif [nom champ][tableau des descriptions]
* @param string $primary_key Nom du champ qui sera la clef primaire
* @param string $type Type de la table
* @param array $unique_keys Tableau associatifs Nom de champs qui seront clef unique => valeur
* @param array $fulltext_keys Tableau des Nom de champs qui seront indexes en fulltext
* @param string $keys Tableau des champs cles noms => valeur
* @return int <0 if KO, >=0 if OK
* @param string $table Nom de la table
* @param array $fields Tableau associatif [nom champ][tableau des descriptions]
* @param string $primary_key Nom du champ qui sera la clef primaire
* @param string $type Type de la table
* @param array $unique_keys Tableau associatifs Nom de champs qui seront clef unique => valeur
* @param array $fulltext_keys Tableau des Nom de champs qui seront indexes en fulltext
* @param string $keys Tableau des champs cles noms => valeur
* @return int <0 if KO, >=0 if OK
*/
function DDLCreateTable($table, $fields, $primary_key, $type, $unique_keys = "", $fulltext_keys = "", $keys = "");
/**
* Return list of available charset that can be used to store data in database
* Return list of available charset that can be used to store data in database
*
* @return array List of Charset
*/
function getListOfCharacterSet();
/**
* Create a new field into table
* Create a new field into table
*
* @param string $table Name of table
* @param string $field_name Name of field to add
* @param string $field_desc Tableau associatif de description du champ a inserer[nom du parametre][valeur du parametre]
* @param string $field_position Optionnel ex.: "after champtruc"
* @return int <0 if KO, >0 if OK
* @param string $table Name of table
* @param string $field_name Name of field to add
* @param string $field_desc Tableau associatif de description du champ a inserer[nom du parametre][valeur du parametre]
* @param string $field_position Optionnel ex.: "after champtruc"
* @return int <0 if KO, >0 if OK
*/
function DDLAddField($table, $field_name, $field_desc, $field_position = "");
/**
* Drop a field from table
* Drop a field from table
*
* @param string $table Name of table
* @param string $field_name Name of field to drop
* @return int <0 if KO, >0 if OK
* @param string $table Name of table
* @param string $field_name Name of field to drop
* @return int <0 if KO, >0 if OK
*/
function DDLDropField($table, $field_name);
/**
* Update format of a field into a table
* Update format of a field into a table
*
* @param string $table Name of table
* @param string $field_name Name of field to modify
* @param string $field_desc Array with description of field format
* @return int <0 if KO, >0 if OK
* @param string $table Name of table
* @param string $field_name Name of field to modify
* @param string $field_desc Array with description of field format
* @return int <0 if KO, >0 if OK
*/
function DDLUpdateField($table, $field_name, $field_desc);
/**
* Return list of available collation that can be used for database
* Return list of available collation that can be used for database
*
* @return array List of Collation
* @return array List of Collation
*/
function getListOfCollation();
/**
* Return a pointer of line with description of a table or field
* Return a pointer of line with description of a table or field
*
* @param string $table Name of table
* @param string $field Optionnel : Name of field if we want description of field
* @return resource Resource
* @param string $table Name of table
* @param string $field Optionnel : Name of field if we want description of field
* @return resource Resource
*/
function DDLDescTable($table, $field = "");
/**
* Return version of database server
* Return version of database server
*
* @return string Version string
* @return string Version string
*/
function getVersion();
/**
* Return charset used to store data in database
* Return charset used to store data in database
*
* @return string Charset
* @return string Charset
*/
function getDefaultCharacterSetDatabase();
/**
* Create a user and privileges to connect to database (even if database does not exists yet)
* Create a user and privileges to connect to database (even if database does not exists yet)
*
* @param string $dolibarr_main_db_host Ip serveur
* @param string $dolibarr_main_db_user Nom user a creer
* @param string $dolibarr_main_db_pass Mot de passe user a creer
* @param string $dolibarr_main_db_name Database name where user must be granted
* @return int <0 if KO, >=0 if OK
* @param string $dolibarr_main_db_host Ip serveur
* @param string $dolibarr_main_db_user Nom user a creer
* @param string $dolibarr_main_db_pass Mot de passe user a creer
* @param string $dolibarr_main_db_name Database name where user must be granted
* @return int <0 if KO, >=0 if OK
*/
function DDLCreateUser(
$dolibarr_main_db_host,
@ -382,85 +382,85 @@ interface Database
);
/**
* Convert (by PHP) a PHP server TZ string date into a Timestamps date (GMT if gm=true)
* 19700101020000 -> 3600 with TZ+1 and gmt=0
* 19700101020000 -> 7200 whaterver is TZ if gmt=1
* Convert (by PHP) a PHP server TZ string date into a Timestamps date (GMT if gm=true)
* 19700101020000 -> 3600 with TZ+1 and gmt=0
* 19700101020000 -> 7200 whaterver is TZ if gmt=1
*
* @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS)
* @param int $gm 1=Input informations are GMT values, otherwise local to server TZ
* @return timestamp|string Date TMS
* @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS)
* @param int $gm 1=Input informations are GMT values, otherwise local to server TZ
* @return int|string Date TMS or ''
*/
function jdate($string, $gm=false);
/**
* Encrypt sensitive data in database
* Warning: This function includes the escape, so it must use direct value
* Encrypt sensitive data in database
* Warning: This function includes the escape, so it must use direct value
*
* @param string $fieldorvalue Field name or value to encrypt
* @param int $withQuotes Return string with quotes
* @return string XXX(field) or XXX('value') or field or 'value'
* @param string $fieldorvalue Field name or value to encrypt
* @param int $withQuotes Return string with quotes
* @return string XXX(field) or XXX('value') or field or 'value'
*/
function encrypt($fieldorvalue, $withQuotes = 0);
/**
* Validate a database transaction
*
* @param string $log Add more log to default log line
* @return int 1 if validation is OK or transaction level no started, 0 if ERROR
* @param string $log Add more log to default log line
* @return int 1 if validation is OK or transaction level no started, 0 if ERROR
*/
function commit($log = '');
/**
* List information of columns into a table.
* List information of columns into a table.
*
* @param string $table Name of table
* @return array Tableau des informations des champs de la table
* @param string $table Name of table
* @return array Array with inforation on table
*/
function DDLInfoTable($table);
/**
* Free last resultset used.
* Free last resultset used.
*
* @param resource $resultset Curseur de la requete voulue
* @return void
* @param resource $resultset Fre cursor
* @return void
*/
function free($resultset = 0);
/**
* Close database connexion
* Close database connexion
*
* @return boolean True if disconnect successfull, false otherwise
* @see connect
* @return boolean True if disconnect successfull, false otherwise
* @see connect
*/
function close();
/**
* Return last query in error
* Return last query in error
*
* @return string lastqueryerror
* @return string lastqueryerror
*/
function lastqueryerror();
/**
* Return connexion ID
*
* @return string Id connexion
* @return string Id connexion
*/
function DDLGetConnectId();
/**
* Renvoie la ligne courante (comme un objet) pour le curseur resultset
* Renvoie la ligne courante (comme un objet) pour le curseur resultset
*
* @param resource $resultset Curseur de la requete voulue
* @return Object Object result line or false if KO or end of cursor
* @param resource $resultset Curseur de la requete voulue
* @return Object Object result line or false if KO or end of cursor
*/
function fetch_object($resultset);
/**
* Select a database
* Select a database
*
* @param string $database Name of database
* @return boolean true if OK, false if KO
* @param string $database Name of database
* @return boolean true if OK, false if KO
*/
function select_db($database);

View File

@ -82,7 +82,7 @@ abstract class DoliDB implements Database
* Convert (by PHP) a GM Timestamp date into a string date with PHP server TZ to insert into a date field.
* Function to use to build INSERT, UPDATE or WHERE predica
*
* @param string $param Date TMS to convert
* @param int $param Date TMS to convert
* @return string Date in a string YYYYMMDDHHMMSS
*/
function idate($param)
@ -271,7 +271,7 @@ abstract class DoliDB implements Database
*
* @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS)
* @param int $gm 1=Input informations are GMT values, otherwise local to server TZ
* @return int|string Date TMS
* @return int|string Date TMS or ''
*/
function jdate($string, $gm=false)
{

View File

@ -296,7 +296,7 @@ class DoliDBSqlite extends DoliDB
* @param string $login login
* @param string $passwd password
* @param string $name name of database (not used for mysql, used for pgsql)
* @param string $port Port of database server
* @param integer $port Port of database server
* @return resource Database access handler
* @see close
*/
@ -459,7 +459,7 @@ class DoliDBSqlite extends DoliDB
/**
* Return datas as an array
*
* @param Resultset $resultset Resultset of request
* @param resource $resultset Resultset of request
* @return array Array
*/
function fetch_row($resultset)
@ -511,7 +511,7 @@ class DoliDBSqlite extends DoliDB
/**
* Free last resultset used.
*
* @param resultset $resultset Curseur de la requete voulue
* @param integer $resultset Curseur de la requete voulue
* @return void
*/
function free($resultset=0)
@ -629,7 +629,7 @@ class DoliDBSqlite extends DoliDB
*
* @param string $fieldorvalue Field name or value to encrypt
* @param int $withQuotes Return string with quotes
* @return return XXX(field) or XXX('value') or field or 'value'
* @return string XXX(field) or XXX('value') or field or 'value'
*/
function encrypt($fieldorvalue, $withQuotes=0)
{

View File

@ -61,7 +61,7 @@ else $genbarcode_loc = $conf->global->GENBARCODE_LOCATION;
*
* @param string $code Code
* @param string $encoding Encoding
* @param string $scale Scale
* @param integer $scale Scale
* @param string $mode 'png' or 'jpg' ...
*
*
@ -159,7 +159,7 @@ function barcode_encode($code,$encoding)
* Calculate EAN sum
*
* @param string $ean EAN to encode
* @return string Sum
* @return integer Sum
*/
function barcode_gen_ean_sum($ean)
{
@ -299,7 +299,7 @@ function barcode_encode_genbarcode($code,$encoding)
* @param string $mode png,gif,jpg (default='png')
* @param int $total_y the total height of the image ( default: scale * 60 )
* @param array $space default: $space[top] = 2 * $scale; $space[bottom]= 2 * $scale; $space[left] = 2 * $scale; $space[right] = 2 * $scale;
* @return void
* @return string|null
*/
function barcode_outimage($text, $bars, $scale = 1, $mode = "png", $total_y = 0, $space = '')
{

View File

@ -452,7 +452,7 @@ function dol_count_nb_of_line($file)
* Return size of a file
*
* @param string $pathoffile Path of file
* @return string File size
* @return integer File size
*/
function dol_filesize($pathoffile)
{
@ -598,7 +598,7 @@ function dolCopyDir($srcfile, $destfile, $newmask, $overwriteifexists)
*
* @param string $srcfile Source file (can't be a directory. use native php @rename() to move a directory)
* @param string $destfile Destination file (can't be a directory. use native php @rename() to move a directory)
* @param string $newmask Mask for new file (0 by default means $conf->global->MAIN_UMASK)
* @param integer $newmask Mask for new file (0 by default means $conf->global->MAIN_UMASK)
* @param int $overwriteifexists Overwrite file if exists (1 by default)
* @return boolean True if OK, false if KO
*/
@ -657,7 +657,7 @@ function dol_unescapefile($filename)
* @param string $dest_file Target full path filename ($_FILES['field']['name'])
* @param int $allowoverwrite 1=Overwrite target file if it already exists
* @param int $disablevirusscan 1=Disable virus scan
* @param string $uploaderrorcode Value of PHP upload error code ($_FILES['field']['error'])
* @param integer $uploaderrorcode Value of PHP upload error code ($_FILES['field']['error'])
* @param int $nohook Disable all hooks
* @param string $varfiles _FILES var name
* @return int >0 if OK, <0 or string if KO
@ -989,7 +989,7 @@ function dol_delete_preview($object)
* This should allow "grep" search.
* This feature is enabled only if option MAIN_DOC_CREATE_METAFILE is set.
*
* @param Object $object Object
* @param CommonObject $object Object
* @return int 0 if we did nothing, >0 success, <0 error
*/
function dol_meta_create($object)

View File

@ -42,7 +42,7 @@ abstract class ModelePDFDeliveryOrder extends CommonDocGenerator
* Return list of active generation modules
*
* @param DoliDB $db Database handler
* @param string $maxfilenamelength Max length of value to show
* @param integer $maxfilenamelength Max length of value to show
* @return array List of templates
*/
static function liste_modeles($db,$maxfilenamelength=0)
@ -151,7 +151,7 @@ abstract class ModeleNumRefDeliveryOrder
* Create object on disk
*
* @param DoliDB $db objet base de donnee
* @param Object $object object delivery
* @param Livraison $object object delivery
* @param string $modele force le modele a utiliser ('' to not force)
* @param Translate $outputlangs objet lang a utiliser pour traduction
* @return int 0 if KO, 1 if OK

View File

@ -85,7 +85,7 @@ class mailing_contacts1 extends MailingTargets
* For example if this selector is used to extract 500 different
* emails from a text file, this function must return 500.
*
* @param string $sql Requete sql de comptage
* @param string $sql Requete sql de comptage
* @return int
*/
function getNbOfRecipients($sql='')

View File

@ -152,7 +152,7 @@ class mailing_contacts2 extends MailingTargets
/**
* Return here number of distinct emails returned by your selector.
*
* @param string $sql Requete sql de comptage
* @param string $sql Requete sql de comptage
* @return int
*/
function getNbOfRecipients($sql='')

View File

@ -157,7 +157,7 @@ class mailing_contacts3 extends MailingTargets
/**
* Return here number of distinct emails returned by your selector.
*
* @param string $sql Requete sql de comptage
* @param string $sql Requete sql de comptage
* @return int Number of recipients
*/
function getNbOfRecipients($sql='')

View File

@ -158,7 +158,7 @@ class mailing_contacts4 extends MailingTargets
/**
* Return here number of distinct emails returned by your selector.
*
* @param string $sql Requete sql de comptage
* @param string $sql Requete sql de comptage
* @return int Number of recipients
*/
function getNbOfRecipients($sql='')

View File

@ -100,8 +100,8 @@ class mailing_example extends MailingTargets
* For example if this selector is used to extract 500 different
* emails from a text file, this function must return 500.
*
* @param string $sql Requete sql de comptage
* @return int
* @param string $sql Requete sql de comptage
* @return int|string Number of recipient or '?'
*/
function getNbOfRecipients($sql='')
{

View File

@ -86,8 +86,8 @@ class mailing_fraise extends MailingTargets
* For example if this selector is used to extract 500 different
* emails from a text file, this function must return 500.
*
* @param string $sql Requete sql de comptage
* @return int Nb of recipients
* @param string $sql Requete sql de comptage
* @return int Nb of recipients
*/
function getNbOfRecipients($sql='')
{

View File

@ -150,8 +150,8 @@ class mailing_framboise extends MailingTargets
* For example if this selector is used to extract 500 different
* emails from a text file, this function must return 500.
*
* @param string $sql Requete sql de comptage
* @return int Nb of recipients
* @param string $sql Requete sql de comptage
* @return int Nb of recipients
*/
function getNbOfRecipients($sql='')
{

View File

@ -72,8 +72,8 @@ class MailingTargets // This can't be abstract as it is used for some method
/**
* Retourne nombre de destinataires
*
* @param string $sql Requete sql de comptage
* @return int Nb de destinataires si ok, < 0 si erreur
* @param string $sql Sql request to count
* @return int Nb of recipient, or <0 if error
*/
function getNbOfRecipients($sql)
{
@ -85,7 +85,7 @@ class MailingTargets // This can't be abstract as it is used for some method
}
else
{
$this->error=$this->db->error();
$this->error=$this->db->lasterror();
return -1;
}
}

View File

@ -157,7 +157,7 @@ class mailing_thirdparties extends MailingTargets
* emails from a text file, this function must return 500.
*
* @param string $sql Requete sql de comptage
* @return int Nb of recipients
* @return int Nb of recipients
*/
function getNbOfRecipients($sql='')
{

View File

@ -73,8 +73,8 @@ class mailing_xinputfile extends MailingTargets
* For example if this selector is used to extract 500 different
* emails from a text file, this function must return 500.
*
* @param string $sql Requete sql de comptage
* @return int '' means NA
* @param string $sql Sql request to count
* @return string '' means NA
*/
function getNbOfRecipients($sql='')
{

View File

@ -73,8 +73,8 @@ class mailing_xinputuser extends MailingTargets
* For example if this selector is used to extract 500 different
* emails from a text file, this function must return 500.
*
* @param string $sql Requete sql de comptage
* @return int '' means NA
* @param string $sql Sql request to count
* @return string '' means NA
*/
function getNbOfRecipients($sql='')
{

View File

@ -49,7 +49,7 @@ class PrintingDriver
* Return list of printing driver
*
* @param DoliDB $db Database handler
* @param string $maxfilenamelength Max length of value to show
* @param integer $maxfilenamelength Max length of value to show
* @return array List of drivers
*/
static function listDrivers($db,$maxfilenamelength=0)

View File

@ -254,7 +254,7 @@ class printing_printgcp extends PrintingDriver
/**
* Login into Google Account
*
* @return string true or false
* @return boolean true or false
*/
function GoogleLogin()
{
@ -324,8 +324,8 @@ class printing_printgcp extends PrintingDriver
*
* @param string $url url to hit
* @param array $postfields array of post fields
* @param array $headers array of http headers
* @return array response from curl
* @param string[] $headers array of http headers
* @return string response from curl
*/
private function makeCurl($url,$postfields=array(),$headers=array())
{

View File

@ -819,7 +819,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
* Show payments table
*
* @param PDF $pdf Object PDF
* @param Object $object Object invoice
* @param FactureFournisseur $object Object invoice
* @param int $posy Position y in PDF
* @param Translate $outputlangs Object langs for output
* @return int <0 if KO, >0 if OK
@ -903,7 +903,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
* Show top header of page.
*
* @param PDF $pdf Object PDF
* @param Object $object Object to show
* @param FactureFournisseur $object Object to show
* @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output
* @return void
@ -1090,7 +1090,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
* Show footer of page. Need this->emetteur object
*
* @param PDF $pdf PDF
* @param Object $object Object to show
* @param FactureFournisseur $object Object to show
* @param Translate $outputlangs Object lang for output
* @param int $hidefreetext 1=Hide free text
* @return int Return height of bottom margin including footer text

View File

@ -44,7 +44,7 @@ abstract class ModelePDFSuppliersOrders extends CommonDocGenerator
* Return list of active generation models
*
* @param DoliDB $db Database handler
* @param string $maxfilenamelength Max length of value to show
* @param integer $maxfilenamelength Max length of value to show
* @return array List of templates
*/
static function liste_modeles($db,$maxfilenamelength=0)
@ -143,7 +143,7 @@ abstract class ModeleNumRefSuppliersOrders
* Create a document onto disk according to template model.
*
* @param DoliDB $db Database handler
* @param Object $object Object supplier order
* @param CommandeFournisseur $object Object supplier order
* @param string $modele Force template to use ('' to not force)
* @param Translate $outputlangs Object lang to use for traduction
* @param int $hidedetails Hide details of lines

View File

@ -52,7 +52,11 @@ class CommandeFournisseur extends CommonOrder
var $id;
var $ref; // TODO deprecated
/**
* TODO: Remove
* @deprecated
*/
var $ref;
var $product_ref;
var $ref_supplier;
var $brouillon;

View File

@ -55,10 +55,15 @@ class FactureFournisseur extends CommonInvoice
var $socid;
//Check constants for types
var $type = self::TYPE_STANDARD;
//! 0=draft,
//! 1=validated
//! 2=classified paid partially (close_code='discount_vat','badcustomer') or completely (close_code=null),
//! Also 2, should be 3=classified abandoned and no payment done (close_code='badcustomer','abandon' ou 'replaced')
/**
* Check constants for more info:
* - STATUS_DRAFT
* - STATUS_VALIDATED
* - STATUS_PAID
* - STATUS_ABANDONED
* @var int
*/
var $statut;
//! 1 si facture payee COMPLETEMENT, 0 sinon (ce champ ne devrait plus servir car insuffisant)
var $paye;
@ -438,7 +443,7 @@ class FactureFournisseur extends CommonInvoice
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
$this->fetch_optionals($this->id,$extralabels);
if ($this->statut == 0) $this->brouillon = 1;
if ($this->statut == self::STATUS_DRAFT) $this->brouillon = 1;
$result=$this->fetch_lines();
if ($result < 0)
@ -886,7 +891,7 @@ class FactureFournisseur extends CommonInvoice
$error=0;
// Protection
if ($this->statut > 0) // This is to avoid to validate twice (avoid errors on logs and stock management)
if ($this->statut > self::STATUS_DRAFT) // This is to avoid to validate twice (avoid errors on logs and stock management)
{
dol_syslog(get_class($this)."::validate no draft status", LOG_WARNING);
return 0;
@ -995,7 +1000,7 @@ class FactureFournisseur extends CommonInvoice
if (! $error)
{
$this->ref = $num;
$this->statut=1;
$this->statut=self::STATUS_VALIDATED;
//$this->date_validation=$now; this is stored into log table
}
@ -1032,7 +1037,7 @@ class FactureFournisseur extends CommonInvoice
$error=0;
if ($this->statut == 0)
if ($this->statut == self::STATUS_DRAFT)
{
dol_syslog(get_class($this)."::set_draft already draft status", LOG_WARNING);
return 0;
@ -1746,7 +1751,7 @@ class FactureFournisseur extends CommonInvoice
// Load source object
$object->fetch($fromid);
$object->id=0;
$object->statut=0;
$object->statut=self::STATUS_DRAFT;
// Clear fields
$object->ref_supplier=$langs->trans("CopyOf").' '.$object->ref_supplier;

View File

@ -288,7 +288,7 @@ if (empty($reshook))
elseif ($action == 'deletepaiement' && $user->rights->fournisseur->facture->creer)
{
$object->fetch($id);
if ($object->statut == 1 && $object->paye == 0)
if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0)
{
$paiementfourn = new PaiementFourn($db);
$result=$paiementfourn->fetch(GETPOST('paiement_id'));
@ -867,8 +867,8 @@ if (empty($reshook))
elseif ($action == 'reopen' && $user->rights->fournisseur->facture->creer)
{
$result = $object->fetch($id);
if ($object->statut == 2
|| ($object->statut == 3 && $object->close_code != 'replaced'))
if ($object->statut == FactureFournisseur::STATUS_CLOSED
|| ($object->statut == FactureFournisseur::STATUS_ABANDONED && $object->close_code != 'replaced'))
{
$result = $object->set_unpaid($user);
if ($result > 0)
@ -1739,8 +1739,8 @@ else
print "</tr>\n";
// Ref supplier
print '<tr><td>'.$form->editfieldkey("RefSupplier",'ref_supplier',$object->ref_supplier,$object,($object->statut<2 && $user->rights->fournisseur->facture->creer)).'</td><td colspan="4">';
print $form->editfieldval("RefSupplier",'ref_supplier',$object->ref_supplier,$object,($object->statut<2 && $user->rights->fournisseur->facture->creer));
print '<tr><td>'.$form->editfieldkey("RefSupplier",'ref_supplier',$object->ref_supplier,$object,($object->statut<FactureFournisseur::STATUS_CLOSED && $user->rights->fournisseur->facture->creer)).'</td><td colspan="4">';
print $form->editfieldval("RefSupplier",'ref_supplier',$object->ref_supplier,$object,($object->statut<FactureFournisseur::STATUS_CLOSED && $user->rights->fournisseur->facture->creer));
print '</td></tr>';
// Third party
@ -1788,8 +1788,8 @@ else
print '</td></tr>';
// Label
print '<tr><td>'.$form->editfieldkey("Label",'label',$object->label,$object,($object->statut<2 && $user->rights->fournisseur->facture->creer)).'</td>';
print '<td colspan="3">'.$form->editfieldval("Label",'label',$object->label,$object,($object->statut<2 && $user->rights->fournisseur->facture->creer)).'</td>';
print '<tr><td>'.$form->editfieldkey("Label",'label',$object->label,$object,($object->statut<FactureFournisseur::STATUS_CLOSED && $user->rights->fournisseur->facture->creer)).'</td>';
print '<td colspan="3">'.$form->editfieldval("Label",'label',$object->label,$object,($object->statut<FactureFournisseur::STATUS_CLOSED && $user->rights->fournisseur->facture->creer)).'</td>';
/*
* List of payments
@ -1853,7 +1853,7 @@ else
}
print '<td align="right">'.price($objp->amount).'</td>';
print '<td align="center">';
if ($object->statut == 1 && $object->paye == 0 && $user->societe_id == 0)
if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->societe_id == 0)
{
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=deletepaiement&paiement_id='.$objp->rowid.'">';
print img_delete();
@ -1891,15 +1891,17 @@ else
print '</tr>';
$form_permission = $object->statut<FactureFournisseur::STATUS_CLOSED && $user->rights->fournisseur->facture->creer && $object->getSommePaiement() <= 0;
// Date
print '<tr><td>'.$form->editfieldkey("Date",'datef',$object->datep,$object,($object->statut<2 && $user->rights->fournisseur->facture->creer && $object->getSommePaiement() <= 0),'datepicker').'</td><td colspan="3">';
print $form->editfieldval("Date",'datef',$object->datep,$object,($object->statut<2 && $user->rights->fournisseur->facture->creer && $object->getSommePaiement() <= 0),'datepicker');
print '<tr><td>'.$form->editfieldkey("Date",'datef',$object->datep,$object,$form_permission,'datepicker').'</td><td colspan="3">';
print $form->editfieldval("Date",'datef',$object->datep,$object,$form_permission,'datepicker');
print '</td>';
// Due date
print '<tr><td>'.$form->editfieldkey("DateMaxPayment",'date_lim_reglement',$object->date_echeance,$object,($object->statut<2 && $user->rights->fournisseur->facture->creer && $object->getSommePaiement() <= 0),'datepicker').'</td><td colspan="3">';
print $form->editfieldval("DateMaxPayment",'date_lim_reglement',$object->date_echeance,$object,($object->statut<2 && $user->rights->fournisseur->facture->creer && $object->getSommePaiement() <= 0),'datepicker');
if ($action != 'editdate_lim_reglement' && $object->statut < 2 && $object->date_echeance && $object->date_echeance < ($now - $conf->facture->fournisseur->warning_delay)) print img_warning($langs->trans('Late'));
print '<tr><td>'.$form->editfieldkey("DateMaxPayment",'date_lim_reglement',$object->date_echeance,$object,$form_permission,'datepicker').'</td><td colspan="3">';
print $form->editfieldval("DateMaxPayment",'date_lim_reglement',$object->date_echeance,$object,$form_permission,'datepicker');
if ($action != 'editdate_lim_reglement' && $object->statut < FactureFournisseur::STATUS_CLOSED && $object->date_echeance && $object->date_echeance < ($now - $conf->facture->fournisseur->warning_delay)) print img_warning($langs->trans('Late'));
print '</td>';
// Conditions de reglement par defaut
@ -2081,7 +2083,7 @@ else
<input type="hidden" name="socid" value="'.$societe->id.'">
';
if (! empty($conf->use_javascript_ajax) && $object->statut == 0) {
if (! empty($conf->use_javascript_ajax) && $object->statut == FactureFournisseur::STATUS_DRAFT) {
include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php';
}
@ -2279,7 +2281,7 @@ else
}
*/
// Form to add new line
if ($object->statut == 0 && $user->rights->fournisseur->facture->creer)
if ($object->statut == FactureFournisseur::STATUS_DRAFT && $user->rights->fournisseur->facture->creer)
{
if ($action != 'editline')
{
@ -2310,7 +2312,7 @@ else
print '<div class="tabsAction">';
// Modify a validated invoice with no payments
if ($object->statut == 1 && $action != 'edit' && $object->getSommePaiement() == 0 && $user->rights->fournisseur->facture->creer)
if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $action != 'edit' && $object->getSommePaiement() == 0 && $user->rights->fournisseur->facture->creer)
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=edit">'.$langs->trans('Modify').'</a>';
}
@ -2329,7 +2331,7 @@ else
}
// Send by mail
if (($object->statut == 1 || $object->statut == 2))
if (($object->statut == FactureFournisseur::STATUS_VALIDATED || $object->statut == FactureFournisseur::STATUS_CLOSED))
{
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->fournisseur->supplier_invoice_advance->send)
{
@ -2340,13 +2342,13 @@ else
// Make payments
if ($action != 'edit' && $object->statut == 1 && $object->paye == 0 && $user->societe_id == 0)
if ($action != 'edit' && $object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->societe_id == 0)
{
print '<a class="butAction" href="paiement.php?facid='.$object->id.'&amp;action=create &amp;accountid='.$object->fk_account.'">'.$langs->trans('DoPayment').'</a>'; // must use facid because id is for payment id not invoice
}
// Classify paid
if ($action != 'edit' && $object->statut == 1 && $object->paye == 0 && $user->societe_id == 0)
if ($action != 'edit' && $object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->societe_id == 0)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=paid"';
print '>'.$langs->trans('ClassifyPaid').'</a>';
@ -2355,7 +2357,7 @@ else
}
// Validate
if ($action != 'edit' && $object->statut == 0)
if ($action != 'edit' && $object->statut == FactureFournisseur::STATUS_DRAFT)
{
if (count($object->lines))
{

View File

@ -513,3 +513,6 @@ create table llx_c_price_global_variable_updater
next_update integer DEFAULT 0,
last_status text DEFAULT NULL
)ENGINE=innodb;
ALTER TABLE llx_adherent CHANGE COLUMN note note_private text DEFAULT NULL;

View File

@ -54,7 +54,7 @@ create table llx_adherent
statut smallint NOT NULL DEFAULT 0,
public smallint NOT NULL DEFAULT 0, -- certain champ de la fiche sont ils public ou pas ?
datefin datetime, -- date de fin de validite de la cotisation
note text,
note_private text DEFAULT NULL,
datevalid datetime, -- date de validation
datec datetime, -- date de creation
tms timestamp, -- date de modification

View File

@ -321,7 +321,7 @@ class Loan extends CommonObject
* Return label of loan status (unpaid, paid)
*
* @param int $mode 0=label, 1=short label, 2=Picto + Short label, 3=Picto, 4=Picto + Label
* @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise)
* @param integer $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise)
* @return string Label
*/
function getLibStatut($mode=0,$alreadypaid=-1)
@ -334,7 +334,7 @@ class Loan extends CommonObject
*
* @param int $statut Id statut
* @param int $mode 0=Label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Label, 5=Short label + Picto
* @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise)
* @param integer $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise)
* @return string Label
*/
function LibStatut($statut,$mode=0,$alreadypaid=-1)
@ -447,7 +447,7 @@ class Loan extends CommonObject
* Information on record
*
* @param int $id Id of record
* @return void
* @return integer|null
*/
function info($id)
{

View File

@ -111,17 +111,17 @@ function test_sql_and_script_inject($val, $type)
/**
* Security: Return true if OK, false otherwise.
*
* @param string $var Variable name
* @param string $type 1=GET, 0=POST, 2=PHP_SELF
* @return boolean true if there is an injection
* @param string $var Variable name
* @param string $type 1=GET, 0=POST, 2=PHP_SELF
* @return boolean||null true if there is an injection. Stop code if injection found.
*/
function analyse_sql_and_script(&$var, $type)
function analyseVarsForSqlAndScriptsInjection(&$var, $type)
{
if (is_array($var))
{
foreach ($var as $key => $value)
{
if (analyse_sql_and_script($value,$type))
if (analyseVarsForSqlAndScriptsInjection($value,$type))
{
$var[$key] = $value;
}
@ -147,16 +147,16 @@ if ((defined('NOREQUIREDB') || defined('NOREQUIRETRAN')) && ! defined('NOREQUIRE
if (! empty($_SERVER["PHP_SELF"]))
{
$morevaltochecklikepost=array($_SERVER["PHP_SELF"]);
analyse_sql_and_script($morevaltochecklikepost,2);
analyseVarsForSqlAndScriptsInjection($morevaltochecklikepost,2);
}
// Sanity check on GET parameters
if (! empty($_SERVER["QUERY_STRING"]))
{
$morevaltochecklikeget=array($_SERVER["QUERY_STRING"]);
analyse_sql_and_script($morevaltochecklikeget,1);
analyseVarsForSqlAndScriptsInjection($morevaltochecklikeget,1);
}
// Sanity check on POST
analyse_sql_and_script($_POST,0);
analyseVarsForSqlAndScriptsInjection($_POST,0);
// This is to make Dolibarr working with Plesk
if (! empty($_SERVER['DOCUMENT_ROOT'])) set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs');

View File

@ -30,8 +30,8 @@ llxHeader("",$langs->trans("Printing"));
print_fiche_titre($langs->trans("Printing"));
// List Jobs from printing modules
//$printer = new dolPrintIPP($db,$conf->global->PRINTIPP_HOST,$conf->global->PRINTIPP_PORT,$user->login,$conf->global->PRINTIPP_USER,$conf->global->PRINTIPP_PASSWORD);
//$printer->list_jobs('commande');
$printer = new dolPrintIPP($db,$conf->global->PRINTIPP_HOST,$conf->global->PRINTIPP_PORT,$user->login,$conf->global->PRINTIPP_USER,$conf->global->PRINTIPP_PASSWORD);
$printer->list_jobs('commande');
llxFooter();

View File

@ -67,7 +67,7 @@ class ActionsCardService
* Assign custom values for canvas (for example into this->tpl to be used by templates)
*
* @param string $action Type of action
* @param string $id Id of object
* @param integer $id Id of object
* @param string $ref Ref of object
* @return void
*/

View File

@ -462,7 +462,7 @@ class Productbatch extends CommonObject
/**
* Return all batch detail records for given product and warehouse
*
* @param obj $db database object
* @param DoliDB $db database object
* @param int $fk_product_stock id product_stock for objet
* @param int $with_qty doesn't return line with 0 quantity
* @return int <0 if KO, >0 if OK

View File

@ -25,9 +25,9 @@
* \brief Example of form to add a new member
*
* Note that you can add following constant to change behaviour of page
* MEMBER_NEWFORM_AMOUNT Default amount for autosubscribe form
* MEMBER_NEWFORM_AMOUNT Default amount for auto-subscribe form
* MEMBER_NEWFORM_EDITAMOUNT Amount can be edited
* MEMBER_NEWFORM_PAYONLINE Suggest paypemt with paypal of paybox
* MEMBER_NEWFORM_PAYONLINE Suggest payment with paypal of paybox
* MEMBER_NEWFORM_DOLIBARRTURNOVER Show field turnover (specific for dolibarr foundation)
* MEMBER_URL_REDIRECT_SUBSCRIPTION Url to redirect once subscribe submitted
* MEMBER_NEWFORM_FORCETYPE Force type of member
@ -40,7 +40,7 @@ define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
// For MultiCompany module.
// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
// TODO This should be useless. Because entity must be retreive from object ref and not from url.
// TODO This should be useless. Because entity must be retrieve from object ref and not from url.
$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
if (is_numeric($entity)) define("DOLENTITY", $entity);
@ -138,7 +138,7 @@ function llxFooterVierge()
* Actions
*/
// Action called when page is submited
// Action called when page is submitted
if ($action == 'add')
{
// test if login already exists
@ -335,7 +335,7 @@ if ($action == 'add')
}
}
// Action called after a submited was send and member created succesfully
// Action called after a submitted was send and member created successfully
// If MEMBER_URL_REDIRECT_SUBSCRIPTION is set to url we never go here because a redirect was done to this url.
// backtopage parameter with an url was set on member submit page, we never go here because a redirect was done to this url.
if ($action == 'added')

View File

@ -355,7 +355,7 @@ abstract class ActionsCardCommon
* Assign custom values for canvas (for example into this->tpl to be used by templates)
*
* @param string $action Type of action
* @param string $id Id of object
* @param integer $id Id of object
* @param string $ref Ref of object
* @return void
*/

View File

@ -92,7 +92,7 @@ class ActionsCardCompany extends ActionsCardCommon
* Assign custom values for canvas (for example into this->tpl to be used by templates)
*
* @param string $action Type of action
* @param string $id Id of object
* @param integer $id Id of object
* @param string $ref Ref of object
* @return void
*/

View File

@ -92,7 +92,7 @@ class ActionsCardIndividual extends ActionsCardCommon
* Assign custom values for canvas (for example into this->tpl to be used by templates)
*
* @param string $action Type of action
* @param string $id Id of object
* @param integer $id Id of object
* @param string $ref Ref of object
* @return void
*/

View File

@ -1578,7 +1578,7 @@ class Societe extends CommonObject
*
* @param User $user Filtre sur un user auteur des remises
* @param string $filter Filtre autre
* @param string $maxvalue Filter on max value for discount
* @param integer $maxvalue Filter on max value for discount
* @return int <0 if KO, Credit note amount otherwise
*/
function getAvailableDiscounts($user='',$filter='',$maxvalue=0)
@ -1728,7 +1728,7 @@ class Societe extends CommonObject
* @param int $withpicto Add picto into link (0=No picto, 1=Include picto with link, 2=Picto only)
* @param string $option Target of link ('', 'customer', 'prospect', 'supplier')
* @param int $maxlen Max length of text
* @param string $notooltip 1=Disable tooltip
* @param integer $notooltip 1=Disable tooltip
* @return string String with URL
*/
function getNomUrl($withpicto=0,$option='',$maxlen=0,$notooltip=0)

View File

@ -1,3 +1,26 @@
<?php
/* Copyright (C) 2010 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* or see http://www.gnu.org/
*/
/**
* \file test/bootstrap.php
* \ingroup test
* \brief PHPUnit test
* \remarks To make test with phpunit
*/
set_time_limit(0);
?>