2
0
forked from Wavyzz/dolibarr

Fix: MSSQL ne supporte pas le mot cl "percent", renommage en "percentage"

This commit is contained in:
Regis Houssin
2007-09-02 10:20:07 +00:00
parent 45c98f1d0d
commit 7654928825
6 changed files with 26 additions and 26 deletions

View File

@@ -56,7 +56,7 @@ class ActionComm
var $societe; var $societe;
var $contact; var $contact;
var $note; var $note;
var $percent; var $percentage;
/** /**
* \brief Constructeur * \brief Constructeur
@@ -83,7 +83,7 @@ class ActionComm
{ {
global $langs,$conf; global $langs,$conf;
if (! $this->percent) $this->percent = 0; if (! $this->percentage) $this->percentage = 0;
if (! $this->priority) $this->priority = 0; if (! $this->priority) $this->priority = 0;
$this->db->begin(); $this->db->begin();
@@ -122,7 +122,7 @@ class ActionComm
if ($this->date) $sql.= "'".$this->db->idate($this->date)."',"; if ($this->date) $sql.= "'".$this->db->idate($this->date)."',";
$sql.= "'".$this->type_id."', '".$this->societe->id."' ,'".addslashes($this->note)."',"; $sql.= "'".$this->type_id."', '".$this->societe->id."' ,'".addslashes($this->note)."',";
$sql.= ($this->contact->id?$this->contact->id:"null").","; $sql.= ($this->contact->id?$this->contact->id:"null").",";
$sql.= "'$author->id', '".$this->user->id ."', '".addslashes($this->label)."','".$this->percent."','".$this->priority."',"; $sql.= "'$author->id', '".$this->user->id ."', '".addslashes($this->label)."','".$this->percentage."','".$this->priority."',";
$sql.= ($this->facid?$this->facid:"null").","; $sql.= ($this->facid?$this->facid:"null").",";
$sql.= ($this->propalrowid?$this->propalrowid:"null").","; $sql.= ($this->propalrowid?$this->propalrowid:"null").",";
$sql.= ($this->orderrowid?$this->orderrowid:"null"); $sql.= ($this->orderrowid?$this->orderrowid:"null");
@@ -167,7 +167,7 @@ class ActionComm
$sql.= " ".$this->db->pdate("a.datep")." as datep,"; $sql.= " ".$this->db->pdate("a.datep")." as datep,";
$sql.= " ".$this->db->pdate("a.datec")." as datec, tms as datem,"; $sql.= " ".$this->db->pdate("a.datec")." as datec, tms as datem,";
$sql.= " a.note, a.label, a.fk_action as type_id,"; $sql.= " a.note, a.label, a.fk_action as type_id,";
$sql.= " fk_soc, fk_user_author, fk_contact, fk_facture, a.percent, a.fk_commande,"; $sql.= " fk_soc, fk_user_author, fk_contact, fk_facture, a.percent as percentage, a.fk_commande,";
$sql.= " c.id as type_id, c.code as type_code, c.libelle"; $sql.= " c.id as type_id, c.code as type_code, c.libelle";
$sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."c_actioncomm as c"; $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."c_actioncomm as c";
$sql.= " WHERE a.id=".$id." AND a.fk_action=c.id"; $sql.= " WHERE a.id=".$id." AND a.fk_action=c.id";
@@ -193,7 +193,7 @@ class ActionComm
$this->datec = $obj->datec; $this->datec = $obj->datec;
$this->datem = $obj->datem; $this->datem = $obj->datem;
$this->note =$obj->note; $this->note =$obj->note;
$this->percent =$obj->percent; $this->percentage =$obj->percentage;
$this->societe->id = $obj->fk_soc; $this->societe->id = $obj->fk_soc;
$this->author->id = $obj->fk_user_author; $this->author->id = $obj->fk_user_author;
$this->contact->id = $obj->fk_contact; $this->contact->id = $obj->fk_contact;
@@ -249,17 +249,17 @@ class ActionComm
/** /**
* \brief Met a jour l'action en base. * \brief Met a jour l'action en base.
* Si percent = 100, on met a jour date 100% * Si percentage = 100, on met a jour date 100%
* \return int <0 si ko, >0 si ok * \return int <0 si ko, >0 si ok
*/ */
function update() function update()
{ {
$this->label=trim($this->label); $this->label=trim($this->label);
$this->note=trim($this->note); $this->note=trim($this->note);
if ($this->percent > 100) $this->percent = 100; if ($this->percentage > 100) $this->percentage = 100;
$sql = "UPDATE ".MAIN_DB_PREFIX."actioncomm "; $sql = "UPDATE ".MAIN_DB_PREFIX."actioncomm ";
$sql.= " SET percent='".$this->percent."'"; $sql.= " SET percent='".$this->percentage."'";
if ($this->label) $sql.= ", label = '".addslashes($this->label)."'"; if ($this->label) $sql.= ", label = '".addslashes($this->label)."'";
$sql.= ", datep = ".($this->datep ? "'".$this->db->idate($this->datep)."'" : 'null'); $sql.= ", datep = ".($this->datep ? "'".$this->db->idate($this->datep)."'" : 'null');
$sql.= ", datea = ".($this->date ? "'".$this->db->idate($this->date)."'" : 'null'); $sql.= ", datea = ".($this->date ? "'".$this->db->idate($this->date)."'" : 'null');
@@ -359,7 +359,7 @@ class ActionComm
*/ */
function getLibStatut($mode) function getLibStatut($mode)
{ {
return $this->LibStatut($this->percent,$mode); return $this->LibStatut($this->percentage,$mode);
} }
/** /**

View File

@@ -139,16 +139,16 @@ if ($_POST["action"] == 'add_action')
// RDV // RDV
if ($actioncomm->date) if ($actioncomm->date)
{ {
$actioncomm->percent = 100; $actioncomm->percentage = 100;
} }
else else
{ {
$actioncomm->percent = 0; $actioncomm->percentage = 0;
} }
} }
else else
{ {
$actioncomm->percent = isset($_POST["percentage"])?$_POST["percentage"]:0; $actioncomm->percentage = isset($_POST["percentage"])?$_POST["percentage"]:0;
} }
$actioncomm->duree=(($_POST["dureehour"] * 60) + $_POST["dureemin"]) * 60; $actioncomm->duree=(($_POST["dureehour"] * 60) + $_POST["dureemin"]) * 60;
$actioncomm->user = $user; $actioncomm->user = $user;
@@ -255,10 +255,10 @@ if ($_POST["action"] == 'update')
//print $_POST["apmonth"].",".$_POST["apday"].",".$_POST["apyear"].",".$_POST["aphour"].",".$_POST["apmin"]."<br>\n"; //print $_POST["apmonth"].",".$_POST["apday"].",".$_POST["apyear"].",".$_POST["aphour"].",".$_POST["apmin"]."<br>\n";
//print $action->datep; //print $action->datep;
$action->label = $_POST["label"]; $action->label = $_POST["label"];
$action->percent = $_POST["percent"]; $action->percentage = $_POST["percentage"];
$action->contact->id = $_POST["contactid"]; $action->contact->id = $_POST["contactid"];
$action->note = $_POST["note"]; $action->note = $_POST["note"];
if ($action->type_code == 'AC_RDV' && $action->percent == 100 && ! $action->date) if ($action->type_code == 'AC_RDV' && $action->percentage == 100 && ! $action->date)
{ {
$action->date = $action->datep; $action->date = $action->datep;
} }
@@ -642,7 +642,7 @@ if ($_GET["id"])
// Date planification // Date planification
print '<tr><td>'.$langs->trans("DateActionPlanned").'</td><td colspan="3">'; print '<tr><td>'.$langs->trans("DateActionPlanned").'</td><td colspan="3">';
$html->select_date(($act->datep?$act->datep:-1),'ap',1,1,1,"action"); $html->select_date(($act->datep?$act->datep:-1),'ap',1,1,1,"action");
if ($act->percent < 100 && $act->datep < (time() - $conf->global->MAIN_DELAY_ACTIONS_TODO)) print img_warning($langs->trans("Late")); if ($act->percentage < 100 && $act->datep < (time() - $conf->global->MAIN_DELAY_ACTIONS_TODO)) print img_warning($langs->trans("Late"));
print '</td></tr>'; print '</td></tr>';
// Date done // Date done
@@ -652,7 +652,7 @@ if ($_GET["id"])
// Etat // Etat
print '<tr><td nowrap>'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td><td colspan="3"><input name="percent" value="'.$act->percent.'" size="4">%</td></tr>'; print '<tr><td nowrap>'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td><td colspan="3"><input name="percentage" value="'.$act->percentage.'" size="4">%</td></tr>';
// Objet li<6C> // Objet li<6C>
if ($act->objet_url) if ($act->objet_url)
@@ -730,7 +730,7 @@ if ($_GET["id"])
// Date planification // Date planification
print '<tr><td>'.$langs->trans("DateActionPlanned").'</td><td colspan="3">'; print '<tr><td>'.$langs->trans("DateActionPlanned").'</td><td colspan="3">';
print dolibarr_print_date($act->datep,'dayhour'); print dolibarr_print_date($act->datep,'dayhour');
if ($act->percent < 100 && $act->datep < (time() - $conf->global->MAIN_DELAY_ACTIONS_TODO)) print img_warning($langs->trans("Late")); if ($act->percentage < 100 && $act->datep < (time() - $conf->global->MAIN_DELAY_ACTIONS_TODO)) print img_warning($langs->trans("Late"));
print '</td></tr>'; print '</td></tr>';
// Date fin real // Date fin real

View File

@@ -28,7 +28,7 @@
\version $Revision$ \version $Revision$
*/ */
require_once(FPDF_PATH.'fpdi_protection.php'); require_once(FPDFI_PATH.'fpdi_protection.php');
require_once(DOL_DOCUMENT_ROOT ."/includes/fpdf/fpdf_indexes.php"); require_once(DOL_DOCUMENT_ROOT ."/includes/fpdf/fpdf_indexes.php");
require_once(DOL_DOCUMENT_ROOT ."/includes/fpdf/fpdf_html.php"); require_once(DOL_DOCUMENT_ROOT ."/includes/fpdf/fpdf_html.php");

View File

@@ -630,7 +630,7 @@ if ($_GET["id"] && $_GET["action"] != 'edit')
$numaction = 0 ; $numaction = 0 ;
// Recherche histo sur actioncomm // Recherche histo sur actioncomm
$sql = "SELECT a.id, ".$db->pdate("a.datea")." as da, a.note, a.percent as percent,"; $sql = "SELECT a.id, ".$db->pdate("a.datea")." as da, a.note, a.percent as percentage,";
$sql.= " c.code as acode, c.libelle,"; $sql.= " c.code as acode, c.libelle,";
$sql.= " u.rowid as user_id, u.login"; $sql.= " u.rowid as user_id, u.login";
$sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u "; $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u ";
@@ -648,7 +648,7 @@ if ($_GET["id"] && $_GET["action"] != 'edit')
while ($i < $num) while ($i < $num)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$histo[$numaction]=array('type'=>'action','id'=>$obj->id,'date'=>$obj->da,'note'=>$obj->note,'percent'=>$obj->percent, $histo[$numaction]=array('type'=>'action','id'=>$obj->id,'date'=>$obj->da,'note'=>$obj->note,'percent'=>$obj->percentage,
'acode'=>$obj->acode,'libelle'=>$obj->libelle, 'acode'=>$obj->acode,'libelle'=>$obj->libelle,
'userid'=>$obj->user_id,'login'=>$obj->login); 'userid'=>$obj->user_id,'login'=>$obj->login);
$numaction++; $numaction++;
@@ -661,7 +661,7 @@ if ($_GET["id"] && $_GET["action"] != 'edit')
} }
// Recherche histo sur mailing // Recherche histo sur mailing
$sql = "SELECT m.rowid as id, ".$db->pdate("mc.date_envoi")." as da, m.titre as note, '100' as percent,"; $sql = "SELECT m.rowid as id, ".$db->pdate("mc.date_envoi")." as da, m.titre as note, '100' as percentage,";
$sql.= " 'AC_EMAILING' as acode,"; $sql.= " 'AC_EMAILING' as acode,";
$sql.= " u.rowid as user_id, u.login"; $sql.= " u.rowid as user_id, u.login";
$sql.= " FROM ".MAIN_DB_PREFIX."mailing as m, ".MAIN_DB_PREFIX."mailing_cibles as mc, ".MAIN_DB_PREFIX."user as u "; $sql.= " FROM ".MAIN_DB_PREFIX."mailing as m, ".MAIN_DB_PREFIX."mailing_cibles as mc, ".MAIN_DB_PREFIX."user as u ";
@@ -680,7 +680,7 @@ if ($_GET["id"] && $_GET["action"] != 'edit')
while ($i < $num) while ($i < $num)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$histo[$numaction]=array('type'=>'mailing','id'=>$obj->id,'date'=>$obj->da,'note'=>$obj->note,'percent'=>$obj->percent, $histo[$numaction]=array('type'=>'mailing','id'=>$obj->id,'date'=>$obj->da,'note'=>$obj->note,'percent'=>$obj->percentage,
'acode'=>$obj->acode,'libelle'=>$obj->libelle, 'acode'=>$obj->acode,'libelle'=>$obj->libelle,
'userid'=>$obj->user_id,'login'=>$obj->login); 'userid'=>$obj->user_id,'login'=>$obj->login);
$numaction++; $numaction++;

