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
This commit is contained in:
commit
6e7e11ede4
133
dev/resources/sepa/test.xml
Normal file
133
dev/resources/sepa/test.xml
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.008.001.02" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<CstmrDrctDbtInitn>
|
||||||
|
<GrpHdr>
|
||||||
|
<MsgId>PREL20171012/REF10</MsgId>
|
||||||
|
<CreDtTm>2017-10-12T00:08:30</CreDtTm>
|
||||||
|
<NbOfTxs>2</NbOfTxs>
|
||||||
|
<CtrlSum>734.4</CtrlSum>
|
||||||
|
<InitgPty>
|
||||||
|
<Nm>MyBigCompany</Nm>
|
||||||
|
<Id>
|
||||||
|
<PrvtId>
|
||||||
|
<Othr>
|
||||||
|
<Id>FR76AAAAA</Id>
|
||||||
|
</Othr>
|
||||||
|
</PrvtId>
|
||||||
|
</Id>
|
||||||
|
</InitgPty>
|
||||||
|
</GrpHdr>
|
||||||
|
<PmtInf>
|
||||||
|
<PmtInfId>PREL20171012/ID00010-T171001</PmtInfId>
|
||||||
|
<PmtMtd>DD</PmtMtd>
|
||||||
|
<NbOfTxs>2</NbOfTxs>
|
||||||
|
<CtrlSum>734.4</CtrlSum>
|
||||||
|
<PmtTpInf>
|
||||||
|
<SvcLvl>
|
||||||
|
<Cd>SEPA</Cd>
|
||||||
|
</SvcLvl>
|
||||||
|
<LclInstrm>
|
||||||
|
<Cd>CORE</Cd>
|
||||||
|
</LclInstrm>
|
||||||
|
<SeqTp>RCUR</SeqTp>
|
||||||
|
</PmtTpInf>
|
||||||
|
<ReqdColltnDt>2017-10-12</ReqdColltnDt>
|
||||||
|
<Cdtr>
|
||||||
|
<Nm>MyBigCompany</Nm>
|
||||||
|
<PstlAdr>
|
||||||
|
<Ctry>FR</Ctry>
|
||||||
|
<AdrLine>Address1</AdrLine>
|
||||||
|
<AdrLine>Address2</AdrLine>
|
||||||
|
</PstlAdr>
|
||||||
|
</Cdtr>
|
||||||
|
<CdtrAcct>
|
||||||
|
<Id>
|
||||||
|
<IBAN>FR76123456</IBAN>
|
||||||
|
</Id>
|
||||||
|
</CdtrAcct>
|
||||||
|
<CdtrAgt>
|
||||||
|
<FinInstnId>
|
||||||
|
<BIC>BICABCDEF</BIC>
|
||||||
|
</FinInstnId>
|
||||||
|
</CdtrAgt>
|
||||||
|
<ChrgBr>SLEV</ChrgBr>
|
||||||
|
<CdtrSchmeId>
|
||||||
|
<Id>
|
||||||
|
<PrvtId>
|
||||||
|
<Othr>
|
||||||
|
<Id>FR76AAAAA</Id>
|
||||||
|
<SchmeNm>
|
||||||
|
<Prtry>SEPA</Prtry>
|
||||||
|
</SchmeNm>
|
||||||
|
</Othr>
|
||||||
|
</PrvtId>
|
||||||
|
</Id>
|
||||||
|
</CdtrSchmeId>
|
||||||
|
<DrctDbtTxInf>
|
||||||
|
<PmtId>
|
||||||
|
<EndToEndId>AS-FA1710-0416-000679</EndToEndId>
|
||||||
|
</PmtId>
|
||||||
|
<InstdAmt Ccy="EUR">540</InstdAmt>
|
||||||
|
<DrctDbtTx>
|
||||||
|
<MndtRltdInf>
|
||||||
|
<MndtId>RUM-CU1610-0001-3-1476058417</MndtId>
|
||||||
|
<DtOfSgntr>2016-10-10</DtOfSgntr>
|
||||||
|
<AmdmntInd>false</AmdmntInd>
|
||||||
|
</MndtRltdInf>
|
||||||
|
</DrctDbtTx>
|
||||||
|
<DbtrAgt>
|
||||||
|
<FinInstnId>
|
||||||
|
<BIC>BICXYZ</BIC>
|
||||||
|
</FinInstnId>
|
||||||
|
</DbtrAgt>
|
||||||
|
<Dbtr>
|
||||||
|
<Nm>CUSTOMER A</Nm>
|
||||||
|
<PstlAdr>
|
||||||
|
<Ctry>FR</Ctry>
|
||||||
|
<AdrLine>Mr abc</AdrLine>
|
||||||
|
</PstlAdr>
|
||||||
|
</Dbtr>
|
||||||
|
<DbtrAcct>
|
||||||
|
<Id>
|
||||||
|
<IBAN>FR123456</IBAN>
|
||||||
|
</Id>
|
||||||
|
</DbtrAcct>
|
||||||
|
<RmtInf>
|
||||||
|
<Ustrd>FA1710-0416</Ustrd>
|
||||||
|
</RmtInf>
|
||||||
|
</DrctDbtTxInf>
|
||||||
|
<DrctDbtTxInf>
|
||||||
|
<PmtId>
|
||||||
|
<EndToEndId>AS-FA1710-0415-000683</EndToEndId>
|
||||||
|
</PmtId>
|
||||||
|
<InstdAmt Ccy="EUR">194.4</InstdAmt>
|
||||||
|
<DrctDbtTx>
|
||||||
|
<MndtRltdInf>
|
||||||
|
<MndtId>RUM-CU1709-0011-4-1506525346</MndtId>
|
||||||
|
<DtOfSgntr>2017-09-27</DtOfSgntr>
|
||||||
|
<AmdmntInd>false</AmdmntInd>
|
||||||
|
</MndtRltdInf>
|
||||||
|
</DrctDbtTx>
|
||||||
|
<DbtrAgt>
|
||||||
|
<FinInstnId>
|
||||||
|
<BIC>BICJKL</BIC>
|
||||||
|
</FinInstnId>
|
||||||
|
</DbtrAgt>
|
||||||
|
<Dbtr>
|
||||||
|
<Nm>CUSTOMER2</Nm>
|
||||||
|
<PstlAdr>
|
||||||
|
<Ctry>FR</Ctry>
|
||||||
|
</PstlAdr>
|
||||||
|
</Dbtr>
|
||||||
|
<DbtrAcct>
|
||||||
|
<Id>
|
||||||
|
<IBAN>FR76123456</IBAN>
|
||||||
|
</Id>
|
||||||
|
</DbtrAcct>
|
||||||
|
<RmtInf>
|
||||||
|
<Ustrd>FA1710-0415</Ustrd>
|
||||||
|
</RmtInf>
|
||||||
|
</DrctDbtTxInf>
|
||||||
|
</PmtInf>
|
||||||
|
</CstmrDrctDbtInitn>
|
||||||
|
</Document>
|
||||||
@ -100,6 +100,7 @@ $fieldstosearchall = array(
|
|||||||
'd.note_public'=>'NotePublic',
|
'd.note_public'=>'NotePublic',
|
||||||
'd.note_private'=>'NotePrivate',
|
'd.note_private'=>'NotePrivate',
|
||||||
);
|
);
|
||||||
|
if($db->type == 'pgsql') unset($fieldstosearchall['d.rowid']);
|
||||||
$arrayfields=array(
|
$arrayfields=array(
|
||||||
'd.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
|
'd.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
|
||||||
'd.lastname'=>array('label'=>$langs->trans("Lastname"), 'checked'=>1),
|
'd.lastname'=>array('label'=>$langs->trans("Lastname"), 'checked'=>1),
|
||||||
|
|||||||
@ -193,14 +193,20 @@ if (empty($conf->global->MAIN_ENABLE_DEFAULT_VALUES))
|
|||||||
{
|
{
|
||||||
// Button off, click to enable
|
// Button off, click to enable
|
||||||
$enabledisablehtml.= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_DEFAULT_VALUES&value=1'.$param.'">';
|
$enabledisablehtml.= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_DEFAULT_VALUES&value=1'.$param.'">';
|
||||||
$enabledisablehtml.= img_picto($langs->trans("Disabled"),'switch_off');
|
//$enabledisablehtml.= img_picto($langs->trans("Disabled"),'switch_off');
|
||||||
|
$enabledisablehtml.='<span class="fa fa-toggle-off valignmiddle" style="font-size: 2em; color: #999;" alt="'.$langs->trans("Disabled").'">';
|
||||||
|
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $enabledisablehtml.=$langs->trans("EnableDefaultValues");
|
||||||
|
$enabledisablehtml.='</span>';
|
||||||
$enabledisablehtml.= '</a>';
|
$enabledisablehtml.= '</a>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Button on, click to disable
|
// Button on, click to disable
|
||||||
$enabledisablehtml.= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_DEFAULT_VALUES&value=0'.$param.'">';
|
$enabledisablehtml.= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_DEFAULT_VALUES&value=0'.$param.'">';
|
||||||
$enabledisablehtml.= img_picto($langs->trans("Activated"),'switch_on');
|
//$enabledisablehtml.= img_picto($langs->trans("Activated"),'switch_on');
|
||||||
|
$enabledisablehtml.='<span class="fa fa-toggle-on valignmiddle" style="font-size: 2em; color: #227722;" alt="'.$langs->trans("Activated").'">';
|
||||||
|
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $enabledisablehtml.=$langs->trans("DisableDefaultValues");
|
||||||
|
$enabledisablehtml.='</span>';
|
||||||
$enabledisablehtml.= '</a>';
|
$enabledisablehtml.= '</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2007-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2007-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2009-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2009-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
|
* Copyright (C) 2017 Frédéric France <frederic.france@free.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
|
||||||
@ -208,25 +209,34 @@ llxHeader('',$langs->trans("Setup"),$wikihelp);
|
|||||||
|
|
||||||
$param='&mode='.$mode;
|
$param='&mode='.$mode;
|
||||||
|
|
||||||
$enabledisablehtml = $langs->trans("EnableOverwriteTranslation").' ';
|
$enabledisablehtml='';
|
||||||
|
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $enabledisablehtml.= $langs->trans("EnableOverwriteTranslation").' ';
|
||||||
if (empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION))
|
if (empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION))
|
||||||
{
|
{
|
||||||
// Button off, click to enable
|
// Button off, click to enable
|
||||||
$enabledisablehtml.='<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_OVERWRITE_TRANSLATION&value=1'.$param.'">';
|
$enabledisablehtml.='<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_OVERWRITE_TRANSLATION&value=1'.$param.'">';
|
||||||
$enabledisablehtml.=img_picto($langs->trans("Disabled"),'switch_off');
|
//$enabledisablehtml.=img_picto($langs->trans("Disabled"),'switch_off');
|
||||||
|
$enabledisablehtml.='<span class="fa fa-toggle-off valignmiddle" style="font-size: 2em; color: #999;" alt="'.$langs->trans("Disabled").'">';
|
||||||
|
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $enabledisablehtml.=$langs->trans("EnableOverwriteTranslation");
|
||||||
|
$enabledisablehtml.='</span>';
|
||||||
$enabledisablehtml.='</a>';
|
$enabledisablehtml.='</a>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Button on, click to disable
|
// Button on, click to disable
|
||||||
$enabledisablehtml.='<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_OVERWRITE_TRANSLATION&value=0'.$param.'">';
|
$enabledisablehtml.='<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_OVERWRITE_TRANSLATION&value=0'.$param.'">';
|
||||||
$enabledisablehtml.=img_picto($langs->trans("Activated"),'switch_on');
|
//$enabledisablehtml.=img_picto($langs->trans("Activated"),'switch_on');
|
||||||
|
$enabledisablehtml.='<span class="fa fa-toggle-on valignmiddle" style="font-size: 2em; color: #227722;" alt="'.$langs->trans("Activated").'">';
|
||||||
|
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $enabledisablehtml.=$langs->trans("DisableOverwriteTranslation");
|
||||||
|
$enabledisablehtml.='</span>';
|
||||||
$enabledisablehtml.='</a>';
|
$enabledisablehtml.='</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("Translation"), $enabledisablehtml, 'title_setup');
|
print load_fiche_titre($langs->trans("Translation"), $enabledisablehtml, 'title_setup');
|
||||||
|
|
||||||
|
//print '<span class="opacitymedium">';
|
||||||
print $langs->trans("TranslationDesc")."<br>\n";
|
print $langs->trans("TranslationDesc")."<br>\n";
|
||||||
|
//print '</span>';
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
|
|
||||||
$current_language_code=$langs->defaultlang;
|
$current_language_code=$langs->defaultlang;
|
||||||
@ -259,11 +269,14 @@ if ($mode == 'overwrite')
|
|||||||
{
|
{
|
||||||
//print load_fiche_titre($langs->trans("TranslationOverwriteKey"), '', '')."\n";
|
//print load_fiche_titre($langs->trans("TranslationOverwriteKey"), '', '')."\n";
|
||||||
|
|
||||||
|
print '<div class="justify"><span class="opacitymedium">';
|
||||||
print img_info().' '.$langs->trans("SomeTranslationAreUncomplete");
|
print img_info().' '.$langs->trans("SomeTranslationAreUncomplete");
|
||||||
$urlwikitranslatordoc='https://wiki.dolibarr.org/index.php/Translator_documentation';
|
$urlwikitranslatordoc='https://wiki.dolibarr.org/index.php/Translator_documentation';
|
||||||
print ' ('.$langs->trans("SeeAlso").': <a href="'.$urlwikitranslatordoc.'" target="_blank">'.$urlwikitranslatordoc.'</a>)<br>';
|
print ' ('.$langs->trans("SeeAlso").': <a href="'.$urlwikitranslatordoc.'" target="_blank">'.$langs->trans("Here").'</a>)<br>';
|
||||||
print $langs->trans("TranslationOverwriteDesc",$langs->transnoentitiesnoconv("Language"),$langs->transnoentitiesnoconv("Key"),$langs->transnoentitiesnoconv("NewTranslationStringToShow"))."\n";
|
print $langs->trans("TranslationOverwriteDesc",$langs->transnoentitiesnoconv("Language"),$langs->transnoentitiesnoconv("Key"),$langs->transnoentitiesnoconv("NewTranslationStringToShow"))."\n";
|
||||||
print ' ('.$langs->trans("TranslationOverwriteDesc2").').'."<br>\n";
|
print ' ('.$langs->trans("TranslationOverwriteDesc2").').'."<br>\n";
|
||||||
|
print '</span></div>';
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
|
|
||||||
@ -291,9 +304,9 @@ if ($mode == 'overwrite')
|
|||||||
print $formadmin->select_language(GETPOST('langcode'), 'langcode', 0, null, 1, 0, $disablededit?1:0, 'maxwidthonsmartphone', 1);
|
print $formadmin->select_language(GETPOST('langcode'), 'langcode', 0, null, 1, 0, $disablededit?1:0, 'maxwidthonsmartphone', 1);
|
||||||
print '</td>'."\n";
|
print '</td>'."\n";
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print '<input type="text" class="flat maxwidthonsmartphone"'.$disablededit.' name="transkey" value="">';
|
print '<input type="text" class="flat maxwidthonsmartphone"'.$disablededit.' name="transkey" value="'.(!empty($transkey)?$transkey:"").'">';
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
print '<input type="text" class="quatrevingtpercent"'.$disablededit.' name="transvalue" value="">';
|
print '<input type="text" class="quatrevingtpercent"'.$disablededit.' name="transvalue" value="'.(!empty($transvalue)?$transvalue:"").'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
// Limit to superadmin
|
// Limit to superadmin
|
||||||
/*if (! empty($conf->multicompany->enabled) && !$user->entity)
|
/*if (! empty($conf->multicompany->enabled) && !$user->entity)
|
||||||
@ -319,7 +332,7 @@ if ($mode == 'overwrite')
|
|||||||
$sql = "SELECT rowid, entity, lang, transkey, transvalue";
|
$sql = "SELECT rowid, entity, lang, transkey, transvalue";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."overwrite_trans";
|
$sql.= " FROM ".MAIN_DB_PREFIX."overwrite_trans";
|
||||||
$sql.= " WHERE 1 = 1";
|
$sql.= " WHERE 1 = 1";
|
||||||
//$sql.= " AND entity IN (".$user->entity.",".$conf->entity.")";
|
$sql.= " AND entity IN (".getEntity('overwrite_trans').")";
|
||||||
$sql.= $db->order($sortfield, $sortorder);
|
$sql.= $db->order($sortfield, $sortorder);
|
||||||
|
|
||||||
dol_syslog("translation::select from table", LOG_DEBUG);
|
dol_syslog("translation::select from table", LOG_DEBUG);
|
||||||
@ -483,7 +496,7 @@ if ($mode == 'searchkey')
|
|||||||
//}
|
//}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
// Action column
|
// Action column
|
||||||
print '<td class="liste_titre nowrap" align="right">';
|
print '<td class="nowrap" align="right">';
|
||||||
$searchpicto=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1);
|
$searchpicto=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1);
|
||||||
print $searchpicto;
|
print $searchpicto;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
@ -508,9 +521,36 @@ if ($mode == 'searchkey')
|
|||||||
{
|
{
|
||||||
if ($val != $newlangfileonly->tab_translate[$key])
|
if ($val != $newlangfileonly->tab_translate[$key])
|
||||||
{
|
{
|
||||||
|
// retrieve rowid
|
||||||
|
$sql = "SELECT rowid";
|
||||||
|
$sql.= " FROM " . MAIN_DB_PREFIX . "overwrite_trans";
|
||||||
|
$sql.= " WHERE transkey = '".$key."'";
|
||||||
|
$sql.= " AND entity IN (" . getEntity('overwrite_trans') . ")";
|
||||||
|
dol_syslog("translation::select from table", LOG_DEBUG);
|
||||||
|
$result = $db->query($sql);
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object($result);
|
||||||
|
}
|
||||||
|
print '<a href="' . $_SERVER['PHP_SELF'] . '?rowid=' . $obj->rowid . '&entity=' . $conf->entity . '&action=edit">' . img_edit() . '</a>';
|
||||||
|
print ' ';
|
||||||
|
print '<a href="' . $_SERVER['PHP_SELF'] . '?rowid=' . $obj->rowid . '&entity=' . $conf->entity . '&action=delete">' . img_delete() . '</a>';
|
||||||
|
print ' ';
|
||||||
$htmltext = $langs->trans("OriginalValueWas", $newlangfileonly->tab_translate[$key]);
|
$htmltext = $langs->trans("OriginalValueWas", $newlangfileonly->tab_translate[$key]);
|
||||||
print $form->textwithpicto('', $htmltext, 1, 'info');
|
print $form->textwithpicto('', $htmltext, 1, 'info');
|
||||||
}
|
}
|
||||||
|
else if (!empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION))
|
||||||
|
{
|
||||||
|
//print $key.'-'.$val;
|
||||||
|
print '<a href="' . $_SERVER['PHP_SELF'] . '?mode=overwrite&langcode=' . $langcode . '&transkey=' . $key . '">' . img_edit_add($langs->trans("Overwrite")) . '</a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($conf->global->MAIN_FEATURES_LEVEL))
|
||||||
|
{
|
||||||
|
$transifexlangfile='$'; // $ means 'All'
|
||||||
|
$transifexurl = 'https://www.transifex.com/dolibarr-association/dolibarr/translate/#'.$langcode.'/'.$transifexlangfile.'?key='.$key;
|
||||||
|
print ' <a href="'.$transifexurl.'" target="transifex">'.img_picto('FixOnTransifex', 'object_globe').'</a>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -69,7 +69,7 @@ class DolibarrApiAccess implements iAuthenticate
|
|||||||
*/
|
*/
|
||||||
public function __isAllowed()
|
public function __isAllowed()
|
||||||
{
|
{
|
||||||
global $db;
|
global $conf, $db;
|
||||||
|
|
||||||
$login = '';
|
$login = '';
|
||||||
$stored_key = '';
|
$stored_key = '';
|
||||||
@ -100,10 +100,13 @@ class DolibarrApiAccess implements iAuthenticate
|
|||||||
|
|
||||||
if ($api_key)
|
if ($api_key)
|
||||||
{
|
{
|
||||||
|
$userentity = 0;
|
||||||
|
|
||||||
$sql = "SELECT u.login, u.datec, u.api_key, ";
|
$sql = "SELECT u.login, u.datec, u.api_key, ";
|
||||||
$sql.= " u.tms as date_modification, u.entity";
|
$sql.= " u.tms as date_modification, u.entity";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
|
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||||
$sql.= " WHERE u.api_key = '".$db->escape($api_key)."'";
|
$sql.= " WHERE u.api_key = '".$db->escape($api_key)."'";
|
||||||
|
// TODO Check if 2 users has same API key.
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
@ -113,24 +116,31 @@ class DolibarrApiAccess implements iAuthenticate
|
|||||||
$obj = $db->fetch_object($result);
|
$obj = $db->fetch_object($result);
|
||||||
$login = $obj->login;
|
$login = $obj->login;
|
||||||
$stored_key = $obj->api_key;
|
$stored_key = $obj->api_key;
|
||||||
|
$userentity = $obj->entity;
|
||||||
|
|
||||||
|
if (! defined("DOLENTITY")) // If API was not forced with HTTP_DOLENTITY, we set entity to entity of user
|
||||||
|
{
|
||||||
|
$conf->entity = ($obj->entity?$obj->entity:1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new RestException(503, 'Error when fetching user api_key :'.$db->error_msg);
|
throw new RestException(503, 'Error when fetching user api_key :'.$db->error_msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($stored_key != $api_key) {
|
if ($stored_key != $api_key) { // This should not happen since we did a search on api_key
|
||||||
$userClass::setCacheIdentifier($api_key);
|
$userClass::setCacheIdentifier($api_key);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $login)
|
if (! $login)
|
||||||
{
|
{
|
||||||
throw new RestException(503, 'Error when searching logn user fro mapi key');
|
throw new RestException(503, 'Error when searching login user from api key');
|
||||||
}
|
}
|
||||||
$fuser = new User($db);
|
$fuser = new User($db);
|
||||||
if(! $fuser->fetch('',$login)) {
|
$result = $fuser->fetch('', $login, '', 0, (empty($userentity) ? -1 : $conf->entity)); // If user is not entity 0, we search in working entity $conf->entity (that may have been forced to a different value than user entity)
|
||||||
throw new RestException(503, 'Error when fetching user :'.$fuser->error);
|
if ($result <= 0) {
|
||||||
|
throw new RestException(503, 'Error when fetching user :'.$fuser->error.' (conf->entity='.$conf->entity.')');
|
||||||
}
|
}
|
||||||
$fuser->getrights();
|
$fuser->getrights();
|
||||||
static::$user = $fuser;
|
static::$user = $fuser;
|
||||||
@ -143,7 +153,7 @@ class DolibarrApiAccess implements iAuthenticate
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new RestException(401, "Failed to login to API. No parameter 'DOLAPIKEY' on HTTP header (neither in URL).");
|
throw new RestException(401, "Failed to login to API. No parameter 'HTTP_DOLAPIKEY' on HTTP header (and no parameter DOLAPIKEY in URL).");
|
||||||
}
|
}
|
||||||
|
|
||||||
$userClass::setCacheIdentifier(static::$role);
|
$userClass::setCacheIdentifier(static::$role);
|
||||||
|
|||||||
@ -241,6 +241,7 @@ if (! empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/resources.json'
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$classfile = str_replace('_', '', $module);
|
$classfile = str_replace('_', '', $module);
|
||||||
|
if ($module == 'contracts') $moduledirforclass = 'contrat';
|
||||||
if ($module == 'supplierinvoices') $classfile = 'supplier_invoices';
|
if ($module == 'supplierinvoices') $classfile = 'supplier_invoices';
|
||||||
if ($module == 'supplierorders') $classfile = 'supplier_orders';
|
if ($module == 'supplierorders') $classfile = 'supplier_orders';
|
||||||
$dir_part_file = dol_buildpath('/'.$moduledirforclass.'/class/api_'.$classfile.'.class.php');
|
$dir_part_file = dol_buildpath('/'.$moduledirforclass.'/class/api_'.$classfile.'.class.php');
|
||||||
|
|||||||
@ -199,8 +199,8 @@ if ($action == 'add')
|
|||||||
$percentage=in_array(GETPOST('status'),array(-1,100))?GETPOST('status'):(in_array(GETPOST('complete'),array(-1,100))?GETPOST('complete'):GETPOST("percentage")); // If status is -1 or 100, percentage is not defined and we must use status
|
$percentage=in_array(GETPOST('status'),array(-1,100))?GETPOST('status'):(in_array(GETPOST('complete'),array(-1,100))?GETPOST('complete'):GETPOST("percentage")); // If status is -1 or 100, percentage is not defined and we must use status
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
$datep=dol_mktime($fulldayevent?'00':GETPOST("aphour"), $fulldayevent?'00':GETPOST("apmin"), 0, GETPOST("apmonth"), GETPOST("apday"), GETPOST("apyear"));
|
$datep=dol_mktime($fulldayevent?'00':GETPOST("aphour",'int'), $fulldayevent?'00':GETPOST("apmin",'int'), $fulldayevent?'00':GETPOST("apsec",'int'), GETPOST("apmonth",'int'), GETPOST("apday",'int'), GETPOST("apyear",'int'));
|
||||||
$datef=dol_mktime($fulldayevent?'23':GETPOST("p2hour"), $fulldayevent?'59':GETPOST("p2min"), $fulldayevent?'59':'0', GETPOST("p2month"), GETPOST("p2day"), GETPOST("p2year"));
|
$datef=dol_mktime($fulldayevent?'23':GETPOST("p2hour",'int'), $fulldayevent?'59':GETPOST("p2min",'int'), $fulldayevent?'59':GETPOST("apsec",'int'), GETPOST("p2month",'int'), GETPOST("p2day",'int'), GETPOST("p2year",'int'));
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if (! $datef && $percentage == 100)
|
if (! $datef && $percentage == 100)
|
||||||
|
|||||||
@ -2284,6 +2284,14 @@ if ($action == 'create')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create an intervention
|
||||||
|
if (! empty($conf->service->enabled) && ! empty($conf->ficheinter->enabled) && $object->statut == Propal::STATUS_SIGNED) {
|
||||||
|
if ($user->rights->ficheinter->creer) {
|
||||||
|
$langs->load("interventions");
|
||||||
|
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/fichinter/card.php?action=create&origin=' . $object->element . '&originid=' . $object->id . '&socid=' . $object->socid . '">' . $langs->trans("AddIntervention") . '</a></div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Create contract
|
// Create contract
|
||||||
if ($conf->contrat->enabled && $object->statut == Propal::STATUS_SIGNED) {
|
if ($conf->contrat->enabled && $object->statut == Propal::STATUS_SIGNED) {
|
||||||
$langs->load("contracts");
|
$langs->load("contracts");
|
||||||
|
|||||||
@ -287,7 +287,7 @@ class Proposals extends DolibarrApi
|
|||||||
);
|
);
|
||||||
|
|
||||||
if ($updateRes > 0) {
|
if ($updateRes > 0) {
|
||||||
return $this->get($id)->line->rowid;
|
return $updateRes;
|
||||||
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -1686,6 +1686,8 @@ if ($action == 'create' && $user->rights->commande->creer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
print '<tr><td>' . $langs->trans($newclassname) . '</td><td>' . $objectsrc->getNomUrl(1) . '</td></tr>';
|
print '<tr><td>' . $langs->trans($newclassname) . '</td><td>' . $objectsrc->getNomUrl(1) . '</td></tr>';
|
||||||
|
|
||||||
|
// Amount
|
||||||
print '<tr><td>' . $langs->trans('TotalHT') . '</td><td>' . price($objectsrc->total_ht) . '</td></tr>';
|
print '<tr><td>' . $langs->trans('TotalHT') . '</td><td>' . price($objectsrc->total_ht) . '</td></tr>';
|
||||||
print '<tr><td>' . $langs->trans('TotalVAT') . '</td><td>' . price($objectsrc->total_tva) . "</td></tr>";
|
print '<tr><td>' . $langs->trans('TotalVAT') . '</td><td>' . price($objectsrc->total_tva) . "</td></tr>";
|
||||||
if ($mysoc->localtax1_assuj == "1" || $objectsrc->total_localtax1 != 0) // Localtax1 RE
|
if ($mysoc->localtax1_assuj == "1" || $objectsrc->total_localtax1 != 0) // Localtax1 RE
|
||||||
|
|||||||
@ -316,7 +316,7 @@ class CommandeApi extends DolibarrApi
|
|||||||
);
|
);
|
||||||
|
|
||||||
if ($updateRes > 0) {
|
if ($updateRes > 0) {
|
||||||
return $this->get($id)->line->rowid;
|
return $updateRes;
|
||||||
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -286,7 +286,7 @@ class Orders extends DolibarrApi
|
|||||||
);
|
);
|
||||||
|
|
||||||
if ($updateRes > 0) {
|
if ($updateRes > 0) {
|
||||||
return $this->get($id)->line->rowid;
|
return $updateRes;
|
||||||
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -1240,7 +1240,7 @@ class Commande extends CommonOrder
|
|||||||
{
|
{
|
||||||
global $mysoc, $conf, $langs, $user;
|
global $mysoc, $conf, $langs, $user;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::addline commandeid=$this->id, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_percent=$remise_percent, info_bits=$info_bits, fk_remise_except=$fk_remise_except, price_base_type=$price_base_type, pu_ttc=$pu_ttc, date_start=$date_start, date_end=$date_end, type=$type special_code=$special_code, fk_unit=$fk_unit", LOG_DEBUG);
|
dol_syslog(get_class($this)."::addline commandeid=$this->id, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_percent=$remise_percent, info_bits=$info_bits, fk_remise_except=$fk_remise_except, price_base_type=$price_base_type, pu_ttc=$pu_ttc, date_start=$date_start, date_end=$date_end, type=$type special_code=$special_code, fk_unit=$fk_unit, origin=$origin, origin_id=$origin_id, pu_ht_devise=$pu_ht_devise", LOG_DEBUG);
|
||||||
|
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||||
|
|
||||||
|
|||||||
@ -1114,7 +1114,7 @@ if ($resql)
|
|||||||
$bankstatic->id=$banklinestatic->fk_account;
|
$bankstatic->id=$banklinestatic->fk_account;
|
||||||
$bankstatic->label=$banklinestatic->bank_account_ref;
|
$bankstatic->label=$banklinestatic->bank_account_ref;
|
||||||
print ' ('.$langs->trans("TransferFrom").' ';
|
print ' ('.$langs->trans("TransferFrom").' ';
|
||||||
print $bankstatic->getNomUrl(1);
|
print $bankstatic->getNomUrl(1,'transactions');
|
||||||
print ' '.$langs->trans("toward").' ';
|
print ' '.$langs->trans("toward").' ';
|
||||||
$bankstatic->id=$objp->bankid;
|
$bankstatic->id=$objp->bankid;
|
||||||
$bankstatic->label=$objp->bankref;
|
$bankstatic->label=$objp->bankref;
|
||||||
@ -1131,7 +1131,7 @@ if ($resql)
|
|||||||
$banklinestatic->fetch($links[$key]['url_id']);
|
$banklinestatic->fetch($links[$key]['url_id']);
|
||||||
$bankstatic->id=$banklinestatic->fk_account;
|
$bankstatic->id=$banklinestatic->fk_account;
|
||||||
$bankstatic->label=$banklinestatic->bank_account_ref;
|
$bankstatic->label=$banklinestatic->bank_account_ref;
|
||||||
print $bankstatic->getNomUrl(1);
|
print $bankstatic->getNomUrl(1,'transactions');
|
||||||
print ')';
|
print ')';
|
||||||
}
|
}
|
||||||
//var_dump($links);
|
//var_dump($links);
|
||||||
|
|||||||
@ -421,7 +421,7 @@ class Invoices extends DolibarrApi
|
|||||||
);
|
);
|
||||||
|
|
||||||
if ($updateRes > 0) {
|
if ($updateRes > 0) {
|
||||||
return $this->get($id)->line->rowid;
|
return $updateRes;
|
||||||
|
|
||||||
}
|
}
|
||||||
throw new RestException(400, 'Unable to insert the new line. Check your inputs.');
|
throw new RestException(400, 'Unable to insert the new line. Check your inputs.');
|
||||||
|
|||||||
@ -84,7 +84,7 @@ dol_mkdir($dir);
|
|||||||
$stats = new FactureStats($db, $socid, $mode, ($userid>0?$userid:0));
|
$stats = new FactureStats($db, $socid, $mode, ($userid>0?$userid:0));
|
||||||
if ($mode == 'customer')
|
if ($mode == 'customer')
|
||||||
{
|
{
|
||||||
if ($object_status != '' && $object_status >= -1) $stats->where .= ' AND f.fk_statut IN ('.$db->escape($object_status).')';
|
if ($object_status != '' && $object_status >= 0) $stats->where .= ' AND f.fk_statut IN ('.$db->escape($object_status).')';
|
||||||
}
|
}
|
||||||
if ($mode == 'supplier')
|
if ($mode == 'supplier')
|
||||||
{
|
{
|
||||||
@ -227,12 +227,13 @@ complete_head_from_modules($conf,$langs,null,$head,$h,$type);
|
|||||||
|
|
||||||
dol_fiche_head($head, 'byyear', $langs->trans("Statistics"), -1);
|
dol_fiche_head($head, 'byyear', $langs->trans("Statistics"), -1);
|
||||||
|
|
||||||
|
// We use select_thirdparty_list instead of select_company so we can use $filter and share same code for customer and supplier.
|
||||||
$tmp_companies = $form->select_thirdparty_list($socid, 'socid', $filter, 1, 0, 0, array(), '', 1);
|
$tmp_companies = $form->select_thirdparty_list($socid, 'socid', $filter, 1, 0, 0, array(), '', 1);
|
||||||
//Array passed as an argument to Form::selectarray to build a proper select input
|
//Array passed as an argument to Form::selectarray to build a proper select input
|
||||||
$companies = array();
|
$companies = array();
|
||||||
|
|
||||||
foreach ($tmp_companies as $value) {
|
foreach ($tmp_companies as $value) {
|
||||||
$companies[$value['value']] = $value['label'];
|
$companies[$value['key']] = $value['label'];
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<div class="fichecenter"><div class="fichethirdleft">';
|
print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||||
|
|||||||
@ -169,6 +169,20 @@ if ($action == 'create')
|
|||||||
$charge->paiementtype=$charge->mode_reglement_id?$charge->mode_reglement_id:$charge->paiementtype;
|
$charge->paiementtype=$charge->mode_reglement_id?$charge->mode_reglement_id:$charge->paiementtype;
|
||||||
|
|
||||||
$total = $charge->amount;
|
$total = $charge->amount;
|
||||||
|
if (! empty($conf->use_javascript_ajax))
|
||||||
|
{
|
||||||
|
print "\n".'<script type="text/javascript" language="javascript">';
|
||||||
|
|
||||||
|
//Add js for AutoFill
|
||||||
|
print ' $(document).ready(function () {';
|
||||||
|
print ' $(".AutoFillAmount").on(\'click touchstart\', function(){
|
||||||
|
var amount = $(this).data("value");
|
||||||
|
document.getElementById($(this).data(\'rowid\')).value = amount ;
|
||||||
|
});';
|
||||||
|
print ' });'."\n";
|
||||||
|
|
||||||
|
print ' </script>'."\n";
|
||||||
|
}
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("DoPayment"));
|
print load_fiche_titre($langs->trans("DoPayment"));
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
@ -188,14 +202,12 @@ if ($action == 'create')
|
|||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
print "<tr class=\"liste_titre\"><td colspan=\"2\">".$langs->trans("SocialContribution")."</td></tr>";
|
print '<tr><td class="titlefieldcreate">'.$langs->trans("Ref").'</td><td><a href="'.DOL_URL_ROOT.'/compta/sociales/card.php?id='.$chid.'">'.$chid.'</a></td></tr>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("Ref").'</td><td><a href="'.DOL_URL_ROOT.'/compta/sociales/card.php?id='.$chid.'">'.$chid.'</a></td></tr>';
|
|
||||||
print '<tr><td>'.$langs->trans("Type")."</td><td>".$charge->type_libelle."</td></tr>\n";
|
print '<tr><td>'.$langs->trans("Type")."</td><td>".$charge->type_libelle."</td></tr>\n";
|
||||||
print '<tr><td>'.$langs->trans("Period")."</td><td>".dol_print_date($charge->periode,'day')."</td></tr>\n";
|
print '<tr><td>'.$langs->trans("Period")."</td><td>".dol_print_date($charge->periode,'day')."</td></tr>\n";
|
||||||
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$charge->lib."</td></tr>\n";
|
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$charge->lib."</td></tr>\n";
|
||||||
print '<tr><td>'.$langs->trans("DateDue")."</td><td>".dol_print_date($charge->date_ech,'day')."</td></tr>\n";
|
/*print '<tr><td>'.$langs->trans("DateDue")."</td><td>".dol_print_date($charge->date_ech,'day')."</td></tr>\n";
|
||||||
print '<tr><td>'.$langs->trans("Amount")."</td><td>".price($charge->amount,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
|
print '<tr><td>'.$langs->trans("Amount")."</td><td>".price($charge->amount,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';*/
|
||||||
|
|
||||||
$sql = "SELECT sum(p.amount) as total";
|
$sql = "SELECT sum(p.amount) as total";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as p";
|
||||||
@ -207,12 +219,8 @@ if ($action == 'create')
|
|||||||
$sumpaid = $obj->total;
|
$sumpaid = $obj->total;
|
||||||
$db->free();
|
$db->free();
|
||||||
}
|
}
|
||||||
print '<tr><td>'.$langs->trans("AlreadyPaid").'</td><td>'.price($sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
|
/*print '<tr><td>'.$langs->trans("AlreadyPaid").'</td><td>'.price($sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
|
||||||
print '<tr><td class="tdtop">'.$langs->trans("RemainderToPay").'</td><td>'.price($total-$sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
|
print '<tr><td class="tdtop">'.$langs->trans("RemainderToPay").'</td><td>'.price($total-$sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';*/
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
print "<td colspan=\"2\">".$langs->trans("Payment").'</td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("Date").'</td><td>';
|
print '<tr><td class="fieldrequired">'.$langs->trans("Date").'</td><td>';
|
||||||
$datepaye = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
|
$datepaye = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
|
||||||
@ -294,7 +302,12 @@ if ($action == 'create')
|
|||||||
if ($sumpaid < $objp->amount)
|
if ($sumpaid < $objp->amount)
|
||||||
{
|
{
|
||||||
$namef = "amount_".$objp->id;
|
$namef = "amount_".$objp->id;
|
||||||
print '<input type="text" size="8" name="'.$namef.'">';
|
$nameRemain = "remain_".$objp->id;
|
||||||
|
if (!empty($conf->use_javascript_ajax))
|
||||||
|
print img_picto("Auto fill",'rightarrow', "class='AutoFillAmount' data-rowid='".$namef."' data-value='".($objp->amount - $sumpaid)."'");
|
||||||
|
$remaintopay=$objp->amount - $sumpaid;
|
||||||
|
print '<input type=hidden class="sum_remain" name="'.$nameRemain.'" value="'.$remaintopay.'">';
|
||||||
|
print '<input type="text" size="8" name="'.$namef.'" id="'.$namef.'">';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -654,7 +654,9 @@ if ($id > 0)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
print '<tr class="oddeven"><td colspan="'.$nbcols.'" class="opacitymedium">'.$langs->trans("None").'</td><td></td><td></td><td></td></tr>';
|
print '<tr class="oddeven"><td class="opacitymedium">'.$langs->trans("None").'</td>';
|
||||||
|
print '<td></td><td></td><td></td><td></td>';
|
||||||
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<tr><td colspan="'.$nbcols.'" align="right">'.$langs->trans("AlreadyPaid")." :</td><td align=\"right\">".price($totalpaye)."</td></tr>\n";
|
print '<tr><td colspan="'.$nbcols.'" align="right">'.$langs->trans("AlreadyPaid")." :</td><td align=\"right\">".price($totalpaye)."</td></tr>\n";
|
||||||
|
|||||||
@ -88,6 +88,7 @@ if ($action == 'setlib' && $user->rights->tax->charges->creer)
|
|||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -42,6 +42,8 @@ $socid = GETPOST('socid','int');
|
|||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
$result = restrictedArea($user, 'tax', $id, 'chargesociales','charges');
|
$result = restrictedArea($user, 'tax', $id, 'chargesociales','charges');
|
||||||
|
|
||||||
|
$object = new ChargeSociales($db);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
@ -68,7 +70,6 @@ $title = $langs->trans("SocialContribution") . ' - ' . $langs->trans("Info");
|
|||||||
$help_url = 'EN:Module_Taxes_and_social_contributions|FR:Module Taxes et dividendes|ES:Módulo Impuestos y cargas sociales (IVA, impuestos)';
|
$help_url = 'EN:Module_Taxes_and_social_contributions|FR:Module Taxes et dividendes|ES:Módulo Impuestos y cargas sociales (IVA, impuestos)';
|
||||||
llxHeader("",$title,$help_url);
|
llxHeader("",$title,$help_url);
|
||||||
|
|
||||||
$object = new ChargeSociales($db);
|
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$object->info($id);
|
$object->info($id);
|
||||||
|
|
||||||
|
|||||||
532
htdocs/contrat/class/api_contracts.class.php
Normal file
532
htdocs/contrat/class/api_contracts.class.php
Normal file
@ -0,0 +1,532 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||||
|
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
use Luracast\Restler\RestException;
|
||||||
|
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API class for contracts
|
||||||
|
*
|
||||||
|
* @access protected
|
||||||
|
* @class DolibarrApiAccess {@requires user,external}
|
||||||
|
*/
|
||||||
|
class Contracts extends DolibarrApi
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array $FIELDS Mandatory fields, checked when create and update object
|
||||||
|
*/
|
||||||
|
static $FIELDS = array(
|
||||||
|
'socid',
|
||||||
|
'date_contrat',
|
||||||
|
'commercial_signature_id',
|
||||||
|
'commercial_suivi_id'
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Contract $contract {@type Contrat}
|
||||||
|
*/
|
||||||
|
public $contract;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
function __construct()
|
||||||
|
{
|
||||||
|
global $db, $conf;
|
||||||
|
$this->db = $db;
|
||||||
|
$this->contract = new Contrat($this->db);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get properties of a contrat object
|
||||||
|
*
|
||||||
|
* Return an array with contrat informations
|
||||||
|
*
|
||||||
|
* @param int $id ID of contract
|
||||||
|
* @return array|mixed data without useless information
|
||||||
|
*
|
||||||
|
* @throws RestException
|
||||||
|
*/
|
||||||
|
function get($id)
|
||||||
|
{
|
||||||
|
if(! DolibarrApiAccess::$user->rights->contrat->lire) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->contract->fetch($id);
|
||||||
|
if( ! $result ) {
|
||||||
|
throw new RestException(404, 'Contract not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ! DolibarrApi::_checkAccessToResource('contrat',$this->contract->id)) {
|
||||||
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->contract->fetchObjectLinked();
|
||||||
|
return $this->_cleanObjectDatas($this->contract);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List contracts
|
||||||
|
*
|
||||||
|
* Get a list of contracts
|
||||||
|
*
|
||||||
|
* @param string $sortfield Sort field
|
||||||
|
* @param string $sortorder Sort order
|
||||||
|
* @param int $limit Limit for list
|
||||||
|
* @param int $page Page number
|
||||||
|
* @param string $thirdparty_ids Thirdparty ids to filter contracts of. {@example '1' or '1,2,3'} {@pattern /^[0-9,]*$/i}
|
||||||
|
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
|
||||||
|
* @return array Array of contract objects
|
||||||
|
*
|
||||||
|
* @throws RestException
|
||||||
|
*/
|
||||||
|
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '') {
|
||||||
|
global $db, $conf;
|
||||||
|
|
||||||
|
$obj_ret = array();
|
||||||
|
|
||||||
|
// case of external user, $thirdparty_ids param is ignored and replaced by user's socid
|
||||||
|
$socids = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $thirdparty_ids;
|
||||||
|
|
||||||
|
// If the internal user must only see his customers, force searching by him
|
||||||
|
$search_sale = 0;
|
||||||
|
if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) $search_sale = DolibarrApiAccess::$user->id;
|
||||||
|
|
||||||
|
$sql = "SELECT t.rowid";
|
||||||
|
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."contrat as t";
|
||||||
|
|
||||||
|
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
||||||
|
|
||||||
|
$sql.= ' WHERE t.entity IN ('.getEntity('contrat').')';
|
||||||
|
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc";
|
||||||
|
if ($socids) $sql.= " AND t.fk_soc IN (".$socids.")";
|
||||||
|
if ($search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
|
||||||
|
// Insert sale filter
|
||||||
|
if ($search_sale > 0)
|
||||||
|
{
|
||||||
|
$sql .= " AND sc.fk_user = ".$search_sale;
|
||||||
|
}
|
||||||
|
// Add sql filters
|
||||||
|
if ($sqlfilters)
|
||||||
|
{
|
||||||
|
if (! DolibarrApi::_checkFilters($sqlfilters))
|
||||||
|
{
|
||||||
|
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||||
|
}
|
||||||
|
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||||
|
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql.= $db->order($sortfield, $sortorder);
|
||||||
|
if ($limit) {
|
||||||
|
if ($page < 0)
|
||||||
|
{
|
||||||
|
$page = 0;
|
||||||
|
}
|
||||||
|
$offset = $limit * $page;
|
||||||
|
|
||||||
|
$sql.= $db->plimit($limit + 1, $offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
dol_syslog("API Rest request");
|
||||||
|
$result = $db->query($sql);
|
||||||
|
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
$num = $db->num_rows($result);
|
||||||
|
$min = min($num, ($limit <= 0 ? $num : $limit));
|
||||||
|
while ($i < $min)
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object($result);
|
||||||
|
$contrat_static = new Contrat($db);
|
||||||
|
if($contrat_static->fetch($obj->rowid)) {
|
||||||
|
$obj_ret[] = $this->_cleanObjectDatas($contrat_static);
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw new RestException(503, 'Error when retrieve contrat list : '.$db->lasterror());
|
||||||
|
}
|
||||||
|
if( ! count($obj_ret)) {
|
||||||
|
throw new RestException(404, 'No contract found');
|
||||||
|
}
|
||||||
|
return $obj_ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create contract object
|
||||||
|
*
|
||||||
|
* @param array $request_data Request data
|
||||||
|
* @return int ID of contrat
|
||||||
|
*/
|
||||||
|
function post($request_data = NULL)
|
||||||
|
{
|
||||||
|
if(! DolibarrApiAccess::$user->rights->contrat->creer) {
|
||||||
|
throw new RestException(401, "Insuffisant rights");
|
||||||
|
}
|
||||||
|
// Check mandatory fields
|
||||||
|
$result = $this->_validate($request_data);
|
||||||
|
|
||||||
|
foreach($request_data as $field => $value) {
|
||||||
|
$this->contract->$field = $value;
|
||||||
|
}
|
||||||
|
/*if (isset($request_data["lines"])) {
|
||||||
|
$lines = array();
|
||||||
|
foreach ($request_data["lines"] as $line) {
|
||||||
|
array_push($lines, (object) $line);
|
||||||
|
}
|
||||||
|
$this->contract->lines = $lines;
|
||||||
|
}*/
|
||||||
|
if ($this->contract->create(DolibarrApiAccess::$user) < 0) {
|
||||||
|
throw new RestException(500, "Error creating contract", array_merge(array($this->contract->error), $this->contract->errors));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->contract->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get lines of an contract
|
||||||
|
*
|
||||||
|
* @param int $id Id of contract
|
||||||
|
*
|
||||||
|
* @url GET {id}/lines
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
function getLines($id) {
|
||||||
|
if(! DolibarrApiAccess::$user->rights->contrat->lire) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->contract->fetch($id);
|
||||||
|
if( ! $result ) {
|
||||||
|
throw new RestException(404, 'Contract not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ! DolibarrApi::_checkAccessToResource('contrat',$this->contract->id)) {
|
||||||
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
|
}
|
||||||
|
$this->contract->getLinesArray();
|
||||||
|
$result = array();
|
||||||
|
foreach ($this->contract->lines as $line) {
|
||||||
|
array_push($result,$this->_cleanObjectDatas($line));
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a line to given contract
|
||||||
|
*
|
||||||
|
* @param int $id Id of contrat to update
|
||||||
|
* @param array $request_data Contractline data
|
||||||
|
*
|
||||||
|
* @url POST {id}/lines
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
function postLine($id, $request_data = NULL) {
|
||||||
|
if(! DolibarrApiAccess::$user->rights->contrat->creer) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->contract->fetch($id);
|
||||||
|
if( ! $result ) {
|
||||||
|
throw new RestException(404, 'Contract not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ! DolibarrApi::_checkAccessToResource('contrat',$this->contract->id)) {
|
||||||
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
|
}
|
||||||
|
$request_data = (object) $request_data;
|
||||||
|
$updateRes = $this->contract->addline(
|
||||||
|
$request_data->desc,
|
||||||
|
$request_data->subprice,
|
||||||
|
$request_data->qty,
|
||||||
|
$request_data->tva_tx,
|
||||||
|
$request_data->localtax1_tx,
|
||||||
|
$request_data->localtax2_tx,
|
||||||
|
$request_data->fk_product,
|
||||||
|
$request_data->remise_percent,
|
||||||
|
$request_data->date_start, // date ouverture = date_start_real
|
||||||
|
$request_data->date_end, // date_cloture = date_end_real
|
||||||
|
$request_data->HT,
|
||||||
|
$request_data->subprice_excl_tax,
|
||||||
|
$request_data->info_bits,
|
||||||
|
$request_data->fk_fournprice,
|
||||||
|
$request_data->pa_ht,
|
||||||
|
$request_data->array_options,
|
||||||
|
$request_data->fk_unit,
|
||||||
|
$request_data->rang
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($updateRes > 0) {
|
||||||
|
return $updateRes;
|
||||||
|
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update a line to given contract
|
||||||
|
*
|
||||||
|
* @param int $id Id of contrat to update
|
||||||
|
* @param int $lineid Id of line to update
|
||||||
|
* @param array $request_data Contractline data
|
||||||
|
*
|
||||||
|
* @url PUT {id}/lines/{lineid}
|
||||||
|
*
|
||||||
|
* @return object
|
||||||
|
*/
|
||||||
|
function putLine($id, $lineid, $request_data = NULL) {
|
||||||
|
if(! DolibarrApiAccess::$user->rights->contrat->creer) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->contract->fetch($id);
|
||||||
|
if( ! $result ) {
|
||||||
|
throw new RestException(404, 'Contrat not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ! DolibarrApi::_checkAccessToResource('contrat',$this->contract->id)) {
|
||||||
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
|
}
|
||||||
|
|
||||||
|
$request_data = (object) $request_data;
|
||||||
|
|
||||||
|
$updateRes = $this->contract->updateline(
|
||||||
|
$lineid,
|
||||||
|
$request_data->desc,
|
||||||
|
$request_data->subprice,
|
||||||
|
$request_data->qty,
|
||||||
|
$request_data->remise_percent,
|
||||||
|
$request_data->date_ouveture_prevue,
|
||||||
|
$request_data->date_fin_validite,
|
||||||
|
$request_data->tva_tx,
|
||||||
|
$request_data->localtax1_tx,
|
||||||
|
$request_data->localtax2_tx,
|
||||||
|
$request_data->date_ouverture,
|
||||||
|
$request_data->date_cloture,
|
||||||
|
'HT',
|
||||||
|
$request_data->info_bits,
|
||||||
|
$request_data->fk_fourn_price,
|
||||||
|
$request_data->pa_ht,
|
||||||
|
$request_data->array_options,
|
||||||
|
$request_data->fk_unit
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($updateRes > 0) {
|
||||||
|
$result = $this->get($id);
|
||||||
|
unset($result->line);
|
||||||
|
return $this->_cleanObjectDatas($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete a line to given contract
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param int $id Id of contract to update
|
||||||
|
* @param int $lineid Id of line to delete
|
||||||
|
*
|
||||||
|
* @url DELETE {id}/lines/{lineid}
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
* @throws 401
|
||||||
|
* @throws 404
|
||||||
|
*/
|
||||||
|
function deleteLine($id, $lineid) {
|
||||||
|
if(! DolibarrApiAccess::$user->rights->contrat->creer) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->contract->fetch($id);
|
||||||
|
if( ! $result ) {
|
||||||
|
throw new RestException(404, 'Contrat not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ! DolibarrApi::_checkAccessToResource('contrat',$this->contract->id)) {
|
||||||
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
|
}
|
||||||
|
|
||||||
|
$request_data = (object) $request_data;
|
||||||
|
$updateRes = $this->contract->deleteline($lineid, DolibarrApiAccess::$user);
|
||||||
|
if ($updateRes > 0) {
|
||||||
|
return $this->get($id);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update contract general fields (won't touch lines of contract)
|
||||||
|
*
|
||||||
|
* @param int $id Id of contrat to update
|
||||||
|
* @param array $request_data Datas
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
function put($id, $request_data = NULL) {
|
||||||
|
if(! DolibarrApiAccess::$user->rights->contrat->creer) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->contract->fetch($id);
|
||||||
|
if( ! $result ) {
|
||||||
|
throw new RestException(404, 'Contrat not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ! DolibarrApi::_checkAccessToResource('contrat',$this->contract->id)) {
|
||||||
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
|
}
|
||||||
|
foreach($request_data as $field => $value) {
|
||||||
|
if ($field == 'id') continue;
|
||||||
|
$this->contract->$field = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($this->contract->update(DolibarrApiAccess::$user, 0))
|
||||||
|
return $this->get($id);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete contract
|
||||||
|
*
|
||||||
|
* @param int $id Contract ID
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
function delete($id)
|
||||||
|
{
|
||||||
|
if(! DolibarrApiAccess::$user->rights->contrat->supprimer) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
$result = $this->contract->fetch($id);
|
||||||
|
if( ! $result ) {
|
||||||
|
throw new RestException(404, 'Contract not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ! DolibarrApi::_checkAccessToResource('contrat',$this->contract->id)) {
|
||||||
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ! $this->contract->delete(DolibarrApiAccess::$user)) {
|
||||||
|
throw new RestException(500, 'Error when delete contract : '.$this->contract->error);
|
||||||
|
}
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'success' => array(
|
||||||
|
'code' => 200,
|
||||||
|
'message' => 'Contract deleted'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validate an contract
|
||||||
|
*
|
||||||
|
* @param int $id Contract ID
|
||||||
|
* @param int $idwarehouse Warehouse ID
|
||||||
|
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||||
|
*
|
||||||
|
* @url POST {id}/validate
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
* FIXME An error 403 is returned if the request has an empty body.
|
||||||
|
* Error message: "Forbidden: Content type `text/plain` is not supported."
|
||||||
|
* Workaround: send this in the body
|
||||||
|
* {
|
||||||
|
* "idwarehouse": 0,
|
||||||
|
* "notrigger": 0
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
function validate($id, $idwarehouse=0, $notrigger=0)
|
||||||
|
{
|
||||||
|
if(! DolibarrApiAccess::$user->rights->contrat->creer) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
$result = $this->contract->fetch($id);
|
||||||
|
if( ! $result ) {
|
||||||
|
throw new RestException(404, 'Contract not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ! DolibarrApi::_checkAccessToResource('contrat',$this->contract->id)) {
|
||||||
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->contract->valid(DolibarrApiAccess::$user, $idwarehouse, $notrigger);
|
||||||
|
if ($result == 0) {
|
||||||
|
throw new RestException(500, 'Error nothing done. May be object is already validated');
|
||||||
|
}
|
||||||
|
if ($result < 0) {
|
||||||
|
throw new RestException(500, 'Error when validating Contract: '.$this->contract->error);
|
||||||
|
}
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'success' => array(
|
||||||
|
'code' => 200,
|
||||||
|
'message' => 'Contract validated (Ref='.$this->contract->ref.')'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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->address);
|
||||||
|
|
||||||
|
return $object;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validate fields before create or update object
|
||||||
|
*
|
||||||
|
* @param array $data Array with data to verify
|
||||||
|
* @return array
|
||||||
|
* @throws RestException
|
||||||
|
*/
|
||||||
|
function _validate($data)
|
||||||
|
{
|
||||||
|
$contrat = array();
|
||||||
|
foreach (Contracts::$FIELDS as $field) {
|
||||||
|
if (!isset($data[$field]))
|
||||||
|
throw new RestException(400, "$field field missing");
|
||||||
|
$contrat[$field] = $data[$field];
|
||||||
|
|
||||||
|
}
|
||||||
|
return $contrat;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1400,13 +1400,14 @@ class Contrat extends CommonObject
|
|||||||
* @param int $pa_ht Buying price HT
|
* @param int $pa_ht Buying price HT
|
||||||
* @param array $array_options extrafields array
|
* @param array $array_options extrafields array
|
||||||
* @param string $fk_unit Code of the unit to use. Null to use the default one
|
* @param string $fk_unit Code of the unit to use. Null to use the default one
|
||||||
* @return int <0 si erreur, >0 si ok
|
* @param string $rang Position
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $date_start, $date_end, $price_base_type='HT', $pu_ttc=0.0, $info_bits=0, $fk_fournprice=null, $pa_ht = 0,$array_options=0, $fk_unit = null)
|
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $date_start, $date_end, $price_base_type='HT', $pu_ttc=0.0, $info_bits=0, $fk_fournprice=null, $pa_ht = 0,$array_options=0, $fk_unit = null, $rang=0)
|
||||||
{
|
{
|
||||||
global $user, $langs, $conf, $mysoc;
|
global $user, $langs, $conf, $mysoc;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::addline $desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $date_start, $date_end, $price_base_type, $pu_ttc, $info_bits");
|
dol_syslog(get_class($this)."::addline $desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $date_start, $date_end, $price_base_type, $pu_ttc, $info_bits, $rang");
|
||||||
|
|
||||||
if ($this->statut >= 0)
|
if ($this->statut >= 0)
|
||||||
{
|
{
|
||||||
@ -1616,7 +1617,7 @@ class Contrat extends CommonObject
|
|||||||
{
|
{
|
||||||
global $user, $conf, $langs, $mysoc;
|
global $user, $conf, $langs, $mysoc;
|
||||||
|
|
||||||
// Nettoyage parametres
|
// Clean parameters
|
||||||
$qty=trim($qty);
|
$qty=trim($qty);
|
||||||
$desc=trim($desc);
|
$desc=trim($desc);
|
||||||
$desc=trim($desc);
|
$desc=trim($desc);
|
||||||
@ -1625,6 +1626,7 @@ class Contrat extends CommonObject
|
|||||||
$localtax1tx = price2num($localtax1tx);
|
$localtax1tx = price2num($localtax1tx);
|
||||||
$localtax2tx = price2num($localtax2tx);
|
$localtax2tx = price2num($localtax2tx);
|
||||||
$pa_ht=price2num($pa_ht);
|
$pa_ht=price2num($pa_ht);
|
||||||
|
if (empty($fk_fournprice)) $fk_fournprice=0;
|
||||||
|
|
||||||
$subprice = $price;
|
$subprice = $price;
|
||||||
$remise = 0;
|
$remise = 0;
|
||||||
@ -1701,7 +1703,7 @@ class Contrat extends CommonObject
|
|||||||
$sql.= ", total_localtax1='".price2num($total_localtax1)."'";
|
$sql.= ", total_localtax1='".price2num($total_localtax1)."'";
|
||||||
$sql.= ", total_localtax2='".price2num($total_localtax2)."'";
|
$sql.= ", total_localtax2='".price2num($total_localtax2)."'";
|
||||||
$sql.= ", total_ttc='". price2num($total_ttc)."'";
|
$sql.= ", total_ttc='". price2num($total_ttc)."'";
|
||||||
$sql.= ", fk_product_fournisseur_price='".$fk_fournprice."'";
|
$sql.= ", fk_product_fournisseur_price=".($fk_fournprice > 0 ? $fk_fournprice : "null");
|
||||||
$sql.= ", buy_price_ht='".price2num($pa_ht)."'";
|
$sql.= ", buy_price_ht='".price2num($pa_ht)."'";
|
||||||
if ($date_start > 0) { $sql.= ",date_ouverture_prevue='".$this->db->idate($date_start)."'"; }
|
if ($date_start > 0) { $sql.= ",date_ouverture_prevue='".$this->db->idate($date_start)."'"; }
|
||||||
else { $sql.=",date_ouverture_prevue=null"; }
|
else { $sql.=",date_ouverture_prevue=null"; }
|
||||||
@ -1772,7 +1774,7 @@ class Contrat extends CommonObject
|
|||||||
* @param User $user User that delete
|
* @param User $user User that delete
|
||||||
* @return int >0 if OK, <0 if KO
|
* @return int >0 if OK, <0 if KO
|
||||||
*/
|
*/
|
||||||
function deleteline($idline,$user)
|
function deleteline($idline, User $user)
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
@ -2343,6 +2345,16 @@ class Contrat extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an array of order lines
|
||||||
|
*
|
||||||
|
* @return int >0 if OK, <0 if KO
|
||||||
|
*/
|
||||||
|
function getLinesArray()
|
||||||
|
{
|
||||||
|
return $this->fetch_lines();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a document onto disk according to template module.
|
* Create a document onto disk according to template module.
|
||||||
*
|
*
|
||||||
@ -3051,8 +3063,8 @@ class ContratLigne extends CommonObjectLine
|
|||||||
else $sql.= ' null,';
|
else $sql.= ' null,';
|
||||||
if ($this->pa_ht > 0) $sql.= ' '.price2num($this->pa_ht);
|
if ($this->pa_ht > 0) $sql.= ' '.price2num($this->pa_ht);
|
||||||
else $sql.= ' null';
|
else $sql.= ' null';
|
||||||
if ($this->date_ouverture_prevue > 0) { $sql.= ",'".$this->db->idate($this->date_ouverture_prevue)."'"; }
|
if ($this->date_ouverture > 0) { $sql.= ",'".$this->db->idate($this->date_ouverture)."'"; }
|
||||||
if ($this->date_fin_validite > 0) { $sql.= ",'".$this->db->idate($this->date_fin_validite)."'"; }
|
if ($this->date_cloture > 0) { $sql.= ",'".$this->db->idate($this->date_cloture)."'"; }
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::insert", LOG_DEBUG);
|
dol_syslog(get_class($this)."::insert", LOG_DEBUG);
|
||||||
|
|||||||
@ -275,7 +275,8 @@ class CMailFile
|
|||||||
// comme des injections mail par les serveurs de messagerie.
|
// comme des injections mail par les serveurs de messagerie.
|
||||||
$this->headers = preg_replace("/([\r\n]+)$/i","",$this->headers);
|
$this->headers = preg_replace("/([\r\n]+)$/i","",$this->headers);
|
||||||
|
|
||||||
$this->message = $this->eol.'This is a message with multiple parts in MIME format.'.$this->eol;
|
//$this->message = $this->eol.'This is a message with multiple parts in MIME format.'.$this->eol;
|
||||||
|
$this->message = 'This is a message with multiple parts in MIME format.'.$this->eol;
|
||||||
$this->message.= $text_body . $files_encoded;
|
$this->message.= $text_body . $files_encoded;
|
||||||
$this->message.= "--" . $this->mixed_boundary . "--" . $this->eol;
|
$this->message.= "--" . $this->mixed_boundary . "--" . $this->eol;
|
||||||
}
|
}
|
||||||
@ -961,8 +962,8 @@ class CMailFile
|
|||||||
|
|
||||||
//$out.= "From: ".$this->getValidAddress($this->addr_from,3,1).$this->eol;
|
//$out.= "From: ".$this->getValidAddress($this->addr_from,3,1).$this->eol;
|
||||||
|
|
||||||
$out.= "Content-Type: multipart/mixed; boundary=\"".$this->mixed_boundary."\"".$this->eol2;
|
$out.= "Content-Type: multipart/mixed;".$this->eol2." boundary=\"".$this->mixed_boundary."\"".$this->eol2;
|
||||||
$out.= "Content-Transfer-Encoding: 8bit".$this->eol2;
|
$out.= "Content-Transfer-Encoding: 8bit".$this->eol2; // TODO Seems to be ignored. Header is 7bit once received.
|
||||||
|
|
||||||
dol_syslog("CMailFile::write_smtpheaders smtp_header=\n".$out);
|
dol_syslog("CMailFile::write_smtpheaders smtp_header=\n".$out);
|
||||||
return $out;
|
return $out;
|
||||||
@ -1014,23 +1015,23 @@ class CMailFile
|
|||||||
|
|
||||||
if ($this->atleastoneimage)
|
if ($this->atleastoneimage)
|
||||||
{
|
{
|
||||||
$out.= "Content-Type: multipart/alternative; boundary=\"".$this->alternative_boundary."\"".$this->eol;
|
$out.= "Content-Type: multipart/alternative;".$this->eol." boundary=\"".$this->alternative_boundary."\"".$this->eol;
|
||||||
$out.= $this->eol;
|
$out.= $this->eol;
|
||||||
$out.= "--" . $this->alternative_boundary . $this->eol;
|
$out.= "--" . $this->alternative_boundary . $this->eol;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make RFC821 Compliant, replace bare linefeeds
|
// Make RFC821 Compliant, replace bare linefeeds
|
||||||
$strContent = preg_replace("/(?<!\r)\n/si", "\r\n", $msgtext);
|
$strContent = preg_replace("/(?<!\r)\n/si", "\r\n", $msgtext); // PCRE modifier /s means new lines are common chars
|
||||||
if (! empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA))
|
if (! empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA))
|
||||||
{
|
{
|
||||||
$strContent = preg_replace("/\r\n/si", "\n", $strContent);
|
$strContent = preg_replace("/\r\n/si", "\n", $strContent); // PCRE modifier /s means new lines are common chars
|
||||||
}
|
}
|
||||||
|
|
||||||
$strContentAltText = '';
|
$strContentAltText = '';
|
||||||
if ($this->msgishtml)
|
if ($this->msgishtml)
|
||||||
{
|
{
|
||||||
$strContentAltText = html_entity_decode(strip_tags($strContent));
|
$strContentAltText = html_entity_decode(strip_tags($strContent));
|
||||||
$strContentAltText = rtrim(wordwrap($strContentAltText, 75, "\r\n"));
|
$strContentAltText = rtrim(wordwrap($strContentAltText, 75, empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA)?"\r\n":"\n"));
|
||||||
|
|
||||||
// Check if html header already in message, if not complete the message
|
// Check if html header already in message, if not complete the message
|
||||||
$strContent = $this->checkIfHTML($strContent);
|
$strContent = $this->checkIfHTML($strContent);
|
||||||
@ -1038,31 +1039,35 @@ class CMailFile
|
|||||||
|
|
||||||
// Make RFC2045 Compliant, split lines
|
// Make RFC2045 Compliant, split lines
|
||||||
//$strContent = rtrim(chunk_split($strContent)); // Function chunck_split seems ko if not used on a base64 content
|
//$strContent = rtrim(chunk_split($strContent)); // Function chunck_split seems ko if not used on a base64 content
|
||||||
$strContent = rtrim(wordwrap($strContent)); // TODO Using this method creates unexpected line break on text/plain content.
|
// TODO Encode main content into base64 and use the chunk_split, or quoted-printable
|
||||||
|
$strContent = rtrim(wordwrap($strContent, 75, empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA)?"\r\n":"\n")); // TODO Using this method creates unexpected line break on text/plain content.
|
||||||
|
|
||||||
if ($this->msgishtml)
|
if ($this->msgishtml)
|
||||||
{
|
{
|
||||||
if ($this->atleastoneimage)
|
if ($this->atleastoneimage)
|
||||||
{
|
{
|
||||||
$out.= "Content-Type: text/plain; charset=".$conf->file->character_set_client.$this->eol;
|
$out.= "Content-Type: text/plain; charset=".$conf->file->character_set_client.$this->eol;
|
||||||
|
//$out.= "Content-Transfer-Encoding: 7bit".$this->eol;
|
||||||
$out.= $this->eol.($strContentAltText?$strContentAltText:strip_tags($strContent)).$this->eol; // Add plain text message
|
$out.= $this->eol.($strContentAltText?$strContentAltText:strip_tags($strContent)).$this->eol; // Add plain text message
|
||||||
$out.= "--" . $this->alternative_boundary . $this->eol;
|
$out.= "--" . $this->alternative_boundary . $this->eol;
|
||||||
$out.= "Content-Type: multipart/related; boundary=\"".$this->related_boundary."\"".$this->eol;
|
$out.= "Content-Type: multipart/related;".$this->eol." boundary=\"".$this->related_boundary."\"".$this->eol;
|
||||||
$out.= $this->eol;
|
$out.= $this->eol;
|
||||||
$out.= "--" . $this->related_boundary . $this->eol;
|
$out.= "--" . $this->related_boundary . $this->eol;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $this->atleastoneimage && $strContentAltText && ! empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) // Add plain text message part before html part
|
if (! $this->atleastoneimage && $strContentAltText && ! empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) // Add plain text message part before html part
|
||||||
{
|
{
|
||||||
$out.= "Content-Type: multipart/alternative; boundary=\"".$this->alternative_boundary."\"".$this->eol;
|
$out.= "Content-Type: multipart/alternative;".$this->eol." boundary=\"".$this->alternative_boundary."\"".$this->eol;
|
||||||
$out.= $this->eol;
|
$out.= $this->eol;
|
||||||
$out.= "--" . $this->alternative_boundary . $this->eol;
|
$out.= "--" . $this->alternative_boundary . $this->eol;
|
||||||
$out.= "Content-Type: text/plain; charset=".$conf->file->character_set_client.$this->eol;
|
$out.= "Content-Type: text/plain; charset=".$conf->file->character_set_client.$this->eol;
|
||||||
|
//$out.= "Content-Transfer-Encoding: 7bit".$this->eol;
|
||||||
$out.= $this->eol.$strContentAltText.$this->eol;
|
$out.= $this->eol.$strContentAltText.$this->eol;
|
||||||
$out.= "--" . $this->alternative_boundary . $this->eol;
|
$out.= "--" . $this->alternative_boundary . $this->eol;
|
||||||
}
|
}
|
||||||
|
|
||||||
$out.= "Content-Type: text/html; charset=".$conf->file->character_set_client.$this->eol;
|
$out.= "Content-Type: text/html; charset=".$conf->file->character_set_client.$this->eol;
|
||||||
|
//$out.= "Content-Transfer-Encoding: 7bit".$this->eol; // TODO Use base64
|
||||||
$out.= $this->eol.$strContent.$this->eol;
|
$out.= $this->eol.$strContent.$this->eol;
|
||||||
|
|
||||||
if (! $this->atleastoneimage && $strContentAltText && ! empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) // Add plain text message part after html part
|
if (! $this->atleastoneimage && $strContentAltText && ! empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) // Add plain text message part after html part
|
||||||
@ -1073,6 +1078,7 @@ class CMailFile
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$out.= "Content-Type: text/plain; charset=".$conf->file->character_set_client.$this->eol;
|
$out.= "Content-Type: text/plain; charset=".$conf->file->character_set_client.$this->eol;
|
||||||
|
//$out.= "Content-Transfer-Encoding: 7bit".$this->eol;
|
||||||
$out.= $this->eol.$strContent.$this->eol;
|
$out.= $this->eol.$strContent.$this->eol;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3690,11 +3690,12 @@ abstract class CommonObject
|
|||||||
* Return HTML table table of source object lines
|
* Return HTML table table of source object lines
|
||||||
* TODO Move this and previous function into output html class file (htmlline.class.php).
|
* TODO Move this and previous function into output html class file (htmlline.class.php).
|
||||||
* If lines are into a template, title must also be into a template
|
* If lines are into a template, title must also be into a template
|
||||||
* But for the moment we don't know if it's possible as we keep a method available on overloaded objects.
|
* But for the moment we don't know if it's possible, so we keep the method available on overloaded objects.
|
||||||
*
|
*
|
||||||
|
* @param string $restrictlist ''=All lines, 'services'=Restrict to services only
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function printOriginLinesList()
|
function printOriginLinesList($restrictlist='')
|
||||||
{
|
{
|
||||||
global $langs, $hookmanager, $conf;
|
global $langs, $hookmanager, $conf;
|
||||||
|
|
||||||
@ -3716,8 +3717,6 @@ abstract class CommonObject
|
|||||||
|
|
||||||
foreach ($this->lines as $line)
|
foreach ($this->lines as $line)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
if (is_object($hookmanager) && (($line->product_type == 9 && ! empty($line->special_code)) || ! empty($line->fk_parent_line)))
|
if (is_object($hookmanager) && (($line->product_type == 9 && ! empty($line->special_code)) || ! empty($line->fk_parent_line)))
|
||||||
{
|
{
|
||||||
if (empty($line->fk_parent_line))
|
if (empty($line->fk_parent_line))
|
||||||
@ -3729,7 +3728,7 @@ abstract class CommonObject
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->printOriginLine($line,$var);
|
$this->printOriginLine($line, $var, $restrictlist);
|
||||||
}
|
}
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
@ -3744,9 +3743,10 @@ abstract class CommonObject
|
|||||||
*
|
*
|
||||||
* @param CommonObjectLine $line Line
|
* @param CommonObjectLine $line Line
|
||||||
* @param string $var Var
|
* @param string $var Var
|
||||||
|
* @param string $restrictlist ''=All lines, 'services'=Restrict to services only (strike line if not)
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function printOriginLine($line,$var)
|
function printOriginLine($line, $var, $restrictlist='')
|
||||||
{
|
{
|
||||||
global $langs, $conf;
|
global $langs, $conf;
|
||||||
|
|
||||||
@ -3848,6 +3848,10 @@ abstract class CommonObject
|
|||||||
if($conf->global->PRODUCT_USE_UNITS) $this->tpl['unit'] = $line->getLabelOfUnit('long');
|
if($conf->global->PRODUCT_USE_UNITS) $this->tpl['unit'] = $line->getLabelOfUnit('long');
|
||||||
$this->tpl['remise_percent'] = (($line->info_bits & 2) != 2) ? vatrate($line->remise_percent, true) : ' ';
|
$this->tpl['remise_percent'] = (($line->info_bits & 2) != 2) ? vatrate($line->remise_percent, true) : ' ';
|
||||||
|
|
||||||
|
// Is the line strike or not
|
||||||
|
$this->tpl['strike']=0;
|
||||||
|
if ($restrictlist == 'services' && $line->product_type != Product::TYPE_SERVICE) $this->tpl['strike']=1;
|
||||||
|
|
||||||
// Output template part (modules that overwrite templates must declare this into descriptor)
|
// Output template part (modules that overwrite templates must declare this into descriptor)
|
||||||
// Use global variables + $dateSelector + $seller and $buyer
|
// Use global variables + $dateSelector + $seller and $buyer
|
||||||
$dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl'));
|
$dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl'));
|
||||||
@ -4640,11 +4644,12 @@ abstract class CommonObject
|
|||||||
* @param Extrafields $extrafields Extrafield Object
|
* @param Extrafields $extrafields Extrafield Object
|
||||||
* @param string $mode Show output (view) or input (edit) for extrafield
|
* @param string $mode Show output (view) or input (edit) for extrafield
|
||||||
* @param array $params Optional parameters
|
* @param array $params Optional parameters
|
||||||
|
* @param string $keysuffix Suffix string to add into name and id of field (can be used to avoid duplicate names)
|
||||||
* @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names)
|
* @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names)
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function showOptionals($extrafields, $mode='view', $params=null, $keyprefix='')
|
function showOptionals($extrafields, $mode='view', $params=null, $keysuffix='', $keyprefix='')
|
||||||
{
|
{
|
||||||
global $_POST, $conf, $langs, $action;
|
global $_POST, $conf, $langs, $action;
|
||||||
|
|
||||||
@ -4672,12 +4677,12 @@ abstract class CommonObject
|
|||||||
|
|
||||||
switch($mode) {
|
switch($mode) {
|
||||||
case "view":
|
case "view":
|
||||||
$value=$this->array_options["options_".$key];
|
$value=$this->array_options["options_".$key.$keysuffix];
|
||||||
break;
|
break;
|
||||||
case "edit":
|
case "edit":
|
||||||
$getposttemp = GETPOST('options_'.$key, 'none'); // GETPOST can get value from GET, POST or setup of default values.
|
$getposttemp = GETPOST($keyprefix.'options_'.$key.$keysuffix, 'none'); // GETPOST can get value from GET, POST or setup of default values.
|
||||||
// GETPOST("options_" . $key) can be 'abc' or array(0=>'abc')
|
// GETPOST("options_" . $key) can be 'abc' or array(0=>'abc')
|
||||||
if (is_array($getposttemp) || $getposttemp != '' || GETPOSTISSET('options_'.$key))
|
if (is_array($getposttemp) || $getposttemp != '' || GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix))
|
||||||
{
|
{
|
||||||
if (is_array($getposttemp)) {
|
if (is_array($getposttemp)) {
|
||||||
// $getposttemp is an array but following code expects a comma separated string
|
// $getposttemp is an array but following code expects a comma separated string
|
||||||
@ -4717,12 +4722,12 @@ abstract class CommonObject
|
|||||||
// Convert date into timestamp format (value in memory must be a timestamp)
|
// Convert date into timestamp format (value in memory must be a timestamp)
|
||||||
if (in_array($extrafields->attribute_type[$key],array('date','datetime')))
|
if (in_array($extrafields->attribute_type[$key],array('date','datetime')))
|
||||||
{
|
{
|
||||||
$value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$this->db->jdate($this->array_options['options_'.$key]);
|
$value = GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix)?dol_mktime(GETPOST($keyprefix.'options_'.$key.$keysuffix."hour",'int',3), GETPOST($keyprefix.'options_'.$key.$keysuffix."min",'int',3), 0, GETPOST($keyprefix.'options_'.$key.$keysuffix."month",'int',3), GETPOST($keyprefix.'options_'.$key.$keysuffix."day",'int',3), GETPOST($keyprefix.'options_'.$key.$keysuffix."year",'int',3)):$this->db->jdate($this->array_options['options_'.$key]);
|
||||||
}
|
}
|
||||||
// Convert float submited string into real php numeric (value in memory must be a php numeric)
|
// Convert float submited string into real php numeric (value in memory must be a php numeric)
|
||||||
if (in_array($extrafields->attribute_type[$key],array('price','double')))
|
if (in_array($extrafields->attribute_type[$key],array('price','double')))
|
||||||
{
|
{
|
||||||
$value = isset($_POST["options_".$key])?price2num($_POST["options_".$key]):$this->array_options['options_'.$key];
|
$value = GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix)?price2num(GETPOST($keyprefix.'options_'.$key.$keysuffix,'int',3)):$this->array_options['options_'.$key];
|
||||||
}
|
}
|
||||||
|
|
||||||
$labeltoshow = $langs->trans($label);
|
$labeltoshow = $langs->trans($label);
|
||||||
@ -4741,7 +4746,7 @@ abstract class CommonObject
|
|||||||
$out .= $extrafields->showOutputField($key, $value);
|
$out .= $extrafields->showOutputField($key, $value);
|
||||||
break;
|
break;
|
||||||
case "edit":
|
case "edit":
|
||||||
$out .= $extrafields->showInputField($key, $value, '', $keyprefix, '', 0, $this->id);
|
$out .= $extrafields->showInputField($key, $value, '', $keysuffix, '', 0, $this->id);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4754,7 +4759,7 @@ abstract class CommonObject
|
|||||||
}
|
}
|
||||||
$out .= "\n";
|
$out .= "\n";
|
||||||
// Add code to manage list depending on others
|
// Add code to manage list depending on others
|
||||||
if (! empty($conf->use_javascript_ajax))
|
if (! empty($conf->use_javascript_ajax)) {
|
||||||
$out .= '
|
$out .= '
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
jQuery(document).ready(function() {
|
jQuery(document).ready(function() {
|
||||||
@ -4786,9 +4791,11 @@ abstract class CommonObject
|
|||||||
</script>'."\n";
|
</script>'."\n";
|
||||||
$out .= '<!-- /showOptionalsInput --> '."\n";
|
$out .= '<!-- /showOptionalsInput --> '."\n";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the rights used for this class
|
* Returns the rights used for this class
|
||||||
* @return stdClass
|
* @return stdClass
|
||||||
|
|||||||
@ -806,13 +806,13 @@ class ExtraFields
|
|||||||
* @param string $key Key of attribute
|
* @param string $key Key of attribute
|
||||||
* @param string $value Preselected value to show (for date type it must be in timestamp format, for amount or price it must be a php numeric value)
|
* @param string $value Preselected value to show (for date type it must be in timestamp format, for amount or price it must be a php numeric value)
|
||||||
* @param string $moreparam To add more parametes on html input tag
|
* @param string $moreparam To add more parametes on html input tag
|
||||||
* @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names)
|
* @param string $keysuffix Prefix string to add into name and id of field (can be used to avoid duplicate names)
|
||||||
* @param string $keysuffix Suffix string to add into name and id of field (can be used to avoid duplicate names)
|
* @param string $keyprefix Suffix string to add into name and id of field (can be used to avoid duplicate names)
|
||||||
* @param mixed $showsize Value for css to define size. May also be a numeric.
|
* @param mixed $showsize Value for css to define size. May also be a numeric.
|
||||||
* @param int $objectid Current object id
|
* @param int $objectid Current object id
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function showInputField($key, $value, $moreparam='', $keyprefix='', $keysuffix='', $showsize=0, $objectid=0)
|
function showInputField($key, $value, $moreparam='', $keysuffix='', $keyprefix='', $showsize=0, $objectid=0)
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
|
|
||||||
@ -831,7 +831,7 @@ class ExtraFields
|
|||||||
|
|
||||||
if ($computed)
|
if ($computed)
|
||||||
{
|
{
|
||||||
if ($keysuffix != 'search_') return '<span class="opacitymedium">'.$langs->trans("AutomaticallyCalculated").'</span>';
|
if ($keyprefix != 'search_') return '<span class="opacitymedium">'.$langs->trans("AutomaticallyCalculated").'</span>';
|
||||||
else return '';
|
else return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -893,26 +893,26 @@ class ExtraFields
|
|||||||
if (! is_object($form)) $form=new Form($this->db);
|
if (! is_object($form)) $form=new Form($this->db);
|
||||||
|
|
||||||
// TODO Must also support $moreparam
|
// TODO Must also support $moreparam
|
||||||
$out = $form->select_date($value, $keysuffix.'options_'.$key.$keyprefix, $showtime, $showtime, $required, '', 1, ($keysuffix != 'search_' ? 1 : 0), 1, 0, 1);
|
$out = $form->select_date($value, $keyprefix.'options_'.$key.$keysuffix, $showtime, $showtime, $required, '', 1, ($keyprefix != 'search_' ? 1 : 0), 1, 0, 1);
|
||||||
}
|
}
|
||||||
elseif (in_array($type,array('int')))
|
elseif (in_array($type,array('int')))
|
||||||
{
|
{
|
||||||
$tmp=explode(',',$size);
|
$tmp=explode(',',$size);
|
||||||
$newsize=$tmp[0];
|
$newsize=$tmp[0];
|
||||||
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" maxlength="'.$newsize.'" value="'.$value.'"'.($moreparam?$moreparam:'').'>';
|
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" maxlength="'.$newsize.'" value="'.$value.'"'.($moreparam?$moreparam:'').'>';
|
||||||
}
|
}
|
||||||
elseif ($type == 'varchar')
|
elseif ($type == 'varchar')
|
||||||
{
|
{
|
||||||
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" maxlength="'.$size.'" value="'.dol_escape_htmltag($value).'"'.($moreparam?$moreparam:'').'>';
|
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" maxlength="'.$size.'" value="'.dol_escape_htmltag($value).'"'.($moreparam?$moreparam:'').'>';
|
||||||
}
|
}
|
||||||
elseif (in_array($type, array('mail', 'phone', 'url')))
|
elseif (in_array($type, array('mail', 'phone', 'url')))
|
||||||
{
|
{
|
||||||
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'>';
|
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'>';
|
||||||
}
|
}
|
||||||
elseif ($type == 'text')
|
elseif ($type == 'text')
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
$doleditor=new DolEditor($keysuffix.'options_'.$key.$keyprefix,$value,'',200,'dolibarr_notes','In',false,false,! empty($conf->fckeditor->enabled) && $conf->global->FCKEDITOR_ENABLE_SOCIETE,ROWS_5,'90%');
|
$doleditor=new DolEditor($keyprefix.'options_'.$key.$keysuffix,$value,'',200,'dolibarr_notes','In',false,false,! empty($conf->fckeditor->enabled) && $conf->global->FCKEDITOR_ENABLE_SOCIETE,ROWS_5,'90%');
|
||||||
$out=$doleditor->Create(1);
|
$out=$doleditor->Create(1);
|
||||||
}
|
}
|
||||||
elseif ($type == 'boolean')
|
elseif ($type == 'boolean')
|
||||||
@ -923,21 +923,21 @@ class ExtraFields
|
|||||||
} else {
|
} else {
|
||||||
$checked=' value="1" ';
|
$checked=' value="1" ';
|
||||||
}
|
}
|
||||||
$out='<input type="checkbox" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" '.$checked.' '.($moreparam?$moreparam:'').'>';
|
$out='<input type="checkbox" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" '.$checked.' '.($moreparam?$moreparam:'').'>';
|
||||||
}
|
}
|
||||||
elseif ($type == 'price')
|
elseif ($type == 'price')
|
||||||
{
|
{
|
||||||
if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format.
|
if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format.
|
||||||
$value=price($value);
|
$value=price($value);
|
||||||
}
|
}
|
||||||
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'> '.$langs->getCurrencySymbol($conf->currency);
|
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'> '.$langs->getCurrencySymbol($conf->currency);
|
||||||
}
|
}
|
||||||
elseif ($type == 'double')
|
elseif ($type == 'double')
|
||||||
{
|
{
|
||||||
if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format.
|
if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format.
|
||||||
$value=price($value);
|
$value=price($value);
|
||||||
}
|
}
|
||||||
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'> ';
|
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'> ';
|
||||||
}
|
}
|
||||||
elseif ($type == 'select')
|
elseif ($type == 'select')
|
||||||
{
|
{
|
||||||
@ -945,10 +945,10 @@ class ExtraFields
|
|||||||
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_EXTRAFIELDS_USE_SELECT2))
|
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_EXTRAFIELDS_USE_SELECT2))
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||||
$out.= ajax_combobox($keysuffix.'options_'.$key.$keyprefix, array(), 0);
|
$out.= ajax_combobox($keyprefix.'options_'.$key.$keysuffix, array(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
$out.='<select class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" id="options_'.$key.$keyprefix.'" '.($moreparam?$moreparam:'').'>';
|
$out.='<select class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" '.($moreparam?$moreparam:'').'>';
|
||||||
$out.='<option value="0"> </option>';
|
$out.='<option value="0"> </option>';
|
||||||
foreach ($param['options'] as $key => $val)
|
foreach ($param['options'] as $key => $val)
|
||||||
{
|
{
|
||||||
@ -967,10 +967,10 @@ class ExtraFields
|
|||||||
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_EXTRAFIELDS_USE_SELECT2))
|
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_EXTRAFIELDS_USE_SELECT2))
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||||
$out.= ajax_combobox($keysuffix.'options_'.$key.$keyprefix, array(), 0);
|
$out.= ajax_combobox($keyprefix.'options_'.$key.$keysuffix, array(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
$out.='<select class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" id="options_'.$key.$keyprefix.'" '.($moreparam?$moreparam:'').'>';
|
$out.='<select class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" '.($moreparam?$moreparam:'').'>';
|
||||||
if (is_array($param['options']))
|
if (is_array($param['options']))
|
||||||
{
|
{
|
||||||
$param_list=array_keys($param['options']);
|
$param_list=array_keys($param['options']);
|
||||||
@ -1132,7 +1132,7 @@ class ExtraFields
|
|||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
$value_arr=explode(',',$value);
|
$value_arr=explode(',',$value);
|
||||||
$out=$form->multiselectarray($keysuffix.'options_'.$key.$keyprefix, (empty($param['options'])?null:$param['options']), $value_arr, '', 0, '', 0, '100%');
|
$out=$form->multiselectarray($keyprefix.'options_'.$key.$keysuffix, (empty($param['options'])?null:$param['options']), $value_arr, '', 0, '', 0, '100%');
|
||||||
|
|
||||||
}
|
}
|
||||||
elseif ($type == 'radio')
|
elseif ($type == 'radio')
|
||||||
@ -1140,11 +1140,11 @@ class ExtraFields
|
|||||||
$out='';
|
$out='';
|
||||||
foreach ($param['options'] as $keyopt => $val)
|
foreach ($param['options'] as $keyopt => $val)
|
||||||
{
|
{
|
||||||
$out.='<input class="flat '.$showsize.'" type="radio" name="'.$keysuffix.'options_'.$key.$keyprefix.'" '.($moreparam?$moreparam:'');
|
$out.='<input class="flat '.$showsize.'" type="radio" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" '.($moreparam?$moreparam:'');
|
||||||
$out.=' value="'.$keyopt.'"';
|
$out.=' value="'.$keyopt.'"';
|
||||||
$out.=' id="'.$keysuffix.'options_'.$key.$keyprefix.'_'.$keyopt.'"';
|
$out.=' id="'.$keyprefix.'options_'.$key.$keysuffix.'_'.$keyopt.'"';
|
||||||
$out.= ($value==$keyopt?'checked':'');
|
$out.= ($value==$keyopt?'checked':'');
|
||||||
$out.='/><label for="'.$keysuffix.'options_'.$key.$keyprefix.'_'.$keyopt.'">'.$val.'</label><br>';
|
$out.='/><label for="'.$keyprefix.'options_'.$key.$keysuffix.'_'.$keyopt.'">'.$val.'</label><br>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif ($type == 'chkbxlst')
|
elseif ($type == 'chkbxlst')
|
||||||
@ -1286,7 +1286,7 @@ class ExtraFields
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
$out=$form->multiselectarray($keysuffix.'options_'.$key.$keyprefix, $data, $value_arr, '', 0, '', 0, '100%');
|
$out=$form->multiselectarray($keyprefix.'options_'.$key.$keysuffix, $data, $value_arr, '', 0, '', 0, '100%');
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>';
|
print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>';
|
||||||
@ -1316,7 +1316,7 @@ class ExtraFields
|
|||||||
if ($object->element == 'societe') $valuetoshow=$object->name; // Special case for thirdparty because ->ref is not name but id (because name is not unique)
|
if ($object->element == 'societe') $valuetoshow=$object->name; // Special case for thirdparty because ->ref is not name but id (because name is not unique)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$out.='<input type="text" class="flat '.$showsize.'" name="'.$keysuffix.'options_'.$key.$keyprefix.'" value="'.$valuetoshow.'" >';
|
$out.='<input type="text" class="flat '.$showsize.'" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" value="'.$valuetoshow.'" >';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1327,10 +1327,10 @@ class ExtraFields
|
|||||||
elseif ($type == 'password')
|
elseif ($type == 'password')
|
||||||
{
|
{
|
||||||
// If prefix is 'search_', field is used as a filter, we use a common text field.
|
// If prefix is 'search_', field is used as a filter, we use a common text field.
|
||||||
$out='<input type="'.($keysuffix=='search_'?'text':'password').'" class="flat '.$showsize.'" name="'.$keysuffix.'options_'.$key.$keyprefix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'>';
|
$out='<input type="'.($keyprefix=='search_'?'text':'password').'" class="flat '.$showsize.'" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'>';
|
||||||
}
|
}
|
||||||
if (!empty($hidden)) {
|
if (!empty($hidden)) {
|
||||||
$out='<input type="hidden" value="'.$value.'" name="'.$keysuffix.'options_'.$key.$keyprefix.'" id="'.$keysuffix.'options_'.$key.$keyprefix.'"/>';
|
$out='<input type="hidden" value="'.$value.'" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'"/>';
|
||||||
}
|
}
|
||||||
/* Add comments
|
/* Add comments
|
||||||
if ($type == 'date') $out.=' (YYYY-MM-DD)';
|
if ($type == 'date') $out.=' (YYYY-MM-DD)';
|
||||||
@ -1339,6 +1339,7 @@ class ExtraFields
|
|||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return HTML string to put an output field into a page
|
* Return HTML string to put an output field into a page
|
||||||
*
|
*
|
||||||
|
|||||||
@ -4742,6 +4742,7 @@ class Form
|
|||||||
{
|
{
|
||||||
$shour = dol_print_date($set_time, "%H");
|
$shour = dol_print_date($set_time, "%H");
|
||||||
$smin = dol_print_date($set_time, "%M");
|
$smin = dol_print_date($set_time, "%M");
|
||||||
|
$ssec = dol_print_date($set_time, "%S");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -4752,6 +4753,7 @@ class Form
|
|||||||
$sday = '';
|
$sday = '';
|
||||||
$shour = !isset($conf->global->MAIN_DEFAULT_DATE_HOUR) ? '' : $conf->global->MAIN_DEFAULT_DATE_HOUR;
|
$shour = !isset($conf->global->MAIN_DEFAULT_DATE_HOUR) ? '' : $conf->global->MAIN_DEFAULT_DATE_HOUR;
|
||||||
$smin = !isset($conf->global->MAIN_DEFAULT_DATE_MIN) ? '' : $conf->global->MAIN_DEFAULT_DATE_MIN;
|
$smin = !isset($conf->global->MAIN_DEFAULT_DATE_MIN) ? '' : $conf->global->MAIN_DEFAULT_DATE_MIN;
|
||||||
|
$ssec = !isset($conf->global->MAIN_DEFAULT_DATE_SEC) ? '' : $conf->global->MAIN_DEFAULT_DATE_SEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
// You can set MAIN_POPUP_CALENDAR to 'eldy' or 'jquery'
|
// You can set MAIN_POPUP_CALENDAR to 'eldy' or 'jquery'
|
||||||
@ -4932,6 +4934,8 @@ class Form
|
|||||||
$retstring.='<option value="'.$min.'"'.(($min == $smin)?' selected':'').'>'.$min.(empty($conf->dol_optimize_smallscreen)?'':'').'</option>';
|
$retstring.='<option value="'.$min.'"'.(($min == $smin)?' selected':'').'>'.$min.(empty($conf->dol_optimize_smallscreen)?'':'').'</option>';
|
||||||
}
|
}
|
||||||
$retstring.='</select>';
|
$retstring.='</select>';
|
||||||
|
|
||||||
|
$retstring.='<input type="hidden" name="'.$prefix.'sec" value="'.$ssec.'">';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add a "Now" link
|
// Add a "Now" link
|
||||||
|
|||||||
@ -1606,7 +1606,8 @@ function getListOfModels($db,$type,$maxfilenamelength=0)
|
|||||||
if (! $tmpdir) { unset($listofdir[$key]); continue; }
|
if (! $tmpdir) { unset($listofdir[$key]); continue; }
|
||||||
if (is_dir($tmpdir))
|
if (is_dir($tmpdir))
|
||||||
{
|
{
|
||||||
$tmpfiles=dol_dir_list($tmpdir,'files',0,'\.od(s|t)$','','name',SORT_ASC,0);
|
// all type of template is allowed
|
||||||
|
$tmpfiles=dol_dir_list($tmpdir, 'files', 0, '', '', 'name', SORT_ASC, 0);
|
||||||
if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles);
|
if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -60,30 +60,30 @@ if ($conf->multicompany->enabled) {
|
|||||||
print '<td width="80"> </td>';
|
print '<td width="80"> </td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
if (count($extrafields->attribute_type))
|
if (count($extrafields->attributes[$elementtype]['type']))
|
||||||
{
|
{
|
||||||
foreach($extrafields->attribute_type as $key => $value)
|
foreach($extrafields->attributes[$elementtype]['type'] as $key => $value)
|
||||||
{
|
{
|
||||||
// Load language if required
|
// Load language if required
|
||||||
if (! empty($extrafields->attribute_langfile[$key])) {
|
if (! empty($extrafields->attributes[$elementtype]['langfile'][$key])) {
|
||||||
$langs->load($extrafields->attribute_langfile[$key]);
|
$langs->load($extrafields->attributes[$elementtype]['langfile'][$key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print "<td>".$extrafields->attribute_pos[$key]."</td>\n";
|
print "<td>".$extrafields->attributes[$elementtype]['pos'][$key]."</td>\n";
|
||||||
print "<td>".$extrafields->attribute_label[$key]."</td>\n"; // We don't translate here, we want admin to know what is the key not translated value
|
print "<td>".$extrafields->attributes[$elementtype]['label'][$key]."</td>\n"; // We don't translate here, we want admin to know what is the key not translated value
|
||||||
print "<td>".$langs->trans($extrafields->attribute_label[$key])."</td>\n";
|
print "<td>".$langs->trans($extrafields->attributes[$elementtype]['label'][$key])."</td>\n";
|
||||||
print "<td>".$key."</td>\n";
|
print "<td>".$key."</td>\n";
|
||||||
print "<td>".$type2label[$extrafields->attribute_type[$key]]."</td>\n";
|
print "<td>".$type2label[$extrafields->attributes[$elementtype]['type'][$key]]."</td>\n";
|
||||||
print '<td align="right">'.$extrafields->attribute_size[$key]."</td>\n";
|
print '<td align="right">'.$extrafields->attributes[$elementtype]['size'][$key]."</td>\n";
|
||||||
print '<td align="center">'.yn($extrafields->attribute_unique[$key])."</td>\n";
|
print '<td align="center">'.yn($extrafields->attributes[$elementtype]['unique'][$key])."</td>\n";
|
||||||
print '<td>'.dol_trunc($extrafields->attribute_computed[$key], 20)."</td>\n";
|
print '<td>'.dol_trunc($extrafields->attributes[$elementtype]['computed'][$key], 20)."</td>\n";
|
||||||
print '<td align="center">'.yn($extrafields->attribute_required[$key])."</td>\n";
|
print '<td align="center">'.yn($extrafields->attributes[$elementtype]['required'][$key])."</td>\n";
|
||||||
print '<td align="center">'.yn($extrafields->attribute_alwayseditable[$key])."</td>\n";
|
print '<td align="center">'.yn($extrafields->attributes[$elementtype]['alwayseditable'][$key])."</td>\n";
|
||||||
print '<td align="center">'.$extrafields->attribute_list[$key]."</td>\n";
|
print '<td align="center">'.$extrafields->attributes[$elementtype]['list'][$key]."</td>\n";
|
||||||
if (! empty($conf->global->MAIN_CAN_HIDE_EXTRAFIELDS)) print '<td align="center">'.yn($extrafields->attribute_hidden[$key])."</td>\n"; // Add hidden option on not working feature. Why hide if user can't see it.
|
if (! empty($conf->global->MAIN_CAN_HIDE_EXTRAFIELDS)) print '<td align="center">'.yn($extrafields->attributes[$elementtype]['ishidden'][$key])."</td>\n"; // Add hidden option on not working feature. Why hide if user can't see it.
|
||||||
if (! empty($conf->multicompany->enabled)) {
|
if (! empty($conf->multicompany->enabled)) {
|
||||||
print '<td align="center">'.($extrafields->attribute_entityid[$key]==0?$langs->trans("All"):$extrafields->attribute_entitylabel[$key]).'</td>';
|
print '<td align="center">'.($extrafields->attributes[$elementtype]['entityid'][$key]==0?$langs->trans("All"):$extrafields->attributes[$elementtype]['entitylabel'][$key]).'</td>';
|
||||||
}
|
}
|
||||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&attrname='.$key.'">'.img_edit().'</a>';
|
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&attrname='.$key.'">'.img_edit().'</a>';
|
||||||
print " <a href=\"".$_SERVER["PHP_SELF"]."?action=delete&attrname=$key\">".img_delete()."</a></td>\n";
|
print " <a href=\"".$_SERVER["PHP_SELF"]."?action=delete&attrname=$key\">".img_delete()."</a></td>\n";
|
||||||
|
|||||||
@ -32,7 +32,7 @@
|
|||||||
$parameters = array();
|
$parameters = array();
|
||||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
if (empty($reshook) && ! empty($extrafields->attribute_label)) {
|
if (empty($reshook) && ! empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||||
print $object->showOptionals($extrafields, 'edit');
|
print $object->showOptionals($extrafields, 'edit');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -32,7 +32,7 @@
|
|||||||
$parameters = array();
|
$parameters = array();
|
||||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
if (empty($reshook) && ! empty($extrafields->attribute_label)) {
|
if (empty($reshook) && ! empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||||
print $object->showOptionals($extrafields, 'edit');
|
print $object->showOptionals($extrafields, 'edit');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
<!-- BEGIN PHP TEMPLATE originproductline.tpl.php -->
|
<!-- BEGIN PHP TEMPLATE originproductline.tpl.php -->
|
||||||
<?php
|
<?php
|
||||||
print '<tr'.$bc[$var].'>';
|
print '<tr class="oddeven'.(empty($this->tpl['strike'])?'':' strikefordisabled').'">';
|
||||||
print '<td>'.$this->tpl['label'].'</td>';
|
print '<td>'.$this->tpl['label'].'</td>';
|
||||||
print '<td>'.$this->tpl['description'].'</td>';
|
print '<td>'.$this->tpl['description'].'</td>';
|
||||||
print '<td align="right">'.$this->tpl['vat_rate'].'</td>';
|
print '<td align="right">'.$this->tpl['vat_rate'].'</td>';
|
||||||
|
|||||||
@ -271,7 +271,7 @@ class ExpenseReports extends DolibarrApi
|
|||||||
);
|
);
|
||||||
|
|
||||||
if ($updateRes > 0) {
|
if ($updateRes > 0) {
|
||||||
return $this->get($id)->line->rowid;
|
return $updateRes;
|
||||||
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -60,6 +60,7 @@ $ref = GETPOST('ref','alpha');
|
|||||||
$socid = GETPOST('socid','int');
|
$socid = GETPOST('socid','int');
|
||||||
$contratid = GETPOST('contratid','int');
|
$contratid = GETPOST('contratid','int');
|
||||||
$action = GETPOST('action','alpha');
|
$action = GETPOST('action','alpha');
|
||||||
|
$cancel = GETPOST('cancel','alpha');
|
||||||
$confirm = GETPOST('confirm','alpha');
|
$confirm = GETPOST('confirm','alpha');
|
||||||
$mesg = GETPOST('msg','alpha');
|
$mesg = GETPOST('msg','alpha');
|
||||||
$origin=GETPOST('origin','alpha');
|
$origin=GETPOST('origin','alpha');
|
||||||
@ -105,6 +106,16 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
|||||||
|
|
||||||
if (empty($reshook))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
|
if ($cancel)
|
||||||
|
{
|
||||||
|
if (! empty($backtopage))
|
||||||
|
{
|
||||||
|
header("Location: ".$backtopage);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$action='';
|
||||||
|
}
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
|
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once
|
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once
|
||||||
@ -205,7 +216,7 @@ if (empty($reshook))
|
|||||||
$object->fk_project = GETPOST('projectid','int');
|
$object->fk_project = GETPOST('projectid','int');
|
||||||
$object->fk_contrat = GETPOST('contratid','int');
|
$object->fk_contrat = GETPOST('contratid','int');
|
||||||
$object->author = $user->id;
|
$object->author = $user->id;
|
||||||
$object->description = GETPOST('description');
|
$object->description = GETPOST('description','none');
|
||||||
$object->ref = $ref;
|
$object->ref = $ref;
|
||||||
$object->modelpdf = GETPOST('model','alpha');
|
$object->modelpdf = GETPOST('model','alpha');
|
||||||
$object->note_private = GETPOST('note_private','none');
|
$object->note_private = GETPOST('note_private','none');
|
||||||
@ -829,7 +840,7 @@ if ($action == 'create')
|
|||||||
|
|
||||||
$soc=new Societe($db);
|
$soc=new Societe($db);
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("AddIntervention"));
|
print load_fiche_titre($langs->trans("AddIntervention"), '', 'title_commercial');
|
||||||
|
|
||||||
dol_htmloutput_mesg($mesg);
|
dol_htmloutput_mesg($mesg);
|
||||||
|
|
||||||
@ -1008,6 +1019,30 @@ if ($action == 'create')
|
|||||||
$newclassname=$classname;
|
$newclassname=$classname;
|
||||||
if ($newclassname=='Propal') $newclassname='CommercialProposal';
|
if ($newclassname=='Propal') $newclassname='CommercialProposal';
|
||||||
print '<tr><td>'.$langs->trans($newclassname).'</td><td colspan="2">'.$objectsrc->getNomUrl(1).'</td></tr>';
|
print '<tr><td>'.$langs->trans($newclassname).'</td><td colspan="2">'.$objectsrc->getNomUrl(1).'</td></tr>';
|
||||||
|
|
||||||
|
// Amount
|
||||||
|
/* Hide amount because we only copy services so amount may differ than source
|
||||||
|
print '<tr><td>' . $langs->trans('TotalHT') . '</td><td>' . price($objectsrc->total_ht) . '</td></tr>';
|
||||||
|
print '<tr><td>' . $langs->trans('TotalVAT') . '</td><td>' . price($objectsrc->total_tva) . "</td></tr>";
|
||||||
|
if ($mysoc->localtax1_assuj == "1" || $objectsrc->total_localtax1 != 0) // Localtax1 RE
|
||||||
|
{
|
||||||
|
print '<tr><td>' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td><td>' . price($objectsrc->total_localtax1) . "</td></tr>";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($mysoc->localtax2_assuj == "1" || $objectsrc->total_localtax2 != 0) // Localtax2 IRPF
|
||||||
|
{
|
||||||
|
print '<tr><td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td><td>' . price($objectsrc->total_localtax2) . "</td></tr>";
|
||||||
|
}
|
||||||
|
|
||||||
|
print '<tr><td>' . $langs->trans('TotalTTC') . '</td><td>' . price($objectsrc->total_ttc) . "</td></tr>";
|
||||||
|
|
||||||
|
if (!empty($conf->multicurrency->enabled))
|
||||||
|
{
|
||||||
|
print '<tr><td>' . $langs->trans('MulticurrencyTotalHT') . '</td><td>' . price($objectsrc->multicurrency_total_ht) . '</td></tr>';
|
||||||
|
print '<tr><td>' . $langs->trans('MulticurrencyTotalVAT') . '</td><td>' . price($objectsrc->multicurrency_total_tva) . "</td></tr>";
|
||||||
|
print '<tr><td>' . $langs->trans('MulticurrencyTotalTTC') . '</td><td>' . price($objectsrc->multicurrency_total_ttc) . "</td></tr>";
|
||||||
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
@ -1029,6 +1064,18 @@ if ($action == 'create')
|
|||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
|
// Show origin lines
|
||||||
|
if (! empty($origin) && ! empty($originid) && is_object($objectsrc)) {
|
||||||
|
$title = $langs->trans('Services');
|
||||||
|
print load_fiche_titre($title);
|
||||||
|
|
||||||
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
|
$objectsrc->printOriginLinesList(empty($conf->global->FICHINTER_PRINT_PRODUCTS)?'services':''); // Show only service, except if option FICHINTER_PRINT_PRODUCTS is on
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1604,22 +1651,8 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#">'.$langs->trans('SendByMail').'</a></div>';
|
else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#">'.$langs->trans('SendByMail').'</a></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Event agenda
|
|
||||||
if (! empty($conf->global->FICHINTER_ADDLINK_TO_EVENT))
|
|
||||||
{
|
|
||||||
if (! empty($conf->agenda->enabled) && $object->statut > Fichinter::STATUS_DRAFT)
|
|
||||||
{
|
|
||||||
$langs->load("agenda");
|
|
||||||
if ($object->statut < Fichinter::STATUS_BILLED)
|
|
||||||
{
|
|
||||||
if ($user->rights->agenda->myactions->create) print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id).'">'.$langs->trans("AddEvent").'</a></div>';
|
|
||||||
else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("AddEvent").'</a></div>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Proposal
|
// Proposal
|
||||||
if (! empty($conf->propal->enabled) && $object->statut > Fichinter::STATUS_DRAFT)
|
if ($conf->service->enabled && ! empty($conf->propal->enabled) && $object->statut > Fichinter::STATUS_DRAFT)
|
||||||
{
|
{
|
||||||
$langs->load("propal");
|
$langs->load("propal");
|
||||||
if ($object->statut < Fichinter::STATUS_BILLED)
|
if ($object->statut < Fichinter::STATUS_BILLED)
|
||||||
|
|||||||
@ -1439,6 +1439,11 @@ if ($action == 'create')
|
|||||||
$dateinvoice=($datetmp==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$datetmp);
|
$dateinvoice=($datetmp==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$datetmp);
|
||||||
$datetmp=dol_mktime(12,0,0,$_POST['echmonth'],$_POST['echday'],$_POST['echyear']);
|
$datetmp=dol_mktime(12,0,0,$_POST['echmonth'],$_POST['echday'],$_POST['echyear']);
|
||||||
$datedue=($datetmp==''?-1:$datetmp);
|
$datedue=($datetmp==''?-1:$datetmp);
|
||||||
|
|
||||||
|
// Replicate extrafields
|
||||||
|
$objectsrc->fetch_optionals($originid);
|
||||||
|
$object->array_options = $objectsrc->array_options;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -771,6 +771,7 @@ Calendar=Calendrier
|
|||||||
GroupBy=Grouper par...
|
GroupBy=Grouper par...
|
||||||
ViewFlatList=Voir vue liste
|
ViewFlatList=Voir vue liste
|
||||||
RemoveString=Supprimer la chaine '%s'
|
RemoveString=Supprimer la chaine '%s'
|
||||||
|
Translation=Traduction
|
||||||
SomeTranslationAreUncomplete=Certains languages pourraient n'être que partiellement traduis, ou contenir des erreurs. Si vous en détectez, vous pouvez les corriger en vous enregistrant sur <a href="https://transifex.com/projects/p/dolibarr/" target="_blank">https://transifex.com/projects/p/dolibarr/</a>
|
SomeTranslationAreUncomplete=Certains languages pourraient n'être que partiellement traduis, ou contenir des erreurs. Si vous en détectez, vous pouvez les corriger en vous enregistrant sur <a href="https://transifex.com/projects/p/dolibarr/" target="_blank">https://transifex.com/projects/p/dolibarr/</a>
|
||||||
DirectDownloadLink=Lien de téléchargement direct
|
DirectDownloadLink=Lien de téléchargement direct
|
||||||
Download=Téléchargement
|
Download=Téléchargement
|
||||||
|
|||||||
@ -100,7 +100,6 @@ ParentProductsNumber=Nbre de produits virtuels/packages parent
|
|||||||
ParentProducts=Produits parents
|
ParentProducts=Produits parents
|
||||||
IfZeroItIsNotAVirtualProduct=Si 0, ce produit n'est pas un produit virtuel
|
IfZeroItIsNotAVirtualProduct=Si 0, ce produit n'est pas un produit virtuel
|
||||||
IfZeroItIsNotUsedByVirtualProduct=Si 0, ce produit n'est pas utilisé par un produit virtuel
|
IfZeroItIsNotUsedByVirtualProduct=Si 0, ce produit n'est pas utilisé par un produit virtuel
|
||||||
Translation=Traduction
|
|
||||||
KeywordFilter=Filtre par mot-clé
|
KeywordFilter=Filtre par mot-clé
|
||||||
CategoryFilter=Filtre par catégorie
|
CategoryFilter=Filtre par catégorie
|
||||||
ProductToAddSearch=Recherche des produits à ajouter
|
ProductToAddSearch=Recherche des produits à ajouter
|
||||||
|
|||||||
@ -816,6 +816,10 @@ if (GETPOST('textbrowser','int') || (! empty($conf->browser->name) && $conf->bro
|
|||||||
{
|
{
|
||||||
$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER=1;
|
$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER=1;
|
||||||
}
|
}
|
||||||
|
elseif (! empty($user->conf->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||||
|
{
|
||||||
|
$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER=$user->conf->MAIN_OPTIMIZEFORTEXTBROWSER;
|
||||||
|
}
|
||||||
|
|
||||||
// Set terminal output option according to conf->browser.
|
// Set terminal output option according to conf->browser.
|
||||||
if (GETPOST('dol_hide_leftmenu','int') || ! empty($_SESSION['dol_hide_leftmenu'])) $conf->dol_hide_leftmenu=1;
|
if (GETPOST('dol_hide_leftmenu','int') || ! empty($_SESSION['dol_hide_leftmenu'])) $conf->dol_hide_leftmenu=1;
|
||||||
@ -1093,9 +1097,9 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
|
|||||||
$favicon=dol_buildpath('/theme/'.$conf->theme.'/img/favicon.ico',1);
|
$favicon=dol_buildpath('/theme/'.$conf->theme.'/img/favicon.ico',1);
|
||||||
if (! empty($conf->global->MAIN_FAVICON_URL)) $favicon=$conf->global->MAIN_FAVICON_URL;
|
if (! empty($conf->global->MAIN_FAVICON_URL)) $favicon=$conf->global->MAIN_FAVICON_URL;
|
||||||
if (empty($conf->dol_use_jmobile)) print '<link rel="shortcut icon" type="image/x-icon" href="'.$favicon.'"/>'."\n"; // Not required into an Android webview
|
if (empty($conf->dol_use_jmobile)) print '<link rel="shortcut icon" type="image/x-icon" href="'.$favicon.'"/>'."\n"; // Not required into an Android webview
|
||||||
//if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && ! GETPOST('textbrowser','int')) print '<link rel="top" title="'.$langs->trans("Home").'" href="'.(DOL_URL_ROOT?DOL_URL_ROOT:'/').'">'."\n";
|
//if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) print '<link rel="top" title="'.$langs->trans("Home").'" href="'.(DOL_URL_ROOT?DOL_URL_ROOT:'/').'">'."\n";
|
||||||
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && ! GETPOST('textbrowser','int')) print '<link rel="copyright" title="GNU General Public License" href="http://www.gnu.org/copyleft/gpl.html#SEC1">'."\n";
|
//if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) print '<link rel="copyright" title="GNU General Public License" href="http://www.gnu.org/copyleft/gpl.html#SEC1">'."\n";
|
||||||
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && ! GETPOST('textbrowser','int')) print '<link rel="author" title="Dolibarr Development Team" href="https://www.dolibarr.org">'."\n";
|
//if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) print '<link rel="author" title="Dolibarr Development Team" href="https://www.dolibarr.org">'."\n";
|
||||||
|
|
||||||
// Displays title
|
// Displays title
|
||||||
$appli=constant('DOL_APPLICATION_TITLE');
|
$appli=constant('DOL_APPLICATION_TITLE');
|
||||||
|
|||||||
@ -893,7 +893,7 @@ else
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
// Stock
|
// Stock real
|
||||||
if (! empty($arrayfields['p.stock']['checked']))
|
if (! empty($arrayfields['p.stock']['checked']))
|
||||||
{
|
{
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
@ -905,7 +905,7 @@ else
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
// Stock
|
// Stock virtual
|
||||||
if (! empty($arrayfields['stock_virtual']['checked']))
|
if (! empty($arrayfields['stock_virtual']['checked']))
|
||||||
{
|
{
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
|
|||||||
@ -342,7 +342,7 @@ class Projects extends DolibarrApi
|
|||||||
);
|
);
|
||||||
|
|
||||||
if ($updateRes > 0) {
|
if ($updateRes > 0) {
|
||||||
return $this->get($id)->line->rowid;
|
return $updateRes;
|
||||||
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -348,7 +348,7 @@ class Tasks extends DolibarrApi
|
|||||||
);
|
);
|
||||||
|
|
||||||
if ($updateRes > 0) {
|
if ($updateRes > 0) {
|
||||||
return $this->get($id)->line->rowid;
|
return $updateRes;
|
||||||
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -739,6 +739,8 @@ class Societe extends CommonObject
|
|||||||
$this->email = trim($this->email);
|
$this->email = trim($this->email);
|
||||||
$this->skype = trim($this->skype);
|
$this->skype = trim($this->skype);
|
||||||
$this->url = $this->url?clean_url($this->url,0):'';
|
$this->url = $this->url?clean_url($this->url,0):'';
|
||||||
|
$this->note_private = trim($this->note_private);
|
||||||
|
$this->note_public = trim($this->note_public);
|
||||||
$this->idprof1 = trim($this->idprof1);
|
$this->idprof1 = trim($this->idprof1);
|
||||||
$this->idprof2 = trim($this->idprof2);
|
$this->idprof2 = trim($this->idprof2);
|
||||||
$this->idprof3 = trim($this->idprof3);
|
$this->idprof3 = trim($this->idprof3);
|
||||||
@ -853,6 +855,9 @@ class Societe extends CommonObject
|
|||||||
$sql .= ",skype = ".(! empty($this->skype)?"'".$this->db->escape($this->skype)."'":"null");
|
$sql .= ",skype = ".(! empty($this->skype)?"'".$this->db->escape($this->skype)."'":"null");
|
||||||
$sql .= ",url = ".(! empty($this->url)?"'".$this->db->escape($this->url)."'":"null");
|
$sql .= ",url = ".(! empty($this->url)?"'".$this->db->escape($this->url)."'":"null");
|
||||||
|
|
||||||
|
$sql .= ",note_private = ".(! empty($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null");
|
||||||
|
$sql .= ",note_public = ".(! empty($this->note_public)?"'".$this->db->escape($this->note_public)."'":"null");
|
||||||
|
|
||||||
$sql .= ",siren = '". $this->db->escape($this->idprof1) ."'";
|
$sql .= ",siren = '". $this->db->escape($this->idprof1) ."'";
|
||||||
$sql .= ",siret = '". $this->db->escape($this->idprof2) ."'";
|
$sql .= ",siret = '". $this->db->escape($this->idprof2) ."'";
|
||||||
$sql .= ",ape = '". $this->db->escape($this->idprof3) ."'";
|
$sql .= ",ape = '". $this->db->escape($this->idprof3) ."'";
|
||||||
|
|||||||
@ -579,6 +579,9 @@ textarea.centpercent {
|
|||||||
.right {
|
.right {
|
||||||
text-align: <?php print $right; ?>;
|
text-align: <?php print $right; ?>;
|
||||||
}
|
}
|
||||||
|
.justify {
|
||||||
|
text-align: justify;
|
||||||
|
}
|
||||||
.nowrap {
|
.nowrap {
|
||||||
white-space: <?php print ($dol_optimize_smallscreen?'normal':'nowrap'); ?>;
|
white-space: <?php print ($dol_optimize_smallscreen?'normal':'nowrap'); ?>;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -584,6 +584,9 @@ textarea.centpercent {
|
|||||||
.right {
|
.right {
|
||||||
text-align: <?php print $right; ?>;
|
text-align: <?php print $right; ?>;
|
||||||
}
|
}
|
||||||
|
.justify {
|
||||||
|
text-align: justify;
|
||||||
|
}
|
||||||
.nowrap {
|
.nowrap {
|
||||||
white-space: <?php print ($dol_optimize_smallscreen?'normal':'nowrap'); ?>;
|
white-space: <?php print ($dol_optimize_smallscreen?'normal':'nowrap'); ?>;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user