Skip to content
Snippets Groups Projects
Commit 76549288 authored by Regis Houssin's avatar Regis Houssin
Browse files

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

parent 45c98f1d
No related branches found
No related tags found
No related merge requests found
......@@ -56,7 +56,7 @@ class ActionComm
var $societe;
var $contact;
var $note;
var $percent;
var $percentage;
/**
* \brief Constructeur
......@@ -83,7 +83,7 @@ class ActionComm
{
global $langs,$conf;
if (! $this->percent) $this->percent = 0;
if (! $this->percentage) $this->percentage = 0;
if (! $this->priority) $this->priority = 0;
$this->db->begin();
......@@ -122,7 +122,7 @@ class ActionComm
if ($this->date) $sql.= "'".$this->db->idate($this->date)."',";
$sql.= "'".$this->type_id."', '".$this->societe->id."' ,'".addslashes($this->note)."',";
$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->propalrowid?$this->propalrowid:"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.datec")." as datec, tms as datem,";
$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.= " 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";
......@@ -193,7 +193,7 @@ class ActionComm
$this->datec = $obj->datec;
$this->datem = $obj->datem;
$this->note =$obj->note;
$this->percent =$obj->percent;
$this->percentage =$obj->percentage;
$this->societe->id = $obj->fk_soc;
$this->author->id = $obj->fk_user_author;
$this->contact->id = $obj->fk_contact;
......@@ -249,17 +249,17 @@ class ActionComm
/**
* \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
*/
function update()
{
$this->label=trim($this->label);
$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.= " SET percent='".$this->percent."'";
$sql.= " SET percent='".$this->percentage."'";
if ($this->label) $sql.= ", label = '".addslashes($this->label)."'";
$sql.= ", datep = ".($this->datep ? "'".$this->db->idate($this->datep)."'" : 'null');
$sql.= ", datea = ".($this->date ? "'".$this->db->idate($this->date)."'" : 'null');
......@@ -359,7 +359,7 @@ class ActionComm
*/
function getLibStatut($mode)
{
return $this->LibStatut($this->percent,$mode);
return $this->LibStatut($this->percentage,$mode);
}
/**
......
......@@ -139,16 +139,16 @@ if ($_POST["action"] == 'add_action')
// RDV
if ($actioncomm->date)
{
$actioncomm->percent = 100;
$actioncomm->percentage = 100;
}
else
{
$actioncomm->percent = 0;
$actioncomm->percentage = 0;
}
}
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->user = $user;
......@@ -255,10 +255,10 @@ if ($_POST["action"] == 'update')
//print $_POST["apmonth"].",".$_POST["apday"].",".$_POST["apyear"].",".$_POST["aphour"].",".$_POST["apmin"]."<br>\n";
//print $action->datep;
$action->label = $_POST["label"];
$action->percent = $_POST["percent"];
$action->percentage = $_POST["percentage"];
$action->contact->id = $_POST["contactid"];
$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;
}
......@@ -642,7 +642,7 @@ if ($_GET["id"])
// Date planification
print '<tr><td>'.$langs->trans("DateActionPlanned").'</td><td colspan="3">';
$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>';
// Date done
......@@ -652,7 +652,7 @@ if ($_GET["id"])
// 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é
if ($act->objet_url)
......@@ -730,7 +730,7 @@ if ($_GET["id"])
// Date planification
print '<tr><td>'.$langs->trans("DateActionPlanned").'</td><td colspan="3">';
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>';
// Date fin real
......
......@@ -28,7 +28,7 @@
\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_html.php");
......
......@@ -630,7 +630,7 @@ if ($_GET["id"] && $_GET["action"] != 'edit')
$numaction = 0 ;
// 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.= " 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 ";
......@@ -648,7 +648,7 @@ if ($_GET["id"] && $_GET["action"] != 'edit')
while ($i < $num)
{
$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,
'userid'=>$obj->user_id,'login'=>$obj->login);
$numaction++;
......@@ -661,7 +661,7 @@ if ($_GET["id"] && $_GET["action"] != 'edit')
}
// 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.= " 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 ";
......@@ -680,7 +680,7 @@ if ($_GET["id"] && $_GET["action"] != 'edit')
while ($i < $num)
{
$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,
'userid'=>$obj->user_id,'login'=>$obj->login);
$numaction++;
......
......@@ -71,7 +71,7 @@ class box_actions extends ModeleBoxes {
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.= " s.nom, s.rowid as socid";
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"));
$this->info_box_contents[$i][3] = array('align' => 'right',
'text' => $objp->percent. "%");
'text' => $objp->percentage. "%");
$this->info_box_contents[$i][4] = array(
'align' => 'right',
'text' => $actionstatic->LibStatut($objp->percent,3));
'text' => $actionstatic->LibStatut($objp->percentage,3));
$i++;
}
......
......@@ -321,7 +321,7 @@ class DoliDb
$query = str_ireplace(" file ", " [file] ", $query);
$query = str_ireplace(" file,", " [file],", $query);
// Idem file
$query = str_ireplace(".percent", ".[percent]", $query);
$query = str_ireplace("percent", "[percent]", $query);
$query = str_ireplace("\'", "''", $query);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment