Merge branch 'develop' of https://github.com/Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
9a812b799d
22
ChangeLog
22
ChangeLog
@ -4,6 +4,7 @@ English Dolibarr ChangeLog
|
||||
|
||||
***** ChangeLog for 3.4 compared to 3.3.2 *****
|
||||
For users:
|
||||
- New: Event into calendar use different colors for different users.
|
||||
- New: Support revenue stamp onto invoices.
|
||||
- New: Add a tab "consumption" on thirdparties to list products bought/sells.
|
||||
- New: Some performance enhancements.
|
||||
@ -30,7 +31,8 @@ For users:
|
||||
- New: Can define a different clicktodial setup per user.
|
||||
- New: Add option INVOICE_CAN_NEVER_BE_REMOVED.
|
||||
- New: Enhance agenda module to reach RFC2445 (add busy information).
|
||||
- First change to prepare feature click to print for PDF.
|
||||
- New: Add module Opensurvey.
|
||||
- First change to prepare feature "click to print" (IPP) for PDF.
|
||||
|
||||
For translators:
|
||||
- Update language files.
|
||||
@ -87,24 +89,6 @@ WARNING: If you used external modules, some of them may need to be upgraded due
|
||||
|
||||
|
||||
|
||||
***** ChangeLog for 3.3.2 compared to 3.3.1 *****
|
||||
|
||||
-Fix: Ducth (nl_NL) translation
|
||||
-Fix: [ bug #790 ] Spanish localtax RE not being correctly calculated
|
||||
-Generalize fix: file with a specific mask not found, again
|
||||
|
||||
|
||||
|
||||
***** ChangeLog for 3.3.1 compared to 3.3 *****
|
||||
|
||||
- Fix: [ bug #733 ] Mass emailing tools do not support <style HTML tag
|
||||
- Fix: Package for launchpad
|
||||
- Fix: [ bug #736 ] Missing column in llx_c_chargesociales
|
||||
- Fix: Localtax2 for Spain must be based into buyer
|
||||
- Fix: [ bug #762 ] Bad profit calculation in Reporting
|
||||
|
||||
|
||||
|
||||
***** ChangeLog for 3.3 compared to 3.2.3 *****
|
||||
For users:
|
||||
- New: Add holiday module, to declare and follow holidays of your employees.
|
||||
|
||||
@ -1,21 +0,0 @@
|
||||
README (English)
|
||||
--------------------------------
|
||||
|
||||
This directory contains example of PHPCheckStyle configuration
|
||||
to use for quality assurance on PHP developpement.
|
||||
|
||||
To run PHPCheckstyle in eclipse, you must:
|
||||
- install plugin PHP Tools integration http://www.phpsrc.org/eclipse/pti/
|
||||
- Unzip PHPCheckStyle archive into a directory.
|
||||
- Go in Eclipse - Window - Preferences - Dynamic Languages - Validator
|
||||
Choose External PHP Script,
|
||||
Set path ro run.php file for localhost
|
||||
Choose a PHP version,
|
||||
Set parameter string with
|
||||
--src %f --config "phpstandard.cfg.xml" --format console
|
||||
Choose php as Filename extension
|
||||
Check Print PHP output to console
|
||||
Then add patern
|
||||
* %f INFO Line:%n - %m Warning
|
||||
* %f WARNING Line:%n - %m Warning
|
||||
* %f ERROR Line:%n - %m Error
|
||||
@ -1,316 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE phpstandard SYSTEM "phpstandard.dtd">
|
||||
<!-- somewhat inspired by java checkstyle -->
|
||||
<phpcheckstyle-configuration>
|
||||
|
||||
<!-- **************** -->
|
||||
<!-- Naming -->
|
||||
<!-- **************** -->
|
||||
|
||||
<!-- Check Constant Naming -->
|
||||
<!-- Disabled to avoid warning with $sql="SELECT ..."
|
||||
<test name="constantNaming" regexp="/^[A-Z_][A-Z_]*[A-Z_]$/" level="ERROR"/>
|
||||
-->
|
||||
|
||||
<!-- Check Variable Naming -->
|
||||
<test name="variableNaming" regexp="/^[a-zA-Z_][a-zA-Z0-9_]*$/" />
|
||||
|
||||
<!-- Check Function Naming -->
|
||||
<test name="functionNaming" regexp="/^[a-z_]/" level="WARNING"/>
|
||||
|
||||
<!-- Check Private Function Naming -->
|
||||
<test name="privateFunctionNaming" regexp="/^[a-z_]/" level="ERROR"/>
|
||||
|
||||
<!-- Checks the constuctor naming -->
|
||||
<!-- old = old style (constructor = name of the class) -->
|
||||
<!-- new = "__construct()" -->
|
||||
<test name="constructorNaming">
|
||||
<property name="naming" value="old"/>
|
||||
</test>
|
||||
|
||||
<!-- Check Class Naming -->
|
||||
<test name="classNaming" regexp="/^[A-Z]/" level="WARNING"/>
|
||||
|
||||
|
||||
<!-- **************** -->
|
||||
<!-- PHP Tags -->
|
||||
<!-- **************** -->
|
||||
|
||||
|
||||
<!-- Test if a short php code open tag is used (? instead of ?php ). -->
|
||||
<test name="noShortPhpCodeTag"/>
|
||||
|
||||
<!-- Test if a PHP closing file is present at the end of a file -->
|
||||
<!-- <test name="noFileCloseTag"/> -->
|
||||
|
||||
<!-- Test if a file finish with some inner HTML (OK for some view but could provoque "header already sent" error) -->
|
||||
<!-- <test name="noFileFinishHTML" level="ERROR" /> -->
|
||||
|
||||
|
||||
<!-- **************** -->
|
||||
<!-- Comments -->
|
||||
<!-- **************** -->
|
||||
|
||||
<!-- Check if some C style comments are used (#) -->
|
||||
<test name="noShellComments"/>
|
||||
|
||||
<!-- Tests that every function and class is immediately preceded by a docblock. A property "excludePrivateMembers" can be set if you want to disable docblocks for private member functions. -->
|
||||
<test name="docBlocks">
|
||||
<property name="excludePrivateMembers" value="true"/>
|
||||
<property name="testReturn" value="true"/>
|
||||
<property name="testParam" value="true"/>
|
||||
<property name="testThrow" value="true"/>
|
||||
</test>
|
||||
|
||||
|
||||
<!-- **************** -->
|
||||
<!-- Indentation -->
|
||||
<!-- **************** -->
|
||||
|
||||
<!-- Tests to make sure that a line does not contain the tab character. -->
|
||||
<!-- <test name="noTabs"/> -->
|
||||
|
||||
<!-- Test to make sure that every control structure is included within a {} block, even if it is syntactically optional. -->
|
||||
<!-- <test name="controlStructNeedCurly"/> -->
|
||||
|
||||
<!-- Check the position of the open curly brace in a control structure (if) -->
|
||||
<!-- sl = same line -->
|
||||
<!-- nl = new line -->
|
||||
<test name="controlStructOpenCurly">
|
||||
<property name="position" value="nl"/>
|
||||
</test>
|
||||
|
||||
<!-- Check the position of the close curly brace -->
|
||||
<test name="controlCloseCurly" level="INFO">
|
||||
</test>
|
||||
|
||||
<!-- Check the position of the open curly brace after a function -->
|
||||
<!-- sl = same line -->
|
||||
<!-- nl = new line -->
|
||||
<test name="funcDefinitionOpenCurly">
|
||||
<property name="position" value="nl"/>
|
||||
</test>
|
||||
|
||||
<!-- Check the position of the else -->
|
||||
<!-- sl = same line -->
|
||||
<!-- nl = new line -->
|
||||
<test name="controlStructElse">
|
||||
<property name="position" value="nl"/>
|
||||
</test>
|
||||
|
||||
|
||||
<!-- **************** -->
|
||||
<!-- Spaces -->
|
||||
<!-- **************** -->
|
||||
|
||||
<!-- Tests that the control statements ("if", "else", "while", "for", etc.)
|
||||
are followed by a space before the opening parenthesis.
|
||||
PEAR standard stipulates this to distinguish it from function calls.
|
||||
-->
|
||||
<!--
|
||||
<test name="spaceAfterControlStmt"/>
|
||||
-->
|
||||
|
||||
<!-- Check that there is no space after a function name in a function call -->
|
||||
<!-- <test name="noSpaceAfterFunctionName" level="INFO"></test> -->
|
||||
|
||||
|
||||
<!-- Check for the (required) presence of a white space after some tokens (like ,) -->
|
||||
<!--
|
||||
<test name="checkWhiteSpaceAfter">
|
||||
<exception value="."/>
|
||||
</test>
|
||||
-->
|
||||
|
||||
<!-- Check for the (required) presence of a white space before some tokens -->
|
||||
<!--
|
||||
<test name="checkWhiteSpaceBefore">
|
||||
<exception value="."/>
|
||||
<exception value=":"/>
|
||||
</test>
|
||||
-->
|
||||
|
||||
<!-- Check that there is no space before before some tokens -->
|
||||
<!--
|
||||
<test name="noSpaceBeforeToken" level="INFO">
|
||||
</test>
|
||||
-->
|
||||
|
||||
<!-- Check that there is no space after some tokens -->
|
||||
<!--
|
||||
<test name="noSpaceAfterToken" level="INFO">
|
||||
</test>
|
||||
-->
|
||||
|
||||
<!-- **************** -->
|
||||
<!-- Metrics -->
|
||||
<!-- **************** -->
|
||||
|
||||
<!-- Check that the lenght of the line doesn't pass the max value -->
|
||||
<test name="lineLength" level="INFO">
|
||||
<property name="maxLineLength" value="160"/>
|
||||
</test>
|
||||
|
||||
<!-- Checks that the lenght (in lines) of a function doesn't pass the max value -->
|
||||
<test name="functionLength" level="INFO">
|
||||
<property name="maxLength" value="500"/>
|
||||
</test>
|
||||
|
||||
<!-- Checks for excessive parameters in a function declaration -->
|
||||
<!-- <test name="functionMaxParameters">
|
||||
<property name="maxParameters" value="4"/>
|
||||
</test> -->
|
||||
|
||||
<!-- Check Cyclomatic Complexity -->
|
||||
<!-- see http://www.aivosto.com/project/help/pm-complexity.html -->
|
||||
<test name="cyclomaticComplexity">
|
||||
<!-- Level raising a warning -->
|
||||
<property name="warningLevel" value="10"/>
|
||||
<!-- Level raising an error -->
|
||||
<property name="errorLevel" value="20"/>
|
||||
</test>
|
||||
|
||||
<!-- **************** -->
|
||||
<!-- Other -->
|
||||
<!-- **************** -->
|
||||
|
||||
<!-- All arguments with default values should be at the end -->
|
||||
<test name="defaultValuesOrder"/>
|
||||
|
||||
<!-- Check for prohibited functions -->
|
||||
<!-- @see http://www.php.net/manual/en/indexes.php -->
|
||||
<test name="checkProhibitedFunctions">
|
||||
<item value="echo"/>
|
||||
<item value="system"/>
|
||||
<item value="print_r"/>
|
||||
<item value="var_dump"/>
|
||||
<item value="dl"/>
|
||||
<!--<item value="exec"/>-->
|
||||
<item value="passthru"/>
|
||||
<!-- <item value="delete"/> We disable because of false report when using method delete -->
|
||||
<item value="ereg_replace"/>
|
||||
<item value="ereg"/>
|
||||
<item value="eregi"/>
|
||||
<!-- <item value="copy"/> -->
|
||||
<!-- <item value="fwrite"/> -->
|
||||
</test>
|
||||
|
||||
<!-- Check for prohibited tokens -->
|
||||
<!-- @see http://www.php.net/manual/en/tokens.php -->
|
||||
<test name="checkProhibitedTokens">
|
||||
<item value="T_BAD_CHARACTER"/>
|
||||
<item value="T_DECLARE"/>
|
||||
<item value="T_ENDDECLARE"/>
|
||||
<item value="T_ENDFOR"/>
|
||||
<item value="T_ENDFOREACH"/>
|
||||
<item value="T_ENDIF"/>
|
||||
<item value="T_ENDSWITCH"/>
|
||||
<item value="T_ENDWHILE"/>
|
||||
<item value="T_HALT_COMPILER"/>
|
||||
<item value="T_OLD_FUNCTION"/>
|
||||
<!-- <item value="T_PRINT"/> -->
|
||||
|
||||
<!-- Same thing as the noShortPhpCodeTag rule -->
|
||||
<!-- <item value="T_OPEN_TAG_WITH_ECHO"/> -->
|
||||
|
||||
<!-- <item value="T_INLINE_HTML"/> -->
|
||||
<!-- <item value="T_ECHO"/> -->
|
||||
|
||||
|
||||
</test>
|
||||
|
||||
<!-- Check for silenced errors before function calls (@function) -->
|
||||
<test name="checkSilencedError">
|
||||
<exception value="rename"/> <!-- Exceptions to this rule -->
|
||||
<exception value="mkdir"/>
|
||||
<exception value="chmod"/>
|
||||
</test>
|
||||
|
||||
<!-- Check for encapsed variables inside a String ("$a") -->
|
||||
<test name="encapsedVariablesInsideString">
|
||||
</test>
|
||||
|
||||
<!-- Avoid passing parameters by reference -->
|
||||
<test name="avoidPassingReferences">
|
||||
</test>
|
||||
|
||||
<test name="showTODOs">
|
||||
</test>
|
||||
|
||||
<!-- Use boolean operators (&&) instead of logical operators (AND) -->
|
||||
<test name="useBooleanOperators">
|
||||
</test>
|
||||
|
||||
<!-- Check empty block like if ($a) {} -->
|
||||
<test name="checkEmptyBlock">
|
||||
<!-- <exception value="catch"/> -->
|
||||
</test>
|
||||
|
||||
<!-- Check empty statement ( ;; ) -->
|
||||
<test name="checkEmptyStatement">
|
||||
</test>
|
||||
|
||||
<!-- Check for the presence of heredoc -->
|
||||
<test name="checkHeredoc">
|
||||
</test>
|
||||
|
||||
<!-- Check for braces around code blocs (if, else, elseif, do, while, for, foreach) -->
|
||||
<!--
|
||||
<test name="needBraces">
|
||||
</test>
|
||||
-->
|
||||
|
||||
<!-- Switch need a default value -->
|
||||
<test name="switchNeedDefault">
|
||||
</test>
|
||||
|
||||
<!-- Switch case should have a break -->
|
||||
<!-- <test name="switchCaseNeedBreak">
|
||||
</test> -->
|
||||
|
||||
<!-- Switch default value should be at the end -->
|
||||
<test name="switchDefaultOrder">
|
||||
</test>
|
||||
|
||||
|
||||
<!--
|
||||
Avoid using unary operators (++) inside a control statement
|
||||
With the exception of for iterators, all variable incrementation or decrementation should occur in their own toplevel statement to increase readability.
|
||||
-->
|
||||
<test name="checkUnaryOperator">
|
||||
<exception value="for"/>
|
||||
</test>
|
||||
|
||||
<!--
|
||||
With inner assignments it is difficult to see all places where a variable is set.
|
||||
With the exception of for iterators, all assignments should occur in their own toplevel statement to increase readability.
|
||||
-->
|
||||
<test name="checkInnerAssignment">
|
||||
<exception value="for"/>
|
||||
</test>
|
||||
|
||||
<!-- Detect unused private functions (detecting unused public ones is more difficult) -->
|
||||
<test name="checkUnusedPrivateFunctions">
|
||||
</test>
|
||||
|
||||
<!-- Detect unused variables -->
|
||||
<test name="checkUnusedVariables">
|
||||
</test>
|
||||
|
||||
<!-- Detect unused function parameters -->
|
||||
<test name="checkUnusedFunctionParameters">
|
||||
</test>
|
||||
|
||||
<!-- Only one class declaration per PHP file -->
|
||||
<test name="oneClassPerFile">
|
||||
</test>
|
||||
|
||||
<!-- ******************* -->
|
||||
<!-- Optimisation -->
|
||||
<!-- ******************* -->
|
||||
|
||||
<!-- Only one class declaration per PHP file -->
|
||||
<test name="functionInsideLoop">
|
||||
</test>
|
||||
|
||||
</phpcheckstyle-configuration>
|
||||
@ -1,13 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!ELEMENT phpcheckstyle-configuration (test+)>
|
||||
<!ELEMENT test (property*,item*,exception*)>
|
||||
<!ATTLIST test name CDATA "">
|
||||
<!ATTLIST test regexp CDATA "">
|
||||
<!ATTLIST test level CDATA "">
|
||||
<!ELEMENT property (#PCDATA)>
|
||||
<!ATTLIST property value CDATA "">
|
||||
<!ATTLIST property name CDATA "">
|
||||
<!ELEMENT item (#PCDATA)>
|
||||
<!ATTLIST item value CDATA "">
|
||||
<!ELEMENT exception (#PCDATA)>
|
||||
<!ATTLIST exception value CDATA "">
|
||||
@ -49,8 +49,8 @@ $backtopage=GETPOST('backtopage','alpha');
|
||||
$confirm=GETPOST('confirm','alpha');
|
||||
$rowid=GETPOST('rowid','int');
|
||||
$typeid=GETPOST('typeid','int');
|
||||
$userid=GETPOST('userid','int');
|
||||
$socid=GETPOST('socid','int');
|
||||
$userid=GETPOST('userid','int');
|
||||
$socid=GETPOST('socid','int');
|
||||
|
||||
if (! empty($conf->mailmanspip->enabled))
|
||||
{
|
||||
@ -68,7 +68,7 @@ $extrafields = new ExtraFields($db);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label('member');
|
||||
|
||||
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
|
||||
$object->getCanvas($socid);
|
||||
$object->getCanvas($rowid);
|
||||
$canvas = $object->canvas?$object->canvas:GETPOST("canvas");
|
||||
$objcanvas='';
|
||||
if (! empty($canvas))
|
||||
@ -117,7 +117,7 @@ $hookmanager->initHooks(array('membercard'));
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$parameters=array('socid'=>$socid, 'objcanvas'=>$objcanvas);
|
||||
$parameters=array('rowid'=>$rowid, 'objcanvas'=>$objcanvas);
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if ($action == 'setuserid' && ($user->rights->user->self->creer || $user->rights->user->user->creer))
|
||||
@ -694,13 +694,14 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
||||
// -----------------------------------------
|
||||
// When used with CANVAS
|
||||
// -----------------------------------------
|
||||
if (empty($object->error) && $socid)
|
||||
if (empty($object->error) && $rowid)
|
||||
{
|
||||
$object = new Adherent($db);
|
||||
$object->fetch($socid);
|
||||
$result=$object->fetch($rowid);
|
||||
if ($result <= 0) dol_print_error('',$object->error);
|
||||
}
|
||||
$objcanvas->assign_values($action, $socid); // Set value for templates
|
||||
$objcanvas->display_canvas($action); // Show template
|
||||
$objcanvas->assign_values($action, $object->id, $object->ref); // Set value for templates
|
||||
$objcanvas->display_canvas($action); // Show template
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -54,7 +54,7 @@ if ($action == 'update' && $user->rights->adherent->creer && ! $_POST["cancel"])
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$res=$object->update_note($_POST["note"],$user);
|
||||
$res=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
|
||||
if ($res < 0)
|
||||
{
|
||||
setEventMessage($object->error, 'errors');
|
||||
|
||||
@ -146,7 +146,7 @@ if ($action == 'commentaire' && $user->rights->adherent->configurer)
|
||||
{
|
||||
$don = new Don($db);
|
||||
$don->fetch($rowid);
|
||||
$don->update_note($_POST["commentaire"]);
|
||||
$don->update_note(dol_html_entity_decode(GETPOST('commentaire'), ENT_QUOTES));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -188,7 +188,7 @@ else if ($action == 'set_COMMANDE_FREE_TEXT')
|
||||
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
|
||||
}
|
||||
}
|
||||
else if ($action='setModuleOptions') {
|
||||
else if ($action=='setModuleOptions') {
|
||||
if (dolibarr_set_const($db, "COMMANDE_ADDON_PDF_ODT_PATH",GETPOST('value1'),'chaine',0,'',$conf->entity))
|
||||
{
|
||||
// La constante qui a ete lue en avant du nouveau set
|
||||
|
||||
@ -152,7 +152,8 @@ else if ($action == 'setmod')
|
||||
|
||||
dolibarr_set_const($db, "PROJECT_ADDON",$value,'chaine',0,'',$conf->entity);
|
||||
}
|
||||
else if ($action='setModuleOptions') {
|
||||
|
||||
else if ($action=='setModuleOptions') {
|
||||
if (dolibarr_set_const($db, "PROJECT_ADDON_PDF_ODT_PATH",GETPOST('value1'),'chaine',0,'',$conf->entity))
|
||||
{
|
||||
// La constante qui a ete lue en avant du nouveau set
|
||||
|
||||
160
htdocs/admin/supplierinvoice_extrafields.php
Normal file
160
htdocs/admin/supplierinvoice_extrafields.php
Normal file
@ -0,0 +1,160 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2012 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/admin/supplierinvoice_extrafields.php
|
||||
* \ingroup fourn
|
||||
* \brief Page to setup extra fields of supplierinvoice
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
|
||||
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("other");
|
||||
$langs->load("orders");
|
||||
$langs->load("suppliers");
|
||||
|
||||
$extrafields = new ExtraFields($db);
|
||||
$form = new Form($db);
|
||||
|
||||
// List of supported format
|
||||
$tmptype2label=getStaticMember(get_class($extrafields),'type2label');
|
||||
$type2label=array('');
|
||||
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
|
||||
|
||||
$action=GETPOST('action', 'alpha');
|
||||
$attrname=GETPOST('attrname', 'alpha');
|
||||
$elementtype='commande_fournisseur';
|
||||
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php';
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$textobject=$langs->transnoentitiesnoconv("SuppliersInvoices");
|
||||
|
||||
llxHeader('',$langs->trans("SuppliersSetup"));
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print_fiche_titre($langs->trans("SuppliersSetup"),$linkback,'setup');
|
||||
print "<br>\n";
|
||||
|
||||
$head = supplierorder_admin_prepare_head(null);
|
||||
|
||||
dol_fiche_head($head, 'supplierinvoice', $langs->trans("ModuleSetup"), 0, 'invoice');
|
||||
|
||||
|
||||
print $langs->trans("DefineHereComplementaryAttributes",$textobject).'<br>'."\n";
|
||||
print '<br>';
|
||||
|
||||
// Load attribute_label
|
||||
$extrafields->fetch_name_optionals_label($elementtype);
|
||||
|
||||
print "<table summary=\"listofattributes\" class=\"noborder\" width=\"100%\">";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Label").'</td>';
|
||||
print '<td>'.$langs->trans("AttributeCode").'</td>';
|
||||
print '<td>'.$langs->trans("Type").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Size").'</td>';
|
||||
print '<td align="center">'.$langs->trans("Unique").'</td>';
|
||||
print '<td align="center">'.$langs->trans("Required").'</td>';
|
||||
print '<td width="80"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$var=True;
|
||||
foreach($extrafields->attribute_type as $key => $value)
|
||||
{
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print "<td>".$extrafields->attribute_label[$key]."</td>\n";
|
||||
print "<td>".$key."</td>\n";
|
||||
print "<td>".$type2label[$extrafields->attribute_type[$key]]."</td>\n";
|
||||
print '<td align="right">'.$extrafields->attribute_size[$key]."</td>\n";
|
||||
print '<td align="center">'.yn($extrafields->attribute_unique[$key])."</td>\n";
|
||||
print '<td align="center">'.yn($extrafields->attribute_required[$key])."</td>\n";
|
||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&attrname='.$key.'">'.img_edit().'</a>';
|
||||
print " <a href=\"".$_SERVER["PHP_SELF"]."?action=delete&attrname=$key\">".img_delete()."</a></td>\n";
|
||||
print "</tr>";
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
// Buttons
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Creation d'un champ optionnel */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Edition d'un champ optionnel */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
if ($action == 'edit' && ! empty($attrname))
|
||||
{
|
||||
print "<br>";
|
||||
print_titre($langs->trans("FieldEdition", $attrname));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
@ -65,7 +65,7 @@ require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php';
|
||||
* View
|
||||
*/
|
||||
|
||||
$textobject=$langs->transnoentitiesnoconv("SupplierOrder");
|
||||
$textobject=$langs->transnoentitiesnoconv("SuppliersOrders");
|
||||
|
||||
llxHeader('',$langs->trans("SuppliersSetup"));
|
||||
|
||||
@ -75,7 +75,7 @@ print "<br>\n";
|
||||
|
||||
$head = supplierorder_admin_prepare_head(null);
|
||||
|
||||
dol_fiche_head($head, 'attributes', $langs->trans("ModuleSetup"), 0, 'order');
|
||||
dol_fiche_head($head, 'supplierorder', $langs->trans("ModuleSetup"), 0, 'order');
|
||||
|
||||
|
||||
print $langs->trans("DefineHereComplementaryAttributes",$textobject).'<br>'."\n";
|
||||
|
||||
@ -47,9 +47,11 @@ print "<br>\n";
|
||||
$modules = array();
|
||||
$modules_names = array();
|
||||
$modules_files = array();
|
||||
$modules_fullpath = array();
|
||||
$modulesdir = dolGetModulesDirs();
|
||||
|
||||
// Load list of modules
|
||||
$i=0;
|
||||
foreach($modulesdir as $dir)
|
||||
{
|
||||
$handle=@opendir(dol_osencode($dir));
|
||||
@ -63,13 +65,25 @@ foreach($modulesdir as $dir)
|
||||
|
||||
if ($modName)
|
||||
{
|
||||
include_once $dir.$file;
|
||||
$objMod = new $modName($db);
|
||||
//print 'xx'.$dir.$file.'<br>';
|
||||
if (in_array($file, $modules_files))
|
||||
{
|
||||
// File duplicate
|
||||
print "Warning duplicate file found : ".$file." (Found ".$dir.$file.", already found ".$modules_fullpath[$file].")<br>";
|
||||
}
|
||||
else
|
||||
{
|
||||
// File to load
|
||||
include_once $dir.$file;
|
||||
|
||||
$modules[$objMod->numero]=$objMod;
|
||||
$modules_names[$objMod->numero]=$objMod->name;
|
||||
$modules_files[$objMod->numero]=$file;
|
||||
$picto[$objMod->numero]=(isset($objMod->picto) && $objMod->picto)?$objMod->picto:'generic';
|
||||
$objMod = new $modName($db);
|
||||
|
||||
$modules[$objMod->numero]=$objMod;
|
||||
$modules_names[$objMod->numero]=$objMod->name;
|
||||
$modules_files[$objMod->numero]=$file;
|
||||
$modules_fullpath[$file]=$dir.$file;
|
||||
$picto[$objMod->numero]=(isset($objMod->picto) && $objMod->picto)?$objMod->picto:'generic';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -127,8 +141,7 @@ sort($rights_ids);
|
||||
$old='';
|
||||
foreach($rights_ids as $right_id)
|
||||
{
|
||||
if ($old == $right_id)
|
||||
print "Warning duplicate id on permission : ".$right_id."<br>";
|
||||
if ($old == $right_id) print "Warning duplicate id on permission : ".$right_id."<br>";
|
||||
$old = $right_id;
|
||||
}
|
||||
|
||||
|
||||
@ -240,7 +240,9 @@ if ($socid)
|
||||
}
|
||||
|
||||
// Address
|
||||
print '<tr><td valign="top">'.$langs->trans('Address').'</td><td colspan="3">'.nl2br($soc->address).'</td></tr>';
|
||||
print '<tr><td valign="top">'.$langs->trans('Address').'</td><td colspan="3">';
|
||||
print dol_print_address($soc->address,'gmap','thirdparty',$object->id);
|
||||
print '</td></tr>';
|
||||
|
||||
// Zip / Town
|
||||
print '<tr><td width="25%">'.$langs->trans('Zip').'</td><td width="25%">'.$soc->zip."</td>";
|
||||
|
||||
@ -477,7 +477,7 @@ class Categorie
|
||||
|
||||
|
||||
/**
|
||||
* Retourne les filles de la categorie
|
||||
* Return childs of a category
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@ -507,43 +507,6 @@ class Categorie
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return category description
|
||||
*
|
||||
* @param int $cate Category id
|
||||
* @return string Description
|
||||
* @deprecated function not used ?
|
||||
*/
|
||||
function get_desc($cate)
|
||||
{
|
||||
$sql = "SELECT description FROM ".MAIN_DB_PREFIX."categorie";
|
||||
$sql.= " WHERE rowid = ".$cate;
|
||||
|
||||
$res = $this->db->query($sql);
|
||||
$n = $this->db->fetch_array($res);
|
||||
|
||||
return($n[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* La categorie $fille est-elle une fille de cette categorie ?
|
||||
*
|
||||
* @param Category $child Object category
|
||||
* @return void
|
||||
* @deprecated function not used ?
|
||||
*/
|
||||
function is_fille($child)
|
||||
{
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."categorie";
|
||||
$sql.= " WHERE fk_parent = ".$this->id." AND rowid = ".$child->id;
|
||||
|
||||
$res = $this->db->query($sql);
|
||||
$n = $this->db->fetch_array($res);
|
||||
|
||||
return ($n[0] > 0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load this->motherof that is array(id_son=>id_parent, ...)
|
||||
*
|
||||
|
||||
@ -589,8 +589,6 @@ if ($action == 'create')
|
||||
print '<input type="text" name="priority" value="'.(GETPOST('priority')?GETPOST('priority'):($actioncomm->priority?$actioncomm->priority:'')).'" size="5">';
|
||||
print '</td></tr>';
|
||||
|
||||
add_row_for_calendar_link();
|
||||
|
||||
// Description
|
||||
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
@ -1061,90 +1059,8 @@ if ($id > 0)
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
||||
|
||||
/**
|
||||
* Ajoute une ligne de tableau a 2 colonnes pour avoir l'option synchro calendrier
|
||||
*
|
||||
* @return int Retourne le nombre de lignes ajoutees
|
||||
*/
|
||||
function add_row_for_calendar_link()
|
||||
{
|
||||
global $conf,$langs,$user;
|
||||
$nbtr=0;
|
||||
|
||||
// Lien avec calendrier si module active
|
||||
// TODO external module
|
||||
if (! empty($conf->webcalendar->enabled))
|
||||
{
|
||||
if ($conf->global->PHPWEBCALENDAR_SYNCRO != 'never')
|
||||
{
|
||||
$langs->load("other");
|
||||
|
||||
print '<tr><td width="25%" nowrap>'.$langs->trans("AddCalendarEntry","Webcalendar").'</td>';
|
||||
|
||||
if (! $user->webcal_login)
|
||||
{
|
||||
print '<td><input type="checkbox" disabled name="add_webcal">';
|
||||
print ' '.$langs->transnoentities("ErrorWebcalLoginNotDefined","<a href=\"".DOL_URL_ROOT."/user/fiche.php?id=".$user->id."\">".$user->login."</a>");
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
$nbtr++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($conf->global->PHPWEBCALENDAR_SYNCRO == 'always')
|
||||
{
|
||||
print '<input type="hidden" name="add_webcal" value="on">';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td><input type="checkbox" name="add_webcal"'.(($conf->global->PHPWEBCALENDAR_SYNCRO=='always' || $conf->global->PHPWEBCALENDAR_SYNCRO=='yesbydefault')?' checked':'').'></td>';
|
||||
print '</tr>';
|
||||
$nbtr++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO external module
|
||||
if (! empty($conf->phenix->enabled))
|
||||
{
|
||||
if ($conf->global->PHPPHENIX_SYNCRO != 'never')
|
||||
{
|
||||
$langs->load("other");
|
||||
|
||||
print '<tr><td width="25%" nowrap>'.$langs->trans("AddCalendarEntry","Phenix").'</td>';
|
||||
|
||||
if (! $user->phenix_login)
|
||||
{
|
||||
print '<td><input type="checkbox" disabled name="add_phenix">';
|
||||
print ' '.$langs->transnoentities("ErrorPhenixLoginNotDefined","<a href=\"".DOL_URL_ROOT."/user/fiche.php?id=".$user->id."\">".$user->login."</a>");
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
$nbtr++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($conf->global->PHPPHENIX_SYNCRO == 'always')
|
||||
{
|
||||
print '<input type="hidden" name="add_phenix" value="on">';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td><input type="checkbox" name="add_phenix"'.(($conf->global->PHPPHENIX_SYNCRO=='always' || $conf->global->PHPPHENIX_SYNCRO=='yesbydefault')?' checked':'').'></td>';
|
||||
print '</tr>';
|
||||
$nbtr++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $nbtr;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
@ -942,7 +942,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
global $user, $conf, $langs;
|
||||
global $filter, $filtera, $filtert, $filterd, $status;
|
||||
global $theme_datacolor;
|
||||
global $cachethirdparties, $cachecontacts;
|
||||
global $cachethirdparties, $cachecontacts, $colorindexused;
|
||||
|
||||
print '<div id="dayevent_'.sprintf("%04d",$year).sprintf("%02d",$month).sprintf("%02d",$day).'" class="dayevent">'."\n";
|
||||
$curtime = dol_mktime(0, 0, 0, $month, $day, $year);
|
||||
@ -972,6 +972,9 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
$i=0; $nummytasks=0; $numother=0; $numbirthday=0; $numical=0; $numicals=array();
|
||||
$ymd=sprintf("%04d",$year).sprintf("%02d",$month).sprintf("%02d",$day);
|
||||
|
||||
$nextindextouse=count($colorindexused);
|
||||
//print $nextindextouse;
|
||||
|
||||
foreach ($eventarray as $daykey => $notused)
|
||||
{
|
||||
$annee = date('Y',$daykey);
|
||||
@ -989,10 +992,12 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
$color=-1; $cssclass=''; $colorindex=-1;
|
||||
if ((! empty($event->author->id) && $event->author->id == $user->id)
|
||||
|| (! empty($event->usertodo->id) && $event->usertodo->id == $user->id)
|
||||
|| (! empty($event->userdone->id) && $event->userdone->id == $user->id)) {
|
||||
$nummytasks++; $colorindex=1; $cssclass='family_mytasks';
|
||||
|| (! empty($event->userdone->id) && $event->userdone->id == $user->id))
|
||||
{
|
||||
$nummytasks++; $cssclass='family_mytasks';
|
||||
}
|
||||
else if ($event->type_code == 'ICALEVENT') {
|
||||
else if ($event->type_code == 'ICALEVENT')
|
||||
{
|
||||
$numical++;
|
||||
if (! empty($event->icalname)) {
|
||||
if (! isset($numicals[dol_string_nospecial($event->icalname)])) {
|
||||
@ -1004,8 +1009,25 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
$cssclass=(! empty($event->icalname)?'family_'.dol_string_nospecial($event->icalname):'family_other');
|
||||
}
|
||||
else if ($event->type_code == 'BIRTHDAY') { $numbirthday++; $colorindex=2; $cssclass='family_birthday'; }
|
||||
else { $numother++; $colorindex=2; $cssclass='family_other'; }
|
||||
if ($color == -1) $color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]);
|
||||
else { $numother++; $cssclass='family_other'; }
|
||||
if ($color == -1) // Color was not forced. Set color according to color index.
|
||||
{
|
||||
// Define color index if not yet defined
|
||||
$idusertouse=($event->usertodo->id?$event->usertodo->id:0);
|
||||
if (isset($colorindexused[$idusertouse]))
|
||||
{
|
||||
$colorindex=$colorindexused[$idusertouse]; // Color already assigned to this user
|
||||
}
|
||||
else
|
||||
{
|
||||
$colorindex=$nextindextouse;
|
||||
$colorindexused[$idusertouse]=$colorindex;
|
||||
if (! empty($theme_datacolor[$nextindextouse+1])) $nextindextouse++; // Prepare to use next color
|
||||
}
|
||||
//print '|'.($color).'='.($idusertouse?$idusertouse:0).'='.$colorindex.'<br>';
|
||||
// Define color
|
||||
$color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]);
|
||||
}
|
||||
$cssclass=$cssclass.' '.$cssclass.'_day_'.$ymd;
|
||||
|
||||
// Show rect of event
|
||||
@ -1182,6 +1204,13 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
print '</div>'."\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* Change color with a delta
|
||||
*
|
||||
* @param string $color Color
|
||||
* @param int $minus Delta
|
||||
* @return string New color
|
||||
*/
|
||||
function dol_color_minus($color, $minus)
|
||||
{
|
||||
$newcolor=$color;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005-2010 Laurent Destailleur <eldy@uers.sourceforge.net>
|
||||
* Copyright (C) 2005-2013 Laurent Destailleur <eldy@uers.sourceforge.net>
|
||||
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -307,7 +307,7 @@ if ($object->fetch($id) >= 0)
|
||||
print $modulename;
|
||||
print "</td>";
|
||||
*/
|
||||
$nbofrecipient=$obj->getNbOfRecipients();
|
||||
$nbofrecipient=$obj->getNbOfRecipients('');
|
||||
print '<td align="center">';
|
||||
if ($nbofrecipient >= 0)
|
||||
{
|
||||
@ -346,21 +346,8 @@ if ($object->fetch($id) >= 0)
|
||||
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'?action=clear&id='.$object->id.'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print_titre($langs->trans("ToClearAllRecipientsClickHere"));
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre" align="right"><input type="submit" class="button" value="'.$langs->trans("TargetsReset").'"></td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
// List of selected targets
|
||||
print "\n<!-- Liste destinataires selectionnes -->\n";
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
@ -383,21 +370,23 @@ if ($object->fetch($id) >= 0)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
$parm = "&id=".$object->id;
|
||||
if ($search_lastname) $parm.= "&search_lastname=".urlencode($search_lastname);
|
||||
if ($search_firstname) $parm.= "&search_firstname=".urlencode($search_firstname);
|
||||
if ($search_email) $parm.= "&search_email=".urlencode($search_email);
|
||||
$param = "&id=".$object->id;
|
||||
if ($search_lastname) $param.= "&search_lastname=".urlencode($search_lastname);
|
||||
if ($search_firstname) $param.= "&search_firstname=".urlencode($search_firstname);
|
||||
if ($search_email) $param.= "&search_email=".urlencode($search_email);
|
||||
|
||||
print_barre_liste($langs->trans("MailSelectedRecipients"),$page,$_SERVER["PHP_SELF"],$parm,$sortfield,$sortorder,"",$num,$object->nbemail,'');
|
||||
$cleartext='<br></div><div>'.$langs->trans("ToClearAllRecipientsClickHere").': '.'<input type="submit" class="button" value="'.$langs->trans("TargetsReset").'">';
|
||||
|
||||
if ($page) $parm.= "&page=".$page;
|
||||
print_barre_liste($langs->trans("MailSelectedRecipients").$cleartext,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,"",$num,$object->nbemail,'');
|
||||
|
||||
if ($page) $param.= "&page=".$page;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"mc.email",$parm,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Lastname"),$_SERVER["PHP_SELF"],"mc.lastname",$parm,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Firstname"),$_SERVER["PHP_SELF"],"mc.firstname",$parm,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("OtherInformations"),$_SERVER["PHP_SELF"],"",$parm,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Source"),$_SERVER["PHP_SELF"],"",$parm,"",'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"mc.email",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Lastname"),$_SERVER["PHP_SELF"],"mc.lastname",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Firstname"),$_SERVER["PHP_SELF"],"mc.firstname",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("OtherInformations"),$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Source"),$_SERVER["PHP_SELF"],"",$param,"",'align="center"',$sortfield,$sortorder);
|
||||
|
||||
// Date sendinf
|
||||
if ($object->statut < 2)
|
||||
@ -406,11 +395,11 @@ if ($object->fetch($id) >= 0)
|
||||
}
|
||||
else
|
||||
{
|
||||
print_liste_field_titre($langs->trans("DateSending"),$_SERVER["PHP_SELF"],"mc.date_envoi",$parm,'','align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DateSending"),$_SERVER["PHP_SELF"],"mc.date_envoi",$param,'','align="center"',$sortfield,$sortorder);
|
||||
}
|
||||
|
||||
// Statut
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"mc.statut",$parm,'','align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"mc.statut",$param,'','align="right"',$sortfield,$sortorder);
|
||||
|
||||
print '</tr>';
|
||||
|
||||
@ -496,7 +485,7 @@ if ($object->fetch($id) >= 0)
|
||||
print '<td align="center"> </td>';
|
||||
print '<td align="right" nowrap="nowrap">'.$langs->trans("MailingStatusNotSent");
|
||||
if ($user->rights->mailing->creer) {
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=delete&rowid='.$obj->rowid.$parm.'">'.img_delete($langs->trans("RemoveRecipient"));
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=delete&rowid='.$obj->rowid.$param.'">'.img_delete($langs->trans("RemoveRecipient"));
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
@ -8,7 +8,8 @@
|
||||
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2011 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
*
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
@ -233,13 +234,13 @@ else if ($action == 'set_ref_client' && $user->rights->propal->creer)
|
||||
|
||||
else if ($action == 'setnote_public' && $user->rights->propal->creer)
|
||||
{
|
||||
$result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES),'_public');
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
else if ($action == 'setnote' && $user->rights->propal->creer)
|
||||
else if ($action == 'setnote_private' && $user->rights->propal->creer)
|
||||
{
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES),'_private');
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
|
||||
@ -8,7 +8,8 @@
|
||||
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2011 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -673,7 +674,7 @@ class Propal extends CommonObject
|
||||
$sql.= ", datec";
|
||||
$sql.= ", ref";
|
||||
$sql.= ", fk_user_author";
|
||||
$sql.= ", note";
|
||||
$sql.= ", note_private";
|
||||
$sql.= ", note_public";
|
||||
$sql.= ", model_pdf";
|
||||
$sql.= ", fin_validite";
|
||||
@ -698,7 +699,7 @@ class Propal extends CommonObject
|
||||
$sql.= ", '".$this->db->idate($now)."'";
|
||||
$sql.= ", '(PROV)'";
|
||||
$sql.= ", ".($user->id > 0 ? "'".$user->id."'":"null");
|
||||
$sql.= ", '".$this->db->escape($this->note)."'";
|
||||
$sql.= ", '".$this->db->escape($this->note_private)."'";
|
||||
$sql.= ", '".$this->db->escape($this->note_public)."'";
|
||||
$sql.= ", '".$this->modelpdf."'";
|
||||
$sql.= ", ".($this->fin_validite!=''?"'".$this->db->idate($this->fin_validite)."'":"null");
|
||||
@ -1000,7 +1001,7 @@ class Propal extends CommonObject
|
||||
$sql.= ", p.fin_validite as dfv";
|
||||
$sql.= ", p.date_livraison as date_livraison";
|
||||
$sql.= ", p.model_pdf, p.ref_client, p.extraparams";
|
||||
$sql.= ", p.note as note_private, p.note_public";
|
||||
$sql.= ", p.note_private, p.note_public";
|
||||
$sql.= ", p.fk_projet, p.fk_statut";
|
||||
$sql.= ", p.fk_user_author, p.fk_user_valid, p.fk_user_cloture";
|
||||
$sql.= ", p.fk_delivery_address";
|
||||
@ -1584,7 +1585,7 @@ class Propal extends CommonObject
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."propal";
|
||||
$sql.= " SET fk_statut = ".$statut.", note = '".$this->db->escape($note)."', date_cloture=".$this->db->idate($now).", fk_user_cloture=".$user->id;
|
||||
$sql.= " SET fk_statut = ".$statut.", note_private = '".$this->db->escape($note)."', date_cloture=".$this->db->idate($now).", fk_user_cloture=".$user->id;
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
@ -1614,7 +1615,7 @@ class Propal extends CommonObject
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."propal";
|
||||
$sql.= " SET fk_statut = ".$statut.", note = '".$this->db->escape($note)."', date_cloture=".$this->db->idate($now).", fk_user_cloture=".$user->id;
|
||||
$sql.= " SET fk_statut = ".$statut.", note_private = '".$this->db->escape($note)."', date_cloture=".$this->db->idate($now).", fk_user_cloture=".$user->id;
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
@ -2322,7 +2323,7 @@ class Propal extends CommonObject
|
||||
$this->demand_reason_id = 1;
|
||||
$this->demand_reason_code = 'SRC_00';
|
||||
$this->note_public='This is a comment (public)';
|
||||
$this->note='This is a comment (private)';
|
||||
$this->note_private='This is a comment (private)';
|
||||
// Lines
|
||||
$nbp = 5;
|
||||
$xnbp = 0;
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -50,14 +51,14 @@ $object = new Propal($db);
|
||||
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));
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES),'_public');
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
else if ($action == 'setnote' && $user->rights->propale->creer)
|
||||
else if ($action == 'setnote_private' && $user->rights->propale->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES),'_private');
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011 Jean Heimburger <jean@tiaris.info>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU *General Public License as published by
|
||||
@ -630,7 +631,7 @@ class Commande extends CommonOrder
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."commande (";
|
||||
$sql.= " ref, fk_soc, date_creation, fk_user_author, fk_projet, date_commande, source, note, note_public, ref_client, ref_int";
|
||||
$sql.= " ref, fk_soc, date_creation, fk_user_author, fk_projet, date_commande, source, note_private, note_public, ref_client, ref_int";
|
||||
$sql.= ", model_pdf, fk_cond_reglement, fk_mode_reglement, fk_availability, fk_input_reason, date_livraison, fk_delivery_address";
|
||||
$sql.= ", remise_absolue, remise_percent";
|
||||
$sql.= ", entity";
|
||||
@ -639,7 +640,7 @@ class Commande extends CommonOrder
|
||||
$sql.= ", ".($this->fk_project?$this->fk_project:"null");
|
||||
$sql.= ", ".$this->db->idate($date);
|
||||
$sql.= ", ".($this->source>=0 && $this->source != '' ?$this->source:'null');
|
||||
$sql.= ", '".$this->db->escape($this->note)."'";
|
||||
$sql.= ", '".$this->db->escape($this->note_private)."'";
|
||||
$sql.= ", '".$this->db->escape($this->note_public)."'";
|
||||
$sql.= ", '".$this->db->escape($this->ref_client)."'";
|
||||
$sql.= ", ".($this->ref_int?"'".$this->db->escape($this->ref_int)."'":"null");
|
||||
@ -952,7 +953,7 @@ class Commande extends CommonOrder
|
||||
$this->fk_delivery_address = $object->fk_delivery_address;
|
||||
$this->contact_id = $object->contactid;
|
||||
$this->ref_client = $object->ref_client;
|
||||
$this->note = $object->note;
|
||||
$this->note_private = $object->note_private;
|
||||
$this->note_public = $object->note_public;
|
||||
|
||||
$this->origin = $object->element;
|
||||
@ -1267,7 +1268,7 @@ class Commande extends CommonOrder
|
||||
$sql.= ', c.date_commande';
|
||||
$sql.= ', c.date_livraison';
|
||||
$sql.= ', c.fk_projet, c.remise_percent, c.remise, c.remise_absolue, c.source, c.facture as billed';
|
||||
$sql.= ', c.note as note_private, c.note_public, c.ref_client, c.ref_ext, c.ref_int, c.model_pdf, c.fk_delivery_address, c.extraparams';
|
||||
$sql.= ', c.note_private, c.note_public, c.ref_client, c.ref_ext, c.ref_int, c.model_pdf, c.fk_delivery_address, c.extraparams';
|
||||
$sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle';
|
||||
$sql.= ', cr.code as cond_reglement_code, cr.libelle as cond_reglement_libelle, cr.libelle_facture as cond_reglement_libelle_doc';
|
||||
$sql.= ', ca.code as availability_code';
|
||||
@ -2697,7 +2698,7 @@ class Commande extends CommonOrder
|
||||
$this->availability_code = 'DSP';
|
||||
$this->demand_reason_code = 'SRC_00';
|
||||
$this->note_public='This is a comment (public)';
|
||||
$this->note='This is a comment (private)';
|
||||
$this->note_private='This is a comment (private)';
|
||||
// Lines
|
||||
$nbp = 5;
|
||||
$xnbp = 0;
|
||||
@ -2782,7 +2783,6 @@ class Commande extends CommonOrder
|
||||
* Update value of extrafields on the proposal
|
||||
*
|
||||
* @param User $user Object user that modify
|
||||
* @param double $remise Amount discount
|
||||
* @return int <0 if ko, >0 if ok
|
||||
*/
|
||||
function update_extrafields($user)
|
||||
|
||||
@ -45,6 +45,7 @@ if (! empty($conf->projet->enabled)) {
|
||||
require DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
require DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
|
||||
}
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
|
||||
$langs->load('orders');
|
||||
$langs->load('sendings');
|
||||
@ -225,7 +226,7 @@ else if ($action == 'add' && $user->rights->commande->creer)
|
||||
$db->begin();
|
||||
|
||||
$object->date_commande = $datecommande;
|
||||
$object->note = GETPOST('note');
|
||||
$object->note_private = GETPOST('note_private');
|
||||
$object->note_public = GETPOST('note_public');
|
||||
$object->source = GETPOST('source_id');
|
||||
$object->fk_project = GETPOST('projectid');
|
||||
@ -534,13 +535,13 @@ else if ($action == 'setremiseabsolue' && $user->rights->commande->creer)
|
||||
|
||||
else if ($action == 'setnote_public' && $user->rights->commande->creer)
|
||||
{
|
||||
$result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES),'_public');
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
else if ($action == 'setnote' && $user->rights->commande->creer)
|
||||
else if ($action == 'setnote_private' && $user->rights->commande->creer)
|
||||
{
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
|
||||
$result=$object->update_note_rivate(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
@ -1411,9 +1412,6 @@ $formorder = new FormOrder($db);
|
||||
*********************************************************************/
|
||||
if ($action == 'create' && $user->rights->commande->creer)
|
||||
{
|
||||
//WYSIWYG Editor
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
|
||||
print_fiche_titre($langs->trans('CreateOrder'));
|
||||
|
||||
dol_htmloutput_mesg($mesg,$mesgs,'error');
|
||||
@ -1470,7 +1468,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
|
||||
$datedelivery = (!empty($objectsrc->date_livraison)?$objectsrc->date_livraison:'');
|
||||
|
||||
$note_private = (! empty($objectsrc->note) ? $objectsrc->note : (! empty($objectsrc->note_private) ? $objectsrc->note_private : ''));
|
||||
$note_private = (! empty($objectsrc->note_private) ? $objectsrc->note_private : (! empty($objectsrc->note_private) ? $objectsrc->note_private : ''));
|
||||
$note_public = (! empty($objectsrc->note_public) ? $objectsrc->note_public : '');
|
||||
|
||||
// Object source contacts list
|
||||
@ -1632,7 +1630,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
print '<td class="border" valign="top">'.$langs->trans('NotePrivate').'</td>';
|
||||
print '<td valign="top" colspan="2">';
|
||||
|
||||
$doleditor=new DolEditor('note', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
|
||||
$doleditor=new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
|
||||
print $doleditor->Create(1);
|
||||
//print '<textarea name="note" wrap="soft" cols="70" rows="'.ROWS_3.'">'.$note_private.'</textarea>';
|
||||
print '</td></tr>';
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -57,14 +58,14 @@ if (! $object->fetch($id, $ref) > 0)
|
||||
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));
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES),'_public');
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
else if ($action == 'setnote' && $user->rights->commande->creer)
|
||||
else if ($action == 'setnote_private' && $user->rights->commande->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES),'_private');
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -101,7 +102,7 @@ class Deplacement extends CommonObject
|
||||
$sql.= ", fk_user_author";
|
||||
$sql.= ", fk_user";
|
||||
$sql.= ", type";
|
||||
$sql.= ", note";
|
||||
$sql.= ", note_private";
|
||||
$sql.= ", note_public";
|
||||
$sql.= ", fk_projet";
|
||||
$sql.= ", fk_soc";
|
||||
@ -195,7 +196,7 @@ class Deplacement extends CommonObject
|
||||
$sql .= " , fk_user = ".$this->fk_user;
|
||||
$sql .= " , fk_user_modif = ".$user->id;
|
||||
$sql .= " , fk_soc = ".($this->socid > 0?$this->socid:'null');
|
||||
$sql .= " , note = ".($this->note_private?"'".$this->db->escape($this->note_private)."'":"null");
|
||||
$sql .= " , note_private = ".($this->note_private?"'".$this->db->escape($this->note_private)."'":"null");
|
||||
$sql .= " , note_public = ".($this->note_public?"'".$this->db->escape($this->note_public)."'":"null");
|
||||
$sql .= " , fk_projet = ".($this->fk_project>0?$this->fk_project:0);
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
@ -223,7 +224,7 @@ class Deplacement extends CommonObject
|
||||
*/
|
||||
function fetch($id)
|
||||
{
|
||||
$sql = "SELECT rowid, fk_user, type, fk_statut, km, fk_soc, dated, note, note_public, fk_projet, extraparams";
|
||||
$sql = "SELECT rowid, fk_user, type, fk_statut, km, fk_soc, dated, note_private, note_public, fk_projet, extraparams";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."deplacement";
|
||||
$sql.= " WHERE rowid = ".$id;
|
||||
|
||||
@ -241,7 +242,7 @@ class Deplacement extends CommonObject
|
||||
$this->km = $obj->km;
|
||||
$this->type = $obj->type;
|
||||
$this->statut = $obj->fk_statut;
|
||||
$this->note_private = $obj->note;
|
||||
$this->note_private = $obj->note_private;
|
||||
$this->note_public = $obj->note_public;
|
||||
$this->fk_project = $obj->fk_projet;
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -234,13 +235,13 @@ else if ($action == 'setkm' && $user->rights->deplacement->creer)
|
||||
else if ($action == 'setnote_public' && $user->rights->deplacement->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->setValueFrom('note_public',GETPOST('note_public','alpha'));
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES),'_public');
|
||||
if ($result < 0) dol_print_error($db, $object->error);
|
||||
}
|
||||
else if ($action == 'setnote' && $user->rights->deplacement->creer)
|
||||
else if ($action == 'setnote_private' && $user->rights->deplacement->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->setValueFrom('note',GETPOST('note','alpha'));
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES),'_private');
|
||||
if ($result < 0) dol_print_error($db, $object->error);
|
||||
}
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -51,7 +52,8 @@ class Don extends CommonObject
|
||||
var $fk_project;
|
||||
var $modepaiement;
|
||||
var $modepaiementid;
|
||||
var $note;
|
||||
var $note_private;
|
||||
var $note_public;
|
||||
var $statut;
|
||||
|
||||
var $projet;
|
||||
@ -191,7 +193,8 @@ class Don extends CommonObject
|
||||
$this->address = 'Twist road';
|
||||
$this->zip = '99999';
|
||||
$this->town = 'Town';
|
||||
$this->note_public='SPECIMEN';
|
||||
$this->note_private='Private note';
|
||||
$this->note_public='Public note';
|
||||
$this->email='email@email.com';
|
||||
$this->note='';
|
||||
$this->statut=1;
|
||||
@ -319,7 +322,8 @@ class Don extends CommonObject
|
||||
$sql.= ", country";
|
||||
$sql.= ", public";
|
||||
$sql.= ", fk_don_projet";
|
||||
$sql.= ", note";
|
||||
$sql.= ", note_private";
|
||||
$sql.= ", note_public";
|
||||
$sql.= ", fk_user_author";
|
||||
$sql.= ", fk_user_valid";
|
||||
$sql.= ", datedon";
|
||||
@ -340,7 +344,8 @@ class Don extends CommonObject
|
||||
$sql.= ", '".$this->db->escape($this->country)."'"; // TODO use country_id
|
||||
$sql.= ", ".$this->public;
|
||||
$sql.= ", ".($this->fk_project > 0?$this->fk_project:"null");
|
||||
$sql.= ", '".$this->db->escape($this->note)."'";
|
||||
$sql.= ", ".(!empty($this->note_private)?("'".$this->db->escape($this->note_private)."'"):"NULL");
|
||||
$sql.= ", ".(!empty($this->note_public)?("'".$this->db->escape($this->note_public)."'"):"NULL");
|
||||
$sql.= ", ".$user->id;
|
||||
$sql.= ", null";
|
||||
$sql.= ", '".$this->db->idate($this->date)."'";
|
||||
@ -400,7 +405,8 @@ class Don extends CommonObject
|
||||
$sql .= ",country='".$this->db->escape($this->country)."'"; // TODO use country_id
|
||||
$sql .= ",public=".$this->public;
|
||||
$sql .= ",fk_don_projet=".($this->fk_project>0?$this->fk_project:'null');
|
||||
$sql .= ",note='".$this->db->escape($this->note)."'";
|
||||
$sql .= ",note_private=".(!empty($this->note_private)?("'".$this->db->escape($this->note_private)."'"):"NULL");
|
||||
$sql .= ",note_public=".(!empty($this->note_public)?("'".$this->db->escape($this->note_public)."'"):"NULL");
|
||||
$sql .= ",datedon='".$this->db->idate($this->date)."'";
|
||||
$sql .= ",email='".$this->email."'";
|
||||
$sql .= ",phone='".$this->phone."'";
|
||||
@ -463,7 +469,9 @@ class Don extends CommonObject
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT d.rowid, d.datec, d.tms as datem, d.datedon,";
|
||||
$sql.= " d.firstname, d.lastname, d.societe, d.amount, d.fk_statut, d.address, d.zip, d.town, d.country, d.public, d.amount, d.fk_paiement, d.note, cp.libelle, d.email, d.phone, d.phone_mobile, d.fk_don_projet,";
|
||||
$sql.= " d.firstname, d.lastname, d.societe, d.amount, d.fk_statut, d.address, d.zip, d.town, ";
|
||||
$sql.= " d.country, d.public, d.amount, d.fk_paiement, d.note_private, d.note_public, cp.libelle, d.email, d.phone, ";
|
||||
$sql.= " d.phone_mobile, d.fk_don_projet,";
|
||||
$sql.= " p.title as project_label";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."don as d";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = d.fk_don_projet";
|
||||
@ -501,7 +509,8 @@ class Don extends CommonObject
|
||||
$this->modepaiementid = $obj->fk_paiement;
|
||||
$this->modepaiement = $obj->libelle;
|
||||
$this->amount = $obj->amount;
|
||||
$this->note = $obj->note;
|
||||
$this->note_private = $obj->note_private;
|
||||
$this->note_public = $obj->note_public;
|
||||
$this->commentaire = $obj->note; // deprecated
|
||||
}
|
||||
return 1;
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -98,7 +99,8 @@ if ($action == 'update')
|
||||
$don->note = $_POST["note"];
|
||||
$don->public = $_POST["public"];
|
||||
$don->fk_project = $_POST["projectid"];
|
||||
$don->note = $_POST["comment"];
|
||||
$don->note_private= GETPOST("note_private");
|
||||
$don->note_public = GETPOST("note_public");
|
||||
$don->modepaiementid = $_POST["modepaiement"];
|
||||
|
||||
if ($don->update($user) > 0)
|
||||
@ -146,10 +148,10 @@ if ($action == 'add')
|
||||
$don->country = $_POST["country"];
|
||||
$don->email = $_POST["email"];
|
||||
$don->date = $donation_date;
|
||||
$don->note = $_POST["note"];
|
||||
$don->note_private= GETPOST("note_private");
|
||||
$don->note_public = GETPOST("note_public");
|
||||
$don->public = $_POST["public"];
|
||||
$don->fk_project = $_POST["projectid"];
|
||||
$don->note = $_POST["comment"];
|
||||
$don->modepaiementid = $_POST["modepaiement"];
|
||||
|
||||
if ($don->create($user) > 0)
|
||||
@ -283,7 +285,7 @@ if ($action == 'create')
|
||||
print '</td>';
|
||||
|
||||
print '<td rowspan="'.$nbrows.'" valign="top">'.$langs->trans("Comments").' :<br>';
|
||||
print "<textarea name=\"comment\" wrap=\"soft\" cols=\"40\" rows=\"15\">".$_POST["comment"]."</textarea></td>";
|
||||
print "<textarea name=\"note_private\" wrap=\"soft\" cols=\"40\" rows=\"15\">".GETPOST("note_private")."</textarea></td>";
|
||||
print "</tr>";
|
||||
|
||||
// Amount
|
||||
@ -371,7 +373,7 @@ if (! empty($id) && $action == 'edit')
|
||||
print '</td>';
|
||||
|
||||
print '<td rowspan="'.$nbrows.'" valign="top">'.$langs->trans("Comments").' :<br>';
|
||||
print "<textarea name=\"comment\" wrap=\"soft\" cols=\"40\" rows=\"15\">".$don->note."</textarea></td>";
|
||||
print "<textarea name=\"note_private\" wrap=\"soft\" cols=\"40\" rows=\"15\">".$don->note_private."</textarea></td>";
|
||||
print "</tr>";
|
||||
|
||||
// Amount
|
||||
@ -471,7 +473,7 @@ if (! empty($id) && $action != 'edit')
|
||||
print "</td>";
|
||||
|
||||
print '<td rowspan="'.$nbrows.'" valign="top" width="50%">'.$langs->trans("Comments").' :<br>';
|
||||
print nl2br($don->note).'</td></tr>';
|
||||
print nl2br($don->note_private).'</td></tr>';
|
||||
|
||||
print "<tr>".'<td>'.$langs->trans("Amount").'</td><td>'.price($don->amount).' '.$langs->trans("Currency".$conf->currency).'</td></tr>';
|
||||
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013 Jean-Francois FERRY <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -43,6 +44,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
|
||||
if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php';
|
||||
if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
|
||||
if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
|
||||
$langs->load('bills');
|
||||
$langs->load('companies');
|
||||
@ -351,14 +353,14 @@ else if ($action == 'set_ref_client' && $user->rights->facture->creer)
|
||||
else if ($action == 'setnote_public' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES),'_public');
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
else if ($action == 'setnote' && $user->rights->facture->creer)
|
||||
else if ($action == 'setnote_private' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES),'_private');
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
@ -695,7 +697,7 @@ else if ($action == 'add' && $user->rights->facture->creer)
|
||||
|
||||
//$result=$object->fetch($_POST['fac_avoir']);
|
||||
|
||||
$object->socid = $_POST['socid'];
|
||||
$object->socid = GETPOST('socid','int');
|
||||
$object->number = $_POST['facnumber'];
|
||||
$object->date = $datefacture;
|
||||
$object->note_public = trim($_POST['note_public']);
|
||||
@ -742,12 +744,12 @@ else if ($action == 'add' && $user->rights->facture->creer)
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$object->socid = $_POST['socid'];
|
||||
$object->socid = GETPOST('socid','int');
|
||||
$object->type = $_POST['type'];
|
||||
$object->number = $_POST['facnumber'];
|
||||
$object->date = $datefacture;
|
||||
$object->note_public = trim($_POST['note_public']);
|
||||
$object->note = trim($_POST['note']);
|
||||
$object->note_private = trim($_POST['note_private']);
|
||||
$object->ref_client = $_POST['ref_client'];
|
||||
$object->ref_int = $_POST['ref_int'];
|
||||
$object->modelpdf = $_POST['model'];
|
||||
@ -778,12 +780,12 @@ else if ($action == 'add' && $user->rights->facture->creer)
|
||||
if (! $error)
|
||||
{
|
||||
// Si facture standard
|
||||
$object->socid = $_POST['socid'];
|
||||
$object->type = $_POST['type'];
|
||||
$object->socid = GETPOST('socid','int');
|
||||
$object->type = GETPOST('type');
|
||||
$object->number = $_POST['facnumber'];
|
||||
$object->date = $datefacture;
|
||||
$object->note_public = trim($_POST['note_public']);
|
||||
$object->note = trim($_POST['note']);
|
||||
$object->note_private = trim($_POST['note_private']);
|
||||
$object->ref_client = $_POST['ref_client'];
|
||||
$object->ref_int = $_POST['ref_int'];
|
||||
$object->modelpdf = $_POST['model'];
|
||||
@ -2113,12 +2115,15 @@ if ($action == 'create')
|
||||
print '<tr>';
|
||||
print '<td class="border" valign="top">'.$langs->trans('NotePublic').'</td>';
|
||||
print '<td valign="top" colspan="2">';
|
||||
print '<textarea name="note_public" wrap="soft" cols="70" rows="'.ROWS_3.'">';
|
||||
$note_public='';
|
||||
if (is_object($objectsrc)) // Take value from source object
|
||||
{
|
||||
print $objectsrc->note_public;
|
||||
$note_public=$objectsrc->note_public;
|
||||
}
|
||||
print '</textarea></td></tr>';
|
||||
$doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
|
||||
print $doleditor->Create(1);
|
||||
|
||||
//print '<textarea name="note_public" wrap="soft" cols="70" rows="'.ROWS_3.'">'.$note_public.'</textarea></td></tr>';
|
||||
|
||||
// Private note
|
||||
if (empty($user->societe_id))
|
||||
@ -2126,12 +2131,14 @@ if ($action == 'create')
|
||||
print '<tr>';
|
||||
print '<td class="border" valign="top">'.$langs->trans('NotePrivate').'</td>';
|
||||
print '<td valign="top" colspan="2">';
|
||||
print '<textarea name="note" wrap="soft" cols="70" rows="'.ROWS_3.'">';
|
||||
$note_private='';
|
||||
if (! empty($origin) && ! empty($originid) && is_object($objectsrc)) // Take value from source object
|
||||
{
|
||||
print $objectsrc->note;
|
||||
$note_private=$objectsrc->note_private;
|
||||
}
|
||||
print '</textarea></td></tr>';
|
||||
$doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
|
||||
print $doleditor->Create(1);
|
||||
//print '<textarea name="note_private" wrap="soft" cols="70" rows="'.ROWS_3.'">'.$note_private.'.</textarea></td></tr>';
|
||||
}
|
||||
|
||||
if (! empty($origin) && ! empty($originid) && is_object($objectsrc))
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -54,7 +55,8 @@ class FactureRec extends Facture
|
||||
var $remise;
|
||||
var $tva;
|
||||
var $total;
|
||||
var $note;
|
||||
var $note_private;
|
||||
var $note_public;
|
||||
var $db_table;
|
||||
var $propalid;
|
||||
var $fk_project;
|
||||
@ -111,7 +113,8 @@ class FactureRec extends Facture
|
||||
$sql.= ", datec";
|
||||
$sql.= ", amount";
|
||||
$sql.= ", remise";
|
||||
$sql.= ", note";
|
||||
$sql.= ", note_private";
|
||||
$sql.= ", note_public";
|
||||
$sql.= ", fk_user_author";
|
||||
$sql.= ", fk_projet";
|
||||
$sql.= ", fk_cond_reglement";
|
||||
@ -124,7 +127,8 @@ class FactureRec extends Facture
|
||||
$sql.= ", ".$this->db->idate($now);
|
||||
$sql.= ", '".$facsrc->amount."'";
|
||||
$sql.= ", '".$facsrc->remise."'";
|
||||
$sql.= ", '".$this->db->escape($this->note)."'";
|
||||
$sql.= ", ".(!empty($this->note_private)?("'".$this->db->escape($this->note_private)."'"):"NULL");
|
||||
$sql.= ", ".(!empty($this->note_public)?("'".$this->db->escape($this->note_public)."'"):"NULL");
|
||||
$sql.= ", '".$user->id."'";
|
||||
$sql.= ", ".(! empty($facsrc->fk_project)?"'".$facsrc->fk_project."'":"null");
|
||||
$sql.= ", '".$facsrc->cond_reglement_id."'";
|
||||
@ -201,7 +205,7 @@ class FactureRec extends Facture
|
||||
{
|
||||
$sql = 'SELECT f.titre,f.fk_soc,f.amount,f.tva,f.total,f.total_ttc,f.remise_percent,f.remise_absolue,f.remise';
|
||||
$sql.= ', f.date_lim_reglement as dlr';
|
||||
$sql.= ', f.note, f.note_public, f.fk_user_author';
|
||||
$sql.= ', f.note_private, f.note_public, f.fk_user_author';
|
||||
$sql.= ', f.fk_mode_reglement, f.fk_cond_reglement';
|
||||
$sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle';
|
||||
$sql.= ', c.code as cond_reglement_code, c.libelle as cond_reglement_libelle, c.libelle_facture as cond_reglement_libelle_doc';
|
||||
@ -249,7 +253,7 @@ class FactureRec extends Facture
|
||||
$this->cond_reglement_doc = $obj->cond_reglement_libelle_doc;
|
||||
$this->fk_project = $obj->fk_projet;
|
||||
$this->fk_facture_source = $obj->fk_facture_source;
|
||||
$this->note = $obj->note;
|
||||
$this->note_private = $obj->note_private;
|
||||
$this->note_public = $obj->note_public;
|
||||
$this->user_author = $obj->fk_user_author;
|
||||
$this->modelpdf = $obj->model_pdf;
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2013 Cedric Gross <c.gross@kreiz-it.fr>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -144,7 +145,7 @@ class Facture extends CommonInvoice
|
||||
if (empty($this->type)) $this->type = 0;
|
||||
$this->ref_client=trim($this->ref_client);
|
||||
$this->note=(isset($this->note) ? trim($this->note) : trim($this->note_private)); // deprecated
|
||||
$this->note_private=(isset($this->note_private) ? trim($this->note_private) : trim($this->note));
|
||||
$this->note_private=(isset($this->note_private) ? trim($this->note_private) : trim($this->note_private));
|
||||
$this->note_public=trim($this->note_public);
|
||||
if (! $this->cond_reglement_id) $this->cond_reglement_id = 0;
|
||||
if (! $this->mode_reglement_id) $this->mode_reglement_id = 0;
|
||||
@ -190,7 +191,7 @@ class Facture extends CommonInvoice
|
||||
// Clean parametres
|
||||
if (! $this->type) $this->type = 0;
|
||||
$this->ref_client=trim($this->ref_client);
|
||||
$this->note=trim($this->note);
|
||||
$this->note_private=trim($this->note_private);
|
||||
$this->note_public=trim($this->note_public);
|
||||
//if (! $this->remise) $this->remise = 0;
|
||||
if (! $this->mode_reglement_id) $this->mode_reglement_id = 0;
|
||||
@ -213,7 +214,7 @@ class Facture extends CommonInvoice
|
||||
$sql.= ", remise_absolue";
|
||||
$sql.= ", remise_percent";
|
||||
$sql.= ", datef";
|
||||
$sql.= ", note";
|
||||
$sql.= ", note_private";
|
||||
$sql.= ", note_public";
|
||||
$sql.= ", ref_client, ref_int";
|
||||
$sql.= ", fk_facture_source, fk_user_author, fk_projet";
|
||||
@ -516,7 +517,7 @@ class Facture extends CommonInvoice
|
||||
$facture->socid = $this->socid;
|
||||
$facture->date = $this->date;
|
||||
$facture->note_public = $this->note_public;
|
||||
$facture->note = $this->note;
|
||||
$facture->note_private = $this->note_private;
|
||||
$facture->ref_client = $this->ref_client;
|
||||
$facture->modelpdf = $this->modelpdf;
|
||||
$facture->fk_project = $this->fk_project;
|
||||
@ -703,7 +704,7 @@ class Facture extends CommonInvoice
|
||||
$this->fk_delivery_address = $object->fk_delivery_address;
|
||||
$this->contact_id = $object->contactid;
|
||||
$this->ref_client = $object->ref_client;
|
||||
$this->note = $object->note;
|
||||
$this->note_private = $object->note_private;
|
||||
$this->note_public = $object->note_public;
|
||||
|
||||
$this->origin = $object->element;
|
||||
@ -802,7 +803,7 @@ class Facture extends CommonInvoice
|
||||
$sql.= ', f.datec as datec';
|
||||
$sql.= ', f.date_valid as datev';
|
||||
$sql.= ', f.tms as datem';
|
||||
$sql.= ', f.note as note_private, f.note_public, f.fk_statut, f.paye, f.close_code, f.close_note, f.fk_user_author, f.fk_user_valid, f.model_pdf';
|
||||
$sql.= ', f.note_private, f.note_public, f.fk_statut, f.paye, f.close_code, f.close_note, f.fk_user_author, f.fk_user_valid, f.model_pdf';
|
||||
$sql.= ', f.fk_facture_source';
|
||||
$sql.= ', f.fk_mode_reglement, f.fk_cond_reglement, f.fk_projet, f.extraparams';
|
||||
$sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle';
|
||||
@ -1061,7 +1062,7 @@ class Facture extends CommonInvoice
|
||||
$sql.= " fk_cond_reglement=".(isset($this->cond_reglement_id)?$this->cond_reglement_id:"null").",";
|
||||
$sql.= " fk_mode_reglement=".(isset($this->mode_reglement_id)?$this->mode_reglement_id:"null").",";
|
||||
$sql.= " date_lim_reglement=".(strval($this->date_lim_reglement)!='' ? "'".$this->db->idate($this->date_lim_reglement)."'" : 'null').",";
|
||||
$sql.= " note=".(isset($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null").",";
|
||||
$sql.= " note_private=".(isset($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null").",";
|
||||
$sql.= " note_public=".(isset($this->note_public)?"'".$this->db->escape($this->note_public)."'":"null").",";
|
||||
$sql.= " model_pdf=".(isset($this->modelpdf)?"'".$this->db->escape($this->modelpdf)."'":"null").",";
|
||||
$sql.= " import_key=".(isset($this->import_key)?"'".$this->db->escape($this->import_key)."'":"null")."";
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -72,7 +73,7 @@ if ($action == 'add')
|
||||
if (! $error)
|
||||
{
|
||||
$object->titre = GETPOST('titre', 'alpha');
|
||||
$object->note = GETPOST('note');
|
||||
$object->note_private = GETPOST('note_private');
|
||||
$object->usenewprice = GETPOST('usenewprice');
|
||||
|
||||
if ($object->create($user, $id) > 0)
|
||||
@ -143,7 +144,7 @@ if ($action == 'create')
|
||||
|
||||
// Note
|
||||
print '<td rowspan="'.$rowspan.'" valign="top">';
|
||||
print '<textarea class="flat" name="note" wrap="soft" cols="60" rows="'.ROWS_4.'"></textarea>';
|
||||
print '<textarea class="flat" name="note_private" wrap="soft" cols="60" rows="'.ROWS_4.'"></textarea>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Author
|
||||
@ -394,7 +395,7 @@ else
|
||||
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id,'none');
|
||||
print "</td></tr>";
|
||||
|
||||
print '<tr><td>'.$langs->trans("Note").'</td><td colspan="3">'.nl2br($object->note)."</td></tr>";
|
||||
print '<tr><td>'.$langs->trans("Note").'</td><td colspan="3">'.nl2br($object->note_private)."</td></tr>";
|
||||
|
||||
print "</table>";
|
||||
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -140,7 +141,7 @@ if (! $sall) $sql = 'SELECT';
|
||||
else $sql = 'SELECT DISTINCT';
|
||||
$sql.= ' f.rowid as facid, f.facnumber, f.type, f.increment, f.total as total_ht, f.tva as total_tva, f.total_ttc,';
|
||||
$sql.= ' f.datef as df, f.date_lim_reglement as datelimite,';
|
||||
$sql.= ' f.paye as paye, f.fk_statut, f.note,';
|
||||
$sql.= ' f.paye as paye, f.fk_statut,';
|
||||
$sql.= ' s.nom, s.rowid as socid';
|
||||
if (! $sall) $sql.= ', SUM(pf.amount) as am'; // To be able to sort on status
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s';
|
||||
@ -210,7 +211,7 @@ if (! $sall)
|
||||
{
|
||||
$sql.= ' GROUP BY f.rowid, f.facnumber, f.type, f.increment, f.total, f.total_ttc,';
|
||||
$sql.= ' f.datef, f.date_lim_reglement,';
|
||||
$sql.= ' f.paye, f.fk_statut, f.note,';
|
||||
$sql.= ' f.paye, f.fk_statut,';
|
||||
$sql.= ' s.nom, s.rowid';
|
||||
}
|
||||
else
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -52,14 +53,14 @@ $object->fetch($id);
|
||||
if ($action == 'setnote_public' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES),'_public');
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
else if ($action == 'setnote' && $user->rights->facture->creer)
|
||||
else if ($action == 'setnote_private' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES),'_private');
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerker@telenet.be>
|
||||
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -63,7 +64,8 @@ class Contact extends CommonObject
|
||||
var $birthday;
|
||||
var $default_lang;
|
||||
var $note_public; // Public note
|
||||
var $note; // Private note
|
||||
var $note; // deprecated
|
||||
var $note_private; // Private note
|
||||
var $no_email; // 1=Don't send e-mail to this contact, 0=do
|
||||
|
||||
var $ref_facturation; // Nb de reference facture pour lequel il est contact
|
||||
@ -238,7 +240,8 @@ class Contact extends CommonObject
|
||||
$sql .= ", poste='".$this->db->escape($this->poste)."'";
|
||||
$sql .= ", fax='".$this->db->escape($this->fax)."'";
|
||||
$sql .= ", email='".$this->db->escape($this->email)."'";
|
||||
$sql .= ", note='".$this->db->escape($this->note)."'";
|
||||
$sql .= ", note_private='".$this->db->escape($this->note_private)."'";
|
||||
$sql .= ", note_public='".$this->db->escape($this->note_public)."'";
|
||||
$sql .= ", phone = '".$this->db->escape($this->phone_pro)."'";
|
||||
$sql .= ", phone_perso = '".$this->db->escape($this->phone_perso)."'";
|
||||
$sql .= ", phone_mobile = '".$this->db->escape($this->phone_mobile)."'";
|
||||
@ -366,7 +369,7 @@ class Contact extends CommonObject
|
||||
if ($this->phone_perso && ! empty($conf->global->LDAP_CONTACT_FIELD_HOMEPHONE)) $info[$conf->global->LDAP_CONTACT_FIELD_HOMEPHONE] = $this->phone_perso;
|
||||
if ($this->phone_mobile && ! empty($conf->global->LDAP_CONTACT_FIELD_MOBILE)) $info[$conf->global->LDAP_CONTACT_FIELD_MOBILE] = $this->phone_mobile;
|
||||
if ($this->fax && ! empty($conf->global->LDAP_CONTACT_FIELD_FAX)) $info[$conf->global->LDAP_CONTACT_FIELD_FAX] = $this->fax;
|
||||
if ($this->note && ! empty($conf->global->LDAP_CONTACT_FIELD_DESCRIPTION)) $info[$conf->global->LDAP_CONTACT_FIELD_DESCRIPTION] = $this->note;
|
||||
if ($this->note_private && ! empty($conf->global->LDAP_CONTACT_FIELD_DESCRIPTION)) $info[$conf->global->LDAP_CONTACT_FIELD_DESCRIPTION] = $this->note_private;
|
||||
if ($this->email && ! empty($conf->global->LDAP_CONTACT_FIELD_MAIL)) $info[$conf->global->LDAP_CONTACT_FIELD_MAIL] = $this->email;
|
||||
|
||||
if ($conf->global->LDAP_SERVER_TYPE == 'egroupware')
|
||||
@ -482,7 +485,7 @@ class Contact extends CommonObject
|
||||
$sql.= " c.fk_departement,";
|
||||
$sql.= " c.birthday,";
|
||||
$sql.= " c.poste, c.phone, c.phone_perso, c.phone_mobile, c.fax, c.email, c.jabberid,";
|
||||
$sql.= " c.priv, c.note, c.default_lang, c.no_email, c.canvas,";
|
||||
$sql.= " c.priv, c.note_private, c.note_public, c.default_lang, c.no_email, c.canvas,";
|
||||
$sql.= " c.import_key,";
|
||||
$sql.= " p.libelle as country, p.code as country_code,";
|
||||
$sql.= " d.nom as state, d.code_departement as state_code,";
|
||||
@ -538,7 +541,9 @@ class Contact extends CommonObject
|
||||
$this->mail = $obj->email;
|
||||
|
||||
$this->birthday = $this->db->jdate($obj->birthday);
|
||||
$this->note = $obj->note;
|
||||
$this->note = $obj->note_private; // deprecated
|
||||
$this->note_private = $obj->note_private;
|
||||
$this->note_public = $obj->note_public;
|
||||
$this->default_lang = $obj->default_lang;
|
||||
$this->no_email = $obj->no_email;
|
||||
$this->user_id = $obj->user_id;
|
||||
@ -1008,7 +1013,7 @@ class Contact extends CommonObject
|
||||
$this->fax = '0909090909';
|
||||
|
||||
$this->note_public='This is a comment (public)';
|
||||
$this->note='This is a comment (private)';
|
||||
$this->note_private='This is a comment (private)';
|
||||
|
||||
$socid = rand(1, $num_socs);
|
||||
$this->socid = $socids[$socid];
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -32,6 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/contact.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
|
||||
$langs->load("companies");
|
||||
$langs->load("users");
|
||||
@ -152,14 +154,15 @@ if (empty($reshook))
|
||||
$object->jabberid = $_POST["jabberid"];
|
||||
$object->no_email = $_POST["no_email"];
|
||||
$object->priv = $_POST["priv"];
|
||||
$object->note = $_POST["note"];
|
||||
$object->note_public = GETPOST("note_public");
|
||||
$object->note_private = GETPOST("note_private");
|
||||
|
||||
// Note: Correct date should be completed with location to have exact GM time of birth.
|
||||
$object->birthday = dol_mktime(0,0,0,$_POST["birthdaymonth"],$_POST["birthdayday"],$_POST["birthdayyear"]);
|
||||
$object->birthday_alert = $_POST["birthday_alert"];
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||
|
||||
if (! $_POST["lastname"])
|
||||
{
|
||||
@ -247,10 +250,11 @@ if (empty($reshook))
|
||||
$object->jabberid = $_POST["jabberid"];
|
||||
$object->no_email = $_POST["no_email"];
|
||||
$object->priv = $_POST["priv"];
|
||||
$object->note = $_POST["note"];
|
||||
$object->note_public = GETPOST("note_public");
|
||||
$object->note_private = GETPOST("note_private");
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||
|
||||
$result = $object->update($_POST["contactid"], $user);
|
||||
|
||||
@ -296,11 +300,12 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
||||
// -----------------------------------------
|
||||
if (empty($object->error) && $id)
|
||||
{
|
||||
$object = new Contact($db);
|
||||
$object->fetch($id);
|
||||
$object = new Contact($db);
|
||||
$result=$object->fetch($id);
|
||||
if ($result <= 0) dol_print_error('',$object->error);
|
||||
}
|
||||
$objcanvas->assign_values($action, $id); // Set value for templates
|
||||
$objcanvas->display_canvas($action); // Show template
|
||||
$objcanvas->assign_values($action, $object->id, $object->ref); // Set value for templates
|
||||
$objcanvas->display_canvas($action); // Show template
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -499,8 +504,21 @@ else
|
||||
print $form->selectarray('priv',$selectarray,(isset($_POST["priv"])?$_POST["priv"]:$object->priv),0);
|
||||
print '</td></tr>';
|
||||
|
||||
// Note
|
||||
print '<tr><td valign="top">'.$langs->trans("Note").'</td><td colspan="3" valign="top"><textarea name="note" cols="70" rows="'.ROWS_3.'">'.(isset($_POST["note"])?$_POST["note"]:$object->note).'</textarea></td></tr>';
|
||||
// Note Public
|
||||
print '<tr><td valign="top">'.$langs->trans("NotePublic").'</td>';
|
||||
print '<td colspan="3" valign="top">';
|
||||
$doleditor = new DolEditor('note_public', GETPOST('note_public'), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
|
||||
print $doleditor->Create(1);
|
||||
//print '<textarea name="note" cols="70" rows="'.ROWS_3.'">'.(isset($_POST["note"])?$_POST["note"]:$object->note).'</textarea>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Note Private
|
||||
print '<tr><td valign="top">'.$langs->trans("NotePrivate").'</td>';
|
||||
print '<td colspan="3" valign="top">';
|
||||
$doleditor = new DolEditor('note_private', GETPOST('note_private'), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
|
||||
print $doleditor->Create(1);
|
||||
//print '<textarea name="note" cols="70" rows="'.ROWS_3.'">'.(isset($_POST["note"])?$_POST["note"]:$object->note).'</textarea>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Other attributes
|
||||
$parameters=array('colspan' => ' colspan="3"');
|
||||
@ -703,11 +721,23 @@ else
|
||||
print $form->selectarray('priv',$selectarray,$object->priv,0);
|
||||
print '</td></tr>';
|
||||
|
||||
// Note
|
||||
print '<tr><td valign="top">'.$langs->trans("Note").'</td><td colspan="3">';
|
||||
print '<textarea name="note" cols="70" rows="'.ROWS_3.'">';
|
||||
print isset($_POST["note"])?$_POST["note"]:$object->note;
|
||||
print '</textarea></td></tr>';
|
||||
// Note Public
|
||||
print '<tr><td valign="top">'.$langs->trans("NotePublic").'</td><td colspan="3">';
|
||||
$doleditor = new DolEditor('note_public', $object->note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
|
||||
print $doleditor->Create(1);
|
||||
// print '<textarea name="note" cols="70" rows="'.ROWS_3.'">';
|
||||
// print isset($_POST["note"])?$_POST["note"]:$object->note;
|
||||
// print '</textarea></td></tr>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Note Private
|
||||
print '<tr><td valign="top">'.$langs->trans("NotePrivate").'</td><td colspan="3">';
|
||||
$doleditor = new DolEditor('note_private', $object->note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
|
||||
print $doleditor->Create(1);
|
||||
// print '<textarea name="note" cols="70" rows="'.ROWS_3.'">';
|
||||
// print isset($_POST["note"])?$_POST["note"]:$object->note;
|
||||
// print '</textarea></td></tr>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Other attributes
|
||||
$parameters=array('colspan' => ' colspan="3"');
|
||||
@ -908,9 +938,14 @@ else
|
||||
print $object->LibPubPriv($object->priv);
|
||||
print '</td></tr>';
|
||||
|
||||
// Note
|
||||
print '<tr><td valign="top">'.$langs->trans("Note").'</td><td colspan="3">';
|
||||
print nl2br($object->note);
|
||||
// Note Public
|
||||
print '<tr><td valign="top">'.$langs->trans("NotePublic").'</td><td colspan="3">';
|
||||
print nl2br($object->note_public);
|
||||
print '</td></tr>';
|
||||
|
||||
// Note Private
|
||||
print '<tr><td valign="top">'.$langs->trans("NotePrivate").'</td><td colspan="3">';
|
||||
print nl2br($object->note_private);
|
||||
print '</td></tr>';
|
||||
|
||||
// Other attributes
|
||||
|
||||
@ -5,7 +5,8 @@
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -338,7 +339,7 @@ class Contrat extends CommonObject
|
||||
$sql.= " fk_user_author,";
|
||||
$sql.= " fk_projet,";
|
||||
$sql.= " fk_commercial_signature, fk_commercial_suivi,";
|
||||
$sql.= " note as note_private, note_public, extraparams";
|
||||
$sql.= " note_private, note_public, extraparams";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."contrat";
|
||||
if ($ref)
|
||||
{
|
||||
@ -649,7 +650,7 @@ class Contrat extends CommonObject
|
||||
// Insert contract
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."contrat (datec, fk_soc, fk_user_author, date_contrat,";
|
||||
$sql.= " fk_commercial_signature, fk_commercial_suivi, fk_projet,";
|
||||
$sql.= " ref, entity, note, note_public)";
|
||||
$sql.= " ref, entity, note_private, note_public)";
|
||||
$sql.= " VALUES (".$this->db->idate($now).",".$this->socid.",".$user->id;
|
||||
$sql.= ",".$this->db->idate($this->date_contrat);
|
||||
$sql.= ",".($this->commercial_signature_id>0?$this->commercial_signature_id:"NULL");
|
||||
@ -657,7 +658,7 @@ class Contrat extends CommonObject
|
||||
$sql.= ",".($this->fk_project>0?$this->fk_project:"NULL");
|
||||
$sql.= ", ".(dol_strlen($this->ref)<=0 ? "null" : "'".$this->ref."'");
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ", ".(!empty($this->note)?("'".$this->db->escape($this->note)."'"):"NULL");
|
||||
$sql.= ", ".(!empty($this->note_private)?("'".$this->db->escape($this->note_private)."'"):"NULL");
|
||||
$sql.= ", ".(!empty($this->note_public)?("'".$this->db->escape($this->note_public)."'"):"NULL");
|
||||
$sql.= ")";
|
||||
$resql=$this->db->query($sql);
|
||||
@ -1605,8 +1606,8 @@ class Contrat extends CommonObject
|
||||
$this->date_contrat = dol_now();
|
||||
$this->commercial_signature_id = 1;
|
||||
$this->commercial_suivi_id = 1;
|
||||
$this->note='This is a comment (private)';
|
||||
$this->note='This is a comment (public)';
|
||||
$this->note_private='This is a comment (private)';
|
||||
$this->note_public='This is a comment (public)';
|
||||
$this->fk_projet = 0;
|
||||
// Lines
|
||||
$nbp = 5;
|
||||
|
||||
@ -4,7 +4,8 @@
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -32,6 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/contract.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/modules/contract/modules_contract.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
if (! empty($conf->produit->enabled) || ! empty($conf->service->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
if (! empty($conf->projet->enabled)) {
|
||||
@ -182,7 +184,7 @@ if ($action == 'add' && $user->rights->contrat->creer)
|
||||
$object->commercial_suivi_id = GETPOST('commercial_suivi_id','int');
|
||||
$object->commercial_signature_id = GETPOST('commercial_signature_id','int');
|
||||
|
||||
$object->note = GETPOST('note','alpha');
|
||||
$object->note_private = GETPOST('note_private','alpha');
|
||||
$object->note_public = GETPOST('note_public','alpha');
|
||||
$object->fk_project = GETPOST('projectid','int');
|
||||
$object->remise_percent = GETPOST('remise_percent','alpha');
|
||||
@ -656,13 +658,13 @@ else if ($action == 'confirm_move' && $confirm == 'yes' && $user->rights->contra
|
||||
|
||||
else if ($action == 'setnote_public' && $user->rights->contrat->creer)
|
||||
{
|
||||
$result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES),'_public');
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
else if ($action == 'setnote' && $user->rights->contrat->creer)
|
||||
else if ($action == 'setnote_private' && $user->rights->contrat->creer)
|
||||
{
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES),'_private');
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
@ -785,7 +787,7 @@ if ($action == 'create')
|
||||
|
||||
$soc = $objectsrc->client;
|
||||
|
||||
$note_private = (! empty($objectsrc->note) ? $objectsrc->note : (! empty($objectsrc->note_private) ? $objectsrc->note_private : ''));
|
||||
$note_private = (! empty($objectsrc->note_private) ? $objectsrc->note_private : '');
|
||||
$note_public = (! empty($objectsrc->note_public) ? $objectsrc->note_public : '');
|
||||
|
||||
// Object source contacts list
|
||||
@ -794,7 +796,7 @@ if ($action == 'create')
|
||||
}
|
||||
else {
|
||||
$projectid = GETPOST('projectid','int');
|
||||
$note_private = GETPOST("note");
|
||||
$note_private = GETPOST("note_private");
|
||||
$note_public = GETPOST("note_public");
|
||||
}
|
||||
|
||||
@ -869,25 +871,16 @@ if ($action == 'create')
|
||||
|
||||
print '<tr><td>'.$langs->trans("NotePublic").'</td><td valign="top">';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
|
||||
$doleditor=new DolEditor('note_public', $note_public, '', '100', 'dolibarr_notes', 'In', 1, true, true, ROWS_3, 70);
|
||||
print $doleditor->Create(1);
|
||||
/*
|
||||
print '<textarea name="note_public" wrap="soft" cols="70" rows="'.ROWS_3.'">';
|
||||
print $note_public;
|
||||
print '</textarea></td></tr>';
|
||||
*/
|
||||
|
||||
|
||||
if (! $user->societe_id)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("NotePrivate").'</td><td valign="top">';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor('note', $note_private, '', '100', 'dolibarr_notes', 'In', 1, true, true, ROWS_3, 70);
|
||||
$doleditor=new DolEditor('note_private', $note_private, '', '100', 'dolibarr_notes', 'In', 1, true, true, ROWS_3, 70);
|
||||
print $doleditor->Create(1);
|
||||
/*
|
||||
print '<textarea name="note" wrap="soft" cols="70" rows="'.ROWS_3.'">';
|
||||
print $note_private;
|
||||
print '</textarea>';*/
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
@ -50,13 +50,13 @@ $object->fetch($id,$ref);
|
||||
|
||||
if ($action == 'setnote_public' && $user->rights->contrat->creer)
|
||||
{
|
||||
$result=$object->update_note_public(dol_html_entity_decode(dol_htmlcleanlastbr(GETPOST('note_public')), ENT_QUOTES));
|
||||
$result=$object->update_note(dol_html_entity_decode(dol_htmlcleanlastbr(GETPOST('note_public')), ENT_QUOTES),'_pubic');
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
else if ($action == 'setnote' && $user->rights->contrat->creer)
|
||||
else if ($action == 'setnote_private' && $user->rights->contrat->creer)
|
||||
{
|
||||
$result=$object->update_note(dol_html_entity_decode(dol_htmlcleanlastbr(GETPOST('note')), ENT_QUOTES));
|
||||
$result=$object->update_note(dol_html_entity_decode(dol_htmlcleanlastbr(GETPOST('note_private')), ENT_QUOTES),'_private');
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
|
||||
@ -66,6 +66,13 @@ if ($action == 'add')
|
||||
$mesg[]=$langs->trans("ErrorNoValueForSelectType");
|
||||
$action = 'create';
|
||||
}
|
||||
if (GETPOST('type')=='sellist' && !GETPOST('param'))
|
||||
{
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
$mesg[]=$langs->trans("ErrorNoValueForSelectListType");
|
||||
$action = 'create';
|
||||
}
|
||||
if (GETPOST('type')=='checkbox' && !GETPOST('param'))
|
||||
{
|
||||
$error++;
|
||||
@ -82,30 +89,30 @@ if ($action == 'add')
|
||||
}
|
||||
if (((GETPOST('type')=='radio') || (GETPOST('type')=='checkbox') || (GETPOST('type')=='radio')) && GETPOST('param'))
|
||||
{
|
||||
// Construct array for parameter (value of select list)
|
||||
$parameters = GETPOST('param');
|
||||
$parameters_array = explode("\r\n",$parameters);
|
||||
foreach($parameters_array as $param_ligne)
|
||||
{
|
||||
if (!empty($param_ligne)) {
|
||||
if (preg_match_all('/,/',$param_ligne,$matches))
|
||||
{
|
||||
if (count($matches[0])>1) {
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
$mesg[]=$langs->trans("ErrorBadFormatValueList",$param_ligne);
|
||||
$action = 'create';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Construct array for parameter (value of select list)
|
||||
$parameters = GETPOST('param');
|
||||
$parameters_array = explode("\r\n",$parameters);
|
||||
foreach($parameters_array as $param_ligne)
|
||||
{
|
||||
if (!empty($param_ligne)) {
|
||||
if (preg_match_all('/,/',$param_ligne,$matches))
|
||||
{
|
||||
if (count($matches[0])>1) {
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
$mesg[]=$langs->trans("ErrorBadFormatValueList",$param_ligne);
|
||||
$action = 'create';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
$mesg[]=$langs->trans("ErrorBadFormatValueList",$param_ligne);
|
||||
$action = 'create';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
@ -114,6 +121,7 @@ if ($action == 'add')
|
||||
if (isset($_POST["attrname"]) && preg_match("/^\w[a-zA-Z0-9-_]*$/",$_POST['attrname']))
|
||||
{
|
||||
// Construct array for parameter (value of select list)
|
||||
$default_value = GETPOST('default_value');
|
||||
$parameters = GETPOST('param');
|
||||
$parameters_array = explode("\r\n",$parameters);
|
||||
foreach($parameters_array as $param_ligne)
|
||||
@ -186,6 +194,13 @@ if ($action == 'update')
|
||||
$mesg[]=$langs->trans("ErrorNoValueForSelectType");
|
||||
$action = 'edit';
|
||||
}
|
||||
if (GETPOST('type')=='sellist' && !GETPOST('param'))
|
||||
{
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
$mesg[]=$langs->trans("ErrorNoValueForSelectListType");
|
||||
$action = 'edit';
|
||||
}
|
||||
if (GETPOST('type')=='checkbox' && !GETPOST('param'))
|
||||
{
|
||||
$error++;
|
||||
@ -291,4 +306,4 @@ if ($action == 'delete')
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@ -1400,77 +1400,52 @@ abstract class CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Update private note of element
|
||||
* Update note of element
|
||||
*
|
||||
* @param string $note New value for note
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @param string $note New value for note
|
||||
* @param string $suffix '', '_public' or '_private'
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function update_note($note)
|
||||
function update_note($note,$suffix='')
|
||||
{
|
||||
if (! $this->table_element)
|
||||
{
|
||||
dol_syslog(get_class($this)."::update_note was called on objet with property table_element not defined", LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
if (! $this->table_element)
|
||||
{
|
||||
dol_syslog(get_class($this)."::update_note was called on objet with property table_element not defined", LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||
// TODO uniformize fields to note_private
|
||||
if ($this->table_element == 'fichinter' || $this->table_element == 'projet' || $this->table_element == 'projet_task')
|
||||
{
|
||||
$sql.= " SET note_private = '".$this->db->escape($note)."'";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql.= " SET note = '".$this->db->escape($note)."'";
|
||||
}
|
||||
$sql.= " WHERE rowid =". $this->id;
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql.= " SET note".$suffix." = ".(!empty($note)?("'".$this->db->escape($note)."'"):"NULL");
|
||||
$sql.= " WHERE rowid =". $this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::update_note sql=".$sql, LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$this->note = $note; // deprecated
|
||||
$this->note_private = $note;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::update_note error=".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
dol_syslog(get_class($this)."::update_note sql=".$sql, LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
if ($suffix == '_public') $this->note_public = $note;
|
||||
else if ($suffix == '_private') $this->note_private = $note;
|
||||
else $this->note = $note;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::update_note error=".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update public note of element
|
||||
*
|
||||
* @param string $note_public New value for note
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* Update public note (kept for backward compatibility)
|
||||
*
|
||||
* @param string $note New value for note
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @deprecated
|
||||
*/
|
||||
function update_note_public($note_public)
|
||||
function update_note_public($note)
|
||||
{
|
||||
if (! $this->table_element)
|
||||
{
|
||||
dol_syslog(get_class($this)."::update_note_public was called on objet with property table_element not defined",LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql.= " SET note_public = '".$this->db->escape($note_public)."'";
|
||||
$sql.= " WHERE rowid =". $this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::update_note_public sql=".$sql);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$this->note_public = $note_public;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
}
|
||||
return $this->update_note($note,'_public');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update total_ht, total_ttc and total_vat for an object (sum of lines)
|
||||
*
|
||||
|
||||
@ -331,7 +331,8 @@ class Conf
|
||||
|
||||
// societe
|
||||
if (empty($this->global->SOCIETE_CODECLIENT_ADDON)) $this->global->SOCIETE_CODECLIENT_ADDON="mod_codeclient_leopard";
|
||||
if (empty($this->global->SOCIETE_CODEFOURNISSEUR_ADDON)) $this->global->SOCIETE_CODEFOURNISSEUR_ADDON=$this->global->SOCIETE_CODECLIENT_ADDON;
|
||||
// Unused constant and for avoid problem with multicompany sharing
|
||||
//if (empty($this->global->SOCIETE_CODEFOURNISSEUR_ADDON)) $this->global->SOCIETE_CODEFOURNISSEUR_ADDON=$this->global->SOCIETE_CODECLIENT_ADDON;
|
||||
if (empty($this->global->SOCIETE_CODECOMPTA_ADDON)) $this->global->SOCIETE_CODECOMPTA_ADDON="mod_codecompta_panicum";
|
||||
|
||||
// Security
|
||||
|
||||
@ -252,18 +252,20 @@ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1,$handler='',$oker
|
||||
// Ajout trace sur requete (eventuellement a commenter si beaucoup de requetes)
|
||||
if (! $silent) print '<tr><td valign="top">'.$langs->trans("Request").' '.($i+1)." sql='".dol_htmlentities($newsql,ENT_NOQUOTES)."'</td></tr>\n";
|
||||
dol_syslog('Admin.lib::run_sql Request '.($i+1).' sql='.$newsql, LOG_DEBUG);
|
||||
$sqlmodified=0;
|
||||
|
||||
// Replace for encrypt data
|
||||
if (preg_match_all('/__ENCRYPT\(\'([A-Za-z0-9_\"\[\]]+)\'\)__/i',$newsql,$reg))
|
||||
if (preg_match_all('/__ENCRYPT\(\'([^\']+)\'\)__/i',$newsql,$reg))
|
||||
{
|
||||
$num=count($reg[0]);
|
||||
|
||||
for($i=0;$i<$num;$i++)
|
||||
for($j=0;$j<$num;$j++)
|
||||
{
|
||||
$from = $reg[0][$i];
|
||||
$to = $db->encrypt($reg[1][$i],1);
|
||||
$from = $reg[0][$j];
|
||||
$to = $db->encrypt($reg[1][$j],1);
|
||||
$newsql = str_replace($from,$to,$newsql);
|
||||
}
|
||||
$sqlmodified++;
|
||||
}
|
||||
|
||||
// Replace for decrypt data
|
||||
@ -271,12 +273,13 @@ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1,$handler='',$oker
|
||||
{
|
||||
$num=count($reg[0]);
|
||||
|
||||
for($i=0;$i<$num;$i++)
|
||||
for($j=0;$j<$num;$j++)
|
||||
{
|
||||
$from = $reg[0][$i];
|
||||
$to = $db->decrypt($reg[1][$i]);
|
||||
$from = $reg[0][$j];
|
||||
$to = $db->decrypt($reg[1][$j]);
|
||||
$newsql = str_replace($from,$to,$newsql);
|
||||
}
|
||||
$sqlmodified++;
|
||||
}
|
||||
|
||||
// Replace __x__ with rowid of insert nb x
|
||||
@ -294,9 +297,11 @@ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1,$handler='',$oker
|
||||
$from='__'.$cursor.'__';
|
||||
$to=$listofinsertedrowid[$cursor];
|
||||
$newsql=str_replace($from,$to,$newsql);
|
||||
dol_syslog('Admin.lib::run_sql New Request '.($i+1).' (replacing '.$from.' to '.$to.') sql='.$newsql, LOG_DEBUG);
|
||||
$sqlmodified++;
|
||||
}
|
||||
|
||||
if ($sqlmodified) dol_syslog('Admin.lib::run_sql New Request '.($i+1).' sql='.$newsql, LOG_DEBUG);
|
||||
|
||||
$result=$db->query($newsql,$usesavepoint);
|
||||
if ($result)
|
||||
{
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
||||
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -85,7 +86,7 @@ function societe_prepare_head($object)
|
||||
if ($user->societe_id == 0)
|
||||
{
|
||||
// Notes
|
||||
$head[$h][0] = DOL_URL_ROOT.'/societe/note.php?socid='.$object->id;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/societe/note.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Note");
|
||||
$head[$h][2] = 'note';
|
||||
$h++;
|
||||
@ -529,7 +530,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
|
||||
}
|
||||
print "</tr>";
|
||||
|
||||
$sql = "SELECT p.rowid, p.lastname, p.firstname, p.fk_pays, p.poste, p.phone, p.phone_mobile, p.fax, p.email, p.note ";
|
||||
$sql = "SELECT p.rowid, p.lastname, p.firstname, p.fk_pays, p.poste, p.phone, p.phone_mobile, p.fax, p.email ";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p";
|
||||
$sql .= " WHERE p.fk_soc = ".$object->id;
|
||||
$sql .= " ORDER by p.datec";
|
||||
|
||||
@ -171,16 +171,19 @@ function supplierorder_admin_prepare_head($object)
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/admin/supplierorder_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ExtraFieldsSupplierOrders");
|
||||
$head[$h][2] = 'attributes';
|
||||
$head[$h][2] = 'supplierorder';
|
||||
$h++;
|
||||
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'supplierorder_admin');
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/supplier_invoice.php";
|
||||
$head[$h][1] = $langs->trans("SuppliersInvoice");
|
||||
$head[$h][2] = 'invoice';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/admin/supplierinvoice_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ExtraFieldsSupplierInvoices");
|
||||
$head[$h][2] = 'supplierinvoice';
|
||||
$h++;
|
||||
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'supplierorder_admin','remove');
|
||||
|
||||
return $head;
|
||||
|
||||
@ -3544,16 +3544,17 @@ function dol_textishtml($msg,$option=0)
|
||||
{
|
||||
if (preg_match('/<html/i',$msg)) return true;
|
||||
elseif (preg_match('/<body/i',$msg)) return true;
|
||||
elseif (preg_match('/<b>/i',$msg)) return true;
|
||||
elseif (preg_match('/<br/i',$msg)) return true;
|
||||
elseif (preg_match('/<span/i',$msg)) return true;
|
||||
elseif (preg_match('/<div/i',$msg)) return true;
|
||||
elseif (preg_match('/<li/i',$msg)) return true;
|
||||
elseif (preg_match('/<table/i',$msg)) return true;
|
||||
elseif (preg_match('/<em>/i',$msg)) return true;
|
||||
elseif (preg_match('/<font/i',$msg)) return true;
|
||||
elseif (preg_match('/<strong/i',$msg)) return true;
|
||||
elseif (preg_match('/<img/i',$msg)) return true;
|
||||
elseif (preg_match('/<i>/i',$msg)) return true;
|
||||
elseif (preg_match('/<b>/i',$msg)) return true;
|
||||
elseif (preg_match('/<li/i',$msg)) return true;
|
||||
elseif (preg_match('/<span/i',$msg)) return true;
|
||||
elseif (preg_match('/<strong/i',$msg)) return true;
|
||||
elseif (preg_match('/<table/i',$msg)) return true;
|
||||
elseif (preg_match('/&[A-Z0-9]{1,6};/i',$msg)) return true; // Html entities names (http://www.w3schools.com/tags/ref_entities.asp)
|
||||
elseif (preg_match('/&#[0-9]{2,3};/i',$msg)) return true; // Html entities numbers (http://www.w3schools.com/tags/ref_entities.asp)
|
||||
return false;
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
#!/usr/bin/php
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2009-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2009-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -29,22 +28,23 @@ require_once(DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php');
|
||||
|
||||
/**
|
||||
* Function to build a compiled PDF
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param Translate $langs Object langs
|
||||
* @param Conf $conf Object conf
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param Translate $langs Object langs
|
||||
* @param Conf $conf Object conf
|
||||
* @param string $diroutputpdf Dir to output file
|
||||
* @param string $newlangid Lang id
|
||||
* @param array $filter Array with filters
|
||||
* @param date $dateafterdate Invoice after date
|
||||
* @param date $dateafterdate Invoice after date
|
||||
* @param date $datebeforedate Invoice before date
|
||||
* @param date $paymentdateafter Payment after date
|
||||
* @param date $paymentdatebefore Payment before date
|
||||
* @param int $usestdout Add information onto standard output
|
||||
* @param int $regenerate ''=Use existing PDF files, 'nameofpdf'=Regenerate all PDF files using the template,
|
||||
* @return int Error code
|
||||
* @param int $regenerate ''=Use existing PDF files, 'nameofpdf'=Regenerate all PDF files using the template
|
||||
* @param string $option Suffix to add into file name of generated PDF
|
||||
* @return int Error code
|
||||
*/
|
||||
function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filter, $dateafterdate, $datebeforedate, $paymentdateafter, $paymentdatebefore, $usestdout, $regenerate=0)
|
||||
function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filter, $dateafterdate, $datebeforedate, $paymentdateafter, $paymentdatebefore, $usestdout, $regenerate=0, $option='')
|
||||
{
|
||||
$sql = "SELECT DISTINCT f.rowid, f.facnumber";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||
@ -104,19 +104,19 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte
|
||||
}
|
||||
if ($sqlwhere) $sql.=$sqlwhere;
|
||||
if ($sqlorder) $sql.=$sqlorder;
|
||||
|
||||
|
||||
//print $sql; exit;
|
||||
dol_syslog("scripts/invoices/rebuild_merge.php: sql=".$sql);
|
||||
|
||||
|
||||
if ($usestdout) print '--- start'."\n";
|
||||
|
||||
|
||||
// Start of transaction
|
||||
//$db->begin();
|
||||
|
||||
|
||||
$error = 0;
|
||||
$result = 0;
|
||||
$files = array() ; // liste les fichiers
|
||||
|
||||
|
||||
dol_syslog("scripts/invoices/rebuild_merge.php sql=".$sql);
|
||||
if ( $resql=$db->query($sql) )
|
||||
{
|
||||
@ -125,16 +125,16 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte
|
||||
$oldemail = '';
|
||||
$message = '';
|
||||
$total = '';
|
||||
|
||||
|
||||
if ($num)
|
||||
{
|
||||
// First loop on each resultset to build PDF
|
||||
// -----------------------------------------
|
||||
|
||||
|
||||
while ($cpt < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
|
||||
$fac = new Facture($db);
|
||||
$result=$fac->fetch($obj->rowid);
|
||||
if ($result > 0)
|
||||
@ -157,35 +157,35 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte
|
||||
else {
|
||||
if ($usestdout) print "PDF for invoice ".$obj->facnumber." already exists\n";
|
||||
}
|
||||
|
||||
|
||||
// Add file into files array
|
||||
$files[] = $filename;
|
||||
}
|
||||
|
||||
|
||||
if ($result <= 0)
|
||||
{
|
||||
$error++;
|
||||
if ($usestdout) print "Error: Failed to build PDF for invoice ".$fac->ref."\n";
|
||||
else dol_syslog("Failed to build PDF for invoice ".$fac->ref, LOG_ERR);
|
||||
if ($usestdout) print "Error: Failed to build PDF for invoice ".($fac->ref?$fac->ref:' id '.$obj->rowid)."\n";
|
||||
else dol_syslog("Failed to build PDF for invoice ".($fac->ref?$fac->ref:' id '.$obj->rowid), LOG_ERR);
|
||||
}
|
||||
|
||||
|
||||
$cpt++;
|
||||
}
|
||||
|
||||
|
||||
// Define format of output PDF
|
||||
|
||||
// Define format of output PDF
|
||||
$formatarray=pdf_getFormat();
|
||||
$page_largeur = $formatarray['width'];
|
||||
$page_hauteur = $formatarray['height'];
|
||||
$format = array($page_largeur,$page_hauteur);
|
||||
|
||||
|
||||
if ($usestdout) print "Using output PDF format ".join('x',$format)."\n";
|
||||
else dol_syslog("Using output PDF format ".join('x',$format), LOG_ERR);
|
||||
|
||||
|
||||
|
||||
|
||||
// Now, build a merged files with all files in $files array
|
||||
//---------------------------------------------------------
|
||||
|
||||
|
||||
// Create empty PDF
|
||||
$pdf=pdf_getInstance($format);
|
||||
if (class_exists('TCPDF'))
|
||||
@ -193,12 +193,12 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte
|
||||
$pdf->setPrintHeader(false);
|
||||
$pdf->setPrintFooter(false);
|
||||
}
|
||||
$pdf->SetFont(pdf_getPDFFont($outputlangs));
|
||||
|
||||
$pdf->SetFont(pdf_getPDFFont($langs));
|
||||
|
||||
if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);
|
||||
//$pdf->SetCompression(false);
|
||||
|
||||
|
||||
|
||||
|
||||
//$pdf->Open();
|
||||
//$pdf->AddPage();
|
||||
//$title=$langs->trans("BillsCustomersUnpaid");
|
||||
@ -224,21 +224,26 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte
|
||||
|
||||
// Create output dir if not exists
|
||||
dol_mkdir($diroutputpdf);
|
||||
|
||||
|
||||
// Save merged file
|
||||
$filename='mergedpdf';
|
||||
|
||||
|
||||
if (! empty($option)) $filename.='_'.$option;
|
||||
|
||||
if ($pagecount)
|
||||
$file=$diroutputpdf.'/'.$filename.'.pdf';
|
||||
|
||||
if (! $error && $pagecount)
|
||||
{
|
||||
$file=$diroutputpdf.'/'.$filename.'.pdf';
|
||||
$pdf->Output($file,'F');
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
}
|
||||
|
||||
if ($usestdout) print "Merged PDF has been built in ".$file."\n";
|
||||
|
||||
if ($usestdout)
|
||||
{
|
||||
if (! $error) print "Merged PDF has been built in ".$file."\n";
|
||||
else print "Can't build PDF ".$file."\n";
|
||||
}
|
||||
|
||||
$result = 1;
|
||||
}
|
||||
else
|
||||
@ -254,7 +259,7 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte
|
||||
dol_syslog("scripts/invoices/rebuild_merge.php: Error");
|
||||
$error++;
|
||||
}
|
||||
|
||||
|
||||
if ($error) return -1;
|
||||
else return $result;
|
||||
}
|
||||
|
||||
@ -63,6 +63,11 @@ function shipping_prepare_head($object)
|
||||
$head[$h][1] = $langs->trans("ContactsAddresses");
|
||||
$head[$h][2] = 'contact';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/expedition/note.php?id=".$object->id;
|
||||
$head[$h][1] = $langs->trans("Notes");
|
||||
$head[$h][2] = 'note';
|
||||
$h++;
|
||||
|
||||
// Show more tabs from modules
|
||||
// Entries must be declared in modules descriptor with line
|
||||
|
||||
@ -1,21 +1,21 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* or see http://www.gnu.org/
|
||||
*/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* or see http://www.gnu.org/
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php
|
||||
@ -86,84 +86,84 @@ class doc_generic_order_odt extends ModelePDFCommandes
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Define array with couple substitution key => substitution value
|
||||
*
|
||||
* @param Object $object Main object to use as data source
|
||||
* @param Translate $outputlangs Lang object to use for output
|
||||
* @return array Array of substitution
|
||||
*/
|
||||
function get_substitutionarray_object($object,$outputlangs)
|
||||
{
|
||||
global $conf;
|
||||
/**
|
||||
* Define array with couple substitution key => substitution value
|
||||
*
|
||||
* @param Object $object Main object to use as data source
|
||||
* @param Translate $outputlangs Lang object to use for output
|
||||
* @return array Array of substitution
|
||||
*/
|
||||
function get_substitutionarray_object($object,$outputlangs)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$resarray=array(
|
||||
'object_id'=>$object->id,
|
||||
'object_ref'=>$object->ref,
|
||||
'object_ref_ext'=>$object->ref_ext,
|
||||
'object_ref_customer'=>$object->ref_client,
|
||||
'object_date'=>dol_print_date($object->date,'day'),
|
||||
'object_date_delivery'=>dol_print_date($object->date_livraison,'dayhour'),
|
||||
'object_date_creation'=>dol_print_date($object->date_creation,'day'),
|
||||
'object_date_modification'=>(! empty($object->date_modification)?dol_print_date($object->date_modification,'day'):''),
|
||||
'object_date_validation'=>(! empty($object->date_validation)?dol_print_date($object->date_validation,'dayhour'):''),
|
||||
'object_date_delivery_planed'=>(! empty($object->date_livraison)?dol_print_date($object->date_livraison,'day'):''),
|
||||
'object_date_close'=>dol_print_date($object->date_cloture,'dayhour'),
|
||||
'object_payment_mode_code'=>$object->mode_reglement_code,
|
||||
'object_payment_mode'=>($outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code)!='PaymentType'.$object->mode_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code):$object->mode_reglement),
|
||||
'object_payment_term_code'=>$object->cond_reglement_code,
|
||||
'object_payment_term'=>($outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code)!='PaymentCondition'.$object->cond_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code):$object->cond_reglement),
|
||||
'object_total_ht'=>price($object->total_ht,0,$outputlangs),
|
||||
'object_total_vat'=>price($object->total_tva,0,$outputlangs),
|
||||
'object_total_ttc'=>price($object->total_ttc,0,$outputlangs),
|
||||
'object_total_discount_ht' => price($object->getTotalDiscount(), 0, $outputlangs),
|
||||
'object_vatrate'=>vatrate($object->tva),
|
||||
'object_note_private'=>$object->note,
|
||||
'object_note'=>$object->note_public,
|
||||
);
|
||||
$resarray=array(
|
||||
'object_id'=>$object->id,
|
||||
'object_ref'=>$object->ref,
|
||||
'object_ref_ext'=>$object->ref_ext,
|
||||
'object_ref_customer'=>$object->ref_client,
|
||||
'object_date'=>dol_print_date($object->date,'day'),
|
||||
'object_date_delivery'=>dol_print_date($object->date_livraison,'dayhour'),
|
||||
'object_date_creation'=>dol_print_date($object->date_creation,'day'),
|
||||
'object_date_modification'=>(! empty($object->date_modification)?dol_print_date($object->date_modification,'day'):''),
|
||||
'object_date_validation'=>(! empty($object->date_validation)?dol_print_date($object->date_validation,'dayhour'):''),
|
||||
'object_date_delivery_planed'=>(! empty($object->date_livraison)?dol_print_date($object->date_livraison,'day'):''),
|
||||
'object_date_close'=>dol_print_date($object->date_cloture,'dayhour'),
|
||||
'object_payment_mode_code'=>$object->mode_reglement_code,
|
||||
'object_payment_mode'=>($outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code)!='PaymentType'.$object->mode_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code):$object->mode_reglement),
|
||||
'object_payment_term_code'=>$object->cond_reglement_code,
|
||||
'object_payment_term'=>($outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code)!='PaymentCondition'.$object->cond_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code):$object->cond_reglement),
|
||||
'object_total_ht'=>price($object->total_ht,0,$outputlangs),
|
||||
'object_total_vat'=>price($object->total_tva,0,$outputlangs),
|
||||
'object_total_ttc'=>price($object->total_ttc,0,$outputlangs),
|
||||
'object_total_discount_ht' => price($object->getTotalDiscount(), 0, $outputlangs),
|
||||
'object_vatrate'=>vatrate($object->tva),
|
||||
'object_note_private'=>$object->note,
|
||||
'object_note'=>$object->note_public,
|
||||
);
|
||||
|
||||
// Add vat by rates
|
||||
foreach ($object->lines as $line)
|
||||
{
|
||||
if (empty($resarray['object_total_vat_'.$line->tva_tx])) $resarray['object_total_vat_'.$line->tva_tx]=0;
|
||||
$resarray['object_total_vat_'.$line->tva_tx]+=$line->total_tva;
|
||||
}
|
||||
// Add vat by rates
|
||||
foreach ($object->lines as $line)
|
||||
{
|
||||
if (empty($resarray['object_total_vat_'.$line->tva_tx])) $resarray['object_total_vat_'.$line->tva_tx]=0;
|
||||
$resarray['object_total_vat_'.$line->tva_tx]+=$line->total_tva;
|
||||
}
|
||||
|
||||
return $resarray;
|
||||
}
|
||||
return $resarray;
|
||||
}
|
||||
|
||||
/**
|
||||
* Define array with couple substitution key => substitution value
|
||||
*
|
||||
* @param array $line Array of lines
|
||||
* @param Translate $outputlangs Lang object to use for output
|
||||
* @return array Return a substitution array
|
||||
*/
|
||||
function get_substitutionarray_lines($line,$outputlangs)
|
||||
{
|
||||
global $conf;
|
||||
/**
|
||||
* Define array with couple substitution key => substitution value
|
||||
*
|
||||
* @param array $line Array of lines
|
||||
* @param Translate $outputlangs Lang object to use for output
|
||||
* @return array Return a substitution array
|
||||
*/
|
||||
function get_substitutionarray_lines($line,$outputlangs)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
return array(
|
||||
'line_fulldesc'=>doc_getlinedesc($line,$outputlangs),
|
||||
'line_product_ref'=>$line->product_ref,
|
||||
'line_product_label'=>$line->product_label,
|
||||
'line_desc'=>$line->desc,
|
||||
'line_vatrate'=>vatrate($line->tva_tx,true,$line->info_bits),
|
||||
'line_up'=>price($line->subprice, 0, $outputlangs),
|
||||
'line_qty'=>$line->qty,
|
||||
'line_discount_percent'=>($line->remise_percent?$line->remise_percent.'%':''),
|
||||
'line_price_ht'=>price($line->total_ht, 0, $outputlangs),
|
||||
'line_price_ttc'=>price($line->total_ttc, 0, $outputlangs),
|
||||
'line_price_vat'=>price($line->total_tva, 0, $outputlangs),
|
||||
'line_date_start'=>$line->date_start,
|
||||
'line_date_end'=>$line->date_end
|
||||
);
|
||||
}
|
||||
return array(
|
||||
'line_fulldesc'=>doc_getlinedesc($line,$outputlangs),
|
||||
'line_product_ref'=>$line->product_ref,
|
||||
'line_product_label'=>$line->product_label,
|
||||
'line_desc'=>$line->desc,
|
||||
'line_vatrate'=>vatrate($line->tva_tx,true,$line->info_bits),
|
||||
'line_up'=>price($line->subprice, 0, $outputlangs),
|
||||
'line_qty'=>$line->qty,
|
||||
'line_discount_percent'=>($line->remise_percent?$line->remise_percent.'%':''),
|
||||
'line_price_ht'=>price($line->total_ht, 0, $outputlangs),
|
||||
'line_price_ttc'=>price($line->total_ttc, 0, $outputlangs),
|
||||
'line_price_vat'=>price($line->total_tva, 0, $outputlangs),
|
||||
'line_date_start'=>$line->date_start,
|
||||
'line_date_end'=>$line->date_end
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return description of a module
|
||||
*
|
||||
* @param Translate $langs Lang object to use for output
|
||||
* @param Translate $langs Lang object to use for output
|
||||
* @return string Description
|
||||
*/
|
||||
function info($langs)
|
||||
@ -191,7 +191,9 @@ class doc_generic_order_odt extends ModelePDFCommandes
|
||||
{
|
||||
$tmpdir=trim($tmpdir);
|
||||
$tmpdir=preg_replace('/DOL_DATA_ROOT/',DOL_DATA_ROOT,$tmpdir);
|
||||
if (! $tmpdir) { unset($listofdir[$key]); continue; }
|
||||
if (! $tmpdir) {
|
||||
unset($listofdir[$key]); continue;
|
||||
}
|
||||
if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0);
|
||||
else
|
||||
{
|
||||
@ -202,19 +204,19 @@ class doc_generic_order_odt extends ModelePDFCommandes
|
||||
$texthelp=$langs->trans("ListOfDirectoriesForModelGenODT");
|
||||
// Add list of substitution keys
|
||||
$texthelp.='<br>'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'<br>';
|
||||
$texthelp.=$langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it
|
||||
$texthelp.=$langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it
|
||||
|
||||
$texte.= $form->textwithpicto($texttitle,$texthelp,1,'help','',1);
|
||||
$texte.= '<table><tr><td>';
|
||||
$texte.= '<textarea class="flat" cols="60" name="value1">';
|
||||
$texte.=$conf->global->COMMANDE_ADDON_PDF_ODT_PATH;
|
||||
$texte.= '</textarea>';
|
||||
$texte.= '</td>';
|
||||
$texte.= '</td>';
|
||||
$texte.= '<td align="center"> ';
|
||||
$texte.= '<input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button">';
|
||||
$texte.= '</td>';
|
||||
$texte.= '<input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button">';
|
||||
$texte.= '</td>';
|
||||
$texte.= '</tr>';
|
||||
$texte.= '</table>';
|
||||
$texte.= '</table>';
|
||||
|
||||
// Scan directories
|
||||
if (count($listofdir)) $texte.=$langs->trans("NumberOfModelFilesFound").': <b>'.count($listoffiles).'</b>';
|
||||
@ -228,7 +230,7 @@ class doc_generic_order_odt extends ModelePDFCommandes
|
||||
$texte.= '</tr>';
|
||||
|
||||
/*$texte.= '<tr>';
|
||||
$texte.= '<td align="center">';
|
||||
$texte.= '<td align="center">';
|
||||
$texte.= '<input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button">';
|
||||
$texte.= '</td>';
|
||||
$texte.= '</tr>';*/
|
||||
@ -245,9 +247,9 @@ class doc_generic_order_odt extends ModelePDFCommandes
|
||||
* @param Commande $object Object source to build document
|
||||
* @param Translate $outputlangs Lang output object
|
||||
* @param string $srctemplatepath Full path of source filename for generator using a template file
|
||||
* @param int $hidedetails Do not show line details
|
||||
* @param int $hidedesc Do not show desc
|
||||
* @param int $hideref Do not show ref
|
||||
* @param int $hidedetails Do not show line details
|
||||
* @param int $hidedesc Do not show desc
|
||||
* @param int $hideref Do not show ref
|
||||
* @return int 1 if OK, <=0 if KO
|
||||
*/
|
||||
function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0)
|
||||
@ -260,14 +262,14 @@ class doc_generic_order_odt extends ModelePDFCommandes
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Add odtgeneration hook
|
||||
if (! is_object($hookmanager))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($this->db);
|
||||
}
|
||||
$hookmanager->initHooks(array('odtgeneration'));
|
||||
global $action;
|
||||
// Add odtgeneration hook
|
||||
if (! is_object($hookmanager))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($this->db);
|
||||
}
|
||||
$hookmanager->initHooks(array('odtgeneration'));
|
||||
global $action;
|
||||
|
||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||
$sav_charset_output=$outputlangs->charset_output;
|
||||
@ -314,7 +316,7 @@ class doc_generic_order_odt extends ModelePDFCommandes
|
||||
$newfiletmp=preg_replace('/\.odt/i','',$newfile);
|
||||
$newfiletmp=preg_replace('/template_/i','',$newfiletmp);
|
||||
$newfiletmp=preg_replace('/modele_/i','',$newfiletmp);
|
||||
$newfiletmp=$objectref.'_'.$newfiletmp;
|
||||
$newfiletmp=$objectref.'_'.$newfiletmp;
|
||||
//$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt';
|
||||
$file=$dir.'/'.$newfiletmp.'.odt';
|
||||
//print "newdir=".$dir;
|
||||
@ -325,64 +327,64 @@ class doc_generic_order_odt extends ModelePDFCommandes
|
||||
dol_mkdir($conf->commande->dir_temp);
|
||||
|
||||
|
||||
// If BILLING contact defined on invoice, we use it
|
||||
$usecontact=false;
|
||||
$arrayidcontact=$object->getIdContact('external','BILLING');
|
||||
if (count($arrayidcontact) > 0)
|
||||
{
|
||||
$usecontact=true;
|
||||
$result=$object->fetch_contact($arrayidcontact[0]);
|
||||
}
|
||||
// If BILLING contact defined on invoice, we use it
|
||||
$usecontact=false;
|
||||
$arrayidcontact=$object->getIdContact('external','BILLING');
|
||||
if (count($arrayidcontact) > 0)
|
||||
{
|
||||
$usecontact=true;
|
||||
$result=$object->fetch_contact($arrayidcontact[0]);
|
||||
}
|
||||
|
||||
// Recipient name
|
||||
if (! empty($usecontact))
|
||||
{
|
||||
// On peut utiliser le nom de la societe du contact
|
||||
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact;
|
||||
else $socobject = $object->client;
|
||||
}
|
||||
else
|
||||
{
|
||||
$socobject=$object->client;
|
||||
}
|
||||
// Recipient name
|
||||
if (! empty($usecontact))
|
||||
{
|
||||
// On peut utiliser le nom de la societe du contact
|
||||
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact;
|
||||
else $socobject = $object->client;
|
||||
}
|
||||
else
|
||||
{
|
||||
$socobject=$object->client;
|
||||
}
|
||||
|
||||
// Make substitution
|
||||
$substitutionarray=array(
|
||||
'__FROM_NAME__' => $this->emetteur->nom,
|
||||
'__FROM_EMAIL__' => $this->emetteur->email,
|
||||
'__TOTAL_TTC__' => $object->total_ttc,
|
||||
'__TOTAL_HT__' => $object->total_ht,
|
||||
'__TOTAL_VAT__' => $object->total_vat
|
||||
);
|
||||
complete_substitutions_array($substitutionarray, $langs, $object);
|
||||
// Call the ODTSubstitution hook
|
||||
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$substitutionarray);
|
||||
$reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
// Make substitution
|
||||
$substitutionarray=array(
|
||||
'__FROM_NAME__' => $this->emetteur->nom,
|
||||
'__FROM_EMAIL__' => $this->emetteur->email,
|
||||
'__TOTAL_TTC__' => $object->total_ttc,
|
||||
'__TOTAL_HT__' => $object->total_ht,
|
||||
'__TOTAL_VAT__' => $object->total_vat
|
||||
);
|
||||
complete_substitutions_array($substitutionarray, $langs, $object);
|
||||
// Call the ODTSubstitution hook
|
||||
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$substitutionarray);
|
||||
$reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
// Line of free text
|
||||
$newfreetext='';
|
||||
$paramfreetext='COMMANDE_FREE_TEXT';
|
||||
if (! empty($conf->global->$paramfreetext))
|
||||
{
|
||||
$newfreetext=make_substitutions($conf->global->$paramfreetext,$substitutionarray);
|
||||
}
|
||||
if (! empty($conf->global->$paramfreetext))
|
||||
{
|
||||
$newfreetext=make_substitutions($conf->global->$paramfreetext,$substitutionarray);
|
||||
}
|
||||
|
||||
// Open and load template
|
||||
// Open and load template
|
||||
require_once ODTPHP_PATH.'odf.php';
|
||||
$odfHandler = new odf(
|
||||
$srctemplatepath,
|
||||
array(
|
||||
'PATH_TO_TMP' => $conf->commande->dir_temp,
|
||||
'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy.
|
||||
'DELIMITER_LEFT' => '{',
|
||||
'DELIMITER_RIGHT' => '}'
|
||||
$srctemplatepath,
|
||||
array(
|
||||
'PATH_TO_TMP' => $conf->commande->dir_temp,
|
||||
'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy.
|
||||
'DELIMITER_LEFT' => '{',
|
||||
'DELIMITER_RIGHT' => '}'
|
||||
)
|
||||
);
|
||||
// After construction $odfHandler->contentXml contains content and
|
||||
// [!-- BEGIN row.lines --]*[!-- END row.lines --] has been replaced by
|
||||
// [!-- BEGIN lines --]*[!-- END lines --]
|
||||
//print html_entity_decode($odfHandler->__toString());
|
||||
//print exit;
|
||||
//print html_entity_decode($odfHandler->__toString());
|
||||
//print exit;
|
||||
|
||||
|
||||
// Make substitutions into odt of freetext
|
||||
@ -393,29 +395,29 @@ class doc_generic_order_odt extends ModelePDFCommandes
|
||||
{
|
||||
}
|
||||
|
||||
// Make substitutions into odt of user info
|
||||
// Make substitutions into odt of user info
|
||||
$tmparray=$this->get_substitutionarray_user($user,$outputlangs);
|
||||
//var_dump($tmparray); exit;
|
||||
foreach($tmparray as $key=>$value)
|
||||
{
|
||||
try {
|
||||
if (preg_match('/logo$/',$key)) // Image
|
||||
{
|
||||
//var_dump($value);exit;
|
||||
if (file_exists($value)) $odfHandler->setImage($key, $value);
|
||||
else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
|
||||
}
|
||||
else // Text
|
||||
{
|
||||
$odfHandler->setVars($key, $value, true, 'UTF-8');
|
||||
}
|
||||
}
|
||||
catch(OdfException $e)
|
||||
{
|
||||
}
|
||||
}
|
||||
// Make substitutions into odt of mysoc
|
||||
$tmparray=$this->get_substitutionarray_mysoc($mysoc,$outputlangs);
|
||||
//var_dump($tmparray); exit;
|
||||
foreach($tmparray as $key=>$value)
|
||||
{
|
||||
try {
|
||||
if (preg_match('/logo$/',$key)) // Image
|
||||
{
|
||||
//var_dump($value);exit;
|
||||
if (file_exists($value)) $odfHandler->setImage($key, $value);
|
||||
else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
|
||||
}
|
||||
else // Text
|
||||
{
|
||||
$odfHandler->setVars($key, $value, true, 'UTF-8');
|
||||
}
|
||||
}
|
||||
catch(OdfException $e)
|
||||
{
|
||||
}
|
||||
}
|
||||
// Make substitutions into odt of mysoc
|
||||
$tmparray=$this->get_substitutionarray_mysoc($mysoc,$outputlangs);
|
||||
//var_dump($tmparray); exit;
|
||||
foreach($tmparray as $key=>$value)
|
||||
{
|
||||
@ -435,7 +437,7 @@ class doc_generic_order_odt extends ModelePDFCommandes
|
||||
{
|
||||
}
|
||||
}
|
||||
// Make substitutions into odt of thirdparty
|
||||
// Make substitutions into odt of thirdparty
|
||||
$tmparray=$this->get_substitutionarray_thirdparty($socobject,$outputlangs);
|
||||
foreach($tmparray as $key=>$value)
|
||||
{
|
||||
@ -455,73 +457,73 @@ class doc_generic_order_odt extends ModelePDFCommandes
|
||||
}
|
||||
}
|
||||
// Replace tags of object + external modules
|
||||
$tmparray=$this->get_substitutionarray_object($object,$outputlangs);
|
||||
complete_substitutions_array($tmparray, $outputlangs, $object);
|
||||
// Call the ODTSubstitution hook
|
||||
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
|
||||
$reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
foreach($tmparray as $key=>$value)
|
||||
{
|
||||
try {
|
||||
if (preg_match('/logo$/',$key)) // Image
|
||||
{
|
||||
if (file_exists($value)) $odfHandler->setImage($key, $value);
|
||||
else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
|
||||
}
|
||||
else // Text
|
||||
{
|
||||
$odfHandler->setVars($key, $value, true, 'UTF-8');
|
||||
}
|
||||
}
|
||||
catch(OdfException $e)
|
||||
{
|
||||
}
|
||||
}
|
||||
$tmparray=$this->get_substitutionarray_object($object,$outputlangs);
|
||||
complete_substitutions_array($tmparray, $outputlangs, $object);
|
||||
// Call the ODTSubstitution hook
|
||||
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
|
||||
$reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
foreach($tmparray as $key=>$value)
|
||||
{
|
||||
try {
|
||||
if (preg_match('/logo$/',$key)) // Image
|
||||
{
|
||||
if (file_exists($value)) $odfHandler->setImage($key, $value);
|
||||
else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
|
||||
}
|
||||
else // Text
|
||||
{
|
||||
$odfHandler->setVars($key, $value, true, 'UTF-8');
|
||||
}
|
||||
}
|
||||
catch(OdfException $e)
|
||||
{
|
||||
}
|
||||
}
|
||||
// Replace tags of lines
|
||||
try
|
||||
{
|
||||
$listlines = $odfHandler->setSegment('lines');
|
||||
foreach ($object->lines as $line)
|
||||
{
|
||||
$tmparray=$this->get_substitutionarray_lines($line,$outputlangs);
|
||||
complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines");
|
||||
// Call the ODTSubstitutionLine hook
|
||||
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray,'line'=>$line);
|
||||
$reshook=$hookmanager->executeHooks('ODTSubstitutionLine',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
foreach($tmparray as $key => $val)
|
||||
{
|
||||
try
|
||||
{
|
||||
$listlines->setVars($key, $val, true, 'UTF-8');
|
||||
}
|
||||
catch(OdfException $e)
|
||||
{
|
||||
}
|
||||
catch(SegmentException $e)
|
||||
{
|
||||
}
|
||||
}
|
||||
$listlines->merge();
|
||||
}
|
||||
$odfHandler->mergeSegment($listlines);
|
||||
}
|
||||
catch(OdfException $e)
|
||||
{
|
||||
$this->error=$e->getMessage();
|
||||
dol_syslog($this->error, LOG_WARNING);
|
||||
return -1;
|
||||
}
|
||||
try
|
||||
{
|
||||
$listlines = $odfHandler->setSegment('lines');
|
||||
foreach ($object->lines as $line)
|
||||
{
|
||||
$tmparray=$this->get_substitutionarray_lines($line,$outputlangs);
|
||||
complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines");
|
||||
// Call the ODTSubstitutionLine hook
|
||||
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray,'line'=>$line);
|
||||
$reshook=$hookmanager->executeHooks('ODTSubstitutionLine',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
foreach($tmparray as $key => $val)
|
||||
{
|
||||
try
|
||||
{
|
||||
$listlines->setVars($key, $val, true, 'UTF-8');
|
||||
}
|
||||
catch(OdfException $e)
|
||||
{
|
||||
}
|
||||
catch(SegmentException $e)
|
||||
{
|
||||
}
|
||||
}
|
||||
$listlines->merge();
|
||||
}
|
||||
$odfHandler->mergeSegment($listlines);
|
||||
}
|
||||
catch(OdfException $e)
|
||||
{
|
||||
$this->error=$e->getMessage();
|
||||
dol_syslog($this->error, LOG_WARNING);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Call the beforeODTSave hook
|
||||
// Call the beforeODTSave hook
|
||||
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
|
||||
$reshook=$hookmanager->executeHooks('beforeODTSave',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
// Write new file
|
||||
// Write new file
|
||||
//$result=$odfHandler->exportAsAttachedFile('toto');
|
||||
$odfHandler->saveToDisk($file);
|
||||
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
$odfHandler=null; // Destroy object
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -191,6 +192,27 @@ class pdf_expedition_merou extends ModelePdfExpedition
|
||||
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10);
|
||||
$tab_height = $this->page_hauteur - $tab_top - $heightforfooter;
|
||||
$tab_height_newpage = $this->page_hauteur - $tab_top_newpage - $heightforfooter;
|
||||
|
||||
// Affiche notes
|
||||
if (! empty($object->note_public))
|
||||
{
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
$pdf->writeHTMLCell(190, 3, $this->marge_gauche, $tab_top, dol_htmlentitiesbr($object->note_public), 0, 1);
|
||||
$nexY = $pdf->GetY();
|
||||
$height_note=$nexY-$tab_top;
|
||||
|
||||
// Rect prend une longueur en 3eme param
|
||||
$pdf->SetDrawColor(192,192,192);
|
||||
$pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1);
|
||||
|
||||
$tab_height = $tab_height - $height_note;
|
||||
$tab_top = $nexY+6;
|
||||
}
|
||||
else
|
||||
{
|
||||
$height_note=0;
|
||||
}
|
||||
|
||||
|
||||
$pdf->SetFillColor(240,240,240);
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
|
||||
@ -2,20 +2,20 @@
|
||||
/* Copyright (C) 2010-2012 Laurent Destailleur <ely@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* or see http://www.gnu.org/
|
||||
*/
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* or see http://www.gnu.org/
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php
|
||||
@ -86,55 +86,55 @@ class doc_generic_invoice_odt extends ModelePDFFactures
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Define array with couple substitution key => substitution value
|
||||
*
|
||||
* @param Object $object Main object to use as data source
|
||||
* @param Translate $outputlangs Lang object to use for output
|
||||
* @return array Array of substitution
|
||||
*/
|
||||
function get_substitutionarray_object($object,$outputlangs)
|
||||
{
|
||||
global $conf;
|
||||
/**
|
||||
* Define array with couple substitution key => substitution value
|
||||
*
|
||||
* @param Object $object Main object to use as data source
|
||||
* @param Translate $outputlangs Lang object to use for output
|
||||
* @return array Array of substitution
|
||||
*/
|
||||
function get_substitutionarray_object($object,$outputlangs)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$invoice_source=new Facture($this->db);
|
||||
$invoice_source=new Facture($this->db);
|
||||
if ($object->fk_facture_source > 0)
|
||||
{
|
||||
$invoice_source->fetch($object->fk_facture_source);
|
||||
$invoice_source->fetch($object->fk_facture_source);
|
||||
}
|
||||
$sumpayed = $object->getSommePaiement();
|
||||
$alreadypayed=price($sumpayed,0,$outputlangs);
|
||||
|
||||
$resarray=array(
|
||||
'object_id'=>$object->id,
|
||||
'object_ref'=>$object->ref,
|
||||
'object_ref_ext'=>$object->ref_ext,
|
||||
'object_ref_customer'=>$object->ref_client,
|
||||
'object_ref_supplier'=>(! empty($object->ref_fournisseur)?$object->ref_fournisseur:''),
|
||||
'object_source_invoice_ref'=>$invoice_source->ref,
|
||||
'object_date'=>dol_print_date($object->date,'day'),
|
||||
'object_date_limit'=>dol_print_date($object->date_lim_reglement,'day'),
|
||||
'object_date_creation'=>dol_print_date($object->date_creation,'day'),
|
||||
'object_date_modification'=>(! empty($object->date_modification)?dol_print_date($object->date_modification,'day'):''),
|
||||
'object_date_validation'=>(! empty($object->date_validation)?dol_print_date($object->date_validation,'dayhour'):''),
|
||||
'object_date_delivery_planed'=>(! empty($object->date_livraison)?dol_print_date($object->date_livraison,'day'):''),
|
||||
'object_payment_mode_code'=>$object->mode_reglement_code,
|
||||
'object_payment_mode'=>($outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code)!='PaymentType'.$object->mode_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code):$object->mode_reglement),
|
||||
'object_payment_term_code'=>$object->cond_reglement_code,
|
||||
'object_payment_term'=>($outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code)!='PaymentCondition'.$object->cond_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code):$object->cond_reglement),
|
||||
'object_total_ht'=>price2num($object->total_ht),
|
||||
'object_total_vat'=>price2num($object->total_tva),
|
||||
'object_total_ttc'=>price2num($object->total_ttc),
|
||||
'object_total_discount_ht' => price2num($object->getTotalDiscount(), 0, $outputlangs),
|
||||
'object_vatrate'=>(isset($object->tva)?vatrate($object->tva):''),
|
||||
'object_note_private'=>$object->note,
|
||||
'object_note'=>$object->note_public,
|
||||
// Payments
|
||||
'object_already_payed'=>$alreadypayed,
|
||||
'object_remain_to_pay'=>price2num($object->total_ttc - $sumpayed)
|
||||
);
|
||||
$resarray=array(
|
||||
'object_id'=>$object->id,
|
||||
'object_ref'=>$object->ref,
|
||||
'object_ref_ext'=>$object->ref_ext,
|
||||
'object_ref_customer'=>$object->ref_client,
|
||||
'object_ref_supplier'=>(! empty($object->ref_fournisseur)?$object->ref_fournisseur:''),
|
||||
'object_source_invoice_ref'=>$invoice_source->ref,
|
||||
'object_date'=>dol_print_date($object->date,'day'),
|
||||
'object_date_limit'=>dol_print_date($object->date_lim_reglement,'day'),
|
||||
'object_date_creation'=>dol_print_date($object->date_creation,'day'),
|
||||
'object_date_modification'=>(! empty($object->date_modification)?dol_print_date($object->date_modification,'day'):''),
|
||||
'object_date_validation'=>(! empty($object->date_validation)?dol_print_date($object->date_validation,'dayhour'):''),
|
||||
'object_date_delivery_planed'=>(! empty($object->date_livraison)?dol_print_date($object->date_livraison,'day'):''),
|
||||
'object_payment_mode_code'=>$object->mode_reglement_code,
|
||||
'object_payment_mode'=>($outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code)!='PaymentType'.$object->mode_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code):$object->mode_reglement),
|
||||
'object_payment_term_code'=>$object->cond_reglement_code,
|
||||
'object_payment_term'=>($outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code)!='PaymentCondition'.$object->cond_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code):$object->cond_reglement),
|
||||
'object_total_ht'=>price2num($object->total_ht),
|
||||
'object_total_vat'=>price2num($object->total_tva),
|
||||
'object_total_ttc'=>price2num($object->total_ttc),
|
||||
'object_total_discount_ht' => price2num($object->getTotalDiscount(), 0, $outputlangs),
|
||||
'object_vatrate'=>(isset($object->tva)?vatrate($object->tva):''),
|
||||
'object_note_private'=>$object->note,
|
||||
'object_note'=>$object->note_public,
|
||||
// Payments
|
||||
'object_already_payed'=>$alreadypayed,
|
||||
'object_remain_to_pay'=>price2num($object->total_ttc - $sumpayed)
|
||||
);
|
||||
|
||||
// Add vat by rates
|
||||
// Add vat by rates
|
||||
foreach ($object->lines as $line)
|
||||
{
|
||||
if (empty($resarray['object_total_vat_'.$line->tva_tx])) $resarray['object_total_vat_'.$line->tva_tx]=0;
|
||||
@ -152,41 +152,41 @@ class doc_generic_invoice_odt extends ModelePDFFactures
|
||||
|
||||
$resarray = $this->fill_substitutionarray_with_extrafields($object,$resarray,$extrafields,$array_key='object',$outputlangs);
|
||||
}
|
||||
return $resarray;
|
||||
}
|
||||
return $resarray;
|
||||
}
|
||||
|
||||
/**
|
||||
* Define array with couple substitution key => substitution value
|
||||
*
|
||||
* @param array $line Array of lines
|
||||
* @param Translate $outputlangs Lang object to use for output
|
||||
* @return array Return substitution array
|
||||
*/
|
||||
function get_substitutionarray_lines($line,$outputlangs)
|
||||
{
|
||||
global $conf;
|
||||
/**
|
||||
* Define array with couple substitution key => substitution value
|
||||
*
|
||||
* @param array $line Array of lines
|
||||
* @param Translate $outputlangs Lang object to use for output
|
||||
* @return array Return substitution array
|
||||
*/
|
||||
function get_substitutionarray_lines($line,$outputlangs)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
return array(
|
||||
'line_fulldesc'=>doc_getlinedesc($line,$outputlangs),
|
||||
'line_product_ref'=>$line->product_ref,
|
||||
'line_product_label'=>$line->product_label,
|
||||
'line_desc'=>$line->desc,
|
||||
'line_vatrate'=>vatrate($line->tva_tx,true,$line->info_bits),
|
||||
'line_up'=>price($line->subprice, 0, $outputlangs),
|
||||
'line_qty'=>$line->qty,
|
||||
'line_discount_percent'=>($line->remise_percent?$line->remise_percent.'%':''),
|
||||
'line_price_ht'=>price2num($line->total_ht),
|
||||
'line_price_ttc'=>price2num($line->total_ttc),
|
||||
'line_price_vat'=>price2num($line->total_tva),
|
||||
'line_date_start'=>dol_print_date($line->date_start, 'day', false, $outputlangs),
|
||||
'line_date_end'=>dol_print_date($line->date_end, 'day', false, $outputlangs),
|
||||
);
|
||||
}
|
||||
return array(
|
||||
'line_fulldesc'=>doc_getlinedesc($line,$outputlangs),
|
||||
'line_product_ref'=>$line->product_ref,
|
||||
'line_product_label'=>$line->product_label,
|
||||
'line_desc'=>$line->desc,
|
||||
'line_vatrate'=>vatrate($line->tva_tx,true,$line->info_bits),
|
||||
'line_up'=>price($line->subprice, 0, $outputlangs),
|
||||
'line_qty'=>$line->qty,
|
||||
'line_discount_percent'=>($line->remise_percent?$line->remise_percent.'%':''),
|
||||
'line_price_ht'=>price2num($line->total_ht),
|
||||
'line_price_ttc'=>price2num($line->total_ttc),
|
||||
'line_price_vat'=>price2num($line->total_tva),
|
||||
'line_date_start'=>dol_print_date($line->date_start, 'day', false, $outputlangs),
|
||||
'line_date_end'=>dol_print_date($line->date_end, 'day', false, $outputlangs),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return description of a module
|
||||
*
|
||||
* @param Translate $langs Lang object to use for output
|
||||
* @param Translate $langs Lang object to use for output
|
||||
* @return string Description
|
||||
*/
|
||||
function info($langs)
|
||||
@ -214,7 +214,9 @@ class doc_generic_invoice_odt extends ModelePDFFactures
|
||||
{
|
||||
$tmpdir=trim($tmpdir);
|
||||
$tmpdir=preg_replace('/DOL_DATA_ROOT/',DOL_DATA_ROOT,$tmpdir);
|
||||
if (! $tmpdir) { unset($listofdir[$key]); continue; }
|
||||
if (! $tmpdir) {
|
||||
unset($listofdir[$key]); continue;
|
||||
}
|
||||
if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0);
|
||||
else
|
||||
{
|
||||
@ -225,19 +227,19 @@ class doc_generic_invoice_odt extends ModelePDFFactures
|
||||
$texthelp=$langs->trans("ListOfDirectoriesForModelGenODT");
|
||||
// Add list of substitution keys
|
||||
$texthelp.='<br>'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'<br>';
|
||||
$texthelp.=$langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it
|
||||
$texthelp.=$langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it
|
||||
|
||||
$texte.= $form->textwithpicto($texttitle,$texthelp,1,'help','',1);
|
||||
$texte.= '<table><tr><td>';
|
||||
$texte.= '<textarea class="flat" cols="60" name="value1">';
|
||||
$texte.=$conf->global->FACTURE_ADDON_PDF_ODT_PATH;
|
||||
$texte.= '</textarea>';
|
||||
$texte.= '</td>';
|
||||
$texte.= '</td>';
|
||||
$texte.= '<td align="center"> ';
|
||||
$texte.= '<input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button">';
|
||||
$texte.= '</td>';
|
||||
$texte.= '<input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button">';
|
||||
$texte.= '</td>';
|
||||
$texte.= '</tr>';
|
||||
$texte.= '</table>';
|
||||
$texte.= '</table>';
|
||||
|
||||
// Scan directories
|
||||
if (count($listofdir)) $texte.=$langs->trans("NumberOfModelFilesFound").': <b>'.count($listoffiles).'</b>';
|
||||
@ -251,7 +253,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures
|
||||
$texte.= '</tr>';
|
||||
|
||||
/*$texte.= '<tr>';
|
||||
$texte.= '<td align="center">';
|
||||
$texte.= '<td align="center">';
|
||||
$texte.= '<input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button">';
|
||||
$texte.= '</td>';
|
||||
$texte.= '</tr>';*/
|
||||
@ -268,9 +270,9 @@ class doc_generic_invoice_odt extends ModelePDFFactures
|
||||
* @param Facture $object Object source to build document
|
||||
* @param Translate $outputlangs Lang output object
|
||||
* @param string $srctemplatepath Full path of source filename for generator using a template file
|
||||
* @param int $hidedetails Do not show line details
|
||||
* @param int $hidedesc Do not show desc
|
||||
* @param int $hideref Do not show ref
|
||||
* @param int $hidedetails Do not show line details
|
||||
* @param int $hidedesc Do not show desc
|
||||
* @param int $hideref Do not show ref
|
||||
* @return int 1 if OK, <=0 if KO
|
||||
*/
|
||||
function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0)
|
||||
@ -283,14 +285,14 @@ class doc_generic_invoice_odt extends ModelePDFFactures
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Add odtgeneration hook
|
||||
if (! is_object($hookmanager))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($this->db);
|
||||
}
|
||||
$hookmanager->initHooks(array('odtgeneration'));
|
||||
global $action;
|
||||
// Add odtgeneration hook
|
||||
if (! is_object($hookmanager))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($this->db);
|
||||
}
|
||||
$hookmanager->initHooks(array('odtgeneration'));
|
||||
global $action;
|
||||
|
||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||
$sav_charset_output=$outputlangs->charset_output;
|
||||
@ -337,7 +339,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures
|
||||
$newfiletmp=preg_replace('/\.odt/i','',$newfile);
|
||||
$newfiletmp=preg_replace('/template_/i','',$newfiletmp);
|
||||
$newfiletmp=preg_replace('/modele_/i','',$newfiletmp);
|
||||
$newfiletmp=$objectref.'_'.$newfiletmp;
|
||||
$newfiletmp=$objectref.'_'.$newfiletmp;
|
||||
//$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt';
|
||||
$file=$dir.'/'.$newfiletmp.'.odt';
|
||||
//print "newdir=".$dir;
|
||||
@ -348,70 +350,70 @@ class doc_generic_invoice_odt extends ModelePDFFactures
|
||||
dol_mkdir($conf->facture->dir_temp);
|
||||
|
||||
|
||||
// If BILLING contact defined on invoice, we use it
|
||||
$usecontact=false;
|
||||
$arrayidcontact=$object->getIdContact('external','BILLING');
|
||||
if (count($arrayidcontact) > 0)
|
||||
{
|
||||
$usecontact=true;
|
||||
$result=$object->fetch_contact($arrayidcontact[0]);
|
||||
}
|
||||
// If BILLING contact defined on invoice, we use it
|
||||
$usecontact=false;
|
||||
$arrayidcontact=$object->getIdContact('external','BILLING');
|
||||
if (count($arrayidcontact) > 0)
|
||||
{
|
||||
$usecontact=true;
|
||||
$result=$object->fetch_contact($arrayidcontact[0]);
|
||||
}
|
||||
|
||||
// Recipient name
|
||||
if (! empty($usecontact))
|
||||
{
|
||||
// On peut utiliser le nom de la societe du contact
|
||||
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact;
|
||||
else $socobject = $object->client;
|
||||
}
|
||||
else
|
||||
{
|
||||
$socobject=$object->client;
|
||||
}
|
||||
// Recipient name
|
||||
if (! empty($usecontact))
|
||||
{
|
||||
// On peut utiliser le nom de la societe du contact
|
||||
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact;
|
||||
else $socobject = $object->client;
|
||||
}
|
||||
else
|
||||
{
|
||||
$socobject=$object->client;
|
||||
}
|
||||
|
||||
// Fetch info for linked propal
|
||||
$linked_propal = $object->fetchObjectLinked('','','','');
|
||||
//print_r($object->linkedObjects['propal']); exit;
|
||||
// Fetch info for linked propal
|
||||
$linked_propal = $object->fetchObjectLinked('','','','');
|
||||
//print_r($object->linkedObjects['propal']); exit;
|
||||
|
||||
$propal_object = $object->linkedObjects['propal'][0];
|
||||
$propal_object = $object->linkedObjects['propal'][0];
|
||||
|
||||
// Make substitution
|
||||
$substitutionarray=array(
|
||||
'__FROM_NAME__' => $this->emetteur->nom,
|
||||
'__FROM_EMAIL__' => $this->emetteur->email,
|
||||
'__TOTAL_TTC__' => $object->total_ttc,
|
||||
'__TOTAL_HT__' => $object->total_ht,
|
||||
'__TOTAL_VAT__' => $object->total_tva
|
||||
);
|
||||
complete_substitutions_array($substitutionarray, $langs, $object);
|
||||
// Call the ODTSubstitution hook
|
||||
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$substitutionarray);
|
||||
$reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
// Make substitution
|
||||
$substitutionarray=array(
|
||||
'__FROM_NAME__' => $this->emetteur->nom,
|
||||
'__FROM_EMAIL__' => $this->emetteur->email,
|
||||
'__TOTAL_TTC__' => $object->total_ttc,
|
||||
'__TOTAL_HT__' => $object->total_ht,
|
||||
'__TOTAL_VAT__' => $object->total_tva
|
||||
);
|
||||
complete_substitutions_array($substitutionarray, $langs, $object);
|
||||
// Call the ODTSubstitution hook
|
||||
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$substitutionarray);
|
||||
$reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
// Line of free text
|
||||
$newfreetext='';
|
||||
$paramfreetext='FACTURE_FREE_TEXT';
|
||||
if (! empty($conf->global->$paramfreetext))
|
||||
{
|
||||
$newfreetext=make_substitutions($conf->global->$paramfreetext,$substitutionarray);
|
||||
}
|
||||
if (! empty($conf->global->$paramfreetext))
|
||||
{
|
||||
$newfreetext=make_substitutions($conf->global->$paramfreetext,$substitutionarray);
|
||||
}
|
||||
|
||||
// Open and load template
|
||||
// Open and load template
|
||||
require_once ODTPHP_PATH.'odf.php';
|
||||
$odfHandler = new odf(
|
||||
$srctemplatepath,
|
||||
array(
|
||||
'PATH_TO_TMP' => $conf->facture->dir_temp,
|
||||
'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy.
|
||||
'DELIMITER_LEFT' => '{',
|
||||
'DELIMITER_RIGHT' => '}'
|
||||
$srctemplatepath,
|
||||
array(
|
||||
'PATH_TO_TMP' => $conf->facture->dir_temp,
|
||||
'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy.
|
||||
'DELIMITER_LEFT' => '{',
|
||||
'DELIMITER_RIGHT' => '}'
|
||||
)
|
||||
);
|
||||
// After construction $odfHandler->contentXml contains content and
|
||||
// [!-- BEGIN row.lines --]*[!-- END row.lines --] has been replaced by
|
||||
// [!-- BEGIN lines --]*[!-- END lines --]
|
||||
//print html_entity_decode($odfHandler->__toString());
|
||||
//print exit;
|
||||
//print html_entity_decode($odfHandler->__toString());
|
||||
//print exit;
|
||||
|
||||
|
||||
// Make substitutions into odt of freetext
|
||||
@ -422,7 +424,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures
|
||||
{
|
||||
}
|
||||
|
||||
// Make substitutions into odt of user info
|
||||
// Make substitutions into odt of user info
|
||||
$array_user=$this->get_substitutionarray_user($user,$outputlangs);
|
||||
$array_soc=$this->get_substitutionarray_mysoc($mysoc,$outputlangs);
|
||||
$array_thirdparty=$this->get_substitutionarray_thirdparty($socobject,$outputlangs);
|
||||
@ -432,74 +434,74 @@ class doc_generic_invoice_odt extends ModelePDFFactures
|
||||
|
||||
$tmparray = array_merge($array_user,$array_soc,$array_thirdparty,$array_objet,$array_propal);
|
||||
complete_substitutions_array($tmparray, $outputlangs, $object);
|
||||
// Call the ODTSubstitution hook
|
||||
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
|
||||
$reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
// Call the ODTSubstitution hook
|
||||
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
|
||||
$reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
//var_dump($tmparray); exit;
|
||||
foreach($tmparray as $key=>$value)
|
||||
{
|
||||
try {
|
||||
if (preg_match('/logo$/',$key)) // Image
|
||||
{
|
||||
//var_dump($value);exit;
|
||||
if (file_exists($value)) $odfHandler->setImage($key, $value);
|
||||
else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
|
||||
}
|
||||
else // Text
|
||||
{
|
||||
$odfHandler->setVars($key, $value, true, 'UTF-8');
|
||||
}
|
||||
}
|
||||
catch(OdfException $e)
|
||||
{
|
||||
}
|
||||
}
|
||||
//var_dump($tmparray); exit;
|
||||
foreach($tmparray as $key=>$value)
|
||||
{
|
||||
try {
|
||||
if (preg_match('/logo$/',$key)) // Image
|
||||
{
|
||||
//var_dump($value);exit;
|
||||
if (file_exists($value)) $odfHandler->setImage($key, $value);
|
||||
else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
|
||||
}
|
||||
else // Text
|
||||
{
|
||||
$odfHandler->setVars($key, $value, true, 'UTF-8');
|
||||
}
|
||||
}
|
||||
catch(OdfException $e)
|
||||
{
|
||||
}
|
||||
}
|
||||
// Replace tags of lines
|
||||
try
|
||||
{
|
||||
$listlines = $odfHandler->setSegment('lines');
|
||||
foreach ($object->lines as $line)
|
||||
{
|
||||
$tmparray=$this->get_substitutionarray_lines($line,$outputlangs);
|
||||
complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines");
|
||||
// Call the ODTSubstitutionLine hook
|
||||
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray,'line'=>$line);
|
||||
$reshook=$hookmanager->executeHooks('ODTSubstitutionLine',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
foreach($tmparray as $key => $val)
|
||||
{
|
||||
try
|
||||
{
|
||||
$listlines->setVars($key, $val, true, 'UTF-8');
|
||||
}
|
||||
catch(OdfException $e)
|
||||
{
|
||||
}
|
||||
catch(SegmentException $e)
|
||||
{
|
||||
}
|
||||
}
|
||||
$listlines->merge();
|
||||
}
|
||||
$odfHandler->mergeSegment($listlines);
|
||||
}
|
||||
catch(OdfException $e)
|
||||
{
|
||||
$this->error=$e->getMessage();
|
||||
dol_syslog($this->error, LOG_WARNING);
|
||||
return -1;
|
||||
}
|
||||
try
|
||||
{
|
||||
$listlines = $odfHandler->setSegment('lines');
|
||||
foreach ($object->lines as $line)
|
||||
{
|
||||
$tmparray=$this->get_substitutionarray_lines($line,$outputlangs);
|
||||
complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines");
|
||||
// Call the ODTSubstitutionLine hook
|
||||
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray,'line'=>$line);
|
||||
$reshook=$hookmanager->executeHooks('ODTSubstitutionLine',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
foreach($tmparray as $key => $val)
|
||||
{
|
||||
try
|
||||
{
|
||||
$listlines->setVars($key, $val, true, 'UTF-8');
|
||||
}
|
||||
catch(OdfException $e)
|
||||
{
|
||||
}
|
||||
catch(SegmentException $e)
|
||||
{
|
||||
}
|
||||
}
|
||||
$listlines->merge();
|
||||
}
|
||||
$odfHandler->mergeSegment($listlines);
|
||||
}
|
||||
catch(OdfException $e)
|
||||
{
|
||||
$this->error=$e->getMessage();
|
||||
dol_syslog($this->error, LOG_WARNING);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Call the beforeODTSave hook
|
||||
// Call the beforeODTSave hook
|
||||
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
|
||||
$reshook=$hookmanager->executeHooks('beforeODTSave',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
// Write new file
|
||||
// Write new file
|
||||
//$result=$odfHandler->exportAsAttachedFile('toto');
|
||||
$odfHandler->saveToDisk($file);
|
||||
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
$odfHandler=null; // Destroy object
|
||||
|
||||
|
||||
@ -71,11 +71,8 @@ class mailing_contacts1 extends MailingTargets
|
||||
$statssql=array();
|
||||
$statssql[0] = "SELECT '".$langs->trans("NbOfCompaniesContacts")."' as label,";
|
||||
$statssql[0].= " count(distinct(c.email)) as nb";
|
||||
$statssql[0].= " FROM ".MAIN_DB_PREFIX."socpeople as c,";
|
||||
$statssql[0].= " ".MAIN_DB_PREFIX."societe as s";
|
||||
$statssql[0].= " WHERE s.rowid = c.fk_soc";
|
||||
$statssql[0].= " AND c.entity IN (".getEntity('societe', 1).")";
|
||||
$statssql[0].= " AND s.client IN (1, 3)";
|
||||
$statssql[0].= " FROM ".MAIN_DB_PREFIX."socpeople as c";
|
||||
$statssql[0].= " WHERE c.entity IN (".getEntity('societe', 1).")";
|
||||
$statssql[0].= " AND c.email != ''"; // Note that null != '' is false
|
||||
$statssql[0].= " AND c.no_email = 0";
|
||||
|
||||
@ -96,12 +93,11 @@ class mailing_contacts1 extends MailingTargets
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT count(distinct(c.email)) as nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as c,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= " WHERE s.rowid = c.fk_soc";
|
||||
$sql .= " AND c.entity IN (".getEntity('societe', 1).")";
|
||||
$sql .= " AND c.email != ''"; // Note that null != '' is false
|
||||
$sql .= " AND c.no_email = 0";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = c.fk_soc";
|
||||
$sql.= " WHERE c.entity IN (".getEntity('societe', 1).")";
|
||||
$sql.= " AND c.email != ''"; // Note that null != '' is false
|
||||
$sql.= " AND c.no_email = 0";
|
||||
|
||||
// La requete doit retourner un champ "nb" pour etre comprise
|
||||
// par parent::getNbOfRecipients
|
||||
@ -203,10 +199,9 @@ class mailing_contacts1 extends MailingTargets
|
||||
$sql = "SELECT c.rowid as id, c.email as email, c.rowid as fk_contact,";
|
||||
$sql.= " c.lastname, c.firstname, c.civilite,";
|
||||
$sql.= " s.nom as companyname";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= " WHERE s.rowid = c.fk_soc";
|
||||
$sql.= " AND c.entity IN (".getEntity('societe', 1).")";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = c.fk_soc";
|
||||
$sql.= " WHERE c.entity IN (".getEntity('societe', 1).")";
|
||||
$sql.= " AND c.email != ''";
|
||||
$sql.= " AND c.no_email = 0";
|
||||
foreach($filtersarray as $key)
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2011 François Cerbelle <francois@cerbelle.net>
|
||||
/* Copyright (C) 2011 François Cerbelle <francois@cerbelle.net>
|
||||
* Copyright (C) 2013 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -80,14 +81,13 @@ class mailing_contacts2 extends MailingTargets
|
||||
$sql = "SELECT sp.rowid as id, sp.email as email, sp.rowid as fk_contact,";
|
||||
$sql.= " sp.lastname, sp.firstname as firstname, sp.civilite,";
|
||||
$sql.= " s.nom as companyname";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= " WHERE s.rowid = sp.fk_soc";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = sp.fk_soc";
|
||||
$sql.= " WHERE sp.entity IN (".getEntity('societe', 1).")";
|
||||
$sql.= " AND sp.email != ''"; // Note that null != '' is false
|
||||
$sql.= " AND sp.no_email = 0";
|
||||
//$sql.= " AND sp.poste != ''";
|
||||
$sql.= " AND sp.entity IN (".getEntity('societe', 1).")";
|
||||
if ($filtersarray[0]<>'all') $sql.= " AND sp.poste ='".$filtersarray[0]."'";
|
||||
if ($filtersarray[0]<>'all') $sql.= " AND sp.poste ='".$this->db->escape($filtersarray[0])."'";
|
||||
$sql.= " ORDER BY sp.lastname, sp.firstname";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
@ -162,10 +162,9 @@ class mailing_contacts2 extends MailingTargets
|
||||
// Number with a filter are show in the combo list for each filter.
|
||||
// If we want a filter "a position is defined", we must add it into formFilter
|
||||
$sql = "SELECT count(distinct(sp.email)) as nb";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= " WHERE s.rowid = sp.fk_soc";
|
||||
$sql.= " AND sp.entity IN (".getEntity('societe', 1).")";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = sp.fk_soc";
|
||||
$sql.= " WHERE sp.entity IN (".getEntity('societe', 1).")";
|
||||
$sql.= " AND sp.email != ''"; // Note that null != '' is false
|
||||
$sql.= " AND sp.no_email = 0";
|
||||
//$sql.= " AND sp.poste != ''";
|
||||
@ -187,10 +186,8 @@ class mailing_contacts2 extends MailingTargets
|
||||
$langs->load("companies");
|
||||
|
||||
$sql = "SELECT sp.poste, count(distinct(sp.email)) AS nb";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= " WHERE s.rowid = sp.fk_soc";
|
||||
$sql.= " AND sp.entity IN (".getEntity('societe', 1).")";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
|
||||
$sql.= " WHERE sp.entity IN (".getEntity('societe', 1).")";
|
||||
$sql.= " AND sp.email != ''"; // Note that null != '' is false
|
||||
$sql.= " AND sp.no_email = 0";
|
||||
$sql.= " AND (sp.poste IS NOT NULL AND sp.poste != '')";
|
||||
|
||||
@ -79,12 +79,11 @@ class mailing_contacts3 extends MailingTargets
|
||||
$sql = "SELECT sp.rowid as id, sp.email as email, sp.rowid as fk_contact,";
|
||||
$sql.= " sp.lastname, sp.firstname, sp.civilite,";
|
||||
$sql.= " s.nom as companyname";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."societe as s";
|
||||
if ($filtersarray[0] <> 'all') $sql.= ", ".MAIN_DB_PREFIX."categorie as c,";
|
||||
if ($filtersarray[0] <> 'all') $sql.= " ".MAIN_DB_PREFIX."categorie_societe as cs";
|
||||
$sql.= " WHERE s.rowid = sp.fk_soc";
|
||||
$sql.= " AND sp.email != ''"; // Note that null != '' is false
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
|
||||
if ($filtersarray[0] <> 'all') $sql.= ", ".MAIN_DB_PREFIX."categorie as c";
|
||||
if ($filtersarray[0] <> 'all') $sql.= ", ".MAIN_DB_PREFIX."categorie_societe as cs";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = sp.fk_soc";
|
||||
$sql.= " WHERE sp.email != ''"; // Note that null != '' is false
|
||||
$sql.= " AND sp.no_email = 0";
|
||||
$sql.= " AND sp.entity IN (".getEntity('societe', 1).")";
|
||||
if ($filtersarray[0] <> 'all') $sql.= " AND cs.fk_categorie = c.rowid";
|
||||
@ -168,10 +167,9 @@ class mailing_contacts3 extends MailingTargets
|
||||
// Number with a filter are show in the combo list for each filter.
|
||||
// If we want a filter "is inside at least one category", we must add it into formFilter
|
||||
$sql = "SELECT count(distinct(c.email)) as nb";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= " WHERE s.rowid = c.fk_soc";
|
||||
$sql.= " AND c.entity IN (".getEntity('societe', 1).")";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = c.fk_soc";
|
||||
$sql.= " WHERE c.entity IN (".getEntity('societe', 1).")";
|
||||
$sql.= " AND c.email != ''"; // Note that null != '' is false
|
||||
$sql.= " AND c.no_email = 0";
|
||||
/*
|
||||
@ -205,11 +203,9 @@ class mailing_contacts3 extends MailingTargets
|
||||
|
||||
$sql = "SELECT c.label, count(distinct(sp.email)) AS nb";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."societe as s,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."categorie as c,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."categorie_societe as cs";
|
||||
$sql.= " WHERE s.rowid = sp.fk_soc";
|
||||
$sql.= " AND sp.email != ''"; // Note that null != '' is false
|
||||
$sql.= " WHERE sp.email != ''"; // Note that null != '' is false
|
||||
$sql.= " AND sp.no_email = 0";
|
||||
$sql.= " AND sp.entity IN (".getEntity('societe', 1).")";
|
||||
$sql.= " AND cs.fk_categorie = c.rowid";
|
||||
|
||||
@ -82,7 +82,7 @@ class mailing_pomme extends MailingTargets
|
||||
* For example if this selector is used to extract 500 different
|
||||
* emails from a text file, this function must return 500.
|
||||
*
|
||||
* @param string $sql Requete sql de comptage
|
||||
* @param string $sql SQL request to use to count
|
||||
* @return int Number of recipients
|
||||
*/
|
||||
function getNbOfRecipients($sql='')
|
||||
|
||||
@ -175,11 +175,10 @@ class mailing_thirdparties_services_expired extends MailingTargets
|
||||
* For example if this selector is used to extract 500 different
|
||||
* emails from a text file, this function must return 500.
|
||||
*
|
||||
* @param int $filter Filter
|
||||
* @param string $option Option
|
||||
* @param string $sql SQL request to use to count
|
||||
* @return int Number of recipients
|
||||
*/
|
||||
function getNbOfRecipients($sql,$filter=1,$option='')
|
||||
function getNbOfRecipients($sql='')
|
||||
{
|
||||
$now=dol_now();
|
||||
|
||||
|
||||
224
htdocs/core/modules/modOpenSurvey.class.php
Executable file
224
htdocs/core/modules/modOpenSurvey.class.php
Executable file
@ -0,0 +1,224 @@
|
||||
<?php
|
||||
/* Copyright (C) 2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* Licensed under the GNU GPL v3 or higher (See file gpl-3.0.html)
|
||||
*/
|
||||
|
||||
/**
|
||||
* \defgroup opensurvey Module OpenSurvey
|
||||
* \brief Module to OpenSurvey integration.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/opensurvey/core/modules/modOpenSurvey.class.php
|
||||
* \ingroup opensurvey
|
||||
* \brief Description and activation file for module OpenSurvey
|
||||
*/
|
||||
include_once(DOL_DOCUMENT_ROOT ."/core/modules/DolibarrModules.class.php");
|
||||
|
||||
|
||||
/**
|
||||
* Description and activation class for module opensurvey
|
||||
*/
|
||||
class modOpenSurvey extends DolibarrModules
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor. Define names, constants, directories, boxes, permissions
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function __construct($db)
|
||||
{
|
||||
global $langs,$conf;
|
||||
|
||||
$this->db = $db;
|
||||
|
||||
// Id for module (must be unique).
|
||||
// Use here a free id (See in Home -> System information -> Dolibarr for list of used module id).
|
||||
$this->numero = 55000;
|
||||
// Key text used to identify module (for permission, menus, etc...)
|
||||
$this->rights_class = 'opensurvey';
|
||||
|
||||
// Family can be 'crm','financial','hr','projects','product','technic','other'
|
||||
// It is used to group modules in module setup page
|
||||
$this->family = "projects";
|
||||
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
|
||||
$this->name = preg_replace('/^mod/i','',get_class($this));
|
||||
// Module description used if translation string 'ModuleXXXDesc' not found (XXX is value MyModule)
|
||||
$this->description = "Module to integrate a survey (like Doodle, Studs, Rdvz, ...)";
|
||||
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
|
||||
$this->version = 'dolibarr';
|
||||
// Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
|
||||
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
||||
// Where to store the module in setup page (0=common,1=interface,2=others,3=very specific)
|
||||
$this->special = 0;
|
||||
// Name of image file used for this module.
|
||||
// If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
|
||||
// If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
|
||||
$this->picto='opensurvey.png@opensurvey';
|
||||
|
||||
// Data directories to create when module is enabled
|
||||
$this->dirs = array();
|
||||
//$this->dirs[0] = DOL_DATA_ROOT.'/mymodule;
|
||||
//$this->dirs[1] = DOL_DATA_ROOT.'/mymodule/temp;
|
||||
|
||||
// Config pages. Put here list of php page names stored in admin directory used to setup module
|
||||
$this->config_page_url = array("index.php@opensurvey");
|
||||
|
||||
// Dependencies
|
||||
$this->depends = array(); // List of modules id that must be enabled if this module is enabled
|
||||
$this->requiredby = array(); // List of modules id to disable if this one is disabled
|
||||
$this->phpmin = array(4,1); // Minimum version of PHP required by module
|
||||
$this->need_dolibarr_version = array(2,4); // Minimum version of Dolibarr required by module
|
||||
|
||||
// Constants
|
||||
$this->const = array(); // List of parameters
|
||||
|
||||
// Dictionnaries
|
||||
$this->dictionnaries=array();
|
||||
|
||||
// Boxes
|
||||
$this->boxes = array(); // List of boxes
|
||||
$r=0;
|
||||
|
||||
// Add here list of php file(s) stored in includes/boxes that contains class to show a box.
|
||||
// Example:
|
||||
//$this->boxes[$r][1] = "myboxa.php";
|
||||
//$r++;
|
||||
//$this->boxes[$r][1] = "myboxb.php";
|
||||
//$r++;
|
||||
|
||||
// Permissions
|
||||
$this->rights = array(); // Permission array used by this module
|
||||
$r=0;
|
||||
|
||||
// Add here list of permission defined by an id, a label, a boolean and two constant strings.
|
||||
// Example:
|
||||
$this->rights[$r][0] = 55000; // Permission id (must not be already used)
|
||||
$this->rights[$r][1] = 'Read surveys'; // Permission label
|
||||
$this->rights[$r][2] = 'r'; // Permission by default for new user (0/1)
|
||||
$this->rights[$r][3] = 0; // Permission by default for new user (0/1)
|
||||
$this->rights[$r][4] = 'survey'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
||||
$this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
||||
$r++;
|
||||
|
||||
// Add here list of permission defined by an id, a label, a boolean and two constant strings.
|
||||
// Example:
|
||||
$this->rights[$r][0] = 55001; // Permission id (must not be already used)
|
||||
$this->rights[$r][1] = 'Create/modify surveys'; // Permission label
|
||||
$this->rights[$r][2] = 'w'; // Permission by default for new user (0/1)
|
||||
$this->rights[$r][3] = 0; // Permission by default for new user (0/1)
|
||||
$this->rights[$r][4] = 'survey'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
||||
$this->rights[$r][5] = 'write'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
||||
$r++;
|
||||
|
||||
|
||||
// Main menu entries
|
||||
$this->menus = array(); // List of menus to add
|
||||
$r=0;
|
||||
|
||||
$this->menu[$r]=array( 'fk_menu'=>0, // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
|
||||
'type'=>'top',
|
||||
'titre'=>'Surveys',
|
||||
'mainmenu'=>'opensurvey',
|
||||
'url'=>'/opensurvey/index.php',
|
||||
'langs'=>'opensurvey@opensurvey',
|
||||
'position'=>200,
|
||||
'enabled'=>'$conf->opensurvey->enabled', // Define condition to show or hide menu entry. Use '$conf->NewsSubmitter->enabled' if entry must be visible if module is enabled.
|
||||
'perms'=>'$user->rights->opensurvey->survey->read',
|
||||
'target'=>'',
|
||||
'user'=>0);
|
||||
$r++;
|
||||
|
||||
$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=opensurvey', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
|
||||
'type'=>'left',
|
||||
'titre'=>'Survey',
|
||||
'mainmenu'=>'opensurvey',
|
||||
'leftmenu'=>'opensurvey',
|
||||
'url'=>'/opensurvey/index.php?mainmenu=opensurvey&leftmenu=opensurvey',
|
||||
'langs'=>'opensurvey@opensurvey',
|
||||
'position'=>200,
|
||||
'enabled'=>'$conf->opensurvey->enabled', // Define condition to show or hide menu entry. Use '$conf->NewsSubmitter->enabled' if entry must be visible if module is enabled.
|
||||
'perms'=>'',
|
||||
'target'=>'',
|
||||
'user'=>0);
|
||||
$r++;
|
||||
|
||||
$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=opensurvey,fk_leftmenu=opensurvey', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
|
||||
'type'=>'left',
|
||||
'titre'=>'NewSurvey',
|
||||
'mainmenu'=>'opensurvey',
|
||||
'leftmenu'=>'opensurvey_new',
|
||||
'url'=>'/opensurvey/public/index.php?origin=dolibarr',
|
||||
'langs'=>'opensurvey@opensurvey',
|
||||
'position'=>210,
|
||||
'enabled'=>'$conf->opensurvey->enabled', // Define condition to show or hide menu entry. Use '$conf->NewsSubmitter->enabled' if entry must be visible if module is enabled.
|
||||
'perms'=>'',
|
||||
'target'=>'_blank',
|
||||
'user'=>0);
|
||||
$r++;
|
||||
|
||||
$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=opensurvey,fk_leftmenu=opensurvey', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
|
||||
'type'=>'left',
|
||||
'titre'=>'List',
|
||||
'mainmenu'=>'opensurvey',
|
||||
'leftmenu'=>'opensurvey_list',
|
||||
'url'=>'/opensurvey/list.php',
|
||||
'langs'=>'opensurvey@opensurvey',
|
||||
'position'=>220,
|
||||
'enabled'=>'$conf->opensurvey->enabled', // Define condition to show or hide menu entry. Use '$conf->NewsSubmitter->enabled' if entry must be visible if module is enabled.
|
||||
'perms'=>'',
|
||||
'target'=>'',
|
||||
'user'=>0);
|
||||
$r++;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function called when module is enabled.
|
||||
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
||||
* It also creates data directories
|
||||
*
|
||||
* @param string $options Options when enabling module ('', 'noboxes')
|
||||
* @return int 1 if OK, 0 if KO
|
||||
*/
|
||||
function init($options='')
|
||||
{
|
||||
$sql = array();
|
||||
|
||||
$result=$this->load_tables();
|
||||
|
||||
return $this->_init($sql,$options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function called when module is disabled.
|
||||
* Remove from database constants, boxes and permissions from Dolibarr database.
|
||||
* Data directories are not deleted
|
||||
*
|
||||
* @param string $options Options when enabling module ('', 'noboxes')
|
||||
* @return int 1 if OK, 0 if KO
|
||||
*/
|
||||
function remove($options='')
|
||||
{
|
||||
$sql = array();
|
||||
|
||||
return $this->_remove($sql,$options);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create tables and keys required by module
|
||||
* Files mymodule.sql and mymodule.key.sql with create table and create keys
|
||||
* commands must be stored in directory /mymodule/sql/
|
||||
* This function is called by this->init.
|
||||
*
|
||||
* @return int <=0 if KO, >0 if OK
|
||||
*/
|
||||
function load_tables()
|
||||
{
|
||||
return $this->_load_tables('/opensurvey/sql/');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@ -125,7 +125,7 @@ class doc_generic_project_odt extends ModelePDFProjects
|
||||
'object_note_private'=>$object->note_private,
|
||||
'object_note_public'=>$object->note_public,
|
||||
'object_public'=>$object->public,
|
||||
'object_statut'=>html_entity_decode($object->getLibStatut())
|
||||
'object_statut'=>$object->getLibStatut()
|
||||
);
|
||||
}
|
||||
|
||||
@ -209,7 +209,7 @@ class doc_generic_project_odt extends ModelePDFProjects
|
||||
function get_substitutionarray_project_reference($refdetail,$outputlangs)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
|
||||
return array(
|
||||
'projref_type'=>$refdetail['type'],
|
||||
'projref_ref'=>$refdetail['ref'],
|
||||
@ -220,7 +220,7 @@ class doc_generic_project_odt extends ModelePDFProjects
|
||||
'projref_status'=>$refdetail['status']
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Define array with couple substitution key => substitution value
|
||||
*
|
||||
@ -242,7 +242,7 @@ class doc_generic_project_odt extends ModelePDFProjects
|
||||
'taskressource_email'=>$taskressource['email']
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Define array with couple substitution key => substitution value
|
||||
*
|
||||
@ -254,7 +254,7 @@ class doc_generic_project_odt extends ModelePDFProjects
|
||||
{
|
||||
global $conf;
|
||||
|
||||
return array(
|
||||
return array(
|
||||
'tasktime_rowid'=>$tasktime['rowid'],
|
||||
'tasktime_task_date'=>dol_print_date($tasktime['task_date'],'day'),
|
||||
'tasktime_task_duration'=>convertSecondToTime($tasktime['task_duration'],'all'),
|
||||
@ -265,7 +265,7 @@ class doc_generic_project_odt extends ModelePDFProjects
|
||||
'tasktime_fullcivname'=>$tasktime['fullcivname']
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Define array with couple substitution key => substitution value
|
||||
*
|
||||
@ -276,7 +276,7 @@ class doc_generic_project_odt extends ModelePDFProjects
|
||||
function get_substitutionarray_task_file($file,$outputlangs)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
|
||||
return array(
|
||||
'tasksfile_name'=>$file['name'],
|
||||
'tasksfile_date'=>dol_print_date($file['date'],'day'),
|
||||
@ -384,6 +384,14 @@ class doc_generic_project_odt extends ModelePDFProjects
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Add odtgeneration hook
|
||||
if (! is_object($hookmanager))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($this->db);
|
||||
}
|
||||
$hookmanager->initHooks(array('odtgeneration'));
|
||||
global $action;
|
||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||
$sav_charset_output=$outputlangs->charset_output;
|
||||
$outputlangs->charset_output='UTF-8';
|
||||
@ -470,7 +478,6 @@ class doc_generic_project_odt extends ModelePDFProjects
|
||||
|
||||
// Make substitutions into odt of user info
|
||||
$tmparray=$this->get_substitutionarray_user($user,$outputlangs);
|
||||
//var_dump($tmparray); exit;
|
||||
foreach($tmparray as $key=>$value)
|
||||
{
|
||||
try {
|
||||
@ -504,6 +511,7 @@ class doc_generic_project_odt extends ModelePDFProjects
|
||||
else // Text
|
||||
{
|
||||
$odfHandler->setVars($key, $value, true, 'UTF-8');
|
||||
$odfHandler->setVarsHeadFooter($key, $value, true, 'UTF-8');
|
||||
}
|
||||
}
|
||||
catch(OdfException $e)
|
||||
@ -534,6 +542,9 @@ class doc_generic_project_odt extends ModelePDFProjects
|
||||
// Replace tags of object + external modules
|
||||
$tmparray=$this->get_substitutionarray_object($object,$outputlangs);
|
||||
complete_substitutions_array($tmparray, $outputlangs, $object);
|
||||
// Call the ODTSubstitution hook
|
||||
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
|
||||
$reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
foreach($tmparray as $key=>$value)
|
||||
{
|
||||
try {
|
||||
@ -564,7 +575,7 @@ class doc_generic_project_odt extends ModelePDFProjects
|
||||
if (!empty($object->fk_soc)) $socid = $object->fk_soc;
|
||||
|
||||
$tasksarray=$taskstatic->getTasksArray(0, 0, $object->id, $socid, 0);
|
||||
|
||||
|
||||
|
||||
|
||||
foreach ($tasksarray as $task)
|
||||
@ -584,10 +595,10 @@ class doc_generic_project_odt extends ModelePDFProjects
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$taskobj=new Task($this->db);
|
||||
$taskobj->fetch($task->id);
|
||||
|
||||
|
||||
// Replace tags of lines for contacts task
|
||||
$sourcearray=array('internal','external');
|
||||
$contact_arrray=array();
|
||||
@ -601,7 +612,7 @@ class doc_generic_project_odt extends ModelePDFProjects
|
||||
if ((is_array($contact_arrray) && count($contact_arrray) > 0))
|
||||
{
|
||||
$listlinestaskres = $listlines->__get('tasksressources');
|
||||
|
||||
|
||||
foreach ($contact_arrray as $contact)
|
||||
{
|
||||
if ($contact['source']=='internal') {
|
||||
@ -611,15 +622,15 @@ class doc_generic_project_odt extends ModelePDFProjects
|
||||
} elseif ($contact['source']=='external') {
|
||||
$objectdetail=new Contact($this->db);
|
||||
$objectdetail->fetch($contact['id']);
|
||||
|
||||
|
||||
$soc=new Societe($this->db);
|
||||
$soc->fetch($contact['socid']);
|
||||
$contact['socname']=$soc->name;
|
||||
}
|
||||
$contact['fullname']=$objectdetail->getFullName($outputlangs,1);
|
||||
|
||||
|
||||
$tmparray=$this->get_substitutionarray_tasksressource($contact,$outputlangs);
|
||||
|
||||
|
||||
foreach($tmparray as $key => $val)
|
||||
{
|
||||
try
|
||||
@ -645,7 +656,7 @@ class doc_generic_project_odt extends ModelePDFProjects
|
||||
$sql .= " WHERE t.fk_task =".$task->id;
|
||||
$sql .= " AND t.fk_user = u.rowid";
|
||||
$sql .= " ORDER BY t.task_date DESC";
|
||||
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -663,9 +674,9 @@ class doc_generic_project_odt extends ModelePDFProjects
|
||||
} else {
|
||||
$row['fullcivname']='';
|
||||
}
|
||||
|
||||
|
||||
$tmparray=$this->get_substitutionarray_taskstime($row,$outputlangs);
|
||||
|
||||
|
||||
foreach($tmparray as $key => $val)
|
||||
{
|
||||
try
|
||||
@ -684,15 +695,15 @@ class doc_generic_project_odt extends ModelePDFProjects
|
||||
}
|
||||
$this->db->free($resql);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Replace tags of project files
|
||||
$listtasksfiles = $listlines->__get('tasksfiles');
|
||||
|
||||
|
||||
$upload_dir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($object->ref).'/'.dol_sanitizeFileName($task->ref);
|
||||
$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$','name',SORT_ASC,1);
|
||||
|
||||
|
||||
|
||||
|
||||
foreach ($filearray as $filedetail)
|
||||
{
|
||||
$tmparray=$this->get_substitutionarray_task_file($filedetail,$outputlangs);
|
||||
@ -731,7 +742,7 @@ class doc_generic_project_odt extends ModelePDFProjects
|
||||
$upload_dir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($object->ref);
|
||||
$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$','name',SORT_ASC,1);
|
||||
|
||||
|
||||
|
||||
foreach ($filearray as $filedetail)
|
||||
{
|
||||
//dol_syslog(get_class($this).'::main $filedetail'.var_export($filedetail,true));
|
||||
@ -794,7 +805,6 @@ class doc_generic_project_odt extends ModelePDFProjects
|
||||
$contact['fullname']=$objectdetail->getFullName($outputlangs,1);
|
||||
|
||||
$tmparray=$this->get_substitutionarray_project_contacts($contact,$outputlangs);
|
||||
complete_substitutions_array($tmparray, $outputlangs, $contact, $contact, "completesubstitutionarray_lines");
|
||||
foreach($tmparray as $key => $val)
|
||||
{
|
||||
try
|
||||
@ -891,27 +901,27 @@ class doc_generic_project_odt extends ModelePDFProjects
|
||||
{
|
||||
$ref_array=array();
|
||||
$ref_array['type']=$langs->trans($classname);
|
||||
|
||||
|
||||
$element = new $classname($this->db);
|
||||
$element->fetch($elementarray[$i]);
|
||||
$element->fetch_thirdparty();
|
||||
|
||||
|
||||
//Ref object
|
||||
$ref_array['ref']=$element->ref;
|
||||
|
||||
|
||||
//Date object
|
||||
$dateref=$element->date;
|
||||
if (empty($dateref)) $dateref=$element->datep;
|
||||
if (empty($dateref)) $dateref=$element->date_contrat;
|
||||
$ref_array['date']=$dateref;
|
||||
|
||||
|
||||
//Soc object
|
||||
if (is_object($element->thirdparty)) {
|
||||
$ref_array['socname']=$element->thirdparty->name;
|
||||
} else {
|
||||
$ref_array['socname']='';
|
||||
}
|
||||
|
||||
|
||||
//Amount object
|
||||
if (empty($valueref['disableamount'])) {
|
||||
if (!empty($element->total_ht)) {
|
||||
@ -925,9 +935,9 @@ class doc_generic_project_odt extends ModelePDFProjects
|
||||
$ref_array['amountht']='';
|
||||
$ref_array['amountttc']='';
|
||||
}
|
||||
|
||||
$ref_array['status']=html_entity_decode($element->getLibStatut(0));
|
||||
|
||||
|
||||
$ref_array['status']=$element->getLibStatut(0);
|
||||
|
||||
$tmparray=$this->get_substitutionarray_project_reference($ref_array,$outputlangs);
|
||||
|
||||
foreach($tmparray as $key => $val)
|
||||
@ -945,7 +955,7 @@ class doc_generic_project_odt extends ModelePDFProjects
|
||||
}
|
||||
$listlines->merge();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
$odfHandler->mergeSegment($listlines);
|
||||
@ -958,8 +968,14 @@ class doc_generic_project_odt extends ModelePDFProjects
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Call the beforeODTSave hook
|
||||
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
|
||||
$reshook=$hookmanager->executeHooks('beforeODTSave',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
|
||||
// Write new file
|
||||
$odfHandler->saveToDisk($file);
|
||||
$odfHandler->saveToDisk($file);
|
||||
//$odfHandler->exportAsAttachedPDF($file);
|
||||
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
@ -1,21 +1,21 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* or see http://www.gnu.org/
|
||||
*/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* or see http://www.gnu.org/
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php
|
||||
@ -89,7 +89,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales
|
||||
/**
|
||||
* Return description of a module
|
||||
*
|
||||
* @param Translate $langs Lang object to use for output
|
||||
* @param Translate $langs Lang object to use for output
|
||||
* @return string Description
|
||||
*/
|
||||
function info($langs)
|
||||
@ -123,7 +123,9 @@ class doc_generic_proposal_odt extends ModelePDFPropales
|
||||
{
|
||||
$tmpdir=trim($tmpdir);
|
||||
$tmpdir=preg_replace('/DOL_DATA_ROOT/',DOL_DATA_ROOT,$tmpdir);
|
||||
if (! $tmpdir) { unset($listofdir[$key]); continue; }
|
||||
if (! $tmpdir) {
|
||||
unset($listofdir[$key]); continue;
|
||||
}
|
||||
if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0);
|
||||
else
|
||||
{
|
||||
@ -134,19 +136,19 @@ class doc_generic_proposal_odt extends ModelePDFPropales
|
||||
$texthelp=$langs->trans("ListOfDirectoriesForModelGenODT");
|
||||
// Add list of substitution keys
|
||||
$texthelp.='<br>'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'<br>';
|
||||
$texthelp.=$langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it
|
||||
$texthelp.=$langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it
|
||||
|
||||
$texte.= $form->textwithpicto($texttitle,$texthelp,1,'help','',1);
|
||||
$texte.= '<table><tr><td>';
|
||||
$texte.= '<textarea class="flat" cols="60" name="value1">';
|
||||
$texte.=$conf->global->PROPALE_ADDON_PDF_ODT_PATH;
|
||||
$texte.= '</textarea>';
|
||||
$texte.= '</td>';
|
||||
$texte.= '</td>';
|
||||
$texte.= '<td align="center"> ';
|
||||
$texte.= '<input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button">';
|
||||
$texte.= '</td>';
|
||||
$texte.= '<input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button">';
|
||||
$texte.= '</td>';
|
||||
$texte.= '</tr>';
|
||||
$texte.= '</table>';
|
||||
$texte.= '</table>';
|
||||
|
||||
// Scan directories
|
||||
if (count($listofdir))
|
||||
@ -190,7 +192,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales
|
||||
$texte.= '</tr>';
|
||||
|
||||
/*$texte.= '<tr>';
|
||||
$texte.= '<td align="center">';
|
||||
$texte.= '<td align="center">';
|
||||
$texte.= '<input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button">';
|
||||
$texte.= '</td>';
|
||||
$texte.= '</tr>';*/
|
||||
@ -207,9 +209,9 @@ class doc_generic_proposal_odt extends ModelePDFPropales
|
||||
* @param Propale $object Object source to build document
|
||||
* @param Translate $outputlangs Lang output object
|
||||
* @param string $srctemplatepath Full path of source filename for generator using a template file
|
||||
* @param int $hidedetails Do not show line details
|
||||
* @param int $hidedesc Do not show desc
|
||||
* @param int $hideref Do not show ref
|
||||
* @param int $hidedetails Do not show line details
|
||||
* @param int $hidedesc Do not show desc
|
||||
* @param int $hideref Do not show ref
|
||||
* @return int 1 if OK, <=0 if KO
|
||||
*/
|
||||
function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0)
|
||||
@ -222,14 +224,14 @@ class doc_generic_proposal_odt extends ModelePDFPropales
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Add odtgeneration hook
|
||||
if (! is_object($hookmanager))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($this->db);
|
||||
}
|
||||
$hookmanager->initHooks(array('odtgeneration'));
|
||||
global $action;
|
||||
// Add odtgeneration hook
|
||||
if (! is_object($hookmanager))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($this->db);
|
||||
}
|
||||
$hookmanager->initHooks(array('odtgeneration'));
|
||||
global $action;
|
||||
|
||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||
$sav_charset_output=$outputlangs->charset_output;
|
||||
@ -276,7 +278,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales
|
||||
$newfiletmp=preg_replace('/\.odt/i','',$newfile);
|
||||
$newfiletmp=preg_replace('/template_/i','',$newfiletmp);
|
||||
$newfiletmp=preg_replace('/modele_/i','',$newfiletmp);
|
||||
$newfiletmp=$objectref.'_'.$newfiletmp;
|
||||
$newfiletmp=$objectref.'_'.$newfiletmp;
|
||||
//$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt';
|
||||
$file=$dir.'/'.$newfiletmp.'.odt';
|
||||
//print "newdir=".$dir;
|
||||
@ -287,64 +289,64 @@ class doc_generic_proposal_odt extends ModelePDFPropales
|
||||
dol_mkdir($conf->propal->dir_temp);
|
||||
|
||||
|
||||
// If BILLING contact defined on invoice, we use it
|
||||
$usecontact=false;
|
||||
$arrayidcontact=$object->getIdContact('external','BILLING');
|
||||
if (count($arrayidcontact) > 0)
|
||||
{
|
||||
$usecontact=true;
|
||||
$result=$object->fetch_contact($arrayidcontact[0]);
|
||||
}
|
||||
// If BILLING contact defined on invoice, we use it
|
||||
$usecontact=false;
|
||||
$arrayidcontact=$object->getIdContact('external','BILLING');
|
||||
if (count($arrayidcontact) > 0)
|
||||
{
|
||||
$usecontact=true;
|
||||
$result=$object->fetch_contact($arrayidcontact[0]);
|
||||
}
|
||||
|
||||
// Recipient name
|
||||
if (! empty($usecontact))
|
||||
{
|
||||
// On peut utiliser le nom de la societe du contact
|
||||
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact;
|
||||
else $socobject = $object->client;
|
||||
}
|
||||
else
|
||||
{
|
||||
$socobject=$object->client;
|
||||
}
|
||||
// Recipient name
|
||||
if (! empty($usecontact))
|
||||
{
|
||||
// On peut utiliser le nom de la societe du contact
|
||||
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact;
|
||||
else $socobject = $object->client;
|
||||
}
|
||||
else
|
||||
{
|
||||
$socobject=$object->client;
|
||||
}
|
||||
|
||||
// Make substitution
|
||||
$substitutionarray=array(
|
||||
'__FROM_NAME__' => $this->emetteur->nom,
|
||||
'__FROM_EMAIL__' => $this->emetteur->email,
|
||||
'__TOTAL_TTC__' => $object->total_ttc,
|
||||
'__TOTAL_HT__' => $object->total_ht,
|
||||
'__TOTAL_VAT__' => $object->total_vat
|
||||
);
|
||||
complete_substitutions_array($substitutionarray, $langs, $object);
|
||||
// Call the ODTSubstitution hook
|
||||
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$substitutionarray);
|
||||
$reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
// Make substitution
|
||||
$substitutionarray=array(
|
||||
'__FROM_NAME__' => $this->emetteur->nom,
|
||||
'__FROM_EMAIL__' => $this->emetteur->email,
|
||||
'__TOTAL_TTC__' => $object->total_ttc,
|
||||
'__TOTAL_HT__' => $object->total_ht,
|
||||
'__TOTAL_VAT__' => $object->total_vat
|
||||
);
|
||||
complete_substitutions_array($substitutionarray, $langs, $object);
|
||||
// Call the ODTSubstitution hook
|
||||
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$substitutionarray);
|
||||
$reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
// Line of free text
|
||||
$newfreetext='';
|
||||
$paramfreetext='PROPALE_FREE_TEXT';
|
||||
if (! empty($conf->global->$paramfreetext))
|
||||
{
|
||||
$newfreetext=make_substitutions($conf->global->$paramfreetext,$substitutionarray);
|
||||
}
|
||||
if (! empty($conf->global->$paramfreetext))
|
||||
{
|
||||
$newfreetext=make_substitutions($conf->global->$paramfreetext,$substitutionarray);
|
||||
}
|
||||
|
||||
// Open and load template
|
||||
// Open and load template
|
||||
require_once ODTPHP_PATH.'odf.php';
|
||||
$odfHandler = new odf(
|
||||
$srctemplatepath,
|
||||
array(
|
||||
'PATH_TO_TMP' => $conf->propal->dir_temp,
|
||||
'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy.
|
||||
'DELIMITER_LEFT' => '{',
|
||||
'DELIMITER_RIGHT' => '}'
|
||||
$srctemplatepath,
|
||||
array(
|
||||
'PATH_TO_TMP' => $conf->propal->dir_temp,
|
||||
'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy.
|
||||
'DELIMITER_LEFT' => '{',
|
||||
'DELIMITER_RIGHT' => '}'
|
||||
)
|
||||
);
|
||||
// After construction $odfHandler->contentXml contains content and
|
||||
// [!-- BEGIN row.lines --]*[!-- END row.lines --] has been replaced by
|
||||
// [!-- BEGIN lines --]*[!-- END lines --]
|
||||
//print html_entity_decode($odfHandler->__toString());
|
||||
//print exit;
|
||||
//print html_entity_decode($odfHandler->__toString());
|
||||
//print exit;
|
||||
|
||||
|
||||
// Make substitutions into odt of freetext
|
||||
@ -355,29 +357,29 @@ class doc_generic_proposal_odt extends ModelePDFPropales
|
||||
{
|
||||
}
|
||||
|
||||
// Make substitutions into odt of user info
|
||||
// Make substitutions into odt of user info
|
||||
$tmparray=$this->get_substitutionarray_user($user,$outputlangs);
|
||||
//var_dump($tmparray); exit;
|
||||
foreach($tmparray as $key=>$value)
|
||||
{
|
||||
try {
|
||||
if (preg_match('/logo$/',$key)) // Image
|
||||
{
|
||||
//var_dump($value);exit;
|
||||
if (file_exists($value)) $odfHandler->setImage($key, $value);
|
||||
else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
|
||||
}
|
||||
else // Text
|
||||
{
|
||||
$odfHandler->setVars($key, $value, true, 'UTF-8');
|
||||
}
|
||||
}
|
||||
catch(OdfException $e)
|
||||
{
|
||||
}
|
||||
}
|
||||
// Make substitutions into odt of mysoc
|
||||
$tmparray=$this->get_substitutionarray_mysoc($mysoc,$outputlangs);
|
||||
//var_dump($tmparray); exit;
|
||||
foreach($tmparray as $key=>$value)
|
||||
{
|
||||
try {
|
||||
if (preg_match('/logo$/',$key)) // Image
|
||||
{
|
||||
//var_dump($value);exit;
|
||||
if (file_exists($value)) $odfHandler->setImage($key, $value);
|
||||
else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
|
||||
}
|
||||
else // Text
|
||||
{
|
||||
$odfHandler->setVars($key, $value, true, 'UTF-8');
|
||||
}
|
||||
}
|
||||
catch(OdfException $e)
|
||||
{
|
||||
}
|
||||
}
|
||||
// Make substitutions into odt of mysoc
|
||||
$tmparray=$this->get_substitutionarray_mysoc($mysoc,$outputlangs);
|
||||
//var_dump($tmparray); exit;
|
||||
foreach($tmparray as $key=>$value)
|
||||
{
|
||||
@ -397,7 +399,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales
|
||||
{
|
||||
}
|
||||
}
|
||||
// Make substitutions into odt of thirdparty
|
||||
// Make substitutions into odt of thirdparty
|
||||
$tmparray=$this->get_substitutionarray_thirdparty($socobject,$outputlangs);
|
||||
foreach($tmparray as $key=>$value)
|
||||
{
|
||||
@ -417,74 +419,74 @@ class doc_generic_proposal_odt extends ModelePDFPropales
|
||||
}
|
||||
}
|
||||
// Replace tags of object + external modules
|
||||
$tmparray=$this->get_substitutionarray_propal($object,$outputlangs);
|
||||
//print_r($tmparray); exit;
|
||||
complete_substitutions_array($tmparray, $outputlangs, $object);
|
||||
// Call the ODTSubstitution hook
|
||||
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
|
||||
$reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
foreach($tmparray as $key=>$value)
|
||||
{
|
||||
try {
|
||||
if (preg_match('/logo$/',$key)) // Image
|
||||
{
|
||||
if (file_exists($value)) $odfHandler->setImage($key, $value);
|
||||
else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
|
||||
}
|
||||
else // Text
|
||||
{
|
||||
$odfHandler->setVars($key, $value, true, 'UTF-8');
|
||||
}
|
||||
}
|
||||
catch(OdfException $e)
|
||||
{
|
||||
}
|
||||
}
|
||||
$tmparray=$this->get_substitutionarray_propal($object,$outputlangs);
|
||||
//print_r($tmparray); exit;
|
||||
complete_substitutions_array($tmparray, $outputlangs, $object);
|
||||
// Call the ODTSubstitution hook
|
||||
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
|
||||
$reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
foreach($tmparray as $key=>$value)
|
||||
{
|
||||
try {
|
||||
if (preg_match('/logo$/',$key)) // Image
|
||||
{
|
||||
if (file_exists($value)) $odfHandler->setImage($key, $value);
|
||||
else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
|
||||
}
|
||||
else // Text
|
||||
{
|
||||
$odfHandler->setVars($key, $value, true, 'UTF-8');
|
||||
}
|
||||
}
|
||||
catch(OdfException $e)
|
||||
{
|
||||
}
|
||||
}
|
||||
// Replace tags of lines
|
||||
try
|
||||
{
|
||||
$listlines = $odfHandler->setSegment('lines');
|
||||
foreach ($object->lines as $line)
|
||||
{
|
||||
$tmparray=$this->get_substitutionarray_propal_lines($line,$outputlangs);
|
||||
complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines");
|
||||
// Call the ODTSubstitutionLine hook
|
||||
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray,'line'=>$line);
|
||||
$reshook=$hookmanager->executeHooks('ODTSubstitutionLine',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
foreach($tmparray as $key => $val)
|
||||
{
|
||||
try
|
||||
{
|
||||
$listlines->setVars($key, $val, true, 'UTF-8');
|
||||
}
|
||||
catch(OdfException $e)
|
||||
{
|
||||
}
|
||||
catch(SegmentException $e)
|
||||
{
|
||||
}
|
||||
}
|
||||
$listlines->merge();
|
||||
}
|
||||
$odfHandler->mergeSegment($listlines);
|
||||
}
|
||||
catch(OdfException $e)
|
||||
{
|
||||
$this->error=$e->getMessage();
|
||||
dol_syslog($this->error, LOG_WARNING);
|
||||
return -1;
|
||||
}
|
||||
try
|
||||
{
|
||||
$listlines = $odfHandler->setSegment('lines');
|
||||
foreach ($object->lines as $line)
|
||||
{
|
||||
$tmparray=$this->get_substitutionarray_propal_lines($line,$outputlangs);
|
||||
complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines");
|
||||
// Call the ODTSubstitutionLine hook
|
||||
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray,'line'=>$line);
|
||||
$reshook=$hookmanager->executeHooks('ODTSubstitutionLine',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
foreach($tmparray as $key => $val)
|
||||
{
|
||||
try
|
||||
{
|
||||
$listlines->setVars($key, $val, true, 'UTF-8');
|
||||
}
|
||||
catch(OdfException $e)
|
||||
{
|
||||
}
|
||||
catch(SegmentException $e)
|
||||
{
|
||||
}
|
||||
}
|
||||
$listlines->merge();
|
||||
}
|
||||
$odfHandler->mergeSegment($listlines);
|
||||
}
|
||||
catch(OdfException $e)
|
||||
{
|
||||
$this->error=$e->getMessage();
|
||||
dol_syslog($this->error, LOG_WARNING);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Call the beforeODTSave hook
|
||||
// Call the beforeODTSave hook
|
||||
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
|
||||
$reshook=$hookmanager->executeHooks('beforeODTSave',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
// Write new file
|
||||
// Write new file
|
||||
//$result=$odfHandler->exportAsAttachedFile('toto');
|
||||
$odfHandler->saveToDisk($file);
|
||||
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
$odfHandler=null; // Destroy object
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -18,19 +19,21 @@
|
||||
|
||||
$module = $object->element;
|
||||
$note_public = 'note_public';
|
||||
$note_private = 'note';
|
||||
$note_private = 'note_private';
|
||||
|
||||
$colwidth=(isset($colwidth)?$colwidth:25);
|
||||
$permission=(isset($permission)?$permission:(isset($user->rights->$module->creer)?$user->rights->$module->creer:0)); // If already defined by caller page
|
||||
$moreparam=(isset($moreparam)?$moreparam:'');
|
||||
|
||||
// Special cases
|
||||
if ($module == 'propal') { $permission=$user->rights->propale->creer; }
|
||||
elseif ($module == 'fichinter') { $permission=$user->rights->ficheinter->creer; $note_private = 'note_private'; }
|
||||
elseif ($module == 'project') { $permission=$user->rights->projet->creer; $note_private = 'note_private'; }
|
||||
elseif ($module == 'project_task') { $permission=$user->rights->projet->creer; $note_private = 'note_private'; }
|
||||
elseif ($module == 'invoice_supplier') { $permission=$user->rights->fournisseur->facture->creer; }
|
||||
elseif ($module == 'order_supplier') { $permission=$user->rights->fournisseur->commande->creer; }
|
||||
if ($module == 'propal') { $permission=$user->rights->propale->creer;}
|
||||
elseif ($module == 'fichinter') { $permission=$user->rights->ficheinter->creer;}
|
||||
elseif ($module == 'project') { $permission=$user->rights->projet->creer;}
|
||||
elseif ($module == 'project_task') { $permission=$user->rights->projet->creer;}
|
||||
elseif ($module == 'invoice_supplier') { $permission=$user->rights->fournisseur->facture->creer;}
|
||||
elseif ($module == 'order_supplier') { $permission=$user->rights->fournisseur->commande->creer;}
|
||||
elseif ($module == 'societe') { $permission=$user->rights->societe->creer;}
|
||||
elseif ($module == 'shipping') { $permission=$user->rights->expedition->creer;}
|
||||
|
||||
if (! empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) $typeofdata='ckeditor:dolibarr_notes:100%:200::1:12:100';
|
||||
else $typeofdata='textarea:12:100';
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
|
||||
* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -56,6 +57,8 @@ class Expedition extends CommonObject
|
||||
var $tracking_url;
|
||||
var $statut;
|
||||
var $billed;
|
||||
var $note_public;
|
||||
var $note_private;
|
||||
|
||||
var $trueWeight;
|
||||
var $weight_units;
|
||||
@ -191,6 +194,8 @@ class Expedition extends CommonObject
|
||||
$sql.= ", height";
|
||||
$sql.= ", weight_units";
|
||||
$sql.= ", size_units";
|
||||
$sql.= ", note_private";
|
||||
$sql.= ", note_public";
|
||||
$sql.= ") VALUES (";
|
||||
$sql.= "'(PROV)'";
|
||||
$sql.= ", ".$conf->entity;
|
||||
@ -210,6 +215,8 @@ class Expedition extends CommonObject
|
||||
$sql.= ", ".$this->sizeH; // TODO Should use this->trueHeight
|
||||
$sql.= ", ".$this->weight_units;
|
||||
$sql.= ", ".$this->size_units;
|
||||
$sql.= ", ".(!empty($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null");
|
||||
$sql.= ", ".(!empty($this->note_public)?"'".$this->db->escape($this->note_public)."'":"null");
|
||||
$sql.= ")";
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
@ -339,8 +346,9 @@ class Expedition extends CommonObject
|
||||
$sql = "SELECT e.rowid, e.ref, e.fk_soc as socid, e.date_creation, e.ref_customer, e.ref_ext, e.ref_int, e.fk_user_author, e.fk_statut";
|
||||
$sql.= ", e.weight, e.weight_units, e.size, e.size_units, e.width, e.height";
|
||||
$sql.= ", e.date_expedition as date_expedition, e.model_pdf, e.fk_address, e.date_delivery";
|
||||
$sql.= ", e.fk_expedition_methode, e.tracking_number";
|
||||
$sql.= ", e.fk_shipping_method, e.tracking_number";
|
||||
$sql.= ", el.fk_source as origin_id, el.sourcetype as origin";
|
||||
$sql.= ", e.note_private, e.note_public";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."expedition as e";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = e.rowid AND el.targettype = '".$this->element."'";
|
||||
$sql.= " WHERE e.entity = ".$conf->entity;
|
||||
@ -387,6 +395,9 @@ class Expedition extends CommonObject
|
||||
$this->height_units = $obj->size_units;
|
||||
$this->trueDepth = $obj->size;
|
||||
$this->depth_units = $obj->size_units;
|
||||
|
||||
$this->note_public = $obj->note_public;
|
||||
$this->note_private = $obj->note_private;
|
||||
|
||||
// A denormalized value
|
||||
$this->trueSize = $obj->size."x".$obj->width."x".$obj->height;
|
||||
@ -690,7 +701,8 @@ class Expedition extends CommonObject
|
||||
if (isset($this->size_units)) $this->size_units=trim($this->size_units);
|
||||
if (isset($this->weight_units)) $this->weight_units=trim($this->weight_units);
|
||||
if (isset($this->trueWeight)) $this->weight=trim($this->trueWeight);
|
||||
if (isset($this->note)) $this->note=trim($this->note);
|
||||
if (isset($this->note_private)) $this->note=trim($this->note_private);
|
||||
if (isset($this->note_public)) $this->note=trim($this->note_public);
|
||||
if (isset($this->model_pdf)) $this->model_pdf=trim($this->model_pdf);
|
||||
|
||||
|
||||
@ -721,7 +733,8 @@ class Expedition extends CommonObject
|
||||
$sql.= " size=".(($this->trueDepth != '')?$this->trueDepth:"null").",";
|
||||
$sql.= " weight_units=".(isset($this->weight_units)?$this->weight_units:"null").",";
|
||||
$sql.= " weight=".(($this->trueWeight != '')?$this->trueWeight:"null").",";
|
||||
$sql.= " note=".(isset($this->note)?"'".$this->db->escape($this->note)."'":"null").",";
|
||||
$sql.= " note_private=".(isset($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null").",";
|
||||
$sql.= " note_public=".(isset($this->note_public)?"'".$this->db->escape($this->note_public)."'":"null").",";
|
||||
$sql.= " model_pdf=".(isset($this->model_pdf)?"'".$this->db->escape($this->model_pdf)."'":"null").",";
|
||||
$sql.= " entity=".$conf->entity;
|
||||
|
||||
@ -1093,6 +1106,9 @@ class Expedition extends CommonObject
|
||||
|
||||
$this->origin_id = 1;
|
||||
$this->origin = 'commande';
|
||||
|
||||
$this->note_private = 'Private note';
|
||||
$this->note_public = 'Public note';
|
||||
|
||||
$nbp = 5;
|
||||
$xnbp = 0;
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -32,6 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/sendings.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/modules/expedition/modules_expedition.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||
@ -107,6 +109,8 @@ if ($action == 'add')
|
||||
$object->shipping_method_id = GETPOST('shipping_method_id','int');
|
||||
$object->tracking_number = GETPOST('tracking_number','alpha');
|
||||
$object->ref_int = GETPOST('ref_int','alpha');
|
||||
$object->note_private = GETPOST('note_private');
|
||||
$object->note_public = GETPOST('note_public');
|
||||
|
||||
$num=count($objectsrc->lines);
|
||||
$totalqty=0;
|
||||
@ -629,12 +633,22 @@ if ($action == 'create')
|
||||
print $form->select_date($object->date_livraison?$object->date_livraison:-1,'date_delivery',1,1);
|
||||
print "</td>\n";
|
||||
print '</tr>';
|
||||
|
||||
// Note Public
|
||||
print '<tr><td>'.$langs->trans("NotePublic").'</td>';
|
||||
print '<td colspan="3">';
|
||||
$doleditor = new DolEditor('note_public', $object->note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
|
||||
print $doleditor->Create(1);
|
||||
print "</td></tr>";
|
||||
|
||||
// Note
|
||||
if ($object->note && ! $user->societe_id)
|
||||
// Note Private
|
||||
if ($object->note_private && ! $user->societe_id)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("NotePrivate").'</td>';
|
||||
print '<td colspan="3">'.nl2br($object->note)."</td></tr>";
|
||||
print '<td colspan="3">';
|
||||
$doleditor = new DolEditor('note_private', $object->note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
|
||||
print $doleditor->Create(1);
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
// Weight
|
||||
|
||||
160
htdocs/expedition/note.php
Normal file
160
htdocs/expedition/note.php
Normal file
@ -0,0 +1,160 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/expedition/note.php
|
||||
* \ingroup expedition
|
||||
* \brief Note card expedition
|
||||
*/
|
||||
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', true);
|
||||
ini_set('html_errors', false);
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/sendings.lib.php';
|
||||
|
||||
$langs->load("sendings");
|
||||
$langs->load("companies");
|
||||
$langs->load("bills");
|
||||
$langs->load('deliveries');
|
||||
$langs->load('orders');
|
||||
$langs->load('stocks');
|
||||
$langs->load('other');
|
||||
$langs->load('propal');
|
||||
|
||||
$id=(GETPOST('id','int')?GETPOST('id','int'):GETPOST('facid','int')); // For backward compatibility
|
||||
$ref=GETPOST('ref','alpha');
|
||||
$action=GETPOST('action','alpha');
|
||||
|
||||
// Security check
|
||||
$socid='';
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result=restrictedArea($user, $origin, $origin_id);
|
||||
|
||||
$object = new Expedition($db);
|
||||
$object->fetch($id);
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/* Actions */
|
||||
/******************************************************************************/
|
||||
|
||||
if ($action == 'setnote_public' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES),'_public');
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
else if ($action == 'setnote_private' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES),'_private');
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/* Affichage fiche */
|
||||
/******************************************************************************/
|
||||
|
||||
llxHeader();
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($object->socid);
|
||||
|
||||
$head=shipping_prepare_head($object);
|
||||
dol_fiche_head($head, 'note', $langs->trans("Sending"), 0, 'sending');
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/expedition/liste.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
|
||||
print '<td colspan="3">';
|
||||
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref');
|
||||
print '</td></tr>';
|
||||
|
||||
// Customer
|
||||
print '<tr><td width="20%">'.$langs->trans("Customer").'</td>';
|
||||
print '<td colspan="3">'.$soc->getNomUrl(1).'</td>';
|
||||
print "</tr>";
|
||||
|
||||
// Linked documents
|
||||
if ($typeobject == 'commande' && $object->$typeobject->id && ! empty($conf->commande->enabled))
|
||||
{
|
||||
print '<tr><td>';
|
||||
$objectsrc=new Commande($db);
|
||||
$objectsrc->fetch($object->$typeobject->id);
|
||||
print $langs->trans("RefOrder").'</td>';
|
||||
print '<td colspan="3">';
|
||||
print $objectsrc->getNomUrl(1,'commande');
|
||||
print "</td>\n";
|
||||
print '</tr>';
|
||||
}
|
||||
if ($typeobject == 'propal' && $object->$typeobject->id && ! empty($conf->propal->enabled))
|
||||
{
|
||||
print '<tr><td>';
|
||||
$objectsrc=new Propal($db);
|
||||
$objectsrc->fetch($object->$typeobject->id);
|
||||
print $langs->trans("RefProposal").'</td>';
|
||||
print '<td colspan="3">';
|
||||
print $objectsrc->getNomUrl(1,'expedition');
|
||||
print "</td>\n";
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Ref customer
|
||||
print '<tr><td>'.$langs->trans("RefCustomer").'</td>';
|
||||
print '<td colspan="3">'.$object->ref_customer."</a></td>\n";
|
||||
print '</tr>';
|
||||
|
||||
// Date creation
|
||||
print '<tr><td>'.$langs->trans("DateCreation").'</td>';
|
||||
print '<td colspan="3">'.dol_print_date($object->date_creation,"day")."</td>\n";
|
||||
print '</tr>';
|
||||
|
||||
// Delivery date planed
|
||||
print '<tr><td>'.$langs->trans("DateDeliveryPlanned").'</td>';
|
||||
print '<td colspan="3">'.dol_print_date($object->date_delivery,"dayhourtext")."</td>\n";
|
||||
print '</tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
|
||||
|
||||
dol_fiche_end();
|
||||
}
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -39,6 +40,7 @@ if (! empty($conf->global->FICHEINTER_ADDON) && is_readable(DOL_DOCUMENT_ROOT ."
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT ."/core/modules/fichinter/mod_".$conf->global->FICHEINTER_ADDON.'.php';
|
||||
}
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
|
||||
$langs->load("companies");
|
||||
$langs->load("interventions");
|
||||
@ -378,7 +380,7 @@ else if ($action == 'setdescription' && $user->rights->ficheinter->creer)
|
||||
else if ($action == 'setnote_public' && $user->rights->ficheinter->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES),'_public');
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
else if ($action == 'setnote_private' && $user->rights->ficheinter->creer)
|
||||
@ -977,16 +979,20 @@ if ($action == 'create')
|
||||
print '<tr>';
|
||||
print '<td class="border" valign="top">'.$langs->trans('NotePublic').'</td>';
|
||||
print '<td valign="top" colspan="2">';
|
||||
print '<textarea name="note_public" cols="80" rows="'.ROWS_3.'">'.$note_public.'</textarea>';
|
||||
$doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
|
||||
print $doleditor->Create(1);
|
||||
//print '<textarea name="note_public" cols="80" rows="'.ROWS_3.'">'.$note_public.'</textarea>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Private note
|
||||
if (! $user->societe_id)
|
||||
if (!empty($user->societe_id))
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td class="border" valign="top">'.$langs->trans('NotePrivate').'</td>';
|
||||
print '<td valign="top" colspan="2">';
|
||||
print '<textarea name="note_private" cols="80" rows="'.ROWS_3.'">'.$note_private.'</textarea>';
|
||||
$doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
|
||||
print $doleditor->Create(1);
|
||||
//print '<textarea name="note_private" cols="80" rows="'.ROWS_3.'">'.$note_private.'</textarea>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -47,13 +48,13 @@ $object->fetch($id,$ref);
|
||||
|
||||
if ($action == 'setnote_public' && $user->rights->ficheinter->creer)
|
||||
{
|
||||
$result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES),'_public');
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
else if ($action == 'setnote_private' && $user->rights->ficheinter->creer)
|
||||
{
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES));
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES),'_private');
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2013 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -121,7 +122,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
$sql.= " c.date_creation, c.date_valid, c.date_approve,";
|
||||
$sql.= " c.fk_user_author, c.fk_user_valid, c.fk_user_approve,";
|
||||
$sql.= " c.date_commande as date_commande, c.date_livraison as date_livraison, c.fk_cond_reglement, c.fk_mode_reglement, c.fk_projet as fk_project, c.remise_percent, c.source, c.fk_input_method,";
|
||||
$sql.= " c.note as note_private, c.note_public, c.model_pdf, c.extraparams,";
|
||||
$sql.= " c.note_private, c.note_public, c.model_pdf, c.extraparams,";
|
||||
$sql.= " cm.libelle as methode_commande,";
|
||||
$sql.= " cr.code as cond_reglement_code, cr.libelle as cond_reglement_libelle,";
|
||||
$sql.= " p.code as mode_reglement_code, p.libelle as mode_reglement_libelle";
|
||||
@ -602,7 +603,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
|
||||
/**
|
||||
* Renvoie la reference de commande suivante non utilisee en fonction du modele
|
||||
* de numerotation actif defini dans COMMANDE_SUPPLIER_ADDON
|
||||
* de numerotation actif defini dans COMMANDE_SUPPLIER_ADDON_NUMBER
|
||||
*
|
||||
* @param Societe $soc objet societe
|
||||
* @return string reference libre pour la facture
|
||||
@ -614,14 +615,14 @@ class CommandeFournisseur extends CommonOrder
|
||||
|
||||
$dir = DOL_DOCUMENT_ROOT .'/core/modules/supplier_order/';
|
||||
|
||||
if (! empty($conf->global->COMMANDE_SUPPLIER_ADDON))
|
||||
if (! empty($conf->global->COMMANDE_SUPPLIER_ADDON_NUMBER))
|
||||
{
|
||||
$file = $conf->global->COMMANDE_SUPPLIER_ADDON.'.php';
|
||||
$file = $conf->global->COMMANDE_SUPPLIER_ADDON_NUMBER.'.php';
|
||||
|
||||
if (is_readable($dir.'/'.$file))
|
||||
{
|
||||
// Definition du nom de modele de numerotation de commande fournisseur
|
||||
$modName=$conf->global->COMMANDE_SUPPLIER_ADDON;
|
||||
$modName=$conf->global->COMMANDE_SUPPLIER_ADDON_NUMBER;
|
||||
require_once $dir.'/'.$file;
|
||||
|
||||
// Recuperation de la nouvelle reference
|
||||
@ -642,7 +643,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("Error")." ".$langs->trans("Error_FailedToLoad_COMMANDE_SUPPLIER_ADDON_File",$conf->global->COMMANDE_SUPPLIER_ADDON);
|
||||
print $langs->trans("Error")." ".$langs->trans("Error_FailedToLoad_COMMANDE_SUPPLIER_ADDON_File",$conf->global->COMMANDE_SUPPLIER_ADDON_NUMBER);
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
@ -927,7 +928,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_fournisseur (";
|
||||
$sql.= "ref";
|
||||
$sql.= ", ref_supplier";
|
||||
$sql.= ", note";
|
||||
$sql.= ", note_private";
|
||||
$sql.= ", note_public";
|
||||
$sql.= ", entity";
|
||||
$sql.= ", fk_soc";
|
||||
@ -942,7 +943,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
$sql.= " VALUES (";
|
||||
$sql.= "''";
|
||||
$sql.= ", '".$this->ref_supplier."'";
|
||||
$sql.= ", '".$this->note."'";
|
||||
$sql.= ", '".$this->note_private."'";
|
||||
$sql.= ", '".$this->note_public."'";
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ", ".$this->socid;
|
||||
@ -1874,7 +1875,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
$this->cond_reglement_code = 'RECEP';
|
||||
$this->mode_reglement_code = 'CHQ';
|
||||
$this->note_public='This is a comment (public)';
|
||||
$this->note='This is a comment (private)';
|
||||
$this->note_private='This is a comment (private)';
|
||||
// Lines
|
||||
$nbp = 5;
|
||||
$xnbp = 0;
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -140,7 +141,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
$sql.= ", fk_soc";
|
||||
$sql.= ", datec";
|
||||
$sql.= ", datef";
|
||||
$sql.= ", note";
|
||||
$sql.= ", note_private";
|
||||
$sql.= ", note_public";
|
||||
$sql.= ", fk_user_author";
|
||||
$sql.= ", date_lim_reglement";
|
||||
@ -153,7 +154,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
$sql.= ", ".$this->socid;
|
||||
$sql.= ", '".$this->db->idate($now)."'";
|
||||
$sql.= ", '".$this->db->idate($this->date)."'";
|
||||
$sql.= ", '".$this->db->escape($this->note)."'";
|
||||
$sql.= ", '".$this->db->escape($this->note_private)."'";
|
||||
$sql.= ", '".$this->db->escape($this->note_public)."'";
|
||||
$sql.= ", ".$user->id.",";
|
||||
$sql.= $this->date_echeance!=''?"'".$this->db->idate($this->date_echeance)."'":"null";
|
||||
@ -297,7 +298,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
$sql.= " t.fk_projet,";
|
||||
$sql.= " t.fk_cond_reglement,";
|
||||
$sql.= " t.date_lim_reglement,";
|
||||
$sql.= " t.note as note_private,";
|
||||
$sql.= " t.note_private,";
|
||||
$sql.= " t.note_public,";
|
||||
$sql.= " t.model_pdf,";
|
||||
$sql.= " t.import_key,";
|
||||
@ -496,7 +497,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
if (isset($this->fk_facture_source)) $this->fk_facture_source=trim($this->fk_facture_source);
|
||||
if (isset($this->fk_project)) $this->fk_project=trim($this->fk_project);
|
||||
if (isset($this->fk_cond_reglement)) $this->fk_cond_reglement=trim($this->fk_cond_reglement);
|
||||
if (isset($this->note)) $this->note=trim($this->note);
|
||||
if (isset($this->note_private)) $this->note=trim($this->note_private);
|
||||
if (isset($this->note_public)) $this->note_public=trim($this->note_public);
|
||||
if (isset($this->model_pdf)) $this->model_pdf=trim($this->model_pdf);
|
||||
if (isset($this->import_key)) $this->import_key=trim($this->import_key);
|
||||
@ -535,7 +536,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
$sql.= " fk_projet=".(isset($this->fk_project)?$this->fk_project:"null").",";
|
||||
$sql.= " fk_cond_reglement=".(isset($this->fk_cond_reglement)?$this->fk_cond_reglement:"null").",";
|
||||
$sql.= " date_lim_reglement=".(dol_strlen($this->date_echeance)!=0 ? "'".$this->db->idate($this->date_echeance)."'" : 'null').",";
|
||||
$sql.= " note=".(isset($this->note)?"'".$this->db->escape($this->note)."'":"null").",";
|
||||
$sql.= " note_private=".(isset($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null").",";
|
||||
$sql.= " note_public=".(isset($this->note_public)?"'".$this->db->escape($this->note_public)."'":"null").",";
|
||||
$sql.= " model_pdf=".(isset($this->model_pdf)?"'".$this->db->escape($this->model_pdf)."'":"null").",";
|
||||
$sql.= " import_key=".(isset($this->import_key)?"'".$this->db->escape($this->import_key)."'":"null")."";
|
||||
@ -1433,7 +1434,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
$this->cond_reglement_code = 'RECEP';
|
||||
$this->mode_reglement_code = 'CHQ';
|
||||
$this->note_public='This is a comment (public)';
|
||||
$this->note='This is a comment (private)';
|
||||
$this->note_private='This is a comment (private)';
|
||||
// Lines
|
||||
$nbp = 5;
|
||||
$xnbp = 0;
|
||||
|
||||
@ -146,6 +146,7 @@ class ProductFournisseur extends Product
|
||||
* @param string $charges costs affering to product
|
||||
* @param float $remise_percent Discount regarding qty (percent)
|
||||
* @param float $remise Discount regarding qty (amount)
|
||||
* @param int $newnpr Set NPR or not
|
||||
* @return int <0 if KO, >=0 if OK
|
||||
*/
|
||||
function update_buyprice($qty, $buyprice, $user, $price_base_type, $fourn, $availability, $ref_fourn, $tva_tx, $charges=0, $remise_percent=0, $remise=0, $newnpr=0)
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -37,6 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
if (!empty($conf->produit->enabled))
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
if (!empty($conf->projet->enabled))
|
||||
@ -138,13 +140,13 @@ else if ($action == 'setremisepercent' && $user->rights->fournisseur->commande->
|
||||
|
||||
else if ($action == 'setnote_public' && $user->rights->fournisseur->commande->creer)
|
||||
{
|
||||
$result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES),'_public');
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
else if ($action == 'setnote' && $user->rights->fournisseur->commande->creer)
|
||||
else if ($action == 'setnote_private' && $user->rights->fournisseur->commande->creer)
|
||||
{
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES),'_private');
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
@ -675,7 +677,7 @@ else if ($action == 'add' && $user->rights->fournisseur->commande->creer)
|
||||
// Creation commande
|
||||
$object->ref_supplier = GETPOST('refsupplier');
|
||||
$object->socid = $socid;
|
||||
$object->note = GETPOST('note');
|
||||
$object->note_private = GETPOST('note_private');
|
||||
$object->note_public = GETPOST('note_public');
|
||||
|
||||
$id = $object->create($user);
|
||||
@ -997,15 +999,25 @@ if ($action=="create")
|
||||
print '</tr>';
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Note').'</td>';
|
||||
print '<td><textarea name="note" wrap="soft" cols="60" rows="'.ROWS_5.'"></textarea></td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
print '<tr><td>'.$langs->trans('NotePublic').'</td>';
|
||||
print '<td><textarea name="note_public" wrap="soft" cols="60" rows="'.ROWS_5.'"></textarea></td>';
|
||||
print '<td>';
|
||||
$doleditor = new DolEditor('note_public', GETPOST('note_public'), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
|
||||
print $doleditor->Create(1);
|
||||
print '</td>';
|
||||
//print '<textarea name="note_public" wrap="soft" cols="60" rows="'.ROWS_5.'"></textarea>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('NotePrivate').'</td>';
|
||||
print '<td>';
|
||||
$doleditor = new DolEditor('note_private', GETPOST('note_private'), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
|
||||
print $doleditor->Create(1);
|
||||
print '</td>';
|
||||
//print '<td><textarea name="note_private" wrap="soft" cols="60" rows="'.ROWS_5.'"></textarea></td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
|
||||
// Other options
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
@ -1504,9 +1516,7 @@ elseif (! empty($object->id))
|
||||
$parameters=array('fk_parent_line'=>$line->fk_parent_line, 'line'=>$line,'var'=>$var,'num'=>$num,'i'=>$i);
|
||||
$reshook=$hookmanager->executeHooks('formEditProductOptions',$parameters,$object,$action);
|
||||
}
|
||||
|
||||
// Description - Editor wysiwyg
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
|
||||
$nbrows=ROWS_2;
|
||||
if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT;
|
||||
$doleditor=new DolEditor('eldesc',$line->description,'',200,'dolibarr_details','',false,true,$conf->global->FCKEDITOR_ENABLE_DETAILS,$nbrows,70);
|
||||
@ -1532,8 +1542,6 @@ elseif (! empty($object->id))
|
||||
*/
|
||||
if ($object->statut == 0 && $user->rights->fournisseur->commande->creer && $action <> 'editline')
|
||||
{
|
||||
//WYSIWYG Editor
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>';
|
||||
|
||||
@ -51,7 +51,7 @@ $object->fetch($id, $ref);
|
||||
|
||||
if ($action == 'setnote_public' && $user->rights->fournisseur->commande->creer)
|
||||
{
|
||||
$result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES),'_public');
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
elseif ($action == 'setnote' && $user->rights->fournisseur->commande->creer)
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -35,6 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
if (!empty($conf->produit->enabled))
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
if (!empty($conf->projet->enabled))
|
||||
@ -209,13 +211,13 @@ elseif ($action == 'setdate_lim_reglement' && $user->rights->fournisseur->factur
|
||||
elseif ($action == 'setnote_public' && $user->rights->fournisseur->facture->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES),'_public');
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
elseif ($action == 'setnote' && $user->rights->fournisseur->facture->creer)
|
||||
elseif ($action == 'setnote_private' && $user->rights->fournisseur->facture->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES),'_private');
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
@ -273,7 +275,8 @@ elseif ($action == 'add' && $user->rights->fournisseur->facture->creer)
|
||||
$object->libelle = $_POST['libelle'];
|
||||
$object->date = $datefacture;
|
||||
$object->date_echeance = $datedue;
|
||||
$object->note_public = $_POST['note'];
|
||||
$object->note_public = GETPOST('note_public');
|
||||
$object->note_private = GETPOST('note_private');
|
||||
|
||||
// If creation from another object of another module
|
||||
if ($_POST['origin'] && $_POST['originid'])
|
||||
@ -1152,7 +1155,20 @@ if ($action == 'create')
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('NotePublic').'</td>';
|
||||
print '<td><textarea name="note" wrap="soft" cols="60" rows="'.ROWS_5.'"></textarea></td>';
|
||||
print '<td>';
|
||||
$doleditor = new DolEditor('note_public', GETPOST('note_public'), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
|
||||
print $doleditor->Create(1);
|
||||
print '</td>';
|
||||
// print '<td><textarea name="note" wrap="soft" cols="60" rows="'.ROWS_5.'"></textarea></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Private note
|
||||
print '<tr><td>'.$langs->trans('NotePrivate').'</td>';
|
||||
print '<td>';
|
||||
$doleditor = new DolEditor('note_private', GETPOST('note_private'), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
|
||||
print $doleditor->Create(1);
|
||||
print '</td>';
|
||||
// print '<td><textarea name="note" wrap="soft" cols="60" rows="'.ROWS_5.'"></textarea></td>';
|
||||
print '</tr>';
|
||||
|
||||
if (is_object($objectsrc))
|
||||
@ -1702,8 +1718,6 @@ else
|
||||
$reshook=$hookmanager->executeHooks('formEditProductOptions',$parameters,$object,$action);
|
||||
}
|
||||
|
||||
// Description - Editor wysiwyg
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$nbrows=ROWS_2;
|
||||
if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT;
|
||||
$doleditor=new DolEditor('desc',$object->lines[$i]->description,'',128,'dolibarr_details','',false,true,$conf->global->FCKEDITOR_ENABLE_DETAILS,$nbrows,70);
|
||||
@ -1849,8 +1863,6 @@ else
|
||||
$reshook=$hookmanager->executeHooks('formCreateSupplierProductOptions',$parameters,$object,$action);
|
||||
}
|
||||
|
||||
// Editor wysiwyg
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$nbrows=ROWS_2;
|
||||
if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT;
|
||||
$doleditor=new DolEditor('dp_desc',GETPOST("dp_desc"),'',100,'dolibarr_details','',false,true,$conf->global->FCKEDITOR_ENABLE_DETAILS,$nbrows,70);
|
||||
|
||||
@ -2,26 +2,27 @@
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/fourn/facture/note.php
|
||||
* \ingroup facture
|
||||
* \brief Fiche de notes sur une facture fournisseur
|
||||
*/
|
||||
* \brief Fiche de notes sur une facture fournisseur
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php';
|
||||
@ -50,21 +51,21 @@ $object->fetch($id,$ref);
|
||||
|
||||
if ($action == 'setnote_public' && $user->rights->fournisseur->facture->creer)
|
||||
{
|
||||
$result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES),'_public');
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
elseif ($action == 'setnote' && $user->rights->fournisseur->facture->creer)
|
||||
elseif ($action == 'setnote_private' && $user->rights->fournisseur->facture->creer)
|
||||
{
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES),'_private');
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
// Set label
|
||||
if ($action == 'setlabel' && $user->rights->fournisseur->facture->creer)
|
||||
{
|
||||
$object->label=$_POST['label'];
|
||||
$result=$object->update($user);
|
||||
if ($result < 0) dol_print_error($db);
|
||||
$object->label=$_POST['label'];
|
||||
$result=$object->update($user);
|
||||
if ($result < 0) dol_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
@ -78,82 +79,82 @@ llxHeader();
|
||||
|
||||
if ($id)
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$head = facturefourn_prepare_head($object);
|
||||
$titre=$langs->trans('SupplierInvoice');
|
||||
dol_fiche_head($head, 'note', $titre, 0, 'bill');
|
||||
$head = facturefourn_prepare_head($object);
|
||||
$titre=$langs->trans('SupplierInvoice');
|
||||
dol_fiche_head($head, 'note', $titre, 0, 'bill');
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/fourn/facture/index.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/fourn/facture/index.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="20%" nowrap="nowrap">'.$langs->trans("Ref").'</td><td colspan="3">';
|
||||
print $form->showrefnav($object, 'facid', $linkback, 1, 'rowid', 'ref', $morehtmlref);
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
// Ref
|
||||
print '<tr><td width="20%" nowrap="nowrap">'.$langs->trans("Ref").'</td><td colspan="3">';
|
||||
print $form->showrefnav($object, 'facid', $linkback, 1, 'rowid', 'ref', $morehtmlref);
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Ref supplier
|
||||
print '<tr><td nowrap="nowrap">'.$langs->trans("RefSupplier").'</td><td colspan="3">'.$object->ref_supplier.'</td>';
|
||||
print "</tr>\n";
|
||||
// Ref supplier
|
||||
print '<tr><td nowrap="nowrap">'.$langs->trans("RefSupplier").'</td><td colspan="3">'.$object->ref_supplier.'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Company
|
||||
print '<tr><td>'.$langs->trans('Supplier').'</td><td colspan="3">'.$object->thirdparty->getNomUrl(1).'</td></tr>';
|
||||
// Company
|
||||
print '<tr><td>'.$langs->trans('Supplier').'</td><td colspan="3">'.$object->thirdparty->getNomUrl(1).'</td></tr>';
|
||||
|
||||
// Type
|
||||
print '<tr><td>'.$langs->trans('Type').'</td><td colspan="4">';
|
||||
print $object->getLibType();
|
||||
if ($object->type == 1)
|
||||
{
|
||||
$facreplaced=new FactureFournisseur($db);
|
||||
$facreplaced->fetch($object->fk_facture_source);
|
||||
print ' ('.$langs->transnoentities("ReplaceInvoice",$facreplaced->getNomUrl(1)).')';
|
||||
}
|
||||
if ($object->type == 2)
|
||||
{
|
||||
$facusing=new FactureFournisseur($db);
|
||||
$facusing->fetch($object->fk_facture_source);
|
||||
print ' ('.$langs->transnoentities("CorrectInvoice",$facusing->getNomUrl(1)).')';
|
||||
}
|
||||
// Type
|
||||
print '<tr><td>'.$langs->trans('Type').'</td><td colspan="4">';
|
||||
print $object->getLibType();
|
||||
if ($object->type == 1)
|
||||
{
|
||||
$facreplaced=new FactureFournisseur($db);
|
||||
$facreplaced->fetch($object->fk_facture_source);
|
||||
print ' ('.$langs->transnoentities("ReplaceInvoice",$facreplaced->getNomUrl(1)).')';
|
||||
}
|
||||
if ($object->type == 2)
|
||||
{
|
||||
$facusing=new FactureFournisseur($db);
|
||||
$facusing->fetch($object->fk_facture_source);
|
||||
print ' ('.$langs->transnoentities("CorrectInvoice",$facusing->getNomUrl(1)).')';
|
||||
}
|
||||
|
||||
$facidavoir=$object->getListIdAvoirFromInvoice();
|
||||
if (count($facidavoir) > 0)
|
||||
{
|
||||
print ' ('.$langs->transnoentities("InvoiceHasAvoir");
|
||||
$i=0;
|
||||
foreach($facidavoir as $fid)
|
||||
{
|
||||
if ($i==0) print ' ';
|
||||
else print ',';
|
||||
$facavoir=new FactureFournisseur($db);
|
||||
$facavoir->fetch($fid);
|
||||
print $facavoir->getNomUrl(1);
|
||||
}
|
||||
print ')';
|
||||
}
|
||||
if ($facidnext > 0)
|
||||
{
|
||||
$facthatreplace=new FactureFournisseur($db);
|
||||
$facthatreplace->fetch($facidnext);
|
||||
print ' ('.$langs->transnoentities("ReplacedByInvoice",$facthatreplace->getNomUrl(1)).')';
|
||||
}
|
||||
print '</td></tr>';
|
||||
$facidavoir=$object->getListIdAvoirFromInvoice();
|
||||
if (count($facidavoir) > 0)
|
||||
{
|
||||
print ' ('.$langs->transnoentities("InvoiceHasAvoir");
|
||||
$i=0;
|
||||
foreach($facidavoir as $fid)
|
||||
{
|
||||
if ($i==0) print ' ';
|
||||
else print ',';
|
||||
$facavoir=new FactureFournisseur($db);
|
||||
$facavoir->fetch($fid);
|
||||
print $facavoir->getNomUrl(1);
|
||||
}
|
||||
print ')';
|
||||
}
|
||||
if ($facidnext > 0)
|
||||
{
|
||||
$facthatreplace=new FactureFournisseur($db);
|
||||
$facthatreplace->fetch($facidnext);
|
||||
print ' ('.$langs->transnoentities("ReplacedByInvoice",$facthatreplace->getNomUrl(1)).')';
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td>'.$form->editfieldkey("Label",'label',$object->label,$object,0).'</td><td colspan="3">';
|
||||
print $form->editfieldval("Label",'label',$object->label,$object,0);
|
||||
print '</td>';
|
||||
// Label
|
||||
print '<tr><td>'.$form->editfieldkey("Label",'label',$object->label,$object,0).'</td><td colspan="3">';
|
||||
print $form->editfieldval("Label",'label',$object->label,$object,0);
|
||||
print '</td>';
|
||||
|
||||
print "</table>";
|
||||
print "</table>";
|
||||
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
$colwidth=20;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
|
||||
$colwidth=20;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
|
||||
|
||||
dol_fiche_end();
|
||||
dol_fiche_end();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com>
|
||||
* Copyright (C) 2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -192,7 +193,7 @@ class Holiday extends CommonObject
|
||||
$sql.= " cp.date_cancel,";
|
||||
$sql.= " cp.fk_user_cancel,";
|
||||
$sql.= " cp.detail_refuse,";
|
||||
$sql.= " cp.note,";
|
||||
$sql.= " cp.note_private,";
|
||||
$sql.= " cp.note_public";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."holiday as cp";
|
||||
$sql.= " WHERE cp.rowid = ".$id;
|
||||
@ -223,7 +224,7 @@ class Holiday extends CommonObject
|
||||
$this->date_cancel = $this->db->jdate($obj->date_cancel);
|
||||
$this->fk_user_cancel = $obj->fk_user_cancel;
|
||||
$this->detail_refuse = $obj->detail_refuse;
|
||||
$this->note = $obj->note;
|
||||
$this->note_private = $obj->note_private;
|
||||
$this->note_public = $obj->note_public;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
@ -1,6 +1,4 @@
|
||||
<?php
|
||||
require_once 'zip/PclZipProxy.php';
|
||||
require_once 'zip/PhpZipProxy.php';
|
||||
require 'Segment.php';
|
||||
class OdfException extends Exception
|
||||
{}
|
||||
@ -129,6 +127,33 @@ class Odf
|
||||
$this->vars[$tag] = str_replace("\n", "<text:line-break/>", $value);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Assing a template variable
|
||||
*
|
||||
* @param string $key name of the variable within the template
|
||||
* @param string $value replacement value
|
||||
* @param bool $encode if true, special XML characters are encoded
|
||||
* @throws OdfException
|
||||
* @return odf
|
||||
*/
|
||||
public function setVarsHeadFooter($key, $value, $encode = true, $charset = 'ISO-8859')
|
||||
{
|
||||
$tag = $this->config['DELIMITER_LEFT'] . $key . $this->config['DELIMITER_RIGHT'];
|
||||
// TODO Warning string may be:
|
||||
// <text:span text:style-name="T13">{</text:span><text:span text:style-name="T12">aaa</text:span><text:span text:style-name="T13">}</text:span>
|
||||
// instead of {aaa} so we should enhance this function.
|
||||
//print $key.'-'.$value.'-'.strpos($this->contentXml, $this->config['DELIMITER_LEFT'] . $key . $this->config['DELIMITER_RIGHT']).'<br>';
|
||||
if (strpos($this->stylesXml, $tag) === false && strpos($this->stylesXml , $tag) === false) {
|
||||
//if (strpos($this->contentXml, '">'. $key . '</text;span>') === false) {
|
||||
throw new OdfException("var $key not found in the document");
|
||||
//}
|
||||
}
|
||||
$value = $encode ? htmlspecialchars($value) : $value;
|
||||
$value = ($charset == 'ISO-8859') ? utf8_encode($value) : $value;
|
||||
$this->vars[$tag] = str_replace("\n", "<text:line-break/>", $value);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Evaluating php codes inside the ODT and output the buffer (print, echo) inplace of the code
|
||||
|
||||
@ -26,18 +26,18 @@ create table llx_adherent_type_extrafields
|
||||
) ENGINE=innodb;
|
||||
ALTER TABLE llx_adherent_type_extrafields ADD INDEX idx_adherent_type_extrafields (fk_object);
|
||||
|
||||
UPDATE llx_const set value='eldy_menu.php' where value='eldy_backoffice.php';
|
||||
UPDATE llx_const set value='eldy_menu.php' where value='eldy_frontoffice.php';
|
||||
UPDATE llx_const set value='auguria_menu.php' where value='auguria_backoffice.php';
|
||||
UPDATE llx_const set value='auguria_menu.php' where value='auguria_frontoffice.php';
|
||||
UPDATE llx_const set value='smartphone_menu.php' where value='smartphone_backoffice.php';
|
||||
UPDATE llx_const set value='smartphone_menu.php' where value='smartphone_frontoffice.php';
|
||||
UPDATE llx_const set name='MAIN_INFO_SOCIETE_ADDRESS' where name='MAIN_INFO_SOCIETE_ADRESSE';
|
||||
UPDATE llx_const set name='MAIN_INFO_SOCIETE_TOWN' where name='MAIN_INFO_SOCIETE_VILLE';
|
||||
UPDATE llx_const set name='MAIN_INFO_SOCIETE_ZIP' where name='MAIN_INFO_SOCIETE_CP';
|
||||
UPDATE llx_const set name='MAIN_INFO_SOCIETE_COUNTRY' where name='MAIN_INFO_SOCIETE_PAYS';
|
||||
UPDATE llx_const set name='MAIN_INFO_SOCIETE_STATE' where name='MAIN_INFO_SOCIETE_DEPARTEMENT';
|
||||
UPDATE llx_const set name='LIVRAISON_ADDON_NUMBER' where name='LIVRAISON_ADDON';
|
||||
UPDATE llx_const set value = __ENCRYPT('eldy_menu.php')__ where __DECRYPT('value')__ = 'eldy_backoffice.php';
|
||||
UPDATE llx_const set value = __ENCRYPT('eldy_menu.php')__ where __DECRYPT('value')__ = 'eldy_frontoffice.php';
|
||||
UPDATE llx_const set value = __ENCRYPT('auguria_menu.php')__ where __DECRYPT('value')__ = 'auguria_backoffice.php';
|
||||
UPDATE llx_const set value = __ENCRYPT('auguria_menu.php')__ where __DECRYPT('value')__ = 'auguria_frontoffice.php';
|
||||
UPDATE llx_const set value = __ENCRYPT('smartphone_menu.php')__ where __DECRYPT('value')__ = 'smartphone_backoffice.php';
|
||||
UPDATE llx_const set value = __ENCRYPT('smartphone_menu.php')__ where __DECRYPT('value')__ = 'smartphone_frontoffice.php';
|
||||
UPDATE llx_const set name = __ENCRYPT('MAIN_INFO_SOCIETE_ADDRESS')__ where __DECRYPT('name')__ = 'MAIN_INFO_SOCIETE_ADRESSE';
|
||||
UPDATE llx_const set name = __ENCRYPT('MAIN_INFO_SOCIETE_TOWN')__ where __DECRYPT('name')__ = 'MAIN_INFO_SOCIETE_VILLE';
|
||||
UPDATE llx_const set name = __ENCRYPT('MAIN_INFO_SOCIETE_ZIP')__ where __DECRYPT('name')__ = 'MAIN_INFO_SOCIETE_CP';
|
||||
UPDATE llx_const set name = __ENCRYPT('MAIN_INFO_SOCIETE_COUNTRY')__ where __DECRYPT('name')__ = 'MAIN_INFO_SOCIETE_PAYS';
|
||||
UPDATE llx_const set name = __ENCRYPT('MAIN_INFO_SOCIETE_STATE')__ where __DECRYPT('name')__ = 'MAIN_INFO_SOCIETE_DEPARTEMENT';
|
||||
UPDATE llx_const set name = __ENCRYPT('LIVRAISON_ADDON_NUMBER')__ where __DECRYPT('name')__ = 'LIVRAISON_ADDON';
|
||||
|
||||
ALTER TABLE llx_user add COLUMN fk_user integer;
|
||||
|
||||
@ -204,26 +204,28 @@ CREATE TABLE llx_cronjob
|
||||
|
||||
ALTER TABLE llx_societe MODIFY COLUMN zip varchar(25);
|
||||
|
||||
ALTER TABLE llx_user ADD COLUMN address varchar(255);
|
||||
ALTER TABLE llx_user ADD COLUMN zip varchar(25);
|
||||
ALTER TABLE llx_user ADD COLUMN town varchar(50);
|
||||
ALTER TABLE llx_user ADD COLUMN fk_state integer DEFAULT 0;
|
||||
ALTER TABLE llx_user ADD COLUMN fk_country integer DEFAULT 0;
|
||||
ALTER TABLE llx_user ADD COLUMN address varchar(255);
|
||||
ALTER TABLE llx_user ADD COLUMN zip varchar(25);
|
||||
ALTER TABLE llx_user ADD COLUMN town varchar(50);
|
||||
ALTER TABLE llx_user ADD COLUMN fk_state integer DEFAULT 0;
|
||||
ALTER TABLE llx_user ADD COLUMN fk_country integer DEFAULT 0;
|
||||
ALTER TABLE llx_user ADD COLUMN color varchar(6);
|
||||
|
||||
ALTER TABLE llx_product_price ADD COLUMN import_key varchar(14) AFTER price_by_qty;
|
||||
|
||||
DROP TABLE llx_printer_ipp;
|
||||
CREATE TABLE llx_printer_ipp
|
||||
(
|
||||
rowid int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
tms timestamp,
|
||||
datec datetime,
|
||||
printer_name text NOT NULL,
|
||||
printer_location text NOT NULL,
|
||||
printer_uri varchar(256) NOT NULL,
|
||||
copy int(11) NOT NULL DEFAULT '1',
|
||||
copy integer NOT NULL DEFAULT '1',
|
||||
module varchar(16) NOT NULL,
|
||||
login varchar(32) NOT NULL
|
||||
)ENGINE=innodb;
|
||||
) ENGINE=innodb;
|
||||
|
||||
ALTER TABLE llx_socpeople ADD COLUMN ref_ext varchar(128) after entity;
|
||||
|
||||
@ -243,3 +245,21 @@ ALTER TABLE llx_facture_fourn_det ADD COLUMN info_bits integer NOT NULL DEFAULT
|
||||
ALTER TABLE llx_actioncomm ADD COLUMN transparency integer after fk_user_action;
|
||||
|
||||
INSERT INTO llx_c_action_trigger (rowid,code,label,description,elementtype,rang) VALUES (29,'FICHINTER_SENTBYMAIL','Intervention sent by mail','Executed when a intervention is sent by mail','ficheinter',29);
|
||||
|
||||
ALTER TABLE llx_adherent ADD COLUMN canvas varchar(32) after fk_user_valid;
|
||||
|
||||
ALTER TABLE llx_expedition CHANGE COLUMN note note_private text;
|
||||
ALTER TABLE llx_expedition ADD COLUMN note_public text after note_private;
|
||||
ALTER TABLE llx_livraison CHANGE COLUMN note note_private text;
|
||||
ALTER TABLE llx_facture CHANGE COLUMN note note_private text;
|
||||
ALTER TABLE llx_commande CHANGE COLUMN note note_private text;
|
||||
ALTER TABLE llx_propal CHANGE COLUMN note note_private text;
|
||||
ALTER TABLE llx_commande_fournisseur CHANGE COLUMN note note_private text;
|
||||
ALTER TABLE llx_contrat CHANGE COLUMN note note_private text;
|
||||
ALTER TABLE llx_deplacement CHANGE COLUMN note note_private text;
|
||||
ALTER TABLE llx_don CHANGE COLUMN note note_private text;
|
||||
ALTER TABLE llx_facture_fourn CHANGE COLUMN note note_private text;
|
||||
ALTER TABLE llx_facture_rec CHANGE COLUMN note note_private text;
|
||||
ALTER TABLE llx_holiday CHANGE COLUMN note note_private text;
|
||||
ALTER TABLE llx_societe CHANGE COLUMN note note_private text;
|
||||
ALTER TABLE llx_socpeople CHANGE COLUMN note note_private text;
|
||||
|
||||
@ -50,7 +50,7 @@ create table llx_commande
|
||||
localtax2 double(24,8) default 0, -- total localtax2
|
||||
total_ht double(24,8) default 0,
|
||||
total_ttc double(24,8) default 0,
|
||||
note text,
|
||||
note_private text,
|
||||
note_public text,
|
||||
model_pdf varchar(255),
|
||||
|
||||
|
||||
@ -50,7 +50,7 @@ create table llx_commande_fournisseur
|
||||
localtax2 double(24,8) default 0,
|
||||
total_ht double(24,8) default 0,
|
||||
total_ttc double(24,8) default 0,
|
||||
note text,
|
||||
note_private text,
|
||||
note_public text,
|
||||
model_pdf varchar(255),
|
||||
|
||||
@ -61,4 +61,4 @@ create table llx_commande_fournisseur
|
||||
import_key varchar(14),
|
||||
extraparams varchar(255) -- for stock other parameters with json format
|
||||
|
||||
)ENGINE=innodb;
|
||||
)ENGINE=innodb;
|
||||
|
||||
@ -37,7 +37,7 @@ create table llx_contrat
|
||||
fk_user_author integer NOT NULL default 0,
|
||||
fk_user_mise_en_service integer,
|
||||
fk_user_cloture integer,
|
||||
note text,
|
||||
note_private text,
|
||||
note_public text,
|
||||
import_key varchar(14),
|
||||
extraparams varchar(255) -- for stock other parameters with json format
|
||||
|
||||
@ -34,7 +34,7 @@ create table llx_deplacement
|
||||
km real,
|
||||
fk_soc integer,
|
||||
fk_projet integer DEFAULT 0,
|
||||
note text,
|
||||
note_private text,
|
||||
note_public text,
|
||||
extraparams varchar(255) -- for stock other parameters with json format
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ create table llx_don
|
||||
fk_don_projet integer NULL, -- projet auquel est fait le don
|
||||
fk_user_author integer NOT NULL,
|
||||
fk_user_valid integer NULL,
|
||||
note text,
|
||||
note_private text,
|
||||
note_public text,
|
||||
model_pdf varchar(255),
|
||||
import_key varchar(14)
|
||||
|
||||
@ -48,7 +48,8 @@ create table llx_expedition
|
||||
size integer, -- depth
|
||||
weight_units integer, -- unit of weight
|
||||
weight integer, -- weight
|
||||
note text,
|
||||
note_private text,
|
||||
note_public text,
|
||||
model_pdf varchar(255)
|
||||
|
||||
)ENGINE=innodb;
|
||||
|
||||
@ -68,7 +68,7 @@ create table llx_facture
|
||||
fk_mode_reglement integer, -- mode de reglement (Virement, Prelevement)
|
||||
date_lim_reglement date, -- date limite de reglement
|
||||
|
||||
note text,
|
||||
note_private text,
|
||||
note_public text,
|
||||
model_pdf varchar(255),
|
||||
import_key varchar(14),
|
||||
|
||||
@ -61,7 +61,7 @@ create table llx_facture_fourn
|
||||
fk_cond_reglement integer DEFAULT 1 NOT NULL, -- condition de reglement (30 jours, fin de mois ...)
|
||||
date_lim_reglement date, -- date limite de reglement
|
||||
|
||||
note text,
|
||||
note_private text,
|
||||
note_public text,
|
||||
model_pdf varchar(255),
|
||||
import_key varchar(14),
|
||||
|
||||
@ -43,7 +43,7 @@ create table llx_facture_rec
|
||||
fk_mode_reglement integer DEFAULT 0, -- mode de reglement (Virement, Prelevement)
|
||||
date_lim_reglement date, -- date limite de reglement
|
||||
|
||||
note text,
|
||||
note_private text,
|
||||
note_public text,
|
||||
|
||||
usenewprice integer,
|
||||
|
||||
@ -34,7 +34,7 @@ fk_user_refuse integer DEFAULT NULL,
|
||||
date_cancel DATETIME DEFAULT NULL,
|
||||
fk_user_cancel integer DEFAULT NULL,
|
||||
detail_refuse varchar( 250 ) DEFAULT NULL,
|
||||
note text,
|
||||
note_private text,
|
||||
note_public text
|
||||
)
|
||||
ENGINE=innodb;
|
||||
ENGINE=innodb;
|
||||
|
||||
@ -37,7 +37,7 @@ create table llx_livraison
|
||||
fk_address integer, -- delivery address (deprecated)
|
||||
fk_statut smallint DEFAULT 0,
|
||||
total_ht double(24,8) DEFAULT 0,
|
||||
note text,
|
||||
note_private text,
|
||||
note_public text,
|
||||
model_pdf varchar(255)
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
|
||||
CREATE TABLE llx_printer_ipp
|
||||
(
|
||||
rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
tms timestamp,
|
||||
datec datetime,
|
||||
printer_name text NOT NULL,
|
||||
|
||||
@ -57,7 +57,7 @@ create table llx_propal
|
||||
fk_cond_reglement integer, -- condition de reglement (30 jours, fin de mois ...)
|
||||
fk_mode_reglement integer, -- mode de reglement (Virement, Prelevement)
|
||||
|
||||
note text,
|
||||
note_private text,
|
||||
note_public text,
|
||||
model_pdf varchar(255),
|
||||
date_livraison date DEFAULT NULL, -- delivery date
|
||||
|
||||
@ -62,7 +62,7 @@ create table llx_societe
|
||||
tva_intra varchar(20), -- tva
|
||||
capital real, -- capital de la societe
|
||||
fk_stcomm integer DEFAULT 0 NOT NULL, -- commercial statut
|
||||
note text, --
|
||||
note_private text, --
|
||||
note_public text, --
|
||||
prefix_comm varchar(5), -- prefix commercial
|
||||
client tinyint DEFAULT 0, -- client 0/1/2
|
||||
|
||||
@ -46,7 +46,7 @@ create table llx_socpeople
|
||||
priv smallint NOT NULL DEFAULT 0,
|
||||
fk_user_creat integer DEFAULT 0, -- user qui a creel'enregistrement
|
||||
fk_user_modif integer,
|
||||
note text,
|
||||
note_private text,
|
||||
note_public text,
|
||||
default_lang varchar(6),
|
||||
canvas varchar(32), -- type of canvas if used (null by default)
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
-- ============================================================================
|
||||
-- Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
-- Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
-- Copyright (C) 2006-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
-- Copyright (C) 2007-2013 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
--
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
@ -47,9 +47,6 @@ create table llx_user
|
||||
email varchar(255),
|
||||
signature text DEFAULT NULL,
|
||||
admin smallint DEFAULT 0,
|
||||
webcal_login varchar(25), -- TODO move to an extra table (ex: llx_extra_fields)
|
||||
phenix_login varchar(25), -- TODO move to an extra table (ex: llx_extra_fields)
|
||||
phenix_pass varchar(128), -- TODO move to an extra table (ex: llx_extra_fields)
|
||||
module_comm smallint DEFAULT 1,
|
||||
module_compta smallint DEFAULT 1,
|
||||
fk_societe integer,
|
||||
@ -64,6 +61,6 @@ create table llx_user
|
||||
openid varchar(255),
|
||||
statut tinyint DEFAULT 1,
|
||||
photo varchar(255), -- filename or url of photo
|
||||
lang varchar(6)
|
||||
|
||||
lang varchar(6),
|
||||
color varchar(6)
|
||||
)ENGINE=innodb;
|
||||
|
||||
@ -82,16 +82,16 @@ ActivateCheckReadKey=Key use to encrypt URL use for "Read Receipt" and "Unsubcri
|
||||
EMailSentToNRecipients=EMail sent to %s recipients.
|
||||
|
||||
# Libelle des modules de liste de destinataires mailing
|
||||
MailingModuleDescContactCompanies=Contacts of all third parties (customer, prospect, supplier, ...)
|
||||
MailingModuleDescContactCompanies=Contacts/addresses of all third parties (customer, prospect, supplier, ...)
|
||||
MailingModuleDescDolibarrUsers=Dolibarr users
|
||||
MailingModuleDescFundationMembers=Foundation members with emails
|
||||
MailingModuleDescEmailsFromFile=EMails from a text file (email;lastname;firstname;other)
|
||||
MailingModuleDescEmailsFromUser=EMails from user input (email;lastname;firstname;other)
|
||||
MailingModuleDescContactsCategories=Third parties (by category)
|
||||
MailingModuleDescDolibarrContractsLinesExpired=Third parties with expired contract's lines
|
||||
MailingModuleDescContactsByCompanyCategory=Contacts of third parties (by third parties category)
|
||||
MailingModuleDescContactsByCompanyCategory=Contacts/addresses of third parties (by third parties category)
|
||||
MailingModuleDescMembersCategories=Foundation members (by categories)
|
||||
MailingModuleDescContactsByFunction=Contacts of third parties (by position/function)
|
||||
MailingModuleDescContactsByFunction=Contacts/addresses of third parties (by position/function)
|
||||
|
||||
|
||||
LineInFile=Line %s in file
|
||||
@ -100,7 +100,7 @@ MailSelectedRecipients=Selected recipients
|
||||
MailingArea=EMailings area
|
||||
LastMailings=Last %s emailings
|
||||
TargetsStatistics=Targets statistics
|
||||
NbOfCompaniesContacts=Unique contacts of companies
|
||||
NbOfCompaniesContacts=Unique contacts/addresses
|
||||
MailNoChangePossible=Recipients for validated emailing can't be changed
|
||||
SearchAMailing=Search mailing
|
||||
SendMailing=Send emailing
|
||||
|
||||
@ -953,7 +953,8 @@ ExtraFieldsContacts=Attributs supplémentaires (contacts/adresses)
|
||||
ExtraFieldsMember=Attributs supplémentaires (adhérents)
|
||||
ExtraFieldsMemberType=Attributs supplémentaires (type d'adhérents)
|
||||
ExtraFieldsCustomerInvoices=Attributs supplémentaires (factures clients)
|
||||
ExtraFieldsSupplierOrders=Attributs supplémentaires (commandes fournisseurs)
|
||||
ExtraFieldsSupplierOrders=Attributs supplémentaires (commandes)
|
||||
ExtraFieldsSupplierInvoices=Attributs supplémentaires (factures)
|
||||
ExtraFieldHasWrongValue=L'attribut %s a une valeur incorrecte.
|
||||
AlphaNumOnlyCharsAndNoSpace=uniquement caractères alphanumériques sans espace
|
||||
SendingMailSetup=Configuration de l'envoi par mail
|
||||
|
||||
@ -99,7 +99,7 @@ MailSelectedRecipients=Destinataires sélectionnés
|
||||
MailingArea=Espace emailings
|
||||
LastMailings=Les %s derniers emailings
|
||||
TargetsStatistics=Statistiques destinataires
|
||||
NbOfCompaniesContacts=Contacts uniques des sociétés
|
||||
NbOfCompaniesContacts=Contacts/adresses uniques
|
||||
MailNoChangePossible=Destinataires d'un mailing validé non modifiables
|
||||
SearchAMailing=Rechercher un mailing
|
||||
SendMailing=Envoi emailing
|
||||
|
||||
@ -5,6 +5,7 @@ Supplier=Fournisseur
|
||||
AddSupplier=Ajouter un fournisseur
|
||||
SupplierRemoved=Fournisseur supprimé
|
||||
SuppliersInvoice=Facture fournisseur
|
||||
SuppliersInvoices=Factures fournisseur
|
||||
NewSupplier=Nouveau fournisseur
|
||||
History=Historique
|
||||
ListOfSuppliers=Liste des fournisseurs
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2006-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
|
||||
* Copyright (C) 2011-2012 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -49,6 +50,9 @@ class Livraison extends CommonObject
|
||||
var $socid;
|
||||
var $ref_customer;
|
||||
var $statut;
|
||||
|
||||
var $note_public;
|
||||
var $note_private;
|
||||
|
||||
var $expedition_id;
|
||||
|
||||
@ -106,15 +110,19 @@ class Livraison extends CommonObject
|
||||
$sql.= ", fk_user_author";
|
||||
$sql.= ", date_delivery";
|
||||
$sql.= ", fk_address";
|
||||
$sql.= ", note_private";
|
||||
$sql.= ", note_public";
|
||||
$sql.= ") VALUES (";
|
||||
$sql.= "'(PROV)'";
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ", ".$this->socid;
|
||||
$sql.= ", '".$this->ref_customer."'";
|
||||
$sql.= ", '".$this->db->escape($this->ref_customer)."'";
|
||||
$sql.= ", ".$this->db->idate($now);
|
||||
$sql.= ", ".$user->id;
|
||||
$sql.= ", ".($this->date_delivery?"'".$this->db->idate($this->date_delivery)."'":"null");
|
||||
$sql.= ", ".($this->fk_delivery_address > 0 ? $this->fk_delivery_address : "null");
|
||||
$sql.= ", ".(!empty($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null");
|
||||
$sql.= ", ".(!empty($this->note_public)?"'".$this->db->escape($this->note_public)."'":"null");
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog("Livraison::create sql=".$sql, LOG_DEBUG);
|
||||
@ -253,7 +261,7 @@ class Livraison extends CommonObject
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT l.rowid, l.fk_soc, l.date_creation, l.date_valid, l.ref, l.ref_customer, l.fk_user_author,";
|
||||
$sql.=" l.total_ht, l.fk_statut, l.fk_user_valid, l.note, l.note_public";
|
||||
$sql.=" l.total_ht, l.fk_statut, l.fk_user_valid, l.note_private, l.note_public";
|
||||
$sql.= ", l.date_delivery, l.fk_address, l.model_pdf";
|
||||
$sql.= ", el.fk_source as origin_id, el.sourcetype as origin";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."livraison as l";
|
||||
@ -279,7 +287,8 @@ class Livraison extends CommonObject
|
||||
$this->user_author_id = $obj->fk_user_author;
|
||||
$this->user_valid_id = $obj->fk_user_valid;
|
||||
$this->fk_delivery_address = $obj->fk_address;
|
||||
$this->note = $obj->note;
|
||||
$this->note = $obj->note_private; //TODO deprecated
|
||||
$this->note_private = $obj->note_private;
|
||||
$this->note_public = $obj->note_public;
|
||||
$this->modelpdf = $obj->model_pdf;
|
||||
$this->origin = $obj->origin; // May be 'shipping'
|
||||
@ -488,7 +497,8 @@ class Livraison extends CommonObject
|
||||
|
||||
$this->origin = $expedition->element;
|
||||
$this->origin_id = $expedition->id;
|
||||
$this->note = $expedition->note;
|
||||
$this->note_private = $expedition->note_private;
|
||||
$this->note_public = $expedition->note_public;
|
||||
$this->fk_project = $expedition->fk_project;
|
||||
$this->date_delivery = $expedition->date_delivery;
|
||||
$this->fk_delivery_address = $expedition->fk_delivery_address;
|
||||
@ -792,7 +802,8 @@ class Livraison extends CommonObject
|
||||
$this->specimen=1;
|
||||
$this->socid = 1;
|
||||
$this->date_delivery = $now;
|
||||
$this->note_public='SPECIMEN';
|
||||
$this->note_public='Pulbic note';
|
||||
$this->note_private='Private note';
|
||||
|
||||
$i=0;
|
||||
$line=new LivraisonLigne($this->db);
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -446,7 +447,7 @@ else
|
||||
$delivery = new Livraison($db);
|
||||
$result = $delivery->fetch($id);
|
||||
$delivery->fetch_thirdparty();
|
||||
|
||||
|
||||
$expedition=new Expedition($db);
|
||||
$result = $expedition->fetch($delivery->origin_id);
|
||||
$typeobject = $expedition->origin;
|
||||
@ -537,6 +538,23 @@ else
|
||||
print '<tr><td>'.$langs->trans("DateReceived").'</td>';
|
||||
print '<td colspan="3">'.dol_print_date($delivery->date_delivery,'daytext')."</td>\n";
|
||||
print '</tr>';
|
||||
|
||||
// Note Public
|
||||
print '<tr><td>'.$langs->trans("NotePublic").'</td>';
|
||||
print '<td colspan="3">';
|
||||
print nl2br($delivery->note_public);
|
||||
/*$doleditor = new DolEditor('note_public', $object->note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
|
||||
print $doleditor->Create(1);*/
|
||||
print "</td></tr>";
|
||||
|
||||
// Note Private
|
||||
print '<tr><td>'.$langs->trans("NotePrivate").'</td>';
|
||||
print '<td colspan="3">';
|
||||
print nl2br($delivery->note_private);
|
||||
/*$doleditor = new DolEditor('note_pprivate', $object->note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
|
||||
print $doleditor->Create(1);*/
|
||||
print "</td></tr>";
|
||||
|
||||
|
||||
// Statut
|
||||
print '<tr><td>'.$langs->trans("Status").'</td>';
|
||||
|
||||
62
htdocs/opensurvey/admin/index.php
Executable file
62
htdocs/opensurvey/admin/index.php
Executable file
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/opensurvey/admin/index.php
|
||||
* \ingroup opensurvey
|
||||
* \brief Setup page of opensurvey
|
||||
*/
|
||||
|
||||
require_once('../../main.inc.php');
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/opensurvey/fonctions.php");
|
||||
|
||||
// Security check
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$langs->load("opensurvey@opensurvey");
|
||||
llxHeader();
|
||||
|
||||
print_fiche_titre($langs->trans("OpenSurveyArea"));
|
||||
|
||||
echo $langs->trans("OpenSurveyNothingToSetup").'<br><br>'."\n";
|
||||
|
||||
// Link
|
||||
print img_picto('','object_globe.png').' '.$langs->trans("PublicLinkToCreateSurvey").':<br>';
|
||||
|
||||
// Define $urlwithroot
|
||||
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
|
||||
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
||||
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
|
||||
|
||||
$url=$urlwithouturlroot.dol_buildpath('/opensurvey/public/index.php',1);
|
||||
$urllink='<a href="'.$url.'" target="_blank">'.$url.'</a>';
|
||||
print $urllink;
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
352
htdocs/opensurvey/adminstuds.php
Executable file
352
htdocs/opensurvey/adminstuds.php
Executable file
@ -0,0 +1,352 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/opensurvey/adminstuds.php
|
||||
* \ingroup opensurvey
|
||||
* \brief Page to edit survey
|
||||
*/
|
||||
|
||||
require_once('../main.inc.php');
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/opensurvey/class/opensurveysondage.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/opensurvey/fonctions.php");
|
||||
|
||||
|
||||
// Security check
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
|
||||
// Initialisation des variables
|
||||
$action=GETPOST('action');
|
||||
$numsondage = $numsondageadmin = '';
|
||||
if (GETPOST('sondage'))
|
||||
{
|
||||
if (strlen(GETPOST('sondage')) == 24) // recuperation du numero de sondage admin (24 car.) dans l'URL
|
||||
{
|
||||
$numsondageadmin=GETPOST("sondage",'alpha');
|
||||
$numsondage=substr($numsondageadmin, 0, 16);
|
||||
}
|
||||
else
|
||||
{
|
||||
$numsondageadmin='';
|
||||
$numsondage=GETPOST("sondage",'alpha');
|
||||
}
|
||||
}
|
||||
|
||||
$object=new Opensurveysondage($db);
|
||||
|
||||
$expiredate=dol_mktime(0, 0, 0, GETPOST('expiremonth'), GETPOST('expireday'), GETPOST('expireyear'));
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
|
||||
// Delete
|
||||
if ($action == 'delete_confirm')
|
||||
{
|
||||
$result=$object->delete($user,'',$numsondageadmin);
|
||||
|
||||
header('Location: '.dol_buildpath('/opensurvey/list.php',1));
|
||||
exit();
|
||||
}
|
||||
|
||||
// Update
|
||||
if ($action == 'update')
|
||||
{
|
||||
$error=0;
|
||||
|
||||
if (! GETPOST('nouveautitre'))
|
||||
{
|
||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Title")),'errors');
|
||||
$error++;
|
||||
$action = 'edit';
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$res=$object->fetch(0,$numsondageadmin);
|
||||
if ($res < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$object->titre = GETPOST('nouveautitre');
|
||||
$object->commentaires = GETPOST('nouveauxcommentaires');
|
||||
$object->mail_admin = GETPOST('nouvelleadresse');
|
||||
$object->date_fin = $expiredate;
|
||||
$object->survey_link_visible = GETPOST('survey_link_visible')=='on'?1:0;
|
||||
$object->canedit = GETPOST('canedit')=='on'?1:0;
|
||||
|
||||
$res=$object->update($user);
|
||||
if ($res < 0)
|
||||
{
|
||||
setEventMessage($object->error,'errors');
|
||||
$action='edit';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Add comment
|
||||
if (GETPOST('ajoutcomment'))
|
||||
{
|
||||
$error=0;
|
||||
|
||||
if (! GETPOST('comment'))
|
||||
{
|
||||
$error++;
|
||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Comment")),'errors');
|
||||
}
|
||||
if (! GETPOST('commentuser'))
|
||||
{
|
||||
$error++;
|
||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("User")),'errors');
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$comment = GETPOST("comment");
|
||||
$comment_user = GETPOST('commentuser');
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."opensurvey_comments (id_sondage, comment, usercomment)";
|
||||
$sql.= " VALUES ('".$db->escape($numsondage)."','".$db->escape($comment)."','".$db->escape($comment_user)."')";
|
||||
$resql = $db->query($sql);
|
||||
dol_syslog("sql=".$sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$err |= COMMENT_INSERT_FAILED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Delete comment
|
||||
$idcomment=GETPOST('deletecomment','int');
|
||||
if ($idcomment)
|
||||
{
|
||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'opensurvey_comments WHERE id_comment = '.$idcomment;
|
||||
$resql = $db->query($sql);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
$result=$object->fetch(0,$numsondage);
|
||||
if ($result <= 0)
|
||||
{
|
||||
print $langs->trans("ErrorRecordNotFound");
|
||||
llxFooter();
|
||||
exit;
|
||||
}
|
||||
|
||||
$arrayofjs=array();
|
||||
$arrayofcss=array('/opensurvey/css/style.css');
|
||||
llxHeader('',$object->titre, 0, 0, 0, 0, $arrayofjs, $arrayofcss);
|
||||
|
||||
|
||||
// Define format of choices
|
||||
$toutsujet=explode(",",$object->sujet);
|
||||
$listofanswers=array();
|
||||
foreach ($toutsujet as $value)
|
||||
{
|
||||
$tmp=explode('@',$value);
|
||||
$listofanswers[]=array('label'=>$tmp[0],'format'=>($tmp[1]?$tmp[1]:'checkbox'));
|
||||
}
|
||||
$toutsujet=str_replace("@","<br>",$toutsujet);
|
||||
$toutsujet=str_replace("°","'",$toutsujet);
|
||||
|
||||
|
||||
print '<form name="updatesurvey" action="'.$_SERVER["PHP_SELF"].'?sondage='.$numsondageadmin.'" method="POST">'."\n";
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
$head = array();
|
||||
|
||||
$head[0][0] = '';
|
||||
$head[0][1] = $langs->trans("Card");
|
||||
$head[0][2] = 'general';
|
||||
$h++;
|
||||
|
||||
$head[1][0] = 'adminstuds_preview.php?sondage='.$object->id_sondage_admin;
|
||||
$head[1][1] = $langs->trans("SurveyResults").'/'.$langs->trans("Preview");
|
||||
$head[1][2] = 'preview';
|
||||
$h++;
|
||||
|
||||
print dol_get_fiche_head($head,'general',$langs->trans("Survey"),0,dol_buildpath('/opensurvey/img/object_opensurvey.png',1),1);
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$linkback = '<a href="'.dol_buildpath('/opensurvey/list.php',1).'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="18%">'.$langs->trans('Ref').'</td>';
|
||||
print '<td colspan="3">';
|
||||
print $form->showrefnav($object, 'sondage', $linkback, 1, 'id_sondage_admin', 'id_sondage_admin');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Type
|
||||
$type=($object->format=="A"||$object->format=="A+")?'classic':'date';
|
||||
print '<tr><td>'.$langs->trans("Type").'</td><td colspan="2">';
|
||||
print img_picto('',dol_buildpath('/opensurvey/img/'.($type == 'classic'?'chart-32.png':'calendar-32.png'),1),'width="16"',1);
|
||||
print ' '.$langs->trans($type=='classic'?"TypeClassic":"TypeDate").'</td></tr>';
|
||||
|
||||
// Title
|
||||
print '<tr><td>';
|
||||
$adresseadmin=$object->mail_admin;
|
||||
print $langs->trans("Title") .'</td><td colspan="2">';
|
||||
if ($action == 'edit')
|
||||
{
|
||||
print '<input type="text" name="nouveautitre" size="40" value="'.dol_escape_htmltag($object->titre).'">';
|
||||
}
|
||||
else print $object->titre;
|
||||
print '</td></tr>';
|
||||
|
||||
// Auteur
|
||||
print '<tr><td>';
|
||||
print $langs->trans("Author") .'</td><td colspan="2">';
|
||||
print $object->nom_admin;
|
||||
print '</td></tr>';
|
||||
|
||||
// Description
|
||||
print '<tr><td>'.$langs->trans("Description") .'</td><td colspan="2">';
|
||||
if ($action == 'edit')
|
||||
{
|
||||
print '<textarea name="nouveauxcommentaires" rows="7" cols="80">'.$object->commentaires.'</textarea>'."\n";
|
||||
}
|
||||
else print dol_nl2br($object->commentaires);
|
||||
print '</td></tr>';
|
||||
|
||||
// EMail
|
||||
print '<tr><td>'.$langs->trans("EMail") .'</td><td colspan="2">';
|
||||
if ($action == 'edit')
|
||||
{
|
||||
print '<input type="text" name="nouvelleadresse" size="40" value="'.$object->mail_admin.'">';
|
||||
}
|
||||
else print dol_print_email($object->mail_admin);
|
||||
print '</td></tr>';
|
||||
|
||||
// Can edit other votes
|
||||
print '<tr><td>'.$langs->trans('CanEditVotes').'</td><td colspan="2">';
|
||||
if ($action == 'edit')
|
||||
{
|
||||
print '<input type="checkbox" name="canedit" size="40"'.($object->canedit?' checked="true"':'').'">';
|
||||
}
|
||||
else print yn($object->canedit);
|
||||
print '</td></tr>';
|
||||
|
||||
// Expire date
|
||||
print '<tr><td>'.$langs->trans('ExpireDate').'</td><td colspan="2">';
|
||||
if ($action == 'edit') print $form->select_date($expiredate?$expiredate:$object->date_fin,'expire');
|
||||
else print dol_print_date($object->date_fin,'day');
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// Link
|
||||
print '<tr><td>'.img_picto('','object_globe.png').' '.$langs->trans("UrlForSurvey",'').'</td><td colspan="2">';
|
||||
|
||||
// Define $urlwithroot
|
||||
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
|
||||
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
||||
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
|
||||
|
||||
$url=$urlwithouturlroot.dol_buildpath('/opensurvey/public/studs.php',1).'?sondage='.$numsondage;
|
||||
$urllink='<a href="'.$url.'" target="_blank">'.$url.'</a>';
|
||||
print $urllink;
|
||||
|
||||
print '</table>';
|
||||
|
||||
if ($action == 'edit') print '<center><br><input type="submit" class="button" name="save" value="'.dol_escape_htmltag($langs->trans("Save")).'"></center>';
|
||||
|
||||
print '</form>'."\n";
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
/*
|
||||
* Barre d'actions
|
||||
*/
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($action != 'edit') print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&sondage=' . $numsondageadmin . '">'.$langs->trans("Modify") . '</a>';
|
||||
|
||||
if ($action != 'edit') print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?suppressionsondage=1&sondage='.$numsondageadmin.'&action=delete">'.$langs->trans('Delete').'</a>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
if ($action == 'delete')
|
||||
{
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?&sondage='.$numsondageadmin, $langs->trans("RemovePoll"), $langs->trans("ConfirmRemovalOfPoll",$id), 'delete_confirm', '', '', 1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
print '<form name="formulaire5" action="#" method="POST">'."\n";
|
||||
|
||||
print_fiche_titre($langs->trans("CommentsOfVoters"),'','');
|
||||
|
||||
// Comment list
|
||||
$sql = 'SELECT id_comment, usercomment, comment';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'opensurvey_comments';
|
||||
$sql.= " WHERE id_sondage='".$db->escape($numsondage)."'";
|
||||
$sql.= " ORDER BY id_comment";
|
||||
$resql = $db->query($sql);
|
||||
$num_rows=$db->num_rows($resql);
|
||||
if ($num_rows > 0)
|
||||
{
|
||||
$i = 0;
|
||||
while ( $i < $num_rows)
|
||||
{
|
||||
$obj=$db->fetch_object($resql);
|
||||
print '<a href="'.dol_buildpath('/opensurvey/adminstuds.php',1).'?deletecomment='.$obj->id_comment.'&sondage='.$numsondageadmin.'"> '.img_picto('', 'delete.png').'</a> ';
|
||||
print $obj->usercomment.' : '.dol_nl2br($obj->comment)." <br>";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("NoCommentYet").'<br>';;
|
||||
}
|
||||
|
||||
print '<br>';
|
||||
|
||||
// Add comment
|
||||
print $langs->trans("AddACommentForPoll") . '<br>';
|
||||
print '<textarea name="comment" rows="2" cols="80"></textarea><br>'."\n";
|
||||
print $langs->trans("Name") .' : <input type=text name="commentuser"><br>'."\n";
|
||||
print '<input type="submit" class="button" name="ajoutcomment" value="'.dol_escape_htmltag($langs->trans("AddComment")).'"><br>'."\n";
|
||||
if (isset($erreur_commentaire_vide) && $erreur_commentaire_vide=="yes") {
|
||||
print "<font color=#FF0000>" . $langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Name")) . "</font>";
|
||||
}
|
||||
|
||||
print '</form>';
|
||||
|
||||
llxFooterSurvey();
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
1064
htdocs/opensurvey/adminstuds_preview.php
Executable file
1064
htdocs/opensurvey/adminstuds_preview.php
Executable file
File diff suppressed because it is too large
Load Diff
512
htdocs/opensurvey/class/opensurveysondage.class.php
Normal file
512
htdocs/opensurvey/class/opensurveysondage.class.php
Normal file
@ -0,0 +1,512 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file dev/skeletons/opensurveysondage.class.php
|
||||
* \ingroup mymodule othermodule1 othermodule2
|
||||
* \brief This file is an example for a CRUD class file (Create/Read/Update/Delete)
|
||||
* Initialy built by build_class_from_table on 2013-03-10 00:32
|
||||
*/
|
||||
|
||||
// Put here all includes required by your class file
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php");
|
||||
//require_once(DOL_DOCUMENT_ROOT."/societe/class/societe.class.php");
|
||||
//require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");
|
||||
|
||||
|
||||
/**
|
||||
* Put here description of your class
|
||||
*/
|
||||
class Opensurveysondage extends CommonObject
|
||||
{
|
||||
var $db; //!< To store db handler
|
||||
var $error; //!< To return error code (or message)
|
||||
var $errors=array(); //!< To return several error codes (or messages)
|
||||
var $element='opensurvey_sondage'; //!< Id that identify managed objects
|
||||
var $table_element='opensurvey_sondage'; //!< Name of table without prefix where object is stored
|
||||
|
||||
var $id;
|
||||
|
||||
var $id_sondage;
|
||||
var $commentaires;
|
||||
var $mail_admin;
|
||||
var $nom_admin;
|
||||
var $titre;
|
||||
var $id_sondage_admin;
|
||||
var $date_fin='';
|
||||
var $format;
|
||||
var $mailsonde;
|
||||
var $survey_link_visible;
|
||||
var $canedit;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDb $db Database handler
|
||||
*/
|
||||
function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create object into database
|
||||
*
|
||||
* @param User $user User that creates
|
||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||
* @return int <0 if KO, Id of created object if OK
|
||||
*/
|
||||
function create($user, $notrigger=0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
$error=0;
|
||||
|
||||
// Clean parameters
|
||||
|
||||
if (isset($this->id_sondage)) $this->id_sondage=trim($this->id_sondage);
|
||||
if (isset($this->commentaires)) $this->commentaires=trim($this->commentaires);
|
||||
if (isset($this->mail_admin)) $this->mail_admin=trim($this->mail_admin);
|
||||
if (isset($this->nom_admin)) $this->nom_admin=trim($this->nom_admin);
|
||||
if (isset($this->titre)) $this->titre=trim($this->titre);
|
||||
if (isset($this->id_sondage_admin)) $this->id_sondage_admin=trim($this->id_sondage_admin);
|
||||
if (isset($this->format)) $this->format=trim($this->format);
|
||||
if (isset($this->mailsonde)) $this->mailsonde=trim($this->mailsonde);
|
||||
if (isset($this->survey_link_visible)) $this->survey_link_visible=trim($this->survey_link_visible);
|
||||
if (isset($this->canedit)) $this->canedit=trim($this->canedit);
|
||||
|
||||
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add control on parameters values
|
||||
|
||||
// Insert request
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."opensurvey_sondage(";
|
||||
|
||||
$sql.= "id_sondage,";
|
||||
$sql.= "commentaires,";
|
||||
$sql.= "mail_admin,";
|
||||
$sql.= "nom_admin,";
|
||||
$sql.= "titre,";
|
||||
$sql.= "id_sondage_admin,";
|
||||
$sql.= "date_fin,";
|
||||
$sql.= "format,";
|
||||
$sql.= "mailsonde,";
|
||||
$sql.= "survey_link_visible,";
|
||||
$sql.= "canedit";
|
||||
$sql.= ") VALUES (";
|
||||
|
||||
$sql.= " ".(! isset($this->id_sondage)?'NULL':"'".$this->id_sondage."'").",";
|
||||
$sql.= " ".(! isset($this->commentaires)?'NULL':"'".$this->db->escape($this->commentaires)."'").",";
|
||||
$sql.= " ".(! isset($this->mail_admin)?'NULL':"'".$this->db->escape($this->mail_admin)."'").",";
|
||||
$sql.= " ".(! isset($this->nom_admin)?'NULL':"'".$this->db->escape($this->nom_admin)."'").",";
|
||||
$sql.= " ".(! isset($this->titre)?'NULL':"'".$this->db->escape($this->titre)."'").",";
|
||||
$sql.= " ".(! isset($this->id_sondage_admin)?'NULL':"'".$this->id_sondage_admin."'").",";
|
||||
$sql.= " ".(! isset($this->date_fin) || dol_strlen($this->date_fin)==0?'NULL':$this->db->idate($this->date_fin)).",";
|
||||
$sql.= " ".(! isset($this->format)?'NULL':"'".$this->db->escape($this->format)."'").",";
|
||||
$sql.= " ".(! isset($this->mailsonde)?'NULL':"'".$this->mailsonde."'").",";
|
||||
$sql.= " ".(! isset($this->survey_link_visible)?'NULL':"'".$this->survey_link_visible."'").",";
|
||||
$sql.= " ".(! isset($this->canedit)?'NULL':"'".$this->canedit."'")."";
|
||||
|
||||
$sql.= ")";
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."opensurvey_sondage");
|
||||
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action calls a trigger.
|
||||
|
||||
//// Call triggers
|
||||
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
//$interface=new Interfaces($this->db);
|
||||
//$result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf);
|
||||
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
//// End call triggers
|
||||
}
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error)
|
||||
{
|
||||
foreach($this->errors as $errmsg)
|
||||
{
|
||||
dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR);
|
||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1*$error;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->commit();
|
||||
return $this->id;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load object in memory from the database
|
||||
*
|
||||
* @param int $id Id object
|
||||
* @param string $numsurvey Ref of survey (admin or not)
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetch($id,$numsurvey='')
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$sql = "SELECT";
|
||||
//$sql.= " t.rowid,";
|
||||
$sql.= " t.id_sondage,";
|
||||
$sql.= " t.commentaires,";
|
||||
$sql.= " t.mail_admin,";
|
||||
$sql.= " t.nom_admin,";
|
||||
$sql.= " t.titre,";
|
||||
$sql.= " t.id_sondage_admin,";
|
||||
$sql.= " t.date_fin,";
|
||||
$sql.= " t.format,";
|
||||
$sql.= " t.mailsonde,";
|
||||
$sql.= " t.survey_link_visible,";
|
||||
$sql.= " t.canedit,";
|
||||
$sql.= " t.sujet,";
|
||||
$sql.= " t.tms";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."opensurvey_sondage as t";
|
||||
if ($id > 0) $sql.= " WHERE t.rowid = ".$id;
|
||||
else if (strlen($numsurvey) == 16) $sql.= " WHERE t.id_sondage = '".$numsurvey."'";
|
||||
else $sql.= " WHERE t.id_sondage_admin = '".$numsurvey."'";
|
||||
|
||||
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($this->db->num_rows($resql))
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
//$this->id = $obj->rowid;
|
||||
$this->ref = $obj->id_sondage_admin;
|
||||
|
||||
$this->id_sondage = $obj->id_sondage;
|
||||
$this->commentaires = $obj->commentaires;
|
||||
$this->mail_admin = $obj->mail_admin;
|
||||
$this->nom_admin = $obj->nom_admin;
|
||||
$this->titre = $obj->titre;
|
||||
$this->id_sondage_admin = $obj->id_sondage_admin;
|
||||
$this->date_fin = $this->db->jdate($obj->date_fin);
|
||||
$this->format = $obj->format;
|
||||
$this->mailsonde = $obj->mailsonde;
|
||||
$this->survey_link_visible = $obj->survey_link_visible;
|
||||
$this->canedit = $obj->canedit;
|
||||
$this->sujet = $obj->sujet;
|
||||
|
||||
$this->date_m = $this->db->jdate($obj->tls);
|
||||
$ret=1;
|
||||
}
|
||||
else $ret=0;
|
||||
|
||||
$this->db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR);
|
||||
$ret=-1;
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update object into database
|
||||
*
|
||||
* @param User $user User that modifies
|
||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function update($user=0, $notrigger=0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
$error=0;
|
||||
|
||||
// Clean parameters
|
||||
|
||||
if (isset($this->id_sondage)) $this->id_sondage=trim($this->id_sondage);
|
||||
if (isset($this->commentaires)) $this->commentaires=trim($this->commentaires);
|
||||
if (isset($this->mail_admin)) $this->mail_admin=trim($this->mail_admin);
|
||||
if (isset($this->nom_admin)) $this->nom_admin=trim($this->nom_admin);
|
||||
if (isset($this->titre)) $this->titre=trim($this->titre);
|
||||
if (isset($this->id_sondage_admin)) $this->id_sondage_admin=trim($this->id_sondage_admin);
|
||||
if (isset($this->format)) $this->format=trim($this->format);
|
||||
if (isset($this->mailsonde)) $this->mailsonde=trim($this->mailsonde);
|
||||
if (isset($this->survey_link_visible)) $this->survey_link_visible=trim($this->survey_link_visible);
|
||||
if (isset($this->canedit)) $this->canedit=trim($this->canedit);
|
||||
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add a control on parameters values
|
||||
|
||||
// Update request
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."opensurvey_sondage SET";
|
||||
|
||||
$sql.= " id_sondage='".(isset($this->id_sondage)?$this->id_sondage:"null")."',";
|
||||
$sql.= " commentaires=".(isset($this->commentaires)?"'".$this->db->escape($this->commentaires)."'":"null").",";
|
||||
$sql.= " mail_admin=".(isset($this->mail_admin)?"'".$this->db->escape($this->mail_admin)."'":"null").",";
|
||||
$sql.= " nom_admin=".(isset($this->nom_admin)?"'".$this->db->escape($this->nom_admin)."'":"null").",";
|
||||
$sql.= " titre=".(isset($this->titre)?"'".$this->db->escape($this->titre)."'":"null").",";
|
||||
$sql.= " id_sondage_admin='".(isset($this->id_sondage_admin)?$this->id_sondage_admin:"null")."',";
|
||||
$sql.= " date_fin=".(dol_strlen($this->date_fin)!=0 ? "'".$this->db->idate($this->date_fin)."'" : 'null').",";
|
||||
$sql.= " format=".(isset($this->format)?"'".$this->db->escape($this->format)."'":"null").",";
|
||||
$sql.= " mailsonde=".(isset($this->mailsonde)?$this->mailsonde:"null").",";
|
||||
$sql.= " survey_link_visible=".(isset($this->survey_link_visible)?$this->survey_link_visible:"null").",";
|
||||
$sql.= " canedit=".(isset($this->canedit)?$this->canedit:"null")."";
|
||||
|
||||
//$sql.= " WHERE rowid=".$this->id;
|
||||
$sql.= " WHERE id_sondage_admin='".$this->id_sondage_admin."'";
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action calls a trigger.
|
||||
|
||||
//// Call triggers
|
||||
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
//$interface=new Interfaces($this->db);
|
||||
//$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf);
|
||||
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
//// End call triggers
|
||||
}
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error)
|
||||
{
|
||||
foreach($this->errors as $errmsg)
|
||||
{
|
||||
dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
|
||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1*$error;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete object in database
|
||||
*
|
||||
* @param User $user User that deletes
|
||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||
* @param string $numsondageadmin Num sondage to delete
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function delete($user, $notrigger, $numsondageadmin)
|
||||
{
|
||||
global $conf, $langs;
|
||||
$error=0;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action calls a trigger.
|
||||
|
||||
//// Call triggers
|
||||
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
//$interface=new Interfaces($this->db);
|
||||
//$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf);
|
||||
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
//// End call triggers
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
|
||||
$sql='DELETE FROM '.MAIN_DB_PREFIX."opensurvey_comments WHERE id_sondage_admin = '".$numsondageadmin."'";
|
||||
dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
$sql='DELETE FROM '.MAIN_DB_PREFIX."opensurvey_user_studs WHERE id_sondage_admin = '".$numsondageadmin."'";
|
||||
dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."opensurvey_sondage";
|
||||
$sql.= " WHERE id_sondage_admin = '".$numsondageadmin."'";
|
||||
|
||||
dol_syslog(get_class($this)."::delete sql=".$sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error)
|
||||
{
|
||||
foreach($this->errors as $errmsg)
|
||||
{
|
||||
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
|
||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1*$error;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return array of lines
|
||||
*
|
||||
* @return array Array of lines
|
||||
*/
|
||||
function fetch_lines()
|
||||
{
|
||||
$ret=array();
|
||||
$sql = "SELECT id_users, nom, reponses FROM ".MAIN_DB_PREFIX."opensurvey_user_studs";
|
||||
$sql.= " WHERE id_sondage = '".$this->id_sondage."'";
|
||||
$resql=$this->db->query($sql);
|
||||
|
||||
if ($resql)
|
||||
{
|
||||
$num=$this->db->num_rows($resql);
|
||||
$i=0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj=$this->db->fetch_object($resql);
|
||||
$tmp=array('id_users'=>$obj->id_users, 'nom'=>$obj->nom, 'reponses'=>$obj->reponses);
|
||||
|
||||
$ret[]=$tmp;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else dol_print_error($this->db);
|
||||
|
||||
$this->lines=$ret;
|
||||
|
||||
return $this->lines;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load an object from its id and create a new one in database
|
||||
*
|
||||
* @param int $fromid Id of object to clone
|
||||
* @return int New id of clone
|
||||
*/
|
||||
function createFromClone($fromid)
|
||||
{
|
||||
global $user,$langs;
|
||||
|
||||
$error=0;
|
||||
|
||||
$object=new Opensurveysondage($this->db);
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Load source object
|
||||
$object->fetch($fromid);
|
||||
$object->id=0;
|
||||
$object->statut=0;
|
||||
|
||||
// Clear fields
|
||||
// ...
|
||||
|
||||
// Create clone
|
||||
$result=$object->create($user);
|
||||
|
||||
// Other options
|
||||
if ($result < 0)
|
||||
{
|
||||
$this->error=$object->error;
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
// End
|
||||
if (! $error)
|
||||
{
|
||||
$this->db->commit();
|
||||
return $object->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialise object with example values
|
||||
* Id must be 0 if object instance is a specimen
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function initAsSpecimen()
|
||||
{
|
||||
$this->id=0;
|
||||
|
||||
$this->id_sondage='';
|
||||
$this->commentaires='';
|
||||
$this->mail_admin='';
|
||||
$this->nom_admin='';
|
||||
$this->titre='';
|
||||
$this->id_sondage_admin='';
|
||||
$this->date_fin='';
|
||||
$this->format='';
|
||||
$this->mailsonde='';
|
||||
$this->survey_link_visible='';
|
||||
$this->canedit=0;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user