For the "default" field, we keep usa of standard on and off button because it is not a feature we activate or not but a choice of one line among others. I will change this later to replace with a checkbox.

This commit is contained in:
Laurent Destailleur 2011-08-31 18:47:29 +00:00
parent 74883b6f03
commit 247fd29662
7 changed files with 123 additions and 145 deletions

View File

@ -120,13 +120,13 @@ if ($action == 'del')
{ {
$type='order'; $type='order';
$sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
$sql.= " WHERE nom = '".$value."'"; $sql.= " WHERE nom = '".$db->escape($value)."'";
$sql.= " AND type = '".$type."'"; $sql.= " AND type = '".$type."'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
if ($db->query($sql)) if ($db->query($sql))
{ {
if ($conf->global->COMMANDE_ADDON_PDF == "$value") dolibarr_del_const($db, 'COMMANDE_ADDON_PDF',$conf->entity);
} }
} }
@ -207,22 +207,7 @@ if ($action == 'set_COMMANDE_FREE_TEXT')
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>"; $mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
} }
} }
/*
if ($action == 'setvalidorder')
{
dolibarr_set_const($db, "COMMANDE_VALID_AFTER_CLOSE_PROPAL",$_POST["validorder"],'chaine',0,'',$conf->entity);
}
if ($action == 'deliverycostline')
{
dolibarr_set_const($db, "COMMANDE_ADD_DELIVERY_COST_LINE",$_POST["addline"],'chaine',0,'',$conf->entity);
}
if ($action == 'set_use_customer_contact_as_recipient')
{
dolibarr_set_const($db, "COMMANDE_USE_CUSTOMER_CONTACT_AS_RECIPIENT",$_POST["use_customer_contact_as_recipient"],'chaine',0,'',$conf->entity);
}
*/
/* /*
* View * View
@ -417,16 +402,16 @@ foreach ($conf->file->dol_document_root as $dirroot)
print "<td align=\"center\">\n"; print "<td align=\"center\">\n";
if (in_array($name, $def)) if (in_array($name, $def))
{ {
if ($conf->global->COMMANDE_ADDON_PDF != "$name") //if ($conf->global->COMMANDE_ADDON_PDF != "$name")
{ //{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">';
print img_picto($langs->trans("Activated"),'switch_on'); print img_picto($langs->trans("Activated"),'switch_on');
print '</a>'; print '</a>';
} //}
else //else
{ //{
print img_picto($langs->trans("Activated"),'switch_on'); // print img_picto($langs->trans("Activated"),'switch_on');
} //}
} }
else else
{ {

View File

@ -107,13 +107,13 @@ if ($action == 'del')
{ {
$type='shipping'; $type='shipping';
$sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
$sql.= " WHERE nom = '".$value."'"; $sql.= " WHERE nom = '".$db->escape($value)."'";
$sql.= " AND type = '".$type."'"; $sql.= " AND type = '".$type."'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
if ($db->query($sql)) if ($db->query($sql))
{ {
if ($conf->global->EXPEDITION_ADDON_PDF == "$value") dolibarr_del_const($db, 'EXPEDITION_ADDON_PDF',$conf->entity);
} }
} }
@ -343,7 +343,7 @@ print '<td width="100">'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Description").'</td>'; print '<td>'.$langs->trans("Description").'</td>';
print '<td>'.$langs->trans("Example").'</td>'; print '<td>'.$langs->trans("Example").'</td>';
print '<td align="center" width="60">'.$langs->trans("Status").'</td>'; print '<td align="center" width="60">'.$langs->trans("Status").'</td>';
print '<td align="center" width="16">'.$langs->trans("Infos").'</td>'; print '<td align="center" width="80">'.$langs->trans("Infos").'</td>';
print "</tr>\n"; print "</tr>\n";
clearstatcache(); clearstatcache();
@ -479,7 +479,7 @@ print '<td width="140">'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Description").'</td>'; print '<td>'.$langs->trans("Description").'</td>';
print '<td align="center" width="60">'.$langs->trans("Status").'</td>'; print '<td align="center" width="60">'.$langs->trans("Status").'</td>';
print '<td align="center" width="60">'.$langs->trans("Default").'</td>'; print '<td align="center" width="60">'.$langs->trans("Default").'</td>';
print '<td align="center" width="32" colspan="2">'.$langs->trans("Infos").'</td>'; print '<td align="center" width="80" nowrap="nowrap">'.$langs->trans("Infos").'</td>';
print "</tr>\n"; print "</tr>\n";
clearstatcache(); clearstatcache();
@ -516,16 +516,16 @@ foreach ($conf->file->dol_document_root as $dirroot)
if (in_array($name, $def)) if (in_array($name, $def))
{ {
print "<td align=\"center\">\n"; print "<td align=\"center\">\n";
if ($conf->global->EXPEDITION_ADDON_PDF != $name) //if ($conf->global->EXPEDITION_ADDON_PDF != $name)
{ //{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'">'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'">';
print img_picto($langs->trans("Activated"),'switch_on'); print img_picto($langs->trans("Activated"),'switch_on');
print '</a>'; print '</a>';
} //}
else //else
{ //{
print img_picto($langs->trans("Activated"),'switch_on'); // print img_picto($langs->trans("Activated"),'switch_on');
} //}
print "</td>"; print "</td>";
} }
else else
@ -539,11 +539,11 @@ foreach ($conf->file->dol_document_root as $dirroot)
print "<td align=\"center\">"; print "<td align=\"center\">";
if ($conf->global->EXPEDITION_ADDON_PDF == $name) if ($conf->global->EXPEDITION_ADDON_PDF == $name)
{ {
print img_picto($langs->trans("Default"),'switch_on'); print img_picto($langs->trans("Default"),'on');
} }
else else
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
} }
print '</td>'; print '</td>';
@ -554,10 +554,8 @@ foreach ($conf->file->dol_document_root as $dirroot)
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>'; $htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,1,1); $htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,1,1);
print '<td align="center">'; print '<td align="center">';
print $html->textwithpicto('',$htmltooltip,1,0); $link='<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_object($langs->trans("Preview"),'sending').'</a>';
print '</td>'; print $html->textwithpicto(' &nbsp; &nbsp; '.$link,$htmltooltip,-1,0);
print '<td align="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_object($langs->trans("Preview"),'sending').'</a>';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr> * Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
@ -38,6 +38,9 @@ $langs->load("errors");
if (!$user->admin) if (!$user->admin)
accessforbidden(); accessforbidden();
$action = GETPOST("action");
$value = GETPOST("value");
$typeconst=array('yesno','texte','chaine'); $typeconst=array('yesno','texte','chaine');
@ -123,13 +126,13 @@ if ($_GET["action"] == 'del')
{ {
$type='invoice'; $type='invoice';
$sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
$sql.= " WHERE nom = '".$_GET["value"]."'"; $sql.= " WHERE nom = '".$db->escape($value)."'";
$sql.= " AND type = '".$type."'"; $sql.= " AND type = '".$type."'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
if ($db->query($sql)) if ($db->query($sql))
{ {
if ($conf->global->FACTURE_ADDON_PDF == "$value") dolibarr_del_const($db, 'FACTURE_ADDON_PDF',$conf->entity);
} }
} }
@ -314,11 +317,11 @@ foreach ($conf->file->dol_document_root as $dirroot)
//print "> ".$conf->global->FACTURE_ADDON." - ".$file; //print "> ".$conf->global->FACTURE_ADDON." - ".$file;
if ($conf->global->FACTURE_ADDON == $file || $conf->global->FACTURE_ADDON.'.php' == $file) if ($conf->global->FACTURE_ADDON == $file || $conf->global->FACTURE_ADDON.'.php' == $file)
{ {
print img_picto($langs->trans("Activated"),'on'); print img_picto($langs->trans("Activated"),'switch_on');
} }
else else
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.preg_replace('/\.php$/','',$file).'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.preg_replace('/\.php$/','',$file).'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
} }
print '</td>'; print '</td>';
@ -473,22 +476,22 @@ foreach ($conf->file->dol_document_root as $dirroot)
if (in_array($name, $def)) if (in_array($name, $def))
{ {
print "<td align=\"center\">\n"; print "<td align=\"center\">\n";
if ($conf->global->FACTURE_ADDON_PDF != "$name") //if ($conf->global->FACTURE_ADDON_PDF != "$name")
{ //{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'">'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'">';
print img_picto($langs->trans("Enabled"),'on'); print img_picto($langs->trans("Enabled"),'switch_on');
print '</a>'; print '</a>';
} //}
else //else
{ //{
print img_picto($langs->trans("Enabled"),'on'); // print img_picto($langs->trans("Enabled"),'on');
} //}
print "</td>"; print "</td>";
} }
else else
{ {
print "<td align=\"center\">\n"; print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print "</td>"; print "</td>";
} }

View File

@ -154,13 +154,13 @@ if ($action == 'del')
{ {
$type='ficheinter'; $type='ficheinter';
$sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
$sql.= " WHERE nom = '".$value."'"; $sql.= " WHERE nom = '".$db->escape($value)."'";
$sql.= " AND type = '".$type."'"; $sql.= " AND type = '".$type."'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
if ($db->query($sql)) if ($db->query($sql))
{ {
if ($conf->global->FICHEINTER_ADDON_PDF == "$value") dolibarr_del_const($db, 'FICHEINTER_ADDON_PDF',$conf->entity);
} }
} }
@ -212,16 +212,9 @@ if ($action == 'setmod')
dolibarr_set_const($db, "FICHEINTER_ADDON",$value,'chaine',0,'',$conf->entity); dolibarr_set_const($db, "FICHEINTER_ADDON",$value,'chaine',0,'',$conf->entity);
} }
/*
// defini les constantes du modele arctic
if ($_POST["action"] == 'updateMatrice') dolibarr_set_const($db, "FICHEINTER_NUM_MATRICE",$_POST["matrice"],'chaine',0,'',$conf->entity);
if ($_POST["action"] == 'updatePrefix') dolibarr_set_const($db, "FICHEINTER_NUM_PREFIX",$_POST["prefix"],'chaine',0,'',$conf->entity);
if ($_POST["action"] == 'setOffset') dolibarr_set_const($db, "FICHEINTER_NUM_DELTA",$_POST["offset"],'chaine',0,'',$conf->entity);
if ($_POST["action"] == 'setNumRestart') dolibarr_set_const($db, "FICHEINTER_NUM_RESTART_BEGIN_YEAR",$_POST["numrestart"],'chaine',0,'',$conf->entity);
*/
/* /*
* Affichage page * View
*/ */
llxHeader(); llxHeader();
@ -242,7 +235,7 @@ print '<td width="100">'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Description").'</td>'; print '<td>'.$langs->trans("Description").'</td>';
print '<td>'.$langs->trans("Example").'</td>'; print '<td>'.$langs->trans("Example").'</td>';
print '<td align="center" width="60">'.$langs->trans("Status").'</td>'; print '<td align="center" width="60">'.$langs->trans("Status").'</td>';
print '<td align="center" width="16">'.$langs->trans("Infos").'</td>'; print '<td align="center" width="80">'.$langs->trans("Infos").'</td>';
print "</tr>\n"; print "</tr>\n";
clearstatcache(); clearstatcache();
@ -359,7 +352,7 @@ print '<td>'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Description").'</td>'; print '<td>'.$langs->trans("Description").'</td>';
print '<td align="center" width="60">'.$langs->trans("Status")."</td>\n"; print '<td align="center" width="60">'.$langs->trans("Status")."</td>\n";
print '<td align="center" width="60">'.$langs->trans("Default")."</td>\n"; print '<td align="center" width="60">'.$langs->trans("Default")."</td>\n";
print '<td align="center" width="32" colspan="2">'.$langs->trans("Infos").'</td>'; print '<td align="center" width="80">'.$langs->trans("Infos").'</td>';
print "</tr>\n"; print "</tr>\n";
clearstatcache(); clearstatcache();
@ -395,16 +388,16 @@ foreach ($conf->file->dol_document_root as $dirroot)
if (in_array($name, $def)) if (in_array($name, $def))
{ {
print "<td align=\"center\">\n"; print "<td align=\"center\">\n";
if ($conf->global->FICHEINTER_ADDON_PDF != "$name") //if ($conf->global->FICHEINTER_ADDON_PDF != "$name")
{ //{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">';
print img_picto($langs->trans("Enabled"),'switch_on'); print img_picto($langs->trans("Enabled"),'switch_on');
print '</a>'; print '</a>';
} //}
else //else
{ //{
print img_picto($langs->trans("Enabled"),'switch_on'); // print img_picto($langs->trans("Enabled"),'switch_on');
} //}
print "</td>"; print "</td>";
} }
else else
@ -418,11 +411,11 @@ foreach ($conf->file->dol_document_root as $dirroot)
print "<td align=\"center\">"; print "<td align=\"center\">";
if ($conf->global->FICHEINTER_ADDON_PDF == "$name") if ($conf->global->FICHEINTER_ADDON_PDF == "$name")
{ {
print img_picto($langs->trans("Default"),'switch_on'); print img_picto($langs->trans("Default"),'on');
} }
else else
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
} }
print '</td>'; print '</td>';
@ -437,10 +430,8 @@ foreach ($conf->file->dol_document_root as $dirroot)
$htmltooltip.='<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang,1,1); $htmltooltip.='<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang,1,1);
$htmltooltip.='<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark,1,1); $htmltooltip.='<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark,1,1);
print '<td align="center">'; print '<td align="center">';
print $html->textwithpicto('',$htmltooltip,1,0); $link='<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'intervention').'</a>';
print '</td>'; print $html->textwithpicto(' &nbsp; &nbsp; '.$link,$htmltooltip,-1,0);
print '<td align="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'intervention').'</a>';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';

