Merge branch 'develop' into 10.0_accoutancy_stats
This commit is contained in:
commit
eb66d45947
@ -342,6 +342,9 @@ script:
|
||||
php upgrade.php 8.0.0 9.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade800900.log
|
||||
php upgrade2.php 8.0.0 9.0.0 > $TRAVIS_BUILD_DIR/upgrade800900-2.log
|
||||
php step5.php 8.0.0 9.0.0 > $TRAVIS_BUILD_DIR/upgrade800900-3.log
|
||||
php upgrade.php 9.0.0 10.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade9001000.log
|
||||
php upgrade2.php 9.0.0 10.0.0 > $TRAVIS_BUILD_DIR/upgrade9001000-2.log
|
||||
php step5.php 9.0.0 10.0.0 > $TRAVIS_BUILD_DIR/upgrade9001000-3.log
|
||||
cd -
|
||||
set +e
|
||||
echo
|
||||
|
||||
@ -3,9 +3,9 @@
|
||||

|
||||
[](https://houndci.com)
|
||||
|
||||
|6|7|8|develop|
|
||||
|----------|----------|----------|----------|
|
||||
|||||
|
||||
|6|7|8|9|develop|
|
||||
|----------|----------|----------|----------|----------|
|
||||
||||||
|
||||
|
||||
Dolibarr ERP & CRM is a modern software package to manage your organization's activity (contacts, suppliers, invoices, orders, stocks, agenda…).
|
||||
|
||||
|
||||
1
build/debian/source/include-binaries
Normal file
1
build/debian/source/include-binaries
Normal file
@ -0,0 +1 @@
|
||||
htdocs/install/doctemplates/websites/website_template-corporate.zip
|
||||
@ -30,7 +30,7 @@ return "Regis Houssin";
|
||||
# script_dolibarr_versions()
|
||||
sub script_dolibarr_versions
|
||||
{
|
||||
return ( "7.0.0", "6.0.5", "5.0.7" );
|
||||
return ( "9.0.0", "8.0.3", "7.0.4", "6.0.8", "5.0.7" );
|
||||
}
|
||||
|
||||
sub script_dolibarr_release
|
||||
@ -263,15 +263,16 @@ if ($upgrade) {
|
||||
local @params = ( [ "action", "upgrade" ],
|
||||
[ "versionfrom", $upgrade->{'version'} ],
|
||||
[ "versionto", $ver ],
|
||||
[ "installlock", "444" ],
|
||||
);
|
||||
local $p = $ver >= 3.8 ? "step5" : "etape5";
|
||||
local $err = &call_dolibarr_wizard_page(\@params, $p, $d, $opts);
|
||||
return (-1, "Dolibarr wizard failed : $err") if ($err);
|
||||
|
||||
# Remove the installation directory.
|
||||
local $dinstall = "$opts->{'dir'}/install";
|
||||
$dinstall =~ s/\/$//;
|
||||
$out = &run_as_domain_user($d, "rm -rf ".quotemeta($dinstall));
|
||||
# Remove the installation directory. (deprecated)
|
||||
# local $dinstall = "$opts->{'dir'}/install";
|
||||
# $dinstall =~ s/\/$//;
|
||||
# $out = &run_as_domain_user($d, "rm -rf ".quotemeta($dinstall));
|
||||
|
||||
}
|
||||
else {
|
||||
@ -306,15 +307,18 @@ else {
|
||||
[ "login", "admin" ],
|
||||
[ "pass", $dompass ],
|
||||
[ "pass_verif", $dompass ],
|
||||
[ "installlock", "444" ],
|
||||
);
|
||||
local $p = $ver >= 3.8 ? "step5" : "etape5";
|
||||
local $err = &call_dolibarr_wizard_page(\@params, $p, $d, $opts);
|
||||
return (-1, "Dolibarr wizard failed : $err") if ($err);
|
||||
|
||||
# Remove the installation directory and protect config file.
|
||||
local $dinstall = "$opts->{'dir'}/install";
|
||||
$dinstall =~ s/\/$//;
|
||||
$out = &run_as_domain_user($d, "rm -rf ".quotemeta($dinstall));
|
||||
# Remove the installation directory (deprecated)
|
||||
# local $dinstall = "$opts->{'dir'}/install";
|
||||
# $dinstall =~ s/\/$//;
|
||||
# $out = &run_as_domain_user($d, "rm -rf ".quotemeta($dinstall));
|
||||
|
||||
# Protect config file
|
||||
&set_permissions_as_domain_user($d, 0644, $cfile);
|
||||
&set_permissions_as_domain_user($d, 0755, $cfiledir);
|
||||
}
|
||||
@ -386,6 +390,8 @@ sub script_dolibarr_check_latest
|
||||
{
|
||||
local ($ver) = @_;
|
||||
local @vers = &osdn_package_versions("dolibarr",
|
||||
$ver >= 9.0 ? "dolibarr\\-(9\\.0\\.[0-9\\.]+)\\.tgz" :
|
||||
$ver >= 8.0 ? "dolibarr\\-(8\\.0\\.[0-9\\.]+)\\.tgz" :
|
||||
$ver >= 7.0 ? "dolibarr\\-(7\\.0\\.[0-9\\.]+)\\.tgz" :
|
||||
$ver >= 6.0 ? "dolibarr\\-(6\\.0\\.[0-9\\.]+)\\.tgz" :
|
||||
$ver >= 5.0 ? "dolibarr\\-(5\\.0\\.[0-9\\.]+)\\.tgz" :
|
||||
|
||||
@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<uml:Model xmi:version="2.1" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1" xmlns:uml="http://www.eclipse.org/uml2/2.1.0/UML" xmi:id="_qb8akM37EdqwVrslYOdUDA">
|
||||
<packagedElement xmi:type="uml:Package" xmi:id="_w8IxIM37EdqwVrslYOdUDA" name="dolibarr">
|
||||
<packagedElement xmi:type="uml:Package" xmi:id="_T5aZ4FK9Ed60vaZbVikprw" name="OrdersModule"/>
|
||||
<packagedElement xmi:type="uml:Package" xmi:id="_ZhuGMlK9Ed60vaZbVikprw" name="InvoiceModule"/>
|
||||
<packagedElement xmi:type="uml:Package" xmi:id="_cf3SUlK9Ed60vaZbVikprw" name="UserModule"/>
|
||||
<packagedElement xmi:type="uml:Package" xmi:id="_maM0glK9Ed60vaZbVikprw" name="FoundationModule"/>
|
||||
<packagedElement xmi:type="uml:Package" xmi:id="_oqTO4lK9Ed60vaZbVikprw" name="ContractsModule"/>
|
||||
<packagedElement xmi:type="uml:Package" xmi:id="_rEq_klK9Ed60vaZbVikprw" name="ProposalsModule"/>
|
||||
<packagedElement xmi:type="uml:Package" xmi:id="_vxYmUlK9Ed60vaZbVikprw" name="EMailingManagement"/>
|
||||
</packagedElement>
|
||||
</uml:Model>
|
||||
@ -1,53 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<diagrams:Diagrams xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.topcased.org/DI/1.0" xmlns:diagrams="http://www.topcased.org/Diagrams/1.0" xmi:id="_SI6FkFK9Ed60vaZbVikprw" activeDiagram="_SI6FkVK9Ed60vaZbVikprw">
|
||||
<model href="dolibarr.uml#_w8IxIM37EdqwVrslYOdUDA"/>
|
||||
<diagrams xmi:id="_SI6FkVK9Ed60vaZbVikprw" position="0,0" size="100,100" name="dolibarr" viewport="0,0">
|
||||
<property xmi:id="_SJ9OcFK9Ed60vaZbVikprw" key="pageFormatName" value="A4"/>
|
||||
<property xmi:id="_SJ9OcVK9Ed60vaZbVikprw" key="diagramWidth" value="840"/>
|
||||
<property xmi:id="_SJ9OclK9Ed60vaZbVikprw" key="diagramHeight" value="1188"/>
|
||||
<property xmi:id="_SJ9Oc1K9Ed60vaZbVikprw" key="pageMarginName" value="Small Margin"/>
|
||||
<property xmi:id="_SJ9OdFK9Ed60vaZbVikprw" key="diagramTopMargin" value="20"/>
|
||||
<property xmi:id="_SJ9OdVK9Ed60vaZbVikprw" key="diagramBottomMargin" value="20"/>
|
||||
<property xmi:id="_SJ9OdlK9Ed60vaZbVikprw" key="diagramLeftMargin" value="20"/>
|
||||
<property xmi:id="_SJ9Od1K9Ed60vaZbVikprw" key="diagramRightMargin" value="20"/>
|
||||
<property xmi:id="_SJ9OeFK9Ed60vaZbVikprw" key="orientation" value="portrait"/>
|
||||
<semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_SI6FklK9Ed60vaZbVikprw" presentation="org.topcased.modeler.uml.classdiagram">
|
||||
<element href="dolibarr.uml#_w8IxIM37EdqwVrslYOdUDA"/>
|
||||
</semanticModel>
|
||||
<contained xsi:type="di:GraphNode" xmi:id="_T2b-YFK9Ed60vaZbVikprw" position="15,190" size="176,81">
|
||||
<semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_T2b-YVK9Ed60vaZbVikprw" presentation="default">
|
||||
<element href="dolibarr.uml#_T5aZ4FK9Ed60vaZbVikprw"/>
|
||||
</semanticModel>
|
||||
</contained>
|
||||
<contained xsi:type="di:GraphNode" xmi:id="_ZhuGMFK9Ed60vaZbVikprw" position="15,118" size="177,68">
|
||||
<semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_ZhuGMVK9Ed60vaZbVikprw" presentation="default">
|
||||
<element href="dolibarr.uml#_ZhuGMlK9Ed60vaZbVikprw"/>
|
||||
</semanticModel>
|
||||
</contained>
|
||||
<contained xsi:type="di:GraphNode" xmi:id="_cf3SUFK9Ed60vaZbVikprw" position="15,10" size="174,81">
|
||||
<semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_cf3SUVK9Ed60vaZbVikprw" presentation="default">
|
||||
<element href="dolibarr.uml#_cf3SUlK9Ed60vaZbVikprw"/>
|
||||
</semanticModel>
|
||||
</contained>
|
||||
<contained xsi:type="di:GraphNode" xmi:id="_maM0gFK9Ed60vaZbVikprw" position="291,118" size="145,73">
|
||||
<semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_maM0gVK9Ed60vaZbVikprw" presentation="default">
|
||||
<element href="dolibarr.uml#_maM0glK9Ed60vaZbVikprw"/>
|
||||
</semanticModel>
|
||||
</contained>
|
||||
<contained xsi:type="di:GraphNode" xmi:id="_oqTO4FK9Ed60vaZbVikprw" position="15,274" size="179,80">
|
||||
<semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_oqTO4VK9Ed60vaZbVikprw" presentation="default">
|
||||
<element href="dolibarr.uml#_oqTO4lK9Ed60vaZbVikprw"/>
|
||||
</semanticModel>
|
||||
</contained>
|
||||
<contained xsi:type="di:GraphNode" xmi:id="_rEq_kFK9Ed60vaZbVikprw" position="15,358" size="181,73">
|
||||
<semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_rEq_kVK9Ed60vaZbVikprw" presentation="default">
|
||||
<element href="dolibarr.uml#_rEq_klK9Ed60vaZbVikprw"/>
|
||||
</semanticModel>
|
||||
</contained>
|
||||
<contained xsi:type="di:GraphNode" xmi:id="_vxYmUFK9Ed60vaZbVikprw" position="15,490" size="181,80">
|
||||
<semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_vxYmUVK9Ed60vaZbVikprw" presentation="default">
|
||||
<element href="dolibarr.uml#_vxYmUlK9Ed60vaZbVikprw"/>
|
||||
</semanticModel>
|
||||
</contained>
|
||||
</diagrams>
|
||||
</diagrams:Diagrams>
|
||||
Binary file not shown.
130
dev/tools/snakeCaseToCamelCase.sh
Executable file
130
dev/tools/snakeCaseToCamelCase.sh
Executable file
@ -0,0 +1,130 @@
|
||||
#!/bin/bash
|
||||
|
||||
## Need "rpl" package
|
||||
RPL_INSTALLED=$(dpkg -s rpl)
|
||||
if [[ -z ${RPL_INSTALLED} ]]; then
|
||||
echo "This bash need rpl command, you can install it with: sudo apt install rpl"
|
||||
fi
|
||||
|
||||
DIR_HTDOCS=$( cd "$( dirname "${BASH_SOURCE[0]}" )/../../htdocs" >/dev/null && pwd )
|
||||
|
||||
PATTERN=""
|
||||
if [[ -f $1 ]]; then
|
||||
TFile=("$1") # specific file
|
||||
elif [[ -n $1 ]]; then
|
||||
PATTERN=$1 # name of a particular file or pattern (ex: societe.class.php)
|
||||
else
|
||||
PATTERN="*.class.php" # *.lib.php
|
||||
fi
|
||||
|
||||
if [[ -n ${PATTERN} ]]; then
|
||||
TCLASSFILE=$(find "${DIR_HTDOCS}" -name "${PATTERN}" | grep -v "/custom/" | grep -v "/includes/" | grep -v -F -f "${DIR_HTDOCS}/../.gitignore")
|
||||
TFile=()
|
||||
I=0
|
||||
for f in ${TCLASSFILE}; do
|
||||
TFile[${I}]="${f}"
|
||||
((I++))
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
REGEX_FNC_W='^([[:blank:]]*)(public|private|protected)?[ \t]*(static)?[ \t]*[^\$\(]function[ \t]*([a-zA-Z0-9\-\_]*)[\(](.*)[\)][ \t]*([\{]?)$'
|
||||
INDENT=" "
|
||||
|
||||
for f in ${TFile[@]}; do
|
||||
# echo ${f}
|
||||
|
||||
IFS=$'\n'
|
||||
TLine=($(cat "${f}" | grep -E "${REGEX_FNC_W}"))
|
||||
|
||||
for LINE in ${TLine[@]}; do
|
||||
|
||||
if [[ ${LINE} =~ ^${REGEX_FNC_W}$ ]]; then
|
||||
FIRST_INDENT=${BASH_REMATCH[1]} # seem not work
|
||||
FNC_TYPE=${BASH_REMATCH[2]}
|
||||
STATIC=${BASH_REMATCH[3]}
|
||||
FNC_NAME=${BASH_REMATCH[4]}
|
||||
PARAMETERS_ORIGIN=${BASH_REMATCH[5]}
|
||||
BRACKET_END=${BASH_REMATCH[6]}
|
||||
|
||||
if [[ ${LINE} =~ ^([[:blank:]]*) ]]; then # but this seems work to get indentation
|
||||
FIRST_INDENT=${BASH_REMATCH[1]}
|
||||
fi
|
||||
|
||||
[[ ${FNC_NAME} =~ ^__ ]] && continue # skip magic function
|
||||
|
||||
CAMEL_CASE=$(echo "${FNC_NAME}" | sed -r 's/(_)([a-zA-Z0-9])/\U\2/g')
|
||||
[[ ${CAMEL_CASE} = ${FNC_NAME} ]] && continue # skip if no difference
|
||||
|
||||
#echo A: ${#FIRST_INDENT}
|
||||
#printf "${FIRST_INDENT}TEST INDENT\n"
|
||||
#echo B: ${FNC_TYPE}
|
||||
#echo C: ${STATIC}
|
||||
#echo D: ${FNC_NAME}
|
||||
#echo D: ${CAMEL_CASE}
|
||||
#echo E: ${PARAMETERS_ORIGIN}
|
||||
#echo F: ${BRACKET_END}
|
||||
#exit
|
||||
|
||||
[[ -n $(cat "${f}" | grep -i "function[[:blank:]]*${CAMEL_CASE}") ]] && continue # skip if already exists
|
||||
|
||||
TCommentLine=()
|
||||
J=1
|
||||
while :; do
|
||||
COMMENT=$(cat ${f} | grep -B ${J} ${LINE/\$/\\$} | head -n1 | grep -P '^[\t\ ]*(/\*\*|\*[^/]?|\*/)')
|
||||
if [[ -n ${COMMENT} ]]; then
|
||||
TCommentLine[${J}]="${COMMENT}"
|
||||
((J++))
|
||||
else
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
COMMENT_ORIGIN=""
|
||||
COMMENT_ORIGIN_WITH_DEPRECATED=""
|
||||
COMMENT_DUPLICATE=""
|
||||
if [[ ${#TCommentLine[@]} -gt 0 ]]; then
|
||||
for (( idx=${#TCommentLine[@]} ; idx>0 ; idx-- )) ; do
|
||||
COMMENT_ORIGIN="${COMMENT_ORIGIN}\n${TCommentLine[idx]}"
|
||||
done
|
||||
|
||||
COMMENT_DUPLICATE=${COMMENT_ORIGIN}
|
||||
|
||||
COMMENT_ORIGIN_WITH_DEPRECATED=$(echo "${COMMENT_ORIGIN%?} @deprecated\n${FIRST_INDENT} * @see ${CAMEL_CASE}\n${FIRST_INDENT} */")
|
||||
fi
|
||||
|
||||
PARAMETERS=${PARAMETERS_ORIGIN}
|
||||
TParam=()
|
||||
I=0
|
||||
while [[ ${PARAMETERS} =~ (\$[a-zA-Z0-9\_\-]+) ]]; do
|
||||
TParam[${I}]=${BASH_REMATCH[1]}
|
||||
PARAMETERS=${PARAMETERS#*"${BASH_REMATCH[1]}"}
|
||||
((I++))
|
||||
done
|
||||
|
||||
PARAMS_STR=$(printf ", %s" "${TParam[@]}")
|
||||
PARAMS_STR=${PARAMS_STR:2}
|
||||
|
||||
REPLACE=${LINE}
|
||||
[[ -z ${BRACKET_END} ]] && REPLACE="${LINE}\n${FIRST_INDENT}{\n${FIRST_INDENT}${INDENT}" || REPLACE="${LINE}\n${FIRST_INDENT}${INDENT}"
|
||||
[[ -n ${STATIC} ]] && REPLACE="${REPLACE}return self::" || REPLACE="${REPLACE}return \$this->"
|
||||
REPLACE="${REPLACE}${CAMEL_CASE}(${PARAMS_STR});\n${FIRST_INDENT}}\n\n"
|
||||
REPLACE="${REPLACE}${FIRST_INDENT}${COMMENT_ORIGIN}\n${FIRST_INDENT}"
|
||||
[[ -n ${STATIC} ]] && REPLACE="${REPLACE}${STATIC} "
|
||||
[[ -n ${FNC_TYPE} ]] && REPLACE="${REPLACE}${FNC_TYPE} "
|
||||
REPLACE="${REPLACE}function ${CAMEL_CASE}(${PARAMETERS_ORIGIN})"
|
||||
[[ -n ${BRACKET_END} ]] && REPLACE="${REPLACE}\n${FIRST_INDENT}{"
|
||||
|
||||
echo " ${FNC_NAME} -> ${CAMEL_CASE}"
|
||||
|
||||
if [[ -n ${COMMENT_ORIGIN_WITH_DEPRECATED} ]]; then
|
||||
rpl -e --quiet "${COMMENT_ORIGIN}" ${COMMENT_ORIGIN_WITH_DEPRECATED} "${f}"
|
||||
fi
|
||||
rpl -e --quiet "${LINE}" ${REPLACE} "${f}"
|
||||
|
||||
fi
|
||||
|
||||
done
|
||||
done
|
||||
|
||||
|
||||
@ -7,12 +7,12 @@ Download
|
||||
--------------------------------
|
||||
|
||||
* Dolibarr ERP/CRM can be downloaded at sourceforge:
|
||||
http://sourceforge.net/projects/dolibarr/files
|
||||
or from Dolibarr official web site:
|
||||
http://www.dolibarr.org
|
||||
https://sourceforge.net/projects/dolibarr/files
|
||||
or from Dolibarr official web site:
|
||||
https://www.dolibarr.org
|
||||
|
||||
* Most external modules are only available on DoliStore:
|
||||
http://www.dolistore.org
|
||||
https://www.dolistore.com
|
||||
|
||||
|
||||
--------------------------------
|
||||
@ -22,4 +22,4 @@ Install
|
||||
* For a Quick guide, take a look at README file into root directory.
|
||||
|
||||
* More complete documentations are also available on line on the Dolibarr Wiki:
|
||||
http://wiki.dolibarr.org
|
||||
https://wiki.dolibarr.org
|
||||
|
||||
33
doc/install/README-DE
Normal file
33
doc/install/README-DE
Normal file
@ -0,0 +1,33 @@
|
||||
README (deutsch / german / allemand)
|
||||
--------------------------------
|
||||
|
||||
|
||||
--------------------------------
|
||||
Download / Herunterladen
|
||||
--------------------------------
|
||||
|
||||
* Dolibarr ERP/CRM kann man über die offizielle Dolibarr Website
|
||||
https://www.dolibarr.org/downloads
|
||||
oder direkt von Sourceforge
|
||||
https://sourceforge.net/projects/dolibarr/files/
|
||||
herunterladen.
|
||||
|
||||
|
||||
|
||||
* Die meisten externen Module/Themens sind über den DoliStore verfügbar:
|
||||
https://www.dolistore.com/de/
|
||||
|
||||
|
||||
--------------------------------
|
||||
Installation
|
||||
--------------------------------
|
||||
|
||||
* Für eine kurze Einleitung, schau auf die README Datei im Hauptverzeichnis.
|
||||
|
||||
* Umfangreiche Dokumentationen sind im Dolibarr Wiki zu finden:
|
||||
https://wiki.dolibarr.org/index.php/Hauptseite
|
||||
|
||||
* eine Deutsche Community bietet der Dolibarr e.V. unter
|
||||
https://www.dolibarr.de/
|
||||
|
||||
|
||||
@ -388,13 +388,13 @@ else if ($id > 0 || $ref) {
|
||||
if (! empty($user->rights->accounting->chartofaccount)) {
|
||||
print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=update&id=' . $id . '">' . $langs->trans('Modify') . '</a>';
|
||||
} else {
|
||||
print '<a class="butActionRefused" href="#" title="' . dol_escape_htmltag($langs->trans("NotAllowed")) . '">' . $langs->trans('Modify') . '</a>';
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="' . dol_escape_htmltag($langs->trans("NotAllowed")) . '">' . $langs->trans('Modify') . '</a>';
|
||||
}
|
||||
|
||||
if (! empty($user->rights->accounting->chartofaccount)) {
|
||||
print '<a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?action=delete&id=' . $id . '">' . $langs->trans('Delete') . '</a>';
|
||||
} else {
|
||||
print '<a class="butActionRefused" href="#" title="' . dol_escape_htmltag($langs->trans("NotAllowed")) . '">' . $langs->trans('Delete') . '</a>';
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="' . dol_escape_htmltag($langs->trans("NotAllowed")) . '">' . $langs->trans('Delete') . '</a>';
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
|
||||
@ -117,7 +117,7 @@ if ($result)
|
||||
}
|
||||
else
|
||||
{
|
||||
$addbutton = '<a class="butActionRefused" href="#"><span class="valignmiddle">' . $langs->trans("NewFiscalYear") .'</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
|
||||
$addbutton = '<a class="butActionRefused classfortooltip" href="#"><span class="valignmiddle" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">' . $langs->trans("NewFiscalYear") .'</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
|
||||
}
|
||||
|
||||
$title = $langs->trans('AccountingPeriods');
|
||||
|
||||
@ -641,7 +641,6 @@ if ($num > 0)
|
||||
$object->id = $line->id;
|
||||
$object->piece_num = $line->piece_num;
|
||||
print $object->getNomUrl(1,'',0,'',1);
|
||||
//print '<a href="./card.php?piece_num=' . $line->piece_num . '&save_lastsearch_values=1">' . $line->piece_num . '</a>';
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@ -94,7 +94,7 @@ $facture_static = new Facture($db);
|
||||
$formaccounting = new FormAccounting($db);
|
||||
|
||||
if (! empty($id)) {
|
||||
$sql = "SELECT f.facnumber, f.rowid as facid, l.fk_product, l.description, l.price,";
|
||||
$sql = "SELECT f.ref, f.rowid as facid, l.fk_product, l.description, l.price,";
|
||||
$sql .= " l.qty, l.rowid, l.tva_tx, l.remise_percent, l.subprice, p.accountancy_code_sell as code_sell,";
|
||||
$sql .= " l.fk_code_ventilation, aa.account_number, aa.label";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as l";
|
||||
@ -102,7 +102,7 @@ if (! empty($id)) {
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON l.fk_code_ventilation = aa.rowid";
|
||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = l.fk_facture";
|
||||
$sql .= " WHERE f.fk_statut > 0 AND l.rowid = " . $id;
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND f.entity IN (" . getEntity('invoice', 0) . ")"; // We don't share object for accountancy
|
||||
|
||||
dol_syslog("/accounting/customer/card.php sql=" . $sql, LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
@ -128,7 +128,7 @@ if (! empty($id)) {
|
||||
|
||||
// Ref facture
|
||||
print '<tr><td>' . $langs->trans("Invoice") . '</td>';
|
||||
$facture_static->ref = $objp->facnumber;
|
||||
$facture_static->ref = $objp->ref;
|
||||
$facture_static->id = $objp->facid;
|
||||
print '<td>' . $facture_static->getNomUrl(1) . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -180,7 +180,7 @@ $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid
|
||||
$sql .= " WHERE f.datef >= '" . $db->idate($search_date_start) . "'";
|
||||
$sql .= " AND f.datef <= '" . $db->idate($search_date_end) . "'";
|
||||
$sql .= " AND f.fk_statut > 0";
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND f.entity IN (" . getEntity('invoice', 0) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND aa.account_number IS NULL";
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
||||
@ -255,7 +255,7 @@ $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_factu
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
|
||||
$sql .= " WHERE f.datef >= '" . $db->idate($search_date_start) . "'";
|
||||
$sql .= " AND f.datef <= '" . $db->idate($search_date_end) . "'";
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND f.entity IN (" . getEntity('invoice', 0) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND f.fk_statut > 0";
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
||||
@ -332,7 +332,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
|
||||
$sql .= " WHERE f.datef >= '" . $db->idate($search_date_start) . "'";
|
||||
$sql .= " AND f.datef <= '" . $db->idate($search_date_end) . "'";
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND f.entity IN (" . getEntity('invoice', 0) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND f.fk_statut > 0";
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
||||
@ -384,7 +384,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
|
||||
$sql .= " WHERE f.datef >= '" . $db->idate($search_date_start) . "'";
|
||||
$sql .= " AND f.datef <= '" . $db->idate($search_date_end) . "'";
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND f.entity IN (" . getEntity('invoice', 0) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND f.fk_statut > 0";
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
||||
|
||||
@ -64,7 +64,7 @@ $pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
$offset = $limit * $page;
|
||||
if (! $sortfield)
|
||||
$sortfield = "f.datef, f.facnumber, fd.rowid";
|
||||
$sortfield = "f.datef, f.ref, fd.rowid";
|
||||
if (! $sortorder) {
|
||||
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) {
|
||||
$sortorder = "DESC";
|
||||
@ -167,7 +167,7 @@ print '<script type="text/javascript">
|
||||
/*
|
||||
* Customer Invoice lines
|
||||
*/
|
||||
$sql = "SELECT f.rowid as facid, f.facnumber as ref, f.type, f.datef, f.ref_client,";
|
||||
$sql = "SELECT f.rowid as facid, f.ref as ref, f.type, f.datef, f.ref_client,";
|
||||
$sql.= " fd.rowid, fd.description, fd.product_type as line_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.vat_src_code, fd.total_ttc,";
|
||||
$sql.= " s.rowid as socid, s.nom as name, s.code_compta, s.code_client,";
|
||||
$sql.= " p.rowid as product_id, p.fk_product_type as product_type, p.ref as product_ref, p.label as product_label, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number, aa.label as label_compte,";
|
||||
@ -184,7 +184,7 @@ $sql.= " INNER JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_factur
|
||||
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
|
||||
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as co ON co.rowid = s.fk_pays ";
|
||||
$sql.= " WHERE fd.fk_code_ventilation > 0";
|
||||
$sql.= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
||||
$sql.= " AND f.entity IN (" . getEntity('invoice', 0) . ")"; // We don't share object for accountancy
|
||||
$sql.= " AND f.fk_statut > 0";
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
||||
@ -195,7 +195,7 @@ if ($search_lineid) {
|
||||
$sql .= natural_search("fd.rowid", $search_lineid, 1);
|
||||
}
|
||||
if (strlen(trim($search_invoice))) {
|
||||
$sql .= natural_search("f.facnumber", $search_invoice);
|
||||
$sql .= natural_search("f.ref", $search_invoice);
|
||||
}
|
||||
if (strlen(trim($search_ref))) {
|
||||
$sql .= natural_search("p.ref", $search_ref);
|
||||
@ -245,7 +245,7 @@ if (strlen(trim($search_country))) {
|
||||
if (strlen(trim($search_tvaintra))) {
|
||||
$sql .= natural_search("s.tva_intra", $search_tvaintra);
|
||||
}
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND f.entity IN (" . getEntity('invoice', 0) . ")"; // We don't share object for accountancy
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
// Count total nb of records
|
||||
@ -331,8 +331,8 @@ if ($result) {
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "fd.rowid", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.facnumber", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.facnumber, fd.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, fd.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
|
||||
//print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "fd.description", "", $param, '', $sortfield, $sortorder);
|
||||
|
||||
@ -75,7 +75,7 @@ $offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortfield)
|
||||
$sortfield = "f.datef, f.facnumber, l.rowid";
|
||||
$sortfield = "f.datef, f.ref, l.rowid";
|
||||
if (! $sortorder) {
|
||||
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) {
|
||||
$sortorder = "DESC";
|
||||
@ -209,7 +209,7 @@ if (empty($chartaccountcode))
|
||||
}
|
||||
|
||||
// Customer Invoice lines
|
||||
$sql = "SELECT f.rowid as facid, f.facnumber as ref, f.datef, f.type as ftype,";
|
||||
$sql = "SELECT f.rowid as facid, f.ref as ref, f.datef, f.type as ftype,";
|
||||
$sql.= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_sell as code_sell, p.tva_tx as tva_tx_prod,";
|
||||
$sql.= " aa.rowid as aarowid,";
|
||||
@ -233,7 +233,7 @@ if ($search_lineid) {
|
||||
$sql .= natural_search("l.rowid", $search_lineid, 1);
|
||||
}
|
||||
if (strlen(trim($search_invoice))) {
|
||||
$sql .= natural_search("f.facnumber", $search_invoice);
|
||||
$sql .= natural_search("f.ref", $search_invoice);
|
||||
}
|
||||
if (strlen(trim($search_ref))) {
|
||||
$sql .= natural_search("p.ref", $search_ref);
|
||||
@ -288,7 +288,7 @@ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
} else {
|
||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")";
|
||||
}
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND f.entity IN (" . getEntity('invoice', 0) . ")"; // We don't share object for accountancy
|
||||
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
@ -399,8 +399,8 @@ if ($result) {
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.facnumber", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.facnumber, l.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
|
||||
//print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
|
||||
|
||||
@ -917,7 +917,7 @@ if (empty($action) || $action == 'view') {
|
||||
print '<div class="tabsAction tabsActionNoBottom">';
|
||||
if (! empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) print '<input type="button" class="butAction" name="exportcsv" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
||||
if ($in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||
else print '<a class="butActionRefused" name="writebookkeeping">' . $langs->trans("WriteBookKeeping") . '</a>';
|
||||
else print '<a class="butActionRefused classfortooltip" name="writebookkeeping">' . $langs->trans("WriteBookKeeping") . '</a>';
|
||||
print '</div>';
|
||||
|
||||
// TODO Avoid using js. We can use a direct link with $param
|
||||
@ -1179,7 +1179,7 @@ function getSourceDocRef($val, $typerecord)
|
||||
$sqlmid = '';
|
||||
if ($typerecord == 'payment')
|
||||
{
|
||||
$sqlmid = 'SELECT payfac.fk_facture as id, f.facnumber as ref';
|
||||
$sqlmid = 'SELECT payfac.fk_facture as id, f.ref as ref';
|
||||
$sqlmid .= " FROM ".MAIN_DB_PREFIX."paiement_facture as payfac, ".MAIN_DB_PREFIX."facture as f";
|
||||
$sqlmid .= " WHERE payfac.fk_facture = f.rowid AND payfac.fk_paiement=" . $val["paymentid"];
|
||||
$ref = $langs->trans("Invoice");
|
||||
|
||||
@ -561,11 +561,11 @@ if (empty($action) || $action == 'view') {
|
||||
}
|
||||
print '<div class="tabsAction tabsActionNoBottom">';
|
||||
if (empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') {
|
||||
print '<input type="button" class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
|
||||
print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
|
||||
}
|
||||
else {
|
||||
if ($in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||
else print '<a href="#" class="butActionRefused" name="writebookkeeping">' . $langs->trans("WriteBookKeeping") . '</a>';
|
||||
else print '<a href="#" class="butActionRefused classfortooltip" name="writebookkeeping">' . $langs->trans("WriteBookKeeping") . '</a>';
|
||||
}
|
||||
//print '<input type="button" class="butAction" name="exportcsv" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
||||
print '</div>';
|
||||
|
||||
@ -748,11 +748,11 @@ if (empty($action) || $action == 'view') {
|
||||
print '<div class="tabsAction tabsActionNoBottom">';
|
||||
if (! empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) print '<input type="button" class="butAction" name="exportcsv" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
||||
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
|
||||
print '<input type="button" class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
|
||||
print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
|
||||
}
|
||||
else {
|
||||
if ($in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||
else print '<a href="#" class="butActionRefused" name="writebookkeeping">' . $langs->trans("WriteBookKeeping") . '</a>';
|
||||
else print '<a href="#" class="butActionRefused classfortooltip" name="writebookkeeping">' . $langs->trans("WriteBookKeeping") . '</a>';
|
||||
}
|
||||
print '</div>';
|
||||
|
||||
|
||||
@ -97,7 +97,7 @@ if (! GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end)
|
||||
|
||||
$idpays = $mysoc->country_id;
|
||||
|
||||
$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef as df, f.ref_client, f.date_lim_reglement as dlr, f.close_code,";
|
||||
$sql = "SELECT f.rowid, f.ref, f.type, f.datef as df, f.ref_client, f.date_lim_reglement as dlr, f.close_code,";
|
||||
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.situation_percent, fd.vat_src_code,";
|
||||
$sql .= " s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
|
||||
$sql .= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
|
||||
@ -107,7 +107,7 @@ $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid =
|
||||
$sql .= " JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
|
||||
$sql .= " JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
|
||||
$sql .= " WHERE fd.fk_code_ventilation > 0";
|
||||
$sql .= " AND f.entity IN (".getEntity('facture', 0).')'; // We don't share object for accountancy, we use source object sharing
|
||||
$sql .= " AND f.entity IN (".getEntity('invoice', 0).')'; // We don't share object for accountancy, we use source object sharing
|
||||
$sql .= " AND f.fk_statut > 0";
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { // Non common setup
|
||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
||||
@ -195,7 +195,7 @@ if ($result) {
|
||||
// Invoice lines
|
||||
$tabfac[$obj->rowid]["date"] = $db->jdate($obj->df);
|
||||
$tabfac[$obj->rowid]["datereg"] = $db->jdate($obj->dlr);
|
||||
$tabfac[$obj->rowid]["ref"] = $obj->facnumber;
|
||||
$tabfac[$obj->rowid]["ref"] = $obj->ref;
|
||||
$tabfac[$obj->rowid]["type"] = $obj->type;
|
||||
$tabfac[$obj->rowid]["description"] = $obj->label_compte;
|
||||
$tabfac[$obj->rowid]["close_code"] = $obj->close_code; // close_code = 'replaced' for replacement invoices (not used in most european countries)
|
||||
@ -686,11 +686,11 @@ if (empty($action) || $action == 'view') {
|
||||
print '<div class="tabsAction tabsActionNoBottom">';
|
||||
if (! empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) print '<input type="button" class="butAction" name="exportcsv" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
||||
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
|
||||
print '<input type="button" class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
|
||||
print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
|
||||
}
|
||||
else {
|
||||
if ($in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||
else print '<a href="#" class="butActionRefused" name="writebookkeeping">' . $langs->trans("WriteBookKeeping") . '</a>';
|
||||
else print '<a href="#" class="butActionRefused classfortooltip" name="writebookkeeping">' . $langs->trans("WriteBookKeeping") . '</a>';
|
||||
}
|
||||
print '</div>';
|
||||
|
||||
|
||||
@ -96,7 +96,7 @@ $facturefournisseur_static = new FactureFournisseur($db);
|
||||
$formaccounting = new FormAccounting($db);
|
||||
|
||||
if (! empty($id)) {
|
||||
$sql = "SELECT f.ref as facnumber, f.rowid as facid, l.fk_product, l.description, l.rowid, l.fk_code_ventilation, ";
|
||||
$sql = "SELECT f.ref as ref, f.rowid as facid, l.fk_product, l.description, l.rowid, l.fk_code_ventilation, ";
|
||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label";
|
||||
$sql .= ", aa.account_number, aa.label";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as l";
|
||||
@ -129,7 +129,7 @@ if (! empty($id)) {
|
||||
|
||||
// ref invoice
|
||||
print '<tr><td>' . $langs->trans("BillsSuppliers") . '</td>';
|
||||
$facturefournisseur_static->ref = $objp->facnumber;
|
||||
$facturefournisseur_static->ref = $objp->ref;
|
||||
$facturefournisseur_static->id = $objp->facid;
|
||||
print '<td>' . $facturefournisseur_static->getNomUrl(1) . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* Copyright (C) 2005-2018 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2012-2018 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2015-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2015-2018 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -23,9 +23,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/adherents/card.php
|
||||
* \ingroup member
|
||||
* \brief Page of member
|
||||
* \file htdocs/adherents/card.php
|
||||
* \ingroup member
|
||||
* \brief Page of member
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
@ -249,6 +249,7 @@ if (empty($reshook))
|
||||
}
|
||||
$lastname=$_POST["lastname"];
|
||||
$firstname=$_POST["firstname"];
|
||||
$gender = $_POST["gender"];
|
||||
$societe=$_POST["societe"];
|
||||
$morphy=$_POST["morphy"];
|
||||
$login=$_POST["login"];
|
||||
@ -284,6 +285,7 @@ if (empty($reshook))
|
||||
$object->civility_id = trim(GETPOST("civility_id",'alpha'));
|
||||
$object->firstname = trim(GETPOST("firstname",'alpha'));
|
||||
$object->lastname = trim(GETPOST("lastname",'alpha'));
|
||||
$object->gender = trim(GETPOST("gender",'alpha'));
|
||||
$object->login = trim(GETPOST("login",'alpha'));
|
||||
$object->pass = trim(GETPOST("pass",'alpha'));
|
||||
|
||||
@ -434,6 +436,7 @@ if (empty($reshook))
|
||||
$civility_id=GETPOST("civility_id",'int');
|
||||
$lastname=GETPOST("lastname",'alpha');
|
||||
$firstname=GETPOST("firstname",'alpha');
|
||||
$gender=GETPOST("gender",'alpha');
|
||||
$societe=GETPOST("societe",'alpha');
|
||||
$address=GETPOST("address",'alpha');
|
||||
$zip=GETPOST("zipcode",'alpha');
|
||||
@ -462,6 +465,7 @@ if (empty($reshook))
|
||||
$object->civility_id = $civility_id;
|
||||
$object->firstname = $firstname;
|
||||
$object->lastname = $lastname;
|
||||
$object->gender = $gender;
|
||||
$object->societe = $societe;
|
||||
$object->address = $address;
|
||||
$object->zip = $zip;
|
||||
@ -954,6 +958,13 @@ else
|
||||
print '<tr><td id="tdfirstname">'.$langs->trans("Firstname").'</td><td><input type="text" name="firstname" class="minwidth300" maxlength="50" value="'.(GETPOST('firstname','alpha')?GETPOST('firstname','alpha'):$object->firstname).'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Gender
|
||||
print '<tr><td>'.$langs->trans("Gender").'</td>';
|
||||
print '<td>';
|
||||
$arraygender=array('man'=>$langs->trans("Genderman"),'woman'=>$langs->trans("Genderwoman"));
|
||||
print $form->selectarray('gender', $arraygender, GETPOST('gender'), 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// EMail
|
||||
print '<tr><td>'.($conf->global->ADHERENT_MAIL_REQUIRED?'<span class="fieldrequired">':'').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'</span>':'').'</td><td><input type="text" name="member_email" class="minwidth300" maxlength="255" value="'.(GETPOST('member_email','alpha')?GETPOST('member_email','alpha'):$object->email).'"></td></tr>';
|
||||
|
||||
@ -1031,7 +1042,7 @@ else
|
||||
// Categories
|
||||
if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire))
|
||||
{
|
||||
print '<tr><td>' . fieldLabel('Categories', 'memcars') . '</td><td>';
|
||||
print '<tr><td>' .$form->editfieldkey("Categories", 'memcats', '', $object, 0) . '</td><td>';
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_MEMBER, null, 'parent', null, null, 1);
|
||||
print $form->multiselectarray('memcats', $cate_arbo, GETPOST('memcats', 'array'), null, null, null, null, '100%');
|
||||
print "</td></tr>";
|
||||
@ -1154,7 +1165,7 @@ else
|
||||
print '<tr><td><span class="fieldrequired">'.$langs->trans("Login").' / '.$langs->trans("Id").'</span></td><td><input type="text" name="login" class="minwidth300" maxlength="50" value="'.(isset($_POST["login"])?GETPOST("login",'alpha',2):$object->login).'"></td></tr>';
|
||||
}
|
||||
|
||||
// Password
|
||||
// Password
|
||||
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
|
||||
{
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Password").'</td><td><input type="password" name="pass" class="minwidth300" maxlength="50" value="'.(isset($_POST["pass"])?GETPOST("pass",'',2):$object->pass).'"></td></tr>';
|
||||
@ -1196,6 +1207,13 @@ else
|
||||
print '<tr><td id="tdfirstname">'.$langs->trans("Firstname").'</td><td><input type="text" name="firstname" class="minwidth300" maxlength="50" value="'.(isset($_POST["firstname"])?GETPOST("firstname",'',3):$object->firstname).'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Gender
|
||||
print '<tr><td>'.$langs->trans("Gender").'</td>';
|
||||
print '<td>';
|
||||
$arraygender=array('man'=>$langs->trans("Genderman"),'woman'=>$langs->trans("Genderwoman"));
|
||||
print $form->selectarray('gender', $arraygender, GETPOST('gender')?GETPOST('gender'):$object->gender, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Photo
|
||||
print '<tr><td>'.$langs->trans("Photo").'</td>';
|
||||
print '<td class="hideonsmartphone" valign="middle">';
|
||||
@ -1281,7 +1299,7 @@ else
|
||||
// Categories
|
||||
if (! empty( $conf->categorie->enabled ) && !empty( $user->rights->categorie->lire ))
|
||||
{
|
||||
print '<tr><td>' . fieldLabel('Categories', 'memcats') . '</td>';
|
||||
print '<tr><td>' . $form->editfieldkey("Categories", 'memcats', '', $object, 0) . '</td>';
|
||||
print '<td>';
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_MEMBER, null, null, null, null, 1);
|
||||
$c = new Categorie($db);
|
||||
@ -1583,6 +1601,12 @@ else
|
||||
print '<tr><td>'.$langs->trans("Nature").'</td><td class="valeur" >'.$object->getmorphylib().'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Gender
|
||||
print '<tr><td>'.$langs->trans("Gender").'</td>';
|
||||
print '<td>';
|
||||
if ($object->gender) print $langs->trans("Gender".$object->gender);
|
||||
print '</td></tr>';
|
||||
|
||||
// Company
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$object->societe.'</td></tr>';
|
||||
|
||||
@ -1637,11 +1661,8 @@ else
|
||||
if (! empty($conf->societe->enabled))
|
||||
{
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans("LinkedToDolibarrThirdParty");
|
||||
print '</td>';
|
||||
if ($action != 'editthirdparty' && $user->rights->adherent->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editthirdparty&rowid='.$object->id.'">'.img_edit($langs->trans('SetLinkToThirdParty'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
$editenable = $user->rights->adherent->creer;
|
||||
print $form->editfieldkey('LinkedToDolibarrThirdParty', 'thirdparty', '', $object, $editenable);
|
||||
print '</td><td colspan="2" class="valeur">';
|
||||
if ($action == 'editthirdparty')
|
||||
{
|
||||
@ -1675,19 +1696,8 @@ else
|
||||
|
||||
// Login Dolibarr
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans("LinkedToDolibarrUser");
|
||||
print '</td>';
|
||||
if ($action != 'editlogin' && $user->rights->adherent->creer)
|
||||
{
|
||||
print '<td align="right">';
|
||||
if ($user->rights->user->user->creer)
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=editlogin&rowid='.$object->id.'">'.img_edit($langs->trans('SetLinkToUser'),1).'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
print '</tr></table>';
|
||||
$editenable = $user->rights->adherent->creer && $user->rights->user->user->creer;
|
||||
print $form->editfieldkey('LinkedToDolibarrUser', 'login', '', $object, $editenable);
|
||||
print '</td><td colspan="2" class="valeur">';
|
||||
if ($action == 'editlogin')
|
||||
{
|
||||
@ -1760,16 +1770,16 @@ else
|
||||
if ($object->statut >= 1)
|
||||
{
|
||||
if ($object->email) print '<div class="inline-block divButAction"><a class="butAction" href="card.php?rowid='.$object->id.'&action=sendinfo">'.$langs->trans("SendCardByMail")."</a></div>\n";
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NoEMail")).'">'.$langs->trans("SendCardByMail")."</a></div>\n";
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NoEMail")).'">'.$langs->trans("SendCardByMail")."</a></div>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><font class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$langs->trans("SendCardByMail")."</font></div>";
|
||||
print '<div class="inline-block divButAction"><font class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$langs->trans("SendCardByMail")."</font></div>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><font class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("SendCardByMail")."</font></div>";
|
||||
print '<div class="inline-block divButAction"><font class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("SendCardByMail")."</font></div>";
|
||||
}*/
|
||||
|
||||
// Modify
|
||||
@ -1779,7 +1789,7 @@ else
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><font class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Modify").'</font></div>';
|
||||
print '<div class="inline-block divButAction"><font class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Modify").'</font></div>';
|
||||
}
|
||||
|
||||
// Validate
|
||||
@ -1791,7 +1801,7 @@ else
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><font class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Validate").'</font></div>';
|
||||
print '<div class="inline-block divButAction"><font class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Validate").'</font></div>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -1804,7 +1814,7 @@ else
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><font class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Reenable")."</font></div>";
|
||||
print '<div class="inline-block divButAction"><font class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Reenable")."</font></div>";
|
||||
}
|
||||
}
|
||||
|
||||
@ -1817,7 +1827,7 @@ else
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><font class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Resiliate")."</font></div>";
|
||||
print '<div class="inline-block divButAction"><font class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Resiliate")."</font></div>";
|
||||
}
|
||||
}
|
||||
|
||||
@ -1827,11 +1837,11 @@ else
|
||||
if ($user->rights->societe->creer)
|
||||
{
|
||||
if ($object->statut != -1) print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&action=create_thirdparty">'.$langs->trans("CreateDolibarrThirdParty").'</a></div>';
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$langs->trans("CreateDolibarrThirdParty").'</a></div>';
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$langs->trans("CreateDolibarrThirdParty").'</a></div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><font class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("CreateDolibarrThirdParty")."</font></div>";
|
||||
print '<div class="inline-block divButAction"><font class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("CreateDolibarrThirdParty")."</font></div>";
|
||||
}
|
||||
}
|
||||
|
||||
@ -1841,11 +1851,11 @@ else
|
||||
if ($user->rights->user->user->creer)
|
||||
{
|
||||
if ($object->statut != -1) print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&action=create_user">'.$langs->trans("CreateDolibarrLogin").'</a></div>';
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$langs->trans("CreateDolibarrLogin").'</a></div>';
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$langs->trans("CreateDolibarrLogin").'</a></div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><font class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("CreateDolibarrLogin")."</font></div>";
|
||||
print '<div class="inline-block divButAction"><font class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("CreateDolibarrLogin")."</font></div>";
|
||||
}
|
||||
}
|
||||
|
||||
@ -1856,7 +1866,7 @@ else
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><font class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Delete")."</font></div>";
|
||||
print '<div class="inline-block divButAction"><font class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Delete")."</font></div>";
|
||||
}
|
||||
|
||||
// Action SPIP
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
* Copyright (C) 2009-2017 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2014-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2014-2018 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2015-2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
@ -175,6 +175,7 @@ class Adherent extends CommonObject
|
||||
public $datem;
|
||||
public $datevalid;
|
||||
|
||||
public $gender;
|
||||
public $birth;
|
||||
|
||||
/**
|
||||
@ -507,17 +508,18 @@ class Adherent extends CommonObject
|
||||
dol_syslog(get_class($this)."::update notrigger=".$notrigger.", nosyncuser=".$nosyncuser.", nosyncuserpass=".$nosyncuserpass." nosyncthirdparty=".$nosyncthirdparty.", email=".$this->email);
|
||||
|
||||
// Clean parameters
|
||||
$this->lastname=trim($this->lastname)?trim($this->lastname):trim($this->lastname);
|
||||
$this->firstname=trim($this->firstname)?trim($this->firstname):trim($this->firstname);
|
||||
$this->address=($this->address?$this->address:$this->address);
|
||||
$this->zip=($this->zip?$this->zip:$this->zip);
|
||||
$this->town=($this->town?$this->town:$this->town);
|
||||
$this->country_id=($this->country_id > 0?$this->country_id:$this->country_id);
|
||||
$this->state_id=($this->state_id > 0?$this->state_id:$this->state_id);
|
||||
$this->lastname = trim($this->lastname)?trim($this->lastname):trim($this->lastname);
|
||||
$this->firstname = trim($this->firstname)?trim($this->firstname):trim($this->firstname);
|
||||
$this->gender = trim($this->gender);
|
||||
$this->address = ($this->address?$this->address:$this->address);
|
||||
$this->zip = ($this->zip?$this->zip:$this->zip);
|
||||
$this->town = ($this->town?$this->town:$this->town);
|
||||
$this->country_id = ($this->country_id > 0?$this->country_id:$this->country_id);
|
||||
$this->state_id = ($this->state_id > 0?$this->state_id:$this->state_id);
|
||||
if (! empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->lastname=ucwords(trim($this->lastname));
|
||||
if (! empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->firstname=ucwords(trim($this->firstname));
|
||||
$this->note_public=($this->note_public?$this->note_public:$this->note_public);
|
||||
$this->note_private=($this->note_private?$this->note_private:$this->note_private);
|
||||
$this->note_public = ($this->note_public?$this->note_public:$this->note_public);
|
||||
$this->note_private = ($this->note_private?$this->note_private:$this->note_private);
|
||||
|
||||
// Check parameters
|
||||
if (! empty($conf->global->ADHERENT_MAIL_REQUIRED) && ! isValidEMail($this->email))
|
||||
@ -533,6 +535,7 @@ class Adherent extends CommonObject
|
||||
$sql.= " civility = ".($this->civility_id?"'".$this->db->escape($this->civility_id)."'":"null");
|
||||
$sql.= ", firstname = ".($this->firstname?"'".$this->db->escape($this->firstname)."'":"null");
|
||||
$sql.= ", lastname = ".($this->lastname?"'".$this->db->escape($this->lastname)."'":"null");
|
||||
$sql.= ", gender = ".($this->gender != -1 ? "'".$this->db->escape($this->gender)."'" : "null"); // 'man' or 'woman'
|
||||
$sql.= ", login = ".($this->login?"'".$this->db->escape($this->login)."'":"null");
|
||||
$sql.= ", societe = ".($this->societe?"'".$this->db->escape($this->societe)."'":"null");
|
||||
$sql.= ", fk_soc = ".($this->fk_soc > 0?$this->db->escape($this->fk_soc):"null");
|
||||
@ -639,15 +642,17 @@ class Adherent extends CommonObject
|
||||
$luser->civility_id=$this->civility_id;
|
||||
$luser->firstname=$this->firstname;
|
||||
$luser->lastname=$this->lastname;
|
||||
$luser->gender=$this->gender;
|
||||
$luser->pass=$this->pass;
|
||||
$luser->societe_id=$this->societe;
|
||||
|
||||
$luser->birth=$this->birth;
|
||||
$luser->address=$this->address;
|
||||
$luser->zip=$this->zip;
|
||||
$luser->town=$this->town;
|
||||
$luser->country_id=$this->country_id;
|
||||
$luser->state_id=$this->state_id;
|
||||
|
||||
$luser->address=$this->address;
|
||||
$luser->zip=$this->zip;
|
||||
$luser->town=$this->town;
|
||||
$luser->country_id=$this->country_id;
|
||||
$luser->state_id=$this->state_id;
|
||||
|
||||
$luser->email=$this->email;
|
||||
$luser->skype=$this->skype;
|
||||
@ -1179,7 +1184,7 @@ class Adherent extends CommonObject
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$sql = "SELECT d.rowid, d.ref_ext, d.civility as civility_id, d.firstname, d.lastname, d.societe as company, d.fk_soc, d.statut, d.public, d.address, d.zip, d.town, d.note_private,";
|
||||
$sql = "SELECT d.rowid, d.ref_ext, d.civility as civility_id, d.gender, d.firstname, d.lastname, d.societe as company, d.fk_soc, d.statut, d.public, d.address, d.zip, d.town, d.note_private,";
|
||||
$sql.= " d.note_public,";
|
||||
$sql.= " d.email, d.skype, d.twitter, d.facebook, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass, d.pass_crypted,";
|
||||
$sql.= " d.photo, d.fk_adherent_type, d.morphy, d.entity,";
|
||||
@ -1226,6 +1231,7 @@ class Adherent extends CommonObject
|
||||
$this->civility_id = $obj->civility_id;
|
||||
$this->firstname = $obj->firstname;
|
||||
$this->lastname = $obj->lastname;
|
||||
$this->gender = $obj->gender;
|
||||
$this->login = $obj->login;
|
||||
$this->societe = $obj->company;
|
||||
$this->company = $obj->company;
|
||||
@ -2338,6 +2344,7 @@ class Adherent extends CommonObject
|
||||
$this->civility_id = 0;
|
||||
$this->lastname = 'DOLIBARR';
|
||||
$this->firstname = 'SPECIMEN';
|
||||
$this->gender='man';
|
||||
$this->login='dolibspec';
|
||||
$this->pass='dolibspec';
|
||||
$this->societe = 'Societe ABC';
|
||||
|
||||
@ -337,11 +337,14 @@ class Subscription extends CommonObject
|
||||
/**
|
||||
* Return clicable name (with picto eventually)
|
||||
*
|
||||
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
|
||||
* @param int $notooltip 1=Disable tooltip
|
||||
* @return string Chaine avec URL
|
||||
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
|
||||
* @param int $notooltip 1=Disable tooltip
|
||||
* @param string $option Page for link ('', 'nolink', ...)
|
||||
* @param string $morecss Add more css on link
|
||||
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
||||
* @return string Chaine avec URL
|
||||
*/
|
||||
function getNomUrl($withpicto=0, $notooltip=0)
|
||||
function getNomUrl($withpicto=0, $notooltip=0, $option='', $morecss='', $save_lastsearch_value=-1)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
@ -350,8 +353,18 @@ class Subscription extends CommonObject
|
||||
$langs->load("members");
|
||||
$label=$langs->trans("ShowSubscription").': '.$this->ref;
|
||||
|
||||
$linkstart = '<a href="'.DOL_URL_ROOT.'/adherents/subscription/card.php?rowid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$linkend='</a>';
|
||||
$url = DOL_URL_ROOT.'/adherents/subscription/card.php?rowid='.$this->id;
|
||||
|
||||
if ($option != 'nolink')
|
||||
{
|
||||
// Add param to save lastsearch_values or not
|
||||
$add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
|
||||
if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
|
||||
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
|
||||
}
|
||||
|
||||
$linkstart = '<a href="'.$url.'" class="classfortooltip" title="'.dol_escape_htmltag($label, 1).'">';
|
||||
$linkend = '</a>';
|
||||
|
||||
$picto='payment';
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2013-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2014-2016 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2018 Alexandre Spangaro <aspangaro@zendsi.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
|
||||
@ -20,9 +21,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/adherents/list.php
|
||||
* \ingroup member
|
||||
* \brief Page to list all members of foundation
|
||||
* \file htdocs/adherents/list.php
|
||||
* \ingroup member
|
||||
* \brief Page to list all members of foundation
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
@ -48,6 +49,7 @@ $search=GETPOST("search",'alpha');
|
||||
$search_ref=GETPOST("search_ref",'alpha');
|
||||
$search_lastname=GETPOST("search_lastname",'alpha');
|
||||
$search_firstname=GETPOST("search_firstname",'alpha');
|
||||
$search_gender=GETPOST("search_gender",'alpha');
|
||||
$search_civility=GETPOST("search_civility",'alpha');
|
||||
$search_login=GETPOST("search_login",'alpha');
|
||||
$search_address=GETPOST("search_address",'alpha');
|
||||
@ -79,8 +81,9 @@ $pagenext = $page + 1;
|
||||
if (! $sortorder) { $sortorder=($filter=='outofdate'?"DESC":"ASC"); }
|
||||
if (! $sortfield) { $sortfield=($filter=='outofdate'?"d.datefin":"d.lastname"); }
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$object = new Adherent($db);
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('memberlist'));
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
@ -109,6 +112,7 @@ $arrayfields=array(
|
||||
'd.civility'=>array('label'=>$langs->trans("Civility"), 'checked'=>0),
|
||||
'd.lastname'=>array('label'=>$langs->trans("Lastname"), 'checked'=>1),
|
||||
'd.firstname'=>array('label'=>$langs->trans("Firstname"), 'checked'=>1),
|
||||
'd.gender'=>array('label'=>$langs->trans("Gender"), 'checked'=>0),
|
||||
'd.company'=>array('label'=>$langs->trans("Company"), 'checked'=>1),
|
||||
'd.login'=>array('label'=>$langs->trans("Login"), 'checked'=>1),
|
||||
'd.morphy'=>array('label'=>$langs->trans("MorPhy"), 'checked'=>1),
|
||||
@ -162,6 +166,7 @@ if (empty($reshook))
|
||||
$search_ref="";
|
||||
$search_lastname="";
|
||||
$search_firstname="";
|
||||
$search_gender="";
|
||||
$search_civility="";
|
||||
$search_login="";
|
||||
$search_company="";
|
||||
@ -205,7 +210,7 @@ $memberstatic=new Adherent($db);
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
$sql = "SELECT d.rowid, d.login, d.lastname, d.firstname, d.societe as company, d.fk_soc,";
|
||||
$sql = "SELECT d.rowid, d.login, d.lastname, d.firstname, d.gender, d.societe as company, d.fk_soc,";
|
||||
$sql.= " d.civility, d.datefin, d.address, d.zip, d.town, d.state_id, d.country,";
|
||||
$sql.= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.skype, d.birth, d.public, d.photo,";
|
||||
$sql.= " d.fk_adherent_type as type_id, d.morphy, d.statut, d.datec as date_creation, d.tms as date_update,";
|
||||
@ -240,6 +245,7 @@ if ($search_ref)
|
||||
if ($search_civility) $sql.= natural_search("d.civility", $search_civility);
|
||||
if ($search_firstname) $sql.= natural_search("d.firstname", $search_firstname);
|
||||
if ($search_lastname) $sql.= natural_search(array("d.firstname", "d.lastname", "d.societe"), $search_lastname);
|
||||
if ($search_gender != '' && $search_gender != '-1') $sql.= " AND d.gender = '".$search_gender."'";
|
||||
if ($search_login) $sql.= natural_search("d.login", $search_login);
|
||||
if ($search_email) $sql.= natural_search("d.email", $search_email);
|
||||
if ($search_town) $sql.= natural_search("d.town",$search_town);
|
||||
@ -329,6 +335,7 @@ if ($search_nom) $param.="&search_nom=".urlencode($search_nom);
|
||||
if ($search_civility) $param.="&search_civility=".urlencode($search_civility);
|
||||
if ($search_firstname) $param.="&search_firstname=".urlencode($search_firstname);
|
||||
if ($search_lastname) $param.="&search_lastname=".urlencode($search_lastname);
|
||||
if ($search_gender) $param.="&search_gender=".urlencode($search_gender);
|
||||
if ($search_login) $param.="&search_login=".urlencode($search_login);
|
||||
if ($search_email) $param.="&search_email=".urlencode($search_email);
|
||||
if ($search_company) $param.="&search_company=".urlencode($search_company);
|
||||
@ -348,8 +355,8 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
|
||||
// List of mass actions available
|
||||
$arrayofmassactions = array(
|
||||
// 'presend'=>$langs->trans("SendByMail"),
|
||||
// 'builddoc'=>$langs->trans("PDFMerge"),
|
||||
//'presend'=>$langs->trans("SendByMail"),
|
||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
if ($user->rights->adherent->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
||||
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
@ -447,6 +454,13 @@ if (! empty($arrayfields['d.lastname']['checked']))
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat maxwidth50" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).'"></td>';
|
||||
}
|
||||
if (! empty($arrayfields['d.gender']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
$arraygender=array('man'=>$langs->trans("Genderman"),'woman'=>$langs->trans("Genderwoman"));
|
||||
print $form->selectarray('search_gender', $arraygender, $search_gender, 1);
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['d.company']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
@ -575,6 +589,7 @@ if (! empty($arrayfields['d.ref']['checked'])) print_liste_field_titr
|
||||
if (! empty($arrayfields['d.civility']['checked'])) print_liste_field_titre($arrayfields['d.civility']['label'],$_SERVER["PHP_SELF"],'d.civility','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.firstname']['checked'])) print_liste_field_titre($arrayfields['d.firstname']['label'],$_SERVER["PHP_SELF"],'d.firstname','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.lastname']['checked'])) print_liste_field_titre($arrayfields['d.lastname']['label'],$_SERVER["PHP_SELF"],'d.lastname','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.gender']['checked'])) print_liste_field_titre($arrayfields['d.gender']['label'],$_SERVER['PHP_SELF'],'d.gender',$param,"","",$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.company']['checked'])) print_liste_field_titre($arrayfields['d.company']['label'],$_SERVER["PHP_SELF"],'d.societe','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.login']['checked'])) print_liste_field_titre($arrayfields['d.login']['label'],$_SERVER["PHP_SELF"],'d.login','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.morphy']['checked'])) print_liste_field_titre($arrayfields['d.morphy']['label'],$_SERVER["PHP_SELF"],'d.morphy','',$param,'',$sortfield,$sortorder);
|
||||
@ -603,6 +618,7 @@ print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="c
|
||||
print "</tr>\n";
|
||||
|
||||
$i = 0;
|
||||
$totalarray=array();
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
@ -613,6 +629,7 @@ while ($i < min($num, $limit))
|
||||
$memberstatic->civility_id=$obj->civility;
|
||||
$memberstatic->lastname=$obj->lastname;
|
||||
$memberstatic->firstname=$obj->firstname;
|
||||
$memberstatic->gender=$obj->gender;
|
||||
$memberstatic->statut=$obj->statut;
|
||||
$memberstatic->datefin= $datefin;
|
||||
$memberstatic->socid = $obj->fk_soc;
|
||||
@ -631,6 +648,7 @@ while ($i < min($num, $limit))
|
||||
if (! empty($conf->global->MAIN_SHOW_TECHNICAL_ID))
|
||||
{
|
||||
print '<td align="center">'.$obj->rowid.'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Ref
|
||||
@ -639,6 +657,7 @@ while ($i < min($num, $limit))
|
||||
print "<td>";
|
||||
print $memberstatic->getNomUrl(-1, 0, 'card', 'ref');
|
||||
print "</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Civility
|
||||
if (! empty($arrayfields['d.civility']['checked']))
|
||||
@ -646,6 +665,7 @@ while ($i < min($num, $limit))
|
||||
print "<td>";
|
||||
print $obj->civility;
|
||||
print "</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Firstname
|
||||
if (! empty($arrayfields['d.firstname']['checked']))
|
||||
@ -653,6 +673,7 @@ while ($i < min($num, $limit))
|
||||
print "<td>";
|
||||
print $obj->firstname;
|
||||
print "</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Lastname
|
||||
if (! empty($arrayfields['d.lastname']['checked']))
|
||||
@ -660,6 +681,15 @@ while ($i < min($num, $limit))
|
||||
print "<td>";
|
||||
print $obj->lastname;
|
||||
print "</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Gender
|
||||
if (! empty($arrayfields['d.gender']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
if ($obj->gender) print $langs->trans("Gender".$obj->gender);
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Company
|
||||
if (! empty($arrayfields['d.company']['checked']))
|
||||
@ -672,11 +702,13 @@ while ($i < min($num, $limit))
|
||||
if (! empty($arrayfields['d.login']['checked']))
|
||||
{
|
||||
print "<td>".$obj->login."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Moral/Physique
|
||||
if (! empty($arrayfields['d.morphy']['checked']))
|
||||
{
|
||||
print "<td>".$memberstatic->getmorphylib($obj->morphy)."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Type label
|
||||
if (! empty($arrayfields['t.libelle']['checked']))
|
||||
@ -686,6 +718,7 @@ while ($i < min($num, $limit))
|
||||
print '<td class="nowrap">';
|
||||
print $membertypestatic->getNomUrl(1,32);
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Address
|
||||
if (! empty($arrayfields['d.address']['checked']))
|
||||
@ -693,6 +726,7 @@ while ($i < min($num, $limit))
|
||||
print '<td class="nocellnopadd">';
|
||||
print $obj->address;
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Zip
|
||||
if (! empty($arrayfields['d.zip']['checked']))
|
||||
@ -828,6 +862,36 @@ while ($i < min($num, $limit))
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Show total line
|
||||
if (isset($totalarray['pos']))
|
||||
{
|
||||
print '<tr class="liste_total">';
|
||||
$i=0;
|
||||
while ($i < $totalarray['nbfield'])
|
||||
{
|
||||
$i++;
|
||||
if (! empty($totalarray['pos'][$i])) print '<td align="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
|
||||
else
|
||||
{
|
||||
if ($i == 1)
|
||||
{
|
||||
if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
}
|
||||
else print '<td></td>';
|
||||
}
|
||||
}
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// If no record found
|
||||
if ($num == 0)
|
||||
{
|
||||
$colspan=1;
|
||||
foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; }
|
||||
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
|
||||
}
|
||||
|
||||
$db->free($resql);
|
||||
|
||||
$parameters=array('sql' => $sql);
|
||||
|
||||
@ -654,7 +654,7 @@ if ($rowid > 0)
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($object->statut > 0) print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$rowid.'&action=addsubscription">'.$langs->trans("AddSubscription")."</a></div>";
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$langs->trans("AddSubscription").'</a></div>';
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$langs->trans("AddSubscription").'</a></div>';
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
@ -191,7 +191,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit')
|
||||
|
||||
dol_fiche_head($head, 'general', $langs->trans("Subscription"), 0, 'payment');
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/subscription/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/subscription/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
print "\n";
|
||||
print '<table class="border" width="100%">';
|
||||
@ -290,7 +290,7 @@ if ($rowid && $action != 'edit')
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/subscription/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/subscription/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
dol_banner_tab($object, 'rowid', $linkback, 1);
|
||||
|
||||
@ -368,7 +368,7 @@ if ($rowid && $action != 'edit')
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" title="'.$langs->trans("BankLineConciliated")."\" href=\"#\">".$langs->trans("Modify")."</a></div>";
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.$langs->trans("BankLineConciliated")."\" href=\"#\">".$langs->trans("Modify")."</a></div>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -28,12 +28,18 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
|
||||
$langs->load("members");
|
||||
$langs->load(array("members","companies"));
|
||||
|
||||
$filter=$_GET["filter"];
|
||||
$statut=isset($_GET["statut"])?$_GET["statut"]:1;
|
||||
$action=GETPOST('action','aZ09');
|
||||
$massaction=GETPOST('massaction','alpha');
|
||||
$confirm=GETPOST('confirm','alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
|
||||
$filter=GETPOST("filter","alpha");
|
||||
$statut=(GETPOSTISSET("statut")?GETPOST("statut","alpha"):1);
|
||||
$search_ref=GETPOST('search_ref','alpha');
|
||||
$search_lastname=GETPOST('search_lastname','alpha');
|
||||
$search_firstname=GETPOST('search_firstname','alpha');
|
||||
$search_login=GETPOST('search_login','alpha');
|
||||
$search_note=GETPOST('search_note','alpha');
|
||||
$search_account=GETPOST('search_account','int');
|
||||
@ -67,6 +73,20 @@ $search_array_options=$extrafields->getOptionalsFromPost($object->table_element,
|
||||
$fieldstosearchall = array(
|
||||
);
|
||||
$arrayfields=array(
|
||||
'd.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
|
||||
'd.lastname'=>array('label'=>$langs->trans("Lastname"), 'checked'=>1),
|
||||
'd.firstname'=>array('label'=>$langs->trans("Firstname"), 'checked'=>1),
|
||||
'd.login'=>array('label'=>$langs->trans("Login"), 'checked'=>1),
|
||||
't.libelle'=>array('label'=>$langs->trans("Type"), 'checked'=>1),
|
||||
'd.bank'=>array('label'=>$langs->trans("BankAccount"), 'checked'=>1, 'enabled'=>(! empty($conf->banque->enabled))),
|
||||
/*'d.note_public'=>array('label'=>$langs->trans("NotePublic"), 'checked'=>0),
|
||||
'd.note_private'=>array('label'=>$langs->trans("NotePrivate"), 'checked'=>0),*/
|
||||
'd.datedebut'=>array('label'=>$langs->trans("DateSubscription"), 'checked'=>1, 'position'=>100),
|
||||
'd.datefin'=>array('label'=>$langs->trans("EndSubscription"), 'checked'=>1, 'position'=>101),
|
||||
'd.amount'=>array('label'=>$langs->trans("Amount"), 'checked'=>1, 'position'=>102),
|
||||
'd.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
||||
'd.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
|
||||
// 'd.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000)
|
||||
);
|
||||
|
||||
// Security check
|
||||
@ -74,7 +94,7 @@ $result=restrictedArea($user,'adherent','','','cotisation');
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||
@ -111,15 +131,16 @@ if (empty($reshook))
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
$subscription=new Subscription($db);
|
||||
$adherent=new Adherent($db);
|
||||
$accountstatic=new Account($db);
|
||||
|
||||
llxHeader('',$langs->trans("ListOfSubscriptions"),'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros');
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
// List of subscriptions
|
||||
$sql = "SELECT d.rowid, d.login, d.firstname, d.lastname, d.societe, d.photo,";
|
||||
$sql.= " c.rowid as crowid, c.subscription,";
|
||||
$sql.= " c.dateadh,";
|
||||
$sql.= " c.datef,";
|
||||
$sql.= " c.dateadh, c.datef, c.datec as date_creation, c.tms as date_update,";
|
||||
$sql.= " c.fk_bank as bank, c.note,";
|
||||
$sql.= " b.fk_account";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."subscription as c";
|
||||
@ -136,253 +157,444 @@ if ($search_ref)
|
||||
if (is_numeric($search_ref)) $sql.= " AND (c.rowid = ".$db->escape($search_ref).")";
|
||||
else $sql.=" AND 1 = 2"; // Always wrong
|
||||
}
|
||||
if ($search_lastname) $sql.= natural_search(array('d.firstname','d.lastname','d.societe'), $search_lastname);
|
||||
if ($search_login) $sql.= natural_search('c.subscription', $search_login);
|
||||
if ($search_lastname) $sql.= natural_search(array('d.lastname','d.societe'), $search_lastname);
|
||||
if ($search_firstname) $sql.= natural_search(array('d.firstname'), $search_firstname);
|
||||
if ($search_login) $sql.= natural_search('d.login', $search_login);
|
||||
if ($search_note) $sql.= natural_search('c.note', $search_note);
|
||||
if ($search_account > 0) $sql.= " AND b.fk_account = ".$search_account;
|
||||
if ($search_account > 0) $sql.= " AND b.fk_account = ".urldecode($search_account);
|
||||
if ($search_amount) $sql.= natural_search('c.subscription', $search_amount, 1);
|
||||
|
||||
// Add where from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
|
||||
// Count total nb of records with no order and no limits
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) $nbtotalofrecords = $db->num_rows($resql);
|
||||
else dol_print_error($db);
|
||||
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
{
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Add limit
|
||||
$sql.= $db->plimit($limit+1, $offset);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
if (! $result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
|
||||
$arrayofselected=is_array($toselect)?$toselect:array();
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
$i = 0;
|
||||
$arrayofselected=is_array($toselect)?$toselect:array();
|
||||
|
||||
$title=$langs->trans("ListOfSubscriptions");
|
||||
if (! empty($date_select)) $title.=' ('.$langs->trans("Year").' '.$date_select.')';
|
||||
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$id = $obj->rowid;
|
||||
header("Location: ".DOL_URL_ROOT.'/adherents/subscription/card.php?id='.$id);
|
||||
exit;
|
||||
}
|
||||
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($statut != '') $param.="&statut=".$statut;
|
||||
if ($date_select) $param.="&date_select=".$date_select;
|
||||
if ($search_lastname) $param.="&search_lastname=".$search_lastname;
|
||||
if ($search_login) $param.="&search_login=".$search_login;
|
||||
if ($search_acount) $param.="&search_account=".$search_account;
|
||||
if ($search_amount) $param.="&search_amount=".$search_amount;
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
llxHeader('',$langs->trans("ListOfSubscriptions"),'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros');
|
||||
|
||||
// List of mass actions available
|
||||
$arrayofmassactions = array(
|
||||
//'presend'=>$langs->trans("SendByMail"),
|
||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
if ($user->rights->adherent->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
||||
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
$i = 0;
|
||||
|
||||
$newcardbutton='';
|
||||
if ($user->rights->adherent->cotisation->creer)
|
||||
{
|
||||
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/adherents/list.php?status=-1,1"><span class="valignmiddle">'.$langs->trans('NewSubscription').'</span>';
|
||||
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
|
||||
$newcardbutton.= '</a>';
|
||||
}
|
||||
$title=$langs->trans("ListOfSubscriptions");
|
||||
if (! empty($date_select)) $title.=' ('.$langs->trans("Year").' '.$date_select.')';
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="view" value="'.dol_escape_htmltag($view).'">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
||||
if ($statut != '') $param.="&statut=".urlencode($statut);
|
||||
if ($date_select) $param.="&date_select=".urlencode($date_select);
|
||||
if ($search_lastname) $param.="&search_lastname=".urlencode($search_lastname);
|
||||
if ($search_login) $param.="&search_login=".urlencode($search_login);
|
||||
if ($search_acount) $param.="&search_account=".urlencode($search_account);
|
||||
if ($search_amount) $param.="&search_amount=".urlencode($search_amount);
|
||||
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
||||
// Add $param from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, $newcardbutton, '', $limit);
|
||||
// List of mass actions available
|
||||
$arrayofmassactions = array(
|
||||
//'presend'=>$langs->trans("SendByMail"),
|
||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
//if ($user->rights->adherent->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
||||
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
$topicmail="Information";
|
||||
$modelmail="subscription";
|
||||
$objecttmp=new Subscription($db);
|
||||
$trackid='sub'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||
$newcardbutton='';
|
||||
if ($user->rights->adherent->cotisation->creer)
|
||||
{
|
||||
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/adherents/list.php?status=-1,1"><span class="valignmiddle">'.$langs->trans('NewSubscription').'</span>';
|
||||
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
|
||||
$newcardbutton.= '</a>';
|
||||
}
|
||||
|
||||
if ($sall)
|
||||
{
|
||||
print $langs->trans("Filter")." (".$langs->trans("Ref").", ".$langs->trans("Lastname").", ".$langs->trans("Firstname").", ".$langs->trans("EMail").", ".$langs->trans("Address")." ".$langs->trans("or")." ".$langs->trans("Town")."): ".$sall;
|
||||
}
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="view" value="'.dol_escape_htmltag($view).'">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
|
||||
$moreforfilter = '';
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, $newcardbutton, '', $limit);
|
||||
|
||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1);
|
||||
$topicmail="Information";
|
||||
$modelmail="subscription";
|
||||
$objecttmp=new Subscription($db);
|
||||
$trackid='sub'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
if ($sall)
|
||||
{
|
||||
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
||||
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'</div>';
|
||||
}
|
||||
|
||||
// Line for filters fields
|
||||
print '<tr class="liste_titre_filter">';
|
||||
$moreforfilter = '';
|
||||
|
||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1);
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
|
||||
|
||||
// Line for filters fields
|
||||
print '<tr class="liste_titre_filter">';
|
||||
|
||||
// Line numbering
|
||||
if (! empty($conf->global->MAIN_SHOW_TECHNICAL_ID))
|
||||
{
|
||||
print '<td class="liste_titre"> </td>';
|
||||
}
|
||||
|
||||
// Ref
|
||||
if (! empty($arrayfields['d.ref']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'" size="4"></td>';
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['d.lastname']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).'" size="12"></td>';
|
||||
print '<input class="flat" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).'" size="7"></td>';
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['d.firstname']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_firstname" value="'.dol_escape_htmltag($search_firstname).'" size="12"></td>';
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['d.login']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).'" size="7"></td>';
|
||||
}
|
||||
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_note" value="'.dol_escape_htmltag($search_note).'" size="7"></td>';
|
||||
if (! empty($arrayfields['t.libelle']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print $form->select_comptes($search_account, 'search_account', 0, '', 1);
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['d.bank']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print $form->select_comptes($search_account, 'search_account', 0, '', 1);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['d.date_debut']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre"> </td>';
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['d.date_fin']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre"> </td>';
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['d.amount']['checked']))
|
||||
{
|
||||
print '<td align="right" class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="search_amount" value="'.dol_escape_htmltag($search_amount).'" size="4">';
|
||||
print '</td>';
|
||||
|
||||
// Action column
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$searchpicto=$form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"c.rowid",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre("Name",$_SERVER["PHP_SELF"],"d.lastname",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre("Login",$_SERVER["PHP_SELF"],"d.login",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"c.note",$param,"",'align="left"',$sortfield,$sortorder);
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
print_liste_field_titre("Account",$_SERVER["PHP_SELF"],"b.fk_account",$pram,"","",$sortfield,$sortorder);
|
||||
}
|
||||
print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"c.dateadh",$param,"",'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre("DateEnd",$_SERVER["PHP_SELF"],"c.datef",$param,"",'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre("Amount",$_SERVER["PHP_SELF"],"c.subscription",$param,"",'align="right"',$sortfield,$sortorder);
|
||||
//print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print_liste_field_titre('', $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
// Static objects
|
||||
$subscription=new Subscription($db);
|
||||
$adherent=new Adherent($db);
|
||||
$accountstatic=new Account($db);
|
||||
|
||||
$total=0;
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$total+=$obj->subscription;
|
||||
|
||||
$subscription->ref=$obj->crowid;
|
||||
$subscription->id=$obj->crowid;
|
||||
|
||||
$adherent->lastname=$obj->lastname;
|
||||
$adherent->firstname=$obj->firstname;
|
||||
$adherent->ref=$obj->rowid;
|
||||
$adherent->id=$obj->rowid;
|
||||
$adherent->statut=$obj->statut;
|
||||
$adherent->login=$obj->login;
|
||||
$adherent->photo=$obj->photo;
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Ref
|
||||
print '<td>'.$subscription->getNomUrl(1).'</td>';
|
||||
|
||||
// Lastname
|
||||
print '<td>'.$adherent->getNomUrl(-1).'</td>';
|
||||
|
||||
// Login
|
||||
print '<td>'.$adherent->login.'</td>';
|
||||
|
||||
// Libelle
|
||||
print '<td>';
|
||||
print dol_trunc($obj->note,32);
|
||||
print '</td>';
|
||||
|
||||
// Banque
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
if ($obj->fk_account > 0)
|
||||
{
|
||||
$accountstatic->id=$obj->fk_account;
|
||||
$accountstatic->fetch($obj->fk_account);
|
||||
//$accountstatic->label=$obj->label;
|
||||
print '<td>'.$accountstatic->getNomUrl(1).'</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<td>";
|
||||
print "</td>\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Date start
|
||||
print '<td align="center">'.dol_print_date($db->jdate($obj->dateadh),'day')."</td>\n";
|
||||
|
||||
// Date end
|
||||
print '<td align="center">'.dol_print_date($db->jdate($obj->datef),'day')."</td>\n";
|
||||
|
||||
// Price
|
||||
print '<td align="right">'.price($obj->subscription).'</td>';
|
||||
|
||||
print '<td></td>';
|
||||
|
||||
print "</tr>";
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Total
|
||||
|
||||
print '<tr class="liste_total">';
|
||||
print "<td>".$langs->trans("Total")."</td>\n";
|
||||
print "<td align=\"right\"> </td>\n";
|
||||
print "<td align=\"right\"> </td>\n";
|
||||
print "<td align=\"right\"> </td>\n";
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
print '<td> </td>';
|
||||
}
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td align="right">'.price($total)."</td>\n";
|
||||
print '<td></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
|
||||
|
||||
// Fields from hook
|
||||
$parameters=array('arrayfields'=>$arrayfields);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Date creation
|
||||
if (! empty($arrayfields['d.datec']['checked']))
|
||||
{
|
||||
dol_print_error($db);
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
// Date modification
|
||||
if (! empty($arrayfields['d.tms']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Action column
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$searchpicto=$form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
if (! empty($arrayfields['d.ref']['checked']))
|
||||
{
|
||||
print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"c.rowid",$param,"","",$sortfield,$sortorder);
|
||||
}
|
||||
if (! empty($arrayfields['d.lastname']['checked']))
|
||||
{
|
||||
print_liste_field_titre("LastName",$_SERVER["PHP_SELF"],"d.lastname",$param,"","",$sortfield,$sortorder);
|
||||
}
|
||||
if (! empty($arrayfields['d.firstname']['checked']))
|
||||
{
|
||||
print_liste_field_titre("FirstName",$_SERVER["PHP_SELF"],"d.firstname",$param,"","",$sortfield,$sortorder);
|
||||
}
|
||||
if (! empty($arrayfields['d.login']['checked']))
|
||||
{
|
||||
print_liste_field_titre("Login",$_SERVER["PHP_SELF"],"d.login",$param,"","",$sortfield,$sortorder);
|
||||
}
|
||||
if (! empty($arrayfields['t.libelle']['checked']))
|
||||
{
|
||||
print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"c.note",$param,"",'align="left"',$sortfield,$sortorder);
|
||||
}
|
||||
if (! empty($arrayfields['d.bank']['checked']))
|
||||
{
|
||||
print_liste_field_titre("Account",$_SERVER["PHP_SELF"],"b.fk_account",$pram,"","",$sortfield,$sortorder);
|
||||
}
|
||||
if (! empty($arrayfields['d.date_debut']['checked']))
|
||||
{
|
||||
print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"c.dateadh",$param,"",'align="center"',$sortfield,$sortorder);
|
||||
}
|
||||
if (! empty($arrayfields['d.date_fin']['checked']))
|
||||
{
|
||||
print_liste_field_titre("DateEnd",$_SERVER["PHP_SELF"],"c.datef",$param,"",'align="center"',$sortfield,$sortorder);
|
||||
}
|
||||
if (! empty($arrayfields['d.amount']['checked']))
|
||||
{
|
||||
print_liste_field_titre("Amount",$_SERVER["PHP_SELF"],"c.subscription",$param,"",'align="right"',$sortfield,$sortorder);
|
||||
}
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||
|
||||
// Hook fields
|
||||
$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (! empty($arrayfields['d.datec']['checked'])) print_liste_field_titre($arrayfields['d.datec']['label'],$_SERVER["PHP_SELF"],"d.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.tms']['checked'])) print_liste_field_titre($arrayfields['d.tms']['label'],$_SERVER["PHP_SELF"],"d.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
$total=0;
|
||||
$totalarray=array();
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$total+=$obj->subscription;
|
||||
|
||||
$subscription->ref=$obj->crowid;
|
||||
$subscription->id=$obj->crowid;
|
||||
|
||||
$adherent->lastname=$obj->lastname;
|
||||
$adherent->firstname=$obj->firstname;
|
||||
$adherent->ref=$obj->rowid;
|
||||
$adherent->id=$obj->rowid;
|
||||
$adherent->statut=$obj->statut;
|
||||
$adherent->login=$obj->login;
|
||||
$adherent->photo=$obj->photo;
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Ref
|
||||
if (! empty($arrayfields['d.ref']['checked']))
|
||||
{
|
||||
print '<td>'.$subscription->getNomUrl(1).'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Lastname
|
||||
if (! empty($arrayfields['d.lastname']['checked']))
|
||||
{
|
||||
$adherent->firstname = '';
|
||||
print '<td>'.$adherent->getNomUrl(-1).'</td>';
|
||||
$adherent->firstname = $obj->firstname;
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Firstname
|
||||
if (! empty($arrayfields['d.firstname']['checked']))
|
||||
{
|
||||
print '<td>'.$adherent->firstname.'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Login
|
||||
if (! empty($arrayfields['d.login']['checked']))
|
||||
{
|
||||
print '<td>'.$adherent->login.'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Label
|
||||
if (! empty($arrayfields['t.libelle']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
print dol_trunc($obj->note,128);
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Banque
|
||||
if (! empty($arrayfields['d.bank']['checked']))
|
||||
{
|
||||
print "<td>";
|
||||
if ($obj->fk_account > 0)
|
||||
{
|
||||
$accountstatic->id=$obj->fk_account;
|
||||
$accountstatic->fetch($obj->fk_account);
|
||||
//$accountstatic->label=$obj->label;
|
||||
print $accountstatic->getNomUrl(1);
|
||||
}
|
||||
print "</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Date start
|
||||
if (! empty($arrayfields['d.date_start']['checked']))
|
||||
{
|
||||
print '<td align="center">'.dol_print_date($db->jdate($obj->dateadh),'day')."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Date end
|
||||
if (! empty($arrayfields['d.date_end']['checked']))
|
||||
{
|
||||
print '<td align="center">'.dol_print_date($db->jdate($obj->datef),'day')."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Price
|
||||
if (! empty($arrayfields['d.amount']['checked']))
|
||||
{
|
||||
print '<td align="right">'.price($obj->subscription).'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='d.amount';
|
||||
$totalarray['val']['d.amount'] += $obj->subscription;
|
||||
}
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||
// Fields from hook
|
||||
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Date creation
|
||||
if (! empty($arrayfields['d.datec']['checked']))
|
||||
{
|
||||
print '<td align="center" class="nowrap">';
|
||||
print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Date modification
|
||||
if (! empty($arrayfields['d.tms']['checked']))
|
||||
{
|
||||
print '<td align="center" class="nowrap">';
|
||||
print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Action column
|
||||
print '<td align="center">';
|
||||
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
{
|
||||
$selected=0;
|
||||
if (in_array($obj->rowid, $arrayofselected)) $selected=1;
|
||||
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>';
|
||||
}
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Show total line
|
||||
if (isset($totalarray['pos']))
|
||||
{
|
||||
print '<tr class="liste_total">';
|
||||
$i=0;
|
||||
while ($i < $totalarray['nbfield'])
|
||||
{
|
||||
$i++;
|
||||
if (! empty($totalarray['pos'][$i])) print '<td align="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
|
||||
else
|
||||
{
|
||||
if ($i == 1)
|
||||
{
|
||||
if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
}
|
||||
else print '<td></td>';
|
||||
}
|
||||
}
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// If no record found
|
||||
if ($num == 0)
|
||||
{
|
||||
$colspan=1;
|
||||
foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; }
|
||||
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
|
||||
}
|
||||
|
||||
$db->free($resql);
|
||||
|
||||
$parameters=array('sql' => $sql);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
print '</form>';
|
||||
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
|
||||
@ -397,7 +397,7 @@ print '<br><br>';
|
||||
*/
|
||||
//if (! empty($conf->global->MAIN_FEATURES_LEVEL))
|
||||
//{
|
||||
print load_fiche_titre($langs->trans("BankAccountReleveModule"), '', '');
|
||||
print load_fiche_titre($langs->trans("Other"), '', '');
|
||||
|
||||
|
||||
print "<table class=\"noborder\" width=\"100%\">\n";
|
||||
|
||||
@ -63,7 +63,7 @@ if ($action == 'setcoder')
|
||||
$resql=$db->query($sqlp);
|
||||
if (! $resql) dol_print_error($db);
|
||||
}
|
||||
else if ($action == 'update')
|
||||
elseif ($action == 'update')
|
||||
{
|
||||
$location = GETPOST('GENBARCODE_LOCATION','alpha');
|
||||
$res = dolibarr_set_const($db, "GENBARCODE_LOCATION",$location,'chaine',0,'',$conf->entity);
|
||||
@ -71,17 +71,8 @@ else if ($action == 'update')
|
||||
$res = dolibarr_set_const($db, "PRODUIT_DEFAULT_BARCODE_TYPE", $coder_id,'chaine',0,'',$conf->entity);
|
||||
$coder_id = GETPOST('GENBARCODE_BARCODETYPE_THIRDPARTY','alpha');
|
||||
$res = dolibarr_set_const($db, "GENBARCODE_BARCODETYPE_THIRDPARTY", $coder_id,'chaine',0,'',$conf->entity);
|
||||
}
|
||||
else if ($action == 'updateengine')
|
||||
{
|
||||
// TODO Update engines.
|
||||
}
|
||||
|
||||
if ($action && $action != 'setcoder' && $action != 'setModuleOptions')
|
||||
{
|
||||
if (! $res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
if ($res > 0)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
@ -90,6 +81,42 @@ if ($action && $action != 'setcoder' && $action != 'setModuleOptions')
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
}
|
||||
elseif ($action == 'updateengine')
|
||||
{
|
||||
$sql = "SELECT rowid, coder";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_barcode_type";
|
||||
$sql.= " WHERE entity = ".$conf->entity;
|
||||
$sql.= " ORDER BY code";
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
if (GETPOST('coder'.$obj->rowid, 'alpha'))
|
||||
{
|
||||
$coder = GETPOST('coder'.$obj->rowid,'alpha');
|
||||
$code_id = $obj->rowid;
|
||||
|
||||
$sqlp = "UPDATE ".MAIN_DB_PREFIX."c_barcode_type";
|
||||
$sqlp.= " SET coder = '" . $coder."'";
|
||||
$sqlp.= " WHERE rowid = ". $code_id;
|
||||
$sqlp.= " AND entity = ".$conf->entity;
|
||||
|
||||
$upsql=$db->query($sqlp);
|
||||
if (! $upsql) dol_print_error($db);
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -161,9 +188,12 @@ foreach($dirbarcode as $reldir)
|
||||
print '<br>';
|
||||
print load_fiche_titre($langs->trans("BarcodeEncodeModule"),'','');
|
||||
|
||||
//print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
|
||||
//print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
//print "<input type=\"hidden\" name=\"action\" value=\"updateengine\">";
|
||||
if (empty($conf->use_javascript_ajax))
|
||||
{
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" id="form_engine">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="updateengine">';
|
||||
}
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
@ -258,10 +288,9 @@ print "</table>\n";
|
||||
|
||||
if (empty($conf->use_javascript_ajax))
|
||||
{
|
||||
// TODO Implement code behind action updateengine
|
||||
//print '<div class="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'"></div>';
|
||||
print '<div class="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'"></div>';
|
||||
print '</form>';
|
||||
}
|
||||
//print '</form>';
|
||||
|
||||
print "<br>";
|
||||
|
||||
|
||||
127
htdocs/admin/commande_fournisseur_dispatch_extrafields.php
Normal file
127
htdocs/admin/commande_fournisseur_dispatch_extrafields.php
Normal file
@ -0,0 +1,127 @@
|
||||
<?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>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015 Claudio Aschieri <c.aschieri@19.coop>
|
||||
* Copyright (C) 2018 Quentin Vial-Gouteyron <quentin.vial-gouteyron@atm-consulting.fr>
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 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/commandefournisseurdispatch_extrafields.php
|
||||
* \ingroup reception
|
||||
* \brief Page to setup extra fields of reception
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/reception.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
|
||||
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("other");
|
||||
$langs->load("receptions");
|
||||
|
||||
$extrafields = new ExtraFields($db);
|
||||
$form = new Form($db);
|
||||
|
||||
// List of supported format
|
||||
$tmptype2label=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_dispatch'; //Must be the $table_element of the class that manage extrafield
|
||||
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$textobject=$langs->transnoentitiesnoconv("Receptions");
|
||||
|
||||
llxHeader('',$langs->trans("ReceptionsSetup"));
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("ReceptionsSetup"),$linkback,'title_setup');
|
||||
print "<br>\n";
|
||||
|
||||
$head = reception_admin_prepare_head();
|
||||
|
||||
dol_fiche_head($head, 'attributeslines_reception', $langs->trans("Receptions"), -1, 'sending');
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
|
||||
|
||||
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 of an optional field */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Edition of an optional field */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
if ($action == 'edit' && ! empty($attrname))
|
||||
{
|
||||
print "<br>";
|
||||
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
@ -423,7 +423,7 @@ $tabcond[14]= (! empty($conf->product->enabled) && (! empty($conf->ecotax->enabl
|
||||
$tabcond[15]= true;
|
||||
$tabcond[16]= (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS));
|
||||
$tabcond[17]= (! empty($conf->deplacement->enabled) || ! empty($conf->expensereport->enabled));
|
||||
$tabcond[18]= ! empty($conf->expedition->enabled);
|
||||
$tabcond[18]= ! empty($conf->expedition->enabled) || ! empty($conf->reception->enabled);
|
||||
$tabcond[19]= ! empty($conf->societe->enabled);
|
||||
$tabcond[20]= ! empty($conf->fournisseur->enabled);
|
||||
$tabcond[21]= ! empty($conf->propal->enabled);
|
||||
|
||||
@ -380,11 +380,24 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
$sourcedir = $object->source_directory;
|
||||
$targetdir = ($object->target_directory ? $object->target_directory : ''); // Can be '[Gmail]/Trash' or 'mytag'
|
||||
|
||||
$connectstringserver = $object->getConnectStringIMAP();
|
||||
$connectstringsource = $connectstringserver.imap_utf7_encode($sourcedir);
|
||||
$connectstringtarget = $connectstringserver.imap_utf7_encode($targetdir);
|
||||
$connection = null;
|
||||
$connectstringserver = '';
|
||||
$connectstringsource = '';
|
||||
$connectstringtarget = '';
|
||||
|
||||
if (function_exists('imap_open'))
|
||||
{
|
||||
$connectstringserver = $object->getConnectStringIMAP();
|
||||
$connectstringsource = $connectstringserver.imap_utf7_encode($sourcedir);
|
||||
$connectstringtarget = $connectstringserver.imap_utf7_encode($targetdir);
|
||||
|
||||
$connection = imap_open($connectstringsource, $object->user, $object->password);
|
||||
$connection = imap_open($connectstringsource, $object->user, $object->password);
|
||||
}
|
||||
else
|
||||
{
|
||||
$morehtml .= 'IMAP functions not available on your PHP';
|
||||
}
|
||||
|
||||
if (! $connection)
|
||||
{
|
||||
$morehtml .= 'Failed to open IMAP connection '.$connectstringsource;
|
||||
@ -395,8 +408,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
$morehtml .= imap_num_msg($connection);
|
||||
}
|
||||
|
||||
imap_close($connection);
|
||||
|
||||
if ($connection)
|
||||
{
|
||||
imap_close($connection);
|
||||
}
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref.'<div class="refidno">'.$morehtml.'</div>', '', 0, '', '', 0, '');
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
@ -241,17 +241,17 @@ if ($action == 'setforcedate')
|
||||
if ($action == 'setDefaultPDFModulesByType')
|
||||
{
|
||||
$invoicetypemodels = GETPOST('invoicetypemodels');
|
||||
|
||||
|
||||
if(!empty($invoicetypemodels) && is_array($invoicetypemodels))
|
||||
{
|
||||
$error = 0;
|
||||
|
||||
|
||||
foreach ($invoicetypemodels as $type => $value)
|
||||
{
|
||||
$res = dolibarr_set_const($db, 'FACTURE_ADDON_PDF_'.intval($type),$value,'chaine',0,'',$conf->entity);
|
||||
if (! $res > 0) $error++;
|
||||
}
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
@ -621,7 +621,7 @@ if(!empty($conf->global->INVOICE_USE_DEFAULT_DOCUMENT)) // Hidden conf
|
||||
print '<td>'.$langs->trans("Name").'</td>';
|
||||
print '<td align="right"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
$listtype=array(
|
||||
Facture::TYPE_STANDARD=>$langs->trans("InvoiceStandard"),
|
||||
Facture::TYPE_REPLACEMENT=>$langs->trans("InvoiceReplacement"),
|
||||
@ -632,7 +632,7 @@ if(!empty($conf->global->INVOICE_USE_DEFAULT_DOCUMENT)) // Hidden conf
|
||||
{
|
||||
$listtype[Facture::TYPE_SITUATION] = $langs->trans("InvoiceSituation");
|
||||
}
|
||||
|
||||
|
||||
foreach ($listtype as $type => $trans)
|
||||
{
|
||||
$thisTypeConfName = 'FACTURE_ADDON_PDF_'.$type;
|
||||
@ -642,7 +642,7 @@ if(!empty($conf->global->INVOICE_USE_DEFAULT_DOCUMENT)) // Hidden conf
|
||||
print '<td colspan="2" >'.$form->selectarray('invoicetypemodels['.$type.']', ModelePDFFactures::liste_modeles($db), $current,0,0, 0).'</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
|
||||
print '</table>';
|
||||
print "</form>";
|
||||
}
|
||||
@ -698,7 +698,7 @@ if (! empty($conf->banque->enabled))
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<i>".$langs->trans("NoActiveBankAccountDefined")."</i>";
|
||||
print '<span class="opacitymedium">'.$langs->trans("NoActiveBankAccountDefined").'</span>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -735,7 +735,7 @@ else
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.$langs->trans("FeatureNotAvailableOnLinux").'">'.$langs->trans("DoTestServerAvailability").'</a>';
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("FeatureNotAvailableOnLinux").'">'.$langs->trans("DoTestServerAvailability").'</a>';
|
||||
}
|
||||
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=test&mode=init#formmailbeforetitle">'.$langs->trans("DoTestSend").'</a>';
|
||||
|
||||
@ -509,7 +509,7 @@ else
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.$langs->trans("FeatureNotAvailableOnLinux").'">'.$langs->trans("DoTestServerAvailability").'</a>';
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("FeatureNotAvailableOnLinux").'">'.$langs->trans("DoTestServerAvailability").'</a>';
|
||||
}
|
||||
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=test&mode=init">'.$langs->trans("DoTestSend").'</a>';
|
||||
|
||||
@ -75,7 +75,7 @@ $offset = $listlimit * $page ;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
if (empty($sortfield)) $sortfield='label, lang, position';
|
||||
if (empty($sortfield)) $sortfield='type_template, lang, position, label';
|
||||
if (empty($sortorder)) $sortorder='ASC';
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
@ -85,10 +85,6 @@ $hookmanager->initHooks(array('emailtemplates'));
|
||||
$tabname=array();
|
||||
$tabname[25]= MAIN_DB_PREFIX."c_email_templates";
|
||||
|
||||
// Criteria to sort dictionaries
|
||||
$tabsqlsort=array();
|
||||
$tabsqlsort[25]="label ASC, lang ASC, position ASC";
|
||||
|
||||
// Nom des champs en resultat de select pour affichage du dictionnaire
|
||||
$tabfield=array();
|
||||
$tabfield[25]= "label,lang,type_template,fk_user,private,position,topic,joinfiles,content";
|
||||
@ -161,6 +157,7 @@ if ($conf->propal->enabled) $elementList['propal_send']=$langs->trans
|
||||
if ($conf->commande->enabled) $elementList['order_send']=$langs->trans('MailToSendOrder');
|
||||
if ($conf->facture->enabled) $elementList['facture_send']=$langs->trans('MailToSendInvoice');
|
||||
if ($conf->expedition->enabled) $elementList['shipping_send']=$langs->trans('MailToSendShipment');
|
||||
if ($conf->reception->enabled) $elementList['reception_send']=$langs->trans('MailToSendReception');
|
||||
if ($conf->ficheinter->enabled) $elementList['fichinter_send']=$langs->trans('MailToSendIntervention');
|
||||
if ($conf->supplier_proposal->enabled) $elementList['supplier_proposal_send']=$langs->trans('MailToSendSupplierRequestForQuotation');
|
||||
if ($conf->fournisseur->enabled) $elementList['order_supplier_send']=$langs->trans('MailToSendSupplierOrder');
|
||||
@ -448,8 +445,6 @@ $sql.=$db->plimit($listlimit+1,$offset);
|
||||
$fieldlist=explode(',',$tabfield[$id]);
|
||||
|
||||
// Form to add a new line
|
||||
$alabelisused=0;
|
||||
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">';
|
||||
@ -461,38 +456,37 @@ print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
foreach ($fieldlist as $field => $value)
|
||||
{
|
||||
// Determine le nom du champ par rapport aux noms possibles
|
||||
// dans les dictionnaires de donnees
|
||||
$valuetoshow=ucfirst($fieldlist[$field]); // Par defaut
|
||||
$valuetoshow=$langs->trans($valuetoshow); // try to translate
|
||||
$align="left";
|
||||
if ($fieldlist[$field]=='fk_user') { $valuetoshow=$langs->trans("Owner");}
|
||||
if ($fieldlist[$field]=='lang') { $valuetoshow=(empty($conf->global->MAIN_MULTILANGS) ? ' ' : $langs->trans("Language")); }
|
||||
if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); }
|
||||
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); }
|
||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Code"); }
|
||||
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
|
||||
if ($fieldlist[$field]=='private') { $align='center'; }
|
||||
if ($fieldlist[$field]=='position') { $align='center'; }
|
||||
// Determine le nom du champ par rapport aux noms possibles
|
||||
// dans les dictionnaires de donnees
|
||||
$valuetoshow=ucfirst($fieldlist[$field]); // Par defaut
|
||||
$valuetoshow=$langs->trans($valuetoshow); // try to translate
|
||||
$align="left";
|
||||
if ($fieldlist[$field]=='fk_user') { $valuetoshow=$langs->trans("Owner");}
|
||||
if ($fieldlist[$field]=='lang') { $valuetoshow=(empty($conf->global->MAIN_MULTILANGS) ? ' ' : $langs->trans("Language")); }
|
||||
if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); }
|
||||
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); }
|
||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Code"); }
|
||||
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
|
||||
if ($fieldlist[$field]=='private') { $align='center'; }
|
||||
if ($fieldlist[$field]=='position') { $align='center'; }
|
||||
|
||||
if ($fieldlist[$field]=='topic') { $valuetoshow=''; }
|
||||
if ($fieldlist[$field]=='joinfiles') { $valuetoshow=''; }
|
||||
if ($fieldlist[$field]=='content') { $valuetoshow=''; }
|
||||
if ($fieldlist[$field]=='content_lines') { $valuetoshow=''; }
|
||||
if ($fieldlist[$field]=='topic') { $valuetoshow=''; }
|
||||
if ($fieldlist[$field]=='joinfiles') { $valuetoshow=''; }
|
||||
if ($fieldlist[$field]=='content') { $valuetoshow=''; }
|
||||
if ($fieldlist[$field]=='content_lines') { $valuetoshow=''; }
|
||||
|
||||
if ($valuetoshow != '')
|
||||
{
|
||||
print '<td align="'.$align.'">';
|
||||
if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i',$tabhelp[$id][$value])) print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1,$valuetoshow).'</a>';
|
||||
else if (! empty($tabhelp[$id][$value]))
|
||||
{
|
||||
if (in_array($value, array('topic'))) print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, $value); // Tooltip on click
|
||||
else print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2); // Tooltip on hover
|
||||
}
|
||||
else print $valuetoshow;
|
||||
print '</td>';
|
||||
}
|
||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1;
|
||||
if ($valuetoshow != '')
|
||||
{
|
||||
print '<td align="'.$align.'">';
|
||||
if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i',$tabhelp[$id][$value])) print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1,$valuetoshow).'</a>';
|
||||
else if (! empty($tabhelp[$id][$value]))
|
||||
{
|
||||
if (in_array($value, array('topic'))) print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, $value); // Tooltip on click
|
||||
else print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2); // Tooltip on hover
|
||||
}
|
||||
else print $valuetoshow;
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
print '<td>';
|
||||
print '<input type="hidden" name="id" value="' . $id . '">';
|
||||
@ -535,6 +529,7 @@ print '<td align="right">';
|
||||
print '</td>';
|
||||
print "</tr>";
|
||||
|
||||
// Show fields for topic, join files and body
|
||||
$fieldsforcontent = array('topic', 'joinfiles', 'content');
|
||||
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) { $fieldsforcontent = array('content','content_lines'); }
|
||||
foreach ($fieldsforcontent as $tmpfieldlist)
|
||||
@ -631,11 +626,11 @@ if ($resql)
|
||||
$filterfound=0;
|
||||
foreach ($fieldlist as $field => $value)
|
||||
{
|
||||
if ($value == 'label') print '<td class="liste_titre"><input type="text" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>';
|
||||
if ($value == 'label') print '<td class="liste_titre"><input type="text" name="search_label" class="maxwidth100" value="'.dol_escape_htmltag($search_label).'"></td>';
|
||||
elseif ($value == 'lang')
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print $formadmin->select_language($search_lang, 'search_lang', 0, null, 1, 0, 0, 'maxwidth150');
|
||||
print $formadmin->select_language($search_lang, 'search_lang', 0, null, 1, 0, 0, 'maxwidth100');
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($value == 'fk_user')
|
||||
@ -644,13 +639,13 @@ if ($resql)
|
||||
$restrictid=array();
|
||||
if (! $user->admin) $restrictid=array($user->id);
|
||||
//var_dump($restrictid);
|
||||
print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, 'hierarchyme', null, 0, 0, 1, '', 0, '', 'maxwidth200');
|
||||
print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, 'hierarchyme', null, 0, 0, 1, '', 0, '', 'maxwidth100');
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($value == 'topic') print '<td class="liste_titre"><input type="text" name="search_topic" value="'.dol_escape_htmltag($search_topic).'"></td>';
|
||||
elseif ($value == 'type_template')
|
||||
{
|
||||
print '<td class="liste_titre">'.$form->selectarray('search_type_template', $elementList, $search_type_template, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth200 maxwidth100onsmartphone').'</td>';
|
||||
print '<td class="liste_titre">'.$form->selectarray('search_type_template', $elementList, $search_type_template, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100 maxwidth100onsmartphone').'</td>';
|
||||
}
|
||||
elseif (! in_array($value, array('content', 'content_lines'))) print '<td class="liste_titre"></td>';
|
||||
}
|
||||
@ -672,6 +667,7 @@ if ($resql)
|
||||
$align="left";
|
||||
$sortable=1;
|
||||
$valuetoshow='';
|
||||
$forcenowrap=1;
|
||||
/*
|
||||
$tmparray=getLabelOfField($fieldlist[$field]);
|
||||
$showfield=$tmp['showfield'];
|
||||
@ -689,7 +685,7 @@ if ($resql)
|
||||
if ($fieldlist[$field]=='private') { $align='center'; }
|
||||
if ($fieldlist[$field]=='position') { $align='center'; }
|
||||
|
||||
if ($fieldlist[$field]=='joinfiles') { $valuetoshow=$langs->trans("FilesAttachedToEmail"); $align='center'; }
|
||||
if ($fieldlist[$field]=='joinfiles') { $valuetoshow=$langs->trans("FilesAttachedToEmail"); $align='center'; $forcenowrap=0; }
|
||||
if ($fieldlist[$field]=='content') { $valuetoshow=$langs->trans("Content"); $showfield=0;}
|
||||
if ($fieldlist[$field]=='content_lines') { $valuetoshow=$langs->trans("ContentLines"); $showfield=0; }
|
||||
|
||||
@ -698,8 +694,8 @@ if ($resql)
|
||||
{
|
||||
if (! empty($tabhelp[$id][$value]))
|
||||
{
|
||||
if (in_array($value, array('topic'))) $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, 'tooltip'.$value); // Tooltip on click
|
||||
else $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, '', 1); // Tooltip on hover
|
||||
if (in_array($value, array('topic'))) $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, 'tooltip'.$value, $forcenowrap); // Tooltip on click
|
||||
else $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, '', $forcenowrap); // Tooltip on hover
|
||||
}
|
||||
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "align=".$align, $sortfield, $sortorder);
|
||||
}
|
||||
@ -1024,17 +1020,18 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
||||
}
|
||||
else
|
||||
{
|
||||
print $form->selectarray('type_template', $elementList, (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), 1, 0, 0, '', 0, 0, 0, '', 'maxwidth200');
|
||||
print $form->selectarray('type_template', $elementList, (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), 1, 0, 0, '', 0, 0, 0, '', 'maxwidth150 maxwidth100onsmartphone');
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($context == 'add' && in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) continue;
|
||||
elseif ($context == 'add' && in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) continue;
|
||||
elseif ($context == 'edit' && in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) continue;
|
||||
elseif ($context == 'hide' && in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) continue;
|
||||
else
|
||||
{
|
||||
$size=''; $class=''; $classtd='';
|
||||
if ($fieldlist[$field]=='code') $class='maxwidth100';
|
||||
if ($fieldlist[$field]=='label') $class='maxwidth100';
|
||||
if ($fieldlist[$field]=='private') { $class='maxwidth50'; $classtd='center'; }
|
||||
if ($fieldlist[$field]=='position') { $class='maxwidth50'; $classtd='center'; }
|
||||
if ($fieldlist[$field]=='libelle') $class='quatrevingtpercent';
|
||||
|
||||
@ -96,6 +96,7 @@ if ($action == 'update')
|
||||
$menu->perms=GETPOST('perms','alpha');
|
||||
$menu->target=GETPOST('target','alpha');
|
||||
$menu->user=GETPOST('user','alpha');
|
||||
$menu->mainmenu=GETPOST('propertymainmenu','alpha');
|
||||
if (is_numeric(GETPOST('menuIdParent','alpha')))
|
||||
{
|
||||
$menu->fk_menu=GETPOST('menuIdParent','alpha');
|
||||
@ -123,14 +124,11 @@ if ($action == 'update')
|
||||
setEventMessages($menu->error, $menu->errors, 'errors');
|
||||
}
|
||||
$action = "edit";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
header("Location: ".DOL_URL_ROOT."/admin/menus/index.php?menu_handler=".$menu_handler);
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($_GET['return'])
|
||||
else
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT."/admin/menus/index.php?menu_handler=".$menu_handler);
|
||||
exit;
|
||||
@ -215,6 +213,7 @@ if ($action == 'add')
|
||||
$menu->perms=GETPOST('perms','alpha');
|
||||
$menu->target=GETPOST('target','alpha');
|
||||
$menu->user=GETPOST('user','alpha');
|
||||
$menu->mainmenu=GETPOST('propertymainmenu','alpha');
|
||||
if (is_numeric(GETPOST('menuId','int')))
|
||||
{
|
||||
$menu->fk_menu=GETPOST('menuId','int');
|
||||
@ -289,10 +288,13 @@ if ($action == 'create')
|
||||
{
|
||||
jQuery("#menuId").prop("disabled", true);
|
||||
jQuery("#menuId").val(\'\');
|
||||
jQuery("#propertymainmenu").removeAttr("disabled");
|
||||
jQuery("#propertymainmenu").val(\'\');
|
||||
}
|
||||
else
|
||||
if (jQuery("#topleft").val() == \'left\')
|
||||
{
|
||||
jQuery("#menuId").removeAttr("disabled");
|
||||
jQuery("#propertymainmenu").prop("disabled", true);
|
||||
}
|
||||
}
|
||||
init_topleft();
|
||||
@ -338,7 +340,7 @@ if ($action == 'create')
|
||||
print '</td>';
|
||||
print '<td>'.$langs->trans('DetailMenuHandler').'</td></tr>';
|
||||
|
||||
//User
|
||||
// User
|
||||
print '<tr><td class="nowrap fieldrequired">'.$langs->trans('MenuForUsers').'</td>';
|
||||
print '<td><select class="flat" name="user">';
|
||||
print '<option value="2" selected>'.$langs->trans("AllMenus").'</option>';
|
||||
@ -362,9 +364,15 @@ if ($action == 'create')
|
||||
print '<option value="left"'.($_POST["type"] && $_POST["type"]=='left'?' selected':'').'>'.$langs->trans('Left').'</option>';
|
||||
print '</select>';
|
||||
}
|
||||
// print '<input type="text" size="50" name="type" value="'.$type.'">';
|
||||
print '</td><td>'.$langs->trans('DetailType').'</td></tr>';
|
||||
|
||||
// Mainmenu code
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('MainMenuCode').'</td>';
|
||||
print '<td><input type="text" class="minwidth300" id="propertymainmenu" name="propertymainmenu" value="'.(GETPOST("propertymainmenu", 'alpha')?GETPOST("propertymainmenu", 'alpha'):'').'"></td>';
|
||||
print '<td>';
|
||||
print $langs->trans("Example").': mytopmenukey';
|
||||
print '</td></tr>';
|
||||
|
||||
// MenuId Parent
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('MenuIdParent').'</td>';
|
||||
if ($parent_rowid)
|
||||
@ -373,23 +381,23 @@ if ($action == 'create')
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td><input type="text" size="48" id="menuId" name="menuId" value="'.(GETPOST("menuId", 'int')?GETPOST("menuId", 'int'):'').'"></td>';
|
||||
print '<td><input type="text" class="minwidth300" id="menuId" name="menuId" value="'.(GETPOST("menuId", 'int')?GETPOST("menuId", 'int'):'').'"></td>';
|
||||
}
|
||||
print '<td>'.$langs->trans('DetailMenuIdParent');
|
||||
print ', '.$langs->trans("Example").': fk_mainmenu=abc&fk_leftmenu=def';
|
||||
print '</td></tr>';
|
||||
|
||||
// Title
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Title').'</td><td><input type="text" size="30" name="titre" value="'.dol_escape_htmltag(GETPOST("titre",'alpha')).'"></td><td>'.$langs->trans('DetailTitre').'</td></tr>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Title').'</td><td><input type="text" class="minwidth300" name="titre" value="'.dol_escape_htmltag(GETPOST("titre",'alpha')).'"></td><td>'.$langs->trans('DetailTitre').'</td></tr>';
|
||||
|
||||
// URL
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('URL').'</td><td><input type="text" size="60" name="url" value="'.GETPOST("url",'alpha').'"></td><td>'.$langs->trans('DetailUrl').'</td></tr>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('URL').'</td><td><input type="text" class="minwidth500" name="url" value="'.GETPOST("url",'alpha').'"></td><td>'.$langs->trans('DetailUrl').'</td></tr>';
|
||||
|
||||
// Langs
|
||||
print '<tr><td>'.$langs->trans('LangFile').'</td><td><input type="text" size="30" name="langs" value="'.$parent_langs.'"></td><td>'.$langs->trans('DetailLangs').'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('LangFile').'</td><td><input type="text" class="minwidth300" name="langs" value="'.$parent_langs.'"></td><td>'.$langs->trans('DetailLangs').'</td></tr>';
|
||||
|
||||
// Position
|
||||
print '<tr><td>'.$langs->trans('Position').'</td><td><input type="text" size="5" name="position" value="'.dol_escape_htmltag(isset($_POST["position"])?$_POST["position"]:100).'"></td><td>'.$langs->trans('DetailPosition').'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Position').'</td><td><input type="text" class="width100" name="position" value="'.dol_escape_htmltag(isset($_POST["position"])?$_POST["position"]:100).'"></td><td>'.$langs->trans('DetailPosition').'</td></tr>';
|
||||
|
||||
// Target
|
||||
print '<tr><td>'.$langs->trans('Target').'</td><td><select class="flat" name="target">';
|
||||
@ -398,10 +406,10 @@ if ($action == 'create')
|
||||
print '</select></td></td><td>'.$langs->trans('DetailTarget').'</td></tr>';
|
||||
|
||||
// Enabled
|
||||
print '<tr><td>'.$langs->trans('Enabled').'</td><td><input type="text" size="60" name="enabled" value="'.GETPOST("enabled",'alpha').'"></td><td>'.$langs->trans('DetailEnabled').'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Enabled').'</td><td><input type="text" class="minwidth500" name="enabled" value="'.(GETPOSTISSET('enabled')?GETPOST("enabled",'alpha'):'1').'"></td><td>'.$langs->trans('DetailEnabled').'</td></tr>';
|
||||
|
||||
// Perms
|
||||
print '<tr><td>'.$langs->trans('Rights').'</td><td><input type="text" size="60" name="perms" value="'.GETPOST('perms','alpha').'"></td><td>'.$langs->trans('DetailRight').'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Rights').'</td><td><input type="text" class="minwidth500" name="perms" value="'.(GETPOSTISSET('perms')?GETPOST('perms','alpha'):'1').'"></td><td>'.$langs->trans('DetailRight').'</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -455,13 +463,30 @@ elseif ($action == 'edit')
|
||||
// Type
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Type').'</td><td>'.$langs->trans(ucfirst($menu->type)).'</td><td>'.$langs->trans('DetailType').'</td></tr>';
|
||||
|
||||
// Mainmenu code
|
||||
if ($menu->type == 'top')
|
||||
{
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('MainMenuCode').'</td>';
|
||||
/*if ($parent_rowid)
|
||||
{
|
||||
print '<td>'.$parent_rowid.'<input type="hidden" name="propertyleftmenu" value="'.$parent_rowid.'"></td>';
|
||||
}
|
||||
else
|
||||
{*/
|
||||
print '<td><input type="text" class="minwidth300" id="propertymainmenu" name="propertymainmenu" value="'.(GETPOST("propertymainmenu", 'alpha')?GETPOST("propertymainmenu", 'alpha'):$menu->mainmenu).'"></td>';
|
||||
//}
|
||||
print '<td>';
|
||||
print $langs->trans("Example").': mytopmenukey';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// MenuId Parent
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('MenuIdParent');
|
||||
print '</td>';
|
||||
$valtouse=$menu->fk_menu;
|
||||
if ($menu->fk_mainmenu) $valtouse='fk_mainmenu='.$menu->fk_mainmenu;
|
||||
if ($menu->fk_leftmenu) $valtouse.='&fk_leftmenu='.$menu->fk_leftmenu;
|
||||
print '<td><input type="text" name="menuIdParent" value="'.$valtouse.'" size="48"></td>';
|
||||
print '<td><input type="text" name="menuIdParent" value="'.$valtouse.'" class="minwidth300"></td>';
|
||||
print '<td>'.$langs->trans('DetailMenuIdParent');
|
||||
print ', '.$langs->trans("Example").': fk_mainmenu=abc&fk_leftmenu=def';
|
||||
print '</td></tr>';
|
||||
@ -470,16 +495,16 @@ elseif ($action == 'edit')
|
||||
//print '<tr><td>'.$langs->trans('Level').'</td><td>'.$menu->level.'</td><td>'.$langs->trans('DetailLevel').'</td></tr>';
|
||||
|
||||
// Title
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Title').'</td><td><input type="text" size="30" name="titre" value="'.dol_escape_htmltag($menu->titre).'"></td><td>'.$langs->trans('DetailTitre').'</td></tr>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Title').'</td><td><input type="text" class="minwidth300" name="titre" value="'.dol_escape_htmltag($menu->titre).'"></td><td>'.$langs->trans('DetailTitre').'</td></tr>';
|
||||
|
||||
// Url
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('URL').'</td><td><input type="text" class="quatrevingtpercent" name="url" value="'.$menu->url.'"></td><td>'.$langs->trans('DetailUrl').'</td></tr>';
|
||||
|
||||
// Langs
|
||||
print '<tr><td>'.$langs->trans('LangFile').'</td><td><input type="text" size="30" name="langs" value="'.dol_escape_htmltag($menu->langs).'"></td><td>'.$langs->trans('DetailLangs').'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('LangFile').'</td><td><input type="text" class="minwidth300" name="langs" value="'.dol_escape_htmltag($menu->langs).'"></td><td>'.$langs->trans('DetailLangs').'</td></tr>';
|
||||
|
||||
// Position
|
||||
print '<tr><td>'.$langs->trans('Position').'</td><td><input type="text" size="5" name="position" value="'.$menu->position.'"></td><td>'.$langs->trans('DetailPosition').'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Position').'</td><td><input type="text" class="minwidth100" name="position" value="'.$menu->position.'"></td><td>'.$langs->trans('DetailPosition').'</td></tr>';
|
||||
|
||||
// Target
|
||||
print '<tr><td>'.$langs->trans('Target').'</td><td><select class="flat" name="target">';
|
||||
@ -488,12 +513,12 @@ elseif ($action == 'edit')
|
||||
print '</select></td><td>'.$langs->trans('DetailTarget').'</td></tr>';
|
||||
|
||||
// Enabled
|
||||
print '<tr><td>'.$langs->trans('Enabled').'</td><td><input type="text" size="60" name="enabled" value="'.dol_escape_htmltag($menu->enabled).'"></td><td>'.$langs->trans('DetailEnabled');
|
||||
print '<tr><td>'.$langs->trans('Enabled').'</td><td><input type="text" class="minwidth500" name="enabled" value="'.dol_escape_htmltag($menu->enabled).'"></td><td>'.$langs->trans('DetailEnabled');
|
||||
if (! empty($menu->enabled)) print ' ('.$langs->trans("ConditionIsCurrently").': '.yn(dol_eval($menu->enabled,1)).')';
|
||||
print '</td></tr>';
|
||||
|
||||
// Perms
|
||||
print '<tr><td>'.$langs->trans('Rights').'</td><td><input type="text" size="60" name="perms" value="'.dol_escape_htmltag($menu->perms).'"></td><td>'.$langs->trans('DetailRight');
|
||||
print '<tr><td>'.$langs->trans('Rights').'</td><td><input type="text" class="minwidth500" name="perms" value="'.dol_escape_htmltag($menu->perms).'"></td><td>'.$langs->trans('DetailRight');
|
||||
if (! empty($menu->perms)) print ' ('.$langs->trans("ConditionIsCurrently").': '.yn(dol_eval($menu->perms,1)).')';
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
@ -432,7 +432,7 @@ if (! empty($conf->global->MAIN_MODULE_NOTIFICATION))
|
||||
|
||||
$sql = "SELECT u.rowid, u.lastname, u.firstname, u.fk_soc, u.email";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||
$sql.= " WHERE entity IN (".getEntity('facture').")";
|
||||
$sql.= " WHERE entity IN (".getEntity('invoice').")";
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
|
||||
127
htdocs/admin/reception_extrafields.php
Normal file
127
htdocs/admin/reception_extrafields.php
Normal file
@ -0,0 +1,127 @@
|
||||
<?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>
|
||||
* Copyright (C) 2015 Claudio Aschieri <c.aschieri@19.coop>
|
||||
* Copyright (C) 2018 Quentin Vial-Gouteyron <quentin.vial-gouteyron@atm-consulting.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 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/reception_extrafields.php
|
||||
* \ingroup reception
|
||||
* \brief Page to setup extra fields of reception
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/reception.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
|
||||
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("other");
|
||||
$langs->load("receptions");
|
||||
$langs->load("deliveries");
|
||||
|
||||
|
||||
$extrafields = new ExtraFields($db);
|
||||
$form = new Form($db);
|
||||
|
||||
// List of supported format
|
||||
$tmptype2label=ExtraFields::$type2label;
|
||||
$type2label=array('');
|
||||
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
|
||||
|
||||
$action=GETPOST('action', 'alpha');
|
||||
$attrname=GETPOST('attrname', 'alpha');
|
||||
$elementtype='reception'; //Must be the $table_element of the class that manage extrafield
|
||||
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$textobject=$langs->transnoentitiesnoconv("Receptions");
|
||||
|
||||
llxHeader('',$langs->trans("ReceptionsSetup"));
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("ReceptionsSetup"),$linkback,'title_setup');
|
||||
print "<br>\n";
|
||||
|
||||
$head = reception_admin_prepare_head();
|
||||
|
||||
dol_fiche_head($head, 'attributes_reception', $langs->trans("Receptions"), -1, 'sending');
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
|
||||
|
||||
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 of an optional field */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Edition of an optional field */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
if ($action == 'edit' && ! empty($attrname))
|
||||
{
|
||||
print "<br>";
|
||||
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
520
htdocs/admin/reception_setup.php
Normal file
520
htdocs/admin/reception_setup.php
Normal file
@ -0,0 +1,520 @@
|
||||
<?php
|
||||
/* Copyright (C) 2018 Quentin Vial-Gouteyron <quentin.vial-gouteyron@atm-consulting.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 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/confexped.php
|
||||
* \ingroup produit
|
||||
* \brief Page to setup reception module
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/reception.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/reception/class/reception.class.php';
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("receptions");
|
||||
$langs->load('other');
|
||||
|
||||
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
|
||||
$action=GETPOST('action','alpha');
|
||||
$value=GETPOST('value','alpha');
|
||||
$label = GETPOST('label','alpha');
|
||||
$scandir = GETPOST('scan_dir','alpha');
|
||||
$type='reception';
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (! empty($conf->reception->enabled) && empty($conf->global->MAIN_SUBMODULE_RECEPTION))
|
||||
{
|
||||
// This option should always be set to on when module is on.
|
||||
dolibarr_set_const($db, "MAIN_SUBMODULE_RECEPTION", "1",'chaine',0,'',$conf->entity);
|
||||
}
|
||||
|
||||
if (empty($conf->global->RECEPTION_ADDON_NUMBER))
|
||||
{
|
||||
$conf->global->RECEPTION_ADDON_NUMBER='mod_reception_beryl';
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
|
||||
if ($action == 'updateMask')
|
||||
{
|
||||
$maskconst=GETPOST('maskconstreception','alpha');
|
||||
$maskvalue=GETPOST('maskreception','alpha');
|
||||
if (! empty($maskconst))
|
||||
$res = dolibarr_set_const($db,$maskconst,$maskvalue,'chaine',0,'',$conf->entity);
|
||||
|
||||
if (isset($res))
|
||||
{
|
||||
if ($res > 0)
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
else
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
else if ($action == 'set_param')
|
||||
{
|
||||
$freetext=GETPOST('RECEPTION_FREE_TEXT','none'); // No alpha here, we want exact string
|
||||
$res = dolibarr_set_const($db, "RECEPTION_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
|
||||
if ($res <= 0)
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
|
||||
$draft=GETPOST('RECEPTION_DRAFT_WATERMARK','alpha');
|
||||
$res = dolibarr_set_const($db, "RECEPTION_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity);
|
||||
if ($res <= 0)
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
}
|
||||
|
||||
else if ($action == 'specimen')
|
||||
{
|
||||
$modele=GETPOST('module','alpha');
|
||||
|
||||
$exp = new Reception($db);
|
||||
$exp->initAsSpecimen();
|
||||
|
||||
// Search template files
|
||||
$file=''; $classname=''; $filefound=0;
|
||||
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
|
||||
foreach($dirmodels as $reldir)
|
||||
{
|
||||
$file=dol_buildpath($reldir."core/modules/reception/doc/pdf_".$modele.".modules.php",0);
|
||||
if (file_exists($file))
|
||||
{
|
||||
$filefound=1;
|
||||
$classname = "pdf_".$modele;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($filefound)
|
||||
{
|
||||
require_once $file;
|
||||
|
||||
$module = new $classname($db);
|
||||
|
||||
if ($module->write_file($exp,$langs) > 0)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=reception&file=SPECIMEN.pdf");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($module->error, $module->errors, 'errors');
|
||||
dol_syslog($module->error, LOG_ERR);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
|
||||
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
// Activate a model
|
||||
else if ($action == 'set')
|
||||
{
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
}
|
||||
|
||||
else if ($action == 'del')
|
||||
{
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0)
|
||||
{
|
||||
if ($conf->global->RECEPTION_ADDON_PDF == "$value") dolibarr_del_const($db, 'RECEPTION_ADDON_PDF',$conf->entity);
|
||||
}
|
||||
}
|
||||
|
||||
// Set default model
|
||||
else if ($action == 'setdoc')
|
||||
{
|
||||
if (dolibarr_set_const($db, "RECEPTION_ADDON_PDF",$value,'chaine',0,'',$conf->entity))
|
||||
{
|
||||
// La constante qui a ete lue en avant du nouveau set
|
||||
// on passe donc par une variable pour avoir un affichage coherent
|
||||
$conf->global->RECEPTION_ADDON_PDF = $value;
|
||||
}
|
||||
|
||||
// On active le modele
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0)
|
||||
{
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
}
|
||||
}
|
||||
|
||||
else if ($action == 'setmodel')
|
||||
{
|
||||
dolibarr_set_const($db, "RECEPTION_ADDON_NUMBER",$value,'chaine',0,'',$conf->entity);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
llxHeader("",$langs->trans("ReceptionsSetup"));
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("ReceptionsSetup"),$linkback,'title_setup');
|
||||
print '<br>';
|
||||
$head = reception_admin_prepare_head();
|
||||
|
||||
dol_fiche_head($head, 'reception', $langs->trans("Receptions"), -1, 'sending');
|
||||
|
||||
// Reception numbering model
|
||||
|
||||
print load_fiche_titre($langs->trans("ReceptionsNumberingModules"));
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="100">'.$langs->trans("Name").'</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td>'.$langs->trans("Example").'</td>';
|
||||
print '<td class="center" width="60">'.$langs->trans("Status").'</td>';
|
||||
print '<td class="center" width="80">'.$langs->trans("ShortInfo").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
clearstatcache();
|
||||
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/reception/");
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
if (substr($file, 0, 14) == 'mod_reception_' && substr($file, dol_strlen($file)-3, 3) == 'php')
|
||||
{
|
||||
$file = substr($file, 0, dol_strlen($file)-4);
|
||||
|
||||
require_once $dir.$file.'.php';
|
||||
|
||||
$module = new $file;
|
||||
|
||||
if ($module->isEnabled())
|
||||
{
|
||||
// Show modules according to features level
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
|
||||
|
||||
print '<tr><td>'.$module->nom."</td>\n";
|
||||
print '<td>';
|
||||
print $module->info();
|
||||
print '</td>';
|
||||
|
||||
// Show example of numbering module
|
||||
print '<td class="nowrap">';
|
||||
$tmp=$module->getExample();
|
||||
if (preg_match('/^Error/',$tmp)) {
|
||||
$langs->load("errors"); print '<div class="error">'.$langs->trans($tmp).'</div>';
|
||||
}
|
||||
elseif ($tmp=='NotConfigured') print $langs->trans($tmp);
|
||||
else print $tmp;
|
||||
print '</td>'."\n";
|
||||
|
||||
print '<td align="center">';
|
||||
if ($conf->global->RECEPTION_ADDON_NUMBER == "$file")
|
||||
{
|
||||
print img_picto($langs->trans("Activated"),'switch_on');
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmodel&value='.$file.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">';
|
||||
print img_picto($langs->trans("Disabled"),'switch_off');
|
||||
print '</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
$reception=new Reception($db);
|
||||
$reception->initAsSpecimen();
|
||||
|
||||
// Info
|
||||
$htmltooltip='';
|
||||
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||
$nextval=$module->getNextValue($mysoc,$reception);
|
||||
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
|
||||
$htmltooltip.=''.$langs->trans("NextValue").': ';
|
||||
if ($nextval) {
|
||||
if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured')
|
||||
$nextval = $langs->trans($nextval);
|
||||
$htmltooltip.=$nextval.'<br>';
|
||||
} else {
|
||||
$htmltooltip.=$langs->trans($module->error).'<br>';
|
||||
}
|
||||
}
|
||||
|
||||
print '<td align="center">';
|
||||
print $form->textwithpicto('',$htmltooltip,1,0);
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '</table><br>';
|
||||
|
||||
|
||||
/*
|
||||
* Documents models for Receptions Receipt
|
||||
*/
|
||||
print load_fiche_titre($langs->trans("ReceptionsReceiptModel"));
|
||||
|
||||
// Defini tableau def de modele invoice
|
||||
$type="reception";
|
||||
$def = array();
|
||||
|
||||
$sql = "SELECT nom";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql.= " WHERE type = '".$type."'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$i = 0;
|
||||
$num_rows=$db->num_rows($resql);
|
||||
while ($i < $num_rows)
|
||||
{
|
||||
$array = $db->fetch_array($resql);
|
||||
array_push($def, $array[0]);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="140">'.$langs->trans("Name").'</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td align="center" width="60">'.$langs->trans("Status").'</td>';
|
||||
print '<td align="center" width="60">'.$langs->trans("Default").'</td>';
|
||||
print '<td align="center" width="80" class="nowrap">'.$langs->trans("ShortInfo").'</td>';
|
||||
print '<td align="center" width="80" class="nowrap">'.$langs->trans("Preview").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
clearstatcache();
|
||||
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
foreach (array('','/doc') as $valdir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/reception".$valdir);
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
$handle=opendir($dir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
$filelist[]=$file;
|
||||
}
|
||||
closedir($handle);
|
||||
arsort($filelist);
|
||||
|
||||
foreach($filelist as $file)
|
||||
{
|
||||
if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file))
|
||||
{
|
||||
|
||||
if (file_exists($dir.'/'.$file))
|
||||
{
|
||||
$name = substr($file, 4, dol_strlen($file) -16);
|
||||
$classname = substr($file, 0, dol_strlen($file) -12);
|
||||
|
||||
require_once $dir.'/'.$file;
|
||||
$module = new $classname($db);
|
||||
|
||||
$modulequalified=1;
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0;
|
||||
|
||||
if ($modulequalified)
|
||||
{
|
||||
print '<tr><td width="100">';
|
||||
print (empty($module->name)?$name:$module->name);
|
||||
print "</td><td>\n";
|
||||
if (method_exists($module,'info')) print $module->info($langs);
|
||||
else print $module->description;
|
||||
print '</td>';
|
||||
|
||||
// Active
|
||||
if (in_array($name, $def))
|
||||
{
|
||||
print '<td align="center">'."\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'">';
|
||||
print img_picto($langs->trans("Enabled"),'switch_on');
|
||||
print '</a>';
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td align="center">'."\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
// Defaut
|
||||
print '<td align="center">';
|
||||
if ($conf->global->RECEPTION_ADDON_PDF == $name)
|
||||
{
|
||||
print img_picto($langs->trans("Default"),'on');
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Info
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
|
||||
if ($module->type == 'pdf')
|
||||
{
|
||||
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||
}
|
||||
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,1,1);
|
||||
$htmltooltip.='<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg,1,1);
|
||||
$htmltooltip.='<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg,1,1);
|
||||
$htmltooltip.='<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang,1,1);
|
||||
$htmltooltip.='<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark,1,1);
|
||||
|
||||
print '<td align="center">';
|
||||
print $form->textwithpicto('',$htmltooltip,1,0);
|
||||
print '</td>';
|
||||
|
||||
// Preview
|
||||
print '<td align="center">';
|
||||
if ($module->type == 'pdf')
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_object($langs->trans("Preview"),'reception').'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print img_object($langs->trans("PreviewNotAvailable"),'generic');
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
/*
|
||||
* Other options
|
||||
*
|
||||
*/
|
||||
/*
|
||||
print load_fiche_titre($langs->trans("OtherOptions"));
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_param">';
|
||||
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print "<td>".$langs->trans("Parameter")."</td>\n";
|
||||
print "</tr>";
|
||||
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs);
|
||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
||||
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
||||
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
|
||||
$htmltext.='</i>';
|
||||
|
||||
print '<tr><td>';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnReceptions"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext).'<br>';
|
||||
$variablename='RECEPTION_FREE_TEXT';
|
||||
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
{
|
||||
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
|
||||
}
|
||||
else
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_notes');
|
||||
print $doleditor->Create();
|
||||
}
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '<tr><td>';
|
||||
print $form->textwithpicto($langs->trans("WatermarkOnDraftContractCards"), $htmltext).'<br>';
|
||||
print '<input size="50" class="flat" type="text" name="RECEPTION_DRAFT_WATERMARK" value="'.$conf->global->RECEPTION_DRAFT_WATERMARK.'">';
|
||||
print "</td></tr>\n";
|
||||
*/
|
||||
print '</table>';
|
||||
|
||||
print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></div>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@ -258,7 +258,7 @@ else
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.$langs->trans("FeatureNotAvailableOnLinux").'">'.$langs->trans("DoTestServerAvailability").'</a>';
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("FeatureNotAvailableOnLinux").'">'.$langs->trans("DoTestServerAvailability").'</a>';
|
||||
}*/
|
||||
|
||||
if (count($listofmethods) && ! empty($conf->global->MAIN_SMS_SENDMODE))
|
||||
@ -267,7 +267,7 @@ else
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused" href="#">'.$langs->trans("DoTestSend").'</a>';
|
||||
print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans("DoTestSend").'</a>';
|
||||
}
|
||||
print '</div>';
|
||||
|
||||
|
||||
@ -89,7 +89,7 @@ dol_fiche_head($head, 'setup', '', 0, 'user');
|
||||
|
||||
print '<br>';
|
||||
|
||||
$arrayofsocialnetworks=array('skype'=>'Skype', 'twitter'=>'Twitter', 'facebook'=>'Facebook');
|
||||
$arrayofsocialnetworks=array('jabber'=>'Jabber', 'skype'=>'Skype', 'twitter'=>'Twitter', 'facebook'=>'Facebook');
|
||||
|
||||
foreach($arrayofsocialnetworks as $snkey => $snlabel)
|
||||
{
|
||||
|
||||
@ -78,16 +78,22 @@ if($action)
|
||||
// Mode of stock increase
|
||||
if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_BILL'
|
||||
|| $action == 'STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER'
|
||||
|| $action == 'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER')
|
||||
|| $action == 'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER'
|
||||
|| $action == 'STOCK_CALCULATE_ON_RECEPTION'
|
||||
|| $action == 'STOCK_CALCULATE_ON_RECEPTION_CLOSE')
|
||||
{
|
||||
//Use variable cause empty(GETPOST()) do not work with php version < 5.4
|
||||
$valdispatch=GETPOST('STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER','alpha');
|
||||
|
||||
$res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_BILL", '','chaine',0,'',$conf->entity);
|
||||
$res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", '','chaine',0,'',$conf->entity);
|
||||
$res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_RECEPTION", '','chaine',0,'',$conf->entity);
|
||||
$res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_RECEPTION_CLOSE", '','chaine',0,'',$conf->entity);
|
||||
$res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", '','chaine',0,'',$conf->entity);
|
||||
if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_BILL') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_BILL", GETPOST('STOCK_CALCULATE_ON_SUPPLIER_BILL','alpha'),'chaine',0,'',$conf->entity);
|
||||
if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", GETPOST('STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER','alpha'),'chaine',0,'',$conf->entity);
|
||||
if ($action == 'STOCK_CALCULATE_ON_RECEPTION') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_RECEPTION", GETPOST('STOCK_CALCULATE_ON_RECEPTION','alpha'),'chaine',0,'',$conf->entity);
|
||||
if ($action == 'STOCK_CALCULATE_ON_RECEPTION_CLOSE') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_RECEPTION_CLOSE", GETPOST('STOCK_CALCULATE_ON_RECEPTION_CLOSE','alpha'),'chaine',0,'',$conf->entity);
|
||||
if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", $valdispatch,'chaine',0,'',$conf->entity);
|
||||
if (empty($valdispatch)) {
|
||||
$res=dolibarr_set_const($db, "SUPPLIER_ORDER_USE_DISPATCH_STATUS", '','chaine',0,'',$conf->entity);
|
||||
@ -307,25 +313,58 @@ else
|
||||
print "</td>\n</tr>\n";
|
||||
$found++;
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("ReStockOnDispatchOrder").'</td>';
|
||||
print '<td align="right">';
|
||||
if (! empty($conf->fournisseur->enabled))
|
||||
if (!empty($conf->reception->enabled))
|
||||
{
|
||||
print "<form method=\"post\" action=\"stock.php\">";
|
||||
print '<tr class="oddeven">';
|
||||
print '<td width="60%">'.$langs->trans("StockOnReception").'</td>';
|
||||
print '<td width="160" align="right">';
|
||||
|
||||
print "<form method=\"post\" action=\"stock.php\">";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER\">";
|
||||
print $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER,1,$disabled);
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"STOCK_CALCULATE_ON_RECEPTION\">";
|
||||
print $form->selectyesno("STOCK_CALCULATE_ON_RECEPTION", $conf->global->STOCK_CALCULATE_ON_RECEPTION, 1, $disabled);
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>';
|
||||
print "</form>\n";
|
||||
|
||||
print "</td>\n</tr>\n";
|
||||
$found++;
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td width="60%">'.$langs->trans("StockOnReceptionOnClosing").'</td>';
|
||||
print '<td width="160" align="right">';
|
||||
|
||||
print "<form method=\"post\" action=\"stock.php\">";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"STOCK_CALCULATE_ON_RECEPTION_CLOSE\">";
|
||||
print $form->selectyesno("STOCK_CALCULATE_ON_RECEPTION_CLOSE", $conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE, 1, $disabled);
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>';
|
||||
print "</form>\n";
|
||||
|
||||
print "</td>\n</tr>\n";
|
||||
$found++;
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name"));
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("ReStockOnDispatchOrder").'</td>';
|
||||
print '<td align="right">';
|
||||
if (! empty($conf->fournisseur->enabled))
|
||||
{
|
||||
print "<form method=\"post\" action=\"stock.php\">";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER\">";
|
||||
print $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER,1,$disabled);
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>';
|
||||
print "</form>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name"));
|
||||
}
|
||||
print "</td>\n</tr>\n";
|
||||
$found++;
|
||||
}
|
||||
print "</td>\n</tr>\n";
|
||||
$found++;
|
||||
|
||||
/*if (! $found)
|
||||
{
|
||||
|
||||
@ -517,7 +517,6 @@ print '<br>';
|
||||
<input type="hidden" name="export_type" value="server" />
|
||||
|
||||
<fieldset><legend class="legendforfieldsetstep" style="font-size: 3em">2</legend>
|
||||
<div class="fichehalfleft">
|
||||
|
||||
<?php
|
||||
print $langs->trans("BackupDesc2",DOL_DATA_ROOT).'<br>';
|
||||
@ -525,6 +524,13 @@ print $langs->trans("BackupDescX").'<br><br>';
|
||||
|
||||
?>
|
||||
|
||||
<div id="backupfilesleft" class="fichehalfleft">
|
||||
|
||||
<?php
|
||||
|
||||
print load_fiche_titre($title?$title:$langs->trans("BackupDumpWizard"));
|
||||
?>
|
||||
|
||||
<label for="zipfilename_template"> <?php echo $langs->trans("FileNameToGenerate"); ?></label><br>
|
||||
<input type="text" name="zipfilename_template" style="width: 90%"
|
||||
id="zipfilename_template"
|
||||
@ -537,6 +543,7 @@ echo $file;
|
||||
?>" /> <br>
|
||||
<br>
|
||||
|
||||
|
||||
<?php
|
||||
// Show compression choices
|
||||
print '<div class="formelementrow">';
|
||||
|
||||
@ -28,7 +28,7 @@ require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("admin","workflow","propal","workflow","orders","supplier_proposals"));
|
||||
$langs->loadLangs(array("admin","workflow","propal","workflow","orders","supplier_proposals","receptions"));
|
||||
|
||||
if (! $user->admin) accessforbidden();
|
||||
|
||||
@ -86,6 +86,8 @@ $workflowcodes=array(
|
||||
'WORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL'=>array('family'=>'classify_supplier_proposal', 'position'=>60, 'enabled'=>'! empty($conf->supplier_proposal->enabled) && ! empty($conf->fournisseur->enabled)', 'picto'=>'propal','warning'=>''),
|
||||
// Automatic classification supplier order
|
||||
'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER'=>array('family'=>'classify_supplier_order', 'position'=>62, 'enabled'=>'! empty($conf->fournisseur->enabled)', 'picto'=>'order','warning'=>''),
|
||||
//Automatic classification reception
|
||||
'WORKFLOW_BILL_ON_RECEPTION'=>array('family'=>'classify_reception', 'position'=>30, 'enabled'=>'! empty($conf->reception->enabled) && ! empty($conf->fournisseur->enabled)', 'picto'=>'bill'),
|
||||
);
|
||||
|
||||
if (! empty($conf->modules_parts['workflow']) && is_array($conf->modules_parts['workflow']))
|
||||
@ -138,6 +140,7 @@ foreach($workflowcodes as $key => $params)
|
||||
if ($reg[1] == 'order') print ' - '.$langs->trans('Order');
|
||||
if ($reg[1] == 'supplier_proposal') print ' - '.$langs->trans('SupplierProposal');
|
||||
if ($reg[1] == 'supplier_order') print ' - '.$langs->trans('SupplierOrder');
|
||||
if ($reg[1] == 'reception') print ' - '.$langs->trans('Reception');
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -287,7 +287,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Modify').'</a>'."\n";
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Modify').'</a>'."\n";
|
||||
}
|
||||
|
||||
if ($user->rights->asset->delete)
|
||||
@ -296,7 +296,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Delete').'</a>'."\n";
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Delete').'</a>'."\n";
|
||||
}
|
||||
}
|
||||
print '</div>'."\n";
|
||||
|
||||
@ -413,7 +413,7 @@ class BlockedLog
|
||||
{
|
||||
if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties
|
||||
if (! in_array($key, array(
|
||||
'ref','facnumber','ref_client','ref_supplier','date','datef','type','total_ht','total_tva','total_ttc','localtax1','localtax2','revenuestamp','datepointoftax','note_public','lines'
|
||||
'ref','ref_client','ref_supplier','date','datef','type','total_ht','total_tva','total_ttc','localtax1','localtax2','revenuestamp','datepointoftax','note_public','lines'
|
||||
))) continue; // Discard if not into a dedicated list
|
||||
if ($key == 'lines')
|
||||
{
|
||||
@ -444,7 +444,7 @@ class BlockedLog
|
||||
{
|
||||
if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties
|
||||
if (! in_array($key, array(
|
||||
'ref','facnumber','ref_client','ref_supplier','date','datef','type','total_ht','total_tva','total_ttc','localtax1','localtax2','revenuestamp','datepointoftax','note_public'
|
||||
'ref','ref_client','ref_supplier','date','datef','type','total_ht','total_tva','total_ttc','localtax1','localtax2','revenuestamp','datepointoftax','note_public'
|
||||
))) continue; // Discard if not into a dedicated list
|
||||
if (!is_object($value)) $this->object_data->{$key} = $value;
|
||||
}
|
||||
@ -557,7 +557,7 @@ class BlockedLog
|
||||
{
|
||||
if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties
|
||||
if (! in_array($key, array(
|
||||
'ref','facnumber','ref_client','ref_supplier','date','datef','type','total_ht','total_tva','total_ttc','localtax1','localtax2','revenuestamp','datepointoftax','note_public'
|
||||
'ref','ref_client','ref_supplier','date','datef','type','total_ht','total_tva','total_ttc','localtax1','localtax2','revenuestamp','datepointoftax','note_public'
|
||||
))) continue; // Discard if not into a dedicated list
|
||||
if (!is_object($value))
|
||||
{
|
||||
|
||||
@ -65,7 +65,7 @@ class Categorie extends CommonObject
|
||||
*
|
||||
* @note This array should be remove in future, once previous constants are moved to the string value. Deprecated
|
||||
*/
|
||||
private $MAP_ID = array(
|
||||
protected $MAP_ID = array(
|
||||
'product' => 0,
|
||||
'supplier' => 1,
|
||||
'customer' => 2,
|
||||
@ -97,7 +97,7 @@ class Categorie extends CommonObject
|
||||
*
|
||||
* @note Move to const array when PHP 5.6 will be our minimum target
|
||||
*/
|
||||
private $MAP_CAT_FK = array(
|
||||
protected $MAP_CAT_FK = array(
|
||||
'product' => 'product',
|
||||
'customer' => 'soc',
|
||||
'supplier' => 'soc',
|
||||
@ -114,7 +114,7 @@ class Categorie extends CommonObject
|
||||
*
|
||||
* @note Move to const array when PHP 5.6 will be our minimum target
|
||||
*/
|
||||
private $MAP_CAT_TABLE = array(
|
||||
protected $MAP_CAT_TABLE = array(
|
||||
'product' => 'product',
|
||||
'customer' => 'societe',
|
||||
'supplier' => 'fournisseur',
|
||||
@ -131,7 +131,7 @@ class Categorie extends CommonObject
|
||||
*
|
||||
* @note Move to const array when PHP 5.6 will be our minimum target
|
||||
*/
|
||||
private $MAP_OBJ_CLASS = array(
|
||||
protected $MAP_OBJ_CLASS = array(
|
||||
'product' => 'Product',
|
||||
'customer' => 'Societe',
|
||||
'supplier' => 'Fournisseur',
|
||||
@ -148,7 +148,7 @@ class Categorie extends CommonObject
|
||||
*
|
||||
* @note Move to const array when PHP 5.6 will be our minimum target
|
||||
*/
|
||||
private $MAP_OBJ_TABLE = array(
|
||||
protected $MAP_OBJ_TABLE = array(
|
||||
'product' => 'product',
|
||||
'customer' => 'societe',
|
||||
'supplier' => 'societe',
|
||||
@ -944,7 +944,7 @@ class Categorie extends CommonObject
|
||||
*
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
private function load_motherof()
|
||||
protected function load_motherof()
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
@ -1536,7 +1536,7 @@ class Categorie extends CommonObject
|
||||
if (colorIsLight($this->color)) $forced_color='categtextblack';
|
||||
}
|
||||
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$this->id.'&type='.$this->type.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip '.$forced_color .'">';
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$this->id.'&type='.$this->type.'&backtopage='.urlencode($_SERVER['PHP_SELF']).'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip '.$forced_color .'">';
|
||||
$linkend='</a>';
|
||||
|
||||
$picto='category';
|
||||
|
||||
@ -189,7 +189,7 @@ if ($object->id)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused hideonsmartphone" href="#">';
|
||||
print '<a class="butActionRefused classfortooltip hideonsmartphone" href="#">';
|
||||
print $langs->trans("AddPhoto").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -1658,7 +1658,7 @@ if ($id > 0)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans("Modify").'</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans("Modify").'</a></div>';
|
||||
}
|
||||
|
||||
if ($user->rights->agenda->allactions->create ||
|
||||
@ -1668,7 +1668,7 @@ if ($id > 0)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans("ToClone").'</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans("ToClone").'</a></div>';
|
||||
}
|
||||
|
||||
if ($user->rights->agenda->allactions->delete ||
|
||||
@ -1678,7 +1678,7 @@ if ($id > 0)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans("Delete").'</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans("Delete").'</a></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1292,7 +1292,8 @@ class ActionComm extends CommonObject
|
||||
$tooltip .= '<br><b>' . $langs->trans('Type') . ':</b> ' . $labeltype;
|
||||
if (! empty($this->location))
|
||||
$tooltip .= '<br><b>' . $langs->trans('Location') . ':</b> ' . $this->location;
|
||||
|
||||
if (! empty($this->note))
|
||||
$tooltip .= '<br><b>' . $langs->trans('Note') . ':</b> ' . $this->note;
|
||||
$linkclose='';
|
||||
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE) && $this->type_color)
|
||||
$linkclose = ' style="background-color:#'.$this->type_color.'"';
|
||||
|
||||
@ -1136,7 +1136,7 @@ if ($object->id > 0)
|
||||
*/
|
||||
if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
{
|
||||
$sql = 'SELECT f.rowid as facid, f.facnumber, f.type, f.amount';
|
||||
$sql = 'SELECT f.rowid as facid, f.ref, f.type, f.amount';
|
||||
$sql.= ', f.total as total_ht';
|
||||
$sql.= ', f.tva as total_tva';
|
||||
$sql.= ', f.total_ttc';
|
||||
@ -1147,7 +1147,7 @@ if ($object->id > 0)
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON f.rowid=pf.fk_facture';
|
||||
$sql.= " WHERE f.fk_soc = s.rowid AND s.rowid = ".$object->id;
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
$sql.= ' GROUP BY f.rowid, f.facnumber, f.type, f.amount, f.total, f.tva, f.total_ttc,';
|
||||
$sql.= ' GROUP BY f.rowid, f.ref, f.type, f.amount, f.total, f.tva, f.total_ttc,';
|
||||
$sql.= ' f.datef, f.datec, f.paye, f.fk_statut,';
|
||||
$sql.= ' s.nom, s.rowid';
|
||||
$sql.= " ORDER BY f.datef DESC, f.datec DESC";
|
||||
@ -1176,7 +1176,7 @@ if ($object->id > 0)
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
$facturestatic->id = $objp->facid;
|
||||
$facturestatic->ref = $objp->facnumber;
|
||||
$facturestatic->ref = $objp->ref;
|
||||
$facturestatic->type = $objp->type;
|
||||
$facturestatic->total_ht = $objp->total_ht;
|
||||
$facturestatic->total_tva = $objp->total_tva;
|
||||
@ -1242,7 +1242,7 @@ if ($object->id > 0)
|
||||
{
|
||||
if ($object->status != 1)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" title="'.dol_escape_js($langs->trans("ThirdPartyIsClosed")).'" href="#">'.$langs->trans("ThirdPartyIsClosed").'</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("ThirdPartyIsClosed")).'" href="#">'.$langs->trans("ThirdPartyIsClosed").'</a></div>';
|
||||
}
|
||||
|
||||
if (! empty($conf->propal->enabled) && $user->rights->propal->creer && $object->status==1)
|
||||
@ -1282,7 +1282,7 @@ if ($object->id > 0)
|
||||
{
|
||||
if (empty($user->rights->facture->creer))
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" title="'.dol_escape_js($langs->trans("NotAllowed")).'" href="#">'.$langs->trans("AddBill").'</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("NotAllowed")).'" href="#">'.$langs->trans("AddBill").'</a></div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1294,13 +1294,13 @@ if ($object->id > 0)
|
||||
if ($object->client != 0 && $object->client != 2)
|
||||
{
|
||||
if (! empty($orders2invoice) && $orders2invoice > 0) print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/commande/orderstoinvoice.php?socid='.$object->id.'">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused" title="'.dol_escape_js($langs->trans("NoOrdersToInvoice")).'" href="#">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("NoOrdersToInvoice")).'" href="#">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
|
||||
}
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused" title="'.dol_escape_js($langs->trans("ThirdPartyMustBeEditAsCustomer")).'" href="#">'.$langs->trans("AddBill").'</a></div>';
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("ThirdPartyMustBeEditAsCustomer")).'" href="#">'.$langs->trans("AddBill").'</a></div>';
|
||||
}
|
||||
|
||||
if ($object->client != 0 && $object->client != 2) print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/card.php?action=create&socid='.$object->id.'">'.$langs->trans("AddBill").'</a></div>';
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused" title="'.dol_escape_js($langs->trans("ThirdPartyMustBeEditAsCustomer")).'" href="#">'.$langs->trans("AddBill").'</a></div>';
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("ThirdPartyMustBeEditAsCustomer")).'" href="#">'.$langs->trans("AddBill").'</a></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -995,7 +995,7 @@ else
|
||||
|
||||
if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! $user->rights->mailing->mailing_advance->send)
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")).'">'.$langs->trans("TestMailing").'</a>';
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")).'">'.$langs->trans("TestMailing").'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1006,11 +1006,11 @@ else
|
||||
{
|
||||
if ($object->nbemail <= 0)
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NoTargetYet")).'">'.$langs->trans("ValidMailing").'</a>';
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NoTargetYet")).'">'.$langs->trans("ValidMailing").'</a>';
|
||||
}
|
||||
else if (empty($user->rights->mailing->valider))
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")).'">'.$langs->trans("ValidMailing").'</a>';
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")).'">'.$langs->trans("ValidMailing").'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1022,11 +1022,11 @@ else
|
||||
{
|
||||
if ($conf->global->MAILING_LIMIT_SENDBYWEB < 0)
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("SendingFromWebInterfaceIsNotAllowed")).'">'.$langs->trans("SendMailing").'</a>';
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("SendingFromWebInterfaceIsNotAllowed")).'">'.$langs->trans("SendMailing").'</a>';
|
||||
}
|
||||
else if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! $user->rights->mailing->mailing_advance->send)
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")).'">'.$langs->trans("SendMailing").'</a>';
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")).'">'.$langs->trans("SendMailing").'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1043,7 +1043,7 @@ else
|
||||
{
|
||||
if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! $user->rights->mailing->mailing_advance->send)
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")).'">'.$langs->trans("ResetMailing").'</a>';
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")).'">'.$langs->trans("ResetMailing").'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1055,7 +1055,7 @@ else
|
||||
{
|
||||
if ($object->statut > 0 && (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! $user->rights->mailing->mailing_advance->delete))
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")).'">'.$langs->trans("DeleteMailing").'</a>';
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")).'">'.$langs->trans("DeleteMailing").'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -72,7 +72,7 @@ $object = new Mailing($db);
|
||||
|
||||
if ($action == 'add')
|
||||
{
|
||||
$module=GETPOST("module");
|
||||
$module=GETPOST("module",'alpha');
|
||||
$result=-1;
|
||||
|
||||
foreach ($modulesdir as $dir)
|
||||
@ -89,14 +89,10 @@ if ($action == 'add')
|
||||
{
|
||||
require_once $file;
|
||||
|
||||
// We fill $filtersarray. Using this variable is now deprecated. Kept for backward compatibility.
|
||||
$filtersarray=array();
|
||||
if (isset($_POST["filter"])) $filtersarray[0]=$_POST["filter"];
|
||||
|
||||
// Add targets into database
|
||||
$obj = new $classname($db);
|
||||
dol_syslog("Call add_to_target on class ".$classname);
|
||||
$result=$obj->add_to_target($id,$filtersarray);
|
||||
$result=$obj->add_to_target($id);
|
||||
}
|
||||
}
|
||||
if ($result > 0)
|
||||
@ -329,14 +325,16 @@ if ($object->fetch($id) >= 0)
|
||||
// Si le module mailing est qualifie
|
||||
if ($qualified)
|
||||
{
|
||||
$var = ! $var;
|
||||
|
||||
if ($allowaddtarget)
|
||||
{
|
||||
print '<form class="oddeven tagtr" name="'.$modulename.'" action="'.$_SERVER['PHP_SELF'].'?action=add&id='.$object->id.'&module='.$modulename.'" method="POST" enctype="multipart/form-data">';
|
||||
print '<form '.$bctag[$var].' name="'.$modulename.'" action="'.$_SERVER['PHP_SELF'].'?action=add&id='.$object->id.'&module='.$modulename.'" method="POST" enctype="multipart/form-data">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="oddeven tagtr">';
|
||||
print '<div '.$bctag[$var].'>';
|
||||
}
|
||||
|
||||
print '<div class="tagtd">';
|
||||
|
||||
@ -745,7 +745,16 @@ class AdvanceTargetingMailing extends CommonObject
|
||||
$sqlwhere[]= " (t.civility IN ('".$this->db->escape(implode("','",$arrayquery['contact_civility']))."'))";
|
||||
}
|
||||
if ($arrayquery['contact_no_email']!='') {
|
||||
$sqlwhere[]= " (t.no_email='".$this->db->escape($arrayquery['contact_no_email'])."')";
|
||||
$tmpwhere = '';
|
||||
if (! empty($arrayquery['contact_no_email']))
|
||||
{
|
||||
$tmpwhere.= "(t.email IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE t.entity IN (".getEntity('mailing').") AND email = '".$this->db->escape($arrayquery['contact_no_email'])."'))";
|
||||
}
|
||||
else
|
||||
{
|
||||
$tmpwhere.= "(t.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE t.entity IN (".getEntity('mailing').") AND email = '".$this->db->escape($arrayquery['contact_no_email'])."'))";
|
||||
}
|
||||
$sqlwhere[]= $tmpwhere;
|
||||
}
|
||||
if ($arrayquery['contact_update_st_dt']!='') {
|
||||
$sqlwhere[]= " (t.tms >= '".$this->db->idate($arrayquery['contact_update_st_dt'])."' AND t.tms <= '".$this->db->idate($arrayquery['contact_update_end_dt'])."')";
|
||||
|
||||
@ -10,8 +10,8 @@
|
||||
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -696,6 +696,88 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// add lines from objectlinked
|
||||
elseif($action == 'import_lines_from_object'
|
||||
&& $user->rights->propal->creer
|
||||
&& $object->statut == Propal::STATUS_DRAFT
|
||||
)
|
||||
{
|
||||
$fromElement = GETPOST('fromelement');
|
||||
$fromElementid = GETPOST('fromelementid');
|
||||
$importLines = GETPOST('line_checkbox');
|
||||
|
||||
if(!empty($importLines) && is_array($importLines) && !empty($fromElement) && ctype_alpha($fromElement) && !empty($fromElementid))
|
||||
{
|
||||
if($fromElement == 'commande')
|
||||
{
|
||||
dol_include_once('/'.$fromElement.'/class/'.$fromElement.'.class.php');
|
||||
$lineClassName = 'OrderLine';
|
||||
}
|
||||
elseif($fromElement == 'propal')
|
||||
{
|
||||
dol_include_once('/comm/'.$fromElement.'/class/'.$fromElement.'.class.php');
|
||||
$lineClassName = 'PropaleLigne';
|
||||
}
|
||||
$nextRang = count($object->lines) + 1;
|
||||
$importCount = 0;
|
||||
$error = 0;
|
||||
foreach($importLines as $lineId)
|
||||
{
|
||||
$lineId = intval($lineId);
|
||||
$originLine = new $lineClassName($db);
|
||||
if(intval($fromElementid) > 0 && $originLine->fetch( $lineId ) > 0)
|
||||
{
|
||||
$originLine->fetch_optionals($lineId);
|
||||
$desc = $originLine->desc;
|
||||
$pu_ht = $originLine->subprice;
|
||||
$qty = $originLine->qty;
|
||||
$txtva = $originLine->tva_tx;
|
||||
$txlocaltax1 = $originLine->localtax1_tx;
|
||||
$txlocaltax2 = $originLine->localtax2_tx;
|
||||
$fk_product = $originLine->fk_product;
|
||||
$remise_percent = $originLine->remise_percent;
|
||||
$date_start = $originLine->date_start;
|
||||
$date_end = $originLine->date_end;
|
||||
$ventil = 0;
|
||||
$info_bits = $originLine->info_bits;
|
||||
$fk_remise_except = $originLine->fk_remise_except;
|
||||
$price_base_type='HT';
|
||||
$pu_ttc=0;
|
||||
$type = $originLine->product_type;
|
||||
$rang=$nextRang++;
|
||||
$special_code = $originLine->special_code;
|
||||
$origin = $originLine->element;
|
||||
$origin_id = $originLine->id;
|
||||
$fk_parent_line=0;
|
||||
$fk_fournprice=$originLine->fk_fournprice;
|
||||
$pa_ht = $originLine->pa_ht;
|
||||
$label = $originLine->label;
|
||||
$array_options = $originLine->array_options;
|
||||
$situation_percent = 100;
|
||||
$fk_prev_id = '';
|
||||
$fk_unit = $originLine->fk_unit;
|
||||
$pu_ht_devise = $originLine->multicurrency_subprice;
|
||||
|
||||
$res = $object->addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $price_base_type, $pu_ttc, $info_bits, $type, $rang, $special_code, $fk_parent_line, $fk_fournprice, $pa_ht, $label,$date_start, $date_end,$array_options, $fk_unit, $origin, $origin_id, $pu_ht_devise, $fk_remise_except);
|
||||
|
||||
if($res > 0){
|
||||
$importCount++;
|
||||
}else{
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
else{
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if($error)
|
||||
{
|
||||
setEventMessages($langs->trans('ErrorsOnXLines',$error), null, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
||||
|
||||
@ -959,7 +1041,7 @@ if (empty($reshook))
|
||||
$desc = $prod->description;
|
||||
}
|
||||
|
||||
$desc = dol_concatdesc($desc, $product_desc);
|
||||
$desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->CHANGE_ORDER_CONCAT_DESCRIPTION));
|
||||
|
||||
// Add dimensions into product description
|
||||
/*if (empty($conf->global->MAIN_PRODUCT_DISABLE_AUTOADD_DIM))
|
||||
@ -1627,7 +1709,7 @@ if ($action == 'create')
|
||||
if (! empty($conf->multicurrency->enabled))
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td>'.fieldLabel('Currency','multicurrency_code').'</td>';
|
||||
print '<td>'.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).'</td>';
|
||||
print '<td class="maxwidthonsmartphone">';
|
||||
print $form->selectMultiCurrency($currency_code, 'multicurrency_code', 0);
|
||||
print '</td></tr>';
|
||||
@ -2118,7 +2200,7 @@ if ($action == 'create')
|
||||
print '<tr>';
|
||||
print '<td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print fieldLabel('Currency','multicurrency_code');
|
||||
print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0);
|
||||
print '</td>';
|
||||
if ($action != 'editmulticurrencycode' && ! empty($object->brouillon) && $usercancreate)
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmulticurrencycode&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '</a></td>';
|
||||
@ -2135,7 +2217,7 @@ if ($action == 'create')
|
||||
print '<tr>';
|
||||
print '<td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print fieldLabel('CurrencyRate','multicurrency_tx');
|
||||
print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0);
|
||||
print '</td>';
|
||||
if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency && $usercancreate)
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmulticurrencyrate&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '</a></td>';
|
||||
@ -2243,17 +2325,17 @@ if ($action == 'create')
|
||||
if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency))
|
||||
{
|
||||
// Multicurrency Amount HT
|
||||
print '<tr><td class="titlefieldmiddle">' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '</td>';
|
||||
print '<tr><td class="titlefieldmiddle">' . $form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0) . '</td>';
|
||||
print '<td class="nowrap">' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Multicurrency Amount VAT
|
||||
print '<tr><td>' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '</td>';
|
||||
print '<tr><td>' . $form->editfieldkey('MulticurrencyAmountVAT', 'multicurrency_total_tva', '', $object, 0) . '</td>';
|
||||
print '<td class="nowrap">' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Multicurrency Amount TTC
|
||||
print '<tr><td>' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '</td>';
|
||||
print '<tr><td>' . $form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0) . '</td>';
|
||||
print '<td class="nowrap">' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
@ -2381,7 +2463,7 @@ if ($action == 'create')
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=validate">' . $langs->trans('Validate') . '</a></div>';
|
||||
}
|
||||
else
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#">' . $langs->trans('Validate') . '</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">' . $langs->trans('Validate') . '</a></div>';
|
||||
}
|
||||
// Create event
|
||||
/*if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a "workflow" action so should appears somewhere else on page.
|
||||
@ -2404,7 +2486,7 @@ if ($action == 'create')
|
||||
if ($usercansend) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . '</a></div>';
|
||||
} else
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#">' . $langs->trans('SendMail') . '</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">' . $langs->trans('SendMail') . '</a></div>';
|
||||
}
|
||||
|
||||
// Create an order
|
||||
@ -2488,7 +2570,13 @@ if ($action == 'create')
|
||||
|
||||
// Show links to link elements
|
||||
$linktoelem = $form->showLinkToObjectBlock($object, null, array('propal'));
|
||||
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
|
||||
|
||||
$compatibleImportElementsList = false;
|
||||
if($user->rights->propal->creer && $object->statut == Propal::STATUS_DRAFT)
|
||||
{
|
||||
$compatibleImportElementsList = array('commande','propal'); // import from linked elements
|
||||
}
|
||||
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem, $compatibleImportElementsList);
|
||||
|
||||
// Show online signature link
|
||||
$useonlinesignature = $conf->global->MAIN_FEATURES_LEVEL; // Replace this with 1 when feature to make online signature is ok
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2018 Ferran Marcet <fmarcet@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
|
||||
@ -438,38 +439,40 @@ class Propal extends CommonObject
|
||||
global $mysoc, $conf, $langs;
|
||||
|
||||
dol_syslog(get_class($this)."::addline propalid=$this->id, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_except=$remise_percent, price_base_type=$price_base_type, pu_ttc=$pu_ttc, info_bits=$info_bits, type=$type, fk_remise_except=".$fk_remise_except);
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||
|
||||
// Clean parameters
|
||||
if (empty($remise_percent)) $remise_percent=0;
|
||||
if (empty($qty)) $qty=0;
|
||||
if (empty($info_bits)) $info_bits=0;
|
||||
if (empty($rang)) $rang=0;
|
||||
if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0;
|
||||
|
||||
$remise_percent=price2num($remise_percent);
|
||||
$qty=price2num($qty);
|
||||
$pu_ht=price2num($pu_ht);
|
||||
$pu_ht_devise=price2num($pu_ht_devise);
|
||||
$pu_ttc=price2num($pu_ttc);
|
||||
$txtva=price2num($txtva); // $txtva can have format '5.0(XXX)' or '5'
|
||||
$txlocaltax1=price2num($txlocaltax1);
|
||||
$txlocaltax2=price2num($txlocaltax2);
|
||||
$pa_ht=price2num($pa_ht);
|
||||
if ($price_base_type=='HT')
|
||||
{
|
||||
$pu=$pu_ht;
|
||||
}
|
||||
else
|
||||
{
|
||||
$pu=$pu_ttc;
|
||||
}
|
||||
|
||||
// Check parameters
|
||||
if ($type < 0) return -1;
|
||||
|
||||
if ($this->statut == self::STATUS_DRAFT)
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||
|
||||
// Clean parameters
|
||||
if (empty($remise_percent)) $remise_percent=0;
|
||||
if (empty($qty)) $qty=0;
|
||||
if (empty($info_bits)) $info_bits=0;
|
||||
if (empty($rang)) $rang=0;
|
||||
if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0;
|
||||
|
||||
$remise_percent=price2num($remise_percent);
|
||||
$qty=price2num($qty);
|
||||
$pu_ht=price2num($pu_ht);
|
||||
$pu_ht_devise=price2num($pu_ht_devise);
|
||||
$pu_ttc=price2num($pu_ttc);
|
||||
if (!preg_match('/\((.*)\)/', $txtva)) {
|
||||
$txtva = price2num($txtva); // $txtva can have format '5,1' or '5.1' or '5.1(XXX)', we must clean only if '5,1'
|
||||
}
|
||||
$txlocaltax1=price2num($txlocaltax1);
|
||||
$txlocaltax2=price2num($txlocaltax2);
|
||||
$pa_ht=price2num($pa_ht);
|
||||
if ($price_base_type=='HT')
|
||||
{
|
||||
$pu=$pu_ht;
|
||||
}
|
||||
else
|
||||
{
|
||||
$pu=$pu_ttc;
|
||||
}
|
||||
|
||||
// Check parameters
|
||||
if ($type < 0) return -1;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$product_type=$type;
|
||||
@ -2775,7 +2778,7 @@ class Propal extends CommonObject
|
||||
|
||||
if (count($linkedInvoices) > 0)
|
||||
{
|
||||
$sql= "SELECT rowid as facid, facnumber, total, datef as df, fk_user_author, fk_statut, paye";
|
||||
$sql= "SELECT rowid as facid, ref, total, datef as df, fk_user_author, fk_statut, paye";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture";
|
||||
$sql.= " WHERE rowid IN (".implode(',',$linkedInvoices).")";
|
||||
|
||||
|
||||
@ -45,7 +45,7 @@ require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('companies','propal','compta','bills','orders','products','deliveries'));
|
||||
$langs->loadLangs(array('companies', 'propal', 'compta', 'bills', 'orders', 'products', 'deliveries', 'categories'));
|
||||
|
||||
$socid=GETPOST('socid','int');
|
||||
|
||||
@ -329,45 +329,9 @@ if ($viewstatut != '' && $viewstatut != '-1')
|
||||
{
|
||||
$sql.= ' AND p.fk_statut IN ('.$db->escape($viewstatut).')';
|
||||
}
|
||||
if ($search_month > 0)
|
||||
{
|
||||
if ($search_year > 0 && empty($search_day))
|
||||
$sql.= " AND p.datep BETWEEN '".$db->idate(dol_get_first_day($search_year,$search_month,false))."' AND '".$db->idate(dol_get_last_day($search_year,$search_month,false))."'";
|
||||
else if ($search_year > 0 && ! empty($search_day))
|
||||
$sql.= " AND p.datep BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month, $search_day, $search_year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month, $search_day, $search_year))."'";
|
||||
else
|
||||
$sql.= " AND date_format(p.datep, '%m') = '".$db->escape($search_month)."'";
|
||||
}
|
||||
else if ($search_year > 0)
|
||||
{
|
||||
$sql.= " AND p.datep BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'";
|
||||
}
|
||||
if ($search_month_end > 0)
|
||||
{
|
||||
if ($search_yearfin > 0 && empty($search_dayfin))
|
||||
$sql.= " AND p.fin_validite BETWEEN '".$db->idate(dol_get_first_day($search_yearfin,$search_month_end,false))."' AND '".$db->idate(dol_get_last_day($search_yearfin,$search_month_end,false))."'";
|
||||
else if ($search_yearfin > 0 && ! empty($search_dayfin))
|
||||
$sql.= " AND p.fin_validite BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month_end, $search_dayfin, $search_yearfin))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month_end, $search_dayfin, $search_yearfin))."'";
|
||||
else
|
||||
$sql.= " AND date_format(p.fin_validite, '%m') = '".$db->escape($search_month_end)."'";
|
||||
}
|
||||
else if ($search_yearfin > 0)
|
||||
{
|
||||
$sql.= " AND p.fin_validite BETWEEN '".$db->idate(dol_get_first_day($search_yearfin,1,false))."' AND '".$db->idate(dol_get_last_day($search_yearfin,12,false))."'";
|
||||
}
|
||||
if ($search_monthdelivery > 0)
|
||||
{
|
||||
if ($search_yeardelivery > 0 && empty($search_daydelivery))
|
||||
$sql.= " AND p.date_livraison BETWEEN '".$db->idate(dol_get_first_day($search_yeardelivery,$search_monthdelivery,false))."' AND '".$db->idate(dol_get_last_day($search_yeardelivery,$search_monthdelivery,false))."'";
|
||||
else if ($search_yeardelivery > 0 && ! empty($search_daydelivery))
|
||||
$sql.= " AND p.date_livraison BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_monthdelivery, $search_daydelivery, $search_yeardelivery))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_monthdelivery, $search_daydelivery, $search_yeardelivery))."'";
|
||||
else
|
||||
$sql.= " AND date_format(p.date_livraison, '%m') = '".$db->escape($search_monthdelivery)."'";
|
||||
}
|
||||
else if ($search_yeardelivery > 0)
|
||||
{
|
||||
$sql.= " AND p.date_livraison BETWEEN '".$db->idate(dol_get_first_day($search_yeardelivery,1,false))."' AND '".$db->idate(dol_get_last_day($search_yeardelivery,12,false))."'";
|
||||
}
|
||||
$sql.= dolSqlDateFilter("p.datep", $search_day, $search_month, $search_year);
|
||||
$sql.= dolSqlDateFilter("p.fin_validite", $search_dayfin, $search_month_end, $search_yearfin);
|
||||
$sql.= dolSqlDateFilter("p.date_livraison", $search_daydelivery, $search_monthdelivery, $search_yeardelivery);
|
||||
if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$db->escape($search_sale);
|
||||
if ($search_user > 0)
|
||||
{
|
||||
@ -462,6 +426,7 @@ if ($resql)
|
||||
|
||||
// List of mass actions available
|
||||
$arrayofmassactions = array(
|
||||
'generate_doc'=>$langs->trans("Generate"),
|
||||
'presend'=>$langs->trans("SendByMail"),
|
||||
'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
|
||||
@ -407,7 +407,7 @@ if ($socid > 0)
|
||||
if($isCustomer) {
|
||||
if($isSupplier) {
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="fichehalfleft">';
|
||||
print '<div class="fichehalfleft fichehalfleft-lg">';
|
||||
print load_fiche_titre($langs->trans("CustomerDiscounts"), '', '');
|
||||
}
|
||||
|
||||
@ -415,7 +415,7 @@ if ($socid > 0)
|
||||
$sql.= " rc.datec as dc, rc.description,";
|
||||
$sql.= " rc.fk_facture_source,";
|
||||
$sql.= " u.login, u.rowid as user_id,";
|
||||
$sql.= " fa.facnumber as ref, fa.type as type";
|
||||
$sql.= " fa.ref as ref, fa.type as type";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."societe_remise_except as rc";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as fa ON rc.fk_facture_source = fa.rowid";
|
||||
$sql.= " WHERE rc.fk_soc = " . $object->id;
|
||||
@ -542,7 +542,7 @@ if ($socid > 0)
|
||||
if($isSupplier) {
|
||||
if($isCustomer) {
|
||||
print '</div>'; // class="fichehalfleft"
|
||||
print '<div class="fichehalfright">';
|
||||
print '<div class="fichehalfright fichehalfright-lg">';
|
||||
print '<div class="ficheaddleft">';
|
||||
print load_fiche_titre($langs->trans("SupplierDiscounts"), '', '');
|
||||
}
|
||||
@ -695,7 +695,7 @@ if ($socid > 0)
|
||||
if($isCustomer) {
|
||||
if($isSupplier) {
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="fichehalfleft">';
|
||||
print '<div class="fichehalfleft fichehalfleft-lg">';
|
||||
print load_fiche_titre($langs->trans("CustomerDiscounts"), '', '');
|
||||
}
|
||||
|
||||
@ -704,8 +704,8 @@ if ($socid > 0)
|
||||
$sql.= " rc.datec as dc, rc.description, rc.fk_facture_line, rc.fk_facture,";
|
||||
$sql.= " rc.fk_facture_source,";
|
||||
$sql.= " u.login, u.rowid as user_id,";
|
||||
$sql.= " f.rowid, f.facnumber,";
|
||||
$sql.= " fa.facnumber as ref, fa.type as type";
|
||||
$sql.= " f.rowid, f.ref,";
|
||||
$sql.= " fa.ref as ref, fa.type as type";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= " , ".MAIN_DB_PREFIX."user as u";
|
||||
$sql.= " , ".MAIN_DB_PREFIX."facturedet as fc";
|
||||
@ -723,8 +723,8 @@ if ($socid > 0)
|
||||
$sql2.= " rc.datec as dc, rc.description, rc.fk_facture_line, rc.fk_facture,";
|
||||
$sql2.= " rc.fk_facture_source,";
|
||||
$sql2.= " u.login, u.rowid as user_id,";
|
||||
$sql2.= " f.rowid, f.facnumber,";
|
||||
$sql2.= " fa.facnumber as ref, fa.type as type";
|
||||
$sql2.= " f.rowid, f.ref,";
|
||||
$sql2.= " fa.ref as ref, fa.type as type";
|
||||
$sql2.= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql2.= " , ".MAIN_DB_PREFIX."user as u";
|
||||
$sql2.= " , ".MAIN_DB_PREFIX."societe_remise_except as rc";
|
||||
@ -819,7 +819,7 @@ if ($socid > 0)
|
||||
print $obj->description;
|
||||
print '</td>';
|
||||
}
|
||||
print '<td align="left" class="nowrap"><a href="'.DOL_URL_ROOT.'/compta/facture/card.php?facid='.$obj->rowid.'">'.img_object($langs->trans("ShowBill"),'bill').' '.$obj->facnumber.'</a></td>';
|
||||
print '<td align="left" class="nowrap"><a href="'.DOL_URL_ROOT.'/compta/facture/card.php?facid='.$obj->rowid.'">'.img_object($langs->trans("ShowBill"),'bill').' '.$obj->ref.'</a></td>';
|
||||
print '<td align="right">'.price($obj->amount_ht).'</td>';
|
||||
print '<td align="right">'.price2num($obj->tva_tx,'MU').'%</td>';
|
||||
print '<td align="right">'.price($obj->amount_ttc).'</td>';
|
||||
@ -848,7 +848,7 @@ if ($socid > 0)
|
||||
if($isSupplier) {
|
||||
if($isCustomer) {
|
||||
print '</div>'; // class="fichehalfleft"
|
||||
print '<div class="fichehalfright">';
|
||||
print '<div class="fichehalfright fichehalfright-lg">';
|
||||
print '<div class="ficheaddleft">';
|
||||
print load_fiche_titre($langs->trans("SupplierDiscounts"), '', '');
|
||||
}
|
||||
@ -858,7 +858,7 @@ if ($socid > 0)
|
||||
$sql.= " rc.datec as dc, rc.description, rc.fk_invoice_supplier_line, rc.fk_invoice_supplier,";
|
||||
$sql.= " rc.fk_invoice_supplier_source,";
|
||||
$sql.= " u.login, u.rowid as user_id,";
|
||||
$sql.= " f.rowid, f.ref as facnumber,";
|
||||
$sql.= " f.rowid, f.ref as ref,";
|
||||
$sql.= " fa.ref, fa.type as type";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||
$sql.= " , ".MAIN_DB_PREFIX."user as u";
|
||||
@ -877,7 +877,7 @@ if ($socid > 0)
|
||||
$sql2.= " rc.datec as dc, rc.description, rc.fk_invoice_supplier_line, rc.fk_invoice_supplier,";
|
||||
$sql2.= " rc.fk_invoice_supplier_source,";
|
||||
$sql2.= " u.login, u.rowid as user_id,";
|
||||
$sql2.= " f.rowid, f.ref as facnumber,";
|
||||
$sql2.= " f.rowid, f.ref as ref,";
|
||||
$sql2.= " fa.ref, fa.type as type";
|
||||
$sql2.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||
$sql2.= " , ".MAIN_DB_PREFIX."user as u";
|
||||
@ -973,7 +973,7 @@ if ($socid > 0)
|
||||
print $obj->description;
|
||||
print '</td>';
|
||||
}
|
||||
print '<td align="left" class="nowrap"><a href="'.DOL_URL_ROOT.'/fourn/facture/card.php?facid='.$obj->rowid.'">'.img_object($langs->trans("ShowBill"),'bill').' '.$obj->facnumber.'</a></td>';
|
||||
print '<td align="left" class="nowrap"><a href="'.DOL_URL_ROOT.'/fourn/facture/card.php?facid='.$obj->rowid.'">'.img_object($langs->trans("ShowBill"),'bill').' '.$obj->ref.'</a></td>';
|
||||
print '<td align="right">'.price($obj->amount_ht).'</td>';
|
||||
print '<td align="right">'.price2num($obj->tva_tx,'MU').'%</td>';
|
||||
print '<td align="right">'.price($obj->amount_ttc).'</td>';
|
||||
|
||||
@ -106,7 +106,8 @@ $permissionedit = $user->rights->commande->creer; // Used by the include of ac
|
||||
*/
|
||||
|
||||
$parameters = array('socid' => $socid);
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
// Note that $action and $object may be modified by some hooks
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action);
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
if (empty($reshook))
|
||||
@ -419,10 +420,11 @@ if (empty($reshook))
|
||||
|
||||
// Hooks
|
||||
$parameters = array('objFrom' => $srcobject);
|
||||
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been
|
||||
// modified by hook
|
||||
if ($reshook < 0)
|
||||
// Note that $action and $object may be modified by hook
|
||||
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action);
|
||||
if ($reshook < 0) {
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$error++;
|
||||
@ -866,7 +868,7 @@ if (empty($reshook))
|
||||
$desc = $prod->description;
|
||||
}
|
||||
|
||||
$desc = dol_concatdesc($desc, $product_desc);
|
||||
$desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->CHANGE_ORDER_CONCAT_DESCRIPTION));
|
||||
|
||||
// Add custom code and origin country into description
|
||||
if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code))) {
|
||||
@ -1318,6 +1320,88 @@ if (empty($reshook))
|
||||
exit();
|
||||
}
|
||||
|
||||
// add lines from objectlinked
|
||||
if($action == 'import_lines_from_object'
|
||||
&& $user->rights->commande->creer
|
||||
&& $object->statut == Commande::STATUS_DRAFT
|
||||
)
|
||||
{
|
||||
$fromElement = GETPOST('fromelement');
|
||||
$fromElementid = GETPOST('fromelementid');
|
||||
$importLines = GETPOST('line_checkbox');
|
||||
|
||||
if(!empty($importLines) && is_array($importLines) && !empty($fromElement) && ctype_alpha($fromElement) && !empty($fromElementid))
|
||||
{
|
||||
if($fromElement == 'commande')
|
||||
{
|
||||
dol_include_once('/'.$fromElement.'/class/'.$fromElement.'.class.php');
|
||||
$lineClassName = 'OrderLine';
|
||||
}
|
||||
elseif($fromElement == 'propal')
|
||||
{
|
||||
dol_include_once('/comm/'.$fromElement.'/class/'.$fromElement.'.class.php');
|
||||
$lineClassName = 'PropaleLigne';
|
||||
}
|
||||
$nextRang = count($object->lines) + 1;
|
||||
$importCount = 0;
|
||||
$error = 0;
|
||||
foreach($importLines as $lineId)
|
||||
{
|
||||
$lineId = intval($lineId);
|
||||
$originLine = new $lineClassName($db);
|
||||
if(intval($fromElementid) > 0 && $originLine->fetch( $lineId ) > 0)
|
||||
{
|
||||
$originLine->fetch_optionals($lineId);
|
||||
$desc = $originLine->desc;
|
||||
$pu_ht = $originLine->subprice;
|
||||
$qty = $originLine->qty;
|
||||
$txtva = $originLine->tva_tx;
|
||||
$txlocaltax1 = $originLine->localtax1_tx;
|
||||
$txlocaltax2 = $originLine->localtax2_tx;
|
||||
$fk_product = $originLine->fk_product;
|
||||
$remise_percent = $originLine->remise_percent;
|
||||
$date_start = $originLine->date_start;
|
||||
$date_end = $originLine->date_end;
|
||||
$ventil = 0;
|
||||
$info_bits = $originLine->info_bits;
|
||||
$fk_remise_except = $originLine->fk_remise_except;
|
||||
$price_base_type='HT';
|
||||
$pu_ttc=0;
|
||||
$type = $originLine->product_type;
|
||||
$rang=$nextRang++;
|
||||
$special_code = $originLine->special_code;
|
||||
$origin = $originLine->element;
|
||||
$origin_id = $originLine->id;
|
||||
$fk_parent_line=0;
|
||||
$fk_fournprice=$originLine->fk_fournprice;
|
||||
$pa_ht = $originLine->pa_ht;
|
||||
$label = $originLine->label;
|
||||
$array_options = $originLine->array_options;
|
||||
$situation_percent = 100;
|
||||
$fk_prev_id = '';
|
||||
$fk_unit = $originLine->fk_unit;
|
||||
$pu_ht_devise = $originLine->multicurrency_subprice;
|
||||
|
||||
$res = $object->addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $info_bits, $fk_remise_except, $price_base_type, $pu_ttc, $date_start, $date_end, $type, $rang, $special_code, $fk_parent_line, $fk_fournprice, $pa_ht, $label,$array_options, $fk_unit, $origin, $origin_id, $pu_ht_devise);
|
||||
|
||||
if($res > 0){
|
||||
$importCount++;
|
||||
}else{
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
else{
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if($error)
|
||||
{
|
||||
setEventMessages($langs->trans('ErrorsOnXLines',$error), null, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Actions when printing a doc from card
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
||||
|
||||
@ -1669,7 +1753,8 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
|
||||
// Other attributes
|
||||
$parameters = array('objectsrc' => $objectsrc, 'socid'=>$socid);
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by
|
||||
// Note that $action and $object may be modified by hook
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action);
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook)) {
|
||||
print $object->showOptionals($extrafields, 'edit');
|
||||
@ -1687,7 +1772,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
if (! empty($conf->multicurrency->enabled))
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td>'.fieldLabel('Currency','multicurrency_code').'</td>';
|
||||
print '<td>'.$form->editfieldkey("Currency", 'multicurrency_code', '', $object, 0).'</td>';
|
||||
print '<td class="maxwidthonsmartphone">';
|
||||
print $form->selectMultiCurrency($currency_code, 'multicurrency_code');
|
||||
print '</td></tr>';
|
||||
@ -1969,7 +2054,8 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
|
||||
// Call Hook formConfirm
|
||||
$parameters = array('lineid' => $lineid);
|
||||
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
// Note that $action and $object may be modified by hook
|
||||
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action);
|
||||
if (empty($reshook)) $formconfirm.=$hookmanager->resPrint;
|
||||
elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint;
|
||||
|
||||
@ -2074,13 +2160,8 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
|
||||
// Date
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('Date');
|
||||
print '</td>';
|
||||
|
||||
if ($action != 'editdate' && $object->brouillon)
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editdate&id=' . $object->id . '">' . img_edit($langs->trans('SetDate'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
$editenable = $user->rights->commande->creer && $object->statut == Commande::STATUS_DRAFT;
|
||||
print $form->editfieldkey("Date", 'date', '', $object, $editenable);
|
||||
print '</td><td>';
|
||||
if ($action == 'editdate') {
|
||||
print '<form name="setdate" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="post">';
|
||||
@ -2100,12 +2181,8 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
|
||||
// Delivery date planed
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('DateDeliveryPlanned');
|
||||
print '</td>';
|
||||
if ($action != 'editdate_livraison')
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editdate_livraison&id=' . $object->id . '">' . img_edit($langs->trans('SetDeliveryDate'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
$editenable = $user->rights->commande->creer;
|
||||
print $form->editfieldkey("DateDeliveryPlanned", 'date_livraison', '', $object, $editenable);
|
||||
print '</td><td>';
|
||||
if ($action == 'editdate_livraison') {
|
||||
print '<form name="setdate_livraison" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="post">';
|
||||
@ -2125,13 +2202,9 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
|
||||
// Shipping Method
|
||||
if (! empty($conf->expedition->enabled)) {
|
||||
print '<tr><td height="10">';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||
print $langs->trans('SendingMethod');
|
||||
print '</td>';
|
||||
if ($action != 'editshippingmethod' && $user->rights->commande->creer)
|
||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editshippingmethod&id='.$object->id.'">'.img_edit($langs->trans('SetShippingMode'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '<tr><td>';
|
||||
$editenable = $user->rights->commande->creer;
|
||||
print $form->editfieldkey("SendingMethod", 'shippingmethod', '', $object, $editenable);
|
||||
print '</td><td>';
|
||||
if ($action == 'editshippingmethod') {
|
||||
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'shipping_method_id', 1);
|
||||
@ -2144,15 +2217,12 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
|
||||
// Warehouse
|
||||
if (! empty($conf->expedition->enabled) && ! empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) {
|
||||
$langs->load('stocks');
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
|
||||
$formproduct=new FormProduct($db);
|
||||
print '<tr><td>';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||
print $langs->trans('Warehouse');
|
||||
print '</td>';
|
||||
if ($action != 'editwarehouse' && $user->rights->commande->creer)
|
||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editwarehouse&id='.$object->id.'">'.img_edit($langs->trans('SetWarehouse'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
$editenable = $user->rights->commande->creer;
|
||||
print $form->editfieldkey("Warehouse", 'warehouse', '', $object, $editenable);
|
||||
print '</td><td>';
|
||||
if ($action == 'editwarehouse') {
|
||||
$formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->warehouse_id, 'warehouse_id', 1);
|
||||
@ -2165,12 +2235,8 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
|
||||
// Terms of payment
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('PaymentConditionsShort');
|
||||
print '</td>';
|
||||
if ($action != 'editconditions')
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editconditions&id=' . $object->id . '">' . img_edit($langs->trans('SetConditions'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
$editenable = $user->rights->commande->creer;
|
||||
print $form->editfieldkey("PaymentConditionsShort", 'conditions', '', $object, $editenable);
|
||||
print '</td><td>';
|
||||
if ($action == 'editconditions') {
|
||||
$form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->cond_reglement_id, 'cond_reglement_id', 1);
|
||||
@ -2183,12 +2249,8 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
|
||||
// Mode of payment
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('PaymentMode');
|
||||
print '</td>';
|
||||
if ($action != 'editmode')
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmode&id=' . $object->id . '">' . img_edit($langs->trans('SetMode'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
$editenable = $user->rights->commande->creer;
|
||||
print $form->editfieldkey("PaymentMode", 'mode', '', $object, $editenable);
|
||||
print '</td><td>';
|
||||
if ($action == 'editmode') {
|
||||
$form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT');
|
||||
@ -2203,12 +2265,8 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
// Multicurrency code
|
||||
print '<tr>';
|
||||
print '<td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print fieldLabel('Currency','multicurrency_code');
|
||||
print '</td>';
|
||||
if ($action != 'editmulticurrencycode' && ! empty($object->brouillon))
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmulticurrencycode&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
$editenable = $user->rights->commande->creer && $object->statut == Commande::STATUS_DRAFT;
|
||||
print $form->editfieldkey("Currency", 'multicurrencycode', '', $object, $editenable);
|
||||
print '</td><td>';
|
||||
if ($action == 'editmulticurrencycode') {
|
||||
$form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'multicurrency_code');
|
||||
@ -2220,12 +2278,8 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
// Multicurrency rate
|
||||
print '<tr>';
|
||||
print '<td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print fieldLabel('CurrencyRate','multicurrency_tx');
|
||||
print '</td>';
|
||||
if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency)
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmulticurrencyrate&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
$editenable = $user->rights->commande->creer && $object->multicurrency_code && $object->multicurrency_code != $conf->currency && $object->statut == Commande::STATUS_DRAFT;
|
||||
print $form->editfieldkey("CurrencyRate", 'multicurrencyrate', '', $object, $editenable);
|
||||
print '</td><td>';
|
||||
if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') {
|
||||
if($action == 'actualizemulticurrencyrate') {
|
||||
@ -2244,13 +2298,9 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
}
|
||||
|
||||
// Delivery delay
|
||||
print '<tr class="fielddeliverydelay"><td height="10">';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('AvailabilityPeriod');
|
||||
print '</td>';
|
||||
if ($action != 'editavailability')
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editavailability&id=' . $object->id . '">' . img_edit($langs->trans('SetAvailability'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
print '<tr class="fielddeliverydelay"><td>';
|
||||
$editenable = $user->rights->commande->creer;
|
||||
print $form->editfieldkey("AvailabilityPeriod", 'availability', '', $object, $editenable);
|
||||
print '</td><td>';
|
||||
if ($action == 'editavailability') {
|
||||
$form->form_availability($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->availability_id, 'availability_id', 1);
|
||||
@ -2260,13 +2310,9 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
print '</td></tr>';
|
||||
|
||||
// Source reason (why we have an ordrer)
|
||||
print '<tr><td height="10">';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('Channel');
|
||||
print '</td>';
|
||||
if ($action != 'editdemandreason')
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editdemandreason&id=' . $object->id . '">' . img_edit($langs->trans('SetDemandReason'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
print '<tr><td>';
|
||||
$editenable = $user->rights->commande->creer;
|
||||
print $form->editfieldkey("Channel", 'demandreason', '', $object, $editenable);
|
||||
print '</td><td>';
|
||||
if ($action == 'editdemandreason') {
|
||||
$form->formInputReason($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->demand_reason_id, 'demand_reason_id', 1);
|
||||
@ -2277,13 +2323,9 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
|
||||
// TODO Order mode (how we receive order). Not yet implemented
|
||||
/*
|
||||
print '<tr><td height="10">';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('SourceMode');
|
||||
print '</td>';
|
||||
if ($action != 'editinputmode')
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editinputmode&id=' . $object->id . '">' . img_edit($langs->trans('SetInputMode'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
print '<tr><td>';
|
||||
$editenable = $user->rights->commande->creer;
|
||||
print $form->editfieldkey("SourceMode", 'inputmode', '', $object, $editenable);
|
||||
print '</td><td>';
|
||||
if ($action == 'editinputmode') {
|
||||
$form->formInputMode($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->source, 'input_mode_id', 1);
|
||||
@ -2296,15 +2338,13 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
$tmparray=$object->getTotalWeightVolume();
|
||||
$totalWeight=$tmparray['weight'];
|
||||
$totalVolume=$tmparray['volume'];
|
||||
if ($totalWeight)
|
||||
{
|
||||
if ($totalWeight) {
|
||||
print '<tr><td>'.$langs->trans("CalculatedWeight").'</td>';
|
||||
print '<td>';
|
||||
print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND)?$conf->global->MAIN_WEIGHT_DEFAULT_ROUND:-1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT)?$conf->global->MAIN_WEIGHT_DEFAULT_UNIT:'no');
|
||||
print '</td></tr>';
|
||||
}
|
||||
if ($totalVolume)
|
||||
{
|
||||
if ($totalVolume) {
|
||||
print '<tr><td>'.$langs->trans("CalculatedVolume").'</td>';
|
||||
print '<td>';
|
||||
print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no');
|
||||
@ -2314,15 +2354,10 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
// TODO How record was recorded OrderMode (llx_c_input_method)
|
||||
|
||||
// Incoterms
|
||||
if (!empty($conf->incoterm->enabled))
|
||||
{
|
||||
if (!empty($conf->incoterm->enabled)) {
|
||||
print '<tr><td>';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||
print $langs->trans('IncotermLabel');
|
||||
print '<td><td align="right">';
|
||||
if ($user->rights->commande->creer) print '<a href="'.DOL_URL_ROOT.'/commande/card.php?id='.$object->id.'&action=editincoterm">'.img_edit().'</a>';
|
||||
else print ' ';
|
||||
print '</td></tr></table>';
|
||||
$editenable = $user->rights->commande->creer;
|
||||
print $form->editfieldkey("IncotermLabel", 'incoterm', '', $object, $editenable);
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if ($action != 'editincoterm')
|
||||
@ -2337,15 +2372,10 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
}
|
||||
|
||||
// Bank Account
|
||||
if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER) && ! empty($conf->banque->enabled))
|
||||
{
|
||||
print '<tr><td class="nowrap">';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans('BankAccount');
|
||||
print '<td>';
|
||||
if ($action != 'editbankaccount' && $user->rights->commande->creer)
|
||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER) && ! empty($conf->banque->enabled)) {
|
||||
print '<tr><td>';
|
||||
$editenable = $user->rights->commande->creer;
|
||||
print $form->editfieldkey("BankAccount", 'bankaccount', '', $object, $editenable);
|
||||
print '</td><td>';
|
||||
if ($action == 'editbankaccount') {
|
||||
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1);
|
||||
@ -2371,17 +2401,17 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency))
|
||||
{
|
||||
// Multicurrency Amount HT
|
||||
print '<tr><td class="titlefieldmiddle">' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '</td>';
|
||||
print '<tr><td class="titlefieldmiddle">' . $form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0) . '</td>';
|
||||
print '<td class="nowrap">' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Multicurrency Amount VAT
|
||||
print '<tr><td>' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '</td>';
|
||||
print '<tr><td>' . $form->editfieldkey('MulticurrencyAmountVAT', 'multicurrency_total_tva', '', $object, 0) . '</td>';
|
||||
print '<td class="nowrap">' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Multicurrency Amount TTC
|
||||
print '<tr><td>' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '</td>';
|
||||
print '<tr><td>' . $form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0) . '</td>';
|
||||
print '<td class="nowrap">' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
@ -2446,12 +2476,11 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
*/
|
||||
$result = $object->getLinesArray();
|
||||
|
||||
print ' <form name="addproduct" id="addproduct" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (($action != 'editline') ? '#addline' : '#line_' . GETPOST('lineid')) . '" method="POST">
|
||||
print '<form name="addproduct" id="addproduct" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (($action != 'editline') ? '#addline' : '#line_' . GETPOST('lineid')) . '" method="POST">
|
||||
<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">
|
||||
<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline') . '">
|
||||
<input type="hidden" name="mode" value="">
|
||||
<input type="hidden" name="id" value="' . $object->id . '">
|
||||
';
|
||||
<input type="hidden" name="id" value="' . $object->id . '">';
|
||||
|
||||
if (! empty($conf->use_javascript_ajax) && $object->statut == Commande::STATUS_DRAFT) {
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php';
|
||||
@ -2477,7 +2506,8 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
$object->formAddObjectLine(1, $mysoc, $soc);
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
// Note that $action and $object may be modified by hook
|
||||
$reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action);
|
||||
}
|
||||
}
|
||||
print '</table>';
|
||||
@ -2494,15 +2524,15 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
|
||||
// modified by hook
|
||||
// Note that $action and $object may be modified by hook
|
||||
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action);
|
||||
if (empty($reshook)) {
|
||||
// Send
|
||||
if ($object->statut > Commande::STATUS_DRAFT) {
|
||||
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->commande->order_advance->send)) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . '</a></div>';
|
||||
} else
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#">' . $langs->trans('SendMail') . '</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">' . $langs->trans('SendMail') . '</a></div>';
|
||||
}
|
||||
|
||||
// Valid
|
||||
@ -2518,10 +2548,11 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?id=' . $object->id . '&action=modif">' . $langs->trans('Modify') . '</a></div>';
|
||||
}
|
||||
// Create event
|
||||
/*if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a
|
||||
// "workflow" action so should appears somewhere else on
|
||||
// page.
|
||||
/*if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD))
|
||||
{
|
||||
// Add hidden condition because this is not a
|
||||
// "workflow" action so should appears somewhere else on
|
||||
// page.
|
||||
print '<a class="butAction" href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&origin=' . $object->element . '&originid=' . $object->id . '&socid=' . $object->socid . '">' . $langs->trans("AddAction") . '</a>';
|
||||
}*/
|
||||
|
||||
@ -2533,7 +2564,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
if ($user->rights->ficheinter->creer) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/fichinter/card.php?action=create&origin=' . $object->element . '&originid=' . $object->id . '&socid=' . $object->socid . '">' . $langs->trans('AddIntervention') . '</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="' . dol_escape_htmltag($langs->trans("NotAllowed")) . '">' . $langs->trans('AddIntervention') . '</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' . dol_escape_htmltag($langs->trans("NotAllowed")) . '">' . $langs->trans('AddIntervention') . '</a></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2557,11 +2588,11 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
if ($user->rights->expedition->creer) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/expedition/shipment.php?id=' . $object->id . '">' . $langs->trans('CreateShipment') . '</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="' . dol_escape_htmltag($langs->trans("NotAllowed")) . '">' . $langs->trans('CreateShipment') . '</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' . dol_escape_htmltag($langs->trans("NotAllowed")) . '">' . $langs->trans('CreateShipment') . '</a></div>';
|
||||
}
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="' . dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete")) . '">' . $langs->trans('CreateShipment') . '</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' . dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete")) . '">' . $langs->trans('CreateShipment') . '</a></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2610,7 +2641,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
if ($numshipping == 0) {
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=delete">' . $langs->trans('Delete') . '</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="' . $langs->trans("ShippingExist") . '">' . $langs->trans("Delete") . '</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' . $langs->trans("ShippingExist") . '">' . $langs->trans("Delete") . '</a></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2638,7 +2669,14 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
|
||||
// Show links to link elements
|
||||
$linktoelem = $form->showLinkToObjectBlock($object, null, array('order'));
|
||||
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
|
||||
|
||||
$compatibleImportElementsList = false;
|
||||
if($user->rights->commande->creer
|
||||
&& $object->statut == Commande::STATUS_DRAFT)
|
||||
{
|
||||
$compatibleImportElementsList = array('commande','propal'); // import from linked elements
|
||||
}
|
||||
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem,$compatibleImportElementsList);
|
||||
|
||||
// Show online payment link
|
||||
$useonlinepayment = (! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled) || ! empty($conf->paybox->enabled));
|
||||
|
||||
@ -9,8 +9,8 @@
|
||||
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2016-2017 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* Copyright (C) 2016-2018 Ferran Marcet <fmarcet@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
|
||||
@ -1312,45 +1312,47 @@ class Commande extends CommonOrder
|
||||
$logtext.= ", date_end=$date_end, type=$type special_code=$special_code, fk_unit=$fk_unit, origin=$origin, origin_id=$origin_id, pu_ht_devise=$pu_ht_devise";
|
||||
dol_syslog(get_class($this).$logtext, LOG_DEBUG);
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||
|
||||
// Clean parameters
|
||||
if (empty($remise_percent)) $remise_percent=0;
|
||||
if (empty($qty)) $qty=0;
|
||||
if (empty($info_bits)) $info_bits=0;
|
||||
if (empty($rang)) $rang=0;
|
||||
if (empty($txtva)) $txtva=0;
|
||||
if (empty($txlocaltax1)) $txlocaltax1=0;
|
||||
if (empty($txlocaltax2)) $txlocaltax2=0;
|
||||
if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0;
|
||||
if (empty($this->fk_multicurrency)) $this->fk_multicurrency=0;
|
||||
|
||||
$remise_percent=price2num($remise_percent);
|
||||
$qty=price2num($qty);
|
||||
$pu_ht=price2num($pu_ht);
|
||||
$pu_ht_devise=price2num($pu_ht_devise);
|
||||
$pu_ttc=price2num($pu_ttc);
|
||||
$pa_ht=price2num($pa_ht);
|
||||
$txtva = price2num($txtva);
|
||||
$txlocaltax1 = price2num($txlocaltax1);
|
||||
$txlocaltax2 = price2num($txlocaltax2);
|
||||
if ($price_base_type=='HT')
|
||||
{
|
||||
$pu=$pu_ht;
|
||||
}
|
||||
else
|
||||
{
|
||||
$pu=$pu_ttc;
|
||||
}
|
||||
$label=trim($label);
|
||||
$desc=trim($desc);
|
||||
|
||||
// Check parameters
|
||||
if ($type < 0) return -1;
|
||||
|
||||
if ($this->statut == self::STATUS_DRAFT)
|
||||
{
|
||||
$this->db->begin();
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||
|
||||
// Clean parameters
|
||||
if (empty($remise_percent)) $remise_percent=0;
|
||||
if (empty($qty)) $qty=0;
|
||||
if (empty($info_bits)) $info_bits=0;
|
||||
if (empty($rang)) $rang=0;
|
||||
if (empty($txtva)) $txtva=0;
|
||||
if (empty($txlocaltax1)) $txlocaltax1=0;
|
||||
if (empty($txlocaltax2)) $txlocaltax2=0;
|
||||
if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0;
|
||||
if (empty($this->fk_multicurrency)) $this->fk_multicurrency=0;
|
||||
|
||||
$remise_percent=price2num($remise_percent);
|
||||
$qty=price2num($qty);
|
||||
$pu_ht=price2num($pu_ht);
|
||||
$pu_ht_devise=price2num($pu_ht_devise);
|
||||
$pu_ttc=price2num($pu_ttc);
|
||||
$pa_ht=price2num($pa_ht);
|
||||
if (!preg_match('/\((.*)\)/', $txtva)) {
|
||||
$txtva = price2num($txtva); // $txtva can have format '5,1' or '5.1' or '5.1(XXX)', we must clean only if '5,1'
|
||||
}
|
||||
$txlocaltax1 = price2num($txlocaltax1);
|
||||
$txlocaltax2 = price2num($txlocaltax2);
|
||||
if ($price_base_type=='HT')
|
||||
{
|
||||
$pu=$pu_ht;
|
||||
}
|
||||
else
|
||||
{
|
||||
$pu=$pu_ttc;
|
||||
}
|
||||
$label=trim($label);
|
||||
$desc=trim($desc);
|
||||
|
||||
// Check parameters
|
||||
if ($type < 0) return -1;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$product_type=$type;
|
||||
if (!empty($fk_product))
|
||||
@ -4021,9 +4023,9 @@ class OrderLine extends CommonOrderLine
|
||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||
* @return int <0 si ko, >0 si ok
|
||||
*/
|
||||
function delete($user=null, $notrigger=0)
|
||||
function delete(User $user, $notrigger=0)
|
||||
{
|
||||
global $conf, $user, $langs;
|
||||
global $conf, $langs;
|
||||
|
||||
$error=0;
|
||||
|
||||
|
||||
@ -10,6 +10,8 @@
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.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
|
||||
@ -301,32 +303,8 @@ if ($viewstatut <> '')
|
||||
$sql .= ' AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))'; // validated, in process or closed but not billed
|
||||
}
|
||||
}
|
||||
if ($search_ordermonth > 0)
|
||||
{
|
||||
if ($search_orderyear > 0 && empty($search_orderday))
|
||||
$sql.= " AND c.date_commande BETWEEN '".$db->idate(dol_get_first_day($search_orderyear,$search_ordermonth,false))."' AND '".$db->idate(dol_get_last_day($search_orderyear,$search_ordermonth,false))."'";
|
||||
else if ($search_orderyear > 0 && ! empty($search_orderday))
|
||||
$sql.= " AND c.date_commande BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_ordermonth, $search_orderday, $search_orderyear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_ordermonth, $search_orderday, $search_orderyear))."'";
|
||||
else
|
||||
$sql.= " AND date_format(c.date_commande, '%m') = '".$search_ordermonth."'";
|
||||
}
|
||||
else if ($search_orderyear > 0)
|
||||
{
|
||||
$sql.= " AND c.date_commande BETWEEN '".$db->idate(dol_get_first_day($search_orderyear,1,false))."' AND '".$db->idate(dol_get_last_day($search_orderyear,12,false))."'";
|
||||
}
|
||||
if ($search_deliverymonth > 0)
|
||||
{
|
||||
if ($search_deliveryyear > 0 && empty($search_deliveryday))
|
||||
$sql.= " AND c.date_livraison BETWEEN '".$db->idate(dol_get_first_day($search_deliveryyear,$search_deliverymonth,false))."' AND '".$db->idate(dol_get_last_day($search_deliveryyear,$search_deliverymonth,false))."'";
|
||||
else if ($search_deliveryyear > 0 && ! empty($search_deliveryday))
|
||||
$sql.= " AND c.date_livraison BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_deliverymonth, $search_deliveryday, $search_deliveryyear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_deliverymonth, $search_deliveryday, $search_deliveryyear))."'";
|
||||
else
|
||||
$sql.= " AND date_format(c.date_livraison, '%m') = '".$search_deliverymonth."'";
|
||||
}
|
||||
else if ($search_deliveryyear > 0)
|
||||
{
|
||||
$sql.= " AND c.date_livraison BETWEEN '".$db->idate(dol_get_first_day($search_deliveryyear,1,false))."' AND '".$db->idate(dol_get_last_day($search_deliveryyear,12,false))."'";
|
||||
}
|
||||
$sql.= dolSqlDateFilter("c.date_commande", $search_orderday, $search_ordermonth, $search_orderyear);
|
||||
$sql.= dolSqlDateFilter("c.date_livraison", $search_deliveryday, $search_deliverymonth, $search_deliveryyear);
|
||||
if ($search_town) $sql.= natural_search('s.town', $search_town);
|
||||
if ($search_zip) $sql.= natural_search("s.zip",$search_zip);
|
||||
if ($search_state) $sql.= natural_search("state.nom",$search_state);
|
||||
@ -449,6 +427,7 @@ if ($resql)
|
||||
|
||||
// List of mass actions available
|
||||
$arrayofmassactions = array(
|
||||
'generate_doc'=>$langs->trans("Generate"),
|
||||
'presend'=>$langs->trans("SendByMail"),
|
||||
'builddoc'=>$langs->trans("PDFMerge"),
|
||||
'cancelorders'=>$langs->trans("Cancel"),
|
||||
|
||||
@ -136,7 +136,7 @@ if (($action == 'create' || $action == 'add') && !$error)
|
||||
$closeOrders = GETPOST('autocloseorders') ? true : false;
|
||||
|
||||
// Security check
|
||||
$fieldid = GETPOST('ref','alpha')?'facnumber':'rowid';
|
||||
$fieldid = GETPOST('ref','alpha')?'ref':'rowid';
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'facture', $id,'','','fk_soc',$fieldid);
|
||||
|
||||
@ -163,7 +163,7 @@ if (($action == 'create' || $action == 'add') && !$error)
|
||||
// Si facture standard
|
||||
$object->socid = $_POST['socid'];
|
||||
$object->type = $_POST['type'];
|
||||
$object->number = $_POST['facnumber'];
|
||||
$object->number = $_POST['ref'];
|
||||
$object->date = $datefacture;
|
||||
$object->note_public = trim($_POST['note_public']);
|
||||
$object->note = trim($_POST['note']);
|
||||
@ -405,7 +405,7 @@ if ($action == 'create' && !$error)
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<input type="hidden" name="socid" value="'.$soc->id.'">' ."\n";
|
||||
print '<input name="facnumber" type="hidden" value="provisoire">';
|
||||
print '<input name="ref" type="hidden" value="provisoire">';
|
||||
print '<input name="ref_client" type="hidden" value="'.$ref_client.'">';
|
||||
print '<input name="ref_int" type="hidden" value="'.$ref_int.'">';
|
||||
print '<input type="hidden" name="origin" value="'.GETPOST('origin').'">';
|
||||
|
||||
@ -634,7 +634,7 @@ if ($resql)
|
||||
}
|
||||
|
||||
// Using BANK_REPORT_LAST_NUM_RELEVE to automatically report last num (or not)
|
||||
if ($conf->global->BANK_REPORT_LAST_NUM_RELEVE == 1)
|
||||
if (! empty($conf->global->BANK_REPORT_LAST_NUM_RELEVE))
|
||||
{
|
||||
print '
|
||||
<script type="text/javascript">
|
||||
|
||||
@ -1471,7 +1471,7 @@ class Account extends CommonObject
|
||||
{
|
||||
$country_code=$this->getCountryCode();
|
||||
|
||||
if (in_array($country_code,array('CH','FR','ES','GA','IT','NC'))) return 1; // France, Spain, Gabon, ...
|
||||
if (in_array($country_code,array('FR','ES','GA','IT','NC'))) return 1; // France, Spain, Gabon, ... - Not valid for CH
|
||||
if (in_array($country_code,array('AU','BE','CA','DE','DK','GR','GB','ID','IE','IR','KR','NL','NZ','UK','US'))) return 2; // Australia, England...
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -596,7 +596,7 @@ if ($result)
|
||||
$langs->load('categories');
|
||||
|
||||
// Bank line
|
||||
print '<tr><td class="toptd">' . fieldLabel('RubriquesTransactions', 'custcats') . '</td><td>';
|
||||
print '<tr><td class="toptd">' . $form->editfieldkey('RubriquesTransactions', 'custcats', '', $object, 0) . '</td><td>';
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_BANK_LINE, null, 'parent', null, null, 1);
|
||||
print $form->multiselectarray('custcats', $cate_arbo, $arrayselected, null, null, null, null, "90%");
|
||||
print "</td></tr>";
|
||||
|
||||
@ -417,7 +417,7 @@ if (empty($numref))
|
||||
if ($user->rights->banque->consolidate) {
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?action=reconcile&search_conciliated=0'.$param.'">'.$langs->trans("Conciliate").'</a>';
|
||||
} else {
|
||||
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Conciliate").'</a>';
|
||||
print '<a class="butActionRefused classfortooltip" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Conciliate").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -136,7 +136,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
|
||||
$sqls = array();
|
||||
|
||||
// Customer invoices
|
||||
$sql = "SELECT 'invoice' as family, f.rowid as objid, f.facnumber as ref, f.total_ttc, f.type, f.date_lim_reglement as dlr,";
|
||||
$sql = "SELECT 'invoice' as family, f.rowid as objid, f.ref as ref, f.total_ttc, f.type, f.date_lim_reglement as dlr,";
|
||||
$sql.= " s.rowid as socid, s.nom as name, s.fournisseur";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON f.fk_soc = s.rowid";
|
||||
|
||||
@ -256,32 +256,32 @@ if ($action == 'create')
|
||||
|
||||
// Date payment
|
||||
print '<tr><td>';
|
||||
print fieldLabel('DatePayment','datep',1).'</td><td>';
|
||||
print $form->editfieldkey('DatePayment', 'datep', '', $object, 0, 'string', '', 1).'</td><td>';
|
||||
print $form->selectDate((empty($datep)?-1:$datep),"datep",'','','','add',1,1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Date value for bank
|
||||
print '<tr><td>';
|
||||
print fieldLabel('DateValue','datev',0).'</td><td>';
|
||||
print $form->editfieldkey('DateValue', 'datev', '', $object, 0).'</td><td>';
|
||||
print $form->selectDate((empty($datev)?-1:$datev),"datev",'','','','add',1,1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td>';
|
||||
print fieldLabel('Label','label',1).'</td><td>';
|
||||
print $form->editfieldkey('Label', 'label', '', $object, 0, 'string', '', 1).'</td><td>';
|
||||
print '<input name="label" id="label" class="minwidth300" value="'.($label?$label:$langs->trans("VariousPayment")).'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Sens
|
||||
print '<tr><td>';
|
||||
print fieldLabel('Sens','sens',1).'</td><td>';
|
||||
print $form->editfieldkey('Sens', 'sens', '', $object, 0, 'string', '', 1).'</td><td>';
|
||||
$sensarray=array( '0' => $langs->trans("Debit"), '1' => $langs->trans("Credit"));
|
||||
print $form->selectarray('sens',$sensarray,$sens);
|
||||
print '</td></tr>';
|
||||
|
||||
// Amount
|
||||
print '<tr><td>';
|
||||
print fieldLabel('Amount','amount',1).'</td><td>';
|
||||
print $form->editfieldkey('Amount', 'amount', '', $object, 0, 'string', '', 1).'</td><td>';
|
||||
print '<input name="amount" id="amount" class="minwidth100" value="'.$amount.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
@ -289,14 +289,14 @@ if ($action == 'create')
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
print '<tr><td>';
|
||||
print fieldLabel('BankAccount','selectaccountid',1).'</td><td>';
|
||||
print $form->editfieldkey('BankAccount', 'selectaccountid', '', $object, 0, 'string', '', 1).'</td><td>';
|
||||
$form->select_comptes($accountid,"accountid",0,'',1); // Affiche liste des comptes courant
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Type payment
|
||||
print '<tr><td>';
|
||||
print fieldLabel('PaymentMode','selectpaymenttype',1).'</td><td>';
|
||||
print $form->editfieldkey('PaymentMode', 'selectpaymenttype', '', $object, 0, 'string', '', 1).'</td><td>';
|
||||
$form->select_types_paiements($paymenttype, "paymenttype");
|
||||
print '</td></tr>';
|
||||
|
||||
@ -489,12 +489,12 @@ if ($id)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.(dol_escape_htmltag($langs->trans("NotAllowed"))).'">'.$langs->trans("Delete").'</a>';
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.(dol_escape_htmltag($langs->trans("NotAllowed"))).'">'.$langs->trans("Delete").'</a>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.$langs->trans("LinkedToAConciliatedTransaction").'">'.$langs->trans("Delete").'</a>';
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("LinkedToAConciliatedTransaction").'">'.$langs->trans("Delete").'</a>';
|
||||
}
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'
|
||||
|
||||
restrictedArea($user,'banque');
|
||||
|
||||
$langs->load("companies");
|
||||
$langs->load("accountancy");
|
||||
if (! empty($conf->facture->enabled)) $langs->load("bills");
|
||||
$date_start =GETPOST('date_start','alpha');
|
||||
$date_startDay= GETPOST('date_startday','int');
|
||||
@ -88,7 +88,7 @@ $filesarray=array();
|
||||
$result=false;
|
||||
if(($action=="searchfiles"||$action=="dl" ) && $date_start && $date_stop){
|
||||
$wheretail=" '".$db->idate($date_start)."' AND '".$db->idate($date_stop)."'";
|
||||
$sql="SELECT rowid as id, facnumber as ref,paye as paid,total_ttc,fk_soc,datef as date, 'Invoice' as item FROM ".MAIN_DB_PREFIX."facture";
|
||||
$sql="SELECT rowid as id, ref as ref,paye as paid,total_ttc,fk_soc,datef as date, 'Invoice' as item FROM ".MAIN_DB_PREFIX."facture";
|
||||
$sql.=" WHERE datef between ".$wheretail;
|
||||
$sql.=" UNION ALL";
|
||||
$sql.=" SELECT rowid as id,ref, paye as paid, total_ttc, fk_soc,datef as date, 'InvoiceSupplier' as item FROM ".MAIN_DB_PREFIX."facture_fourn";
|
||||
@ -218,98 +218,103 @@ if($result & $action=="dl"){
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
|
||||
llxHeader('',$title,$help_url);
|
||||
|
||||
$h=0;
|
||||
$head[$h][0] = $_SERVER["PHP_SELF"].$varlink;
|
||||
$head[$h][1] = $langs->trans("AccountantFiles");
|
||||
$head[$h][2] = 'AccountantFiles';
|
||||
dol_fiche_head($head, 'AccountantFiles');
|
||||
$form = new Form($db);
|
||||
$userstatic=new User($db);
|
||||
$title=$langs->trans("ComptaFiles").' - '.$langs->trans("List");
|
||||
//if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name.' - '.$langs->trans("Symmary");
|
||||
$help_url='EN:Module_Accounting|FR:Module_Compatibilite'; //FIXME
|
||||
llxHeader('',$title,$help_url);
|
||||
print '<div><form name="searchfiles" action="?action=searchfiles'.$tail.'" method="POST" >'."\n\t\t\t";
|
||||
print '<a>'.$langs->trans("dateStart").': '.$form->select_date($date_start,'date_start',0,0,0,"",1,1,1)."\n</a>";
|
||||
print '<a>'.$langs->trans("dateStop").': '.$form->select_date($date_stop,'date_stop',0,0,0,"",1,1,1)."\n</a>";
|
||||
print '<input class="butAction" type="submit" value="Go" /></form></div>'."\n\t\t";
|
||||
if (!empty($date_start) && !empty($date_stop))echo dol_print_date($date_start)." - ".dol_print_date($date_stop);
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
//if (! empty($arrayfields['f.datef']['checked']))
|
||||
print_liste_field_titre($arrayfields['date']['label'],$_SERVER["PHP_SELF"],"date","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
print '<td>'.$langs->trans("Type").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Ref").'</td>';
|
||||
print '<td>'.$langs->trans("File").'</td>';
|
||||
print '<td>'.$langs->trans("Paid").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Debit").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Credit").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Balance").'</td>';
|
||||
print '</tr>';
|
||||
if ($result)
|
||||
{
|
||||
$TData = dol_sort_array($filesarray, 'date', 'ASC');
|
||||
if(empty($TData)) {
|
||||
print '<tr class="oddeven"><td colspan="7">'.$langs->trans("NoItem").'</td></tr>';
|
||||
} else {
|
||||
// Sort array by date ASC to calucalte balance
|
||||
print '<a>'.$langs->trans("ReportPeriod").': '.$form->select_date($date_start,'date_start',0,0,0,"",1,1,1);
|
||||
print ' - '.$form->select_date($date_stop,'date_stop',0,0,0,"",1,1,1)."\n</a>";
|
||||
print '<input class="butAction" type="submit" value="'.$langs->trans("Refresh").'" /></form></div>'."\n\t\t";
|
||||
if (!empty($date_start) && !empty($date_stop)){
|
||||
echo dol_print_date($date_start)." - ".dol_print_date($date_stop);
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($arrayfields['date']['label'],$_SERVER["PHP_SELF"],"date","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
print '<td>'.$langs->trans("Type").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Ref").'</td>';
|
||||
print '<td>'.$langs->trans("File").'</td>';
|
||||
print '<td>'.$langs->trans("Paid").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Debit").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Credit").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Balance").'</td>';
|
||||
print '</tr>';
|
||||
if ($result)
|
||||
{
|
||||
$TData = dol_sort_array($filesarray, 'date', 'ASC');
|
||||
if(empty($TData)) {
|
||||
print '<tr class="oddeven"><td colspan="7">'.$langs->trans("NoItem").'</td></tr>';
|
||||
} else {
|
||||
// Sort array by date ASC to calucalte balance
|
||||
|
||||
$totalDebit = 0;
|
||||
$totalCredit = 0;
|
||||
// Balance calculation
|
||||
$balance = 0;
|
||||
foreach($TData as &$data1) {
|
||||
if($data1['item']!='Invoice'&& $data1['item']!='Donation' ){
|
||||
$data1['amount']=-$data1['amount'];
|
||||
}
|
||||
if ($data1['amount']>0){
|
||||
}else{
|
||||
}
|
||||
$balance += $data1['amount'];
|
||||
$data1['balance'] = $balance;
|
||||
}
|
||||
// Display array
|
||||
foreach($TData as $data) {
|
||||
$html_class = '';
|
||||
//if (!empty($data['fk_facture'])) $html_class = 'facid-'.$data['fk_facture'];
|
||||
//elseif (!empty($data['fk_paiement'])) $html_class = 'payid-'.$data['fk_paiement'];
|
||||
print '<tr class="oddeven '.$html_class.'">';
|
||||
print "<td align=\"center\">";
|
||||
print dol_print_date($data['date'],'day');
|
||||
print "</td>\n";
|
||||
print '<td aling="left">'.$data['item'].'</td>';
|
||||
print '<td aling="left">'.$data['ref'].'</td>';
|
||||
print '<td> <a href='.$data['link'].">".$data['name']."</a></td>\n";
|
||||
print '<td aling="left">'.$data['paid'].'</td>';
|
||||
print '<td align="right">'.(($data['amount'] > 0) ? price(abs($data['amount'])) : '')."</td>\n";
|
||||
$totalDebit += ($data['amount'] > 0) ? abs($data['amount']) : 0;
|
||||
print '<td align="right">'.(($data['amount'] > 0) ? '' : price(abs($data['amount'])))."</td>\n";
|
||||
$totalCredit += ($data['amount'] > 0) ? 0 : abs($data['amount']);
|
||||
// Balance
|
||||
print '<td align="right">'.price($data['balance'])."</td>\n";
|
||||
print "</tr>\n";
|
||||
}
|
||||
print '<tr class="liste_total">';
|
||||
print '<td colspan="5"> </td>';
|
||||
print '<td align="right">'.price($totalDebit).'</td>';
|
||||
print '<td align="right">'.price($totalCredit).'</td>';
|
||||
print '<td align="right">'.price(price2num($totalDebit - $totalCredit, 'MT')).'</td>';
|
||||
print '<td></td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
print "</table>";
|
||||
print '<form name="dl" action="?action=dl" method="POST" >'."\n\t\t\t";
|
||||
$totalDebit = 0;
|
||||
$totalCredit = 0;
|
||||
// Balance calculation
|
||||
$balance = 0;
|
||||
foreach($TData as &$data1) {
|
||||
if($data1['item']!='Invoice'&& $data1['item']!='Donation' ){
|
||||
$data1['amount']=-$data1['amount'];
|
||||
}
|
||||
if ($data1['amount']>0){
|
||||
}else{
|
||||
}
|
||||
$balance += $data1['amount'];
|
||||
$data1['balance'] = $balance;
|
||||
}
|
||||
// Display array
|
||||
foreach($TData as $data) {
|
||||
$html_class = '';
|
||||
//if (!empty($data['fk_facture'])) $html_class = 'facid-'.$data['fk_facture'];
|
||||
//elseif (!empty($data['fk_paiement'])) $html_class = 'payid-'.$data['fk_paiement'];
|
||||
print '<tr class="oddeven '.$html_class.'">';
|
||||
print "<td align=\"center\">";
|
||||
print dol_print_date($data['date'],'day');
|
||||
print "</td>\n";
|
||||
print '<td aling="left">'.$data['item'].'</td>';
|
||||
print '<td aling="left">'.$data['ref'].'</td>';
|
||||
print '<td> <a href='.$data['link'].">".$data['name']."</a></td>\n";
|
||||
print '<td aling="left">'.$data['paid'].'</td>';
|
||||
print '<td align="right">'.(($data['amount'] > 0) ? price(abs($data['amount'])) : '')."</td>\n";
|
||||
$totalDebit += ($data['amount'] > 0) ? abs($data['amount']) : 0;
|
||||
print '<td align="right">'.(($data['amount'] > 0) ? '' : price(abs($data['amount'])))."</td>\n";
|
||||
$totalCredit += ($data['amount'] > 0) ? 0 : abs($data['amount']);
|
||||
// Balance
|
||||
print '<td align="right">'.price($data['balance'])."</td>\n";
|
||||
print "</tr>\n";
|
||||
}
|
||||
print '<tr class="liste_total">';
|
||||
print '<td colspan="5"> </td>';
|
||||
print '<td align="right">'.price($totalDebit).'</td>';
|
||||
print '<td align="right">'.price($totalCredit).'</td>';
|
||||
print '<td align="right">'.price(price2num($totalDebit - $totalCredit, 'MT')).'</td>';
|
||||
print '<td></td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
print "</table>";
|
||||
print '<form name="dl" action="?action=dl" method="POST" >'."\n\t\t\t";
|
||||
|
||||
print '<input type="hidden" name="date_start" value="'.dol_print_date($date_start,'dayxcard').'" />';
|
||||
print '<input type="hidden" name="date_stop" value="'.dol_print_date($date_stop, 'dayxcard').'" />';
|
||||
print '<input type="hidden" name="date_start" value="'.dol_print_date($date_start,'dayxcard').'" />';
|
||||
print '<input type="hidden" name="date_stop" value="'.dol_print_date($date_stop, 'dayxcard').'" />';
|
||||
|
||||
//print '<input type="hidden" name="date_stopDay" value="'.dol_print_date($date_stop, '%d').'" />';
|
||||
//print '<input type="hidden" name="date_stopMonth" value="'.dol_print_date($date_stop, '%m').'" />';
|
||||
//print '<input type="hidden" name="date_stopYear" value="'.dol_print_date($date_stop, '%Y').'" />';
|
||||
//print '<input type="hidden" name="date_stopDay" value="'.dol_print_date($date_stop, '%d').'" />';
|
||||
//print '<input type="hidden" name="date_stopMonth" value="'.dol_print_date($date_stop, '%m').'" />';
|
||||
//print '<input type="hidden" name="date_stopYear" value="'.dol_print_date($date_stop, '%Y').'" />';
|
||||
|
||||
//print '<input type="hidden" name="date_startDay" value="'.dol_print_date($date_start, '%d').'" />';
|
||||
//print '<input type="hidden" name="date_startMonth" value="'.dol_print_date($date_start, '%m').'" />';
|
||||
//print '<input type="hidden" name="date_startYear" value="'.dol_print_date($date_start, '%m').'" />';
|
||||
|
||||
|
||||
print '<input class="butAction" type="submit" value="Download" /></form>'."\n\t\t</th>\n\t\t<th>\n\t\t\t";
|
||||
//print '<input type="hidden" name="date_startDay" value="'.dol_print_date($date_start, '%d').'" />';
|
||||
//print '<input type="hidden" name="date_startMonth" value="'.dol_print_date($date_start, '%m').'" />';
|
||||
//print '<input type="hidden" name="date_startYear" value="'.dol_print_date($date_start, '%m').'" />';
|
||||
|
||||
print '<input class="butAction" type="submit" value="'.$langs->trans("Download").'" /></form>'."\n\t\t</th>\n\t\t<th>\n\t\t\t";
|
||||
}
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
@ -531,7 +531,7 @@ else if ($id)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Modify').'</a>';
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Modify').'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -543,7 +543,7 @@ else if ($id)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Validate').'</a>';
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Validate').'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -555,7 +555,7 @@ else if ($id)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('ClassifyRefunded').'</a>';
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('ClassifyRefunded').'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -565,7 +565,7 @@ else if ($id)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Delete').'</a>';
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Delete').'</a>';
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2018 charlene Benke <charlie@patas-monkey.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
|
||||
@ -55,6 +56,7 @@ if (! $sortfield) $sortfield="d.dated";
|
||||
|
||||
$year=GETPOST("year");
|
||||
$month=GETPOST("month");
|
||||
$day=GETPOST("day");
|
||||
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter','alpha')) // Both test are required to be compatible with all browsers
|
||||
{
|
||||
@ -64,6 +66,7 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter','a
|
||||
// $search_amount="";
|
||||
$year="";
|
||||
$month="";
|
||||
$day="";
|
||||
}
|
||||
|
||||
/*
|
||||
@ -102,20 +105,7 @@ if ($search_company)
|
||||
{
|
||||
$sql .= natural_search('s.nom', $search_company);
|
||||
}
|
||||
// if ($search_amount) $sql.=" AND d.km='".$db->escape(price2num(trim($search_amount)))."'";
|
||||
if ($month > 0)
|
||||
{
|
||||
if ($year > 0 && empty($day))
|
||||
$sql.= " AND d.dated BETWEEN '".$db->idate(dol_get_first_day($year,$month,false))."' AND '".$db->idate(dol_get_last_day($year,$month,false))."'";
|
||||
else if ($year > 0 && ! empty($day))
|
||||
$sql.= " AND d.dated BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."'";
|
||||
else
|
||||
$sql.= " AND date_format(d.dated, '%m') = '".$month."'";
|
||||
}
|
||||
else if ($year > 0)
|
||||
{
|
||||
$sql.= " AND d.dated BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'";
|
||||
}
|
||||
$sql.= dolSqlDateFilter("d.dated", $day, $month, $year);
|
||||
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
$sql.= $db->plimit($limit + 1, $offset);
|
||||
|
||||
@ -128,12 +128,11 @@ $permissiondellink = $usercancreate; // Used by the include of actions_dellink.i
|
||||
$permissiontoedit = $usercancreate; // Used by the include of actions_lineupdonw.inc.php
|
||||
|
||||
// Security check
|
||||
$fieldid = (! empty($ref) ? 'facnumber' : 'rowid');
|
||||
$fieldid = (! empty($ref) ? 'ref' : 'rowid');
|
||||
if ($user->societe_id) $socid = $user->societe_id;
|
||||
$isdraft = (($object->statut == Facture::STATUS_DRAFT) ? 1 : 0);
|
||||
$result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid, $isdraft);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
@ -739,7 +738,7 @@ if (empty($reshook))
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id';
|
||||
$sql.= ' WHERE pf.fk_facture = '.$object->id;
|
||||
$sql.= ' AND pf.fk_paiement = p.rowid';
|
||||
$sql.= ' AND p.entity IN (' . getEntity('facture').')';
|
||||
$sql.= ' AND p.entity IN (' . getEntity('invoice').')';
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if (! $resql) dol_print_error($db);
|
||||
@ -912,7 +911,7 @@ if (empty($reshook))
|
||||
if (! $error)
|
||||
{
|
||||
$object->socid = GETPOST('socid','int');
|
||||
$object->number = $_POST['facnumber'];
|
||||
$object->number = $_POST['ref'];
|
||||
$object->date = $dateinvoice;
|
||||
$object->date_pointoftax = $date_pointoftax;
|
||||
$object->note_public = trim(GETPOST('note_public','none'));
|
||||
@ -1093,7 +1092,7 @@ if (empty($reshook))
|
||||
{
|
||||
$object->socid = GETPOST('socid','int');
|
||||
$object->type = $_POST['type'];
|
||||
$object->number = $_POST['facnumber'];
|
||||
$object->number = $_POST['ref'];
|
||||
$object->date = $dateinvoice;
|
||||
$object->date_pointoftax = $date_pointoftax;
|
||||
$object->note_public = trim(GETPOST('note_public','none'));
|
||||
@ -1144,7 +1143,7 @@ if (empty($reshook))
|
||||
// Si facture standard
|
||||
$object->socid = GETPOST('socid','int');
|
||||
$object->type = GETPOST('type');
|
||||
$object->number = $_POST['facnumber'];
|
||||
$object->number = $_POST['ref'];
|
||||
$object->date = $dateinvoice;
|
||||
$object->date_pointoftax = $date_pointoftax;
|
||||
$object->note_public = trim(GETPOST('note_public','none'));
|
||||
@ -1916,7 +1915,7 @@ if (empty($reshook))
|
||||
$desc = $prod->description;
|
||||
}
|
||||
|
||||
$desc = dol_concatdesc($desc, $product_desc);
|
||||
$desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->CHANGE_ORDER_CONCAT_DESCRIPTION));
|
||||
|
||||
// Add custom code and origin country into description
|
||||
if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code))) {
|
||||
@ -2718,7 +2717,7 @@ if ($action == 'create')
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
if ($soc->id > 0) print '<input type="hidden" name="socid" value="' . $soc->id . '">' . "\n";
|
||||
print '<input name="facnumber" type="hidden" value="provisoire">';
|
||||
print '<input name="ref" type="hidden" value="provisoire">';
|
||||
print '<input name="ref_client" type="hidden" value="' . $ref_client . '">';
|
||||
print '<input name="ref_int" type="hidden" value="' . $ref_int . '">';
|
||||
print '<input type="hidden" name="origin" value="' . $origin . '">';
|
||||
@ -3213,7 +3212,7 @@ if ($action == 'create')
|
||||
if (! empty($conf->multicurrency->enabled))
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td>'.fieldLabel('Currency','multicurrency_code').'</td>';
|
||||
print '<td>'.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).'</td>';
|
||||
print '<td colspan="2" class="maxwidthonsmartphone">';
|
||||
print $form->selectMultiCurrency($currency_code, 'multicurrency_code');
|
||||
print '</td></tr>';
|
||||
@ -3740,7 +3739,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
|
||||
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref, '', 0, '', '');
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '');
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="fichehalfleft">';
|
||||
@ -3915,7 +3914,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
print '<tr>';
|
||||
print '<td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print fieldLabel('Currency','multicurrency_code');
|
||||
print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0);
|
||||
print '</td>';
|
||||
if ($usercancreate && $action != 'editmulticurrencycode' && ! empty($object->brouillon))
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmulticurrencycode&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '</a></td>';
|
||||
@ -3928,7 +3927,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
print '<tr>';
|
||||
print '<td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print fieldLabel('CurrencyRate','multicurrency_tx');
|
||||
print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0);
|
||||
print '</td>';
|
||||
if ($usercancreate && $action != 'editmulticurrencyrate' && ! empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency)
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmulticurrencyrate&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '</a></td>';
|
||||
@ -4014,17 +4013,17 @@ else if ($id > 0 || ! empty($ref))
|
||||
if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency))
|
||||
{
|
||||
// Multicurrency Amount HT
|
||||
print '<tr><td class="titlefieldmiddle">' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '</td>';
|
||||
print '<tr><td class="titlefieldmiddle">' . $form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0) . '</td>';
|
||||
print '<td class="nowrap amountcard">' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Multicurrency Amount VAT
|
||||
print '<tr><td>' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '</td>';
|
||||
print '<tr><td>' . $form->editfieldkey('MulticurrencyAmountVAT', 'multicurrency_total_tva', '', $object, 0) . '</td>';
|
||||
print '<td class="nowrap amountcard">' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Multicurrency Amount TTC
|
||||
print '<tr><td>' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '</td>';
|
||||
print '<tr><td>' . $form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0) . '</td>';
|
||||
print '<td class="nowrap amountcard">' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
@ -4281,7 +4280,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bank as b ON p.fk_bank = b.rowid';
|
||||
$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bank_account as ba ON b.fk_account = ba.rowid';
|
||||
$sql .= ' WHERE pf.fk_facture = ' . $object->id . ' AND pf.fk_paiement = p.rowid';
|
||||
$sql .= ' AND p.entity IN (' . getEntity('facture').')';
|
||||
$sql .= ' AND p.entity IN (' . getEntity('invoice').')';
|
||||
$sql .= ' ORDER BY p.datep, p.tms';
|
||||
|
||||
$result = $db->query($sql);
|
||||
@ -4628,18 +4627,18 @@ else if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction'.($conf->use_javascript_ajax?' reposition':'').'" href="' . $_SERVER['PHP_SELF'] . '?facid=' . $object->id . '&action=modif">' . $langs->trans('Modify') . '</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("NotEnoughPermissions") . '">' . $langs->trans('Modify') . '</span></div>';
|
||||
print '<div class="inline-block divButAction"><span class="butActionRefused classfortooltip" title="' . $langs->trans("NotEnoughPermissions") . '">' . $langs->trans('Modify') . '</span></div>';
|
||||
}
|
||||
} else if (!$object->is_last_in_cycle()) {
|
||||
print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("NotLastInCycle") . '">' . $langs->trans('Modify') . '</span></div>';
|
||||
print '<div class="inline-block divButAction"><span class="butActionRefused classfortooltip" title="' . $langs->trans("NotLastInCycle") . '">' . $langs->trans('Modify') . '</span></div>';
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("DisabledBecauseReplacedInvoice") . '">' . $langs->trans('Modify') . '</span></div>';
|
||||
print '<div class="inline-block divButAction"><span class="butActionRefused classfortooltip" title="' . $langs->trans("DisabledBecauseReplacedInvoice") . '">' . $langs->trans('Modify') . '</span></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("DisabledBecauseDispatchedInAccounting") . '">' . $langs->trans('Modify') . '</span></div>';
|
||||
print '<div class="inline-block divButAction"><span class="butActionRefused classfortooltip" title="' . $langs->trans("DisabledBecauseDispatchedInAccounting") . '">' . $langs->trans('Modify') . '</span></div>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -4657,7 +4656,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction'.($conf->use_javascript_ajax?' reposition':'').'" href="' . $_SERVER['PHP_SELF'] . '?facid=' . $object->id . '&action=reopen">' . $langs->trans('ReOpen') . '</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("DisabledBecauseReplacedInvoice") . '">' . $langs->trans('ReOpen') . '</span></div>';
|
||||
print '<div class="inline-block divButAction"><span class="butActionRefused classfortooltip" title="' . $langs->trans("DisabledBecauseReplacedInvoice") . '">' . $langs->trans('ReOpen') . '</span></div>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -4672,12 +4671,12 @@ else if ($id > 0 || ! empty($ref))
|
||||
// Send by mail
|
||||
if (($object->statut == Facture::STATUS_VALIDATED || $object->statut == Facture::STATUS_CLOSED) || ! empty($conf->global->FACTURE_SENDBYEMAIL_FOR_ALL_STATUS)) {
|
||||
if ($objectidnext) {
|
||||
print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("DisabledBecauseReplacedInvoice") . '">' . $langs->trans('SendMail') . '</span></div>';
|
||||
print '<div class="inline-block divButAction"><span class="butActionRefused classfortooltip" title="' . $langs->trans("DisabledBecauseReplacedInvoice") . '">' . $langs->trans('SendMail') . '</span></div>';
|
||||
} else {
|
||||
if ($usercansend) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?facid=' . $object->id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . '</a></div>';
|
||||
} else
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#">' . $langs->trans('SendMail') . '</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">' . $langs->trans('SendMail') . '</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -4692,27 +4691,27 @@ else if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$object->id.'" title="'.dol_escape_htmltag($langs->trans("MakeWithdrawRequest")).'">'.$langs->trans("MakeWithdrawRequest").'</a>';
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("DisabledBecauseReplacedInvoice") . '">' . $langs->trans('MakeWithdrawRequest') . '</span></div>';
|
||||
print '<div class="inline-block divButAction"><span class="butActionRefused classfortooltip" title="' . $langs->trans("DisabledBecauseReplacedInvoice") . '">' . $langs->trans('MakeWithdrawRequest') . '</span></div>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("MakeWithdrawRequest").'</a>';
|
||||
//print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("MakeWithdrawRequest").'</a>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("AmountMustBePositive")).'">'.$langs->trans("MakeWithdrawRequest").'</a>';
|
||||
//print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("AmountMustBePositive")).'">'.$langs->trans("MakeWithdrawRequest").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
// Create payment
|
||||
if ($object->type != Facture::TYPE_CREDIT_NOTE && $object->statut == 1 && $object->paye == 0 && $usercanissuepayment) {
|
||||
if ($objectidnext) {
|
||||
print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("DisabledBecauseReplacedInvoice") . '">' . $langs->trans('DoPayment') . '</span></div>';
|
||||
print '<div class="inline-block divButAction"><span class="butActionRefused classfortooltip" title="' . $langs->trans("DisabledBecauseReplacedInvoice") . '">' . $langs->trans('DoPayment') . '</span></div>';
|
||||
} else {
|
||||
//if ($resteapayer == 0) { // Sometimes we can receive more, so we accept to enter more and will offer a button to convert into discount (but it is not a credit note, just a prepayment done)
|
||||
// print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("DisabledBecauseRemainderToPayIsZero") . '">' . $langs->trans('DoPayment') . '</span></div>';
|
||||
// print '<div class="inline-block divButAction"><span class="butActionRefused classfortooltip" title="' . $langs->trans("DisabledBecauseRemainderToPayIsZero") . '">' . $langs->trans('DoPayment') . '</span></div>';
|
||||
//} else {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'. DOL_URL_ROOT .'/compta/paiement.php?facid=' . $object->id . '&action=create&accountid='.$object->fk_account.'">' . $langs->trans('DoPayment') . '</a></div>';
|
||||
//}
|
||||
@ -4726,7 +4725,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
if ($resteapayer == 0)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><span class="butActionRefused" title="'.$langs->trans("DisabledBecauseRemainderToPayIsZero").'">'.$langs->trans('DoPaymentBack').'</span></div>';
|
||||
print '<div class="inline-block divButAction"><span class="butActionRefused classfortooltip" title="'.$langs->trans("DisabledBecauseRemainderToPayIsZero").'">'.$langs->trans('DoPaymentBack').'</span></div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -4773,7 +4772,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
if ($objectidnext)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("DisabledBecauseReplacedInvoice") . '">' . $langs->trans('ClassifyCanceled') . '</span></div>';
|
||||
print '<div class="inline-block divButAction"><span class="butActionRefused classfortooltip" title="' . $langs->trans("DisabledBecauseReplacedInvoice") . '">' . $langs->trans('ClassifyCanceled') . '</span></div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -4820,7 +4819,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?socid=' . $object->socid .'&fac_avoir=' . $object->id . '&invoiceAvoirWithLines=1&action=create&type=2'.($object->fk_project > 0 ? '&projectid='.$object->fk_project : '').'">' . $langs->trans("CreateCreditNote") . '</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("NotEnoughPermissions") . '">' . $langs->trans("CreateCreditNote") . '</span></div>';
|
||||
print '<div class="inline-block divButAction"><span class="butActionRefused classfortooltip" title="' . $langs->trans("NotEnoughPermissions") . '">' . $langs->trans("CreateCreditNote") . '</span></div>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -4840,7 +4839,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a id="butSituationOutRefused" class="butActionRefused" href="#" title="' . $langs->trans("DisabledBecauseNotEnouthCreditNote") . '" >' . $langs->trans("RemoveSituationFromCycle") . '</a></div>';
|
||||
print '<div class="inline-block divButAction"><a id="butSituationOutRefused" class="butActionRefused classfortooltip" href="#" title="' . $langs->trans("DisabledBecauseNotEnouthCreditNote") . '" >' . $langs->trans("RemoveSituationFromCycle") . '</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -4849,9 +4848,9 @@ else if ($id > 0 || ! empty($ref))
|
||||
if ($object->is_last_in_cycle() && $object->situation_final != 1) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?action=create&type=5&origin=facture&originid=' . $object->id . '&socid=' . $object->socid . '" >' . $langs->trans('CreateNextSituationInvoice') . '</a></div>';
|
||||
} else if (!$object->is_last_in_cycle()) {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="' . $langs->trans("DisabledBecauseNotLastInCycle") . '">' . $langs->trans('CreateNextSituationInvoice') . '</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' . $langs->trans("DisabledBecauseNotLastInCycle") . '">' . $langs->trans('CreateNextSituationInvoice') . '</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="' . $langs->trans("DisabledBecauseFinal") . '">' . $langs->trans('CreateNextSituationInvoice') . '</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' . $langs->trans("DisabledBecauseFinal") . '">' . $langs->trans('CreateNextSituationInvoice') . '</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -4861,31 +4860,31 @@ else if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
//var_dump($isErasable);
|
||||
if ($isErasable == -4) {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="' . $langs->trans("DisabledBecausePayments") . '">' . $langs->trans('Delete') . '</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' . $langs->trans("DisabledBecausePayments") . '">' . $langs->trans('Delete') . '</a></div>';
|
||||
}
|
||||
elseif ($isErasable == -3) {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="' . $langs->trans("DisabledBecauseNotLastSituationInvoice") . '">' . $langs->trans('Delete') . '</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' . $langs->trans("DisabledBecauseNotLastSituationInvoice") . '">' . $langs->trans('Delete') . '</a></div>';
|
||||
}
|
||||
elseif ($isErasable == -2) {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="' . $langs->trans("DisabledBecauseNotLastInvoice") . '">' . $langs->trans('Delete') . '</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' . $langs->trans("DisabledBecauseNotLastInvoice") . '">' . $langs->trans('Delete') . '</a></div>';
|
||||
}
|
||||
elseif ($isErasable == -1) {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="' . $langs->trans("DisabledBecauseDispatchedInBookkeeping") . '">' . $langs->trans('Delete') . '</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' . $langs->trans("DisabledBecauseDispatchedInBookkeeping") . '">' . $langs->trans('Delete') . '</a></div>';
|
||||
}
|
||||
elseif ($isErasable <= 0) // Any other cases
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="' . $langs->trans("DisabledBecauseNotErasable") . '">' . $langs->trans('Delete') . '</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' . $langs->trans("DisabledBecauseNotErasable") . '">' . $langs->trans('Delete') . '</a></div>';
|
||||
}
|
||||
elseif ($objectidnext)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="' . $langs->trans("DisabledBecauseReplacedInvoice") . '">' . $langs->trans('Delete') . '</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' . $langs->trans("DisabledBecauseReplacedInvoice") . '">' . $langs->trans('Delete') . '</a></div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete'.($conf->use_javascript_ajax?' reposition':'').'" href="' . $_SERVER["PHP_SELF"] . '?facid=' . $object->id . '&action=delete">' . $langs->trans('Delete') . '</a></div>';
|
||||
}
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="' . $langs->trans("NotAllowed") . '">' . $langs->trans('Delete') . '</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' . $langs->trans("NotAllowed") . '">' . $langs->trans('Delete') . '</a></div>';
|
||||
}
|
||||
}
|
||||
print '</div>';
|
||||
|
||||
@ -123,7 +123,7 @@ class Invoices extends DolibarrApi
|
||||
|
||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
||||
|
||||
$sql.= ' WHERE t.entity IN ('.getEntity('facture').')';
|
||||
$sql.= ' WHERE t.entity IN ('.getEntity('invoice').')';
|
||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc";
|
||||
if ($socids) $sql.= " AND t.fk_soc IN (".$socids.")";
|
||||
|
||||
|
||||
@ -340,7 +340,7 @@ class FactureRec extends CommonInvoice
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as c ON f.fk_cond_reglement = c.rowid';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON f.fk_mode_reglement = p.id';
|
||||
//$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = f.rowid AND el.targettype = 'facture'";
|
||||
$sql.= ' WHERE f.entity IN ('.getEntity('facture').')';
|
||||
$sql.= ' WHERE f.entity IN ('.getEntity('invoice').')';
|
||||
if ($rowid) $sql.= ' AND f.rowid='.$rowid;
|
||||
elseif ($ref) $sql.= " AND f.titre='".$this->db->escape($ref)."'";
|
||||
/* This field are not used for template invoice
|
||||
@ -998,26 +998,25 @@ class FactureRec extends CommonInvoice
|
||||
*
|
||||
* WARNING: This method change temporarly context $conf->entity to be in correct context for each recurring invoice found.
|
||||
*
|
||||
* @param int $restictoninvoiceid 0=All qualified template invoices found. > 0 = restrict action on invoice ID
|
||||
* @param int $restrictioninvoiceid 0=All qualified template invoices found. > 0 = restrict action on invoice ID
|
||||
* @param int $forcevalidation 1=Force validation of invoice whatever is template auto_validate flag.
|
||||
* @return int 0 if OK, < 0 if KO (this function is used also by cron so only 0 is OK)
|
||||
*/
|
||||
function createRecurringInvoices($restictoninvoiceid=0, $forcevalidation=0)
|
||||
function createRecurringInvoices($restrictioninvoiceid=0, $forcevalidation=0)
|
||||
{
|
||||
global $conf, $langs, $db, $user;
|
||||
global $conf, $langs, $db, $user, $hookmanager;
|
||||
|
||||
$error=0;
|
||||
$nb_create=0;
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("main","bills"));
|
||||
|
||||
$nb_create=0;
|
||||
$langs->loadLangs(array("main","bills"));
|
||||
|
||||
$now = dol_now();
|
||||
$tmparray=dol_getdate($now);
|
||||
$today = dol_mktime(23,59,59,$tmparray['mon'],$tmparray['mday'],$tmparray['year']); // Today is last second of current day
|
||||
|
||||
dol_syslog("createRecurringInvoices restictoninvoiceid=".$restictoninvoiceid." forcevalidation=".$forcevalidation);
|
||||
dol_syslog("createRecurringInvoices restrictioninvoiceid=".$restrictioninvoiceid." forcevalidation=".$forcevalidation);
|
||||
|
||||
$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'facture_rec';
|
||||
$sql.= ' WHERE frequency > 0'; // A recurring invoice is an invoice with a frequency
|
||||
@ -1025,30 +1024,39 @@ class FactureRec extends CommonInvoice
|
||||
$sql.= ' AND (nb_gen_done < nb_gen_max OR nb_gen_max = 0)';
|
||||
$sql.= ' AND suspended = 0';
|
||||
$sql.= ' AND entity = '.$conf->entity; // MUST STAY = $conf->entity here
|
||||
if ($restictoninvoiceid > 0) $sql.=' AND rowid = '.$restictoninvoiceid;
|
||||
if ($restrictioninvoiceid > 0)
|
||||
$sql.=' AND rowid = '.$restrictioninvoiceid;
|
||||
$sql.= $db->order('entity', 'ASC');
|
||||
//print $sql;exit;
|
||||
$parameters = array(
|
||||
'restrictioninvoiceid' => $restrictioninvoiceid,
|
||||
'forcevalidation' => $forcevalidation,
|
||||
);
|
||||
$reshook = $hookmanager->executeHooks('beforeCreationOfRecurringInvoices', $parameters, $sql); // note that $sql might be modified by hooks
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$i=0;
|
||||
$num = $db->num_rows($resql);
|
||||
$i=0;
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
if ($num) $this->output.=$langs->trans("FoundXQualifiedRecurringInvoiceTemplate", $num)."\n";
|
||||
else $this->output.=$langs->trans("NoQualifiedRecurringInvoiceTemplateFound");
|
||||
if ($num)
|
||||
$this->output.=$langs->trans("FoundXQualifiedRecurringInvoiceTemplate", $num)."\n";
|
||||
else
|
||||
$this->output.=$langs->trans("NoQualifiedRecurringInvoiceTemplateFound");
|
||||
|
||||
$saventity = $conf->entity;
|
||||
$saventity = $conf->entity;
|
||||
|
||||
while ($i < $num) // Loop on each template invoice. If $num = 0, test is false at first pass.
|
||||
while ($i < $num) // Loop on each template invoice. If $num = 0, test is false at first pass.
|
||||
{
|
||||
$line = $db->fetch_object($resql);
|
||||
|
||||
$db->begin();
|
||||
$db->begin();
|
||||
|
||||
$invoiceidgenerated = 0;
|
||||
$invoiceidgenerated = 0;
|
||||
|
||||
$facturerec = new FactureRec($db);
|
||||
$facture = null;
|
||||
$facturerec = new FactureRec($db);
|
||||
$facturerec->fetch($line->rowid);
|
||||
|
||||
if ($facturerec->id > 0)
|
||||
@ -1058,44 +1066,44 @@ class FactureRec extends CommonInvoice
|
||||
|
||||
dol_syslog("createRecurringInvoices Process invoice template id=".$facturerec->id.", ref=".$facturerec->ref.", entity=".$facturerec->entity);
|
||||
|
||||
$facture = new Facture($db);
|
||||
$facture = new Facture($db);
|
||||
$facture->fac_rec = $facturerec->id; // We will create $facture from this recurring invoice
|
||||
$facture->fk_fac_rec_source = $facturerec->id; // We will create $facture from this recurring invoice
|
||||
|
||||
$facture->type = self::TYPE_STANDARD;
|
||||
$facture->brouillon = 1;
|
||||
$facture->date = (empty($facturerec->date_when)?$now:$facturerec->date_when); // We could also use dol_now here but we prefer date_when so invoice has real date when we would like even if we generate later.
|
||||
$facture->socid = $facturerec->socid;
|
||||
$facture->type = self::TYPE_STANDARD;
|
||||
$facture->brouillon = 1;
|
||||
$facture->date = (empty($facturerec->date_when)?$now:$facturerec->date_when); // We could also use dol_now here but we prefer date_when so invoice has real date when we would like even if we generate later.
|
||||
$facture->socid = $facturerec->socid;
|
||||
|
||||
$invoiceidgenerated = $facture->create($user);
|
||||
if ($invoiceidgenerated <= 0)
|
||||
{
|
||||
$this->errors = $facture->errors;
|
||||
$this->error = $facture->error;
|
||||
$error++;
|
||||
}
|
||||
if (! $error && ($facturerec->auto_validate || $forcevalidation))
|
||||
{
|
||||
$result = $facture->validate($user);
|
||||
if ($result <= 0)
|
||||
{
|
||||
$this->errors = $facture->errors;
|
||||
$this->error = $facture->error;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
if (! $error && $facturerec->generate_pdf)
|
||||
{
|
||||
// We refresh the object in order to have all necessary data (like date_lim_reglement)
|
||||
$facture->fetch($facture->id);
|
||||
$result = $facture->generateDocument($facturerec->modelpdf, $langs);
|
||||
if ($result <= 0)
|
||||
{
|
||||
$this->errors = $facture->errors;
|
||||
$this->error = $facture->error;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
$invoiceidgenerated = $facture->create($user);
|
||||
if ($invoiceidgenerated <= 0)
|
||||
{
|
||||
$this->errors = $facture->errors;
|
||||
$this->error = $facture->error;
|
||||
$error++;
|
||||
}
|
||||
if (! $error && ($facturerec->auto_validate || $forcevalidation))
|
||||
{
|
||||
$result = $facture->validate($user);
|
||||
if ($result <= 0)
|
||||
{
|
||||
$this->errors = $facture->errors;
|
||||
$this->error = $facture->error;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
if (! $error && $facturerec->generate_pdf)
|
||||
{
|
||||
// We refresh the object in order to have all necessary data (like date_lim_reglement)
|
||||
$facture->fetch($facture->id);
|
||||
$result = $facture->generateDocument($facturerec->modelpdf, $langs);
|
||||
if ($result <= 0)
|
||||
{
|
||||
$this->errors = $facture->errors;
|
||||
$this->error = $facture->error;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1114,9 +1122,19 @@ class FactureRec extends CommonInvoice
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback("createRecurringInvoices Process invoice template id=".$facturerec->id.", ref=".$facturerec->ref);
|
||||
$db->rollback("createRecurringInvoices Process invoice template id=".$facturerec->id.", ref=".$facturerec->ref);
|
||||
}
|
||||
|
||||
$parameters = array(
|
||||
'cpt' => $i,
|
||||
'total' => $num,
|
||||
'errorCount' => $error,
|
||||
'invoiceidgenerated' => $invoiceidgenerated,
|
||||
'facturerec' => $facturerec, // it's an object which PHP passes by "reference", so modifiable by hooks.
|
||||
'this' => $this, // it's an object which PHP passes by "reference", so modifiable by hooks.
|
||||
);
|
||||
$reshook = $hookmanager->executeHooks('afterCreationOfRecurringInvoice', $parameters, $facture); // note: $facture can be modified by hooks (warning: $facture can be null)
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
@ -93,7 +93,7 @@ class Facture extends CommonInvoice
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected $table_ref_field = 'facnumber';
|
||||
protected $table_ref_field = 'ref';
|
||||
|
||||
public $socid;
|
||||
|
||||
@ -450,7 +450,7 @@ class Facture extends CommonInvoice
|
||||
$socid = $this->socid;
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."facture (";
|
||||
$sql.= " facnumber";
|
||||
$sql.= " ref";
|
||||
$sql.= ", entity";
|
||||
$sql.= ", ref_ext";
|
||||
$sql.= ", type";
|
||||
@ -514,7 +514,7 @@ class Facture extends CommonInvoice
|
||||
|
||||
// Update ref with new one
|
||||
$this->ref='(PROV'.$this->id.')';
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX."facture SET facnumber='".$this->db->escape($this->ref)."' WHERE rowid=".$this->id;
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX."facture SET ref='".$this->db->escape($this->ref)."' WHERE rowid=".$this->id;
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql) $error++;
|
||||
@ -1310,7 +1310,7 @@ class Facture extends CommonInvoice
|
||||
|
||||
if (empty($rowid) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1;
|
||||
|
||||
$sql = 'SELECT f.rowid,f.entity,f.facnumber,f.ref_client,f.ref_ext,f.ref_int,f.type,f.fk_soc,f.amount';
|
||||
$sql = 'SELECT f.rowid,f.entity,f.ref,f.ref_client,f.ref_ext,f.ref_int,f.type,f.fk_soc,f.amount';
|
||||
$sql.= ', f.tva, f.localtax1, f.localtax2, f.total, f.total_ttc, f.revenuestamp';
|
||||
$sql.= ', f.remise_percent, f.remise_absolue, f.remise';
|
||||
$sql.= ', f.datef as df, f.date_pointoftax';
|
||||
@ -1334,9 +1334,9 @@ class Facture extends CommonInvoice
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON f.fk_incoterms = i.rowid';
|
||||
|
||||
if ($rowid) $sql.= " WHERE f.rowid=".$rowid;
|
||||
else $sql.= ' WHERE f.entity IN ('.getEntity('facture').')'; // Dont't use entity if you use rowid
|
||||
else $sql.= ' WHERE f.entity IN ('.getEntity('invoice').')'; // Dont't use entity if you use rowid
|
||||
|
||||
if ($ref) $sql.= " AND f.facnumber='".$this->db->escape($ref)."'";
|
||||
if ($ref) $sql.= " AND f.ref='".$this->db->escape($ref)."'";
|
||||
if ($ref_ext) $sql.= " AND f.ref_ext='".$this->db->escape($ref_ext)."'";
|
||||
if ($ref_int) $sql.= " AND f.ref_int='".$this->db->escape($ref_int)."'";
|
||||
|
||||
@ -1351,7 +1351,7 @@ class Facture extends CommonInvoice
|
||||
$this->id = $obj->rowid;
|
||||
$this->entity = $obj->entity;
|
||||
|
||||
$this->ref = $obj->facnumber;
|
||||
$this->ref = $obj->ref;
|
||||
$this->ref_client = $obj->ref_client;
|
||||
$this->ref_ext = $obj->ref_ext;
|
||||
$this->ref_int = $obj->ref_int;
|
||||
@ -1615,7 +1615,7 @@ class Facture extends CommonInvoice
|
||||
|
||||
// Clean parameters
|
||||
if (empty($this->type)) $this->type= self::TYPE_STANDARD;
|
||||
if (isset($this->facnumber)) $this->facnumber=trim($this->ref);
|
||||
if (isset($this->ref)) $this->ref=trim($this->ref);
|
||||
if (isset($this->ref_client)) $this->ref_client=trim($this->ref_client);
|
||||
if (isset($this->increment)) $this->increment=trim($this->increment);
|
||||
if (isset($this->close_code)) $this->close_code=trim($this->close_code);
|
||||
@ -1631,7 +1631,7 @@ class Facture extends CommonInvoice
|
||||
|
||||
// Update request
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facture SET";
|
||||
$sql.= " facnumber=".(isset($this->ref)?"'".$this->db->escape($this->ref)."'":"null").",";
|
||||
$sql.= " ref=".(isset($this->ref)?"'".$this->db->escape($this->ref)."'":"null").",";
|
||||
$sql.= " type=".(isset($this->type)?$this->db->escape($this->type):"null").",";
|
||||
$sql.= " ref_client=".(isset($this->ref_client)?"'".$this->db->escape($this->ref_client)."'":"null").",";
|
||||
$sql.= " increment=".(isset($this->increment)?"'".$this->db->escape($this->increment)."'":"null").",";
|
||||
@ -2337,7 +2337,7 @@ class Facture extends CommonInvoice
|
||||
|
||||
// Validate
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture';
|
||||
$sql.= " SET facnumber='".$num."', fk_statut = ".self::STATUS_VALIDATED.", fk_user_valid = ".($user->id > 0 ? $user->id : "null").", date_valid = '".$this->db->idate($now)."'";
|
||||
$sql.= " SET ref='".$num."', fk_statut = ".self::STATUS_VALIDATED.", fk_user_valid = ".($user->id > 0 ? $user->id : "null").", date_valid = '".$this->db->idate($now)."'";
|
||||
if (! empty($conf->global->FAC_FORCE_DATE_VALIDATION)) // If option enabled, we force invoice date
|
||||
{
|
||||
$sql.= ", datef='".$this->db->idate($this->date)."'";
|
||||
@ -2446,7 +2446,7 @@ class Facture extends CommonInvoice
|
||||
if (! $error)
|
||||
{
|
||||
$this->ref = $num;
|
||||
$this->facnumber=$num;
|
||||
$this->ref=$num;
|
||||
$this->statut= self::STATUS_VALIDATED;
|
||||
$this->brouillon=0;
|
||||
$this->date_validation=$now;
|
||||
@ -2663,55 +2663,47 @@ class Facture extends CommonInvoice
|
||||
global $mysoc, $conf, $langs;
|
||||
|
||||
dol_syslog(get_class($this)."::addline id=$this->id,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, fk_product=$fk_product,remise_percent=$remise_percent,date_start=$date_start,date_end=$date_end,ventil=$ventil,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type, fk_unit=$fk_unit", LOG_DEBUG);
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||
|
||||
// Clean parameters
|
||||
if (empty($remise_percent)) $remise_percent=0;
|
||||
if (empty($qty)) $qty=0;
|
||||
if (empty($info_bits)) $info_bits=0;
|
||||
if (empty($rang)) $rang=0;
|
||||
if (empty($ventil)) $ventil=0;
|
||||
if (empty($txtva)) $txtva=0;
|
||||
if (empty($txlocaltax1)) $txlocaltax1=0;
|
||||
if (empty($txlocaltax2)) $txlocaltax2=0;
|
||||
if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0;
|
||||
if (empty($fk_prev_id)) $fk_prev_id = 'null';
|
||||
if (! isset($situation_percent) || $situation_percent > 100 || (string) $situation_percent == '') $situation_percent = 100;
|
||||
|
||||
$localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc);
|
||||
|
||||
// Clean vat code
|
||||
$vat_src_code='';
|
||||
if (preg_match('/\((.*)\)/', $txtva, $reg))
|
||||
{
|
||||
$vat_src_code = $reg[1];
|
||||
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
|
||||
}
|
||||
|
||||
$remise_percent=price2num($remise_percent);
|
||||
$qty=price2num($qty);
|
||||
$pu_ht=price2num($pu_ht);
|
||||
$pu_ht_devise=price2num($pu_ht_devise);
|
||||
$pu_ttc=price2num($pu_ttc);
|
||||
$pa_ht=price2num($pa_ht);
|
||||
$txtva=price2num($txtva);
|
||||
$txlocaltax1=price2num($txlocaltax1);
|
||||
$txlocaltax2=price2num($txlocaltax2);
|
||||
|
||||
if ($price_base_type=='HT')
|
||||
{
|
||||
$pu=$pu_ht;
|
||||
}
|
||||
else
|
||||
{
|
||||
$pu=$pu_ttc;
|
||||
}
|
||||
|
||||
// Check parameters
|
||||
if ($type < 0) return -1;
|
||||
|
||||
if (! empty($this->brouillon))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||
|
||||
// Clean parameters
|
||||
if (empty($remise_percent)) $remise_percent=0;
|
||||
if (empty($qty)) $qty=0;
|
||||
if (empty($info_bits)) $info_bits=0;
|
||||
if (empty($rang)) $rang=0;
|
||||
if (empty($ventil)) $ventil=0;
|
||||
if (empty($txtva)) $txtva=0;
|
||||
if (empty($txlocaltax1)) $txlocaltax1=0;
|
||||
if (empty($txlocaltax2)) $txlocaltax2=0;
|
||||
if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0;
|
||||
if (empty($fk_prev_id)) $fk_prev_id = 'null';
|
||||
if (! isset($situation_percent) || $situation_percent > 100 || (string) $situation_percent == '') $situation_percent = 100;
|
||||
|
||||
$remise_percent=price2num($remise_percent);
|
||||
$qty=price2num($qty);
|
||||
$pu_ht=price2num($pu_ht);
|
||||
$pu_ht_devise=price2num($pu_ht_devise);
|
||||
$pu_ttc=price2num($pu_ttc);
|
||||
$pa_ht=price2num($pa_ht);
|
||||
if (!preg_match('/\((.*)\)/', $txtva)) {
|
||||
$txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5'
|
||||
}
|
||||
$txlocaltax1=price2num($txlocaltax1);
|
||||
$txlocaltax2=price2num($txlocaltax2);
|
||||
|
||||
if ($price_base_type=='HT')
|
||||
{
|
||||
$pu=$pu_ht;
|
||||
}
|
||||
else
|
||||
{
|
||||
$pu=$pu_ttc;
|
||||
}
|
||||
|
||||
// Check parameters
|
||||
if ($type < 0) return -1;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$product_type=$type;
|
||||
@ -2729,6 +2721,16 @@ class Facture extends CommonInvoice
|
||||
}
|
||||
}
|
||||
|
||||
$localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc);
|
||||
|
||||
// Clean vat code
|
||||
$vat_src_code='';
|
||||
if (preg_match('/\((.*)\)/', $txtva, $reg))
|
||||
{
|
||||
$vat_src_code = $reg[1];
|
||||
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
|
||||
}
|
||||
|
||||
// Calcul du total TTC et de la TVA pour la ligne a partir de
|
||||
// qty, pu, remise_percent et txtva
|
||||
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
|
||||
@ -3479,7 +3481,7 @@ class Facture extends CommonInvoice
|
||||
$ga = array();
|
||||
|
||||
$sql = "SELECT s.rowid, s.nom as name, s.client,";
|
||||
$sql.= " f.rowid as fid, f.facnumber as ref, f.datef as df";
|
||||
$sql.= " f.rowid as fid, f.ref as ref, f.datef as df";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as f";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
@ -3549,7 +3551,7 @@ class Facture extends CommonInvoice
|
||||
|
||||
$return = array();
|
||||
|
||||
$sql = "SELECT f.rowid as rowid, f.facnumber, f.fk_statut,";
|
||||
$sql = "SELECT f.rowid as rowid, f.ref, f.fk_statut,";
|
||||
$sql.= " ff.rowid as rowidnext";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid = pf.fk_facture";
|
||||
@ -3560,7 +3562,7 @@ class Facture extends CommonInvoice
|
||||
$sql.= " AND pf.fk_paiement IS NULL"; // Aucun paiement deja fait
|
||||
$sql.= " AND ff.fk_statut IS NULL"; // Renvoi vrai si pas facture de remplacement
|
||||
if ($socid > 0) $sql.=" AND f.fk_soc = ".$socid;
|
||||
$sql.= " ORDER BY f.facnumber";
|
||||
$sql.= " ORDER BY f.ref";
|
||||
|
||||
dol_syslog(get_class($this)."::list_replacable_invoices", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
@ -3569,7 +3571,7 @@ class Facture extends CommonInvoice
|
||||
while ($obj=$this->db->fetch_object($resql))
|
||||
{
|
||||
$return[$obj->rowid]=array( 'id' => $obj->rowid,
|
||||
'ref' => $obj->facnumber,
|
||||
'ref' => $obj->ref,
|
||||
'status' => $obj->fk_statut);
|
||||
}
|
||||
//print_r($return);
|
||||
@ -3600,7 +3602,7 @@ class Facture extends CommonInvoice
|
||||
$return = array();
|
||||
|
||||
|
||||
$sql = "SELECT f.rowid as rowid, f.facnumber, f.fk_statut, f.type, f.paye, pf.fk_paiement";
|
||||
$sql = "SELECT f.rowid as rowid, f.ref, f.fk_statut, f.type, f.paye, pf.fk_paiement";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid = pf.fk_facture";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as ff ON (f.rowid = ff.fk_facture_source AND ff.type=".self::TYPE_REPLACEMENT.")";
|
||||
@ -3629,7 +3631,7 @@ class Facture extends CommonInvoice
|
||||
}
|
||||
|
||||
if ($socid > 0) $sql.=" AND f.fk_soc = ".$socid;
|
||||
$sql.= " ORDER BY f.facnumber";
|
||||
$sql.= " ORDER BY f.ref";
|
||||
|
||||
dol_syslog(get_class($this)."::list_qualified_avoir_invoices", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
@ -3642,9 +3644,9 @@ class Facture extends CommonInvoice
|
||||
if ($obj->fk_statut == self::STATUS_CLOSED) $qualified=1;
|
||||
if ($qualified)
|
||||
{
|
||||
//$ref=$obj->facnumber;
|
||||
//$ref=$obj->ref;
|
||||
$paymentornot=($obj->fk_paiement?1:0);
|
||||
$return[$obj->rowid]=array('ref'=>$obj->facnumber,'status'=>$obj->fk_statut,'type'=>$obj->type,'paye'=>$obj->paye,'paymentornot'=>$paymentornot);
|
||||
$return[$obj->rowid]=array('ref'=>$obj->ref,'status'=>$obj->fk_statut,'type'=>$obj->type,'paye'=>$obj->paye,'paymentornot'=>$paymentornot);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4142,7 +4144,7 @@ class Facture extends CommonInvoice
|
||||
function newCycle()
|
||||
{
|
||||
$sql = 'SELECT max(situation_cycle_ref) FROM ' . MAIN_DB_PREFIX . 'facture as f';
|
||||
$sql.= " WHERE f.entity in (".getEntity('facture', 0).")";
|
||||
$sql.= " WHERE f.entity in (".getEntity('invoice', 0).")";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
if ($resql->num_rows > 0)
|
||||
|
||||
@ -193,7 +193,7 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref, '', 0, '', '', 1);
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
@ -160,7 +160,7 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref, '', 0);
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0);
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
@ -1674,7 +1674,7 @@ else
|
||||
{
|
||||
if (! empty($object->frequency) && $object->nb_gen_max > 0 && ($object->nb_gen_done >= $object->nb_gen_max))
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("MaxGenerationReached")).'">'.$langs->trans("CreateBill").'</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("MaxGenerationReached")).'">'.$langs->trans("CreateBill").'</a></div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1684,13 +1684,13 @@ else
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("DateIsNotEnough")).'">'.$langs->trans("CreateBill").'</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("DateIsNotEnough")).'">'.$langs->trans("CreateBill").'</a></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#">'.$langs->trans("CreateBill").'</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans("CreateBill").'</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -107,7 +107,7 @@ $morehtmlref.='</div>';
|
||||
|
||||
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref, '', 0);
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0);
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
@ -222,7 +222,7 @@ if (! $user->rights->societe->client->voir && ! $socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql.= " WHERE f.fk_soc = s.rowid";
|
||||
$sql.= ' AND f.entity IN ('.getEntity('facture').')';
|
||||
$sql.= ' AND f.entity IN ('.getEntity('invoice').')';
|
||||
if (! $user->rights->societe->client->voir && ! $socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
}
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2015-2016 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2017 Josep Lluís Amador <joseplluis@lliuretic.cat>
|
||||
* Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.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
|
||||
@ -50,7 +51,7 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('bills', 'companies', 'products'));
|
||||
$langs->loadLangs(array('bills', 'companies', 'products', 'categories'));
|
||||
|
||||
$sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
|
||||
$projectid=(GETPOST('projectid')?GETPOST('projectid','int'):0);
|
||||
@ -88,7 +89,7 @@ $search_country=GETPOST("search_country",'int');
|
||||
$search_type_thirdparty=GETPOST("search_type_thirdparty",'int');
|
||||
$search_user = GETPOST('search_user','int');
|
||||
$search_sale = GETPOST('search_sale','int');
|
||||
$search_day = GETPOST('search_day','int');
|
||||
$search_day = GETPOST('search_day','int');
|
||||
$search_month = GETPOST('search_month','int');
|
||||
$search_year = GETPOST('search_year','int');
|
||||
$search_day_lim = GETPOST('search_day_lim','int');
|
||||
@ -117,7 +118,7 @@ $pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
// Security check
|
||||
$fieldid = (! empty($ref)?'facnumber':'rowid');
|
||||
$fieldid = (! empty($ref)?'ref':'rowid');
|
||||
if (! empty($user->societe_id)) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'facture', $id,'','','fk_soc',$fieldid);
|
||||
|
||||
@ -138,7 +139,7 @@ $search_array_options=$extrafields->getOptionalsFromPost($object->table_element,
|
||||
|
||||
// List of fields to search into when doing a "search in all"
|
||||
$fieldstosearchall = array(
|
||||
'f.facnumber'=>'Ref',
|
||||
'f.ref'=>'Ref',
|
||||
'f.ref_client'=>'RefCustomer',
|
||||
'pd.description'=>'Description',
|
||||
's.nom'=>"ThirdParty",
|
||||
@ -148,7 +149,7 @@ if (empty($user->socid)) $fieldstosearchall["f.note_private"]="NotePrivate";
|
||||
|
||||
$checkedtypetiers=0;
|
||||
$arrayfields=array(
|
||||
'f.facnumber'=>array('label'=>"Ref", 'checked'=>1),
|
||||
'f.ref'=>array('label'=>"Ref", 'checked'=>1),
|
||||
'f.ref_client'=>array('label'=>"RefCustomer", 'checked'=>1),
|
||||
'f.type'=>array('label'=>"Type", 'checked'=>0),
|
||||
'f.date'=>array('label'=>"DateInvoice", 'checked'=>1),
|
||||
@ -358,7 +359,7 @@ $thirdpartystatic=new Societe($db);
|
||||
|
||||
$sql = 'SELECT';
|
||||
if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
|
||||
$sql.= ' f.rowid as id, f.facnumber as ref, f.ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.total as total_ht, f.tva as total_vat, f.total_ttc,';
|
||||
$sql.= ' f.rowid as id, f.ref, f.ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.total as total_ht, f.tva as total_vat, f.total_ttc,';
|
||||
$sql.= ' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,';
|
||||
$sql.= ' f.datef as df, f.date_lim_reglement as datelimite,';
|
||||
$sql.= ' f.paye as paye, f.fk_statut,';
|
||||
@ -399,7 +400,7 @@ if ($search_user > 0)
|
||||
$sql.=", ".MAIN_DB_PREFIX."c_type_contact as tc";
|
||||
}
|
||||
$sql.= ' WHERE f.fk_soc = s.rowid';
|
||||
$sql.= ' AND f.entity IN ('.getEntity('facture').')';
|
||||
$sql.= ' AND f.entity IN ('.getEntity('invoice').')';
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($search_product_category > 0) $sql.=" AND cp.fk_categorie = ".$db->escape($search_product_category);
|
||||
if ($socid > 0) $sql.= ' AND s.rowid = '.$socid;
|
||||
@ -417,7 +418,7 @@ if ($filtre)
|
||||
$sql .= ' AND ' . $db->escape(trim($filt[0])) . ' = ' . $db->escape(trim($filt[1]));
|
||||
}
|
||||
}
|
||||
if ($search_ref) $sql .= natural_search('f.facnumber', $search_ref);
|
||||
if ($search_ref) $sql .= natural_search('f.ref', $search_ref);
|
||||
if ($search_refcustomer) $sql .= natural_search('f.ref_client', $search_refcustomer);
|
||||
if ($search_type != '' && $search_type != '-1') $sql.=" AND f.type IN (".$db->escape($search_type).")";
|
||||
if ($search_project) $sql .= natural_search('p.ref', $search_project);
|
||||
@ -450,34 +451,10 @@ if ($search_status != '-1' && $search_status != '')
|
||||
}
|
||||
}
|
||||
if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$db->escape($search_paymentmode);
|
||||
if ($search_month > 0)
|
||||
{
|
||||
if ($search_year > 0 && empty($search_day))
|
||||
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,$search_month,false))."' AND '".$db->idate(dol_get_last_day($search_year,$search_month,false))."'";
|
||||
else if ($search_year > 0 && ! empty($search_day))
|
||||
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month, $search_day, $search_year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month, $search_day, $search_year))."'";
|
||||
else
|
||||
$sql.= " AND date_format(f.datef, '%m') = '".$search_month."'";
|
||||
}
|
||||
else if ($search_year > 0)
|
||||
{
|
||||
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'";
|
||||
}
|
||||
if ($search_month_lim > 0)
|
||||
{
|
||||
if ($search_year_lim > 0 && empty($search_day_lim))
|
||||
$sql.= " AND f.date_lim_reglement BETWEEN '".$db->idate(dol_get_first_day($search_year_lim,$search_month_lim,false))."' AND '".$db->idate(dol_get_last_day($search_year_lim,$search_month_lim,false))."'";
|
||||
else if ($search_year_lim > 0 && ! empty($search_day_lim))
|
||||
$sql.= " AND f.date_lim_reglement BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month_lim, $search_day_lim, $search_year_lim))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month_lim, $search_day_lim, $search_year_lim))."'";
|
||||
else
|
||||
$sql.= " AND date_format(f.date_lim_reglement, '%m') = '".$db->escape($search_month_lim)."'";
|
||||
}
|
||||
else if ($search_year_lim > 0)
|
||||
{
|
||||
$sql.= " AND f.date_lim_reglement BETWEEN '".$db->idate(dol_get_first_day($search_year_lim,1,false))."' AND '".$db->idate(dol_get_last_day($search_year_lim,12,false))."'";
|
||||
}
|
||||
$sql.= dolSqlDateFilter("f.datef", $search_day, $search_month, $search_year);
|
||||
$sql.= dolSqlDateFilter("f.date_lim_reglement", $search_day_lim, $search_month_lim, $search_year_lim);
|
||||
if ($option == 'late') $sql.=" AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->client->warning_delay)."'";
|
||||
if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale;
|
||||
if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale;
|
||||
if ($search_user > 0)
|
||||
{
|
||||
$sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='facture' AND tc.source='internal' AND ec.element_id = f.rowid AND ec.fk_socpeople = ".$search_user;
|
||||
@ -491,7 +468,7 @@ $sql.=$hookmanager->resPrint;
|
||||
|
||||
if (! $sall)
|
||||
{
|
||||
$sql.= ' GROUP BY f.rowid, f.facnumber, ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.total, f.tva, f.total_ttc,';
|
||||
$sql.= ' GROUP BY f.rowid, f.ref, ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.total, f.tva, f.total_ttc,';
|
||||
$sql.= ' f.localtax1, f.localtax2,';
|
||||
$sql.= ' f.datef, f.date_lim_reglement,';
|
||||
$sql.= ' f.paye, f.fk_statut,';
|
||||
@ -595,6 +572,7 @@ if ($resql)
|
||||
|
||||
$arrayofmassactions=array(
|
||||
'validate'=>$langs->trans("Validate"),
|
||||
'generate_doc'=>$langs->trans("Generate"),
|
||||
'presend'=>$langs->trans("SendByMail"),
|
||||
'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
@ -706,7 +684,7 @@ if ($resql)
|
||||
// Filters lines
|
||||
print '<tr class="liste_titre_filter">';
|
||||
// Ref
|
||||
if (! empty($arrayfields['f.facnumber']['checked']))
|
||||
if (! empty($arrayfields['f.ref']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" size="6" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
|
||||
@ -878,7 +856,7 @@ if ($resql)
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
if (! empty($arrayfields['f.facnumber']['checked'])) print_liste_field_titre($arrayfields['f.facnumber']['label'],$_SERVER['PHP_SELF'],'f.facnumber','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['f.ref']['checked'])) print_liste_field_titre($arrayfields['f.ref']['label'],$_SERVER['PHP_SELF'],'f.ref','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['f.ref_client']['checked'])) print_liste_field_titre($arrayfields['f.ref_client']['label'],$_SERVER["PHP_SELF"],'f.ref_client','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['f.type']['checked'])) print_liste_field_titre($arrayfields['f.type']['label'],$_SERVER["PHP_SELF"],'f.type','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['f.date']['checked'])) print_liste_field_titre($arrayfields['f.date']['label'],$_SERVER['PHP_SELF'],'f.datef','',$param,'align="center"',$sortfield,$sortorder);
|
||||
@ -960,7 +938,7 @@ if ($resql)
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
if (! empty($arrayfields['f.facnumber']['checked']))
|
||||
if (! empty($arrayfields['f.ref']['checked']))
|
||||
{
|
||||
print '<td class="nowrap">';
|
||||
|
||||
|
||||
@ -130,7 +130,7 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref, '', 0);
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0);
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -45,7 +46,7 @@ $ref=GETPOST('ref','alpha');
|
||||
$socid=GETPOST('socid','int');
|
||||
$action=GETPOST('action','alpha');
|
||||
|
||||
$fieldid = (! empty($ref)?'facnumber':'rowid');
|
||||
$fieldid = (! empty($ref)?'ref':'rowid');
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid);
|
||||
|
||||
@ -208,7 +209,7 @@ if ($object->id > 0)
|
||||
|
||||
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref, '', 0, '', '');
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '');
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="fichehalfleft">';
|
||||
@ -402,17 +403,17 @@ if ($object->id > 0)
|
||||
if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency))
|
||||
{
|
||||
// Multicurrency Amount HT
|
||||
print '<tr><td class="titlefieldmiddle">' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '</td>';
|
||||
print '<tr><td class="titlefieldmiddle">' . $form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0) . '</td>';
|
||||
print '<td class="nowrap">' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Multicurrency Amount VAT
|
||||
print '<tr><td>' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '</td>';
|
||||
print '<tr><td>' . $form->editfieldkey('MulticurrencyAmountVAT', 'multicurrency_total_tva', '', $object, 0) . '</td>';
|
||||
print '<td class="nowrap">' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Multicurrency Amount TTC
|
||||
print '<tr><td>' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '</td>';
|
||||
print '<tr><td>' . $form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0) . '</td>';
|
||||
print '<td class="nowrap">' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
@ -542,22 +543,22 @@ if ($object->id > 0)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("MakeWithdrawRequest").'</a>';
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("MakeWithdrawRequest").'</a>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("AmountMustBePositive")).'">'.$langs->trans("MakeWithdrawRequest").'</a>';
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("AmountMustBePositive")).'">'.$langs->trans("MakeWithdrawRequest").'</a>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($num == 0)
|
||||
{
|
||||
if ($object->statut > Facture::STATUS_DRAFT) print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("AlreadyPaid")).'">'.$langs->trans("MakeWithdrawRequest").'</a>';
|
||||
else print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("Draft")).'">'.$langs->trans("MakeWithdrawRequest").'</a>';
|
||||
if ($object->statut > Facture::STATUS_DRAFT) print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("AlreadyPaid")).'">'.$langs->trans("MakeWithdrawRequest").'</a>';
|
||||
else print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("Draft")).'">'.$langs->trans("MakeWithdrawRequest").'</a>';
|
||||
}
|
||||
else print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("RequestAlreadyDone")).'">'.$langs->trans("MakeWithdrawRequest").'</a>';
|
||||
else print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("RequestAlreadyDone")).'">'.$langs->trans("MakeWithdrawRequest").'</a>';
|
||||
}
|
||||
|
||||
print "</div><br>\n";
|
||||
|
||||
@ -136,7 +136,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele
|
||||
*/
|
||||
if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
{
|
||||
$sql = "SELECT f.facnumber";
|
||||
$sql = "SELECT f.ref";
|
||||
$sql.= ", f.rowid, f.total as total_ht, f.tva as total_tva, f.total_ttc, f.ref_client";
|
||||
$sql.= ", f.type";
|
||||
$sql.= ", s.nom as name";
|
||||
@ -177,7 +177,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$facturestatic->ref=$obj->facnumber;
|
||||
$facturestatic->ref=$obj->ref;
|
||||
$facturestatic->id=$obj->rowid;
|
||||
$facturestatic->total_ht=$obj->total_ht;
|
||||
$facturestatic->total_tva=$obj->total_tva;
|
||||
@ -320,7 +320,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
$langs->load("boxes");
|
||||
$facstatic=new Facture($db);
|
||||
|
||||
$sql = "SELECT f.rowid, f.facnumber, f.fk_statut, f.type, f.total as total_ht, f.tva as total_tva, f.total_ttc, f.paye, f.tms";
|
||||
$sql = "SELECT f.rowid, f.ref, f.fk_statut, f.type, f.total as total_ht, f.tva as total_tva, f.total_ttc, f.paye, f.tms";
|
||||
$sql.= ", f.date_lim_reglement as datelimite";
|
||||
$sql.= ", s.nom as name";
|
||||
$sql.= ", s.rowid as socid";
|
||||
@ -339,7 +339,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
$reshook=$hookmanager->executeHooks('printFieldListWhereCustomerLastModified',$parameters);
|
||||
$sql.=$hookmanager->resPrint;
|
||||
|
||||
$sql.= " GROUP BY f.rowid, f.facnumber, f.fk_statut, f.type, f.total, f.tva, f.total_ttc, f.paye, f.tms, f.date_lim_reglement,";
|
||||
$sql.= " GROUP BY f.rowid, f.ref, f.fk_statut, f.type, f.total, f.tva, f.total_ttc, f.paye, f.tms, f.date_lim_reglement,";
|
||||
$sql.= " s.nom, s.rowid, s.code_client, s.code_compta, s.email,";
|
||||
$sql.= " cc.rowid, cc.code";
|
||||
$sql.= " ORDER BY f.tms DESC ";
|
||||
@ -365,7 +365,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$facturestatic->ref=$obj->facnumber;
|
||||
$facturestatic->ref=$obj->ref;
|
||||
$facturestatic->id=$obj->rowid;
|
||||
$facturestatic->total_ht=$obj->total_ht;
|
||||
$facturestatic->total_tva=$obj->total_tva;
|
||||
@ -399,8 +399,8 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
}
|
||||
print '</td>';
|
||||
print '<td width="16" align="right" class="nobordernopadding hideonsmartphone">';
|
||||
$filename=dol_sanitizeFileName($obj->facnumber);
|
||||
$filedir=$conf->facture->dir_output . '/' . dol_sanitizeFileName($obj->facnumber);
|
||||
$filename=dol_sanitizeFileName($obj->ref);
|
||||
$filedir=$conf->facture->dir_output . '/' . dol_sanitizeFileName($obj->ref);
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?facid='.$obj->rowid;
|
||||
print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir);
|
||||
print '</td></tr></table>';
|
||||
@ -812,7 +812,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
{
|
||||
$facstatic=new Facture($db);
|
||||
|
||||
$sql = "SELECT f.rowid, f.facnumber, f.fk_statut, f.datef, f.type, f.total as total_ht, f.tva as total_tva, f.total_ttc, f.paye, f.tms";
|
||||
$sql = "SELECT f.rowid, f.ref, f.fk_statut, f.datef, f.type, f.total as total_ht, f.tva as total_tva, f.total_ttc, f.paye, f.tms";
|
||||
$sql.= ", f.date_lim_reglement as datelimite";
|
||||
$sql.= ", s.nom as name";
|
||||
$sql.= ", s.rowid as socid, s.email";
|
||||
@ -831,9 +831,9 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
$reshook=$hookmanager->executeHooks('printFieldListWhereCustomerUnpaid',$parameters);
|
||||
$sql.=$hookmanager->resPrint;
|
||||
|
||||
$sql.= " GROUP BY f.rowid, f.facnumber, f.fk_statut, f.datef, f.type, f.total, f.tva, f.total_ttc, f.paye, f.tms, f.date_lim_reglement,";
|
||||
$sql.= " GROUP BY f.rowid, f.ref, f.fk_statut, f.datef, f.type, f.total, f.tva, f.total_ttc, f.paye, f.tms, f.date_lim_reglement,";
|
||||
$sql.= " s.nom, s.rowid, s.email, s.code_client, s.code_compta, cc.rowid, cc.code";
|
||||
$sql.= " ORDER BY f.datef ASC, f.facnumber ASC";
|
||||
$sql.= " ORDER BY f.datef ASC, f.ref ASC";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
@ -858,7 +858,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$facturestatic->ref=$obj->facnumber;
|
||||
$facturestatic->ref=$obj->ref;
|
||||
$facturestatic->id=$obj->rowid;
|
||||
$facturestatic->total_ht=$obj->total_ht;
|
||||
$facturestatic->total_tva=$obj->total_tva;
|
||||
@ -891,8 +891,8 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
}
|
||||
print '</td>';
|
||||
print '<td width="16" align="right" class="nobordernopadding hideonsmartphone">';
|
||||
$filename=dol_sanitizeFileName($obj->facnumber);
|
||||
$filedir=$conf->facture->dir_output . '/' . dol_sanitizeFileName($obj->facnumber);
|
||||
$filename=dol_sanitizeFileName($obj->ref);
|
||||
$filedir=$conf->facture->dir_output . '/' . dol_sanitizeFileName($obj->ref);
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?facid='.$obj->rowid;
|
||||
print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir);
|
||||
print '</td></tr></table>';
|
||||
|
||||
@ -100,7 +100,7 @@ report_header($name,'',$period,$periodlink,$description,$builddate,$exportlink);
|
||||
$p = explode(":", $conf->global->MAIN_INFO_SOCIETE_COUNTRY);
|
||||
$idpays = $p[0];
|
||||
|
||||
$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef, f.ref_client,";
|
||||
$sql = "SELECT f.rowid, f.ref, f.type, f.datef, f.ref_client,";
|
||||
$sql.= " fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.total_ttc, fd.localtax1_tx, fd.localtax2_tx, fd.total_localtax1, fd.total_localtax2, fd.rowid as id, fd.situation_percent,";
|
||||
$sql.= " s.rowid as socid, s.nom as name, s.code_compta, s.client,";
|
||||
$sql.= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell,";
|
||||
@ -180,7 +180,7 @@ if ($result)
|
||||
|
||||
//la ligne facture
|
||||
$tabfac[$obj->rowid]["date"] = $obj->datef;
|
||||
$tabfac[$obj->rowid]["ref"] = $obj->facnumber;
|
||||
$tabfac[$obj->rowid]["ref"] = $obj->ref;
|
||||
$tabfac[$obj->rowid]["type"] = $obj->type;
|
||||
if (! isset($tabttc[$obj->rowid][$compta_soc])) $tabttc[$obj->rowid][$compta_soc]=0;
|
||||
if (! isset($tabht[$obj->rowid][$compta_prod])) $tabht[$obj->rowid][$compta_prod]=0;
|
||||
|
||||
@ -295,7 +295,7 @@ if ($id)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.$langs->trans("LinkedToAConcialitedTransaction").'">'.$langs->trans("Delete").'</a>';
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("LinkedToAConcialitedTransaction").'">'.$langs->trans("Delete").'</a>';
|
||||
}
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@ -525,10 +525,10 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
* List of unpaid invoices
|
||||
*/
|
||||
|
||||
$sql = 'SELECT f.rowid as facid, f.facnumber, f.total_ttc, f.multicurrency_code, f.multicurrency_total_ttc, f.type,';
|
||||
$sql = 'SELECT f.rowid as facid, f.ref, f.total_ttc, f.multicurrency_code, f.multicurrency_total_ttc, f.type,';
|
||||
$sql.= ' f.datef as df, f.fk_soc as socid, f.date_lim_reglement as dlr';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f';
|
||||
$sql.= ' WHERE f.entity IN ('.getEntity('facture', $conf->entity).')';
|
||||
$sql.= ' WHERE f.entity IN ('.getEntity('invoice', $conf->entity).')';
|
||||
$sql.= ' AND (f.fk_soc = '.$facture->socid;
|
||||
// Can pay invoices of all child of parent company
|
||||
if(!empty($conf->global->FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS) && !empty($facture->thirdparty->parent)) {
|
||||
@ -550,7 +550,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
}
|
||||
|
||||
// Sort invoices by date and serial number: the older one comes first
|
||||
$sql.=' ORDER BY f.datef ASC, f.facnumber ASC';
|
||||
$sql.=' ORDER BY f.datef ASC, f.ref ASC';
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
@ -844,12 +844,12 @@ if (! GETPOST('action','aZ09'))
|
||||
if (! $sortorder) $sortorder='DESC';
|
||||
if (! $sortfield) $sortfield='p.datep';
|
||||
|
||||
$sql = 'SELECT p.datep as dp, p.amount, f.amount as fa_amount, f.facnumber';
|
||||
$sql = 'SELECT p.datep as dp, p.amount, f.amount as fa_amount, f.ref';
|
||||
$sql.=', f.rowid as facid, c.libelle as paiement_type, p.num_paiement';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiement as p LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id';
|
||||
$sql.= ', '.MAIN_DB_PREFIX.'facture as f';
|
||||
$sql.= ' WHERE p.fk_facture = f.rowid';
|
||||
$sql.= ' AND f.entity IN (' . getEntity('facture').')';
|
||||
$sql.= ' AND f.entity IN (' . getEntity('invoice').')';
|
||||
if ($socid)
|
||||
{
|
||||
$sql.= ' AND f.fk_soc = '.$socid;
|
||||
@ -867,7 +867,7 @@ if (! GETPOST('action','aZ09'))
|
||||
print_barre_liste($langs->trans('Payments'), $page, $_SERVER["PHP_SELF"],'',$sortfield,$sortorder,'',$num);
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre('Invoice',$_SERVER["PHP_SELF"],'facnumber','','','',$sortfield,$sortorder);
|
||||
print_liste_field_titre('Invoice',$_SERVER["PHP_SELF"],'ref','','','',$sortfield,$sortorder);
|
||||
print_liste_field_titre('Date',$_SERVER["PHP_SELF"],'dp','','','',$sortfield,$sortorder);
|
||||
print_liste_field_titre('Type',$_SERVER["PHP_SELF"],'libelle','','','',$sortfield,$sortorder);
|
||||
print_liste_field_titre('Amount',$_SERVER["PHP_SELF"],'fa_amount','','','align="right"',$sortfield,$sortorder);
|
||||
@ -879,7 +879,7 @@ if (! GETPOST('action','aZ09'))
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/compta/facture/card.php?facid='.$objp->facid.'">'.$objp->facnumber."</a></td>\n";
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/compta/facture/card.php?facid='.$objp->facid.'">'.$objp->ref."</a></td>\n";
|
||||
print '<td>'.dol_print_date($db->jdate($objp->dp))."</td>\n";
|
||||
print '<td>'.$objp->paiement_type.' '.$objp->num_paiement."</td>\n";
|
||||
print '<td align="right">'.price($objp->amount).'</td><td> </td>';
|
||||
|
||||
@ -316,7 +316,7 @@ dol_fiche_end();
|
||||
* List of invoices
|
||||
*/
|
||||
|
||||
$sql = 'SELECT f.rowid as facid, f.facnumber, f.type, f.total_ttc, f.paye, f.fk_statut, pf.amount, s.nom as name, s.rowid as socid';
|
||||
$sql = 'SELECT f.rowid as facid, f.ref, f.type, f.total_ttc, f.paye, f.fk_statut, pf.amount, s.nom as name, s.rowid as socid';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf,'.MAIN_DB_PREFIX.'facture as f,'.MAIN_DB_PREFIX.'societe as s';
|
||||
$sql.= ' WHERE pf.fk_facture = f.rowid';
|
||||
$sql.= ' AND f.fk_soc = s.rowid';
|
||||
@ -438,7 +438,7 @@ if ($user->societe_id == 0 && $action == '')
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.$title_button.'">'.$langs->trans('Delete').'</a>';
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.$title_button.'">'.$langs->trans('Delete').'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -546,7 +546,7 @@ if ($action == 'new')
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans('NewCheckDepositOn',$account_label).'</a>';
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans('NewCheckDepositOn',$account_label).'</a>';
|
||||
}
|
||||
print '</div><br>';
|
||||
print '</form>';
|
||||
|
||||
@ -165,7 +165,7 @@ class Paiement extends CommonObject
|
||||
$sql.= ' b.fk_account';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiement as p LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid';
|
||||
$sql.= ' WHERE p.entity IN (' . getEntity('facture').')';
|
||||
$sql.= ' WHERE p.entity IN (' . getEntity('invoice').')';
|
||||
if ($id > 0)
|
||||
$sql.= ' AND p.rowid = '.$id;
|
||||
else if ($ref)
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.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
|
||||
@ -120,7 +121,7 @@ if (GETPOST("orphelins"))
|
||||
$sql.=$hookmanager->resPrint;
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."paiement as p LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_paiement = c.id";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement";
|
||||
$sql.= " WHERE p.entity IN (" . getEntity('facture').")";
|
||||
$sql.= " WHERE p.entity IN (" . getEntity('invoice').")";
|
||||
$sql.= " AND pf.fk_facture IS NULL";
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
@ -151,7 +152,7 @@ else
|
||||
{
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
|
||||
}
|
||||
$sql.= " WHERE p.entity IN (" . getEntity('facture') . ")";
|
||||
$sql.= " WHERE p.entity IN (" . getEntity('invoice') . ")";
|
||||
if (! $user->rights->societe->client->voir && ! $socid)
|
||||
{
|
||||
$sql.= " AND sc.fk_user = " .$user->id;
|
||||
@ -163,19 +164,7 @@ else
|
||||
else $sql.= " AND f.fk_user_author = ".$userid;
|
||||
}
|
||||
// Search criteria
|
||||
if ($month > 0)
|
||||
{
|
||||
if ($year > 0 && empty($day))
|
||||
$sql.= " AND p.datep BETWEEN '".$db->idate(dol_get_first_day($year,$month,false))."' AND '".$db->idate(dol_get_last_day($year,$month,false))."'";
|
||||
else if ($year > 0 && ! empty($day))
|
||||
$sql.= " AND p.datep BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."'";
|
||||
else
|
||||
$sql.= " AND date_format(p.datep, '%m') = '".$month."'";
|
||||
}
|
||||
else if ($year > 0)
|
||||
{
|
||||
$sql.= " AND p.datep BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'";
|
||||
}
|
||||
$sql.= dolSqlDateFilter("p.datep", $day, $month, $year);
|
||||
if ($search_ref) $sql .= natural_search('p.ref', $search_ref);
|
||||
if ($search_account > 0) $sql .=" AND b.fk_account=".$search_account;
|
||||
if ($search_paymenttype != "") $sql .=" AND c.code='".$db->escape($search_paymenttype)."'";
|
||||
|
||||
@ -71,7 +71,7 @@ if ($socid)
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON pf.fk_facture = f.rowid";
|
||||
}
|
||||
$sql.= " WHERE p.entity IN (" . getEntity('facture') . ')';
|
||||
$sql.= " WHERE p.entity IN (" . getEntity('invoice') . ')';
|
||||
if ($socid)
|
||||
{
|
||||
$sql.= " AND f.fk_soc = ".$socid;
|
||||
|
||||
@ -319,7 +319,7 @@ if ($action == '')
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("CantRemovePaymentWithOneInvoicePaid")).'">'.$langs->trans('Delete').'</a>';
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("CantRemovePaymentWithOneInvoicePaid")).'">'.$langs->trans('Delete').'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -74,7 +74,7 @@ llxHeader('',$langs->trans("WithdrawalsReceipts"));
|
||||
|
||||
$sql = "SELECT p.rowid, p.ref, p.amount, p.statut, p.datec";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
||||
$sql.= " WHERE p.entity IN (".getEntity('facture').")";
|
||||
$sql.= " WHERE p.entity IN (".getEntity('invoice').")";
|
||||
if ($search_ref) $sql.=natural_search("p.ref", $search_ref);
|
||||
if ($search_amount) $sql.=natural_search("p.amount", $search_amount, 1);
|
||||
|
||||
|
||||
@ -288,7 +288,7 @@ class BonPrelevement extends CommonObject
|
||||
$sql.= ", p.fk_user_credit";
|
||||
$sql.= ", p.statut";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
||||
$sql.= " WHERE p.entity IN (".getEntity('facture').")";
|
||||
$sql.= " WHERE p.entity IN (".getEntity('invoice').")";
|
||||
if ($rowid > 0) $sql.= " AND p.rowid = ".$rowid;
|
||||
else $sql.= " AND p.ref = '".$this->db->escape($ref)."'";
|
||||
|
||||
@ -820,7 +820,7 @@ class BonPrelevement extends CommonObject
|
||||
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
||||
$sql.= " WHERE f.rowid = pfd.fk_facture";
|
||||
$sql.= " AND f.entity IN (".getEntity('facture').')';
|
||||
$sql.= " AND f.entity IN (".getEntity('invoice').')';
|
||||
$sql.= " AND s.rowid = f.fk_soc";
|
||||
//if ($banque || $agence) $sql.= " AND s.rowid = sr.fk_soc";
|
||||
$sql.= " AND f.fk_statut = 1";
|
||||
@ -1349,7 +1349,7 @@ class BonPrelevement extends CommonObject
|
||||
|
||||
$sql = "SELECT soc.code_client as code, soc.address, soc.zip, soc.town, c.code as country_code,";
|
||||
$sql.= " pl.client_nom as nom, pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,";
|
||||
$sql.= " f.facnumber as fac, pf.fk_facture as idfac, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum";
|
||||
$sql.= " f.ref as fac, pf.fk_facture as idfac, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum";
|
||||
$sql.= " FROM";
|
||||
$sql.= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."facture as f,";
|
||||
@ -1488,12 +1488,12 @@ class BonPrelevement extends CommonObject
|
||||
* @param string $rib_guichet code of bank office
|
||||
* @param string $rib_number bank account
|
||||
* @param float $amount amount
|
||||
* @param string $facnumber ref of invoice
|
||||
* @param string $ref ref of invoice
|
||||
* @param int $facid id of invoice
|
||||
* @param string $rib_dom rib domiciliation
|
||||
* @return void
|
||||
*/
|
||||
function EnregDestinataire($rowid, $client_nom, $rib_banque, $rib_guichet, $rib_number, $amount, $facnumber, $facid, $rib_dom='')
|
||||
function EnregDestinataire($rowid, $client_nom, $rib_banque, $rib_guichet, $rib_number, $amount, $ref, $facid, $rib_dom='')
|
||||
{
|
||||
// phpcs:enable
|
||||
fputs($this->file, "06");
|
||||
@ -1537,7 +1537,7 @@ class BonPrelevement extends CommonObject
|
||||
|
||||
// Libelle F
|
||||
|
||||
fputs($this->file, substr("*_".$facnumber."_RDVnet".$rowid." ", 0, 31));
|
||||
fputs($this->file, substr("*_".$ref."_RDVnet".$rowid." ", 0, 31));
|
||||
|
||||
// Code etablissement G1
|
||||
|
||||
@ -1580,7 +1580,7 @@ class BonPrelevement extends CommonObject
|
||||
* @param string $row_cg pl.code_guichet AS cg, Not used for SEPA
|
||||
* @param string $row_cc pl.number AS cc, Not used for SEPA
|
||||
* @param string $row_somme pl.amount AS somme,
|
||||
* @param string $row_facnumber f.facnumber
|
||||
* @param string $row_ref f.ref
|
||||
* @param string $row_idfac pf.fk_facture AS idfac,
|
||||
* @param string $row_iban rib.iban_prefix AS iban,
|
||||
* @param string $row_bic rib.bic AS bic,
|
||||
@ -1588,7 +1588,7 @@ class BonPrelevement extends CommonObject
|
||||
* @param string $row_drum rib.rowid used to generate rum
|
||||
* @return string Return string with SEPA part DrctDbtTxInf
|
||||
*/
|
||||
function EnregDestinataireSEPA($row_code_client, $row_nom, $row_address, $row_zip, $row_town, $row_country_code, $row_cb, $row_cg, $row_cc, $row_somme, $row_facnumber, $row_idfac, $row_iban, $row_bic, $row_datec, $row_drum)
|
||||
function EnregDestinataireSEPA($row_code_client, $row_nom, $row_address, $row_zip, $row_town, $row_country_code, $row_cb, $row_cg, $row_cc, $row_somme, $row_ref, $row_idfac, $row_iban, $row_bic, $row_datec, $row_drum)
|
||||
{
|
||||
// phpcs:enable
|
||||
$CrLf = "\n";
|
||||
@ -1604,8 +1604,8 @@ class BonPrelevement extends CommonObject
|
||||
$XML_DEBITOR ='';
|
||||
$XML_DEBITOR .=' <DrctDbtTxInf>'.$CrLf;
|
||||
$XML_DEBITOR .=' <PmtId>'.$CrLf;
|
||||
// $XML_DEBITOR .=' <EndToEndId>'.('AS-'.dol_trunc($row_facnumber,20).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
|
||||
$XML_DEBITOR .=' <EndToEndId>'.(($conf->global->END_TO_END != "" ) ? $conf->global->END_TO_END : ('AS-'.dol_trunc($row_facnumber,20)).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
|
||||
// $XML_DEBITOR .=' <EndToEndId>'.('AS-'.dol_trunc($row_ref,20).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
|
||||
$XML_DEBITOR .=' <EndToEndId>'.(($conf->global->END_TO_END != "" ) ? $conf->global->END_TO_END : ('AS-'.dol_trunc($row_ref,20)).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
|
||||
$XML_DEBITOR .=' </PmtId>'.$CrLf;
|
||||
$XML_DEBITOR .=' <InstdAmt Ccy="EUR">'.round($row_somme, 2).'</InstdAmt>'.$CrLf;
|
||||
$XML_DEBITOR .=' <DrctDbtTx>'.$CrLf;
|
||||
@ -1636,9 +1636,9 @@ class BonPrelevement extends CommonObject
|
||||
$XML_DEBITOR .=' </Id>'.$CrLf;
|
||||
$XML_DEBITOR .=' </DbtrAcct>'.$CrLf;
|
||||
$XML_DEBITOR .=' <RmtInf>'.$CrLf;
|
||||
// $XML_DEBITOR .=' <Ustrd>'.($row_facnumber.'/'.$Rowing.'/'.$Rum).'</Ustrd>'.$CrLf;
|
||||
// $XML_DEBITOR .=' <Ustrd>'.dol_trunc($row_facnumber, 135).'</Ustrd>'.$CrLf; // 140 max
|
||||
$XML_DEBITOR .=' <Ustrd>'.(($conf->global->USTRD != "" ) ? $conf->global->USTRD : dol_trunc($row_facnumber, 135) ).'</Ustrd>'.$CrLf; // 140 max
|
||||
// $XML_DEBITOR .=' <Ustrd>'.($row_ref.'/'.$Rowing.'/'.$Rum).'</Ustrd>'.$CrLf;
|
||||
// $XML_DEBITOR .=' <Ustrd>'.dol_trunc($row_ref, 135).'</Ustrd>'.$CrLf; // 140 max
|
||||
$XML_DEBITOR .=' <Ustrd>'.(($conf->global->USTRD != "" ) ? $conf->global->USTRD : dol_trunc($row_ref, 135) ).'</Ustrd>'.$CrLf; // 140 max
|
||||
$XML_DEBITOR .=' </RmtInf>'.$CrLf;
|
||||
$XML_DEBITOR .=' </DrctDbtTxInf>'.$CrLf;
|
||||
return $XML_DEBITOR;
|
||||
|
||||
@ -166,18 +166,18 @@ if ($nb) {
|
||||
{
|
||||
if ($mysoc->isInEEC())
|
||||
{
|
||||
print '<a class="butActionRefused" href="#">'.$langs->trans("CreateForSepaFRST")."</a>\n";
|
||||
print '<a class="butActionRefused" href="#">'.$langs->trans("CreateForSepaRCUR")."</a>\n";
|
||||
print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans("CreateForSepaFRST")."</a>\n";
|
||||
print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans("CreateForSepaRCUR")."</a>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused" href="#">'.$langs->trans("CreateAll")."</a>\n";
|
||||
print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans("CreateAll")."</a>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NoInvoiceToWithdraw", $langs->transnoentitiesnoconv("StandingOrders"))).'">'.$langs->trans("CreateAll")."</a>\n";
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NoInvoiceToWithdraw", $langs->transnoentitiesnoconv("StandingOrders"))).'">'.$langs->trans("CreateAll")."</a>\n";
|
||||
}
|
||||
|
||||
print "</div>\n";
|
||||
@ -188,7 +188,7 @@ print '<br>';
|
||||
* Invoices waiting for withdraw
|
||||
*/
|
||||
|
||||
$sql = "SELECT f.facnumber, f.rowid, f.total_ttc, s.nom as name, s.rowid as socid,";
|
||||
$sql = "SELECT f.ref, f.rowid, f.total_ttc, s.nom as name, s.rowid as socid,";
|
||||
$sql.= " pfd.date_demande, pfd.amount";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."societe as s,";
|
||||
@ -249,7 +249,7 @@ if ($resql)
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>';
|
||||
$invoicestatic->id=$obj->rowid;
|
||||
$invoicestatic->ref=$obj->facnumber;
|
||||
$invoicestatic->ref=$obj->ref;
|
||||
print $invoicestatic->getNomUrl(1,'withdraw');
|
||||
print '</td>';
|
||||
// Thirdparty
|
||||
@ -303,7 +303,7 @@ print load_fiche_titre($langs->trans("LastWithdrawalReceipts",$limit),'','');
|
||||
$sql = "SELECT p.rowid, p.ref, p.amount, p.statut";
|
||||
$sql.= ", p.datec";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
||||
$sql.= " WHERE p.entity IN (".getEntity('facture').")";
|
||||
$sql.= " WHERE p.entity IN (".getEntity('invoice').")";
|
||||
$sql.= " ORDER BY datec DESC";
|
||||
$sql.=$db->plimit($limit);
|
||||
|
||||
|
||||
@ -52,7 +52,7 @@ $offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
if (! $sortfield) $sortfield="f.facnumber";
|
||||
if (! $sortfield) $sortfield="f.ref";
|
||||
|
||||
|
||||
/*
|
||||
@ -66,7 +66,7 @@ $invoicestatic=new Facture($db);
|
||||
|
||||
// List of requests
|
||||
|
||||
$sql= "SELECT f.facnumber, f.rowid, f.total_ttc,";
|
||||
$sql= "SELECT f.ref, f.rowid, f.total_ttc,";
|
||||
$sql.= " s.nom as name, s.rowid as socid,";
|
||||
$sql.= " pfd.date_demande as date_demande,";
|
||||
$sql.= " pfd.fk_user_demande";
|
||||
@ -138,7 +138,7 @@ if ($resql)
|
||||
// Ref facture
|
||||
print '<td>';
|
||||
$invoicestatic->id=$obj->rowid;
|
||||
$invoicestatic->ref=$obj->facnumber;
|
||||
$invoicestatic->ref=$obj->ref;
|
||||
print $invoicestatic->getNomUrl(1,'withdraw');
|
||||
print '</td>';
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user