Merge branch 'develop' of https://github.com/Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
571041e5d5
10
ChangeLog
10
ChangeLog
@ -5,6 +5,7 @@ English Dolibarr ChangeLog
|
||||
|
||||
***** ChangeLog for 3.3 compared to 3.2 *****
|
||||
For users:
|
||||
- New: Can filter list of proposal, order or invoice on sales representative.
|
||||
- New: Add supplier ref on supplier orders.
|
||||
- New: Can export supplier orders.
|
||||
- New: First feature to install external plugins from gui.
|
||||
@ -26,6 +27,7 @@ For users:
|
||||
not work with this.
|
||||
|
||||
For developers:
|
||||
- New: Add webservice for thirdparty creation and list.
|
||||
- New: A module can overwrite templates parts.
|
||||
- New: Can add a link on title field of added dictionnary.
|
||||
- New: Uniformize code.
|
||||
@ -39,7 +41,7 @@ to make a backup of your database before making upgrade.
|
||||
For users:
|
||||
- New: Each user can remove/add its own boxes.
|
||||
- New: Add signature at end of predefined email text.
|
||||
- New: Can use personalized fields of products/services.
|
||||
- New: Can use personalized fields on products/services.
|
||||
- New: Can attach files on social contributions.
|
||||
- New: Show payments terms and conditions onto muscadet template.
|
||||
- New: Can open back a closed commercial proposal.
|
||||
@ -57,7 +59,7 @@ For users:
|
||||
- New: task #10606 : more comprehensive message error.
|
||||
- New: task #11278 : Option into point of sale module to add services in list.
|
||||
- New: task #11261 : Add an entry into menu called "New shipment".
|
||||
- New: [ task #187 ] Gerer les evenement recurrents dans les imports ical
|
||||
- New: [ task #187 ] Gerer les evenement recurrents dans les imports ical.
|
||||
- New: Make option MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT available by default.
|
||||
- New: Can build PDF in USLetter format or canada format (change paper size).
|
||||
- New: Can export into Excel 2007 format.
|
||||
@ -72,7 +74,7 @@ For users:
|
||||
- New: Reduce seriously size of packages.
|
||||
- New: Can define country code for import.
|
||||
- New: When invoice was generated from order, order date is visible on PDF, after order ref.
|
||||
- New: [ task #181 ] Hide password of click2dial in user card
|
||||
- New: [ task #181 ] Hide password of click2dial in user card.
|
||||
- New: Chart are faster to build
|
||||
- New: Value of data into charts are visible on mouse hover.
|
||||
- New: Import wizard can import contacts.
|
||||
@ -97,6 +99,8 @@ For users:
|
||||
- Fix: Sanitize input parameters.
|
||||
- Fix: [ bug #368 ] Product list
|
||||
- Fix: [ bug #370 ] Filter in accountancy -> suppliers_bills
|
||||
- Fix: [ bug #399 ] Bad calculation of local taxes in update line products
|
||||
- Fix: [ bug #427 ] Bad links to wiki help in certains menus
|
||||
|
||||
For developers:
|
||||
- New: Can add a left menu into an existing top menu or left menu.
|
||||
|
||||
@ -24,7 +24,7 @@ $RPMSUBVERSION="auto"; # auto use value found into BUILD
|
||||
"RPM_OPENSUSE"=>"rpmbuild",
|
||||
"DEB"=>"dpkg",
|
||||
"APS"=>"zip",
|
||||
"EXEDOLIWAMP"=>"iscc.exe"
|
||||
"EXEDOLIWAMP"=>"ISCC.exe"
|
||||
);
|
||||
%ALTERNATEPATH=(
|
||||
"7z"=>"7-ZIP",
|
||||
|
||||
@ -94,8 +94,8 @@ DoliWamp is the auto-installer for Windows users with no technical knowledge to
|
||||
</Program_Descriptions>
|
||||
<Web_Info>
|
||||
<Application_URLs>
|
||||
<Application_Info_URL>http://www.nltechno.com/pages/dolibarrwinbin.php</Application_Info_URL>
|
||||
<Application_Order_URL>http://www.nltechno.com/pages/dolibarrwinbin.php</Application_Order_URL>
|
||||
<Application_Info_URL>http://www.nltechno.com/doliwamp/</Application_Info_URL>
|
||||
<Application_Order_URL>http://www.nltechno.com/doliwamp/</Application_Order_URL>
|
||||
<Application_Screenshot_URL>http://www.dolibarr.org/images/dolibarr_screenshot1.png</Application_Screenshot_URL>
|
||||
<Application_Icon_URL>http://www.dolibarr.org/images/dolibarr.gif</Application_Icon_URL>
|
||||
<Application_XML_File_URL>http://www.dolibarr.org/files/pad_doliwamp.xml</Application_XML_File_URL>
|
||||
|
||||
@ -30,7 +30,7 @@ return "Regis Houssin";
|
||||
# script_dolibarr_versions()
|
||||
sub script_dolibarr_versions
|
||||
{
|
||||
return ( "3.3.0", "3.2.0", "3.1.0", "3.0.1", "2.9.0" );
|
||||
return ( "3.3.0", "3.2.1", "3.1.1" );
|
||||
}
|
||||
|
||||
sub script_dolibarr_category
|
||||
@ -43,13 +43,6 @@ sub script_dolibarr_php_vers
|
||||
return ( 5 );
|
||||
}
|
||||
|
||||
sub script_dolibarr_php_vars
|
||||
{
|
||||
return ( [ 'memory_limit', '64M', '+' ],
|
||||
[ 'upload_max_filesize', '10M', '+' ],
|
||||
[ 'max_execution_time', '60', '+' ] );
|
||||
}
|
||||
|
||||
sub script_dolibarr_php_modules
|
||||
{
|
||||
local ($d, $ver, $phpver, $opts) = @_;
|
||||
@ -348,21 +341,32 @@ if ($opts->{'newdb'}) {
|
||||
return (1, "Dolibarr directory and tables deleted.");
|
||||
}
|
||||
|
||||
# script_dolibarr_latest(version)
|
||||
# Returns a URL and regular expression or callback func to get the version
|
||||
sub script_dolibarr_latest
|
||||
# script_dolibarr_realversion(&domain, &opts)
|
||||
# Returns the real version number of some script install, or undef if unknown
|
||||
sub script_dolibarr_realversion
|
||||
{
|
||||
local ($d, $opts, $sinfo) = @_;
|
||||
local $lref = &read_file_lines("$opts->{'dir'}/filefunc.inc.php", 1);
|
||||
foreach my $l (@$lref) {
|
||||
if ($l =~ /'DOL_VERSION','([0-9a-z\.\-]+)'/) {
|
||||
return $1;
|
||||
}
|
||||
}
|
||||
return undef;
|
||||
}
|
||||
|
||||
# script_dolibarr_check_latest(version)
|
||||
# Checks if some version is the latest for this project, and if not returns
|
||||
# a newer one. Otherwise returns undef.
|
||||
sub script_dolibarr_check_latest
|
||||
{
|
||||
local ($ver) = @_;
|
||||
if ($ver >= 3.0) {
|
||||
return ( "http://sourceforge.net/projects/dolibarr/files/".
|
||||
"Dolibarr%20ERP-CRM",
|
||||
"(3\\.[0-9\\.]+)" );
|
||||
}
|
||||
elsif ($ver >= 2.9) {
|
||||
return ( "http://www.dolibarr.fr/files/stable/",
|
||||
"dolibarr\\-(2\\.[0-9\\.]+)" );
|
||||
}
|
||||
return ( );
|
||||
local @vers = &osdn_package_versions("dolibarr",
|
||||
$ver >= 3 ? "dolibarr\\-(3\\.[0-9\\.]+)\\.tgz" :
|
||||
$ver >= 2.9 ? "dolibarr\\-(2\\.9\\.[0-9\\.]+)\\.tgz" :
|
||||
"dolibarr\\-(2\\.8\\.[0-9\\.]+)\\.tgz");
|
||||
return "Failed to find versions" if (!@vers);
|
||||
return $ver eq $vers[0] ? undef : $vers[0];
|
||||
}
|
||||
|
||||
sub script_dolibarr_site
|
||||
|
||||
@ -58,7 +58,7 @@ if (! isset($argv[1]))
|
||||
|
||||
if ($db->type != 'mysql' && $db->type != 'mysqli')
|
||||
{
|
||||
print "Error: This script works with mysql driver only\n";
|
||||
print "Error: This script works with mysql or mysqli driver only\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -67,15 +67,10 @@ print 'Tablename='.$argv[1]."\n";
|
||||
print "Current dir is ".getcwd()."\n";
|
||||
|
||||
|
||||
|
||||
//--------------------------------
|
||||
// Build skeleton_class.class.php
|
||||
//--------------------------------
|
||||
|
||||
$table=$argv[1];
|
||||
// Define array with list of properties
|
||||
$property=array();
|
||||
$table=$argv[1];
|
||||
$foundprimary=0;
|
||||
|
||||
$resql=$db->DDLDescTable($table);
|
||||
if ($resql)
|
||||
{
|
||||
@ -121,9 +116,32 @@ if ($resql)
|
||||
else
|
||||
{
|
||||
print "Error: Failed to get description for table '".$table."'.\n";
|
||||
return false;
|
||||
}
|
||||
//var_dump($property);
|
||||
|
||||
// Define substitute select parameters
|
||||
$varpropselect="\n";
|
||||
$cleanparam='';
|
||||
$i=0;
|
||||
foreach($property as $key => $prop)
|
||||
{
|
||||
$i++;
|
||||
if ($prop['field'] != 'rowid')
|
||||
{
|
||||
$varpropselect.="\t\t\$sql.= \" ";
|
||||
$varpropselect.="t.".$prop['field'];
|
||||
if ($i < count($property)) $varpropselect.=",";
|
||||
$varpropselect.="\";";
|
||||
$varpropselect.="\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//--------------------------------
|
||||
// Build skeleton_class.class.php
|
||||
//--------------------------------
|
||||
|
||||
// Define working variables
|
||||
$table=strtolower($table);
|
||||
@ -296,22 +314,7 @@ $targetcontent=preg_replace('/\$sql.= " field1=".\(isset\(\$this->field1\)\?"\'"
|
||||
$targetcontent=preg_replace('/\$sql.= " field2=".\(isset\(\$this->field2\)\?"\'".\$this->db->escape\(\$this->field2\)."\'":"null"\)."";/', '', $targetcontent);
|
||||
|
||||
// Substitute select parameters
|
||||
$varprop="\n";
|
||||
$cleanparam='';
|
||||
$i=0;
|
||||
foreach($property as $key => $prop)
|
||||
{
|
||||
$i++;
|
||||
if ($prop['field'] != 'rowid')
|
||||
{
|
||||
$varprop.="\t\t\$sql.= \" ";
|
||||
$varprop.="t.".$prop['field'];
|
||||
if ($i < count($property)) $varprop.=",";
|
||||
$varprop.="\";";
|
||||
$varprop.="\n";
|
||||
}
|
||||
}
|
||||
$targetcontent=preg_replace('/\$sql\.= " t\.field1,";/', $varprop, $targetcontent);
|
||||
$targetcontent=preg_replace('/\$sql\.= " t\.field1,";/', $varpropselect, $targetcontent);
|
||||
$targetcontent=preg_replace('/\$sql\.= " t\.field2";/', '', $targetcontent);
|
||||
|
||||
// Substitute select set parameters
|
||||
@ -405,6 +408,54 @@ if ($fp)
|
||||
}
|
||||
else $error++;
|
||||
|
||||
|
||||
|
||||
//--------------------------------
|
||||
// Build skeleton_page.php
|
||||
//--------------------------------
|
||||
|
||||
// Read skeleton_page.php file
|
||||
$skeletonfile=$path.'skeleton_page.php';
|
||||
$sourcecontent=file_get_contents($skeletonfile);
|
||||
if (! $sourcecontent)
|
||||
{
|
||||
print "\n";
|
||||
print "Error: Failed to read skeleton sample '".$skeletonfile."'\n";
|
||||
print "Try to run script from skeletons directory.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
// Define output variables
|
||||
$outfile='out.'.$classmin.'_page.php';
|
||||
$targetcontent=$sourcecontent;
|
||||
|
||||
// Substitute class name
|
||||
$targetcontent=preg_replace('/skeleton_class\.class\.php/', $classmin.'.class.php', $targetcontent);
|
||||
$targetcontent=preg_replace('/skeleton_script\.php/', $classmin.'_script.php', $targetcontent);
|
||||
$targetcontent=preg_replace('/\$element=\'skeleton\'/', '\$element=\''.$classmin.'\'', $targetcontent);
|
||||
$targetcontent=preg_replace('/\$table_element=\'skeleton\'/', '\$table_element=\''.$classmin.'\'', $targetcontent);
|
||||
$targetcontent=preg_replace('/Skeleton_Class/', $classname, $targetcontent);
|
||||
$targetcontent=preg_replace('/skeleton/', $classname, $targetcontent);
|
||||
|
||||
// Substitute comments
|
||||
$targetcontent=preg_replace('/This file is an example to create a new class file/', 'Put here description of this class', $targetcontent);
|
||||
$targetcontent=preg_replace('/\s*\/\/\.\.\./', '', $targetcontent);
|
||||
$targetcontent=preg_replace('/Put here some comments/','Initialy built by build_class_from_table on '.strftime('%Y-%m-%d %H:%M',mktime()), $targetcontent);
|
||||
|
||||
// Substitute table name
|
||||
$targetcontent=preg_replace('/MAIN_DB_PREFIX."mytable/', 'MAIN_DB_PREFIX."'.$tablenoprefix, $targetcontent);
|
||||
|
||||
// Build file
|
||||
$fp=fopen($outfile,"w");
|
||||
if ($fp)
|
||||
{
|
||||
fputs($fp, $targetcontent);
|
||||
fclose($fp);
|
||||
print "File '".$outfile."' has been built in current directory.\n";
|
||||
}
|
||||
else $error++;
|
||||
|
||||
|
||||
// -------------------- END OF BUILD_CLASS_FROM_TABLE SCRIPT --------------------
|
||||
|
||||
print "You can now rename generated files by removing the 'out.' prefix in their name and store them in a directory of your choice.\n";
|
||||
|
||||
@ -43,8 +43,8 @@ if (! $res && file_exists("../../../dolibarr/htdocs/main.inc.php")) $res=@includ
|
||||
if (! $res && file_exists("../../../../dolibarr/htdocs/main.inc.php")) $res=@include("../../../../dolibarr/htdocs/main.inc.php"); // Used on dev env only
|
||||
if (! $res && file_exists("../../../../../dolibarr/htdocs/main.inc.php")) $res=@include("../../../../../dolibarr/htdocs/main.inc.php"); // Used on dev env only
|
||||
if (! $res) die("Include of main fails");
|
||||
// Change this following line to use the correct relative path from htdocs (do not remove DOL_DOCUMENT_ROOT)
|
||||
require_once(DOL_DOCUMENT_ROOT."/skeleton/skeleton_class.class.php");
|
||||
// Change this following line to use the correct relative path from htdocs
|
||||
dol_include_once("/module/class/skeleton_class.class.php");
|
||||
|
||||
// Load traductions files requiredby by page
|
||||
$langs->load("companies");
|
||||
@ -118,11 +118,57 @@ jQuery(document).ready(function() {
|
||||
</script>';
|
||||
|
||||
|
||||
|
||||
// Example 2 : Adding jquery code
|
||||
// Example 2 : Adding links to objects
|
||||
$somethingshown=$myobject->showLinkedObjectBlock();
|
||||
|
||||
|
||||
// Example 3 : List of data
|
||||
if ($action == 'list')
|
||||
{
|
||||
$sql = "SELECT";
|
||||
$sql.= " t.field1,";
|
||||
$sql.= " t.field2";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."skeleton as t";
|
||||
$sql.= " WHERE field3 = 'xxx'";
|
||||
$sql.= " ORDER BY field1 ASC";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans('field1'),$_SERVER['PHP_SELF'],'t.field1','',$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('field2'),$_SERVER['PHP_SELF'],'t.field2','',$param,'',$sortfield,$sortorder);
|
||||
print '</tr>';
|
||||
|
||||
dol_syslog($script_file." sql=".$sql, LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
if ($num)
|
||||
{
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj)
|
||||
{
|
||||
// You can use here results
|
||||
print '<tr><td>';
|
||||
print $obj->field1;
|
||||
print $obj->field2;
|
||||
print '</td></tr>';
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
|
||||
@ -112,7 +112,7 @@ else print "Object with id ".$myobject->id." deleted\n";
|
||||
// An example of a direct SQL read without using the fetch method
|
||||
/*
|
||||
$sql = "SELECT field1, field2";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_pays";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."skeleton";
|
||||
$sql.= " WHERE field3 = 'xxx'";
|
||||
$sql.= " ORDER BY field1 ASC";
|
||||
|
||||
|
||||
@ -40,7 +40,7 @@ $mesg=isset($_GET["mesg"])?'<div class="ok">'.$_GET["mesg"].'</div>':'';
|
||||
$id = GETPOST('id','int');
|
||||
|
||||
// Security check
|
||||
if (! $user->rights->adherent->lire) accessforbidden();
|
||||
$result=restrictedArea($user,'adherent',$id);
|
||||
|
||||
$object = new Adherent($db);
|
||||
$result=$object->fetch($id);
|
||||
|
||||
@ -39,8 +39,8 @@ $langs->load("users");
|
||||
$langs->load("mails");
|
||||
|
||||
|
||||
$action=GETPOST('action','alpha');
|
||||
$rowid=GETPOST('rowid','int');
|
||||
$action=GETPOST('action','alpha');
|
||||
$rowid=GETPOST('rowid','int');
|
||||
$typeid=GETPOST('typeid','int');
|
||||
|
||||
// Security check
|
||||
|
||||
@ -184,7 +184,7 @@ class Adherent extends CommonObject
|
||||
*/
|
||||
function makeSubstitution($text)
|
||||
{
|
||||
global $langs;
|
||||
global $conf,$langs;
|
||||
|
||||
$birthday = dol_print_date($this->naiss,'day');
|
||||
|
||||
@ -202,8 +202,11 @@ class Adherent extends CommonObject
|
||||
$infos.= $langs->transnoentities("Town").": ".$this->town."\n";
|
||||
$infos.= $langs->transnoentities("Country").": ".$this->country."\n";
|
||||
$infos.= $langs->transnoentities("EMail").": ".$this->email."\n";
|
||||
$infos.= $langs->transnoentities("Login").": ".$this->login."\n";
|
||||
$infos.= $langs->transnoentities("Password").": ".$this->pass."\n";
|
||||
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
|
||||
{
|
||||
$infos.= $langs->transnoentities("Login").": ".$this->login."\n";
|
||||
$infos.= $langs->transnoentities("Password").": ".$this->pass."\n";
|
||||
}
|
||||
$infos.= $langs->transnoentities("Birthday").": ".$birthday."\n";
|
||||
$infos.= $langs->transnoentities("Photo").": ".$this->photo."\n";
|
||||
$infos.= $langs->transnoentities("Public").": ".yn($this->public);
|
||||
@ -1005,7 +1008,7 @@ class Adherent extends CommonObject
|
||||
if ($rowid) $sql.= " AND d.rowid=".$rowid;
|
||||
elseif ($ref || $fk_soc) {
|
||||
$sql.= " AND d.entity IN (".getEntity().")";
|
||||
if ($ref) $sql.= " AND d.rowid='".$ref."'";
|
||||
if ($ref) $sql.= " AND d.rowid='".$ref."'";
|
||||
elseif ($fk_soc) $sql.= " AND d.fk_soc='".$fk_soc."'";
|
||||
}
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@ require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent_type.class.php");
|
||||
$langs->load("members");
|
||||
$langs->load("companies");
|
||||
$langs->load('other');
|
||||
|
||||
|
||||
$id=GETPOST('id','int');
|
||||
$action=GETPOST('action','alpha');
|
||||
$confirm=GETPOST('confirm','alpha');
|
||||
|
||||
@ -42,12 +42,12 @@ $langs->load("members");
|
||||
$langs->load("users");
|
||||
|
||||
|
||||
$action=GETPOST('action','alpha');
|
||||
$action=GETPOST('action','alpha');
|
||||
$backtopage=GETPOST('backtopage','alpha');
|
||||
$confirm=GETPOST('confirm','alpha');
|
||||
$rowid=GETPOST('rowid','int');
|
||||
$typeid=GETPOST('typeid','int');
|
||||
$userid=GETPOST('userid','int');
|
||||
$confirm=GETPOST('confirm','alpha');
|
||||
$rowid=GETPOST('rowid','int');
|
||||
$typeid=GETPOST('typeid','int');
|
||||
$userid=GETPOST('userid','int');
|
||||
$socid=GETPOST('socid','int');
|
||||
|
||||
// Security check
|
||||
@ -201,8 +201,13 @@ if ($action == 'confirm_sendinfo' && $confirm == 'yes')
|
||||
{
|
||||
if ($object->email)
|
||||
{
|
||||
$result=$object->send_an_email($langs->transnoentitiesnoconv("ThisIsContentOfYourCard")."\n\n%INFOS%\n\n",$langs->transnoentitiesnoconv("CardContent"));
|
||||
$mesg=$langs->trans("CardSent");
|
||||
$from=$conf->email_from;
|
||||
if ($conf->global->ADHERENT_MAIL_FROM) $from=$conf->global->ADHERENT_MAIL_FROM;
|
||||
|
||||
$result=$object->send_an_email($langs->transnoentitiesnoconv("ThisIsContentOfYourCard")."\n\n%INFOS%\n\n",$langs->transnoentitiesnoconv("CardContent"));
|
||||
|
||||
$langs->load("mails");
|
||||
$mesg=$langs->trans("MailSuccessfulySent", $from, $object->email);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1089,7 +1094,9 @@ if ($action == 'edit')
|
||||
|
||||
if ($rowid && $action != 'edit')
|
||||
{
|
||||
/* ************************************************************************** */
|
||||
dol_htmloutput_mesg($mesg);
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Mode affichage */
|
||||
/* */
|
||||
|
||||
@ -27,14 +27,14 @@ require_once(DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php');
|
||||
require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent_type.class.php");
|
||||
|
||||
$langs->load("companies");
|
||||
$langs->load("members");
|
||||
$langs->load("companies");
|
||||
$langs->load("members");
|
||||
$langs->load("bills");
|
||||
|
||||
$action=GETPOST('action','alpha');
|
||||
$id=GETPOST('id','int');
|
||||
|
||||
// Security check
|
||||
// Security check
|
||||
$result=restrictedArea($user,'adherent',$id);
|
||||
|
||||
$object = new Adherent($db);
|
||||
|
||||
@ -49,7 +49,7 @@ $pagenext = $page + 1;
|
||||
if (! $sortorder) { $sortorder="DESC"; }
|
||||
if (! $sortfield) { $sortfield="d.nom"; }
|
||||
|
||||
// Security check
|
||||
// Security check
|
||||
$result=restrictedArea($user,'adherent',$rowid,'adherent_type');
|
||||
|
||||
if (GETPOST('button_removefilter'))
|
||||
|
||||
@ -913,8 +913,8 @@ if ($id)
|
||||
else if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='pays_id') {
|
||||
$showfield=0;
|
||||
}
|
||||
else if ($fieldlist[$field]=='unicode') {
|
||||
$valuetoshow = getCurrencySymbol($obj->code);
|
||||
else if ($fieldlist[$field]=='unicode') {
|
||||
$valuetoshow = getCurrencySymbol($obj->code);
|
||||
}
|
||||
if ($showfield) print '<td>'.$valuetoshow.'</td>';
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@ if ($action == 'specimen')
|
||||
if ($action == 'setdoc')
|
||||
{
|
||||
$value = GETPOST('value','alpha');
|
||||
$label = GETPOST('label','alpha');
|
||||
$label = GETPOST('label','alpha');
|
||||
$scandir = GETPOST('scandir','alpha');
|
||||
|
||||
$db->begin();
|
||||
@ -111,8 +111,8 @@ if ($action == 'setdoc')
|
||||
|
||||
if ($action == 'set')
|
||||
{
|
||||
$value = GETPOST('value','alpha');
|
||||
$label = GETPOST('label','alpha');
|
||||
$value = GETPOST('value','alpha');
|
||||
$label = GETPOST('label','alpha');
|
||||
$scandir = GETPOST('scandir','alpha');
|
||||
|
||||
$type='donation';
|
||||
|
||||
@ -38,9 +38,9 @@ $langs->load("interventions");
|
||||
|
||||
if (! $user->admin) accessforbidden();
|
||||
|
||||
$action = GETPOST('action','alpha');
|
||||
$value = GETPOST('value','alpha');
|
||||
$label = GETPOST('label','alpha');
|
||||
$action = GETPOST('action','alpha');
|
||||
$value = GETPOST('value','alpha');
|
||||
$label = GETPOST('label','alpha');
|
||||
$scandir = GETPOST('scandir','alpha');
|
||||
$type='ficheinter';
|
||||
|
||||
@ -334,8 +334,8 @@ print "</tr>\n";
|
||||
clearstatcache();
|
||||
|
||||
$var=true;
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/fichinter/doc/");
|
||||
|
||||
if (is_dir($dir))
|
||||
|
||||
@ -163,7 +163,7 @@ if ($action == 'specimenfacture') // For invoices
|
||||
|
||||
if ($action == 'set')
|
||||
{
|
||||
$label = GETPOST('label','alpha');
|
||||
$label = GETPOST('label','alpha');
|
||||
$scandir = GETPOST('scandir','alpha');
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
|
||||
@ -195,7 +195,7 @@ if ($action == 'del')
|
||||
|
||||
if ($action == 'setdoc')
|
||||
{
|
||||
$label = GETPOST('label','alpha');
|
||||
$label = GETPOST('label','alpha');
|
||||
$scandir = GETPOST('scandir','alpha');
|
||||
|
||||
$db->begin();
|
||||
|
||||
@ -209,12 +209,12 @@ if ($action == 'edit') // Edit
|
||||
print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Hide unauthorized button
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("ButtonHideUnauthorized").'</td><td>';
|
||||
print $form->selectyesno('MAIN_BUTTON_HIDE_UNAUTHORIZED',isset($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED)?$conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED:0,1);
|
||||
print '</td>';
|
||||
print '<td width="20"> </td>';
|
||||
// Hide unauthorized button
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("ButtonHideUnauthorized").'</td><td>';
|
||||
print $form->selectyesno('MAIN_BUTTON_HIDE_UNAUTHORIZED',isset($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED)?$conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED:0,1);
|
||||
print '</td>';
|
||||
print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Hide helpcenter link on login page
|
||||
@ -367,10 +367,10 @@ else // Show
|
||||
print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Hide unauthorized button
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("ButtonHideUnauthorized").'</td><td colspan="2">';
|
||||
print yn($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED,1);
|
||||
// Hide unauthorized button
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("ButtonHideUnauthorized").'</td><td colspan="2">';
|
||||
print yn($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED,1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Link to help center
|
||||
|
||||
@ -34,8 +34,8 @@ if (! $user->admin) accessforbidden();
|
||||
|
||||
$dirstandard = array();
|
||||
$dirsmartphone = array();
|
||||
$dirmenus=array_merge(array("/core/menus/"),(array) $conf->modules_parts['menus']);
|
||||
foreach($dirmenus as $dirmenu)
|
||||
$dirmenus=array_merge(array("/core/menus/"),(array) $conf->modules_parts['menus']);
|
||||
foreach($dirmenus as $dirmenu)
|
||||
{
|
||||
$dirstandard[]=$dirmenu.'standard';
|
||||
$dirsmartphone[]=$dirmenu.'smartphone';
|
||||
|
||||
@ -255,7 +255,7 @@ if ($mode != 4)
|
||||
{
|
||||
print "<table summary=\"list_of_modules\" class=\"noborder\" width=\"100%\">\n";
|
||||
//print "<tr class=\"liste_titre\">\n";
|
||||
print '<tr class="liste_total">'."\n";
|
||||
print '<tr class="liste_titre">'."\n";
|
||||
//print " <td>".$langs->trans("Family")."</td>\n";
|
||||
print " <td colspan=\"2\">".$langs->trans("Module")."</td>\n";
|
||||
print " <td>".$langs->trans("Description")."</td>\n";
|
||||
|
||||
@ -212,9 +212,9 @@ if ($action == 'edit') // Edit
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 1)
|
||||
{
|
||||
//Desc
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("HideDescOnPDF").'</td><td>';
|
||||
print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_DESC',(! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC))?$conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC:0,1);
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("HideDescOnPDF").'</td><td>';
|
||||
print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_DESC',(! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC))?$conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC:0,1);
|
||||
print '</td></tr>';
|
||||
|
||||
//Ref
|
||||
@ -223,10 +223,10 @@ if ($action == 'edit') // Edit
|
||||
print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_REF',(! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF))?$conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF:0,1);
|
||||
print '</td></tr>';
|
||||
|
||||
//Details
|
||||
$var=!$var;
|
||||
//Details
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("HideDetailsOnPDF").'</td><td>';
|
||||
print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS',(! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS))?$conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS:0,1);
|
||||
print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS',(! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS))?$conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS:0,1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -371,25 +371,25 @@ else // Show
|
||||
print yn($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT,1);
|
||||
print '</td></tr>';
|
||||
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 1)
|
||||
{
|
||||
//Desc
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("HideDescOnPDF").'</td><td>';
|
||||
print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC,1);
|
||||
print '</td></tr>';
|
||||
|
||||
//Ref
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("HideRefOnPDF").'</td><td>';
|
||||
print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF,1);
|
||||
print '</td></tr>';
|
||||
|
||||
//Details
|
||||
$var=!$var;
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 1)
|
||||
{
|
||||
//Desc
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("HideDescOnPDF").'</td><td>';
|
||||
print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC,1);
|
||||
print '</td></tr>';
|
||||
|
||||
//Ref
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("HideRefOnPDF").'</td><td>';
|
||||
print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF,1);
|
||||
print '</td></tr>';
|
||||
|
||||
//Details
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("HideDetailsOnPDF").'</td><td>';
|
||||
print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS,1);
|
||||
print '</td></tr>';
|
||||
print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS,1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -39,7 +39,7 @@ if (! $user->admin) accessforbidden();
|
||||
|
||||
$action = GETPOST('action','alpha');
|
||||
$value = GETPOST('value','alpha');
|
||||
$label = GETPOST('label','alpha');
|
||||
$label = GETPOST('label','alpha');
|
||||
$scandir = GETPOST('scandir','alpha');
|
||||
$type='propal';
|
||||
|
||||
@ -207,7 +207,7 @@ else if ($action == 'setdoc')
|
||||
|
||||
// On active le modele
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0)
|
||||
if ($ret > 0)
|
||||
{
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
}
|
||||
|
||||
@ -165,7 +165,7 @@ $daylight=(is_numeric($c) && is_numeric($b))?round($c-$b):'unknown';
|
||||
$val=($a>=0?'+':'').$a;
|
||||
$val.=' ('.($a==='unknown'?'unknown':($a>=0?'+':'').($a*3600)).')';
|
||||
$val.=' '.getServerTimeZoneString();
|
||||
$val.=' '.$langs->trans("DaylingSavingTime").': '.($daylight==='unknown'?'unknown':yn($daylight));
|
||||
$val.=' '.$langs->trans("DaylingSavingTime").': '.($daylight==='unknown'?'unknown':yn($daylight));
|
||||
print $form->textwithtooltip($val,$txt,2,1,img_info(''));
|
||||
print '</td></tr>'."\n"; // value defined in http://fr3.php.net/manual/en/timezones.europe.php
|
||||
$var=!$var;
|
||||
|
||||
@ -79,7 +79,7 @@ if (GETPOST('action','alpha')=='install')
|
||||
$result=dol_uncompress($newfile,$documentrootalt);
|
||||
if (! empty($result['error']))
|
||||
{
|
||||
$langs->load("errors");
|
||||
$langs->load("errors");
|
||||
$mesg = '<div class="error">'.$langs->trans($result['error'],$original_file).'</div>';
|
||||
|
||||
}
|
||||
@ -95,8 +95,8 @@ if (GETPOST('action','alpha')=='install')
|
||||
* View
|
||||
*/
|
||||
|
||||
$dirins=DOL_DOCUMENT_ROOT_ALT;
|
||||
$dirins_ok=(is_dir($dirins));
|
||||
$dirins=DOL_DOCUMENT_ROOT_ALT;
|
||||
$dirins_ok=(is_dir($dirins));
|
||||
|
||||
$wikihelp='EN:Installation_-_Upgrade|FR:Installation_-_Mise_à_jour|ES:Instalación_-_Actualización';
|
||||
llxHeader('',$langs->trans("Upgrade"),$wikihelp);
|
||||
@ -150,14 +150,14 @@ if (! empty($conf->global->MAIN_ONLINE_INSTALL_MODULE))
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$message=info_admin($langs->trans("NotExistsDirect").$langs->trans("InfDirAlt").$langs->trans("InfDirExample"));
|
||||
print $message;
|
||||
{
|
||||
$message=info_admin($langs->trans("NotExistsDirect").$langs->trans("InfDirAlt").$langs->trans("InfDirExample"));
|
||||
print $message;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<b>'.$langs->trans("StepNb",4).'</b>: ';
|
||||
print '<b>'.$langs->trans("StepNb",4).'</b>: ';
|
||||
print $langs->trans("SetupIsReadyForUse").'<br>';
|
||||
}
|
||||
print '</form>';
|
||||
|
||||
@ -88,14 +88,14 @@ $workflow=array(
|
||||
)
|
||||
);
|
||||
|
||||
if (! empty($conf->modules_parts['workflow'])) $workflow = array_merge($workflow, $conf->modules_parts['workflow']);
|
||||
if (! empty($conf->modules_parts['workflow']) && is_array($conf->modules_parts['workflow'])) $workflow = array_merge($workflow, $conf->modules_parts['workflow']);
|
||||
|
||||
foreach($workflow as $child => $parents)
|
||||
{
|
||||
if ($conf->$child->enabled)
|
||||
{
|
||||
$langs->Load($child.'@'.$child);
|
||||
|
||||
|
||||
foreach($parents as $parent => $actions)
|
||||
{
|
||||
if ($conf->$parent->enabled)
|
||||
|
||||
@ -51,11 +51,11 @@ if ($id == "")
|
||||
$result = restrictedArea($user, 'categorie', $id, '&category');
|
||||
|
||||
$object = new Categorie($db);
|
||||
if ($id > 0)
|
||||
{
|
||||
$result = $object->fetch($id);
|
||||
|
||||
$upload_dir = $conf->categorie->multidir_output[$object->entity];
|
||||
if ($id > 0)
|
||||
{
|
||||
$result = $object->fetch($id);
|
||||
|
||||
$upload_dir = $conf->categorie->multidir_output[$object->entity];
|
||||
}
|
||||
|
||||
|
||||
@ -89,207 +89,207 @@ $form = new Form($db);
|
||||
|
||||
if ($object->id)
|
||||
{
|
||||
$title=$langs->trans("ProductsCategoryShort");
|
||||
if ($type == 0) $title=$langs->trans("ProductsCategoryShort");
|
||||
elseif ($type == 1) $title=$langs->trans("SuppliersCategoryShort");
|
||||
elseif ($type == 2) $title=$langs->trans("CustomersCategoryShort");
|
||||
elseif ($type == 3) $title=$langs->trans("MembersCategoryShort");
|
||||
|
||||
$head = categories_prepare_head($object,$type);
|
||||
dol_fiche_head($head, 'photos', $title, 0, 'category');
|
||||
|
||||
/*
|
||||
* Confirmation de la suppression de photo
|
||||
*/
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&type='.$type.'&file='.$_GET["file"], $langs->trans('DeletePicture'), $langs->trans('ConfirmDeletePicture'), 'confirm_delete', '', 0, 1);
|
||||
if ($ret == 'html') print '<br>';
|
||||
}
|
||||
|
||||
print($mesg);
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Path of category
|
||||
print '<tr><td width="20%" class="notopnoleft">';
|
||||
$ways = $object->print_all_ways();
|
||||
print $langs->trans("Ref").'</td><td>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("Root").'</a> >> ';
|
||||
foreach ($ways as $way)
|
||||
{
|
||||
print $way."<br>\n";
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Description
|
||||
print '<tr><td width="20%" class="notopnoleft">';
|
||||
print $langs->trans("Description").'</td><td>';
|
||||
print nl2br($object->description);
|
||||
print '</td></tr>';
|
||||
|
||||
// Visibility
|
||||
/* if ($type == 0 && $conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER)
|
||||
{
|
||||
if ($object->socid)
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($object->socid);
|
||||
|
||||
print '<tr><td width="20%" class="notopnoleft">';
|
||||
print $langs->trans("AssignedToTheCustomer").'</td><td>';
|
||||
print $soc->getNomUrl(1);
|
||||
print '</td></tr>';
|
||||
|
||||
$catsMeres = $object->get_meres ();
|
||||
|
||||
if ($catsMeres < 0)
|
||||
{
|
||||
dol_print_error();
|
||||
}
|
||||
else if (count($catsMeres) > 0)
|
||||
{
|
||||
print '<tr><td width="20%" class="notopnoleft">';
|
||||
print $langs->trans("CategoryContents").'</td><td>';
|
||||
print ($object->visible ? $langs->trans("Visible") : $langs->trans("Invisible"));
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td width="20%" class="notopnoleft">';
|
||||
print $langs->trans("CategoryContents").'</td><td>';
|
||||
print ($object->visible ? $langs->trans("Visible") : $langs->trans("Invisible"));
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td width="20%" class="notopnoleft">';
|
||||
print $langs->trans("CategoryContents").'</td><td>';
|
||||
print ($object->visible ? $langs->trans("Visible") : $langs->trans("Invisible"));
|
||||
print '</td></tr>';
|
||||
}
|
||||
*/
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
print "</div>\n";
|
||||
|
||||
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Barre d'action */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
print "\n<div class=\"tabsAction\">\n";
|
||||
|
||||
if ($action != 'ajout_photo' && $user->rights->categorie->creer)
|
||||
{
|
||||
if (! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=ajout_photo&id='.$object->id.'&type='.$type.'">';
|
||||
print $langs->trans("AddPhoto").'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused" href="#">';
|
||||
print $langs->trans("AddPhoto").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
print "\n</div>\n";
|
||||
|
||||
/*
|
||||
* Ajouter une photo
|
||||
*/
|
||||
if ($action == 'ajout_photo' && $user->rights->categorie->creer && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
{
|
||||
// Affiche formulaire upload
|
||||
$formfile=new FormFile($db);
|
||||
$formfile->form_attach_new_file($_SERVER['PHP_SELF'].'?id='.$object->id.'&type='.$type,$langs->trans("AddPhoto"),1);
|
||||
}
|
||||
|
||||
// Affiche photos
|
||||
if ($action != 'ajout_photo')
|
||||
{
|
||||
$nbphoto=0;
|
||||
$nbbyrow=5;
|
||||
|
||||
$maxWidth = 160;
|
||||
$maxHeight = 120;
|
||||
|
||||
$pdir = get_exdir($object->id,2) . $object->id ."/photos/";
|
||||
$dir = $upload_dir.'/'.$pdir;
|
||||
|
||||
print '<br>';
|
||||
print '<table width="100%" valign="top" align="center" border="0" cellpadding="2" cellspacing="2">';
|
||||
|
||||
foreach ($object->liste_photos($dir) as $key => $obj)
|
||||
{
|
||||
$nbphoto++;
|
||||
|
||||
|
||||
if ($nbbyrow && ($nbphoto % $nbbyrow == 1)) print '<tr align=center valign=middle border=1>';
|
||||
if ($nbbyrow) print '<td width="'.ceil(100/$nbbyrow).'%" class="photo">';
|
||||
|
||||
print '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart=category&entity='.$object->entity.'&file='.urlencode($pdir.$obj['photo']).'" alt="Taille origine" target="_blank">';
|
||||
|
||||
// Si fichier vignette disponible, on l'utilise, sinon on utilise photo origine
|
||||
if ($obj['photo_vignette'])
|
||||
{
|
||||
$filename='thumbs/'.$obj['photo_vignette'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$filename=$obj['photo'];
|
||||
}
|
||||
|
||||
// Nom affiche
|
||||
$viewfilename=$obj['photo'];
|
||||
|
||||
// Taille de l'image
|
||||
$object->get_image_size($dir.$filename);
|
||||
$imgWidth = ($object->imgWidth < $maxWidth) ? $object->imgWidth : $maxWidth;
|
||||
$imgHeight = ($object->imgHeight < $maxHeight) ? $object->imgHeight : $maxHeight;
|
||||
|
||||
print '<img border="0" width="'.$imgWidth.'" height="'.$imgHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=category&entity='.$object->entity.'&file='.urlencode($pdir.$filename).'">';
|
||||
|
||||
print '</a>';
|
||||
print '<br>'.$viewfilename;
|
||||
print '<br>';
|
||||
|
||||
// On propose la generation de la vignette si elle n'existe pas et si la taille est superieure aux limites
|
||||
if (!$obj['photo_vignette'] && preg_match('/(\.bmp|\.gif|\.jpg|\.jpeg|\.png)$/i',$obj['photo']) && ($object->imgWidth > $maxWidth || $object->imgHeight > $maxHeight))
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->entity.'&action=addthumb&type='.$type.'&file='.urlencode($pdir.$viewfilename).'">'.img_picto($langs->trans('GenerateThumb'),'refresh').' </a>';
|
||||
}
|
||||
if ($user->rights->categorie->creer)
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->entity.'&action=delete&type='.$type.'&file='.urlencode($pdir.$viewfilename).'">';
|
||||
print img_delete().'</a>';
|
||||
}
|
||||
if ($nbbyrow) print '</td>';
|
||||
if ($nbbyrow && ($nbphoto % $nbbyrow == 0)) print '</tr>';
|
||||
}
|
||||
|
||||
// Ferme tableau
|
||||
while ($nbphoto % $nbbyrow)
|
||||
{
|
||||
print '<td width="'.ceil(100/$nbbyrow).'%"> </td>';
|
||||
$nbphoto++;
|
||||
}
|
||||
|
||||
if ($nbphoto < 1)
|
||||
{
|
||||
print '<tr align=center valign=middle border=1><td class="photo">';
|
||||
print "<br>".$langs->trans("NoPhotoYet")."<br><br>";
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
$title=$langs->trans("ProductsCategoryShort");
|
||||
if ($type == 0) $title=$langs->trans("ProductsCategoryShort");
|
||||
elseif ($type == 1) $title=$langs->trans("SuppliersCategoryShort");
|
||||
elseif ($type == 2) $title=$langs->trans("CustomersCategoryShort");
|
||||
elseif ($type == 3) $title=$langs->trans("MembersCategoryShort");
|
||||
|
||||
$head = categories_prepare_head($object,$type);
|
||||
dol_fiche_head($head, 'photos', $title, 0, 'category');
|
||||
|
||||
/*
|
||||
* Confirmation de la suppression de photo
|
||||
*/
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&type='.$type.'&file='.$_GET["file"], $langs->trans('DeletePicture'), $langs->trans('ConfirmDeletePicture'), 'confirm_delete', '', 0, 1);
|
||||
if ($ret == 'html') print '<br>';
|
||||
}
|
||||
|
||||
print($mesg);
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Path of category
|
||||
print '<tr><td width="20%" class="notopnoleft">';
|
||||
$ways = $object->print_all_ways();
|
||||
print $langs->trans("Ref").'</td><td>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("Root").'</a> >> ';
|
||||
foreach ($ways as $way)
|
||||
{
|
||||
print $way."<br>\n";
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Description
|
||||
print '<tr><td width="20%" class="notopnoleft">';
|
||||
print $langs->trans("Description").'</td><td>';
|
||||
print nl2br($object->description);
|
||||
print '</td></tr>';
|
||||
|
||||
// Visibility
|
||||
/* if ($type == 0 && $conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER)
|
||||
{
|
||||
if ($object->socid)
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($object->socid);
|
||||
|
||||
print '<tr><td width="20%" class="notopnoleft">';
|
||||
print $langs->trans("AssignedToTheCustomer").'</td><td>';
|
||||
print $soc->getNomUrl(1);
|
||||
print '</td></tr>';
|
||||
|
||||
$catsMeres = $object->get_meres ();
|
||||
|
||||
if ($catsMeres < 0)
|
||||
{
|
||||
dol_print_error();
|
||||
}
|
||||
else if (count($catsMeres) > 0)
|
||||
{
|
||||
print '<tr><td width="20%" class="notopnoleft">';
|
||||
print $langs->trans("CategoryContents").'</td><td>';
|
||||
print ($object->visible ? $langs->trans("Visible") : $langs->trans("Invisible"));
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td width="20%" class="notopnoleft">';
|
||||
print $langs->trans("CategoryContents").'</td><td>';
|
||||
print ($object->visible ? $langs->trans("Visible") : $langs->trans("Invisible"));
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td width="20%" class="notopnoleft">';
|
||||
print $langs->trans("CategoryContents").'</td><td>';
|
||||
print ($object->visible ? $langs->trans("Visible") : $langs->trans("Invisible"));
|
||||
print '</td></tr>';
|
||||
}
|
||||
*/
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
print "</div>\n";
|
||||
|
||||
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Barre d'action */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
print "\n<div class=\"tabsAction\">\n";
|
||||
|
||||
if ($action != 'ajout_photo' && $user->rights->categorie->creer)
|
||||
{
|
||||
if (! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=ajout_photo&id='.$object->id.'&type='.$type.'">';
|
||||
print $langs->trans("AddPhoto").'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused" href="#">';
|
||||
print $langs->trans("AddPhoto").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
print "\n</div>\n";
|
||||
|
||||
/*
|
||||
* Ajouter une photo
|
||||
*/
|
||||
if ($action == 'ajout_photo' && $user->rights->categorie->creer && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
{
|
||||
// Affiche formulaire upload
|
||||
$formfile=new FormFile($db);
|
||||
$formfile->form_attach_new_file($_SERVER['PHP_SELF'].'?id='.$object->id.'&type='.$type,$langs->trans("AddPhoto"),1);
|
||||
}
|
||||
|
||||
// Affiche photos
|
||||
if ($action != 'ajout_photo')
|
||||
{
|
||||
$nbphoto=0;
|
||||
$nbbyrow=5;
|
||||
|
||||
$maxWidth = 160;
|
||||
$maxHeight = 120;
|
||||
|
||||
$pdir = get_exdir($object->id,2) . $object->id ."/photos/";
|
||||
$dir = $upload_dir.'/'.$pdir;
|
||||
|
||||
print '<br>';
|
||||
print '<table width="100%" valign="top" align="center" border="0" cellpadding="2" cellspacing="2">';
|
||||
|
||||
foreach ($object->liste_photos($dir) as $key => $obj)
|
||||
{
|
||||
$nbphoto++;
|
||||
|
||||
|
||||
if ($nbbyrow && ($nbphoto % $nbbyrow == 1)) print '<tr align=center valign=middle border=1>';
|
||||
if ($nbbyrow) print '<td width="'.ceil(100/$nbbyrow).'%" class="photo">';
|
||||
|
||||
print '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart=category&entity='.$object->entity.'&file='.urlencode($pdir.$obj['photo']).'" alt="Taille origine" target="_blank">';
|
||||
|
||||
// Si fichier vignette disponible, on l'utilise, sinon on utilise photo origine
|
||||
if ($obj['photo_vignette'])
|
||||
{
|
||||
$filename='thumbs/'.$obj['photo_vignette'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$filename=$obj['photo'];
|
||||
}
|
||||
|
||||
// Nom affiche
|
||||
$viewfilename=$obj['photo'];
|
||||
|
||||
// Taille de l'image
|
||||
$object->get_image_size($dir.$filename);
|
||||
$imgWidth = ($object->imgWidth < $maxWidth) ? $object->imgWidth : $maxWidth;
|
||||
$imgHeight = ($object->imgHeight < $maxHeight) ? $object->imgHeight : $maxHeight;
|
||||
|
||||
print '<img border="0" width="'.$imgWidth.'" height="'.$imgHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=category&entity='.$object->entity.'&file='.urlencode($pdir.$filename).'">';
|
||||
|
||||
print '</a>';
|
||||
print '<br>'.$viewfilename;
|
||||
print '<br>';
|
||||
|
||||
// On propose la generation de la vignette si elle n'existe pas et si la taille est superieure aux limites
|
||||
if (!$obj['photo_vignette'] && preg_match('/(\.bmp|\.gif|\.jpg|\.jpeg|\.png)$/i',$obj['photo']) && ($object->imgWidth > $maxWidth || $object->imgHeight > $maxHeight))
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->entity.'&action=addthumb&type='.$type.'&file='.urlencode($pdir.$viewfilename).'">'.img_picto($langs->trans('GenerateThumb'),'refresh').' </a>';
|
||||
}
|
||||
if ($user->rights->categorie->creer)
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->entity.'&action=delete&type='.$type.'&file='.urlencode($pdir.$viewfilename).'">';
|
||||
print img_delete().'</a>';
|
||||
}
|
||||
if ($nbbyrow) print '</td>';
|
||||
if ($nbbyrow && ($nbphoto % $nbbyrow == 0)) print '</tr>';
|
||||
}
|
||||
|
||||
// Ferme tableau
|
||||
while ($nbphoto % $nbbyrow)
|
||||
{
|
||||
print '<td width="'.ceil(100/$nbbyrow).'%"> </td>';
|
||||
$nbphoto++;
|
||||
}
|
||||
|
||||
if ($nbphoto < 1)
|
||||
{
|
||||
print '<tr align=center valign=middle border=1><td class="photo">';
|
||||
print "<br>".$langs->trans("NoPhotoYet")."<br><br>";
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@ -51,11 +51,11 @@ $object = new Address($db);
|
||||
* Actions
|
||||
*/
|
||||
|
||||
// Cancel
|
||||
if (GETPOST("cancel") && ! empty($backtopage))
|
||||
{
|
||||
header("Location: ".$backtopage);
|
||||
exit;
|
||||
// Cancel
|
||||
if (GETPOST("cancel") && ! empty($backtopage))
|
||||
{
|
||||
header("Location: ".$backtopage);
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($action == 'add' || $action == 'update')
|
||||
@ -80,7 +80,7 @@ if ($action == 'add' || $action == 'update')
|
||||
{
|
||||
if (! empty($backtopage))
|
||||
{
|
||||
Header("Location: ".$backtopage);
|
||||
Header("Location: ".$backtopage);
|
||||
exit;
|
||||
}
|
||||
else if ($origin == 'commande')
|
||||
@ -93,10 +93,10 @@ if ($action == 'add' || $action == 'update')
|
||||
Header("Location: ../comm/propal/contact.php?action=editdelivery_adress&socid=".$socid."&id=".$originid);
|
||||
exit;
|
||||
}
|
||||
elseif ($origin == 'shipment')
|
||||
{
|
||||
Header("Location: ../expedition/fiche.php?id=".$originid);
|
||||
exit;
|
||||
elseif ($origin == 'shipment')
|
||||
{
|
||||
Header("Location: ../expedition/fiche.php?id=".$originid);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -118,10 +118,10 @@ if ($action == 'add' || $action == 'update')
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
if (! empty($backtopage))
|
||||
{
|
||||
Header("Location: ".$backtopage);
|
||||
exit;
|
||||
if (! empty($backtopage))
|
||||
{
|
||||
Header("Location: ".$backtopage);
|
||||
exit;
|
||||
}
|
||||
else if ($origin == 'commande')
|
||||
{
|
||||
@ -286,10 +286,10 @@ if ($action == 'create')
|
||||
|
||||
print '<br><center>';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans('Add').'">';
|
||||
if (! empty($backtopage))
|
||||
{
|
||||
print ' ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
if (! empty($backtopage))
|
||||
{
|
||||
print ' ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
}
|
||||
print '</center>'."\n";
|
||||
|
||||
@ -384,10 +384,10 @@ elseif ($action == 'edit')
|
||||
|
||||
print '</table><br>';
|
||||
|
||||
print '<center>';
|
||||
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
|
||||
print ' ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '<center>';
|
||||
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
|
||||
print ' ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</center>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
@ -365,6 +365,9 @@ if ($id > 0)
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Sales representative
|
||||
include(DOL_DOCUMENT_ROOT.'/societe/tpl/linesalesrepresentative.tpl.php');
|
||||
|
||||
// Module Adherent
|
||||
if ($conf->adherent->enabled)
|
||||
{
|
||||
|
||||
@ -92,7 +92,7 @@ $result = restrictedArea($user, $module, $objectid, $dbtable);
|
||||
$object = new Propal($db);
|
||||
|
||||
// Load object
|
||||
if ($id > 0 || ! empty($ref))
|
||||
if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
$ret=$object->fetch($id, $ref);
|
||||
}
|
||||
@ -159,29 +159,29 @@ else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->prop
|
||||
// Remove line
|
||||
else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->propale->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->fetch_thirdparty();
|
||||
$result = $object->deleteline($lineid);
|
||||
// reorder lines
|
||||
if ($result) $object->line_order(true);
|
||||
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
|
||||
if (! empty($newlang))
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
||||
{
|
||||
$ret=$object->fetch($id); // Reload to get new records
|
||||
propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
|
||||
}
|
||||
|
||||
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
|
||||
$object->fetch($id);
|
||||
$object->fetch_thirdparty();
|
||||
$result = $object->deleteline($lineid);
|
||||
// reorder lines
|
||||
if ($result) $object->line_order(true);
|
||||
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
|
||||
if (! empty($newlang))
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
||||
{
|
||||
$ret=$object->fetch($id); // Reload to get new records
|
||||
propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
|
||||
}
|
||||
|
||||
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -253,18 +253,18 @@ else if ($action == 'set_ref_client' && $user->rights->propale->creer)
|
||||
$object->set_ref_client($user, $_POST['ref_client']);
|
||||
}
|
||||
|
||||
else if ($action == 'setnote_public' && $user->rights->propale->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
else if ($action == 'setnote_public' && $user->rights->propale->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
else if ($action == 'setnote' && $user->rights->propale->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
|
||||
else if ($action == 'setnote' && $user->rights->propale->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
// Create proposal
|
||||
@ -957,21 +957,21 @@ else if ($action == 'builddoc' && $user->rights->propale->creer)
|
||||
}
|
||||
}
|
||||
|
||||
// Remove file in doc form
|
||||
else if ($action == 'remove_file')
|
||||
{
|
||||
if ($object->fetch($id))
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
|
||||
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$langs->load("other");
|
||||
$upload_dir = $conf->propal->dir_output;
|
||||
$file = $upload_dir . '/' . GETPOST('file');
|
||||
dol_delete_file($file,0,0,0,$object);
|
||||
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('file')).'</div>';
|
||||
}
|
||||
// Remove file in doc form
|
||||
else if ($action == 'remove_file')
|
||||
{
|
||||
if ($object->fetch($id))
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
|
||||
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$langs->load("other");
|
||||
$upload_dir = $conf->propal->dir_output;
|
||||
$file = $upload_dir . '/' . GETPOST('file');
|
||||
dol_delete_file($file,0,0,0,$object);
|
||||
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('file')).'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
// Set project
|
||||
@ -1071,63 +1071,63 @@ else if ($action == 'down' && $user->rights->propale->creer)
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
{
|
||||
if ($action == 'addcontact' && $user->rights->propale->creer)
|
||||
{
|
||||
$result = $object->fetch($id);
|
||||
|
||||
if ($result > 0 && $id > 0)
|
||||
if ($action == 'addcontact' && $user->rights->propale->creer)
|
||||
{
|
||||
$result = $object->fetch($id);
|
||||
|
||||
if ($result > 0 && $id > 0)
|
||||
{
|
||||
$contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'));
|
||||
$result = $result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]);
|
||||
}
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
{
|
||||
$langs->load("errors");
|
||||
$mesg = '<div class="error">'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg = '<div class="error">'.$object->error.'</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Bascule du statut d'un contact
|
||||
else if ($action == 'swapstatut' && $user->rights->propale->creer)
|
||||
{
|
||||
if ($object->fetch($id) > 0)
|
||||
{
|
||||
$result=$object->swapContactStatus(GETPOST('ligne'));
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
// Efface un contact
|
||||
else if ($action == 'deletecontact' && $user->rights->propale->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result = $object->delete_contact($lineid);
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
$contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'));
|
||||
$result = $result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]);
|
||||
}
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
{
|
||||
$langs->load("errors");
|
||||
$mesg = '<div class="error">'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg = '<div class="error">'.$object->error.'</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Bascule du statut d'un contact
|
||||
else if ($action == 'swapstatut' && $user->rights->propale->creer)
|
||||
{
|
||||
if ($object->fetch($id) > 0)
|
||||
{
|
||||
$result=$object->swapContactStatus(GETPOST('ligne'));
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
// Efface un contact
|
||||
else if ($action == 'deletecontact' && $user->rights->propale->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result = $object->delete_contact($lineid);
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1564,19 +1564,19 @@ print '<tr><td height="10">'.$langs->trans('Status').'</td><td align="left" cols
|
||||
|
||||
print '</table><br>';
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
|
||||
$formcompany= new FormCompany($db);
|
||||
|
||||
$blocname = 'contacts';
|
||||
$title = $langs->trans('ContactsAddresses');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
|
||||
$formcompany= new FormCompany($db);
|
||||
|
||||
$blocname = 'contacts';
|
||||
$title = $langs->trans('ContactsAddresses');
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php');
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_NOTES_TAB))
|
||||
{
|
||||
$blocname = 'notes';
|
||||
$blocname = 'notes';
|
||||
$title = $langs->trans('Notes');
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php');
|
||||
}
|
||||
|
||||
@ -969,7 +969,7 @@ class Propal extends CommonObject
|
||||
$sql.= ", p.fk_cond_reglement";
|
||||
$sql.= ", p.fk_mode_reglement";
|
||||
$sql.= ", c.label as statut_label";
|
||||
$sql.= ", ca.code as availability_code, ca.label as availability";
|
||||
$sql.= ", ca.code as availability_code, ca.label as availability";
|
||||
$sql.= ", dr.code as demand_reason_code, dr.label as demand_reason";
|
||||
$sql.= ", cr.code as cond_reglement_code, cr.libelle as cond_reglement, cr.libelle_facture as cond_reglement_libelle_doc";
|
||||
$sql.= ", cp.code as mode_reglement_code, cp.libelle as mode_reglement";
|
||||
|
||||
@ -39,11 +39,11 @@ $confirm = GETPOST('confirm','alpha');
|
||||
$id = GETPOST('id','int');
|
||||
$ref = GETPOST('ref','alpha');
|
||||
|
||||
$mesg='';
|
||||
if (isset($_SESSION['DolMessage']))
|
||||
{
|
||||
$mesg=$_SESSION['DolMessage'];
|
||||
unset($_SESSION['DolMessage']);
|
||||
$mesg='';
|
||||
if (isset($_SESSION['DolMessage']))
|
||||
{
|
||||
$mesg=$_SESSION['DolMessage'];
|
||||
unset($_SESSION['DolMessage']);
|
||||
}
|
||||
|
||||
// Security check
|
||||
@ -67,9 +67,9 @@ if (! $sortfield) $sortfield="name";
|
||||
|
||||
$object = new Propal($db);
|
||||
$object->fetch($id,$ref);
|
||||
if ($object->id > 0)
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
if ($object->id > 0)
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
}
|
||||
|
||||
/*
|
||||
@ -148,70 +148,70 @@ $form = new Form($db);
|
||||
|
||||
if ($object->id > 0)
|
||||
{
|
||||
$upload_dir = $conf->propal->dir_output.'/'.dol_sanitizeFileName($object->ref);
|
||||
|
||||
$head = propal_prepare_head($object);
|
||||
dol_fiche_head($head, 'document', $langs->trans('Proposal'), 0, 'propal');
|
||||
|
||||
|
||||
// Construit liste des fichiers
|
||||
$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
|
||||
$totalsize=0;
|
||||
foreach($filearray as $key => $file)
|
||||
{
|
||||
$totalsize+=$file['size'];
|
||||
}
|
||||
|
||||
|
||||
print '<table class="border"width="100%">';
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/comm/propal/list.php'."?page=$page&socid=$socid&viewstatut=$viewstatut&sortfield=$sortfield&$sortorder".'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="3">';
|
||||
print $form->showrefnav($object,'ref',$linkback,1,'ref','ref','');
|
||||
print '</td></tr>';
|
||||
|
||||
// Ref client
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td nowrap>';
|
||||
print $langs->trans('RefCustomer').'</td><td align="left">';
|
||||
print '</td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
print $object->ref_client;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Customer
|
||||
print "<tr><td>".$langs->trans("Company")."</td>";
|
||||
print '<td colspan="3">'.$object->thirdparty->getNomUrl(1).'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
dol_htmloutput_mesg($mesg,$mesgs);
|
||||
|
||||
/*
|
||||
* Confirmation suppression fichier
|
||||
*/
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$id.'&urlfile='.urlencode(GETPOST("urlfile")), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1);
|
||||
if ($ret == 'html') print '<br>';
|
||||
}
|
||||
|
||||
// Affiche formulaire upload
|
||||
$formfile=new FormFile($db);
|
||||
$formfile->form_attach_new_file(DOL_URL_ROOT.'/comm/propal/document.php?id='.$object->id,'',0,0,$user->rights->propale->creer,50,$object);
|
||||
|
||||
|
||||
// List of document
|
||||
$param='&id='.$object->id;
|
||||
$upload_dir = $conf->propal->dir_output.'/'.dol_sanitizeFileName($object->ref);
|
||||
|
||||
$head = propal_prepare_head($object);
|
||||
dol_fiche_head($head, 'document', $langs->trans('Proposal'), 0, 'propal');
|
||||
|
||||
|
||||
// Construit liste des fichiers
|
||||
$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
|
||||
$totalsize=0;
|
||||
foreach($filearray as $key => $file)
|
||||
{
|
||||
$totalsize+=$file['size'];
|
||||
}
|
||||
|
||||
|
||||
print '<table class="border"width="100%">';
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/comm/propal/list.php'."?page=$page&socid=$socid&viewstatut=$viewstatut&sortfield=$sortfield&$sortorder".'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="3">';
|
||||
print $form->showrefnav($object,'ref',$linkback,1,'ref','ref','');
|
||||
print '</td></tr>';
|
||||
|
||||
// Ref client
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td nowrap>';
|
||||
print $langs->trans('RefCustomer').'</td><td align="left">';
|
||||
print '</td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
print $object->ref_client;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Customer
|
||||
print "<tr><td>".$langs->trans("Company")."</td>";
|
||||
print '<td colspan="3">'.$object->thirdparty->getNomUrl(1).'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
dol_htmloutput_mesg($mesg,$mesgs);
|
||||
|
||||
/*
|
||||
* Confirmation suppression fichier
|
||||
*/
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$id.'&urlfile='.urlencode(GETPOST("urlfile")), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1);
|
||||
if ($ret == 'html') print '<br>';
|
||||
}
|
||||
|
||||
// Affiche formulaire upload
|
||||
$formfile=new FormFile($db);
|
||||
$formfile->form_attach_new_file(DOL_URL_ROOT.'/comm/propal/document.php?id='.$object->id,'',0,0,$user->rights->propale->creer,50,$object);
|
||||
|
||||
|
||||
// List of document
|
||||
$param='&id='.$object->id;
|
||||
$formfile->list_of_documents($filearray,$object,'propal',$param);
|
||||
}
|
||||
else
|
||||
|
||||
@ -184,14 +184,14 @@ if ($conf->propal->enabled)
|
||||
$obj = $db->fetch_object($resql);
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
$propalstatic->id=$obj->rowid;
|
||||
$propalstatic->ref=$obj->ref;
|
||||
$propalstatic->id=$obj->rowid;
|
||||
$propalstatic->ref=$obj->ref;
|
||||
print '<td nowrap="nowrap">'.$propalstatic->getNomUrl(1).'</td>';
|
||||
|
||||
$companystatic->id=$obj->socid;
|
||||
$companystatic->name=$obj->socname;
|
||||
$companystatic->client=$obj->client;
|
||||
$companystatic->canvas=$obj->canvas;
|
||||
$companystatic->id=$obj->socid;
|
||||
$companystatic->name=$obj->socname;
|
||||
$companystatic->client=$obj->client;
|
||||
$companystatic->canvas=$obj->canvas;
|
||||
print '<td>'.$companystatic->getNomUrl(1,'customer',24).'</td>';
|
||||
|
||||
print '</tr>';
|
||||
@ -265,10 +265,10 @@ if ($resql)
|
||||
|
||||
print '</td>';
|
||||
|
||||
$companystatic->id=$obj->socid;
|
||||
$companystatic->name=$obj->socname;
|
||||
$companystatic->client=$obj->client;
|
||||
$companystatic->canvas=$obj->canvas;
|
||||
$companystatic->id=$obj->socid;
|
||||
$companystatic->name=$obj->socname;
|
||||
$companystatic->client=$obj->client;
|
||||
$companystatic->canvas=$obj->canvas;
|
||||
print '<td>'.$companystatic->getNomUrl(1,'customer').'</td>';
|
||||
|
||||
print '<td>'.dol_print_date($db->jdate($obj->datec),'day').'</td>';
|
||||
@ -340,10 +340,10 @@ if ($conf->propal->enabled && $user->rights->propale->lire)
|
||||
|
||||
print "</td>";
|
||||
|
||||
$companystatic->id=$obj->socid;
|
||||
$companystatic->name=$obj->socname;
|
||||
$companystatic->client=$obj->client;
|
||||
$companystatic->canvas=$obj->canvas;
|
||||
$companystatic->id=$obj->socid;
|
||||
$companystatic->name=$obj->socname;
|
||||
$companystatic->client=$obj->client;
|
||||
$companystatic->canvas=$obj->canvas;
|
||||
print '<td align="left">'.$companystatic->getNomUrl(1,'customer',44).'</td>'."\n";
|
||||
|
||||
print '<td align="right">';
|
||||
|
||||
@ -33,6 +33,7 @@ require("../../main.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formother.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formpropal.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php');
|
||||
if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT.'/projet/class/project.class.php');
|
||||
|
||||
@ -51,6 +52,7 @@ $confirm=GETPOST('confirm','alpha');
|
||||
$lineid=GETPOST('lineid','int');
|
||||
|
||||
$search_user=GETPOST('search_user','int');
|
||||
$search_sale=GETPOST('search_sale','int');
|
||||
$search_ref=GETPOST('sf_ref')?GETPOST('sf_ref','alpha'):GETPOST('search_ref','alpha');
|
||||
$search_refcustomer=GETPOST('search_refcustomer','alpha');
|
||||
$search_societe=GETPOST('search_societe','alpha');
|
||||
@ -84,7 +86,7 @@ $result = restrictedArea($user, $module, $objectid, $dbtable);
|
||||
$object = new Propal($db);
|
||||
|
||||
// Load object
|
||||
if ($id > 0 || ! empty($ref))
|
||||
if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
$ret=$object->fetch($id, $ref);
|
||||
}
|
||||
@ -105,6 +107,7 @@ if (GETPOST("button_removefilter_x"))
|
||||
{
|
||||
$search_categ='';
|
||||
$search_user='';
|
||||
$search_sale='';
|
||||
$search_ref='';
|
||||
$search_refcustomer='';
|
||||
$search_societe='';
|
||||
@ -152,7 +155,8 @@ $sql.= ' u.login';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'propal as p';
|
||||
if ($sall) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'propaldet as pd ON p.rowid=pd.fk_propal';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON p.fk_user_author = u.rowid';
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
// We'll need this table joined to the select in order to filter by sale
|
||||
if ($search_sale || (! $user->rights->societe->client->voir && ! $socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
if ($search_user > 0)
|
||||
{
|
||||
$sql.=", ".MAIN_DB_PREFIX."element_contact as c";
|
||||
@ -160,7 +164,6 @@ if ($search_user > 0)
|
||||
}
|
||||
$sql.= ' WHERE p.fk_soc = s.rowid';
|
||||
$sql.= ' AND p.entity = '.$conf->entity;
|
||||
|
||||
if (! $user->rights->societe->client->voir && ! $socid) //restriction
|
||||
{
|
||||
$sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
@ -169,9 +172,9 @@ if ($search_ref)
|
||||
{
|
||||
$sql.= " AND p.ref LIKE '%".$db->escape(trim($search_ref))."%'";
|
||||
}
|
||||
if ($search_refcustomer)
|
||||
{
|
||||
$sql.= " AND p.ref_client LIKE '%".$db->escape(trim($search_refcustomer))."%'";
|
||||
if ($search_refcustomer)
|
||||
{
|
||||
$sql.= " AND p.ref_client LIKE '%".$db->escape(trim($search_refcustomer))."%'";
|
||||
}
|
||||
if ($search_societe)
|
||||
{
|
||||
@ -200,6 +203,7 @@ else if ($year > 0)
|
||||
{
|
||||
$sql.= " AND p.datep BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'";
|
||||
}
|
||||
if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale;
|
||||
if ($search_user > 0)
|
||||
{
|
||||
$sql.= " AND c.fk_c_type_contact = tc.rowid AND tc.element='propal' AND tc.source='internal' AND c.element_id = p.rowid AND c.fk_socpeople = ".$search_user;
|
||||
@ -224,13 +228,14 @@ if ($result)
|
||||
}
|
||||
|
||||
$param='&socid='.$socid.'&viewstatut='.$viewstatut;
|
||||
if ($month) $param.='&month='.$month;
|
||||
if ($year) $param.='&year='.$year;
|
||||
if ($search_ref) $param.='&search_ref=' .$search_ref;
|
||||
if ($month) $param.='&month='.$month;
|
||||
if ($year) $param.='&year='.$year;
|
||||
if ($search_ref) $param.='&search_ref=' .$search_ref;
|
||||
if ($search_refcustomer) $param.='&search_ref=' .$search_refcustomer;
|
||||
if ($search_societe) $param.='&search_societe=' .$search_societe;
|
||||
if ($search_societe) $param.='&search_societe=' .$search_societe;
|
||||
if ($search_user > 0) $param.='&search_user='.$search_user;
|
||||
if ($search_montant_ht) $param.='&search_montant_ht='.$search_montant_ht;
|
||||
if ($search_sale > 0) $param.='&search_sale='.$search_sale;
|
||||
if ($search_montant_ht) $param.='&search_montant_ht='.$search_montant_ht;
|
||||
print_barre_liste($langs->trans('ListOfProposals').' '.($socid?'- '.$soc->nom:''), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num);
|
||||
|
||||
// Lignes des champs de filtre
|
||||
@ -239,6 +244,13 @@ if ($result)
|
||||
$i = 0;
|
||||
print '<table class="liste" width="100%">';
|
||||
|
||||
// If the user can view prospects other than his'
|
||||
if ($user->rights->societe->client->voir || $socid)
|
||||
{
|
||||
$moreforfilter.=$langs->trans('ThirdPartiesOfSaleRepresentative'). ': ';
|
||||
$moreforfilter.=$formother->select_salesrepresentatives($search_sale,'search_sale',$user);
|
||||
$moreforfilter.=' ';
|
||||
}
|
||||
// If the user can view prospects other than his'
|
||||
if ($user->rights->societe->client->voir || $socid)
|
||||
{
|
||||
@ -272,8 +284,8 @@ if ($result)
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" size="16" name="search_societe" value="'.$search_societe.'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" size="10" type="text" name="search_refcustomer" value="'.$search_refcustomer.'">';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" size="10" type="text" name="search_refcustomer" value="'.$search_refcustomer.'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" colspan="1" align="center">';
|
||||
print $langs->trans('Month').': <input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
|
||||
@ -340,8 +352,8 @@ if ($result)
|
||||
print '</td>';
|
||||
|
||||
// Customer ref
|
||||
print '<td nowrap="nowrap">';
|
||||
print $objp->ref_client;
|
||||
print '<td nowrap="nowrap">';
|
||||
print $objp->ref_client;
|
||||
print '</td>';
|
||||
|
||||
// Date propale
|
||||
|
||||
@ -47,18 +47,18 @@ $object = new Propal($db);
|
||||
/* Actions */
|
||||
/******************************************************************************/
|
||||
|
||||
if ($action == 'setnote_public' && $user->rights->propale->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
else if ($action == 'setnote' && $user->rights->propale->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
if ($action == 'setnote_public' && $user->rights->propale->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
else if ($action == 'setnote' && $user->rights->propale->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -41,6 +41,8 @@ $socid = GETPOST('socid','int');
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'societe', $socid, '&societe');
|
||||
|
||||
$object = new Prospect($db);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -55,9 +57,8 @@ if ($_GET["action"] == 'cstc')
|
||||
// set prospect level
|
||||
if ($_POST["action"] == 'setprospectlevel' && $user->rights->societe->creer)
|
||||
{
|
||||
$societe = new Societe($db);
|
||||
$societe->fetch($_GET["socid"]);
|
||||
$societe->fk_prospectlevel=$_POST['prospect_level_id'];
|
||||
$object->fetch($_GET["socid"]);
|
||||
$object->fk_prospectlevel=$_POST['prospect_level_id'];
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_prospectlevel='".$_POST['prospect_level_id'];
|
||||
$sql.= "' WHERE rowid='".$_GET["socid"]."'";
|
||||
$result = $db->query($sql);
|
||||
@ -81,8 +82,7 @@ $formcompany=new FormCompany($db);
|
||||
if ($socid > 0)
|
||||
{
|
||||
$actionstatic=new ActionComm($db);
|
||||
$societe = new Prospect($db, $socid);
|
||||
$result = $societe->fetch($socid);
|
||||
$result = $object->fetch($socid);
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_print_error($db);
|
||||
@ -92,7 +92,7 @@ if ($socid > 0)
|
||||
/*
|
||||
* Affichage onglets
|
||||
*/
|
||||
$head = societe_prepare_head($societe);
|
||||
$head = societe_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'prospect', $langs->trans("ThirdParty"),0,'company');
|
||||
|
||||
@ -101,51 +101,51 @@ if ($socid > 0)
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td width="25%">'.$langs->trans("ThirdPartyName").'</td><td colspan="3">';
|
||||
$societe->next_prev_filter="te.client in (2,3)";
|
||||
print $form->showrefnav($societe,'socid','',($user->societe_id?0:1),'rowid','nom','','');
|
||||
$object->next_prev_filter="te.client in (2,3)";
|
||||
print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom','','');
|
||||
print '</td></tr>';
|
||||
|
||||
// Address
|
||||
print '<tr><td valign="top">'.$langs->trans("Address").'</td><td colspan="3">';
|
||||
dol_print_address($societe->address,'gmap','thirdparty',$societe->id);
|
||||
dol_print_address($object->address,'gmap','thirdparty',$object->id);
|
||||
print "</td></tr>";
|
||||
|
||||
// Zip / Town
|
||||
print '<tr><td nowrap="nowrap">'.$langs->trans('Zip').' / '.$langs->trans("Town").'</td><td colspan="3">'.$societe->cp.(($societe->cp && $societe->ville)?' / ':'').$societe->ville.'</td>';
|
||||
print '<tr><td nowrap="nowrap">'.$langs->trans('Zip').' / '.$langs->trans("Town").'</td><td colspan="3">'.$object->zip.(($object->zip && $object->town)?' / ':'').$societe->town.'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Country
|
||||
print '<tr><td>'.$langs->trans("Country").'</td><td colspan="3">';
|
||||
$img=picto_from_langcode($societe->country_code);
|
||||
if ($societe->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$societe->country,$langs->trans("CountryIsInEEC"),1,0);
|
||||
else print ($img?$img.' ':'').$societe->country;
|
||||
$img=picto_from_langcode($object->country_code);
|
||||
if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->country,$langs->trans("CountryIsInEEC"),1,0);
|
||||
else print ($img?$img.' ':'').$object->country;
|
||||
print '</td></tr>';
|
||||
|
||||
// Phone
|
||||
print '<tr><td>'.$langs->trans("Phone").'</td><td style="min-width: 25%;">'.dol_print_phone($societe->tel,$societe->country_code,0,$societe->id,'AC_TEL').'</td>';
|
||||
print '<td>'.$langs->trans("Fax").'</td><td style="min-width: 25%;">'.dol_print_phone($societe->fax,$societe->country_code).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Phone").'</td><td style="min-width: 25%;">'.dol_print_phone($object->tel,$object->country_code,0,$object->id,'AC_TEL').'</td>';
|
||||
print '<td>'.$langs->trans("Fax").'</td><td style="min-width: 25%;">'.dol_print_phone($object->fax,$object->country_code).'</td></tr>';
|
||||
|
||||
// EMail
|
||||
print '<td>'.$langs->trans('EMail').'</td><td colspan="3">'.dol_print_email($societe->email,0,$societe->id,'AC_EMAIL').'</td></tr>';
|
||||
print '<td>'.$langs->trans('EMail').'</td><td colspan="3">'.dol_print_email($object->email,0,$object->id,'AC_EMAIL').'</td></tr>';
|
||||
|
||||
// Web
|
||||
print '<tr><td>'.$langs->trans("Web")."</td><td colspan=\"3\"><a href=\"http://$societe->url\">$societe->url</a></td></tr>";
|
||||
print '<tr><td>'.$langs->trans("Web")."</td><td colspan=\"3\"><a href=\"http://$object->url\">$object->url</a></td></tr>";
|
||||
|
||||
// Level of prospect
|
||||
print '<tr><td nowrap>';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td nowrap>';
|
||||
print $langs->trans('ProspectLevelShort');
|
||||
print '<td>';
|
||||
if (($_GET['action'] != 'editlevel') && $user->rights->societe->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editlevel&socid='.$societe->id.'">'.img_edit($langs->trans('SetLevel'),1).'</a></td>';
|
||||
if (($_GET['action'] != 'editlevel') && $user->rights->societe->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editlevel&socid='.$object->id.'">'.img_edit($langs->trans('SetLevel'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($_GET['action'] == 'editlevel')
|
||||
{
|
||||
$formcompany->form_prospect_level($_SERVER['PHP_SELF'].'?socid='.$societe->id,$societe->fk_prospectlevel,'prospect_level_id',1);
|
||||
$formcompany->form_prospect_level($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->fk_prospectlevel,'prospect_level_id',1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print $societe->getLibLevel();
|
||||
print $object->getLibLevel();
|
||||
//$formcompany->form_prospect_level($_SERVER['PHP_SELF'].'?socid='.$objsoc->id,$objsoc->mode_reglement,'none');
|
||||
}
|
||||
print "</td>";
|
||||
@ -160,23 +160,26 @@ if ($socid > 0)
|
||||
print '<td><td align="right">';
|
||||
if ($user->rights->societe->creer)
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/comm/multiprix.php?id='.$societe->id.'">'.img_edit($langs->trans("Modify")).'</a>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/comm/multiprix.php?id='.$object->id.'">'.img_edit($langs->trans("Modify")).'</a>';
|
||||
}
|
||||
print '</td></tr></table>';
|
||||
print '</td><td colspan="3">'.$societe->price_level."</td>";
|
||||
print '</td><td colspan="3">'.$object->price_level."</td>";
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Status
|
||||
print '<tr><td>'.$langs->trans("StatusProsp").'</td><td colspan="2">'.$societe->getLibProspStatut(4).'</td>';
|
||||
print '<tr><td>'.$langs->trans("StatusProsp").'</td><td colspan="2">'.$object->getLibProspStatut(4).'</td>';
|
||||
print '<td>';
|
||||
if ($societe->stcomm_id != -1) print '<a href="fiche.php?socid='.$societe->id.'&stcomm=-1&action=cstc">'.img_action(0,-1).'</a>';
|
||||
if ($societe->stcomm_id != 0) print '<a href="fiche.php?socid='.$societe->id.'&stcomm=0&action=cstc">'.img_action(0,0).'</a>';
|
||||
if ($societe->stcomm_id != 1) print '<a href="fiche.php?socid='.$societe->id.'&stcomm=1&action=cstc">'.img_action(0,1).'</a>';
|
||||
if ($societe->stcomm_id != 2) print '<a href="fiche.php?socid='.$societe->id.'&stcomm=2&action=cstc">'.img_action(0,2).'</a>';
|
||||
if ($societe->stcomm_id != 3) print '<a href="fiche.php?socid='.$societe->id.'&stcomm=3&action=cstc">'.img_action(0,3).'</a>';
|
||||
if ($object->stcomm_id != -1) print '<a href="fiche.php?socid='.$object->id.'&stcomm=-1&action=cstc">'.img_action(0,-1).'</a>';
|
||||
if ($object->stcomm_id != 0) print '<a href="fiche.php?socid='.$object->id.'&stcomm=0&action=cstc">'.img_action(0,0).'</a>';
|
||||
if ($object->stcomm_id != 1) print '<a href="fiche.php?socid='.$object->id.'&stcomm=1&action=cstc">'.img_action(0,1).'</a>';
|
||||
if ($object->stcomm_id != 2) print '<a href="fiche.php?socid='.$object->id.'&stcomm=2&action=cstc">'.img_action(0,2).'</a>';
|
||||
if ($object->stcomm_id != 3) print '<a href="fiche.php?socid='.$object->id.'&stcomm=3&action=cstc">'.img_action(0,3).'</a>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Sales representative
|
||||
include(DOL_DOCUMENT_ROOT.'/societe/tpl/linesalesrepresentative.tpl.php');
|
||||
|
||||
// Module Adherent
|
||||
if ($conf->adherent->enabled)
|
||||
{
|
||||
@ -185,7 +188,7 @@ if ($socid > 0)
|
||||
print '<tr><td width="25%" valign="top">'.$langs->trans("LinkedToDolibarrMember").'</td>';
|
||||
print '<td colspan="3">';
|
||||
$adh=new Adherent($db);
|
||||
$result=$adh->fetch('','',$societe->id);
|
||||
$result=$adh->fetch('','',$object->id);
|
||||
if ($result > 0)
|
||||
{
|
||||
$adh->ref=$adh->getFullName($langs);
|
||||
@ -213,7 +216,7 @@ if ($socid > 0)
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("Summary").'</td>';
|
||||
print '<td align="right"><a href="'.DOL_URL_ROOT.'/comm/prospect/recap-prospect.php?socid='.$societe->id.'">'.$langs->trans("ShowProspectPreview").'</a></td></tr></table></td>';
|
||||
print '<td align="right"><a href="'.DOL_URL_ROOT.'/comm/prospect/recap-prospect.php?socid='.$object->id.'">'.$langs->trans("ShowProspectPreview").'</a></td></tr></table></td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
@ -235,7 +238,7 @@ if ($socid > 0)
|
||||
$sql.= " WHERE p.fk_soc = s.rowid";
|
||||
$sql.= " AND p.fk_statut = c.id";
|
||||
$sql.= " AND p.entity = ".$conf->entity;
|
||||
$sql.= " AND s.rowid = ".$societe->id;
|
||||
$sql.= " AND s.rowid = ".$object->id;
|
||||
$sql.= " ORDER BY p.datep DESC";
|
||||
|
||||
$resql=$db->query($sql);
|
||||
@ -249,8 +252,8 @@ if ($socid > 0)
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastPropals",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a href="'.DOL_URL_ROOT.'/comm/propal.php?socid='.$societe->id.'">'.$langs->trans("AllPropals").' ('.$num.')</a></td>';
|
||||
print '<td width="20px" align="right"><a href="'.DOL_URL_ROOT.'/comm/propal/stats/index.php?socid='.$societe->id.'">'.img_picto($langs->trans("Statistics"),'stats').'</a></td>';
|
||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastPropals",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a href="'.DOL_URL_ROOT.'/comm/propal.php?socid='.$object->id.'">'.$langs->trans("AllPropals").' ('.$num.')</a></td>';
|
||||
print '<td width="20px" align="right"><a href="'.DOL_URL_ROOT.'/comm/propal/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"),'stats').'</a></td>';
|
||||
print '</tr></table></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
@ -296,7 +299,7 @@ if ($socid > 0)
|
||||
|
||||
if ($conf->propal->enabled && $user->rights->propale->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/addpropal.php?socid='.$societe->id.'&action=create">'.$langs->trans("AddProp").'</a>';
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/addpropal.php?socid='.$object->id.'&action=create">'.$langs->trans("AddProp").'</a>';
|
||||
}
|
||||
|
||||
// Add action
|
||||
@ -304,7 +307,7 @@ if ($socid > 0)
|
||||
{
|
||||
if ($user->rights->agenda->myactions->create)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&socid='.$societe->id.'">'.$langs->trans("AddAction").'</a>';
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&socid='.$object->id.'">'.$langs->trans("AddAction").'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -321,7 +324,7 @@ if ($socid > 0)
|
||||
{
|
||||
print '<br>';
|
||||
// List of contacts
|
||||
show_contacts($conf,$langs,$db,$societe,$_SERVER["PHP_SELF"].'?socid='.$societe->id);
|
||||
show_contacts($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id);
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_REPEATTASKONEACHTAB))
|
||||
@ -329,10 +332,10 @@ if ($socid > 0)
|
||||
print load_fiche_titre($langs->trans("ActionsOnCompany"),'','');
|
||||
|
||||
// List of todo actions
|
||||
show_actions_todo($conf,$langs,$db,$societe);
|
||||
show_actions_todo($conf,$langs,$db,$object);
|
||||
|
||||
// List of done actions
|
||||
show_actions_done($conf,$langs,$db,$societe);
|
||||
show_actions_done($conf,$langs,$db,$object);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -159,7 +159,7 @@ if ($_GET["action"] == 'cstc')
|
||||
* View
|
||||
*/
|
||||
|
||||
$htmlother=new FormOther($db);
|
||||
$formother=new FormOther($db);
|
||||
|
||||
$sql = "SELECT s.rowid, s.nom, s.ville, s.datec, s.datea, s.status as status,";
|
||||
$sql.= " st.libelle as stcomm, s.prefix_comm, s.fk_stcomm, s.fk_prospectlevel,";
|
||||
@ -271,14 +271,14 @@ if ($resql)
|
||||
if ($conf->categorie->enabled)
|
||||
{
|
||||
$moreforfilter.=$langs->trans('Categories'). ': ';
|
||||
$moreforfilter.=$htmlother->select_categories(2,$search_categ,'search_categ');
|
||||
$moreforfilter.=$formother->select_categories(2,$search_categ,'search_categ');
|
||||
$moreforfilter.=' ';
|
||||
}
|
||||
// If the user can view prospects other than his'
|
||||
if ($user->rights->societe->client->voir || $socid)
|
||||
{
|
||||
$moreforfilter.=$langs->trans('SalesRepresentatives'). ': ';
|
||||
$moreforfilter.=$htmlother->select_salesrepresentatives($search_sale,'search_sale',$user);
|
||||
$moreforfilter.=$formother->select_salesrepresentatives($search_sale,'search_sale',$user);
|
||||
}
|
||||
if ($moreforfilter)
|
||||
{
|
||||
|
||||
@ -921,13 +921,13 @@ class Commande extends CommonObject
|
||||
$this->note_public = $object->note_public;
|
||||
|
||||
$this->origin = $object->element;
|
||||
$this->origin_id = $object->id;
|
||||
|
||||
// Possibility to add external linked objects with hooks
|
||||
$this->linked_objects[$this->origin] = $this->origin_id;
|
||||
if (is_array($object->other_linked_objects) && ! empty($object->other_linked_objects))
|
||||
{
|
||||
$this->linked_objects = array_merge($this->linked_objects, $object->other_linked_objects);
|
||||
$this->origin_id = $object->id;
|
||||
|
||||
// Possibility to add external linked objects with hooks
|
||||
$this->linked_objects[$this->origin] = $this->origin_id;
|
||||
if (is_array($object->other_linked_objects) && ! empty($object->other_linked_objects))
|
||||
{
|
||||
$this->linked_objects = array_merge($this->linked_objects, $object->other_linked_objects);
|
||||
}
|
||||
|
||||
$ret = $this->create($user);
|
||||
@ -937,7 +937,7 @@ class Commande extends CommonObject
|
||||
// Actions hooked (by external module)
|
||||
if (! is_object($hookmanager))
|
||||
{
|
||||
include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php');
|
||||
include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php');
|
||||
$hookmanager=new HookManager($this->db);
|
||||
}
|
||||
$hookmanager->initHooks(array('orderdao'));
|
||||
|
||||
@ -163,7 +163,7 @@ if ($resql)
|
||||
$lienfin='</a>';
|
||||
$name=$obj->nom;
|
||||
$result.=($lien.img_object($langs->trans("ShowCompany").': '.$name,'company').$lienfin);
|
||||
$result.=$lien.(dol_trunc($name,$maxlen)).$lienfin;
|
||||
$result.=$lien.(dol_trunc($name,$maxlen)).$lienfin;
|
||||
|
||||
print $result;
|
||||
print '</td>';
|
||||
|
||||
@ -40,11 +40,11 @@ $confirm = GETPOST('confirm');
|
||||
$id = GETPOST('id','int');
|
||||
$ref = GETPOST('ref');
|
||||
|
||||
$mesg='';
|
||||
if (isset($_SESSION['DolMessage']))
|
||||
{
|
||||
$mesg=$_SESSION['DolMessage'];
|
||||
unset($_SESSION['DolMessage']);
|
||||
$mesg='';
|
||||
if (isset($_SESSION['DolMessage']))
|
||||
{
|
||||
$mesg=$_SESSION['DolMessage'];
|
||||
unset($_SESSION['DolMessage']);
|
||||
}
|
||||
|
||||
// Security check
|
||||
@ -130,7 +130,7 @@ else if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
||||
$file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
|
||||
dol_delete_file($file,0,0,0,$object);
|
||||
$_SESSION['DolMessage'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
|
||||
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,7 +58,7 @@ $confirm = GETPOST('confirm');
|
||||
$lineid = GETPOST('lineid');
|
||||
$mesg = GETPOST('mesg');
|
||||
|
||||
//PDF
|
||||
//PDF
|
||||
$hidedetails = (GETPOST('hidedetails','int') ? GETPOST('hidedetails','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
|
||||
$hidedesc = (GETPOST('hidedesc','int') ? GETPOST('hidedesc','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0));
|
||||
$hideref = (GETPOST('hideref','int') ? GETPOST('hideref','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0));
|
||||
@ -69,10 +69,10 @@ $result=restrictedArea($user,'commande',$id,'');
|
||||
|
||||
$object = new Commande($db);
|
||||
|
||||
// Load object
|
||||
if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
$ret=$object->fetch($id, $ref);
|
||||
// Load object
|
||||
if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
$ret=$object->fetch($id, $ref);
|
||||
}
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
@ -512,18 +512,18 @@ else if ($action == 'setremiseabsolue' && $user->rights->commande->creer)
|
||||
$result = $object->set_remise_absolue($user, $_POST['remise_absolue']);
|
||||
}
|
||||
|
||||
else if ($action == 'setnote_public' && $user->rights->commande->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
else if ($action == 'setnote' && $user->rights->commande->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
else if ($action == 'setnote_public' && $user->rights->commande->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
else if ($action == 'setnote' && $user->rights->commande->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1227,64 +1227,64 @@ if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_P
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
{
|
||||
if ($action == 'addcontact' && $user->rights->commande->creer)
|
||||
{
|
||||
$result = $object->fetch($id);
|
||||
|
||||
if ($result > 0 && $id > 0)
|
||||
if ($action == 'addcontact' && $user->rights->commande->creer)
|
||||
{
|
||||
$result = $object->fetch($id);
|
||||
|
||||
if ($result > 0 && $id > 0)
|
||||
{
|
||||
$contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'));
|
||||
$result = $result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]);
|
||||
}
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
{
|
||||
$langs->load("errors");
|
||||
$mesg = '<div class="error">'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg = '<div class="error">'.$object->error.'</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// bascule du statut d'un contact
|
||||
else if ($action == 'swapstatut' && $user->rights->commande->creer)
|
||||
{
|
||||
if ($object->fetch($id))
|
||||
{
|
||||
$result=$object->swapContactStatus(GETPOST('ligne'));
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
// Efface un contact
|
||||
else if ($action == 'deletecontact' && $user->rights->commande->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result = $object->delete_contact($lineid);
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
$contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'));
|
||||
$result = $result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]);
|
||||
}
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
{
|
||||
$langs->load("errors");
|
||||
$mesg = '<div class="error">'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg = '<div class="error">'.$object->error.'</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// bascule du statut d'un contact
|
||||
else if ($action == 'swapstatut' && $user->rights->commande->creer)
|
||||
{
|
||||
if ($object->fetch($id))
|
||||
{
|
||||
$result=$object->swapContactStatus(GETPOST('ligne'));
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
// Efface un contact
|
||||
else if ($action == 'deletecontact' && $user->rights->commande->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result = $object->delete_contact($lineid);
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2052,24 +2052,24 @@ else
|
||||
print '<td colspan="2">'.$object->getLibStatut(4).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</table><br>';
|
||||
print '</table><br>';
|
||||
print "\n";
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
|
||||
$formcompany= new FormCompany($db);
|
||||
|
||||
$blocname = 'contacts';
|
||||
$title = $langs->trans('ContactsAddresses');
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php');
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_NOTES_TAB))
|
||||
{
|
||||
$blocname = 'notes';
|
||||
$title = $langs->trans('Notes');
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php');
|
||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
|
||||
$formcompany= new FormCompany($db);
|
||||
|
||||
$blocname = 'contacts';
|
||||
$title = $langs->trans('ContactsAddresses');
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php');
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_NOTES_TAB))
|
||||
{
|
||||
$blocname = 'notes';
|
||||
$title = $langs->trans('Notes');
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php');
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@ -27,7 +27,8 @@
|
||||
|
||||
require("../main.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT ."/commande/class/commande.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formother.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/commande/class/commande.class.php");
|
||||
|
||||
$langs->load('orders');
|
||||
$langs->load('deliveries');
|
||||
@ -43,6 +44,7 @@ $snom=GETPOST('snom','alpha');
|
||||
$sall=GETPOST('sall');
|
||||
$socid=GETPOST('socid','int');
|
||||
$search_user=GETPOST('search_user','int');
|
||||
$search_sale=GETPOST('search_sale','int');
|
||||
|
||||
// Security check
|
||||
$id = (GETPOST('orderid')?GETPOST('orderid'):GETPOST('id','int'));
|
||||
@ -63,6 +65,25 @@ $limit = $conf->liste_limit;
|
||||
$viewstatut=GETPOST('viewstatut');
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
// Do we click on purge search criteria ?
|
||||
if (GETPOST("button_removefilter_x"))
|
||||
{
|
||||
$search_categ='';
|
||||
$search_user='';
|
||||
$search_sale='';
|
||||
$search_ref='';
|
||||
$search_refcustomer='';
|
||||
$search_societe='';
|
||||
$search_montant_ht='';
|
||||
$year='';
|
||||
$month='';
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -71,6 +92,7 @@ $viewstatut=GETPOST('viewstatut');
|
||||
$now=dol_now();
|
||||
|
||||
$form = new Form($db);
|
||||
$formother = new FormOther($db);
|
||||
$formfile = new FormFile($db);
|
||||
$companystatic = new Societe($db);
|
||||
|
||||
@ -80,7 +102,8 @@ $sql = 'SELECT s.nom, s.rowid as socid, s.client, c.rowid, c.ref, c.total_ht, c.
|
||||
$sql.= ' c.date_valid, c.date_commande, c.date_livraison, c.fk_statut, c.facture as facturee';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s';
|
||||
$sql.= ', '.MAIN_DB_PREFIX.'commande as c';
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
// We'll need this table joined to the select in order to filter by sale
|
||||
if ($search_sale > 0 || (! $user->rights->societe->client->voir && ! $socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
if ($search_user > 0)
|
||||
{
|
||||
$sql.=", ".MAIN_DB_PREFIX."element_contact as ec";
|
||||
@ -152,6 +175,7 @@ if (!empty($sref_client))
|
||||
{
|
||||
$sql.= ' AND c.ref_client LIKE \'%'.$db->escape($sref_client).'%\'';
|
||||
}
|
||||
if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale;
|
||||
if ($search_user > 0)
|
||||
{
|
||||
$sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user;
|
||||
@ -190,12 +214,13 @@ if ($resql)
|
||||
$title.=' - '.$langs->trans('StatusOrderToProcessShort');
|
||||
|
||||
$param='&socid='.$socid.'&viewstatut='.$viewstatut;
|
||||
if ($month) $param.='&month='.$month;
|
||||
if ($year) $param.='&year='.$year;
|
||||
if ($sref) $param.='&sref='.$sref;
|
||||
if ($snom) $param.='&snom='.$snom;
|
||||
if ($sref_client) $param.='&sref_client='.$sref_client;
|
||||
if ($month) $param.='&month='.$month;
|
||||
if ($year) $param.='&year='.$year;
|
||||
if ($sref) $param.='&sref='.$sref;
|
||||
if ($snom) $param.='&snom='.$snom;
|
||||
if ($sref_client) $param.='&sref_client='.$sref_client;
|
||||
if ($search_user > 0) $param.='&search_user='.$search_user;
|
||||
if ($search_sale > 0) $param.='&search_sale='.$search_sale;
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
print_barre_liste($title, $page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num);
|
||||
@ -206,6 +231,13 @@ if ($resql)
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
// If the user can view prospects other than his'
|
||||
if ($user->rights->societe->client->voir || $socid)
|
||||
{
|
||||
$moreforfilter.=$langs->trans('ThirdPartiesOfSaleRepresentative'). ': ';
|
||||
$moreforfilter.=$formother->select_salesrepresentatives($search_sale,'search_sale',$user);
|
||||
$moreforfilter.=' ';
|
||||
}
|
||||
// If the user can view prospects other than his'
|
||||
if ($user->rights->societe->client->voir || $socid)
|
||||
{
|
||||
|
||||
@ -44,7 +44,7 @@ $sref_client=GETPOST('sref_client');
|
||||
$sall=GETPOST('sall');
|
||||
$socid=GETPOST('socid','int');
|
||||
|
||||
if (! $user->rights->facture->creer)
|
||||
if (! $user->rights->facture->creer)
|
||||
accessforbidden();
|
||||
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
@ -52,9 +52,9 @@ $sortorder = GETPOST("sortorder",'alpha');
|
||||
if (! $sortfield) $sortfield='c.rowid';
|
||||
if (! $sortorder) $sortorder='DESC';
|
||||
|
||||
$date_start=dol_mktime(0,0,0,$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"]); // Date for local PHP server
|
||||
$date_start=dol_mktime(0,0,0,$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"]); // Date for local PHP server
|
||||
$date_end=dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"]);
|
||||
$date_starty=dol_mktime(0,0,0,$_REQUEST["date_start_delymonth"],$_REQUEST["date_start_delyday"],$_REQUEST["date_start_delyyear"]); // Date for local PHP server
|
||||
$date_starty=dol_mktime(0,0,0,$_REQUEST["date_start_delymonth"],$_REQUEST["date_start_delyday"],$_REQUEST["date_start_delyyear"]); // Date for local PHP server
|
||||
$date_endy=dol_mktime(23,59,59,$_REQUEST["date_end_delymonth"],$_REQUEST["date_end_delyday"],$_REQUEST["date_end_delyyear"]);
|
||||
$selected=GETPOST('orders_to_invoice');
|
||||
$action=GETPOST('action','alpha');
|
||||
@ -78,399 +78,399 @@ $formfile = new FormFile($db);
|
||||
$companystatic = new Societe($db);
|
||||
$htmlother = new FormOther($db);
|
||||
|
||||
/*
|
||||
* Actions
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (($action == 'create' || $action == 'add') && ! $mesg )
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formother.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/modules/facture/modules_facture.php');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/discount.class.php');
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/functions2.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php');
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php");
|
||||
if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT.'/projet/class/project.class.php');
|
||||
if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php');
|
||||
$langs->load('bills');
|
||||
$langs->load('products');
|
||||
$langs->load('main');
|
||||
if (isset($_GET['orders_to_invoice']))
|
||||
{
|
||||
$orders_id = $_GET['orders_to_invoice'];
|
||||
$n = count($orders_id);
|
||||
$i = 0;
|
||||
|
||||
$originid=$orders_id[0];
|
||||
$_GET['originid']=$orders_id[0];
|
||||
|
||||
}
|
||||
if (isset($_POST['orders_to_invoice']))
|
||||
{
|
||||
$orders_id = $_POST['orders_to_invoice'];
|
||||
$nn = count($orders_id);
|
||||
$ii = 0;
|
||||
|
||||
$originid=$orders_id[0];
|
||||
$_POST['originid']=$orders_id[0];
|
||||
|
||||
}
|
||||
if (GETPOST('mesg','int',1) && isset($_SESSION['message'])) $mesg=$_SESSION['message'];
|
||||
$sall=isset($_GET['sall'])?trim($_GET['sall']):trim($_POST['sall']);
|
||||
$projectid=isset($_GET['projectid'])?$_GET['projectid']:0;
|
||||
$id =(GETPOST('id')?GETPOST("id"):GETPOST("facid")); // For backward compatibility
|
||||
$ref =GETPOST('ref');
|
||||
$socid =GETPOST('socid');
|
||||
$action =GETPOST('action');
|
||||
$confirm =GETPOST('confirm');
|
||||
$lineid =GETPOST('lineid');
|
||||
$userid =GETPOST('userid');
|
||||
$search_ref =GETPOST('sf_ref')?GETPOST('sf_ref'):GETPOST('search_ref');
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formother.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/modules/facture/modules_facture.php');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/discount.class.php');
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/functions2.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php');
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php");
|
||||
if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT.'/projet/class/project.class.php');
|
||||
if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php');
|
||||
$langs->load('bills');
|
||||
$langs->load('products');
|
||||
$langs->load('main');
|
||||
if (isset($_GET['orders_to_invoice']))
|
||||
{
|
||||
$orders_id = $_GET['orders_to_invoice'];
|
||||
$n = count($orders_id);
|
||||
$i = 0;
|
||||
|
||||
// Security check
|
||||
$fieldid = isset($_GET["ref"])?'facnumber':'rowid';
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'facture', $id,'','','fk_soc',$fieldid);
|
||||
|
||||
$usehm=$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE;
|
||||
$originid=$orders_id[0];
|
||||
$_GET['originid']=$orders_id[0];
|
||||
|
||||
}
|
||||
if (isset($_POST['orders_to_invoice']))
|
||||
{
|
||||
$orders_id = $_POST['orders_to_invoice'];
|
||||
$nn = count($orders_id);
|
||||
$ii = 0;
|
||||
|
||||
$originid=$orders_id[0];
|
||||
$_POST['originid']=$orders_id[0];
|
||||
|
||||
}
|
||||
if (GETPOST('mesg','int',1) && isset($_SESSION['message'])) $mesg=$_SESSION['message'];
|
||||
$sall=isset($_GET['sall'])?trim($_GET['sall']):trim($_POST['sall']);
|
||||
$projectid=isset($_GET['projectid'])?$_GET['projectid']:0;
|
||||
$id =(GETPOST('id')?GETPOST("id"):GETPOST("facid")); // For backward compatibility
|
||||
$ref =GETPOST('ref');
|
||||
$socid =GETPOST('socid');
|
||||
$action =GETPOST('action');
|
||||
$confirm =GETPOST('confirm');
|
||||
$lineid =GETPOST('lineid');
|
||||
$userid =GETPOST('userid');
|
||||
$search_ref =GETPOST('sf_ref')?GETPOST('sf_ref'):GETPOST('search_ref');
|
||||
|
||||
// Security check
|
||||
$fieldid = isset($_GET["ref"])?'facnumber':'rowid';
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'facture', $id,'','','fk_soc',$fieldid);
|
||||
|
||||
$usehm=$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE;
|
||||
$object=new Facture($db);
|
||||
|
||||
// Insert new invoice in database
|
||||
if ($action == 'add' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->socid=GETPOST('socid');
|
||||
$db->begin();
|
||||
|
||||
// Insert new invoice in database
|
||||
if ($action == 'add' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->socid=GETPOST('socid');
|
||||
$db->begin();
|
||||
$error=0;
|
||||
|
||||
// Standard or deposit or proforma invoice
|
||||
if ($_POST['type'] == 0 )
|
||||
{
|
||||
$datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
||||
if (empty($datefacture))
|
||||
{
|
||||
$datefacture = dol_mktime(12, 0, 0, date("m"), date("d"), date("Y"));
|
||||
}
|
||||
if (! $error)
|
||||
{
|
||||
// Si facture standard
|
||||
$object->socid = $_POST['socid'];
|
||||
$object->type = $_POST['type'];
|
||||
$object->number = $_POST['facnumber'];
|
||||
$object->date = $datefacture;
|
||||
$object->note_public = trim($_POST['note_public']);
|
||||
$object->note = trim($_POST['note']);
|
||||
$object->ref_client = $_POST['ref_client'];
|
||||
$object->ref_int = $_POST['ref_int'];
|
||||
$object->modelpdf = $_POST['model'];
|
||||
$object->fk_project = $_POST['projectid'];
|
||||
$object->cond_reglement_id = ($_POST['type'] == 3?1:$_POST['cond_reglement_id']);
|
||||
$object->mode_reglement_id = $_POST['mode_reglement_id'];
|
||||
$object->amount = $_POST['amount'];
|
||||
$object->remise_absolue = $_POST['remise_absolue'];
|
||||
$object->remise_percent = $_POST['remise_percent'];
|
||||
|
||||
if ($_POST['origin'] && $_POST['originid'])
|
||||
|
||||
// Standard or deposit or proforma invoice
|
||||
if ($_POST['type'] == 0 )
|
||||
{
|
||||
$datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
||||
if (empty($datefacture))
|
||||
{
|
||||
$datefacture = dol_mktime(12, 0, 0, date("m"), date("d"), date("Y"));
|
||||
}
|
||||
if (! $error)
|
||||
{
|
||||
// Si facture standard
|
||||
$object->socid = $_POST['socid'];
|
||||
$object->type = $_POST['type'];
|
||||
$object->number = $_POST['facnumber'];
|
||||
$object->date = $datefacture;
|
||||
$object->note_public = trim($_POST['note_public']);
|
||||
$object->note = trim($_POST['note']);
|
||||
$object->ref_client = $_POST['ref_client'];
|
||||
$object->ref_int = $_POST['ref_int'];
|
||||
$object->modelpdf = $_POST['model'];
|
||||
$object->fk_project = $_POST['projectid'];
|
||||
$object->cond_reglement_id = ($_POST['type'] == 3?1:$_POST['cond_reglement_id']);
|
||||
$object->mode_reglement_id = $_POST['mode_reglement_id'];
|
||||
$object->amount = $_POST['amount'];
|
||||
$object->remise_absolue = $_POST['remise_absolue'];
|
||||
$object->remise_percent = $_POST['remise_percent'];
|
||||
|
||||
if ($_POST['origin'] && $_POST['originid'])
|
||||
{
|
||||
$object->origin = $_POST['origin'];
|
||||
$object->origin_id = $orders_id[$ii];
|
||||
$object->linked_objects = $orders_id;
|
||||
$object->linked_objects = $orders_id;
|
||||
$id = $object->create($user);
|
||||
|
||||
if ($id>0)
|
||||
{
|
||||
foreach($orders_id as $origin => $origin_id)
|
||||
{
|
||||
$origin_id = (! empty($origin_id) ? $origin_id : $object->origin_id);
|
||||
$db->begin();
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."element_element (";
|
||||
$sql.= "fk_source";
|
||||
$sql.= ", sourcetype";
|
||||
$sql.= ", fk_target";
|
||||
$sql.= ", targettype";
|
||||
$sql.= ") VALUES (";
|
||||
$sql.= $origin_id;
|
||||
$sql.= ", '".$object->origin."'";
|
||||
$sql.= ", ".$id;
|
||||
$sql.= ", '".$object->element."'";
|
||||
$sql.= ")";
|
||||
|
||||
if ($db->query($sql))
|
||||
{
|
||||
$db->commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
{
|
||||
$origin_id = (! empty($origin_id) ? $origin_id : $object->origin_id);
|
||||
$db->begin();
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."element_element (";
|
||||
$sql.= "fk_source";
|
||||
$sql.= ", sourcetype";
|
||||
$sql.= ", fk_target";
|
||||
$sql.= ", targettype";
|
||||
$sql.= ") VALUES (";
|
||||
$sql.= $origin_id;
|
||||
$sql.= ", '".$object->origin."'";
|
||||
$sql.= ", ".$id;
|
||||
$sql.= ", '".$object->element."'";
|
||||
$sql.= ")";
|
||||
|
||||
if ($db->query($sql))
|
||||
{
|
||||
$db->commit();
|
||||
}
|
||||
}
|
||||
|
||||
while ($ii < $nn)
|
||||
{
|
||||
dol_include_once('/commande/class/commande.class.php');
|
||||
$srcobject = new Commande($db);
|
||||
dol_syslog("Try to find source object origin=".$object->origin." originid=".$object->origin_id." to add lines");
|
||||
$result=$srcobject->fetch($orders_id[$ii]);
|
||||
if ($result > 0)
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
|
||||
while ($ii < $nn)
|
||||
{
|
||||
dol_include_once('/commande/class/commande.class.php');
|
||||
$srcobject = new Commande($db);
|
||||
dol_syslog("Try to find source object origin=".$object->origin." originid=".$object->origin_id." to add lines");
|
||||
$result=$srcobject->fetch($orders_id[$ii]);
|
||||
if ($result > 0)
|
||||
{
|
||||
$srcobject->classer_facturee();
|
||||
$srcobject->setStatut(3);
|
||||
$lines = $srcobject->lines;
|
||||
if (empty($lines) && method_exists($srcobject,'fetch_lines')) $lines = $srcobject->fetch_lines();
|
||||
$fk_parent_line=0;
|
||||
$num=count($lines);
|
||||
for ($i=0;$i<$num;$i++)
|
||||
{
|
||||
$desc=($lines[$i]->desc?$lines[$i]->desc:$lines[$i]->libelle);
|
||||
if ($lines[$i]->subprice < 0)
|
||||
{
|
||||
// Negative line, we create a discount line
|
||||
$discount = new DiscountAbsolute($db);
|
||||
$discount->fk_soc=$object->socid;
|
||||
$discount->amount_ht=abs($lines[$i]->total_ht);
|
||||
$discount->amount_tva=abs($lines[$i]->total_tva);
|
||||
$discount->amount_ttc=abs($lines[$i]->total_ttc);
|
||||
$discount->tva_tx=$lines[$i]->tva_tx;
|
||||
$discount->fk_user=$user->id;
|
||||
$discount->description=$desc;
|
||||
$discountid=$discount->create($user);
|
||||
if ($discountid > 0)
|
||||
{
|
||||
$result=$object->insert_discount($discountid);
|
||||
//$result=$discount->link_to_invoice($lineid,$id);
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg=$discount->error;
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Positive line
|
||||
$product_type=($lines[$i]->product_type?$lines[$i]->product_type:0);
|
||||
// Date start
|
||||
$date_start=false;
|
||||
if ($lines[$i]->date_debut_prevue) $date_start=$lines[$i]->date_debut_prevue;
|
||||
if ($lines[$i]->date_debut_reel) $date_start=$lines[$i]->date_debut_reel;
|
||||
if ($lines[$i]->date_start) $date_start=$lines[$i]->date_start;
|
||||
//Date end
|
||||
$date_end=false;
|
||||
if ($lines[$i]->date_fin_prevue) $date_end=$lines[$i]->date_fin_prevue;
|
||||
if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel;
|
||||
if ($lines[$i]->date_end) $date_end=$lines[$i]->date_end;
|
||||
// Reset fk_parent_line for no child products and special product
|
||||
$srcobject->setStatut(3);
|
||||
$lines = $srcobject->lines;
|
||||
if (empty($lines) && method_exists($srcobject,'fetch_lines')) $lines = $srcobject->fetch_lines();
|
||||
$fk_parent_line=0;
|
||||
$num=count($lines);
|
||||
for ($i=0;$i<$num;$i++)
|
||||
{
|
||||
$desc=($lines[$i]->desc?$lines[$i]->desc:$lines[$i]->libelle);
|
||||
if ($lines[$i]->subprice < 0)
|
||||
{
|
||||
// Negative line, we create a discount line
|
||||
$discount = new DiscountAbsolute($db);
|
||||
$discount->fk_soc=$object->socid;
|
||||
$discount->amount_ht=abs($lines[$i]->total_ht);
|
||||
$discount->amount_tva=abs($lines[$i]->total_tva);
|
||||
$discount->amount_ttc=abs($lines[$i]->total_ttc);
|
||||
$discount->tva_tx=$lines[$i]->tva_tx;
|
||||
$discount->fk_user=$user->id;
|
||||
$discount->description=$desc;
|
||||
$discountid=$discount->create($user);
|
||||
if ($discountid > 0)
|
||||
{
|
||||
$result=$object->insert_discount($discountid);
|
||||
//$result=$discount->link_to_invoice($lineid,$id);
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg=$discount->error;
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Positive line
|
||||
$product_type=($lines[$i]->product_type?$lines[$i]->product_type:0);
|
||||
// Date start
|
||||
$date_start=false;
|
||||
if ($lines[$i]->date_debut_prevue) $date_start=$lines[$i]->date_debut_prevue;
|
||||
if ($lines[$i]->date_debut_reel) $date_start=$lines[$i]->date_debut_reel;
|
||||
if ($lines[$i]->date_start) $date_start=$lines[$i]->date_start;
|
||||
//Date end
|
||||
$date_end=false;
|
||||
if ($lines[$i]->date_fin_prevue) $date_end=$lines[$i]->date_fin_prevue;
|
||||
if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel;
|
||||
if ($lines[$i]->date_end) $date_end=$lines[$i]->date_end;
|
||||
// Reset fk_parent_line for no child products and special product
|
||||
if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9)
|
||||
{
|
||||
$fk_parent_line = 0;
|
||||
}
|
||||
{
|
||||
$fk_parent_line = 0;
|
||||
}
|
||||
$result = $object->addline(
|
||||
$id,
|
||||
$desc,
|
||||
$lines[$i]->subprice,
|
||||
$lines[$i]->qty,
|
||||
$lines[$i]->tva_tx,
|
||||
$lines[$i]->localtax1_tx,
|
||||
$lines[$i]->localtax2_tx,
|
||||
$lines[$i]->fk_product,
|
||||
$lines[$i]->remise_percent,
|
||||
$date_start,
|
||||
$date_end,
|
||||
0,
|
||||
$lines[$i]->info_bits,
|
||||
$lines[$i]->fk_remise_except,
|
||||
'HT',
|
||||
0,
|
||||
$product_type,
|
||||
$lines[$i]->rang,
|
||||
$lines[$i]->special_code,
|
||||
$object->origin,
|
||||
$lines[$i]->rowid,
|
||||
$fk_parent_line
|
||||
);
|
||||
if ($result > 0)
|
||||
{
|
||||
$lineid=$result;
|
||||
}
|
||||
else
|
||||
{
|
||||
$lineid=0;
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
// Defined the new fk_parent_line
|
||||
$id,
|
||||
$desc,
|
||||
$lines[$i]->subprice,
|
||||
$lines[$i]->qty,
|
||||
$lines[$i]->tva_tx,
|
||||
$lines[$i]->localtax1_tx,
|
||||
$lines[$i]->localtax2_tx,
|
||||
$lines[$i]->fk_product,
|
||||
$lines[$i]->remise_percent,
|
||||
$date_start,
|
||||
$date_end,
|
||||
0,
|
||||
$lines[$i]->info_bits,
|
||||
$lines[$i]->fk_remise_except,
|
||||
'HT',
|
||||
0,
|
||||
$product_type,
|
||||
$lines[$i]->rang,
|
||||
$lines[$i]->special_code,
|
||||
$object->origin,
|
||||
$lines[$i]->rowid,
|
||||
$fk_parent_line
|
||||
);
|
||||
if ($result > 0)
|
||||
{
|
||||
$lineid=$result;
|
||||
}
|
||||
else
|
||||
{
|
||||
$lineid=0;
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
// Defined the new fk_parent_line
|
||||
if ($result > 0 && $lines[$i]->product_type == 9)
|
||||
{
|
||||
$fk_parent_line = $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg=$srcobject->error;
|
||||
$error++;
|
||||
{
|
||||
$fk_parent_line = $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$ii++;
|
||||
else
|
||||
{
|
||||
$mesg=$srcobject->error;
|
||||
$error++;
|
||||
}
|
||||
$ii++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg=$object->error;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg=$object->error;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// End of object creation, we show it
|
||||
if ($id > 0 && ! $error)
|
||||
{
|
||||
$db->commit();
|
||||
Header('Location: '.DOL_URL_ROOT.'/compta/facture.php?facid='.$id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
$action='create';
|
||||
$_GET["origin"]=$_POST["origin"];
|
||||
$_GET["originid"]=$_POST["originid"];
|
||||
if (! $mesg) $mesg='<div class="error">'.$object->error.'</div>';
|
||||
}
|
||||
|
||||
// End of object creation, we show it
|
||||
if ($id > 0 && ! $error)
|
||||
{
|
||||
$db->commit();
|
||||
Header('Location: '.DOL_URL_ROOT.'/compta/facture.php?facid='.$id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
$action='create';
|
||||
$_GET["origin"]=$_POST["origin"];
|
||||
$_GET["originid"]=$_POST["originid"];
|
||||
if (! $mesg) $mesg='<div class="error">'.$object->error.'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
$html = new Form($db);
|
||||
$htmlother = new FormOther($db);
|
||||
$formfile = new FormFile($db);
|
||||
$now=dol_now();
|
||||
|
||||
// Mode creation
|
||||
if ($action == 'create')
|
||||
{
|
||||
$facturestatic=new Facture($db);
|
||||
llxHeader();
|
||||
print_fiche_titre($langs->trans('NewBill'));
|
||||
dol_htmloutput_mesg($mesg);
|
||||
$soc = new Societe($db);
|
||||
if ($socid) $res=$soc->fetch($socid);
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
$html = new Form($db);
|
||||
$htmlother = new FormOther($db);
|
||||
$formfile = new FormFile($db);
|
||||
$now=dol_now();
|
||||
|
||||
// Mode creation
|
||||
if ($action == 'create')
|
||||
{
|
||||
$facturestatic=new Facture($db);
|
||||
llxHeader();
|
||||
print_fiche_titre($langs->trans('NewBill'));
|
||||
dol_htmloutput_mesg($mesg);
|
||||
$soc = new Societe($db);
|
||||
if ($socid) $res=$soc->fetch($socid);
|
||||
if ($res)
|
||||
{
|
||||
$cond_reglement_id = $soc->cond_reglement_id;
|
||||
$mode_reglement_id = $soc->mode_reglement_id;
|
||||
{
|
||||
$cond_reglement_id = $soc->cond_reglement_id;
|
||||
$mode_reglement_id = $soc->mode_reglement_id;
|
||||
$remise_percent = $soc->remise_percent;
|
||||
}
|
||||
$remise_absolue = 0;
|
||||
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0;
|
||||
|
||||
$absolute_discount=$soc->getAvailableDiscounts();
|
||||
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<input type="hidden" name="socid" value="'.$soc->id.'">' ."\n";
|
||||
print '<input name="facnumber" type="hidden" value="provisoire">';
|
||||
print '<input name="ref_client" type="hidden" value="'.$ref_client.'">';
|
||||
print '<input name="ref_int" type="hidden" value="'.$ref_int.'">';
|
||||
print '<input type="hidden" name="origin" value="'.GETPOST('origin').'">';
|
||||
print '<input type="hidden" name="originid" value="'.GETPOST('originid').'">';
|
||||
print '<table class="border" width="100%">';
|
||||
// Ref
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Ref').'</td><td colspan="2">'.$langs->trans('Draft').'</td></tr>';
|
||||
// Tiers
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Customer').'</td><td colspan="2">';
|
||||
print $soc->getNomUrl(1);
|
||||
print '<input type="hidden" name="socid" value="'.$soc->id.'">';
|
||||
print '</td>';
|
||||
print '</tr>'."\n";
|
||||
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans('Type').'</td><td colspan="2">';
|
||||
print '<table class="nobordernopadding">'."\n";
|
||||
// Standard invoice
|
||||
print '<tr height="18"><td width="16px" valign="middle">';
|
||||
print '<input type="radio" name="type" value="0"'.(GETPOST('type')==0?' checked="true"':'').'>';
|
||||
print '</td><td valign="middle">';
|
||||
$desc=$html->textwithpicto($langs->trans("InvoiceStandardAsk"),$langs->transnoentities("InvoiceStandardDesc"),1);
|
||||
print $desc;
|
||||
print '</td></tr>'."\n";
|
||||
print '</table>';
|
||||
// Date invoice
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Date').'</td><td colspan="2">';
|
||||
$html->select_date(0,'','','','',"add",1,1);
|
||||
print '</td></tr>';
|
||||
// Payment term
|
||||
print '<tr><td nowrap>'.$langs->trans('PaymentConditionsShort').'</td><td colspan="2">';
|
||||
$html->select_conditions_paiements(isset($_POST['cond_reglement_id'])?$_POST['cond_reglement_id']:$cond_reglement_id,'cond_reglement_id');
|
||||
print '</td></tr>';
|
||||
// Payment mode
|
||||
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td colspan="2">';
|
||||
$html->select_types_paiements(isset($_POST['mode_reglement_id'])?$_POST['mode_reglement_id']:$mode_reglement_id,'mode_reglement_id');
|
||||
print '</td></tr>';
|
||||
// Project
|
||||
if ($conf->projet->enabled)
|
||||
{
|
||||
$langs->load('projects');
|
||||
print '<tr><td>'.$langs->trans('Project').'</td><td colspan="2">';
|
||||
select_projects($soc->id, $projectid, 'projectid');
|
||||
print '</td></tr>';
|
||||
}
|
||||
// Modele PDF
|
||||
print '<tr><td>'.$langs->trans('Model').'</td>';
|
||||
print '<td>';
|
||||
}
|
||||
$remise_absolue = 0;
|
||||
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0;
|
||||
|
||||
$absolute_discount=$soc->getAvailableDiscounts();
|
||||
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<input type="hidden" name="socid" value="'.$soc->id.'">' ."\n";
|
||||
print '<input name="facnumber" type="hidden" value="provisoire">';
|
||||
print '<input name="ref_client" type="hidden" value="'.$ref_client.'">';
|
||||
print '<input name="ref_int" type="hidden" value="'.$ref_int.'">';
|
||||
print '<input type="hidden" name="origin" value="'.GETPOST('origin').'">';
|
||||
print '<input type="hidden" name="originid" value="'.GETPOST('originid').'">';
|
||||
print '<table class="border" width="100%">';
|
||||
// Ref
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Ref').'</td><td colspan="2">'.$langs->trans('Draft').'</td></tr>';
|
||||
// Tiers
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Customer').'</td><td colspan="2">';
|
||||
print $soc->getNomUrl(1);
|
||||
print '<input type="hidden" name="socid" value="'.$soc->id.'">';
|
||||
print '</td>';
|
||||
print '</tr>'."\n";
|
||||
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans('Type').'</td><td colspan="2">';
|
||||
print '<table class="nobordernopadding">'."\n";
|
||||
// Standard invoice
|
||||
print '<tr height="18"><td width="16px" valign="middle">';
|
||||
print '<input type="radio" name="type" value="0"'.(GETPOST('type')==0?' checked="true"':'').'>';
|
||||
print '</td><td valign="middle">';
|
||||
$desc=$html->textwithpicto($langs->trans("InvoiceStandardAsk"),$langs->transnoentities("InvoiceStandardDesc"),1);
|
||||
print $desc;
|
||||
print '</td></tr>'."\n";
|
||||
print '</table>';
|
||||
// Date invoice
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Date').'</td><td colspan="2">';
|
||||
$html->select_date(0,'','','','',"add",1,1);
|
||||
print '</td></tr>';
|
||||
// Payment term
|
||||
print '<tr><td nowrap>'.$langs->trans('PaymentConditionsShort').'</td><td colspan="2">';
|
||||
$html->select_conditions_paiements(isset($_POST['cond_reglement_id'])?$_POST['cond_reglement_id']:$cond_reglement_id,'cond_reglement_id');
|
||||
print '</td></tr>';
|
||||
// Payment mode
|
||||
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td colspan="2">';
|
||||
$html->select_types_paiements(isset($_POST['mode_reglement_id'])?$_POST['mode_reglement_id']:$mode_reglement_id,'mode_reglement_id');
|
||||
print '</td></tr>';
|
||||
// Project
|
||||
if ($conf->projet->enabled)
|
||||
{
|
||||
$langs->load('projects');
|
||||
print '<tr><td>'.$langs->trans('Project').'</td><td colspan="2">';
|
||||
select_projects($soc->id, $projectid, 'projectid');
|
||||
print '</td></tr>';
|
||||
}
|
||||
// Modele PDF
|
||||
print '<tr><td>'.$langs->trans('Model').'</td>';
|
||||
print '<td>';
|
||||
include_once(DOL_DOCUMENT_ROOT.'/core/modules/facture/modules_facture.php');
|
||||
$liste=ModelePDFFactures::liste_modeles($db);
|
||||
print $html->selectarray('model',$liste,$conf->global->FACTURE_ADDON_PDF);
|
||||
print "</td></tr>";
|
||||
|
||||
// Public note
|
||||
print '<tr>';
|
||||
print '<td class="border" valign="top">'.$langs->trans('NotePublic').'</td>';
|
||||
print '<td valign="top" colspan="2">';
|
||||
$liste=ModelePDFFactures::liste_modeles($db);
|
||||
print $html->selectarray('model',$liste,$conf->global->FACTURE_ADDON_PDF);
|
||||
print "</td></tr>";
|
||||
|
||||
// Public note
|
||||
print '<tr>';
|
||||
print '<td class="border" valign="top">'.$langs->trans('NotePublic').'</td>';
|
||||
print '<td valign="top" colspan="2">';
|
||||
print '<textarea name="note_public" wrap="soft" cols="70" rows="'.ROWS_3.'">';
|
||||
|
||||
dol_include_once('/commande/class/commande.class.php');
|
||||
$srcobject = new Commande($db);
|
||||
$commandes = $langs->trans("Orders").": ";
|
||||
foreach ($selected as $sel)
|
||||
{
|
||||
$result=$srcobject->fetch($sel);
|
||||
if ($result > 0)
|
||||
{
|
||||
$commandes.= $srcobject->ref." ";
|
||||
}
|
||||
}
|
||||
dol_include_once('/commande/class/commande.class.php');
|
||||
$srcobject = new Commande($db);
|
||||
$commandes = $langs->trans("Orders").": ";
|
||||
foreach ($selected as $sel)
|
||||
{
|
||||
$result=$srcobject->fetch($sel);
|
||||
if ($result > 0)
|
||||
{
|
||||
$commandes.= $srcobject->ref." ";
|
||||
}
|
||||
}
|
||||
print $commandes;
|
||||
|
||||
print '</textarea></td></tr>';
|
||||
// Private note
|
||||
if (! $user->societe_id)
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td class="border" valign="top">'.$langs->trans('NotePrivate').'</td>';
|
||||
print '<td valign="top" colspan="2">';
|
||||
print '<textarea name="note" wrap="soft" cols="70" rows="'.ROWS_3.'">';
|
||||
|
||||
print '</textarea></td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '</textarea></td></tr>';
|
||||
// Private note
|
||||
if (! $user->societe_id)
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td class="border" valign="top">'.$langs->trans('NotePrivate').'</td>';
|
||||
print '<td valign="top" colspan="2">';
|
||||
print '<textarea name="note" wrap="soft" cols="70" rows="'.ROWS_3.'">';
|
||||
|
||||
print '</textarea></td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</td></tr>';
|
||||
|
||||
}
|
||||
|
||||
while ($i < $n)
|
||||
{
|
||||
print '<input type="hidden" name="orders_to_invoice[]" value="'.$orders_id[$i].'">';
|
||||
|
||||
$i++;
|
||||
while ($i < $n)
|
||||
{
|
||||
print '<input type="hidden" name="orders_to_invoice[]" value="'.$orders_id[$i].'">';
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
print "</table>\n";
|
||||
// Button "Create Draft"
|
||||
print '<br><center><input type="submit" class="button" name="bouton" value="'.$langs->trans('CreateDraft').'"></center>';
|
||||
|
||||
print "</table>\n";
|
||||
// Button "Create Draft"
|
||||
print '<br><center><input type="submit" class="button" name="bouton" value="'.$langs->trans('CreateDraft').'"></center>';
|
||||
print "</form>\n";
|
||||
}
|
||||
|
||||
@ -513,7 +513,7 @@ else
|
||||
|
||||
//Date filter
|
||||
if ($date_start && $date_end) $sql.= " AND c.date_commande >= '".$db->idate($date_start)."' AND c.date_commande <= '".$db->idate($date_end)."'";
|
||||
if ($date_starty && $date_endy) $sql.= " AND c.date_livraison >= '".$db->idate($date_starty)."' AND c.date_livraison <= '".$db->idate($date_endy)."'";
|
||||
if ($date_starty && $date_endy) $sql.= " AND c.date_livraison >= '".$db->idate($date_starty)."' AND c.date_livraison <= '".$db->idate($date_endy)."'";
|
||||
|
||||
if (!empty($sref_client))
|
||||
{
|
||||
@ -538,14 +538,14 @@ else
|
||||
$num = $db->num_rows($resql);
|
||||
print_fiche_titre($title);
|
||||
$i = 0;
|
||||
$period=$html->select_date($date_start,'date_start',0,0,1,'',1,0,1).' - '.$html->select_date($date_end,'date_end',0,0,1,'',1,0,1);
|
||||
$period=$html->select_date($date_start,'date_start',0,0,1,'',1,0,1).' - '.$html->select_date($date_end,'date_end',0,0,1,'',1,0,1);
|
||||
$periodely=$html->select_date($date_starty,'date_start_dely',0,0,1,'',1,0,1).' - '.$html->select_date($date_endy,'date_end_dely',0,0,1,'',1,0,1);
|
||||
// Company
|
||||
print '<h3>';
|
||||
$companystatic->id=$socid;
|
||||
$companystatic->nom=$soc->nom;
|
||||
|
||||
print $companystatic->getNomUrl(1,'customer');
|
||||
// Company
|
||||
print '<h3>';
|
||||
$companystatic->id=$socid;
|
||||
$companystatic->nom=$soc->nom;
|
||||
|
||||
print $companystatic->getNomUrl(1,'customer');
|
||||
print '</h3>';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
@ -584,8 +584,8 @@ else
|
||||
print '<input type="image" class="liste_titre" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
|
||||
//ALL/NONE
|
||||
print '<td class="liste_titre" align="center">';
|
||||
if ($conf->use_javascript_ajax) print '<a href="#" id="checkall">'.$langs->trans("All").'</a> / <a href="#" id="checknone">'.$langs->trans("None").'</a>';
|
||||
print '<td class="liste_titre" align="center">';
|
||||
if ($conf->use_javascript_ajax) print '<a href="#" id="checkall">'.$langs->trans("All").'</a> / <a href="#" id="checknone">'.$langs->trans("None").'</a>';
|
||||
print '</td>';
|
||||
|
||||
print '</td></tr>';
|
||||
@ -625,13 +625,13 @@ else
|
||||
print '<td>'.$objp->ref_client.'</td>';
|
||||
|
||||
// Order date
|
||||
print '<td align="center" nowrap>';
|
||||
print dol_print_date($db->jdate($objp->date_commande),'day');
|
||||
print '<td align="center" nowrap>';
|
||||
print dol_print_date($db->jdate($objp->date_commande),'day');
|
||||
print '</td>';
|
||||
|
||||
//Delivery date
|
||||
print '<td align="center" nowrap>';
|
||||
print dol_print_date($db->jdate($objp->date_livraison),'day');
|
||||
print '<td align="center" nowrap>';
|
||||
print dol_print_date($db->jdate($objp->date_livraison),'day');
|
||||
print '</td>';
|
||||
|
||||
// Statut
|
||||
@ -650,15 +650,15 @@ else
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
/*
|
||||
* Boutons actions
|
||||
/*
|
||||
* Boutons actions
|
||||
*/
|
||||
print '<div align="right">';
|
||||
print '<input type="hidden" name="socid" value="'.$socid.'">';
|
||||
print '<input type="hidden" name="action" value="create">';
|
||||
print '<div align="right">';
|
||||
print '<input type="hidden" name="socid" value="'.$socid.'">';
|
||||
print '<input type="hidden" name="action" value="create">';
|
||||
print '<input type="hidden" name="origin" value="commande"><br>';
|
||||
print '<a class="butAction" href="index.php">'.$langs->trans("GoBack").'</a>';
|
||||
print '<input type="submit" class="butAction" value='.$langs->trans("GenerateBill").'>';
|
||||
print '<a class="butAction" href="index.php">'.$langs->trans("GoBack").'</a>';
|
||||
print '<input type="submit" class="butAction" value='.$langs->trans("GenerateBill").'>';
|
||||
print '</form>';
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
@ -499,8 +499,8 @@ else if ($id)
|
||||
print "</table><br>";
|
||||
|
||||
// Notes
|
||||
$blocname = 'notes';
|
||||
$title = $langs->trans('Notes');
|
||||
$blocname = 'notes';
|
||||
$title = $langs->trans('Notes');
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php');
|
||||
|
||||
print '</div>';
|
||||
|
||||
@ -69,7 +69,7 @@ $search_societe=GETPOST('search_societe','alpha');
|
||||
$search_montant_ht=GETPOST('search_montant_ht','alpha');
|
||||
$search_montant_ttc=GETPOST('search_montant_ttc','alpha');
|
||||
|
||||
//PDF
|
||||
//PDF
|
||||
$hidedetails = (GETPOST('hidedetails','int') ? GETPOST('hidedetails','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
|
||||
$hidedesc = (GETPOST('hidedesc','int') ? GETPOST('hidedesc','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0));
|
||||
$hideref = (GETPOST('hideref','int') ? GETPOST('hideref','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0));
|
||||
@ -86,10 +86,10 @@ $usehm=$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE;
|
||||
|
||||
$object=new Facture($db);
|
||||
|
||||
// Load object
|
||||
if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
$ret=$object->fetch($id, $ref);
|
||||
// Load object
|
||||
if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
$ret=$object->fetch($id, $ref);
|
||||
}
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
@ -1524,21 +1524,21 @@ else if ($action == 'builddoc') // En get ou en post
|
||||
}
|
||||
}
|
||||
|
||||
// Remove file in doc form
|
||||
else if ($action == 'remove_file')
|
||||
{
|
||||
if ($object->fetch($id))
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
|
||||
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$langs->load("other");
|
||||
$upload_dir = $conf->facture->dir_output;
|
||||
$file = $upload_dir . '/' . GETPOST('file');
|
||||
dol_delete_file($file,0,0,0,$object);
|
||||
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('file')).'</div>';
|
||||
}
|
||||
// Remove file in doc form
|
||||
else if ($action == 'remove_file')
|
||||
{
|
||||
if ($object->fetch($id))
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
|
||||
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$langs->load("other");
|
||||
$upload_dir = $conf->facture->dir_output;
|
||||
$file = $upload_dir . '/' . GETPOST('file');
|
||||
dol_delete_file($file,0,0,0,$object);
|
||||
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('file')).'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
|
||||
@ -256,30 +256,30 @@ class Facture extends CommonObject
|
||||
$error++;
|
||||
}
|
||||
|
||||
// TODO mutualiser
|
||||
if ($origin == 'commande')
|
||||
{
|
||||
// On recupere les differents contact interne et externe
|
||||
// TODO mutualiser
|
||||
if ($origin == 'commande')
|
||||
{
|
||||
// On recupere les differents contact interne et externe
|
||||
$order = new Commande($this->db);
|
||||
$order->id = $origin_id;
|
||||
|
||||
// On recupere le commercial suivi propale
|
||||
$order->id = $origin_id;
|
||||
|
||||
// On recupere le commercial suivi propale
|
||||
$this->userid = $order->getIdcontact('internal', 'SALESREPFOLL');
|
||||
|
||||
if ($this->userid)
|
||||
{
|
||||
//On passe le commercial suivi commande en commercial suivi paiement
|
||||
$this->add_contact($this->userid[0], 'SALESREPFOLL', 'internal');
|
||||
}
|
||||
|
||||
// On recupere le contact client facturation commande
|
||||
$this->contactid = $order->getIdcontact('external', 'BILLING');
|
||||
|
||||
if ($this->contactid)
|
||||
{
|
||||
//On passe le contact client facturation commande en contact client facturation
|
||||
$this->add_contact($this->contactid[0], 'BILLING', 'external');
|
||||
}
|
||||
|
||||
if ($this->userid)
|
||||
{
|
||||
//On passe le commercial suivi commande en commercial suivi paiement
|
||||
$this->add_contact($this->userid[0], 'SALESREPFOLL', 'internal');
|
||||
}
|
||||
|
||||
// On recupere le contact client facturation commande
|
||||
$this->contactid = $order->getIdcontact('external', 'BILLING');
|
||||
|
||||
if ($this->contactid)
|
||||
{
|
||||
//On passe le contact client facturation commande en contact client facturation
|
||||
$this->add_contact($this->contactid[0], 'BILLING', 'external');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -674,11 +674,11 @@ class Facture extends CommonObject
|
||||
$this->origin = $object->element;
|
||||
$this->origin_id = $object->id;
|
||||
|
||||
// Possibility to add external linked objects with hooks
|
||||
$this->linked_objects[$this->origin] = $this->origin_id;
|
||||
if (is_array($object->other_linked_objects) && ! empty($object->other_linked_objects))
|
||||
{
|
||||
$this->linked_objects = array_merge($this->linked_objects, $object->other_linked_objects);
|
||||
// Possibility to add external linked objects with hooks
|
||||
$this->linked_objects[$this->origin] = $this->origin_id;
|
||||
if (is_array($object->other_linked_objects) && ! empty($object->other_linked_objects))
|
||||
{
|
||||
$this->linked_objects = array_merge($this->linked_objects, $object->other_linked_objects);
|
||||
}
|
||||
|
||||
$ret = $this->create($user);
|
||||
@ -1240,32 +1240,32 @@ class Facture extends CommonObject
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
// On efface le repertoire de pdf provisoire
|
||||
$ref = dol_sanitizeFileName($this->ref);
|
||||
if ($conf->facture->dir_output)
|
||||
{
|
||||
$dir = $conf->facture->dir_output . "/" . $ref;
|
||||
$file = $conf->facture->dir_output . "/" . $ref . "/" . $ref . ".pdf";
|
||||
if (file_exists($file)) // We must delete all files before deleting directory
|
||||
{
|
||||
// On efface le repertoire de pdf provisoire
|
||||
$ref = dol_sanitizeFileName($this->ref);
|
||||
if ($conf->facture->dir_output)
|
||||
{
|
||||
$dir = $conf->facture->dir_output . "/" . $ref;
|
||||
$file = $conf->facture->dir_output . "/" . $ref . "/" . $ref . ".pdf";
|
||||
if (file_exists($file)) // We must delete all files before deleting directory
|
||||
{
|
||||
$ret=dol_delete_preview($this);
|
||||
|
||||
if (! dol_delete_file($file,0,0,0,$this)) // For triggers
|
||||
{
|
||||
$this->error=$langs->trans("ErrorCanNotDeleteFile",$file);
|
||||
$this->db->rollback();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (file_exists($dir))
|
||||
{
|
||||
if (! dol_delete_dir_recursive($dir)) // For remove dir and meta
|
||||
{
|
||||
$this->error=$langs->trans("ErrorCanNotDeleteDir",$dir);
|
||||
$this->db->rollback();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (! dol_delete_file($file,0,0,0,$this)) // For triggers
|
||||
{
|
||||
$this->error=$langs->trans("ErrorCanNotDeleteFile",$file);
|
||||
$this->db->rollback();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (file_exists($dir))
|
||||
{
|
||||
if (! dol_delete_dir_recursive($dir)) // For remove dir and meta
|
||||
{
|
||||
$this->error=$langs->trans("ErrorCanNotDeleteDir",$dir);
|
||||
$this->db->rollback();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->db->commit();
|
||||
|
||||
@ -43,11 +43,11 @@ $confirm = GETPOST('confirm');
|
||||
$id = GETPOST('facid','int');
|
||||
$ref = GETPOST('ref');
|
||||
|
||||
$mesg='';
|
||||
if (isset($_SESSION['DolMessage']))
|
||||
{
|
||||
$mesg=$_SESSION['DolMessage'];
|
||||
unset($_SESSION['DolMessage']);
|
||||
$mesg='';
|
||||
if (isset($_SESSION['DolMessage']))
|
||||
{
|
||||
$mesg=$_SESSION['DolMessage'];
|
||||
unset($_SESSION['DolMessage']);
|
||||
}
|
||||
|
||||
// Security check
|
||||
|
||||
@ -268,6 +268,7 @@ if ($resql)
|
||||
print_liste_field_titre($langs->trans("AmountHT"),$_SERVER["PHP_SELF"],"f.total","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"f.total_ttc","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Received"),$_SERVER["PHP_SELF"],"am","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Rest"),$_SERVER["PHP_SELF"],"am","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"fk_statut,paye,am","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Merge"),$_SERVER["PHP_SELF"],"","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print "</tr>\n";
|
||||
@ -286,7 +287,7 @@ if ($resql)
|
||||
print '<input class="flat" type="text" size="10" name="search_montant_ht" value="'.$search_montant_ht.'">';
|
||||
print '</td><td class="liste_titre" align="right">';
|
||||
print '<input class="flat" type="text" size="10" name="search_montant_ttc" value="'.$search_montant_ttc.'">';
|
||||
print '</td><td class="liste_titre" colspan="2" align="right">';
|
||||
print '</td><td class="liste_titre" colspan="3" align="right">';
|
||||
print '<input type="image" class="liste_titre" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="center">';
|
||||
@ -354,6 +355,10 @@ if ($resql)
|
||||
print '<td align="right">'.price($objp->total_ht).'</td>';
|
||||
print '<td align="right">'.price($objp->total_ttc).'</td>';
|
||||
print '<td align="right">'.price($objp->am).'</td>';
|
||||
if ($objp->am==0)
|
||||
{ print '<td align="right"></td>'; }
|
||||
else
|
||||
{ print '<td align="right">'.price($objp->total_ttc-$objp->am).'</td>'; }
|
||||
|
||||
// Affiche statut de la facture
|
||||
print '<td align="right" nowrap="nowrap">';
|
||||
|
||||
@ -112,7 +112,19 @@ $now=dol_now();
|
||||
$parameters=array('socid'=>$socid);
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
// None
|
||||
// Do we click on purge search criteria ?
|
||||
if (GETPOST("button_removefilter_x"))
|
||||
{
|
||||
$search_categ='';
|
||||
$search_user='';
|
||||
$search_sale='';
|
||||
$search_ref='';
|
||||
$search_refcustomer='';
|
||||
$search_societe='';
|
||||
$search_montant_ht='';
|
||||
$year='';
|
||||
$month='';
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@ -122,7 +134,7 @@ $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action);
|
||||
llxHeader('',$langs->trans('Bill'),'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes');
|
||||
|
||||
$form = new Form($db);
|
||||
$htmlother = new FormOther($db);
|
||||
$formother = new FormOther($db);
|
||||
$formfile = new FormFile($db);
|
||||
$bankaccountstatic=new Account($db);
|
||||
$facturestatic=new Facture($db);
|
||||
@ -135,10 +147,11 @@ $sql.= ' f.paye as paye, f.fk_statut, f.note,';
|
||||
$sql.= ' s.nom, s.rowid as socid';
|
||||
if (! $sall) $sql.= ', SUM(pf.amount) as am'; // To be able to sort on status
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s';
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= ', '.MAIN_DB_PREFIX.'facture as f';
|
||||
if (! $sall) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON pf.fk_facture = f.rowid';
|
||||
else $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'facturedet as fd ON fd.fk_facture = f.rowid';
|
||||
// We'll need this table joined to the select in order to filter by sale
|
||||
if ($search_sale > 0 || (! $user->rights->societe->client->voir && ! $socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
if ($search_user > 0)
|
||||
{
|
||||
$sql.=", ".MAIN_DB_PREFIX."element_contact as ec";
|
||||
@ -191,6 +204,7 @@ else if ($year > 0)
|
||||
{
|
||||
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'";
|
||||
}
|
||||
if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale;
|
||||
if ($search_user > 0)
|
||||
{
|
||||
$sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='facture' AND tc.source='internal' AND ec.element_id = f.rowid AND ec.fk_socpeople = ".$search_user;
|
||||
@ -199,7 +213,7 @@ if (! $sall)
|
||||
{
|
||||
$sql.= ' GROUP BY f.rowid, f.facnumber, f.type, f.increment, f.total, f.total_ttc,';
|
||||
$sql.= ' f.datef, f.date_lim_reglement,';
|
||||
$sql.= ' f.paye, f.fk_statut,';
|
||||
$sql.= ' f.paye, f.fk_statut, f.note,';
|
||||
$sql.= ' s.nom, s.rowid';
|
||||
}
|
||||
else
|
||||
@ -225,11 +239,12 @@ if ($resql)
|
||||
}
|
||||
|
||||
$param='&socid='.$socid;
|
||||
if ($month) $param.='&month='.$month;
|
||||
if ($year) $param.='&year=' .$year;
|
||||
if ($search_ref) $param.='&search_ref=' .$search_ref;
|
||||
if ($search_societe) $param.='&search_societe=' .$search_societe;
|
||||
if ($search_user > 0) $param.='&search_user=' .$search_user;
|
||||
if ($month) $param.='&month='.$month;
|
||||
if ($year) $param.='&year=' .$year;
|
||||
if ($search_ref) $param.='&search_ref=' .$search_ref;
|
||||
if ($search_societe) $param.='&search_societe=' .$search_societe;
|
||||
if ($search_sale > 0) $param.='&search_sale=' .$search_sale;
|
||||
if ($search_user > 0) $param.='&search_user=' .$search_user;
|
||||
if ($search_montant_ht) $param.='&search_montant_ht='.$search_montant_ht;
|
||||
if ($search_montant_ttc) $param.='&search_montant_ttc='.$search_montant_ttc;
|
||||
print_barre_liste($langs->trans('BillsCustomers').' '.($socid?' '.$soc->nom:''),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num);
|
||||
@ -238,6 +253,13 @@ if ($resql)
|
||||
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||
print '<table class="liste" width="100%">';
|
||||
|
||||
// If the user can view prospects other than his'
|
||||
if ($user->rights->societe->client->voir || $socid)
|
||||
{
|
||||
$moreforfilter.=$langs->trans('ThirdPartiesOfSaleRepresentative'). ': ';
|
||||
$moreforfilter.=$formother->select_salesrepresentatives($search_sale,'search_sale',$user);
|
||||
$moreforfilter.=' ';
|
||||
}
|
||||
// If the user can view prospects other than his'
|
||||
if ($user->rights->societe->client->voir || $socid)
|
||||
{
|
||||
@ -272,7 +294,7 @@ if ($resql)
|
||||
print '<td class="liste_titre" align="center">';
|
||||
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="day" value="'.$day.'">';
|
||||
print '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
|
||||
$htmlother->select_year($year?$year:-1,'year',1, 20, 5);
|
||||
$formother->select_year($year?$year:-1,'year',1, 20, 5);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="left"> </td>';
|
||||
print '<td class="liste_titre" align="left">';
|
||||
|
||||
@ -31,9 +31,9 @@ require_once(DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php');
|
||||
$langs->load("companies");
|
||||
$langs->load("bills");
|
||||
|
||||
$id=(GETPOST('id','int')?GETPOST('id','int'):GETPOST('facid','int')); // For backward compatibility
|
||||
$ref=GETPOST('ref','alpha');
|
||||
$socid=GETPOST('socid','int');
|
||||
$id=(GETPOST('id','int')?GETPOST('id','int'):GETPOST('facid','int')); // For backward compatibility
|
||||
$ref=GETPOST('ref','alpha');
|
||||
$socid=GETPOST('socid','int');
|
||||
$action=GETPOST('action','alpha');
|
||||
|
||||
// Security check
|
||||
|
||||
@ -1013,7 +1013,7 @@ class Contact extends CommonObject
|
||||
// Initialise parameters
|
||||
$this->id=0;
|
||||
$this->specimen=1;
|
||||
$this->name = 'DOLIBARR';
|
||||
$this->lastname = 'DOLIBARR';
|
||||
$this->firstname = 'SPECIMEN';
|
||||
$this->address = '61 jump street';
|
||||
$this->zip = '75000';
|
||||
|
||||
@ -137,8 +137,6 @@ if (empty($reshook))
|
||||
$object->address = $_POST["address"];
|
||||
$object->zip = $_POST["zipcode"];
|
||||
$object->town = $_POST["town"];
|
||||
$object->fk_pays = $_POST["country_id"];
|
||||
$object->fk_departement = $_POST["departement_id"];
|
||||
$object->country_id = $_POST["country_id"];
|
||||
$object->state_id = $_POST["departement_id"];
|
||||
$object->email = $_POST["email"];
|
||||
@ -229,8 +227,6 @@ if (empty($reshook))
|
||||
$object->address = $_POST["address"];
|
||||
$object->zip = $_POST["zipcode"];
|
||||
$object->town = $_POST["town"];
|
||||
$object->fk_departement = $_POST["departement_id"];
|
||||
$object->fk_pays = $_POST["country_id"];
|
||||
$object->state_id = $_POST["departement_id"];
|
||||
$object->country_id = $_POST["country_id"];
|
||||
|
||||
@ -338,15 +334,13 @@ else
|
||||
*/
|
||||
$object->canvas=$canvas;
|
||||
|
||||
$object->fk_departement = $_POST["departement_id"];
|
||||
$object->state_id = $_POST["state_id"];
|
||||
|
||||
// We set country_id, country_code and label for the selected country
|
||||
$object->country_id=$_POST["country_id"]?$_POST["country_id"]:$mysoc->country_id;
|
||||
if ($object->country_id)
|
||||
{
|
||||
$tmparray=getCountry($object->country_id,'all');
|
||||
$object->pays_code = $tmparray['code'];
|
||||
$object->pays = $tmparray['label'];
|
||||
$object->country_code = $tmparray['code'];
|
||||
$object->country = $tmparray['label'];
|
||||
}
|
||||
@ -414,8 +408,8 @@ else
|
||||
if (($objsoc->typent_code == 'TE_PRIVATE' || ! empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->zip)) == 0) $object->zip = $objsoc->zip; // Predefined with third party
|
||||
if (($objsoc->typent_code == 'TE_PRIVATE' || ! empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->town)) == 0) $object->town = $objsoc->town; // Predefined with third party
|
||||
print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td colspan="3">';
|
||||
print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$object->zip),'zipcode',array('town','selectcountry_id','departement_id'),6).' ';
|
||||
print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$object->town),'town',array('zipcode','selectcountry_id','departement_id'));
|
||||
print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$object->zip),'zipcode',array('town','selectcountry_id','state_id'),6).' ';
|
||||
print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$object->town),'town',array('zipcode','selectcountry_id','state_id'));
|
||||
print '</td></tr>';
|
||||
|
||||
// Country
|
||||
@ -431,7 +425,7 @@ else
|
||||
print '<tr><td>'.$langs->trans('State').'</td><td colspan="3">';
|
||||
if ($object->country_id)
|
||||
{
|
||||
print $formcompany->select_state(isset($_POST["departement_id"])?$_POST["departement_id"]:$object->fk_departement,$object->country_code);
|
||||
print $formcompany->select_state(isset($_POST["state_id"])?$_POST["state_id"]:$object->state_id,$object->country_code,'state_id');
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -583,8 +577,8 @@ else
|
||||
|
||||
// Zip / Town
|
||||
print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td colspan="3">';
|
||||
print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$object->zip),'zipcode',array('town','selectcountry_id','departement_id'),6).' ';
|
||||
print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$object->town),'town',array('zipcode','selectcountry_id','departement_id'));
|
||||
print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$object->zip),'zipcode',array('town','selectcountry_id','state_id'),6).' ';
|
||||
print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$object->town),'town',array('zipcode','selectcountry_id','state_id'));
|
||||
print '</td></tr>';
|
||||
|
||||
// Country
|
||||
@ -597,7 +591,7 @@ else
|
||||
if (empty($conf->global->SOCIETE_DISABLE_STATE))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans('State').'</td><td colspan="3">';
|
||||
print $formcompany->select_state($object->fk_departement,isset($_POST["country_id"])?$_POST["country_id"]:$object->country_id);
|
||||
print $formcompany->select_state($object->state_id,isset($_POST["country_id"])?$_POST["country_id"]:$object->country_id,'state_id');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -785,7 +779,7 @@ else
|
||||
// State
|
||||
if (empty($conf->global->SOCIETE_DISABLE_STATE))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans('State').'</td><td colspan="3">'.$object->departement.'</td>';
|
||||
print '<tr><td>'.$langs->trans('State').'</td><td colspan="3">'.$object->state.'</td>';
|
||||
}
|
||||
|
||||
// Phone
|
||||
|
||||
@ -791,35 +791,35 @@ class Contrat extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
// Appel des triggers
|
||||
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('CONTRACT_DELETE',$this,$user,$langs,$conf);
|
||||
if ($result < 0) {
|
||||
$error++; $this->errors=$interface->errors;
|
||||
}
|
||||
// Fin appel triggers
|
||||
if (! $error)
|
||||
{
|
||||
// Appel des triggers
|
||||
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('CONTRACT_DELETE',$this,$user,$langs,$conf);
|
||||
if ($result < 0) {
|
||||
$error++; $this->errors=$interface->errors;
|
||||
}
|
||||
// Fin appel triggers
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
// We remove directory
|
||||
$ref = dol_sanitizeFileName($this->ref);
|
||||
if ($conf->contrat->dir_output)
|
||||
{
|
||||
$dir = $conf->contrat->dir_output . "/" . $ref;
|
||||
if (file_exists($dir))
|
||||
{
|
||||
$res=@dol_delete_dir_recursive($dir);
|
||||
if (! $res)
|
||||
{
|
||||
$this->error='ErrorFailToDeleteDir';
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (! $error)
|
||||
{
|
||||
// We remove directory
|
||||
$ref = dol_sanitizeFileName($this->ref);
|
||||
if ($conf->contrat->dir_output)
|
||||
{
|
||||
$dir = $conf->contrat->dir_output . "/" . $ref;
|
||||
if (file_exists($dir))
|
||||
{
|
||||
$res=@dol_delete_dir_recursive($dir);
|
||||
if (! $res)
|
||||
{
|
||||
$this->error='ErrorFailToDeleteDir';
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
|
||||
@ -168,9 +168,9 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
// Contacts lines
|
||||
print '<br>';
|
||||
|
||||
// Contacts lines
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/contacts.tpl.php');
|
||||
|
||||
}
|
||||
|
||||
@ -36,16 +36,16 @@ $langs->load("other");
|
||||
$langs->load("products");
|
||||
|
||||
|
||||
$action = GETPOST('action','alpha');
|
||||
$confirm = GETPOST('confirm','alpha');
|
||||
$id = GETPOST('id','int');
|
||||
$action = GETPOST('action','alpha');
|
||||
$confirm = GETPOST('confirm','alpha');
|
||||
$id = GETPOST('id','int');
|
||||
$ref = GETPOST('ref','alpha');
|
||||
|
||||
$mesg='';
|
||||
if (isset($_SESSION['DolMessage']))
|
||||
{
|
||||
$mesg=$_SESSION['DolMessage'];
|
||||
unset($_SESSION['DolMessage']);
|
||||
$mesg='';
|
||||
if (isset($_SESSION['DolMessage']))
|
||||
{
|
||||
$mesg=$_SESSION['DolMessage'];
|
||||
unset($_SESSION['DolMessage']);
|
||||
}
|
||||
|
||||
// Security check
|
||||
@ -120,19 +120,19 @@ if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
}
|
||||
}
|
||||
|
||||
// Delete
|
||||
if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
||||
{
|
||||
if ($object->id)
|
||||
{
|
||||
$langs->load("other");
|
||||
|
||||
$file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
|
||||
$ret=dol_delete_file($file,0,0,0,$object);
|
||||
$_SESSION['DolMessage'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
|
||||
exit;
|
||||
}
|
||||
// Delete
|
||||
if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
||||
{
|
||||
if ($object->id)
|
||||
{
|
||||
$langs->load("other");
|
||||
|
||||
$file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
|
||||
$ret=dol_delete_file($file,0,0,0,$object);
|
||||
$_SESSION['DolMessage'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -178,13 +178,13 @@ if ($object->id)
|
||||
|
||||
dol_htmloutput_mesg($mesg,$mesgs);
|
||||
|
||||
/*
|
||||
/*
|
||||
* Confirmation suppression fichier
|
||||
*/
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$id.'&urlfile='.urlencode(GETPOST("urlfile")), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1);
|
||||
if ($ret == 'html') print '<br>';
|
||||
*/
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$id.'&urlfile='.urlencode(GETPOST("urlfile")), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1);
|
||||
if ($ret == 'html') print '<br>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -428,113 +428,113 @@ else if ($action == 'confirm_close' && $confirm == 'yes' && $user->rights->contr
|
||||
else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->contrat->supprimer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->fetch_thirdparty();
|
||||
$result=$object->delete($user);
|
||||
if ($result >= 0)
|
||||
{
|
||||
Header("Location: index.php");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$object->error.'</div>';
|
||||
$object->fetch_thirdparty();
|
||||
$result=$object->delete($user);
|
||||
if ($result >= 0)
|
||||
{
|
||||
Header("Location: index.php");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$object->error.'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
else if ($action == 'confirm_move' && $confirm == 'yes' && $user->rights->contrat->creer)
|
||||
{
|
||||
if ($_POST['newcid'] > 0)
|
||||
{
|
||||
$contractline = new ContratLigne($db);
|
||||
$result=$contractline->fetch($_GET["lineid"]);
|
||||
$contractline->fk_contrat = $_POST["newcid"];
|
||||
$result=$contractline->update($user,1);
|
||||
if ($result >= 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$object->error.'</div>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("RefNewContract")).'</div>';
|
||||
if ($_POST['newcid'] > 0)
|
||||
{
|
||||
$contractline = new ContratLigne($db);
|
||||
$result=$contractline->fetch($_GET["lineid"]);
|
||||
$contractline->fk_contrat = $_POST["newcid"];
|
||||
$result=$contractline->update($user,1);
|
||||
if ($result >= 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$object->error.'</div>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("RefNewContract")).'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
else if ($action == 'setnote_public' && $user->rights->contrat->creer)
|
||||
{
|
||||
$result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
else if ($action == 'setnote' && $user->rights->contrat->creer)
|
||||
{
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
else if ($action == 'setnote_public' && $user->rights->contrat->creer)
|
||||
{
|
||||
$result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
else if ($action == 'setnote' && $user->rights->contrat->creer)
|
||||
{
|
||||
if ($action == 'addcontact' && $user->rights->contrat->creer)
|
||||
{
|
||||
$result = $object->fetch($id);
|
||||
|
||||
if ($result > 0 && $id > 0)
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
{
|
||||
if ($action == 'addcontact' && $user->rights->contrat->creer)
|
||||
{
|
||||
$result = $object->fetch($id);
|
||||
|
||||
if ($result > 0 && $id > 0)
|
||||
{
|
||||
$contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'));
|
||||
$result = $result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]);
|
||||
}
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
{
|
||||
$langs->load("errors");
|
||||
$mesg = '<div class="error">'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg = '<div class="error">'.$object->error.'</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// bascule du statut d'un contact
|
||||
else if ($action == 'swapstatut' && $user->rights->contrat->creer)
|
||||
{
|
||||
if ($object->fetch($id))
|
||||
{
|
||||
$result=$object->swapContactStatus(GETPOST('ligne'));
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
// Efface un contact
|
||||
else if ($action == 'deletecontact' && $user->rights->contrat->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result = $object->delete_contact($_GET["lineid"]);
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
$contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'));
|
||||
$result = $result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]);
|
||||
}
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
{
|
||||
$langs->load("errors");
|
||||
$mesg = '<div class="error">'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg = '<div class="error">'.$object->error.'</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// bascule du statut d'un contact
|
||||
else if ($action == 'swapstatut' && $user->rights->contrat->creer)
|
||||
{
|
||||
if ($object->fetch($id))
|
||||
{
|
||||
$result=$object->swapContactStatus(GETPOST('ligne'));
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
// Efface un contact
|
||||
else if ($action == 'deletecontact' && $user->rights->contrat->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result = $object->delete_contact($_GET["lineid"]);
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -783,21 +783,21 @@ else
|
||||
|
||||
echo '<br>';
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
|
||||
$formcompany= new FormCompany($db);
|
||||
|
||||
$blocname = 'contacts';
|
||||
$title = $langs->trans('ContactsAddresses');
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php');
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_NOTES_TAB))
|
||||
{
|
||||
$blocname = 'notes';
|
||||
$title = $langs->trans('Notes');
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php');
|
||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
|
||||
$formcompany= new FormCompany($db);
|
||||
|
||||
$blocname = 'contacts';
|
||||
$title = $langs->trans('ContactsAddresses');
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php');
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_NOTES_TAB))
|
||||
{
|
||||
$blocname = 'notes';
|
||||
$title = $langs->trans('Notes');
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php');
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -30,9 +30,9 @@ require_once(DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php");
|
||||
$langs->load("companies");
|
||||
$langs->load("contracts");
|
||||
|
||||
$action=GETPOST('action','alpha');
|
||||
$confirm=GETPOST('confirm','alpha');
|
||||
$socid=GETPOST('socid','int');
|
||||
$action=GETPOST('action','alpha');
|
||||
$confirm=GETPOST('confirm','alpha');
|
||||
$socid=GETPOST('socid','int');
|
||||
$id=GETPOST('id','int');
|
||||
$ref=GETPOST('ref','alpha');
|
||||
|
||||
|
||||
@ -31,7 +31,8 @@ if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
|
||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
|
||||
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
||||
|
||||
if (! isset($mode) || $mode != 'noajax')
|
||||
|
||||
if (! isset($mode) || $mode != 'noajax') // For ajax call
|
||||
{
|
||||
require_once("../../main.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php');
|
||||
@ -54,7 +55,7 @@ if (! isset($mode) || $mode != 'noajax')
|
||||
exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
else // For no ajax call
|
||||
{
|
||||
$ecmdir = new EcmDirectory($db);
|
||||
$relativepath='';
|
||||
@ -124,11 +125,11 @@ if (! dol_is_dir($upload_dir))
|
||||
}
|
||||
|
||||
print '<!-- TYPE='.$type.' -->'."\n";
|
||||
print '<!-- Ajax page called with url '.$_SERVER["PHP_SELF"].'?'.$_SERVER["QUERY_STRING"].' -->'."\n";
|
||||
print '<!-- Page called with mode='.$mode.' url='.$_SERVER["PHP_SELF"].'?'.$_SERVER["QUERY_STRING"].' -->'."\n";
|
||||
|
||||
$param='';
|
||||
|
||||
// Dir
|
||||
// Dir scan
|
||||
if ($type == 'directory')
|
||||
{
|
||||
$formfile=new FormFile($db);
|
||||
@ -136,7 +137,7 @@ if ($type == 'directory')
|
||||
$param.=($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:'');
|
||||
$maxlengthname=40;
|
||||
|
||||
// Right area
|
||||
// Right area. If module is defined, we are in automatic ecm.
|
||||
if ($module == 'company') // Auto area for suppliers invoices
|
||||
{
|
||||
$upload_dir = $conf->societe->dir_output; // TODO change for multicompany sharing
|
||||
|
||||
@ -33,13 +33,14 @@ if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
||||
|
||||
$res=@include("../../main.inc.php");
|
||||
include_once(DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php');
|
||||
include_once(DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php');
|
||||
include_once(DOL_DOCUMENT_ROOT.'/core/lib/treeview.lib.php');
|
||||
include_once(DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php');
|
||||
include_once(DOL_DOCUMENT_ROOT."/ecm/class/ecmdirectory.class.php");
|
||||
|
||||
$openeddir = GETPOST('openeddir');
|
||||
$modulepart= GETPOST('modulepart');
|
||||
$selecteddir = urldecode(GETPOST('dir')); // relative patch. We must keep the urldecode here because para comes from jqueyrFileTree that url encode it.
|
||||
$selecteddir = jsUnEscape(GETPOST('dir')); // relative path. We must decode using same encoding function used by javascript: escape()
|
||||
if ($selecteddir != '/') $selecteddir = preg_replace('/\/$/','',$selecteddir); // We removed last '/' except if it is '/'
|
||||
|
||||
$langs->load("ecm");
|
||||
@ -89,7 +90,6 @@ foreach($sqltree as $keycursor => $val)
|
||||
}
|
||||
}
|
||||
|
||||
//var_dump($sqltree);
|
||||
|
||||
if( file_exists($fullpathselecteddir) )
|
||||
{
|
||||
@ -111,6 +111,7 @@ if( file_exists($fullpathselecteddir) )
|
||||
|
||||
// Try to find key into $sqltree
|
||||
$val=array();
|
||||
|
||||
foreach($sqltree as $key => $tmpval)
|
||||
{
|
||||
//print "-- ".$val['fullrelativename']." vs ".(($selecteddir != '/'?$selecteddir.'/':'').$file).'<br>';
|
||||
|
||||
@ -57,7 +57,7 @@ header('Access-Control-Allow-Methods: OPTIONS, HEAD, GET, POST, PUT, DELETE');
|
||||
header('Access-Control-Allow-Headers: X-File-Name, X-File-Type, X-File-Size');
|
||||
|
||||
switch ($_SERVER['REQUEST_METHOD']) {
|
||||
case 'OPTIONS':
|
||||
case 'OPTIONS':
|
||||
break;
|
||||
case 'HEAD':
|
||||
case 'GET':
|
||||
|
||||
@ -90,7 +90,7 @@ if (! empty($field) && ! empty($element) && ! empty($table_element) && ! empty($
|
||||
$module = $subelement = $ext_element;
|
||||
if (preg_match('/^([^_]+)_([^_]+)/i',$ext_element,$regs))
|
||||
{
|
||||
$module = $regs[1];
|
||||
$module = $regs[1];
|
||||
$subelement = $regs[2];
|
||||
}
|
||||
|
||||
|
||||
@ -30,9 +30,9 @@ if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
||||
require('../../main.inc.php');
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/genericobject.class.php");
|
||||
|
||||
$field = GETPOST('field','alpha',2);
|
||||
$element = GETPOST('element','alpha',2);
|
||||
$table_element = GETPOST('table_element','alpha',2);
|
||||
$field = GETPOST('field','alpha',2);
|
||||
$element = GETPOST('element','alpha',2);
|
||||
$table_element = GETPOST('table_element','alpha',2);
|
||||
$fk_element = GETPOST('fk_element','alpha',2);
|
||||
|
||||
/*
|
||||
@ -132,11 +132,11 @@ if (! empty($field) && ! empty($element) && ! empty($table_element) && ! empty($
|
||||
}
|
||||
else
|
||||
{
|
||||
$module = $subelement = $ext_element;
|
||||
if (preg_match('/^([^_]+)_([^_]+)/i',$ext_element,$regs))
|
||||
{
|
||||
$module = $regs[1];
|
||||
$subelement = $regs[2];
|
||||
$module = $subelement = $ext_element;
|
||||
if (preg_match('/^([^_]+)_([^_]+)/i',$ext_element,$regs))
|
||||
{
|
||||
$module = $regs[1];
|
||||
$subelement = $regs[2];
|
||||
}
|
||||
|
||||
dol_include_once('/'.$module.'/class/actions_'.$subelement.'.class.php');
|
||||
|
||||
@ -49,12 +49,12 @@ if (! empty($id) && ! empty($action) && ! empty($htmlname))
|
||||
|
||||
$soc->fetch($id);
|
||||
|
||||
$return=array();
|
||||
|
||||
$return['value'] = $form->load_tva('tva_tx','',$soc,$mysoc,0,0,'',true);
|
||||
$return['num'] = $form->num;
|
||||
$return['error'] = $form->error;
|
||||
|
||||
$return=array();
|
||||
|
||||
$return['value'] = $form->load_tva('tva_tx','',$soc,$mysoc,0,0,'',true);
|
||||
$return['num'] = $form->num;
|
||||
$return['error'] = $form->error;
|
||||
|
||||
echo json_encode($return);
|
||||
}
|
||||
|
||||
|
||||
@ -47,7 +47,7 @@ top_httphead();
|
||||
|
||||
//print '<!-- Ajax page called with url '.$_SERVER["PHP_SELF"].'?'.$_SERVER["QUERY_STRING"].' -->'."\n";
|
||||
|
||||
dol_syslog("GET is ".join(',',$_GET));
|
||||
dol_syslog("GET is ".join(',',$_GET).', MAIN_USE_ZIPTOWN_DICTIONNARY='.(empty($conf->global->MAIN_USE_ZIPTOWN_DICTIONNARY)?'':$conf->global->MAIN_USE_ZIPTOWN_DICTIONNARY));
|
||||
//var_dump($_GET);
|
||||
|
||||
// Generation of list of zip-town
|
||||
@ -133,4 +133,6 @@ else
|
||||
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
?>
|
||||
|
||||
227
htdocs/core/boxes/box_activity.php
Normal file
227
htdocs/core/boxes/box_activity.php
Normal file
@ -0,0 +1,227 @@
|
||||
<?php
|
||||
/* Copyright (C) 2012 Charles-François BENKE <charles.fr@benke.fr>
|
||||
* 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 2 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/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/boxes/box_activity.php
|
||||
* \ingroup societes
|
||||
* \brief Module to show box of bills, orders & propal of the current year
|
||||
*/
|
||||
|
||||
include_once(DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php");
|
||||
|
||||
class box_activity extends ModeleBoxes
|
||||
{
|
||||
var $boxcode="activity";
|
||||
var $boximg="object_bill";
|
||||
var $boxlabel;
|
||||
var $depends = array("facture");
|
||||
|
||||
var $db;
|
||||
var $param;
|
||||
|
||||
var $info_box_head = array();
|
||||
var $info_box_contents = array();
|
||||
|
||||
/**
|
||||
* \brief Constructeur de la classe
|
||||
*/
|
||||
function box_activity()
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("boxes");
|
||||
$langs->load("bills");
|
||||
$langs->load("projects");
|
||||
$langs->trans("orders");
|
||||
|
||||
$this->boxlabel=$langs->transnoentitiesnoconv("BoxGlobalActivity");
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Charge les donnees en memoire pour affichage ulterieur
|
||||
* \param $max Nombre maximum d'enregistrements a charger
|
||||
*/
|
||||
function loadBox()
|
||||
{
|
||||
global $conf, $user, $langs, $db;
|
||||
|
||||
$totalMnt = 0;
|
||||
$totalnb = 0;
|
||||
|
||||
include_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php");
|
||||
include_once(DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php");
|
||||
include_once(DOL_DOCUMENT_ROOT."/commande/class/commande.class.php");
|
||||
$facturestatic=new Facture($db);
|
||||
$propalstatic=new Propal($db);
|
||||
$commandestatic=new Commande($db);
|
||||
|
||||
$textHead = $langs->trans("Activity")." ".date("Y");
|
||||
$this->info_box_head = array('text' => $textHead, 'limit'=> dol_strlen($textHead));
|
||||
|
||||
// list the summary of the bills
|
||||
if ($conf->facture->enabled && $user->rights->facture->lire)
|
||||
{
|
||||
$sql = "SELECT f.paye, f.fk_statut, sum(f.total_ttc) as Mnttot, count(*) as nb";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= " WHERE f.entity = ".$conf->entity;
|
||||
$sql.= " AND f.fk_soc = s.rowid";
|
||||
$sql.= " AND (DATE_FORMAT(f.datef,'%Y') = ".date("Y")." or paye=0)";
|
||||
$sql.= " GROUP BY f.paye, f.fk_statut ";
|
||||
$sql.= " ORDER BY f.fk_statut DESC";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$now=gmmktime();
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
|
||||
'logo' => 'bill');
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
|
||||
'text' => $langs->trans("Bills")." ".$facturestatic->LibStatut($objp->paye,$objp->fk_statut,0));
|
||||
|
||||
if($objp->fk_statut==0)
|
||||
{ // draft
|
||||
$billurl="viewstatut=0&paye=0";
|
||||
} elseif($objp->fk_statut==1)
|
||||
{ // unpaid
|
||||
$billurl="viewstatut=1&paye=0";
|
||||
} else
|
||||
{ // paid for current year
|
||||
$billurl="viewstatut=2&paye=1";
|
||||
}
|
||||
$this->info_box_contents[$i][2] = array('td' => 'align="right"',
|
||||
'text' => $objp->nb, 'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills"
|
||||
);
|
||||
$totalnb += $objp->nb;
|
||||
$this->info_box_contents[$i][3] = array('td' => 'align="right"',
|
||||
'text' => dol_trunc(number_format($objp->Mnttot, 0, ',', ' '),40)." ".getCurrencySymbol($conf->currency)
|
||||
);
|
||||
$totalMnt += $objp->Mnttot;
|
||||
$this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"',
|
||||
'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3)
|
||||
);
|
||||
$i++;
|
||||
}
|
||||
if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedInvoices"));
|
||||
} else {
|
||||
$this->info_box_contents[0][0] = array( 'td' => 'align="left"', 'maxlength'=>500, 'text' => ($db->error().' sql='.$sql));
|
||||
}
|
||||
}
|
||||
|
||||
// list the summary of the orders
|
||||
if ($conf->commande->enabled && $user->rights->commande->lire)
|
||||
{
|
||||
$sql = "SELECT c.fk_statut,c.facture, sum(c.total_ttc) as Mnttot, count(*) as nb";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c";
|
||||
$sql.= " WHERE c.entity = ".$conf->entity;
|
||||
$sql.= " AND c.fk_soc = s.rowid";
|
||||
$sql.= " AND c.facture=0";
|
||||
$sql.= " GROUP BY c.fk_statut";
|
||||
$sql.= " ORDER BY c.fk_statut DESC";
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result)+$i;
|
||||
while ($i < $num)
|
||||
{
|
||||
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"','logo' => 'object_order');
|
||||
|
||||
$objp = $db->fetch_object($result);
|
||||
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
|
||||
'text' =>$langs->trans("Orders")." ".$commandestatic->LibStatut($objp->fk_statut,$objp->facture,0)
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][2] = array('td' => 'align="right"',
|
||||
'text' => $objp->nb,
|
||||
'url' => DOL_URL_ROOT."/commande/liste.php?mainmenu=commercial&leftmenu=orders&viewstatut=".$objp->fk_statut
|
||||
);
|
||||
$totalnb += $objp->nb;
|
||||
|
||||
$this->info_box_contents[$i][3] = array('td' => 'align="right"',
|
||||
'text' => dol_trunc(number_format($objp->Mnttot, 0, ',', ' '),40)." ".getCurrencySymbol($conf->currency)
|
||||
);
|
||||
$totalMnt += $objp->Mnttot;
|
||||
$this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"', 'text' => $commandestatic->LibStatut($objp->fk_statut,$objp->facture,3));
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// list the summary of the propals
|
||||
if ($conf->propal->enabled && $user->rights->propal->lire)
|
||||
{
|
||||
$sql = "SELECT p.fk_statut, sum(p.total) as Mnttot, count(*) as nb";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p";
|
||||
$sql.= " WHERE p.entity = ".$conf->entity;
|
||||
$sql.= " AND p.fk_soc = s.rowid";
|
||||
$sql.= " AND DATE_FORMAT(p.datep,'%Y') = ".date("Y");
|
||||
$sql.= " AND p.date_cloture IS NULL "; // just unclosed
|
||||
$sql.= " GROUP BY p.fk_statut";
|
||||
$sql.= " ORDER BY p.fk_statut DESC";
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result)+$i;
|
||||
while ($i < $num)
|
||||
{
|
||||
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"','logo' => 'object_propal');
|
||||
|
||||
$objp = $db->fetch_object($result);
|
||||
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
|
||||
'text' =>$langs->trans("Proposals")." ".$propalstatic->LibStatut($objp->fk_statut,0)
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][2] = array('td' => 'align="right"',
|
||||
'text' => $objp->nb,
|
||||
'url' => DOL_URL_ROOT."/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&viewstatut=".$objp->fk_statut
|
||||
);
|
||||
$totalnb += $objp->nb;
|
||||
|
||||
$this->info_box_contents[$i][3] = array('td' => 'align="right"',
|
||||
'text' => dol_trunc(number_format($objp->Mnttot, 0, ',', ' '),40)." ".getCurrencySymbol($conf->currency)
|
||||
);
|
||||
$totalMnt += $objp->Mnttot;
|
||||
$this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"', 'text' => $propalstatic->LibStatut($objp->fk_statut,3));
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add the sum in the bottom of the boxes
|
||||
$this->info_box_contents[$i][1] = array('td' => 'align="left" ', 'text' => $langs->trans("Total")." ".$textHead);
|
||||
$this->info_box_contents[$i][2] = array('td' => 'align="right" ', 'text' => number_format($totalnb, 0, ',', ' '));
|
||||
$this->info_box_contents[$i][3] = array('td' => 'align="right" ', 'text' => number_format($totalMnt, 0, ',', ' ')." ".getCurrencySymbol($conf->currency));
|
||||
$this->info_box_contents[$i][4] = array('td' => 'align="right" ', 'text' => "");
|
||||
$this->info_box_contents[$i][5] = array('td' => 'align="right"', 'text' => "");
|
||||
}
|
||||
|
||||
function showBox($head = null, $contents = null)
|
||||
{
|
||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -71,8 +71,10 @@ class box_contacts extends ModeleBoxes
|
||||
|
||||
if ($user->rights->societe->lire)
|
||||
{
|
||||
$sql = "SELECT sp.rowid, sp.name, sp.firstname, sp.civilite, sp.datec, sp.tms";
|
||||
$sql = "SELECT sp.rowid, sp.name, sp.firstname, sp.civilite, sp.datec, sp.tms, sp.fk_soc,";
|
||||
$sql.= " s.nom as socname";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON sp.fk_soc = s.rowid";
|
||||
if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE sp.entity IN (".getEntity('societe', 1).")";
|
||||
if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " AND sp.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
@ -87,6 +89,7 @@ class box_contacts extends ModeleBoxes
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
$contactstatic=new Contact($db);
|
||||
$societestatic=new Societe($db);
|
||||
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
@ -99,6 +102,9 @@ class box_contacts extends ModeleBoxes
|
||||
$contactstatic->firstname=$objp->firstname;
|
||||
$contactstatic->civilite_id=$objp->civilite;
|
||||
|
||||
$societestatic->id=$objp->fk_soc;
|
||||
$societestatic->name=$objp->socname;
|
||||
|
||||
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
|
||||
'logo' => $this->boximg,
|
||||
'url' => DOL_URL_ROOT."/contact/fiche.php?id=".$objp->rowid);
|
||||
@ -107,7 +113,15 @@ class box_contacts extends ModeleBoxes
|
||||
'text' => $contactstatic->getFullName($langs,1),
|
||||
'url' => DOL_URL_ROOT."/contact/fiche.php?id=".$objp->rowid);
|
||||
|
||||
$this->info_box_contents[$i][2] = array('td' => 'align="right"',
|
||||
$this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"',
|
||||
'logo' => ($objp->fk_soc > 0?'company':''),
|
||||
'url' => ($objp->fk_soc > 0?DOL_URL_ROOT."/societe/soc.php?socid=".$objp->fk_soc:''));
|
||||
|
||||
$this->info_box_contents[$i][3] = array('td' => 'align="left"',
|
||||
'text' => $societestatic->name,
|
||||
'url' => DOL_URL_ROOT."/societe/soc.php?socid=".$objp->fk_soc);
|
||||
|
||||
$this->info_box_contents[$i][4] = array('td' => 'align="right"',
|
||||
'text' => dol_print_date($datem, "day"));
|
||||
|
||||
$i++;
|
||||
|
||||
@ -1646,7 +1646,7 @@ abstract class CommonObject
|
||||
|
||||
$sourceid = (! empty($sourceid) ? $sourceid : $this->id);
|
||||
$targetid = (! empty($targetid) ? $targetid : $this->id);
|
||||
$sourcetype = (! empty($sourcetype) ? $sourcetype : (! empty($this->origin) ? $this->origin : $this->element));
|
||||
$sourcetype = (! empty($sourcetype) ? $sourcetype : $this->element);
|
||||
$targettype = (! empty($targettype) ? $targettype : $this->element);
|
||||
|
||||
// Links beetween objects are stored in this table
|
||||
@ -2283,6 +2283,9 @@ abstract class CommonObject
|
||||
if ($objecttype == 'member') {
|
||||
$classpath = 'adherents/class'; $module='adherent'; $subelement='adherent';
|
||||
}
|
||||
if ($objecttype == 'cabinetmed_cons') {
|
||||
$classpath = 'cabinetmed/class'; $module='cabinetmed'; $subelement='cabinetmedcons';
|
||||
}
|
||||
|
||||
//print "objecttype=".$objecttype." module=".$module." subelement=".$subelement;
|
||||
|
||||
@ -2294,13 +2297,15 @@ abstract class CommonObject
|
||||
$classfile = 'fournisseur.commande'; $classname='CommandeFournisseur';
|
||||
}
|
||||
|
||||
if ($conf->$module->enabled)
|
||||
if (! empty($conf->$module->enabled))
|
||||
{
|
||||
dol_include_once('/'.$classpath.'/'.$classfile.'.class.php');
|
||||
|
||||
$object = new $classname($this->db);
|
||||
$ret=$object->fetch($objectid);
|
||||
if ($ret > 0) return $object->getNomUrl($withpicto,$option);
|
||||
$res=dol_include_once('/'.$classpath.'/'.$classfile.'.class.php');
|
||||
if ($res)
|
||||
{
|
||||
$object = new $classname($this->db);
|
||||
$ret=$object->fetch($objectid);
|
||||
if ($ret > 0) return $object->getNomUrl($withpicto,$option);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -206,28 +206,28 @@ class Conf
|
||||
//var_dump($this->modules);
|
||||
//var_dump($this->modules_parts);
|
||||
|
||||
// Object $mc
|
||||
if (! defined('NOREQUIREMC') && ! empty($this->multicompany->enabled))
|
||||
{
|
||||
global $mc;
|
||||
$ret = @dol_include_once('/multicompany/class/actions_multicompany.class.php');
|
||||
if ($ret) $mc = new ActionsMulticompany($db);
|
||||
// Object $mc
|
||||
if (! defined('NOREQUIREMC') && ! empty($this->multicompany->enabled))
|
||||
{
|
||||
global $mc;
|
||||
$ret = @dol_include_once('/multicompany/class/actions_multicompany.class.php');
|
||||
if ($ret) $mc = new ActionsMulticompany($db);
|
||||
}
|
||||
|
||||
// Second or others levels object
|
||||
$this->propal->cloture = (object) array();
|
||||
$this->propal->cloture = (object) array();
|
||||
$this->propal->facturation = (object) array();
|
||||
$this->commande->client = (object) array();
|
||||
$this->commande->client = (object) array();
|
||||
$this->commande->fournisseur = (object) array();
|
||||
$this->facture->client = (object) array();
|
||||
$this->facture->client = (object) array();
|
||||
$this->facture->fournisseur = (object) array();
|
||||
$this->fournisseur->commande = (object) array();
|
||||
$this->fournisseur->commande = (object) array();
|
||||
$this->fournisseur->facture = (object) array();
|
||||
$this->contrat->services = (object) array();
|
||||
$this->contrat->services->inactifs = (object) array();
|
||||
$this->contrat->services = (object) array();
|
||||
$this->contrat->services->inactifs = (object) array();
|
||||
$this->contrat->services->expires = (object) array();
|
||||
$this->adherent->cotisation = (object) array();
|
||||
$this->bank->rappro = (object) array();
|
||||
$this->bank->rappro = (object) array();
|
||||
$this->bank->cheque = (object) array();
|
||||
|
||||
// Clean some variables
|
||||
@ -261,7 +261,7 @@ class Conf
|
||||
// Define default dir_output and dir_temp for directories of modules
|
||||
foreach($this->modules as $module)
|
||||
{
|
||||
$this->$module->multidir_output = array($this->entity => $rootfordata."/".$module);
|
||||
$this->$module->multidir_output = array($this->entity => $rootfordata."/".$module);
|
||||
$this->$module->multidir_temp = array($this->entity => $rootfordata."/".$module."/temp");
|
||||
// For backward compatibility
|
||||
$this->$module->dir_output = $rootfordata."/".$module;
|
||||
@ -277,14 +277,14 @@ class Conf
|
||||
$this->admin->dir_temp=$rootfordata.'/admin/temp';
|
||||
|
||||
// For user storage
|
||||
$this->user->multidir_output = array($this->entity => $rootfordata."/users");
|
||||
$this->user->multidir_output = array($this->entity => $rootfordata."/users");
|
||||
$this->user->multidir_temp = array($this->entity => $rootfordata."/users/temp");
|
||||
// For backward compatibility
|
||||
$this->user->dir_output=$rootforuser."/users";
|
||||
$this->user->dir_temp=$rootforuser."/users/temp";
|
||||
|
||||
// For propal storage
|
||||
$this->propal->dir_output=$rootforuser."/propale";
|
||||
// For propal storage
|
||||
$this->propal->dir_output=$rootforuser."/propale";
|
||||
$this->propal->dir_temp=$rootforuser."/propale/temp";
|
||||
|
||||
// Exception: Some dir are not the name of module. So we keep exception here
|
||||
@ -307,9 +307,9 @@ class Conf
|
||||
$this->service->multidir_output=array($this->entity => $rootfordata."/produit");
|
||||
$this->service->multidir_temp =array($this->entity => $rootfordata."/produit/temp");
|
||||
// For backward compatibility
|
||||
$this->product->dir_output=$rootfordata."/produit";
|
||||
$this->product->dir_temp =$rootfordata."/produit/temp";
|
||||
$this->service->dir_output=$rootfordata."/produit";
|
||||
$this->product->dir_output=$rootfordata."/produit";
|
||||
$this->product->dir_temp =$rootfordata."/produit/temp";
|
||||
$this->service->dir_output=$rootfordata."/produit";
|
||||
$this->service->dir_temp =$rootfordata."/produit/temp";
|
||||
|
||||
// Module contrat
|
||||
@ -429,10 +429,10 @@ class Conf
|
||||
if ($this->top_menu == 'eldy.php') $this->top_menu='eldy_backoffice.php';
|
||||
elseif ($this->top_menu == 'rodolphe.php') $this->top_menu='eldy_backoffice.php';
|
||||
|
||||
// Object $mc
|
||||
if (! defined('NOREQUIREMC') && ! empty($this->multicompany->enabled))
|
||||
// Object $mc
|
||||
if (! defined('NOREQUIREMC') && ! empty($this->multicompany->enabled))
|
||||
{
|
||||
if (is_object($mc)) $mc->setValues($this);
|
||||
if (is_object($mc)) $mc->setValues($this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,9 +65,9 @@ class FileUpload
|
||||
$pathname = 'compta/facture';
|
||||
$dir_output=$conf->$element->dir_output;
|
||||
}
|
||||
elseif ($element == 'project') {
|
||||
elseif ($element == 'project') {
|
||||
$element = $pathname = 'projet';
|
||||
$dir_output=$conf->$element->dir_output;
|
||||
$dir_output=$conf->$element->dir_output;
|
||||
}
|
||||
elseif ($element == 'fichinter') {
|
||||
$element='ficheinter';
|
||||
@ -108,11 +108,11 @@ class FileUpload
|
||||
'accept_file_types' => '/.+$/i',
|
||||
// The maximum number of files for the upload directory:
|
||||
'max_number_of_files' => null,
|
||||
// Image resolution restrictions:
|
||||
'max_width' => null,
|
||||
'max_height' => null,
|
||||
'min_width' => 1,
|
||||
'min_height' => 1,
|
||||
// Image resolution restrictions:
|
||||
'max_width' => null,
|
||||
'max_height' => null,
|
||||
'min_width' => 1,
|
||||
'min_height' => 1,
|
||||
// Set the following option to false to enable resumable uploads:
|
||||
'discard_aborted_uploads' => true,
|
||||
'image_versions' => array(
|
||||
@ -131,7 +131,7 @@ class FileUpload
|
||||
'thumbnail' => array(
|
||||
'upload_dir' => $dir_output . '/' . $object->ref . '/thumbs/',
|
||||
'upload_url' => DOL_URL_ROOT.'/document.php?modulepart='.$element.'&attachment=1&file=/'.$object->ref.'/thumbs/',
|
||||
'max_width' => 80,
|
||||
'max_width' => 80,
|
||||
'max_height' => 80
|
||||
)
|
||||
)
|
||||
@ -148,14 +148,14 @@ class FileUpload
|
||||
*/
|
||||
protected function getFullUrl()
|
||||
{
|
||||
$https = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off';
|
||||
return
|
||||
($https ? 'https://' : 'http://').
|
||||
(!empty($_SERVER['REMOTE_USER']) ? $_SERVER['REMOTE_USER'].'@' : '').
|
||||
(isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : ($_SERVER['SERVER_NAME'].
|
||||
($https && $_SERVER['SERVER_PORT'] === 443 ||
|
||||
$_SERVER['SERVER_PORT'] === 80 ? '' : ':'.$_SERVER['SERVER_PORT']))).
|
||||
substr($_SERVER['SCRIPT_NAME'],0, strrpos($_SERVER['SCRIPT_NAME'], '/'));
|
||||
$https = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off';
|
||||
return
|
||||
($https ? 'https://' : 'http://').
|
||||
(!empty($_SERVER['REMOTE_USER']) ? $_SERVER['REMOTE_USER'].'@' : '').
|
||||
(isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : ($_SERVER['SERVER_NAME'].
|
||||
($https && $_SERVER['SERVER_PORT'] === 443 ||
|
||||
$_SERVER['SERVER_PORT'] === 80 ? '' : ':'.$_SERVER['SERVER_PORT']))).
|
||||
substr($_SERVER['SCRIPT_NAME'],0, strrpos($_SERVER['SCRIPT_NAME'], '/'));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -165,13 +165,13 @@ class FileUpload
|
||||
* @return void
|
||||
*/
|
||||
protected function setFileDeleteUrl($file)
|
||||
{
|
||||
$file->delete_url = $this->options['script_url']
|
||||
.'?file='.rawurlencode($file->name).'&fk_element='.$this->fk_element.'&element='.$this->element;
|
||||
$file->delete_type = $this->options['delete_type'];
|
||||
if ($file->delete_type !== 'DELETE') {
|
||||
$file->delete_url .= '&_method=DELETE';
|
||||
}
|
||||
{
|
||||
$file->delete_url = $this->options['script_url']
|
||||
.'?file='.rawurlencode($file->name).'&fk_element='.$this->fk_element.'&element='.$this->element;
|
||||
$file->delete_type = $this->options['delete_type'];
|
||||
if ($file->delete_type !== 'DELETE') {
|
||||
$file->delete_url .= '&_method=DELETE';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -260,9 +260,9 @@ class FileUpload
|
||||
$file->error = $error;
|
||||
return false;
|
||||
}
|
||||
if (!$file->name) {
|
||||
$file->error = 'missingFileName';
|
||||
return false;
|
||||
if (!$file->name) {
|
||||
$file->error = 'missingFileName';
|
||||
return false;
|
||||
}
|
||||
if (!preg_match($this->options['accept_file_types'], $file->name)) {
|
||||
$file->error = 'acceptFileTypes';
|
||||
@ -314,10 +314,10 @@ class FileUpload
|
||||
* @return string ???
|
||||
*/
|
||||
protected function upcountNameCallback($matches)
|
||||
{
|
||||
$index = isset($matches[1]) ? intval($matches[1]) + 1 : 1;
|
||||
$ext = isset($matches[2]) ? $matches[2] : '';
|
||||
return ' ('.$index.')'.$ext;
|
||||
{
|
||||
$index = isset($matches[1]) ? intval($matches[1]) + 1 : 1;
|
||||
$ext = isset($matches[2]) ? $matches[2] : '';
|
||||
return ' ('.$index.')'.$ext;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -327,8 +327,8 @@ class FileUpload
|
||||
* @return string ???
|
||||
*/
|
||||
protected function upcountName($name)
|
||||
{
|
||||
return preg_replace_callback('/(?:(?: \(([\d]+)\))?(\.[^.]+))?$/', array($this, 'upcountNameCallback'), $name, 1);
|
||||
{
|
||||
return preg_replace_callback('/(?:(?: \(([\d]+)\))?(\.[^.]+))?$/', array($this, 'upcountNameCallback'), $name, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -340,24 +340,24 @@ class FileUpload
|
||||
* @return void
|
||||
*/
|
||||
protected function trimFileName($name, $type, $index)
|
||||
{
|
||||
// Remove path information and dots around the filename, to prevent uploading
|
||||
// into different directories or replacing hidden system files.
|
||||
// Also remove control characters and spaces (\x00..\x20) around the filename:
|
||||
$file_name = trim(basename(stripslashes($name)), ".\x00..\x20");
|
||||
// Add missing file extension for known image types:
|
||||
if (strpos($file_name, '.') === false &&
|
||||
preg_match('/^image\/(gif|jpe?g|png)/', $type, $matches)) {
|
||||
$file_name .= '.'.$matches[1];
|
||||
}
|
||||
{
|
||||
// Remove path information and dots around the filename, to prevent uploading
|
||||
// into different directories or replacing hidden system files.
|
||||
// Also remove control characters and spaces (\x00..\x20) around the filename:
|
||||
$file_name = trim(basename(stripslashes($name)), ".\x00..\x20");
|
||||
// Add missing file extension for known image types:
|
||||
if (strpos($file_name, '.') === false &&
|
||||
preg_match('/^image\/(gif|jpe?g|png)/', $type, $matches)) {
|
||||
$file_name .= '.'.$matches[1];
|
||||
}
|
||||
if ($this->options['discard_aborted_uploads'])
|
||||
{
|
||||
{
|
||||
while(is_file($this->options['upload_dir'].$file_name))
|
||||
{
|
||||
$file_name = $this->upcountName($file_name);
|
||||
}
|
||||
}
|
||||
return $file_name;
|
||||
{
|
||||
$file_name = $this->upcountName($file_name);
|
||||
}
|
||||
}
|
||||
return $file_name;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -367,33 +367,33 @@ class FileUpload
|
||||
* @return int Success or not
|
||||
*/
|
||||
protected function orientImage($file_path)
|
||||
{
|
||||
$exif = @exif_read_data($file_path);
|
||||
if ($exif === false) {
|
||||
return false;
|
||||
}
|
||||
$orientation = intval(@$exif['Orientation']);
|
||||
if (!in_array($orientation, array(3, 6, 8))) {
|
||||
return false;
|
||||
}
|
||||
$image = @imagecreatefromjpeg($file_path);
|
||||
switch ($orientation) {
|
||||
case 3:
|
||||
$image = @imagerotate($image, 180, 0);
|
||||
break;
|
||||
case 6:
|
||||
$image = @imagerotate($image, 270, 0);
|
||||
break;
|
||||
case 8:
|
||||
$image = @imagerotate($image, 90, 0);
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
$success = imagejpeg($image, $file_path);
|
||||
// Free up memory (imagedestroy does not delete files):
|
||||
@imagedestroy($image);
|
||||
return $success;
|
||||
{
|
||||
$exif = @exif_read_data($file_path);
|
||||
if ($exif === false) {
|
||||
return false;
|
||||
}
|
||||
$orientation = intval(@$exif['Orientation']);
|
||||
if (!in_array($orientation, array(3, 6, 8))) {
|
||||
return false;
|
||||
}
|
||||
$image = @imagecreatefromjpeg($file_path);
|
||||
switch ($orientation) {
|
||||
case 3:
|
||||
$image = @imagerotate($image, 180, 0);
|
||||
break;
|
||||
case 6:
|
||||
$image = @imagerotate($image, 270, 0);
|
||||
break;
|
||||
case 8:
|
||||
$image = @imagerotate($image, 90, 0);
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
$success = imagejpeg($image, $file_path);
|
||||
// Free up memory (imagedestroy does not delete files):
|
||||
@imagedestroy($image);
|
||||
return $success;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -416,40 +416,40 @@ class FileUpload
|
||||
$file->type = $type;
|
||||
if ($this->validate($uploaded_file, $file, $error, $index) && dol_mkdir($this->options['upload_dir']) >= 0)
|
||||
{
|
||||
$file_path = $this->options['upload_dir'].$file->name;
|
||||
$append_file = !$this->options['discard_aborted_uploads'] && is_file($file_path) && $file->size > filesize($file_path);
|
||||
$file_path = $this->options['upload_dir'].$file->name;
|
||||
$append_file = !$this->options['discard_aborted_uploads'] && is_file($file_path) && $file->size > filesize($file_path);
|
||||
clearstatcache();
|
||||
if ($uploaded_file && is_uploaded_file($uploaded_file)) {
|
||||
// multipart/formdata uploads (POST method uploads)
|
||||
if ($uploaded_file && is_uploaded_file($uploaded_file)) {
|
||||
// multipart/formdata uploads (POST method uploads)
|
||||
if ($append_file)
|
||||
{
|
||||
file_put_contents($file_path, fopen($uploaded_file, 'r'), FILE_APPEND);
|
||||
} else {
|
||||
dol_move_uploaded_file($uploaded_file, $file_path, 1);
|
||||
}
|
||||
{
|
||||
file_put_contents($file_path, fopen($uploaded_file, 'r'), FILE_APPEND);
|
||||
} else {
|
||||
dol_move_uploaded_file($uploaded_file, $file_path, 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Non-multipart uploads (PUT method support)
|
||||
file_put_contents($file_path, fopen('php://input', 'r'), $append_file ? FILE_APPEND : 0);
|
||||
}
|
||||
{
|
||||
// Non-multipart uploads (PUT method support)
|
||||
file_put_contents($file_path, fopen('php://input', 'r'), $append_file ? FILE_APPEND : 0);
|
||||
}
|
||||
$file_size = filesize($file_path);
|
||||
if ($file_size === $file->size)
|
||||
{
|
||||
$file->url = $this->options['upload_url'].rawurlencode($file->name);
|
||||
foreach($this->options['image_versions'] as $version => $options)
|
||||
{
|
||||
if ($this->createScaledImage($file->name, $options))
|
||||
{
|
||||
$tmp=explode('.',$file->name);
|
||||
$file->{$version.'_url'} = $options['upload_url'].rawurlencode($tmp[0].'_mini.'.$tmp[1]);
|
||||
}
|
||||
}
|
||||
{
|
||||
$file->url = $this->options['upload_url'].rawurlencode($file->name);
|
||||
foreach($this->options['image_versions'] as $version => $options)
|
||||
{
|
||||
if ($this->createScaledImage($file->name, $options))
|
||||
{
|
||||
$tmp=explode('.',$file->name);
|
||||
$file->{$version.'_url'} = $options['upload_url'].rawurlencode($tmp[0].'_mini.'.$tmp[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ($this->options['discard_aborted_uploads'])
|
||||
{
|
||||
unlink($file_path);
|
||||
$file->error = 'abort';
|
||||
{
|
||||
unlink($file_path);
|
||||
$file->error = 'abort';
|
||||
}
|
||||
$file->size = $file_size;
|
||||
$this->setFileDeleteUrl($file);
|
||||
@ -486,15 +486,15 @@ class FileUpload
|
||||
public function post()
|
||||
{
|
||||
if (isset($_REQUEST['_method']) && $_REQUEST['_method'] === 'DELETE')
|
||||
{
|
||||
return $this->delete();
|
||||
{
|
||||
return $this->delete();
|
||||
}
|
||||
$upload = isset($_FILES[$this->options['param_name']]) ?
|
||||
$_FILES[$this->options['param_name']] : null;
|
||||
$info = array();
|
||||
if ($upload && is_array($upload['tmp_name']))
|
||||
{
|
||||
// param_name is an array identifier like "files[]",
|
||||
// param_name is an array identifier like "files[]",
|
||||
// $_FILES is a multi-dimensional array:
|
||||
foreach ($upload['tmp_name'] as $index => $value) {
|
||||
$info[] = $this->handleFileUpload(
|
||||
@ -507,7 +507,7 @@ class FileUpload
|
||||
);
|
||||
}
|
||||
} elseif ($upload || isset($_SERVER['HTTP_X_FILE_NAME'])) {
|
||||
// param_name is a single object identifier like "file",
|
||||
// param_name is a single object identifier like "file",
|
||||
// $_FILES is a one-dimensional array:
|
||||
$info[] = $this->handleFileUpload(
|
||||
isset($upload['tmp_name']) ? $upload['tmp_name'] : null,
|
||||
@ -519,11 +519,11 @@ class FileUpload
|
||||
}
|
||||
header('Vary: Accept');
|
||||
$json = json_encode($info);
|
||||
$redirect = isset($_REQUEST['redirect']) ?
|
||||
stripslashes($_REQUEST['redirect']) : null;
|
||||
if ($redirect) {
|
||||
header('Location: '.sprintf($redirect, rawurlencode($json)));
|
||||
return;
|
||||
$redirect = isset($_REQUEST['redirect']) ?
|
||||
stripslashes($_REQUEST['redirect']) : null;
|
||||
if ($redirect) {
|
||||
header('Location: '.sprintf($redirect, rawurlencode($json)));
|
||||
return;
|
||||
}
|
||||
if (isset($_SERVER['HTTP_ACCEPT']) &&
|
||||
(strpos($_SERVER['HTTP_ACCEPT'], 'application/json') !== false)) {
|
||||
|
||||
@ -285,12 +285,12 @@ class Form
|
||||
if (! empty($tmp[2])) $savemethod=$tmp[2];
|
||||
if (! empty($tmp[3])) $button_only=true;
|
||||
}
|
||||
else if (preg_match('/^textarea/',$inputType))
|
||||
{
|
||||
$tmp=explode(':',$inputType);
|
||||
else if (preg_match('/^textarea/',$inputType))
|
||||
{
|
||||
$tmp=explode(':',$inputType);
|
||||
$inputType=$tmp[0];
|
||||
if (! empty($tmp[1])) $rows=$tmp[1];
|
||||
if (! empty($tmp[2])) $cols=$tmp[2];
|
||||
if (! empty($tmp[1])) $rows=$tmp[1];
|
||||
if (! empty($tmp[2])) $cols=$tmp[2];
|
||||
}
|
||||
else if (preg_match('/^ckeditor/',$inputType))
|
||||
{
|
||||
@ -790,20 +790,20 @@ class Form
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return list of all contacts (for a third party or all)
|
||||
*
|
||||
* @param int $socid Id ot third party or 0 for all
|
||||
* @param string $selected Id contact pre-selectionne
|
||||
* @param string $htmlname Name of HTML field ('none' for a not editable field)
|
||||
* @param int $showempty 0=no empty value, 1=add an empty value
|
||||
* @param string $exclude List of contacts id to exclude
|
||||
* @param string $limitto Disable answers that are not id in this array list
|
||||
* @param string $showfunction Add function into label
|
||||
* @param string $moreclass Add more class to class style
|
||||
* @return int <0 if KO, Nb of contact in list if OK
|
||||
*/
|
||||
function select_contacts($socid,$selected='',$htmlname='contactid',$showempty=0,$exclude='',$limitto='',$showfunction=0, $moreclass='')
|
||||
/**
|
||||
* Return list of all contacts (for a third party or all)
|
||||
*
|
||||
* @param int $socid Id ot third party or 0 for all
|
||||
* @param string $selected Id contact pre-selectionne
|
||||
* @param string $htmlname Name of HTML field ('none' for a not editable field)
|
||||
* @param int $showempty 0=no empty value, 1=add an empty value
|
||||
* @param string $exclude List of contacts id to exclude
|
||||
* @param string $limitto Disable answers that are not id in this array list
|
||||
* @param string $showfunction Add function into label
|
||||
* @param string $moreclass Add more class to class style
|
||||
* @return int <0 if KO, Nb of contact in list if OK
|
||||
*/
|
||||
function select_contacts($socid,$selected='',$htmlname='contactid',$showempty=0,$exclude='',$limitto='',$showfunction=0, $moreclass='')
|
||||
{
|
||||
print $this->selectcontacts($socid,$selected,$htmlname,$showempty,$exclude,$limitto,$showfunction, $moreclass);
|
||||
return $this->num;
|
||||
@ -2725,50 +2725,50 @@ class Form
|
||||
print $this->selectcurrency($selected,$htmlname);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load into the cache all currencies
|
||||
*
|
||||
* @return int Nb of loaded lines, 0 if already loaded, <0 if KO
|
||||
*/
|
||||
function load_cache_currencies()
|
||||
{
|
||||
/**
|
||||
* Load into the cache all currencies
|
||||
*
|
||||
* @return int Nb of loaded lines, 0 if already loaded, <0 if KO
|
||||
*/
|
||||
function load_cache_currencies()
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$langs->load("dict");
|
||||
|
||||
if (count($this->cache_currencies)) return 0; // Cache deja charge
|
||||
|
||||
$langs->load("dict");
|
||||
|
||||
if (count($this->cache_currencies)) return 0; // Cache deja charge
|
||||
|
||||
$sql = "SELECT code_iso, label, unicode";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_currencies";
|
||||
$sql.= " WHERE active = 1";
|
||||
$sql.= " ORDER BY code_iso ASC";
|
||||
|
||||
dol_syslog(get_class($this).'::load_cache_currencies sql='.$sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
|
||||
$this->cache_currencies[$obj->code_iso]['label'] = ($obj->code_iso && $langs->trans("Currency".$obj->code_iso)!="Currency".$obj->code_iso?$langs->trans("Currency".$obj->code_iso):($obj->label!='-'?$obj->label:''));
|
||||
|
||||
dol_syslog(get_class($this).'::load_cache_currencies sql='.$sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
|
||||
$this->cache_currencies[$obj->code_iso]['label'] = ($obj->code_iso && $langs->trans("Currency".$obj->code_iso)!="Currency".$obj->code_iso?$langs->trans("Currency".$obj->code_iso):($obj->label!='-'?$obj->label:''));
|
||||
$this->cache_currencies[$obj->code_iso]['unicode'] = (array) json_decode($obj->unicode, true);
|
||||
$label[$obj->code_iso] = $this->cache_currencies[$obj->code_iso]['label'];
|
||||
$i++;
|
||||
$i++;
|
||||
}
|
||||
|
||||
array_multisort($label, SORT_ASC, $this->cache_currencies);
|
||||
|
||||
return $num;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return $num;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2833,33 +2833,33 @@ class Form
|
||||
print $this->load_tva($htmlname, $selectedrate, $societe_vendeuse, $societe_acheteuse, $idprod, $info_bits, $type);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Load into the cache vat rates of a country
|
||||
*
|
||||
* @param string $country_code Country code
|
||||
* @return int Nb of loaded lines, 0 if already loaded, <0 if KO
|
||||
* @param string $country_code Country code
|
||||
* @return int Nb of loaded lines, 0 if already loaded, <0 if KO
|
||||
*/
|
||||
function load_cache_vatrates($country_code)
|
||||
function load_cache_vatrates($country_code)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$num = count($this->cache_vatrates);
|
||||
$num = count($this->cache_vatrates);
|
||||
if ($num > 0) return $num; // Cache deja charge
|
||||
|
||||
$sql = "SELECT DISTINCT t.taux, t.recuperableonly";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p";
|
||||
$sql.= " WHERE t.fk_pays = p.rowid";
|
||||
$sql.= " AND t.active = 1";
|
||||
$sql.= " AND p.code IN (".$country_code.")";
|
||||
$sql.= " ORDER BY t.taux ASC, t.recuperableonly ASC";
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
if ($num)
|
||||
{
|
||||
for ($i = 0; $i < $num; $i++)
|
||||
$sql = "SELECT DISTINCT t.taux, t.recuperableonly";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p";
|
||||
$sql.= " WHERE t.fk_pays = p.rowid";
|
||||
$sql.= " AND t.active = 1";
|
||||
$sql.= " AND p.code IN (".$country_code.")";
|
||||
$sql.= " ORDER BY t.taux ASC, t.recuperableonly ASC";
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
if ($num)
|
||||
{
|
||||
for ($i = 0; $i < $num; $i++)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$this->cache_vatrates[$i]['txtva'] = $obj->taux;
|
||||
@ -2879,7 +2879,7 @@ class Form
|
||||
{
|
||||
$this->error = '<font class="error">'.$this->db->error().'</font>';
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2975,32 +2975,32 @@ class Form
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
// Definition du taux a pre-selectionner (si defaulttx non force et donc vaut -1 ou '')
|
||||
if ($defaulttx < 0 || dol_strlen($defaulttx) == 0)
|
||||
{
|
||||
$defaulttx=get_default_tva($societe_vendeuse,$societe_acheteuse,$idprod);
|
||||
$defaultnpr=get_default_npr($societe_vendeuse,$societe_acheteuse,$idprod);
|
||||
}
|
||||
|
||||
// Si taux par defaut n'a pu etre determine, on prend dernier de la liste.
|
||||
// Comme ils sont tries par ordre croissant, dernier = plus eleve = taux courant
|
||||
if ($defaulttx < 0 || dol_strlen($defaulttx) == 0)
|
||||
{
|
||||
$defaulttx = $this->cache_vatrates[$num-1]['txtva'];
|
||||
// Definition du taux a pre-selectionner (si defaulttx non force et donc vaut -1 ou '')
|
||||
if ($defaulttx < 0 || dol_strlen($defaulttx) == 0)
|
||||
{
|
||||
$defaulttx=get_default_tva($societe_vendeuse,$societe_acheteuse,$idprod);
|
||||
$defaultnpr=get_default_npr($societe_vendeuse,$societe_acheteuse,$idprod);
|
||||
}
|
||||
|
||||
// Si taux par defaut n'a pu etre determine, on prend dernier de la liste.
|
||||
// Comme ils sont tries par ordre croissant, dernier = plus eleve = taux courant
|
||||
if ($defaulttx < 0 || dol_strlen($defaulttx) == 0)
|
||||
{
|
||||
$defaulttx = $this->cache_vatrates[$num-1]['txtva'];
|
||||
}
|
||||
|
||||
if (! $options_only) $return.= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">';
|
||||
|
||||
foreach ($this->cache_vatrates as $rate)
|
||||
{
|
||||
$return.= '<option value="'.$rate['txtva'];
|
||||
$return.= $rate['nprtva'] ? '*': '';
|
||||
$return.= '<option value="'.$rate['txtva'];
|
||||
$return.= $rate['nprtva'] ? '*': '';
|
||||
$return.= '"';
|
||||
if ($rate['txtva'] == $defaulttx && $rate['nprtva'] == $defaultnpr)
|
||||
{
|
||||
$return.= ' selected="selected"';
|
||||
}
|
||||
$return.= '>'.vatrate($rate['libtva']);
|
||||
}
|
||||
$return.= '>'.vatrate($rate['libtva']);
|
||||
$return.= $rate['nprtva'] ? ' *': '';
|
||||
$return.= '</option>';
|
||||
|
||||
@ -3391,79 +3391,79 @@ class Form
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show a multiselect form from an array.
|
||||
*
|
||||
/**
|
||||
* Show a multiselect form from an array.
|
||||
*
|
||||
* @param string $htmlname Name of select
|
||||
* @param array $array Array with key+value
|
||||
* @param array $array Array with key+value
|
||||
* @param array $selected Preselected keys
|
||||
* @param int $key_in_label 1 pour afficher la key dans la valeur "[key] value"
|
||||
* @param int $value_as_key 1 to use value as key
|
||||
* @param string $option Valeur de l'option en fonction du type choisi
|
||||
* @param int $translate Translate and encode value
|
||||
* @return string HTML multiselect string
|
||||
*/
|
||||
function multiselectarray($htmlname, $array, $selected=array(), $key_in_label=0, $value_as_key=0, $option='', $translate=0)
|
||||
{
|
||||
* @param int $translate Translate and encode value
|
||||
* @return string HTML multiselect string
|
||||
*/
|
||||
function multiselectarray($htmlname, $array, $selected=array(), $key_in_label=0, $value_as_key=0, $option='', $translate=0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$out = '<select id="'.$htmlname.'" class="multiselect" multiple="multiple" name="'.$htmlname.'[]"'.$option.'>'."\n";
|
||||
if (is_array($array) && ! empty($array))
|
||||
|
||||
$out = '<select id="'.$htmlname.'" class="multiselect" multiple="multiple" name="'.$htmlname.'[]"'.$option.'>'."\n";
|
||||
if (is_array($array) && ! empty($array))
|
||||
{
|
||||
if ($value_as_key) $array=array_combine($array, $array);
|
||||
|
||||
if (! empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) && is_array($selected) && ! empty($selected))
|
||||
if (! empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) && is_array($selected) && ! empty($selected))
|
||||
{
|
||||
foreach ($selected as $selected_value)
|
||||
{
|
||||
foreach($array as $key => $value)
|
||||
{
|
||||
if ($selected_value == $key)
|
||||
{
|
||||
$value=$array[$selected_value];
|
||||
$out.= '<option value="'.$key.'" selected="selected">';
|
||||
$newval = ($translate ? $langs->trans(ucfirst($value)) : $value);
|
||||
$newval = ($key_in_label ? $key.' - '.$newval : $newval);
|
||||
$out.= dol_htmlentitiesbr($newval);
|
||||
$out.= '</option>'."\n";
|
||||
unset($array[$key]);
|
||||
if ($selected_value == $key)
|
||||
{
|
||||
$value=$array[$selected_value];
|
||||
$out.= '<option value="'.$key.'" selected="selected">';
|
||||
$newval = ($translate ? $langs->trans(ucfirst($value)) : $value);
|
||||
$newval = ($key_in_label ? $key.' - '.$newval : $newval);
|
||||
$out.= dol_htmlentitiesbr($newval);
|
||||
$out.= '</option>'."\n";
|
||||
unset($array[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($array))
|
||||
{
|
||||
foreach ($array as $key => $value)
|
||||
foreach ($array as $key => $value)
|
||||
{
|
||||
$out.= '<option value="'.$key.'">';
|
||||
$newval = ($translate ? $langs->trans(ucfirst($value)) : $value);
|
||||
$newval = ($key_in_label ? $key.' - '.$newval : $newval);
|
||||
$out.= dol_htmlentitiesbr($newval);
|
||||
$out.= '</option>'."\n";
|
||||
$out.= '<option value="'.$key.'">';
|
||||
$newval = ($translate ? $langs->trans(ucfirst($value)) : $value);
|
||||
$newval = ($key_in_label ? $key.' - '.$newval : $newval);
|
||||
$out.= dol_htmlentitiesbr($newval);
|
||||
$out.= '</option>'."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach ($array as $key => $value)
|
||||
{
|
||||
$out.= '<option value="'.$key.'"';
|
||||
if (is_array($selected) && ! empty($selected) && in_array($key, $selected))
|
||||
{
|
||||
$out.= ' selected="selected"';
|
||||
}
|
||||
$out.= '>';
|
||||
|
||||
$newval = ($translate ? $langs->trans(ucfirst($value)) : $value);
|
||||
$newval = ($key_in_label ? $key.' - '.$newval : $newval);
|
||||
$out.= dol_htmlentitiesbr($newval);
|
||||
$out.= '</option>'."\n";
|
||||
foreach ($array as $key => $value)
|
||||
{
|
||||
$out.= '<option value="'.$key.'"';
|
||||
if (is_array($selected) && ! empty($selected) && in_array($key, $selected))
|
||||
{
|
||||
$out.= ' selected="selected"';
|
||||
}
|
||||
$out.= '>';
|
||||
|
||||
$newval = ($translate ? $langs->trans(ucfirst($value)) : $value);
|
||||
$newval = ($key_in_label ? $key.' - '.$newval : $newval);
|
||||
$out.= dol_htmlentitiesbr($newval);
|
||||
$out.= '</option>'."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
$out.= '</select>'."\n";
|
||||
|
||||
return $out;
|
||||
}
|
||||
}
|
||||
$out.= '</select>'."\n";
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
|
||||
@ -3561,18 +3561,20 @@ class Form
|
||||
* To add a particular filter on select, you must set $object->next_prev_filter to SQL criteria.
|
||||
*
|
||||
* @param Object $object Object to show
|
||||
* @param int $paramid Name of parameter to use to name the id into the URL link
|
||||
* @param string $morehtml More html content to output just before the nav bar
|
||||
* @param string $paramid Name of parameter to use to name the id into the URL link
|
||||
* @param string $morehtml More html content to output just before the nav bar
|
||||
* @param int $shownav Show Condition (navigation is shown if value is 1)
|
||||
* @param int $fieldid Nom du champ en base a utiliser pour select next et previous
|
||||
* @param string $fieldref Nom du champ objet ref (object->ref) a utiliser pour select next et previous
|
||||
* @param string $morehtmlref Code html supplementaire a afficher apres ref
|
||||
* @param string $moreparam More param to add in nav link url.
|
||||
* @return tring Portion HTML avec ref + boutons nav
|
||||
* @param string $fieldid Nom du champ en base a utiliser pour select next et previous
|
||||
* @param string $fieldref Nom du champ objet ref (object->ref) a utiliser pour select next et previous
|
||||
* @param string $morehtmlref Code html supplementaire a afficher apres ref
|
||||
* @param string $moreparam More param to add in nav link url.
|
||||
* @return tring Portion HTML avec ref + boutons nav
|
||||
*/
|
||||
function showrefnav($object,$paramid,$morehtml='',$shownav=1,$fieldid='rowid',$fieldref='ref',$morehtmlref='',$moreparam='')
|
||||
{
|
||||
$ret='';
|
||||
if (empty($fieldid)) $fieldid='rowid';
|
||||
if (empty($fieldref)) $fieldref='ref';
|
||||
|
||||
//print "paramid=$paramid,morehtml=$morehtml,shownav=$shownav,$fieldid,$fieldref,$morehtmlref,$moreparam";
|
||||
$object->load_previous_next_ref((isset($object->next_prev_filter)?$object->next_prev_filter:''),$fieldid);
|
||||
|
||||
@ -650,6 +650,8 @@ class FormFile
|
||||
global $bc;
|
||||
global $sortfield, $sortorder;
|
||||
|
||||
dol_syslog(get_class($this).'::list_of_autoecmfiles upload_dir='.$upload_dir.' modulepart='.$modulepart);
|
||||
|
||||
// Affiche liste des documents existant
|
||||
if (empty($useinecm)) print_titre($langs->trans("AttachedFiles"));
|
||||
//else { $bc[true]=''; $bc[false]=''; };
|
||||
@ -666,7 +668,12 @@ class FormFile
|
||||
print '</tr>';
|
||||
|
||||
// To show ref or specific information according to view to show (defined by $module)
|
||||
if ($modulepart == 'invoice')
|
||||
if ($modulepart == 'company')
|
||||
{
|
||||
include_once(DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php');
|
||||
$object_instance=new Societe($this->db);
|
||||
}
|
||||
else if ($modulepart == 'invoice')
|
||||
{
|
||||
include_once(DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php');
|
||||
$object_instance=new Facture($this->db);
|
||||
@ -718,6 +725,7 @@ class FormFile
|
||||
$id=0; $ref=''; $label='';
|
||||
|
||||
// To show ref or specific information according to view to show (defined by $module)
|
||||
if ($modulepart == 'company') { preg_match('/(\d+)\/[^\/]+$/',$relativefile,$reg); $id=$reg[1]; }
|
||||
if ($modulepart == 'invoice') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=$reg[1]; }
|
||||
if ($modulepart == 'invoice_supplier') { preg_match('/(\d+)\/[^\/]+$/',$relativefile,$reg); $id=$reg[1]; }
|
||||
if ($modulepart == 'propal') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=$reg[1]; }
|
||||
@ -804,8 +812,8 @@ class FormFile
|
||||
$upload_max_filesize = $mul_upload_max_filesize * (int) $upload_max_filesize;
|
||||
// Max file size
|
||||
$max_file_size = (($post_max_size < $upload_max_filesize) ? $post_max_size : $upload_max_filesize);
|
||||
|
||||
// Include main
|
||||
|
||||
// Include main
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/ajax/fileupload_main.tpl.php');
|
||||
|
||||
// Include template
|
||||
|
||||
@ -170,9 +170,9 @@ class SMTPs
|
||||
*/
|
||||
var $_smtpsRelatedBoundary = null;
|
||||
|
||||
/**
|
||||
* Alternative Boundary
|
||||
*/
|
||||
/**
|
||||
* Alternative Boundary
|
||||
*/
|
||||
var $_smtpsAlternativeBoundary = null;
|
||||
|
||||
/**
|
||||
@ -1223,8 +1223,8 @@ class SMTPs
|
||||
|
||||
if (key_exists('image', $this->_msgContent))
|
||||
{
|
||||
$content.= 'Content-Type: multipart/alternative; boundary="'.$this->_getBoundary('alternative').'"' . "\r\n";
|
||||
$content .= "\r\n";
|
||||
$content.= 'Content-Type: multipart/alternative; boundary="'.$this->_getBoundary('alternative').'"' . "\r\n";
|
||||
$content .= "\r\n";
|
||||
$content .= "--" . $this->_getBoundary('alternative') . "\r\n";
|
||||
}
|
||||
|
||||
@ -1268,21 +1268,21 @@ class SMTPs
|
||||
. $_data['data'] . "\r\n";
|
||||
}
|
||||
|
||||
// always end related and end alternative after inline images
|
||||
$content.= "--" . $this->_getBoundary('related') . "--" . "\r\n";
|
||||
$content.= "\r\n" . "--" . $this->_getBoundary('alternative') . "--" . "\r\n";
|
||||
// always end related and end alternative after inline images
|
||||
$content.= "--" . $this->_getBoundary('related') . "--" . "\r\n";
|
||||
$content.= "\r\n" . "--" . $this->_getBoundary('alternative') . "--" . "\r\n";
|
||||
$content.= "\r\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (key_exists('image', $this->_msgContent))
|
||||
{
|
||||
$content.= "Content-Type: text/plain; charset=" . $this->getCharSet() . "\r\n";
|
||||
$content.= "\r\n" . strip_tags($_content['data']) . "\r\n"; // Add plain text message
|
||||
$content.= "--" . $this->_getBoundary('alternative') . "\r\n";
|
||||
$content.= 'Content-Type: multipart/related; boundary="' . $this->_getBoundary('related') . '"' . "\r\n";
|
||||
$content.= "\r\n";
|
||||
$content.= "--" . $this->_getBoundary('related') . "\r\n";
|
||||
if (key_exists('image', $this->_msgContent))
|
||||
{
|
||||
$content.= "Content-Type: text/plain; charset=" . $this->getCharSet() . "\r\n";
|
||||
$content.= "\r\n" . strip_tags($_content['data']) . "\r\n"; // Add plain text message
|
||||
$content.= "--" . $this->_getBoundary('alternative') . "\r\n";
|
||||
$content.= 'Content-Type: multipart/related; boundary="' . $this->_getBoundary('related') . '"' . "\r\n";
|
||||
$content.= "\r\n";
|
||||
$content.= "--" . $this->_getBoundary('related') . "\r\n";
|
||||
}
|
||||
|
||||
$content .= 'Content-Type: ' . $_content['mimeType'] . '; '
|
||||
@ -1490,7 +1490,7 @@ class SMTPs
|
||||
function _setBoundary()
|
||||
{
|
||||
$this->_smtpsBoundary = "multipart_x." . time() . ".x_boundary";
|
||||
$this->_smtpsRelatedBoundary = 'mul_'.dol_hash(uniqid("dolibarr2"));
|
||||
$this->_smtpsRelatedBoundary = 'mul_'.dol_hash(uniqid("dolibarr2"));
|
||||
$this->_smtpsAlternativeBoundary = 'mul_'.dol_hash(uniqid("dolibarr3"));
|
||||
}
|
||||
|
||||
|
||||
@ -1,88 +1,88 @@
|
||||
/*
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2010 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* Common objects and functions shared by all pages that compose the
|
||||
* File Browser dialog window.
|
||||
*/
|
||||
|
||||
// Automatically detect the correct document.domain (#1919).
|
||||
(function()
|
||||
{
|
||||
var d = document.domain ;
|
||||
|
||||
while ( true )
|
||||
{
|
||||
// Test if we can access a parent property.
|
||||
try
|
||||
{
|
||||
var test = window.top.opener.document.domain ;
|
||||
break ;
|
||||
}
|
||||
catch( e )
|
||||
{}
|
||||
|
||||
// Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ...
|
||||
d = d.replace( /.*?(?:\.|$)/, '' ) ;
|
||||
|
||||
if ( d.length == 0 )
|
||||
break ; // It was not able to detect the domain.
|
||||
|
||||
try
|
||||
{
|
||||
document.domain = d ;
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
break ;
|
||||
}
|
||||
}
|
||||
})() ;
|
||||
|
||||
function AddSelectOption( selectElement, optionText, optionValue )
|
||||
{
|
||||
var oOption = document.createElement("OPTION") ;
|
||||
|
||||
oOption.text = optionText ;
|
||||
oOption.value = optionValue ;
|
||||
|
||||
selectElement.options.add(oOption) ;
|
||||
|
||||
return oOption ;
|
||||
}
|
||||
|
||||
var oConnector = window.parent.oConnector ;
|
||||
var oIcons = window.parent.oIcons ;
|
||||
|
||||
|
||||
function StringBuilder( value )
|
||||
{
|
||||
this._Strings = new Array( value || '' ) ;
|
||||
}
|
||||
|
||||
StringBuilder.prototype.Append = function( value )
|
||||
{
|
||||
if ( value )
|
||||
this._Strings.push( value ) ;
|
||||
}
|
||||
|
||||
StringBuilder.prototype.ToString = function()
|
||||
{
|
||||
return this._Strings.join( '' ) ;
|
||||
}
|
||||
/*
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2010 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* Common objects and functions shared by all pages that compose the
|
||||
* File Browser dialog window.
|
||||
*/
|
||||
|
||||
// Automatically detect the correct document.domain (#1919).
|
||||
(function()
|
||||
{
|
||||
var d = document.domain ;
|
||||
|
||||
while ( true )
|
||||
{
|
||||
// Test if we can access a parent property.
|
||||
try
|
||||
{
|
||||
var test = window.top.opener.document.domain ;
|
||||
break ;
|
||||
}
|
||||
catch( e )
|
||||
{}
|
||||
|
||||
// Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ...
|
||||
d = d.replace( /.*?(?:\.|$)/, '' ) ;
|
||||
|
||||
if ( d.length == 0 )
|
||||
break ; // It was not able to detect the domain.
|
||||
|
||||
try
|
||||
{
|
||||
document.domain = d ;
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
break ;
|
||||
}
|
||||
}
|
||||
})() ;
|
||||
|
||||
function AddSelectOption( selectElement, optionText, optionValue )
|
||||
{
|
||||
var oOption = document.createElement("OPTION") ;
|
||||
|
||||
oOption.text = optionText ;
|
||||
oOption.value = optionValue ;
|
||||
|
||||
selectElement.options.add(oOption) ;
|
||||
|
||||
return oOption ;
|
||||
}
|
||||
|
||||
var oConnector = window.parent.oConnector ;
|
||||
var oIcons = window.parent.oIcons ;
|
||||
|
||||
|
||||
function StringBuilder( value )
|
||||
{
|
||||
this._Strings = new Array( value || '' ) ;
|
||||
}
|
||||
|
||||
StringBuilder.prototype.Append = function( value )
|
||||
{
|
||||
if ( value )
|
||||
this._Strings.push( value ) ;
|
||||
}
|
||||
|
||||
StringBuilder.prototype.ToString = function()
|
||||
{
|
||||
return this._Strings.join( '' ) ;
|
||||
}
|
||||
|
||||
@ -1,147 +1,147 @@
|
||||
/*
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2010 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* Defines the FCKXml object that is used for XML data calls
|
||||
* and XML processing.
|
||||
*
|
||||
* This script is shared by almost all pages that compose the
|
||||
* File Browser frameset.
|
||||
*/
|
||||
|
||||
var FCKXml = function()
|
||||
{}
|
||||
|
||||
FCKXml.prototype.GetHttpRequest = function()
|
||||
{
|
||||
// Gecko / IE7
|
||||
try { return new XMLHttpRequest(); }
|
||||
catch(e) {}
|
||||
|
||||
// IE6
|
||||
try { return new ActiveXObject( 'Msxml2.XMLHTTP' ) ; }
|
||||
catch(e) {}
|
||||
|
||||
// IE5
|
||||
try { return new ActiveXObject( 'Microsoft.XMLHTTP' ) ; }
|
||||
catch(e) {}
|
||||
|
||||
return null ;
|
||||
}
|
||||
|
||||
FCKXml.prototype.LoadUrl = function( urlToCall, asyncFunctionPointer )
|
||||
{
|
||||
var oFCKXml = this ;
|
||||
|
||||
var bAsync = ( typeof(asyncFunctionPointer) == 'function' ) ;
|
||||
|
||||
var oXmlHttp = this.GetHttpRequest() ;
|
||||
|
||||
oXmlHttp.open( "GET", urlToCall, bAsync ) ;
|
||||
|
||||
if ( bAsync )
|
||||
{
|
||||
oXmlHttp.onreadystatechange = function()
|
||||
{
|
||||
if ( oXmlHttp.readyState == 4 )
|
||||
{
|
||||
var oXml ;
|
||||
try
|
||||
{
|
||||
// this is the same test for an FF2 bug as in fckxml_gecko.js
|
||||
// but we've moved the responseXML assignment into the try{}
|
||||
// so we don't even have to check the return status codes.
|
||||
var test = oXmlHttp.responseXML.firstChild ;
|
||||
oXml = oXmlHttp.responseXML ;
|
||||
}
|
||||
catch ( e )
|
||||
{
|
||||
try
|
||||
{
|
||||
oXml = (new DOMParser()).parseFromString( oXmlHttp.responseText, 'text/xml' ) ;
|
||||
}
|
||||
catch ( e ) {}
|
||||
}
|
||||
|
||||
if ( !oXml || !oXml.firstChild || oXml.firstChild.nodeName == 'parsererror' )
|
||||
{
|
||||
alert( 'The server didn\'t send back a proper XML response. Please contact your system administrator.\n\n' +
|
||||
'XML request error: ' + oXmlHttp.statusText + ' (' + oXmlHttp.status + ')\n\n' +
|
||||
'Requested URL:\n' + urlToCall + '\n\n' +
|
||||
'Response text:\n' + oXmlHttp.responseText ) ;
|
||||
return ;
|
||||
}
|
||||
|
||||
oFCKXml.DOMDocument = oXml ;
|
||||
asyncFunctionPointer( oFCKXml ) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
oXmlHttp.send( null ) ;
|
||||
|
||||
if ( ! bAsync )
|
||||
{
|
||||
if ( oXmlHttp.status == 200 || oXmlHttp.status == 304 )
|
||||
this.DOMDocument = oXmlHttp.responseXML ;
|
||||
else
|
||||
{
|
||||
alert( 'XML request error: ' + oXmlHttp.statusText + ' (' + oXmlHttp.status + ')' ) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FCKXml.prototype.SelectNodes = function( xpath )
|
||||
{
|
||||
if ( navigator.userAgent.indexOf('MSIE') >= 0 ) // IE
|
||||
return this.DOMDocument.selectNodes( xpath ) ;
|
||||
else // Gecko
|
||||
{
|
||||
var aNodeArray = new Array();
|
||||
|
||||
var xPathResult = this.DOMDocument.evaluate( xpath, this.DOMDocument,
|
||||
this.DOMDocument.createNSResolver(this.DOMDocument.documentElement), XPathResult.ORDERED_NODE_ITERATOR_TYPE, null) ;
|
||||
if ( xPathResult )
|
||||
{
|
||||
var oNode = xPathResult.iterateNext() ;
|
||||
while( oNode )
|
||||
{
|
||||
aNodeArray[aNodeArray.length] = oNode ;
|
||||
oNode = xPathResult.iterateNext();
|
||||
}
|
||||
}
|
||||
return aNodeArray ;
|
||||
}
|
||||
}
|
||||
|
||||
FCKXml.prototype.SelectSingleNode = function( xpath )
|
||||
{
|
||||
if ( navigator.userAgent.indexOf('MSIE') >= 0 ) // IE
|
||||
return this.DOMDocument.selectSingleNode( xpath ) ;
|
||||
else // Gecko
|
||||
{
|
||||
var xPathResult = this.DOMDocument.evaluate( xpath, this.DOMDocument,
|
||||
this.DOMDocument.createNSResolver(this.DOMDocument.documentElement), 9, null);
|
||||
|
||||
if ( xPathResult && xPathResult.singleNodeValue )
|
||||
return xPathResult.singleNodeValue ;
|
||||
else
|
||||
return null ;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2010 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* Defines the FCKXml object that is used for XML data calls
|
||||
* and XML processing.
|
||||
*
|
||||
* This script is shared by almost all pages that compose the
|
||||
* File Browser frameset.
|
||||
*/
|
||||
|
||||
var FCKXml = function()
|
||||
{}
|
||||
|
||||
FCKXml.prototype.GetHttpRequest = function()
|
||||
{
|
||||
// Gecko / IE7
|
||||
try { return new XMLHttpRequest(); }
|
||||
catch(e) {}
|
||||
|
||||
// IE6
|
||||
try { return new ActiveXObject( 'Msxml2.XMLHTTP' ) ; }
|
||||
catch(e) {}
|
||||
|
||||
// IE5
|
||||
try { return new ActiveXObject( 'Microsoft.XMLHTTP' ) ; }
|
||||
catch(e) {}
|
||||
|
||||
return null ;
|
||||
}
|
||||
|
||||
FCKXml.prototype.LoadUrl = function( urlToCall, asyncFunctionPointer )
|
||||
{
|
||||
var oFCKXml = this ;
|
||||
|
||||
var bAsync = ( typeof(asyncFunctionPointer) == 'function' ) ;
|
||||
|
||||
var oXmlHttp = this.GetHttpRequest() ;
|
||||
|
||||
oXmlHttp.open( "GET", urlToCall, bAsync ) ;
|
||||
|
||||
if ( bAsync )
|
||||
{
|
||||
oXmlHttp.onreadystatechange = function()
|
||||
{
|
||||
if ( oXmlHttp.readyState == 4 )
|
||||
{
|
||||
var oXml ;
|
||||
try
|
||||
{
|
||||
// this is the same test for an FF2 bug as in fckxml_gecko.js
|
||||
// but we've moved the responseXML assignment into the try{}
|
||||
// so we don't even have to check the return status codes.
|
||||
var test = oXmlHttp.responseXML.firstChild ;
|
||||
oXml = oXmlHttp.responseXML ;
|
||||
}
|
||||
catch ( e )
|
||||
{
|
||||
try
|
||||
{
|
||||
oXml = (new DOMParser()).parseFromString( oXmlHttp.responseText, 'text/xml' ) ;
|
||||
}
|
||||
catch ( e ) {}
|
||||
}
|
||||
|
||||
if ( !oXml || !oXml.firstChild || oXml.firstChild.nodeName == 'parsererror' )
|
||||
{
|
||||
alert( 'The server didn\'t send back a proper XML response. Please contact your system administrator.\n\n' +
|
||||
'XML request error: ' + oXmlHttp.statusText + ' (' + oXmlHttp.status + ')\n\n' +
|
||||
'Requested URL:\n' + urlToCall + '\n\n' +
|
||||
'Response text:\n' + oXmlHttp.responseText ) ;
|
||||
return ;
|
||||
}
|
||||
|
||||
oFCKXml.DOMDocument = oXml ;
|
||||
asyncFunctionPointer( oFCKXml ) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
oXmlHttp.send( null ) ;
|
||||
|
||||
if ( ! bAsync )
|
||||
{
|
||||
if ( oXmlHttp.status == 200 || oXmlHttp.status == 304 )
|
||||
this.DOMDocument = oXmlHttp.responseXML ;
|
||||
else
|
||||
{
|
||||
alert( 'XML request error: ' + oXmlHttp.statusText + ' (' + oXmlHttp.status + ')' ) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FCKXml.prototype.SelectNodes = function( xpath )
|
||||
{
|
||||
if ( navigator.userAgent.indexOf('MSIE') >= 0 ) // IE
|
||||
return this.DOMDocument.selectNodes( xpath ) ;
|
||||
else // Gecko
|
||||
{
|
||||
var aNodeArray = new Array();
|
||||
|
||||
var xPathResult = this.DOMDocument.evaluate( xpath, this.DOMDocument,
|
||||
this.DOMDocument.createNSResolver(this.DOMDocument.documentElement), XPathResult.ORDERED_NODE_ITERATOR_TYPE, null) ;
|
||||
if ( xPathResult )
|
||||
{
|
||||
var oNode = xPathResult.iterateNext() ;
|
||||
while( oNode )
|
||||
{
|
||||
aNodeArray[aNodeArray.length] = oNode ;
|
||||
oNode = xPathResult.iterateNext();
|
||||
}
|
||||
}
|
||||
return aNodeArray ;
|
||||
}
|
||||
}
|
||||
|
||||
FCKXml.prototype.SelectSingleNode = function( xpath )
|
||||
{
|
||||
if ( navigator.userAgent.indexOf('MSIE') >= 0 ) // IE
|
||||
return this.DOMDocument.selectSingleNode( xpath ) ;
|
||||
else // Gecko
|
||||
{
|
||||
var xPathResult = this.DOMDocument.evaluate( xpath, this.DOMDocument,
|
||||
this.DOMDocument.createNSResolver(this.DOMDocument.documentElement), 9, null);
|
||||
|
||||
if ( xPathResult && xPathResult.singleNodeValue )
|
||||
return xPathResult.singleNodeValue ;
|
||||
else
|
||||
return null ;
|
||||
}
|
||||
}
|
||||
|
||||
@ -68,55 +68,57 @@ $(document).ready(function() {
|
||||
$('#viewval_' + $(this).attr('id')).hide();
|
||||
$('#editval_' + $(this).attr('id')).show().click();
|
||||
});
|
||||
|
||||
$('.editval_ckeditor').editable(urlSaveInPlace, {
|
||||
type : 'ckeditor',
|
||||
id : 'field',
|
||||
onblur : 'ignore',
|
||||
tooltip : tooltipInPlace,
|
||||
placeholder : ' ',
|
||||
cancel : cancelInPlace,
|
||||
submit : submitInPlace,
|
||||
indicator : indicatorInPlace,
|
||||
ckeditor : {
|
||||
customConfig: ckeditorConfig,
|
||||
toolbar: $('#ckeditor_toolbar').val(),
|
||||
filebrowserBrowseUrl : ckeditorFilebrowserBrowseUrl,
|
||||
filebrowserImageBrowseUrl : ckeditorFilebrowserImageBrowseUrl,
|
||||
filebrowserWindowWidth : '900',
|
||||
filebrowserWindowHeight : '500',
|
||||
filebrowserImageWindowWidth : '900',
|
||||
filebrowserImageWindowHeight : '500'
|
||||
},
|
||||
submitdata : function(result, settings) {
|
||||
return getParameters(this, 'ckeditor');
|
||||
},
|
||||
callback : function(result, settings) {
|
||||
getResult(this, result);
|
||||
},
|
||||
onreset : function(result, settings) {
|
||||
getDefault(settings);
|
||||
}
|
||||
});
|
||||
$('.editkey_ckeditor').hover(
|
||||
function () {
|
||||
$('#viewval_' + $(this).attr('id')).addClass("viewval_hover");
|
||||
|
||||
if (typeof ckeditorConfig != 'undefined') {
|
||||
$('.editval_ckeditor').editable(urlSaveInPlace, {
|
||||
type : 'ckeditor',
|
||||
id : 'field',
|
||||
onblur : 'ignore',
|
||||
tooltip : tooltipInPlace,
|
||||
placeholder : ' ',
|
||||
cancel : cancelInPlace,
|
||||
submit : submitInPlace,
|
||||
indicator : indicatorInPlace,
|
||||
ckeditor : {
|
||||
customConfig: ckeditorConfig,
|
||||
toolbar: $('#ckeditor_toolbar').val(),
|
||||
filebrowserBrowseUrl : ckeditorFilebrowserBrowseUrl,
|
||||
filebrowserImageBrowseUrl : ckeditorFilebrowserImageBrowseUrl,
|
||||
filebrowserWindowWidth : '900',
|
||||
filebrowserWindowHeight : '500',
|
||||
filebrowserImageWindowWidth : '900',
|
||||
filebrowserImageWindowHeight : '500'
|
||||
},
|
||||
function () {
|
||||
$('#viewval_' + $(this).attr('id')).removeClass("viewval_hover");
|
||||
submitdata : function(result, settings) {
|
||||
return getParameters(this, 'ckeditor');
|
||||
},
|
||||
callback : function(result, settings) {
|
||||
getResult(this, result);
|
||||
},
|
||||
onreset : function(result, settings) {
|
||||
getDefault(settings);
|
||||
}
|
||||
);
|
||||
$('.editkey_ckeditor').click(function() {
|
||||
$( '#viewval_' + $(this).attr('id') ).click();
|
||||
});
|
||||
$('.viewval_ckeditor.active').click(function() {
|
||||
$('#viewval_' + $(this).attr('id').substr(8)).hide();
|
||||
$('#editval_' + $(this).attr('id').substr(8)).show().click();
|
||||
});
|
||||
$('.editkey_ckeditor').click(function() {
|
||||
$('#viewval_' + $(this).attr('id')).hide();
|
||||
$('#editval_' + $(this).attr('id')).show().click();
|
||||
});
|
||||
});
|
||||
$('.editkey_ckeditor').hover(
|
||||
function () {
|
||||
$('#viewval_' + $(this).attr('id')).addClass("viewval_hover");
|
||||
},
|
||||
function () {
|
||||
$('#viewval_' + $(this).attr('id')).removeClass("viewval_hover");
|
||||
}
|
||||
);
|
||||
$('.editkey_ckeditor').click(function() {
|
||||
$( '#viewval_' + $(this).attr('id') ).click();
|
||||
});
|
||||
$('.viewval_ckeditor.active').click(function() {
|
||||
$('#viewval_' + $(this).attr('id').substr(8)).hide();
|
||||
$('#editval_' + $(this).attr('id').substr(8)).show().click();
|
||||
});
|
||||
$('.editkey_ckeditor').click(function() {
|
||||
$('#viewval_' + $(this).attr('id')).hide();
|
||||
$('#editval_' + $(this).attr('id')).show().click();
|
||||
});
|
||||
}
|
||||
|
||||
$('.editval_string').editable(urlSaveInPlace, {
|
||||
type : 'text',
|
||||
|
||||
@ -725,11 +725,11 @@ function activateModule($value,$withdeps=1)
|
||||
$num = count($objMod->depends);
|
||||
for ($i = 0; $i < $num; $i++)
|
||||
{
|
||||
foreach ($modulesdir as $dir)
|
||||
foreach ($modulesdir as $dir)
|
||||
{
|
||||
if (file_exists($dir.$objMod->depends[$i].".class.php"))
|
||||
{
|
||||
activateModule($objMod->depends[$i]);
|
||||
if (file_exists($dir.$objMod->depends[$i].".class.php"))
|
||||
{
|
||||
activateModule($objMod->depends[$i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -741,11 +741,11 @@ function activateModule($value,$withdeps=1)
|
||||
$num = count($objMod->conflictwith);
|
||||
for ($i = 0; $i < $num; $i++)
|
||||
{
|
||||
foreach ($modulesdir as $dir)
|
||||
foreach ($modulesdir as $dir)
|
||||
{
|
||||
if (file_exists($dir.$objMod->conflictwith[$i].".class.php"))
|
||||
{
|
||||
unActivateModule($objMod->conflictwith[$i],0);
|
||||
if (file_exists($dir.$objMod->conflictwith[$i].".class.php"))
|
||||
{
|
||||
unActivateModule($objMod->conflictwith[$i],0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1128,16 +1128,16 @@ function form_constantes($tableau)
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Add document model used by doc generator
|
||||
*
|
||||
/**
|
||||
* Add document model used by doc generator
|
||||
*
|
||||
* @param string $name Model name
|
||||
* @param string $type Model type
|
||||
* @param string $label Model label
|
||||
* @param string $description Model description
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function addDocumentModel($name, $type, $label='', $description='')
|
||||
* @param string $type Model type
|
||||
* @param string $label Model label
|
||||
* @param string $description Model description
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function addDocumentModel($name, $type, $label='', $description='')
|
||||
{
|
||||
global $db, $conf;
|
||||
|
||||
@ -1150,51 +1150,51 @@ function addDocumentModel($name, $type, $label='', $description='')
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog("admin.lib::addDocumentModel sql=".$sql);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
$db->rollback();
|
||||
return -1;
|
||||
}
|
||||
$db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete document model used by doc generator
|
||||
*
|
||||
* @param string $name Model name
|
||||
* @param string $type Model type
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function delDocumentModel($name, $type)
|
||||
{
|
||||
/**
|
||||
* Delete document model used by doc generator
|
||||
*
|
||||
* @param string $name Model name
|
||||
* @param string $type Model type
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function delDocumentModel($name, $type)
|
||||
{
|
||||
global $db, $conf;
|
||||
|
||||
$db->begin();
|
||||
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql.= " WHERE nom = '".$db->escape($name)."'";
|
||||
$sql.= " AND type = '".$type."'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
|
||||
dol_syslog("admin.lib::delDocumentModel sql=".$sql);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
|
||||
dol_syslog("admin.lib::delDocumentModel sql=".$sql);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
$db->rollback();
|
||||
return -1;
|
||||
}
|
||||
$db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -595,99 +595,99 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
|
||||
return $i;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show html area for list of addresses
|
||||
*
|
||||
* @param Conf $conf Object conf
|
||||
* @param Translate $langs Object langs
|
||||
* @param DoliDB $db Database handler
|
||||
* @param Object $object Third party object
|
||||
* @param string $backtopage Url to go once address is created
|
||||
* @return void
|
||||
*/
|
||||
function show_addresses($conf,$langs,$db,$object,$backtopage='')
|
||||
{
|
||||
global $user;
|
||||
/**
|
||||
* Show html area for list of addresses
|
||||
*
|
||||
* @param Conf $conf Object conf
|
||||
* @param Translate $langs Object langs
|
||||
* @param DoliDB $db Database handler
|
||||
* @param Object $object Third party object
|
||||
* @param string $backtopage Url to go once address is created
|
||||
* @return void
|
||||
*/
|
||||
function show_addresses($conf,$langs,$db,$object,$backtopage='')
|
||||
{
|
||||
global $user;
|
||||
global $bc;
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT."/societe/class/address.class.php");
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT."/societe/class/address.class.php");
|
||||
|
||||
$addressstatic = new Address($db);
|
||||
$num = $addressstatic->fetch_lines($object->id);
|
||||
|
||||
$buttoncreate='';
|
||||
if ($user->rights->societe->creer)
|
||||
{
|
||||
$buttoncreate='<a class="addnewrecord" href="'.DOL_URL_ROOT.'/comm/address.php?socid='.$object->id.'&action=create&backtopage='.urlencode($backtopage).'">'.$langs->trans("AddAddress").' '.img_picto($langs->trans("AddAddress"),'filenew').'</a>'."\n";
|
||||
}
|
||||
|
||||
print "\n";
|
||||
print_fiche_titre($langs->trans("AddressesForCompany"),$buttoncreate,'');
|
||||
|
||||
print "\n".'<table class="noborder" width="100%">'."\n";
|
||||
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Label").'</td>';
|
||||
$num = $addressstatic->fetch_lines($object->id);
|
||||
|
||||
$buttoncreate='';
|
||||
if ($user->rights->societe->creer)
|
||||
{
|
||||
$buttoncreate='<a class="addnewrecord" href="'.DOL_URL_ROOT.'/comm/address.php?socid='.$object->id.'&action=create&backtopage='.urlencode($backtopage).'">'.$langs->trans("AddAddress").' '.img_picto($langs->trans("AddAddress"),'filenew').'</a>'."\n";
|
||||
}
|
||||
|
||||
print "\n";
|
||||
print_fiche_titre($langs->trans("AddressesForCompany"),$buttoncreate,'');
|
||||
|
||||
print "\n".'<table class="noborder" width="100%">'."\n";
|
||||
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Label").'</td>';
|
||||
print '<td>'.$langs->trans("CompanyName").'</td>';
|
||||
print '<td>'.$langs->trans("Town").'</td>';
|
||||
print '<td>'.$langs->trans("Country").'</td>';
|
||||
print '<td>'.$langs->trans("Tel").'</td>';
|
||||
print '<td>'.$langs->trans("Fax").'</td>';
|
||||
print "<td> </td>";
|
||||
print "</tr>";
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
$var=true;
|
||||
|
||||
foreach ($addressstatic->lines as $address)
|
||||
{
|
||||
$var = !$var;
|
||||
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
print '<td>'.$langs->trans("Tel").'</td>';
|
||||
print '<td>'.$langs->trans("Fax").'</td>';
|
||||
print "<td> </td>";
|
||||
print "</tr>";
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
$var=true;
|
||||
|
||||
foreach ($addressstatic->lines as $address)
|
||||
{
|
||||
$var = !$var;
|
||||
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
print '<td>';
|
||||
$addressstatic->id = $address->id;
|
||||
$addressstatic->label = $address->label;
|
||||
print $addressstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
|
||||
$addressstatic->label = $address->label;
|
||||
print $addressstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
|
||||
print '<td>'.$address->name.'</td>';
|
||||
|
||||
print '<td>'.$address->town.'</td>';
|
||||
|
||||
$img=picto_from_langcode($address->country_code);
|
||||
print '<td>'.($img?$img.' ':'').$address->country.'</td>';
|
||||
|
||||
// Lien click to dial
|
||||
print '<td>';
|
||||
print dol_print_phone($address->phone,$address->country_code,$address->id,$object->id,'AC_TEL');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print dol_print_phone($address->fax,$address->country_code,$address->id,$object->id,'AC_FAX');
|
||||
print '</td>';
|
||||
|
||||
if ($user->rights->societe->creer)
|
||||
{
|
||||
print '<td align="right">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/comm/address.php?action=edit&id='.$address->id.'&socid='.$object->id.'&backtopage='.urlencode($backtopage).'">';
|
||||
print img_edit();
|
||||
print '</a></td>';
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//print "<tr ".$bc[$var].">";
|
||||
//print '<td>'.$langs->trans("NoAddressYetDefined").'</td>';
|
||||
//print "</tr>\n";
|
||||
}
|
||||
print "\n</table>\n";
|
||||
|
||||
print "<br>\n";
|
||||
|
||||
return $num;
|
||||
print '<td>'.($img?$img.' ':'').$address->country.'</td>';
|
||||
|
||||
// Lien click to dial
|
||||
print '<td>';
|
||||
print dol_print_phone($address->phone,$address->country_code,$address->id,$object->id,'AC_TEL');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print dol_print_phone($address->fax,$address->country_code,$address->id,$object->id,'AC_FAX');
|
||||
print '</td>';
|
||||
|
||||
if ($user->rights->societe->creer)
|
||||
{
|
||||
print '<td align="right">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/comm/address.php?action=edit&id='.$address->id.'&socid='.$object->id.'&backtopage='.urlencode($backtopage).'">';
|
||||
print img_edit();
|
||||
print '</a></td>';
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//print "<tr ".$bc[$var].">";
|
||||
//print '<td>'.$langs->trans("NoAddressYetDefined").'</td>';
|
||||
//print "</tr>\n";
|
||||
}
|
||||
print "\n</table>\n";
|
||||
|
||||
print "<br>\n";
|
||||
|
||||
return $num;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -39,11 +39,11 @@ function contract_prepare_head($object)
|
||||
$head[$h][2] = 'card';
|
||||
$h++;
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/contrat/contact.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("ContactsAddresses");
|
||||
$head[$h][2] = 'contact';
|
||||
$head[$h][0] = DOL_URL_ROOT.'/contrat/contact.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("ContactsAddresses");
|
||||
$head[$h][2] = 'contact';
|
||||
$h++;
|
||||
}
|
||||
|
||||
@ -53,11 +53,11 @@ function contract_prepare_head($object)
|
||||
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'contract');
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
|
||||
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/contrat/note.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Note");
|
||||
$head[$h][2] = 'note';
|
||||
$head[$h][0] = DOL_URL_ROOT.'/contrat/note.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Note");
|
||||
$head[$h][2] = 'note';
|
||||
$h++;
|
||||
}
|
||||
|
||||
|
||||
@ -75,7 +75,7 @@ function getServerTimeZoneString()
|
||||
|
||||
/**
|
||||
* Return server timezone int.
|
||||
* If $conf->global->MAIN_NEW_DATE is set, we use new behaviour: All convertions take care of dayling saving time.
|
||||
* If $conf->global->MAIN_OLD_DATE is set or PHP too old, we use old behaviour: All convertions does not take care of dayling saving time.
|
||||
*
|
||||
* @param string $refgmtdate Reference period for timezone (timezone differs on winter and summer. May be 'now', 'winter' or 'summer')
|
||||
* @return int An offset in hour (+1 for Europe/Paris on winter and +2 for Europe/Paris on summer)
|
||||
@ -83,7 +83,7 @@ function getServerTimeZoneString()
|
||||
function getServerTimeZoneInt($refgmtdate='now')
|
||||
{
|
||||
global $conf;
|
||||
if (method_exists('DateTimeZone','getOffset') && ! empty($conf->global->MAIN_NEW_DATE))
|
||||
if (method_exists('DateTimeZone','getOffset') && empty($conf->global->MAIN_OLD_DATE))
|
||||
{
|
||||
// Method 1 (include daylight)
|
||||
$gmtnow=dol_now('gmt'); $yearref=dol_print_date($gmtnow,'%Y'); $monthref=dol_print_date($gmtnow,'%m'); $dayref=dol_print_date($gmtnow,'%d');
|
||||
@ -101,7 +101,7 @@ function getServerTimeZoneInt($refgmtdate='now')
|
||||
if ($refgmtdate == 'now')
|
||||
{
|
||||
if (ini_get("date.timezone")=='UTC') return 0;
|
||||
// We don't know server timezone string, so we don't know location, so we can't guess daylight. We assume we use same than client. Fix is to use MAIN_NEW_DATE.
|
||||
// We don't know server timezone string, so we don't know location, so we can't guess daylight. We assume we use same than client. Fix is to use new PHP with not MAIN_OLD_DATE.
|
||||
$gmtnow=dol_now('gmt'); $yearref=dol_print_date($gmtnow,'%Y'); $monthref=dol_print_date($gmtnow,'%m'); $dayref=dol_print_date($gmtnow,'%d');
|
||||
if (dol_stringtotime($_SESSION['dol_dst_first']) <= $gmtnow && $gmtnow < dol_stringtotime($_SESSION['dol_dst_second'])) $daylight=1;
|
||||
else $daylight=0;
|
||||
@ -111,7 +111,7 @@ function getServerTimeZoneInt($refgmtdate='now')
|
||||
elseif ($refgmtdate == 'summer')
|
||||
{
|
||||
if (ini_get("date.timezone")=='UTC') return 0;
|
||||
// We don't know server timezone string, so we don't know location, so we can't guess daylight. We assume we use same than client. Fix is to use MAIN_NEW_DATE.
|
||||
// We don't know server timezone string, so we don't know location, so we can't guess daylight. We assume we use same than client. Fix is to use new PHP with not MAIN_OLD_DATE.
|
||||
$gmtnow=dol_now('gmt'); $yearref=dol_print_date($gmtnow,'%Y'); $monthref='08'; $dayref='01';
|
||||
if (dol_stringtotime($_SESSION['dol_dst_first']) <= dol_stringtotime($yearref.'-'.$monthref.'-'.$dayref) && dol_stringtotime($yearref.'-'.$monthref.'-'.$dayref) < dol_stringtotime($_SESSION['dol_dst_second'])) $daylight=1;
|
||||
else $daylight=0;
|
||||
@ -146,7 +146,7 @@ function getParentCompanyTimeZoneString()
|
||||
function getParentCompanyTimeZoneInt($refgmtdate='now')
|
||||
{
|
||||
global $conf;
|
||||
if (class_exists('DateTime') && ! empty($conf->global->MAIN_NEW_DATE))
|
||||
if (class_exists('DateTime') && empty($conf->global->MAIN_OLD_DATE))
|
||||
{
|
||||
// Method 1 (include daylight)
|
||||
$localtz = new DateTimeZone(getParentCompanyTimeZoneString());
|
||||
|
||||
@ -43,11 +43,11 @@ function fichinter_prepare_head($object)
|
||||
$head[$h][2] = 'card';
|
||||
$h++;
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fichinter/contact.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('InterventionContact');
|
||||
$head[$h][2] = 'contact';
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fichinter/contact.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('InterventionContact');
|
||||
$head[$h][2] = 'contact';
|
||||
$h++;
|
||||
}
|
||||
|
||||
@ -65,11 +65,11 @@ function fichinter_prepare_head($object)
|
||||
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'intervention');
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
|
||||
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fichinter/note.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Notes');
|
||||
$head[$h][2] = 'note';
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fichinter/note.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Notes');
|
||||
$head[$h][2] = 'note';
|
||||
$h++;
|
||||
}
|
||||
|
||||
|
||||
@ -23,6 +23,17 @@
|
||||
* \brief Library for file managing functions
|
||||
*/
|
||||
|
||||
/**
|
||||
* Make a basename working with all page code (default PHP basenamed fails with cyrillic).
|
||||
* We supose dir separator for input is '/'.
|
||||
*
|
||||
* @param string $pathfile String to find basename.
|
||||
* @return string Basename of input
|
||||
*/
|
||||
function dol_basename($pathfile)
|
||||
{
|
||||
return preg_replace('/^.*\/([^\/]+)$/','$1',rtrim($pathfile,'/'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Scan a directory and return a list of files/directories.
|
||||
@ -496,9 +507,9 @@ function dol_move($srcfile, $destfile, $newmask=0, $overwriteifexists=1)
|
||||
*/
|
||||
function dol_unescapefile($filename)
|
||||
{
|
||||
// Remove path information and dots around the filename, to prevent uploading
|
||||
// into different directories or replacing hidden system files.
|
||||
// Also remove control characters and spaces (\x00..\x20) around the filename:
|
||||
// Remove path information and dots around the filename, to prevent uploading
|
||||
// into different directories or replacing hidden system files.
|
||||
// Also remove control characters and spaces (\x00..\x20) around the filename:
|
||||
return trim(basename($filename), ".\x00..\x20");
|
||||
}
|
||||
|
||||
@ -617,15 +628,15 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable
|
||||
{
|
||||
if (is_object($object))
|
||||
{
|
||||
$object->src_file=$dest_file;
|
||||
|
||||
// Appel des triggers
|
||||
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
|
||||
$interface=new Interfaces($db);
|
||||
$result=$interface->run_triggers('FILE_UPLOAD',$object,$user,$langs,$conf);
|
||||
if ($result < 0) {
|
||||
$error++; $errors=$interface->errors;
|
||||
}
|
||||
$object->src_file=$dest_file;
|
||||
|
||||
// Appel des triggers
|
||||
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
|
||||
$interface=new Interfaces($db);
|
||||
$result=$interface->run_triggers('FILE_UPLOAD',$object,$user,$langs,$conf);
|
||||
if ($result < 0) {
|
||||
$error++; $errors=$interface->errors;
|
||||
}
|
||||
// Fin appel triggers
|
||||
}
|
||||
else
|
||||
|
||||
@ -41,11 +41,11 @@ function facturefourn_prepare_head($object)
|
||||
$head[$h][2] = 'card';
|
||||
$h++;
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fourn/facture/contact.php?facid='.$object->id;
|
||||
$head[$h][1] = $langs->trans('ContactsAddresses');
|
||||
$head[$h][2] = 'contact';
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fourn/facture/contact.php?facid='.$object->id;
|
||||
$head[$h][1] = $langs->trans('ContactsAddresses');
|
||||
$head[$h][2] = 'contact';
|
||||
$h++;
|
||||
}
|
||||
|
||||
@ -55,11 +55,11 @@ function facturefourn_prepare_head($object)
|
||||
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'supplier_invoice');
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
|
||||
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fourn/facture/note.php?facid='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Notes');
|
||||
$head[$h][2] = 'note';
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fourn/facture/note.php?facid='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Notes');
|
||||
$head[$h][2] = 'note';
|
||||
$h++;
|
||||
}
|
||||
|
||||
@ -107,11 +107,11 @@ function ordersupplier_prepare_head($object)
|
||||
$h++;
|
||||
}
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fourn/commande/contact.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('ContactsAddresses');
|
||||
$head[$h][2] = 'contact';
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fourn/commande/contact.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('ContactsAddresses');
|
||||
$head[$h][2] = 'contact';
|
||||
$h++;
|
||||
}
|
||||
|
||||
@ -121,11 +121,11 @@ function ordersupplier_prepare_head($object)
|
||||
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'supplier_order');
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
|
||||
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fourn/commande/note.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Notes");
|
||||
$head[$h][2] = 'note';
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fourn/commande/note.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Notes");
|
||||
$head[$h][2] = 'note';
|
||||
$h++;
|
||||
}
|
||||
|
||||
|
||||
@ -960,7 +960,7 @@ function dol_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$check=1)
|
||||
if ($second< 0 || $second > 60) return '';
|
||||
}
|
||||
|
||||
if (method_exists('DateTime','getTimestamp') && ! empty($conf->global->MAIN_NEW_DATE))
|
||||
if (method_exists('DateTime','getTimestamp') && empty($conf->global->MAIN_OLD_DATE))
|
||||
{
|
||||
if (empty($gm)) $localtz = new DateTimeZone(date_default_timezone_get());
|
||||
else $localtz = new DateTimeZone('UTC');
|
||||
@ -4007,36 +4007,36 @@ function colorArrayToHex($arraycolor,$colorifnotfound='888888')
|
||||
if (! is_array($arraycolor)) return $colorifnotfound;
|
||||
return dechex($arraycolor[0]).dechex($arraycolor[1]).dechex($arraycolor[2]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a currency code into its symbol
|
||||
*
|
||||
* @param string $currency_code Currency code
|
||||
* @return string Currency symbol encoded into UTF8
|
||||
*/
|
||||
function getCurrencySymbol($currency_code)
|
||||
{
|
||||
global $db, $form;
|
||||
|
||||
$currency_sign = '';
|
||||
|
||||
if (! is_object($form)) $form = new Form($db);
|
||||
|
||||
$form->load_cache_currencies();
|
||||
|
||||
if (function_exists("mb_convert_encoding") && is_array($form->cache_currencies[$currency_code]['unicode']) && ! empty($form->cache_currencies[$currency_code]['unicode']))
|
||||
{
|
||||
foreach($form->cache_currencies[$currency_code]['unicode'] as $unicode)
|
||||
{
|
||||
|
||||
/**
|
||||
* Convert a currency code into its symbol
|
||||
*
|
||||
* @param string $currency_code Currency code
|
||||
* @return string Currency symbol encoded into UTF8
|
||||
*/
|
||||
function getCurrencySymbol($currency_code)
|
||||
{
|
||||
global $db, $form;
|
||||
|
||||
$currency_sign = '';
|
||||
|
||||
if (! is_object($form)) $form = new Form($db);
|
||||
|
||||
$form->load_cache_currencies();
|
||||
|
||||
if (function_exists("mb_convert_encoding") && is_array($form->cache_currencies[$currency_code]['unicode']) && ! empty($form->cache_currencies[$currency_code]['unicode']))
|
||||
{
|
||||
foreach($form->cache_currencies[$currency_code]['unicode'] as $unicode)
|
||||
{
|
||||
$currency_sign .= mb_convert_encoding("&#{$unicode};", "UTF-8", 'HTML-ENTITIES');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$currency_sign = $currency_code;
|
||||
}
|
||||
|
||||
return $currency_sign;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$currency_sign = $currency_code;
|
||||
}
|
||||
|
||||
return $currency_sign;
|
||||
}
|
||||
|
||||
if (! function_exists('getmypid'))
|
||||
|
||||
@ -24,6 +24,45 @@
|
||||
* This file contains all rare functions.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Same function than javascript unescape() function but in PHP.
|
||||
*
|
||||
* @param string $sourcetodecode String to decode
|
||||
* @return
|
||||
*/
|
||||
function jsUnEscape($source)
|
||||
{
|
||||
$decodedStr = "";
|
||||
$pos = 0;
|
||||
$len = strlen ($source);
|
||||
while ($pos < $len) {
|
||||
$charAt = substr ($source, $pos, 1);
|
||||
if ($charAt == '%') {
|
||||
$pos++;
|
||||
$charAt = substr ($source, $pos, 1);
|
||||
if ($charAt == 'u') {
|
||||
// we got a unicode character
|
||||
$pos++;
|
||||
$unicodeHexVal = substr ($source, $pos, 4);
|
||||
$unicode = hexdec ($unicodeHexVal);
|
||||
$entity = "&#". $unicode . ';';
|
||||
$decodedStr .= utf8_encode ($entity);
|
||||
$pos += 4;
|
||||
}
|
||||
else {
|
||||
// we have an escaped ascii character
|
||||
$hexVal = substr ($source, $pos, 2);
|
||||
$decodedStr .= chr (hexdec ($hexVal));
|
||||
$pos += 2;
|
||||
}
|
||||
} else {
|
||||
$decodedStr .= $charAt;
|
||||
$pos++;
|
||||
}
|
||||
}
|
||||
return dol_html_entity_decode($decodedStr, ENT_COMPAT);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return list of modules directories
|
||||
@ -146,7 +185,7 @@ function dol_print_object_info($object)
|
||||
$deltadateforclient=((int) $_SESSION['dol_tz'] + (int) $_SESSION['dol_dst']);
|
||||
//$deltadateforcompany=((int) $_SESSION['dol_tz'] + (int) $_SESSION['dol_dst']);
|
||||
$deltadateforuser=round($deltadateforclient-$deltadateforserver);
|
||||
//print "x".$deltadateforserver." - ".$deltadateforclient." - ".$deltadateforuser;
|
||||
//print "x".$deltadateforserver." - ".$deltadateforclient." - ".$deltadateforuser;
|
||||
|
||||
// Import key
|
||||
if (isset($object->import_key))
|
||||
|
||||
@ -40,11 +40,11 @@ function facture_prepare_head($object)
|
||||
$head[$h][2] = 'compta';
|
||||
$h++;
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/contact.php?facid='.$object->id;
|
||||
$head[$h][1] = $langs->trans('ContactsAddresses');
|
||||
$head[$h][2] = 'contact';
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/contact.php?facid='.$object->id;
|
||||
$head[$h][1] = $langs->trans('ContactsAddresses');
|
||||
$head[$h][2] = 'contact';
|
||||
$h++;
|
||||
}
|
||||
|
||||
@ -71,11 +71,11 @@ function facture_prepare_head($object)
|
||||
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'invoice');
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
|
||||
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/note.php?facid='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Notes');
|
||||
$head[$h][2] = 'note';
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/note.php?facid='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Notes');
|
||||
$head[$h][2] = 'note';
|
||||
$h++;
|
||||
}
|
||||
|
||||
|
||||
@ -25,60 +25,60 @@
|
||||
|
||||
if (! function_exists('json_encode'))
|
||||
{
|
||||
/**
|
||||
* Implement json_encode for PHP that does not support it
|
||||
*
|
||||
* @param mixed $elements PHP Object to json encode
|
||||
* @return string Json encoded string
|
||||
*/
|
||||
function json_encode($elements)
|
||||
/**
|
||||
* Implement json_encode for PHP that does not support it
|
||||
*
|
||||
* @param mixed $elements PHP Object to json encode
|
||||
* @return string Json encoded string
|
||||
*/
|
||||
function json_encode($elements)
|
||||
{
|
||||
return dol_json_encode($elements);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement json_encode for PHP that does not support it
|
||||
*
|
||||
* @param mixed $elements PHP Object to json encode
|
||||
* @return string Json encoded string
|
||||
*/
|
||||
function dol_json_encode($elements)
|
||||
{
|
||||
$num = count($elements);
|
||||
|
||||
// determine type
|
||||
if (is_numeric(key($elements)))
|
||||
{
|
||||
// indexed (list)
|
||||
$output = '[';
|
||||
for ($i = 0, $last = ($num - 1); isset($elements[$i]); ++$i)
|
||||
{
|
||||
if (is_array($elements[$i])) $output.= json_encode($elements[$i]);
|
||||
else $output .= _val($elements[$i]);
|
||||
if($i !== $last) $output.= ',';
|
||||
}
|
||||
$output.= ']';
|
||||
}
|
||||
else
|
||||
{
|
||||
// associative (object)
|
||||
$output = '{';
|
||||
$last = $num - 1;
|
||||
$i = 0;
|
||||
foreach($elements as $key => $value)
|
||||
{
|
||||
$output .= '"'.$key.'":';
|
||||
if (is_array($value)) $output.= json_encode($value);
|
||||
else $output .= _val($value);
|
||||
if ($i !== $last) $output.= ',';
|
||||
++$i;
|
||||
}
|
||||
$output.= '}';
|
||||
}
|
||||
|
||||
// return
|
||||
return $output;
|
||||
/**
|
||||
* Implement json_encode for PHP that does not support it
|
||||
*
|
||||
* @param mixed $elements PHP Object to json encode
|
||||
* @return string Json encoded string
|
||||
*/
|
||||
function dol_json_encode($elements)
|
||||
{
|
||||
$num = count($elements);
|
||||
|
||||
// determine type
|
||||
if (is_numeric(key($elements)))
|
||||
{
|
||||
// indexed (list)
|
||||
$output = '[';
|
||||
for ($i = 0, $last = ($num - 1); isset($elements[$i]); ++$i)
|
||||
{
|
||||
if (is_array($elements[$i])) $output.= json_encode($elements[$i]);
|
||||
else $output .= _val($elements[$i]);
|
||||
if($i !== $last) $output.= ',';
|
||||
}
|
||||
$output.= ']';
|
||||
}
|
||||
else
|
||||
{
|
||||
// associative (object)
|
||||
$output = '{';
|
||||
$last = $num - 1;
|
||||
$i = 0;
|
||||
foreach($elements as $key => $value)
|
||||
{
|
||||
$output .= '"'.$key.'":';
|
||||
if (is_array($value)) $output.= json_encode($value);
|
||||
else $output .= _val($value);
|
||||
if ($i !== $last) $output.= ',';
|
||||
++$i;
|
||||
}
|
||||
$output.= '}';
|
||||
}
|
||||
|
||||
// return
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -189,70 +189,70 @@ function _val($val)
|
||||
|
||||
if (! function_exists('json_decode'))
|
||||
{
|
||||
/**
|
||||
* Implement json_decode for PHP that does not support it
|
||||
*
|
||||
* @param string $json Json encoded to PHP Object or Array
|
||||
* @param bool $assoc False return an object, true return an array
|
||||
* @return mixed Object or Array
|
||||
*/
|
||||
function json_decode($json, $assoc=false)
|
||||
/**
|
||||
* Implement json_decode for PHP that does not support it
|
||||
*
|
||||
* @param string $json Json encoded to PHP Object or Array
|
||||
* @param bool $assoc False return an object, true return an array
|
||||
* @return mixed Object or Array
|
||||
*/
|
||||
function json_decode($json, $assoc=false)
|
||||
{
|
||||
return dol_json_decode($json, $assoc);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement json_decode for PHP that does not support it
|
||||
*
|
||||
* @param string $json Json encoded to PHP Object or Array
|
||||
* @param bool $assoc False return an object, true return an array. Try to always use it with true !
|
||||
* @return mixed Object or Array
|
||||
*/
|
||||
function dol_json_decode($json, $assoc=false)
|
||||
{
|
||||
$comment = false;
|
||||
|
||||
/**
|
||||
* Implement json_decode for PHP that does not support it
|
||||
*
|
||||
* @param string $json Json encoded to PHP Object or Array
|
||||
* @param bool $assoc False return an object, true return an array. Try to always use it with true !
|
||||
* @return mixed Object or Array
|
||||
*/
|
||||
function dol_json_decode($json, $assoc=false)
|
||||
{
|
||||
$comment = false;
|
||||
|
||||
$out='';
|
||||
$strLength = strlen($json); // Must stay strlen and not dol_strlen because we want technical length, not visible length
|
||||
for ($i=0; $i<$strLength; $i++)
|
||||
{
|
||||
if (! $comment)
|
||||
{
|
||||
if (($json[$i] == '{') || ($json[$i] == '[')) $out.= 'array(';
|
||||
else if (($json[$i] == '}') || ($json[$i] == ']')) $out.= ')';
|
||||
else if ($json[$i] == ':') $out.= ' => ';
|
||||
else $out.=$json[$i];
|
||||
}
|
||||
else $out.= $json[$i];
|
||||
if ($json[$i] == '"' && $json[($i-1)]!="\\") $comment = !$comment;
|
||||
}
|
||||
|
||||
$out=_unval($out);
|
||||
|
||||
// Return an array
|
||||
$strLength = strlen($json); // Must stay strlen and not dol_strlen because we want technical length, not visible length
|
||||
for ($i=0; $i<$strLength; $i++)
|
||||
{
|
||||
if (! $comment)
|
||||
{
|
||||
if (($json[$i] == '{') || ($json[$i] == '[')) $out.= 'array(';
|
||||
else if (($json[$i] == '}') || ($json[$i] == ']')) $out.= ')';
|
||||
else if ($json[$i] == ':') $out.= ' => ';
|
||||
else $out.=$json[$i];
|
||||
}
|
||||
else $out.= $json[$i];
|
||||
if ($json[$i] == '"' && $json[($i-1)]!="\\") $comment = !$comment;
|
||||
}
|
||||
|
||||
$out=_unval($out);
|
||||
|
||||
// Return an array
|
||||
if ($out != '') eval('$array = '.$out.';');
|
||||
else $array=array();
|
||||
|
||||
// Return an object
|
||||
if (! $assoc)
|
||||
{
|
||||
if (! empty($array))
|
||||
{
|
||||
$object = false;
|
||||
|
||||
foreach ($array as $key => $value)
|
||||
{
|
||||
$object->{$key} = $value;
|
||||
}
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return $array;
|
||||
else $array=array();
|
||||
|
||||
// Return an object
|
||||
if (! $assoc)
|
||||
{
|
||||
if (! empty($array))
|
||||
{
|
||||
$object = false;
|
||||
|
||||
foreach ($array as $key => $value)
|
||||
{
|
||||
$object->{$key} = $value;
|
||||
}
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -68,11 +68,11 @@ function commande_prepare_head($object)
|
||||
$h++;
|
||||
}
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/commande/contact.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('ContactsAddresses');
|
||||
$head[$h][2] = 'contact';
|
||||
$head[$h][0] = DOL_URL_ROOT.'/commande/contact.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('ContactsAddresses');
|
||||
$head[$h][2] = 'contact';
|
||||
$h++;
|
||||
}
|
||||
|
||||
@ -91,11 +91,11 @@ function commande_prepare_head($object)
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
|
||||
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/commande/note.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Notes');
|
||||
$head[$h][2] = 'note';
|
||||
$head[$h][0] = DOL_URL_ROOT.'/commande/note.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Notes');
|
||||
$head[$h][2] = 'note';
|
||||
$h++;
|
||||
}
|
||||
|
||||
|
||||
@ -714,7 +714,7 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Show linked objects for PDF generation
|
||||
*
|
||||
* @param PDF &$pdf Object PDF
|
||||
@ -728,8 +728,8 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
|
||||
* @param string $default_font_size Font size
|
||||
* @param HookManager $hookmanager Hook manager object
|
||||
* @return void
|
||||
*/
|
||||
function pdf_writeLinkedObjects(&$pdf,$object,$outputlangs,$posx,$posy,$w,$h,$align,$default_font_size,$hookmanager=false)
|
||||
*/
|
||||
function pdf_writeLinkedObjects(&$pdf,$object,$outputlangs,$posx,$posy,$w,$h,$align,$default_font_size,$hookmanager=false)
|
||||
{
|
||||
$linkedobjects = pdf_getLinkedObjects($object,$outputlangs,$hookmanager);
|
||||
if (! empty($linkedobjects))
|
||||
@ -743,14 +743,14 @@ function pdf_writeLinkedObjects(&$pdf,$object,$outputlangs,$posx,$posy,$w,$h,$al
|
||||
|
||||
if (! empty($linkedobject["date_title"]) && ! empty($linkedobject["date_value"]))
|
||||
{
|
||||
$posy+=3;
|
||||
$pdf->SetXY($posx,$posy);
|
||||
$posy+=3;
|
||||
$pdf->SetXY($posx,$posy);
|
||||
$pdf->MultiCell($w, $h, $linkedobject["date_title"].' : '.$linkedobject["date_value"], '', $align);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $pdf->getY();
|
||||
|
||||
return $pdf->getY();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1354,26 +1354,26 @@ function pdf_getTotalQty($object,$type,$outputlangs,$hookmanager=false)
|
||||
*/
|
||||
function pdf_getCurrencySymbol(&$pdf, $currency_code)
|
||||
{
|
||||
global $db, $form;
|
||||
|
||||
$currency_sign = '';
|
||||
|
||||
if (! is_object($form)) $form = new Form($db);
|
||||
|
||||
$form->load_cache_currencies();
|
||||
|
||||
if (is_array($form->cache_currencies[$currency_code]['unicode']) && ! empty($form->cache_currencies[$currency_code]['unicode']))
|
||||
{
|
||||
foreach($form->cache_currencies[$currency_code]['unicode'] as $unicode)
|
||||
{
|
||||
$currency_sign.= $pdf->unichr($unicode);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$currency_sign = $currency_code;
|
||||
}
|
||||
|
||||
global $db, $form;
|
||||
|
||||
$currency_sign = '';
|
||||
|
||||
if (! is_object($form)) $form = new Form($db);
|
||||
|
||||
$form->load_cache_currencies();
|
||||
|
||||
if (is_array($form->cache_currencies[$currency_code]['unicode']) && ! empty($form->cache_currencies[$currency_code]['unicode']))
|
||||
{
|
||||
foreach($form->cache_currencies[$currency_code]['unicode'] as $unicode)
|
||||
{
|
||||
$currency_sign.= $pdf->unichr($unicode);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$currency_sign = $currency_code;
|
||||
}
|
||||
|
||||
return $currency_sign;
|
||||
}
|
||||
|
||||
@ -1417,13 +1417,25 @@ function pdf_getLinkedObjects($object,$outputlangs,$hookmanager=false)
|
||||
$linkedobjects[$objecttype]['date_value'] = dol_print_date($objects[$i]->date,'day','',$outputlangs);
|
||||
}
|
||||
}
|
||||
else if ($objecttype == 'contrat')
|
||||
{
|
||||
$outputlangs->load('contracts');
|
||||
$num=count($objects);
|
||||
for ($i=0;$i<$num;$i++)
|
||||
{
|
||||
$linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefContract");
|
||||
$linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($objects[$i]->ref);
|
||||
$linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("DateContract");
|
||||
$linkedobjects[$objecttype]['date_value'] = dol_print_date($objects[$i]->date_contrat,'day','',$outputlangs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// For add external linked objects
|
||||
if (is_object($hookmanager))
|
||||
{
|
||||
$parameters = array('linkedobjects' => $linkedobjects, 'outputlangs'=>$outputlangs);
|
||||
$action='';
|
||||
$parameters = array('linkedobjects' => $linkedobjects, 'outputlangs'=>$outputlangs);
|
||||
$action='';
|
||||
$hookmanager->executeHooks('pdf_getLinkedObjects',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
if (! empty($hookmanager->resArray)) $linkedobjects = $hookmanager->resArray;
|
||||
}
|
||||
|
||||
@ -155,9 +155,9 @@ function product_admin_prepare_head($object=null)
|
||||
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 1)
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/product/admin/product_tools.php';
|
||||
$head[$h][1] = $langs->trans("Tools");
|
||||
$head[$h][2] = 'tools';
|
||||
$head[$h][0] = DOL_URL_ROOT.'/product/admin/product_tools.php';
|
||||
$head[$h][1] = $langs->trans("Tools");
|
||||
$head[$h][2] = 'tools';
|
||||
$h++;
|
||||
}
|
||||
|
||||
|
||||
@ -65,9 +65,9 @@ function propal_prepare_head($object)
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/contact.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('ContactsAddresses');
|
||||
$head[$h][2] = 'contact';
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/contact.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('ContactsAddresses');
|
||||
$head[$h][2] = 'contact';
|
||||
$h++;
|
||||
}
|
||||
|
||||
|
||||
@ -286,7 +286,7 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature
|
||||
{
|
||||
$sql='';
|
||||
|
||||
$check = array('banque','user','usergroup','produit','service','produit|service','categorie'); // Test on entity only (Objects with no link to company)
|
||||
$check = array('adherent','banque','user','usergroup','produit','service','produit|service','categorie'); // Test on entity only (Objects with no link to company)
|
||||
$checksoc = array('societe'); // Test for societe object
|
||||
$checkother = array('contact'); // Test on entity and link to societe. Allowed if link is empty (Ex: contacts...).
|
||||
$checkproject = array('projet'); // Test for project object
|
||||
@ -319,7 +319,7 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature
|
||||
if ($user->societe_id <> $objectid) accessforbidden();
|
||||
}
|
||||
// If internal user: Check permission for internal users that are restricted on their objects
|
||||
else if (! $user->rights->societe->client->voir)
|
||||
else if (! empty($conf->societe->enabled) && ($user->rights->societe->lire && ! $user->rights->societe->client->voir))
|
||||
{
|
||||
$sql = "SELECT sc.fk_soc";
|
||||
$sql.= " FROM (".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
@ -349,7 +349,7 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature
|
||||
$sql.= " AND dbt.fk_soc = ".$user->societe_id;
|
||||
}
|
||||
// If internal user: Check permission for internal users that are restricted on their objects
|
||||
else if (! $user->rights->societe->client->voir)
|
||||
else if (! empty($conf->societe->enabled) && ($user->rights->societe->lire && ! $user->rights->societe->client->voir))
|
||||
{
|
||||
$sql = "SELECT dbt.rowid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt";
|
||||
@ -369,7 +369,7 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature
|
||||
}
|
||||
else if (in_array($feature,$checkproject))
|
||||
{
|
||||
if (! $user->rights->projet->all->lire)
|
||||
if (! empty($conf->projet->enabled) && ! $user->rights->projet->all->lire)
|
||||
{
|
||||
include_once(DOL_DOCUMENT_ROOT."/projet/class/project.class.php");
|
||||
$projectstatic=new Project($db);
|
||||
@ -379,9 +379,9 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "SELECT dbt.".$dbt_select;
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt";
|
||||
$sql.= " WHERE dbt.".$dbt_select." = ".$objectid;
|
||||
$sql = "SELECT dbt.".$dbt_select;
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt";
|
||||
$sql.= " WHERE dbt.".$dbt_select." = ".$objectid;
|
||||
$sql.= " AND dbt.entity IN (".getEntity($sharedelement, 1).")";
|
||||
}
|
||||
}
|
||||
@ -396,7 +396,7 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature
|
||||
$sql.= " AND dbt.".$dbt_keyfield." = ".$user->societe_id;
|
||||
}
|
||||
// If internal user: Check permission for internal users that are restricted on their objects
|
||||
else if (! $user->rights->societe->client->voir)
|
||||
else if (! empty($conf->societe->enabled) && ($user->rights->societe->lire && ! $user->rights->societe->client->voir))
|
||||
{
|
||||
$sql = "SELECT sc.fk_soc";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt";
|
||||
|
||||
@ -72,14 +72,14 @@ function checkLoginPassEntity($usertotest,$passwordtotest,$entitytotest,$authmod
|
||||
$mode=trim($mode);
|
||||
$authfile='functions_'.$mode.'.php';
|
||||
$fullauthfile='';
|
||||
|
||||
$dirlogin=array_merge(array("/core/login"),(array) $conf->modules_parts['login']);
|
||||
foreach($dirlogin as $reldir)
|
||||
{
|
||||
$dir=dol_buildpath($reldir,0);
|
||||
$newdir=dol_osencode($dir);
|
||||
|
||||
// Check if file found (do not use dol_is_file to avoid loading files.lib.php)
|
||||
|
||||
$dirlogin=array_merge(array("/core/login"),(array) $conf->modules_parts['login']);
|
||||
foreach($dirlogin as $reldir)
|
||||
{
|
||||
$dir=dol_buildpath($reldir,0);
|
||||
$newdir=dol_osencode($dir);
|
||||
|
||||
// Check if file found (do not use dol_is_file to avoid loading files.lib.php)
|
||||
if (is_file($newdir.'/'.$authfile)) $fullauthfile=$newdir.'/'.$authfile;
|
||||
}
|
||||
|
||||
@ -130,12 +130,12 @@ function dol_loginfunction($langs,$conf,$mysoc)
|
||||
global $dolibarr_main_demo,$db;
|
||||
global $smartphone,$hookmanager;
|
||||
|
||||
// Instantiate hooks of thirdparty module only if not already define
|
||||
if (! is_object($hookmanager))
|
||||
{
|
||||
include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php');
|
||||
$hookmanager=new HookManager($db);
|
||||
}
|
||||
// Instantiate hooks of thirdparty module only if not already define
|
||||
if (! is_object($hookmanager))
|
||||
{
|
||||
include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php');
|
||||
$hookmanager=new HookManager($db);
|
||||
}
|
||||
$hookmanager->initHooks(array('mainloginpage'));
|
||||
|
||||
$langcode=(GETPOST('lang')?((is_object($langs)&&$langs->defaultlang)?$langs->defaultlang:'auto'):GETPOST('lang'));
|
||||
@ -205,8 +205,8 @@ function dol_loginfunction($langs,$conf,$mysoc)
|
||||
}
|
||||
|
||||
// Execute hook getLoginPageOptions
|
||||
// Should be an array with differents options in $hookmanager->resArray
|
||||
$parameters=array('entity' => $_POST['entity']);
|
||||
// Should be an array with differents options in $hookmanager->resArray
|
||||
$parameters=array('entity' => $_POST['entity']);
|
||||
$hookmanager->executeHooks('getLoginPageOptions',$parameters); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
// Login
|
||||
|
||||
@ -45,12 +45,17 @@ function shipping_prepare_head($object)
|
||||
$head[$h][2] = 'shipping';
|
||||
$h++;
|
||||
|
||||
if ($conf->livraison_bon->enabled && $user->rights->expedition->livraison->lire && ! empty($object->linkedObjectsIds['delivery'][0]))
|
||||
if ($conf->livraison_bon->enabled && $user->rights->expedition->livraison->lire)
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT."/livraison/fiche.php?id=".$object->linkedObjectsIds['delivery'][0];
|
||||
$head[$h][1] = $langs->trans("DeliveryCard");
|
||||
$head[$h][2] = 'delivery';
|
||||
$h++;
|
||||
// delivery link
|
||||
$object->fetchObjectLinked($object->id,$object->element);
|
||||
if (! empty($object->linkedObjectsIds['delivery'][0]))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT."/livraison/fiche.php?id=".$object->linkedObjectsIds['delivery'][0];
|
||||
$head[$h][1] = $langs->trans("DeliveryCard");
|
||||
$head[$h][2] = 'delivery';
|
||||
$h++;
|
||||
}
|
||||
}
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/expedition/contact.php?id=".$object->id;
|
||||
|
||||
@ -219,53 +219,53 @@ function show_theme($fuser,$edit=0,$foruserprofile=false)
|
||||
|
||||
foreach($dirthemes as $dir)
|
||||
{
|
||||
$dirtheme=dol_buildpath($dir,0);
|
||||
$dirtheme=dol_buildpath($dir,0);
|
||||
$urltheme=dol_buildpath($dir,1);
|
||||
|
||||
if (is_dir($dirtheme))
|
||||
if (is_dir($dirtheme))
|
||||
{
|
||||
$handle=opendir($dirtheme);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
while (($subdir = readdir($handle))!==false)
|
||||
{
|
||||
if (is_dir($dirtheme."/".$subdir) && substr($subdir, 0, 1) <> '.'
|
||||
&& substr($subdir, 0, 3) <> 'CVS' && ! preg_match('/common|phones/i',$subdir))
|
||||
{
|
||||
// Disable not stable themes
|
||||
//if ($conf->global->MAIN_FEATURES_LEVEL < 1 && preg_match('/bureau2crea/i',$subdir)) continue;
|
||||
|
||||
if ($i % $thumbsbyrow == 0)
|
||||
{
|
||||
print '<tr '.$bc[$var].'>';
|
||||
}
|
||||
|
||||
print '<td align="center">';
|
||||
$file=$dirtheme."/".$subdir."/thumb.png";
|
||||
$url=$urltheme."/".$subdir."/thumb.png";
|
||||
if (! file_exists($file)) $url=$urltheme."/common/nophoto.jpg";
|
||||
print '<table><tr><td>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].($edit?'?action=edit&theme=':'?theme=').$subdir.(GETPOST("optioncss")?'&optioncss='.GETPOST("optioncss",'alpha',1):'').($fuser?'&id='.$fuser->id:'').'" style="font-weight: normal;" alt="'.$langs->trans("Preview").'">';
|
||||
if ($subdir == $conf->global->MAIN_THEME) $title=$langs->trans("ThemeCurrentlyActive");
|
||||
else $title=$langs->trans("ShowPreview");
|
||||
print '<img src="'.$url.'" border="0" width="80" height="60" alt="'.$title.'" title="'.$title.'">';
|
||||
print '</a>';
|
||||
print '</td></tr><tr><td align="center">';
|
||||
if ($subdir == $selected_theme)
|
||||
{
|
||||
print '<input '.($edit?'':'disabled').' type="radio" '.$bc[$var].' style="border: 0px;" checked name="main_theme" value="'.$subdir.'"> <b>'.$subdir.'</b>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input '.($edit?'':'disabled').' type="radio" '.$bc[$var].' style="border: 0px;" name="main_theme" value="'.$subdir.'"> '.$subdir;
|
||||
}
|
||||
print '</td></tr></table></td>';
|
||||
|
||||
$i++;
|
||||
|
||||
if ($i % $thumbsbyrow == 0) print '</tr>';
|
||||
}
|
||||
}
|
||||
$handle=opendir($dirtheme);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
while (($subdir = readdir($handle))!==false)
|
||||
{
|
||||
if (is_dir($dirtheme."/".$subdir) && substr($subdir, 0, 1) <> '.'
|
||||
&& substr($subdir, 0, 3) <> 'CVS' && ! preg_match('/common|phones/i',$subdir))
|
||||
{
|
||||
// Disable not stable themes
|
||||
//if ($conf->global->MAIN_FEATURES_LEVEL < 1 && preg_match('/bureau2crea/i',$subdir)) continue;
|
||||
|
||||
if ($i % $thumbsbyrow == 0)
|
||||
{
|
||||
print '<tr '.$bc[$var].'>';
|
||||
}
|
||||
|
||||
print '<td align="center">';
|
||||
$file=$dirtheme."/".$subdir."/thumb.png";
|
||||
$url=$urltheme."/".$subdir."/thumb.png";
|
||||
if (! file_exists($file)) $url=$urltheme."/common/nophoto.jpg";
|
||||
print '<table><tr><td>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].($edit?'?action=edit&theme=':'?theme=').$subdir.(GETPOST("optioncss")?'&optioncss='.GETPOST("optioncss",'alpha',1):'').($fuser?'&id='.$fuser->id:'').'" style="font-weight: normal;" alt="'.$langs->trans("Preview").'">';
|
||||
if ($subdir == $conf->global->MAIN_THEME) $title=$langs->trans("ThemeCurrentlyActive");
|
||||
else $title=$langs->trans("ShowPreview");
|
||||
print '<img src="'.$url.'" border="0" width="80" height="60" alt="'.$title.'" title="'.$title.'">';
|
||||
print '</a>';
|
||||
print '</td></tr><tr><td align="center">';
|
||||
if ($subdir == $selected_theme)
|
||||
{
|
||||
print '<input '.($edit?'':'disabled').' type="radio" '.$bc[$var].' style="border: 0px;" checked name="main_theme" value="'.$subdir.'"> <b>'.$subdir.'</b>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input '.($edit?'':'disabled').' type="radio" '.$bc[$var].' style="border: 0px;" name="main_theme" value="'.$subdir.'"> '.$subdir;
|
||||
}
|
||||
print '</td></tr></table></td>';
|
||||
|
||||
$i++;
|
||||
|
||||
if ($i % $thumbsbyrow == 0) print '</tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1370,7 +1370,7 @@ abstract class DolibarrModules
|
||||
{
|
||||
foreach($this->module_parts as $key => $value)
|
||||
{
|
||||
// If entity is defined
|
||||
// If entity is defined
|
||||
if (is_array($value) && isset($value['entity'])) $entity = $value['entity'];
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const";
|
||||
|
||||
@ -166,8 +166,8 @@ class CommActionRapport
|
||||
|
||||
$sql = "SELECT s.nom as societe, s.rowid as socid, s.client,";
|
||||
$sql.= " a.id, a.datep as dp, a.datep2 as dp2,";
|
||||
$sql.= " a.fk_contact, a.note, a.percent as percent,";
|
||||
$sql.= " c.libelle,";
|
||||
$sql.= " a.fk_contact, a.note, a.percent as percent, a.label,";
|
||||
$sql.= " c.code, c.libelle,";
|
||||
$sql.= " u.login";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."actioncomm as a";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
|
||||
@ -191,7 +191,10 @@ class CommActionRapport
|
||||
$y = max($y, $pdf->GetY(), $y0, $y1, $y2, $y3);
|
||||
|
||||
// Calculate height of text
|
||||
$text=dol_trunc(dol_htmlentitiesbr_decode($obj->note),150);
|
||||
$text='';
|
||||
if (! preg_match('/^'.preg_quote($obj->label).'/',$obj->note)) $text=$obj->label."\n";
|
||||
$text.=$obj->note;
|
||||
$text=dol_trunc(dol_htmlentitiesbr_decode($text),150);
|
||||
//print 'd'.$text; exit;
|
||||
$nboflines=dol_nboflines($text);
|
||||
$heightlinemax=max(2*$height,$nboflines*$height);
|
||||
@ -215,7 +218,7 @@ class CommActionRapport
|
||||
$y1 = $pdf->GetY();
|
||||
|
||||
$pdf->SetXY(60,$y);
|
||||
$pdf->MultiCell(32, $height, dol_trunc($outputlangs->convToOutputCharset($obj->libelle),32), 0, 'L', 0);
|
||||
$pdf->MultiCell(32, $height, dol_trunc($outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Action".$obj->code)),32), 0, 'L', 0);
|
||||
$y2 = $pdf->GetY();
|
||||
|
||||
$pdf->SetXY(106,$y);
|
||||
|
||||
@ -300,7 +300,7 @@ class pdf_edison extends ModelePDFCommandes
|
||||
// Actions on extra fields (by external module or standard code)
|
||||
if (! is_object($hookmanager))
|
||||
{
|
||||
include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php');
|
||||
include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php');
|
||||
$hookmanager=new HookManager($this->db);
|
||||
}
|
||||
$hookmanager->initHooks(array('pdfgeneration'));
|
||||
@ -651,7 +651,7 @@ class pdf_edison extends ModelePDFCommandes
|
||||
|
||||
|
||||
$posy+=1;
|
||||
|
||||
|
||||
// Show list of linked objects
|
||||
$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'L', $default_font_size, $hookmanager);
|
||||
}
|
||||
|
||||
@ -929,8 +929,8 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("OrderDate")." : " . dol_print_date($object->date,"%d %b %Y",false,$outputlangs,true), '', 'R');
|
||||
|
||||
$posy+=2;
|
||||
|
||||
$posy+=2;
|
||||
|
||||
// Show list of linked objects
|
||||
$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size, $hookmanager);
|
||||
|
||||
|
||||
@ -154,37 +154,37 @@ class MailingTargets // This can't be abstract as it is used for some method
|
||||
{
|
||||
if (! empty($cibles[$i]['email'])) // avoid empty email address
|
||||
{
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."mailing_cibles";
|
||||
$sql .= " (fk_mailing,";
|
||||
$sql .= " fk_contact,";
|
||||
$sql .= " nom, prenom, email, other, source_url, source_id,";
|
||||
if (! empty($conf->global->MAILING_EMAIL_UNSUBSCRIBE)) $sql .= " tag,";
|
||||
$sql.= " source_type)";
|
||||
$sql .= " VALUES (".$mailing_id.",";
|
||||
$sql .= (empty($cibles[$i]['fk_contact']) ? '0' : "'".$cibles[$i]['fk_contact']."'") .",";
|
||||
$sql .= "'".$this->db->escape($cibles[$i]['name'])."',";
|
||||
$sql .= "'".$this->db->escape($cibles[$i]['firstname'])."',";
|
||||
$sql .= "'".$this->db->escape($cibles[$i]['email'])."',";
|
||||
$sql .= "'".$this->db->escape($cibles[$i]['other'])."',";
|
||||
$sql .= "'".$this->db->escape($cibles[$i]['source_url'])."',";
|
||||
$sql .= "'".$this->db->escape($cibles[$i]['source_id'])."',";
|
||||
if (! empty($conf->global->MAILING_EMAIL_UNSUBSCRIBE)) $sql .= "'".$this->db->escape(md5($cibles[$i]['email'].';'.$cibles[$i]['name'].';'.$mailing_id.';'.$conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY))."',";
|
||||
$sql .= "'".$this->db->escape($cibles[$i]['source_type'])."')";
|
||||
$result=$this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$j++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($this->db->errno() != 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
{
|
||||
// Si erreur autre que doublon
|
||||
dol_syslog($this->db->error());
|
||||
$this->error=$this->db->error();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."mailing_cibles";
|
||||
$sql .= " (fk_mailing,";
|
||||
$sql .= " fk_contact,";
|
||||
$sql .= " nom, prenom, email, other, source_url, source_id,";
|
||||
if (! empty($conf->global->MAILING_EMAIL_UNSUBSCRIBE)) $sql .= " tag,";
|
||||
$sql.= " source_type)";
|
||||
$sql .= " VALUES (".$mailing_id.",";
|
||||
$sql .= (empty($cibles[$i]['fk_contact']) ? '0' : "'".$cibles[$i]['fk_contact']."'") .",";
|
||||
$sql .= "'".$this->db->escape($cibles[$i]['name'])."',";
|
||||
$sql .= "'".$this->db->escape($cibles[$i]['firstname'])."',";
|
||||
$sql .= "'".$this->db->escape($cibles[$i]['email'])."',";
|
||||
$sql .= "'".$this->db->escape($cibles[$i]['other'])."',";
|
||||
$sql .= "'".$this->db->escape($cibles[$i]['source_url'])."',";
|
||||
$sql .= "'".$this->db->escape($cibles[$i]['source_id'])."',";
|
||||
if (! empty($conf->global->MAILING_EMAIL_UNSUBSCRIBE)) $sql .= "'".$this->db->escape(md5($cibles[$i]['email'].';'.$cibles[$i]['name'].';'.$mailing_id.';'.$conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY))."',";
|
||||
$sql .= "'".$this->db->escape($cibles[$i]['source_type'])."')";
|
||||
$result=$this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$j++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($this->db->errno() != 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
{
|
||||
// Si erreur autre que doublon
|
||||
dol_syslog($this->db->error());
|
||||
$this->error=$this->db->error();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -74,8 +74,8 @@ class modMailing extends DolibarrModules
|
||||
// Permissions
|
||||
$this->rights = array();
|
||||
$this->rights_class = 'mailing';
|
||||
$r=0;
|
||||
|
||||
$r=0;
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 221; // id de la permission
|
||||
$this->rights[$r][1] = 'Consulter les mailings'; // libelle de la permission
|
||||
@ -104,28 +104,28 @@ class modMailing extends DolibarrModules
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'supprimer';
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 237;
|
||||
$this->rights[$r][1] = 'View recipients and info';
|
||||
$this->rights[$r][2] = 'r';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'mailing_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
|
||||
$r++;
|
||||
$this->rights[$r][0] = 237;
|
||||
$this->rights[$r][1] = 'View recipients and info';
|
||||
$this->rights[$r][2] = 'r';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'mailing_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
|
||||
$this->rights[$r][5] = 'recipient';
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 238;
|
||||
$this->rights[$r][1] = 'Manually send mailings';
|
||||
$this->rights[$r][2] = 'w';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'mailing_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
|
||||
$r++;
|
||||
$this->rights[$r][0] = 238;
|
||||
$this->rights[$r][1] = 'Manually send mailings';
|
||||
$this->rights[$r][2] = 'w';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'mailing_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
|
||||
$this->rights[$r][5] = 'send';
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 239;
|
||||
$this->rights[$r][1] = 'Delete mailings after validation and/or sent';
|
||||
$this->rights[$r][2] = 'd';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'mailing_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
|
||||
$r++;
|
||||
$this->rights[$r][0] = 239;
|
||||
$this->rights[$r][1] = 'Delete mailings after validation and/or sent';
|
||||
$this->rights[$r][2] = 'd';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'mailing_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
|
||||
$this->rights[$r][5] = 'delete';
|
||||
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user