View File

@ -110,7 +110,6 @@ if ($action == 'set')
$sql.= ")"; $sql.= ")";
if ($db->query($sql)) if ($db->query($sql))
{ {
} }
} }
@ -118,13 +117,13 @@ if ($action == 'del')
{ {
$type='delivery'; $type='delivery';
$sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
$sql.= " WHERE nom = '".$value."'"; $sql.= " WHERE nom = '".$db->escape($value)."'";
$sql.= " AND type = '".$type."'"; $sql.= " AND type = '".$type."'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
if ($db->query($sql)) if ($db->query($sql))
{ {
if ($conf->global->LIVRAISON_ADDON_PDF == "$value") dolibarr_del_const($db, 'LIVRAISON_ADDON_PDF',$conf->entity);
} }
} }
@ -402,16 +401,16 @@ foreach ($conf->file->dol_document_root as $dirroot)
if (in_array($name, $def)) if (in_array($name, $def))
{ {
print "<td align=\"center\">\n"; print "<td align=\"center\">\n";
if ($conf->global->LIVRAISON_ADDON_PDF != "$name") //if ($conf->global->LIVRAISON_ADDON_PDF != "$name")
{ //{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">';
print img_picto($langs->trans("Enabled"),'switch_on'); print img_picto($langs->trans("Enabled"),'switch_on');
print '</a>'; print '</a>';
} //}
else //else
{ //{
print img_picto($langs->trans("Enabled"),'switch_on'); // print img_picto($langs->trans("Enabled"),'switch_on');
} //}
print "</td>"; print "</td>";
} }
else else
@ -425,11 +424,11 @@ foreach ($conf->file->dol_document_root as $dirroot)
print "<td align=\"center\">"; print "<td align=\"center\">";
if ($conf->global->LIVRAISON_ADDON_PDF == "$name") if ($conf->global->LIVRAISON_ADDON_PDF == "$name")
{ {
print img_picto($langs->trans("Default"),'switch_on'); print img_picto($langs->trans("Default"),'on');
} }
else else
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
} }
print '</td>'; print '</td>';