View File

@@ -71,7 +71,7 @@ class box_actions extends ModeleBoxes {
if ($user->rights->commercial->main->lire) if ($user->rights->commercial->main->lire)
{ {
$sql = "SELECT a.id, a.label, ".$db->pdate("a.datep")." as dp , a.percent,"; $sql = "SELECT a.id, a.label, ".$db->pdate("a.datep")." as dp , a.percent as percentage,";
$sql.= " ta.code,"; $sql.= " ta.code,";
$sql.= " s.nom, s.rowid as socid"; $sql.= " s.nom, s.rowid as socid";
if (!$user->rights->commercial->client->voir && !$user->societe_id) $sql .= ", sc.fk_soc, sc.fk_user"; if (!$user->rights->commercial->client->voir && !$user->societe_id) $sql .= ", sc.fk_soc, sc.fk_user";
@@ -119,11 +119,11 @@ class box_actions extends ModeleBoxes {
'text' => dolibarr_print_date($objp->dp, "dayhour")); 'text' => dolibarr_print_date($objp->dp, "dayhour"));
$this->info_box_contents[$i][3] = array('align' => 'right', $this->info_box_contents[$i][3] = array('align' => 'right',
'text' => $objp->percent. "%"); 'text' => $objp->percentage. "%");
$this->info_box_contents[$i][4] = array( $this->info_box_contents[$i][4] = array(
'align' => 'right', 'align' => 'right',
'text' => $actionstatic->LibStatut($objp->percent,3)); 'text' => $actionstatic->LibStatut($objp->percentage,3));
$i++; $i++;
} }

View File

@@ -321,7 +321,7 @@ class DoliDb
$query = str_ireplace(" file ", " [file] ", $query); $query = str_ireplace(" file ", " [file] ", $query);
$query = str_ireplace(" file,", " [file],", $query); $query = str_ireplace(" file,", " [file],", $query);
// Idem file // Idem file
$query = str_ireplace(".percent", ".[percent]", $query); $query = str_ireplace("percent", "[percent]", $query);
$query = str_ireplace("\'", "''", $query); $query = str_ireplace("\'", "''", $query);