Merge remote-tracking branch 'Dolibarr/13.0' into 13
This commit is contained in:
commit
57e1ff2b7c
@ -55,8 +55,7 @@ ONLY vulnerabilities discovered, when the following setup on test platform is us
|
||||
* $dolibarr_nocsrfcheck must be kept to the value 0 into conf.php (this is the default value)
|
||||
* $dolibarr_main_force_https must be set to something else than 0.
|
||||
* The constant MAIN_SECURITY_CSRF_WITH_TOKEN must be set to 1 into backoffice menu Home - Setup - Other (this protection should be set to 1 soon by default)
|
||||
* The module DebugBar must NOT be enabled (by default, this module is not enabled. This is a developer tool)
|
||||
* The module ModuleBuilder must NOT be enabled (by default, this module is not enabled. This is a developer tool)
|
||||
* The module DebugBar and ModuleBuilder must NOT be enabled (by default, this module is not enabled. This is a developer tool)
|
||||
* ONLY security reports on modules provided by default and with the "stable" status are valid (troubles into "experimental", "developement" or external modules are not valid vulnerabilities).
|
||||
* The root of web server must link to htdocs and the documents directory must be outside of the web server root (this is the default when using the default installer but may differs with external installer).
|
||||
* The web server setup must be done so only the documents directory is in write mode. The root directory called htdocs must be readonly.
|
||||
|
||||
102
build.xml
102
build.xml
@ -1,102 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Script build for hudson CI -->
|
||||
<project name="dolibarr" default="hudson" basedir=".">
|
||||
<!-- Exclude/ignore paths -->
|
||||
<property name="ignorepaths" value="${basedir}/htdocs/conf,${basedir}/htdocs/core/filemanagerdol,${basedir}/htdocs/includes" />
|
||||
<property name="ignoreregexp" value="**/PEAR/*,**/NET/*,**/HTTP/*,**/zendgdata/*,**/reportico/*" />
|
||||
|
||||
<target name="clean">
|
||||
<!-- Clean up -->
|
||||
<delete dir="${basedir}/hudson"/>
|
||||
<delete dir="${basedir}/generatedJUnitFiles"/>
|
||||
|
||||
<!-- Create build directories -->
|
||||
<mkdir dir="${basedir}/hudson/doxygen"/>
|
||||
<mkdir dir="${basedir}/hudson/logs"/>
|
||||
<mkdir dir="${basedir}/hudson/coverage"/>
|
||||
</target>
|
||||
|
||||
<!-- Run phpmd, phpcpd, phpcs, doxygen and phploc in parallel -->
|
||||
<target name="parallelTasks">
|
||||
<parallel>
|
||||
<!-- <antcall target="phpmd"/> -->
|
||||
<antcall target="phpcpd"/>
|
||||
<!-- <antcall target="phpcs"/> -->
|
||||
<antcall target="doxygen"/>
|
||||
<antcall target="phploc"/>
|
||||
</parallel>
|
||||
</target>
|
||||
|
||||
<!-- Generate pmd.xml -->
|
||||
<!--
|
||||
<target name="phpmd">
|
||||
<exec executable="phpmd">
|
||||
<arg line="htdocs xml codesize,unusedcode
|
||||
-\-reportfile '${basedir}/hudson/logs/pmd.xml'
|
||||
-\-ignore=${ignorepaths}
|
||||
" />
|
||||
</exec>
|
||||
</target>
|
||||
-->
|
||||
|
||||
<!-- Generate pmd-cpd.xml -->
|
||||
<target name="phpcpd">
|
||||
<exec executable="phpcpd">
|
||||
<arg line=" --log-pmd '${basedir}/hudson/logs/pmd-cpd.xml'
|
||||
--exclude '${basedir}/htdocs/conf'
|
||||
--exclude '${basedir}/htdocs/core/filemanagerdol'
|
||||
--exclude '${basedir}/htdocs/includes'
|
||||
--exclude '**/PEAR/*,**/NET/*,**/HTTP/*,**/zendgdata/*,**/reportico/*'
|
||||
--min-tokens 70
|
||||
--min-lines 20
|
||||
htdocs
|
||||
" />
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<!-- Generate phploc.csv -->
|
||||
<target name="phploc">
|
||||
<exec executable="phploc">
|
||||
<arg line=" --log-csv '${basedir}/hudson/logs/phploc.csv'
|
||||
--exclude '${basedir}/htdocs/conf'
|
||||
--exclude '${basedir}/htdocs/core/filemanagerdol'
|
||||
--exclude '${basedir}/htdocs/includes'
|
||||
--exclude '**/PEAR/*,**/NET/*,**/HTTP/*,**/zendgdata/*,**/reportico/*'
|
||||
htdocs
|
||||
" />
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<!-- Generate checkstyle.xml -->
|
||||
<target name="phpcs">
|
||||
<exec executable="phpcs" dir="${basedir}">
|
||||
<arg line=" --standard=${basedir}/dev/codesniffer/jenkins_ruleset.xml
|
||||
--report=checkstyle
|
||||
--report-file=${basedir}/hudson/logs/checkstyle.xml
|
||||
--ignore=${ignorepaths},${ignoreregexp}
|
||||
htdocs
|
||||
"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<!-- Run unit tests and generate junit.xml and clover.xml -->
|
||||
<target name="phpunit">
|
||||
<exec executable="phpunit" dir="${basedir}" failonerror="true">
|
||||
<arg line=" --configuration ${basedir}/test/phpunit/phpunittest.xml
|
||||
--log-junit ${basedir}/hudson/logs/junit.xml
|
||||
--coverage-clover ${basedir}/hudson/coverage/clover.xml
|
||||
--coverage-html ${basedir}/hudson/coverage/
|
||||
test/phpunit/AllTests.php
|
||||
"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<!-- Generate Doxygen documentation -->
|
||||
<target name="doxygen" description="Dolibarr documentation" >
|
||||
<exec executable="doxygen" dir="${basedir}" failonerror="false">
|
||||
<arg value="${basedir}/build/doxygen/jenkins_doxygen.doxyfile"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="hudson" depends="clean,phpunit,phpcs,parallelTasks"/>
|
||||
</project>
|
||||
@ -238,18 +238,18 @@ if ($action == 'create') {
|
||||
print $formaccounting->select_account($object->account_parent, 'account_parent', 1, null, 0, 0, 'minwidth200');
|
||||
print '</td></tr>';
|
||||
|
||||
// Category
|
||||
print '<tr><td>'.$langs->trans("AccountingCategory").'</td>';
|
||||
print '<td>';
|
||||
$formaccounting->select_accounting_category($object->account_category, 'account_category', 1, 0, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Chart of accounts type
|
||||
print '<tr><td>'.$langs->trans("Pcgtype").'</td>';
|
||||
print '<td>';
|
||||
print '<input type="text" name="pcg_type" value="'.dol_escape_htmltag(GETPOSTISSET('pcg_type') ? GETPOST('pcg_type', 'alpha') : $object->pcg_type).'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Category
|
||||
print '<tr><td>'.$langs->trans("AccountingCategory").'</td>';
|
||||
print '<td>';
|
||||
$formaccounting->select_accounting_category($object->account_category, 'account_category', 1, 0, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print dol_get_fiche_end();
|
||||
@ -300,18 +300,18 @@ if ($action == 'create') {
|
||||
print $formaccounting->select_account($object->account_parent, 'account_parent', 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Category
|
||||
print '<tr><td>'.$langs->trans("AccountingCategory").'</td>';
|
||||
print '<td>';
|
||||
$formaccounting->select_accounting_category($object->account_category, 'account_category', 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Chart of accounts type
|
||||
print '<tr><td>'.$langs->trans("Pcgtype").'</td>';
|
||||
print '<td>';
|
||||
print '<input type="text" name="pcg_type" value="'.dol_escape_htmltag(GETPOSTISSET('pcg_type') ? GETPOST('pcg_type', 'alpha') : $object->pcg_type).'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Category
|
||||
print '<tr><td>'.$langs->trans("AccountingCategory").'</td>';
|
||||
print '<td>';
|
||||
$formaccounting->select_accounting_category($object->account_category, 'account_category', 1);
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
@ -78,7 +78,7 @@ $form = new Form($db);
|
||||
if (empty($search_date_start) && !GETPOSTISSET('formfilteraction'))
|
||||
{
|
||||
$sql = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear ";
|
||||
$sql .= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."'";
|
||||
$sql .= " WHERE date_start < '".$db->idate(dol_now())."' AND date_end > '".$db->idate(dol_now())."'";
|
||||
$sql .= $db->plimit(1);
|
||||
$res = $db->query($sql);
|
||||
if ($res->num_rows > 0) {
|
||||
@ -242,10 +242,12 @@ if ($action != 'export_csv')
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
$colspan = (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE) ? 5 : 4);
|
||||
|
||||
print '<table class="liste '.($moreforfilter ? "listwithfilterbefore" : "").'">';
|
||||
|
||||
print '<tr class="liste_titre_filter">';
|
||||
print '<td class="liste_titre" colspan="5">';
|
||||
print '<td class="liste_titre" colspan="'.$colspan.'">';
|
||||
print $langs->trans('From');
|
||||
print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array(), 1, 1, '');
|
||||
print ' ';
|
||||
@ -261,7 +263,7 @@ if ($action != 'export_csv')
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("AccountAccounting", $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("OpeningBalance", $_SERVER['PHP_SELF'], "", $param, "", 'class="right"', $sortfield, $sortorder);
|
||||
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) print_liste_field_titre("OpeningBalance", $_SERVER['PHP_SELF'], "", $param, "", 'class="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Balance", $_SERVER["PHP_SELF"], "", $param, "", 'class="right"', $sortfield, $sortorder);
|
||||
@ -278,22 +280,30 @@ if ($action != 'export_csv')
|
||||
|
||||
$accountingaccountstatic = new AccountingAccount($db);
|
||||
|
||||
$sql = "SELECT t.numero_compte, (SUM(t.debit) - SUM(t.credit)) as opening_balance";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as t";
|
||||
$sql .= " WHERE t.entity = ".$conf->entity; // Never do sharing into accounting features
|
||||
$sql .= " AND t.doc_date < '".$db->idate($search_date_start)."'";
|
||||
$sql .= " GROUP BY t.numero_compte";
|
||||
// TODO Debug - This feature is dangerous, it takes all the entries and adds all the accounts
|
||||
// without time and class limits (Class 6 and 7 accounts ???) and does not take into account the "a-nouveau" journal.
|
||||
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
|
||||
$sql = "SELECT t.numero_compte, (SUM(t.debit) - SUM(t.credit)) as opening_balance";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t";
|
||||
$sql .= " WHERE t.entity = " . $conf->entity; // Never do sharing into accounting features
|
||||
$sql .= " AND t.doc_date < '" . $db->idate($search_date_start) . "'";
|
||||
$sql .= " GROUP BY t.numero_compte";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
$nrows = $resql->num_rows;
|
||||
$opening_balances = array();
|
||||
for ($i = 0; $i < $nrows; $i++) {
|
||||
$arr = $resql->fetch_array();
|
||||
$opening_balances["'".$arr['numero_compte']."'"] = $arr['opening_balance'];
|
||||
$resql = $db->query($sql);
|
||||
$nrows = $resql->num_rows;
|
||||
$opening_balances = array();
|
||||
for ($i = 0; $i < $nrows; $i++) {
|
||||
$arr = $resql->fetch_array();
|
||||
$opening_balances["'" . $arr['numero_compte'] . "'"] = $arr['opening_balance'];
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($object->lines as $line)
|
||||
{
|
||||
// reset before the fetch (in case of the fetch fails)
|
||||
$accountingaccountstatic->id = 0;
|
||||
$accountingaccountstatic->account_number = '';
|
||||
|
||||
$accountingaccountstatic->fetch(null, $line->numero_compte, true);
|
||||
if (!empty($accountingaccountstatic->account_number)) {
|
||||
$accounting_account = $accountingaccountstatic->getNomUrl(0, 1);
|
||||
@ -311,8 +321,8 @@ if ($action != 'export_csv')
|
||||
$root_account_description = $tmparrayforrootaccount['label'];
|
||||
$root_account_number = $tmparrayforrootaccount['account_number'];
|
||||
|
||||
if (empty($accountingaccountstatic->account_number)) {
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/accountancy/admin/card.php?action=create&accountingaccount='.length_accountg($line->numero_compte).'">'.img_edit_add().'</a>';
|
||||
if (empty($accountingaccountstatic->label) && $accountingaccountstatic->id > 0) {
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/accountancy/admin/card.php?action=update&token='.newToken().'&id='.$accountingaccountstatic->id.'">'.img_edit().'</a>';
|
||||
}
|
||||
|
||||
if (!empty($show_subgroup))
|
||||
@ -322,17 +332,22 @@ if ($action != 'export_csv')
|
||||
// Show subtotal per accounting account
|
||||
if ($displayed_account != "") {
|
||||
print '<tr class="liste_total">';
|
||||
print '<td class="right" colspan="2">'.$langs->trans("SubTotal").':</td>';
|
||||
print '<td class="right">'.$langs->trans("SubTotal").':</td>';
|
||||
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) print '<td class="nowrap right">'.price($sous_total_opening_balance).'</td>';
|
||||
print '<td class="nowrap right">'.price($sous_total_debit).'</td>';
|
||||
print '<td class="nowrap right">'.price($sous_total_credit).'</td>';
|
||||
print '<td class="nowrap right">'.price(price2num($sous_total_opening_balance + $sous_total_credit - $sous_total_debit)).'</td>';
|
||||
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
|
||||
print '<td class="nowrap right">'.price(price2num($sous_total_opening_balance + $sous_total_debit - $sous_total_credit)).'</td>';
|
||||
} else {
|
||||
print '<td class="nowrap right">'.price(price2num($sous_total_debit - $sous_total_credit)).'</td>';
|
||||
}
|
||||
print "<td></td>\n";
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Show first line of a break
|
||||
print '<tr class="trforbreak">';
|
||||
print '<td colspan="6" style="font-weight:bold; border-bottom: 1pt solid black;">'.$line->numero_compte.($root_account_description ? ' - '.$root_account_description : '').'</td>';
|
||||
print '<td colspan="'.($colspan+1).'" style="font-weight:bold; border-bottom: 1pt solid black;">'.$line->numero_compte.($root_account_description ? ' - '.$root_account_description : '').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$displayed_account = $root_account_number;
|
||||
@ -344,10 +359,14 @@ if ($action != 'export_csv')
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$accounting_account.'</td>';
|
||||
print '<td class="nowraponall right">'.price($opening_balance).'</td>';
|
||||
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) print '<td class="nowraponall right">'.price($opening_balance).'</td>';
|
||||
print '<td class="nowraponall right">'.price($line->debit).'</td>';
|
||||
print '<td class="nowraponall right">'.price($line->credit).'</td>';
|
||||
print '<td class="nowraponall right">'.price(price2num($opening_balance + $line->debit - $line->credit, 'MT')).'</td>';
|
||||
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
|
||||
print '<td class="nowraponall right">'.price(price2num($opening_balance + $line->debit - $line->credit, 'MT')).'</td>';
|
||||
} else {
|
||||
print '<td class="nowraponall right">'.price(price2num($line->debit - $line->credit, 'MT')).'</td>';
|
||||
}
|
||||
print '<td class="center">'.$link;
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
@ -360,12 +379,28 @@ if ($action != 'export_csv')
|
||||
|
||||
if (!empty($show_subgroup))
|
||||
{
|
||||
print '<tr class="liste_total"><td class="right" colspan="2">'.$langs->trans("SubTotal").':</td><td class="nowrap right">'.price($sous_total_debit).'</td><td class="nowrap right">'.price($sous_total_credit).'</td><td class="nowrap right">'.price(price2num($sous_total_opening_balance + $sous_total_debit - $sous_total_credit, 'MT')).'</td>';
|
||||
print '<tr class="liste_total"><td class="right">'.$langs->trans("SubTotal").':</td>';
|
||||
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) print '<td class="nowrap right">'.price($sous_total_opening_balance).'</td>';
|
||||
print '<td class="nowrap right">'.price($sous_total_debit).'</td>';
|
||||
print '<td class="nowrap right">'.price($sous_total_credit).'</td>';
|
||||
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
|
||||
print '<td class="nowrap right">' . price(price2num($sous_total_opening_balance + $sous_total_debit - $sous_total_credit, 'MT')) . '</td>';
|
||||
} else {
|
||||
print '<td class="nowrap right">' . price(price2num($sous_total_debit - $sous_total_credit, 'MT')) . '</td>';
|
||||
}
|
||||
print "<td></td>\n";
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '<tr class="liste_total"><td class="right" colspan="2">'.$langs->trans("AccountBalance").':</td><td class="nowrap right">'.price($total_debit).'</td><td class="nowrap right">'.price($total_credit).'</td><td class="nowrap right">'.price(price2num($total_opening_balance + $total_debit - $total_credit, 'MT')).'</td>';
|
||||
print '<tr class="liste_total"><td class="right">'.$langs->trans("AccountBalance").':</td>';
|
||||
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) print '<td class="nowrap right">'.price($total_opening_balance).'</td>';
|
||||
print '<td class="nowrap right">'.price($total_debit).'</td>';
|
||||
print '<td class="nowrap right">'.price($total_credit).'</td>';
|
||||
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
|
||||
print '<td class="nowrap right">' . price(price2num($total_opening_balance + $total_debit - $total_credit, 'MT')) . '</td>';
|
||||
} else {
|
||||
print '<td class="nowrap right">' . price(price2num($total_debit - $total_credit, 'MT')) . '</td>';
|
||||
}
|
||||
print "<td></td>\n";
|
||||
print '</tr>';
|
||||
|
||||
|
||||
@ -749,40 +749,42 @@ while ($i < min($num, $limit))
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Show sub-total of last shown account
|
||||
if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) {
|
||||
$colnumber = 3;
|
||||
$colnumberend = 7;
|
||||
} else {
|
||||
$colnumber = 4;
|
||||
$colnumberend = 7;
|
||||
if ($num > 0) {
|
||||
// Show sub-total of last shown account
|
||||
if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) {
|
||||
$colnumber = 3;
|
||||
$colnumberend = 7;
|
||||
} else {
|
||||
$colnumber = 4;
|
||||
$colnumberend = 7;
|
||||
}
|
||||
$colspan = $totalarray['nbfield'] - $colnumber;
|
||||
$colspanend = $totalarray['nbfield'] - $colnumberend;
|
||||
print '<tr class="liste_total">';
|
||||
print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("TotalForAccount").' '.$accountg.':</td>';
|
||||
print '<td class="nowrap right">'.price($sous_total_debit).'</td>';
|
||||
print '<td class="nowrap right">'.price($sous_total_credit).'</td>';
|
||||
print '<td colspan="'.$colspanend.'"></td>';
|
||||
print '</tr>';
|
||||
// Show balance of last shown account
|
||||
$balance = $sous_total_debit - $sous_total_credit;
|
||||
print '<tr class="liste_total">';
|
||||
print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("Balance").':</td>';
|
||||
if ($balance > 0)
|
||||
{
|
||||
print '<td class="nowraponall right">';
|
||||
print price($sous_total_debit - $sous_total_credit);
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
} else {
|
||||
print '<td></td>';
|
||||
print '<td class="nowraponall right">';
|
||||
print price($sous_total_credit - $sous_total_debit);
|
||||
print '</td>';
|
||||
}
|
||||
print '<td colspan="'.$colspanend.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
$colspan = $totalarray['nbfield'] - $colnumber;
|
||||
$colspanend = $totalarray['nbfield'] - $colnumberend;
|
||||
print '<tr class="liste_total">';
|
||||
print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("TotalForAccount").' '.$accountg.':</td>';
|
||||
print '<td class="nowrap right">'.price($sous_total_debit).'</td>';
|
||||
print '<td class="nowrap right">'.price($sous_total_credit).'</td>';
|
||||
print '<td colspan="'.$colspanend.'"></td>';
|
||||
print '</tr>';
|
||||
// Show balance of last shown account
|
||||
$balance = $sous_total_debit - $sous_total_credit;
|
||||
print '<tr class="liste_total">';
|
||||
print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("Balance").':</td>';
|
||||
if ($balance > 0)
|
||||
{
|
||||
print '<td class="nowraponall right">';
|
||||
print price($sous_total_debit - $sous_total_credit);
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
} else {
|
||||
print '<td></td>';
|
||||
print '<td class="nowraponall right">';
|
||||
print price($sous_total_credit - $sous_total_debit);
|
||||
print '</td>';
|
||||
}
|
||||
print '<td colspan="'.$colspanend.'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Show total line
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
||||
|
||||
@ -761,40 +761,42 @@ while ($i < min($num, $limit))
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Show sub-total of last shown account
|
||||
if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) {
|
||||
$colnumber = 3;
|
||||
$colnumberend = 7;
|
||||
} else {
|
||||
$colnumber = 4;
|
||||
$colnumberend = 7;
|
||||
if ($num > 0) {
|
||||
// Show sub-total of last shown account
|
||||
if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) {
|
||||
$colnumber = 3;
|
||||
$colnumberend = 7;
|
||||
} else {
|
||||
$colnumber = 4;
|
||||
$colnumberend = 7;
|
||||
}
|
||||
$colspan = $totalarray['nbfield'] - $colnumber;
|
||||
$colspanend = $totalarray['nbfield'] - $colnumberend;
|
||||
print '<tr class="liste_total">';
|
||||
print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("TotalForAccount").' '.$accountg.':</td>';
|
||||
print '<td class="nowrap right">'.price($sous_total_debit).'</td>';
|
||||
print '<td class="nowrap right">'.price($sous_total_credit).'</td>';
|
||||
print '<td colspan="'.$colspanend.'"></td>';
|
||||
print '</tr>';
|
||||
// Show balance of last shown account
|
||||
$balance = $sous_total_debit - $sous_total_credit;
|
||||
print '<tr class="liste_total">';
|
||||
print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("Balance").':</td>';
|
||||
if ($balance > 0)
|
||||
{
|
||||
print '<td class="nowraponall right">';
|
||||
print price($sous_total_debit - $sous_total_credit);
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
} else {
|
||||
print '<td></td>';
|
||||
print '<td class="nowraponall right">';
|
||||
print price($sous_total_credit - $sous_total_debit);
|
||||
print '</td>';
|
||||
}
|
||||
print '<td colspan="'.$colspanend.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
$colspan = $totalarray['nbfield'] - $colnumber;
|
||||
$colspanend = $totalarray['nbfield'] - $colnumberend;
|
||||
print '<tr class="liste_total">';
|
||||
print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("TotalForAccount").' '.$accountg.':</td>';
|
||||
print '<td class="nowrap right">'.price($sous_total_debit).'</td>';
|
||||
print '<td class="nowrap right">'.price($sous_total_credit).'</td>';
|
||||
print '<td colspan="'.$colspanend.'"></td>';
|
||||
print '</tr>';
|
||||
// Show balance of last shown account
|
||||
$balance = $sous_total_debit - $sous_total_credit;
|
||||
print '<tr class="liste_total">';
|
||||
print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("Balance").':</td>';
|
||||
if ($balance > 0)
|
||||
{
|
||||
print '<td class="nowraponall right">';
|
||||
print price($sous_total_debit - $sous_total_credit);
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
} else {
|
||||
print '<td></td>';
|
||||
print '<td class="nowraponall right">';
|
||||
print price($sous_total_credit - $sous_total_debit);
|
||||
print '</td>';
|
||||
}
|
||||
print '<td colspan="'.$colspanend.'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Show total line
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
||||
|
||||
@ -25,11 +25,16 @@
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("compta", "bills", "other", "main", "accountancy"));
|
||||
|
||||
$socid = GETPOST('socid', 'int');
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
// Security check
|
||||
if (empty($conf->accounting->enabled)) {
|
||||
accessforbidden();
|
||||
@ -39,6 +44,7 @@ if ($user->socid > 0)
|
||||
if (!$user->rights->accounting->fiscalyear->write)
|
||||
accessforbidden();
|
||||
|
||||
$object = new BookKeeping($db);
|
||||
|
||||
$month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
|
||||
if (GETPOST("year", 'int')) $year_start = GETPOST("year", 'int');
|
||||
@ -60,14 +66,91 @@ $year_current = $year_start;
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
if ($action == 'validate_movements_confirm' && $user->rights->accounting->fiscalyear->write) {
|
||||
$result = $object->fetchAll();
|
||||
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
} else {
|
||||
// Specify as export : update field date_validated on selected month/year
|
||||
$error = 0;
|
||||
$db->begin();
|
||||
|
||||
$date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
|
||||
$date_end = dol_mktime(23, 59, 59, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));
|
||||
|
||||
if (is_array($object->lines))
|
||||
{
|
||||
foreach ($object->lines as $movement)
|
||||
{
|
||||
$now = dol_now();
|
||||
|
||||
$sql = " UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping";
|
||||
$sql .= " SET date_validated = '".$db->idate($now)."'";
|
||||
$sql .= " WHERE rowid = ".$movement->id;
|
||||
$sql .= " AND doc_date >= '" . dol_print_date($date_start, 'dayrfc') . "'";
|
||||
$sql .= " AND doc_date <= '" . dol_print_date($date_end, 'dayrfc') . "'";
|
||||
|
||||
dol_syslog("/accountancy/closure/index.php :: Function validate_movement_confirm Specify movements as validated sql=".$sql, LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if (!$result)
|
||||
{
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("AllMovementsWereRecordedAsValidated"), null, 'mesgs');
|
||||
} else {
|
||||
$error++;
|
||||
$db->rollback();
|
||||
setEventMessages($langs->trans("NotAllMovementsCouldBeRecordedAsValidated"), null, 'errors');
|
||||
}
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?year=".$year_start);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
$formaccounting = new FormAccounting($db);
|
||||
|
||||
llxHeader('', $langs->trans("Closure"));
|
||||
|
||||
if ($action == 'validate_movements') {
|
||||
$form_question = array();
|
||||
|
||||
$month = isset($conf->global->SOCIETE_FISCAL_MONTH_START) ? intval($conf->global->SOCIETE_FISCAL_MONTH_START) : 1;
|
||||
$date_start = new DateTime(sprintf('%04d-%02d-%02d', $year_start, $month, 1));
|
||||
$date_end = new DateTime(sprintf('%04d-%02d-%02d', $year_start, $month, 1));
|
||||
$date_end->add(new DateInterval('P1Y'));
|
||||
$date_end->sub(new DateInterval('P1D'));
|
||||
|
||||
$form_question['date_start'] = array(
|
||||
'name' => 'date_start',
|
||||
'type' => 'date',
|
||||
'label' => $langs->trans('DateStart'),
|
||||
'value' => $date_start->format('Y-m-d')
|
||||
);
|
||||
$form_question['date_end'] = array(
|
||||
'name' => 'date_end',
|
||||
'type' => 'date',
|
||||
'label' => $langs->trans('DateEnd'),
|
||||
'value' => $date_end->format('Y-m-d')
|
||||
);
|
||||
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?year='.$year_start, $langs->trans('ValidateMovements'), $langs->trans('DescValidateMovements', $langs->transnoentitiesnoconv("RegistrationInAccounting")), 'validate_movements_confirm', $form_question, '', 1, 300);
|
||||
print $formconfirm;
|
||||
}
|
||||
|
||||
$textprevyear = '<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_current - 1).'">'.img_previous().'</a>';
|
||||
$textnextyear = ' <a href="'.$_SERVER["PHP_SELF"].'?year='.($year_current + 1).'">'.img_next().'</a>';
|
||||
|
||||
@ -80,9 +163,9 @@ print '<br>';
|
||||
|
||||
$y = $year_current;
|
||||
|
||||
$buttonbind = '<a class="butAction" href="./validate.php">'.$langs->trans("ValidateMovements").'</a>';
|
||||
$buttonvalidate = '<a class="butAction" name="button_validate_movements" href="'.$_SERVER["PHP_SELF"].'?action=validate_movements&year='.$year_start.'">'.$langs->trans("ValidateMovements").'</a>';
|
||||
|
||||
print_barre_liste($langs->trans("OverviewOfMovementsNotValidated"), '', '', '', '', '', '', -1, '', '', 0, $buttonbind, '', 0, 1, 1);
|
||||
print_barre_liste($langs->trans("OverviewOfMovementsNotValidated"), '', '', '', '', '', '', -1, '', '', 0, $buttonvalidate, '', 0, 1, 1);
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
@ -104,6 +187,7 @@ $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as b";
|
||||
$sql .= " WHERE b.doc_date >= '".$db->idate($search_date_start)."'";
|
||||
$sql .= " AND b.doc_date <= '".$db->idate($search_date_end)."'";
|
||||
$sql .= " AND b.entity IN (".getEntity('bookkeeping', 0).")"; // We don't share object for accountancy
|
||||
$sql .= " AND date_validated IS NULL";
|
||||
|
||||
dol_syslog('htdocs/accountancy/closure/index.php sql='.$sql, LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
|
||||
@ -1,156 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2019 Open-DSI <support@open-dsi.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/accountancy/closure/validate.php
|
||||
* \ingroup Accountancy
|
||||
* \brief Validate entries page
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("compta", "bills", "other", "main", "accountancy"));
|
||||
|
||||
// Security check
|
||||
if (empty($conf->accounting->enabled)) {
|
||||
accessforbidden();
|
||||
}
|
||||
if ($user->socid > 0)
|
||||
accessforbidden();
|
||||
if (!$user->rights->accounting->fiscalyear->write)
|
||||
accessforbidden();
|
||||
|
||||
|
||||
$month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
|
||||
if (GETPOST("year", 'int')) $year_start = GETPOST("year", 'int');
|
||||
else {
|
||||
$year_start = dol_print_date(dol_now(), '%Y');
|
||||
if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year
|
||||
}
|
||||
$year_end = $year_start + 1;
|
||||
$month_end = $month_start - 1;
|
||||
if ($month_end < 1)
|
||||
{
|
||||
$month_end = 12;
|
||||
$year_end--;
|
||||
}
|
||||
$search_date_start = dol_mktime(0, 0, 0, $month_start, 1, $year_start);
|
||||
$search_date_end = dol_get_last_day($year_end, $month_end);
|
||||
$year_current = $year_start;
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'validate')
|
||||
{
|
||||
$now = dol_now();
|
||||
|
||||
// Update database
|
||||
$db->begin();
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping as b";
|
||||
$sql .= " SET b.date_validated = '".$db->idate($now)."'";
|
||||
$sql .= ' WHERE b.date_validated IS NULL';
|
||||
|
||||
dol_syslog("htdocs/accountancy/closure/validate.php validate", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql1) {
|
||||
$error++;
|
||||
$db->rollback();
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
} else {
|
||||
$db->commit();
|
||||
}
|
||||
// End clean database
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('', $langs->trans("ValidateMovements"));
|
||||
|
||||
$textprevyear = '<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_current - 1).'">'.img_previous().'</a>';
|
||||
$textnextyear = ' <a href="'.$_SERVER["PHP_SELF"].'?year='.($year_current + 1).'">'.img_next().'</a>';
|
||||
|
||||
|
||||
print load_fiche_titre($langs->trans("ValidateMovements")." ".$textprevyear." ".$langs->trans("Year")." ".$year_start." ".$textnextyear, '', 'title_accountancy');
|
||||
|
||||
print $langs->trans("DescValidateMovements").'<br>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
$y = $year_current;
|
||||
|
||||
print_barre_liste($langs->trans("SelectMonthAndValidate"), '', '', '', '', '', '', -1, '', '', 0, '', 'class="right"', 0, 1, 1);
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="oddeven">';
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
|
||||
if ($j > 12) $j -= 12;
|
||||
print '<td class="center">'.$langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT)).'</td>';
|
||||
}
|
||||
print '<td><b>'.$langs->trans("Total").'</b></td></tr>';
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
$sql = "SELECT COUNT(b.rowid) as detail,";
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
|
||||
if ($j > 12) $j -= 12;
|
||||
$sql .= " SUM(".$db->ifsql('MONTH(b.doc_date)='.$j, '1', '0').") AS month".str_pad($j, 2, '0', STR_PAD_LEFT).",";
|
||||
}
|
||||
$sql .= " COUNT(b.rowid) as total";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as b";
|
||||
$sql .= " WHERE b.doc_date >= '".$db->idate($search_date_start)."'";
|
||||
$sql .= " AND b.doc_date <= '".$db->idate($search_date_end)."'";
|
||||
$sql .= " AND b.entity IN (".getEntity('bookkeeping', 0).")"; // We don't share object for accountancy
|
||||
|
||||
dol_syslog('htdocs/accountancy/closure/index.php sql='.$sql, LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ($row = $db->fetch_row($resql)) {
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
print '<td class="nowrap center">'.$row[$i].'<br><br>';
|
||||
print '<input id="cb'.$row[$i].'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$row[$i].'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
print '</td>';
|
||||
}
|
||||
print '<td class="valigntop"><b>'.$row[13].'</b></td>';
|
||||
}
|
||||
|
||||
$db->free($resql);
|
||||
} else {
|
||||
print $db->lasterror(); // Show last sql error
|
||||
}
|
||||
print '</tr>';
|
||||
print "</table>\n";
|
||||
|
||||
print '<br><div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?month='.$year_current.'&action=validate"">'.$langs->trans("ValidateMovements").'</a></div>';
|
||||
print '</div>';
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@ -1761,7 +1761,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
if ($linktoelem) print ($somethingshown?'':'<br>').$linktoelem;
|
||||
*/
|
||||
|
||||
// Shon online payment link
|
||||
// Show online payment link
|
||||
$useonlinepayment = (!empty($conf->paypal->enabled) || !empty($conf->stripe->enabled) || !empty($conf->paybox->enabled));
|
||||
|
||||
if ($useonlinepayment) {
|
||||
|
||||
@ -299,7 +299,7 @@ if (empty($mysoc->country_code))
|
||||
print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU');
|
||||
print " x ".$langs->trans("Quantity").": ".$qty;
|
||||
print " - ".$langs->trans("VAT").": ".$vat.'%';
|
||||
print ' -> <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").": ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."<br>\n";
|
||||
print ' -> <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").":</span> ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."<br>\n";
|
||||
|
||||
$s = 10 / 3; $qty = 2; $vat = 10;
|
||||
$tmparray = calcul_price_total($qty, price2num($s, 'MU'), 0, $vat, -1, -1, 0, 'HT', 0, 0, $mysoc, $localtax_array);
|
||||
|
||||
@ -475,24 +475,22 @@ print load_fiche_titre($langs->trans("ModulesSetup"), '', 'title_setup');
|
||||
if ($mode == 'common' || $mode == 'commonkanban') {
|
||||
$desc = $langs->trans("ModulesDesc", '{picto}');
|
||||
$desc = str_replace('{picto}', img_picto('', 'switch_off'), $desc);
|
||||
print '<span class="opacitymedium hideonsmartphone">'.$desc."<br></span>\n";
|
||||
print '<span class="opacitymedium hideonsmartphone">'.$desc."<br><br></span>\n";
|
||||
}
|
||||
if ($mode == 'marketplace') {
|
||||
print '<span class="opacitymedium hideonsmartphone">'.$langs->trans("ModulesMarketPlaceDesc")."<br></span>\n";
|
||||
print '<span class="opacitymedium hideonsmartphone">'.$langs->trans("ModulesMarketPlaceDesc")."<br><br></span>\n";
|
||||
}
|
||||
if ($mode == 'deploy') {
|
||||
print '<span class="opacitymedium hideonsmartphone">'.$langs->trans("ModulesDeployDesc", $langs->transnoentitiesnoconv("AvailableModules"))."<br></span>\n";
|
||||
print '<span class="opacitymedium hideonsmartphone">'.$langs->trans("ModulesDeployDesc", $langs->transnoentitiesnoconv("AvailableModules"))."<br><br></span>\n";
|
||||
}
|
||||
if ($mode == 'develop') {
|
||||
print '<span class="opacitymedium hideonsmartphone">'.$langs->trans("ModulesDevelopDesc")."<br></span>\n";
|
||||
print '<span class="opacitymedium hideonsmartphone">'.$langs->trans("ModulesDevelopDesc")."<br><br></span>\n";
|
||||
}
|
||||
|
||||
|
||||
$head = modules_prepare_head();
|
||||
|
||||
|
||||
print "<br>\n";
|
||||
|
||||
|
||||
if ($mode == 'common' || $mode == 'commonkanban') {
|
||||
dol_set_focus('#search_keyword');
|
||||
|
||||
@ -1139,7 +1137,7 @@ if ($mode == 'deploy') {
|
||||
|
||||
print '<input class="flat minwidth400" type="file" name="fileinstall" id="fileinstall"> ';
|
||||
|
||||
print '<input type="submit" name="send" value="'.dol_escape_htmltag($langs->trans("Send")).'" class="button">';
|
||||
print '<input type="submit" name="send" value="'.dol_escape_htmltag($langs->trans("Upload")).'" class="button">';
|
||||
|
||||
if (!empty($conf->global->MAIN_UPLOAD_DOC)) {
|
||||
if ($user->admin) {
|
||||
|
||||
@ -224,7 +224,7 @@ if (($thousand != ',' && $thousand != '.') || ($thousand != ' '))
|
||||
print '<tr class="oddeven"><td> => price(1234.56)</td><td>'.price(1234.56).'</td></tr>'."\n";
|
||||
// Timezone
|
||||
$txt = $langs->trans("OSTZ").' (variable system TZ): '.(!empty($_ENV["TZ"]) ? $_ENV["TZ"] : $langs->trans("NotDefined")).'<br>'."\n";
|
||||
$txt .= $langs->trans("PHPTZ").' (php.ini date.timezone): '.(ini_get("date.timezone") ?ini_get("date.timezone") : $langs->trans("NotDefined")).''."<br>\n"; // date.timezone must be in valued defined in http://fr3.php.net/manual/en/timezones.europe.php
|
||||
$txt .= $langs->trans("PHPTZ").' (date_default_timezone_get() / php.ini date.timezone): '.(getServerTimeZoneString()." / ".(ini_get("date.timezone") ? ini_get("date.timezone") : $langs->trans("NotDefined")))."<br>\n"; // date.timezone must be in valued defined in http://fr3.php.net/manual/en/timezones.europe.php
|
||||
$txt .= $langs->trans("Dolibarr constant MAIN_SERVER_TZ").': '.(empty($conf->global->MAIN_SERVER_TZ) ? $langs->trans("NotDefined") : $conf->global->MAIN_SERVER_TZ);
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("CurrentTimeZone").'</td><td>'; // Timezone server PHP
|
||||
$a = getServerTimeZoneInt('now');
|
||||
|
||||
@ -211,7 +211,7 @@ if ($result)
|
||||
if ($search_user) $param .= '&search_user='.urlencode($search_user);
|
||||
if ($search_desc) $param .= '&search_desc='.urlencode($search_desc);
|
||||
if ($search_ua) $param .= '&search_ua='.urlencode($search_ua);
|
||||
if ($search_prefix_sessiona) $param .= '&search_prefix_session='.urlencode($search_prefix_session);
|
||||
if ($search_prefix_session) $param .= '&search_prefix_session='.urlencode($search_prefix_session);
|
||||
if ($date_startmonth) $param .= "&date_startmonth=".urlencode($date_startmonth);
|
||||
if ($date_startday) $param .= "&date_startday=".urlencode($date_startday);
|
||||
if ($date_startyear) $param .= "&date_startyear=".urlencode($date_startyear);
|
||||
|
||||
@ -1146,6 +1146,8 @@ class Categorie extends CommonObject
|
||||
// First build full array $motherof
|
||||
//$this->load_motherof(); // Disabled because already done by caller of build_path_from_id_categ
|
||||
|
||||
// $this->cats[$id_categ] is supposed to be already an array. We just want to complete it with property fullpath and fulllabel
|
||||
|
||||
// Define fullpath and fulllabel
|
||||
$this->cats[$id_categ]['fullpath'] = '_'.$id_categ;
|
||||
$this->cats[$id_categ]['fulllabel'] = $this->cats[$id_categ]['label'];
|
||||
|
||||
@ -131,8 +131,8 @@ if (GETPOST('exportcsv', 'int'))
|
||||
header('Content-Disposition: attachment;filename='.$completefilename);
|
||||
|
||||
// List of selected targets
|
||||
$sql = "SELECT mc.rowid, mc.lastname, mc.firstname, mc.email, mc.other, mc.statut, mc.date_envoi, mc.tms,";
|
||||
$sql .= " mc.source_url, mc.source_id, mc.source_type, mc.error_text";
|
||||
$sql = "SELECT mc.rowid, mc.lastname, mc.firstname, mc.email, mc.other, mc.statut as status, mc.date_envoi, mc.tms,";
|
||||
$sql .= " mc.source_id, mc.source_type, mc.error_text";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc";
|
||||
$sql .= " WHERE mc.fk_mailing=".$object->id;
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
@ -146,16 +146,16 @@ if (GETPOST('exportcsv', 'int'))
|
||||
while ($obj = $db->fetch_object($resql))
|
||||
{
|
||||
print $obj->rowid.$sep;
|
||||
print $obj->lastname.$sep;
|
||||
print $obj->firstname.$sep;
|
||||
print '"'.$obj->lastname.'"'.$sep;
|
||||
print '"'.$obj->firstname.'"'.$sep;
|
||||
print $obj->email.$sep;
|
||||
print $obj->other.$sep;
|
||||
print $obj->date_envoi.$sep;
|
||||
print $obj->tms.$sep;
|
||||
print $obj->source_url.$sep;
|
||||
print $obj->source_id.$sep;
|
||||
print $obj->source_type.$sep;
|
||||
print $obj->error_text.$sep;
|
||||
print $obj->source_id.$sep;
|
||||
print $obj->date_envoi.$sep;
|
||||
print $obj->status.$sep;
|
||||
print '"'.$obj->error_text.'"'.$sep;
|
||||
print "\n";
|
||||
}
|
||||
|
||||
|
||||
@ -600,6 +600,7 @@ class Propal extends CommonObject
|
||||
// Clean vat code
|
||||
$reg = array();
|
||||
$vat_src_code = '';
|
||||
$reg = array();
|
||||
if (preg_match('/\((.*)\)/', $txtva, $reg))
|
||||
{
|
||||
$vat_src_code = $reg[1];
|
||||
@ -771,7 +772,9 @@ class Propal extends CommonObject
|
||||
$qty = price2num($qty);
|
||||
$pu = price2num($pu);
|
||||
$pu_ht_devise = price2num($pu_ht_devise);
|
||||
$txtva = price2num($txtva);
|
||||
if (!preg_match('/\((.*)\)/', $txtva)) {
|
||||
$txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5'
|
||||
}
|
||||
$txlocaltax1 = price2num($txlocaltax1);
|
||||
$txlocaltax2 = price2num($txlocaltax2);
|
||||
$pa_ht = price2num($pa_ht);
|
||||
|
||||
@ -631,9 +631,9 @@ if (empty($reshook))
|
||||
|
||||
// Set if we used free entry or predefined product
|
||||
$predef = '';
|
||||
$product_desc = (GETPOST('dp_desc') ?GETPOST('dp_desc') : '');
|
||||
$price_ht = GETPOST('price_ht');
|
||||
$price_ht_devise = GETPOST('multicurrency_price_ht');
|
||||
$product_desc = (GETPOSTISSET('dp_desc') ? GETPOST('dp_desc', 'restricthtml') : '');
|
||||
$price_ht = price2num(GETPOST('price_ht'), 'MU');
|
||||
$price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CR');
|
||||
$prod_entry_mode = GETPOST('prod_entry_mode');
|
||||
if ($prod_entry_mode == 'free')
|
||||
{
|
||||
|
||||
@ -3060,7 +3060,9 @@ class Commande extends CommonOrder
|
||||
$pu = price2num($pu);
|
||||
$pa_ht = price2num($pa_ht);
|
||||
$pu_ht_devise = price2num($pu_ht_devise);
|
||||
$txtva = price2num($txtva);
|
||||
if (!preg_match('/\((.*)\)/', $txtva)) {
|
||||
$txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5'
|
||||
}
|
||||
$txlocaltax1 = price2num($txlocaltax1);
|
||||
$txlocaltax2 = price2num($txlocaltax2);
|
||||
|
||||
|
||||
@ -200,7 +200,7 @@ class PaymentVarious extends CommonObject
|
||||
$sql .= " datev='".$this->db->idate($this->datev)."',";
|
||||
$sql .= " sens=".(int) $this->sens.",";
|
||||
$sql .= " amount=".price2num($this->amount).",";
|
||||
$sql .= " fk_typepayment=".(int) $this->fk_typepayment.",";
|
||||
$sql .= " fk_typepayment=".(int) $this->type_payment.",";
|
||||
$sql .= " num_payment='".$this->db->escape($this->num_payment)."',";
|
||||
$sql .= " label='".$this->db->escape($this->label)."',";
|
||||
$sql .= " note='".$this->db->escape($this->note)."',";
|
||||
|
||||
@ -408,7 +408,7 @@ if ($action == 'create')
|
||||
|
||||
// Subledger account
|
||||
if (!empty($conf->accounting->enabled)) {
|
||||
print '<tr><td>'.$langs->trans("SubledgerAccount").'aaaa</td>';
|
||||
print '<tr><td>'.$langs->trans("SubledgerAccount").'</td>';
|
||||
print '<td>';
|
||||
if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) {
|
||||
print $formaccounting->select_auxaccount($subledger_account, 'subledger_account', 1, '');
|
||||
|
||||
@ -437,9 +437,9 @@ if (empty($reshook))
|
||||
|
||||
// Set if we used free entry or predefined product
|
||||
$predef = '';
|
||||
$product_desc = (GETPOST('dp_desc') ?GETPOST('dp_desc') : '');
|
||||
$price_ht = GETPOST('price_ht');
|
||||
$price_ht_devise = GETPOST('multicurrency_price_ht');
|
||||
$product_desc = (GETPOSTISSET('dp_desc') ? GETPOST('dp_desc', 'restricthtml') : '');
|
||||
$price_ht = price2num(GETPOST('price_ht'), 'MU');
|
||||
$price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CR');
|
||||
$prod_entry_mode = GETPOST('prod_entry_mode', 'alpha');
|
||||
if ($prod_entry_mode == 'free')
|
||||
{
|
||||
@ -450,7 +450,7 @@ if (empty($reshook))
|
||||
$tva_tx = '';
|
||||
}
|
||||
|
||||
$qty = GETPOST('qty'.$predef);
|
||||
$qty = price2num(GETPOST('qty'.$predef), 'alpha');
|
||||
$remise_percent = GETPOST('remise_percent'.$predef);
|
||||
|
||||
// Extrafields
|
||||
|
||||
@ -4738,7 +4738,15 @@ if ($action == 'create')
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $paymentstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
print '<td>'.dol_print_date($db->jdate($objp->dp), 'dayhour').'</td>';
|
||||
print '<td>';
|
||||
$dateofpayment = $db->jdate($objp->dp);
|
||||
$tmparray = dol_getdate($dateofpayment);
|
||||
if ($tmparray['seconds'] == 0 && $tmparray['minutes'] == 0 && ($tmparray['hours'] == 0 || $tmparray['hours'] == 12)) { // We set hours to 0:00 or 12:00 because we don't know it
|
||||
print dol_print_date($dateofpayment, 'day');
|
||||
} else { // Hours was set to real date of payment (special case for POS for example)
|
||||
print dol_print_date($dateofpayment, 'dayhour', 'tzuser');
|
||||
}
|
||||
print '</td>';
|
||||
$label = ($langs->trans("PaymentType".$objp->payment_code) != ("PaymentType".$objp->payment_code)) ? $langs->trans("PaymentType".$objp->payment_code) : $objp->payment_label;
|
||||
print '<td>'.$label.' '.$objp->num_payment.'</td>';
|
||||
if (!empty($conf->banque->enabled))
|
||||
|
||||
@ -853,7 +853,9 @@ class FactureRec extends CommonInvoice
|
||||
$qty = price2num($qty);
|
||||
$pu_ht = price2num($pu_ht);
|
||||
$pu_ttc = price2num($pu_ttc);
|
||||
$txtva = price2num($txtva);
|
||||
if (!preg_match('/\((.*)\)/', $txtva)) {
|
||||
$txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5'
|
||||
}
|
||||
$txlocaltax1 = price2num($txlocaltax1);
|
||||
$txlocaltax2 = price2num($txlocaltax2);
|
||||
if (empty($txtva)) $txtva = 0;
|
||||
@ -1031,7 +1033,9 @@ class FactureRec extends CommonInvoice
|
||||
$pu_ht = price2num($pu_ht);
|
||||
$pu_ttc = price2num($pu_ttc);
|
||||
$pu_ht_devise = price2num($pu_ht_devise);
|
||||
$txtva = price2num($txtva);
|
||||
if (!preg_match('/\((.*)\)/', $txtva)) {
|
||||
$txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5'
|
||||
}
|
||||
$txlocaltax1 = price2num($txlocaltax1);
|
||||
$txlocaltax2 = price2num($txlocaltax2);
|
||||
if (empty($txlocaltax1)) $txlocaltax1 = 0;
|
||||
@ -1057,6 +1061,7 @@ class FactureRec extends CommonInvoice
|
||||
|
||||
// Clean vat code
|
||||
$vat_src_code = '';
|
||||
$reg = array();
|
||||
if (preg_match('/\((.*)\)/', $txtva, $reg))
|
||||
{
|
||||
$vat_src_code = $reg[1];
|
||||
|
||||
@ -3283,7 +3283,9 @@ class Facture extends CommonInvoice
|
||||
$pu = price2num($pu);
|
||||
$pu_ht_devise = price2num($pu_ht_devise);
|
||||
$pa_ht = price2num($pa_ht);
|
||||
$txtva = price2num($txtva);
|
||||
if (!preg_match('/\((.*)\)/', $txtva)) {
|
||||
$txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5'
|
||||
}
|
||||
$txlocaltax1 = price2num($txlocaltax1);
|
||||
$txlocaltax2 = price2num($txlocaltax2);
|
||||
|
||||
|
||||
@ -294,7 +294,7 @@ class Paiement extends CommonObject
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."paiement (entity, ref, ref_ext, datec, datep, amount, multicurrency_amount, fk_paiement, num_paiement, note, ext_payment_id, ext_payment_site, fk_user_creat, pos_change)";
|
||||
$sql .= " VALUES (".$conf->entity.", '".$this->db->escape($this->ref)."', '".$this->db->escape($this->ref_ext)."', '".$this->db->idate($now)."', '".$this->db->idate($this->datepaye)."', ".$total.", ".$mtotal.", ".$this->paiementid.", ";
|
||||
$sql .= "'".$this->db->escape($num_payment)."', '".$this->db->escape($note)."', ".($this->ext_payment_id ? "'".$this->db->escape($this->ext_payment_id)."'" : "null").", ".($this->ext_payment_site ? "'".$this->db->escape($this->ext_payment_site)."'" : "null").", ".$user->id.", ".((int) $this->pos_change).")";
|
||||
$sql .= "'".$this->db->escape($num_payment)."', '".$this->db->escape($note)."', ".($this->ext_payment_id ? "'".$this->db->escape($this->ext_payment_id)."'" : "null").", ".($this->ext_payment_site ? "'".$this->db->escape($this->ext_payment_site)."'" : "null").", ".$user->id.", ".((float) $this->pos_change).")";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
@ -1171,9 +1171,19 @@ class Paiement extends CommonObject
|
||||
if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips
|
||||
|
||||
$result = '';
|
||||
|
||||
$label = img_picto('', $this->picto).' <u>'.$langs->trans("Payment").'</u><br>';
|
||||
$label .= '<strong>'.$langs->trans("Ref").':</strong> '.$this->ref;
|
||||
if ($this->datepaye ? $this->datepaye : $this->date) $label .= '<br><strong>'.$langs->trans("Date").':</strong> '.dol_print_date($this->datepaye ? $this->datepaye : $this->date, 'dayhour');
|
||||
$dateofpayment = ($this->datepaye ? $this->datepaye : $this->date);
|
||||
if ($dateofpayment) {
|
||||
$label .= '<br><strong>'.$langs->trans("Date").':</strong> ';
|
||||
$tmparray = dol_getdate($dateofpayment);
|
||||
if ($tmparray['seconds'] == 0 && $tmparray['minutes'] == 0 && ($tmparray['hours'] == 0 || $tmparray['hours'] == 12)) { // We set hours to 0:00 or 12:00 because we don't know it
|
||||
$label .= dol_print_date($dateofpayment, 'day');
|
||||
} else { // Hours was set to real date of payment (special case for POS for example)
|
||||
$label .= dol_print_date($dateofpayment, 'dayhour', 'tzuser');
|
||||
}
|
||||
}
|
||||
if ($mode == 'withlistofinvoices')
|
||||
{
|
||||
$arraybill = $this->getBillsArray();
|
||||
|
||||
@ -89,6 +89,7 @@ $extralabelslines = $extrafields->fetch_name_optionals_label($object->table_elem
|
||||
$permissionnote = $user->rights->contrat->creer; // Used by the include of actions_setnotes.inc.php
|
||||
$permissiondellink = $user->rights->contrat->creer; // Used by the include of actions_dellink.inc.php
|
||||
|
||||
$error = 0;
|
||||
|
||||
|
||||
/*
|
||||
@ -383,9 +384,9 @@ if (empty($reshook))
|
||||
{
|
||||
// Set if we used free entry or predefined product
|
||||
$predef = '';
|
||||
$product_desc = (GETPOST('dp_desc') ?GETPOST('dp_desc') : '');
|
||||
$price_ht = price2num(GETPOST('price_ht'));
|
||||
$price_ht_devise = price2num(GETPOST('multicurrency_price_ht'));
|
||||
$product_desc = (GETPOSTISSET('dp_desc') ? GETPOST('dp_desc', 'restricthtml') : '');
|
||||
$price_ht = price2num(GETPOST('price_ht'), 'MU');
|
||||
$price_ht_devise = price2num(GETPOST('multicurrency_price_ht', 'CR'));
|
||||
if (GETPOST('prod_entry_mode', 'alpha') == 'free')
|
||||
{
|
||||
$idprod = 0;
|
||||
@ -395,7 +396,7 @@ if (empty($reshook))
|
||||
$tva_tx = '';
|
||||
}
|
||||
|
||||
$qty = price2num(GETPOST('qty'.$predef));
|
||||
$qty = price2num(GETPOST('qty'.$predef), 'alpha');
|
||||
$remise_percent = ((GETPOST('remise_percent'.$predef) != '') ? GETPOST('remise_percent'.$predef) : 0);
|
||||
|
||||
if ($qty == '')
|
||||
|
||||
@ -1465,7 +1465,6 @@ class Contrat extends CommonObject
|
||||
$vat_src_code = $reg[1];
|
||||
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
|
||||
}
|
||||
|
||||
$txtva = price2num($txtva);
|
||||
$txlocaltax1 = price2num($txlocaltax1);
|
||||
$txlocaltax2 = price2num($txlocaltax2);
|
||||
|
||||
@ -103,7 +103,7 @@ class box_scheduled_jobs extends ModeleBoxes
|
||||
$nextrun = $this->db->jdate($objp->datenextrun);
|
||||
if (empty($nextrun)) $nextrun = $this->db->jdate($objp->datestart);
|
||||
|
||||
if ($line == 0 || ($nextrun < $cronstatic->datenextrun && (empty($objp->nbrun) || empty($objp->maxrun) || $objp->nbrun < $obj->maxrun))) {
|
||||
if ($line == 0 || ($nextrun < $cronstatic->datenextrun && (empty($objp->nbrun) || empty($objp->maxrun) || $objp->nbrun < $objp->maxrun))) {
|
||||
$cronstatic->id = $objp->rowid;
|
||||
$cronstatic->ref = $objp->rowid;
|
||||
$cronstatic->label = $langs->trans($objp->label);
|
||||
|
||||
@ -2652,14 +2652,14 @@ class Form
|
||||
if (!empty($conf->stock->enabled) && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)))
|
||||
{
|
||||
if (!empty($user->rights->stock->lire)) {
|
||||
$opt .= ' - '.$langs->trans("Stock").':'.$objp->stock;
|
||||
$opt .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS'));
|
||||
|
||||
if ($objp->stock > 0) {
|
||||
$outval .= ' - <span class="product_line_stock_ok">';
|
||||
} elseif ($objp->stock <= 0) {
|
||||
$outval .= ' - <span class="product_line_stock_too_low">';
|
||||
}
|
||||
$outval .= $langs->transnoentities("Stock").':'.$objp->stock;
|
||||
$outval .= $langs->transnoentities("Stock").': '.price(price2num($objp->stock, 'MS'));
|
||||
$outval .= '</span>';
|
||||
if (empty($novirtualstock) && !empty($conf->global->STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO)) // Warning, this option may slow down combo list generation
|
||||
{
|
||||
@ -2989,14 +2989,14 @@ class Form
|
||||
$novirtualstock = ($showstockinlist == 2);
|
||||
|
||||
if (!empty($user->rights->stock->lire)) {
|
||||
$outvallabel .= ' - '.$langs->trans("Stock").':'.$objp->stock;
|
||||
$outvallabel .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS'));
|
||||
|
||||
if ($objp->stock > 0) {
|
||||
$optlabel .= ' - <span class="product_line_stock_ok">';
|
||||
} elseif ($objp->stock <= 0) {
|
||||
$optlabel .= ' - <span class="product_line_stock_too_low">';
|
||||
}
|
||||
$optlabel .= $langs->transnoentities("Stock").':'.$objp->stock;
|
||||
$optlabel .= $langs->transnoentities("Stock").':'.price(price2num($objp->stock, 'MS'));
|
||||
$optlabel .= '</span>';
|
||||
if (empty($novirtualstock) && !empty($conf->global->STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO)) // Warning, this option may slow down combo list generation
|
||||
{
|
||||
|
||||
@ -3032,7 +3032,7 @@ function dol_print_address($address, $htmlid, $element, $id, $noprint = 0, $char
|
||||
/**
|
||||
* Return true if email syntax is ok.
|
||||
*
|
||||
* @param string $address email (Ex: "toto@examle.com", "John Do <johndo@example.com>")
|
||||
* @param string $address email (Ex: "toto@examle.com". Long form "John Do <johndo@example.com>" will be false)
|
||||
* @param int $acceptsupervisorkey If 1, the special string '__SUPERVISOREMAIL__' is also accepted as valid
|
||||
* @return boolean true if email syntax is OK, false if KO or empty string
|
||||
* @see isValidMXRecord()
|
||||
@ -4810,7 +4810,7 @@ function price($amount, $form = 0, $outlangs = '', $trunc = 1, $rounding = -1, $
|
||||
* 'MU'=Round to Max unit price (MAIN_MAX_DECIMALS_UNIT)
|
||||
* 'MT'=Round to Max for totals with Tax (MAIN_MAX_DECIMALS_TOT)
|
||||
* 'MS'=Round to Max for stock quantity (MAIN_MAX_DECIMALS_STOCK)
|
||||
* 'CR'=Currency rate
|
||||
* 'CR'=Foreign currency accurancy
|
||||
* Numeric = Nb of digits for rounding
|
||||
* @param int $option Put 1 if you know that content is already universal format number (so no correction on decimal will be done)
|
||||
* Put 2 if you know that number is a user input (so we know we don't have to fix decimal separator).
|
||||
@ -4871,10 +4871,18 @@ function price2num($amount, $rounding = '', $option = 0)
|
||||
if ($rounding)
|
||||
{
|
||||
$nbofdectoround = '';
|
||||
if ($rounding == 'MU') $nbofdectoround = $conf->global->MAIN_MAX_DECIMALS_UNIT;
|
||||
elseif ($rounding == 'MT') $nbofdectoround = $conf->global->MAIN_MAX_DECIMALS_TOT;
|
||||
elseif ($rounding == 'MS') $nbofdectoround = empty($conf->global->MAIN_MAX_DECIMALS_STOCK) ? 5 : $conf->global->MAIN_MAX_DECIMALS_STOCK;
|
||||
elseif ($rounding == 'CR') $nbofdectoround = 8;
|
||||
if ($rounding == 'MU') {
|
||||
$nbofdectoround = $conf->global->MAIN_MAX_DECIMALS_UNIT;
|
||||
}
|
||||
elseif ($rounding == 'MT') {
|
||||
$nbofdectoround = $conf->global->MAIN_MAX_DECIMALS_TOT;
|
||||
}
|
||||
elseif ($rounding == 'MS') {
|
||||
$nbofdectoround = empty($conf->global->MAIN_MAX_DECIMALS_STOCK) ? 5 : $conf->global->MAIN_MAX_DECIMALS_STOCK;
|
||||
}
|
||||
elseif ($rounding == 'CR') {
|
||||
$nbofdectoround = max($conf->global->MAIN_MAX_DECIMALS_TOT, 8);
|
||||
}
|
||||
elseif (is_numeric($rounding)) $nbofdectoround = $rounding;
|
||||
//print "RR".$amount.' - '.$nbofdectoround.'<br>';
|
||||
if (dol_strlen($nbofdectoround)) $amount = round(is_string($amount) ? (float) $amount : $amount, $nbofdectoround); // $nbofdectoround can be 0.
|
||||
@ -7123,9 +7131,9 @@ function dol_sort_array(&$array, $index, $order = 'asc', $natsort = 0, $case_sen
|
||||
foreach (array_keys($array) as $key)
|
||||
{
|
||||
if (is_object($array[$key])) {
|
||||
$temp[$key] = $array[$key]->$index;
|
||||
$temp[$key] = empty($array[$key]->$index) ? 0 : $array[$key]->$index;
|
||||
} else {
|
||||
$temp[$key] = $array[$key][$index];
|
||||
$temp[$key] = empty($array[$key][$index]) ? 0 : $array[$key][$index];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1252,7 +1252,7 @@ function check_value($mask, $value)
|
||||
//print "masktri=".$masktri." maskcounter=".$maskcounter." maskwithonlyymcode=".$maskwithonlyymcode." maskwithnocode=".$maskwithnocode." maskraz=".$maskraz." maskoffset=".$maskoffset."<br>\n";
|
||||
|
||||
if (function_exists('mb_strrpos')) {
|
||||
$posnumstart = mb_strrpos($maskwithnocode, $maskcounter, 'UTF-8');
|
||||
$posnumstart = mb_strrpos($maskwithnocode, $maskcounter, 0, 'UTF-8');
|
||||
}
|
||||
else {
|
||||
$posnumstart = strrpos($maskwithnocode, $maskcounter);
|
||||
|
||||
@ -1334,10 +1334,6 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
|
||||
// Closure
|
||||
if (!empty($conf->global->MAIN_FEATURES_LEVEL) && $conf->global->MAIN_FEATURES_LEVEL >= 2) {
|
||||
$newmenu->add("/accountancy/closure/index.php?mainmenu=accountancy&leftmenu=accountancy_closure", $langs->trans("MenuAccountancyClosure"), 1, $user->rights->accounting->fiscalyear->write, '', $mainmenu, 'closure');
|
||||
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_closure/', $leftmenu)) {
|
||||
$newmenu->add("/accountancy/closure/validate.php?leftmenu=accountancy_closure", $langs->trans("MenuAccountancyValidationMovements"), 2, $user->rights->accounting->fiscalyear->write);
|
||||
}
|
||||
}
|
||||
|
||||
// Reports
|
||||
|
||||
@ -162,7 +162,6 @@ class mailing_xinputfile extends MailingTargets
|
||||
if (!empty($buffer))
|
||||
{
|
||||
//print 'xx'.dol_strlen($buffer).empty($buffer)."<br>\n";
|
||||
$id = $cpt;
|
||||
if (isValidEMail($email))
|
||||
{
|
||||
if ($old <> $email)
|
||||
|
||||
@ -212,8 +212,8 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
|
||||
|
||||
// Get Mask value
|
||||
$mask = '';
|
||||
if ($type == 0) $mask = $conf->global->COMPANY_ELEPHANT_MASK_CUSTOMER;
|
||||
if ($type == 1) $mask = $conf->global->COMPANY_ELEPHANT_MASK_SUPPLIER;
|
||||
if ($type == 0) $mask = empty($conf->global->COMPANY_ELEPHANT_MASK_CUSTOMER) ? '' : $conf->global->COMPANY_ELEPHANT_MASK_CUSTOMER;
|
||||
if ($type == 1) $mask = empty($conf->global->COMPANY_ELEPHANT_MASK_SUPPLIER) ? '' : $conf->global->COMPANY_ELEPHANT_MASK_SUPPLIER;
|
||||
if (!$mask)
|
||||
{
|
||||
$this->error = 'NotConfigured';
|
||||
|
||||
@ -157,6 +157,8 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode
|
||||
$i = 0;
|
||||
$this->code = '';
|
||||
|
||||
$disponibility = 0;
|
||||
|
||||
if (is_object($societe))
|
||||
{
|
||||
dol_syslog("mod_codecompta_digitaria::get_code search code for type=".$type." & company=".(!empty($societe->name) ? $societe->name : ''));
|
||||
@ -216,8 +218,7 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode
|
||||
}
|
||||
}
|
||||
|
||||
if ($disponibility == 0)
|
||||
{
|
||||
if ($disponibility == 0) {
|
||||
return 0; // return ok
|
||||
} else {
|
||||
return -1; // return ko
|
||||
|
||||
@ -386,10 +386,10 @@ if ($nolinesbefore) {
|
||||
<td class="nobottom margininfos linecolmargin right">
|
||||
<!-- For predef product -->
|
||||
<?php if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) { ?>
|
||||
<select id="fournprice_predef" name="fournprice_predef" class="flat minwidth75imp" style="display: none;"></select>
|
||||
<select id="fournprice_predef" name="fournprice_predef" class="flat minwidth75imp maxwidth150" style="display: none;"></select>
|
||||
<?php } ?>
|
||||
<!-- For free product -->
|
||||
<input type="text" id="buying_price" name="buying_price" class="flat maxwidth75 right" value="<?php echo (GETPOSTISSET("buying_price") ? GETPOST("buying_price", 'alpha', 2) : ''); ?>">
|
||||
<input type="text" id="buying_price" name="buying_price" class="flat maxwidth75 maxwidth150 right" value="<?php echo (GETPOSTISSET("buying_price") ? GETPOST("buying_price", 'alpha', 2) : ''); ?>">
|
||||
</td>
|
||||
<?php
|
||||
if (!empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||
|
||||
@ -491,7 +491,9 @@ class FichinterRec extends Fichinter
|
||||
if (!$info_bits) $info_bits = 0;
|
||||
$pu_ht = price2num($pu_ht);
|
||||
$pu_ttc = price2num($pu_ttc);
|
||||
$txtva = price2num($txtva);
|
||||
if (!preg_match('/\((.*)\)/', $txtva)) {
|
||||
$txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5'
|
||||
}
|
||||
|
||||
if ($price_base_type == 'HT') {
|
||||
$pu = $pu_ht;
|
||||
@ -499,7 +501,6 @@ class FichinterRec extends Fichinter
|
||||
$pu = $pu_ttc;
|
||||
}
|
||||
|
||||
|
||||
// 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
|
||||
|
||||
@ -2546,9 +2546,12 @@ class CommandeFournisseur extends CommonOrder
|
||||
|
||||
$remise_percent = price2num($remise_percent);
|
||||
$qty = price2num($qty);
|
||||
if (!$qty) $qty = 1;
|
||||
$pu = price2num($pu);
|
||||
$pu_ht_devise = price2num($pu_ht_devise);
|
||||
$txtva = price2num($txtva);
|
||||
if (!preg_match('/\((.*)\)/', $txtva)) {
|
||||
$txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5'
|
||||
}
|
||||
$txlocaltax1 = price2num($txlocaltax1);
|
||||
$txlocaltax2 = price2num($txlocaltax2);
|
||||
|
||||
|
||||
@ -356,24 +356,24 @@ if (empty($reshook))
|
||||
|
||||
// Set if we used free entry or predefined product
|
||||
$predef = '';
|
||||
$product_desc = (GETPOST('dp_desc') ?GETPOST('dp_desc') : '');
|
||||
$product_desc = (GETPOSTISSET('dp_desc') ? GETPOST('dp_desc', 'restricthtml') : '');
|
||||
$date_start = dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), GETPOST('date_start'.$predef.'sec'), GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year'));
|
||||
$date_end = dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end'.$predef.'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year'));
|
||||
$prod_entry_mode = GETPOST('prod_entry_mode');
|
||||
if ($prod_entry_mode == 'free')
|
||||
{
|
||||
$idprod = 0;
|
||||
$price_ht = GETPOST('price_ht');
|
||||
$price_ht = price2num(GETPOST('price_ht'), 'MU');
|
||||
$tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
|
||||
} else {
|
||||
$idprod = GETPOST('idprod', 'int');
|
||||
$price_ht = GETPOST('price_ht');
|
||||
$price_ht = price2num(GETPOST('price_ht'), 'MU');
|
||||
$tva_tx = '';
|
||||
}
|
||||
|
||||
$qty = GETPOST('qty'.$predef);
|
||||
$qty = price2num(GETPOST('qty'.$predef), 'alpha');
|
||||
$remise_percent = GETPOST('remise_percent'.$predef);
|
||||
$price_ht_devise = GETPOST('multicurrency_price_ht');
|
||||
$price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CR');
|
||||
|
||||
// Extrafields
|
||||
$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
|
||||
|
||||
@ -1175,7 +1175,7 @@ if (empty($reshook))
|
||||
|
||||
// Set if we used free entry or predefined product
|
||||
$predef = '';
|
||||
$product_desc = (GETPOST('dp_desc') ?GETPOST('dp_desc') : '');
|
||||
$product_desc = (GETPOSTISSET('dp_desc') ? GETPOST('dp_desc', 'restricthtml') : '');
|
||||
$date_start = dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), GETPOST('date_start'.$predef.'sec'), GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year'));
|
||||
$date_end = dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end'.$predef.'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year'));
|
||||
|
||||
@ -1183,17 +1183,17 @@ if (empty($reshook))
|
||||
if ($prod_entry_mode == 'free')
|
||||
{
|
||||
$idprod = 0;
|
||||
$price_ht = GETPOST('price_ht');
|
||||
$price_ht = price2num(GETPOST('price_ht'), 'MU');
|
||||
$tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
|
||||
} else {
|
||||
$idprod = GETPOST('idprod', 'int');
|
||||
$price_ht = GETPOST('price_ht');
|
||||
$price_ht = price2num(GETPOST('price_ht'), 'MU');
|
||||
$tva_tx = '';
|
||||
}
|
||||
|
||||
$qty = GETPOST('qty'.$predef);
|
||||
$qty = price2num(GETPOST('qty'.$predef), 'alpha');
|
||||
$remise_percent = GETPOST('remise_percent'.$predef);
|
||||
$price_ht_devise = GETPOST('multicurrency_price_ht');
|
||||
$price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CR');
|
||||
|
||||
// Extrafields
|
||||
$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
|
||||
|
||||
@ -6125,7 +6125,7 @@ class wsdl extends nusoap_base {
|
||||
$rows = sizeof($value);
|
||||
$contents = '';
|
||||
foreach($value as $k => $v) {
|
||||
$this->debug("serializing array element: $k, $v of type: $typeDef[arrayType]");
|
||||
$this->debug("serializing array element: $k of type: ".$typeDef['arrayType']);
|
||||
//if (strpos($typeDef['arrayType'], ':') ) {
|
||||
if (!in_array($typeDef['arrayType'],$this->typemap['http://www.w3.org/2001/XMLSchema'])) {
|
||||
$contents .= $this->serializeType('item', $typeDef['arrayType'], $v, $use);
|
||||
|
||||
@ -35,6 +35,16 @@
|
||||
|
||||
delete from llx_c_tva;
|
||||
|
||||
-- ALGERIA (id country=13)
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 131, 13, '0','0','TVA 0%', 1);
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 132, 13, '9','0','TVA 9%',1);
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 133, 13, '19','0','TVA 19%', 1);
|
||||
|
||||
-- ANGOLA (id country=35)
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 351, 35, '0','0','VAT Rate 0', 1);
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 352, 35, '7','0','VAT reduced rate',1);
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 353, 35, '14','0','VAT standard rate',1);
|
||||
|
||||
-- ARGENTINA (id country=23)
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (231, 23, '0','0','IVA Rate 0', 1);
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (232, 23,'10.5','0','IVA reduced rate',1);
|
||||
@ -202,6 +212,13 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 1
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 173, 17, '19','0','Algemeen BTW tarief',1);
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 174, 17, '21','0','Algemeen BTW tarief (vanaf 1 oktober 2012)',0);
|
||||
|
||||
-- NEW CALEDONIA (id country=165)
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1651, 165, '0','0','VAT Rate 0', 1);
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1652, 165, '3','0','VAT standard 3', 1);
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1653, 165, '6','0','VAT standard 6', 1);
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1654, 165, '11','0','VAT standard rate', 1);
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1655, 165, '22','0','VAT standard high', 1);
|
||||
|
||||
-- NEW ZEALAND (id country=166)
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1661, 166, '0','0','VAT Rate 0', 1);
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1662, 166, '15','0','VAT standard rate', 1);
|
||||
@ -361,16 +378,6 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (23
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2322,232, '12','0','VAT 12%',1);
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2323,232, '8','0','VAT 8%',1);
|
||||
|
||||
-- ALGERIA(id country=13)
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 131, 13, '0','0','TVA 0%', 1);
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 132, 13, '9','0','TVA 9%',1);
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 133, 13, '19','0','TVA 19%', 1);
|
||||
|
||||
-- ANGOLA (id country=35)
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 351, 35, '0','0','VAT Rate 0', 1);
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 352, 35, '7','0','VAT reduced rate',1);
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 353, 35, '14','0','VAT standard rate',1);
|
||||
|
||||
-- Example of code to insert a vat rate 0 for each country
|
||||
--delete from llx_c_tva where rowid = 1181; -- to delete a record that does not follow rules for rowid (fk_pays+'1')
|
||||
--insert into llx_c_tva(rowid, fk_pays, taux, recuperableonly, note, active) SELECT CONCAT(c.rowid, '1'), c.rowid, 0, 0, 'No VAT', 1 from llx_c_country as c where c.rowid not in (select fk_pays from llx_c_tva);
|
||||
|
||||
@ -475,7 +475,7 @@ UPDATE llx_chargesociales SET date_creation = tms WHERE date_creation IS NULL;
|
||||
-- VMYSQL4.1 SET sql_mode = 'NO_ZERO_DATE';
|
||||
-- VMYSQL4.1 update llx_inventory set date_cre = null where DATE(STR_TO_DATE(date_cre, '%Y-%m-%d')) IS NULL;
|
||||
|
||||
-- Note that you can manually set the default value of a date to CURRENT_TIMESTAMP with:
|
||||
-- Note that you can manually set the default value of a date or datetime to CURRENT_TIMESTAMP with:
|
||||
--ALTER TABLE llx_table modify column columnname datetime DEFAULT CURRENT_TIMESTAMP;
|
||||
|
||||
|
||||
|
||||
@ -251,7 +251,7 @@ PaymentsNotLinkedToProduct=Payment not linked to any product / service
|
||||
OpeningBalance=Opening balance
|
||||
ShowOpeningBalance=Show opening balance
|
||||
HideOpeningBalance=Hide opening balance
|
||||
ShowSubtotalByGroup=Show subtotal by group
|
||||
ShowSubtotalByGroup=Show subtotal by level
|
||||
|
||||
Pcgtype=Group of account
|
||||
PcgtypeDesc=Group of account are used as predefined 'filter' and 'grouping' criteria for some accounting reports. For example, 'INCOME' or 'EXPENSE' are used as groups for accounting accounts of products to build the expense/income report.
|
||||
@ -274,11 +274,13 @@ DescVentilExpenseReport=Consult here the list of expense report lines bound (or
|
||||
DescVentilExpenseReportMore=If you setup accounting account on type of expense report lines, the application will be able to make all the binding between your expense report lines and the accounting account of your chart of accounts, just in one click with the button <strong>"%s"</strong>. If account was not set on fees dictionary or if you still have some lines not bound to any account, you will have to make a manual binding from the menu "<strong>%s</strong>".
|
||||
DescVentilDoneExpenseReport=Consult here the list of the lines of expenses reports and their fees accounting account
|
||||
|
||||
Closure=Annual closure
|
||||
DescClosure=Consult here the number of movements by month who are not validated & fiscal years already open
|
||||
OverviewOfMovementsNotValidated=Step 1/ Overview of movements not validated. (Necessary to close a fiscal year)
|
||||
AllMovementsWereRecordedAsValidated=All movements were recorded as validated
|
||||
NotAllMovementsCouldBeRecordedAsValidated=Not all movements could be recorded as validated
|
||||
ValidateMovements=Validate movements
|
||||
DescValidateMovements=Any modification or deletion of writing, lettering and deletes will be prohibited. All entries for an exercise must be validated otherwise closing will not be possible
|
||||
SelectMonthAndValidate=Select month and validate movements
|
||||
|
||||
ValidateHistory=Bind Automatically
|
||||
AutomaticBindingDone=Automatic binding done
|
||||
|
||||
@ -99,7 +99,8 @@ CashDeskRefNumberingModules=Numbering module for POS sales
|
||||
CashDeskGenericMaskCodes6 = <br><b>{TN}</b> tag is used to add the terminal number
|
||||
TakeposGroupSameProduct=Group same products lines
|
||||
StartAParallelSale=Start a new parallel sale
|
||||
ControlCashOpening=Control cash desk at opening POS
|
||||
SaleStartedAt=Sale started at %s
|
||||
ControlCashOpening=Control cash popup at opening POS
|
||||
CloseCashFence=Close cash desk control
|
||||
CashReport=Cash report
|
||||
MainPrinterToUse=Main printer to use
|
||||
|
||||
@ -490,9 +490,9 @@ if ($id > 0 || $ref)
|
||||
if ($rowid)
|
||||
{
|
||||
print '<input type="hidden" name="ref_fourn_old" value="'.$object->ref_supplier.'">';
|
||||
print '<input class="flat" name="ref_fourn" size="12" value="'.$object->ref_supplier.'">';
|
||||
print '<input class="flat width150" maxlength="30" name="ref_fourn" value="'.$object->ref_supplier.'">';
|
||||
} else {
|
||||
print '<input class="flat" name="ref_fourn" size="12" value="'.(GETPOST("ref_fourn") ?GETPOST("ref_fourn") : '').'">';
|
||||
print '<input class="flat width150" maxlength="30" name="ref_fourn" value="'.(GETPOST("ref_fourn") ? GETPOST("ref_fourn") : '').'">';
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -533,9 +533,6 @@ if ($resql)
|
||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||
//'presend'=>$langs->trans("SendByMail"),
|
||||
);
|
||||
|
||||
$rightskey = 'produit';
|
||||
if ($type == Product::TYPE_SERVICE) $rightskey = 'service';
|
||||
if ($user->rights->{$rightskey}->supprimer) $arrayofmassactions['predelete'] = "<span class='fa fa-trash paddingrightonly'></span>".$langs->trans("Delete");
|
||||
if (in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
|
||||
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
@ -88,6 +88,11 @@ class PaymentSalary extends CommonObject
|
||||
*/
|
||||
public $fk_user_modif;
|
||||
|
||||
/**
|
||||
* @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
|
||||
*/
|
||||
public $fields = array();
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
||||
@ -109,7 +109,7 @@ if ($object->id > 0) {
|
||||
|
||||
$permissiontoread = $user->rights->societe->lire;
|
||||
$permissiontoadd = $user->rights->societe->creer; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
|
||||
$permissiontodelete = $user->rights->societe->delete || ($permissiontoadd && isset($object->status) && $object->status == 0);
|
||||
$permissiontodelete = $user->rights->societe->supprimer || ($permissiontoadd && isset($object->status) && $object->status == 0);
|
||||
$permissionnote = $user->rights->societe->creer; // Used by the include of actions_setnotes.inc.php
|
||||
$permissiondellink = $user->rights->societe->creer; // Used by the include of actions_dellink.inc.php
|
||||
$upload_dir = $conf->societe->multidir_output[isset($object->entity) ? $object->entity : 1];
|
||||
@ -1355,7 +1355,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
||||
print '<td'.($conf->browser->layout == 'phone' ? ' colspan="3"' : '').'>'.img_picto('', 'object_phoning_fax').' <input type="text" name="fax" id="fax" class="maxwidth200 widthcentpercentminusx" value="'.(GETPOSTISSET('fax') ?GETPOST('fax', 'alpha') : $object->fax).'"></td></tr>';
|
||||
|
||||
// Email / Web
|
||||
print '<tr><td>'.$form->editfieldkey('EMail', 'email', '', $object, 0, 'string', '', $conf->global->SOCIETE_EMAIL_MANDATORY).'</td>';
|
||||
print '<tr><td>'.$form->editfieldkey('EMail', 'email', '', $object, 0, 'string', '', empty($conf->global->SOCIETE_EMAIL_MANDATORY) ? '' : $conf->global->SOCIETE_EMAIL_MANDATORY).'</td>';
|
||||
print '<td colspan="3">'.img_picto('', 'object_email').' <input type="text" class="maxwidth500 widthcentpercentminusx" name="email" id="email" value="'.$object->email.'"></td></tr>';
|
||||
print '<tr><td>'.$form->editfieldkey('Web', 'url', '', $object, 0).'</td>';
|
||||
print '<td colspan="3">'.img_picto('', 'globe').' <input type="text" class="maxwidth500 widthcentpercentminusx" name="url" id="url" value="'.$object->url.'"></td></tr>';
|
||||
@ -1366,7 +1366,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
||||
print '<tr>';
|
||||
print '<td><label for="'.$value['label'].'">'.$form->editfieldkey($value['label'], $key, '', $object, 0).'</label></td>';
|
||||
print '<td colspan="3">';
|
||||
print '<input type="text" name="'.$key.'" id="'.$key.'" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET($key) ?GETPOST($key, 'alphanohtml') : $object->socialnetworks[$key]).'">';
|
||||
print '<input type="text" name="'.$key.'" id="'.$key.'" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET($key) ? GETPOST($key, 'alphanohtml') : (empty($object->socialnetworks[$key]) ? '' : $object->socialnetworks[$key])).'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
} elseif (!empty($object->socialnetworks[$key])) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -540,24 +540,24 @@ if (empty($reshook))
|
||||
|
||||
// Set if we used free entry or predefined product
|
||||
$predef = '';
|
||||
$product_desc = (GETPOST('dp_desc') ?GETPOST('dp_desc') : '');
|
||||
$product_desc = (GETPOSTISSET('dp_desc') ? GETPOST('dp_desc', 'restricthtml') : '');
|
||||
$date_start = dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), GETPOST('date_start'.$predef.'sec'), GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year'));
|
||||
$date_end = dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end'.$predef.'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year'));
|
||||
$ref_supplier = GETPOST('fourn_ref', 'alpha');
|
||||
$prod_entry_mode = GETPOST('prod_entry_mode');
|
||||
if ($prod_entry_mode == 'free') {
|
||||
$idprod = 0;
|
||||
$price_ht = GETPOST('price_ht');
|
||||
$price_ht = price2num(GETPOST('price_ht'), 'MU');
|
||||
$tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
|
||||
} else {
|
||||
$idprod = GETPOST('idprod', 'int');
|
||||
$price_ht = GETPOST('price_ht');
|
||||
$price_ht = price2num(GETPOST('price_ht'), 'MU');
|
||||
$tva_tx = '';
|
||||
}
|
||||
|
||||
$qty = GETPOST('qty'.$predef);
|
||||
$qty = price2num(GETPOST('qty'.$predef), 'alpha');
|
||||
$remise_percent = GETPOST('remise_percent'.$predef);
|
||||
$price_ht_devise = GETPOST('multicurrency_price_ht');
|
||||
$price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CR');
|
||||
|
||||
// Extrafields
|
||||
$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
|
||||
|
||||
@ -416,10 +416,12 @@ class SupplierProposal extends CommonObject
|
||||
$qty = price2num($qty);
|
||||
$pu_ht = price2num($pu_ht);
|
||||
$pu_ttc = price2num($pu_ttc);
|
||||
$txtva = price2num($txtva);
|
||||
if (!preg_match('/\((.*)\)/', $txtva)) {
|
||||
$txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5'
|
||||
}
|
||||
$txlocaltax1 = price2num($txlocaltax1);
|
||||
$txlocaltax2 = price2num($txlocaltax2);
|
||||
$pa_ht = price2num($pa_ht);
|
||||
$pa_ht = price2num($pa_ht);
|
||||
if ($price_base_type == 'HT')
|
||||
{
|
||||
$pu = $pu_ht;
|
||||
@ -673,7 +675,9 @@ class SupplierProposal extends CommonObject
|
||||
$remise_percent = price2num($remise_percent);
|
||||
$qty = price2num($qty);
|
||||
$pu = price2num($pu);
|
||||
$txtva = price2num($txtva);
|
||||
if (!preg_match('/\((.*)\)/', $txtva)) {
|
||||
$txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5'
|
||||
}
|
||||
$txlocaltax1 = price2num($txlocaltax1);
|
||||
$txlocaltax2 = price2num($txlocaltax2);
|
||||
$pa_ht = price2num($pa_ht);
|
||||
|
||||
@ -167,6 +167,7 @@ var pageactions=0;
|
||||
var place="<?php echo $place; ?>";
|
||||
var editaction="qty";
|
||||
var editnumber="";
|
||||
var invoiceid=0;
|
||||
|
||||
/*
|
||||
var app = this;
|
||||
@ -483,17 +484,18 @@ function TakeposOrderNotes() {
|
||||
}
|
||||
|
||||
function Refresh() {
|
||||
console.log("Refresh");
|
||||
$("#poslines").load("invoice.php?place="+place, function() {
|
||||
console.log("Refresh by reloading place="+place+" invoiceid="+invoiceid);
|
||||
$("#poslines").load("invoice.php?place="+place+"&invoiceid="+invoiceid, function() {
|
||||
//$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
|
||||
});
|
||||
}
|
||||
|
||||
function New() {
|
||||
// If we go here,it means $conf->global->TAKEPOS_BAR_RESTAURANT is not defined
|
||||
console.log("New with place = <?php echo $place; ?>, js place="+place);
|
||||
|
||||
invoiceid = $("#invoiceid").val();
|
||||
|
||||
console.log("New with place = <?php echo $place; ?>, js place="+place+", invoiceid="+invoiceid);
|
||||
|
||||
$.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getInvoice&id='+invoiceid, function(data) {
|
||||
var r;
|
||||
|
||||
@ -831,7 +833,7 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
|
||||
</div>
|
||||
<div class="topnav-right">
|
||||
<div class="login_block_other">
|
||||
<input type="text" id="search" name="search" onkeyup="Search2(<?php echo $keyCodeForEnter; ?>);" placeholder="<?php echo $langs->trans("Search"); ?>" autofocus>
|
||||
<input type="text" id="search" name="search" onkeyup="Search2(<?php echo $keyCodeForEnter; ?>);" placeholder="<?php echo $langs->trans("Search"); ?>" autofocus>
|
||||
<a onclick="ClearSearch();"><span class="fa fa-backspace"></span></a>
|
||||
<a onclick="window.location.href='<?php echo DOL_URL_ROOT.'/'; ?>';"><span class="fas fa-home"></span></a>
|
||||
<?php if (empty($conf->dol_use_jmobile)) { ?>
|
||||
|
||||
@ -173,11 +173,13 @@ if ($action == 'valid' && $user->rights->facture->creer)
|
||||
|
||||
if ($invoice->total_ttc < 0) {
|
||||
$invoice->type = $invoice::TYPE_CREDIT_NOTE;
|
||||
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture WHERE";
|
||||
$sql .= " fk_soc = ".((int) $invoice->socid);
|
||||
$sql .= " AND type <> ".Facture::TYPE_CREDIT_NOTE;
|
||||
$sql .= " AND fk_statut >= ".$invoice::STATUS_VALIDATED;
|
||||
$sql .= " ORDER BY rowid DESC";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
@ -572,16 +574,9 @@ if ($action == "deleteline") {
|
||||
}
|
||||
}
|
||||
|
||||
// Action to delete or discard an invoice
|
||||
if ($action == "delete") {
|
||||
// $placeid is the invoice id (it differs from place) and is defined if the place is set and the ref of invoice is '(PROV-POS'.$_SESSION["takeposterminal"].'-'.$place.')', so the fetch at begining of page works.
|
||||
|
||||
/*$reg = array();
|
||||
if (preg_match('/^(\d+)-(\d+)$/', $place, $reg)) {
|
||||
|
||||
$place = $reg[1];
|
||||
var_dump($place);
|
||||
}*/
|
||||
|
||||
if ($placeid > 0) {
|
||||
$result = $invoice->fetch($placeid);
|
||||
|
||||
@ -599,7 +594,9 @@ if ($action == "delete") {
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facture set fk_soc=".$conf->global->{'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"]};
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facture";
|
||||
$sql .= " SET fk_soc=".$conf->global->{'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"]}.", ";
|
||||
$sql .= " datec = '".$db->idate(dol_now())."'";
|
||||
$sql .= " WHERE ref='(PROV-POS".$db->escape($_SESSION["takeposterminal"]."-".$place).")'";
|
||||
$resql1 = $db->query($sql);
|
||||
|
||||
@ -1003,7 +1000,7 @@ function CreditNote() {
|
||||
|
||||
|
||||
$( document ).ready(function() {
|
||||
console.log("Set customer info and sales in header");
|
||||
console.log("Set customer info and sales in header placeid=<?php echo $placeid; ?> status=<?php echo $invoice->statut; ?>");
|
||||
|
||||
<?php
|
||||
$s = $langs->trans("Customer");
|
||||
@ -1018,25 +1015,36 @@ $( document ).ready(function() {
|
||||
|
||||
<?php
|
||||
$sql = "SELECT rowid, datec, ref FROM ".MAIN_DB_PREFIX."facture";
|
||||
$sql .= " WHERE ref LIKE '(PROV-POS".$_SESSION["takeposterminal"]."-0%' AND entity IN (".getEntity('invoice').")";
|
||||
if (empty($conf->global->TAKEPOS_CAN_EDIT_IF_ALREADY_VALIDATED)) {
|
||||
// By default, only invoices with a ref not already defined can in list of open invoice we can edit.
|
||||
$sql .= " WHERE ref LIKE '(PROV-POS".$db->escape($_SESSION["takeposterminal"])."-0%' AND entity IN (".getEntity('invoice').")";
|
||||
} else {
|
||||
// If TAKEPOS_CAN_EDIT_IF_ALREADY_VALIDATED set, we show also draft invoice that already has a reference defined
|
||||
$sql .= " WHERE pos_source = '".$db->escape($_SESSION["takeposterminal"])."'";
|
||||
$sql .= " AND module_source = 'takepos'";
|
||||
$sql .= " AND entity IN (".getEntity('invoice').")";
|
||||
}
|
||||
|
||||
$sql .= $db->order('datec', 'ASC');
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
while ($obj = $db->fetch_object($resql)) {
|
||||
echo '$("#customerandsales").append(\'';
|
||||
echo '<a class="valignmiddle" onclick="place=\\\'';
|
||||
echo '<a class="valignmiddle" title="'.dol_escape_js($langs->trans("SaleStartedAt", dol_print_date($db->jdate($obj->datec), '%H:%M', 'tzuser'))).'" onclick="place=\\\'';
|
||||
$num_sale = str_replace(")", "", str_replace("(PROV-POS".$_SESSION["takeposterminal"]."-", "", $obj->ref));
|
||||
echo $num_sale;
|
||||
if (str_replace("-", "", $num_sale) > $max_sale) $max_sale = str_replace("-", "", $num_sale);
|
||||
echo '\\\';Refresh();">';
|
||||
echo '\\\'; invoiceid=\\\'';
|
||||
echo $obj->rowid;
|
||||
echo '\\\'; Refresh();">';
|
||||
if ($placeid == $obj->rowid) echo "<b>";
|
||||
echo date('H:i', strtotime($obj->datec));
|
||||
echo dol_print_date($db->jdate($obj->datec), '%H:%M', 'tzuser');
|
||||
if ($placeid == $obj->rowid) echo "</b>";
|
||||
echo '</a>\');';
|
||||
}
|
||||
echo '$("#customerandsales").append(\'<a onclick="place=\\\'0-';
|
||||
echo $max_sale + 1;
|
||||
echo '\\\';Refresh();"><span class="fa fa-plus-square" title="'.dol_escape_htmltag($langs->trans("StartAParallelSale")).'"></a>\');';
|
||||
echo '\\\'; invoiceid=0; Refresh();"><span class="fa fa-plus-square" title="'.dol_escape_htmltag($langs->trans("StartAParallelSale")).'"></a>\');';
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
@ -35,7 +35,7 @@
|
||||
--oddevencolor: #202020;
|
||||
--colorboxstatsborder: #e0e0e0;
|
||||
--dolgraphbg: rgba(255,255,255,0);
|
||||
--fieldrequiredcolor: #804000;
|
||||
--fieldrequiredcolor: #700040;
|
||||
--colortextbacktab: #<?php print $colortextbacktab; ?>;
|
||||
--colorboxiconbg: #eee;
|
||||
--refidnocolor:#444;
|
||||
|
||||
@ -1806,7 +1806,7 @@ class User extends CommonObject
|
||||
|
||||
$adh->pass = $this->pass;
|
||||
|
||||
$adh->societe = (empty($adh->societe) && $this->societe_id ? $this->societe_id : $adh->societe);
|
||||
//$adh->societe = (empty($adh->societe) && $this->societe_id ? $this->societe_id : $adh->societe);
|
||||
|
||||
$adh->address = $this->address;
|
||||
$adh->town = $this->town;
|
||||
@ -2418,6 +2418,7 @@ class User extends CommonObject
|
||||
}
|
||||
|
||||
$result = ''; $label = '';
|
||||
$companylink = '';
|
||||
|
||||
if (!empty($this->photo)) {
|
||||
$label .= '<div class="photointooltip">';
|
||||
|
||||
@ -270,10 +270,10 @@ function getContact($authentication, $id, $ref_ext)
|
||||
if ($result > 0)
|
||||
{
|
||||
// Only internal user who have contact read permission
|
||||
// Or for external user who have contact read permission, with restrict on societe_id
|
||||
// Or for external user who have contact read permission, with restrict on socid
|
||||
if (
|
||||
$fuser->rights->societe->contact->lire && !$fuser->societe_id
|
||||
|| ($fuser->rights->societe->contact->lire && ($fuser->societe_id == $contact->socid))
|
||||
$fuser->rights->societe->contact->lire && !$fuser->socid
|
||||
|| ($fuser->rights->societe->contact->lire && ($fuser->socid == $contact->socid))
|
||||
) {
|
||||
$contact_result_fields = array(
|
||||
'id' => $contact->id,
|
||||
|
||||
@ -777,12 +777,11 @@ function updateInvoice($authentication, $invoice)
|
||||
$object->generateDocument($object->model_pdf, $outputlangs);
|
||||
}
|
||||
}
|
||||
if ($invoice['status'] == Facture::STATUS_CLOSED)
|
||||
{
|
||||
$result = $object->set_paid($fuser, $invoice->close_code, $invoice->close_note);
|
||||
if ($invoice['status'] == Facture::STATUS_CLOSED) {
|
||||
$result = $object->set_paid($fuser, $invoice['close_code'], $invoice['close_note']);
|
||||
}
|
||||
if ($invoice['status'] == Facture::STATUS_ABANDONED)
|
||||
$result = $object->set_canceled($fuser, $invoice->close_code, $invoice->close_note);
|
||||
$result = $object->set_canceled($fuser, $invoice['close_code'], $invoice['close_note']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -364,10 +364,11 @@ function getOrder($authentication, $id = '', $ref = '', $ref_ext = '')
|
||||
$objectresp = array();
|
||||
$errorcode = ''; $errorlabel = '';
|
||||
$error = 0;
|
||||
$socid = 0;
|
||||
|
||||
$fuser = check_authentication($authentication, $error, $errorcode, $errorlabel);
|
||||
|
||||
if ($fuser->societe_id) $socid = $fuser->societe_id;
|
||||
if ($fuser->socid) $socid = $fuser->socid;
|
||||
|
||||
// Check parameters
|
||||
if (!$error && (($id && $ref) || ($id && $ref_ext) || ($ref && $ref_ext)))
|
||||
@ -387,10 +388,10 @@ function getOrder($authentication, $id = '', $ref = '', $ref_ext = '')
|
||||
if ($result > 0)
|
||||
{
|
||||
// Security for external user
|
||||
if ($socid && ($socid != $order->socid))
|
||||
if ($socid && $socid != $order->socid)
|
||||
{
|
||||
$error++;
|
||||
$errorcode = 'PERMISSION_DENIED'; $errorlabel = $order->socid.'User does not have permission for this request';
|
||||
$errorcode = 'PERMISSION_DENIED'; $errorlabel = 'User does not have permission for this request';
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
@ -516,7 +517,7 @@ function getOrdersForThirdParty($authentication, $idthirdparty)
|
||||
$error = 0;
|
||||
$fuser = check_authentication($authentication, $error, $errorcode, $errorlabel);
|
||||
|
||||
if ($fuser->societe_id) $socid = $fuser->societe_id;
|
||||
if ($fuser->socid) $socid = $fuser->socid;
|
||||
|
||||
// Check parameters
|
||||
if (!$error && empty($idthirdparty))
|
||||
|
||||
@ -208,7 +208,7 @@ function getDocument($authentication, $modulepart, $file, $refname = '')
|
||||
|
||||
$fuser = check_authentication($authentication, $error, $errorcode, $errorlabel);
|
||||
|
||||
if ($fuser->societe_id) $socid = $fuser->societe_id;
|
||||
if ($fuser->socid) $socid = $fuser->socid;
|
||||
|
||||
// Check parameters
|
||||
if (!$error && (!$file || !$modulepart))
|
||||
@ -234,7 +234,7 @@ function getDocument($authentication, $modulepart, $file, $refname = '')
|
||||
$original_file = $check_access['original_file'];
|
||||
|
||||
// Basic protection (against external users only)
|
||||
if ($fuser->societe_id > 0)
|
||||
if ($fuser->socid > 0)
|
||||
{
|
||||
if ($sqlprotectagainstexternals)
|
||||
{
|
||||
@ -246,7 +246,7 @@ function getDocument($authentication, $modulepart, $file, $refname = '')
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($fuser->societe_id != $obj->fk_soc)
|
||||
if ($fuser->socid != $obj->fk_soc)
|
||||
{
|
||||
$accessallowed = 0;
|
||||
break;
|
||||
|
||||
@ -154,7 +154,7 @@ if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafie
|
||||
}
|
||||
}
|
||||
|
||||
if (is_array($extrafield_array)) $productorservice_fields = array_merge($productorservice_fields, $extrafield_array);
|
||||
if (!empty($extrafield_array) && is_array($extrafield_array)) $productorservice_fields = array_merge($productorservice_fields, $extrafield_array);
|
||||
|
||||
// Define other specific objects
|
||||
$server->wsdl->addComplexType(
|
||||
@ -536,7 +536,7 @@ function createProductOrService($authentication, $product)
|
||||
|
||||
$newobject->stock_reel = isset($product['stock_real']) ? $product['stock_real'] : null;
|
||||
$newobject->pmp = isset($product['pmp']) ? $product['pmp'] : null;
|
||||
$newobject->seuil_stock_alert = isset($product['stock_alert']) ? $product['stock_alert'] : null;
|
||||
$newobject->seuil_stock_alerte = isset($product['stock_alert']) ? $product['stock_alert'] : null;
|
||||
|
||||
$newobject->country_id = isset($product['country_id']) ? $product['country_id'] : 0;
|
||||
if (!empty($product['country_code'])) $newobject->country_id = getCountry($product['country_code'], 3);
|
||||
@ -705,15 +705,15 @@ function updateProductOrService($authentication, $product)
|
||||
$newobject->barcode_type = $product['barcode_type'];
|
||||
}
|
||||
|
||||
$newobject->stock_reel = $product['stock_real'];
|
||||
$newobject->pmp = $product['pmp'];
|
||||
$newobject->seuil_stock_alert = $product['stock_alert'];
|
||||
$newobject->stock_reel = isset($product['stock_real']) ? $product['stock_real'] : null;
|
||||
$newobject->pmp = isset($product['pmp']) ? $product['pmp'] : null;
|
||||
$newobject->seuil_stock_alerte = isset($product['stock_alert']) ? $product['stock_alert'] : null;
|
||||
|
||||
$newobject->country_id = $product['country_id'];
|
||||
if ($product['country_code']) $newobject->country_id = getCountry($product['country_code'], 3);
|
||||
$newobject->customcode = $product['customcode'];
|
||||
$newobject->country_id = isset($product['country_id']) ? $product['country_id'] : 0;
|
||||
if (!empty($product['country_code'])) $newobject->country_id = getCountry($product['country_code'], 3);
|
||||
$newobject->customcode = isset($product['customcode']) ? $product['customcode'] : '';
|
||||
|
||||
$newobject->canvas = $product['canvas'];
|
||||
$newobject->canvas = isset($product['canvas']) ? $product['canvas'] : '';
|
||||
|
||||
$elementtype = 'product';
|
||||
|
||||
|
||||
@ -329,8 +329,9 @@ function getThirdParty($authentication, $id = '', $ref = '', $ref_ext = '')
|
||||
'supplier_code' => $thirdparty->code_fournisseur,
|
||||
'customer_code_accountancy' => $thirdparty->code_compta,
|
||||
'supplier_code_accountancy' => $thirdparty->code_compta_fournisseur,
|
||||
'fk_user_author' => $thirdparty->fk_user_author,
|
||||
'user_creation' => $thirdparty->user_creation,
|
||||
'date_creation' => dol_print_date($thirdparty->date_creation, 'dayhourrfc'),
|
||||
'user_modification' => $thirdparty->user_modification,
|
||||
'date_modification' => dol_print_date($thirdparty->date_modification, 'dayhourrfc'),
|
||||
'address' => $thirdparty->address,
|
||||
'zip' => $thirdparty->zip,
|
||||
@ -369,7 +370,9 @@ function getThirdParty($authentication, $id = '', $ref = '', $ref_ext = '')
|
||||
{
|
||||
foreach ($extrafields->attributes[$elementtype]['label'] as $key => $label)
|
||||
{
|
||||
$thirdparty_result_fields = array_merge($thirdparty_result_fields, array('options_'.$key => $thirdparty->array_options['options_'.$key]));
|
||||
if (isset($thirdparty->array_options['options_'.$key])) {
|
||||
$thirdparty_result_fields = array_merge($thirdparty_result_fields, array('options_'.$key => $thirdparty->array_options['options_'.$key]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -468,12 +471,12 @@ function createThirdParty($authentication, $thirdparty)
|
||||
|
||||
$newobject->capital = $thirdparty['capital'];
|
||||
|
||||
$newobject->barcode = $thirdparty['barcode'];
|
||||
$newobject->tva_assuj = $thirdparty['vat_used'];
|
||||
$newobject->tva_intra = $thirdparty['vat_number'];
|
||||
$newobject->barcode = empty($thirdparty['barcode']) ? '' : $thirdparty['barcode'];
|
||||
$newobject->tva_assuj = empty($thirdparty['vat_used']) ? 0 : $thirdparty['vat_used'];
|
||||
$newobject->tva_intra = empty($thirdparty['vat_number']) ? '' : $thirdparty['vat_number'];
|
||||
|
||||
$newobject->canvas = $thirdparty['canvas'];
|
||||
$newobject->particulier = $thirdparty['individual'];
|
||||
$newobject->canvas = empty($thirdparty['canvas']) ? '' : $thirdparty['canvas'];
|
||||
$newobject->particulier = empty($thirdparty['individual']) ? 0 : $thirdparty['individual'];
|
||||
|
||||
$elementtype = 'societe';
|
||||
|
||||
@ -486,7 +489,9 @@ function createThirdParty($authentication, $thirdparty)
|
||||
foreach ($extrafields->attributes[$elementtype]['label'] as $key => $label)
|
||||
{
|
||||
$key = 'options_'.$key;
|
||||
$newobject->array_options[$key] = $thirdparty[$key];
|
||||
if (isset($thirdparty[$key])) {
|
||||
$newobject->array_options[$key] = $thirdparty[$key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -508,7 +513,7 @@ function createThirdParty($authentication, $thirdparty)
|
||||
$db->commit();
|
||||
|
||||
// Patch to add capability to associate (one) sale representative
|
||||
if ($thirdparty['commid'] && $thirdparty['commid'] > 0)
|
||||
if (!empty($thirdparty['commid']) && $thirdparty['commid'] > 0)
|
||||
$newobject->add_commercial($fuser, $thirdparty["commid"]);
|
||||
|
||||
$objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>''), 'id'=>$newobject->id, 'ref'=>$newobject->ref);
|
||||
@ -620,7 +625,9 @@ function updateThirdParty($authentication, $thirdparty)
|
||||
foreach ($extrafields->attributes[$elementtype]['label'] as $key => $label)
|
||||
{
|
||||
$key = 'options_'.$key;
|
||||
$object->array_options[$key] = $thirdparty[$key];
|
||||
if (isset($thirdparty[$key])) {
|
||||
$object->array_options[$key] = $thirdparty[$key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -725,7 +732,9 @@ function getListOfThirdParties($authentication, $filterthirdparty)
|
||||
{
|
||||
foreach ($extrafields->attributes[$elementtype]['label'] as $key => $label)
|
||||
{
|
||||
$extrafieldsOptions['options_'.$key] = $obj->{$key};
|
||||
if (isset($obj->{$key})) {
|
||||
$extrafieldsOptions['options_'.$key] = $obj->{$key};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -485,7 +485,7 @@ function createUserFromThirdparty($authentication, $thirdpartywithuser)
|
||||
|
||||
$fuser = check_authentication($authentication, $error, $errorcode, $errorlabel);
|
||||
|
||||
if ($fuser->societe_id) $socid = $fuser->societe_id;
|
||||
if ($fuser->socid) $socid = $fuser->socid;
|
||||
|
||||
if (!$error && !$thirdpartywithuser)
|
||||
{
|
||||
@ -502,7 +502,7 @@ function createUserFromThirdparty($authentication, $thirdpartywithuser)
|
||||
$thirdparty = new Societe($db);
|
||||
|
||||
// If a contact / company already exists with the email, return the corresponding socid
|
||||
$sql = "SELECT s.rowid as societe_id FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql = "SELECT s.rowid as socid FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON sp.fk_soc = s.rowid";
|
||||
$sql .= " WHERE s.entity=".$conf->entity;
|
||||
$sql .= " AND s.email='".$db->escape($thirdpartywithuser['email'])."'";
|
||||
@ -690,7 +690,7 @@ function setUserPassword($authentication, $shortuser)
|
||||
|
||||
$fuser = check_authentication($authentication, $error, $errorcode, $errorlabel);
|
||||
|
||||
if ($fuser->societe_id) $socid = $fuser->societe_id;
|
||||
if ($fuser->socid) $socid = $fuser->socid;
|
||||
|
||||
if (!$error && !$shortuser)
|
||||
{
|
||||
|
||||
@ -131,6 +131,35 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* testIsValidEmail
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testIsValidEmail()
|
||||
{
|
||||
// Nb of line is same than entry text
|
||||
|
||||
$input="bidon@bademail";
|
||||
$result=isValidEmail($input);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertFalse($result, 'Check isValidEmail '.$input);
|
||||
|
||||
$input="test@yahoo.com";
|
||||
$result=isValidEmail($input);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertTrue($result, 'Check isValidEmail '.$input);
|
||||
|
||||
$input="The name of sender <test@yahoo.com>";
|
||||
$result=isValidEmail($input);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertFalse($result, 'Check isValidEmail '.$input);
|
||||
|
||||
$input="1234.abcdefg@domainame.com.br";
|
||||
$result=isValidEmail($input);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertTrue($result, 'Check isValidEmail '.$input);
|
||||
}
|
||||
|
||||
/**
|
||||
* testIsValidMXRecord
|
||||
|
||||
@ -61,6 +61,9 @@ class WebservicesInvoicesTest extends PHPUnit\Framework\TestCase
|
||||
|
||||
protected $ns = 'http://www.dolibarr.org/ns/';
|
||||
|
||||
protected $pass = 'admin';
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* We save global variables into local variables
|
||||
@ -248,7 +251,7 @@ class WebservicesInvoicesTest extends PHPUnit\Framework\TestCase
|
||||
'dolibarrkey'=>$conf->global->WEBSERVICES_KEY,
|
||||
'sourceapplication'=>'DEMO',
|
||||
'login'=>'admin',
|
||||
'password'=>'admin',
|
||||
'password'=>$this->pass,
|
||||
'entity'=>'');
|
||||
|
||||
// Test URL
|
||||
@ -272,7 +275,7 @@ class WebservicesInvoicesTest extends PHPUnit\Framework\TestCase
|
||||
print "\n";
|
||||
}
|
||||
|
||||
print __METHOD__." result=".$result['result']['result_code']."\n";
|
||||
print __METHOD__." result=".$result['result']['result_code']." ".$result['result']['result_label']."\n";
|
||||
$this->assertEquals('OK', $result['result']['result_code']);
|
||||
$this->assertEquals('ref-phpunit-2', $result['ref_ext']);
|
||||
|
||||
@ -304,7 +307,7 @@ class WebservicesInvoicesTest extends PHPUnit\Framework\TestCase
|
||||
'dolibarrkey'=>$conf->global->WEBSERVICES_KEY,
|
||||
'sourceapplication'=>'DEMO',
|
||||
'login'=>'admin',
|
||||
'password'=>'admin',
|
||||
'password'=>$this->pass,
|
||||
'entity'=>'');
|
||||
|
||||
// Test URL
|
||||
@ -403,7 +406,7 @@ class WebservicesInvoicesTest extends PHPUnit\Framework\TestCase
|
||||
'dolibarrkey'=>$conf->global->WEBSERVICES_KEY,
|
||||
'sourceapplication'=>'DEMO',
|
||||
'login'=>'admin',
|
||||
'password'=>'admin',
|
||||
'password'=>$this->pass,
|
||||
'entity'=>'');
|
||||
|
||||
// Test URL
|
||||
|
||||
Loading…
Reference in New Issue
Block a user