View File

@ -1,5 +1,6 @@
<?php <?php
/* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr> /* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -18,7 +19,7 @@
/** /**
* \file htdocs/admin/project.php * \file htdocs/admin/project.php
* \ingroup project * \ingroup project
* \brief Page d'administration-configuration du module Projet * \brief Page to setup project module
*/ */
require("../main.inc.php"); require("../main.inc.php");
@ -33,6 +34,9 @@ $langs->load("projects");
if (!$user->admin) if (!$user->admin)
accessforbidden(); accessforbidden();
$value=GETPOST('value');
$action=GETPOST('action');
/* /*
* Actions * Actions
@ -98,12 +102,12 @@ if ($_GET["action"] == 'del')
{ {
$type='project'; $type='project';
$sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
$sql.= " WHERE nom = '".$_GET["value"]."'"; $sql.= " WHERE nom = '".$db->escape($value)."'";
$sql.= " AND type = '".$type."'"; $sql.= " AND type = '".$type."'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
if ($db->query($sql)) if ($db->query($sql))
{ {
if ($conf->global->PROJECT_ADDON_PDF == "$value") dolibarr_del_const($db, 'PROJECT_ADDON_PDF',$conf->entity);
} }
} }
@ -174,7 +178,7 @@ print '<td width="100">'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Description").'</td>'; print '<td>'.$langs->trans("Description").'</td>';
print '<td>'.$langs->trans("Example").'</td>'; print '<td>'.$langs->trans("Example").'</td>';
print '<td align="center" width="60">'.$langs->trans("Activated").'</td>'; print '<td align="center" width="60">'.$langs->trans("Activated").'</td>';
print '<td align="center" width="16">'.$langs->trans("Info").'</td>'; print '<td align="center" width="80">'.$langs->trans("Infos").'</td>';
print "</tr>\n"; print "</tr>\n";
clearstatcache(); clearstatcache();
@ -215,11 +219,11 @@ if (is_resource($handle))
print '<td align="center">'; print '<td align="center">';
if ($conf->global->PROJECT_ADDON == "$file") if ($conf->global->PROJECT_ADDON == "$file")
{ {
print img_picto($langs->trans("Activated"),'on'); print img_picto($langs->trans("Activated"),'switch_on');
} }
else else
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$file.'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$file.'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
} }
print '</td>'; print '</td>';
@ -297,7 +301,7 @@ print ' <td width="100">'.$langs->trans("Name")."</td>\n";
print " <td>".$langs->trans("Description")."</td>\n"; print " <td>".$langs->trans("Description")."</td>\n";
print '<td align="center" width="60">'.$langs->trans("Activated")."</td>\n"; print '<td align="center" width="60">'.$langs->trans("Activated")."</td>\n";
print '<td align="center" width="60">'.$langs->trans("Default")."</td>\n"; print '<td align="center" width="60">'.$langs->trans("Default")."</td>\n";
print '<td align="center" width="32" colspan="2">'.$langs->trans("Info").'</td>'; print '<td align="center" width="80">'.$langs->trans("Infos").'</td>';
print "</tr>\n"; print "</tr>\n";
clearstatcache(); clearstatcache();
@ -326,22 +330,22 @@ if (is_resource($handle))
if (in_array($name, $def)) if (in_array($name, $def))
{ {
print "<td align=\"center\">\n"; print "<td align=\"center\">\n";
if ($conf->global->PROJECT_ADDON_PDF != "$name") //if ($conf->global->PROJECT_ADDON_PDF != "$name")
{ //{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">';
print img_picto($langs->trans("Enabled"),'on'); print img_picto($langs->trans("Enabled"),'switch_on');
print '</a>'; print '</a>';
} //}
else //else
{ //{
print img_picto($langs->trans("Enabled"),'on'); // print img_picto($langs->trans("Enabled"),'on');
} //}
print "</td>"; print "</td>";
} }
else else
{ {
print "<td align=\"center\">\n"; print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print "</td>"; print "</td>";
} }
@ -364,10 +368,8 @@ if (is_resource($handle))
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>'; $htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,1,1); $htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,1,1);
print '<td align="center">'; print '<td align="center">';
print $html->textwithpicto('',$htmltooltip,1,0); $link='<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&amp;module='.$name.'">'.img_object($langs->trans("Preview"),'order').'</a>';
print '</td>'; print $html->textwithpicto(' &nbsp; &nbsp; '.$link,$htmltooltip,-1,0);
print '<td align="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&amp;module='.$name.'">'.img_object($langs->trans("Preview"),'order').'</a>';
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";

View File

@ -193,12 +193,12 @@ if ($action == 'del')
{ {
$type='propal'; $type='propal';
$sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
$sql.= " WHERE nom = '".$value."'"; $sql.= " WHERE nom = '".$db->escape($value)."'";
$sql.= " AND type = '".$type."'"; $sql.= " AND type = '".$type."'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
if ($db->query($sql)) if ($db->query($sql))
{ {
if ($conf->global->PROPALE_ADDON_PDF == "$value") dolibarr_del_const($db, 'PROPALE_ADDON_PDF',$conf->entity);
} }
} }
@ -209,7 +209,7 @@ if ($action == 'setdoc')
$db->begin(); $db->begin();
if (dolibarr_set_const($db, "PROPALE_ADDON_PDF",$value,'chaine',0,'',$conf->entity)) if (dolibarr_set_const($db, "PROPALE_ADDON_PDF",$value,'chaine',0,'',$conf->entity))
{ {
$conf->global->PROPALE_ADDON_PDF = $value; $conf->global->PROPALE_ADDON_PDF = $value;
} }
@ -438,16 +438,16 @@ foreach ($conf->file->dol_document_root as $dirroot)
print '<td align="center">'."\n"; print '<td align="center">'."\n";
if (in_array($name, $def)) if (in_array($name, $def))
{ {
if ($conf->global->PROPALE_ADDON_PDF != "$name") //if ($conf->global->PROPALE_ADDON_PDF != "$name")
{ //{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">';
print img_picto($langs->trans("Activated"),'switch_on'); print img_picto($langs->trans("Activated"),'switch_on');
print '</a>'; print '</a>';
} //}
else //else
{ //{
print img_picto($langs->trans("Activated"),'switch_on'); // print img_picto($langs->trans("Activated"),'switch_on');
} //}
} }
else else
{ {