diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php
index e5aae08ca3c..bac638927c0 100644
--- a/htdocs/adherents/card_subscriptions.php
+++ b/htdocs/adherents/card_subscriptions.php
@@ -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
diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php
index 532d9c466ff..83b2c24dbc5 100644
--- a/htdocs/adherents/class/adherent.class.php
+++ b/htdocs/adherents/class/adherent.class.php
@@ -1008,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."'";
}
diff --git a/htdocs/adherents/document.php b/htdocs/adherents/document.php
index b838294770b..5b7ca0d2614 100644
--- a/htdocs/adherents/document.php
+++ b/htdocs/adherents/document.php
@@ -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');
diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php
index 2d72004f6a0..650ec5016af 100644
--- a/htdocs/adherents/fiche.php
+++ b/htdocs/adherents/fiche.php
@@ -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
diff --git a/htdocs/adherents/note.php b/htdocs/adherents/note.php
index a99ae057925..5ede330a911 100644
--- a/htdocs/adherents/note.php
+++ b/htdocs/adherents/note.php
@@ -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);
diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php
index 16203fecde3..80ec61b3f98 100644
--- a/htdocs/adherents/type.php
+++ b/htdocs/adherents/type.php
@@ -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'))
diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php
index ea7dcd7c4ab..71ec16150b6 100644
--- a/htdocs/admin/dict.php
+++ b/htdocs/admin/dict.php
@@ -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 '
';
- print '';
- print ' ';
- print '';
+ print '';
+ print '';
+ print ' ';
+ print '';
print '';
print '';
diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php
index 74aba8662a6..403fedddd15 100644
--- a/htdocs/comm/propal.php
+++ b/htdocs/comm/propal.php
@@ -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 = ''.$langs->trans("FileWasRemoved",GETPOST('file')).'
';
- }
+// 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 = ''.$langs->trans("FileWasRemoved",GETPOST('file')).'
';
+ }
}
// 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 = ''.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'
';
- }
- else
- {
- $mesg = ''.$object->error.'
';
- }
- }
- }
-
- // 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 = ''.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'
';
+ }
+ else
+ {
+ $mesg = ''.$object->error.'
';
+ }
+ }
+ }
+
+ // 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 '| '.$langs->trans('Status').' | ';
-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');
}
diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php
index 7b78fd20f09..761f68cde5d 100644
--- a/htdocs/comm/propal/class/propal.class.php
+++ b/htdocs/comm/propal/class/propal.class.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";
diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php
index 53e8cd6475e..5940c01c247 100644
--- a/htdocs/comm/propal/document.php
+++ b/htdocs/comm/propal/document.php
@@ -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 '';
-
- $linkback=''.$langs->trans("BackToList").'';
-
- // Ref
- print '| '.$langs->trans('Ref').' | ';
- print $form->showrefnav($object,'ref',$linkback,1,'ref','ref','');
- print ' | ';
-
- // Ref client
- print '';
- print '| ';
- print $langs->trans('RefCustomer').' | ';
- print ' | ';
- print ' ';
- print ' | ';
- print $object->ref_client;
- print ' | ';
- print ' ';
-
- // Customer
- print "| ".$langs->trans("Company")." | ";
- print ''.$object->thirdparty->getNomUrl(1).' | ';
-
- print '| '.$langs->trans("NbOfAttachedFiles").' | '.count($filearray).' | ';
- print '| '.$langs->trans("TotalSizeOfAttachedFiles").' | '.$totalsize.' '.$langs->trans("bytes").' | ';
-
- print ' ';
-
- print '';
-
- 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 ' ';
- }
-
- // 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 '';
+
+ $linkback=''.$langs->trans("BackToList").'';
+
+ // Ref
+ print '| '.$langs->trans('Ref').' | ';
+ print $form->showrefnav($object,'ref',$linkback,1,'ref','ref','');
+ print ' | ';
+
+ // Ref client
+ print '';
+ print '| ';
+ print $langs->trans('RefCustomer').' | ';
+ print ' | ';
+ print ' ';
+ print ' | ';
+ print $object->ref_client;
+ print ' | ';
+ print ' ';
+
+ // Customer
+ print "| ".$langs->trans("Company")." | ";
+ print ''.$object->thirdparty->getNomUrl(1).' | ';
+
+ print '| '.$langs->trans("NbOfAttachedFiles").' | '.count($filearray).' | ';
+ print '| '.$langs->trans("TotalSizeOfAttachedFiles").' | '.$totalsize.' '.$langs->trans("bytes").' | ';
+
+ print ' ';
+
+ print '';
+
+ 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 ' ';
+ }
+
+ // 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
diff --git a/htdocs/comm/propal/index.php b/htdocs/comm/propal/index.php
index ea518da991a..6063c21a8d0 100644
--- a/htdocs/comm/propal/index.php
+++ b/htdocs/comm/propal/index.php
@@ -184,14 +184,14 @@ if ($conf->propal->enabled)
$obj = $db->fetch_object($resql);
print " |
";
- $propalstatic->id=$obj->rowid;
- $propalstatic->ref=$obj->ref;
+ $propalstatic->id=$obj->rowid;
+ $propalstatic->ref=$obj->ref;
print '| '.$propalstatic->getNomUrl(1).' | ';
- $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 ''.$companystatic->getNomUrl(1,'customer',24).' | ';
print '
';
@@ -265,10 +265,10 @@ if ($resql)
print '';
- $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 ''.$companystatic->getNomUrl(1,'customer').' | ';
print ''.dol_print_date($db->jdate($obj->datec),'day').' | ';
@@ -340,10 +340,10 @@ if ($conf->propal->enabled && $user->rights->propale->lire)
print "";
- $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 ''.$companystatic->getNomUrl(1,'customer',44).' | '."\n";
print '';
diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php
index 0fbd9b060ca..f8f9f361cd0 100644
--- a/htdocs/comm/propal/list.php
+++ b/htdocs/comm/propal/list.php
@@ -86,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);
}
@@ -172,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)
{
@@ -284,8 +284,8 @@ if ($result)
print ' | ';
print '';
print ' | ';
- print '';
- print '';
+ print ' | ';
+ print '';
print ' | ';
print '';
print $langs->trans('Month').': ';
@@ -352,8 +352,8 @@ if ($result)
print ' | ';
// Customer ref
- print '';
- print $objp->ref_client;
+ print ' | ';
+ print $objp->ref_client;
print ' | ';
// Date propale
diff --git a/htdocs/comm/propal/note.php b/htdocs/comm/propal/note.php
index d7d88029062..0c90d58b1ac 100644
--- a/htdocs/comm/propal/note.php
+++ b/htdocs/comm/propal/note.php
@@ -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);
}
diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index e52b96e2856..21ac189e562 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -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'));
diff --git a/htdocs/commande/customer.php b/htdocs/commande/customer.php
index dc664de96e9..8386f77d88a 100755
--- a/htdocs/commande/customer.php
+++ b/htdocs/commande/customer.php
@@ -163,7 +163,7 @@ if ($resql)
$lienfin='';
$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 '';
diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php
index 84c2896e0e3..e158495b0c2 100644
--- a/htdocs/commande/document.php
+++ b/htdocs/commande/document.php
@@ -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'] = ''.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'
';
- Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
+ Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
exit;
}
}
diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php
index 74485eafb37..dff7aa50de9 100644
--- a/htdocs/commande/fiche.php
+++ b/htdocs/commande/fiche.php
@@ -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 = ''.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'
';
- }
- else
- {
- $mesg = ''.$object->error.'
';
- }
- }
- }
-
- // 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 = ''.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'
';
+ }
+ else
+ {
+ $mesg = ''.$object->error.'
';
+ }
+ }
+ }
+
+ // 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 ''.$object->getLibStatut(4).' | ';
print '';
- print '
';
+ print '
';
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');
}
/*
diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php
index 16a45b0a7d9..a521f766574 100755
--- a/htdocs/commande/orderstoinvoice.php
+++ b/htdocs/commande/orderstoinvoice.php
@@ -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=''.$object->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=''.$object->error.'
';
+ }
}
-
- /*
- * 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 '\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 '';
- $companystatic->id=$socid;
- $companystatic->nom=$soc->nom;
-
- print $companystatic->getNomUrl(1,'customer');
+ // Company
+ print '';
+ $companystatic->id=$socid;
+ $companystatic->nom=$soc->nom;
+
+ print $companystatic->getNomUrl(1,'customer');
print '
';
print '
';
print '';
@@ -584,8 +584,8 @@ else
print '';
//ALL/NONE
- print '| ';
- if ($conf->use_javascript_ajax) print ''.$langs->trans("All").' / '.$langs->trans("None").'';
+ print ' | ';
+ if ($conf->use_javascript_ajax) print ''.$langs->trans("All").' / '.$langs->trans("None").'';
print ' | ';
print '
';
@@ -625,13 +625,13 @@ else
print ''.$objp->ref_client.' | ';
// Order date
- print '';
- print dol_print_date($db->jdate($objp->date_commande),'day');
+ print ' | ';
+ print dol_print_date($db->jdate($objp->date_commande),'day');
print ' | ';
//Delivery date
- print '';
- print dol_print_date($db->jdate($objp->date_livraison),'day');
+ print ' | ';
+ print dol_print_date($db->jdate($objp->date_livraison),'day');
print ' | ';
// Statut
@@ -650,15 +650,15 @@ else
}
print '
';
- /*
- * Boutons actions
+ /*
+ * Boutons actions
*/
- print '';
- print '
';
- print '
';
+ print '
';
+ print '
';
+ print '
';
print '
';
- print '
'.$langs->trans("GoBack").'';
- print '
';
+ print '
'.$langs->trans("GoBack").'';
+ print '
';
print '';
$db->free($resql);
}
diff --git a/htdocs/compta/deplacement/fiche.php b/htdocs/compta/deplacement/fiche.php
index cf97fd8ee83..9e97c88ae1e 100644
--- a/htdocs/compta/deplacement/fiche.php
+++ b/htdocs/compta/deplacement/fiche.php
@@ -499,8 +499,8 @@ else if ($id)
print "
";
// Notes
- $blocname = 'notes';
- $title = $langs->trans('Notes');
+ $blocname = 'notes';
+ $title = $langs->trans('Notes');
include(DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php');
print '
';
diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index 6ea8b90fa01..ac5c2afde9e 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -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 = '
'.$langs->trans("FileWasRemoved",GETPOST('file')).'
';
- }
+// 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 = '
'.$langs->trans("FileWasRemoved",GETPOST('file')).'
';
+ }
}
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index e8ecfaf74b5..4842d8f5079 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -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();
diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php
index bdb0990f4b3..7a789c32c4f 100644
--- a/htdocs/compta/facture/document.php
+++ b/htdocs/compta/facture/document.php
@@ -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
diff --git a/htdocs/compta/facture/note.php b/htdocs/compta/facture/note.php
index c2258ea78f8..c68ad3777d8 100644
--- a/htdocs/compta/facture/note.php
+++ b/htdocs/compta/facture/note.php
@@ -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
diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php
index 5f343fd8944..2bdfc30a440 100644
--- a/htdocs/contrat/class/contrat.class.php
+++ b/htdocs/contrat/class/contrat.class.php
@@ -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)
diff --git a/htdocs/contrat/contact.php b/htdocs/contrat/contact.php
index 7a35a414481..915a2775b91 100644
--- a/htdocs/contrat/contact.php
+++ b/htdocs/contrat/contact.php
@@ -168,9 +168,9 @@ if ($id > 0 || ! empty($ref))
print '
';
- print '
';
-
- // Contacts lines
+ print '
';
+
+ // Contacts lines
include(DOL_DOCUMENT_ROOT.'/core/tpl/contacts.tpl.php');
}
diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php
index a16030a686b..298fdd0da4e 100644
--- a/htdocs/contrat/document.php
+++ b/htdocs/contrat/document.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'] = ''.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'
';
- 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'] = ''.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'
';
+ 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 '
';
+ */
+ 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 '
';
}
diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php
index 3e26e4c9b88..4474f56ea05 100644
--- a/htdocs/contrat/fiche.php
+++ b/htdocs/contrat/fiche.php
@@ -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=''.$object->error.'
';
+ $object->fetch_thirdparty();
+ $result=$object->delete($user);
+ if ($result >= 0)
+ {
+ Header("Location: index.php");
+ return;
+ }
+ else
+ {
+ $mesg=''.$object->error.'
';
}
}
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=''.$object->error.'
';
- }
- }
- else
- {
- $mesg=''.$langs->trans("ErrorFieldRequired",$langs->transnoentities("RefNewContract")).'
';
+ 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=''.$object->error.'
';
+ }
+ }
+ else
+ {
+ $mesg=''.$langs->trans("ErrorFieldRequired",$langs->transnoentities("RefNewContract")).'
';
}
}
-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 = ''.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'
';
- }
- else
- {
- $mesg = ''.$object->error.'
';
- }
- }
- }
-
- // 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 = ''.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'
';
+ }
+ else
+ {
+ $mesg = ''.$object->error.'
';
+ }
+ }
+ }
+
+ // 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 '
';
- 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');
}
diff --git a/htdocs/contrat/note.php b/htdocs/contrat/note.php
index 0855fc6ec29..57bd23ccd89 100644
--- a/htdocs/contrat/note.php
+++ b/htdocs/contrat/note.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');
diff --git a/htdocs/core/ajax/fileupload.php b/htdocs/core/ajax/fileupload.php
index a3a525d0d3c..30c52242f74 100644
--- a/htdocs/core/ajax/fileupload.php
+++ b/htdocs/core/ajax/fileupload.php
@@ -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':
diff --git a/htdocs/core/ajax/loadinplace.php b/htdocs/core/ajax/loadinplace.php
index 55d9adb70f3..45781e46379 100644
--- a/htdocs/core/ajax/loadinplace.php
+++ b/htdocs/core/ajax/loadinplace.php
@@ -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];
}
diff --git a/htdocs/core/ajax/saveinplace.php b/htdocs/core/ajax/saveinplace.php
index 50541facffa..04cb8955a8a 100644
--- a/htdocs/core/ajax/saveinplace.php
+++ b/htdocs/core/ajax/saveinplace.php
@@ -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');
diff --git a/htdocs/core/ajax/vatrates.php b/htdocs/core/ajax/vatrates.php
index c4ecc36ae9b..985cfb9b71b 100644
--- a/htdocs/core/ajax/vatrates.php
+++ b/htdocs/core/ajax/vatrates.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);
}
diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php
index 32f4634e40e..a216383b9d5 100644
--- a/htdocs/core/class/conf.class.php
+++ b/htdocs/core/class/conf.class.php
@@ -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);
}
}
}
diff --git a/htdocs/core/class/fileupload.class.php b/htdocs/core/class/fileupload.class.php
index 3fff8b7667c..50b699d8b33 100644
--- a/htdocs/core/class/fileupload.class.php
+++ b/htdocs/core/class/fileupload.class.php
@@ -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)) {
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 6b8e3469d34..595f1eba0d8 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -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 = ''.$this->db->error().'';
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.= '