Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into NEW_Show_Region_in_company_info_&_Global_option_to_show_state_code_MAIN_SHOW_STATE_CODE
# Conflicts: # htdocs/admin/company.php # htdocs/core/class/commonobject.class.php
This commit is contained in:
commit
1a5cdf2406
@ -325,18 +325,21 @@ script:
|
|||||||
set +e
|
set +e
|
||||||
echo
|
echo
|
||||||
#cat $TRAVIS_BUILD_DIR/upgrade400500-2.log
|
#cat $TRAVIS_BUILD_DIR/upgrade400500-2.log
|
||||||
|
#cat $TRAVIS_BUILD_DIR/upgrade500600.log
|
||||||
|
#cat $TRAVIS_BUILD_DIR/upgrade500600-2.log
|
||||||
|
#cat $TRAVIS_BUILD_DIR/upgrade500600-3.log
|
||||||
#cat /tmp/dolibarr_install.log
|
#cat /tmp/dolibarr_install.log
|
||||||
|
|
||||||
- |
|
- |
|
||||||
echo "Unit testing"
|
echo "Unit testing"
|
||||||
# Ensure we catch errors. Set this to +e if you want to go to the end to see log file.
|
# Ensure we catch errors. Set this to +e if you want to go to the end to see dolibarr.log file.
|
||||||
set -e
|
set -e
|
||||||
phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php
|
phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php
|
||||||
set +e
|
set +e
|
||||||
|
|
||||||
- |
|
- |
|
||||||
#echo "Output dolibarr.log"
|
#echo "Output dolibarr.log"
|
||||||
#echo cat documents/dolibarr.log
|
#cat documents/dolibarr.log
|
||||||
|
|
||||||
after_script:
|
after_script:
|
||||||
- |
|
- |
|
||||||
|
|||||||
@ -16,6 +16,10 @@ Following changes may create regressions for some external modules, but were nec
|
|||||||
* The substitution key for reference of object is now __REF__ whatever is the object (it replaces __ORDERREF__,
|
* The substitution key for reference of object is now __REF__ whatever is the object (it replaces __ORDERREF__,
|
||||||
__PROPALREF__, ...)
|
__PROPALREF__, ...)
|
||||||
* Some REST API to access the dictionary (country, town, ...) were moved into a common API.
|
* Some REST API to access the dictionary (country, town, ...) were moved into a common API.
|
||||||
|
* Page bank/index.php and bank/bankentries.php were renamed into bank/list.php and bank/bankentries_list.php to
|
||||||
|
follow page naming conventions (so default filter/sort order features can also work).
|
||||||
|
* The trigger ORDER_SUPPLIER_STATUS_ONPROCESS was renamed ORDER_SUPPLIER_STATUS_ORDERED
|
||||||
|
* The trigger ORDER_SUPPLIER_STATUS_RECEIVED_ALL was renamed ORDER_SUPPLIER_STATUS_RECEIVED_COMPLETELY
|
||||||
|
|
||||||
|
|
||||||
***** ChangeLog for 6.0.1 compared to 6.0.* *****
|
***** ChangeLog for 6.0.1 compared to 6.0.* *****
|
||||||
|
|||||||
@ -149,7 +149,7 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape))
|
|||||||
$condpayment = trim($fields[36]);
|
$condpayment = trim($fields[36]);
|
||||||
if ($condpayment == 'A la commande') $condpayment = 'A réception de commande';
|
if ($condpayment == 'A la commande') $condpayment = 'A réception de commande';
|
||||||
if ($condpayment == 'A reception facture') $condpayment = 'Réception de facture';
|
if ($condpayment == 'A reception facture') $condpayment = 'Réception de facture';
|
||||||
$object->cond_reglement_id = dol_getIdFromCode($db, $condpayment, 'c_payment_term', 'libelle_facture', 'rowid');
|
$object->cond_reglement_id = dol_getIdFromCode($db, $condpayment, 'c_payment_term', 'libelle_facture', 'rowid', 1);
|
||||||
if (empty($object->cond_reglement_id))
|
if (empty($object->cond_reglement_id))
|
||||||
{
|
{
|
||||||
print " - Error cant find payment mode for ".$condpayment."\n";
|
print " - Error cant find payment mode for ".$condpayment."\n";
|
||||||
|
|||||||
1
dev/resources/iso-normes/code_nace.txt
Normal file
1
dev/resources/iso-normes/code_nace.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
http://ec.europa.eu/eurostat/ramon/nomenclatures/index.cfm?TargetUrl=LST_CLS_DLD&StrNom=NACE_REV2&StrLanguageCode=FR&StrLayoutCode=#
|
||||||
@ -126,7 +126,7 @@
|
|||||||
<rule ref="Generic.Metrics.CyclomaticComplexity">
|
<rule ref="Generic.Metrics.CyclomaticComplexity">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="complexity" value="120" />
|
<property name="complexity" value="120" />
|
||||||
<property name="absoluteComplexity" value="250" />
|
<property name="absoluteComplexity" value="300" />
|
||||||
</properties>
|
</properties>
|
||||||
</rule>
|
</rule>
|
||||||
<rule ref="Generic.Metrics.NestingLevel">
|
<rule ref="Generic.Metrics.NestingLevel">
|
||||||
|
|||||||
@ -15,7 +15,7 @@ then
|
|||||||
echo "This push local files to transifex for project $project."
|
echo "This push local files to transifex for project $project."
|
||||||
echo "Note: If you push a language file (not source), file will be skipped if transifex file is newer."
|
echo "Note: If you push a language file (not source), file will be skipped if transifex file is newer."
|
||||||
echo " Using -f will overwrite translation but not memory."
|
echo " Using -f will overwrite translation but not memory."
|
||||||
echo "Usage: ./dev/translation/txpush.sh (source|xx_XX|all) [-r dolibarr.file] [-f] [--no-interactive]"
|
echo "Usage: ./dev/translation/txpush.sh (source|xx_XX|all) [-r ".$project.".file] [-f] [--no-interactive]"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@ -87,9 +87,6 @@ $hookmanager->initHooks(array('admin'));
|
|||||||
// This page is a generic page to edit dictionaries
|
// This page is a generic page to edit dictionaries
|
||||||
// Put here declaration of dictionaries properties
|
// Put here declaration of dictionaries properties
|
||||||
|
|
||||||
// Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this.
|
|
||||||
$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,33,34,0,6,0,29,0,7,17,24,28,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,25,0,26,0,31,32,0);
|
|
||||||
|
|
||||||
// Name of SQL tables of dictionaries
|
// Name of SQL tables of dictionaries
|
||||||
$tabname=array();
|
$tabname=array();
|
||||||
|
|
||||||
@ -148,75 +145,10 @@ $tabfieldcheck=array();
|
|||||||
$tabfieldcheck[31] = array();
|
$tabfieldcheck[31] = array();
|
||||||
$tabfieldcheck[32] = array();
|
$tabfieldcheck[32] = array();
|
||||||
|
|
||||||
// Complete all arrays with entries found into modules
|
|
||||||
complete_dictionary_with_modules($taborder,$tabname,$tablib,$tabsql,$tabsqlsort,$tabfield,$tabfieldvalue,$tabfieldinsert,$tabrowid,$tabcond,$tabhelp,$tabfieldcheck);
|
|
||||||
|
|
||||||
|
|
||||||
// Define elementList and sourceList (used for dictionary type of contacts "llx_c_type_contact")
|
// Define elementList and sourceList (used for dictionary type of contacts "llx_c_type_contact")
|
||||||
$elementList = array();
|
$elementList = array();
|
||||||
$sourceList=array();
|
$sourceList=array();
|
||||||
if ($id == 11)
|
|
||||||
{
|
|
||||||
$langs->load("orders");
|
|
||||||
$langs->load("contracts");
|
|
||||||
$langs->load("projects");
|
|
||||||
$langs->load("propal");
|
|
||||||
$langs->load("bills");
|
|
||||||
$langs->load("interventions");
|
|
||||||
$elementList = array(
|
|
||||||
'' => '',
|
|
||||||
'societe' => $langs->trans('ThirdParty'),
|
|
||||||
// 'proposal' => $langs->trans('Proposal'),
|
|
||||||
// 'order' => $langs->trans('Order'),
|
|
||||||
// 'invoice' => $langs->trans('Bill'),
|
|
||||||
'invoice_supplier' => $langs->trans('SupplierBill'),
|
|
||||||
'order_supplier' => $langs->trans('SupplierOrder'),
|
|
||||||
// 'intervention' => $langs->trans('InterventionCard'),
|
|
||||||
// 'contract' => $langs->trans('Contract'),
|
|
||||||
'project' => $langs->trans('Project'),
|
|
||||||
'project_task' => $langs->trans('Task'),
|
|
||||||
'agenda' => $langs->trans('Agenda'),
|
|
||||||
// old deprecated
|
|
||||||
'contrat' => $langs->trans('Contract'),
|
|
||||||
'propal' => $langs->trans('Proposal'),
|
|
||||||
'commande' => $langs->trans('Order'),
|
|
||||||
'facture' => $langs->trans('Bill'),
|
|
||||||
'resource' => $langs->trans('Resource'),
|
|
||||||
// 'facture_fourn' => $langs->trans('SupplierBill'),
|
|
||||||
'fichinter' => $langs->trans('InterventionCard')
|
|
||||||
);
|
|
||||||
if (! empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES)) $elementList["societe"] = $langs->trans('ThirdParty');
|
|
||||||
|
|
||||||
complete_elementList_with_modules($elementList);
|
|
||||||
|
|
||||||
asort($elementList);
|
|
||||||
$sourceList = array(
|
|
||||||
'internal' => $langs->trans('Internal'),
|
|
||||||
'external' => $langs->trans('External')
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if ($id == 25)
|
|
||||||
{
|
|
||||||
// We save list of template email Dolibarr can manage. This list can found by a grep into code on "->param['models']"
|
|
||||||
$elementList = array();
|
|
||||||
if ($conf->propal->enabled) $elementList['propal_send']=$langs->trans('MailToSendProposal');
|
|
||||||
if ($conf->commande->enabled) $elementList['order_send']=$langs->trans('MailToSendOrder');
|
|
||||||
if ($conf->facture->enabled) $elementList['facture_send']=$langs->trans('MailToSendInvoice');
|
|
||||||
if ($conf->expedition->enabled) $elementList['shipping_send']=$langs->trans('MailToSendShipment');
|
|
||||||
if ($conf->ficheinter->enabled) $elementList['fichinter_send']=$langs->trans('MailToSendIntervention');
|
|
||||||
if ($conf->supplier_proposal->enabled) $elementList['supplier_proposal_send']=$langs->trans('MailToSendSupplierRequestForQuotation');
|
|
||||||
if ($conf->fournisseur->enabled) $elementList['order_supplier_send']=$langs->trans('MailToSendSupplierOrder');
|
|
||||||
if ($conf->fournisseur->enabled) $elementList['invoice_supplier_send']=$langs->trans('MailToSendSupplierInvoice');
|
|
||||||
if ($conf->societe->enabled) $elementList['thirdparty']=$langs->trans('MailToThirdparty');
|
|
||||||
|
|
||||||
$parameters=array('elementList'=>$elementList);
|
|
||||||
$reshook=$hookmanager->executeHooks('emailElementlist',$parameters); // Note that $action and $object may have been modified by some hooks
|
|
||||||
if ($reshook == 0) {
|
|
||||||
foreach ($hookmanager->resArray as $item => $value) {
|
|
||||||
$elementList[$item] = $value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -690,7 +622,6 @@ if ($id)
|
|||||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1;
|
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($id == 4) print '<td></td>';
|
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
@ -731,7 +662,6 @@ if ($id)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($id == 4) print '<td></td>';
|
|
||||||
print '<td colspan="3" align="right">';
|
print '<td colspan="3" align="right">';
|
||||||
if ($tabname[$id] != MAIN_DB_PREFIX.'c_email_templates' || $action != 'edit')
|
if ($tabname[$id] != MAIN_DB_PREFIX.'c_email_templates' || $action != 'edit')
|
||||||
{
|
{
|
||||||
@ -741,9 +671,8 @@ if ($id)
|
|||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|
||||||
$colspan=count($fieldlist)+3;
|
$colspan=count($fieldlist)+3;
|
||||||
if ($id == 4) $colspan++;
|
|
||||||
|
|
||||||
if (! empty($alabelisused) && $id != 25) // If there is one label among fields, we show legend of *
|
if (! empty($alabelisused)) // If there is one label among fields, we show legend of *
|
||||||
{
|
{
|
||||||
print '<tr><td colspan="'.$colspan.'">* '.$langs->trans("LabelUsedByDefault").'.</td></tr>';
|
print '<tr><td colspan="'.$colspan.'">* '.$langs->trans("LabelUsedByDefault").'.</td></tr>';
|
||||||
}
|
}
|
||||||
@ -775,9 +704,38 @@ if ($id)
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Title of lines
|
// Title line with search boxes
|
||||||
print '<tr class="liste_titre liste_titre_add">';
|
print '<tr class="liste_titre liste_titre_add">';
|
||||||
foreach ($fieldlist as $field => $value)
|
foreach ($fieldlist as $field => $value)
|
||||||
|
{
|
||||||
|
$showfield=1; // By defaut
|
||||||
|
|
||||||
|
if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $showfield=0; }
|
||||||
|
|
||||||
|
if ($showfield)
|
||||||
|
{
|
||||||
|
if ($value == 'country')
|
||||||
|
{
|
||||||
|
print '<td class="liste_titre">';
|
||||||
|
print $form->select_country($search_country_id, 'search_country_id', '', 28, 'maxwidth200 maxwidthonsmartphone');
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<td class="liste_titre"></td>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print '<td class="liste_titre"></td>';
|
||||||
|
print '<td class="liste_titre" colspan="2" align="right">';
|
||||||
|
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
||||||
|
print $searchpicto;
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
// Title of lines
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
foreach ($fieldlist as $field => $value)
|
||||||
{
|
{
|
||||||
// Determine le nom du champ par rapport aux noms possibles
|
// Determine le nom du champ par rapport aux noms possibles
|
||||||
// dans les dictionnaires de donnees
|
// dans les dictionnaires de donnees
|
||||||
@ -845,44 +803,11 @@ if ($id)
|
|||||||
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "align=".$align, $sortfield, $sortorder);
|
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "align=".$align, $sortfield, $sortorder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Favorite - Only activated on country dictionary
|
|
||||||
if ($id == 4) print getTitleFieldOfList($langs->trans("Favorite"), 0, $_SERVER["PHP_SELF"], "favorite", ($page?'page='.$page.'&':''), $param, 'align="center"', $sortfield, $sortorder);
|
|
||||||
|
|
||||||
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page?'page='.$page.'&':''), $param, 'align="center"', $sortfield, $sortorder);
|
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page?'page='.$page.'&':''), $param, 'align="center"', $sortfield, $sortorder);
|
||||||
print getTitleFieldOfList('');
|
print getTitleFieldOfList('');
|
||||||
print getTitleFieldOfList('');
|
print getTitleFieldOfList('');
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Title line with search boxes
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
foreach ($fieldlist as $field => $value)
|
|
||||||
{
|
|
||||||
$showfield=1; // By defaut
|
|
||||||
|
|
||||||
if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $showfield=0; }
|
|
||||||
|
|
||||||
if ($showfield)
|
|
||||||
{
|
|
||||||
if ($value == 'country')
|
|
||||||
{
|
|
||||||
print '<td class="liste_titre">';
|
|
||||||
print $form->select_country($search_country_id, 'search_country_id', '', 28, 'maxwidth200 maxwidthonsmartphone');
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<td class="liste_titre"></td>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($id == 4) print '<td></td>';
|
|
||||||
print '<td class="liste_titre"></td>';
|
|
||||||
print '<td class="liste_titre" colspan="2" align="right">';
|
|
||||||
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
|
||||||
print $searchpicto;
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
if ($num)
|
if ($num)
|
||||||
{
|
{
|
||||||
// Lines with values
|
// Lines with values
|
||||||
@ -1090,16 +1015,6 @@ if ($id)
|
|||||||
if ($param) $url .= '&'.$param;
|
if ($param) $url .= '&'.$param;
|
||||||
$url.='&';
|
$url.='&';
|
||||||
|
|
||||||
// Favorite
|
|
||||||
// Only activated on country dictionary
|
|
||||||
if ($id == 4)
|
|
||||||
{
|
|
||||||
print '<td align="center" class="nowrap">';
|
|
||||||
if ($iserasable) print '<a href="'.$url.'action='.$acts[$obj->favorite].'_favorite">'.$actl[$obj->favorite].'</a>';
|
|
||||||
else print $langs->trans("AlwaysActive");
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Active
|
// Active
|
||||||
print '<td align="center" class="nowrap">';
|
print '<td align="center" class="nowrap">';
|
||||||
if ($canbedisabled) print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
|
if ($canbedisabled) print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
|
||||||
@ -1135,65 +1050,6 @@ if ($id)
|
|||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* Show list of dictionary to show
|
|
||||||
*/
|
|
||||||
|
|
||||||
$lastlineisempty=false;
|
|
||||||
print '<table class="noborder" width="100%">';
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
//print '<td>'.$langs->trans("Module").'</td>';
|
|
||||||
print '<td colspan="2">'.$langs->trans("Dictionary").'</td>';
|
|
||||||
print '<td>'.$langs->trans("Table").'</td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
$showemptyline='';
|
|
||||||
foreach ($taborder as $i)
|
|
||||||
{
|
|
||||||
if (isset($tabname[$i]) && empty($tabcond[$i])) continue;
|
|
||||||
|
|
||||||
if ($i)
|
|
||||||
{
|
|
||||||
if ($showemptyline)
|
|
||||||
{
|
|
||||||
print '<tr class="oddeven"><td width="30%"> </td><td> </td><td> </td></tr>';
|
|
||||||
$showemptyline=0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$value=$tabname[$i];
|
|
||||||
print '<tr class="oddeven"><td width="50%">';
|
|
||||||
if (! empty($tabcond[$i]))
|
|
||||||
{
|
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$i.'">'.$langs->trans($tablib[$i]).'</a>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print $langs->trans($tablib[$i]);
|
|
||||||
}
|
|
||||||
print '</td>';
|
|
||||||
print '<td>';
|
|
||||||
/*if (empty($tabcond[$i]))
|
|
||||||
{
|
|
||||||
print info_admin($langs->trans("DictionaryDisabledSinceNoModuleNeedIt"),1);
|
|
||||||
}*/
|
|
||||||
print '</td>';
|
|
||||||
print '<td>'.$tabname[$i].'</td></tr>';
|
|
||||||
$lastlineisempty=false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (! $lastlineisempty)
|
|
||||||
{
|
|
||||||
$showemptyline=1;
|
|
||||||
$lastlineisempty=true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
print '</table>';
|
|
||||||
}
|
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
|
|||||||
@ -354,6 +354,7 @@ if ($action == $acts[1])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
@ -527,8 +528,25 @@ if ($id)
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Title line with search boxes
|
||||||
|
print '<tr class="liste_titre_filter liste_titre_add">';
|
||||||
|
print '<td class="liste_titre"></td>';
|
||||||
|
print '<td class="liste_titre"></td>';
|
||||||
|
print '<td class="liste_titre"></td>';
|
||||||
|
print '<td class="liste_titre"></td>';
|
||||||
|
print '<td class="liste_titre"></td>';
|
||||||
|
print '<td class="liste_titre"></td>';
|
||||||
|
print '<td class="liste_titre" align="center">';
|
||||||
|
if ($filterfound)
|
||||||
|
{
|
||||||
|
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
||||||
|
print $searchpicto;
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
// Title of lines
|
// Title of lines
|
||||||
print '<tr class="liste_titre liste_titre_add">';
|
print '<tr class="liste_titre">';
|
||||||
foreach ($fieldlist as $field => $value)
|
foreach ($fieldlist as $field => $value)
|
||||||
{
|
{
|
||||||
// Determine le nom du champ par rapport aux noms possibles
|
// Determine le nom du champ par rapport aux noms possibles
|
||||||
@ -562,23 +580,6 @@ if ($id)
|
|||||||
print getTitleFieldOfList('');
|
print getTitleFieldOfList('');
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Title line with search boxes
|
|
||||||
print '<tr class="liste_titre_filter">';
|
|
||||||
print '<td class="liste_titre"></td>';
|
|
||||||
print '<td class="liste_titre"></td>';
|
|
||||||
print '<td class="liste_titre"></td>';
|
|
||||||
print '<td class="liste_titre"></td>';
|
|
||||||
print '<td class="liste_titre"></td>';
|
|
||||||
print '<td class="liste_titre"></td>';
|
|
||||||
print '<td class="liste_titre" align="center">';
|
|
||||||
if ($filterfound)
|
|
||||||
{
|
|
||||||
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
|
||||||
print $searchpicto;
|
|
||||||
}
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
if ($num)
|
if ($num)
|
||||||
{
|
{
|
||||||
// Lines with values
|
// Lines with values
|
||||||
|
|||||||
@ -569,7 +569,7 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
print_liste_field_titre("AccountAccountingShort");
|
print_liste_field_titre("AccountAccountingShort");
|
||||||
print_liste_field_titre("SubledgerAccount");
|
print_liste_field_titre("SubledgerAccount");
|
||||||
print_liste_field_titre("Labelcompte");
|
print_liste_field_titre("LabelAccount");
|
||||||
print_liste_field_titre("Label");
|
print_liste_field_titre("Label");
|
||||||
print_liste_field_titre("Debit", "", "", "", "", 'align="right"');
|
print_liste_field_titre("Debit", "", "", "", "", 'align="right"');
|
||||||
print_liste_field_titre("Credit", "", "", "", "", 'align="right"');
|
print_liste_field_titre("Credit", "", "", "", "", 'align="right"');
|
||||||
|
|||||||
@ -399,7 +399,7 @@ print '</td>';
|
|||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<div class="nowrap">';
|
print '<div class="nowrap">';
|
||||||
print $langs->trans('From').' ';
|
print $langs->trans('From').' ';
|
||||||
// TODO For the moment we keep a fre input text instead of a combo. The select_auxaccount has problem because it does not
|
// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because it does not
|
||||||
// use setup of keypress to select thirdparty and this hang browser on large database.
|
// use setup of keypress to select thirdparty and this hang browser on large database.
|
||||||
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
||||||
{
|
{
|
||||||
@ -412,7 +412,7 @@ else
|
|||||||
print '</div>';
|
print '</div>';
|
||||||
print '<div class="nowrap">';
|
print '<div class="nowrap">';
|
||||||
print $langs->trans('to').' ';
|
print $langs->trans('to').' ';
|
||||||
// TODO For the moment we keep a fre input text instead of a combo. The select_auxaccount has problem because it does not
|
// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because it does not
|
||||||
// use setup of keypress to select thirdparty and this hang browser on large database.
|
// use setup of keypress to select thirdparty and this hang browser on large database.
|
||||||
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
||||||
{
|
{
|
||||||
@ -489,8 +489,8 @@ while ($i < min($num, $limit))
|
|||||||
}
|
}
|
||||||
|
|
||||||
print '<tr class="liste_total">';
|
print '<tr class="liste_total">';
|
||||||
if ($num < $limit) print '<td align="left" colspan="6">'.$langs->trans("Total").'</td>';
|
if ($num < $limit) print '<td align="left" colspan="7">'.$langs->trans("Total").'</td>';
|
||||||
else print '<td align="left" colspan="6">'.$langs->trans("Totalforthispage").'</td>';
|
else print '<td align="left" colspan="7">'.$langs->trans("Totalforthispage").'</td>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
print price($total_debit);
|
print price($total_debit);
|
||||||
|
|||||||
@ -196,7 +196,7 @@ llxHeader ( '', 'Compta - Grand Livre' );
|
|||||||
print_liste_field_titre("Docref", "liste.php", "bk.doc_ref" );
|
print_liste_field_titre("Docref", "liste.php", "bk.doc_ref" );
|
||||||
// print_liste_field_titre("Numerocompte", "liste.php", "bk.numero_compte" );
|
// print_liste_field_titre("Numerocompte", "liste.php", "bk.numero_compte" );
|
||||||
// print_liste_field_titre("Code_tiers", "liste.php", "bk.code_tiers" );
|
// print_liste_field_titre("Code_tiers", "liste.php", "bk.code_tiers" );
|
||||||
print_liste_field_titre("Labelcompte", "liste.php", "bk_label_compte" );
|
print_liste_field_titre("LabelAccount", "liste.php", "bk_label_compte" );
|
||||||
print_liste_field_titre("Debit", "liste.php", "bk.debit" );
|
print_liste_field_titre("Debit", "liste.php", "bk.debit" );
|
||||||
print_liste_field_titre("Credit", "liste.php", "bk.credit" );
|
print_liste_field_titre("Credit", "liste.php", "bk.credit" );
|
||||||
// print_liste_field_titre("Amount", "liste.php", "bk.montant" );
|
// print_liste_field_titre("Amount", "liste.php", "bk.montant" );
|
||||||
|
|||||||
@ -205,7 +205,7 @@ llxHeader ( '', 'Compta - Grand Livre' );
|
|||||||
print_liste_field_titre("Docref", "liste.php", "bk.doc_ref" );
|
print_liste_field_titre("Docref", "liste.php", "bk.doc_ref" );
|
||||||
// print_liste_field_titre("Numerocompte", "liste.php", "bk.numero_compte" );
|
// print_liste_field_titre("Numerocompte", "liste.php", "bk.numero_compte" );
|
||||||
// print_liste_field_titre("Code_tiers", "liste.php", "bk.code_tiers" );
|
// print_liste_field_titre("Code_tiers", "liste.php", "bk.code_tiers" );
|
||||||
print_liste_field_titre("Labelcompte", "liste.php", "bk_label_compte" );
|
print_liste_field_titre("LabelAccount", "liste.php", "bk_label_compte" );
|
||||||
print_liste_field_titre("Debit", "liste.php", "bk.debit" );
|
print_liste_field_titre("Debit", "liste.php", "bk.debit" );
|
||||||
print_liste_field_titre("Credit", "liste.php", "bk.credit" );
|
print_liste_field_titre("Credit", "liste.php", "bk.credit" );
|
||||||
print_liste_field_titre("Amount", "liste.php", "bk.montant" );
|
print_liste_field_titre("Amount", "liste.php", "bk.montant" );
|
||||||
|
|||||||
@ -419,7 +419,7 @@ class AccountancyExport
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Export format : Agiris
|
* Export format : Agiris Isacompta
|
||||||
*
|
*
|
||||||
* @param array $objectLines data
|
* @param array $objectLines data
|
||||||
*
|
*
|
||||||
@ -433,30 +433,23 @@ class AccountancyExport
|
|||||||
|
|
||||||
$date = dol_print_date($line->doc_date, '%d%m%Y');
|
$date = dol_print_date($line->doc_date, '%d%m%Y');
|
||||||
|
|
||||||
print $line->id . $this->separator;
|
print $line->piece_num . $this->separator;
|
||||||
print '"'.dol_trunc($line->piece_num,15,'right','UTF-8',1).'"'.$this->separator;
|
print $line->label_operation . $this->separator;
|
||||||
print $date . $this->separator;
|
print $date . $this->separator;
|
||||||
print '"'.dol_trunc($line->piece_num,15,'right','UTF-8',1).'"'.$this->separator;
|
print $line->label_operation . $this->separator;
|
||||||
|
|
||||||
if (empty($line->subledger_account)) {
|
if (empty($line->subledger_account)) {
|
||||||
print length_accountg($line->numero_compte) . $this->separator;
|
print length_accountg($line->numero_compte) . $this->separator;
|
||||||
} else {
|
} else {
|
||||||
// FIXME Because the subledger_account is already an accounting account, does we really need
|
print length_accounta($line->subledger_account) . $this->separator;
|
||||||
// to concat 4011 or 401 to it ?
|
|
||||||
if (substr($line->numero_compte, 0, 1) == 'C' || substr($line->numero_compte, 0, 1) == '9') {
|
|
||||||
print '411' . substr(str_replace(" ", "", $line->subledger_account), 0, 5) . $this->separator;
|
|
||||||
}
|
|
||||||
if (substr($line->numero_compte, 0, 1) == 'F' || substr($line->numero_compte, 0, 1) == '0') {
|
|
||||||
print '401' . substr(str_replace(" ", "", $line->subledger_account), 0, 5) . $this->separator;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print length_accounta($line->subledger_account) . $this->separator;
|
print $line->doc_ref . $this->separator;
|
||||||
print price($line->debit) . $this->separator;
|
print price($line->debit) . $this->separator;
|
||||||
print price($line->credit) . $this->separator;
|
print price($line->credit) . $this->separator;
|
||||||
print price($line->montant).$this->separator;
|
print price($line->montant).$this->separator;
|
||||||
print $line->sens.$this->separator;
|
print $line->sens.$this->separator;
|
||||||
print $line->code_journal . $this->separator;
|
print $line->code_journal;
|
||||||
print $this->end_line;
|
print $this->end_line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro@zendsi.com>
|
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||||
*
|
*
|
||||||
@ -310,6 +310,7 @@ if ($resql) {
|
|||||||
}
|
}
|
||||||
else print length_accountg($row[0]);
|
else print length_accountg($row[0]);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td align="left">';
|
print '<td align="left">';
|
||||||
if ($row[0] == 'tobind')
|
if ($row[0] == 'tobind')
|
||||||
{
|
{
|
||||||
@ -317,7 +318,7 @@ if ($resql) {
|
|||||||
}
|
}
|
||||||
else print $row[1];
|
else print $row[1];
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="left">' . $row[1] . '</td>';
|
|
||||||
for($i = 2; $i <= 12; $i ++) {
|
for($i = 2; $i <= 12; $i ++) {
|
||||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -422,7 +422,6 @@ if (! $error && $action == 'writebookkeeping') {
|
|||||||
$bookkeeping->fk_doc = $key;
|
$bookkeeping->fk_doc = $key;
|
||||||
$bookkeeping->fk_docdet = $val["fk_bank"];
|
$bookkeeping->fk_docdet = $val["fk_bank"];
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
$bookkeeping->label_operation = $val["label"];
|
|
||||||
$bookkeeping->label_compte = $langs->trans("Bank");
|
$bookkeeping->label_compte = $langs->trans("Bank");
|
||||||
$bookkeeping->montant = $mt;
|
$bookkeeping->montant = $mt;
|
||||||
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
|
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
|
||||||
@ -433,21 +432,28 @@ if (! $error && $action == 'writebookkeeping') {
|
|||||||
$bookkeeping->fk_user_author = $user->id;
|
$bookkeeping->fk_user_author = $user->id;
|
||||||
$bookkeeping->date_create = $now;
|
$bookkeeping->date_create = $now;
|
||||||
|
|
||||||
// No subledger_account value for the bank line
|
// No subledger_account value for the bank line but add a specific label_operation
|
||||||
if ($tabtype[$key] == 'payment') {
|
if ($tabtype[$key] == 'payment') {
|
||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
|
$bookkeeping->label_operation = $tabcompany[$key]['name'] . ' - ' . $ref;
|
||||||
} else if ($tabtype[$key] == 'payment_supplier') {
|
} else if ($tabtype[$key] == 'payment_supplier') {
|
||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
|
$bookkeeping->label_operation = $tabcompany[$key]['name'] . ' - ' . $ref;
|
||||||
} else if ($tabtype[$key] == 'payment_expensereport') {
|
} else if ($tabtype[$key] == 'payment_expensereport') {
|
||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
|
$bookkeeping->label_operation = $tabuser[$key]['name'] . ' - ' . $ref;
|
||||||
} else if ($tabtype[$key] == 'payment_salary') {
|
} else if ($tabtype[$key] == 'payment_salary') {
|
||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
|
$bookkeeping->label_operation = $tabuser[$key]['name'] . ' - ' . $ref;
|
||||||
} else if ($tabtype[$key] == 'payment_vat') {
|
} else if ($tabtype[$key] == 'payment_vat') {
|
||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
|
$bookkeeping->label_operation = $ref;
|
||||||
} else if ($tabtype[$key] == 'payment_donation') {
|
} else if ($tabtype[$key] == 'payment_donation') {
|
||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
|
$bookkeeping->label_operation = $ref;
|
||||||
} else if ($tabtype[$key] == 'payment_various') {
|
} else if ($tabtype[$key] == 'payment_various') {
|
||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
|
$bookkeeping->label_operation = $ref;
|
||||||
} else if ($tabtype[$key] == 'unknown') {
|
} else if ($tabtype[$key] == 'unknown') {
|
||||||
// ???
|
// ???
|
||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
@ -484,7 +490,6 @@ if (! $error && $action == 'writebookkeeping') {
|
|||||||
$bookkeeping->doc_type = 'bank';
|
$bookkeeping->doc_type = 'bank';
|
||||||
$bookkeeping->fk_doc = $key;
|
$bookkeeping->fk_doc = $key;
|
||||||
$bookkeeping->fk_docdet = $val["fk_bank"];
|
$bookkeeping->fk_docdet = $val["fk_bank"];
|
||||||
$bookkeeping->label_operation = $tabcompany[$key]['name'];
|
|
||||||
$bookkeeping->montant = $mt;
|
$bookkeeping->montant = $mt;
|
||||||
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
|
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
|
||||||
$bookkeeping->debit = ($mt < 0 ? - $mt : 0);
|
$bookkeeping->debit = ($mt < 0 ? - $mt : 0);
|
||||||
@ -495,55 +500,55 @@ if (! $error && $action == 'writebookkeeping') {
|
|||||||
$bookkeeping->date_create = $now;
|
$bookkeeping->date_create = $now;
|
||||||
|
|
||||||
if ($tabtype[$key] == 'payment') { // If payment is payment of customer invoice, we get ref of invoice
|
if ($tabtype[$key] == 'payment') { // If payment is payment of customer invoice, we get ref of invoice
|
||||||
$bookkeeping->label_operation = '';
|
$bookkeeping->label_operation = $tabcompany[$key]['name'] . ' - ' . $ref;
|
||||||
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
|
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
|
||||||
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
|
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
|
||||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
|
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
|
||||||
$bookkeeping->label_compte = '';
|
$bookkeeping->label_compte = '';
|
||||||
} else if ($tabtype[$key] == 'payment_supplier') { // If payment is payment of supplier invoice, we get ref of invoice
|
} else if ($tabtype[$key] == 'payment_supplier') { // If payment is payment of supplier invoice, we get ref of invoice
|
||||||
$bookkeeping->label_operation = '';
|
$bookkeeping->label_operation = $tabcompany[$key]['name'] . ' - ' . $ref;
|
||||||
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
|
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
|
||||||
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
|
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
|
||||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
|
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
|
||||||
$bookkeeping->label_compte = '';
|
$bookkeeping->label_compte = '';
|
||||||
} else if ($tabtype[$key] == 'payment_expensereport') {
|
} else if ($tabtype[$key] == 'payment_expensereport') {
|
||||||
$bookkeeping->label_operation = $tabuser[$key]['name'];
|
$bookkeeping->label_operation = $tabuser[$key]['name'] . ' - ' . $ref;
|
||||||
$bookkeeping->subledger_account = $tabuser[$key]['accountancy_code'];
|
$bookkeeping->subledger_account = $tabuser[$key]['accountancy_code'];
|
||||||
$bookkeeping->subledger_label = $tabuser[$key]['name'];
|
$bookkeeping->subledger_label = $tabuser[$key]['name'];
|
||||||
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
||||||
$bookkeeping->label_compte = '';
|
$bookkeeping->label_compte = '';
|
||||||
} else if ($tabtype[$key] == 'payment_salary') {
|
} else if ($tabtype[$key] == 'payment_salary') {
|
||||||
$bookkeeping->label_operation = $tabuser[$key]['name'];
|
$bookkeeping->label_operation = $tabuser[$key]['name'] . ' - ' . $ref;
|
||||||
$bookkeeping->subledger_account = $tabuser[$key]['accountancy_code'];
|
$bookkeeping->subledger_account = $tabuser[$key]['accountancy_code'];
|
||||||
$bookkeeping->subledger_label = $tabuser[$key]['name'];
|
$bookkeeping->subledger_label = $tabuser[$key]['name'];
|
||||||
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
||||||
$bookkeeping->label_compte = '';
|
$bookkeeping->label_compte = '';
|
||||||
} else if (in_array($tabtype[$key], array('sc', 'payment_sc'))) { // If payment is payment of social contribution
|
} else if (in_array($tabtype[$key], array('sc', 'payment_sc'))) { // If payment is payment of social contribution
|
||||||
$bookkeeping->label_operation = '';
|
$bookkeeping->label_operation = $ref;
|
||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
$bookkeeping->subledger_label = '';
|
$bookkeeping->subledger_label = '';
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
$bookkeeping->label_compte = $objmid->labelc;
|
$bookkeeping->label_compte = $objmid->labelc;
|
||||||
} else if ($tabtype[$key] == 'payment_vat') {
|
} else if ($tabtype[$key] == 'payment_vat') {
|
||||||
$bookkeeping->label_operation = '';
|
$bookkeeping->label_operation = $ref;
|
||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
$bookkeeping->subledger_label = '';
|
$bookkeeping->subledger_label = '';
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
$bookkeeping->label_compte = '';
|
$bookkeeping->label_compte = '';
|
||||||
} else if ($tabtype[$key] == 'payment_donation') {
|
} else if ($tabtype[$key] == 'payment_donation') {
|
||||||
$bookkeeping->label_operation = '';
|
$bookkeeping->label_operation = $ref;
|
||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
$bookkeeping->subledger_label = '';
|
$bookkeeping->subledger_label = '';
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
$bookkeeping->label_compte = '';
|
$bookkeeping->label_compte = '';
|
||||||
} else if ($tabtype[$key] == 'payment_various') {
|
} else if ($tabtype[$key] == 'payment_various') {
|
||||||
$bookkeeping->label_operation = '';
|
$bookkeeping->label_operation = $ref;
|
||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
$bookkeeping->subledger_label = '';
|
$bookkeeping->subledger_label = '';
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
$bookkeeping->label_compte = '';
|
$bookkeeping->label_compte = '';
|
||||||
} else if ($tabtype[$key] == 'banktransfert') {
|
} else if ($tabtype[$key] == 'banktransfert') {
|
||||||
$bookkeeping->label_operation = '';
|
$bookkeeping->label_operation = $ref;
|
||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
$bookkeeping->subledger_label = '';
|
$bookkeeping->subledger_label = '';
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
@ -676,9 +681,9 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
|||||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||||
print " " . $sep;
|
print " " . $sep;
|
||||||
if ($companystatic->name == '') {
|
if ($companystatic->name == '') {
|
||||||
print '"' . $langs->trans('Bank') . " - " . utf8_decode($reflabel) . '"' . $sep;
|
print '"' . $val['bank_account_ref'] . " - " . utf8_decode($reflabel) . '"' . $sep;
|
||||||
} else {
|
} else {
|
||||||
print '"' . $langs->trans("Bank") . ' - ' . utf8_decode($companystatic->name) . '"' . $sep;
|
print '"' . $val['bank_account_ref'] . ' - ' . utf8_decode($companystatic->name) . '"' . $sep;
|
||||||
}
|
}
|
||||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
|
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
|
||||||
@ -720,9 +725,9 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
|||||||
print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
|
print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
|
||||||
print " " . $sep;
|
print " " . $sep;
|
||||||
if ($companystatic->name == '') {
|
if ($companystatic->name == '') {
|
||||||
print '"' . $langs->trans("Bank") . ' - ' . utf8_decode($reflabel) . '"' . $sep;
|
print '"' . $val['bank_account_ref'] . ' - ' . utf8_decode($reflabel) . '"' . $sep;
|
||||||
} else {
|
} else {
|
||||||
print '"' . $langs->trans("Bank") . ' - ' . utf8_decode($companystatic->name) . '"' . $sep;
|
print '"' . $val['bank_account_ref'] . ' - ' . utf8_decode($companystatic->name) . '"' . $sep;
|
||||||
}
|
}
|
||||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
|
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
|
||||||
@ -823,7 +828,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("ObjectsRef") . ")</td>";
|
print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("ObjectsRef") . ")</td>";
|
||||||
print "<td>" . $langs->trans("AccountAccounting") . "</td>";
|
print "<td>" . $langs->trans("AccountAccounting") . "</td>";
|
||||||
print "<td>" . $langs->trans("SubledgerAccount") . "</td>";
|
print "<td>" . $langs->trans("SubledgerAccount") . "</td>";
|
||||||
print "<td>" . $langs->trans("Label") . "</td>";
|
print "<td>" . $langs->trans("LabelOperation") . "</td>";
|
||||||
print "<td>" . $langs->trans("PaymentMode") . "</td>";
|
print "<td>" . $langs->trans("PaymentMode") . "</td>";
|
||||||
print "<td align='right'>" . $langs->trans("Debit") . "</td>";
|
print "<td align='right'>" . $langs->trans("Debit") . "</td>";
|
||||||
print "<td align='right'>" . $langs->trans("Credit") . "</td>";
|
print "<td align='right'>" . $langs->trans("Credit") . "</td>";
|
||||||
|
|||||||
@ -298,7 +298,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
$bookkeeping->subledger_label = '';
|
$bookkeeping->subledger_label = '';
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
$bookkeeping->label_operation = $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]);
|
$bookkeeping->label_operation = $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]).' %';
|
||||||
$bookkeeping->montant = $mt;
|
$bookkeeping->montant = $mt;
|
||||||
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
||||||
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
||||||
@ -552,7 +552,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("ExpenseReportRef") . ")</td>";
|
print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("ExpenseReportRef") . ")</td>";
|
||||||
print "<td>" . $langs->trans("AccountAccounting") . "</td>";
|
print "<td>" . $langs->trans("AccountAccounting") . "</td>";
|
||||||
print "<td>" . $langs->trans("SubledgerAccount") . "</td>";
|
print "<td>" . $langs->trans("SubledgerAccount") . "</td>";
|
||||||
print "<td>" . $langs->trans("Label") . "</td>";
|
print "<td>" . $langs->trans("LabelOperation") . "</td>";
|
||||||
print "<td align='right'>" . $langs->trans("Debit") . "</td>";
|
print "<td align='right'>" . $langs->trans("Debit") . "</td>";
|
||||||
print "<td align='right'>" . $langs->trans("Credit") . "</td>";
|
print "<td align='right'>" . $langs->trans("Credit") . "</td>";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
@ -659,7 +659,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
// Subledger account
|
// Subledger account
|
||||||
print "<td>";
|
print "<td>";
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]).($numtax?' - Localtax '.$numtax:'');
|
print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]).' %'.($numtax?' - Localtax '.$numtax:'');
|
||||||
print "</td>";
|
print "</td>";
|
||||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||||
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||||
|
|||||||
@ -224,7 +224,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping = new BookKeeping($db);
|
$bookkeeping = new BookKeeping($db);
|
||||||
$bookkeeping->doc_date = $val["date"];
|
$bookkeeping->doc_date = $val["date"];
|
||||||
$bookkeeping->date_lim_reglement = $val["datereg"];
|
$bookkeeping->date_lim_reglement = $val["datereg"];
|
||||||
$bookkeeping->doc_ref = $val["ref"];
|
$bookkeeping->doc_ref = $val["refsologest"];
|
||||||
$bookkeeping->date_create = $now;
|
$bookkeeping->date_create = $now;
|
||||||
$bookkeeping->doc_type = 'supplier_invoice';
|
$bookkeeping->doc_type = 'supplier_invoice';
|
||||||
$bookkeeping->fk_doc = $key;
|
$bookkeeping->fk_doc = $key;
|
||||||
@ -272,7 +272,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping = new BookKeeping($db);
|
$bookkeeping = new BookKeeping($db);
|
||||||
$bookkeeping->doc_date = $val["date"];
|
$bookkeeping->doc_date = $val["date"];
|
||||||
$bookkeeping->date_lim_reglement = $val["datereg"];
|
$bookkeeping->date_lim_reglement = $val["datereg"];
|
||||||
$bookkeeping->doc_ref = $val["ref"];
|
$bookkeeping->doc_ref = $val["refsologest"];
|
||||||
$bookkeeping->date_create = $now;
|
$bookkeeping->date_create = $now;
|
||||||
$bookkeeping->doc_type = 'supplier_invoice';
|
$bookkeeping->doc_type = 'supplier_invoice';
|
||||||
$bookkeeping->fk_doc = $key;
|
$bookkeeping->fk_doc = $key;
|
||||||
@ -326,7 +326,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping = new BookKeeping($db);
|
$bookkeeping = new BookKeeping($db);
|
||||||
$bookkeeping->doc_date = $val["date"];
|
$bookkeeping->doc_date = $val["date"];
|
||||||
$bookkeeping->date_lim_reglement = $val["datereg"];
|
$bookkeeping->date_lim_reglement = $val["datereg"];
|
||||||
$bookkeeping->doc_ref = $val["ref"];
|
$bookkeeping->doc_ref = $val["refsologest"];
|
||||||
$bookkeeping->date_create = $now;
|
$bookkeeping->date_create = $now;
|
||||||
$bookkeeping->doc_type = 'supplier_invoice';
|
$bookkeeping->doc_type = 'supplier_invoice';
|
||||||
$bookkeeping->fk_doc = $key;
|
$bookkeeping->fk_doc = $key;
|
||||||
@ -335,7 +335,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
$bookkeeping->subledger_label = '';
|
$bookkeeping->subledger_label = '';
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT").' '.join(', ',$def_tva[$key][$k]) . ($numtax?' - Localtax '.$numtax:'');
|
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT").' '.join(', ',$def_tva[$key][$k]) .' %' . ($numtax?' - Localtax '.$numtax:'');
|
||||||
$bookkeeping->montant = $mt;
|
$bookkeeping->montant = $mt;
|
||||||
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
||||||
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
||||||
@ -419,7 +419,6 @@ $form = new Form($db);
|
|||||||
// Export
|
// Export
|
||||||
if ($action == 'exportcsv') {
|
if ($action == 'exportcsv') {
|
||||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||||
$journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
|
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
||||||
|
|
||||||
@ -445,7 +444,7 @@ if ($action == 'exportcsv') {
|
|||||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||||
print '"' . $key . '"' . $sep;
|
print '"' . $key . '"' . $sep;
|
||||||
print '"' . $date . '"' . $sep;
|
print '"' . $date . '"' . $sep;
|
||||||
print '"' . $val["refsuppliersologest"] . '"' . $sep;
|
print '"' . $val["refsologest"] . '"' . $sep;
|
||||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ). '"' . $sep;
|
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ). '"' . $sep;
|
||||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||||
print '"' . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . '"' . $sep;
|
print '"' . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . '"' . $sep;
|
||||||
@ -465,11 +464,11 @@ if ($action == 'exportcsv') {
|
|||||||
if ($mt) {
|
if ($mt) {
|
||||||
print '"' . $key . '"' . $sep;
|
print '"' . $key . '"' . $sep;
|
||||||
print '"' . $date . '"' . $sep;
|
print '"' . $date . '"' . $sep;
|
||||||
print '"' . $val["refsuppliersologest"] . '"' . $sep;
|
print '"' . $val["refsologest"] . '"' . $sep;
|
||||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ) . '"' . $sep;
|
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ) . '"' . $sep;
|
||||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||||
print " " . $sep;
|
print '""' . $sep;
|
||||||
print '"' . utf8_decode ( dol_trunc($accountingaccount->label, 32) ) . '"' . $sep;
|
print '"' . utf8_decode ( dol_trunc($accountingaccount->label, 32) ) . '"' . $sep;
|
||||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
|
print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
|
||||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||||
@ -478,6 +477,7 @@ if ($action == 'exportcsv') {
|
|||||||
print "\n";
|
print "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// VAT
|
// VAT
|
||||||
$listoftax = array(0, 1, 2);
|
$listoftax = array(0, 1, 2);
|
||||||
foreach ($listoftax as $numtax) {
|
foreach ($listoftax as $numtax) {
|
||||||
@ -489,13 +489,13 @@ if ($action == 'exportcsv') {
|
|||||||
if ($mt) {
|
if ($mt) {
|
||||||
print '"' . $key . '"' . $sep;
|
print '"' . $key . '"' . $sep;
|
||||||
print '"' . $date . '"' . $sep;
|
print '"' . $date . '"' . $sep;
|
||||||
print '"' . $val["refsuppliersologest"] . '"' . $sep;
|
print '"' . $val["refsologest"] . '"' . $sep;
|
||||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ) . '"' . $sep;
|
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ) . '"' . $sep;
|
||||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||||
print " " . $sep;
|
print '""' . $sep;
|
||||||
print '"' . $langs->trans("VAT") . ' - ' . $def_tva[$key] . '"' . $sep;
|
print '"' . $langs->trans("VAT") . ' - ' . $def_tva[$key] . '"' . $sep;
|
||||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("VAT") . join(', ',$def_tva[$key][$k]) . ($numtax?' - Localtax '.$numtax:'') . '"' . $sep;
|
print '"' . utf8_decode(dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("VAT") . join(', ',$def_tva[$key][$k]) .' %' . ($numtax?' - Localtax '.$numtax:'') . '"' . $sep;
|
||||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"'. $sep;
|
print '"' . ($mt < 0 ? price(- $mt) : '') . '"'. $sep;
|
||||||
print '"' . $journal . '"' ;
|
print '"' . $journal . '"' ;
|
||||||
@ -573,7 +573,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("InvoiceRef") . ")</td>";
|
print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("InvoiceRef") . ")</td>";
|
||||||
print "<td>" . $langs->trans("AccountAccounting") . "</td>";
|
print "<td>" . $langs->trans("AccountAccounting") . "</td>";
|
||||||
print "<td>" . $langs->trans("SubledgerAccount") . "</td>";
|
print "<td>" . $langs->trans("SubledgerAccount") . "</td>";
|
||||||
print "<td>" . $langs->trans("Label") . "</td>";
|
print "<td>" . $langs->trans("LabelOperation") . "</td>";
|
||||||
print "<td align='right'>" . $langs->trans("Debit") . "</td>";
|
print "<td align='right'>" . $langs->trans("Debit") . "</td>";
|
||||||
print "<td align='right'>" . $langs->trans("Credit") . "</td>";
|
print "<td align='right'>" . $langs->trans("Credit") . "</td>";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
@ -627,6 +627,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Product / Service
|
// Product / Service
|
||||||
foreach ( $tabht[$key] as $k => $mt ) {
|
foreach ( $tabht[$key] as $k => $mt ) {
|
||||||
$accountingaccount = new AccountingAccount($db);
|
$accountingaccount = new AccountingAccount($db);
|
||||||
@ -683,7 +684,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
// Subledger account
|
// Subledger account
|
||||||
print "<td>";
|
print "<td>";
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]).($numtax?' - Localtax '.$numtax:'');
|
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]).' %'.($numtax?' - Localtax '.$numtax:'');
|
||||||
print "</td>";
|
print "</td>";
|
||||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||||
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||||
|
|||||||
@ -353,7 +353,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
$bookkeeping->subledger_label = '';
|
$bookkeeping->subledger_label = '';
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT").' '.join(', ',$def_tva[$key][$k]) . ($numtax?' - Localtax '.$numtax:'');
|
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT").' '.join(', ',$def_tva[$key][$k]) .' %' . ($numtax?' - Localtax '.$numtax:'');
|
||||||
$bookkeeping->montant = $mt;
|
$bookkeeping->montant = $mt;
|
||||||
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
|
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
|
||||||
$bookkeeping->debit = ($mt < 0) ? -$mt : 0;
|
$bookkeeping->debit = ($mt < 0) ? -$mt : 0;
|
||||||
@ -441,7 +441,6 @@ $form = new Form($db);
|
|||||||
if ($action == 'exportcsv') {
|
if ($action == 'exportcsv') {
|
||||||
|
|
||||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||||
$sell_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
|
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
||||||
|
|
||||||
@ -472,7 +471,7 @@ if ($action == 'exportcsv') {
|
|||||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . '"' . $sep;
|
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . '"' . $sep;
|
||||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||||
print '"' . $sell_journal . '"';
|
print '"' . $journal . '"';
|
||||||
print "\n";
|
print "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -487,12 +486,12 @@ if ($action == 'exportcsv') {
|
|||||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 32)) . '"' . $sep;
|
print '"' . utf8_decode(dol_trunc($companystatic->name, 32)) . '"' . $sep;
|
||||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||||
print " " . $sep;
|
print '""' . $sep;
|
||||||
print '"' . utf8_decode(dol_trunc($accountingaccount->label, 32)) . '"' . $sep;
|
print '"' . utf8_decode(dol_trunc($accountingaccount->label, 32)) . '"' . $sep;
|
||||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
|
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
|
||||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||||
print '"' . $sell_journal . '"';
|
print '"' . $journal . '"';
|
||||||
print "\n";
|
print "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -512,12 +511,12 @@ if ($action == 'exportcsv') {
|
|||||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 32)) . '"' . $sep;
|
print '"' . utf8_decode(dol_trunc($companystatic->name, 32)) . '"' . $sep;
|
||||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||||
print " " . $sep;
|
print '""' . $sep;
|
||||||
print '"' . $langs->trans("VAT") . ' - ' . $def_tva[$key] . '"' . $sep;
|
print '"' . $langs->trans("VAT") . ' - ' . $def_tva[$key] . ' %"' . $sep;
|
||||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . join(', ',$def_tva[$key][$k]) . ($numtax?' - Localtax '.$numtax:'') . '"' . $sep;
|
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . join(', ',$def_tva[$key][$k]) .' %' . ($numtax?' - Localtax '.$numtax:'') . '"' . $sep;
|
||||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||||
print '"' . $sell_journal . '"';
|
print '"' . $journal . '"';
|
||||||
print "\n";
|
print "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -593,7 +592,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("InvoiceRef") . ")</td>";
|
print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("InvoiceRef") . ")</td>";
|
||||||
print "<td>" . $langs->trans("AccountAccounting") . "</td>";
|
print "<td>" . $langs->trans("AccountAccounting") . "</td>";
|
||||||
print "<td>" . $langs->trans("SubledgerAccount") . "</td>";
|
print "<td>" . $langs->trans("SubledgerAccount") . "</td>";
|
||||||
print "<td>" . $langs->trans("Label") . "</td>";
|
print "<td>" . $langs->trans("LabelOperation") . "</td>";
|
||||||
print "<td align='right'>" . $langs->trans("Debit") . "</td>";
|
print "<td align='right'>" . $langs->trans("Debit") . "</td>";
|
||||||
print "<td align='right'>" . $langs->trans("Credit") . "</td>";
|
print "<td align='right'>" . $langs->trans("Credit") . "</td>";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
@ -699,7 +698,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
// Subledger account
|
// Subledger account
|
||||||
print "<td>";
|
print "<td>";
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]).($numtax?' - Localtax '.$numtax:'');
|
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]).' %'.($numtax?' - Localtax '.$numtax:'');
|
||||||
print "</td>";
|
print "</td>";
|
||||||
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||||
|
|||||||
@ -38,6 +38,28 @@ $langs->load("members");
|
|||||||
|
|
||||||
$id = GETPOST('id','int')?GETPOST('id','int'):GETPOST('rowid','int');
|
$id = GETPOST('id','int')?GETPOST('id','int'):GETPOST('rowid','int');
|
||||||
|
|
||||||
|
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||||
|
$sortfield = GETPOST("sortfield",'alpha');
|
||||||
|
$sortorder = GETPOST("sortorder",'alpha');
|
||||||
|
$page = GETPOST("page",'int');
|
||||||
|
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||||
|
$offset = $limit * $page;
|
||||||
|
$pageprev = $page - 1;
|
||||||
|
$pagenext = $page + 1;
|
||||||
|
if (! $sortfield) $sortfield='a.datep,a.id';
|
||||||
|
if (! $sortorder) $sortorder='DESC';
|
||||||
|
|
||||||
|
if (GETPOST('actioncode','array'))
|
||||||
|
{
|
||||||
|
$actioncode=GETPOST('actioncode','array',3);
|
||||||
|
if (! count($actioncode)) $actioncode='0';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
|
||||||
|
}
|
||||||
|
$search_agenda_label=GETPOST('search_agenda_label');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$result=restrictedArea($user,'adherent',$id);
|
$result=restrictedArea($user,'adherent',$id);
|
||||||
|
|
||||||
@ -56,7 +78,26 @@ if ($result > 0)
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// None
|
$parameters=array('id'=>$id, 'objcanvas'=>$objcanvas);
|
||||||
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
|
if (empty($reshook))
|
||||||
|
{
|
||||||
|
// Cancel
|
||||||
|
if (GETPOST('cancel','alpha') && ! empty($backtopage))
|
||||||
|
{
|
||||||
|
header("Location: ".$backtopage);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Purge search criteria
|
||||||
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
|
||||||
|
{
|
||||||
|
$actioncode='';
|
||||||
|
$search_agenda_label='';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -87,7 +128,7 @@ if ($object->id > 0)
|
|||||||
|
|
||||||
dol_fiche_head($head, 'agenda', $langs->trans("Member"), -1, 'user');
|
dol_fiche_head($head, 'agenda', $langs->trans("Member"), -1, 'user');
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
dol_banner_tab($object, 'rowid', $linkback);
|
dol_banner_tab($object, 'rowid', $linkback);
|
||||||
|
|
||||||
@ -103,25 +144,33 @@ if ($object->id > 0)
|
|||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
|
|
||||||
/*
|
//print '<div class="tabsAction">';
|
||||||
* Barre d'action
|
//print '</div>';
|
||||||
*/
|
|
||||||
|
|
||||||
print '<div class="tabsAction">';
|
|
||||||
|
|
||||||
|
$morehtmlcenter = '';
|
||||||
if (! empty($conf->agenda->enabled))
|
if (! empty($conf->agenda->enabled))
|
||||||
{
|
{
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage=1&origin=member&originid='.$id.'">'.$langs->trans("AddAction").'</a></div>';
|
$morehtmlcenter.='<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage=1&origin=member&originid='.$id.'">'.$langs->trans("AddAction").'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</div>';
|
if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
|
||||||
|
{
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
$out='';
|
$param='&id='.$id;
|
||||||
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||||
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("ActionsOnMember"),$out,'');
|
print_barre_liste($langs->trans("ActionsOnMember"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $morehtmlcenter, 0, -1, '', '', '', '', 0, 1, 1);
|
||||||
|
|
||||||
// List of actions
|
// List of all actions
|
||||||
show_actions_done($conf,$langs,$db,$object,null,0,'','');
|
$filters=array();
|
||||||
|
$filters['search_agenda_label']=$search_agenda_label;
|
||||||
|
|
||||||
|
// TODO Replace this with same code than into listactions.php
|
||||||
|
show_actions_done($conf,$langs,$db,$object,null,0,$actioncode, '', $filters, $sortfield, $sortorder);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1431,7 +1431,7 @@ else
|
|||||||
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) $rowspan++;
|
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) $rowspan++;
|
||||||
if (! empty($conf->societe->enabled)) $rowspan++;
|
if (! empty($conf->societe->enabled)) $rowspan++;
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
dol_banner_tab($object, 'rowid', $linkback);
|
dol_banner_tab($object, 'rowid', $linkback);
|
||||||
|
|
||||||
@ -1799,10 +1799,16 @@ else
|
|||||||
|
|
||||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||||
|
|
||||||
|
$MAX = 10;
|
||||||
|
|
||||||
|
$morehtmlright = '<a href="'.DOL_URL_ROOT.'/adherents/agenda.php?id='.$object->id.'">';
|
||||||
|
$morehtmlright.= $langs->trans("SeeAll");
|
||||||
|
$morehtmlright.= '</a>';
|
||||||
|
|
||||||
// List of actions on element
|
// List of actions on element
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
|
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
|
||||||
$formactions = new FormActions($db);
|
$formactions = new FormActions($db);
|
||||||
$somethingshown = $formactions->showactions($object, 'member', $socid, 1, 'listactions', 10);
|
$somethingshown = $formactions->showactions($object, 'member', $socid, 1, 'listactions', $MAX, '', $morehtmlright);
|
||||||
|
|
||||||
print '</div></div></div>';
|
print '</div></div></div>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -419,7 +419,7 @@ class Adherent extends CommonObject
|
|||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET";
|
||||||
$sql.= " civility = ".($this->civility_id>0?$this->db->escape($this->civility_id):"null");
|
$sql.= " civility = ".($this->civility_id?"'".$this->db->escape($this->civility_id)."'":"null");
|
||||||
$sql.= ", firstname = ".($this->firstname?"'".$this->db->escape($this->firstname)."'":"null");
|
$sql.= ", firstname = ".($this->firstname?"'".$this->db->escape($this->firstname)."'":"null");
|
||||||
$sql.= ", lastname = ".($this->lastname?"'".$this->db->escape($this->lastname)."'":"null");
|
$sql.= ", lastname = ".($this->lastname?"'".$this->db->escape($this->lastname)."'":"null");
|
||||||
$sql.= ", login = ".($this->login?"'".$this->db->escape($this->login)."'":"null");
|
$sql.= ", login = ".($this->login?"'".$this->db->escape($this->login)."'":"null");
|
||||||
@ -1562,12 +1562,13 @@ class Adherent extends CommonObject
|
|||||||
*
|
*
|
||||||
* @param int $withpictoimg 0=No picto, 1=Include picto into link, 2=Only picto, -1=Include photo into link, -2=Only picto photo, -3=Only photo very small)
|
* @param int $withpictoimg 0=No picto, 1=Include picto into link, 2=Only picto, -1=Include photo into link, -2=Only picto photo, -3=Only photo very small)
|
||||||
* @param int $maxlen length max label
|
* @param int $maxlen length max label
|
||||||
* @param string $option Page for link
|
* @param string $option Page for link ('card', 'category', 'subscription', ...)
|
||||||
* @param string $mode ''=Show firstname and lastname, 'firstname'=Show only firstname, 'login'=Show login, 'ref'=Show ref
|
* @param string $mode ''=Show firstname and lastname, 'firstname'=Show only firstname, 'login'=Show login, 'ref'=Show ref
|
||||||
* @param string $morecss Add more css on link
|
* @param string $morecss Add more css on link
|
||||||
|
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
||||||
* @return string Chaine avec URL
|
* @return string Chaine avec URL
|
||||||
*/
|
*/
|
||||||
function getNomUrl($withpictoimg=0,$maxlen=0,$option='card',$mode='',$morecss='')
|
function getNomUrl($withpictoimg=0, $maxlen=0, $option='card', $mode='', $morecss='', $save_lastsearch_value=-1)
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
@ -1591,15 +1592,21 @@ class Adherent extends CommonObject
|
|||||||
$label.= '<br><b>' . $langs->trans('Name') . ':</b> ' . $this->getFullName($langs);
|
$label.= '<br><b>' . $langs->trans('Name') . ':</b> ' . $this->getFullName($langs);
|
||||||
$label.='</div>';
|
$label.='</div>';
|
||||||
|
|
||||||
if ($option == 'card' || $option == 'category')
|
$url = DOL_URL_ROOT.'/adherents/card.php?rowid='.$this->id;
|
||||||
{
|
|
||||||
$link = '<a href="'.DOL_URL_ROOT.'/adherents/card.php?rowid='.$this->id.'"';
|
|
||||||
}
|
|
||||||
if ($option == 'subscription')
|
if ($option == 'subscription')
|
||||||
{
|
{
|
||||||
$link = '<a href="'.DOL_URL_ROOT.'/adherents/subscription.php?rowid='.$this->id.'"';
|
$url = DOL_URL_ROOT.'/adherents/subscription.php?rowid='.$this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($option != 'nolink')
|
||||||
|
{
|
||||||
|
// Add param to save lastsearch_values or not
|
||||||
|
$add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
|
||||||
|
if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
|
||||||
|
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
|
||||||
|
}
|
||||||
|
|
||||||
|
$link = '<a href="'.$url.'"';
|
||||||
$linkclose="";
|
$linkclose="";
|
||||||
if (empty($notooltip))
|
if (empty($notooltip))
|
||||||
{
|
{
|
||||||
@ -1952,25 +1959,49 @@ class Adherent extends CommonObject
|
|||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
|
|
||||||
$info=array();
|
$info=array();
|
||||||
|
$keymodified=false;
|
||||||
|
|
||||||
// Object classes
|
// Object classes
|
||||||
$info["objectclass"]=explode(',',$conf->global->LDAP_MEMBER_OBJECT_CLASS);
|
$info["objectclass"]=explode(',',$conf->global->LDAP_MEMBER_OBJECT_CLASS);
|
||||||
|
|
||||||
$this->fullname=$this->getFullName($langs);
|
$this->fullname=$this->getFullName($langs);
|
||||||
|
|
||||||
|
// For avoid ldap error when firstname and lastname are empty
|
||||||
|
if ($this->morphy == 'mor' && empty($this->fullname)) {
|
||||||
|
$this->fullname = $this->societe;
|
||||||
|
$this->lastname = $this->societe;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Possible LDAP KEY (constname => varname)
|
||||||
|
$ldapkey = array(
|
||||||
|
'LDAP_MEMBER_FIELD_FULLNAME' => 'fullname',
|
||||||
|
'LDAP_MEMBER_FIELD_NAME' => 'lastname',
|
||||||
|
'LDAP_MEMBER_FIELD_LOGIN' => 'login',
|
||||||
|
'LDAP_MEMBER_FIELD_LOGIN_SAMBA' => 'login',
|
||||||
|
'LDAP_MEMBER_FIELD_MAIL' => 'email'
|
||||||
|
);
|
||||||
|
|
||||||
// Member
|
// Member
|
||||||
if ($this->fullname && ! empty($conf->global->LDAP_MEMBER_FIELD_FULLNAME)) $info[$conf->global->LDAP_MEMBER_FIELD_FULLNAME] = $this->fullname;
|
foreach ($ldapkey as $constname => $varname)
|
||||||
if ($this->lastname && ! empty($conf->global->LDAP_MEMBER_FIELD_NAME)) $info[$conf->global->LDAP_MEMBER_FIELD_NAME] = $this->lastname;
|
{
|
||||||
|
if (! empty($this->$varname) && ! empty($conf->global->$constname))
|
||||||
|
{
|
||||||
|
$info[$conf->global->$constname] = $this->$varname;
|
||||||
|
|
||||||
|
// Check if it is the LDAP key and if its value has been changed
|
||||||
|
if (! empty($conf->global->LDAP_KEY_MEMBERS) && $conf->global->LDAP_KEY_MEMBERS == $conf->global->$constname)
|
||||||
|
{
|
||||||
|
if (! empty($this->oldcopy) && $this->$varname != $this->oldcopy->$varname) $keymodified=true; // For check if LDAP key has been modified
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if ($this->firstname && ! empty($conf->global->LDAP_MEMBER_FIELD_FIRSTNAME)) $info[$conf->global->LDAP_MEMBER_FIELD_FIRSTNAME] = $this->firstname;
|
if ($this->firstname && ! empty($conf->global->LDAP_MEMBER_FIELD_FIRSTNAME)) $info[$conf->global->LDAP_MEMBER_FIELD_FIRSTNAME] = $this->firstname;
|
||||||
if ($this->login && ! empty($conf->global->LDAP_MEMBER_FIELD_LOGIN)) $info[$conf->global->LDAP_MEMBER_FIELD_LOGIN] = $this->login;
|
|
||||||
if ($this->pass && ! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD] = $this->pass; // this->pass = mot de passe non crypte
|
|
||||||
if ($this->pass && ! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass, 4); // md5 for OpenLdap TODO add type of encryption
|
|
||||||
if ($this->poste && ! empty($conf->global->LDAP_MEMBER_FIELD_TITLE)) $info[$conf->global->LDAP_MEMBER_FIELD_TITLE] = $this->poste;
|
if ($this->poste && ! empty($conf->global->LDAP_MEMBER_FIELD_TITLE)) $info[$conf->global->LDAP_MEMBER_FIELD_TITLE] = $this->poste;
|
||||||
|
if ($this->societe && ! empty($conf->global->LDAP_MEMBER_FIELD_COMPANY)) $info[$conf->global->LDAP_MEMBER_FIELD_COMPANY] = $this->societe;
|
||||||
if ($this->address && ! empty($conf->global->LDAP_MEMBER_FIELD_ADDRESS)) $info[$conf->global->LDAP_MEMBER_FIELD_ADDRESS] = $this->address;
|
if ($this->address && ! empty($conf->global->LDAP_MEMBER_FIELD_ADDRESS)) $info[$conf->global->LDAP_MEMBER_FIELD_ADDRESS] = $this->address;
|
||||||
if ($this->zip && ! empty($conf->global->LDAP_MEMBER_FIELD_ZIP)) $info[$conf->global->LDAP_MEMBER_FIELD_ZIP] = $this->zip;
|
if ($this->zip && ! empty($conf->global->LDAP_MEMBER_FIELD_ZIP)) $info[$conf->global->LDAP_MEMBER_FIELD_ZIP] = $this->zip;
|
||||||
if ($this->town && ! empty($conf->global->LDAP_MEMBER_FIELD_TOWN)) $info[$conf->global->LDAP_MEMBER_FIELD_TOWN] = $this->town;
|
if ($this->town && ! empty($conf->global->LDAP_MEMBER_FIELD_TOWN)) $info[$conf->global->LDAP_MEMBER_FIELD_TOWN] = $this->town;
|
||||||
if ($this->country_code && ! empty($conf->global->LDAP_MEMBER_FIELD_COUNTRY)) $info[$conf->global->LDAP_MEMBER_FIELD_COUNTRY] = $this->country_code;
|
if ($this->country_code && ! empty($conf->global->LDAP_MEMBER_FIELD_COUNTRY)) $info[$conf->global->LDAP_MEMBER_FIELD_COUNTRY] = $this->country_code;
|
||||||
if ($this->email && ! empty($conf->global->LDAP_MEMBER_FIELD_MAIL)) $info[$conf->global->LDAP_MEMBER_FIELD_MAIL] = $this->email;
|
|
||||||
if ($this->skype && ! empty($conf->global->LDAP_MEMBER_FIELD_SKYPE)) $info[$conf->global->LDAP_MEMBER_FIELD_SKYPE] = $this->skype;
|
if ($this->skype && ! empty($conf->global->LDAP_MEMBER_FIELD_SKYPE)) $info[$conf->global->LDAP_MEMBER_FIELD_SKYPE] = $this->skype;
|
||||||
if ($this->phone && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE] = $this->phone;
|
if ($this->phone && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE] = $this->phone;
|
||||||
if ($this->phone_perso && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO] = $this->phone_perso;
|
if ($this->phone_perso && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO] = $this->phone_perso;
|
||||||
@ -1982,6 +2013,35 @@ class Adherent extends CommonObject
|
|||||||
if (isset($this->statut) && ! empty($conf->global->LDAP_FIELD_MEMBER_STATUS)) $info[$conf->global->LDAP_FIELD_MEMBER_STATUS] = $this->statut;
|
if (isset($this->statut) && ! empty($conf->global->LDAP_FIELD_MEMBER_STATUS)) $info[$conf->global->LDAP_FIELD_MEMBER_STATUS] = $this->statut;
|
||||||
if ($this->datefin && ! empty($conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION)) $info[$conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION] = dol_print_date($this->datefin,'dayhourldap');
|
if ($this->datefin && ! empty($conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION)) $info[$conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION] = dol_print_date($this->datefin,'dayhourldap');
|
||||||
|
|
||||||
|
// When password is modified
|
||||||
|
if (! empty($this->pass))
|
||||||
|
{
|
||||||
|
if (! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD] = $this->pass; // this->pass = mot de passe non crypte
|
||||||
|
if (! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass, 4); // Create OpenLDAP MD5 password (TODO add type of encryption)
|
||||||
|
}
|
||||||
|
// Set LDAP password if possible
|
||||||
|
else if ($conf->global->LDAP_SERVER_PROTOCOLVERSION !== '3') // If ldap key is modified and LDAPv3 we use ldap_rename function for avoid lose encrypt password
|
||||||
|
{
|
||||||
|
if (! empty($conf->global->DATABASE_PWD_ENCRYPTED))
|
||||||
|
{
|
||||||
|
// Just for the default MD5 !
|
||||||
|
if (empty($conf->global->MAIN_SECURITY_HASH_ALGO))
|
||||||
|
{
|
||||||
|
if ($this->pass_indatabase_crypted && ! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) {
|
||||||
|
// Create OpenLDAP MD5 password from Dolibarr MD5 password
|
||||||
|
// Note: This suppose that "pass_indatabase_crypted" is a md5 (guaranted by the previous test if "(empty($conf->global->MAIN_SECURITY_HASH_ALGO))"
|
||||||
|
$info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = '{md5}'.base64_encode(hex2bin($this->pass_indatabase_crypted));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Use $this->pass_indatabase value if exists
|
||||||
|
else if (! empty($this->pass_indatabase))
|
||||||
|
{
|
||||||
|
if (! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD] = $this->pass_indatabase; // $this->pass_indatabase = mot de passe non crypte
|
||||||
|
if (! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass_indatabase, 4); // md5 for OpenLdap TODO add type of encryption
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Subscriptions
|
// Subscriptions
|
||||||
if ($this->first_subscription_date && ! empty($conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE)) $info[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE] = dol_print_date($this->first_subscription_date,'dayhourldap');
|
if ($this->first_subscription_date && ! empty($conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE)) $info[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE] = dol_print_date($this->first_subscription_date,'dayhourldap');
|
||||||
if (isset($this->first_subscription_amount) && ! empty($conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT)) $info[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT] = $this->first_subscription_amount;
|
if (isset($this->first_subscription_amount) && ! empty($conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT)) $info[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT] = $this->first_subscription_amount;
|
||||||
|
|||||||
@ -57,9 +57,9 @@ class AdherentType extends CommonObject
|
|||||||
public $subscription;
|
public $subscription;
|
||||||
/** @var string Public note */
|
/** @var string Public note */
|
||||||
public $note;
|
public $note;
|
||||||
/** @var bool Can vote*/
|
/** @var integer Can vote */
|
||||||
public $vote;
|
public $vote;
|
||||||
/** @var bool Email sent during validation */
|
/** @var string Email sent during validation */
|
||||||
public $mail_valid;
|
public $mail_valid;
|
||||||
/** @var array Array of members */
|
/** @var array Array of members */
|
||||||
public $members=array();
|
public $members=array();
|
||||||
@ -481,7 +481,7 @@ class AdherentType extends CommonObject
|
|||||||
|
|
||||||
// Initialise parametres
|
// Initialise parametres
|
||||||
$this->id = 0;
|
$this->id = 0;
|
||||||
$this->ref = 0;
|
$this->ref = 'MTSPEC';
|
||||||
$this->specimen=1;
|
$this->specimen=1;
|
||||||
|
|
||||||
$this->label='MEMBERS TYPE SPECIMEN';
|
$this->label='MEMBERS TYPE SPECIMEN';
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2016 Xebax Christy <xebax@wanadoo.fr>
|
/* Copyright (C) 2016 Xebax Christy <xebax@wanadoo.fr>
|
||||||
|
* Copyright (C) 2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -19,6 +20,7 @@ use Luracast\Restler\RestException;
|
|||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API class for members
|
* API class for members
|
||||||
@ -357,4 +359,38 @@ class Members extends DolibarrApi
|
|||||||
return $member->subscription($start_date, $amount, 0, '', $label, '', '', '', $end_date);
|
return $member->subscription($start_date, $amount, 0, '', $label, '', '', '', $end_date);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get categories for a member
|
||||||
|
*
|
||||||
|
* @param int $id ID of member
|
||||||
|
* @param string $sortfield Sort field
|
||||||
|
* @param string $sortorder Sort order
|
||||||
|
* @param int $limit Limit for list
|
||||||
|
* @param int $page Page number
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*
|
||||||
|
* @url GET {id}/categories
|
||||||
|
*/
|
||||||
|
function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0)
|
||||||
|
{
|
||||||
|
if (! DolibarrApiAccess::$user->rights->categorie->lire) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
$categories = new Categorie($this->db);
|
||||||
|
|
||||||
|
$result = $categories->getListForItem($id, 'member', $sortfield, $sortorder, $limit, $page);
|
||||||
|
|
||||||
|
if (empty($result)) {
|
||||||
|
throw new RestException(404, 'No category found');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($result < 0) {
|
||||||
|
throw new RestException(503, 'Error when retrieve category list : '.$categories->error);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -110,7 +110,7 @@ if ($id > 0)
|
|||||||
|
|
||||||
dol_fiche_head($head, 'document', $langs->trans("Member"), -1, 'user');
|
dol_fiche_head($head, 'document', $langs->trans("Member"), -1, 'user');
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
dol_banner_tab($object, 'rowid', $linkback);
|
dol_banner_tab($object, 'rowid', $linkback);
|
||||||
|
|
||||||
|
|||||||
@ -59,26 +59,23 @@ if (! $result)
|
|||||||
|
|
||||||
if ($action == 'dolibarr2ldap')
|
if ($action == 'dolibarr2ldap')
|
||||||
{
|
{
|
||||||
$db->begin();
|
|
||||||
|
|
||||||
$ldap=new Ldap();
|
$ldap=new Ldap();
|
||||||
$result=$ldap->connect_bind();
|
$result=$ldap->connect_bind();
|
||||||
|
|
||||||
|
if ($result > 0)
|
||||||
|
{
|
||||||
$info=$object->_load_ldap_info();
|
$info=$object->_load_ldap_info();
|
||||||
$dn=$object->_load_ldap_dn($info);
|
$dn=$object->_load_ldap_dn($info);
|
||||||
$olddn=$dn; // We can say that old dn = dn as we force synchro
|
$olddn=$dn; // We can say that old dn = dn as we force synchro
|
||||||
|
|
||||||
$result=$ldap->update($dn,$info,$user,$olddn);
|
$result=$ldap->update($dn,$info,$user,$olddn);
|
||||||
|
|
||||||
if ($result >= 0)
|
|
||||||
{
|
|
||||||
setEventMessages($langs->trans("MemberSynchronized"), null, 'mesgs');
|
|
||||||
$db->commit();
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
if ($result >= 0) {
|
||||||
|
setEventMessages($langs->trans("MemberSynchronized"), null, 'mesgs');
|
||||||
|
}
|
||||||
|
else {
|
||||||
setEventMessages($ldap->errors, $ldap->error, 'errors');
|
setEventMessages($ldap->errors, $ldap->error, 'errors');
|
||||||
$db->rollback();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,7 +93,7 @@ $head = member_prepare_head($object);
|
|||||||
|
|
||||||
dol_fiche_head($head, 'ldap', $langs->trans("Member"), 0, 'user');
|
dol_fiche_head($head, 'ldap', $langs->trans("Member"), 0, 'user');
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
dol_banner_tab($object, 'rowid', $linkback);
|
dol_banner_tab($object, 'rowid', $linkback);
|
||||||
|
|
||||||
|
|||||||
@ -129,7 +129,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
{
|
{
|
||||||
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -74,7 +74,7 @@ if ($id)
|
|||||||
print "<form method=\"post\" action=\"".$_SERVER['PHP_SELF']."\">";
|
print "<form method=\"post\" action=\"".$_SERVER['PHP_SELF']."\">";
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
dol_banner_tab($object, 'rowid', $linkback);
|
dol_banner_tab($object, 'rowid', $linkback);
|
||||||
|
|
||||||
|
|||||||
@ -461,7 +461,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
|||||||
$paiement = new Paiement($db);
|
$paiement = new Paiement($db);
|
||||||
$paiement->datepaye = $paymentdate;
|
$paiement->datepaye = $paymentdate;
|
||||||
$paiement->amounts = $amounts;
|
$paiement->amounts = $amounts;
|
||||||
$paiement->paiementid = dol_getIdFromCode($db,$operation,'c_paiement');
|
$paiement->paiementid = dol_getIdFromCode($db,$operation,'c_paiement','code','id',1);
|
||||||
$paiement->num_paiement = $num_chq;
|
$paiement->num_paiement = $num_chq;
|
||||||
$paiement->note = $label;
|
$paiement->note = $label;
|
||||||
|
|
||||||
@ -601,7 +601,7 @@ if ($rowid > 0)
|
|||||||
|
|
||||||
dol_fiche_head($head, 'subscription', $langs->trans("Member"), -1, 'user');
|
dol_fiche_head($head, 'subscription', $langs->trans("Member"), -1, 'user');
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
dol_banner_tab($object, 'rowid', $linkback);
|
dol_banner_tab($object, 'rowid', $linkback);
|
||||||
|
|
||||||
|
|||||||
@ -365,7 +365,7 @@ if ($rowid > 0)
|
|||||||
|
|
||||||
dol_fiche_head($head, 'card', $langs->trans("MemberType"), -1, 'group');
|
dol_fiche_head($head, 'card', $langs->trans("MemberType"), -1, 'group');
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/type.php">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/type.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
dol_banner_tab($object, 'rowid', $linkback);
|
dol_banner_tab($object, 'rowid', $linkback);
|
||||||
|
|
||||||
|
|||||||
@ -93,7 +93,7 @@ $head = member_type_prepare_head($object);
|
|||||||
|
|
||||||
dol_fiche_head($head, 'ldap', $langs->trans("MemberType"), -1, 'group');
|
dol_fiche_head($head, 'ldap', $langs->trans("MemberType"), -1, 'group');
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/type.php">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/type.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
dol_banner_tab($object, 'rowid', $linkback);
|
dol_banner_tab($object, 'rowid', $linkback);
|
||||||
|
|
||||||
|
|||||||
@ -80,8 +80,7 @@ if ($action == "save" && empty($cancel))
|
|||||||
{
|
{
|
||||||
$param='MAIN_AGENDA_ACTIONAUTO_'.$trigger['code'];
|
$param='MAIN_AGENDA_ACTIONAUTO_'.$trigger['code'];
|
||||||
//print "param=".$param." - ".$_POST[$param];
|
//print "param=".$param." - ".$_POST[$param];
|
||||||
if (GETPOST($param,'alpha')) $res = dolibarr_set_const($db,$param,GETPOST($param,'alpha'),'chaine',0,'',$conf->entity);
|
$res = dolibarr_set_const($db,$param,(GETPOST($param,'alpha')?GETPOST($param,'alpha'):''),'chaine',0,'',$conf->entity);
|
||||||
else $res = dolibarr_del_const($db,$param,$conf->entity);
|
|
||||||
if (! $res > 0) $error++;
|
if (! $res > 0) $error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2011-2017 Philippe Grand <philippe.grand@atoo-net.com>
|
* Copyright (C) 2011-2017 Philippe Grand <philippe.grand@atoo-net.com>
|
||||||
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||||
@ -46,10 +46,18 @@ if (! $user->admin) accessforbidden();
|
|||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||||
|
$contextpage=array('admincompany','globaladmin');
|
||||||
|
$hookmanager->initHooks($contextpage);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
if ( ($action == 'update' && ! GETPOST("cancel",'alpha'))
|
if ( ($action == 'update' && ! GETPOST("cancel",'alpha'))
|
||||||
|| ($action == 'updateedit') )
|
|| ($action == 'updateedit') )
|
||||||
{
|
{
|
||||||
|
|||||||
@ -269,12 +269,12 @@ if ($mode != 'focus')
|
|||||||
{
|
{
|
||||||
if ($mode != 'sortorder')
|
if ($mode != 'sortorder')
|
||||||
{
|
{
|
||||||
$substitutionarray=getCommonSubstitutionArray($langs, 0, array('object')); // Must match list into GETPOST
|
$substitutionarray=getCommonSubstitutionArray($langs, 2, array('object','objectamount')); // Must match list into GETPOST
|
||||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
unset($substitutionarray['__USER_SIGNATURE__']);
|
||||||
$texthelp=$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
$texthelp=$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||||
foreach($substitutionarray as $key => $val)
|
foreach($substitutionarray as $key => $val)
|
||||||
{
|
{
|
||||||
$texthelp.=$key.'<br>';
|
$texthelp.=$key.' -> '.$val.'<br>';
|
||||||
}
|
}
|
||||||
$textvalue=$form->textwithpicto($langs->trans("Value"), $texthelp, 1, 'help', '', 0, 2, ''); // No tooltip on click, this also triggers the sort click
|
$textvalue=$form->textwithpicto($langs->trans("Value"), $texthelp, 1, 'help', '', 0, 2, ''); // No tooltip on click, this also triggers the sort click
|
||||||
}
|
}
|
||||||
|
|||||||
@ -138,6 +138,16 @@ if ($action == 'update')
|
|||||||
}
|
}
|
||||||
|
|
||||||
dolibarr_set_const($db, "MAIN_DISABLE_METEO",$_POST["MAIN_DISABLE_METEO"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_DISABLE_METEO",$_POST["MAIN_DISABLE_METEO"],'chaine',0,'',$conf->entity);
|
||||||
|
dolibarr_set_const($db, "MAIN_USE_METEO_WITH_PERCENTAGE",GETPOST("MAIN_USE_METEO_WITH_PERCENTAGE"),'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
|
// For update value with percentage
|
||||||
|
$plus='';
|
||||||
|
if(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $plus = '_PERCENTAGE';
|
||||||
|
// Update values
|
||||||
|
for($i=0;$i<4;$i++) {
|
||||||
|
if(isset($_POST['MAIN_METEO'.$plus.'_LEVEL'.$i])) dolibarr_set_const($db, 'MAIN_METEO'.$plus.'_LEVEL'.$i, GETPOST('MAIN_METEO'.$plus.'_LEVEL'.$i, 'int'),'chaine',0,'',$conf->entity);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -196,13 +206,6 @@ if ($action == 'edit')
|
|||||||
print '<td>'.$langs->trans("MAIN_DISABLE_METEO").'</td><td class="center">' .$form->selectyesno('MAIN_DISABLE_METEO',(empty($conf->global->MAIN_DISABLE_METEO)?0:1),1) . '</td></tr>';
|
print '<td>'.$langs->trans("MAIN_DISABLE_METEO").'</td><td class="center">' .$form->selectyesno('MAIN_DISABLE_METEO',(empty($conf->global->MAIN_DISABLE_METEO)?0:1),1) . '</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '<br>';
|
|
||||||
|
|
||||||
print '<br><div class="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"></div>';
|
|
||||||
print '<br>';
|
|
||||||
|
|
||||||
print '</form>';
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -244,21 +247,30 @@ else
|
|||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '<br>';
|
|
||||||
|
|
||||||
// Boutons d'action
|
|
||||||
print '<div class="tabsAction">';
|
|
||||||
print '<a class="butAction" href="delais.php?action=edit">'.$langs->trans("Modify").'</a>';
|
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
|
|
||||||
// Show logo for weather
|
// Show logo for weather
|
||||||
print $langs->trans("DescWeather").'<br>';
|
print $langs->trans("DescWeather").'<br>';
|
||||||
|
|
||||||
|
if($action == 'edit') {
|
||||||
|
|
||||||
|
$str_mode_std = $langs->trans('MeteoStdModEnabled').' : '.$langs->trans('MeteoUseMod', $langs->trans('MeteoPercentageMod'));
|
||||||
|
$str_mode_percentage = $langs->trans('MeteoPercentageModEnabled').' : '.$langs->trans('MeteoUseMod', $langs->trans('MeteoStdMod'));
|
||||||
|
if(empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $str_mode_enabled = $str_mode_std;
|
||||||
|
else $str_mode_enabled = $str_mode_percentage;
|
||||||
|
print '<a href="#" onclick="return false;" id="change_mode">'.$str_mode_enabled.'</a>';
|
||||||
|
print '<input type="hidden" id="MAIN_USE_METEO_WITH_PERCENTAGE" name="MAIN_USE_METEO_WITH_PERCENTAGE" value="'.$conf->global->MAIN_USE_METEO_WITH_PERCENTAGE.'" />';
|
||||||
|
|
||||||
|
print '<br><br>';
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if(empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) print $langs->trans('MeteoStdModEnabled');
|
||||||
|
else print $langs->trans('MeteoPercentageModEnabled');
|
||||||
|
print '<br><br>';
|
||||||
|
}
|
||||||
|
|
||||||
$offset=0;
|
$offset=0;
|
||||||
$cursor=10; // By default
|
$cursor=10; // By default
|
||||||
//if (! empty($conf->global->MAIN_METEO_OFFSET)) $offset=$conf->global->MAIN_METEO_OFFSET;
|
//if (! empty($conf->global->MAIN_METEO_OFFSET)) $offset=$conf->global->MAIN_METEO_OFFSET;
|
||||||
@ -267,36 +279,143 @@ $level0=$offset; if (! empty($conf->global->MAIN_METEO_LEVEL0)) $level
|
|||||||
$level1=$offset+1*$cursor; if (! empty($conf->global->MAIN_METEO_LEVEL1)) $level1=$conf->global->MAIN_METEO_LEVEL1;
|
$level1=$offset+1*$cursor; if (! empty($conf->global->MAIN_METEO_LEVEL1)) $level1=$conf->global->MAIN_METEO_LEVEL1;
|
||||||
$level2=$offset+2*$cursor; if (! empty($conf->global->MAIN_METEO_LEVEL2)) $level2=$conf->global->MAIN_METEO_LEVEL2;
|
$level2=$offset+2*$cursor; if (! empty($conf->global->MAIN_METEO_LEVEL2)) $level2=$conf->global->MAIN_METEO_LEVEL2;
|
||||||
$level3=$offset+3*$cursor; if (! empty($conf->global->MAIN_METEO_LEVEL3)) $level3=$conf->global->MAIN_METEO_LEVEL3;
|
$level3=$offset+3*$cursor; if (! empty($conf->global->MAIN_METEO_LEVEL3)) $level3=$conf->global->MAIN_METEO_LEVEL3;
|
||||||
$text=''; $options='height="60px"';
|
$text=''; $options='class="valignmiddle" height="60px"';
|
||||||
print '<table>';
|
|
||||||
print '<tr>';
|
|
||||||
print '<td>';
|
if ($action == 'edit') {
|
||||||
|
|
||||||
|
|
||||||
|
print '<div id="standard" '.(empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '' : 'style="display:none;"').'>';
|
||||||
|
|
||||||
|
print '<div>';
|
||||||
|
print '<div class="inline-block" style="padding-right: 20px">';
|
||||||
print img_weather($text,'weather-clear.png', $options);
|
print img_weather($text,'weather-clear.png', $options);
|
||||||
print '</td><td>= '.$level0.'</td>';
|
print '= <input type="text" size="2" name="MAIN_METEO_LEVEL0" value="'.$level0.'"/></td>';
|
||||||
print '<td> </td>';
|
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||||
print '<td>';
|
|
||||||
print img_weather($text,'weather-few-clouds.png',$options);
|
print img_weather($text,'weather-few-clouds.png',$options);
|
||||||
print '</td><td><= '.$level1.'</td>';
|
print '<= <input type="text" size="2" name="MAIN_METEO_LEVEL1" value="'.$level1.'"/></td>';
|
||||||
print '<td> </td>';
|
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||||
print '<td>';
|
|
||||||
print img_weather($text,'weather-clouds.png',$options);
|
print img_weather($text,'weather-clouds.png',$options);
|
||||||
print '</td><td><= '.$level2.'</td>';
|
print '<= <input type="text" size="2" name="MAIN_METEO_LEVEL2" value="'.$level2.'"/></td>';
|
||||||
print '</tr>';
|
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||||
|
|
||||||
print '<tr><td>';
|
|
||||||
print img_weather($text,'weather-many-clouds.png',$options);
|
print img_weather($text,'weather-many-clouds.png',$options);
|
||||||
print '</td><td><= '.$level3.'</td>';
|
print '<= <input type="text" size="2" name="MAIN_METEO_LEVEL3" value="'.$level3.'"/></td>';
|
||||||
print '<td> </td>';
|
print '</div>';
|
||||||
print '<td>';
|
print '</div>';
|
||||||
|
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
print '<div id="percentage" '.(empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? 'style="display:none;"' : '').'>';
|
||||||
|
|
||||||
|
print '<div>';
|
||||||
|
print '<div class="inline-block" style="padding-right: 20px">';
|
||||||
|
print img_weather($text,'weather-clear.png',$options);
|
||||||
|
print '= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL0" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL0.'"/> %</td>';
|
||||||
|
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||||
|
print img_weather($text,'weather-few-clouds.png',$options);
|
||||||
|
print '<= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL1" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL1.'"/> %</td>';
|
||||||
|
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||||
|
print img_weather($text,'weather-clouds.png',$options);
|
||||||
|
print '<= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL2" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL2.'"/> %</td>';
|
||||||
|
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||||
|
print img_weather($text,'weather-many-clouds.png',$options);
|
||||||
|
print '<= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL3" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL3.'"/> %</td>';
|
||||||
|
print '</div>';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
$("#change_mode").click(function() {
|
||||||
|
var use_percent = $("#MAIN_USE_METEO_WITH_PERCENTAGE");
|
||||||
|
var str_mode_std = "<?php print $str_mode_std; ?>";
|
||||||
|
var str_mode_percentage = "<?php print $str_mode_percentage; ?>";
|
||||||
|
|
||||||
|
if(use_percent.val() == 1) {
|
||||||
|
use_percent.val(0);
|
||||||
|
$("#standard").show();
|
||||||
|
$("#percentage").hide();
|
||||||
|
$(this).html(str_mode_std);
|
||||||
|
} else {
|
||||||
|
use_percent.val(1);
|
||||||
|
$("#standard").hide();
|
||||||
|
$("#percentage").show();
|
||||||
|
$(this).html(str_mode_percentage);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) {
|
||||||
|
|
||||||
|
print '<div>';
|
||||||
|
print '<div class="inline-block" style="padding-right: 20px">';
|
||||||
|
print img_weather($text,'weather-clear.png',$options);
|
||||||
|
print '= '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL0.' %</td>';
|
||||||
|
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||||
|
print img_weather($text,'weather-few-clouds.png',$options);
|
||||||
|
print '<= '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL1.' %</td>';
|
||||||
|
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||||
|
print img_weather($text,'weather-clouds.png',$options);
|
||||||
|
print '<= '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL2.' %</td>';
|
||||||
|
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||||
|
print img_weather($text,'weather-many-clouds.png',$options);
|
||||||
|
print '<= '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL3.' %</td>';
|
||||||
|
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||||
print img_weather($text,'weather-storm.png',$options);
|
print img_weather($text,'weather-storm.png',$options);
|
||||||
print '</td><td>> '.$level3.'</td>';
|
print '> '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL3.' %</td>';
|
||||||
print '<td> </td>';
|
print '</div>';
|
||||||
print '<td> </td>';
|
print '</div>';
|
||||||
print '<td> </td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
print '</table>';
|
} else {
|
||||||
|
|
||||||
|
print '<div>';
|
||||||
|
print '<div class="inline-block" style="padding-right: 20px">';
|
||||||
|
print img_weather($text,'weather-clear.png',$options);
|
||||||
|
print '= '.$level0;
|
||||||
|
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||||
|
print img_weather($text,'weather-few-clouds.png',$options);
|
||||||
|
print '<= '.$level1;
|
||||||
|
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||||
|
print img_weather($text,'weather-clouds.png',$options);
|
||||||
|
print '<= '.$level2;
|
||||||
|
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||||
|
print img_weather($text,'weather-many-clouds.png',$options);
|
||||||
|
print '<= '.$level3;
|
||||||
|
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||||
|
print img_weather($text,'weather-storm.png',$options);
|
||||||
|
print '> '.$level3;
|
||||||
|
print '</div>';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
if($action == 'edit') {
|
||||||
|
|
||||||
|
print '<br><div class="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"></div>';
|
||||||
|
print '<br></form>';
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// Boutons d'action
|
||||||
|
print '<br><div class="tabsAction">';
|
||||||
|
print '<a class="butAction" href="delais.php?action=edit">'.$langs->trans("Modify").'</a></div>';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com>
|
* Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com>
|
||||||
* Copyright (C) 2011 Remy Younes <ryounes@gmail.com>
|
* Copyright (C) 2011 Remy Younes <ryounes@gmail.com>
|
||||||
@ -54,6 +54,7 @@ $action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view';
|
|||||||
$confirm=GETPOST('confirm','alpha');
|
$confirm=GETPOST('confirm','alpha');
|
||||||
$id=GETPOST('id','int');
|
$id=GETPOST('id','int');
|
||||||
$rowid=GETPOST('rowid','alpha');
|
$rowid=GETPOST('rowid','alpha');
|
||||||
|
$entity=GETPOST('entity','int');
|
||||||
$code=GETPOST('code','alpha');
|
$code=GETPOST('code','alpha');
|
||||||
|
|
||||||
$allowed=$user->admin;
|
$allowed=$user->admin;
|
||||||
@ -181,8 +182,8 @@ $tabsql[8] = "SELECT t.id as rowid, t.code as code, t.libelle, t.fk_country as
|
|||||||
$tabsql[9] = "SELECT c.code_iso as code, c.label, c.unicode, c.active FROM ".MAIN_DB_PREFIX."c_currencies AS c";
|
$tabsql[9] = "SELECT c.code_iso as code, c.label, c.unicode, c.active FROM ".MAIN_DB_PREFIX."c_currencies AS c";
|
||||||
$tabsql[10]= "SELECT t.rowid, t.code, t.taux, t.localtax1_type, t.localtax1, t.localtax2_type, t.localtax2, c.label as country, c.code as country_code, t.fk_pays as country_id, t.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid";
|
$tabsql[10]= "SELECT t.rowid, t.code, t.taux, t.localtax1_type, t.localtax1, t.localtax2_type, t.localtax2, c.label as country, c.code as country_code, t.fk_pays as country_id, t.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid";
|
||||||
$tabsql[11]= "SELECT t.rowid as rowid, t.element, t.source, t.code, t.libelle, t.position, t.active FROM ".MAIN_DB_PREFIX."c_type_contact AS t";
|
$tabsql[11]= "SELECT t.rowid as rowid, t.element, t.source, t.code, t.libelle, t.position, t.active FROM ".MAIN_DB_PREFIX."c_type_contact AS t";
|
||||||
$tabsql[12]= "SELECT c.rowid as rowid, c.code, c.libelle, c.libelle_facture, c.nbjour, c.type_cdr, c.decalage, c.active, c.sortorder FROM ".MAIN_DB_PREFIX.'c_payment_term AS c';
|
$tabsql[12]= "SELECT c.rowid as rowid, c.code, c.libelle, c.libelle_facture, c.nbjour, c.type_cdr, c.decalage, c.active, c.sortorder, c.entity FROM ".MAIN_DB_PREFIX."c_payment_term AS c WHERE c.entity = " . getEntity($tabname[12]);
|
||||||
$tabsql[13]= "SELECT c.id as rowid, c.code, c.libelle, c.type, c.active, c.accountancy_code FROM ".MAIN_DB_PREFIX."c_paiement AS c";
|
$tabsql[13]= "SELECT c.id as rowid, c.code, c.libelle, c.type, c.active, c.accountancy_code, c.entity FROM ".MAIN_DB_PREFIX."c_paiement AS c WHERE c.entity = " . getEntity($tabname[13]);
|
||||||
$tabsql[14]= "SELECT e.rowid as rowid, e.code as code, e.libelle, e.price, e.organization, e.fk_pays as country_id, c.code as country_code, c.label as country, e.active FROM ".MAIN_DB_PREFIX."c_ecotaxe AS e, ".MAIN_DB_PREFIX."c_country as c WHERE e.fk_pays=c.rowid and c.active=1";
|
$tabsql[14]= "SELECT e.rowid as rowid, e.code as code, e.libelle, e.price, e.organization, e.fk_pays as country_id, c.code as country_code, c.label as country, e.active FROM ".MAIN_DB_PREFIX."c_ecotaxe AS e, ".MAIN_DB_PREFIX."c_country as c WHERE e.fk_pays=c.rowid and c.active=1";
|
||||||
$tabsql[15]= "SELECT rowid as rowid, code, label as libelle, width, height, unit, active FROM ".MAIN_DB_PREFIX."c_paper_format";
|
$tabsql[15]= "SELECT rowid as rowid, code, label as libelle, width, height, unit, active FROM ".MAIN_DB_PREFIX."c_paper_format";
|
||||||
$tabsql[16]= "SELECT code, label as libelle, sortorder, active FROM ".MAIN_DB_PREFIX."c_prospectlevel";
|
$tabsql[16]= "SELECT code, label as libelle, sortorder, active FROM ".MAIN_DB_PREFIX."c_prospectlevel";
|
||||||
@ -259,8 +260,8 @@ $tabfield[8] = "code,libelle,country_id,country".(! empty($conf->global->SOCIETE
|
|||||||
$tabfield[9] = "code,label,unicode";
|
$tabfield[9] = "code,label,unicode";
|
||||||
$tabfield[10]= "country_id,country,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note";
|
$tabfield[10]= "country_id,country,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note";
|
||||||
$tabfield[11]= "element,source,code,libelle,position";
|
$tabfield[11]= "element,source,code,libelle,position";
|
||||||
$tabfield[12]= "code,libelle,libelle_facture,nbjour,type_cdr,decalage,sortorder";
|
$tabfield[12]= "code,libelle,libelle_facture,nbjour,type_cdr,decalage,sortorder,entity";
|
||||||
$tabfield[13]= "code,libelle,type,accountancy_code";
|
$tabfield[13]= "code,libelle,type,accountancy_code,entity";
|
||||||
$tabfield[14]= "code,libelle,price,organization,country_id,country";
|
$tabfield[14]= "code,libelle,price,organization,country_id,country";
|
||||||
$tabfield[15]= "code,libelle,width,height,unit";
|
$tabfield[15]= "code,libelle,width,height,unit";
|
||||||
$tabfield[16]= "code,libelle,sortorder";
|
$tabfield[16]= "code,libelle,sortorder";
|
||||||
@ -335,8 +336,8 @@ $tabfieldinsert[8] = "code,libelle,fk_country".(! empty($conf->global->SOCIETE_S
|
|||||||
$tabfieldinsert[9] = "code_iso,label,unicode";
|
$tabfieldinsert[9] = "code_iso,label,unicode";
|
||||||
$tabfieldinsert[10]= "fk_pays,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note";
|
$tabfieldinsert[10]= "fk_pays,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note";
|
||||||
$tabfieldinsert[11]= "element,source,code,libelle,position";
|
$tabfieldinsert[11]= "element,source,code,libelle,position";
|
||||||
$tabfieldinsert[12]= "code,libelle,libelle_facture,nbjour,type_cdr,decalage,sortorder";
|
$tabfieldinsert[12]= "code,libelle,libelle_facture,nbjour,type_cdr,decalage,sortorder,entity";
|
||||||
$tabfieldinsert[13]= "code,libelle,type,accountancy_code";
|
$tabfieldinsert[13]= "code,libelle,type,accountancy_code,entity";
|
||||||
$tabfieldinsert[14]= "code,libelle,price,organization,fk_pays";
|
$tabfieldinsert[14]= "code,libelle,price,organization,fk_pays";
|
||||||
$tabfieldinsert[15]= "code,label,width,height,unit";
|
$tabfieldinsert[15]= "code,label,width,height,unit";
|
||||||
$tabfieldinsert[16]= "code,label,sortorder";
|
$tabfieldinsert[16]= "code,label,sortorder";
|
||||||
@ -733,7 +734,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
$_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU');
|
$_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU');
|
||||||
}
|
}
|
||||||
else if ($value == 'entity') {
|
else if ($value == 'entity') {
|
||||||
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
$_POST[$listfieldvalue[$i]] = getEntity($tabname[$id]);
|
||||||
}
|
}
|
||||||
if ($i) $sql.=",";
|
if ($i) $sql.=",";
|
||||||
if ($listfieldvalue[$i] == 'sortorder') // For column name 'sortorder', we use the field name 'position'
|
if ($listfieldvalue[$i] == 'sortorder') // For column name 'sortorder', we use the field name 'position'
|
||||||
@ -785,7 +786,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
$_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU');
|
$_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU');
|
||||||
}
|
}
|
||||||
else if ($field == 'entity') {
|
else if ($field == 'entity') {
|
||||||
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
$_POST[$listfieldvalue[$i]] = getEntity($tabname[$id]);
|
||||||
}
|
}
|
||||||
if ($i) $sql.=",";
|
if ($i) $sql.=",";
|
||||||
$sql.= $field."=";
|
$sql.= $field."=";
|
||||||
@ -798,6 +799,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$sql.= " WHERE ".$rowidcol." = '".$rowid."'";
|
$sql.= " WHERE ".$rowidcol." = '".$rowid."'";
|
||||||
|
$sql.= " AND entity = '".getEntity($tabname[$id])."'";
|
||||||
|
|
||||||
dol_syslog("actionmodify", LOG_DEBUG);
|
dol_syslog("actionmodify", LOG_DEBUG);
|
||||||
//print $sql;
|
//print $sql;
|
||||||
@ -820,7 +822,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes') // delete
|
|||||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||||
else { $rowidcol="rowid"; }
|
else { $rowidcol="rowid"; }
|
||||||
|
|
||||||
$sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol."='".$rowid."'";
|
$sql = "DELETE FROM ".$tabname[$id]." WHERE ".$rowidcol."='".$rowid."'".($entity != '' ? " AND entity = " . (int) $entity : '');
|
||||||
|
|
||||||
dol_syslog("delete", LOG_DEBUG);
|
dol_syslog("delete", LOG_DEBUG);
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
@ -844,10 +846,10 @@ if ($action == $acts[0])
|
|||||||
else { $rowidcol="rowid"; }
|
else { $rowidcol="rowid"; }
|
||||||
|
|
||||||
if ($rowid) {
|
if ($rowid) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'";
|
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'".($entity != '' ? " AND entity = " . (int) $entity : '');
|
||||||
}
|
}
|
||||||
elseif ($code) {
|
elseif ($code) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".dol_escape_htmltag($code)."'";
|
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = " . (int) $entity : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
@ -864,10 +866,10 @@ if ($action == $acts[1])
|
|||||||
else { $rowidcol="rowid"; }
|
else { $rowidcol="rowid"; }
|
||||||
|
|
||||||
if ($rowid) {
|
if ($rowid) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'";
|
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'".($entity != '' ? " AND entity = " . (int) $entity : '');
|
||||||
}
|
}
|
||||||
elseif ($code) {
|
elseif ($code) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".dol_escape_htmltag($code)."'";
|
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = " . (int) $entity : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
@ -884,10 +886,10 @@ if ($action == 'activate_favorite')
|
|||||||
else { $rowidcol="rowid"; }
|
else { $rowidcol="rowid"; }
|
||||||
|
|
||||||
if ($rowid) {
|
if ($rowid) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE ".$rowidcol."='".$rowid."'";
|
$sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE ".$rowidcol."='".$rowid."'".($entity != '' ? " AND entity = " . (int) $entity : '');
|
||||||
}
|
}
|
||||||
elseif ($code) {
|
elseif ($code) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE code='".dol_escape_htmltag($code)."'";
|
$sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = " . (int) $entity : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
@ -904,10 +906,10 @@ if ($action == 'disable_favorite')
|
|||||||
else { $rowidcol="rowid"; }
|
else { $rowidcol="rowid"; }
|
||||||
|
|
||||||
if ($rowid) {
|
if ($rowid) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE ".$rowidcol."='".$rowid."'";
|
$sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE ".$rowidcol."='".$rowid."'".($entity != '' ? " AND entity = " . (int) $entity : '');
|
||||||
}
|
}
|
||||||
elseif ($code) {
|
elseif ($code) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE code='".dol_escape_htmltag($code)."'";
|
$sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = " . (int) $entity : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
@ -959,6 +961,7 @@ print "<br>\n";
|
|||||||
$param = '&id='.$id;
|
$param = '&id='.$id;
|
||||||
if ($search_country_id > 0) $param.= '&search_country_id='.$search_country_id;
|
if ($search_country_id > 0) $param.= '&search_country_id='.$search_country_id;
|
||||||
if ($search_code != '') $param.= '&search_code='.urlencode($search_country_id);
|
if ($search_code != '') $param.= '&search_code='.urlencode($search_country_id);
|
||||||
|
if ($entity != '') $param.= '&entity=' . (int) $entity;
|
||||||
$paramwithsearch = $param;
|
$paramwithsearch = $param;
|
||||||
if ($sortorder) $paramwithsearch.= '&sortorder='.$sortorder;
|
if ($sortorder) $paramwithsearch.= '&sortorder='.$sortorder;
|
||||||
if ($sortfield) $paramwithsearch.= '&sortfield='.$sortfield;
|
if ($sortfield) $paramwithsearch.= '&sortfield='.$sortfield;
|
||||||
@ -1016,6 +1019,7 @@ if ($id)
|
|||||||
if ($tabname[$id])
|
if ($tabname[$id])
|
||||||
{
|
{
|
||||||
$alabelisused=0;
|
$alabelisused=0;
|
||||||
|
$withentity=null;
|
||||||
|
|
||||||
$fieldlist=explode(',',$tabfield[$id]);
|
$fieldlist=explode(',',$tabfield[$id]);
|
||||||
|
|
||||||
@ -1026,6 +1030,11 @@ if ($id)
|
|||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
foreach ($fieldlist as $field => $value)
|
foreach ($fieldlist as $field => $value)
|
||||||
{
|
{
|
||||||
|
if ($fieldlist[$field] == 'entity') {
|
||||||
|
$withentity = getEntity($tabname[$id]);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Determine le nom du champ par rapport aux noms possibles
|
// Determine le nom du champ par rapport aux noms possibles
|
||||||
// dans les dictionnaires de donnees
|
// dans les dictionnaires de donnees
|
||||||
$valuetoshow=ucfirst($fieldlist[$field]); // Par defaut
|
$valuetoshow=ucfirst($fieldlist[$field]); // Par defaut
|
||||||
@ -1119,6 +1128,8 @@ if ($id)
|
|||||||
if ($id == 4) print '<td></td>';
|
if ($id == 4) print '<td></td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||||
|
if (! is_null($withentity))
|
||||||
|
print '<input type="hidden" name="entity" value="'.$withentity.'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td style="min-width: 26px;"></td>';
|
print '<td style="min-width: 26px;"></td>';
|
||||||
print '<td style="min-width: 26px;"></td>';
|
print '<td style="min-width: 26px;"></td>';
|
||||||
@ -1197,7 +1208,9 @@ if ($id)
|
|||||||
$filterfound=0;
|
$filterfound=0;
|
||||||
foreach ($fieldlist as $field => $value)
|
foreach ($fieldlist as $field => $value)
|
||||||
{
|
{
|
||||||
$showfield=1; // By defaut
|
if ($fieldlist[$field] == 'entity') continue;
|
||||||
|
|
||||||
|
$showfield=1; // By default
|
||||||
|
|
||||||
if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $showfield=0; }
|
if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $showfield=0; }
|
||||||
|
|
||||||
@ -1239,6 +1252,8 @@ if ($id)
|
|||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
foreach ($fieldlist as $field => $value)
|
foreach ($fieldlist as $field => $value)
|
||||||
{
|
{
|
||||||
|
if ($fieldlist[$field] == 'entity') continue;
|
||||||
|
|
||||||
// Determine le nom du champ par rapport aux noms possibles
|
// Determine le nom du champ par rapport aux noms possibles
|
||||||
// dans les dictionnaires de donnees
|
// dans les dictionnaires de donnees
|
||||||
$showfield=1; // By defaut
|
$showfield=1; // By defaut
|
||||||
@ -1349,12 +1364,16 @@ if ($id)
|
|||||||
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
||||||
|
|
||||||
// Show fields
|
// Show fields
|
||||||
if (empty($reshook)) fieldList($fieldlist, $obj, $tabname[$id], 'edit');
|
if (empty($reshook)) {
|
||||||
|
$withentity = fieldList($fieldlist, $obj, $tabname[$id], 'edit');
|
||||||
|
}
|
||||||
|
|
||||||
print '<td colspan="3" align="center">';
|
print '<td colspan="3" align="center">';
|
||||||
print '<div name="'.(! empty($obj->rowid)?$obj->rowid:$obj->code).'"></div>';
|
print '<div name="'.(! empty($obj->rowid)?$obj->rowid:$obj->code).'"></div>';
|
||||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||||
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
|
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
|
||||||
|
if (! is_null($withentity))
|
||||||
|
print '<input type="hidden" name="entity" value="'.$withentity.'">';
|
||||||
print '<input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
|
print '<input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
|
||||||
print '<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'">';
|
print '<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
@ -1369,11 +1388,19 @@ if ($id)
|
|||||||
|
|
||||||
if (empty($reshook))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
|
$withentity=null;
|
||||||
|
|
||||||
foreach ($fieldlist as $field => $value)
|
foreach ($fieldlist as $field => $value)
|
||||||
{
|
{
|
||||||
$showfield=1;
|
$showfield=1;
|
||||||
$align="left";
|
$align="left";
|
||||||
$valuetoshow=$obj->{$fieldlist[$field]};
|
$valuetoshow=$obj->{$fieldlist[$field]};
|
||||||
|
|
||||||
|
if ($fieldlist[$field] == 'entity') {
|
||||||
|
$withentity = $valuetoshow;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if ($value == 'element')
|
if ($value == 'element')
|
||||||
{
|
{
|
||||||
$valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow;
|
$valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow;
|
||||||
@ -1588,7 +1615,8 @@ if ($id)
|
|||||||
// If rowidcol not defined
|
// If rowidcol not defined
|
||||||
if (empty($rowidcol) || in_array($id, array(6,7,8,13,17,19,27))) $rowidcol='rowid';
|
if (empty($rowidcol) || in_array($id, array(6,7,8,13,17,19,27))) $rowidcol='rowid';
|
||||||
$url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.((! empty($obj->{$rowidcol}) || $obj->{$rowidcol} == '0')?$obj->{$rowidcol}:(! empty($obj->code)?urlencode($obj->code):'')).'&code='.(! empty($obj->code)?urlencode($obj->code):'');
|
$url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.((! empty($obj->{$rowidcol}) || $obj->{$rowidcol} == '0')?$obj->{$rowidcol}:(! empty($obj->code)?urlencode($obj->code):'')).'&code='.(! empty($obj->code)?urlencode($obj->code):'');
|
||||||
if ($param) $url .= '&'.$param;
|
if (! empty($param)) $url .= '&'.$param;
|
||||||
|
if (! is_null($withentity)) $url .= '&entity='.$withentity;
|
||||||
$url.='&';
|
$url.='&';
|
||||||
|
|
||||||
// Favorite
|
// Favorite
|
||||||
@ -1721,7 +1749,7 @@ $db->close();
|
|||||||
* @param Object $obj If we show a particular record, obj is filled with record fields
|
* @param Object $obj If we show a particular record, obj is filled with record fields
|
||||||
* @param string $tabname Name of SQL table
|
* @param string $tabname Name of SQL table
|
||||||
* @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered
|
* @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered
|
||||||
* @return void
|
* @return string '' or value of entity into table
|
||||||
*/
|
*/
|
||||||
function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
||||||
{
|
{
|
||||||
@ -1735,8 +1763,15 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
|||||||
$formcompany = new FormCompany($db);
|
$formcompany = new FormCompany($db);
|
||||||
if (! empty($conf->accounting->enabled)) $formaccounting = new FormAccounting($db);
|
if (! empty($conf->accounting->enabled)) $formaccounting = new FormAccounting($db);
|
||||||
|
|
||||||
|
$withentity='';
|
||||||
|
|
||||||
foreach ($fieldlist as $field => $value)
|
foreach ($fieldlist as $field => $value)
|
||||||
{
|
{
|
||||||
|
if ($fieldlist[$field] == 'entity') {
|
||||||
|
$withentity = $obj->{$fieldlist[$field]};
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (in_array($fieldlist[$field], array('code', 'libelle', 'type')) && $tabname == MAIN_DB_PREFIX."c_actioncomm" && in_array($obj->type, array('system','systemauto')))
|
if (in_array($fieldlist[$field], array('code', 'libelle', 'type')) && $tabname == MAIN_DB_PREFIX."c_actioncomm" && in_array($obj->type, array('system','systemauto')))
|
||||||
{
|
{
|
||||||
$hidden = (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'');
|
$hidden = (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'');
|
||||||
@ -1948,5 +1983,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $withentity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -47,14 +47,21 @@ if (! $user->admin) accessforbidden();
|
|||||||
|
|
||||||
$action = GETPOST('action','aZ09');
|
$action = GETPOST('action','aZ09');
|
||||||
|
|
||||||
|
|
||||||
if (! defined("MAIN_MOTD")) define("MAIN_MOTD","");
|
if (! defined("MAIN_MOTD")) define("MAIN_MOTD","");
|
||||||
|
|
||||||
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||||
|
$contextpage=array('adminihm','globaladmin');
|
||||||
|
$hookmanager->initHooks($contextpage);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Action
|
* Action
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
if (GETPOST('cancel','alpha'))
|
if (GETPOST('cancel','alpha'))
|
||||||
{
|
{
|
||||||
$action='';
|
$action='';
|
||||||
@ -99,6 +106,10 @@ if ($action == 'update')
|
|||||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_TOPMENU_BACK1', $conf->entity);
|
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_TOPMENU_BACK1', $conf->entity);
|
||||||
else dolibarr_set_const($db, 'THEME_ELDY_TOPMENU_BACK1', $val,'chaine',0,'',$conf->entity);
|
else dolibarr_set_const($db, 'THEME_ELDY_TOPMENU_BACK1', $val,'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
|
$val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_VERMENU_BACK1'),array()))));
|
||||||
|
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_VERMENU_BACK1', $conf->entity);
|
||||||
|
else dolibarr_set_const($db, 'THEME_ELDY_VERMENU_BACK1', $val,'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
$val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1'),array()))));
|
$val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1'),array()))));
|
||||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_BACKTITLE1', $conf->entity);
|
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_BACKTITLE1', $conf->entity);
|
||||||
else dolibarr_set_const($db, 'THEME_ELDY_BACKTITLE1', $val,'chaine',0,'',$conf->entity);
|
else dolibarr_set_const($db, 'THEME_ELDY_BACKTITLE1', $val,'chaine',0,'',$conf->entity);
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||||
* Copyright (C) 2005 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2006-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2006-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
|
||||||
*
|
*
|
||||||
@ -68,6 +68,7 @@ if ($action == 'setvalue' && $user->admin)
|
|||||||
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_MOBILE',GETPOST("fieldmobile"),'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_MOBILE',GETPOST("fieldmobile"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_SKYPE',GETPOST("fieldskype"),'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_SKYPE',GETPOST("fieldskype"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_FAX',GETPOST("fieldfax"),'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_FAX',GETPOST("fieldfax"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
|
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_COMPANY',GETPOST("fieldcompany"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_ADDRESS',GETPOST("fieldaddress"),'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_ADDRESS',GETPOST("fieldaddress"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_ZIP',GETPOST("fieldzip"),'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_ZIP',GETPOST("fieldzip"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_TOWN',GETPOST("fieldtown"),'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_TOWN',GETPOST("fieldtown"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
@ -282,6 +283,14 @@ print '</td><td>'.$langs->trans("LDAPFieldFaxExample").'</td>';
|
|||||||
print '<td align="right"> </td>';
|
print '<td align="right"> </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
// Company
|
||||||
|
|
||||||
|
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldCompany").'</td><td>';
|
||||||
|
print '<input size="25" type="text" name="fieldcompany" value="'.$conf->global->LDAP_MEMBER_FIELD_COMPANY.'">';
|
||||||
|
print '</td><td>'.$langs->trans("LDAPFieldCompanyExample").'</td>';
|
||||||
|
print '<td align="right"> </td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
// Address
|
// Address
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldAddress").'</td><td>';
|
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldAddress").'</td><td>';
|
||||||
|
|||||||
@ -65,6 +65,11 @@ if ($action == 'setvalue' && $user->admin)
|
|||||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_MOBILE',GETPOST("fieldmobile"),'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_FIELD_MOBILE',GETPOST("fieldmobile"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_SKYPE',GETPOST("fieldskype"),'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_FIELD_SKYPE',GETPOST("fieldskype"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_FAX',GETPOST("fieldfax"),'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_FIELD_FAX',GETPOST("fieldfax"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
|
if (! dolibarr_set_const($db, 'LDAP_FIELD_COMPANY',GETPOST("fieldcompany"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
|
if (! dolibarr_set_const($db, 'LDAP_FIELD_ADDRESS',GETPOST("fieldaddress"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
|
if (! dolibarr_set_const($db, 'LDAP_FIELD_ZIP',GETPOST("fieldzip"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
|
if (! dolibarr_set_const($db, 'LDAP_FIELD_TOWN',GETPOST("fieldtown"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
|
if (! dolibarr_set_const($db, 'LDAP_FIELD_COUNTRY',GETPOST("fieldcountry"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_DESCRIPTION',GETPOST("fielddescription"),'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_FIELD_DESCRIPTION',GETPOST("fielddescription"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_SID',GETPOST("fieldsid"),'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_FIELD_SID',GETPOST("fieldsid"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_TITLE',GETPOST("fieldtitle"),'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_FIELD_TITLE',GETPOST("fieldtitle"),'chaine',0,'',$conf->entity)) $error++;
|
||||||
@ -208,7 +213,7 @@ print '</tr>';
|
|||||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldPasswordNotCrypted").'</td><td>';
|
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldPasswordNotCrypted").'</td><td>';
|
||||||
print '<input size="25" type="text" name="fieldpassword" value="'.$conf->global->LDAP_FIELD_PASSWORD.'">';
|
print '<input size="25" type="text" name="fieldpassword" value="'.$conf->global->LDAP_FIELD_PASSWORD.'">';
|
||||||
print '</td><td>'.$langs->trans("LDAPFieldPasswordExample").'</td>';
|
print '</td><td>'.$langs->trans("LDAPFieldPasswordExample").'</td>';
|
||||||
print '<td align="right"><input type="radio" name="key" value="LDAP_FIELD_PASSWORD"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_PASSWORD)?' checked':'')."></td>";
|
print '<td align="right"> </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Password crypted
|
// Password crypted
|
||||||
@ -216,7 +221,7 @@ print '</tr>';
|
|||||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldPasswordCrypted").'</td><td>';
|
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldPasswordCrypted").'</td><td>';
|
||||||
print '<input size="25" type="text" name="fieldpasswordcrypted" value="'.$conf->global->LDAP_FIELD_PASSWORD_CRYPTED.'">';
|
print '<input size="25" type="text" name="fieldpasswordcrypted" value="'.$conf->global->LDAP_FIELD_PASSWORD_CRYPTED.'">';
|
||||||
print '</td><td>'.$langs->trans("LDAPFieldPasswordExample").'</td>';
|
print '</td><td>'.$langs->trans("LDAPFieldPasswordExample").'</td>';
|
||||||
print '<td align="right"><input type="radio" name="key" value="LDAP_FIELD_PASSWORD_CRYPTED"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_PASSWORD_CRYPTED)?' checked':'')."></td>";
|
print '<td align="right"> </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Mail
|
// Mail
|
||||||
@ -259,12 +264,52 @@ print '</td><td>'.$langs->trans("LDAPFieldFaxExample").'</td>';
|
|||||||
print '<td align="right"><input type="radio" name="key" value="LDAP_FIELD_FAX"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_FAX)?' checked':'')."></td>";
|
print '<td align="right"><input type="radio" name="key" value="LDAP_FIELD_FAX"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_FAX)?' checked':'')."></td>";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
// Company
|
||||||
|
|
||||||
|
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldCompany").'</td><td>';
|
||||||
|
print '<input size="25" type="text" name="fieldcompany" value="'.$conf->global->LDAP_FIELD_COMPANY.'">';
|
||||||
|
print '</td><td>'.$langs->trans("LDAPFieldCompanyExample").'</td>';
|
||||||
|
print '<td align="right"> </td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
// Address
|
||||||
|
|
||||||
|
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldAddress").'</td><td>';
|
||||||
|
print '<input size="25" type="text" name="fieldaddress" value="'.$conf->global->LDAP_FIELD_ADDRESS.'">';
|
||||||
|
print '</td><td>'.$langs->trans("LDAPFieldAddressExample").'</td>';
|
||||||
|
print '<td align="right"> </td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
// ZIP
|
||||||
|
|
||||||
|
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldZip").'</td><td>';
|
||||||
|
print '<input size="25" type="text" name="fieldzip" value="'.$conf->global->LDAP_FIELD_ZIP.'">';
|
||||||
|
print '</td><td>'.$langs->trans("LDAPFieldZipExample").'</td>';
|
||||||
|
print '<td align="right"> </td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
// TOWN
|
||||||
|
|
||||||
|
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldTown").'</td><td>';
|
||||||
|
print '<input size="25" type="text" name="fieldtown" value="'.$conf->global->LDAP_FIELD_TOWN.'">';
|
||||||
|
print '</td><td>'.$langs->trans("LDAPFieldTownExample").'</td>';
|
||||||
|
print '<td align="right"> </td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
// COUNTRY
|
||||||
|
|
||||||
|
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldCountry").'</td><td>';
|
||||||
|
print '<input size="25" type="text" name="fieldcountry" value="'.$conf->global->LDAP_FIELD_COUNTRY.'">';
|
||||||
|
print '</td><td> </td>';
|
||||||
|
print '<td align="right"> </td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
// Title
|
// Title
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldTitle").'</td><td>';
|
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldTitle").'</td><td>';
|
||||||
print '<input size="25" type="text" name="fieldtitle" value="'.$conf->global->LDAP_FIELD_TITLE.'">';
|
print '<input size="25" type="text" name="fieldtitle" value="'.$conf->global->LDAP_FIELD_TITLE.'">';
|
||||||
print '</td><td>'.$langs->trans("LDAPFieldTitleExample").'</td>';
|
print '</td><td>'.$langs->trans("LDAPFieldTitleExample").'</td>';
|
||||||
print '<td align="right"><input type="radio" name="key" value="LDAP_FIELD_TITLE"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_TITLE)?' checked':'')."></td>";
|
print '<td align="right"> </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Note
|
// Note
|
||||||
@ -272,7 +317,7 @@ print '</tr>';
|
|||||||
print '<tr class="oddeven"><td>'.$langs->trans("Note").'</td><td>';
|
print '<tr class="oddeven"><td>'.$langs->trans("Note").'</td><td>';
|
||||||
print '<input size="25" type="text" name="fielddescription" value="'.$conf->global->LDAP_FIELD_DESCRIPTION.'">';
|
print '<input size="25" type="text" name="fielddescription" value="'.$conf->global->LDAP_FIELD_DESCRIPTION.'">';
|
||||||
print '</td><td>'.$langs->trans("LDAPFieldDescriptionExample").'</td>';
|
print '</td><td>'.$langs->trans("LDAPFieldDescriptionExample").'</td>';
|
||||||
print '<td align="right"><input type="radio" name="key" value="LDAP_FIELD_DESCRIPTION"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_DESCRIPTION)?' checked':'')."></td>";
|
print '<td align="right"> </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Sid
|
// Sid
|
||||||
|
|||||||
@ -53,7 +53,6 @@ $id=GETPOST('id','int');
|
|||||||
$rowid=GETPOST('rowid','alpha');
|
$rowid=GETPOST('rowid','alpha');
|
||||||
$search_label=GETPOST('search_label','alpha');
|
$search_label=GETPOST('search_label','alpha');
|
||||||
$search_type_template=GETPOST('search_type_template','alpha');
|
$search_type_template=GETPOST('search_type_template','alpha');
|
||||||
$search_topic=GETPOST('search_topic','alpha');
|
|
||||||
$search_lang=GETPOST('search_lang','alpha');
|
$search_lang=GETPOST('search_lang','alpha');
|
||||||
$search_fk_user=GETPOST('search_fk_user','intcomma');
|
$search_fk_user=GETPOST('search_fk_user','intcomma');
|
||||||
$search_topic=GETPOST('search_topic','alpha');
|
$search_topic=GETPOST('search_topic','alpha');
|
||||||
@ -94,26 +93,20 @@ $tabsqlsort[25]="label ASC, lang ASC, position ASC";
|
|||||||
|
|
||||||
// Nom des champs en resultat de select pour affichage du dictionnaire
|
// Nom des champs en resultat de select pour affichage du dictionnaire
|
||||||
$tabfield=array();
|
$tabfield=array();
|
||||||
$tabfield[25]= "label,type_template,lang,fk_user,private,position,topic,content";
|
$tabfield[25]= "label,type_template,lang,fk_user,private,position,topic,joinfiles,content";
|
||||||
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) $tabfield[25].=',content_lines';
|
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) $tabfield[25].=',content_lines';
|
||||||
|
|
||||||
// Nom des champs d'edition pour modification d'un enregistrement
|
// Nom des champs d'edition pour modification d'un enregistrement
|
||||||
$tabfieldvalue=array();
|
$tabfieldvalue=array();
|
||||||
$tabfieldvalue[25]= "label,type_template,fk_user,lang,private,position,topic,content";
|
$tabfieldvalue[25]= "label,type_template,fk_user,lang,private,position,topic,joinfiles,content";
|
||||||
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) $tabfieldvalue[25].=',content_lines';
|
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) $tabfieldvalue[25].=',content_lines';
|
||||||
|
|
||||||
// Nom des champs dans la table pour insertion d'un enregistrement
|
// Nom des champs dans la table pour insertion d'un enregistrement
|
||||||
$tabfieldinsert=array();
|
$tabfieldinsert=array();
|
||||||
$tabfieldinsert[25]= "label,type_template,fk_user,lang,private,position,topic,content";
|
$tabfieldinsert[25]= "label,type_template,fk_user,lang,private,position,topic,joinfiles,content";
|
||||||
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) $tabfieldinsert[25].=',content_lines';
|
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) $tabfieldinsert[25].=',content_lines';
|
||||||
$tabfieldinsert[25].=',entity'; // Must be at end because not into other arrays
|
$tabfieldinsert[25].=',entity'; // Must be at end because not into other arrays
|
||||||
|
|
||||||
// Nom du rowid si le champ n'est pas de type autoincrement
|
|
||||||
// Example: "" if id field is "rowid" and has autoincrement on
|
|
||||||
// "nameoffield" if id field is not "rowid" or has not autoincrement on
|
|
||||||
$tabrowid=array();
|
|
||||||
$tabrowid[25]= "";
|
|
||||||
|
|
||||||
// Condition to show dictionary in setup page
|
// Condition to show dictionary in setup page
|
||||||
$tabcond=array();
|
$tabcond=array();
|
||||||
$tabcond[25]= true;
|
$tabcond[25]= true;
|
||||||
@ -153,7 +146,7 @@ else
|
|||||||
|
|
||||||
|
|
||||||
$tabhelp=array();
|
$tabhelp=array();
|
||||||
$tabhelp[25] = array('topic'=>$helpsubstit,'content'=>$helpsubstit,'content_lines'=>$helpsubstitforlines,'type_template'=>$langs->trans("TemplateForElement"),'private'=>$langs->trans("TemplateIsVisibleByOwnerOnly"), 'position'=>$langs->trans("PositionIntoComboList"));
|
$tabhelp[25] = array('topic'=>$helpsubstit,'joinfiles'=>$langs->trans('AttachMainDocByDefault'), 'content'=>$helpsubstit,'content_lines'=>$helpsubstitforlines,'type_template'=>$langs->trans("TemplateForElement"),'private'=>$langs->trans("TemplateIsVisibleByOwnerOnly"), 'position'=>$langs->trans("PositionIntoComboList"));
|
||||||
|
|
||||||
// List of check for fields (NOT USED YET)
|
// List of check for fields (NOT USED YET)
|
||||||
$tabfieldcheck=array();
|
$tabfieldcheck=array();
|
||||||
@ -177,6 +170,7 @@ if ($conf->fournisseur->enabled) $elementList['invoice_supplier_send']=$la
|
|||||||
if ($conf->societe->enabled) $elementList['thirdparty']=$langs->trans('MailToThirdparty');
|
if ($conf->societe->enabled) $elementList['thirdparty']=$langs->trans('MailToThirdparty');
|
||||||
if ($conf->adherent->enabled) $elementList['member']=$langs->trans('MailToMember');
|
if ($conf->adherent->enabled) $elementList['member']=$langs->trans('MailToMember');
|
||||||
if ($conf->contrat->enabled) $elementList['contract']=$langs->trans('MailToSendContract');
|
if ($conf->contrat->enabled) $elementList['contract']=$langs->trans('MailToSendContract');
|
||||||
|
$elementList['user']=$langs->trans('MailToUser');
|
||||||
$elementList['all'] =$langs->trans('VisibleEverywhere');
|
$elementList['all'] =$langs->trans('VisibleEverywhere');
|
||||||
$elementList['none']=$langs->trans('VisibleNowhere');
|
$elementList['none']=$langs->trans('VisibleNowhere');
|
||||||
|
|
||||||
@ -229,10 +223,12 @@ if (empty($reshook))
|
|||||||
$ok=1;
|
$ok=1;
|
||||||
foreach ($listfield as $f => $value)
|
foreach ($listfield as $f => $value)
|
||||||
{
|
{
|
||||||
|
// Not mandatory fields
|
||||||
|
if ($value == 'joinfiles') continue;
|
||||||
if ($value == 'content') continue;
|
if ($value == 'content') continue;
|
||||||
if ($value == 'content_lines') continue;
|
if ($value == 'content_lines') continue;
|
||||||
if ($value == 'content') $value='content-'.$rowid;
|
|
||||||
if ($value == 'content_lines') $value='content_lines-'.$rowid;
|
if (GETPOST('actionmodify') && $value == 'topic') $_POST['topic']=$_POST['topic-'.$rowid];
|
||||||
|
|
||||||
if ((! isset($_POST[$value]) || $_POST[$value]=='' || $_POST[$value]=='-1') && $value != 'lang' && $value != 'fk_user' && $value != 'position')
|
if ((! isset($_POST[$value]) || $_POST[$value]=='' || $_POST[$value]=='-1') && $value != 'lang' && $value != 'fk_user' && $value != 'position')
|
||||||
{
|
{
|
||||||
@ -256,34 +252,14 @@ if (empty($reshook))
|
|||||||
// Si verif ok et action add, on ajoute la ligne
|
// Si verif ok et action add, on ajoute la ligne
|
||||||
if ($ok && GETPOST('actionadd'))
|
if ($ok && GETPOST('actionadd'))
|
||||||
{
|
{
|
||||||
if ($tabrowid[$id])
|
|
||||||
{
|
|
||||||
// Recupere id libre pour insertion
|
|
||||||
$newid=0;
|
|
||||||
$sql = "SELECT max(".$tabrowid[$id].") newid from ".$tabname[$id];
|
|
||||||
$result = $db->query($sql);
|
|
||||||
if ($result)
|
|
||||||
{
|
|
||||||
$obj = $db->fetch_object($result);
|
|
||||||
$newid=($obj->newid + 1);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
dol_print_error($db);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add new entry
|
// Add new entry
|
||||||
$sql = "INSERT INTO ".$tabname[$id]." (";
|
$sql = "INSERT INTO ".$tabname[$id]." (";
|
||||||
// List of fields
|
// List of fields
|
||||||
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert))
|
|
||||||
$sql.= $tabrowid[$id].",";
|
|
||||||
$sql.= $tabfieldinsert[$id];
|
$sql.= $tabfieldinsert[$id];
|
||||||
$sql.=",active)";
|
$sql.=",active)";
|
||||||
$sql.= " VALUES(";
|
$sql.= " VALUES(";
|
||||||
|
|
||||||
// List of values
|
// List of values
|
||||||
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert))
|
|
||||||
$sql.= $newid.",";
|
|
||||||
$i=0;
|
$i=0;
|
||||||
foreach ($listfieldinsert as $f => $value)
|
foreach ($listfieldinsert as $f => $value)
|
||||||
{
|
{
|
||||||
@ -322,17 +298,11 @@ if (empty($reshook))
|
|||||||
// Si verif ok et action modify, on modifie la ligne
|
// Si verif ok et action modify, on modifie la ligne
|
||||||
if ($ok && GETPOST('actionmodify'))
|
if ($ok && GETPOST('actionmodify'))
|
||||||
{
|
{
|
||||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
$rowidcol="rowid";
|
||||||
else { $rowidcol="rowid"; }
|
|
||||||
|
|
||||||
// Modify entry
|
// Modify entry
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET ";
|
$sql = "UPDATE ".$tabname[$id]." SET ";
|
||||||
// Modifie valeur des champs
|
// Modifie valeur des champs
|
||||||
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldmodify))
|
|
||||||
{
|
|
||||||
$sql.= $tabrowid[$id]."=";
|
|
||||||
$sql.= "'".$db->escape($rowid)."', ";
|
|
||||||
}
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ($listfieldmodify as $field)
|
foreach ($listfieldmodify as $field)
|
||||||
{
|
{
|
||||||
@ -340,6 +310,8 @@ if (empty($reshook))
|
|||||||
if ($field == 'lang') $keycode='langcode';
|
if ($field == 'lang') $keycode='langcode';
|
||||||
|
|
||||||
if ($field == 'fk_user' && ! ($_POST['fk_user'] > 0)) $_POST['fk_user']='';
|
if ($field == 'fk_user' && ! ($_POST['fk_user'] > 0)) $_POST['fk_user']='';
|
||||||
|
if ($field == 'topic') $_POST['topic']=$_POST['topic-'.$rowid];
|
||||||
|
if ($field == 'joinfiles') $_POST['joinfiles']=$_POST['joinfiles-'.$rowid];
|
||||||
if ($field == 'content') $_POST['content']=$_POST['content-'.$rowid];
|
if ($field == 'content') $_POST['content']=$_POST['content-'.$rowid];
|
||||||
if ($field == 'content_lines') $_POST['content_lines']=$_POST['content_lines-'.$rowid];
|
if ($field == 'content_lines') $_POST['content_lines']=$_POST['content_lines-'.$rowid];
|
||||||
if ($field == 'entity') $_POST[$keycode] = $conf->entity;
|
if ($field == 'entity') $_POST[$keycode] = $conf->entity;
|
||||||
@ -354,7 +326,11 @@ if (empty($reshook))
|
|||||||
dol_syslog("actionmodify", LOG_DEBUG);
|
dol_syslog("actionmodify", LOG_DEBUG);
|
||||||
//print $sql;
|
//print $sql;
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if (! $resql)
|
if ($resql)
|
||||||
|
{
|
||||||
|
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
setEventMessages($db->error(), null, 'errors');
|
setEventMessages($db->error(), null, 'errors');
|
||||||
}
|
}
|
||||||
@ -363,8 +339,7 @@ if (empty($reshook))
|
|||||||
|
|
||||||
if ($action == 'confirm_delete' && $confirm == 'yes') // delete
|
if ($action == 'confirm_delete' && $confirm == 'yes') // delete
|
||||||
{
|
{
|
||||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
$rowidcol="rowid";
|
||||||
else { $rowidcol="rowid"; }
|
|
||||||
|
|
||||||
$sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol."='".$rowid."'";
|
$sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol."='".$rowid."'";
|
||||||
|
|
||||||
@ -386,15 +361,9 @@ if (empty($reshook))
|
|||||||
// activate
|
// activate
|
||||||
if ($action == $acts[0])
|
if ($action == $acts[0])
|
||||||
{
|
{
|
||||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
$rowidcol="rowid";
|
||||||
else { $rowidcol="rowid"; }
|
|
||||||
|
|
||||||
if ($rowid) {
|
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'";
|
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'";
|
||||||
}
|
|
||||||
elseif ($code) {
|
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".$code."'";
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if (!$result)
|
if (!$result)
|
||||||
@ -406,15 +375,9 @@ if (empty($reshook))
|
|||||||
// disable
|
// disable
|
||||||
if ($action == $acts[1])
|
if ($action == $acts[1])
|
||||||
{
|
{
|
||||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
$rowidcol="rowid";
|
||||||
else { $rowidcol="rowid"; }
|
|
||||||
|
|
||||||
if ($rowid) {
|
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'";
|
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'";
|
||||||
}
|
|
||||||
elseif ($code) {
|
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".$code."'";
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if (!$result)
|
if (!$result)
|
||||||
@ -475,7 +438,7 @@ if ($action == 'delete')
|
|||||||
//var_dump($elementList);
|
//var_dump($elementList);
|
||||||
|
|
||||||
|
|
||||||
$sql="SELECT rowid as rowid, label, type_template, lang, fk_user, private, position, topic, content_lines, content, active";
|
$sql="SELECT rowid as rowid, label, type_template, lang, fk_user, private, position, topic, joinfiles, content_lines, content, active";
|
||||||
$sql.=" FROM ".MAIN_DB_PREFIX."c_email_templates";
|
$sql.=" FROM ".MAIN_DB_PREFIX."c_email_templates";
|
||||||
$sql.=" WHERE entity IN (".getEntity('email_template').")";
|
$sql.=" WHERE entity IN (".getEntity('email_template').")";
|
||||||
if (! $user->admin)
|
if (! $user->admin)
|
||||||
@ -541,11 +504,14 @@ foreach ($fieldlist as $field => $value)
|
|||||||
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); }
|
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); }
|
||||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label"); }
|
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label"); }
|
||||||
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
|
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
|
||||||
if ($fieldlist[$field]=='content') { $valuetoshow=''; }
|
|
||||||
if ($fieldlist[$field]=='content_lines') { $valuetoshow=''; }
|
|
||||||
if ($fieldlist[$field]=='private') { $align='center'; }
|
if ($fieldlist[$field]=='private') { $align='center'; }
|
||||||
if ($fieldlist[$field]=='position') { $align='center'; }
|
if ($fieldlist[$field]=='position') { $align='center'; }
|
||||||
|
|
||||||
|
if ($fieldlist[$field]=='topic') { $valuetoshow=''; }
|
||||||
|
if ($fieldlist[$field]=='joinfiles') { $valuetoshow=''; }
|
||||||
|
if ($fieldlist[$field]=='content') { $valuetoshow=''; }
|
||||||
|
if ($fieldlist[$field]=='content_lines') { $valuetoshow=''; }
|
||||||
|
|
||||||
if ($valuetoshow != '')
|
if ($valuetoshow != '')
|
||||||
{
|
{
|
||||||
print '<td align="'.$align.'">';
|
print '<td align="'.$align.'">';
|
||||||
@ -560,14 +526,11 @@ foreach ($fieldlist as $field => $value)
|
|||||||
}
|
}
|
||||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1;
|
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1;
|
||||||
}
|
}
|
||||||
print '<td colspan="3">';
|
print '<td>';
|
||||||
print '<input type="hidden" name="id" value="' . $id . '">';
|
print '<input type="hidden" name="id" value="' . $id . '">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Line to enter new values (input fields)
|
|
||||||
print "<tr " . $bcnd[$var] . ">";
|
|
||||||
|
|
||||||
$obj = new stdClass();
|
$obj = new stdClass();
|
||||||
// If data was already input, we define them in obj to populate input fields.
|
// If data was already input, we define them in obj to populate input fields.
|
||||||
if (GETPOST('actionadd'))
|
if (GETPOST('actionadd'))
|
||||||
@ -587,6 +550,10 @@ $reshook = $hookmanager->executeHooks('createDictionaryFieldlist', $parameters,
|
|||||||
$error = $hookmanager->error;
|
$error = $hookmanager->error;
|
||||||
$errors = $hookmanager->errors;
|
$errors = $hookmanager->errors;
|
||||||
|
|
||||||
|
|
||||||
|
// Line to enter new values (input fields)
|
||||||
|
print "<tr " . $bcnd[$var] . ">";
|
||||||
|
|
||||||
if (empty($reshook))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
if ($action == 'edit') {
|
if ($action == 'edit') {
|
||||||
@ -596,20 +563,37 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<td align="right" colspan="3">';
|
print '<td align="right">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|
||||||
$fieldsforcontent = array('content');
|
$fieldsforcontent = array('topic', 'joinfiles', 'content');
|
||||||
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) { $fieldsforcontent = array('content','content_lines'); }
|
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) { $fieldsforcontent = array('content','content_lines'); }
|
||||||
foreach ($fieldsforcontent as $tmpfieldlist)
|
foreach ($fieldsforcontent as $tmpfieldlist)
|
||||||
{
|
{
|
||||||
print '<tr class="impair nodrag nodrop nohover"><td colspan="6">';
|
print '<tr class="impair nodrag nodrop nohover"><td colspan="6" class="nobottom">';
|
||||||
|
// Label
|
||||||
|
if ($tmpfieldlist == 'topic')
|
||||||
|
{
|
||||||
|
print '<strong>' . $form->textwithpicto($langs->trans("Topic"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist) . '</strong> ';
|
||||||
|
}
|
||||||
|
if ($tmpfieldlist == 'joinfiles')
|
||||||
|
{
|
||||||
|
print '<strong>' . $form->textwithpicto($langs->trans("FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist) . '</strong> ';
|
||||||
|
}
|
||||||
if ($tmpfieldlist == 'content')
|
if ($tmpfieldlist == 'content')
|
||||||
print '<strong>' . $form->textwithpicto($langs->trans("Content"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist) . '</strong><br>';
|
print '<strong>' . $form->textwithpicto($langs->trans("Content"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist) . '</strong> ';
|
||||||
if ($tmpfieldlist == 'content_lines')
|
if ($tmpfieldlist == 'content_lines')
|
||||||
print '<strong>' . $form->textwithpicto($langs->trans("ContentForLines"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist) . '</strong><br>';
|
print '<strong>' . $form->textwithpicto($langs->trans("ContentForLines"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist) . '</strong><br>';
|
||||||
|
// Input field
|
||||||
|
if ($tmpfieldlist == 'topic') {
|
||||||
|
print '<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.'" value="' . (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '') . '">';
|
||||||
|
}
|
||||||
|
else if ($tmpfieldlist == 'joinfiles') {
|
||||||
|
print '<input type="text" class="flat maxwidth50" name="'.$tmpfieldlist.'" value="' . (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '') . '">';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if ($context != 'hide') {
|
if ($context != 'hide') {
|
||||||
// print '<textarea cols="3" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'</textarea>';
|
// print '<textarea cols="3" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'</textarea>';
|
||||||
$okforextended = true;
|
$okforextended = true;
|
||||||
@ -617,11 +601,13 @@ foreach ($fieldsforcontent as $tmpfieldlist)
|
|||||||
$okforextended = false;
|
$okforextended = false;
|
||||||
$doleditor = new DolEditor($tmpfieldlist, (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 120, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_4, '90%');
|
$doleditor = new DolEditor($tmpfieldlist, (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 120, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_4, '90%');
|
||||||
print $doleditor->Create(1);
|
print $doleditor->Create(1);
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
print ' ';
|
print ' ';
|
||||||
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if ($tmpfieldlist == 'content') {
|
if ($tmpfieldlist == 'topic') {
|
||||||
print '<td align="center" colspan="3" rowspan="' . (count($fieldsforcontent)) . '">';
|
print '<td align="center" rowspan="' . (count($fieldsforcontent)) . '">';
|
||||||
if ($action != 'edit') {
|
if ($action != 'edit') {
|
||||||
print '<input type="submit" class="button" name="actionadd" value="' . $langs->trans("Add") . '">';
|
print '<input type="submit" class="button" name="actionadd" value="' . $langs->trans("Add") . '">';
|
||||||
}
|
}
|
||||||
@ -704,7 +690,6 @@ if ($resql)
|
|||||||
elseif (! in_array($value, array('content', 'content_lines'))) print '<td class="liste_titre"></td>';
|
elseif (! in_array($value, array('content', 'content_lines'))) print '<td class="liste_titre"></td>';
|
||||||
}
|
}
|
||||||
if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) print '<td class="liste_titre"></td>';
|
if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) print '<td class="liste_titre"></td>';
|
||||||
print '<td class="liste_titre"></td>';
|
|
||||||
// Action column
|
// Action column
|
||||||
print '<td class="liste_titre" align="right" width="64">';
|
print '<td class="liste_titre" align="right" width="64">';
|
||||||
$searchpicto=$form->showFilterButtons();
|
$searchpicto=$form->showFilterButtons();
|
||||||
@ -736,11 +721,13 @@ if ($resql)
|
|||||||
if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); }
|
if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); }
|
||||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label"); }
|
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label"); }
|
||||||
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
|
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
|
||||||
if ($fieldlist[$field]=='content') { $valuetoshow=$langs->trans("Content"); $showfield=0;}
|
|
||||||
if ($fieldlist[$field]=='content_lines') { $valuetoshow=$langs->trans("ContentLines"); $showfield=0; }
|
|
||||||
if ($fieldlist[$field]=='private') { $align='center'; }
|
if ($fieldlist[$field]=='private') { $align='center'; }
|
||||||
if ($fieldlist[$field]=='position') { $align='center'; }
|
if ($fieldlist[$field]=='position') { $align='center'; }
|
||||||
|
|
||||||
|
if ($fieldlist[$field]=='joinfiles') { $valuetoshow=$langs->trans("FilesAttachedToEmail"); $align='center'; }
|
||||||
|
if ($fieldlist[$field]=='content') { $valuetoshow=$langs->trans("Content"); $showfield=0;}
|
||||||
|
if ($fieldlist[$field]=='content_lines') { $valuetoshow=$langs->trans("ContentLines"); $showfield=0; }
|
||||||
|
|
||||||
// Affiche nom du champ
|
// Affiche nom du champ
|
||||||
if ($showfield)
|
if ($showfield)
|
||||||
{
|
{
|
||||||
@ -755,7 +742,6 @@ if ($resql)
|
|||||||
|
|
||||||
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page?'page='.$page.'&':''), $param, 'align="center"', $sortfield, $sortorder);
|
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page?'page='.$page.'&':''), $param, 'align="center"', $sortfield, $sortorder);
|
||||||
print getTitleFieldOfList('');
|
print getTitleFieldOfList('');
|
||||||
print getTitleFieldOfList('');
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
if ($num)
|
if ($num)
|
||||||
@ -777,7 +763,8 @@ if ($resql)
|
|||||||
// Show fields
|
// Show fields
|
||||||
if (empty($reshook)) fieldList($fieldlist,$obj,$tabname[$id],'edit');
|
if (empty($reshook)) fieldList($fieldlist,$obj,$tabname[$id],'edit');
|
||||||
|
|
||||||
print '<td colspan="3" align="center">';
|
print '<td></td><td></td><td></td>';
|
||||||
|
print '<td align="center">';
|
||||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||||
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
|
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
|
||||||
print '<input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
|
print '<input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
|
||||||
@ -785,10 +772,10 @@ if ($resql)
|
|||||||
print '<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'">';
|
print '<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
$fieldsforcontent = array('content');
|
$fieldsforcontent = array('topic', 'joinfiles', 'content');
|
||||||
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES))
|
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES))
|
||||||
{
|
{
|
||||||
$fieldsforcontent = array('content', 'content_lines');
|
$fieldsforcontent = array('topic', 'joinfiles', 'content', 'content_lines');
|
||||||
}
|
}
|
||||||
foreach ($fieldsforcontent as $tmpfieldlist)
|
foreach ($fieldsforcontent as $tmpfieldlist)
|
||||||
{
|
{
|
||||||
@ -799,17 +786,29 @@ if ($resql)
|
|||||||
$class = 'tddict';
|
$class = 'tddict';
|
||||||
// Show value for field
|
// Show value for field
|
||||||
if ($showfield) {
|
if ($showfield) {
|
||||||
|
// Show line for topic, joinfiles and content
|
||||||
print '</tr><tr class="oddeven" nohover tr-'.$tmpfieldlist.'-'.$rowid.' ">';
|
print '</tr><tr class="oddeven" nohover tr-'.$tmpfieldlist.'-'.$rowid.' ">';
|
||||||
print '<td colspan="7">'; // To create an artificial CR for the current tr we are on
|
print '<td colspan="8">';
|
||||||
|
if ($tmpfieldlist == 'topic')
|
||||||
|
{
|
||||||
|
print '<strong>' . $form->textwithpicto($langs->trans("Topic"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist) . '</strong> ';
|
||||||
|
print '<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.'-'.$rowid.'" value="' . (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '') . '">';
|
||||||
|
}
|
||||||
|
if ($tmpfieldlist == 'joinfiles')
|
||||||
|
{
|
||||||
|
print '<strong>' . $form->textwithpicto($langs->trans("FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist) . '</strong> ';
|
||||||
|
print '<input type="text" class="flat maxwidth50" name="'.$tmpfieldlist.'-'.$rowid.'" value="' . (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '') . '">';
|
||||||
|
}
|
||||||
|
if ($tmpfieldlist == 'content')
|
||||||
|
{
|
||||||
$okforextended = true;
|
$okforextended = true;
|
||||||
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) $okforextended = false;
|
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) $okforextended = false;
|
||||||
$doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_6, '90%');
|
$doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_6, '90%');
|
||||||
print $doleditor->Create(1);
|
print $doleditor->Create(1);
|
||||||
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td></td>';
|
print '<td></td>';
|
||||||
print '<td></td>';
|
print '<td></td>';
|
||||||
print '<td></td>';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -856,6 +855,12 @@ if ($resql)
|
|||||||
{
|
{
|
||||||
$align="center";
|
$align="center";
|
||||||
}
|
}
|
||||||
|
if ($value == 'joinfiles')
|
||||||
|
{
|
||||||
|
$align="center";
|
||||||
|
if ($valuetoshow) $valuetoshow=1;
|
||||||
|
else $valuetoshow='';
|
||||||
|
}
|
||||||
|
|
||||||
$class='tddict';
|
$class='tddict';
|
||||||
// Show value for field
|
// Show value for field
|
||||||
@ -880,24 +885,21 @@ if ($resql)
|
|||||||
if ($param) $url .= '&'.$param;
|
if ($param) $url .= '&'.$param;
|
||||||
$url.='&';
|
$url.='&';
|
||||||
|
|
||||||
// Active
|
// Status / Active
|
||||||
print '<td align="center" class="nowrap">';
|
print '<td align="center" class="nowrap">';
|
||||||
if ($canbedisabled) print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
|
if ($canbedisabled) print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
|
||||||
print "</td>";
|
print "</td>";
|
||||||
|
|
||||||
// Modify link
|
// Modify link / Delete link
|
||||||
if ($canbemodified) print '<td align="center" width="64"><a class="reposition" href="'.$url.'action=edit">'.img_edit().'</a></td>';
|
print '<td align="center" width="64">';
|
||||||
else print '<td></td>';
|
if ($canbemodified) print '<a class="reposition" href="'.$url.'action=edit">'.img_edit().'</a>';
|
||||||
|
|
||||||
// Delete link
|
|
||||||
if ($iserasable)
|
if ($iserasable)
|
||||||
{
|
{
|
||||||
print '<td align="center" width="64">';
|
print ' <a href="'.$url.'action=delete">'.img_delete().'</a>';
|
||||||
print '<a href="'.$url.'action=delete">'.img_delete().'</a>';
|
|
||||||
//else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin
|
//else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin
|
||||||
print '</td>';
|
|
||||||
}
|
}
|
||||||
else print '<td></td>';
|
print '</td>';
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
$fieldsforcontent = array('content');
|
$fieldsforcontent = array('content');
|
||||||
@ -1042,7 +1044,9 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
|||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
elseif (in_array($fieldlist[$field], array('content','content_lines'))) continue;
|
elseif ($context == 'add' & in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) continue;
|
||||||
|
elseif ($context == 'edit' & in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) continue;
|
||||||
|
elseif ($context == 'hide' & in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) continue;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$size=''; $class=''; $classtd='';
|
$size=''; $class=''; $classtd='';
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -54,7 +54,7 @@ if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
|||||||
if (preg_match('/set_(.*)/',$action,$reg))
|
if (preg_match('/set_(.*)/',$action,$reg))
|
||||||
{
|
{
|
||||||
$code=$reg[1];
|
$code=$reg[1];
|
||||||
$value=(GETPOST($code) ? GETPOST($code) : 1);
|
$value=(GETPOST($code, 'alpha') ? GETPOST($code, 'alpha') : 1);
|
||||||
if (dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity) > 0)
|
if (dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity) > 0)
|
||||||
{
|
{
|
||||||
Header("Location: ".$_SERVER["PHP_SELF"]);
|
Header("Location: ".$_SERVER["PHP_SELF"]);
|
||||||
@ -82,10 +82,10 @@ else if (preg_match('/del_(.*)/',$action,$reg))
|
|||||||
|
|
||||||
else if ($action == 'updateform')
|
else if ($action == 'updateform')
|
||||||
{
|
{
|
||||||
$res3=dolibarr_set_const($db, 'MAIN_UPLOAD_DOC',$_POST["MAIN_UPLOAD_DOC"],'chaine',0,'',$conf->entity);
|
$res3=dolibarr_set_const($db, 'MAIN_UPLOAD_DOC',GETPOST('MAIN_UPLOAD_DOC','alpha'),'chaine',0,'',$conf->entity);
|
||||||
$res4=dolibarr_set_const($db, "MAIN_UMASK", $_POST["MAIN_UMASK"],'chaine',0,'',$conf->entity);
|
$res4=dolibarr_set_const($db, "MAIN_UMASK", GETPOST('MAIN_UMASK','alpha'),'chaine',0,'',$conf->entity);
|
||||||
$res5=dolibarr_set_const($db, "MAIN_ANTIVIRUS_COMMAND", $_POST["MAIN_ANTIVIRUS_COMMAND"],'chaine',0,'',$conf->entity);
|
$res5=dolibarr_set_const($db, "MAIN_ANTIVIRUS_COMMAND", trim(GETPOST('MAIN_ANTIVIRUS_COMMAND','none')),'chaine',0,'',$conf->entity); // Use GETPOST none because we must accept "
|
||||||
$res6=dolibarr_set_const($db, "MAIN_ANTIVIRUS_PARAM", $_POST["MAIN_ANTIVIRUS_PARAM"],'chaine',0,'',$conf->entity);
|
$res6=dolibarr_set_const($db, "MAIN_ANTIVIRUS_PARAM", trim(GETPOST('MAIN_ANTIVIRUS_PARAM','none')),'chaine',0,'',$conf->entity); // Use GETPOST none because we must accept "
|
||||||
if ($res3 && $res4 && $res5 && $res6) setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
|
if ($res3 && $res4 && $res5 && $res6) setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,7 +178,7 @@ if (ini_get('safe_mode') && ! empty($conf->global->MAIN_ANTIVIRUS_COMMAND))
|
|||||||
dol_syslog("safe_mode is on, basedir is ".$basedir.", safe_mode_exec_dir is ".ini_get('safe_mode_exec_dir'), LOG_WARNING);
|
dol_syslog("safe_mode is on, basedir is ".$basedir.", safe_mode_exec_dir is ".ini_get('safe_mode_exec_dir'), LOG_WARNING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print '<input type="text" name="MAIN_ANTIVIRUS_COMMAND" class="minwidth500imp" value="'.(! empty($conf->global->MAIN_ANTIVIRUS_COMMAND)?dol_htmlentities($conf->global->MAIN_ANTIVIRUS_COMMAND):'').'">';
|
print '<input type="text" name="MAIN_ANTIVIRUS_COMMAND" class="minwidth500imp" value="'.(! empty($conf->global->MAIN_ANTIVIRUS_COMMAND)?dol_escape_htmltag($conf->global->MAIN_ANTIVIRUS_COMMAND):'').'">';
|
||||||
print "</td>";
|
print "</td>";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
@ -189,7 +189,7 @@ print '<td colspan="2">'.$langs->trans("AntiVirusParam").'<br>';
|
|||||||
print $langs->trans("AntiVirusParamExample");
|
print $langs->trans("AntiVirusParamExample");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print '<input type="text" name="MAIN_ANTIVIRUS_PARAM" class="minwidth500imp" value="'.(! empty($conf->global->MAIN_ANTIVIRUS_PARAM)?dol_htmlentities($conf->global->MAIN_ANTIVIRUS_PARAM):'').'">';
|
print '<input type="text" name="MAIN_ANTIVIRUS_PARAM" class="minwidth500imp" value="'.(! empty($conf->global->MAIN_ANTIVIRUS_PARAM)?dol_escape_htmltag($conf->global->MAIN_ANTIVIRUS_PARAM):'').'">';
|
||||||
print "</td>";
|
print "</td>";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
|||||||
@ -56,9 +56,14 @@ class DolibarrApi
|
|||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
$production_mode = ( empty($conf->global->API_PRODUCTION_MODE) ? false : true );
|
$production_mode = ( empty($conf->global->API_PRODUCTION_MODE) ? false : true );
|
||||||
$this->r = new Restler($production_mode, $refreshCache);
|
$this->r = new Restler($production_mode, $refreshCache);
|
||||||
|
|
||||||
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
|
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
|
||||||
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
||||||
$this->r->setBaseUrls(DOL_MAIN_URL_ROOT, $urlwithroot);
|
|
||||||
|
$urlwithouturlrootautodetect=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim(DOL_MAIN_URL_ROOT));
|
||||||
|
$urlwithrootautodetect=$urlwithouturlroot.DOL_URL_ROOT; // This is to use local domain autodetected by dolibarr from url
|
||||||
|
|
||||||
|
$this->r->setBaseUrls($urlwithouturlroot, $urlwithouturlrootautodetect);
|
||||||
$this->r->setAPIVersion(1);
|
$this->r->setAPIVersion(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,6 +136,9 @@ class DolibarrApi
|
|||||||
unset($object->table_element_line);
|
unset($object->table_element_line);
|
||||||
unset($object->picto);
|
unset($object->picto);
|
||||||
|
|
||||||
|
unset($object->skip_update_total);
|
||||||
|
unset($object->context);
|
||||||
|
|
||||||
// Remove the $oldcopy property because it is not supported by the JSON
|
// Remove the $oldcopy property because it is not supported by the JSON
|
||||||
// encoder. The following error is generated when trying to serialize
|
// encoder. The following error is generated when trying to serialize
|
||||||
// it: "Error encoding/decoding JSON: Type is not supported"
|
// it: "Error encoding/decoding JSON: Type is not supported"
|
||||||
|
|||||||
@ -1,5 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2017 Neil Orley <neil.orley@oeris.fr>
|
/* Copyright (C) 2016 Xebax Christy <xebax@wanadoo.fr>
|
||||||
|
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
|
* Copyright (C) 2017 Neil Orley <neil.orley@oeris.fr>
|
||||||
|
*
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -21,7 +25,7 @@ require_once DOL_DOCUMENT_ROOT.'/main.inc.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/ccountry.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/ccountry.class.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API class for payment type (content of the paiement dictionary)
|
* API class for dictionaries
|
||||||
*
|
*
|
||||||
* @access protected
|
* @access protected
|
||||||
* @class DolibarrApiAccess {@requires user,external}
|
* @class DolibarrApiAccess {@requires user,external}
|
||||||
@ -47,13 +51,14 @@ class Dictionary extends DolibarrApi
|
|||||||
* @param int $limit Number of items per page
|
* @param int $limit Number of items per page
|
||||||
* @param int $page Page number {@min 0}
|
* @param int $page Page number {@min 0}
|
||||||
* @param int $active Payment type is active or not {@min 0} {@max 1}
|
* @param int $active Payment type is active or not {@min 0} {@max 1}
|
||||||
* @param string $sqlfilters SQL criteria to filter. Syntax example "(t.code:=:'CHQ')"
|
* @param string $sqlfilters SQL criteria to filter with. Syntax example "(t.code:=:'CHQ')"
|
||||||
*
|
*
|
||||||
* @url GET payments
|
* @url GET payment/types
|
||||||
*
|
*
|
||||||
* @return List of payment types
|
* @return array [List of payment types]
|
||||||
*
|
*
|
||||||
* @throws RestException
|
* @throws 400 RestException
|
||||||
|
* @throws 200 OK
|
||||||
*/
|
*/
|
||||||
function getPaymentTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
|
function getPaymentTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
|
||||||
{
|
{
|
||||||
@ -67,7 +72,7 @@ class Dictionary extends DolibarrApi
|
|||||||
{
|
{
|
||||||
if (! DolibarrApi::_checkFilters($sqlfilters))
|
if (! DolibarrApi::_checkFilters($sqlfilters))
|
||||||
{
|
{
|
||||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
throw new RestException(400, 'error when validating parameter sqlfilters '.$sqlfilters);
|
||||||
}
|
}
|
||||||
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||||
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||||
@ -94,7 +99,7 @@ class Dictionary extends DolibarrApi
|
|||||||
$list[] = $this->db->fetch_object($result);
|
$list[] = $this->db->fetch_object($result);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new RestException(503, 'Error when retrieving list of payment types : '.$this->db->lasterror());
|
throw new RestException(400, $this->db->lasterror());
|
||||||
}
|
}
|
||||||
|
|
||||||
return $list;
|
return $list;
|
||||||
@ -449,4 +454,66 @@ class Dictionary extends DolibarrApi
|
|||||||
return $list;
|
return $list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the list of payments terms.
|
||||||
|
*
|
||||||
|
* @param string $sortfield Sort field
|
||||||
|
* @param string $sortorder Sort order
|
||||||
|
* @param int $limit Number of items per page
|
||||||
|
* @param int $page Page number {@min 0}
|
||||||
|
* @param int $active Payment term is active or not {@min 0} {@max 1}
|
||||||
|
* @param string $sqlfilters SQL criteria to filter. Syntax example "(t.code:=:'CHQ')"
|
||||||
|
*
|
||||||
|
* @url GET payment/terms
|
||||||
|
*
|
||||||
|
* @return array List of payment terms
|
||||||
|
*
|
||||||
|
* @throws 400 RestException
|
||||||
|
* @throws 200 OK
|
||||||
|
*/
|
||||||
|
function getPaymentTerms($sortfield = "sortorder", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
|
||||||
|
{
|
||||||
|
$list = array();
|
||||||
|
|
||||||
|
$sql = "SELECT rowid as id, code, sortorder, libelle as label, libelle_facture as descr, type_cdr, nbjour, decalage, module";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_payment_term as t";
|
||||||
|
$sql.= " WHERE t.active = ".$active;
|
||||||
|
// Add sql filters
|
||||||
|
if ($sqlfilters)
|
||||||
|
{
|
||||||
|
if (! DolibarrApi::_checkFilters($sqlfilters))
|
||||||
|
{
|
||||||
|
throw new RestException(400, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||||
|
}
|
||||||
|
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||||
|
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$sql.= $this->db->order($sortfield, $sortorder);
|
||||||
|
|
||||||
|
if ($limit) {
|
||||||
|
if ($page < 0) {
|
||||||
|
$page = 0;
|
||||||
|
}
|
||||||
|
$offset = $limit * $page;
|
||||||
|
|
||||||
|
$sql .= $this->db->plimit($limit, $offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->db->query($sql);
|
||||||
|
|
||||||
|
if ($result) {
|
||||||
|
$num = $this->db->num_rows($result);
|
||||||
|
$min = min($num, ($limit <= 0 ? $num : $limit));
|
||||||
|
for ($i = 0; $i < $min; $i++) {
|
||||||
|
$list[] = $this->db->fetch_object($result);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new RestException(400, $this->db->lasterror());
|
||||||
|
}
|
||||||
|
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,6 +22,9 @@ use Luracast\Restler\Format\UploadFormat;
|
|||||||
|
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/main.inc.php';
|
require_once DOL_DOCUMENT_ROOT.'/main.inc.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API class for receive files
|
* API class for receive files
|
||||||
@ -50,17 +53,80 @@ class Documents extends DolibarrApi
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return list of documents.
|
* Returns a document. Note that, this API is similar to using the wrapper link "documents.php" to download
|
||||||
|
* a file (used for internal HTML links of documents into application), but with no need to be into a logged session (no need to post the session cookie).
|
||||||
*
|
*
|
||||||
* @param string $module_part Name of module or area concerned by file download ('facture', ...)
|
* @param string $module_part Name of module or area concerned by file download ('facture', ...)
|
||||||
* @param string $ref Reference of object (This will define subdir automatically)
|
* @param string $original_file Relative path with filename, relative to modulepart (for example: IN201701-999/IN201701-999.pdf)
|
||||||
* @param string $subdir Subdirectory (Only if ref not provided)
|
* @param int $regeneratedoc If requested document is the main document of an object, setting this to 1 ask API to regenerate document before returning it (supported for some module_part only). It is no effect in other cases.
|
||||||
|
* Also, note that setting this to 1 nead write access on object.
|
||||||
* @return array List of documents
|
* @return array List of documents
|
||||||
*
|
*
|
||||||
* @throws RestException
|
* @throws 500
|
||||||
|
* @throws 501
|
||||||
|
* @throws 400
|
||||||
|
* @throws 401
|
||||||
|
* @throws 200
|
||||||
*/
|
*/
|
||||||
public function index($module_part, $ref='', $subdir='') {
|
public function index($module_part, $original_file='', $regeneratedoc=0)
|
||||||
return array('note'=>'FeatureNotYetAvailable');
|
{
|
||||||
|
global $conf, $langs;
|
||||||
|
|
||||||
|
if (empty($module_part)) {
|
||||||
|
throw new RestException(400, 'bad value for parameter modulepart');
|
||||||
|
}
|
||||||
|
if (empty($original_file)) {
|
||||||
|
throw new RestException(400, 'bad value for parameter ref or subdir');
|
||||||
|
}
|
||||||
|
|
||||||
|
//--- Finds and returns the document
|
||||||
|
$entity=$conf->entity;
|
||||||
|
|
||||||
|
$check_access = dol_check_secure_access_document($module_part, $original_file, $entity, DolibarrApiAccess::$user, '', ($regeneratedoc ? 'write' : 'read'));
|
||||||
|
$accessallowed = $check_access['accessallowed'];
|
||||||
|
$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals'];
|
||||||
|
$original_file = $check_access['original_file'];
|
||||||
|
|
||||||
|
if (preg_match('/\.\./',$original_file) || preg_match('/[<>|]/',$original_file))
|
||||||
|
{
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
if (!$accessallowed) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Generates the document
|
||||||
|
if ($regeneratedoc)
|
||||||
|
{
|
||||||
|
$hidedetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 0 : 1;
|
||||||
|
$hidedesc = empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 0 : 1;
|
||||||
|
$hideref = empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 0 : 1;
|
||||||
|
|
||||||
|
if ($module_part == 'facture' || $module_part == 'invoice')
|
||||||
|
{
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||||
|
$this->invoice = new Facture($this->db);
|
||||||
|
$result = $this->invoice->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file)));
|
||||||
|
if( ! $result ) {
|
||||||
|
throw new RestException(404, 'Invoice not found');
|
||||||
|
}
|
||||||
|
$result = $this->invoice->generateDocument($this->invoice->modelpdf, $langs, $hidedetails, $hidedesc, $hideref);
|
||||||
|
if( $result <= 0 ) {
|
||||||
|
throw new RestException(500, 'Error generating document');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$filename = basename($original_file);
|
||||||
|
$original_file_osencoded=dol_osencode($original_file); // New file name encoded in OS encoding charset
|
||||||
|
|
||||||
|
if (! file_exists($original_file_osencoded))
|
||||||
|
{
|
||||||
|
throw new RestException(404, 'File not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
$file_content=file_get_contents($original_file_osencoded);
|
||||||
|
return array('filename'=>$filename, 'content'=>base64_encode($file_content), 'encoding'=>'MIME base64 (base64_encode php function, http://php.net/manual/en/function.base64-encode.php)' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -84,7 +150,7 @@ class Documents extends DolibarrApi
|
|||||||
* Test sample 2: { "filename": "mynewfile.txt", "modulepart": "medias", "ref": "", "subdir": "mysubdir1/mysubdir2", "filecontent": "content text", "fileencoding": "", "overwriteifexists": "0" }.
|
* Test sample 2: { "filename": "mynewfile.txt", "modulepart": "medias", "ref": "", "subdir": "mysubdir1/mysubdir2", "filecontent": "content text", "fileencoding": "", "overwriteifexists": "0" }.
|
||||||
*
|
*
|
||||||
* @param string $filename Name of file to create ('FA1705-0123')
|
* @param string $filename Name of file to create ('FA1705-0123')
|
||||||
* @param string $modulepart Name of module or area concerned by file upload ('facture', ...)
|
* @param string $modulepart Name of module or area concerned by file upload ('facture', 'project', 'project_task', ...)
|
||||||
* @param string $ref Reference of object (This will define subdir automatically and store submited file into it)
|
* @param string $ref Reference of object (This will define subdir automatically and store submited file into it)
|
||||||
* @param string $subdir Subdirectory (Only if ref not provided)
|
* @param string $subdir Subdirectory (Only if ref not provided)
|
||||||
* @param string $filecontent File content (string with file content. An empty file will be created if this parameter is not provided)
|
* @param string $filecontent File content (string with file content. An empty file will be created if this parameter is not provided)
|
||||||
@ -102,7 +168,10 @@ class Documents extends DolibarrApi
|
|||||||
var_dump($filecontent);
|
var_dump($filecontent);
|
||||||
exit;*/
|
exit;*/
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
if(empty($modulepart))
|
||||||
|
{
|
||||||
|
throw new RestException(400, 'Modulepart not provided.');
|
||||||
|
}
|
||||||
|
|
||||||
if (!DolibarrApiAccess::$user->rights->ecm->upload) {
|
if (!DolibarrApiAccess::$user->rights->ecm->upload) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
@ -122,8 +191,52 @@ class Documents extends DolibarrApi
|
|||||||
if ($modulepart == 'facture' || $modulepart == 'invoice')
|
if ($modulepart == 'facture' || $modulepart == 'invoice')
|
||||||
{
|
{
|
||||||
$modulepart='facture';
|
$modulepart='facture';
|
||||||
$object=new Facture($db);
|
$object = new Facture($this->db);
|
||||||
|
}
|
||||||
|
elseif ($modulepart == 'project')
|
||||||
|
{
|
||||||
|
$object = new Project($this->db);
|
||||||
|
}
|
||||||
|
elseif ($modulepart == 'task' || $modulepart == 'project_task')
|
||||||
|
{
|
||||||
|
$modulepart = 'project_task';
|
||||||
|
$object = new Task($this->db);
|
||||||
|
|
||||||
|
$task_result = $object->fetch('', $ref);
|
||||||
|
|
||||||
|
// Fetching the tasks project is required because its out_dir might be a subdirectory of the project
|
||||||
|
if($task_result > 0)
|
||||||
|
{
|
||||||
|
$project_result = $object->fetch_projet();
|
||||||
|
|
||||||
|
if($project_result >= 0)
|
||||||
|
{
|
||||||
|
$tmpreldir = dol_sanitizeFileName($object->project->ref).'/';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new RestException(500, 'Error while fetching Task '.$ref);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// TODO Implement additional moduleparts
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new RestException(500, 'Modulepart '.$modulepart.' not implemented yet.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if(is_object($object))
|
||||||
|
{
|
||||||
$result = $object->fetch('', $ref);
|
$result = $object->fetch('', $ref);
|
||||||
|
|
||||||
|
if($result == 0)
|
||||||
|
{
|
||||||
|
throw new RestException(500, "Object with ref '".$ref.'" was not found.');
|
||||||
|
}
|
||||||
|
elseif ($result < 0)
|
||||||
|
{
|
||||||
|
throw new RestException(500, 'Error while fetching object.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! ($object->id > 0))
|
if (! ($object->id > 0))
|
||||||
@ -131,7 +244,7 @@ class Documents extends DolibarrApi
|
|||||||
throw new RestException(500, 'The object '.$modulepart." with ref '".$ref."' was not found.");
|
throw new RestException(500, 'The object '.$modulepart." with ref '".$ref."' was not found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$tmp = dol_check_secure_access_document($modulepart, $tmpreldir.$object->ref, $entity, DolibarrApiAccess::$user, $ref, 'write');
|
$tmp = dol_check_secure_access_document($modulepart, $tmpreldir.dol_sanitizeFileName($object->ref), $entity, DolibarrApiAccess::$user, $ref, 'write');
|
||||||
$upload_dir = $tmp['original_file'];
|
$upload_dir = $tmp['original_file'];
|
||||||
|
|
||||||
if (empty($upload_dir) || $upload_dir == '/')
|
if (empty($upload_dir) || $upload_dir == '/')
|
||||||
|
|||||||
@ -136,7 +136,7 @@ switch ($action)
|
|||||||
$cond_reglement_id = 0;
|
$cond_reglement_id = 0;
|
||||||
break;
|
break;
|
||||||
case 'ESP':
|
case 'ESP':
|
||||||
$mode_reglement_id = dol_getIdFromCode($db,'LIQ','c_paiement');
|
$mode_reglement_id = dol_getIdFromCode($db,'LIQ','c_paiement','code','id',1);
|
||||||
$cond_reglement_id = 0;
|
$cond_reglement_id = 0;
|
||||||
$note .= $langs->trans("Cash")."\n";
|
$note .= $langs->trans("Cash")."\n";
|
||||||
$note .= $langs->trans("Received").' : '.$obj_facturation->montantEncaisse()." ".$conf->currency."\n";
|
$note .= $langs->trans("Received").' : '.$obj_facturation->montantEncaisse()." ".$conf->currency."\n";
|
||||||
@ -145,11 +145,11 @@ switch ($action)
|
|||||||
$note .= '--------------------------------------'."\n\n";
|
$note .= '--------------------------------------'."\n\n";
|
||||||
break;
|
break;
|
||||||
case 'CB':
|
case 'CB':
|
||||||
$mode_reglement_id = dol_getIdFromCode($db,'CB','c_paiement');
|
$mode_reglement_id = dol_getIdFromCode($db,'CB','c_paiement','code','id',1);
|
||||||
$cond_reglement_id = 0;
|
$cond_reglement_id = 0;
|
||||||
break;
|
break;
|
||||||
case 'CHQ':
|
case 'CHQ':
|
||||||
$mode_reglement_id = dol_getIdFromCode($db,'CHQ','c_paiement');
|
$mode_reglement_id = dol_getIdFromCode($db,'CHQ','c_paiement','code','id',1);
|
||||||
$cond_reglement_id = 0;
|
$cond_reglement_id = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -166,94 +166,6 @@ class Categories extends DolibarrApi
|
|||||||
return $obj_ret;
|
return $obj_ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* List categories of an entity
|
|
||||||
*
|
|
||||||
* Note: This method is not directly exposed in the API, it is used
|
|
||||||
* in the GET /xxx/{id}/categories requests.
|
|
||||||
*
|
|
||||||
* @param string $sortfield Sort field
|
|
||||||
* @param string $sortorder Sort order
|
|
||||||
* @param int $limit Limit for list
|
|
||||||
* @param int $page Page number
|
|
||||||
* @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact')
|
|
||||||
* @param int $item Id of the item to get categories for
|
|
||||||
* @return array Array of category objects
|
|
||||||
*
|
|
||||||
* @access private
|
|
||||||
*/
|
|
||||||
function getListForItem($sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $type='customer', $item = 0) {
|
|
||||||
global $db, $conf;
|
|
||||||
|
|
||||||
$obj_ret = array();
|
|
||||||
|
|
||||||
if(! DolibarrApiAccess::$user->rights->categorie->lire) {
|
|
||||||
throw new RestException(401);
|
|
||||||
}
|
|
||||||
//if ($type == "") {
|
|
||||||
//$type="product";
|
|
||||||
//}
|
|
||||||
$sub_type = $type;
|
|
||||||
$subcol_name = "fk_".$type;
|
|
||||||
if ($type=="customer" || $type=="supplier") {
|
|
||||||
$sub_type="societe";
|
|
||||||
$subcol_name="fk_soc";
|
|
||||||
}
|
|
||||||
if ($type=="contact") {
|
|
||||||
$subcol_name="fk_socpeople";
|
|
||||||
}
|
|
||||||
$sql = "SELECT s.rowid";
|
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."categorie as s";
|
|
||||||
$sql.= " , ".MAIN_DB_PREFIX."categorie_".$sub_type." as sub ";
|
|
||||||
$sql.= ' WHERE s.entity IN ('.getEntity('category').')';
|
|
||||||
$sql.= ' AND s.type='.array_search($type,Categories::$TYPES);
|
|
||||||
$sql.= ' AND s.rowid = sub.fk_categorie';
|
|
||||||
$sql.= ' AND sub.'.$subcol_name.' = '.$item;
|
|
||||||
|
|
||||||
$nbtotalofrecords = '';
|
|
||||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
|
||||||
{
|
|
||||||
$result = $db->query($sql);
|
|
||||||
$nbtotalofrecords = $db->num_rows($result);
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql.= $db->order($sortfield, $sortorder);
|
|
||||||
if ($limit) {
|
|
||||||
if ($page < 0)
|
|
||||||
{
|
|
||||||
$page = 0;
|
|
||||||
}
|
|
||||||
$offset = $limit * $page;
|
|
||||||
|
|
||||||
$sql.= $db->plimit($limit + 1, $offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = $db->query($sql);
|
|
||||||
if ($result)
|
|
||||||
{
|
|
||||||
$i=0;
|
|
||||||
$num = $db->num_rows($result);
|
|
||||||
$min = min($num, ($limit <= 0 ? $num : $limit));
|
|
||||||
while ($i < $min)
|
|
||||||
{
|
|
||||||
$obj = $db->fetch_object($result);
|
|
||||||
$category_static = new Categorie($db);
|
|
||||||
if($category_static->fetch($obj->rowid)) {
|
|
||||||
$obj_ret[] = $this->_cleanObjectDatas($category_static);
|
|
||||||
}
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw new RestException(503, 'Error when retrieve category list : '.$db->lasterror());
|
|
||||||
}
|
|
||||||
if( ! count($obj_ret)) {
|
|
||||||
throw new RestException(404, 'No category found');
|
|
||||||
}
|
|
||||||
|
|
||||||
return $obj_ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create category object
|
* Create category object
|
||||||
*
|
*
|
||||||
|
|||||||
@ -879,6 +879,100 @@ class Categorie extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List categories of an element id
|
||||||
|
*
|
||||||
|
* @param int $id Id of element
|
||||||
|
* @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact')
|
||||||
|
* @param string $sortfield Sort field
|
||||||
|
* @param string $sortorder Sort order
|
||||||
|
* @param int $limit Limit for list
|
||||||
|
* @param int $page Page number
|
||||||
|
* @return array Array of categories
|
||||||
|
*/
|
||||||
|
function getListForItem($id, $type='customer', $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0)
|
||||||
|
{
|
||||||
|
global $conf;
|
||||||
|
|
||||||
|
$categories = array();
|
||||||
|
|
||||||
|
$sub_type = $type;
|
||||||
|
$subcol_name = "fk_".$type;
|
||||||
|
if ($type=="customer" || $type=="supplier") {
|
||||||
|
$sub_type="societe";
|
||||||
|
$subcol_name="fk_soc";
|
||||||
|
}
|
||||||
|
if ($type=="contact") {
|
||||||
|
$subcol_name="fk_socpeople";
|
||||||
|
}
|
||||||
|
$sql = "SELECT s.rowid";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."categorie as s";
|
||||||
|
$sql.= " , ".MAIN_DB_PREFIX."categorie_".$sub_type." as sub ";
|
||||||
|
$sql.= ' WHERE s.entity IN ('.getEntity('category').')';
|
||||||
|
$sql.= ' AND s.type='.array_search($type, self::$MAP_ID_TO_CODE);
|
||||||
|
$sql.= ' AND s.rowid = sub.fk_categorie';
|
||||||
|
$sql.= ' AND sub.'.$subcol_name.' = '.$id;
|
||||||
|
|
||||||
|
$nbtotalofrecords = '';
|
||||||
|
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||||
|
{
|
||||||
|
$result = $this->db->query($sql);
|
||||||
|
$nbtotalofrecords = $this->db->num_rows($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql.= $this->db->order($sortfield, $sortorder);
|
||||||
|
if ($limit) {
|
||||||
|
if ($page < 0)
|
||||||
|
{
|
||||||
|
$page = 0;
|
||||||
|
}
|
||||||
|
$offset = $limit * $page;
|
||||||
|
|
||||||
|
$sql.= $this->db->plimit($limit + 1, $offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->db->query($sql);
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
$i=0;
|
||||||
|
$num = $this->db->num_rows($result);
|
||||||
|
$min = min($num, ($limit <= 0 ? $num : $limit));
|
||||||
|
while ($i < $min)
|
||||||
|
{
|
||||||
|
$obj = $this->db->fetch_object($result);
|
||||||
|
$category_static = new Categorie($this->db);
|
||||||
|
if ($category_static->fetch($obj->rowid))
|
||||||
|
{
|
||||||
|
$categories[$i]['id'] = $category_static->id;
|
||||||
|
$categories[$i]['fk_parent'] = $category_static->fk_parent;
|
||||||
|
$categories[$i]['label'] = $category_static->label;
|
||||||
|
$categories[$i]['description'] = $category_static->description;
|
||||||
|
$categories[$i]['color'] = $category_static->color;
|
||||||
|
$categories[$i]['socid'] = $category_static->socid;
|
||||||
|
$categories[$i]['visible'] = $category_static->visible;
|
||||||
|
$categories[$i]['type'] = $category_static->type;
|
||||||
|
$categories[$i]['entity'] = $category_static->entity;
|
||||||
|
$categories[$i]['array_options'] = $category_static->array_options;
|
||||||
|
|
||||||
|
// multilangs
|
||||||
|
if (! empty($conf->global->MAIN_MULTILANGS)) {
|
||||||
|
$categories[$i]['multilangs'] = $category_static->multilangs;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->error = $this->db->lasterror();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if ( ! count($categories)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $categories;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return childs of a category
|
* Return childs of a category
|
||||||
*
|
*
|
||||||
|
|||||||
@ -319,7 +319,7 @@ else
|
|||||||
|
|
||||||
|
|
||||||
// List of products or services (type is type of category)
|
// List of products or services (type is type of category)
|
||||||
if ($object->type == Categorie::TYPE_PRODUCT)
|
if ($type == Categorie::TYPE_PRODUCT)
|
||||||
{
|
{
|
||||||
$prods = $object->getObjectsInCateg("product");
|
$prods = $object->getObjectsInCateg("product");
|
||||||
if ($prods < 0)
|
if ($prods < 0)
|
||||||
@ -391,7 +391,7 @@ if ($object->type == Categorie::TYPE_PRODUCT)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($object->type == Categorie::TYPE_SUPPLIER)
|
if ($type == Categorie::TYPE_SUPPLIER)
|
||||||
{
|
{
|
||||||
$socs = $object->getObjectsInCateg("supplier");
|
$socs = $object->getObjectsInCateg("supplier");
|
||||||
if ($socs < 0)
|
if ($socs < 0)
|
||||||
@ -440,7 +440,7 @@ if ($object->type == Categorie::TYPE_SUPPLIER)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($object->type == Categorie::TYPE_CUSTOMER)
|
if($type == Categorie::TYPE_CUSTOMER)
|
||||||
{
|
{
|
||||||
$socs = $object->getObjectsInCateg("customer");
|
$socs = $object->getObjectsInCateg("customer");
|
||||||
if ($socs < 0)
|
if ($socs < 0)
|
||||||
@ -494,7 +494,7 @@ if($object->type == Categorie::TYPE_CUSTOMER)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// List of members
|
// List of members
|
||||||
if ($object->type == Categorie::TYPE_MEMBER)
|
if ($type == Categorie::TYPE_MEMBER)
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||||
|
|
||||||
@ -547,7 +547,7 @@ if ($object->type == Categorie::TYPE_MEMBER)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Categorie contact
|
// Categorie contact
|
||||||
if($object->type == Categorie::TYPE_CONTACT)
|
if ($type == Categorie::TYPE_CONTACT)
|
||||||
{
|
{
|
||||||
$contacts = $object->getObjectsInCateg("contact");
|
$contacts = $object->getObjectsInCateg("contact");
|
||||||
if ($contacts < 0)
|
if ($contacts < 0)
|
||||||
@ -600,7 +600,7 @@ if($object->type == Categorie::TYPE_CONTACT)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// List of accounts
|
// List of accounts
|
||||||
if ($object->type == Categorie::TYPE_ACCOUNT)
|
if ($type == Categorie::TYPE_ACCOUNT)
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||||
|
|
||||||
@ -653,7 +653,7 @@ if ($object->type == Categorie::TYPE_ACCOUNT)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// List of Project
|
// List of Project
|
||||||
if ($object->type == Categorie::TYPE_PROJECT)
|
if ($type == Categorie::TYPE_PROJECT)
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||||
|
|
||||||
|
|||||||
@ -1202,14 +1202,13 @@ if ($id > 0)
|
|||||||
|
|
||||||
// Link to other agenda views
|
// Link to other agenda views
|
||||||
$out='';
|
$out='';
|
||||||
$out.=img_picto($langs->trans("ViewPerUser"),'object_calendarperuser','class="hideonsmartphone pictoactionview"');
|
$out.='</li><li class="noborder litext">'.img_picto($langs->trans("ViewPerUser"),'object_calendarperuser','class="hideonsmartphone pictoactionview"');
|
||||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/peruser.php?action=show_peruser&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewPerUser").'</a>';
|
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/peruser.php?action=show_peruser&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewPerUser").'</a>';
|
||||||
$out.='<br>';
|
$out.='</li><li class="noborder litext">'.img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone pictoactionview"');
|
||||||
$out.=img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone pictoactionview"');
|
|
||||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_month&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewCal").'</a>';
|
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_month&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewCal").'</a>';
|
||||||
$out.=img_picto($langs->trans("ViewWeek"),'object_calendarweek','class="hideonsmartphone pictoactionview"');
|
$out.='</li><li class="noborder litext">'.img_picto($langs->trans("ViewWeek"),'object_calendarweek','class="hideonsmartphone pictoactionview"');
|
||||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_week&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewWeek").'</a>';
|
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_week&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewWeek").'</a>';
|
||||||
$out.=img_picto($langs->trans("ViewDay"),'object_calendarday','class="hideonsmartphone pictoactionview"');
|
$out.='</li><li class="noborder litext">'.img_picto($langs->trans("ViewDay"),'object_calendarday','class="hideonsmartphone pictoactionview"');
|
||||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewDay").'</a>';
|
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewDay").'</a>';
|
||||||
$linkback.=$out;
|
$linkback.=$out;
|
||||||
|
|
||||||
|
|||||||
@ -912,18 +912,24 @@ class ActionComm extends CommonObject
|
|||||||
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
|
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
|
||||||
*
|
*
|
||||||
* @param User $user Objet user
|
* @param User $user Objet user
|
||||||
|
* @param int $load_state_board Charge indicateurs this->nb de tableau de bord
|
||||||
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
|
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
|
||||||
*/
|
*/
|
||||||
function load_board($user)
|
function load_board($user, $load_state_board=0)
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
$sql = "SELECT a.id, a.datep as dp";
|
if(empty($load_state_board)) $sql = "SELECT a.id, a.datep as dp";
|
||||||
|
else {
|
||||||
|
$this->nb=array();
|
||||||
|
$sql = "SELECT count(a.id) as nb";
|
||||||
|
}
|
||||||
$sql.= " FROM (".MAIN_DB_PREFIX."actioncomm as a";
|
$sql.= " FROM (".MAIN_DB_PREFIX."actioncomm as a";
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
|
if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
|
||||||
$sql.= " WHERE a.percent >= 0 AND a.percent < 100";
|
$sql.= " WHERE 1";
|
||||||
|
if(empty($load_state_board)) $sql.= " AND a.percent >= 0 AND a.percent < 100";
|
||||||
$sql.= " AND a.entity IN (".getEntity('agenda').")";
|
$sql.= " AND a.entity IN (".getEntity('agenda').")";
|
||||||
if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
|
if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
|
||||||
if ($user->societe_id) $sql.=" AND a.fk_soc = ".$user->societe_id;
|
if ($user->societe_id) $sql.=" AND a.fk_soc = ".$user->societe_id;
|
||||||
@ -932,31 +938,32 @@ class ActionComm extends CommonObject
|
|||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
|
if(empty($load_state_board)) {
|
||||||
$agenda_static = new ActionComm($this->db);
|
$agenda_static = new ActionComm($this->db);
|
||||||
|
|
||||||
$response = new WorkboardResponse();
|
$response = new WorkboardResponse();
|
||||||
$response->warning_delay = $conf->agenda->warning_delay/60/60/24;
|
$response->warning_delay = $conf->agenda->warning_delay/60/60/24;
|
||||||
$response->label = $langs->trans("ActionsToDo");
|
$response->label = $langs->trans("ActionsToDo");
|
||||||
$response->url = DOL_URL_ROOT.'/comm/action/listactions.php?status=todo&mainmenu=agenda';
|
$response->url = DOL_URL_ROOT.'/comm/action/listactions.php?status=todo&mainmenu=agenda';
|
||||||
if ($user->rights->agenda->allactions->read) $response->url.='&filtert=-1';
|
if ($user->rights->agenda->allactions->read) $response->url.='&filtert=-1';
|
||||||
$response->img = img_object('',"action",'class="inline-block valigntextmiddle"');
|
$response->img = img_object('',"action",'class="inline-block valigntextmiddle"');
|
||||||
|
}
|
||||||
// This assignment in condition is not a bug. It allows walking the results.
|
// This assignment in condition is not a bug. It allows walking the results.
|
||||||
while ($obj=$this->db->fetch_object($resql))
|
while ($obj=$this->db->fetch_object($resql))
|
||||||
{
|
{
|
||||||
|
if(empty($load_state_board)) {
|
||||||
$response->nbtodo++;
|
$response->nbtodo++;
|
||||||
|
|
||||||
$agenda_static->datep = $this->db->jdate($obj->dp);
|
$agenda_static->datep = $this->db->jdate($obj->dp);
|
||||||
|
if ($agenda_static->hasDelay()) $response->nbtodolate++;
|
||||||
if ($agenda_static->hasDelay()) {
|
} else $this->nb["actionscomm"]=$obj->nb;
|
||||||
$response->nbtodolate++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $response;
|
$this->db->free($resql);
|
||||||
|
if(empty($load_state_board)) return $response;
|
||||||
|
else return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
dol_print_error($this->db);
|
||||||
$this->error=$this->db->error();
|
$this->error=$this->db->error();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -128,14 +128,13 @@ if ($object->id > 0)
|
|||||||
|
|
||||||
// Link to other agenda views
|
// Link to other agenda views
|
||||||
$out='';
|
$out='';
|
||||||
$out.=img_picto($langs->trans("ViewPerUser"),'object_calendarperuser','class="hideonsmartphone pictoactionview"');
|
$out.='</li><li class="noborder litext">'.img_picto($langs->trans("ViewPerUser"),'object_calendarperuser','class="hideonsmartphone pictoactionview"');
|
||||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/peruser.php?action=show_peruser&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewPerUser").'</a>';
|
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/peruser.php?action=show_peruser&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewPerUser").'</a>';
|
||||||
$out.='<br>';
|
$out.='</li><li class="noborder litext">'.img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone pictoactionview"');
|
||||||
$out.=img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone pictoactionview"');
|
|
||||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_month&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewCal").'</a>';
|
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_month&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewCal").'</a>';
|
||||||
$out.=img_picto($langs->trans("ViewWeek"),'object_calendarweek','class="hideonsmartphone pictoactionview"');
|
$out.='</li><li class="noborder litext">'.img_picto($langs->trans("ViewWeek"),'object_calendarweek','class="hideonsmartphone pictoactionview"');
|
||||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewWeek").'</a>';
|
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewWeek").'</a>';
|
||||||
$out.=img_picto($langs->trans("ViewDay"),'object_calendarday','class="hideonsmartphone pictoactionview"');
|
$out.='</li><li class="noborder litext">'.img_picto($langs->trans("ViewDay"),'object_calendarday','class="hideonsmartphone pictoactionview"');
|
||||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewDay").'</a>';
|
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewDay").'</a>';
|
||||||
|
|
||||||
$linkback.=$out;
|
$linkback.=$out;
|
||||||
|
|||||||
@ -51,6 +51,8 @@ $result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions|
|
|||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$form=new Form($db);
|
||||||
|
|
||||||
$help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda';
|
$help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda';
|
||||||
llxHeader('',$langs->trans("Agenda"),$help_url);
|
llxHeader('',$langs->trans("Agenda"),$help_url);
|
||||||
|
|
||||||
@ -66,14 +68,13 @@ $linkback.= '<a href="'.DOL_URL_ROOT.'/comm/action/index.php">'.$langs->trans("B
|
|||||||
|
|
||||||
// Link to other agenda views
|
// Link to other agenda views
|
||||||
$out='';
|
$out='';
|
||||||
$out.=img_picto($langs->trans("ViewPerUser"),'object_calendarperuser','class="hideonsmartphone pictoactionview"');
|
$out.='</li><li class="noborder litext">'.img_picto($langs->trans("ViewPerUser"),'object_calendarperuser','class="hideonsmartphone pictoactionview"');
|
||||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/peruser.php?action=show_peruser&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewPerUser").'</a>';
|
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/peruser.php?action=show_peruser&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewPerUser").'</a>';
|
||||||
$out.='<br>';
|
$out.='</li><li class="noborder litext">'.img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone pictoactionview"');
|
||||||
$out.=img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone pictoactionview"');
|
|
||||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_month&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewCal").'</a>';
|
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_month&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewCal").'</a>';
|
||||||
$out.=img_picto($langs->trans("ViewWeek"),'object_calendarweek','class="hideonsmartphone pictoactionview"');
|
$out.='</li><li class="noborder litext">'.img_picto($langs->trans("ViewWeek"),'object_calendarweek','class="hideonsmartphone pictoactionview"');
|
||||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewWeek").'</a>';
|
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewWeek").'</a>';
|
||||||
$out.=img_picto($langs->trans("ViewDay"),'object_calendarday','class="hideonsmartphone pictoactionview"');
|
$out.='</li><li class="noborder litext">'.img_picto($langs->trans("ViewDay"),'object_calendarday','class="hideonsmartphone pictoactionview"');
|
||||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewDay").'</a>';
|
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewDay").'</a>';
|
||||||
|
|
||||||
$linkback.=$out;
|
$linkback.=$out;
|
||||||
|
|||||||
@ -357,7 +357,7 @@ if ($resql)
|
|||||||
//$param='month='.$monthshown.'&year='.$year;
|
//$param='month='.$monthshown.'&year='.$year;
|
||||||
$hourminsec='100000';
|
$hourminsec='100000';
|
||||||
$link = '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.sprintf("%04d%02d%02d",$tmpforcreatebutton['year'],$tmpforcreatebutton['mon'],$tmpforcreatebutton['mday']).$hourminsec.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam?'?'.$newparam:'')).'">';
|
$link = '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.sprintf("%04d%02d%02d",$tmpforcreatebutton['year'],$tmpforcreatebutton['mon'],$tmpforcreatebutton['mday']).$hourminsec.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam?'?'.$newparam:'')).'">';
|
||||||
$link.= $langs->trans("NewAction");
|
$link.= $langs->trans("AddAction");
|
||||||
$link.= '</a>';
|
$link.= '</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -372,8 +372,8 @@ if ($resql)
|
|||||||
print '<tr class="liste_titre_filter">';
|
print '<tr class="liste_titre_filter">';
|
||||||
print '<td class="liste_titre"></td>';
|
print '<td class="liste_titre"></td>';
|
||||||
print '<td class="liste_titre"></td>';
|
print '<td class="liste_titre"></td>';
|
||||||
print '<td class="liste_titre"><input type="text" name="search_title" value="'.$search_title.'"></td>';
|
|
||||||
print '<td class="liste_titre"></td>';
|
print '<td class="liste_titre"></td>';
|
||||||
|
print '<td class="liste_titre"><input type="text" name="search_title" value="'.$search_title.'"></td>';
|
||||||
print '<td class="liste_titre" align="center">';
|
print '<td class="liste_titre" align="center">';
|
||||||
print $form->select_date($datestart, 'datestart', 0, 0, 1, '', 1, 0, 1);
|
print $form->select_date($datestart, 'datestart', 0, 0, 1, '', 1, 0, 1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
@ -396,9 +396,9 @@ if ($resql)
|
|||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"a.id",$param,"","",$sortfield,$sortorder);
|
print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"a.id",$param,"","",$sortfield,$sortorder);
|
||||||
print_liste_field_titre("ActionsOwnedByShort",$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder);
|
print_liste_field_titre("ActionsOwnedByShort",$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder);
|
||||||
print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"a.label",$param,"","",$sortfield,$sortorder);
|
|
||||||
//if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
//if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
||||||
print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"c.libelle",$param,"","",$sortfield,$sortorder);
|
print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"c.libelle",$param,"","",$sortfield,$sortorder);
|
||||||
|
print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"a.label",$param,"","",$sortfield,$sortorder);
|
||||||
print_liste_field_titre("DateStart",$_SERVER["PHP_SELF"],"a.datep",$param,'','align="center"',$sortfield,$sortorder);
|
print_liste_field_titre("DateStart",$_SERVER["PHP_SELF"],"a.datep",$param,'','align="center"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre("DateEnd",$_SERVER["PHP_SELF"],"a.datep2",$param,'','align="center"',$sortfield,$sortorder);
|
print_liste_field_titre("DateEnd",$_SERVER["PHP_SELF"],"a.datep2",$param,'','align="center"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre("ThirdParty",$_SERVER["PHP_SELF"],"s.nom",$param,"","",$sortfield,$sortorder);
|
print_liste_field_titre("ThirdParty",$_SERVER["PHP_SELF"],"s.nom",$param,"","",$sortfield,$sortorder);
|
||||||
@ -452,11 +452,6 @@ if ($resql)
|
|||||||
else print ' ';
|
else print ' ';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Label
|
|
||||||
print '<td class="tdoverflowmax300">';
|
|
||||||
print $actionstatic->label;
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
// Type
|
// Type
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
||||||
@ -475,6 +470,11 @@ if ($resql)
|
|||||||
print dol_trunc($labeltype,28);
|
print dol_trunc($labeltype,28);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
|
// Label
|
||||||
|
print '<td class="tdoverflowmax300">';
|
||||||
|
print $actionstatic->label;
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
// Start date
|
// Start date
|
||||||
print '<td align="center" class="nowrap">';
|
print '<td align="center" class="nowrap">';
|
||||||
print dol_print_date($db->jdate($obj->dp),"dayhour");
|
print dol_print_date($db->jdate($obj->dp),"dayhour");
|
||||||
|
|||||||
@ -116,7 +116,7 @@ if ($resql)
|
|||||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||||
|
|
||||||
print_barre_liste($langs->trans("Actions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_agenda', 0, '', '', $limit);
|
print_barre_liste($langs->trans("EventReports"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_agenda', 0, '', '', $limit);
|
||||||
|
|
||||||
$moreforfilter='';
|
$moreforfilter='';
|
||||||
|
|
||||||
|
|||||||
@ -1530,13 +1530,7 @@ if ($action == 'create')
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
$parameters = array();
|
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_add.tpl.php';
|
||||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
|
||||||
print $hookmanager->resPrint;
|
|
||||||
if (empty($reshook) && ! empty($extrafields->attribute_label)) {
|
|
||||||
print $object->showOptionals($extrafields, 'edit');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Lines from source
|
// Lines from source
|
||||||
if (! empty($origin) && ! empty($originid) && is_object($objectsrc))
|
if (! empty($origin) && ! empty($originid) && is_object($objectsrc))
|
||||||
@ -1696,7 +1690,15 @@ if ($action == 'create')
|
|||||||
//array('type' => 'other','name' => 'note_private', 'label' => $langs->trans("Note"),'value' => '<textarea cols="30" rows="' . ROWS_3 . '" wrap="soft" name="note_private" id="note_private">'.$object->note_private.'</textarea>'));
|
//array('type' => 'other','name' => 'note_private', 'label' => $langs->trans("Note"),'value' => '<textarea cols="30" rows="' . ROWS_3 . '" wrap="soft" name="note_private" id="note_private">'.$object->note_private.'</textarea>'));
|
||||||
array('type' => 'text', 'name' => 'note_private', 'label' => $langs->trans("Note"),'value' => $object->note_private));
|
array('type' => 'text', 'name' => 'note_private', 'label' => $langs->trans("Note"),'value' => $object->note_private));
|
||||||
|
|
||||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('SetAcceptedRefused'), '', 'setstatut', $formquestion, '', 1, 250);
|
if (! empty($conf->notification->enabled)) {
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
|
||||||
|
$notify = new Notify($db);
|
||||||
|
$formquestion = array_merge($formquestion, array(
|
||||||
|
array('type' => 'onecolumn', 'value' => $notify->confirmMessage('PROPAL_CLOSE_SIGNED', $object->socid, $object)),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('SetAcceptedRefused'), $text, 'setstatut', $formquestion, '', 1, 250);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -239,7 +239,8 @@ class Proposals extends DolibarrApi
|
|||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
function postLine($id, $request_data = NULL) {
|
function postLine($id, $request_data = NULL)
|
||||||
|
{
|
||||||
if(! DolibarrApiAccess::$user->rights->propal->creer) {
|
if(! DolibarrApiAccess::$user->rights->propal->creer) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
@ -249,10 +250,13 @@ class Proposals extends DolibarrApi
|
|||||||
throw new RestException(404, 'Commercial Proposal not found');
|
throw new RestException(404, 'Commercial Proposal not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
|
if (! DolibarrApi::_checkAccessToResource('propal',$this->propal->id))
|
||||||
|
{
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
|
|
||||||
$request_data = (object) $request_data;
|
$request_data = (object) $request_data;
|
||||||
|
|
||||||
$updateRes = $this->propal->addline(
|
$updateRes = $this->propal->addline(
|
||||||
$request_data->desc,
|
$request_data->desc,
|
||||||
$request_data->subprice,
|
$request_data->subprice,
|
||||||
@ -278,7 +282,7 @@ class Proposals extends DolibarrApi
|
|||||||
$request_data->fk_unit,
|
$request_data->fk_unit,
|
||||||
$this->element,
|
$this->element,
|
||||||
$request_data->id,
|
$request_data->id,
|
||||||
$request_data->pu_ht_devise,
|
$request_data->multicurrency_subprice,
|
||||||
$request_data->fk_remise_except
|
$request_data->fk_remise_except
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -300,42 +304,52 @@ class Proposals extends DolibarrApi
|
|||||||
*
|
*
|
||||||
* @return object
|
* @return object
|
||||||
*/
|
*/
|
||||||
function putLine($id, $lineid, $request_data = NULL) {
|
function putLine($id, $lineid, $request_data = NULL)
|
||||||
|
{
|
||||||
if(! DolibarrApiAccess::$user->rights->propal->creer) {
|
if(! DolibarrApiAccess::$user->rights->propal->creer) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->propal->fetch($id);
|
$result = $this->propal->fetch($id);
|
||||||
if( ! $result ) {
|
if($result <= 0) {
|
||||||
throw new RestException(404, 'Proposal not found');
|
throw new RestException(404, 'Proposal not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
|
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
|
|
||||||
$request_data = (object) $request_data;
|
$request_data = (object) $request_data;
|
||||||
|
|
||||||
|
$propalline = new PropaleLigne($this->db);
|
||||||
|
$result = $propalline->fetch($lineid);
|
||||||
|
if ($result <= 0) {
|
||||||
|
throw new RestException(404, 'Proposal line not found');
|
||||||
|
}
|
||||||
|
|
||||||
$updateRes = $this->propal->updateline(
|
$updateRes = $this->propal->updateline(
|
||||||
$lineid,
|
$lineid,
|
||||||
$request_data->desc,
|
isset($request_data->subprice)?$request_data->subprice:$propalline->subprice,
|
||||||
$request_data->subprice,
|
isset($request_data->qty)?$request_data->qty:$propalline->qty,
|
||||||
$request_data->qty,
|
isset($request_data->remise_percent)?$request_data->remise_percent:$propalline->remise_percent,
|
||||||
$request_data->remise_percent,
|
isset($request_data->tva_tx)?$request_data->tva_tx:$propalline->tva_tx,
|
||||||
$request_data->tva_tx,
|
isset($request_data->localtax1_tx)?$request_data->localtax1_tx:$propalline->localtax1_tx,
|
||||||
$request_data->localtax1_tx,
|
isset($request_data->localtax2_tx)?$request_data->localtax2_tx:$propalline->localtax2_tx,
|
||||||
$request_data->localtax2_tx,
|
isset($request_data->desc)?$request_data->desc:$propalline->desc,
|
||||||
'HT',
|
'HT',
|
||||||
$request_data->info_bits,
|
isset($request_data->info_bits)?$request_data->info_bits:$propalline->info_bits,
|
||||||
$request_data->date_start,
|
isset($request_data->special_code)?$request_data->special_code:$propalline->special_code,
|
||||||
$request_data->date_end,
|
isset($request_data->fk_parent_line)?$request_data->fk_parent_line:$propalline->fk_parent_line,
|
||||||
$request_data->product_type,
|
|
||||||
$request_data->fk_parent_line,
|
|
||||||
0,
|
0,
|
||||||
$request_data->fk_fournprice,
|
isset($request_data->fk_fournprice)?$request_data->fk_fournprice:$propalline->fk_fournprice,
|
||||||
$request_data->pa_ht,
|
isset($request_data->pa_ht)?$request_data->pa_ht:$propalline->pa_ht,
|
||||||
$request_data->label,
|
isset($request_data->label)?$request_data->label:$propalline->label,
|
||||||
$request_data->special_code,
|
isset($request_data->product_type)?$request_data->product_type:$propalline->product_type,
|
||||||
$request_data->array_options,
|
isset($request_data->date_start)?$request_data->date_start:$propalline->date_start,
|
||||||
$request_data->fk_unit
|
isset($request_data->date_end)?$request_data->date_end:$propalline->date_end,
|
||||||
|
isset($request_data->array_options)?$request_data->array_options:$propalline->array_options,
|
||||||
|
isset($request_data->fk_unit)?$request_data->fk_unit:$propalline->fk_unit,
|
||||||
|
isset($request_data->multicurrency_subprice)?$request_data->multicurrency_subprice:$propalline->subprice
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($updateRes > 0) {
|
if ($updateRes > 0) {
|
||||||
@ -356,8 +370,10 @@ class Proposals extends DolibarrApi
|
|||||||
* @url DELETE {id}/lines/{lineid}
|
* @url DELETE {id}/lines/{lineid}
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
|
* @throws 401
|
||||||
|
* @throws 404
|
||||||
*/
|
*/
|
||||||
function delLine($id, $lineid) {
|
function deleteLine($id, $lineid) {
|
||||||
if(! DolibarrApiAccess::$user->rights->propal->creer) {
|
if(! DolibarrApiAccess::$user->rights->propal->creer) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
@ -370,9 +386,10 @@ class Proposals extends DolibarrApi
|
|||||||
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
|
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
|
|
||||||
$request_data = (object) $request_data;
|
$request_data = (object) $request_data;
|
||||||
$updateRes = $this->propal->deleteline($lineid);
|
$updateRes = $this->propal->deleteline($lineid);
|
||||||
if ($updateRes == 1) {
|
if ($updateRes > 0) {
|
||||||
return $this->get($id);
|
return $this->get($id);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -508,4 +525,23 @@ class Proposals extends DolibarrApi
|
|||||||
}
|
}
|
||||||
return $propal;
|
return $propal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clean sensible object datas
|
||||||
|
*
|
||||||
|
* @param object $object Object to clean
|
||||||
|
* @return array Array of cleaned object properties
|
||||||
|
*/
|
||||||
|
function _cleanObjectDatas($object) {
|
||||||
|
|
||||||
|
$object = parent::_cleanObjectDatas($object);
|
||||||
|
|
||||||
|
unset($object->name);
|
||||||
|
unset($object->lastname);
|
||||||
|
unset($object->firstname);
|
||||||
|
unset($object->civility_id);
|
||||||
|
unset($object->address);
|
||||||
|
|
||||||
|
return $object;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -639,6 +639,7 @@ class Propal extends CommonObject
|
|||||||
$pa_ht=price2num($pa_ht);
|
$pa_ht=price2num($pa_ht);
|
||||||
if (empty($qty) && empty($special_code)) $special_code=3; // Set option tag
|
if (empty($qty) && empty($special_code)) $special_code=3; // Set option tag
|
||||||
if (! empty($qty) && $special_code == 3) $special_code=0; // Remove option tag
|
if (! empty($qty) && $special_code == 3) $special_code=0; // Remove option tag
|
||||||
|
if (empty($type)) $type=0;
|
||||||
|
|
||||||
if ($this->statut == self::STATUS_DRAFT)
|
if ($this->statut == self::STATUS_DRAFT)
|
||||||
{
|
{
|
||||||
@ -1271,8 +1272,8 @@ class Propal extends CommonObject
|
|||||||
$sql.= ", cr.code as cond_reglement_code, cr.libelle as cond_reglement, cr.libelle_facture as cond_reglement_libelle_doc";
|
$sql.= ", cr.code as cond_reglement_code, cr.libelle as cond_reglement, cr.libelle_facture as cond_reglement_libelle_doc";
|
||||||
$sql.= ", cp.code as mode_reglement_code, cp.libelle as mode_reglement";
|
$sql.= ", cp.code as mode_reglement_code, cp.libelle as mode_reglement";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_propalst as c, ".MAIN_DB_PREFIX."propal as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_propalst as c, ".MAIN_DB_PREFIX."propal as p";
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as cp ON p.fk_mode_reglement = cp.id';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as cp ON p.fk_mode_reglement = cp.id AND cp.entity IN (' . getEntity('c_paiement').')';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as cr ON p.fk_cond_reglement = cr.rowid';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as cr ON p.fk_cond_reglement = cr.rowid AND cr.entity IN (' . getEntity('c_payment_term').')';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_availability as ca ON p.fk_availability = ca.rowid';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_availability as ca ON p.fk_availability = ca.rowid';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON p.fk_input_reason = dr.rowid';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON p.fk_input_reason = dr.rowid';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON p.fk_incoterms = i.rowid';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON p.fk_incoterms = i.rowid';
|
||||||
@ -3653,6 +3654,8 @@ class PropaleLigne extends CommonObjectLine
|
|||||||
{
|
{
|
||||||
$objp = $this->db->fetch_object($result);
|
$objp = $this->db->fetch_object($result);
|
||||||
|
|
||||||
|
if ($objp)
|
||||||
|
{
|
||||||
$this->id = $objp->rowid;
|
$this->id = $objp->rowid;
|
||||||
$this->rowid = $objp->rowid; // deprecated
|
$this->rowid = $objp->rowid; // deprecated
|
||||||
$this->fk_propal = $objp->fk_propal;
|
$this->fk_propal = $objp->fk_propal;
|
||||||
@ -3708,6 +3711,11 @@ class PropaleLigne extends CommonObjectLine
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -158,7 +158,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
{
|
{
|
||||||
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1716,7 +1716,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
|||||||
print '<div class="center">';
|
print '<div class="center">';
|
||||||
print '<input type="submit" class="button" name="bouton" value="' . $langs->trans('CreateDraft') . '">';
|
print '<input type="submit" class="button" name="bouton" value="' . $langs->trans('CreateDraft') . '">';
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<input type="submit" class="button" name="cancel" value="' . $langs->trans("Cancel") . '">';
|
print '<input type="button" class="button" name="cancel" value="' . $langs->trans("Cancel") . '" onclick="javascript:history.go(-1)">';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|||||||
@ -389,7 +389,7 @@ class CommandeApi extends DolibarrApi
|
|||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
function delLine($id, $lineid) {
|
function deleteLine($id, $lineid) {
|
||||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -353,14 +353,16 @@ class Orders extends DolibarrApi
|
|||||||
* Delete a line to given order
|
* Delete a line to given order
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @param int $id Id of commande to update
|
* @param int $id Id of order to update
|
||||||
* @param int $lineid Id of line to delete
|
* @param int $lineid Id of line to delete
|
||||||
*
|
*
|
||||||
* @url DELETE {id}/lines/{lineid}
|
* @url DELETE {id}/lines/{lineid}
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
|
* @throws 401
|
||||||
|
* @throws 404
|
||||||
*/
|
*/
|
||||||
function delLine($id, $lineid) {
|
function deleteLine($id, $lineid) {
|
||||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
@ -373,6 +375,7 @@ class Orders extends DolibarrApi
|
|||||||
if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) {
|
if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) {
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
|
|
||||||
$request_data = (object) $request_data;
|
$request_data = (object) $request_data;
|
||||||
$updateRes = $this->commande->deleteline(DolibarrApiAccess::$user,$lineid);
|
$updateRes = $this->commande->deleteline(DolibarrApiAccess::$user,$lineid);
|
||||||
if ($updateRes > 0) {
|
if ($updateRes > 0) {
|
||||||
|
|||||||
@ -169,15 +169,11 @@ class Commande extends CommonOrder
|
|||||||
*/
|
*/
|
||||||
const STATUS_VALIDATED = 1;
|
const STATUS_VALIDATED = 1;
|
||||||
/**
|
/**
|
||||||
* Accepted (supplier orders)
|
* Shipment on process
|
||||||
*/
|
|
||||||
const STATUS_ACCEPTED = 2;
|
|
||||||
/**
|
|
||||||
* Shipment on process (customer orders)
|
|
||||||
*/
|
*/
|
||||||
const STATUS_SHIPMENTONPROCESS = 2;
|
const STATUS_SHIPMENTONPROCESS = 2;
|
||||||
/**
|
/**
|
||||||
* Closed (Sent/Received, billed or not)
|
* Closed (Sent, billed or not)
|
||||||
*/
|
*/
|
||||||
const STATUS_CLOSED = 3;
|
const STATUS_CLOSED = 3;
|
||||||
|
|
||||||
@ -1559,10 +1555,10 @@ class Commande extends CommonOrder
|
|||||||
$sql.= ', ca.code as availability_code, ca.label as availability_label';
|
$sql.= ', ca.code as availability_code, ca.label as availability_label';
|
||||||
$sql.= ', dr.code as demand_reason_code';
|
$sql.= ', dr.code as demand_reason_code';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'commande as c';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'commande as c';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as cr ON (c.fk_cond_reglement = cr.rowid)';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as cr ON c.fk_cond_reglement = cr.rowid AND cr.entity IN (' . getEntity('c_payment_term') . ')';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON (c.fk_mode_reglement = p.id)';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON c.fk_mode_reglement = p.id AND p.entity IN (' . getEntity('c_paiement') . ')';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_availability as ca ON (c.fk_availability = ca.rowid)';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_availability as ca ON c.fk_availability = ca.rowid';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON (c.fk_input_reason = ca.rowid)';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON c.fk_input_reason = ca.rowid';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON c.fk_incoterms = i.rowid';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON c.fk_incoterms = i.rowid';
|
||||||
$sql.= " WHERE c.entity IN (".getEntity('commande').")";
|
$sql.= " WHERE c.entity IN (".getEntity('commande').")";
|
||||||
if ($id) $sql.= " AND c.rowid=".$id;
|
if ($id) $sql.= " AND c.rowid=".$id;
|
||||||
@ -3225,7 +3221,7 @@ class Commande extends CommonOrder
|
|||||||
}
|
}
|
||||||
$sql.= $clause." c.entity IN (".getEntity('commande').")";
|
$sql.= $clause." c.entity IN (".getEntity('commande').")";
|
||||||
//$sql.= " AND c.fk_statut IN (1,2,3) AND c.facture = 0";
|
//$sql.= " AND c.fk_statut IN (1,2,3) AND c.facture = 0";
|
||||||
$sql.= " AND ((c.fk_statut IN (".self::STATUS_VALIDATED.",".self::STATUS_ACCEPTED.")) OR (c.fk_statut = ".self::STATUS_CLOSED." AND c.facture = 0))"; // If status is 2 and facture=1, it must be selected
|
$sql.= " AND ((c.fk_statut IN (".self::STATUS_VALIDATED.",".self::STATUS_SHIPMENTONPROCESS.")) OR (c.fk_statut = ".self::STATUS_CLOSED." AND c.facture = 0))"; // If status is 2 and facture=1, it must be selected
|
||||||
if ($user->societe_id) $sql.=" AND c.fk_soc = ".$user->societe_id;
|
if ($user->societe_id) $sql.=" AND c.fk_soc = ".$user->societe_id;
|
||||||
|
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
@ -3310,7 +3306,7 @@ class Commande extends CommonOrder
|
|||||||
if ($statut==self::STATUS_CANCELED) return $langs->trans('StatusOrderCanceled');
|
if ($statut==self::STATUS_CANCELED) return $langs->trans('StatusOrderCanceled');
|
||||||
if ($statut==self::STATUS_DRAFT) return $langs->trans('StatusOrderDraft');
|
if ($statut==self::STATUS_DRAFT) return $langs->trans('StatusOrderDraft');
|
||||||
if ($statut==self::STATUS_VALIDATED) return $langs->trans('StatusOrderValidated').$billedtext;
|
if ($statut==self::STATUS_VALIDATED) return $langs->trans('StatusOrderValidated').$billedtext;
|
||||||
if ($statut==self::STATUS_ACCEPTED) return $langs->trans('StatusOrderSentShort').$billedtext;
|
if ($statut==self::STATUS_SHIPMENTONPROCESS) return $langs->trans('StatusOrderSentShort').$billedtext;
|
||||||
if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderToBill');
|
if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderToBill');
|
||||||
if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderProcessed').$billedtext;
|
if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderProcessed').$billedtext;
|
||||||
if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderDelivered');
|
if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderDelivered');
|
||||||
@ -3320,7 +3316,7 @@ class Commande extends CommonOrder
|
|||||||
if ($statut==self::STATUS_CANCELED) return $langs->trans('StatusOrderCanceledShort');
|
if ($statut==self::STATUS_CANCELED) return $langs->trans('StatusOrderCanceledShort');
|
||||||
if ($statut==self::STATUS_DRAFT) return $langs->trans('StatusOrderDraftShort');
|
if ($statut==self::STATUS_DRAFT) return $langs->trans('StatusOrderDraftShort');
|
||||||
if ($statut==self::STATUS_VALIDATED) return $langs->trans('StatusOrderValidatedShort').$billedtext;
|
if ($statut==self::STATUS_VALIDATED) return $langs->trans('StatusOrderValidatedShort').$billedtext;
|
||||||
if ($statut==self::STATUS_ACCEPTED) return $langs->trans('StatusOrderSentShort').$billedtext;
|
if ($statut==self::STATUS_SHIPMENTONPROCESS) return $langs->trans('StatusOrderSentShort').$billedtext;
|
||||||
if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderToBillShort');
|
if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderToBillShort');
|
||||||
if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderProcessed').$billedtext;
|
if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderProcessed').$billedtext;
|
||||||
if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderDelivered');
|
if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderDelivered');
|
||||||
@ -3330,7 +3326,7 @@ class Commande extends CommonOrder
|
|||||||
if ($statut==self::STATUS_CANCELED) return img_picto($langs->trans('StatusOrderCanceled'),'statut5').' '.$langs->trans('StatusOrderCanceledShort');
|
if ($statut==self::STATUS_CANCELED) return img_picto($langs->trans('StatusOrderCanceled'),'statut5').' '.$langs->trans('StatusOrderCanceledShort');
|
||||||
if ($statut==self::STATUS_DRAFT) return img_picto($langs->trans('StatusOrderDraft'),'statut0').' '.$langs->trans('StatusOrderDraftShort');
|
if ($statut==self::STATUS_DRAFT) return img_picto($langs->trans('StatusOrderDraft'),'statut0').' '.$langs->trans('StatusOrderDraftShort');
|
||||||
if ($statut==self::STATUS_VALIDATED) return img_picto($langs->trans('StatusOrderValidated'),'statut1').' '.$langs->trans('StatusOrderValidatedShort').$billedtext;
|
if ($statut==self::STATUS_VALIDATED) return img_picto($langs->trans('StatusOrderValidated'),'statut1').' '.$langs->trans('StatusOrderValidatedShort').$billedtext;
|
||||||
if ($statut==self::STATUS_ACCEPTED) return img_picto($langs->trans('StatusOrderSent'),'statut3').' '.$langs->trans('StatusOrderSentShort').$billedtext;
|
if ($statut==self::STATUS_SHIPMENTONPROCESS) return img_picto($langs->trans('StatusOrderSent'),'statut3').' '.$langs->trans('StatusOrderSentShort').$billedtext;
|
||||||
if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderToBill'),'statut4').' '.$langs->trans('StatusOrderToBillShort');
|
if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderToBill'),'statut4').' '.$langs->trans('StatusOrderToBillShort');
|
||||||
if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderProcessed').$billedtext,'statut6').' '.$langs->trans('StatusOrderProcessed').$billedtext;
|
if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderProcessed').$billedtext,'statut6').' '.$langs->trans('StatusOrderProcessed').$billedtext;
|
||||||
if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderDelivered'),'statut6').' '.$langs->trans('StatusOrderDeliveredShort');
|
if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderDelivered'),'statut6').' '.$langs->trans('StatusOrderDeliveredShort');
|
||||||
@ -3340,7 +3336,7 @@ class Commande extends CommonOrder
|
|||||||
if ($statut==self::STATUS_CANCELED) return img_picto($langs->trans('StatusOrderCanceled'),'statut5');
|
if ($statut==self::STATUS_CANCELED) return img_picto($langs->trans('StatusOrderCanceled'),'statut5');
|
||||||
if ($statut==self::STATUS_DRAFT) return img_picto($langs->trans('StatusOrderDraft'),'statut0');
|
if ($statut==self::STATUS_DRAFT) return img_picto($langs->trans('StatusOrderDraft'),'statut0');
|
||||||
if ($statut==self::STATUS_VALIDATED) return img_picto($langs->trans('StatusOrderValidated').$billedtext,'statut1');
|
if ($statut==self::STATUS_VALIDATED) return img_picto($langs->trans('StatusOrderValidated').$billedtext,'statut1');
|
||||||
if ($statut==self::STATUS_ACCEPTED) return img_picto($langs->trans('StatusOrderSentShort').$billedtext,'statut3');
|
if ($statut==self::STATUS_SHIPMENTONPROCESS) return img_picto($langs->trans('StatusOrderSentShort').$billedtext,'statut3');
|
||||||
if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderToBill'),'statut4');
|
if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderToBill'),'statut4');
|
||||||
if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderProcessed').$billedtext,'statut6');
|
if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderProcessed').$billedtext,'statut6');
|
||||||
if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderDelivered'),'statut6');
|
if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderDelivered'),'statut6');
|
||||||
@ -3350,7 +3346,7 @@ class Commande extends CommonOrder
|
|||||||
if ($statut==self::STATUS_CANCELED) return img_picto($langs->trans('StatusOrderCanceled'),'statut5').' '.$langs->trans('StatusOrderCanceled');
|
if ($statut==self::STATUS_CANCELED) return img_picto($langs->trans('StatusOrderCanceled'),'statut5').' '.$langs->trans('StatusOrderCanceled');
|
||||||
if ($statut==self::STATUS_DRAFT) return img_picto($langs->trans('StatusOrderDraft'),'statut0').' '.$langs->trans('StatusOrderDraft');
|
if ($statut==self::STATUS_DRAFT) return img_picto($langs->trans('StatusOrderDraft'),'statut0').' '.$langs->trans('StatusOrderDraft');
|
||||||
if ($statut==self::STATUS_VALIDATED) return img_picto($langs->trans('StatusOrderValidated').$billedtext,'statut1').' '.$langs->trans('StatusOrderValidated').$billedtext;
|
if ($statut==self::STATUS_VALIDATED) return img_picto($langs->trans('StatusOrderValidated').$billedtext,'statut1').' '.$langs->trans('StatusOrderValidated').$billedtext;
|
||||||
if ($statut==self::STATUS_ACCEPTED) return img_picto($langs->trans('StatusOrderSentShort').$billedtext,'statut3').' '.$langs->trans('StatusOrderSent').$billedtext;
|
if ($statut==self::STATUS_SHIPMENTONPROCESS) return img_picto($langs->trans('StatusOrderSentShort').$billedtext,'statut3').' '.$langs->trans('StatusOrderSent').$billedtext;
|
||||||
if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderToBill'),'statut4').' '.$langs->trans('StatusOrderToBill');
|
if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderToBill'),'statut4').' '.$langs->trans('StatusOrderToBill');
|
||||||
if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderProcessedShort').$billedtext,'statut6').' '.$langs->trans('StatusOrderProcessed').$billedtext;
|
if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderProcessedShort').$billedtext,'statut6').' '.$langs->trans('StatusOrderProcessed').$billedtext;
|
||||||
if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderDelivered'),'statut6').' '.$langs->trans('StatusOrderDelivered');
|
if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderDelivered'),'statut6').' '.$langs->trans('StatusOrderDelivered');
|
||||||
@ -3360,7 +3356,7 @@ class Commande extends CommonOrder
|
|||||||
if ($statut==self::STATUS_CANCELED) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderCanceledShort').' </span>'.img_picto($langs->trans('StatusOrderCanceled'),'statut5');
|
if ($statut==self::STATUS_CANCELED) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderCanceledShort').' </span>'.img_picto($langs->trans('StatusOrderCanceled'),'statut5');
|
||||||
if ($statut==self::STATUS_DRAFT) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderDraftShort').' </span>'.img_picto($langs->trans('StatusOrderDraft'),'statut0');
|
if ($statut==self::STATUS_DRAFT) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderDraftShort').' </span>'.img_picto($langs->trans('StatusOrderDraft'),'statut0');
|
||||||
if ($statut==self::STATUS_VALIDATED) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderValidatedShort').$billedtext.' </span>'.img_picto($langs->trans('StatusOrderValidated').$billedtext,'statut1');
|
if ($statut==self::STATUS_VALIDATED) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderValidatedShort').$billedtext.' </span>'.img_picto($langs->trans('StatusOrderValidated').$billedtext,'statut1');
|
||||||
if ($statut==self::STATUS_ACCEPTED) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderSentShort').$billedtext.' </span>'.img_picto($langs->trans('StatusOrderSent').$billedtext,'statut3');
|
if ($statut==self::STATUS_SHIPMENTONPROCESS) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderSentShort').$billedtext.' </span>'.img_picto($langs->trans('StatusOrderSent').$billedtext,'statut3');
|
||||||
if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderToBillShort').' </span>'.img_picto($langs->trans('StatusOrderToBill'),'statut4');
|
if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderToBillShort').' </span>'.img_picto($langs->trans('StatusOrderToBill'),'statut4');
|
||||||
if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderProcessedShort').$billedtext.' </span>'.img_picto($langs->trans('StatusOrderProcessed').$billedtext,'statut6');
|
if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderProcessedShort').$billedtext.' </span>'.img_picto($langs->trans('StatusOrderProcessed').$billedtext,'statut6');
|
||||||
if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderDeliveredShort').' </span>'.img_picto($langs->trans('StatusOrderDelivered'),'statut6');
|
if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderDeliveredShort').' </span>'.img_picto($langs->trans('StatusOrderDelivered'),'statut6');
|
||||||
|
|||||||
@ -142,7 +142,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
{
|
{
|
||||||
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,7 +213,7 @@ if (empty($reshook))
|
|||||||
// TODO Move this into mass action include
|
// TODO Move this into mass action include
|
||||||
if ($massaction == 'confirm_createbills') {
|
if ($massaction == 'confirm_createbills') {
|
||||||
|
|
||||||
$orders = GETPOST('toselect');
|
$orders = GETPOST('toselect','array');
|
||||||
$createbills_onebythird = GETPOST('createbills_onebythird', 'int');
|
$createbills_onebythird = GETPOST('createbills_onebythird', 'int');
|
||||||
$validate_invoices = GETPOST('valdate_invoices', 'int');
|
$validate_invoices = GETPOST('valdate_invoices', 'int');
|
||||||
|
|
||||||
@ -224,8 +224,8 @@ if (empty($reshook))
|
|||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
foreach($orders as $id_order) {
|
foreach($orders as $id_order)
|
||||||
|
{
|
||||||
$cmd = new Commande($db);
|
$cmd = new Commande($db);
|
||||||
if ($cmd->fetch($id_order) <= 0) continue;
|
if ($cmd->fetch($id_order) <= 0) continue;
|
||||||
|
|
||||||
@ -252,12 +252,10 @@ if (empty($reshook))
|
|||||||
$res = $object->create($user);
|
$res = $object->create($user);
|
||||||
|
|
||||||
if($res > 0) $nb_bills_created++;
|
if($res > 0) $nb_bills_created++;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($object->id > 0) {
|
if ($object->id > 0)
|
||||||
|
{
|
||||||
$db->begin();
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."element_element (";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."element_element (";
|
||||||
$sql.= "fk_source";
|
$sql.= "fk_source";
|
||||||
$sql.= ", sourcetype";
|
$sql.= ", sourcetype";
|
||||||
@ -270,15 +268,13 @@ if (empty($reshook))
|
|||||||
$sql.= ", '".$object->element."'";
|
$sql.= ", '".$object->element."'";
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
|
|
||||||
if ($db->query($sql))
|
if (! $db->query($sql))
|
||||||
{
|
{
|
||||||
$db->commit();
|
$error++;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$db->rollback();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
$lines = $cmd->lines;
|
$lines = $cmd->lines;
|
||||||
if (empty($lines) && method_exists($cmd, 'fetch_lines'))
|
if (empty($lines) && method_exists($cmd, 'fetch_lines'))
|
||||||
{
|
{
|
||||||
@ -378,7 +374,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//$cmd->classifyBilled($user); // Disabled. This behavior must be set or not using the workflow module.
|
//$cmd->classifyBilled($user); // Disabled. This behavior must be set or not using the workflow module.
|
||||||
@ -391,27 +387,29 @@ if (empty($reshook))
|
|||||||
$TAllFact = empty($createbills_onebythird) ? $TFact : $TFactThird;
|
$TAllFact = empty($createbills_onebythird) ? $TFact : $TFactThird;
|
||||||
$toselect = array();
|
$toselect = array();
|
||||||
|
|
||||||
if(!empty($validate_invoices)) {
|
if (! $error && $validate_invoices)
|
||||||
|
{
|
||||||
$massaction = $action = 'builddoc';
|
$massaction = $action = 'builddoc';
|
||||||
|
foreach($TAllFact as &$object)
|
||||||
|
{
|
||||||
|
$result = $object->validate($user);
|
||||||
|
if ($result <= 0)
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
foreach($TAllFact as &$object) {
|
$id = $object->id; // For builddoc action
|
||||||
$object->validate($user);
|
|
||||||
$toselect[] = $object->id; // For builddoc action
|
|
||||||
|
|
||||||
// Fac builddoc
|
// Fac builddoc
|
||||||
|
$donotredirect = 1;
|
||||||
$upload_dir = $conf->facture->dir_output;
|
$upload_dir = $conf->facture->dir_output;
|
||||||
$permissioncreate=$user->rights->facture->creer;
|
$permissioncreate=$user->rights->facture->creer;
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
$objectclass='Facture';
|
$massaction = $action = 'confirm_createbills';
|
||||||
$objectlabel='Invoice';
|
|
||||||
$permtoread = $user->rights->facture->lire;
|
|
||||||
$permtodelete = $user->rights->facture->supprimer;
|
|
||||||
$uploaddir = $conf->facture->dir_output;
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
|
|||||||
@ -149,7 +149,7 @@ dol_fiche_head($head, 'annual', $langs->trans("FinancialAccount"), -1, 'account'
|
|||||||
$title=$langs->trans("FinancialAccount")." : ".$object->label;
|
$title=$langs->trans("FinancialAccount")." : ".$object->label;
|
||||||
$link=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?account=".$object->id."&year_start=".($year_start-1)."'>".img_previous('', 'class="valignbottom"')."</a> ".$langs->trans("Year")." <a href='".$_SERVER["PHP_SELF"]."?account=".$object->id."&year_start=".($year_start+1)."'>".img_next('', 'class="valignbottom"')."</a>":"");
|
$link=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?account=".$object->id."&year_start=".($year_start-1)."'>".img_previous('', 'class="valignbottom"')."</a> ".$langs->trans("Year")." <a href='".$_SERVER["PHP_SELF"]."?account=".$object->id."&year_start=".($year_start+1)."'>".img_next('', 'class="valignbottom"')."</a>":"");
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
|
|
||||||
if (!empty($id))
|
if (!empty($id))
|
||||||
|
|||||||
@ -23,7 +23,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/compta/bank/bankentries.php
|
* \file htdocs/compta/bank/bankentries_list.php
|
||||||
* \ingroup banque
|
* \ingroup banque
|
||||||
* \brief List of bank transactions
|
* \brief List of bank transactions
|
||||||
*/
|
*/
|
||||||
@ -151,7 +151,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
{
|
{
|
||||||
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -405,7 +405,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$head=bank_prepare_head($object);
|
$head=bank_prepare_head($object);
|
||||||
dol_fiche_head($head,'journal',$langs->trans("FinancialAccount"),0,'account');
|
dol_fiche_head($head,'journal',$langs->trans("FinancialAccount"),0,'account');
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
|
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
|
||||||
|
|
||||||
@ -447,7 +447,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
if ($object->canBeConciliated() > 0) {
|
if ($object->canBeConciliated() > 0) {
|
||||||
// If not cash account and can be reconciliate
|
// If not cash account and can be reconciliate
|
||||||
if ($user->rights->banque->consolidate) {
|
if ($user->rights->banque->consolidate) {
|
||||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/bankentries.php?action=reconcile&search_conciliated=0'.$param.'">'.$langs->trans("Conciliate").'</a>';
|
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?action=reconcile&search_conciliated=0'.$param.'">'.$langs->trans("Conciliate").'</a>';
|
||||||
} else {
|
} else {
|
||||||
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Conciliate").'</a>';
|
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Conciliate").'</a>';
|
||||||
}
|
}
|
||||||
@ -559,7 +559,7 @@ if (! empty($thirdparty)) $mode_balance_ok=false;
|
|||||||
|
|
||||||
$sql.= $db->plimit($limit+1,$offset);
|
$sql.= $db->plimit($limit+1,$offset);
|
||||||
|
|
||||||
dol_syslog('compta/bank/bankentries.php', LOG_DEBUG);
|
dol_syslog('compta/bank/bankentries_list.php', LOG_DEBUG);
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
@ -1161,7 +1161,7 @@ if ($resql)
|
|||||||
if (! empty($arrayfields['type']['checked']))
|
if (! empty($arrayfields['type']['checked']))
|
||||||
{
|
{
|
||||||
print '<td align="center" class="nowrap">';
|
print '<td align="center" class="nowrap">';
|
||||||
$labeltype=($langs->trans("PaymentTypeShort".$objp->fk_type)!="PaymentTypeShort".$objp->fk_type)?$langs->trans("PaymentTypeShort".$objp->fk_type):$langs->getLabelFromKey($db,$objp->fk_type,'c_paiement','code','libelle');
|
$labeltype=($langs->trans("PaymentTypeShort".$objp->fk_type)!="PaymentTypeShort".$objp->fk_type)?$langs->trans("PaymentTypeShort".$objp->fk_type):$langs->getLabelFromKey($db,$objp->fk_type,'c_paiement','code','libelle','',1);
|
||||||
if ($labeltype == 'SOLD') print ' '; //$langs->trans("InitialBankBalance");
|
if ($labeltype == 'SOLD') print ' '; //$langs->trans("InitialBankBalance");
|
||||||
else print $labeltype;
|
else print $labeltype;
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
@ -76,7 +76,7 @@ if ($result)
|
|||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print "<td><a href=\"".DOL_URL_ROOT."/compta/bank/bankentries.php?bid=$objp->rowid\">$objp->label</a></td>";
|
print "<td><a href=\"".DOL_URL_ROOT."/compta/bank/bankentries_list.php?bid=$objp->rowid\">$objp->label</a></td>";
|
||||||
print '<td align="right">'.$objp->nombre.'</td>';
|
print '<td align="right">'.$objp->nombre.'</td>';
|
||||||
print '<td align="right">'.price(abs($objp->somme))."</td>";
|
print '<td align="right">'.price(abs($objp->somme))."</td>";
|
||||||
print '<td align="right">'.price(abs(price2num($objp->somme / $objp->nombre,'MT')))."</td>";
|
print '<td align="right">'.price(abs(price2num($objp->somme / $objp->nombre,'MT')))."</td>";
|
||||||
|
|||||||
@ -262,7 +262,7 @@ if ($action == 'confirm_delete' && $_POST["confirm"] == "yes" && $user->rights->
|
|||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
|
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
|
||||||
header("Location: ".DOL_URL_ROOT."/compta/bank/index.php");
|
header("Location: ".DOL_URL_ROOT."/compta/bank/list.php");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -324,11 +324,11 @@ if ($action == 'create')
|
|||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Ref").'</td>';
|
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Ref").'</td>';
|
||||||
print '<td><input size="8" type="text" class="flat" name="ref" value="'.(GETPOST("ref")?GETPOST("ref",'alpha'):$object->ref).'" maxlength="12"></td></tr>';
|
print '<td><input size="8" type="text" class="flat" name="ref" value="'.dol_escape_htmltag(GETPOST("ref")?GETPOST("ref",'alpha'):$object->ref).'" maxlength="12" autofocus></td></tr>';
|
||||||
|
|
||||||
// Label
|
// Label
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("LabelBankCashAccount").'</td>';
|
print '<tr><td class="fieldrequired">'.$langs->trans("LabelBankCashAccount").'</td>';
|
||||||
print '<td><input size="30" type="text" class="flat" name="label" value="'.GETPOST("label", 'alpha').'"></td></tr>';
|
print '<td><input size="30" type="text" class="flat" name="label" value="'.dol_escape_htmltag(GETPOST("label", 'alpha')).'"></td></tr>';
|
||||||
|
|
||||||
// Type
|
// Type
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("AccountType").'</td>';
|
print '<tr><td class="fieldrequired">'.$langs->trans("AccountType").'</td>';
|
||||||
@ -349,7 +349,7 @@ if ($action == 'create')
|
|||||||
// Status
|
// Status
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td>';
|
print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $form->selectarray("clos", $object->status,(isset($_POST["clos"])?$_POST["clos"]:$object->clos));
|
print $form->selectarray("clos", $object->status,(GETPOST("clos",'int')!=''?GETPOST("clos",'int'):$object->clos));
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Country
|
// Country
|
||||||
@ -576,7 +576,7 @@ else
|
|||||||
// Print form confirm
|
// Print form confirm
|
||||||
print $formconfirm;
|
print $formconfirm;
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
$morehtmlref='';
|
$morehtmlref='';
|
||||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||||
|
|||||||
@ -414,6 +414,7 @@ class Account extends CommonObject
|
|||||||
{
|
{
|
||||||
$sql = "SELECT code FROM ".MAIN_DB_PREFIX."c_paiement";
|
$sql = "SELECT code FROM ".MAIN_DB_PREFIX."c_paiement";
|
||||||
$sql.= " WHERE id=".$oper;
|
$sql.= " WHERE id=".$oper;
|
||||||
|
$sql.= " AND entity IN (" . getEntity('c_paiement') . ")";
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
@ -1186,7 +1187,7 @@ class Account extends CommonObject
|
|||||||
$response = new WorkboardResponse();
|
$response = new WorkboardResponse();
|
||||||
$response->warning_delay=$conf->bank->rappro->warning_delay/60/60/24;
|
$response->warning_delay=$conf->bank->rappro->warning_delay/60/60/24;
|
||||||
$response->label=$langs->trans("TransactionsToConciliate");
|
$response->label=$langs->trans("TransactionsToConciliate");
|
||||||
$response->url=DOL_URL_ROOT.'/compta/bank/index.php?leftmenu=bank&mainmenu=bank';
|
$response->url=DOL_URL_ROOT.'/compta/bank/list.php?leftmenu=bank&mainmenu=bank';
|
||||||
$response->img=img_object('',"payment");
|
$response->img=img_object('',"payment");
|
||||||
|
|
||||||
while ($obj=$this->db->fetch_object($resql))
|
while ($obj=$this->db->fetch_object($resql))
|
||||||
@ -1207,6 +1208,44 @@ class Account extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Charge indicateurs this->nb de tableau de bord
|
||||||
|
* @param int $filteraccountid To get info for a particular account id
|
||||||
|
* @return int <0 if ko, >0 if ok
|
||||||
|
*/
|
||||||
|
function load_state_board($filteraccountid = 0)
|
||||||
|
{
|
||||||
|
global $user;
|
||||||
|
|
||||||
|
if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe
|
||||||
|
|
||||||
|
$sql = "SELECT count(b.rowid) as nb";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b,";
|
||||||
|
$sql.= " ".MAIN_DB_PREFIX."bank_account as ba";
|
||||||
|
$sql.= " WHERE b.fk_account = ba.rowid";
|
||||||
|
$sql.= " AND ba.entity IN (".getEntity('bank_account').")";
|
||||||
|
$sql.= " AND (ba.rappro = 1 AND ba.courant != 2)"; // Compte rapprochable
|
||||||
|
$sql.= " AND clos = 0";
|
||||||
|
if ($filteraccountid) $sql.=" AND ba.rowid = ".$filteraccountid;
|
||||||
|
|
||||||
|
$resql=$this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
while ($obj=$this->db->fetch_object($resql))
|
||||||
|
{
|
||||||
|
$this->nb["banklines"]=$obj->nb;
|
||||||
|
}
|
||||||
|
$this->db->free($resql);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($this->db);
|
||||||
|
$this->error=$this->db->error();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
|
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
|
||||||
@ -1246,9 +1285,10 @@ class Account extends CommonObject
|
|||||||
* @param int $withpicto Include picto into link
|
* @param int $withpicto Include picto into link
|
||||||
* @param string $mode ''=Link to card, 'transactions'=Link to transactions card
|
* @param string $mode ''=Link to card, 'transactions'=Link to transactions card
|
||||||
* @param string $option ''=Show ref, 'reflabel'=Show ref+label
|
* @param string $option ''=Show ref, 'reflabel'=Show ref+label
|
||||||
|
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
||||||
* @return string Chaine avec URL
|
* @return string Chaine avec URL
|
||||||
*/
|
*/
|
||||||
function getNomUrl($withpicto=0, $mode='', $option='')
|
function getNomUrl($withpicto=0, $mode='', $option='', $save_lastsearch_value=-1)
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
@ -1266,22 +1306,27 @@ class Account extends CommonObject
|
|||||||
}
|
}
|
||||||
$linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
$linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
|
|
||||||
if (empty($mode))
|
$url = DOL_URL_ROOT.'/compta/bank/card.php?id='.$this->id;
|
||||||
|
if ($mode == 'transactions')
|
||||||
{
|
{
|
||||||
$link = '<a href="'.DOL_URL_ROOT.'/compta/bank/card.php?id='.$this->id.$linkclose;
|
$url = DOL_URL_ROOT.'/compta/bank/bankentries_list.php?id='.$this->id;
|
||||||
$linkend='</a>';
|
|
||||||
}
|
|
||||||
else if ($mode == 'transactions')
|
|
||||||
{
|
|
||||||
$link = '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries.php?id='.$this->id.$linkclose;
|
|
||||||
$linkend='</a>';
|
|
||||||
}
|
}
|
||||||
else if ($mode == 'receipts')
|
else if ($mode == 'receipts')
|
||||||
{
|
{
|
||||||
$link = '<a href="'.DOL_URL_ROOT.'/compta/bank/releve.php?account='.$this->id.$linkclose;
|
$url = DOL_URL_ROOT.'/compta/bank/releve.php?account='.$this->id;
|
||||||
$linkend='</a>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($option != 'nolink')
|
||||||
|
{
|
||||||
|
// Add param to save lastsearch_values or not
|
||||||
|
$add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
|
||||||
|
if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
|
||||||
|
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
|
||||||
|
}
|
||||||
|
|
||||||
|
$link = '<a href="'.$url.$linkclose;
|
||||||
|
$linkend='</a>';
|
||||||
|
|
||||||
if ($withpicto) $result.=($link.img_object($label, 'account', 'class="classfortooltip"').$linkend.' ');
|
if ($withpicto) $result.=($link.img_object($label, 'account', 'class="classfortooltip"').$linkend.' ');
|
||||||
$result.=$link.$this->ref.($option == 'reflabel' && $this->label ? ' - '.$this->label : '').$linkend;
|
$result.=$link.$this->ref.($option == 'reflabel' && $this->label ? ' - '.$this->label : '').$linkend;
|
||||||
return $result;
|
return $result;
|
||||||
|
|||||||
@ -117,7 +117,7 @@ if ($id > 0 || !empty($ref)) {
|
|||||||
$totalsize+=$file['size'];
|
$totalsize+=$file['size'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||||
|
|
||||||
|
|||||||
@ -760,7 +760,7 @@ $head=bank_prepare_head($object);
|
|||||||
dol_fiche_head($head,'graph',$langs->trans("FinancialAccount"),0,'account');
|
dol_fiche_head($head,'graph',$langs->trans("FinancialAccount"),0,'account');
|
||||||
|
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
if ($account)
|
if ($account)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -58,7 +58,7 @@ $h++;
|
|||||||
|
|
||||||
dol_fiche_head($head, $hselected, $langs->trans("LineRecord"), -1, 'account');
|
dol_fiche_head($head, $hselected, $langs->trans("LineRecord"), -1, 'account');
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries.php">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
|
|
||||||
dol_banner_tab($object, 'rowid', $linkback);
|
dol_banner_tab($object, 'rowid', $linkback);
|
||||||
|
|||||||
@ -297,7 +297,7 @@ if ($result)
|
|||||||
|
|
||||||
dol_fiche_head($tabs, 0, $langs->trans('LineRecord'), 0, 'account');
|
dol_fiche_head($tabs, 0, $langs->trans('LineRecord'), 0, 'account');
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries.php">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
|
|
||||||
dol_banner_tab($bankline, 'rowid', $linkback);
|
dol_banner_tab($bankline, 'rowid', $linkback);
|
||||||
|
|||||||
@ -19,7 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/compta/bank/index.php
|
* \file htdocs/compta/bank/list.php
|
||||||
* \ingroup banque
|
* \ingroup banque
|
||||||
* \brief Home page of bank module
|
* \brief Home page of bank module
|
||||||
*/
|
*/
|
||||||
@ -103,7 +103,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
{
|
{
|
||||||
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -611,7 +611,7 @@ foreach ($accounts as $key=>$type)
|
|||||||
if (! empty($arrayfields['balance']['checked']))
|
if (! empty($arrayfields['balance']['checked']))
|
||||||
{
|
{
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries.php?id='.$obj->id.'">'.price($solde, 0, $langs, 0, 0, -1, $obj->currency_code).'</a>';
|
print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?id='.$obj->id.'">'.price($solde, 0, $langs, 0, 0, -1, $obj->currency_code).'</a>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
if (! $i) $totalarray['totalbalancefield']=$totalarray['nbfield'];
|
if (! $i) $totalarray['totalbalancefield']=$totalarray['nbfield'];
|
||||||
@ -328,7 +328,7 @@ if (empty($numref))
|
|||||||
$head=bank_prepare_head($object);
|
$head=bank_prepare_head($object);
|
||||||
dol_fiche_head($head,'statement',$langs->trans("FinancialAccount"),0,'account');
|
dol_fiche_head($head,'statement',$langs->trans("FinancialAccount"),0,'account');
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
|
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
|
||||||
|
|
||||||
@ -340,7 +340,7 @@ if (empty($numref))
|
|||||||
if ($object->canBeConciliated() > 0) {
|
if ($object->canBeConciliated() > 0) {
|
||||||
// If not cash account and can be reconciliate
|
// If not cash account and can be reconciliate
|
||||||
if ($user->rights->banque->consolidate) {
|
if ($user->rights->banque->consolidate) {
|
||||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/bankentries.php?action=reconcile&search_conciliated=0'.$param.'">'.$langs->trans("Conciliate").'</a>';
|
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?action=reconcile&search_conciliated=0'.$param.'">'.$langs->trans("Conciliate").'</a>';
|
||||||
} else {
|
} else {
|
||||||
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Conciliate").'</a>';
|
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Conciliate").'</a>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -93,7 +93,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
|
|||||||
$head=bank_prepare_head($object);
|
$head=bank_prepare_head($object);
|
||||||
dol_fiche_head($head, 'cash', $langs->trans("FinancialAccount"), -1, 'account');
|
dol_fiche_head($head, 'cash', $langs->trans("FinancialAccount"), -1, 'account');
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
|
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
|
||||||
|
|
||||||
|
|||||||
@ -96,7 +96,7 @@ $sql = "SELECT v.rowid, v.amount, v.label, v.datep as datep, v.datev as datev, v
|
|||||||
$sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number as bank_account_number, ba.fk_accountancy_journal as accountancy_journal, ba.label as blabel,";
|
$sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number as bank_account_number, ba.fk_accountancy_journal as accountancy_journal, ba.label as blabel,";
|
||||||
$sql.= " pst.code as payment_code";
|
$sql.= " pst.code as payment_code";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."payment_various as v";
|
$sql.= " FROM ".MAIN_DB_PREFIX."payment_various as v";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON v.fk_typepayment = pst.id";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON v.fk_typepayment = pst.id AND pst.entity = " . getEntity('c_paiement');
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON v.fk_bank = b.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON v.fk_bank = b.rowid";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
|
||||||
$sql.= " WHERE v.entity = ".$conf->entity;
|
$sql.= " WHERE v.entity = ".$conf->entity;
|
||||||
|
|||||||
@ -139,7 +139,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,";
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,";
|
||||||
$sql.= " ".MAIN_DB_PREFIX."chargesociales as cs";
|
$sql.= " ".MAIN_DB_PREFIX."chargesociales as cs";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementcharge as pc ON pc.fk_charge = cs.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementcharge as pc ON pc.fk_charge = cs.rowid";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON pc.fk_typepaiement = pct.id";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON pc.fk_typepaiement = pct.id AND pct.entity = " . getEntity('c_paiement');
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON pc.fk_bank = b.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON pc.fk_bank = b.rowid";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
|
||||||
$sql.= " WHERE cs.fk_type = c.id";
|
$sql.= " WHERE cs.fk_type = c.id";
|
||||||
@ -260,7 +260,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."tva as pv";
|
$sql.= " FROM ".MAIN_DB_PREFIX."tva as pv";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON pv.fk_bank = b.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON pv.fk_bank = b.rowid";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON pv.fk_typepayment = pct.id";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON pv.fk_typepayment = pct.id AND pct.entity = " . getEntity('c_paiement');
|
||||||
$sql.= " WHERE pv.entity = ".$conf->entity;
|
$sql.= " WHERE pv.entity = ".$conf->entity;
|
||||||
if ($year > 0)
|
if ($year > 0)
|
||||||
{
|
{
|
||||||
@ -474,7 +474,7 @@ if (! empty($conf->salaries->enabled) && $user->rights->salaries->read)
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s";
|
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON s.fk_bank = b.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON s.fk_bank = b.rowid";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON s.fk_typepayment = pct.id";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON s.fk_typepayment = pct.id AND pct.entity = " . getEntity('c_paiement');
|
||||||
$sql.= " , ".MAIN_DB_PREFIX."user as u";
|
$sql.= " , ".MAIN_DB_PREFIX."user as u";
|
||||||
$sql.= " WHERE s.entity IN (".getEntity('user').")";
|
$sql.= " WHERE s.entity IN (".getEntity('user').")";
|
||||||
$sql.= " AND u.rowid = s.fk_user";
|
$sql.= " AND u.rowid = s.fk_user";
|
||||||
|
|||||||
@ -38,6 +38,7 @@
|
|||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture-rec.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture-rec.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/modules/facture/modules_facture.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/modules/facture/modules_facture.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/discount.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/discount.class.php';
|
||||||
@ -716,9 +717,13 @@ if (empty($reshook))
|
|||||||
if ($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT || $object->type == Facture::TYPE_SITUATION)
|
if ($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT || $object->type == Facture::TYPE_SITUATION)
|
||||||
{
|
{
|
||||||
// If we're on a standard invoice, we have to get excess received to create a discount in TTC without VAT
|
// If we're on a standard invoice, we have to get excess received to create a discount in TTC without VAT
|
||||||
$sql = 'SELECT SUM(pf.amount) as total_paiements
|
|
||||||
FROM llx_c_paiement as c, llx_paiement_facture as pf, llx_paiement as p
|
$sql = 'SELECT SUM(pf.amount) as total_paiements';
|
||||||
WHERE pf.fk_facture = '.$object->id.' AND p.fk_paiement = c.id AND pf.fk_paiement = p.rowid';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'c_paiement as c, '.MAIN_DB_PREFIX.'paiement_facture as pf, '.MAIN_DB_PREFIX.'paiement as p';
|
||||||
|
$sql.= ' WHERE pf.fk_facture = '.$object->id;
|
||||||
|
$sql.= ' AND p.fk_paiement = c.id AND pf.fk_paiement = p.rowid';
|
||||||
|
$sql.= ' AND c.entity IN (' . getEntity('c_paiement').')';
|
||||||
|
$sql.= ' ORDER BY p.datep, p.tms';
|
||||||
|
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if (! $resql) dol_print_error($db);
|
if (! $resql) dol_print_error($db);
|
||||||
@ -3798,6 +3803,7 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bank as b ON p.fk_bank = b.rowid';
|
$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bank as b ON p.fk_bank = b.rowid';
|
||||||
$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bank_account as ba ON b.fk_account = ba.rowid';
|
$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bank_account as ba ON b.fk_account = ba.rowid';
|
||||||
$sql .= ' WHERE pf.fk_facture = ' . $object->id . ' AND p.fk_paiement = c.id AND pf.fk_paiement = p.rowid';
|
$sql .= ' WHERE pf.fk_facture = ' . $object->id . ' AND p.fk_paiement = c.id AND pf.fk_paiement = p.rowid';
|
||||||
|
$sql .= ' AND c.entity IN (' . getEntity('c_paiement').')';
|
||||||
$sql .= ' ORDER BY p.datep, p.tms';
|
$sql .= ' ORDER BY p.datep, p.tms';
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
@ -3810,18 +3816,21 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
if ($num > 0) {
|
if ($num > 0) {
|
||||||
while ($i < $num) {
|
while ($i < $num) {
|
||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
print '<tr class="oddeven"><td>';
|
|
||||||
$paymentstatic->id = $objp->rowid;
|
$paymentstatic->id = $objp->rowid;
|
||||||
$paymentstatic->datepaye = $db->jdate($objp->dp);
|
$paymentstatic->datepaye = $db->jdate($objp->dp);
|
||||||
$paymentstatic->ref = $objp->ref;
|
$paymentstatic->ref = $objp->ref;
|
||||||
$paymentstatic->num_paiement = $objp->num_paiement;
|
$paymentstatic->num_paiement = $objp->num_paiement;
|
||||||
$paymentstatic->payment_code = $objp->payment_code;
|
$paymentstatic->payment_code = $objp->payment_code;
|
||||||
|
|
||||||
|
print '<tr class="oddeven"><td>';
|
||||||
print $paymentstatic->getNomUrl(1);
|
print $paymentstatic->getNomUrl(1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>' . dol_print_date($db->jdate($objp->dp), 'day') . '</td>';
|
print '<td>' . dol_print_date($db->jdate($objp->dp), 'day') . '</td>';
|
||||||
$label = ($langs->trans("PaymentType" . $objp->payment_code) != ("PaymentType" . $objp->payment_code)) ? $langs->trans("PaymentType" . $objp->payment_code) : $objp->payment_label;
|
$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_paiement . '</td>';
|
print '<td>' . $label . ' ' . $objp->num_paiement . '</td>';
|
||||||
if (! empty($conf->banque->enabled)) {
|
if (! empty($conf->banque->enabled))
|
||||||
|
{
|
||||||
$bankaccountstatic->id = $objp->baid;
|
$bankaccountstatic->id = $objp->baid;
|
||||||
$bankaccountstatic->ref = $objp->baref;
|
$bankaccountstatic->ref = $objp->baref;
|
||||||
$bankaccountstatic->label = $objp->baref;
|
$bankaccountstatic->label = $objp->baref;
|
||||||
@ -4324,7 +4333,7 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
// Delete
|
// Delete
|
||||||
if ($user->rights->facture->supprimer)
|
if ($user->rights->facture->supprimer)
|
||||||
{
|
{
|
||||||
if (! $object->is_erasable()) {
|
if ($object->is_erasable() <= 0) {
|
||||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="' . $langs->trans("DisabledBecauseNotErasable") . '">' . $langs->trans('Delete') . '</a></div>';
|
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="' . $langs->trans("DisabledBecauseNotErasable") . '">' . $langs->trans('Delete') . '</a></div>';
|
||||||
} else if ($objectidnext) {
|
} else if ($objectidnext) {
|
||||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="' . $langs->trans("DisabledBecauseReplacedInvoice") . '">' . $langs->trans('Delete') . '</a></div>';
|
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="' . $langs->trans("DisabledBecauseReplacedInvoice") . '">' . $langs->trans('Delete') . '</a></div>';
|
||||||
|
|||||||
@ -306,6 +306,56 @@ class Invoices extends DolibarrApi
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes a line of a given invoice
|
||||||
|
*
|
||||||
|
* @param int $id Id of invoice
|
||||||
|
* @param int $lineid Id of the line to delete
|
||||||
|
*
|
||||||
|
* @url DELETE {id}/lines/{lineid}
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
* @throws 400
|
||||||
|
* @throws 401
|
||||||
|
* @throws 404
|
||||||
|
* @throws 405
|
||||||
|
*/
|
||||||
|
function deleteLine($id, $lineid) {
|
||||||
|
|
||||||
|
if(! DolibarrApiAccess::$user->rights->facture->creer) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
if(empty($lineid)) {
|
||||||
|
throw new RestException(400, 'Line ID is mandatory');
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ! DolibarrApi::_checkAccessToResource('facture',$id)) {
|
||||||
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->invoice->fetch($id);
|
||||||
|
if( ! $result ) {
|
||||||
|
throw new RestException(404, 'Invoice not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->invoice->deleteline($lineid);
|
||||||
|
if( $result < 0) {
|
||||||
|
throw new RestException(405, $this->invoice->error);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->invoice->fetch($id);
|
||||||
|
|
||||||
|
$this->invoice->getLinesArray();
|
||||||
|
$result = array();
|
||||||
|
foreach ($this->invoice->lines as $line) {
|
||||||
|
array_push($result,$this->_cleanObjectDatas($line));
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a line to a given invoice
|
* Add a line to a given invoice
|
||||||
*
|
*
|
||||||
@ -314,7 +364,7 @@ class Invoices extends DolibarrApi
|
|||||||
* @param int $id Id of invoice
|
* @param int $id Id of invoice
|
||||||
* @param array $request_data Invoiceline data
|
* @param array $request_data Invoiceline data
|
||||||
*
|
*
|
||||||
* @url POST {id}/lines
|
* @url POST {id}/addline
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
@ -378,7 +428,59 @@ class Invoices extends DolibarrApi
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate an order
|
* Sets an invoice as draft
|
||||||
|
*
|
||||||
|
* @param int $id Order ID
|
||||||
|
* @param int $idwarehouse Warehouse ID
|
||||||
|
*
|
||||||
|
* @url POST {id}/settodraft
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*
|
||||||
|
* @throws 200
|
||||||
|
* @throws 304
|
||||||
|
* @throws 401
|
||||||
|
* @throws 404
|
||||||
|
* @throws 500
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function settodraft($id, $idwarehouse=-1)
|
||||||
|
{
|
||||||
|
if(! DolibarrApiAccess::$user->rights->facture->creer) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
$result = $this->invoice->fetch($id);
|
||||||
|
if( ! $result ) {
|
||||||
|
throw new RestException(404, 'Invoice not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
|
||||||
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->invoice->set_draft(DolibarrApiAccess::$user, $idwarehouse);
|
||||||
|
if ($result == 0) {
|
||||||
|
throw new RestException(304, 'Nothing done.');
|
||||||
|
}
|
||||||
|
if ($result < 0) {
|
||||||
|
throw new RestException(500, 'Error : '.$this->invoice->error);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->invoice->fetch($id);
|
||||||
|
if( ! $result ) {
|
||||||
|
throw new RestException(404, 'Invoice not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
|
||||||
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->_cleanObjectDatas($this->invoice);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validate an invoice
|
||||||
*
|
*
|
||||||
* @param int $id Order ID
|
* @param int $id Order ID
|
||||||
* @param int $idwarehouse Warehouse ID
|
* @param int $idwarehouse Warehouse ID
|
||||||
@ -411,20 +513,82 @@ class Invoices extends DolibarrApi
|
|||||||
|
|
||||||
$result = $this->invoice->validate(DolibarrApiAccess::$user, '', $idwarehouse, $notrigger);
|
$result = $this->invoice->validate(DolibarrApiAccess::$user, '', $idwarehouse, $notrigger);
|
||||||
if ($result == 0) {
|
if ($result == 0) {
|
||||||
throw new RestException(500, 'Error nothing done. May be object is already validated');
|
throw new RestException(304, 'Error nothing done. May be object is already validated');
|
||||||
}
|
}
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
throw new RestException(500, 'Error when validating Invoice: '.$this->invoice->error);
|
throw new RestException(500, 'Error when validating Invoice: '.$this->invoice->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
return array(
|
|
||||||
'success' => array(
|
$result = $this->invoice->fetch($id);
|
||||||
'code' => 200,
|
if( ! $result ) {
|
||||||
'message' => 'Invoice validated (Ref='.$this->invoice->ref.')'
|
throw new RestException(404, 'Invoice not found');
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
|
||||||
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->_cleanObjectDatas($this->invoice);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets an invoice as paid
|
||||||
|
*
|
||||||
|
* @param int $id Order ID
|
||||||
|
* @param string $close_code Code renseigne si on classe a payee completement alors que paiement incomplet (cas escompte par exemple)
|
||||||
|
* @param string $close_note Commentaire renseigne si on classe a payee alors que paiement incomplet (cas escompte par exemple)
|
||||||
|
*
|
||||||
|
* @url POST {id}/settopaid
|
||||||
|
*
|
||||||
|
* @return array An invoice object
|
||||||
|
*
|
||||||
|
* @throws 200
|
||||||
|
* @throws 304
|
||||||
|
* @throws 401
|
||||||
|
* @throws 404
|
||||||
|
* @throws 500
|
||||||
|
*/
|
||||||
|
function settopaid($id, $close_code='', $close_note='')
|
||||||
|
{
|
||||||
|
if(! DolibarrApiAccess::$user->rights->facture->creer) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
$result = $this->invoice->fetch($id);
|
||||||
|
if( ! $result ) {
|
||||||
|
throw new RestException(404, 'Invoice not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
|
||||||
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->invoice->set_paid(DolibarrApiAccess::$user, $close_code, $close_note);
|
||||||
|
if ($result == 0) {
|
||||||
|
throw new RestException(304, 'Error nothing done. May be object is already validated');
|
||||||
|
}
|
||||||
|
if ($result < 0) {
|
||||||
|
throw new RestException(500, 'Error : '.$this->invoice->error);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$result = $this->invoice->fetch($id);
|
||||||
|
if( ! $result ) {
|
||||||
|
throw new RestException(404, 'Invoice not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
|
||||||
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->_cleanObjectDatas($this->invoice);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clean sensible object datas
|
* Clean sensible object datas
|
||||||
*
|
*
|
||||||
|
|||||||
@ -262,8 +262,8 @@ class FactureRec extends CommonInvoice
|
|||||||
$sql.= ', c.code as cond_reglement_code, c.libelle as cond_reglement_libelle, c.libelle_facture as cond_reglement_libelle_doc';
|
$sql.= ', c.code as cond_reglement_code, c.libelle as cond_reglement_libelle, c.libelle_facture as cond_reglement_libelle_doc';
|
||||||
//$sql.= ', el.fk_source';
|
//$sql.= ', el.fk_source';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture_rec as f';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture_rec as f';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as c ON f.fk_cond_reglement = c.rowid';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as c ON f.fk_cond_reglement = c.rowid AND c.entity IN (' . getEntity('c_payment_term').')';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON f.fk_mode_reglement = p.id';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON f.fk_mode_reglement = p.id AND p.entity IN (' . getEntity('c_paiement').')';
|
||||||
//$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = f.rowid AND el.targettype = 'facture'";
|
//$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = f.rowid AND el.targettype = 'facture'";
|
||||||
if ($rowid) $sql.= ' WHERE f.rowid='.$rowid;
|
if ($rowid) $sql.= ' WHERE f.rowid='.$rowid;
|
||||||
elseif ($ref) $sql.= " WHERE f.titre='".$this->db->escape($ref)."'";
|
elseif ($ref) $sql.= " WHERE f.titre='".$this->db->escape($ref)."'";
|
||||||
|
|||||||
@ -1085,9 +1085,10 @@ class Facture extends CommonInvoice
|
|||||||
* @param string $moretitle Add more text to title tooltip
|
* @param string $moretitle Add more text to title tooltip
|
||||||
* @param int $notooltip 1=Disable tooltip
|
* @param int $notooltip 1=Disable tooltip
|
||||||
* @param int $addlinktonotes 1=Add link to notes
|
* @param int $addlinktonotes 1=Add link to notes
|
||||||
|
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
||||||
* @return string String with URL
|
* @return string String with URL
|
||||||
*/
|
*/
|
||||||
function getNomUrl($withpicto=0,$option='',$max=0,$short=0,$moretitle='',$notooltip=0,$addlinktonotes=0)
|
function getNomUrl($withpicto=0, $option='', $max=0, $short=0, $moretitle='', $notooltip=0, $addlinktonotes=0, $save_lastsearch_value=-1)
|
||||||
{
|
{
|
||||||
global $langs, $conf, $user, $form;
|
global $langs, $conf, $user, $form;
|
||||||
|
|
||||||
@ -1100,6 +1101,14 @@ class Facture extends CommonInvoice
|
|||||||
|
|
||||||
if ($short) return $url;
|
if ($short) return $url;
|
||||||
|
|
||||||
|
if ($option !== 'nolink')
|
||||||
|
{
|
||||||
|
// Add param to save lastsearch_values or not
|
||||||
|
$add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
|
||||||
|
if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
|
||||||
|
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
|
||||||
|
}
|
||||||
|
|
||||||
$picto='bill';
|
$picto='bill';
|
||||||
if ($this->type == self::TYPE_REPLACEMENT) $picto.='r'; // Replacement invoice
|
if ($this->type == self::TYPE_REPLACEMENT) $picto.='r'; // Replacement invoice
|
||||||
if ($this->type == self::TYPE_CREDIT_NOTE) $picto.='a'; // Credit note
|
if ($this->type == self::TYPE_CREDIT_NOTE) $picto.='a'; // Credit note
|
||||||
@ -1197,8 +1206,8 @@ class Facture extends CommonInvoice
|
|||||||
$sql.= ', f.fk_incoterms, f.location_incoterms';
|
$sql.= ', f.fk_incoterms, f.location_incoterms';
|
||||||
$sql.= ", i.libelle as libelle_incoterms";
|
$sql.= ", i.libelle as libelle_incoterms";
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as c ON f.fk_cond_reglement = c.rowid';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as c ON f.fk_cond_reglement = c.rowid AND c.entity IN (' . getEntity('c_payment_term').')';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON f.fk_mode_reglement = p.id';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON f.fk_mode_reglement = p.id AND p.entity IN (' . getEntity('c_paiement').')';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON f.fk_incoterms = i.rowid';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON f.fk_incoterms = i.rowid';
|
||||||
$sql.= ' WHERE f.entity = '.$conf->entity;
|
$sql.= ' WHERE f.entity = '.$conf->entity;
|
||||||
if ($rowid) $sql.= " AND f.rowid=".$rowid;
|
if ($rowid) $sql.= " AND f.rowid=".$rowid;
|
||||||
@ -1737,20 +1746,24 @@ class Facture extends CommonInvoice
|
|||||||
* @param User $user User making the deletion.
|
* @param User $user User making the deletion.
|
||||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||||
* @param int $idwarehouse Id warehouse to use for stock change.
|
* @param int $idwarehouse Id warehouse to use for stock change.
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, 0=Refused, >0 if OK
|
||||||
*/
|
*/
|
||||||
function delete($user, $notrigger=0, $idwarehouse=-1)
|
function delete($user, $notrigger=0, $idwarehouse=-1)
|
||||||
{
|
{
|
||||||
global $langs,$conf;
|
global $langs,$conf;
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
|
||||||
if (empty($rowid)) $rowid=$this->id;
|
$rowid=$this->id;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::delete rowid=".$rowid, LOG_DEBUG);
|
dol_syslog(get_class($this)."::delete rowid=".$rowid.", ref=".$this->ref.", thirdparty=".$this->thirdparty->name, LOG_DEBUG);
|
||||||
|
|
||||||
// TODO Test if there is at least one payment. If yes, refuse to delete.
|
// Test to avoid invoice deletion (allowed if draft)
|
||||||
|
$test = $this->is_erasable();
|
||||||
|
|
||||||
|
if ($test <= 0) return $test;
|
||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
if (! $error && ! $notrigger)
|
if (! $error && ! $notrigger)
|
||||||
@ -2072,7 +2085,7 @@ class Facture extends CommonInvoice
|
|||||||
* @param string $force_number Reference to force on invoice
|
* @param string $force_number Reference to force on invoice
|
||||||
* @param int $idwarehouse Id of warehouse to use for stock decrease if option to decreasenon stock is on (0=no decrease)
|
* @param int $idwarehouse Id of warehouse to use for stock decrease if option to decreasenon stock is on (0=no decrease)
|
||||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, 0=Nothing done because invoice is not a draft, >0 if OK
|
||||||
*/
|
*/
|
||||||
function validate($user, $force_number='', $idwarehouse=0, $notrigger=0)
|
function validate($user, $force_number='', $idwarehouse=0, $notrigger=0)
|
||||||
{
|
{
|
||||||
@ -2084,6 +2097,10 @@ class Facture extends CommonInvoice
|
|||||||
$error=0;
|
$error=0;
|
||||||
dol_syslog(get_class($this).'::validate user='.$user->id.', force_number='.$force_number.', idwarehouse='.$idwarehouse);
|
dol_syslog(get_class($this).'::validate user='.$user->id.', force_number='.$force_number.', idwarehouse='.$idwarehouse);
|
||||||
|
|
||||||
|
// Force to have object complete for checks
|
||||||
|
$this->fetch_thirdparty();
|
||||||
|
$this->fetch_lines();
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if (! $this->brouillon)
|
if (! $this->brouillon)
|
||||||
{
|
{
|
||||||
@ -2106,9 +2123,6 @@ class Facture extends CommonInvoice
|
|||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$this->fetch_thirdparty();
|
|
||||||
$this->fetch_lines();
|
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if ($this->type == self::TYPE_REPLACEMENT) // si facture de remplacement
|
if ($this->type == self::TYPE_REPLACEMENT) // si facture de remplacement
|
||||||
{
|
{
|
||||||
@ -3167,6 +3181,7 @@ class Facture extends CommonInvoice
|
|||||||
//$sql.= ' WHERE pf.'.$field.' = 1';
|
//$sql.= ' WHERE pf.'.$field.' = 1';
|
||||||
$sql.= ' AND pf.'.$field2.' = p.rowid';
|
$sql.= ' AND pf.'.$field2.' = p.rowid';
|
||||||
$sql.= ' AND p.fk_paiement = t.id';
|
$sql.= ' AND p.fk_paiement = t.id';
|
||||||
|
$sql.= ' AND t.entity IN (' . getEntity('c_paiement').')';
|
||||||
if ($filtertype) $sql.=" AND t.code='PRE'";
|
if ($filtertype) $sql.=" AND t.code='PRE'";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::getListOfPayments", LOG_DEBUG);
|
dol_syslog(get_class($this)."::getListOfPayments", LOG_DEBUG);
|
||||||
@ -3213,6 +3228,8 @@ class Facture extends CommonInvoice
|
|||||||
|
|
||||||
if (! empty($conf->global->FACTURE_ADDON))
|
if (! empty($conf->global->FACTURE_ADDON))
|
||||||
{
|
{
|
||||||
|
dol_syslog("Call getNextNumRef with FACTURE_ADDON = ".$conf->global->FACTURE_ADDON.", thirdparty=".$soc->nom.", type=".$soc->typent_code, LOG_DEBUG);
|
||||||
|
|
||||||
$mybool=false;
|
$mybool=false;
|
||||||
|
|
||||||
$file = $conf->global->FACTURE_ADDON.".php";
|
$file = $conf->global->FACTURE_ADDON.".php";
|
||||||
@ -3356,40 +3373,49 @@ class Facture extends CommonInvoice
|
|||||||
/**
|
/**
|
||||||
* Return if an invoice can be deleted
|
* Return if an invoice can be deleted
|
||||||
* Rule is:
|
* Rule is:
|
||||||
* If hidden option INVOICE_CAN_ALWAYS_BE_REMOVED is on, we can
|
|
||||||
* If invoice has a definitive ref, is last, without payment and not dipatched into accountancy -> yes end of rule
|
|
||||||
* If invoice is draft and ha a temporary ref -> yes
|
* If invoice is draft and ha a temporary ref -> yes
|
||||||
|
* If hidden option INVOICE_CAN_ALWAYS_BE_REMOVED is on, we can. If hidden option INVOICE_CAN_NEVER_BE_REMOVED is on, we can't.
|
||||||
|
* If invoice has a definitive ref, is last, without payment and not dipatched into accountancy -> yes end of rule
|
||||||
*
|
*
|
||||||
* @return int <0 if KO, 0=no, 1=yes
|
* @return int <0 if KO, 0=no, >0=yes
|
||||||
*/
|
*/
|
||||||
function is_erasable()
|
function is_erasable()
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
if (! empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED)) return 1;
|
// we check if invoice is a temporary number (PROVxxxx)
|
||||||
|
$tmppart = substr($this->ref, 1, 4);
|
||||||
|
|
||||||
|
if ($this->statut == self::STATUS_DRAFT && $tmppart === 'PROV') // If draft invoice and ref not yet defined
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED)) return 2;
|
||||||
if (! empty($conf->global->INVOICE_CAN_NEVER_BE_REMOVED)) return 0;
|
if (! empty($conf->global->INVOICE_CAN_NEVER_BE_REMOVED)) return 0;
|
||||||
|
|
||||||
// on verifie si la facture est en numerotation provisoire
|
// TODO Test if there is at least one payment. If yes, refuse to delete.
|
||||||
$facref = substr($this->ref, 1, 4);
|
// ...
|
||||||
|
|
||||||
// If not a draft invoice and not temporary invoice
|
// If not a draft invoice and not temporary invoice
|
||||||
if ($facref != 'PROV')
|
if ($tmppart !== 'PROV')
|
||||||
{
|
{
|
||||||
|
// We need to have this->thirdparty defined, in case of numbering rule use tags that depend on thirdparty (like {t} tag).
|
||||||
|
if (empty($this->thirdparty)) $this->fetch_thirdparty();
|
||||||
|
|
||||||
$maxfacnumber = $this->getNextNumRef($this->thirdparty,'last');
|
$maxfacnumber = $this->getNextNumRef($this->thirdparty,'last');
|
||||||
$ventilExportCompta = $this->getVentilExportCompta();
|
$ventilExportCompta = $this->getVentilExportCompta();
|
||||||
|
|
||||||
// If there is no invoice into the reset range and not already dispatched, we can delete
|
// If there is no invoice into the reset range and not already dispatched, we can delete
|
||||||
if ($maxfacnumber == '' && $ventilExportCompta == 0) return 1;
|
if ($maxfacnumber == '' && $ventilExportCompta == 0) return 3;
|
||||||
// If invoice to delete is last one and not already dispatched, we can delete
|
// If invoice to delete is last one and not already dispatched, we can delete
|
||||||
if ($maxfacnumber == $this->ref && $ventilExportCompta == 0) return 1;
|
if ($maxfacnumber == $this->ref && $ventilExportCompta == 0) return 4;
|
||||||
|
|
||||||
if ($this->situation_cycle_ref) {
|
if ($this->situation_cycle_ref) {
|
||||||
$last = $this->is_last_in_cycle();
|
$last = $this->is_last_in_cycle();
|
||||||
return $last;
|
return $last;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ($this->statut == self::STATUS_DRAFT && $facref == 'PROV') // Si facture brouillon et provisoire
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -3649,7 +3675,7 @@ class Facture extends CommonInvoice
|
|||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
// Force payment mode of invoice to withdraw
|
// Force payment mode of invoice to withdraw
|
||||||
$payment_mode_id = dol_getIdFromCode($this->db, 'PRE', 'c_paiement');
|
$payment_mode_id = dol_getIdFromCode($this->db, 'PRE', 'c_paiement', 'code', 'id', 1);
|
||||||
if ($payment_mode_id > 0)
|
if ($payment_mode_id > 0)
|
||||||
{
|
{
|
||||||
$result=$this->setPaymentMethods($payment_mode_id);
|
$result=$this->setPaymentMethods($payment_mode_id);
|
||||||
|
|||||||
@ -91,6 +91,7 @@ class PaymentTerm // extends CommonObject
|
|||||||
// Insert request
|
// Insert request
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."c_payment_term(";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."c_payment_term(";
|
||||||
$sql.= "rowid,";
|
$sql.= "rowid,";
|
||||||
|
$sql.= "entity,";
|
||||||
$sql.= "code,";
|
$sql.= "code,";
|
||||||
$sql.= "sortorder,";
|
$sql.= "sortorder,";
|
||||||
$sql.= "active,";
|
$sql.= "active,";
|
||||||
@ -101,6 +102,7 @@ class PaymentTerm // extends CommonObject
|
|||||||
$sql.= "decalage";
|
$sql.= "decalage";
|
||||||
$sql.= ") VALUES (";
|
$sql.= ") VALUES (";
|
||||||
$sql.= " ".(! isset($this->rowid)?'NULL':"'".$this->db->escape($this->rowid)."'").",";
|
$sql.= " ".(! isset($this->rowid)?'NULL':"'".$this->db->escape($this->rowid)."'").",";
|
||||||
|
$sql.= " ".(! isset($this->entity)?getEntity('c_payment_term'):"'".$this->db->escape($this->entity)."'").",";
|
||||||
$sql.= " ".(! isset($this->code)?'NULL':"'".$this->db->escape($this->code)."'").",";
|
$sql.= " ".(! isset($this->code)?'NULL':"'".$this->db->escape($this->code)."'").",";
|
||||||
$sql.= " ".(! isset($this->sortorder)?'NULL':"'".$this->db->escape($this->sortorder)."'").",";
|
$sql.= " ".(! isset($this->sortorder)?'NULL':"'".$this->db->escape($this->sortorder)."'").",";
|
||||||
$sql.= " ".(! isset($this->active)?'NULL':"'".$this->db->escape($this->active)."'").",";
|
$sql.= " ".(! isset($this->active)?'NULL':"'".$this->db->escape($this->active)."'").",";
|
||||||
@ -165,6 +167,7 @@ class PaymentTerm // extends CommonObject
|
|||||||
global $langs;
|
global $langs;
|
||||||
$sql = "SELECT";
|
$sql = "SELECT";
|
||||||
$sql.= " t.rowid,";
|
$sql.= " t.rowid,";
|
||||||
|
$sql.= " t.entity";
|
||||||
|
|
||||||
$sql.= " t.code,";
|
$sql.= " t.code,";
|
||||||
$sql.= " t.sortorder,";
|
$sql.= " t.sortorder,";
|
||||||
@ -178,6 +181,7 @@ class PaymentTerm // extends CommonObject
|
|||||||
|
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_payment_term as t";
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_payment_term as t";
|
||||||
$sql.= " WHERE t.rowid = ".$id;
|
$sql.= " WHERE t.rowid = ".$id;
|
||||||
|
$sql.= " AND t.entity = " . getEntity('c_payment_term');
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
@ -227,6 +231,7 @@ class PaymentTerm // extends CommonObject
|
|||||||
$sql.= " t.rowid";
|
$sql.= " t.rowid";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_payment_term as t";
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_payment_term as t";
|
||||||
$sql.= " WHERE t.code = 'RECEP'";
|
$sql.= " WHERE t.code = 'RECEP'";
|
||||||
|
$sql.= " AND t.entity = " . getEntity('c_payment_term');
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::getDefaultId", LOG_DEBUG);
|
dol_syslog(get_class($this)."::getDefaultId", LOG_DEBUG);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
@ -258,6 +263,7 @@ class PaymentTerm // extends CommonObject
|
|||||||
function update($user=null, $notrigger=0)
|
function update($user=null, $notrigger=0)
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
@ -287,6 +293,7 @@ class PaymentTerm // extends CommonObject
|
|||||||
$sql.= " nbjour=".(isset($this->nbjour)?$this->nbjour:"null").",";
|
$sql.= " nbjour=".(isset($this->nbjour)?$this->nbjour:"null").",";
|
||||||
$sql.= " decalage=".(isset($this->decalage)?$this->decalage:"null")."";
|
$sql.= " decalage=".(isset($this->decalage)?$this->decalage:"null")."";
|
||||||
$sql.= " WHERE rowid = " . $this->id;
|
$sql.= " WHERE rowid = " . $this->id;
|
||||||
|
$sql.= " AND entity = " . getEntity('c_payment_term');
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
@ -301,12 +308,12 @@ class PaymentTerm // extends CommonObject
|
|||||||
// Uncomment this and change MYOBJECT to your own tag if you
|
// Uncomment this and change MYOBJECT to your own tag if you
|
||||||
// want this action call a trigger.
|
// want this action call a trigger.
|
||||||
|
|
||||||
//// Call triggers
|
// Call triggers
|
||||||
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||||
//$interface=new Interfaces($this->db);
|
//$interface=new Interfaces($this->db);
|
||||||
//$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf);
|
//$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf);
|
||||||
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||||
//// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -343,6 +350,7 @@ class PaymentTerm // extends CommonObject
|
|||||||
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."c_payment_term";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."c_payment_term";
|
||||||
$sql.= " WHERE rowid = " . $this->id;
|
$sql.= " WHERE rowid = " . $this->id;
|
||||||
|
$sql.= " AND t.entity = " . getEntity('c_payment_term');
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
|
|||||||
@ -144,7 +144,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
// Invoice content
|
// Invoice content
|
||||||
|
|
||||||
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
|
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
|
||||||
|
|
||||||
$morehtmlref='<div class="refidno">';
|
$morehtmlref='<div class="refidno">';
|
||||||
// Ref customer
|
// Ref customer
|
||||||
|
|||||||
@ -113,7 +113,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
// Invoice content
|
// Invoice content
|
||||||
|
|
||||||
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
|
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
|
||||||
|
|
||||||
$morehtmlref='<div class="refidno">';
|
$morehtmlref='<div class="refidno">';
|
||||||
// Ref customer
|
// Ref customer
|
||||||
|
|||||||
@ -1169,7 +1169,7 @@ else
|
|||||||
|
|
||||||
// Recurring invoice content
|
// Recurring invoice content
|
||||||
|
|
||||||
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/invoicetemplate_list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
|
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/invoicetemplate_list.php?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
|
||||||
|
|
||||||
$morehtmlref='';
|
$morehtmlref='';
|
||||||
if ($action != 'editref') $morehtmlref.=$form->editfieldkey($object->ref, 'ref', $object->ref, $object, $user->rights->facture->creer, '', '', 0, 2);
|
if ($action != 'editref') $morehtmlref.=$form->editfieldkey($object->ref, 'ref', $object->ref, $object, $user->rights->facture->creer, '', '', 0, 2);
|
||||||
|
|||||||
@ -58,7 +58,7 @@ $totalpaye = $object->getSommePaiement();
|
|||||||
|
|
||||||
// Invoice content
|
// Invoice content
|
||||||
|
|
||||||
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
|
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
|
||||||
|
|
||||||
$morehtmlref='<div class="refidno">';
|
$morehtmlref='<div class="refidno">';
|
||||||
// Ref customer
|
// Ref customer
|
||||||
|
|||||||
@ -138,7 +138,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
{
|
{
|
||||||
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -174,7 +174,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
{
|
{
|
||||||
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -81,7 +81,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
// Invoice content
|
// Invoice content
|
||||||
|
|
||||||
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
|
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
|
||||||
|
|
||||||
$morehtmlref='<div class="refidno">';
|
$morehtmlref='<div class="refidno">';
|
||||||
// Ref customer
|
// Ref customer
|
||||||
|
|||||||
@ -151,7 +151,7 @@ if ($object->id > 0)
|
|||||||
|
|
||||||
// Invoice content
|
// Invoice content
|
||||||
|
|
||||||
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
|
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
|
||||||
|
|
||||||
$morehtmlref='<div class="refidno">';
|
$morehtmlref='<div class="refidno">';
|
||||||
// Ref customer
|
// Ref customer
|
||||||
|
|||||||
@ -74,7 +74,7 @@ if ($mode == 'customer')
|
|||||||
if ($mode == 'supplier')
|
if ($mode == 'supplier')
|
||||||
{
|
{
|
||||||
$title=$langs->trans("BillsStatisticsSuppliers");
|
$title=$langs->trans("BillsStatisticsSuppliers");
|
||||||
$dir=$conf->fournisseur->dir_output.'/facture/temp';
|
$dir=$conf->fournisseur->facture->dir_temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
print load_fiche_titre($title, $mesg, 'title_accountancy.png');
|
print load_fiche_titre($title, $mesg, 'title_accountancy.png');
|
||||||
|
|||||||
@ -251,7 +251,7 @@ if (empty($reshook))
|
|||||||
$paiement->datepaye = $datepaye;
|
$paiement->datepaye = $datepaye;
|
||||||
$paiement->amounts = $amounts; // Array with all payments dispatching with invoice id
|
$paiement->amounts = $amounts; // Array with all payments dispatching with invoice id
|
||||||
$paiement->multicurrency_amounts = $multicurrency_amounts; // Array with all payments dispatching
|
$paiement->multicurrency_amounts = $multicurrency_amounts; // Array with all payments dispatching
|
||||||
$paiement->paiementid = dol_getIdFromCode($db,GETPOST('paiementcode'),'c_paiement');
|
$paiement->paiementid = dol_getIdFromCode($db,GETPOST('paiementcode'),'c_paiement','code','id',1);
|
||||||
$paiement->num_paiement = GETPOST('num_paiement');
|
$paiement->num_paiement = GETPOST('num_paiement');
|
||||||
$paiement->note = GETPOST('comment');
|
$paiement->note = GETPOST('comment');
|
||||||
|
|
||||||
@ -529,18 +529,16 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
|||||||
$sql = 'SELECT f.rowid as facid, f.facnumber, f.total_ttc, f.multicurrency_code, f.multicurrency_total_ttc, f.type,';
|
$sql = 'SELECT f.rowid as facid, f.facnumber, f.total_ttc, f.multicurrency_code, f.multicurrency_total_ttc, f.type,';
|
||||||
$sql.= ' f.datef as df, f.fk_soc as socid';
|
$sql.= ' f.datef as df, f.fk_soc as socid';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f';
|
||||||
|
$sql.= ' WHERE f.entity IN ('.getEntity('facture', $conf->entity).')';
|
||||||
if(!empty($conf->global->FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS)) {
|
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON (f.fk_soc = s.rowid)';
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql.= ' WHERE f.entity = '.$conf->entity;
|
|
||||||
$sql.= ' AND (f.fk_soc = '.$facture->socid;
|
$sql.= ' AND (f.fk_soc = '.$facture->socid;
|
||||||
|
// Can pay invoices of all child of parent company
|
||||||
if(!empty($conf->global->FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS) && !empty($facture->thirdparty->parent)) {
|
if(!empty($conf->global->FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS) && !empty($facture->thirdparty->parent)) {
|
||||||
$sql.= ' OR f.fk_soc IN (SELECT rowid FROM '.MAIN_DB_PREFIX.'societe WHERE parent = '.$facture->thirdparty->parent.')';
|
$sql.= ' OR f.fk_soc IN (SELECT rowid FROM '.MAIN_DB_PREFIX.'societe WHERE parent = '.$facture->thirdparty->parent.')';
|
||||||
}
|
}
|
||||||
|
// Can pay invoices of all child of myself
|
||||||
|
if(!empty($conf->global->FACTURE_PAYMENTS_ON_SUBSIDIARY_COMPANIES)){
|
||||||
|
$sql.= ' OR f.fk_soc IN (SELECT rowid FROM '.MAIN_DB_PREFIX.'societe WHERE parent = '.$facture->thirdparty->id.')';
|
||||||
|
}
|
||||||
$sql.= ') AND f.paye = 0';
|
$sql.= ') AND f.paye = 0';
|
||||||
$sql.= ' AND f.fk_statut = 1'; // Statut=0 => not validated, Statut=2 => canceled
|
$sql.= ' AND f.fk_statut = 1'; // Statut=0 => not validated, Statut=2 => canceled
|
||||||
if ($facture->type != 2)
|
if ($facture->type != 2)
|
||||||
@ -831,7 +829,8 @@ if (! GETPOST('action','aZ09'))
|
|||||||
$sql.=', f.rowid as facid, c.libelle as paiement_type, p.num_paiement';
|
$sql.=', f.rowid as facid, c.libelle as paiement_type, p.num_paiement';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiement as p, '.MAIN_DB_PREFIX.'facture as f, '.MAIN_DB_PREFIX.'c_paiement as c';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiement as p, '.MAIN_DB_PREFIX.'facture as f, '.MAIN_DB_PREFIX.'c_paiement as c';
|
||||||
$sql.= ' WHERE p.fk_facture = f.rowid AND p.fk_paiement = c.id';
|
$sql.= ' WHERE p.fk_facture = f.rowid AND p.fk_paiement = c.id';
|
||||||
$sql.= ' AND f.entity = '.$conf->entity;
|
$sql.= ' AND f.entity IN (' . getEntity('facture').')';
|
||||||
|
$sql.= ' AND c.entity IN (' . getEntity('c_paiement').')';
|
||||||
if ($socid)
|
if ($socid)
|
||||||
{
|
{
|
||||||
$sql.= ' AND f.fk_soc = '.$socid;
|
$sql.= ' AND f.fk_soc = '.$socid;
|
||||||
|
|||||||
@ -72,6 +72,7 @@ if ($socid)
|
|||||||
}
|
}
|
||||||
$sql.= " WHERE p.fk_paiement = c.id";
|
$sql.= " WHERE p.fk_paiement = c.id";
|
||||||
$sql.= " AND p.entity = " . $conf->entity;
|
$sql.= " AND p.entity = " . $conf->entity;
|
||||||
|
$sql.= " AND c.entity = " . getEntity('c_paiement');
|
||||||
if ($socid)
|
if ($socid)
|
||||||
{
|
{
|
||||||
$sql.= " AND f.fk_soc = ".$socid;
|
$sql.= " AND f.fk_soc = ".$socid;
|
||||||
|
|||||||
@ -533,6 +533,45 @@ class RemiseCheque extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Charge indicateurs this->nb de tableau de bord
|
||||||
|
*
|
||||||
|
* @return int <0 if ko, >0 if ok
|
||||||
|
*/
|
||||||
|
function load_state_board()
|
||||||
|
{
|
||||||
|
global $user;
|
||||||
|
|
||||||
|
if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe
|
||||||
|
|
||||||
|
$sql = "SELECT count(b.rowid) as nb";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
|
||||||
|
$sql.= ", ".MAIN_DB_PREFIX."bank_account as ba";
|
||||||
|
$sql.= " WHERE b.fk_account = ba.rowid";
|
||||||
|
$sql.= " AND ba.entity IN (".getEntity('bank_account').")";
|
||||||
|
$sql.= " AND b.fk_type = 'CHQ'";
|
||||||
|
$sql.= " AND b.amount > 0";
|
||||||
|
|
||||||
|
$resql=$this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
|
||||||
|
while ($obj=$this->db->fetch_object($resql))
|
||||||
|
{
|
||||||
|
$this->nb["cheques"]=$obj->nb;
|
||||||
|
}
|
||||||
|
$this->db->free($resql);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($this->db);
|
||||||
|
$this->error=$this->db->error();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build document
|
* Build document
|
||||||
*
|
*
|
||||||
@ -753,7 +792,7 @@ class RemiseCheque extends CommonObject
|
|||||||
$rejectedPayment = new Paiement($db);
|
$rejectedPayment = new Paiement($db);
|
||||||
$rejectedPayment->amounts = array();
|
$rejectedPayment->amounts = array();
|
||||||
$rejectedPayment->datepaye = $rejection_date;
|
$rejectedPayment->datepaye = $rejection_date;
|
||||||
$rejectedPayment->paiementid = dol_getIdFromCode($this->db, 'CHQ', 'c_paiement');
|
$rejectedPayment->paiementid = dol_getIdFromCode($this->db, 'CHQ', 'c_paiement','code','id',1);
|
||||||
$rejectedPayment->num_paiement = $payment->numero;
|
$rejectedPayment->num_paiement = $payment->numero;
|
||||||
|
|
||||||
while($obj = $db->fetch_object($resql))
|
while($obj = $db->fetch_object($resql))
|
||||||
|
|||||||
@ -203,7 +203,7 @@ if ($resql)
|
|||||||
|
|
||||||
// Bank
|
// Bank
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if ($objp->bid) print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries.php?account='.$objp->bid.'">'.img_object($langs->trans("ShowAccount"),'account').' '.$objp->label.'</a>';
|
if ($objp->bid) print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?account='.$objp->bid.'">'.img_object($langs->trans("ShowAccount"),'account').' '.$objp->label.'</a>';
|
||||||
else print ' ';
|
else print ' ';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
|
|||||||
@ -93,6 +93,7 @@ class Paiement extends CommonObject
|
|||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'c_paiement as c, '.MAIN_DB_PREFIX.'paiement as p';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'c_paiement as c, '.MAIN_DB_PREFIX.'paiement as p';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid ';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid ';
|
||||||
$sql.= ' WHERE p.fk_paiement = c.id';
|
$sql.= ' WHERE p.fk_paiement = c.id';
|
||||||
|
$sql.= ' AND c.entity IN (' . getEntity('c_paiement').')';
|
||||||
if ($id > 0)
|
if ($id > 0)
|
||||||
$sql.= ' AND p.rowid = '.$id;
|
$sql.= ' AND p.rowid = '.$id;
|
||||||
else if ($ref)
|
else if ($ref)
|
||||||
|
|||||||
@ -120,6 +120,7 @@ if (GETPOST("orphelins"))
|
|||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement";
|
||||||
$sql.= " WHERE p.fk_paiement = c.id";
|
$sql.= " WHERE p.fk_paiement = c.id";
|
||||||
$sql.= " AND p.entity = " . $conf->entity;
|
$sql.= " AND p.entity = " . $conf->entity;
|
||||||
|
$sql.= " AND c.entity = " . getEntity('c_paiement');
|
||||||
$sql.= " AND pf.fk_facture IS NULL";
|
$sql.= " AND pf.fk_facture IS NULL";
|
||||||
// Add where from hooks
|
// Add where from hooks
|
||||||
$parameters=array();
|
$parameters=array();
|
||||||
@ -151,6 +152,7 @@ else
|
|||||||
}
|
}
|
||||||
$sql.= " WHERE p.fk_paiement = c.id";
|
$sql.= " WHERE p.fk_paiement = c.id";
|
||||||
$sql.= " AND p.entity = " . $conf->entity;
|
$sql.= " AND p.entity = " . $conf->entity;
|
||||||
|
$sql.= " AND c.entity = " . getEntity('c_paiement');
|
||||||
if (! $user->rights->societe->client->voir && ! $socid)
|
if (! $user->rights->societe->client->voir && ! $socid)
|
||||||
{
|
{
|
||||||
$sql.= " AND sc.fk_user = " .$user->id;
|
$sql.= " AND sc.fk_user = " .$user->id;
|
||||||
|
|||||||
@ -60,18 +60,21 @@ if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm=='yes
|
|||||||
|
|
||||||
if (! $_POST["paiementtype"] > 0)
|
if (! $_POST["paiementtype"] > 0)
|
||||||
{
|
{
|
||||||
$mesg = $langs->trans("ErrorFieldRequired",$langs->transnoentities("PaymentMode"));
|
setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentities("PaymentMode")), null, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
|
$action = 'create';
|
||||||
}
|
}
|
||||||
if ($datepaye == '')
|
if ($datepaye == '')
|
||||||
{
|
{
|
||||||
$mesg = $langs->trans("ErrorFieldRequired",$langs->transnoentities("Date"));
|
setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentities("Date")), null, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
|
$action = 'create';
|
||||||
}
|
}
|
||||||
if (! empty($conf->banque->enabled) && ! $_POST["accountid"] > 0)
|
if (! empty($conf->banque->enabled) && ! $_POST["accountid"] > 0)
|
||||||
{
|
{
|
||||||
$mesg = $langs->trans("ErrorFieldRequired",$langs->transnoentities("AccountToCredit"));
|
setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentities("AccountToCredit")), null, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
|
$action = 'create';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -91,7 +94,8 @@ if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm=='yes
|
|||||||
if (count($amounts) <= 0)
|
if (count($amounts) <= 0)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$errmsg='ErrorNoPaymentDefined';
|
setEventMessages($langs->trans("ErrorNoPaymentDefined"), null, 'errors');
|
||||||
|
$action='create';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -112,18 +116,20 @@ if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm=='yes
|
|||||||
$paymentid = $paiement->create($user, (GETPOST('closepaidcontrib')=='on'?1:0));
|
$paymentid = $paiement->create($user, (GETPOST('closepaidcontrib')=='on'?1:0));
|
||||||
if ($paymentid < 0)
|
if ($paymentid < 0)
|
||||||
{
|
{
|
||||||
$errmsg=$paiement->error;
|
|
||||||
$error++;
|
$error++;
|
||||||
|
setEventMessages($paiement->error, null, 'errors');
|
||||||
|
$action='create';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$result=$paiement->addPaymentToBank($user,'payment_sc','(SocialContributionPayment)',$_POST['accountid'],'','');
|
$result=$paiement->addPaymentToBank($user,'payment_sc','(SocialContributionPayment)', GETPOST('accountid','int'),'','');
|
||||||
if (! $result > 0)
|
if (! ($result > 0))
|
||||||
{
|
{
|
||||||
$errmsg=$paiement->error;
|
|
||||||
$error++;
|
$error++;
|
||||||
|
setEventMessages($paiement->error, null, 'errors');
|
||||||
|
$action='create';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,7 +147,6 @@ if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm=='yes
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$_GET["action"]='create';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -44,10 +44,10 @@ if ($user->societe_id) $socid=$user->societe_id;
|
|||||||
// TODO ajouter regle pour restreindre acces paiement
|
// TODO ajouter regle pour restreindre acces paiement
|
||||||
//$result = restrictedArea($user, 'facture', $id,'');
|
//$result = restrictedArea($user, 'facture', $id,'');
|
||||||
|
|
||||||
$paiement = new PaymentSocialContribution($db);
|
$object = new PaymentSocialContribution($db);
|
||||||
if ($id > 0)
|
if ($id > 0)
|
||||||
{
|
{
|
||||||
$result=$paiement->fetch($id);
|
$result=$object->fetch($id);
|
||||||
if (! $result) dol_print_error($db,'Failed to get payment id '.$id);
|
if (! $result) dol_print_error($db,'Failed to get payment id '.$id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->tax->char
|
|||||||
{
|
{
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$result = $paiement->delete($user);
|
$result = $object->delete($user);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$db->commit();
|
$db->commit();
|
||||||
@ -70,7 +70,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->tax->char
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessages($paiement->error, $paiement->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -80,7 +80,7 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->tax->char
|
|||||||
{
|
{
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$result=$paiement->valide();
|
$result=$object->valide();
|
||||||
|
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
@ -103,12 +103,12 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->tax->char
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
header('Location: card.php?id='.$paiement->id);
|
header('Location: card.php?id='.$object->id);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessages($paiement->error, $paiement->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -137,14 +137,14 @@ $h++;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
dol_fiche_head($head, $hselected, $langs->trans("PaymentSocialContribution"), 0, 'payment');
|
dol_fiche_head($head, $hselected, $langs->trans("PaymentSocialContribution"), -1, 'payment');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Deletion confirmation of payment
|
* Deletion confirmation of payment
|
||||||
*/
|
*/
|
||||||
if ($action == 'delete')
|
if ($action == 'delete')
|
||||||
{
|
{
|
||||||
print $form->formconfirm('card.php?id='.$paiement->id, $langs->trans("DeletePayment"), $langs->trans("ConfirmDeletePayment"), 'confirm_delete','',0,2);
|
print $form->formconfirm('card.php?id='.$object->id, $langs->trans("DeletePayment"), $langs->trans("ConfirmDeletePayment"), 'confirm_delete','',0,2);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,41 +154,49 @@ if ($action == 'delete')
|
|||||||
if ($action == 'valide')
|
if ($action == 'valide')
|
||||||
{
|
{
|
||||||
$facid = $_GET['facid'];
|
$facid = $_GET['facid'];
|
||||||
print $form->formconfirm('card.php?id='.$paiement->id.'&facid='.$facid, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_valide','',0,2);
|
print $form->formconfirm('card.php?id='.$object->id.'&facid='.$facid, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_valide','',0,2);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/sociales/payments.php">' . $langs->trans("BackToList") . '</a>';
|
||||||
|
|
||||||
|
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'id', '');
|
||||||
|
|
||||||
|
|
||||||
|
print '<div class="fichecenter">';
|
||||||
|
print '<div class="underbanner clearboth"></div>';
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print '<tr><td class="titlefield">'.$langs->trans('Ref').'</td>';
|
/*print '<tr><td class="titlefield">'.$langs->trans('Ref').'</td>';
|
||||||
print '<td colspan="3">';
|
print '<td colspan="3">';
|
||||||
print $form->showrefnav($paiement,'id','',1,'rowid','id');
|
print $form->showrefnav($object,'id','',1,'rowid','id');
|
||||||
print '</td></tr>';
|
print '</td></tr>';*/
|
||||||
|
|
||||||
// Date
|
// Date
|
||||||
print '<tr><td>'.$langs->trans('Date').'</td><td colspan="3">'.dol_print_date($paiement->datep,'day').'</td></tr>';
|
print '<tr><td>'.$langs->trans('Date').'</td><td colspan="3">'.dol_print_date($object->datep,'day').'</td></tr>';
|
||||||
|
|
||||||
// Mode
|
// Mode
|
||||||
print '<tr><td>'.$langs->trans('Mode').'</td><td colspan="3">'.$langs->trans("PaymentType".$paiement->type_code).'</td></tr>';
|
print '<tr><td>'.$langs->trans('Mode').'</td><td colspan="3">'.$langs->trans("PaymentType".$object->type_code).'</td></tr>';
|
||||||
|
|
||||||
// Numero
|
// Numero
|
||||||
print '<tr><td>'.$langs->trans('Numero').'</td><td colspan="3">'.$paiement->num_paiement.'</td></tr>';
|
print '<tr><td>'.$langs->trans('Numero').'</td><td colspan="3">'.$object->num_paiement.'</td></tr>';
|
||||||
|
|
||||||
// Montant
|
// Montant
|
||||||
print '<tr><td>'.$langs->trans('Amount').'</td><td colspan="3">'.price($paiement->amount, 0, $outputlangs, 1, -1, -1, $conf->currency).'</td></tr>';
|
print '<tr><td>'.$langs->trans('Amount').'</td><td colspan="3">'.price($object->amount, 0, $outputlangs, 1, -1, -1, $conf->currency).'</td></tr>';
|
||||||
|
|
||||||
// Note
|
// Note
|
||||||
print '<tr><td>'.$langs->trans('Note').'</td><td colspan="3">'.nl2br($paiement->note).'</td></tr>';
|
print '<tr><td>'.$langs->trans('Note').'</td><td colspan="3">'.nl2br($object->note).'</td></tr>';
|
||||||
|
|
||||||
// Bank account
|
// Bank account
|
||||||
if (! empty($conf->banque->enabled))
|
if (! empty($conf->banque->enabled))
|
||||||
{
|
{
|
||||||
if ($paiement->bank_account)
|
if ($object->bank_account)
|
||||||
{
|
{
|
||||||
$bankline=new AccountLine($db);
|
$bankline=new AccountLine($db);
|
||||||
$bankline->fetch($paiement->bank_line);
|
$bankline->fetch($object->bank_line);
|
||||||
|
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>'.$langs->trans('BankTransactionLine').'</td>';
|
print '<td>'.$langs->trans('BankTransactionLine').'</td>';
|
||||||
@ -201,6 +209,10 @@ if (! empty($conf->banque->enabled))
|
|||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
dol_fiche_end();
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* List of social contributions payed
|
* List of social contributions payed
|
||||||
@ -211,7 +223,7 @@ $sql = 'SELECT f.rowid as scid, f.libelle, f.paye, f.amount as sc_amount, pf.amo
|
|||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiementcharge as pf,'.MAIN_DB_PREFIX.'chargesociales as f, '.MAIN_DB_PREFIX.'c_chargesociales as pc';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiementcharge as pf,'.MAIN_DB_PREFIX.'chargesociales as f, '.MAIN_DB_PREFIX.'c_chargesociales as pc';
|
||||||
$sql.= ' WHERE pf.fk_charge = f.rowid AND f.fk_type = pc.id';
|
$sql.= ' WHERE pf.fk_charge = f.rowid AND f.fk_type = pc.id';
|
||||||
$sql.= ' AND f.entity = '.$conf->entity;
|
$sql.= ' AND f.entity = '.$conf->entity;
|
||||||
$sql.= ' AND pf.rowid = '.$paiement->id;
|
$sql.= ' AND pf.rowid = '.$object->id;
|
||||||
|
|
||||||
dol_syslog("compta/payment_sc/card.php", LOG_DEBUG);
|
dol_syslog("compta/payment_sc/card.php", LOG_DEBUG);
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
@ -278,7 +290,6 @@ else
|
|||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_fiche_end();
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -289,7 +300,7 @@ print '<div class="tabsAction">';
|
|||||||
/*
|
/*
|
||||||
if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))
|
if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))
|
||||||
{
|
{
|
||||||
if ($user->societe_id == 0 && $paiement->statut == 0 && $_GET['action'] == '')
|
if ($user->societe_id == 0 && $object->statut == 0 && $_GET['action'] == '')
|
||||||
{
|
{
|
||||||
if ($user->rights->facture->paiement)
|
if ($user->rights->facture->paiement)
|
||||||
{
|
{
|
||||||
@ -299,7 +310,7 @@ if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($_GET['action'] == '')
|
if ($action == '')
|
||||||
{
|
{
|
||||||
if ($user->rights->tax->charges->supprimer)
|
if ($user->rights->tax->charges->supprimer)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -822,7 +822,7 @@ else
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as p";
|
||||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user_author";
|
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user_author";
|
||||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_expensereport as pe ON pe.fk_expensereport = p.rowid";
|
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_expensereport as pe ON pe.fk_expensereport = p.rowid";
|
||||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id";
|
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id AND c.entity = " . getEntity('c_paiement');
|
||||||
$sql.= " WHERE p.entity = ".getEntity('expensereport');
|
$sql.= " WHERE p.entity = ".getEntity('expensereport');
|
||||||
$sql.= " AND p.fk_statut>=5";
|
$sql.= " AND p.fk_statut>=5";
|
||||||
|
|
||||||
@ -906,7 +906,7 @@ else
|
|||||||
$sql = "SELECT p.societe as nom, p.firstname, p.lastname, date_format(p.datedon,'%Y-%m') as dm, sum(p.amount) as amount";
|
$sql = "SELECT p.societe as nom, p.firstname, p.lastname, date_format(p.datedon,'%Y-%m') as dm, sum(p.amount) as amount";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."don as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."don as p";
|
||||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_donation as pe ON pe.fk_donation = p.rowid";
|
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_donation as pe ON pe.fk_donation = p.rowid";
|
||||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id";
|
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id AND c.entity = " . getEntity('c_paiement');
|
||||||
$sql.= " WHERE p.entity = ".getEntity('donation');
|
$sql.= " WHERE p.entity = ".getEntity('donation');
|
||||||
$sql.= " AND fk_statut >= 2";
|
$sql.= " AND fk_statut >= 2";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -698,7 +698,7 @@ if (! empty($conf->expensereport->enabled) && ($modecompta == 'CREANCES-DETTES'
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as p";
|
||||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user_author";
|
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user_author";
|
||||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_expensereport as pe ON pe.fk_expensereport = p.rowid";
|
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_expensereport as pe ON pe.fk_expensereport = p.rowid";
|
||||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id";
|
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id AND c.entity = " . getEntity('c_paiement');
|
||||||
$sql.= " WHERE p.entity = ".getEntity('expensereport');
|
$sql.= " WHERE p.entity = ".getEntity('expensereport');
|
||||||
$sql.= " AND p.fk_statut>=5";
|
$sql.= " AND p.fk_statut>=5";
|
||||||
|
|
||||||
@ -761,7 +761,7 @@ if (! empty($conf->don->enabled) && ($modecompta == 'CREANCES-DETTES' || $modeco
|
|||||||
$sql = "SELECT p.societe as nom, p.firstname, p.lastname, date_format(pe.datep,'%Y-%m') as dm, sum(p.amount) as amount";
|
$sql = "SELECT p.societe as nom, p.firstname, p.lastname, date_format(pe.datep,'%Y-%m') as dm, sum(p.amount) as amount";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."don as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."don as p";
|
||||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_donation as pe ON pe.fk_donation = p.rowid";
|
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_donation as pe ON pe.fk_donation = p.rowid";
|
||||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id";
|
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id AND c.entity = " . getEntity('c_paiement');
|
||||||
$sql.= " WHERE p.entity = ".getEntity('donation');
|
$sql.= " WHERE p.entity = ".getEntity('donation');
|
||||||
$sql.= " AND fk_statut >= 2";
|
$sql.= " AND fk_statut >= 2";
|
||||||
if (! empty($date_start) && ! empty($date_end))
|
if (! empty($date_start) && ! empty($date_end))
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user