Merge remote-tracking branch 'uptream/develop' into 6.0-multijournal
# Conflicts: # htdocs/core/menus/standard/eldy.lib.php
This commit is contained in:
commit
ef9275d031
20
ChangeLog
20
ChangeLog
@ -22,6 +22,26 @@ Following changes may create regression for some external modules, but were nece
|
|||||||
* Removed the trigger file of PAYPAL module that stored data that was not used by Dolibarr. The trigger event still
|
* Removed the trigger file of PAYPAL module that stored data that was not used by Dolibarr. The trigger event still
|
||||||
exists, but if an external module need action on it, it must provides itself its trigger file.
|
exists, but if an external module need action on it, it must provides itself its trigger file.
|
||||||
|
|
||||||
|
***** ChangeLog for 5.0.3 compared to 5.0.2 *****
|
||||||
|
FIX: #6677 Expired contracts dashboard box does not show the name of the thirdparty
|
||||||
|
FIX: #6813
|
||||||
|
FIX: 6863
|
||||||
|
FIX: #6877
|
||||||
|
FIX: #6881
|
||||||
|
FIX: Better sanitizing of search all parameter.
|
||||||
|
FIX: Correction with author and validator user on orders
|
||||||
|
FIX: dialog window with md theme must not be hidden by left menu part.
|
||||||
|
FIX: doactions hook missing in invoice model page
|
||||||
|
FIX: Fullname when member is a moral entity with no name.
|
||||||
|
FIX: Link to files on bank account tab broken with multicompany FIX: Link to preview on thirdparty broken with multicompany
|
||||||
|
FIX: New vat code not correctly implemented if "1 price per customer".
|
||||||
|
FIX: Pagination of invoices
|
||||||
|
FIX: pagination on resources
|
||||||
|
FIX: REST API not possible to add agendaevents
|
||||||
|
FIX: situation invoice broken due to the all percent application form inside addline form
|
||||||
|
FIX: SQL injection on user/index.php parameter search_statut.
|
||||||
|
FIX: XSS
|
||||||
|
|
||||||
***** ChangeLog for 5.0.2 compared to 5.0.1 *****
|
***** ChangeLog for 5.0.2 compared to 5.0.1 *****
|
||||||
FIX: #6468 + Fix missing translation
|
FIX: #6468 + Fix missing translation
|
||||||
FIX: #6517 #6525 Autocompletion of thirdparty after n chars not implemented
|
FIX: #6517 #6525 Autocompletion of thirdparty after n chars not implemented
|
||||||
|
|||||||
@ -444,3 +444,4 @@ Note that package 3.5.7 contains not only fixed for bugs reported to debian. It
|
|||||||
so it is a better solution to validate this maintenance release than applying a patch of the only CVE-2015-3935.
|
so it is a better solution to validate this maintenance release than applying a patch of the only CVE-2015-3935.
|
||||||
After discussion with ..., it appears that security holes are enough to request this unblock request."
|
After discussion with ..., it appears that security holes are enough to request this unblock request."
|
||||||
|
|
||||||
|
Note: If there is a response to ask more information, don't forget to remove the tag during answer.
|
||||||
|
|||||||
@ -4,7 +4,12 @@ dolibarr: source-contains-prebuilt-javascript-object htdocs/includes/jsgantt/*
|
|||||||
dolibarr: source-contains-prebuilt-javascript-object htdocs/includes/jstz/*
|
dolibarr: source-contains-prebuilt-javascript-object htdocs/includes/jstz/*
|
||||||
# Those are false positives, the files are their own sources since
|
# Those are false positives, the files are their own sources since
|
||||||
# they are not minified
|
# they are not minified
|
||||||
source-is-missing htdocs/includes/jsgantt/jsgantt.js *
|
source-is-missing htdocs/includes/ckeditor/ckeditor/plugins/a11yhelp/dialogs/lang/*.js
|
||||||
source-is-missing htdocs/includes/jquery/plugins/colorpicker/jquery.colorpicker.js *
|
source-is-missing htdocs/includes/ckeditor/ckeditor/plugins/specialchar/dialogs/lang/*.js
|
||||||
source-is-missing htdocs/includes/jquery/plugins/select2/select2.js *
|
source-is-missing htdocs/includes/ckeditor/ckeditor/lang/*.js
|
||||||
source-is-missing htdocs/includes/jquery/plugins/select2/select2_locale_ar.js *
|
source-is-missing htdocs/includes/ckeditor/ckeditor/plugins/*/dialogs/*.js
|
||||||
|
source-is-missing htdocs/includes/ckeditor/ckeditor/plugins/*/filter/*.js
|
||||||
|
source-is-missing htdocs/includes/ckeditor/ckeditor/plugins/templates/templates/default.js
|
||||||
|
source-is-missing htdocs/includes/mobiledetect/mobiledetectlib/Mobile_Detect.json
|
||||||
|
source-is-missing htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/*.js
|
||||||
|
|
||||||
|
|||||||
@ -49,6 +49,8 @@ $type = 'action';
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||||
|
|
||||||
if (preg_match('/set_(.*)/',$action,$reg))
|
if (preg_match('/set_(.*)/',$action,$reg))
|
||||||
{
|
{
|
||||||
$code=$reg[1];
|
$code=$reg[1];
|
||||||
@ -77,21 +79,6 @@ if (preg_match('/del_(.*)/',$action,$reg))
|
|||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...)
|
|
||||||
if ($action == 'setModuleOptions')
|
|
||||||
{
|
|
||||||
|
|
||||||
if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity);
|
|
||||||
if (! $res > 0) $error++;
|
|
||||||
if (! $error)
|
|
||||||
{
|
|
||||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($action == 'set')
|
if ($action == 'set')
|
||||||
{
|
{
|
||||||
dolibarr_set_const($db, 'AGENDA_USE_EVENT_TYPE_DEFAULT', GETPOST('AGENDA_USE_EVENT_TYPE_DEFAULT'), 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, 'AGENDA_USE_EVENT_TYPE_DEFAULT', GETPOST('AGENDA_USE_EVENT_TYPE_DEFAULT'), 'chaine', 0, '', $conf->entity);
|
||||||
|
|||||||
@ -39,6 +39,8 @@ $action = GETPOST('action','alpha');
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||||
|
|
||||||
if ($action == 'setbarcodeproducton')
|
if ($action == 'setbarcodeproducton')
|
||||||
{
|
{
|
||||||
$res=dolibarr_set_const($db, "BARCODE_PRODUCT_ADDON_NUM", GETPOST('value'), 'chaine', 0, '', $conf->entity);
|
$res=dolibarr_set_const($db, "BARCODE_PRODUCT_ADDON_NUM", GETPOST('value'), 'chaine', 0, '', $conf->entity);
|
||||||
@ -75,32 +77,6 @@ else if ($action == 'updateengine')
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// define constants for models generator that need parameters
|
|
||||||
if ($action == 'setModuleOptions')
|
|
||||||
{
|
|
||||||
$post_size=count($_POST);
|
|
||||||
|
|
||||||
for($i=0;$i < $post_size;$i++)
|
|
||||||
{
|
|
||||||
if (array_key_exists('param'.$i,$_POST))
|
|
||||||
{
|
|
||||||
$param=GETPOST("param".$i,'alpha');
|
|
||||||
$value=GETPOST("value".$i,'alpha');
|
|
||||||
if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (! $res > 0) $error++;
|
|
||||||
|
|
||||||
if (! $error)
|
|
||||||
{
|
|
||||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($action && $action != 'setcoder' && $action != 'setModuleOptions')
|
if ($action && $action != 'setcoder' && $action != 'setModuleOptions')
|
||||||
{
|
{
|
||||||
if (! $res > 0) $error++;
|
if (! $res > 0) $error++;
|
||||||
|
|||||||
@ -77,7 +77,7 @@ if ($action == 'setmod')
|
|||||||
|
|
||||||
if ($action == 'set_BANK_CHEQUERECEIPT_FREE_TEXT')
|
if ($action == 'set_BANK_CHEQUERECEIPT_FREE_TEXT')
|
||||||
{
|
{
|
||||||
$freetext = GETPOST('BANK_CHEQUERECEIPT_FREE_TEXT'); // No alpha here, we want exact string
|
$freetext = GETPOST('BANK_CHEQUERECEIPT_FREE_TEXT','none'); // No alpha here, we want exact string
|
||||||
|
|
||||||
$res = dolibarr_set_const($db, "BANK_CHEQUERECEIPT_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
|
$res = dolibarr_set_const($db, "BANK_CHEQUERECEIPT_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
|
|||||||
@ -54,6 +54,8 @@ $type = 'order';
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||||
|
|
||||||
if ($action == 'updateMask')
|
if ($action == 'updateMask')
|
||||||
{
|
{
|
||||||
$maskconstorder=GETPOST('maskconstorder','alpha');
|
$maskconstorder=GETPOST('maskconstorder','alpha');
|
||||||
@ -118,35 +120,6 @@ else if ($action == 'specimen')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...)
|
|
||||||
if ($action == 'setModuleOptions')
|
|
||||||
{
|
|
||||||
$post_size=count($_POST);
|
|
||||||
|
|
||||||
$db->begin();
|
|
||||||
|
|
||||||
for($i=0;$i < $post_size;$i++)
|
|
||||||
{
|
|
||||||
if (array_key_exists('param'.$i,$_POST))
|
|
||||||
{
|
|
||||||
$param=GETPOST("param".$i,'alpha');
|
|
||||||
$value=GETPOST("value".$i,'alpha');
|
|
||||||
if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity);
|
|
||||||
if (! $res > 0) $error++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (! $error)
|
|
||||||
{
|
|
||||||
$db->commit();
|
|
||||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$db->rollback();
|
|
||||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Activate a model
|
// Activate a model
|
||||||
else if ($action == 'set')
|
else if ($action == 'set')
|
||||||
{
|
{
|
||||||
@ -207,7 +180,7 @@ else if ($action == 'set_COMMANDE_DRAFT_WATERMARK')
|
|||||||
|
|
||||||
else if ($action == 'set_ORDER_FREE_TEXT')
|
else if ($action == 'set_ORDER_FREE_TEXT')
|
||||||
{
|
{
|
||||||
$freetext = GETPOST("ORDER_FREE_TEXT"); // No alpha here, we want exact string
|
$freetext = GETPOST("ORDER_FREE_TEXT",'none'); // No alpha here, we want exact string
|
||||||
|
|
||||||
$res = dolibarr_set_const($db, "ORDER_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
|
$res = dolibarr_set_const($db, "ORDER_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
|
|||||||
@ -50,6 +50,8 @@ if (empty($conf->global->CONTRACT_ADDON))
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||||
|
|
||||||
if ($action == 'updateMask')
|
if ($action == 'updateMask')
|
||||||
{
|
{
|
||||||
$maskconst = GETPOST('maskconstcontract','alpha');
|
$maskconst = GETPOST('maskconstcontract','alpha');
|
||||||
@ -113,35 +115,6 @@ else if ($action == 'specimen') // For contract
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...)
|
|
||||||
if ($action == 'setModuleOptions')
|
|
||||||
{
|
|
||||||
$post_size=count($_POST);
|
|
||||||
|
|
||||||
$db->begin();
|
|
||||||
|
|
||||||
for($i=0;$i < $post_size;$i++)
|
|
||||||
{
|
|
||||||
if (array_key_exists('param'.$i,$_POST))
|
|
||||||
{
|
|
||||||
$param=GETPOST("param".$i,'alpha');
|
|
||||||
$value=GETPOST("value".$i,'alpha');
|
|
||||||
if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity);
|
|
||||||
if (! $res > 0) $error++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (! $error)
|
|
||||||
{
|
|
||||||
$db->commit();
|
|
||||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$db->rollback();
|
|
||||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Activate a model
|
// Activate a model
|
||||||
else if ($action == 'set')
|
else if ($action == 'set')
|
||||||
{
|
{
|
||||||
@ -185,7 +158,7 @@ else if ($action == 'setmod')
|
|||||||
|
|
||||||
else if ($action == 'set_other')
|
else if ($action == 'set_other')
|
||||||
{
|
{
|
||||||
$freetext= GETPOST('CONTRACT_FREE_TEXT'); // No alpha here, we want exact string
|
$freetext= GETPOST('CONTRACT_FREE_TEXT','none'); // No alpha here, we want exact string
|
||||||
$res1 = dolibarr_set_const($db, "CONTRACT_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
|
$res1 = dolibarr_set_const($db, "CONTRACT_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
$draft= GETPOST('CONTRACT_DRAFT_WATERMARK','alpha');
|
$draft= GETPOST('CONTRACT_DRAFT_WATERMARK','alpha');
|
||||||
@ -501,7 +474,7 @@ print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$var=true;
|
$var=true;
|
||||||
|
|
||||||
$substitutionarray=pdf_getSubstitutionArray($langs);
|
$substitutionarray=pdf_getSubstitutionArray($langs, array('objectamount'));
|
||||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
||||||
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
||||||
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
|
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
|
||||||
|
|||||||
@ -57,6 +57,9 @@ if (empty($conf->global->EXPEDITION_ADDON_NUMBER))
|
|||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||||
|
|
||||||
if ($action == 'updateMask')
|
if ($action == 'updateMask')
|
||||||
{
|
{
|
||||||
$maskconst=GETPOST('maskconstexpedition','alpha');
|
$maskconst=GETPOST('maskconstexpedition','alpha');
|
||||||
@ -75,7 +78,7 @@ if ($action == 'updateMask')
|
|||||||
|
|
||||||
else if ($action == 'set_param')
|
else if ($action == 'set_param')
|
||||||
{
|
{
|
||||||
$freetext=GETPOST('SHIPPING_FREE_TEXT'); // No alpha here, we want exact string
|
$freetext=GETPOST('SHIPPING_FREE_TEXT','none'); // No alpha here, we want exact string
|
||||||
$res = dolibarr_set_const($db, "SHIPPING_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
|
$res = dolibarr_set_const($db, "SHIPPING_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
|
||||||
if ($res <= 0)
|
if ($res <= 0)
|
||||||
{
|
{
|
||||||
@ -142,35 +145,6 @@ else if ($action == 'specimen')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...)
|
|
||||||
else if ($action == 'setModuleOptions')
|
|
||||||
{
|
|
||||||
$post_size=count($_POST);
|
|
||||||
|
|
||||||
$db->begin();
|
|
||||||
|
|
||||||
for($i=0;$i < $post_size;$i++)
|
|
||||||
{
|
|
||||||
if (array_key_exists('param'.$i,$_POST))
|
|
||||||
{
|
|
||||||
$param=GETPOST("param".$i,'alpha');
|
|
||||||
$value=GETPOST("value".$i,'alpha');
|
|
||||||
if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity);
|
|
||||||
if (! $res > 0) $error++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (! $error)
|
|
||||||
{
|
|
||||||
$db->commit();
|
|
||||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$db->rollback();
|
|
||||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Activate a model
|
// Activate a model
|
||||||
else if ($action == 'set')
|
else if ($action == 'set')
|
||||||
{
|
{
|
||||||
|
|||||||
@ -51,6 +51,9 @@ $type='expensereport';
|
|||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||||
|
|
||||||
if ($action == 'updateMask')
|
if ($action == 'updateMask')
|
||||||
{
|
{
|
||||||
$maskconst=GETPOST('maskconst','alpha');
|
$maskconst=GETPOST('maskconst','alpha');
|
||||||
@ -116,35 +119,6 @@ else if ($action == 'specimen') // For fiche inter
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...)
|
|
||||||
if ($action == 'setModuleOptions')
|
|
||||||
{
|
|
||||||
$post_size=count($_POST);
|
|
||||||
|
|
||||||
$db->begin();
|
|
||||||
|
|
||||||
for($i=0;$i < $post_size;$i++)
|
|
||||||
{
|
|
||||||
if (array_key_exists('param'.$i,$_POST))
|
|
||||||
{
|
|
||||||
$param=GETPOST("param".$i,'alpha');
|
|
||||||
$value=GETPOST("value".$i,'alpha');
|
|
||||||
if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity);
|
|
||||||
if (! $res > 0) $error++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (! $error)
|
|
||||||
{
|
|
||||||
$db->commit();
|
|
||||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$db->rollback();
|
|
||||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Activate a model
|
// Activate a model
|
||||||
else if ($action == 'set')
|
else if ($action == 'set')
|
||||||
{
|
{
|
||||||
@ -194,7 +168,7 @@ else if ($action == 'setoptions')
|
|||||||
{
|
{
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$freetext= GETPOST('EXPENSEREPORT_FREE_TEXT'); // No alpha here, we want exact string
|
$freetext= GETPOST('EXPENSEREPORT_FREE_TEXT','none'); // No alpha here, we want exact string
|
||||||
$res1 = dolibarr_set_const($db, "EXPENSEREPORT_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
|
$res1 = dolibarr_set_const($db, "EXPENSEREPORT_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
$draft= GETPOST('EXPENSEREPORT_DRAFT_WATERMARK','alpha');
|
$draft= GETPOST('EXPENSEREPORT_DRAFT_WATERMARK','alpha');
|
||||||
|
|||||||
@ -51,6 +51,8 @@ $type='invoice';
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||||
|
|
||||||
if ($action == 'updateMask')
|
if ($action == 'updateMask')
|
||||||
{
|
{
|
||||||
$maskconstinvoice=GETPOST('maskconstinvoice','alpha');
|
$maskconstinvoice=GETPOST('maskconstinvoice','alpha');
|
||||||
@ -123,31 +125,6 @@ if ($action == 'specimen')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// define constants for models generator that need parameters
|
|
||||||
if ($action == 'setModuleOptions')
|
|
||||||
{
|
|
||||||
$post_size=count($_POST);
|
|
||||||
for($i=0;$i < $post_size;$i++)
|
|
||||||
{
|
|
||||||
if (array_key_exists('param'.$i,$_POST))
|
|
||||||
{
|
|
||||||
$param=GETPOST("param".$i,'alpha');
|
|
||||||
$value=GETPOST("value".$i,'alpha');
|
|
||||||
if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (! $res > 0) $error++;
|
|
||||||
|
|
||||||
if (! $error)
|
|
||||||
{
|
|
||||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Activate a model
|
// Activate a model
|
||||||
else if ($action == 'set')
|
else if ($action == 'set')
|
||||||
{
|
{
|
||||||
@ -229,7 +206,7 @@ if ($action == 'set_FACTURE_DRAFT_WATERMARK')
|
|||||||
|
|
||||||
if ($action == 'set_INVOICE_FREE_TEXT')
|
if ($action == 'set_INVOICE_FREE_TEXT')
|
||||||
{
|
{
|
||||||
$freetext = GETPOST('INVOICE_FREE_TEXT'); // No alpha here, we want exact string
|
$freetext = GETPOST('INVOICE_FREE_TEXT','none'); // No alpha here, we want exact string
|
||||||
|
|
||||||
$res = dolibarr_set_const($db, "INVOICE_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
|
$res = dolibarr_set_const($db, "INVOICE_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
|
|||||||
@ -51,6 +51,9 @@ $type='ficheinter';
|
|||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||||
|
|
||||||
if ($action == 'updateMask')
|
if ($action == 'updateMask')
|
||||||
{
|
{
|
||||||
$maskconst=GETPOST('maskconst','alpha');
|
$maskconst=GETPOST('maskconst','alpha');
|
||||||
@ -114,35 +117,6 @@ else if ($action == 'specimen') // For fiche inter
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...)
|
|
||||||
if ($action == 'setModuleOptions')
|
|
||||||
{
|
|
||||||
$post_size=count($_POST);
|
|
||||||
|
|
||||||
$db->begin();
|
|
||||||
|
|
||||||
for($i=0;$i < $post_size;$i++)
|
|
||||||
{
|
|
||||||
if (array_key_exists('param'.$i,$_POST))
|
|
||||||
{
|
|
||||||
$param=GETPOST("param".$i,'alpha');
|
|
||||||
$value=GETPOST("value".$i,'alpha');
|
|
||||||
if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity);
|
|
||||||
if (! $res > 0) $error++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (! $error)
|
|
||||||
{
|
|
||||||
$db->commit();
|
|
||||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$db->rollback();
|
|
||||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Activate a model
|
// Activate a model
|
||||||
else if ($action == 'set')
|
else if ($action == 'set')
|
||||||
{
|
{
|
||||||
@ -186,7 +160,7 @@ else if ($action == 'setmod')
|
|||||||
|
|
||||||
else if ($action == 'set_FICHINTER_FREE_TEXT')
|
else if ($action == 'set_FICHINTER_FREE_TEXT')
|
||||||
{
|
{
|
||||||
$freetext= GETPOST('FICHINTER_FREE_TEXT'); // No alpha here, we want exact string
|
$freetext= GETPOST('FICHINTER_FREE_TEXT','none'); // No alpha here, we want exact string
|
||||||
$res = dolibarr_set_const($db, "FICHINTER_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
|
$res = dolibarr_set_const($db, "FICHINTER_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
if (! $res > 0) $error++;
|
if (! $res > 0) $error++;
|
||||||
|
|||||||
@ -47,10 +47,13 @@ $label = GETPOST('label','alpha');
|
|||||||
$scandir = GETPOST('scandir','alpha');
|
$scandir = GETPOST('scandir','alpha');
|
||||||
$type='delivery';
|
$type='delivery';
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||||
|
|
||||||
if ($action == 'updateMask')
|
if ($action == 'updateMask')
|
||||||
{
|
{
|
||||||
$maskconstdelivery=GETPOST('maskconstdelivery','alpha');
|
$maskconstdelivery=GETPOST('maskconstdelivery','alpha');
|
||||||
@ -71,7 +74,7 @@ if ($action == 'updateMask')
|
|||||||
|
|
||||||
if ($action == 'set_DELIVERY_FREE_TEXT')
|
if ($action == 'set_DELIVERY_FREE_TEXT')
|
||||||
{
|
{
|
||||||
$free=GETPOST('DELIVERY_FREE_TEXT'); // No alpha here, we want exact string
|
$free=GETPOST('DELIVERY_FREE_TEXT','none'); // No alpha here, we want exact string
|
||||||
$res=dolibarr_set_const($db, "DELIVERY_FREE_TEXT",$free,'chaine',0,'',$conf->entity);
|
$res=dolibarr_set_const($db, "DELIVERY_FREE_TEXT",$free,'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
if (! $res > 0) $error++;
|
if (! $res > 0) $error++;
|
||||||
@ -131,35 +134,6 @@ if ($action == 'specimen')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...)
|
|
||||||
if ($action == 'setModuleOptions')
|
|
||||||
{
|
|
||||||
$post_size=count($_POST);
|
|
||||||
|
|
||||||
$db->begin();
|
|
||||||
|
|
||||||
for($i=0;$i < $post_size;$i++)
|
|
||||||
{
|
|
||||||
if (array_key_exists('param'.$i,$_POST))
|
|
||||||
{
|
|
||||||
$param=GETPOST("param".$i,'alpha');
|
|
||||||
$value=GETPOST("value".$i,'alpha');
|
|
||||||
if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity);
|
|
||||||
if (! $res > 0) $error++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (! $error)
|
|
||||||
{
|
|
||||||
$db->commit();
|
|
||||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$db->rollback();
|
|
||||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($action == 'set')
|
if ($action == 'set')
|
||||||
{
|
{
|
||||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||||
|
|||||||
@ -71,7 +71,7 @@ if ($action == 'setmod')
|
|||||||
|
|
||||||
if ($action == 'setparams')
|
if ($action == 'setparams')
|
||||||
{
|
{
|
||||||
$freetext = GETPOST('FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS'); // No alpha here, we want exact string
|
$freetext = GETPOST('FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS','none'); // No alpha here, we want exact string
|
||||||
|
|
||||||
$res = dolibarr_set_const($db, "FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS",$freetext,'chaine',0,'',$conf->entity);
|
$res = dolibarr_set_const($db, "FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS",$freetext,'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
@ -81,19 +81,6 @@ if ($action == 'setparams')
|
|||||||
{
|
{
|
||||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
$freetext = GETPOST('INVOICE_AUTO_FILLJS'); // No alpha here, we want exact string
|
|
||||||
|
|
||||||
$res = dolibarr_set_const($db, "INVOICE_AUTO_FILLJS",$freetext,'chaine',0,'',$conf->entity);
|
|
||||||
|
|
||||||
if (! $res > 0) $error++;
|
|
||||||
|
|
||||||
if ($error)
|
|
||||||
{
|
|
||||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
|
||||||
}*/
|
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||||
|
|||||||
@ -49,6 +49,9 @@ $type='propal';
|
|||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
if ($action == 'updateMask')
|
if ($action == 'updateMask')
|
||||||
{
|
{
|
||||||
@ -132,7 +135,7 @@ if ($action == 'set_PROPALE_DRAFT_WATERMARK')
|
|||||||
|
|
||||||
if ($action == 'set_PROPOSAL_FREE_TEXT')
|
if ($action == 'set_PROPOSAL_FREE_TEXT')
|
||||||
{
|
{
|
||||||
$freetext = GETPOST('PROPOSAL_FREE_TEXT'); // No alpha here, we want exact string
|
$freetext = GETPOST('PROPOSAL_FREE_TEXT','none'); // No alpha here, we want exact string
|
||||||
|
|
||||||
$res = dolibarr_set_const($db, "PROPOSAL_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
|
$res = dolibarr_set_const($db, "PROPOSAL_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
@ -180,35 +183,6 @@ if ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...)
|
|
||||||
if ($action == 'setModuleOptions')
|
|
||||||
{
|
|
||||||
$post_size=count($_POST);
|
|
||||||
|
|
||||||
$db->begin();
|
|
||||||
|
|
||||||
for($i=0;$i < $post_size;$i++)
|
|
||||||
{
|
|
||||||
if (array_key_exists('param'.$i,$_POST))
|
|
||||||
{
|
|
||||||
$param=GETPOST("param".$i,'alpha');
|
|
||||||
$value=GETPOST("value".$i,'alpha');
|
|
||||||
if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity);
|
|
||||||
if (! $res > 0) $error++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (! $error)
|
|
||||||
{
|
|
||||||
$db->commit();
|
|
||||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$db->rollback();
|
|
||||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Activate a model
|
// Activate a model
|
||||||
if ($action == 'set')
|
if ($action == 'set')
|
||||||
{
|
{
|
||||||
|
|||||||
@ -172,7 +172,7 @@ if ($action == 'addcat')
|
|||||||
|
|
||||||
if ($action == 'set_SUPPLIER_INVOICE_FREE_TEXT')
|
if ($action == 'set_SUPPLIER_INVOICE_FREE_TEXT')
|
||||||
{
|
{
|
||||||
$freetext = GETPOST('SUPPLIER_INVOICE_FREE_TEXT'); // No alpha here, we want exact string
|
$freetext = GETPOST('SUPPLIER_INVOICE_FREE_TEXT','none'); // No alpha here, we want exact string
|
||||||
|
|
||||||
$res = dolibarr_set_const($db, "SUPPLIER_INVOICE_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
|
$res = dolibarr_set_const($db, "SUPPLIER_INVOICE_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
|
|||||||
@ -169,7 +169,7 @@ else if ($action == 'addcat')
|
|||||||
|
|
||||||
else if ($action == 'set_SUPPLIER_ORDER_OTHER')
|
else if ($action == 'set_SUPPLIER_ORDER_OTHER')
|
||||||
{
|
{
|
||||||
$freetext = GETPOST('SUPPLIER_ORDER_FREE_TEXT'); // No alpha here, we want exact string
|
$freetext = GETPOST('SUPPLIER_ORDER_FREE_TEXT','none'); // No alpha here, we want exact string
|
||||||
$doubleapproval = GETPOST('SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED','alpha');
|
$doubleapproval = GETPOST('SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED','alpha');
|
||||||
$doubleapproval = price2num($doubleapproval );
|
$doubleapproval = price2num($doubleapproval );
|
||||||
|
|
||||||
|
|||||||
@ -47,6 +47,8 @@ $type='supplier_payment';
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||||
|
|
||||||
if ($action == 'updateMask')
|
if ($action == 'updateMask')
|
||||||
{
|
{
|
||||||
$maskconstsupplierpayment=GETPOST('maskconstsupplierpayment','alpha');
|
$maskconstsupplierpayment=GETPOST('maskconstsupplierpayment','alpha');
|
||||||
@ -68,31 +70,6 @@ if ($action == 'updateMask')
|
|||||||
dolibarr_set_const($db, "SUPPLIER_PAYMENT_ADDON", $value, 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, "SUPPLIER_PAYMENT_ADDON", $value, 'chaine', 0, '', $conf->entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
// define constants for models generator that need parameters
|
|
||||||
else if ($action == 'setModuleOptions')
|
|
||||||
{
|
|
||||||
$post_size=count($_POST);
|
|
||||||
for($i=0;$i < $post_size;$i++)
|
|
||||||
{
|
|
||||||
if (array_key_exists('param'.$i,$_POST))
|
|
||||||
{
|
|
||||||
$param=GETPOST("param".$i,'alpha');
|
|
||||||
$value=GETPOST("value".$i,'alpha');
|
|
||||||
if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (! $res > 0) $error++;
|
|
||||||
|
|
||||||
if (! $error)
|
|
||||||
{
|
|
||||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Activate a model
|
// Activate a model
|
||||||
else if ($action == 'set')
|
else if ($action == 'set')
|
||||||
{
|
{
|
||||||
|
|||||||
@ -41,10 +41,15 @@ $label = GETPOST('label','alpha');
|
|||||||
$scandir = GETPOST('scandir','alpha');
|
$scandir = GETPOST('scandir','alpha');
|
||||||
$type='supplier_proposal';
|
$type='supplier_proposal';
|
||||||
|
|
||||||
|
$error=0;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
$error=0;
|
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||||
|
|
||||||
if ($action == 'updateMask')
|
if ($action == 'updateMask')
|
||||||
{
|
{
|
||||||
$maskconstsupplier_proposal=GETPOST('maskconstsupplier_proposal','alpha');
|
$maskconstsupplier_proposal=GETPOST('maskconstsupplier_proposal','alpha');
|
||||||
@ -127,7 +132,7 @@ if ($action == 'set_SUPPLIER_PROPOSAL_DRAFT_WATERMARK')
|
|||||||
|
|
||||||
if ($action == 'set_SUPPLIER_PROPOSAL_FREE_TEXT')
|
if ($action == 'set_SUPPLIER_PROPOSAL_FREE_TEXT')
|
||||||
{
|
{
|
||||||
$freetext = GETPOST('SUPPLIER_PROPOSAL_FREE_TEXT'); // No alpha here, we want exact string
|
$freetext = GETPOST('SUPPLIER_PROPOSAL_FREE_TEXT','none'); // No alpha here, we want exact string
|
||||||
|
|
||||||
$res = dolibarr_set_const($db, "SUPPLIER_PROPOSAL_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
|
$res = dolibarr_set_const($db, "SUPPLIER_PROPOSAL_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
@ -159,35 +164,6 @@ if ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...)
|
|
||||||
if ($action == 'setModuleOptions')
|
|
||||||
{
|
|
||||||
$post_size=count($_POST);
|
|
||||||
|
|
||||||
$db->begin();
|
|
||||||
|
|
||||||
for($i=0;$i < $post_size;$i++)
|
|
||||||
{
|
|
||||||
if (array_key_exists('param'.$i,$_POST))
|
|
||||||
{
|
|
||||||
$param=GETPOST("param".$i,'alpha');
|
|
||||||
$value=GETPOST("value".$i,'alpha');
|
|
||||||
if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity);
|
|
||||||
if (! $res > 0) $error++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (! $error)
|
|
||||||
{
|
|
||||||
$db->commit();
|
|
||||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$db->rollback();
|
|
||||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Activate a model
|
// Activate a model
|
||||||
if ($action == 'set')
|
if ($action == 'set')
|
||||||
{
|
{
|
||||||
|
|||||||
@ -47,37 +47,9 @@ $type='user';
|
|||||||
* Action
|
* Action
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Activate a model
|
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||||
|
|
||||||
// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...)
|
if ($action == 'set_default')
|
||||||
if ($action == 'setModuleOptions')
|
|
||||||
{
|
|
||||||
$post_size=count($_POST);
|
|
||||||
|
|
||||||
$db->begin();
|
|
||||||
|
|
||||||
for($i=0;$i < $post_size;$i++)
|
|
||||||
{
|
|
||||||
if (array_key_exists('param'.$i,$_POST))
|
|
||||||
{
|
|
||||||
$param=GETPOST("param".$i,'alpha');
|
|
||||||
$value=GETPOST("value".$i,'alpha');
|
|
||||||
if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity);
|
|
||||||
if (! $res > 0) $error++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (! $error)
|
|
||||||
{
|
|
||||||
$db->commit();
|
|
||||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$db->rollback();
|
|
||||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
elseif ($action == 'set_default')
|
|
||||||
{
|
{
|
||||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||||
$res = true;
|
$res = true;
|
||||||
|
|||||||
@ -47,37 +47,9 @@ $type='group';
|
|||||||
* Action
|
* Action
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Activate a model
|
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||||
|
|
||||||
// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...)
|
if ($action == 'set_default')
|
||||||
if ($action == 'setModuleOptions')
|
|
||||||
{
|
|
||||||
$post_size=count($_POST);
|
|
||||||
|
|
||||||
$db->begin();
|
|
||||||
|
|
||||||
for($i=0;$i < $post_size;$i++)
|
|
||||||
{
|
|
||||||
if (array_key_exists('param'.$i,$_POST))
|
|
||||||
{
|
|
||||||
$param=GETPOST("param".$i,'alpha');
|
|
||||||
$value=GETPOST("value".$i,'alpha');
|
|
||||||
if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity);
|
|
||||||
if (! $res > 0) $error++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (! $error)
|
|
||||||
{
|
|
||||||
$db->commit();
|
|
||||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$db->rollback();
|
|
||||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
elseif ($action == 'set_default')
|
|
||||||
{
|
{
|
||||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||||
$res = true;
|
$res = true;
|
||||||
|
|||||||
@ -1208,7 +1208,7 @@ if ($id > 0)
|
|||||||
$out.=img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone pictoactionview"');
|
$out.=img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone pictoactionview"');
|
||||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_month&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewCal").'</a>';
|
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_month&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewCal").'</a>';
|
||||||
$out.=img_picto($langs->trans("ViewWeek"),'object_calendarweek','class="hideonsmartphone pictoactionview"');
|
$out.=img_picto($langs->trans("ViewWeek"),'object_calendarweek','class="hideonsmartphone pictoactionview"');
|
||||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewWeek").'</a>';
|
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_week&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewWeek").'</a>';
|
||||||
$out.=img_picto($langs->trans("ViewDay"),'object_calendarday','class="hideonsmartphone pictoactionview"');
|
$out.=img_picto($langs->trans("ViewDay"),'object_calendarday','class="hideonsmartphone pictoactionview"');
|
||||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewDay").'</a>';
|
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewDay").'</a>';
|
||||||
$linkback.=$out;
|
$linkback.=$out;
|
||||||
|
|||||||
@ -361,6 +361,7 @@ class Facture extends CommonInvoice
|
|||||||
'__INVOICE_NEXT_YEAR__' => dol_print_date(dol_time_plus_duree($this->date, 1, 'y'), '%Y'),
|
'__INVOICE_NEXT_YEAR__' => dol_print_date(dol_time_plus_duree($this->date, 1, 'y'), '%Y'),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$substitutionisok=true;
|
||||||
complete_substitutions_array($substitutionarray, $outputlangs);
|
complete_substitutions_array($substitutionarray, $outputlangs);
|
||||||
|
|
||||||
$this->note_public=make_substitutions($this->note_public,$substitutionarray);
|
$this->note_public=make_substitutions($this->note_public,$substitutionarray);
|
||||||
@ -2650,7 +2651,7 @@ class Facture extends CommonInvoice
|
|||||||
* @param double $pu_ht_devise Unit price in currency
|
* @param double $pu_ht_devise Unit price in currency
|
||||||
* @return int < 0 if KO, > 0 if OK
|
* @return int < 0 if KO, > 0 if OK
|
||||||
*/
|
*/
|
||||||
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type= self::TYPE_STANDARD, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_options=0, $situation_percent=0, $fk_unit = null, $pu_ht_devise = 0)
|
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type= self::TYPE_STANDARD, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_options=0, $situation_percent=100, $fk_unit = null, $pu_ht_devise = 0)
|
||||||
{
|
{
|
||||||
global $conf,$user;
|
global $conf,$user;
|
||||||
// Deprecation warning
|
// Deprecation warning
|
||||||
|
|||||||
@ -1272,16 +1272,6 @@ class BonPrelevement extends CommonObject
|
|||||||
* section Debiteur (sepa Debiteurs bloc lines)
|
* section Debiteur (sepa Debiteurs bloc lines)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*$tmp_invoices = array();
|
|
||||||
|
|
||||||
$sql = "SELECT f.facnumber as fac FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl, ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."prelevement_facture as pf, ".MAIN_DB_PREFIX."societe as soc, ".MAIN_DB_PREFIX."c_country as p, ".MAIN_DB_PREFIX."societe_rib as rib WHERE pl.fk_prelevement_bons = ".$this->id." AND pl.rowid = pf.fk_prelevement_lignes AND pf.fk_facture = f.rowid AND soc.fk_pays = p.rowid AND soc.rowid = f.fk_soc AND rib.fk_soc = f.fk_soc AND rib.default_rib = 1";
|
|
||||||
$resql=$this->db->query($sql);
|
|
||||||
if ($resql) {
|
|
||||||
while ($objfac = $this->db->fetch_object($resql)) {
|
|
||||||
$tmp_invoices[] = $objfac->fac;
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
$sql = "SELECT soc.code_client as code, soc.address, soc.zip, soc.town, c.code as country_code,";
|
$sql = "SELECT soc.code_client as code, soc.address, soc.zip, soc.town, c.code as country_code,";
|
||||||
$sql.= " pl.client_nom as nom, pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,";
|
$sql.= " pl.client_nom as nom, pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,";
|
||||||
$sql.= " f.facnumber as fac, pf.fk_facture as idfac, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum";
|
$sql.= " f.facnumber as fac, pf.fk_facture as idfac, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum";
|
||||||
@ -1365,35 +1355,6 @@ class BonPrelevement extends CommonObject
|
|||||||
fputs($this->file, ' </PmtInf>'.$CrLf);
|
fputs($this->file, ' </PmtInf>'.$CrLf);
|
||||||
fputs($this->file, ' </CstmrDrctDbtInitn>'.$CrLf);
|
fputs($this->file, ' </CstmrDrctDbtInitn>'.$CrLf);
|
||||||
fputs($this->file, '</Document>'.$CrLf);
|
fputs($this->file, '</Document>'.$CrLf);
|
||||||
|
|
||||||
/*$sql = "SELECT pl.amount";
|
|
||||||
$sql.= " FROM";
|
|
||||||
$sql.= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
|
|
||||||
$sql.= " ".MAIN_DB_PREFIX."facture as f,";
|
|
||||||
$sql.= " ".MAIN_DB_PREFIX."prelevement_facture as pf";
|
|
||||||
$sql.= " WHERE pl.fk_prelevement_bons = ".$this->id;
|
|
||||||
$sql.= " AND pl.rowid = pf.fk_prelevement_lignes";
|
|
||||||
$sql.= " AND pf.fk_facture = f.rowid";
|
|
||||||
|
|
||||||
//Lines
|
|
||||||
$i = 0;
|
|
||||||
$resql=$this->db->query($sql);
|
|
||||||
if ($resql)
|
|
||||||
{
|
|
||||||
$num = $this->db->num_rows($resql);
|
|
||||||
|
|
||||||
while ($i < $num)
|
|
||||||
{
|
|
||||||
$obj = $this->db->fetch_object($resql);
|
|
||||||
$this->total = $this->total + $obj->amount;
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$result = -2;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build file for Other Countries with unknow format
|
// Build file for Other Countries with unknow format
|
||||||
@ -1580,11 +1541,11 @@ class BonPrelevement extends CommonObject
|
|||||||
$XML_DEBITOR .=' </FinInstnId>'.$CrLf;
|
$XML_DEBITOR .=' </FinInstnId>'.$CrLf;
|
||||||
$XML_DEBITOR .=' </DbtrAgt>'.$CrLf;
|
$XML_DEBITOR .=' </DbtrAgt>'.$CrLf;
|
||||||
$XML_DEBITOR .=' <Dbtr>'.$CrLf;
|
$XML_DEBITOR .=' <Dbtr>'.$CrLf;
|
||||||
$XML_DEBITOR .=' <Nm>'.strtoupper(dol_string_unaccent($row_nom)).'</Nm>'.$CrLf;
|
$XML_DEBITOR .=' <Nm>'.dolEscapeXML(strtoupper(dol_string_unaccent($row_nom))).'</Nm>'.$CrLf;
|
||||||
$XML_DEBITOR .=' <PstlAdr>'.$CrLf;
|
$XML_DEBITOR .=' <PstlAdr>'.$CrLf;
|
||||||
$XML_DEBITOR .=' <Ctry>'.$row_country_code.'</Ctry>'.$CrLf;
|
$XML_DEBITOR .=' <Ctry>'.$row_country_code.'</Ctry>'.$CrLf;
|
||||||
$XML_DEBITOR .=' <AdrLine>'.dol_string_unaccent(strtr($row_address, array(CHR(13) => ", ", CHR(10) => ""))).'</AdrLine>'.$CrLf;
|
$XML_DEBITOR .=' <AdrLine>'.dolEscapeXML(dol_trunc(dol_string_unaccent(strtr($row_address, array(CHR(13) => ", ", CHR(10) => ""))),70,'right','UTF-8',true)).'</AdrLine>'.$CrLf;
|
||||||
$XML_DEBITOR .=' <AdrLine>'.dol_string_unaccent($row_zip.' '.$row_town).'</AdrLine>'.$CrLf;
|
$XML_DEBITOR .=' <AdrLine>'.dolEscapeXML(dol_string_unaccent($row_zip.' '.$row_town)).'</AdrLine>'.$CrLf;
|
||||||
$XML_DEBITOR .=' </PstlAdr>'.$CrLf;
|
$XML_DEBITOR .=' </PstlAdr>'.$CrLf;
|
||||||
$XML_DEBITOR .=' </Dbtr>'.$CrLf;
|
$XML_DEBITOR .=' </Dbtr>'.$CrLf;
|
||||||
$XML_DEBITOR .=' <DbtrAcct>'.$CrLf;
|
$XML_DEBITOR .=' <DbtrAcct>'.$CrLf;
|
||||||
|
|||||||
@ -2225,7 +2225,11 @@ class Contrat extends CommonObject
|
|||||||
$line->total_ht=90;
|
$line->total_ht=90;
|
||||||
$line->total_ttc=107.64; // 90 * 1.196
|
$line->total_ttc=107.64; // 90 * 1.196
|
||||||
$line->total_tva=17.64;
|
$line->total_tva=17.64;
|
||||||
if ($num_prods > 0)
|
$line->date_ouverture = dol_now() - 200000;
|
||||||
|
$line->date_ouverture_prevue = dol_now() - 500000;
|
||||||
|
$line->date_fin_validite = dol_now() + 500000;
|
||||||
|
$line->date_cloture = dol_now() - 100000;
|
||||||
|
if ($num_prods > 0)
|
||||||
{
|
{
|
||||||
$prodid = mt_rand(1, $num_prods);
|
$prodid = mt_rand(1, $num_prods);
|
||||||
$line->fk_product=$prodids[$prodid];
|
$line->fk_product=$prodids[$prodid];
|
||||||
@ -2233,11 +2237,6 @@ class Contrat extends CommonObject
|
|||||||
$this->lines[$xnbp]=$line;
|
$this->lines[$xnbp]=$line;
|
||||||
$xnbp++;
|
$xnbp++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->amount_ht = $xnbp*100;
|
|
||||||
$this->total_ht = $xnbp*100;
|
|
||||||
$this->total_tva = $xnbp*19.6;
|
|
||||||
$this->total_ttc = $xnbp*119.6;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2750,6 +2749,8 @@ class ContratLigne extends CommonObjectLine
|
|||||||
if (empty($this->total_ht)) $this->total_ht = 0;
|
if (empty($this->total_ht)) $this->total_ht = 0;
|
||||||
if (empty($this->total_tva)) $this->total_tva = 0;
|
if (empty($this->total_tva)) $this->total_tva = 0;
|
||||||
if (empty($this->total_ttc)) $this->total_ttc = 0;
|
if (empty($this->total_ttc)) $this->total_ttc = 0;
|
||||||
|
if (empty($this->localtax1_tx)) $this->localtax1_tx = 0;
|
||||||
|
if (empty($this->localtax2_tx)) $this->localtax2_tx = 0;
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
// Put here code to add control on parameters values
|
// Put here code to add control on parameters values
|
||||||
|
|||||||
@ -24,7 +24,9 @@
|
|||||||
|
|
||||||
// $massaction must be defined
|
// $massaction must be defined
|
||||||
// $objectclass and $$objectlabel must be defined
|
// $objectclass and $$objectlabel must be defined
|
||||||
// $uploaddir (example $conf->projet->dir_output . "/";)
|
// $parameters, $object, $action must be defined for the hook.
|
||||||
|
|
||||||
|
// $uploaddir may be defined (example to $conf->projet->dir_output."/";)
|
||||||
// $toselect may be defined
|
// $toselect may be defined
|
||||||
|
|
||||||
|
|
||||||
@ -36,8 +38,8 @@ if (empty($objectclass) || empty($uploaddir))
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Mass actions. Controls on number of lines checked
|
// Mass actions. Controls on number of lines checked.
|
||||||
$maxformassaction=1000;
|
$maxformassaction=(empty($conf->global->MAIN_LIMIT_FOR_MASS_ACTIONS)?1000:$conf->global->MAIN_LIMIT_FOR_MASS_ACTIONS);
|
||||||
if (! empty($massaction) && count($toselect) < 1)
|
if (! empty($massaction) && count($toselect) < 1)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
@ -565,6 +567,11 @@ if (! $error && $massaction == 'delete' && $permtodelete)
|
|||||||
//var_dump($listofobjectthirdparties);exit;
|
//var_dump($listofobjectthirdparties);exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$parameters['toselect']=$toselect;
|
||||||
|
$parameters['uploaddir']=$uploaddir;
|
||||||
|
|
||||||
|
$reshook=$hookmanager->executeHooks('doMassActions',$parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
86
htdocs/core/actions_setmoduleoptions.inc.php
Normal file
86
htdocs/core/actions_setmoduleoptions.inc.php
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2014 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/>.
|
||||||
|
* or see http://www.gnu.org/
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/core/actions_setnotes.inc.php
|
||||||
|
* \brief Code for actions on setting notes of object page
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
// $action must be defined
|
||||||
|
// $_FILES may be defined
|
||||||
|
// $nomessageinsetmoduleoptions can be set to 1
|
||||||
|
|
||||||
|
// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...)
|
||||||
|
if ($action == 'setModuleOptions')
|
||||||
|
{
|
||||||
|
$db->begin();
|
||||||
|
|
||||||
|
// Process common param fields
|
||||||
|
foreach($_POST as $key => $val)
|
||||||
|
{
|
||||||
|
if (preg_match('/^param(\d*)$/', $key, $reg)) // Works for POST['param'], POST['param1'], POST['param2'], ...
|
||||||
|
{
|
||||||
|
$param=GETPOST("param".$reg[1],'alpha');
|
||||||
|
$value=GETPOST("value".$reg[1],'alpha');
|
||||||
|
if ($param)
|
||||||
|
{
|
||||||
|
$res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity);
|
||||||
|
if (! $res > 0) $error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Process upload fields
|
||||||
|
if (GETPOST('upload','alpha') && GETPOST('keyforuploaddir','aZ09'))
|
||||||
|
{
|
||||||
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
$keyforuploaddir=GETPOST('keyforuploaddir','aZ09');
|
||||||
|
$listofdir=explode(',',preg_replace('/[\r\n]+/',',',trim($conf->global->$keyforuploaddir)));
|
||||||
|
foreach($listofdir as $key=>$tmpdir)
|
||||||
|
{
|
||||||
|
$tmpdir=trim($tmpdir);
|
||||||
|
$tmpdir=preg_replace('/DOL_DATA_ROOT/',DOL_DATA_ROOT,$tmpdir);
|
||||||
|
if (! $tmpdir) {
|
||||||
|
unset($listofdir[$key]); continue;
|
||||||
|
}
|
||||||
|
if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$upload_dir=$tmpdir;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($upload_dir)
|
||||||
|
{
|
||||||
|
$result = dol_add_file_process($upload_dir, 0, 1, 'uploadfile', '');
|
||||||
|
if ($result <= 0) $error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
$db->commit();
|
||||||
|
if (empty($nomessageinsetmoduleoptions)) setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$db->rollback();
|
||||||
|
if (empty($nomessageinsetmoduleoptions)) setEventMessages($langs->trans("SetupNotSaved"), null, 'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ -1681,7 +1681,7 @@ class ExtraFields
|
|||||||
// Clean parameters
|
// Clean parameters
|
||||||
$value_key=dol_mktime($_POST[$keysuffix."options_".$key.$keyprefix."hour"], $_POST[$keysuffix."options_".$key.$keyprefix."min"], 0, $_POST[$keysuffix."options_".$key.$keyprefix."month"], $_POST[$keysuffix."options_".$key.$keyprefix."day"], $_POST[$keysuffix."options_".$key.$keyprefix."year"]);
|
$value_key=dol_mktime($_POST[$keysuffix."options_".$key.$keyprefix."hour"], $_POST[$keysuffix."options_".$key.$keyprefix."min"], 0, $_POST[$keysuffix."options_".$key.$keyprefix."month"], $_POST[$keysuffix."options_".$key.$keyprefix."day"], $_POST[$keysuffix."options_".$key.$keyprefix."year"]);
|
||||||
}
|
}
|
||||||
else if (in_array($key_type,array('checkbox')))
|
else if (in_array($key_type,array('checkbox', 'chkbxlst')))
|
||||||
{
|
{
|
||||||
$value_arr=GETPOST($keysuffix."options_".$key.$keyprefix);
|
$value_arr=GETPOST($keysuffix."options_".$key.$keyprefix);
|
||||||
// Make sure we get an array even if there's only one checkbox
|
// Make sure we get an array even if there's only one checkbox
|
||||||
|
|||||||
@ -133,11 +133,14 @@ class HookManager
|
|||||||
if (in_array(
|
if (in_array(
|
||||||
$method,
|
$method,
|
||||||
array(
|
array(
|
||||||
'addMoreActionsButtons',
|
'addCalendarChoice',
|
||||||
|
'addMoreActionsButtons',
|
||||||
|
'addMoreMassActions',
|
||||||
'addSearchEntry',
|
'addSearchEntry',
|
||||||
'addStatisticLine',
|
'addStatisticLine',
|
||||||
'deleteFile',
|
'deleteFile',
|
||||||
'doActions',
|
'doActions',
|
||||||
|
'doMassActions',
|
||||||
'formCreateThirdpartyOptions',
|
'formCreateThirdpartyOptions',
|
||||||
'formObjectOptions',
|
'formObjectOptions',
|
||||||
'formattachOptions',
|
'formattachOptions',
|
||||||
@ -169,7 +172,6 @@ class HookManager
|
|||||||
'printSearchForm',
|
'printSearchForm',
|
||||||
'printTabsHead',
|
'printTabsHead',
|
||||||
'formatEvent',
|
'formatEvent',
|
||||||
'addCalendarChoice',
|
|
||||||
'printObjectLine',
|
'printObjectLine',
|
||||||
'printObjectSubLine',
|
'printObjectSubLine',
|
||||||
'createDictionaryFieldList',
|
'createDictionaryFieldList',
|
||||||
@ -181,14 +183,16 @@ class HookManager
|
|||||||
|
|
||||||
if ($method == 'insertExtraFields')
|
if ($method == 'insertExtraFields')
|
||||||
{
|
{
|
||||||
$hooktype='returnvalue'; // deprecated. TODO Remove all code with "executeHooks('insertExtraFields'" as soon as there is a trigger available.
|
$hooktype='returnvalue'; // @deprecated. TODO Remove all code with "executeHooks('insertExtraFields'" as soon as there is a trigger available.
|
||||||
dol_syslog("Warning: The hook 'insertExtraFields' is deprecated and must not be used. Use instead trigger on CRUD event (ask it to dev team if not implemented)", LOG_WARNING);
|
dol_syslog("Warning: The hook 'insertExtraFields' is deprecated and must not be used. Use instead trigger on CRUD event (ask it to dev team if not implemented)", LOG_WARNING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Init return properties
|
||||||
|
$this->resPrint=''; $this->resArray=array();
|
||||||
|
|
||||||
// Loop on each hook to qualify modules that have declared context
|
// Loop on each hook to qualify modules that have declared context
|
||||||
$modulealreadyexecuted=array();
|
$modulealreadyexecuted=array();
|
||||||
$resaction=0; $error=0; $result='';
|
$resaction=0; $error=0; $result='';
|
||||||
$this->resPrint=''; $this->resArray=array();
|
|
||||||
foreach($this->hooks as $context => $modules) // $this->hooks is an array with context as key and value is an array of modules that handle this context
|
foreach($this->hooks as $context => $modules) // $this->hooks is an array with context as key and value is an array of modules that handle this context
|
||||||
{
|
{
|
||||||
if (! empty($modules))
|
if (! empty($modules))
|
||||||
|
|||||||
@ -545,11 +545,20 @@ class Form
|
|||||||
$disabled=0;
|
$disabled=0;
|
||||||
$ret='<div class="centpercent center">';
|
$ret='<div class="centpercent center">';
|
||||||
$ret.='<select data-role="none" class="flat'.(empty($conf->use_javascript_ajax)?'':' hideobject').' massaction massactionselect" name="massaction"'.($disabled?' disabled="disabled"':'').'>';
|
$ret.='<select data-role="none" class="flat'.(empty($conf->use_javascript_ajax)?'':' hideobject').' massaction massactionselect" name="massaction"'.($disabled?' disabled="disabled"':'').'>';
|
||||||
$ret.='<option value="0"'.($disabled?' disabled="disabled"':'').'>-- '.$langs->trans("SelectAction").' --</option>';
|
|
||||||
foreach($arrayofaction as $code => $label)
|
// Complete list with data from external modules. THe module can use $_SERVER['PHP_SELF'] to know on which page we are, or use the $parameters['currentcontext'] completed by executeHooks.
|
||||||
{
|
$parameters=array();
|
||||||
$ret.='<option value="'.$code.'"'.($disabled?' disabled="disabled"':'').'>'.$label.'</option>';
|
$reshook=$hookmanager->executeHooks('addMoreMassActions',$parameters); // Note that $action and $object may have been modified by hook
|
||||||
}
|
if (empty($reshook))
|
||||||
|
{
|
||||||
|
$ret.='<option value="0"'.($disabled?' disabled="disabled"':'').'>-- '.$langs->trans("SelectAction").' --</option>';
|
||||||
|
foreach($arrayofaction as $code => $label)
|
||||||
|
{
|
||||||
|
$ret.='<option value="'.$code.'"'.($disabled?' disabled="disabled"':'').'>'.$label.'</option>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$ret.=$hookmanager->resPrint;
|
||||||
|
|
||||||
$ret.='</select>';
|
$ret.='</select>';
|
||||||
// Warning: if you set submit button to disabled, post using 'Enter' will no more work.
|
// Warning: if you set submit button to disabled, post using 'Enter' will no more work.
|
||||||
$ret.='<input type="submit" data-role="none" name="confirmmassaction" class="button'.(empty($conf->use_javascript_ajax)?'':' hideobject').' massaction massactionconfirmed" value="'.dol_escape_htmltag($langs->trans("Confirm")).'">';
|
$ret.='<input type="submit" data-role="none" name="confirmmassaction" class="button'.(empty($conf->use_javascript_ajax)?'':' hideobject').' massaction massactionconfirmed" value="'.dol_escape_htmltag($langs->trans("Confirm")).'">';
|
||||||
@ -1391,7 +1400,7 @@ class Form
|
|||||||
* @deprecated
|
* @deprecated
|
||||||
* @see select_dolusers()
|
* @see select_dolusers()
|
||||||
*/
|
*/
|
||||||
function select_users($selected='',$htmlname='userid',$show_empty=0,$exclude='',$disabled=0,$include='',$enableonly='',$force_entity=0)
|
function select_users($selected='',$htmlname='userid',$show_empty=0,$exclude=null,$disabled=0,$include='',$enableonly='',$force_entity=0)
|
||||||
{
|
{
|
||||||
print $this->select_dolusers($selected,$htmlname,$show_empty,$exclude,$disabled,$include,$enableonly,$force_entity);
|
print $this->select_dolusers($selected,$htmlname,$show_empty,$exclude,$disabled,$include,$enableonly,$force_entity);
|
||||||
}
|
}
|
||||||
@ -1411,13 +1420,13 @@ class Form
|
|||||||
* @param int $showstatus 0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status
|
* @param int $showstatus 0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status
|
||||||
* @param string $morefilter Add more filters into sql request
|
* @param string $morefilter Add more filters into sql request
|
||||||
* @param integer $show_every 0=default list, 1=add also a value "Everybody" at beginning of list
|
* @param integer $show_every 0=default list, 1=add also a value "Everybody" at beginning of list
|
||||||
* @param string $enableonlytext If option $enableonly is set, we use this text to explain into label why record is disabled. Not used if enableonly is empty.
|
* @param string $enableonlytext If option $enableonlytext is set, we use this text to explain into label why record is disabled. Not used if enableonly is empty.
|
||||||
* @param string $morecss More css
|
* @param string $morecss More css
|
||||||
* @param int $noactive Show only active users (this will also happened whatever is this option if USER_HIDE_INACTIVE_IN_COMBOBOX is on).
|
* @param int $noactive Show only active users (this will also happened whatever is this option if USER_HIDE_INACTIVE_IN_COMBOBOX is on).
|
||||||
* @return string HTML select string
|
* @return string HTML select string
|
||||||
* @see select_dolgroups
|
* @see select_dolgroups
|
||||||
*/
|
*/
|
||||||
function select_dolusers($selected='', $htmlname='userid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity=0, $maxlength=0, $showstatus=0, $morefilter='', $show_every=0, $enableonlytext='', $morecss='', $noactive=0)
|
function select_dolusers($selected='', $htmlname='userid', $show_empty=0, $exclude=null, $disabled=0, $include='', $enableonly='', $force_entity=0, $maxlength=0, $showstatus=0, $morefilter='', $show_every=0, $enableonlytext='', $morecss='', $noactive=0)
|
||||||
{
|
{
|
||||||
global $conf,$user,$langs;
|
global $conf,$user,$langs;
|
||||||
|
|
||||||
@ -1613,7 +1622,7 @@ class Form
|
|||||||
* @return string HTML select string
|
* @return string HTML select string
|
||||||
* @see select_dolgroups
|
* @see select_dolgroups
|
||||||
*/
|
*/
|
||||||
function select_dolusers_forevent($action='', $htmlname='userid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity=0, $maxlength=0, $showstatus=0, $morefilter='')
|
function select_dolusers_forevent($action='', $htmlname='userid', $show_empty=0, $exclude=null, $disabled=0, $include='', $enableonly='', $force_entity=0, $maxlength=0, $showstatus=0, $morefilter='')
|
||||||
{
|
{
|
||||||
global $conf,$user,$langs;
|
global $conf,$user,$langs;
|
||||||
|
|
||||||
|
|||||||
@ -693,16 +693,17 @@ class FormCompany
|
|||||||
* @param string $source Source ('internal' or 'external')
|
* @param string $source Source ('internal' or 'external')
|
||||||
* @param string $sortorder Sort criteria ('position', 'code', ...)
|
* @param string $sortorder Sort criteria ('position', 'code', ...)
|
||||||
* @param int $showempty 1=Add en empty line
|
* @param int $showempty 1=Add en empty line
|
||||||
|
* @param string $morecss Add more css to select component
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function selectTypeContact($object, $selected, $htmlname = 'type', $source='internal', $sortorder='position', $showempty=0)
|
function selectTypeContact($object, $selected, $htmlname = 'type', $source='internal', $sortorder='position', $showempty=0, $morecss='')
|
||||||
{
|
{
|
||||||
global $user, $langs;
|
global $user, $langs;
|
||||||
|
|
||||||
if (is_object($object) && method_exists($object, 'liste_type_contact'))
|
if (is_object($object) && method_exists($object, 'liste_type_contact'))
|
||||||
{
|
{
|
||||||
$lesTypes = $object->liste_type_contact($source, $sortorder, 0, 1);
|
$lesTypes = $object->liste_type_contact($source, $sortorder, 0, 1);
|
||||||
print '<select class="flat valignmiddle" name="'.$htmlname.'" id="'.$htmlname.'">';
|
print '<select class="flat valignmiddle'.($morecss?' '.$morecss:'').'" name="'.$htmlname.'" id="'.$htmlname.'">';
|
||||||
if ($showempty) print '<option value="0"></option>';
|
if ($showempty) print '<option value="0"></option>';
|
||||||
foreach($lesTypes as $key=>$value)
|
foreach($lesTypes as $key=>$value)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -170,21 +170,19 @@ class FormProjets
|
|||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$minmax='maxwidth500';
|
$morecss='maxwidth500';
|
||||||
|
|
||||||
// Use select2 selector
|
// Use select2 selector
|
||||||
$nodatarole='';
|
|
||||||
if (! empty($conf->use_javascript_ajax))
|
if (! empty($conf->use_javascript_ajax))
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||||
$comboenhancement = ajax_combobox($htmlid, array(), 0, $forcefocus);
|
$comboenhancement = ajax_combobox($htmlid, array(), 0, $forcefocus);
|
||||||
$out.=$comboenhancement;
|
$out.=$comboenhancement;
|
||||||
$nodatarole=($comboenhancement?' data-role="none"':'');
|
$morecss='minwidth100 maxwidth300';
|
||||||
$minmax='minwidth100 maxwidth300';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($option_only)) {
|
if (empty($option_only)) {
|
||||||
$out.= '<select class="flat'.($minmax?' '.$minmax:'').'"'.($disabled?' disabled="disabled"':'').' id="'.$htmlid.'" name="'.$htmlname.'"'.$nodatarole.'>';
|
$out.= '<select class="flat'.($morecss?' '.$morecss:'').'"'.($disabled?' disabled="disabled"':'').' id="'.$htmlid.'" name="'.$htmlname.'">';
|
||||||
}
|
}
|
||||||
if (!empty($show_empty)) {
|
if (!empty($show_empty)) {
|
||||||
$out.= '<option value="0"> </option>';
|
$out.= '<option value="0"> </option>';
|
||||||
@ -302,13 +300,14 @@ class FormProjets
|
|||||||
* @param string $htmlname Name of HTML select
|
* @param string $htmlname Name of HTML select
|
||||||
* @param int $maxlength Maximum length of label
|
* @param int $maxlength Maximum length of label
|
||||||
* @param int $option_only Return only html options lines without the select tag
|
* @param int $option_only Return only html options lines without the select tag
|
||||||
* @param int $show_empty Add an empty line
|
* @param string $show_empty Add an empty line ('1' or string to show for empty line)
|
||||||
* @param int $discard_closed Discard closed projects (0=Keep,1=hide completely,2=Disable)
|
* @param int $discard_closed Discard closed projects (0=Keep,1=hide completely,2=Disable)
|
||||||
* @param int $forcefocus Force focus on field (works with javascript only)
|
* @param int $forcefocus Force focus on field (works with javascript only)
|
||||||
* @param int $disabled Disabled
|
* @param int $disabled Disabled
|
||||||
|
* @param string $morecss More css added to the select component
|
||||||
* @return int Nbr of project if OK, <0 if KO
|
* @return int Nbr of project if OK, <0 if KO
|
||||||
*/
|
*/
|
||||||
function selectTasks($socid=-1, $selected='', $htmlname='taskid', $maxlength=24, $option_only=0, $show_empty=1, $discard_closed=0, $forcefocus=0, $disabled=0)
|
function selectTasks($socid=-1, $selected='', $htmlname='taskid', $maxlength=24, $option_only=0, $show_empty='1', $discard_closed=0, $forcefocus=0, $disabled=0, $morecss='maxwidth500')
|
||||||
{
|
{
|
||||||
global $user,$conf,$langs;
|
global $user,$conf,$langs;
|
||||||
|
|
||||||
@ -339,28 +338,26 @@ class FormProjets
|
|||||||
if ($socid > 0) $sql.= " AND (p.fk_soc=".$socid." OR p.fk_soc IS NULL)";
|
if ($socid > 0) $sql.= " AND (p.fk_soc=".$socid." OR p.fk_soc IS NULL)";
|
||||||
$sql.= " ORDER BY p.ref, t.ref ASC";
|
$sql.= " ORDER BY p.ref, t.ref ASC";
|
||||||
|
|
||||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$minmax='maxwidth500';
|
|
||||||
|
|
||||||
// Use select2 selector
|
// Use select2 selector
|
||||||
$nodatarole='';
|
|
||||||
if (! empty($conf->use_javascript_ajax))
|
if (! empty($conf->use_javascript_ajax))
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||||
$comboenhancement = ajax_combobox($htmlname, '', 0, $forcefocus);
|
$comboenhancement = ajax_combobox($htmlname, '', 0, $forcefocus);
|
||||||
$out.=$comboenhancement;
|
$out.=$comboenhancement;
|
||||||
$nodatarole=($comboenhancement?' data-role="none"':'');
|
$morecss='minwidth200 maxwidth500';
|
||||||
$minmax='minwidth200 maxwidth500';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($option_only)) {
|
if (empty($option_only)) {
|
||||||
$out.= '<select class="valignmiddle flat'.($minmax?' '.$minmax:'').'"'.($disabled?' disabled="disabled"':'').' id="'.$htmlname.'" name="'.$htmlname.'"'.$nodatarole.'>';
|
$out.= '<select class="valignmiddle flat'.($morecss?' '.$morecss:'').'"'.($disabled?' disabled="disabled"':'').' id="'.$htmlname.'" name="'.$htmlname.'">';
|
||||||
}
|
}
|
||||||
if (!empty($show_empty)) {
|
if (! empty($show_empty)) {
|
||||||
$out.= '<option value="0"> </option>';
|
$out.= '<option value="0" class="optiongrey">';
|
||||||
|
if (! is_numeric($show_empty)) $out.=$show_empty;
|
||||||
|
else $out.=' ';
|
||||||
|
$out.= '</option>';
|
||||||
}
|
}
|
||||||
$num = $this->db->num_rows($resql);
|
$num = $this->db->num_rows($resql);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
@ -370,7 +367,7 @@ class FormProjets
|
|||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
// If we ask to filter on a company and user has no permission to see all companies and project is linked to another company, we hide project.
|
// If we ask to filter on a company and user has no permission to see all companies and project is linked to another company, we hide project.
|
||||||
if ($socid > 0 && (empty($obj->fk_soc) || $obj->fk_soc == $socid) && ! $user->rights->societe->lire)
|
if ($socid > 0 && (empty($obj->fk_soc) || $obj->fk_soc == $socid) && empty($user->rights->societe->lire))
|
||||||
{
|
{
|
||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
@ -382,7 +379,7 @@ class FormProjets
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$labeltoshow=dol_trunc($obj->ref,18);
|
$labeltoshow=dol_trunc($obj->ref,18); // Project ref
|
||||||
//if ($obj->public) $labeltoshow.=' ('.$langs->trans("SharedProject").')';
|
//if ($obj->public) $labeltoshow.=' ('.$langs->trans("SharedProject").')';
|
||||||
//else $labeltoshow.=' ('.$langs->trans("Private").')';
|
//else $labeltoshow.=' ('.$langs->trans("Private").')';
|
||||||
$labeltoshow.=' '.dol_trunc($obj->title,$maxlength);
|
$labeltoshow.=' '.dol_trunc($obj->title,$maxlength);
|
||||||
@ -532,7 +529,6 @@ class FormProjets
|
|||||||
$sql.= " ORDER BY ref DESC";
|
$sql.= " ORDER BY ref DESC";
|
||||||
|
|
||||||
dol_syslog(get_class($this).'::select_element', LOG_DEBUG);
|
dol_syslog(get_class($this).'::select_element', LOG_DEBUG);
|
||||||
|
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/* Copyright (C) 2014 delcroip <delcroip@gmail.com>
|
/* Copyright (C) 2014 delcroip <delcroip@gmail.com>
|
||||||
* Laurent Destailleur 2015 <eldy@users.sourceforge.net>
|
* Copyright (C) 2015-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
|
|||||||
@ -839,8 +839,8 @@ function dolCheckVirus($src_file)
|
|||||||
* If there is errors (virus found, antivir in error, bad filename), file is not moved.
|
* If there is errors (virus found, antivir in error, bad filename), file is not moved.
|
||||||
* Note:
|
* Note:
|
||||||
* - This function can be used only into a HTML page context. Use dol_move if you are outside.
|
* - This function can be used only into a HTML page context. Use dol_move if you are outside.
|
||||||
* - Database of files is not updated.
|
|
||||||
* - Test on antivirus is always done (if antivirus set).
|
* - Test on antivirus is always done (if antivirus set).
|
||||||
|
* - Database of files is NOT updated.
|
||||||
*
|
*
|
||||||
* @param string $src_file Source full path filename ($_FILES['field']['tmp_name'])
|
* @param string $src_file Source full path filename ($_FILES['field']['tmp_name'])
|
||||||
* @param string $dest_file Target full path filename ($_FILES['field']['name'])
|
* @param string $dest_file Target full path filename ($_FILES['field']['name'])
|
||||||
|
|||||||
@ -239,7 +239,7 @@ function dol_shutdown()
|
|||||||
/**
|
/**
|
||||||
* Return value of a param into GET or POST supervariable.
|
* Return value of a param into GET or POST supervariable.
|
||||||
* Use the property $user->default_values[path]['creatform'] and/or $user->default_values[path]['filters'] and/or $user->default_values[path]['sortorder']
|
* Use the property $user->default_values[path]['creatform'] and/or $user->default_values[path]['filters'] and/or $user->default_values[path]['sortorder']
|
||||||
* Note: The property $user->default_values is loaded by the main when loading the user.
|
* Note: The property $user->default_values is loaded by main.php when loading the user.
|
||||||
*
|
*
|
||||||
* @param string $paramname Name of parameter to found
|
* @param string $paramname Name of parameter to found
|
||||||
* @param string $check Type of check
|
* @param string $check Type of check
|
||||||
@ -359,32 +359,34 @@ function GETPOST($paramname, $check='', $method=0, $filter=NULL, $options=NULL)
|
|||||||
|
|
||||||
if (! empty($check))
|
if (! empty($check))
|
||||||
{
|
{
|
||||||
// Replace vars like __DAY__, __MONTH__, __YEAR__, __MYCOUNTRYID__, __USERID__, __ENTITYID__, ...
|
// Substitution variables for GETPOST (used to get final url with variable parameters or final default value with variable paramaters)
|
||||||
if (! is_array($out))
|
// Example of variables: __DAY__, __MONTH__, __YEAR__, __MYCOUNTRYID__, __USERID__, __ENTITYID__, ...
|
||||||
|
// We do this only if var is a GET. If it is a POST, may be we want to post the text with vars as the setup text.
|
||||||
|
if (! is_array($out) && empty($_POST[$paramname]))
|
||||||
{
|
{
|
||||||
$maxloop=20; $loopnb=0; // Protection against infinite loop
|
$maxloop=20; $loopnb=0; // Protection against infinite loop
|
||||||
while (preg_match('/__([A-Z0-9]+_?[A-Z0-9]+)__/i', $out, $reg) && ($loopnb < $maxloop)) // Detect '__ABCDEF__' as key 'ABCDEF' and '__ABC_DEF__' as key 'ABC_DEF'. Detection is also correct when 2 vars are side by side.
|
while (preg_match('/__([A-Z0-9]+_?[A-Z0-9]+)__/i', $out, $reg) && ($loopnb < $maxloop)) // Detect '__ABCDEF__' as key 'ABCDEF' and '__ABC_DEF__' as key 'ABC_DEF'. Detection is also correct when 2 vars are side by side.
|
||||||
{
|
{
|
||||||
$loopnb++; $newout = '';
|
$loopnb++; $newout = '';
|
||||||
|
|
||||||
if ($reg[1] == 'DAY') { $tmp=dol_getdate(dol_now(), true); $newout = $tmp['mday']; }
|
if ($reg[1] == 'DAY') { $tmp=dol_getdate(dol_now(), true); $newout = $tmp['mday']; }
|
||||||
elseif ($reg[1] == 'MONTH') { $tmp=dol_getdate(dol_now(), true); $newout = $tmp['mon']; }
|
elseif ($reg[1] == 'MONTH') { $tmp=dol_getdate(dol_now(), true); $newout = $tmp['mon']; }
|
||||||
elseif ($reg[1] == 'YEAR') { $tmp=dol_getdate(dol_now(), true); $newout = $tmp['year']; }
|
elseif ($reg[1] == 'YEAR') { $tmp=dol_getdate(dol_now(), true); $newout = $tmp['year']; }
|
||||||
elseif ($reg[1] == 'PREVIOUS_DAY') { $tmp=dol_getdate(dol_now(), true); $tmp2=dol_get_prev_day($tmp['mday'], $tmp['mon'], $tmp['year']); $newout = $tmp2['day']; }
|
elseif ($reg[1] == 'PREVIOUS_DAY') { $tmp=dol_getdate(dol_now(), true); $tmp2=dol_get_prev_day($tmp['mday'], $tmp['mon'], $tmp['year']); $newout = $tmp2['day']; }
|
||||||
elseif ($reg[1] == 'PREVIOUS_MONTH') { $tmp=dol_getdate(dol_now(), true); $tmp2=dol_get_prev_month($tmp['mday'], $tmp['mon'], $tmp['year']); $newout = $tmp2['month']; }
|
elseif ($reg[1] == 'PREVIOUS_MONTH') { $tmp=dol_getdate(dol_now(), true); $tmp2=dol_get_prev_month($tmp['mday'], $tmp['mon'], $tmp['year']); $newout = $tmp2['month']; }
|
||||||
elseif ($reg[1] == 'PREVIOUS_YEAR') { $tmp=dol_getdate(dol_now(), true); $newout = ($tmp['year'] - 1); }
|
elseif ($reg[1] == 'PREVIOUS_YEAR') { $tmp=dol_getdate(dol_now(), true); $newout = ($tmp['year'] - 1); }
|
||||||
elseif ($reg[1] == 'NEXT_DAY') { $tmp=dol_getdate(dol_now(), true); $tmp2=dol_get_next_day($tmp['mday'], $tmp['mon'], $tmp['year']); $newout = $tmp2['day']; }
|
elseif ($reg[1] == 'NEXT_DAY') { $tmp=dol_getdate(dol_now(), true); $tmp2=dol_get_next_day($tmp['mday'], $tmp['mon'], $tmp['year']); $newout = $tmp2['day']; }
|
||||||
elseif ($reg[1] == 'NEXT_MONTH') { $tmp=dol_getdate(dol_now(), true); $tmp2=dol_get_next_month($tmp['mday'], $tmp['mon'], $tmp['year']); $newout = $tmp2['month']; }
|
elseif ($reg[1] == 'NEXT_MONTH') { $tmp=dol_getdate(dol_now(), true); $tmp2=dol_get_next_month($tmp['mday'], $tmp['mon'], $tmp['year']); $newout = $tmp2['month']; }
|
||||||
elseif ($reg[1] == 'NEXT_YEAR') { $tmp=dol_getdate(dol_now(), true); $newout = ($tmp['year'] + 1); }
|
elseif ($reg[1] == 'NEXT_YEAR') { $tmp=dol_getdate(dol_now(), true); $newout = ($tmp['year'] + 1); }
|
||||||
elseif ($reg[1] == 'MYCOUNTRYID')
|
elseif ($reg[1] == 'MYCOUNTRY_ID' || $reg[1] == 'MYCOUNTRYID')
|
||||||
{
|
{
|
||||||
$newout = $mysoc->country_id;
|
$newout = $mysoc->country_id;
|
||||||
}
|
}
|
||||||
elseif ($reg[1] == 'USERID')
|
elseif ($reg[1] == 'USER_ID' || $reg[1] == 'USERID')
|
||||||
{
|
{
|
||||||
$newout = $user->id;
|
$newout = $user->id;
|
||||||
}
|
}
|
||||||
elseif ($reg[1] == 'SUPERVISORID')
|
elseif ($reg[1] == 'SUPERVISOR_ID' || $reg[1] == 'SUPERVISORID')
|
||||||
{
|
{
|
||||||
$newout = $user->fk_user;
|
$newout = $user->fk_user;
|
||||||
}
|
}
|
||||||
@ -1586,7 +1588,8 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e
|
|||||||
if (preg_match('/__b__/i',$format))
|
if (preg_match('/__b__/i',$format))
|
||||||
{
|
{
|
||||||
// Here ret is string in PHP setup language (strftime was used). Now we convert to $outputlangs.
|
// Here ret is string in PHP setup language (strftime was used). Now we convert to $outputlangs.
|
||||||
$month=adodb_strftime('%m',$time+$offsettz+$offsetdst); // TODO Remove this
|
$month=adodb_strftime('%m',$time+$offsettz+$offsetdst); // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring.
|
||||||
|
$month=sprintf("%02d", $month); // $month may be return with format '06' on some installation and '6' on other, so we force it to '06'.
|
||||||
if ($encodetooutput)
|
if ($encodetooutput)
|
||||||
{
|
{
|
||||||
$monthtext=$outputlangs->transnoentities('Month'.$month);
|
$monthtext=$outputlangs->transnoentities('Month'.$month);
|
||||||
@ -2554,6 +2557,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
|||||||
$picto = $regs[1];
|
$picto = $regs[1];
|
||||||
$path = $regs[2]; // $path is $mymodule
|
$path = $regs[2]; // $path is $mymodule
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
if (! preg_match('/(\.png|\.gif)$/i',$picto)) $picto .= '.png';
|
if (! preg_match('/(\.png|\.gif)$/i',$picto)) $picto .= '.png';
|
||||||
// If alt path are defined, define url where img file is, according to physical path
|
// If alt path are defined, define url where img file is, according to physical path
|
||||||
@ -2792,7 +2796,7 @@ function img_printer($titlealt = "default", $other='')
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show delete logo
|
* Show split logo
|
||||||
*
|
*
|
||||||
* @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
|
* @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
|
||||||
* @param string $other Add more attributes on img
|
* @param string $other Add more attributes on img
|
||||||
@ -3233,15 +3237,19 @@ function dol_print_error($db='',$error='',$errors=null)
|
|||||||
* Show a public email and error code to contact if technical error
|
* Show a public email and error code to contact if technical error
|
||||||
*
|
*
|
||||||
* @param string $prefixcode Prefix of public error code
|
* @param string $prefixcode Prefix of public error code
|
||||||
|
* @param string $errormessage Complete error message
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function dol_print_error_email($prefixcode)
|
function dol_print_error_email($prefixcode, $errormessage='')
|
||||||
{
|
{
|
||||||
global $langs,$conf;
|
global $langs,$conf;
|
||||||
|
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$now=dol_now();
|
$now=dol_now();
|
||||||
print '<br><div class="error">'.$langs->trans("ErrorContactEMail", $conf->global->MAIN_INFO_SOCIETE_MAIL, $prefixcode.dol_print_date($now,'%Y%m%d')).'</div>';
|
print '<br><div class="center login_main_message"><div class="error">';
|
||||||
|
print $langs->trans("ErrorContactEMail", $conf->global->MAIN_INFO_SOCIETE_MAIL, $prefixcode.dol_print_date($now,'%Y%m%d'));
|
||||||
|
if ($errormessage) print '<br><br>'.$errormessage;
|
||||||
|
print '</div></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -5020,7 +5028,7 @@ function dol_concatdesc($text1,$text2,$forxml=false)
|
|||||||
*
|
*
|
||||||
* @param Translate $outputlangs Output language
|
* @param Translate $outputlangs Output language
|
||||||
* @param int $onlykey Do not calculate heavy values of keys (performance enhancement when we need only the keys)
|
* @param int $onlykey Do not calculate heavy values of keys (performance enhancement when we need only the keys)
|
||||||
* @param array $exclude Array of family keys we want to exclude. For example array('mycompany', 'object', 'date', 'user', ...)
|
* @param array $exclude Array of family keys we want to exclude. For example array('mycompany', 'objectamount', 'date', 'user', ...)
|
||||||
* @param Object $object Object for keys on object
|
* @param Object $object Object for keys on object
|
||||||
* @return array Array of substitutions
|
* @return array Array of substitutions
|
||||||
*/
|
*/
|
||||||
@ -5045,7 +5053,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
|
|||||||
'__MYCOMPANY_COUNTRY_ID__' => $mysoc->country_id
|
'__MYCOMPANY_COUNTRY_ID__' => $mysoc->country_id
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
if (empty($exclude) || ! in_array('object', $exclude))
|
if (empty($exclude) || ! in_array('objectamount', $exclude))
|
||||||
{
|
{
|
||||||
if (is_object($object)) // For backward compatibility
|
if (is_object($object)) // For backward compatibility
|
||||||
{
|
{
|
||||||
|
|||||||
@ -591,12 +591,13 @@ function pdf_pagehead(&$pdf,$outputlangs,$page_height)
|
|||||||
* Return array of possible substitutions for PDF content (without external module substitutions).
|
* Return array of possible substitutions for PDF content (without external module substitutions).
|
||||||
*
|
*
|
||||||
* @param Translate $outputlangs Output language
|
* @param Translate $outputlangs Output language
|
||||||
|
* @param array $exclude Array of family keys we want to exclude. For example array('mycompany', 'object', 'date', 'user', ...)
|
||||||
* @param Object $object Object
|
* @param Object $object Object
|
||||||
* @return array Array of substitutions
|
* @return array Array of substitutions
|
||||||
*/
|
*/
|
||||||
function pdf_getSubstitutionArray($outputlangs, $object=null)
|
function pdf_getSubstitutionArray($outputlangs, $exclude=null, $object=null)
|
||||||
{
|
{
|
||||||
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
|
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, $exclude, $object);
|
||||||
$substitutionarray['__FROM_NAME__']='__FROM_NAME__';
|
$substitutionarray['__FROM_NAME__']='__FROM_NAME__';
|
||||||
$substitutionarray['__FROM_EMAIL__']='__FROM_EMAIL__';
|
$substitutionarray['__FROM_EMAIL__']='__FROM_EMAIL__';
|
||||||
return $substitutionarray;
|
return $substitutionarray;
|
||||||
@ -625,9 +626,9 @@ function pdf_watermark(&$pdf, $outputlangs, $h, $w, $unit, $text)
|
|||||||
elseif ($unit=='in') $k=72;
|
elseif ($unit=='in') $k=72;
|
||||||
|
|
||||||
// Make substitution
|
// Make substitution
|
||||||
$substitutionarray=pdf_getSubstitutionArray($outputlangs,null);
|
$substitutionarray=pdf_getSubstitutionArray($outputlangs, null, null);
|
||||||
complete_substitutions_array($substitutionarray,$outputlangs,null);
|
complete_substitutions_array($substitutionarray, $outputlangs, null);
|
||||||
$text=make_substitutions($text,$substitutionarray,$outputlangs);
|
$text=make_substitutions($text, $substitutionarray, $outputlangs);
|
||||||
$text=$outputlangs->convToOutputCharset($text);
|
$text=$outputlangs->convToOutputCharset($text);
|
||||||
|
|
||||||
$savx=$pdf->getX(); $savy=$pdf->getY();
|
$savx=$pdf->getX(); $savy=$pdf->getY();
|
||||||
@ -854,12 +855,12 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
|
|||||||
// Line of free text
|
// Line of free text
|
||||||
if (empty($hidefreetext) && ! empty($conf->global->$paramfreetext))
|
if (empty($hidefreetext) && ! empty($conf->global->$paramfreetext))
|
||||||
{
|
{
|
||||||
$substitutionarray=pdf_getSubstitutionArray($outputlangs, $object);
|
$substitutionarray=pdf_getSubstitutionArray($outputlangs, null, $object);
|
||||||
// More substitution keys
|
// More substitution keys
|
||||||
$substitutionarray['__FROM_NAME__']=$fromcompany->name;
|
$substitutionarray['__FROM_NAME__']=$fromcompany->name;
|
||||||
$substitutionarray['__FROM_EMAIL__']=$fromcompany->email;
|
$substitutionarray['__FROM_EMAIL__']=$fromcompany->email;
|
||||||
complete_substitutions_array($substitutionarray,$outputlangs,$object);
|
complete_substitutions_array($substitutionarray, $outputlangs, $object);
|
||||||
$newfreetext=make_substitutions($conf->global->$paramfreetext,$substitutionarray,$outputlangs);
|
$newfreetext=make_substitutions($conf->global->$paramfreetext, $substitutionarray, $outputlangs);
|
||||||
$line.=$outputlangs->convToOutputCharset($newfreetext);
|
$line.=$outputlangs->convToOutputCharset($newfreetext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -208,9 +208,10 @@ function task_prepare_head($object)
|
|||||||
* Prepare array with list of tabs
|
* Prepare array with list of tabs
|
||||||
*
|
*
|
||||||
* @param string $mode Mode
|
* @param string $mode Mode
|
||||||
|
* @param string $fuser Filter on user
|
||||||
* @return array Array of tabs to show
|
* @return array Array of tabs to show
|
||||||
*/
|
*/
|
||||||
function project_timesheet_prepare_head($mode)
|
function project_timesheet_prepare_head($mode, $fuser=null)
|
||||||
{
|
{
|
||||||
global $langs, $conf, $user;
|
global $langs, $conf, $user;
|
||||||
$h = 0;
|
$h = 0;
|
||||||
@ -218,9 +219,13 @@ function project_timesheet_prepare_head($mode)
|
|||||||
|
|
||||||
$h = 0;
|
$h = 0;
|
||||||
|
|
||||||
|
$param='';
|
||||||
|
$param.=($mode?'&mode='.$mode:'');
|
||||||
|
if (is_object($fuser) && $fuser->id > 0 && $fuser->id != $user->id) $param.='&search_usertoprocessid='.$fuser->id;
|
||||||
|
|
||||||
if (empty($conf->global->PROJECT_DISABLE_TIMESHEET_PERWEEK))
|
if (empty($conf->global->PROJECT_DISABLE_TIMESHEET_PERWEEK))
|
||||||
{
|
{
|
||||||
$head[$h][0] = DOL_URL_ROOT."/projet/activity/perweek.php".($mode?'?mode='.$mode:'');
|
$head[$h][0] = DOL_URL_ROOT."/projet/activity/perweek.php".($param?'?'.$param:'');
|
||||||
$head[$h][1] = $langs->trans("InputPerWeek");
|
$head[$h][1] = $langs->trans("InputPerWeek");
|
||||||
$head[$h][2] = 'inputperweek';
|
$head[$h][2] = 'inputperweek';
|
||||||
$h++;
|
$h++;
|
||||||
@ -228,7 +233,7 @@ function project_timesheet_prepare_head($mode)
|
|||||||
|
|
||||||
if (empty($conf->global->PROJECT_DISABLE_TIMESHEET_PERTIME))
|
if (empty($conf->global->PROJECT_DISABLE_TIMESHEET_PERTIME))
|
||||||
{
|
{
|
||||||
$head[$h][0] = DOL_URL_ROOT."/projet/activity/perday.php".($mode?'?mode='.$mode:'');
|
$head[$h][0] = DOL_URL_ROOT."/projet/activity/perday.php".($param?'?'.$param:'');
|
||||||
$head[$h][1] = $langs->trans("InputPerDay");
|
$head[$h][1] = $langs->trans("InputPerDay");
|
||||||
$head[$h][2] = 'inputperday';
|
$head[$h][2] = 'inputperday';
|
||||||
$h++;
|
$h++;
|
||||||
@ -621,7 +626,12 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
|
|||||||
|
|
||||||
$taskstatic->id=$lines[$i]->id;
|
$taskstatic->id=$lines[$i]->id;
|
||||||
|
|
||||||
print "<tr ".$bc[$var].">\n";
|
print '<tr class="oddeven">'."\n";
|
||||||
|
|
||||||
|
// User
|
||||||
|
print '<td class="nowrap">';
|
||||||
|
print $fuser->getNomUrl(1, 'withproject', 'time');
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print '<td>';
|
print '<td>';
|
||||||
@ -707,7 +717,10 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
|
|||||||
print '<td class="nowrap" align="center">';
|
print '<td class="nowrap" align="center">';
|
||||||
$tableCell=$form->select_date($preselectedday,$lines[$i]->id,1,1,2,"addtime",0,0,1,$disabledtask);
|
$tableCell=$form->select_date($preselectedday,$lines[$i]->id,1,1,2,"addtime",0,0,1,$disabledtask);
|
||||||
print $tableCell;
|
print $tableCell;
|
||||||
print '</td><td align="right">';
|
print '</td>';
|
||||||
|
|
||||||
|
// Duration
|
||||||
|
print '<td align="right">';
|
||||||
|
|
||||||
$dayWorkLoad = $projectstatic->weekWorkLoadPerTask[$preselectedday][$lines[$i]->id];
|
$dayWorkLoad = $projectstatic->weekWorkLoadPerTask[$preselectedday][$lines[$i]->id];
|
||||||
$alreadyspent='';
|
$alreadyspent='';
|
||||||
@ -723,13 +736,14 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("YouAreNotContactOfProject"));
|
print '<textarea name="'.$lines[$i]->id.'note" rows="'.ROWS_2.'" id="'.$lines[$i]->id.'note"'.($disabledtask?' disabled="disabled"':'').'>';
|
||||||
else if ($disabledtask) print $form->textwithpicto('',$langs->trans("TaskIsNotAffectedToYou"));
|
print '</textarea>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
|
// Warning
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
print '<textarea name="'.$lines[$i]->id.'note" rows="2" id="note">';
|
if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("UserIsNotContactOfProject"));
|
||||||
print '</textarea>';
|
else if ($disabledtask) print $form->textwithpicto('',$langs->trans("TaskIsNotAssignedToUser", $langs->transnoentitiesnoconv("AssignTaskToUser", '...')));
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
@ -818,7 +832,12 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
|||||||
$workloadforid[$projectstatic->id]=1;
|
$workloadforid[$projectstatic->id]=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
print "<tr ".$bc[$var].">\n";
|
print '<tr class="oddeven">'."\n";
|
||||||
|
|
||||||
|
// User
|
||||||
|
print '<td class="nowrap">';
|
||||||
|
print $fuser->getNomUrl(1, 'withproject', 'time');
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print '<td class="nowrap">';
|
print '<td class="nowrap">';
|
||||||
@ -842,7 +861,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
|||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
|
|
||||||
// Project
|
// Project
|
||||||
print '<td class="nowrap">'.$var;
|
print '<td class="nowrap">';
|
||||||
$projectstatic->id=$lines[$i]->fk_project;
|
$projectstatic->id=$lines[$i]->fk_project;
|
||||||
$projectstatic->ref=$lines[$i]->projectref;
|
$projectstatic->ref=$lines[$i]->projectref;
|
||||||
$projectstatic->title=$lines[$i]->projectlabel;
|
$projectstatic->title=$lines[$i]->projectlabel;
|
||||||
@ -935,9 +954,10 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
|||||||
print $tableCell;
|
print $tableCell;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Warning
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("YouAreNotContactOfProject"));
|
if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("UserIsNotContactOfProject"));
|
||||||
else if ($disabledtask) print $form->textwithpicto('',$langs->trans("TaskIsNotAffectedToYou"));
|
else if ($disabledtask) print $form->textwithpicto('',$langs->trans("TaskIsNotAssignedToUser", $langs->transnoentitiesnoconv("AssignTaskToUser", '...')));
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|||||||
@ -345,7 +345,7 @@ function restrictedArea($user, $features, $objectid=0, $tableandshare='', $featu
|
|||||||
* This function is also called by restrictedArea
|
* This function is also called by restrictedArea
|
||||||
*
|
*
|
||||||
* @param User $user User to check
|
* @param User $user User to check
|
||||||
* @param array $featuresarray Features/modules to check. Example: ('user','service')
|
* @param array $featuresarray Features/modules to check. Example: ('user','service','member','project','task',...)
|
||||||
* @param int $objectid Object ID if we want to check a particular record (optional) is linked to a owned thirdparty (optional).
|
* @param int $objectid Object ID if we want to check a particular record (optional) is linked to a owned thirdparty (optional).
|
||||||
* @param string $tableandshare 'TableName&SharedElement' with Tablename is table where object is stored. SharedElement is an optional key to define where to check entity for multicompany modume. Param not used if objectid is null (optional).
|
* @param string $tableandshare 'TableName&SharedElement' with Tablename is table where object is stored. SharedElement is an optional key to define where to check entity for multicompany modume. Param not used if objectid is null (optional).
|
||||||
* @param string $feature2 Feature to check, second level of permission (optional). Can be or check with 'level1|level2'.
|
* @param string $feature2 Feature to check, second level of permission (optional). Can be or check with 'level1|level2'.
|
||||||
@ -369,11 +369,14 @@ function checkUserAccessToObject($user, $featuresarray, $objectid=0, $tableandsh
|
|||||||
|
|
||||||
// For backward compatibility
|
// For backward compatibility
|
||||||
if ($feature == 'member') $feature='adherent';
|
if ($feature == 'member') $feature='adherent';
|
||||||
|
if ($feature == 'project') $feature='projet';
|
||||||
|
if ($feature == 'task') $feature='projet_task';
|
||||||
|
|
||||||
$check = array('adherent','banque','user','usergroup','produit','service','produit|service','categorie'); // Test on entity only (Objects with no link to company)
|
$check = array('adherent','banque','user','usergroup','produit','service','produit|service','categorie'); // Test on entity only (Objects with no link to company)
|
||||||
$checksoc = array('societe'); // Test for societe object
|
$checksoc = array('societe'); // Test for societe object
|
||||||
$checkother = array('contact'); // Test on entity and link to societe. Allowed if link is empty (Ex: contacts...).
|
$checkother = array('contact'); // Test on entity and link to societe. Allowed if link is empty (Ex: contacts...).
|
||||||
$checkproject = array('projet'); // Test for project object
|
$checkproject = array('projet','project'); // Test for project object
|
||||||
|
$checktask = array('projet_task');
|
||||||
$nocheck = array('barcode','stock','fournisseur'); // No test
|
$nocheck = array('barcode','stock','fournisseur'); // No test
|
||||||
$checkdefault = 'all other not already defined'; // Test on entity and link to third party. Not allowed if link is empty (Ex: invoice, orders...).
|
$checkdefault = 'all other not already defined'; // Test on entity and link to third party. Not allowed if link is empty (Ex: invoice, orders...).
|
||||||
|
|
||||||
@ -453,7 +456,7 @@ function checkUserAccessToObject($user, $featuresarray, $objectid=0, $tableandsh
|
|||||||
}
|
}
|
||||||
else if (in_array($feature,$checkproject))
|
else if (in_array($feature,$checkproject))
|
||||||
{
|
{
|
||||||
if (! empty($conf->projet->enabled) && ! $user->rights->projet->all->lire)
|
if (! empty($conf->projet->enabled) && empty($user->rights->projet->all->lire))
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||||
$projectstatic=new Project($db);
|
$projectstatic=new Project($db);
|
||||||
@ -469,6 +472,27 @@ function checkUserAccessToObject($user, $featuresarray, $objectid=0, $tableandsh
|
|||||||
$sql.= " AND dbt.entity IN (".getEntity($sharedelement, 1).")";
|
$sql.= " AND dbt.entity IN (".getEntity($sharedelement, 1).")";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (in_array($feature,$checktask))
|
||||||
|
{
|
||||||
|
if (! empty($conf->projet->enabled) && empty($user->rights->projet->all->lire))
|
||||||
|
{
|
||||||
|
$task = new Task($db);
|
||||||
|
$task->fetch($objectid);
|
||||||
|
|
||||||
|
include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||||
|
$projectstatic=new Project($db);
|
||||||
|
$tmps=$projectstatic->getProjectsAuthorizedForUser($user,0,1,0);
|
||||||
|
$tmparray=explode(',',$tmps);
|
||||||
|
if (! in_array($task->fk_project,$tmparray)) return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$sql = "SELECT dbt.".$dbt_select;
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt";
|
||||||
|
$sql.= " WHERE dbt.".$dbt_select." = ".$objectid;
|
||||||
|
$sql.= " AND dbt.entity IN (".getEntity($sharedelement, 1).")";
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (! in_array($feature,$nocheck)) // By default we check with link to third party
|
else if (! in_array($feature,$nocheck)) // By default we check with link to third party
|
||||||
{
|
{
|
||||||
// If external user: Check permission for external users
|
// If external user: Check permission for external users
|
||||||
|
|||||||
@ -288,6 +288,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
|
|||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3701__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks.php?leftmenu=projects&action=create', 'NewTask', 1, 'projects', '$user->rights->projet->creer', '', 2, 1, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3701__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks.php?leftmenu=projects&action=create', 'NewTask', 1, 'projects', '$user->rights->projet->creer', '', 2, 1, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3702__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks/list.php?leftmenu=projects', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 2, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3702__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks/list.php?leftmenu=projects', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 2, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3703__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/activity/perweek.php?leftmenu=projects', 'NewTimeSpent', 1, 'projects', '$user->rights->projet->lire', '', 2, 3, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3703__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/activity/perweek.php?leftmenu=projects', 'NewTimeSpent', 1, 'projects', '$user->rights->projet->lire', '', 2, 3, __ENTITY__);
|
||||||
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3704__+MAX_llx_menu__, 'project', '', 3600__+MAX_llx_menu__, '/projet/tasks/stats/index.php?leftmenu=projects', 'Statistics', 1, 'projects', '$user->rights->projet->lire', '', 2, 4, __ENTITY__);
|
||||||
|
|
||||||
-- Project - Categories
|
-- Project - Categories
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3804__+MAX_llx_menu__, 'project', 'cat', 3__+MAX_llx_menu__, '/categories/index.php?leftmenu=cat&type=6', 'Categories', 0, 'categories', '$user->rights->categorie->lire', '', 2, 4, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3804__+MAX_llx_menu__, 'project', 'cat', 3__+MAX_llx_menu__, '/categories/index.php?leftmenu=cat&type=6', 'Categories', 0, 'categories', '$user->rights->categorie->lire', '', 2, 4, __ENTITY__);
|
||||||
|
|||||||
@ -1322,6 +1322,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
|||||||
$newmenu->add("/projet/tasks.php?leftmenu=tasks&action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer);
|
$newmenu->add("/projet/tasks.php?leftmenu=tasks&action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer);
|
||||||
$newmenu->add("/projet/tasks/list.php?leftmenu=tasks".($search_project_user?'&search_project_user='.$search_project_user:''), $langs->trans("List"), 1, $user->rights->projet->lire);
|
$newmenu->add("/projet/tasks/list.php?leftmenu=tasks".($search_project_user?'&search_project_user='.$search_project_user:''), $langs->trans("List"), 1, $user->rights->projet->lire);
|
||||||
$newmenu->add("/projet/activity/perweek.php?leftmenu=tasks".($search_project_user?'&search_project_user='.$search_project_user:''), $langs->trans("NewTimeSpent"), 1, $user->rights->projet->lire);
|
$newmenu->add("/projet/activity/perweek.php?leftmenu=tasks".($search_project_user?'&search_project_user='.$search_project_user:''), $langs->trans("NewTimeSpent"), 1, $user->rights->projet->lire);
|
||||||
|
$newmenu->add("/projet/tasks/stats/index.php?leftmenu=projects", $langs->trans("Statistics"), 1, $user->rights->projet->lire);
|
||||||
|
|
||||||
// All project i have permission on
|
// All project i have permission on
|
||||||
/*$newmenu->add("/projet/activity/index.php", $langs->trans("Activities"), 0, $user->rights->projet->lire && $user->rights->projet->lire);
|
/*$newmenu->add("/projet/activity/index.php", $langs->trans("Activities"), 0, $user->rights->projet->lire && $user->rights->projet->lire);
|
||||||
|
|||||||
@ -538,8 +538,8 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
|||||||
return $langs->trans("Module".$this->numero."Name");
|
return $langs->trans("Module".$this->numero."Name");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// If module name translation using it's unique id does not exists, we take use its name to find translation
|
// If module name translation using it's unique id does not exists, we try to use its name to find translation
|
||||||
if (is_array($this->langfiles))
|
if (is_array($this->langfiles))
|
||||||
{
|
{
|
||||||
foreach($this->langfiles as $val)
|
foreach($this->langfiles as $val)
|
||||||
@ -547,6 +547,14 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
|||||||
if ($val) $langs->load($val);
|
if ($val) $langs->load($val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($langs->trans("Module".$this->name."Name") != ("Module".$this->name."Name"))
|
||||||
|
{
|
||||||
|
// If module name translation exists
|
||||||
|
return $langs->trans("Module".$this->name."Name");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Last change with simple product label
|
||||||
return $langs->trans($this->name);
|
return $langs->trans($this->name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -102,16 +102,10 @@ class doc_generic_contract_odt extends ModelePDFContract
|
|||||||
$form = new Form($this->db);
|
$form = new Form($this->db);
|
||||||
|
|
||||||
$texte = $this->description.".<br>\n";
|
$texte = $this->description.".<br>\n";
|
||||||
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" enctype="multipart/form-data">';
|
||||||
$texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
$texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
$texte.= '<input type="hidden" name="action" value="setModuleOptions">';
|
$texte.= '<input type="hidden" name="action" value="setModuleOptions">';
|
||||||
$texte.= '<input type="hidden" name="param1" value="CONTRACT_ADDON_PDF_ODT_PATH">';
|
$texte.= '<input type="hidden" name="param1" value="CONTRACT_ADDON_PDF_ODT_PATH">';
|
||||||
if ($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT > 0)
|
|
||||||
{
|
|
||||||
$texte.= '<input type="hidden" name="param2" value="CONTRACT_ADDON_PDF_ODT_DEFAULT">';
|
|
||||||
$texte.= '<input type="hidden" name="param3" value="CONTRACT_ADDON_PDF_ODT_TOBILL">';
|
|
||||||
$texte.= '<input type="hidden" name="param4" value="CONTRACT_ADDON_PDF_ODT_CLOSED">';
|
|
||||||
}
|
|
||||||
$texte.= '<table class="nobordernopadding" width="100%">';
|
$texte.= '<table class="nobordernopadding" width="100%">';
|
||||||
|
|
||||||
// List of directories area
|
// List of directories area
|
||||||
@ -144,40 +138,21 @@ class doc_generic_contract_odt extends ModelePDFContract
|
|||||||
$texte.=$conf->global->CONTRACT_ADDON_PDF_ODT_PATH;
|
$texte.=$conf->global->CONTRACT_ADDON_PDF_ODT_PATH;
|
||||||
$texte.= '</textarea>';
|
$texte.= '</textarea>';
|
||||||
$texte.= '</div><div style="display: inline-block; vertical-align: middle;">';
|
$texte.= '</div><div style="display: inline-block; vertical-align: middle;">';
|
||||||
$texte.= '<input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button">';
|
$texte.= '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Modify")).'" name="Button">';
|
||||||
$texte.= '<br></div></div>';
|
$texte.= '<br></div></div>';
|
||||||
|
|
||||||
// Scan directories
|
// Scan directories
|
||||||
if (count($listofdir))
|
if (count($listofdir))
|
||||||
{
|
{
|
||||||
$texte.=$langs->trans("NumberOfModelFilesFound").': <b>'.count($listoffiles).'</b>';
|
$texte.=$langs->trans("NumberOfModelFilesFound").': <b>'.count($listoffiles).'</b>';
|
||||||
|
|
||||||
if ($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT > 0)
|
|
||||||
{
|
|
||||||
// Model for creation
|
|
||||||
$liste=ModelePDFContract::liste_modeles($this->db);
|
|
||||||
$texte.= '<table width="50%;">';
|
|
||||||
$texte.= '<tr>';
|
|
||||||
$texte.= '<td width="60%;">'.$langs->trans("DefaultModelPropalCreate").'</td>';
|
|
||||||
$texte.= '<td colspan="">';
|
|
||||||
$texte.= $form->selectarray('value2',$liste,$conf->global->CONTRACT_ADDON_PDF_ODT_DEFAULT);
|
|
||||||
$texte.= "</td></tr>";
|
|
||||||
|
|
||||||
$texte.= '<tr>';
|
|
||||||
$texte.= '<td width="60%;">'.$langs->trans("DefaultModelPropalToBill").'</td>';
|
|
||||||
$texte.= '<td colspan="">';
|
|
||||||
$texte.= $form->selectarray('value3',$liste,$conf->global->CONTRACT_ADDON_PDF_ODT_TOBILL);
|
|
||||||
$texte.= "</td></tr>";
|
|
||||||
$texte.= '<tr>';
|
|
||||||
|
|
||||||
$texte.= '<td width="60%;">'.$langs->trans("DefaultModelPropalClosed").'</td>';
|
|
||||||
$texte.= '<td colspan="">';
|
|
||||||
$texte.= $form->selectarray('value4',$liste,$conf->global->CONTRACT_ADDON_PDF_ODT_CLOSED);
|
|
||||||
$texte.= "</td></tr>";
|
|
||||||
$texte.= '</table>';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add select to upload a new template file. TODO Copy this feature on other admin pages.
|
||||||
|
$texte.= '<div>'.$langs->trans("UploadNewTemplate").' <input type="file" name="uploadfile">';
|
||||||
|
$texte.= '<input type="hidden" value="CONTRACT_ADDON_PDF_ODT_PATH" name="keyforuploaddir">';
|
||||||
|
$texte.= '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Upload")).'" name="upload">';
|
||||||
|
$texte.= '</div>';
|
||||||
|
|
||||||
$texte.= '</td>';
|
$texte.= '</td>';
|
||||||
|
|
||||||
$texte.= '<td valign="top" rowspan="2" class="hideonsmartphone">';
|
$texte.= '<td valign="top" rowspan="2" class="hideonsmartphone">';
|
||||||
|
|||||||
@ -296,20 +296,23 @@ class pdf_strato extends ModelePDFContract
|
|||||||
}
|
}
|
||||||
|
|
||||||
$txtpredefinedservice='';
|
$txtpredefinedservice='';
|
||||||
$txtpredefinedservice = $objectligne->product_ref;
|
$txtpredefinedservice = $objectligne->product_label;
|
||||||
if ($objectligne->product_label)
|
if ($objectligne->product_label)
|
||||||
{
|
{
|
||||||
$txtpredefinedservice .= ' - ';
|
$txtpredefinedservice .= ' - ';
|
||||||
$txtpredefinedservice .= $objectligne->product_label;
|
$txtpredefinedservice .= $objectligne->product_label;
|
||||||
}
|
}
|
||||||
|
|
||||||
$txt='<strong>'.dol_htmlentitiesbr($outputlangs->transnoentities("DateStartPlannedShort")." : ".$datei." - ".$outputlangs->transnoentities("DateEndPlanned")." : ".$datee,1,$outputlangs->charset_output).'</strong>';
|
$desc=dol_htmlentitiesbr($objectligne->desc,1); // Desc (not empty for free lines)
|
||||||
|
$txt='';
|
||||||
|
$txt.=$outputlangs->transnoentities("Quantity").' : <strong>'.$objectligne->qty.'</strong> - '.$outputlangs->transnoentities("UnitPrice").' : <strong>'.price($objectligne->subprice).'</strong>'; // Desc (not empty for free lines)
|
||||||
$txt.='<br>';
|
$txt.='<br>';
|
||||||
$txt.='<strong>'.dol_htmlentitiesbr($outputlangs->transnoentities("DateStartRealShort")." : ".$daters,1,$outputlangs->charset_output);
|
$txt.=$outputlangs->transnoentities("DateStartPlannedShort")." : <strong>".$datei."</strong> - ".$outputlangs->transnoentities("DateEndPlanned")." : <strong>".$datee.'</strong>';
|
||||||
if ($objectligne->date_cloture) $txt.=dol_htmlentitiesbr(" - ".$outputlangs->transnoentities("DateEndRealShort")." : ".$datere,1,$outputlangs->charset_output).'</strong>';
|
$txt.='<br>';
|
||||||
$desc=dol_htmlentitiesbr($objectligne->desc,1);
|
$txt.=$outputlangs->transnoentities("DateStartRealShort")." : <strong>".$daters.'</strong>';
|
||||||
|
if ($objectligne->date_cloture) $txt.=" - ".$outputlangs->transnoentities("DateEndRealShort")." : '<strong>'".$datere.'</strong>';
|
||||||
|
|
||||||
$pdf->writeHTMLCell(0, 0, $curX, $curY, dol_concatdesc($txt,dol_concatdesc($txtpredefinedservice,$desc)), 0, 1, 0);
|
$pdf->writeHTMLCell(0, 0, $curX, $curY, dol_concatdesc($txtpredefinedservice, dol_concatdesc($txt, $desc)), 0, 1, 0);
|
||||||
|
|
||||||
$nexY = $pdf->GetY() + 2;
|
$nexY = $pdf->GetY() + 2;
|
||||||
$pageposafter=$pdf->getPage();
|
$pageposafter=$pdf->getPage();
|
||||||
|
|||||||
@ -121,7 +121,7 @@ else if ($action == 'del')
|
|||||||
// Options
|
// Options
|
||||||
if ($action == 'set_DONATION_ACCOUNTINGACCOUNT')
|
if ($action == 'set_DONATION_ACCOUNTINGACCOUNT')
|
||||||
{
|
{
|
||||||
$account = GETPOST('DONATION_ACCOUNTINGACCOUNT'); // No alpha here, we want exact string
|
$account = GETPOST('DONATION_ACCOUNTINGACCOUNT','alpha');
|
||||||
|
|
||||||
$res = dolibarr_set_const($db, "DONATION_ACCOUNTINGACCOUNT",$account,'chaine',0,'',$conf->entity);
|
$res = dolibarr_set_const($db, "DONATION_ACCOUNTINGACCOUNT",$account,'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
@ -139,7 +139,7 @@ if ($action == 'set_DONATION_ACCOUNTINGACCOUNT')
|
|||||||
|
|
||||||
if ($action == 'set_DONATION_MESSAGE')
|
if ($action == 'set_DONATION_MESSAGE')
|
||||||
{
|
{
|
||||||
$freemessage = GETPOST('DONATION_MESSAGE'); // No alpha here, we want exact string
|
$freemessage = GETPOST('DONATION_MESSAGE','none'); // No alpha here, we want exact string
|
||||||
|
|
||||||
$res = dolibarr_set_const($db, "DONATION_MESSAGE",$freemessage,'chaine',0,'',$conf->entity);
|
$res = dolibarr_set_const($db, "DONATION_MESSAGE",$freemessage,'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
|
|||||||
@ -31,7 +31,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr');
|
if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr');
|
||||||
if (! defined('DOL_VERSION')) define('DOL_VERSION','6.0.0-alpha'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c
|
if (! defined('DOL_VERSION')) define('DOL_VERSION','6.0.0-beta'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c
|
||||||
|
|
||||||
if (! defined('EURO')) define('EURO',chr(128));
|
if (! defined('EURO')) define('EURO',chr(128));
|
||||||
|
|
||||||
|
|||||||
@ -159,6 +159,9 @@ CREATE TABLE llx_product_attribute_combination
|
|||||||
|
|
||||||
ALTER TABLE llx_bank_account drop foreign key bank_fk_accountancy_journal;
|
ALTER TABLE llx_bank_account drop foreign key bank_fk_accountancy_journal;
|
||||||
|
|
||||||
|
-- Fix missing entity column after init demo
|
||||||
|
ALTER TABLE llx_accounting_journal ADD COLUMN entity integer DEFAULT 1;
|
||||||
|
|
||||||
-- Add journal entries
|
-- Add journal entries
|
||||||
INSERT INTO llx_accounting_journal (rowid, code, label, nature, active) VALUES (1,'VT', 'Sale journal', 2, 1);
|
INSERT INTO llx_accounting_journal (rowid, code, label, nature, active) VALUES (1,'VT', 'Sale journal', 2, 1);
|
||||||
INSERT INTO llx_accounting_journal (rowid, code, label, nature, active) VALUES (2,'AC', 'Purchase journal', 3, 1);
|
INSERT INTO llx_accounting_journal (rowid, code, label, nature, active) VALUES (2,'AC', 'Purchase journal', 3, 1);
|
||||||
@ -348,5 +351,31 @@ ALTER TABLE llx_facture ADD COLUMN fk_fac_rec_source integer;
|
|||||||
|
|
||||||
DELETE from llx_c_actioncomm where code in ('AC_PROP','AC_COM','AC_FAC','AC_SHIP','AC_SUP_ORD','AC_SUP_INV') AND id NOT IN (SELECT DISTINCT fk_action FROM llx_actioncomm);
|
DELETE from llx_c_actioncomm where code in ('AC_PROP','AC_COM','AC_FAC','AC_SHIP','AC_SUP_ORD','AC_SUP_INV') AND id NOT IN (SELECT DISTINCT fk_action FROM llx_actioncomm);
|
||||||
|
|
||||||
|
-- Fix: delete orphelin category.
|
||||||
|
delete from llx_categorie_product where fk_categorie not in (select rowid from llx_categorie where type = 0);
|
||||||
|
delete from llx_categorie_societe where fk_categorie not in (select rowid from llx_categorie where type in (1, 2));
|
||||||
|
delete from llx_categorie_member where fk_categorie not in (select rowid from llx_categorie where type = 3);
|
||||||
|
delete from llx_categorie_contact where fk_categorie not in (select rowid from llx_categorie where type = 4);
|
||||||
|
delete from llx_categorie_project where fk_categorie not in (select rowid from llx_categorie where type = 5);
|
||||||
|
|
||||||
ALTER TABLE llx_inventory ADD COLUMN ref varchar(48);
|
ALTER TABLE llx_inventory ADD COLUMN ref varchar(48);
|
||||||
|
|
||||||
|
create table llx_loan_schedule
|
||||||
|
(
|
||||||
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
fk_loan integer,
|
||||||
|
datec datetime,
|
||||||
|
tms timestamp,
|
||||||
|
datep datetime,
|
||||||
|
amount_capital real DEFAULT 0,
|
||||||
|
amount_insurance real DEFAULT 0,
|
||||||
|
amount_interest real DEFAULT 0,
|
||||||
|
fk_typepayment integer NOT NULL,
|
||||||
|
num_payment varchar(50),
|
||||||
|
note_private text,
|
||||||
|
note_public text,
|
||||||
|
fk_bank integer NOT NULL,
|
||||||
|
fk_user_creat integer,
|
||||||
|
fk_user_modif integer
|
||||||
|
)ENGINE=innodb;
|
||||||
|
|
||||||
|
|||||||
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- Requests to clean corrupted database
|
-- Requests to clean corrupted data
|
||||||
|
|
||||||
|
|
||||||
UPDATE llx_user set api_key = null where api_key = '';
|
UPDATE llx_user set api_key = null where api_key = '';
|
||||||
@ -124,6 +124,7 @@ delete from llx_categorie_product where fk_categorie not in (select rowid from l
|
|||||||
delete from llx_categorie_societe where fk_categorie not in (select rowid from llx_categorie where type in (1, 2));
|
delete from llx_categorie_societe where fk_categorie not in (select rowid from llx_categorie where type in (1, 2));
|
||||||
delete from llx_categorie_member where fk_categorie not in (select rowid from llx_categorie where type = 3);
|
delete from llx_categorie_member where fk_categorie not in (select rowid from llx_categorie where type = 3);
|
||||||
delete from llx_categorie_contact where fk_categorie not in (select rowid from llx_categorie where type = 4);
|
delete from llx_categorie_contact where fk_categorie not in (select rowid from llx_categorie where type = 4);
|
||||||
|
delete from llx_categorie_project where fk_categorie not in (select rowid from llx_categorie where type = 5);
|
||||||
|
|
||||||
|
|
||||||
-- Fix: delete orphelin deliveries. Note: deliveries are linked to shipment by llx_element_element only. No other links.
|
-- Fix: delete orphelin deliveries. Note: deliveries are linked to shipment by llx_element_element only. No other links.
|
||||||
@ -337,3 +338,8 @@ drop table tmp_c_shipment_mode;
|
|||||||
-- VMYSQL4.1 update llx_expensereport_det as ed set date = (select date_debut from llx_expensereport as e where ed.fk_expensereport = e.rowid) where DATE(STR_TO_DATE(date, '%Y-%m-%d')) < '1000-00-00';
|
-- VMYSQL4.1 update llx_expensereport_det as ed set date = (select date_debut from llx_expensereport as e where ed.fk_expensereport = e.rowid) where DATE(STR_TO_DATE(date, '%Y-%m-%d')) < '1000-00-00';
|
||||||
-- VMYSQL4.1 SET sql_mode = 'NO_ZERO_DATE';
|
-- VMYSQL4.1 SET sql_mode = 'NO_ZERO_DATE';
|
||||||
|
|
||||||
|
|
||||||
|
-- Backport a change of value into the hourly rate.
|
||||||
|
-- update llx_projet_task_time as ptt set ptt.thm = (SELECT thm from llx_user as u where ptt.fk_user = u.rowid) where (ptt.thm is null)
|
||||||
|
|
||||||
|
|
||||||
@ -28,4 +28,4 @@ CREATE TABLE llx_advtargetemailing
|
|||||||
datec datetime NOT NULL,
|
datec datetime NOT NULL,
|
||||||
fk_user_mod integer NOT NULL,
|
fk_user_mod integer NOT NULL,
|
||||||
tms timestamp NOT NULL
|
tms timestamp NOT NULL
|
||||||
)ENGINE=InnoDB;
|
)ENGINE=innodb;
|
||||||
|
|||||||
37
htdocs/install/mysql/tables/llx_loan_schedule.sql
Normal file
37
htdocs/install/mysql/tables/llx_loan_schedule.sql
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
-- ===================================================================
|
||||||
|
-- Copyright (C) 2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||||
|
-- Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||||
|
--
|
||||||
|
-- This program is free software; you can redistribute it and/or modify
|
||||||
|
-- it under the terms of the GNU General Public License as published by
|
||||||
|
-- the Free Software Foundation; either version 3 of the License, or
|
||||||
|
-- (at your option) any later version.
|
||||||
|
--
|
||||||
|
-- This program is distributed in the hope that it will be useful,
|
||||||
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
-- GNU General Public License for more details.
|
||||||
|
--
|
||||||
|
-- You should have received a copy of the GNU General Public License
|
||||||
|
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
--
|
||||||
|
-- ===================================================================
|
||||||
|
|
||||||
|
create table llx_loan_schedule
|
||||||
|
(
|
||||||
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
fk_loan integer,
|
||||||
|
datec datetime, -- creation date
|
||||||
|
tms timestamp,
|
||||||
|
datep datetime, -- payment date
|
||||||
|
amount_capital real DEFAULT 0,
|
||||||
|
amount_insurance real DEFAULT 0,
|
||||||
|
amount_interest real DEFAULT 0,
|
||||||
|
fk_typepayment integer NOT NULL,
|
||||||
|
num_payment varchar(50),
|
||||||
|
note_private text,
|
||||||
|
note_public text,
|
||||||
|
fk_bank integer NOT NULL,
|
||||||
|
fk_user_creat integer, -- creation user
|
||||||
|
fk_user_modif integer -- last modification user
|
||||||
|
)ENGINE=innodb;
|
||||||
@ -23,4 +23,4 @@ CREATE TABLE llx_product_attribute
|
|||||||
label VARCHAR(255) NOT NULL,
|
label VARCHAR(255) NOT NULL,
|
||||||
rang INT DEFAULT 0 NOT NULL,
|
rang INT DEFAULT 0 NOT NULL,
|
||||||
entity INT DEFAULT 1 NOT NULL
|
entity INT DEFAULT 1 NOT NULL
|
||||||
);
|
)ENGINE=innodb;
|
||||||
|
|||||||
@ -25,4 +25,4 @@ CREATE TABLE llx_product_attribute_combination
|
|||||||
variation_price_percentage INT NULL,
|
variation_price_percentage INT NULL,
|
||||||
variation_weight FLOAT NOT NULL,
|
variation_weight FLOAT NOT NULL,
|
||||||
entity INT DEFAULT 1 NOT NULL
|
entity INT DEFAULT 1 NOT NULL
|
||||||
);
|
)ENGINE=innodb;
|
||||||
@ -22,4 +22,4 @@ CREATE TABLE llx_product_attribute_combination2val
|
|||||||
fk_prod_combination INT NOT NULL,
|
fk_prod_combination INT NOT NULL,
|
||||||
fk_prod_attr INT NOT NULL,
|
fk_prod_attr INT NOT NULL,
|
||||||
fk_prod_attr_val INT NOT NULL
|
fk_prod_attr_val INT NOT NULL
|
||||||
);
|
)ENGINE=innodb;
|
||||||
@ -23,4 +23,4 @@ CREATE TABLE llx_product_attribute_value
|
|||||||
ref VARCHAR(255) DEFAULT NULL,
|
ref VARCHAR(255) DEFAULT NULL,
|
||||||
value VARCHAR(255) DEFAULT NULL,
|
value VARCHAR(255) DEFAULT NULL,
|
||||||
entity INT DEFAULT 1 NOT NULL
|
entity INT DEFAULT 1 NOT NULL
|
||||||
);
|
)ENGINE=innodb;
|
||||||
@ -23,4 +23,4 @@ CREATE TABLE llx_product_pricerules
|
|||||||
fk_level INT NOT NULL, -- Price variations are made over price of X
|
fk_level INT NOT NULL, -- Price variations are made over price of X
|
||||||
var_percent FLOAT NOT NULL, -- Price variation over based price
|
var_percent FLOAT NOT NULL, -- Price variation over based price
|
||||||
var_min_percent FLOAT NOT NULL -- Min price discount over general price
|
var_min_percent FLOAT NOT NULL -- Min price discount over general price
|
||||||
);
|
)ENGINE=innodb;
|
||||||
|
|||||||
@ -3945,7 +3945,10 @@ function migrate_delete_old_files($db,$langs,$conf)
|
|||||||
|
|
||||||
DOL_DOCUMENT_ROOT.'/compta/facture/class/api_invoice.class.php',
|
DOL_DOCUMENT_ROOT.'/compta/facture/class/api_invoice.class.php',
|
||||||
DOL_DOCUMENT_ROOT.'/commande/class/api_commande.class.php',
|
DOL_DOCUMENT_ROOT.'/commande/class/api_commande.class.php',
|
||||||
DOL_DOCUMENT_ROOT.'/user/class/api_user.class.php'
|
DOL_DOCUMENT_ROOT.'/user/class/api_user.class.php',
|
||||||
|
DOL_DOCUMENT_ROOT.'/product/class/api_product.class.php',
|
||||||
|
DOL_DOCUMENT_ROOT.'/societe/class/api_contact.class.php',
|
||||||
|
DOL_DOCUMENT_ROOT.'/societe/class/api_thirdparty.class.php'
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($filetodeletearray as $filetodelete)
|
foreach ($filetodeletearray as $filetodelete)
|
||||||
|
|||||||
@ -48,6 +48,7 @@ InternalUsers=Internal users
|
|||||||
ExternalUsers=External users
|
ExternalUsers=External users
|
||||||
GUISetup=Display
|
GUISetup=Display
|
||||||
SetupArea=Setup area
|
SetupArea=Setup area
|
||||||
|
UploadNewTemplate=Upload new template(s)
|
||||||
FormToTestFileUploadForm=Form to test file upload (according to setup)
|
FormToTestFileUploadForm=Form to test file upload (according to setup)
|
||||||
IfModuleEnabled=Note: yes is effective only if module <b>%s</b> is enabled
|
IfModuleEnabled=Note: yes is effective only if module <b>%s</b> is enabled
|
||||||
RemoveLock=Remove file <b>%s</b> if it exists to allow usage of the update tool.
|
RemoveLock=Remove file <b>%s</b> if it exists to allow usage of the update tool.
|
||||||
@ -613,7 +614,7 @@ Permission32=Create/modify products
|
|||||||
Permission34=Delete products
|
Permission34=Delete products
|
||||||
Permission36=See/manage hidden products
|
Permission36=See/manage hidden products
|
||||||
Permission38=Export products
|
Permission38=Export products
|
||||||
Permission41=Read projects and tasks (shared project and projects i'm contact for). Can also enter time consumed on assigned tasks (timesheet)
|
Permission41=Read projects and tasks (shared project and projects i'm contact for). Can also enter time consumed, for me or my hierarchy, on assigned tasks (Timesheet)
|
||||||
Permission42=Create/modify projects (shared project and projects i'm contact for). Can also create tasks and assign users to project and tasks
|
Permission42=Create/modify projects (shared project and projects i'm contact for). Can also create tasks and assign users to project and tasks
|
||||||
Permission44=Delete projects (shared project and projects i'm contact for)
|
Permission44=Delete projects (shared project and projects i'm contact for)
|
||||||
Permission45=Export projects
|
Permission45=Export projects
|
||||||
@ -873,6 +874,7 @@ DictionaryProspectStatus=Prospection status
|
|||||||
DictionaryHolidayTypes=Types of leaves
|
DictionaryHolidayTypes=Types of leaves
|
||||||
DictionaryOpportunityStatus=Opportunity status for project/lead
|
DictionaryOpportunityStatus=Opportunity status for project/lead
|
||||||
SetupSaved=Setup saved
|
SetupSaved=Setup saved
|
||||||
|
SetupNotSaved=Setup not saved
|
||||||
BackToModuleList=Back to modules list
|
BackToModuleList=Back to modules list
|
||||||
BackToDictionaryList=Back to dictionaries list
|
BackToDictionaryList=Back to dictionaries list
|
||||||
VATManagement=VAT Management
|
VATManagement=VAT Management
|
||||||
|
|||||||
@ -190,6 +190,7 @@ ErrorModuleFileSeemsToHaveAWrongFormat=The module package seems to have a wrong
|
|||||||
ErrorFilenameDosNotMatchDolibarrPackageRules=The name of the module package (<strong>%s</strong>) does not match expected name syntax: <strong>%s</strong>
|
ErrorFilenameDosNotMatchDolibarrPackageRules=The name of the module package (<strong>%s</strong>) does not match expected name syntax: <strong>%s</strong>
|
||||||
ErrorDuplicateTrigger=Error, duplicate trigger name %s. Already loaded from %s.
|
ErrorDuplicateTrigger=Error, duplicate trigger name %s. Already loaded from %s.
|
||||||
ErrorNoWarehouseDefined=Error, no warehouses defined.
|
ErrorNoWarehouseDefined=Error, no warehouses defined.
|
||||||
|
ErrorBadLinkSourceSetButBadValueForRef=The link you use is not valid. A 'source' for payment is defined, but value for 'ref' is not valid.
|
||||||
|
|
||||||
# Warnings
|
# Warnings
|
||||||
WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user.
|
WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user.
|
||||||
|
|||||||
@ -50,3 +50,4 @@ ConfigLoan=Configuration of the module loan
|
|||||||
LOAN_ACCOUNTING_ACCOUNT_CAPITAL=Accounting account capital by default
|
LOAN_ACCOUNTING_ACCOUNT_CAPITAL=Accounting account capital by default
|
||||||
LOAN_ACCOUNTING_ACCOUNT_INTEREST=Accounting account interest by default
|
LOAN_ACCOUNTING_ACCOUNT_INTEREST=Accounting account interest by default
|
||||||
LOAN_ACCOUNTING_ACCOUNT_INSURANCE=Accounting account insurance by default
|
LOAN_ACCOUNTING_ACCOUNT_INSURANCE=Accounting account insurance by default
|
||||||
|
CreateCalcSchedule=Créer / Modifier échéancier de pret
|
||||||
|
|||||||
@ -41,6 +41,7 @@ ShowProject=Show project
|
|||||||
SetProject=Set project
|
SetProject=Set project
|
||||||
NoProject=No project defined or owned
|
NoProject=No project defined or owned
|
||||||
NbOfProjects=Nb of projects
|
NbOfProjects=Nb of projects
|
||||||
|
NbOfTasks=Nb of tasks
|
||||||
TimeSpent=Time spent
|
TimeSpent=Time spent
|
||||||
TimeSpentByYou=Time spent by you
|
TimeSpentByYou=Time spent by you
|
||||||
TimeSpentByUser=Time spent by user
|
TimeSpentByUser=Time spent by user
|
||||||
@ -53,7 +54,7 @@ TaskTimeNote=Note
|
|||||||
TaskTimeDate=Date
|
TaskTimeDate=Date
|
||||||
TasksOnOpenedProject=Tasks on open projects
|
TasksOnOpenedProject=Tasks on open projects
|
||||||
WorkloadNotDefined=Workload not defined
|
WorkloadNotDefined=Workload not defined
|
||||||
NewTimeSpent=New time spent
|
NewTimeSpent=Time spent
|
||||||
MyTimeSpent=My time spent
|
MyTimeSpent=My time spent
|
||||||
Tasks=Tasks
|
Tasks=Tasks
|
||||||
Task=Task
|
Task=Task
|
||||||
@ -107,6 +108,7 @@ ConfirmReOpenAProject=Are you sure you want to re-open this project?
|
|||||||
ProjectContact=Project contacts
|
ProjectContact=Project contacts
|
||||||
ActionsOnProject=Events on project
|
ActionsOnProject=Events on project
|
||||||
YouAreNotContactOfProject=You are not a contact of this private project
|
YouAreNotContactOfProject=You are not a contact of this private project
|
||||||
|
UserIsNotContactOfProject=User is not a contact of this private project
|
||||||
DeleteATimeSpent=Delete time spent
|
DeleteATimeSpent=Delete time spent
|
||||||
ConfirmDeleteATimeSpent=Are you sure you want to delete this time spent?
|
ConfirmDeleteATimeSpent=Are you sure you want to delete this time spent?
|
||||||
DoNotShowMyTasksOnly=See also tasks not assigned to me
|
DoNotShowMyTasksOnly=See also tasks not assigned to me
|
||||||
@ -115,7 +117,7 @@ TaskRessourceLinks=Resources
|
|||||||
ProjectsDedicatedToThisThirdParty=Projects dedicated to this third party
|
ProjectsDedicatedToThisThirdParty=Projects dedicated to this third party
|
||||||
NoTasks=No tasks for this project
|
NoTasks=No tasks for this project
|
||||||
LinkedToAnotherCompany=Linked to other third party
|
LinkedToAnotherCompany=Linked to other third party
|
||||||
TaskIsNotAffectedToYou=Task not assigned to you
|
TaskIsNotAssignedToUser=Task not assigned to user. Use button '<strong>%s</strong>' to assign task now.
|
||||||
ErrorTimeSpentIsEmpty=Time spent is empty
|
ErrorTimeSpentIsEmpty=Time spent is empty
|
||||||
ThisWillAlsoRemoveTasks=This action will also delete all tasks of project (<b>%s</b> tasks at the moment) and all inputs of time spent.
|
ThisWillAlsoRemoveTasks=This action will also delete all tasks of project (<b>%s</b> tasks at the moment) and all inputs of time spent.
|
||||||
IfNeedToUseOhterObjectKeepEmpty=If some objects (invoice, order, ...), belonging to another third party, must be linked to the project to create, keep this empty to have the project being multi third parties.
|
IfNeedToUseOhterObjectKeepEmpty=If some objects (invoice, order, ...), belonging to another third party, must be linked to the project to create, keep this empty to have the project being multi third parties.
|
||||||
@ -166,26 +168,30 @@ FirstAddRessourceToAllocateTime=Assign a user resource to task to allocate time
|
|||||||
InputPerDay=Input per day
|
InputPerDay=Input per day
|
||||||
InputPerWeek=Input per week
|
InputPerWeek=Input per week
|
||||||
InputPerAction=Input per action
|
InputPerAction=Input per action
|
||||||
TimeAlreadyRecorded=Time spent already recorded for this task/day and user %s
|
TimeAlreadyRecorded=This is time spent already recorded for this task/day and user %s
|
||||||
ProjectsWithThisUserAsContact=Projects with this user as contact
|
ProjectsWithThisUserAsContact=Projects with this user as contact
|
||||||
TasksWithThisUserAsContact=Tasks assigned to this user
|
TasksWithThisUserAsContact=Tasks assigned to this user
|
||||||
ResourceNotAssignedToProject=Not assigned to project
|
ResourceNotAssignedToProject=Not assigned to project
|
||||||
ResourceNotAssignedToTheTask=Not assigned to the task
|
ResourceNotAssignedToTheTask=Not assigned to the task
|
||||||
TasksAssignedTo=Tasks assigned to
|
TasksAssignedTo=Tasks assigned to
|
||||||
AssignTaskToMe=Assign task to me
|
AssignTaskToMe=Assign task to me
|
||||||
|
AssignTaskToUser=Assign task to %s
|
||||||
|
SelectTaskToAssign=Select task to assign...
|
||||||
AssignTask=Assign
|
AssignTask=Assign
|
||||||
ProjectOverview=Overview
|
ProjectOverview=Overview
|
||||||
ManageTasks=Use projects to follow tasks and time
|
ManageTasks=Use projects to follow tasks and time
|
||||||
ManageOpportunitiesStatus=Use projects to follow leads/opportinuties
|
ManageOpportunitiesStatus=Use projects to follow leads/opportinuties
|
||||||
ProjectNbProjectByMonth=Nb of created projects by month
|
ProjectNbProjectByMonth=Nb of created projects by month
|
||||||
|
ProjectNbTaskByMonth=Nb of created tasks by month
|
||||||
ProjectOppAmountOfProjectsByMonth=Amount of opportunities by month
|
ProjectOppAmountOfProjectsByMonth=Amount of opportunities by month
|
||||||
ProjectWeightedOppAmountOfProjectsByMonth=Weighted amount of opportunities by month
|
ProjectWeightedOppAmountOfProjectsByMonth=Weighted amount of opportunities by month
|
||||||
ProjectOpenedProjectByOppStatus=Open project/lead by opportunity status
|
ProjectOpenedProjectByOppStatus=Open project/lead by opportunity status
|
||||||
ProjectsStatistics=Statistics on projects/leads
|
ProjectsStatistics=Statistics on projects/leads
|
||||||
|
TasksStatistics=Statistics on project/lead tasks
|
||||||
TaskAssignedToEnterTime=Task assigned. Entering time on this task should be possible.
|
TaskAssignedToEnterTime=Task assigned. Entering time on this task should be possible.
|
||||||
IdTaskTime=Id task time
|
IdTaskTime=Id task time
|
||||||
YouCanCompleteRef=If you want to complete the ref with some information (to use it as search filters), it is recommanded to add a - character to separate it, so the automatic numbering will still work correctly for next projects. For example %s-ABC. You may also prefer to add search keys into label. But best practice may be to add a dedicated field, also called complementary attributes.
|
YouCanCompleteRef=If you want to complete the ref with some information (to use it as search filters), it is recommanded to add a - character to separate it, so the automatic numbering will still work correctly for next projects. For example %s-ABC. You may also prefer to add search keys into label. But best practice may be to add a dedicated field, also called complementary attributes.
|
||||||
OpenedProjectsByThirdparties=Open projects by thirdparties
|
OpenedProjectsByThirdparties=Open projects by third parties
|
||||||
OnlyOpportunitiesShort=Only opportunities
|
OnlyOpportunitiesShort=Only opportunities
|
||||||
OpenedOpportunitiesShort=Open opportunities
|
OpenedOpportunitiesShort=Open opportunities
|
||||||
NotAnOpportunityShort=Not an opportunity
|
NotAnOpportunityShort=Not an opportunity
|
||||||
|
|||||||
72
htdocs/loan/calcmens.php
Normal file
72
htdocs/loan/calcmens.php
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
<?php
|
||||||
|
/* TVI
|
||||||
|
* Copyright (C) 2015 Florian HENRY <florian.henry@open-concept.pro>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 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, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file tvi/ajax/list.php
|
||||||
|
* \brief File to return datables output
|
||||||
|
*/
|
||||||
|
if (! defined('NOTOKENRENEWAL'))
|
||||||
|
define('NOTOKENRENEWAL', '1'); // Disables token renewal
|
||||||
|
if (! defined('NOREQUIREMENU'))
|
||||||
|
define('NOREQUIREMENU', '1');
|
||||||
|
// if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
|
||||||
|
if (! defined('NOREQUIREAJAX'))
|
||||||
|
define('NOREQUIREAJAX', '1');
|
||||||
|
// if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
||||||
|
// if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
|
||||||
|
|
||||||
|
|
||||||
|
require '../main.inc.php';
|
||||||
|
require DOL_DOCUMENT_ROOT.'/loan/class/loanschedule.class.php';
|
||||||
|
|
||||||
|
$mens=GETPOST('mens');
|
||||||
|
$capital=GETPOST('capital');
|
||||||
|
$rate=GETPOST('rate');
|
||||||
|
$echance=GETPOST('echeance');
|
||||||
|
$nbterm=GETPOST('nbterm');
|
||||||
|
|
||||||
|
top_httphead();
|
||||||
|
|
||||||
|
$output=array();
|
||||||
|
|
||||||
|
$object = new LoanSchedule($db);
|
||||||
|
|
||||||
|
$int = ($capital*($rate/12));
|
||||||
|
$int = round($int,2,PHP_ROUND_HALF_UP);
|
||||||
|
$cap_rest = round($capital - ($mens-$int),2,PHP_ROUND_HALF_UP);
|
||||||
|
$output[$echance]=array('cap_rest'=>$cap_rest,'cap_rest_str'=>price($cap_rest),'interet'=>$int,'interet_str'=>price($int,0,'',1),'mens'=>$mens);
|
||||||
|
|
||||||
|
$echance++;
|
||||||
|
$capital=$cap_rest;
|
||||||
|
while ($echance<=$nbterm) {
|
||||||
|
|
||||||
|
$mens = round($object->calc_mens($capital,$rate,$nbterm-$echance+1),2,PHP_ROUND_HALF_UP);
|
||||||
|
|
||||||
|
$int = ($capital*($rate/12));
|
||||||
|
$int = round($int,2,PHP_ROUND_HALF_UP);
|
||||||
|
$cap_rest = round($capital - ($mens-$int),2,PHP_ROUND_HALF_UP);
|
||||||
|
|
||||||
|
$output[$echance]=array('cap_rest'=>$cap_rest,'cap_rest_str'=>price($cap_rest),'interet'=>$int,'interet_str'=>price($int,0,'',1),'mens'=>$mens);
|
||||||
|
|
||||||
|
$capital=$cap_rest;
|
||||||
|
$echance++;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo json_encode($output);
|
||||||
|
|
||||||
@ -417,6 +417,18 @@ if ($id > 0)
|
|||||||
|
|
||||||
dol_fiche_head($head, 'card', $langs->trans("Loan"), 0, 'bill');
|
dol_fiche_head($head, 'card', $langs->trans("Loan"), 0, 'bill');
|
||||||
|
|
||||||
|
print '<script type="text/javascript">' . "\n";
|
||||||
|
print ' function popEcheancier() {' . "\n";
|
||||||
|
print ' $div = $(\'<div id="popCalendar"><iframe width="100%" height="100%" frameborder="0" src="createschedule.php?loanid=' . $object->id . '"></iframe></div>\');' . "\n";
|
||||||
|
print ' $div.dialog({' . "\n";
|
||||||
|
print ' modal:true' . "\n";
|
||||||
|
print ' ,width:"90%"' . "\n";
|
||||||
|
print ' ,height:$(window).height() - 150' . "\n";
|
||||||
|
print ' });' . "\n";
|
||||||
|
print ' }' . "\n";
|
||||||
|
print '</script>';
|
||||||
|
|
||||||
|
|
||||||
// Loan card
|
// Loan card
|
||||||
|
|
||||||
$linkback = '<a href="' . DOL_URL_ROOT . '/loan/index.php">' . $langs->trans("BackToList") . '</a>';
|
$linkback = '<a href="' . DOL_URL_ROOT . '/loan/index.php">' . $langs->trans("BackToList") . '</a>';
|
||||||
@ -717,6 +729,8 @@ if ($id > 0)
|
|||||||
// Edit
|
// Edit
|
||||||
if ($user->rights->loan->write)
|
if ($user->rights->loan->write)
|
||||||
{
|
{
|
||||||
|
print '<a href="javascript:popEcheancier()" class="butAction">'.$langs->trans('CreateCalcSchedule').'</a>';
|
||||||
|
|
||||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/loan/card.php?id='.$object->id.'&action=edit">'.$langs->trans("Modify").'</a>';
|
print '<a class="butAction" href="'.DOL_URL_ROOT.'/loan/card.php?id='.$object->id.'&action=edit">'.$langs->trans("Modify").'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
542
htdocs/loan/class/loanschedule.class.php
Normal file
542
htdocs/loan/class/loanschedule.class.php
Normal file
@ -0,0 +1,542 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2017 Florian HENRY <florian.henry@atm-consulting.fr>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/loan/class/loanschedule.class.php
|
||||||
|
* \ingroup facture
|
||||||
|
* \brief File of class to manage schedule of loans
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class to manage Schedule of loans
|
||||||
|
*/
|
||||||
|
class LoanSchedule extends CommonObject
|
||||||
|
{
|
||||||
|
public $element='loan_schedule'; //!< Id that identify managed objects
|
||||||
|
public $table_element='loan_schedule'; //!< Name of table without prefix where object is stored
|
||||||
|
|
||||||
|
var $fk_loan;
|
||||||
|
var $datec='';
|
||||||
|
var $tms='';
|
||||||
|
var $datep='';
|
||||||
|
var $amounts=array(); // Array of amounts
|
||||||
|
var $amount_capital; // Total amount of payment
|
||||||
|
var $amount_insurance;
|
||||||
|
var $amount_interest;
|
||||||
|
var $fk_typepayment;
|
||||||
|
var $num_payment;
|
||||||
|
var $fk_bank;
|
||||||
|
var $fk_user_creat;
|
||||||
|
var $fk_user_modif;
|
||||||
|
var $lines=array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
* @see amount, amounts
|
||||||
|
*/
|
||||||
|
var $total;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param DoliDB $db Database handler
|
||||||
|
*/
|
||||||
|
function __construct($db)
|
||||||
|
{
|
||||||
|
$this->db = $db;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create payment of loan into database.
|
||||||
|
* Use this->amounts to have list of lines for the payment
|
||||||
|
*
|
||||||
|
* @param User $user User making payment
|
||||||
|
* @return int <0 if KO, id of payment if OK
|
||||||
|
*/
|
||||||
|
function create($user)
|
||||||
|
{
|
||||||
|
global $conf, $langs;
|
||||||
|
|
||||||
|
$error=0;
|
||||||
|
|
||||||
|
$now=dol_now();
|
||||||
|
|
||||||
|
// Validate parameters
|
||||||
|
if (! $this->datepaid)
|
||||||
|
{
|
||||||
|
$this->error='ErrorBadValueForParameter';
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clean parameters
|
||||||
|
if (isset($this->fk_loan)) $this->fk_loan = trim($this->fk_loan);
|
||||||
|
if (isset($this->amount_capital)) $this->amount_capital = trim($this->amount_capital?$this->amount_capital:0);
|
||||||
|
if (isset($this->amount_insurance)) $this->amount_insurance = trim($this->amount_insurance?$this->amount_insurance:0);
|
||||||
|
if (isset($this->amount_interest)) $this->amount_interest = trim($this->amount_interest?$this->amount_interest:0);
|
||||||
|
if (isset($this->fk_typepayment)) $this->fk_typepayment = trim($this->fk_typepayment);
|
||||||
|
if (isset($this->fk_bank)) $this->fk_bank = trim($this->fk_bank);
|
||||||
|
if (isset($this->fk_user_creat)) $this->fk_user_creat = trim($this->fk_user_creat);
|
||||||
|
if (isset($this->fk_user_modif)) $this->fk_user_modif = trim($this->fk_user_modif);
|
||||||
|
|
||||||
|
$totalamount = $this->amount_capital + $this->amount_insurance + $this->amount_interest;
|
||||||
|
$totalamount = price2num($totalamount);
|
||||||
|
|
||||||
|
// Check parameters
|
||||||
|
if ($totalamount == 0) {
|
||||||
|
$this->errors[]='step1';
|
||||||
|
return -1; // Negative amounts are accepted for reject prelevement but not null
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
|
if ($totalamount != 0)
|
||||||
|
{
|
||||||
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element." (fk_loan, datec, datep, amount_capital, amount_insurance, amount_interest,";
|
||||||
|
$sql.= " fk_typepayment, fk_user_creat, fk_bank)";
|
||||||
|
$sql.= " VALUES (".$this->fk_loan.", '".$this->db->idate($now)."',";
|
||||||
|
$sql.= " '".$this->db->idate($this->datepaid)."',";
|
||||||
|
$sql.= " ".$this->amount_capital.",";
|
||||||
|
$sql.= " ".$this->amount_insurance.",";
|
||||||
|
$sql.= " ".$this->amount_interest.",";
|
||||||
|
$sql.= " ".$this->fk_typepayment.", ";
|
||||||
|
$sql.= " ".$user->id.",";
|
||||||
|
$sql.= " ".$this->fk_bank . ")";
|
||||||
|
|
||||||
|
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||||
|
$resql=$this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_loan");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->error=$this->db->lasterror();
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($totalamount != 0 && ! $error)
|
||||||
|
{
|
||||||
|
$this->amount_capital=$totalamount;
|
||||||
|
$this->total=$totalamount; // deprecated
|
||||||
|
$this->db->commit();
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->errors[]=$this->db->lasterror();
|
||||||
|
$this->db->rollback();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load object in memory from database
|
||||||
|
*
|
||||||
|
* @param int $id Id object
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
function fetch($id)
|
||||||
|
{
|
||||||
|
global $langs;
|
||||||
|
$sql = "SELECT";
|
||||||
|
$sql.= " t.rowid,";
|
||||||
|
$sql.= " t.fk_loan,";
|
||||||
|
$sql.= " t.datec,";
|
||||||
|
$sql.= " t.tms,";
|
||||||
|
$sql.= " t.datep,";
|
||||||
|
$sql.= " t.amount_capital,";
|
||||||
|
$sql.= " t.amount_insurance,";
|
||||||
|
$sql.= " t.amount_interest,";
|
||||||
|
$sql.= " t.fk_typepayment,";
|
||||||
|
$sql.= " t.num_payment,";
|
||||||
|
$sql.= " t.note_private,";
|
||||||
|
$sql.= " t.note_public,";
|
||||||
|
$sql.= " t.fk_bank,";
|
||||||
|
$sql.= " t.fk_user_creat,";
|
||||||
|
$sql.= " t.fk_user_modif,";
|
||||||
|
$sql.= " pt.code as type_code, pt.libelle as type_libelle,";
|
||||||
|
$sql.= ' b.fk_account';
|
||||||
|
$sql.= " FROM (".MAIN_DB_PREFIX."c_paiement as pt, ".MAIN_DB_PREFIX.$this->table_element." as t)";
|
||||||
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON t.fk_bank = b.rowid';
|
||||||
|
$sql.= " WHERE t.rowid = ".$id." AND t.fk_typepayment = pt.id";
|
||||||
|
|
||||||
|
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||||
|
$resql=$this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
if ($this->db->num_rows($resql))
|
||||||
|
{
|
||||||
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
|
||||||
|
$this->id = $obj->rowid;
|
||||||
|
$this->ref = $obj->rowid;
|
||||||
|
|
||||||
|
$this->fk_loan = $obj->fk_loan;
|
||||||
|
$this->datec = $this->db->jdate($obj->datec);
|
||||||
|
$this->tms = $this->db->jdate($obj->tms);
|
||||||
|
$this->datep = $this->db->jdate($obj->datep);
|
||||||
|
$this->amount_capital = $obj->amount_capital;
|
||||||
|
$this->amount_insurance = $obj->amount_insurance;
|
||||||
|
$this->amount_interest = $obj->amount_interest;
|
||||||
|
$this->fk_typepayment = $obj->fk_typepayment;
|
||||||
|
$this->num_payment = $obj->num_payment;
|
||||||
|
$this->note_private = $obj->note_private;
|
||||||
|
$this->note_public = $obj->note_public;
|
||||||
|
$this->fk_bank = $obj->fk_bank;
|
||||||
|
$this->fk_user_creat = $obj->fk_user_creat;
|
||||||
|
$this->fk_user_modif = $obj->fk_user_modif;
|
||||||
|
|
||||||
|
$this->type_code = $obj->type_code;
|
||||||
|
$this->type_libelle = $obj->type_libelle;
|
||||||
|
|
||||||
|
$this->bank_account = $obj->fk_account;
|
||||||
|
$this->bank_line = $obj->fk_bank;
|
||||||
|
}
|
||||||
|
$this->db->free($resql);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->error="Error ".$this->db->lasterror();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update database
|
||||||
|
*
|
||||||
|
* @param User $user User that modify
|
||||||
|
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
function update($user=0, $notrigger=0)
|
||||||
|
{
|
||||||
|
global $conf, $langs;
|
||||||
|
$error=0;
|
||||||
|
|
||||||
|
// Clean parameters
|
||||||
|
if (isset($this->fk_loan)) $this->fk_loan=trim($this->fk_loan);
|
||||||
|
if (isset($this->amount_capital)) $this->amount_capital=trim($this->amount_capital);
|
||||||
|
if (isset($this->amount_insurance)) $this->amount_insurance=trim($this->amount_insurance);
|
||||||
|
if (isset($this->amount_interest)) $this->amount_interest=trim($this->amount_interest);
|
||||||
|
if (isset($this->fk_typepayment)) $this->fk_typepayment=trim($this->fk_typepayment);
|
||||||
|
if (isset($this->num_payment)) $this->num_payment=trim($this->num_payment);
|
||||||
|
if (isset($this->note_private)) $this->note_private=trim($this->note_private);
|
||||||
|
if (isset($this->note_public)) $this->note_public=trim($this->note_public);
|
||||||
|
if (isset($this->fk_bank)) $this->fk_bank=trim($this->fk_bank);
|
||||||
|
if (isset($this->fk_user_creat)) $this->fk_user_creat=trim($this->fk_user_creat);
|
||||||
|
if (isset($this->fk_user_modif)) $this->fk_user_modif=trim($this->fk_user_modif);
|
||||||
|
|
||||||
|
// Check parameters
|
||||||
|
// Put here code to add control on parameters values
|
||||||
|
|
||||||
|
// Update request
|
||||||
|
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET";
|
||||||
|
|
||||||
|
$sql.= " fk_loan=".(isset($this->fk_loan)?$this->fk_loan:"null").",";
|
||||||
|
$sql.= " datec=".(dol_strlen($this->datec)!=0 ? "'".$this->db->idate($this->datec)."'" : 'null').",";
|
||||||
|
$sql.= " tms=".(dol_strlen($this->tms)!=0 ? "'".$this->db->idate($this->tms)."'" : 'null').",";
|
||||||
|
$sql.= " datep=".(dol_strlen($this->datep)!=0 ? "'".$this->db->idate($this->datep)."'" : 'null').",";
|
||||||
|
$sql.= " amount_capital=".(isset($this->amount_capital)?$this->amount_capital:"null").",";
|
||||||
|
$sql.= " amount_insurance=".(isset($this->amount_insurance)?$this->amount_insurance:"null").",";
|
||||||
|
$sql.= " amount_interest=".(isset($this->amount_interest)?$this->amount_interest:"null").",";
|
||||||
|
$sql.= " fk_typepayment=".(isset($this->fk_typepayment)?$this->fk_typepayment:"null").",";
|
||||||
|
$sql.= " num_payment=".(isset($this->num_payment)?"'".$this->db->escape($this->num_payment)."'":"null").",";
|
||||||
|
$sql.= " note_private=".(isset($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null").",";
|
||||||
|
$sql.= " note_public=".(isset($this->note_public)?"'".$this->db->escape($this->note_public)."'":"null").",";
|
||||||
|
$sql.= " fk_bank=".(isset($this->fk_bank)?$this->fk_bank:"null").",";
|
||||||
|
$sql.= " fk_user_creat=".(isset($this->fk_user_creat)?$this->fk_user_creat:"null").",";
|
||||||
|
$sql.= " fk_user_modif=".(isset($this->fk_user_modif)?$this->fk_user_modif:"null")."";
|
||||||
|
|
||||||
|
$sql.= " WHERE rowid=".$this->id;
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
|
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
if (! $notrigger)
|
||||||
|
{
|
||||||
|
// Uncomment this and change MYOBJECT to your own tag if you
|
||||||
|
// want this action call a trigger.
|
||||||
|
|
||||||
|
//// Call triggers
|
||||||
|
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||||
|
//$interface=new Interfaces($this->db);
|
||||||
|
//$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf);
|
||||||
|
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||||
|
//// End call triggers
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Commit or rollback
|
||||||
|
if ($error)
|
||||||
|
{
|
||||||
|
$this->db->rollback();
|
||||||
|
return -1*$error;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->db->commit();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete object in database
|
||||||
|
*
|
||||||
|
* @param User $user User that delete
|
||||||
|
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
function delete($user, $notrigger=0)
|
||||||
|
{
|
||||||
|
global $conf, $langs;
|
||||||
|
$error=0;
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element;
|
||||||
|
$sql.= " WHERE rowid=".$this->id;
|
||||||
|
|
||||||
|
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
if (! $notrigger)
|
||||||
|
{
|
||||||
|
// Uncomment this and change MYOBJECT to your own tag if you
|
||||||
|
// want this action call a trigger.
|
||||||
|
|
||||||
|
//// Call triggers
|
||||||
|
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||||
|
//$interface=new Interfaces($this->db);
|
||||||
|
//$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf);
|
||||||
|
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||||
|
//// End call triggers
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Commit or rollback
|
||||||
|
if ($error)
|
||||||
|
{
|
||||||
|
foreach($this->errors as $errmsg)
|
||||||
|
{
|
||||||
|
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
|
||||||
|
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||||
|
}
|
||||||
|
$this->db->rollback();
|
||||||
|
return -1*$error;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->db->commit();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function calc_mens($capital,$rate,$nbterm)
|
||||||
|
{
|
||||||
|
$result='';
|
||||||
|
|
||||||
|
if (!empty($capital)&&!empty($rate)&&!empty($nbterm))
|
||||||
|
{
|
||||||
|
$result=($capital*($rate/12))/(1-pow((1+($rate/12)),($nbterm*-1)));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load all object in memory from database
|
||||||
|
*
|
||||||
|
* @param int $loanid Id object
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
function fetchall($loanid)
|
||||||
|
{
|
||||||
|
global $langs;
|
||||||
|
|
||||||
|
$sql = "SELECT";
|
||||||
|
$sql.= " t.rowid,";
|
||||||
|
$sql.= " t.fk_loan,";
|
||||||
|
$sql.= " t.datec,";
|
||||||
|
$sql.= " t.tms,";
|
||||||
|
$sql.= " t.datep,";
|
||||||
|
$sql.= " t.amount_capital,";
|
||||||
|
$sql.= " t.amount_insurance,";
|
||||||
|
$sql.= " t.amount_interest,";
|
||||||
|
$sql.= " t.fk_typepayment,";
|
||||||
|
$sql.= " t.num_payment,";
|
||||||
|
$sql.= " t.note_private,";
|
||||||
|
$sql.= " t.note_public,";
|
||||||
|
$sql.= " t.fk_bank,";
|
||||||
|
$sql.= " t.fk_user_creat,";
|
||||||
|
$sql.= " t.fk_user_modif";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as t";
|
||||||
|
$sql.= " WHERE t.fk_loan = ".$loanid;
|
||||||
|
|
||||||
|
dol_syslog(get_class($this)."::fetchall", LOG_DEBUG);
|
||||||
|
$resql=$this->db->query($sql);
|
||||||
|
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
while($obj = $this->db->fetch_object($resql))
|
||||||
|
{
|
||||||
|
$line = New LoanSchedule($this->db);
|
||||||
|
$line->id = $obj->rowid;
|
||||||
|
$line->ref = $obj->rowid;
|
||||||
|
|
||||||
|
$line->fk_loan = $obj->fk_loan;
|
||||||
|
$line->datec = $this->db->jdate($obj->datec);
|
||||||
|
$line->tms = $this->db->jdate($obj->tms);
|
||||||
|
$line->datep = $this->db->jdate($obj->datep);
|
||||||
|
$line->amount_capital = $obj->amount_capital;
|
||||||
|
$line->amount_insurance = $obj->amount_insurance;
|
||||||
|
$line->amount_interest = $obj->amount_interest;
|
||||||
|
$line->fk_typepayment = $obj->fk_typepayment;
|
||||||
|
$line->num_payment = $obj->num_payment;
|
||||||
|
$line->note_private = $obj->note_private;
|
||||||
|
$line->note_public = $obj->note_public;
|
||||||
|
$line->fk_bank = $obj->fk_bank;
|
||||||
|
$line->fk_user_creat = $obj->fk_user_creat;
|
||||||
|
$line->fk_user_modif = $obj->fk_user_modif;
|
||||||
|
|
||||||
|
$this->lines[] = $line;
|
||||||
|
}
|
||||||
|
$this->db->free($resql);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->error="Error ".$this->db->lasterror();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* trans_paiment
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function trans_paiment()
|
||||||
|
{
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/loan.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||||
|
|
||||||
|
$toinsert = array();
|
||||||
|
|
||||||
|
$sql = "SELECT l.rowid";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."loan as l ";
|
||||||
|
$sql.= " WHERE l.paid = 0";
|
||||||
|
$resql=$this->db->query($sql);
|
||||||
|
|
||||||
|
if($resql){
|
||||||
|
while($obj = $this->db->fetch_object($resql)){
|
||||||
|
$lastrecorded = $this->lastpaiment($obj->rowid);
|
||||||
|
$toinsert = $this->paimenttorecord($obj->rowid, $lastrecorded);
|
||||||
|
if(count($toinsert)>0){
|
||||||
|
foreach ($toinsert as $echid){
|
||||||
|
$this->db->begin();
|
||||||
|
$sql = "INSERT INTO " .MAIN_DB_PREFIX . "payment_loan ";
|
||||||
|
$sql.= "(fk_loan,datec,tms,datep,amount_capital,amount_insurance,amount_interest,fk_typepayment,num_payment,note_private,note_public,fk_bank,fk_user_creat,fk_user_modif) ";
|
||||||
|
$sql.= "SELECT fk_loan,datec,tms,datep,amount_capital,amount_insurance,amount_interest,fk_typepayment,num_payment,note_private,note_public,fk_bank,fk_user_creat,fk_user_modif FROM " . MAIN_DB_PREFIX . "loan_schedule WHERE rowid =" .$echid;
|
||||||
|
$res=$this->db->query($sql);
|
||||||
|
if($res){
|
||||||
|
$this->db->commit();
|
||||||
|
}else {
|
||||||
|
$this->db->rollback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* trans_paiment
|
||||||
|
*
|
||||||
|
* @param int $loanid Loan id
|
||||||
|
* @return int < 0 if KO, Date > 0 if OK
|
||||||
|
*/
|
||||||
|
function lastpaiment($loanid)
|
||||||
|
{
|
||||||
|
$sql = "SELECT p.datep";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."payment_loan as p ";
|
||||||
|
$sql.= " WHERE p.fk_loan = " . $loanid;
|
||||||
|
$sql.= " ORDER BY p.datep DESC ";
|
||||||
|
$sql.= " LIMIT 1 ";
|
||||||
|
|
||||||
|
$resql=$this->db->query($sql);
|
||||||
|
|
||||||
|
if($resql){
|
||||||
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
return $this->db->jdate($obj->datep);
|
||||||
|
}else{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* paimenttorecord
|
||||||
|
*
|
||||||
|
* @param int $loanid Loan id
|
||||||
|
* @param int $datemax Date max
|
||||||
|
* @return array Array of id
|
||||||
|
*/
|
||||||
|
function paimenttorecord($loanid, $datemax)
|
||||||
|
{
|
||||||
|
$sql = "SELECT p.rowid";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as p ";
|
||||||
|
$sql.= " WHERE p.fk_loan = " . $loanid;
|
||||||
|
if (!empty($datemax)) { $sql.= " AND p.datep > '" . $this->db->idate($datemax) ."'";}
|
||||||
|
$sql.= " AND p.datep <= '" . $this->db->idate(dol_now()). "'";
|
||||||
|
|
||||||
|
$resql=$this->db->query($sql);
|
||||||
|
|
||||||
|
if($resql){
|
||||||
|
while($obj = $this->db->fetch_object($resql))
|
||||||
|
{
|
||||||
|
$result[] = $obj->rowid;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
208
htdocs/loan/createschedule.php
Normal file
208
htdocs/loan/createschedule.php
Normal file
@ -0,0 +1,208 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2017 Franck Moreau <franck.moreau@theobald.com>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/loan/createecheancier.php
|
||||||
|
* \ingroup loan
|
||||||
|
* \brief Schedule card
|
||||||
|
*/
|
||||||
|
|
||||||
|
require '../main.inc.php';
|
||||||
|
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/loan.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/loan/class/loanschedule.class.php';
|
||||||
|
|
||||||
|
global $user;
|
||||||
|
|
||||||
|
$loanid = GETPOST('loanid', 'int');
|
||||||
|
$action = GETPOST('action');
|
||||||
|
|
||||||
|
$object = new Loan($db);
|
||||||
|
$object->fetch($loanid);
|
||||||
|
|
||||||
|
$langs->load('loan');
|
||||||
|
|
||||||
|
if ($action == 'createecheancier') {
|
||||||
|
|
||||||
|
$i=1;
|
||||||
|
while($i <$object->nbterm+1){
|
||||||
|
|
||||||
|
$date = GETPOST('hi_date'.$i,'int');
|
||||||
|
$mens = GETPOST('mens'.$i);
|
||||||
|
$int = GETPOST('hi_interets'.$i);
|
||||||
|
|
||||||
|
$echeance = new LoanSchedule($db);
|
||||||
|
|
||||||
|
$echeance->fk_loan = $object->id;
|
||||||
|
$echeance->datec = dol_now();
|
||||||
|
$echeance->tms = dol_now();
|
||||||
|
$echeance->datepaid = $date;
|
||||||
|
$echeance->amount_capital = $mens-$int;
|
||||||
|
$echeance->amount_insurance = 0;
|
||||||
|
$echeance->amount_interest = $int;
|
||||||
|
$echeance->fk_typepayment = 3;
|
||||||
|
$echeance->fk_bank = 1;
|
||||||
|
$echeance->fk_user_creat = $user->id;
|
||||||
|
$echeance->fk_user_modif = $user->id;
|
||||||
|
$result=$echeance->create($user);
|
||||||
|
if ($result<0) {
|
||||||
|
setEventMessages(null, $echeance->errors,'errors');
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($action == 'updateecheancier') {
|
||||||
|
|
||||||
|
$i=1;
|
||||||
|
while($i <$object->nbterm+1){
|
||||||
|
|
||||||
|
$mens = GETPOST('mens'.$i);
|
||||||
|
$int = GETPOST('hi_interets'.$i);
|
||||||
|
$id = GETPOST('hi_rowid'.$i);
|
||||||
|
$echeance = new LoanSchedule($db);
|
||||||
|
$echeance->fetch($id);
|
||||||
|
$echeance->tms = dol_now();
|
||||||
|
$echeance->amount_capital = $mens-$int;
|
||||||
|
$echeance->amount_insurance = 0;
|
||||||
|
$echeance->amount_interest = $int;
|
||||||
|
$echeance->fk_user_modif = $user->id;
|
||||||
|
$result= $echeance->update($user,0);
|
||||||
|
if ($result<0) {
|
||||||
|
setEventMessages(null, $echeance->errors,'errors');
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$echeance = new LoanSchedule($db);
|
||||||
|
$echeance->fetchall($object->id);
|
||||||
|
|
||||||
|
top_htmlhead('', '');
|
||||||
|
$var = ! $var;
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
||||||
|
<script type="text/javascript" language="javascript">
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('[name^="mens"]').focusout(function() {
|
||||||
|
var echeance=$(this).attr('ech');
|
||||||
|
var mens=$(this).val();
|
||||||
|
var idcap=echeance-1;
|
||||||
|
idcap = '#hi_capital'+idcap;
|
||||||
|
var capital=$(idcap).val();
|
||||||
|
$.ajax({
|
||||||
|
dataType: 'json',
|
||||||
|
url: 'calcmens.php',
|
||||||
|
data: { echeance: echeance, mens: mens, capital:capital, rate:<?php echo $object->rate/100;?> , nbterm : <?php echo $object->nbterm;?>},
|
||||||
|
success: function(data) {
|
||||||
|
$.each(data, function(index, element) {
|
||||||
|
var idcap_res='#hi_capital'+index;
|
||||||
|
var idcap_res_srt='#capital'+index;
|
||||||
|
var interet_res='#hi_interets'+index;
|
||||||
|
var interet_res_str='#interets'+index;
|
||||||
|
var men_res='#mens'+index;
|
||||||
|
$(idcap_res).val(element.cap_rest);
|
||||||
|
$(idcap_res_srt).text(element.cap_rest_str+' €');
|
||||||
|
$(interet_res).val(element.interet);
|
||||||
|
$(interet_res_str).text(element.interet_str+' €');
|
||||||
|
$(men_res).val(element.mens);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
print '<form name="createecheancier" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
|
||||||
|
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||||
|
print '<input type="hidden" name="loanid" value="' . $loanid . '">';
|
||||||
|
if(count($echeance->lines)>0){
|
||||||
|
print '<input type="hidden" name="action" value="updateecheancier">';
|
||||||
|
}else{
|
||||||
|
print '<input type="hidden" name="action" value="createecheancier">';
|
||||||
|
}
|
||||||
|
print '<table class="border" width="100%">';
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print '<th align="center" colspan="5">' . "Création d'échéancier</th>";
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
Print '<th width="10%" align="center"> Echéance </th>';
|
||||||
|
Print '<th width="10%" align="center"> Date </th>';
|
||||||
|
Print '<th width="10%" align="center"> Montant </th>';
|
||||||
|
Print '<th width="20%" align="center"> Intérêts </th>';
|
||||||
|
Print '<th width="40%" align="center"> Capital restant du </th>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
if ($object->nbterm > 0 && count($echeance->lines)==0)
|
||||||
|
{
|
||||||
|
$i=1;
|
||||||
|
$capital = $object->capital;
|
||||||
|
while($i <$object->nbterm+1){
|
||||||
|
$mens = round($echeance->calc_mens($capital, $object->rate/100, $object->nbterm-$i+1),2,PHP_ROUND_HALF_UP);
|
||||||
|
$int = ($capital*($object->rate/12))/100;
|
||||||
|
$int = round($int,2,PHP_ROUND_HALF_UP);
|
||||||
|
$cap_rest = round($capital - ($mens-$int),2,PHP_ROUND_HALF_UP);
|
||||||
|
print '<tr>';
|
||||||
|
print '<td align="center" id="n'.$i.'">' . $i .'</td>';
|
||||||
|
print '<td align="center" id ="date' .$i .'"><input type="hidden" name="hi_date' .$i .'" id ="hi_date' .$i .'" value="' . dol_time_plus_duree($object->datestart, $i-1, 'm') . '">' . dol_print_date(dol_time_plus_duree($object->datestart, $i-1, 'm'),'day') . '</td>';
|
||||||
|
print '<td align="center"><input name="mens'.$i.'" id="mens'.$i.'" size="5" value="'.$mens.'" ech="'.$i.'"> €</td>';
|
||||||
|
print '<td align="center" id="interets'.$i.'">'.price($int,0,'',1).' €</td><input type="hidden" name="hi_interets' .$i .'" id ="hi_interets' .$i .'" value="' . $int . '">';
|
||||||
|
print '<td align="center" id="capital'.$i.'">'.price($cap_rest).' €</td><input type="hidden" name="hi_capital' .$i .'" id ="hi_capital' .$i .'" value="' . $cap_rest . '">';
|
||||||
|
print '</tr>';
|
||||||
|
$i++;
|
||||||
|
$capital = $cap_rest;
|
||||||
|
}
|
||||||
|
}elseif(count($echeance->lines)>0){
|
||||||
|
$i=1;
|
||||||
|
$capital = $object->capital;
|
||||||
|
foreach ($echeance->lines as $line){
|
||||||
|
$mens = $line->amount_capital+$line->amount_insurance+$line->amount_interest;
|
||||||
|
$int = $line->amount_interest;
|
||||||
|
$cap_rest = round($capital - ($mens-$int),2,PHP_ROUND_HALF_UP);
|
||||||
|
print '<tr>';
|
||||||
|
print '<td align="center" id="n'.$i.'"><input type="hidden" name="hi_rowid' .$i .'" id ="hi_rowid' .$i .'" value="' . $line->id . '">' . $i .'</td>';
|
||||||
|
print '<td align="center" id ="date' .$i .'"><input type="hidden" name="hi_date' .$i .'" id ="hi_date' .$i .'" value="' . $line->datep . '">' . dol_print_date($line->datep,'day') . '</td>';
|
||||||
|
if($line->datep > dol_now()){
|
||||||
|
print '<td align="center"><input name="mens'.$i.'" id="mens'.$i.'" size="5" value="'.$mens.'" ech="'.$i.'"> €</td>';
|
||||||
|
}else{
|
||||||
|
print '<td align="center">' . price($mens) . ' €</td><input type="hidden" name="mens' .$i .'" id ="mens' .$i .'" value="' . $mens . '">';
|
||||||
|
}
|
||||||
|
print '<td align="center" id="interets'.$i.'">'.price($int,0,'',1).' €</td><input type="hidden" name="hi_interets' .$i .'" id ="hi_interets' .$i .'" value="' . $int . '">';
|
||||||
|
print '<td align="center" id="capital'.$i.'">'.price($cap_rest).' €</td><input type="hidden" name="hi_capital' .$i .'" id ="hi_capital' .$i .'" value="' . $cap_rest . '">';
|
||||||
|
print '</tr>';
|
||||||
|
$i++;
|
||||||
|
$capital = $cap_rest;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
print '</br>';
|
||||||
|
print '</br>';
|
||||||
|
print '<div align="center"><input class="button" type="submit" value="'.$langs->trans("Save").'"></div>';
|
||||||
|
print '</form>';
|
||||||
|
|
||||||
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -39,20 +39,23 @@ require_once '../lib/mymodule.lib.php';
|
|||||||
$langs->load("mymodule@mymodule");
|
$langs->load("mymodule@mymodule");
|
||||||
|
|
||||||
// Access control
|
// Access control
|
||||||
if (! $user->admin) {
|
if (! $user->admin) accessforbidden();
|
||||||
accessforbidden();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Parameters
|
// Parameters
|
||||||
$action = GETPOST('action', 'alpha');
|
$action = GETPOST('action', 'alpha');
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$page_name = "MyModuleSetup";
|
$page_name = "MyModuleSetup";
|
||||||
llxHeader('', $langs->trans($page_name));
|
llxHeader('', $langs->trans($page_name));
|
||||||
|
|
||||||
|
|||||||
@ -62,24 +62,101 @@ class ActionsMyModule
|
|||||||
*/
|
*/
|
||||||
public function doActions($parameters, &$object, &$action, $hookmanager)
|
public function doActions($parameters, &$object, &$action, $hookmanager)
|
||||||
{
|
{
|
||||||
|
global $conf, $user, $langs;
|
||||||
|
|
||||||
$error = 0; // Error counter
|
$error = 0; // Error counter
|
||||||
$myvalue = 'test'; // A result value
|
|
||||||
|
|
||||||
|
/*
|
||||||
print_r($parameters);
|
print_r($parameters);
|
||||||
echo "action: " . $action;
|
|
||||||
print_r($object);
|
print_r($object);
|
||||||
|
echo "action: " . $action;
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (in_array($parameters['currentcontext'], array('somecontext1','somecontext2'))) { // do something only for the context 'somecontext1' or 'somecontext2'
|
||||||
|
|
||||||
|
|
||||||
if (in_array('somecontext', explode(':', $parameters['context']))) {
|
|
||||||
// do something only for the context 'somecontext'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error) {
|
if (! $error) {
|
||||||
$this->results = array('myreturn' => $myvalue);
|
$this->results = array('myreturn' => 999);
|
||||||
$this->resprints = 'A text to show';
|
$this->resprints = 'A text to show';
|
||||||
return 0; // or return 1 to replace standard code
|
return 0; // or return 1 to replace standard code
|
||||||
} else {
|
} else {
|
||||||
$this->errors[] = 'Error message';
|
$this->errors[] = 'Error message';
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overloading the doActions function : replacing the parent's function with the one below
|
||||||
|
*
|
||||||
|
* @param array() $parameters Hook metadatas (context, etc...)
|
||||||
|
* @param CommonObject $object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...)
|
||||||
|
* @param string $action Current action (if set). Generally create or edit or null
|
||||||
|
* @param HookManager $hookmanager Hook manager propagated to allow calling another hook
|
||||||
|
* @return int < 0 on error, 0 on success, 1 to replace standard code
|
||||||
|
*/
|
||||||
|
public function doMassActions($parameters, &$object, &$action, $hookmanager)
|
||||||
|
{
|
||||||
|
global $conf, $user, $langs;
|
||||||
|
|
||||||
|
$error = 0; // Error counter
|
||||||
|
|
||||||
|
/*
|
||||||
|
print_r($parameters);
|
||||||
|
print_r($object);
|
||||||
|
echo "action: " . $action;
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (in_array($parameters['currentcontext'], array('somecontext1','somecontext2'))) { // do something only for the context 'somecontext1' or 'somecontext2'
|
||||||
|
|
||||||
|
foreach($parameters['toselect'] as $objectid)
|
||||||
|
{
|
||||||
|
// Do action on each object id
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error) {
|
||||||
|
$this->results = array('myreturn' => 999);
|
||||||
|
$this->resprints = 'A text to show';
|
||||||
|
return 0; // or return 1 to replace standard code
|
||||||
|
} else {
|
||||||
|
$this->errors[] = 'Error message';
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overloading the addMoreMassActions function : replacing the parent's function with the one below
|
||||||
|
*
|
||||||
|
* @param array() $parameters Hook metadatas (context, etc...)
|
||||||
|
* @param CommonObject $object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...)
|
||||||
|
* @param string $action Current action (if set). Generally create or edit or null
|
||||||
|
* @param HookManager $hookmanager Hook manager propagated to allow calling another hook
|
||||||
|
* @return int < 0 on error, 0 on success, 1 to replace standard code
|
||||||
|
*/
|
||||||
|
public function addMoreMassActions($parameters, &$object, &$action, $hookmanager)
|
||||||
|
{
|
||||||
|
global $conf, $user, $langs;
|
||||||
|
|
||||||
|
$error = 0; // Error counter
|
||||||
|
|
||||||
|
if (in_array($parameters['currentcontext'], array('somecontext1','somecontext2'))) // do something only for the context 'somecontext'
|
||||||
|
{
|
||||||
|
$this->resprints = '<option value="0"'.($disabled?' disabled="disabled"':'').'>'.$langs->trans("MyModuleMassAction").'</option>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error) {
|
||||||
|
return 0; // or return 1 to replace standard code
|
||||||
|
} else {
|
||||||
|
$this->errors[] = 'Error message';
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
htdocs/modulebuilder/template/img/object_mytest.png
Normal file
BIN
htdocs/modulebuilder/template/img/object_mytest.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 360 B |
@ -18,12 +18,10 @@
|
|||||||
# Generic
|
# Generic
|
||||||
#
|
#
|
||||||
|
|
||||||
# Module label 'ModuleXXXName'
|
# Module label 'ModuleMyModuleName'
|
||||||
# (where XXX is value of numeric property 'numero' of module)
|
ModuleMyModuleName = My module
|
||||||
Module500000Name = My module
|
# Module description 'ModuleMyModuleDesc'
|
||||||
# Module description 'ModuleXXXDesc'
|
ModuleMyModuleDesc = My module description
|
||||||
# (where XXX is value of numeric property 'numero' of module)
|
|
||||||
Module500000Desc = My module description
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Admin page
|
# Admin page
|
||||||
|
|||||||
@ -18,12 +18,10 @@
|
|||||||
# Générique
|
# Générique
|
||||||
#
|
#
|
||||||
|
|
||||||
# Module label 'ModuleXXXName'
|
# Module label 'ModuleMyModuleName'
|
||||||
# (where XXX is value of numeric property 'numero' of module)
|
ModuleMyModuleName = Mon module
|
||||||
Module500000Name = Mon module
|
# Module description 'ModuleMyModuleDesc'
|
||||||
# Module description 'ModuleXXXDesc'
|
ModuleMyModuleDesc = Description de mon module
|
||||||
# (where XXX is value of numeric property 'numero' of module)
|
|
||||||
Module500000Desc = Description de mon module
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Page d'administration
|
# Page d'administration
|
||||||
|
|||||||
@ -74,6 +74,9 @@ $error = 0;
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$nomessageinsetmoduleoptions=1;
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||||
|
|
||||||
if ($action == 'setcodeproduct')
|
if ($action == 'setcodeproduct')
|
||||||
{
|
{
|
||||||
if (dolibarr_set_const($db, "PRODUCT_CODEPRODUCT_ADDON",$value,'chaine',0,'',$conf->entity) > 0)
|
if (dolibarr_set_const($db, "PRODUCT_CODEPRODUCT_ADDON",$value,'chaine',0,'',$conf->entity) > 0)
|
||||||
@ -87,36 +90,6 @@ if ($action == 'setcodeproduct')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...)
|
|
||||||
if ($action == 'setModuleOptions')
|
|
||||||
{
|
|
||||||
$post_size=count($_POST);
|
|
||||||
|
|
||||||
$db->begin();
|
|
||||||
|
|
||||||
for($i=0;$i < $post_size;$i++)
|
|
||||||
{
|
|
||||||
if (array_key_exists('param'.$i,$_POST))
|
|
||||||
{
|
|
||||||
$param=GETPOST("param".$i,'alpha');
|
|
||||||
$value=GETPOST("value".$i,'alpha');
|
|
||||||
if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity);
|
|
||||||
if (! $res > 0) $error++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (! $error)
|
|
||||||
{
|
|
||||||
$db->commit();
|
|
||||||
//setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$db->rollback();
|
|
||||||
// message yet present at the bottom if($action)
|
|
||||||
//setEventMessages($langs->trans("Error"), null, 'errors');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($action == 'other' && GETPOST('value_PRODUIT_LIMIT_SIZE') >= 0)
|
if ($action == 'other' && GETPOST('value_PRODUIT_LIMIT_SIZE') >= 0)
|
||||||
{
|
{
|
||||||
$res = dolibarr_set_const($db, "PRODUIT_LIMIT_SIZE", GETPOST('value_PRODUIT_LIMIT_SIZE'),'chaine',0,'',$conf->entity);
|
$res = dolibarr_set_const($db, "PRODUIT_LIMIT_SIZE", GETPOST('value_PRODUIT_LIMIT_SIZE'),'chaine',0,'',$conf->entity);
|
||||||
@ -278,7 +251,7 @@ if ($action)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
setEventMessages($langs->trans("SetupNotError"), null, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -34,6 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||||
|
|
||||||
$langs->load('projects');
|
$langs->load('projects');
|
||||||
|
$langs->load('users');
|
||||||
|
|
||||||
$action=GETPOST('action','aZ09');
|
$action=GETPOST('action','aZ09');
|
||||||
$mode=GETPOST("mode");
|
$mode=GETPOST("mode");
|
||||||
@ -62,6 +63,8 @@ $month=GETPOST('remonth')?GETPOST('remonth'):(GETPOST("month","int")?GETPOST("mo
|
|||||||
$day=GETPOST('reday')?GETPOST('reday'):(GETPOST("day","int")?GETPOST("day","int"):date("d"));
|
$day=GETPOST('reday')?GETPOST('reday'):(GETPOST("day","int")?GETPOST("day","int"):date("d"));
|
||||||
$day = (int) $day;
|
$day = (int) $day;
|
||||||
$week=GETPOST("week","int")?GETPOST("week","int"):date("W");
|
$week=GETPOST("week","int")?GETPOST("week","int"):date("W");
|
||||||
|
|
||||||
|
$search_usertoprocessid=GETPOST('search_usertoprocessid', 'int');
|
||||||
$search_task_ref=GETPOST('search_task_ref', 'alpha');
|
$search_task_ref=GETPOST('search_task_ref', 'alpha');
|
||||||
$search_task_label=GETPOST('search_task_label', 'alpha');
|
$search_task_label=GETPOST('search_task_label', 'alpha');
|
||||||
$search_project_ref=GETPOST('search_project_ref', 'alpha');
|
$search_project_ref=GETPOST('search_project_ref', 'alpha');
|
||||||
@ -75,6 +78,17 @@ $daytoparse = $now;
|
|||||||
if ($yearofday && $monthofday && $dayofday) $daytoparse=dol_mktime(0, 0, 0, $monthofday, $dayofday, $yearofday); // xxxofday is value of day after submit action 'addtime'
|
if ($yearofday && $monthofday && $dayofday) $daytoparse=dol_mktime(0, 0, 0, $monthofday, $dayofday, $yearofday); // xxxofday is value of day after submit action 'addtime'
|
||||||
else if ($year && $month && $day) $daytoparse=dol_mktime(0, 0, 0, $month, $day, $year); // this are value submited after submit of action 'submitdateselect'
|
else if ($year && $month && $day) $daytoparse=dol_mktime(0, 0, 0, $month, $day, $year); // this are value submited after submit of action 'submitdateselect'
|
||||||
|
|
||||||
|
if (empty($search_usertoprocessid) || $search_usertoprocessid == $user->id)
|
||||||
|
{
|
||||||
|
$usertoprocess=$user;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$usertoprocess=new User($db);
|
||||||
|
$usertoprocess->fetch($search_usertoprocessid);
|
||||||
|
}
|
||||||
|
$search_usertoprocessid=$usertoprocess->id;
|
||||||
|
|
||||||
$object=new Task($db);
|
$object=new Task($db);
|
||||||
|
|
||||||
|
|
||||||
@ -83,9 +97,10 @@ $object=new Task($db);
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Purge criteria
|
// Purge criteria
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$action = '';
|
$action = '';
|
||||||
|
$search_usertoprocessid = '';
|
||||||
$search_task_ref = '';
|
$search_task_ref = '';
|
||||||
$search_task_label = '';
|
$search_task_label = '';
|
||||||
$search_project_ref = '';
|
$search_project_ref = '';
|
||||||
@ -125,7 +140,7 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('assigntask')
|
|||||||
}
|
}
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$idfortaskuser=$user->id;
|
$idfortaskuser=$usertoprocess->id;
|
||||||
$result = $object->add_contact($idfortaskuser, GETPOST("type"), 'internal');
|
$result = $object->add_contact($idfortaskuser, GETPOST("type"), 'internal');
|
||||||
|
|
||||||
if ($result >= 0 || $result == -2) // Contact add ok or already contact of task
|
if ($result >= 0 || $result == -2) // Contact add ok or already contact of task
|
||||||
@ -175,6 +190,7 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('assigntask')
|
|||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
setEventMessages("TaskAssignedToEnterTime", null);
|
setEventMessages("TaskAssignedToEnterTime", null);
|
||||||
|
$taskid=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$action='';
|
$action='';
|
||||||
@ -247,7 +263,7 @@ if ($action == 'addtime' && $user->rights->projet->lire)
|
|||||||
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
|
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
|
||||||
|
|
||||||
// Redirect to avoid submit twice on back
|
// Redirect to avoid submit twice on back
|
||||||
header('Location: '.$_SERVER["PHP_SELF"].($projectid?'?id='.$projectid:'?').($mode?'&mode='.$mode:'').'&year='.$yearofday.'&month='.$monthofday.'&day='.$dayofday);
|
header('Location: '.$_SERVER["PHP_SELF"].'?'.($projectid?'id='.$projectid:'').($search_usertoprocessid?'&search_usertoprocessid='.$search_usertoprocessid:'').($mode?'&mode='.$mode:'').'&year='.$yearofday.'&month='.$monthofday.'&day='.$dayofday);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -286,8 +302,6 @@ $next_day = $next['mday'];
|
|||||||
$title=$langs->trans("TimeSpent");
|
$title=$langs->trans("TimeSpent");
|
||||||
if ($mine) $title=$langs->trans("MyTimeSpent");
|
if ($mine) $title=$langs->trans("MyTimeSpent");
|
||||||
|
|
||||||
$usertoprocess = $user;
|
|
||||||
|
|
||||||
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($usertoprocess,0,1); // Return all project i have permission on. I want my tasks and some of my task may be on a public projet that is not my project
|
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($usertoprocess,0,1); // Return all project i have permission on. I want my tasks and some of my task may be on a public projet that is not my project
|
||||||
|
|
||||||
if ($id)
|
if ($id)
|
||||||
@ -314,8 +328,9 @@ llxHeader("",$title,"");
|
|||||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num, '', 'title_project');
|
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num, '', 'title_project');
|
||||||
|
|
||||||
$param='';
|
$param='';
|
||||||
$param.=($mode?'&mode='.$mode:'');
|
$param.=($mode?'&mode='.$mode:'');
|
||||||
$param.=($search_project_ref?'&search_project_ref='.$search_project_ref:'');
|
$param.=($search_project_ref?'&search_project_ref='.$search_project_ref:'');
|
||||||
|
$param.=($search_userassignedid > 0?'&search_userassignedid='.$search_usertoprocessid:'');
|
||||||
|
|
||||||
// Show navigation bar
|
// Show navigation bar
|
||||||
$nav ='<a class="inline-block valignmiddle" href="?year='.$prev_year."&month=".$prev_month."&day=".$prev_day.$param.'">'.img_previous($langs->trans("Previous"))."</a>\n";
|
$nav ='<a class="inline-block valignmiddle" href="?year='.$prev_year."&month=".$prev_month."&day=".$prev_day.$param.'">'.img_previous($langs->trans("Previous"))."</a>\n";
|
||||||
@ -337,7 +352,7 @@ print '<input type="hidden" name="addtimeyear" value="'.$tmp['year'].'">';
|
|||||||
print '<input type="hidden" name="addtimemonth" value="'.$tmp['mon'].'">';
|
print '<input type="hidden" name="addtimemonth" value="'.$tmp['mon'].'">';
|
||||||
print '<input type="hidden" name="addtimeday" value="'.$tmp['mday'].'">';
|
print '<input type="hidden" name="addtimeday" value="'.$tmp['mday'].'">';
|
||||||
|
|
||||||
$head=project_timesheet_prepare_head($mode);
|
$head=project_timesheet_prepare_head($mode, $usertoprocess);
|
||||||
dol_fiche_head($head, 'inputperday', '', -1, 'task');
|
dol_fiche_head($head, 'inputperday', '', -1, 'task');
|
||||||
|
|
||||||
// Show description of content
|
// Show description of content
|
||||||
@ -360,45 +375,17 @@ print '</div>';
|
|||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
|
print '<div class="floatright right'.($conf->dol_optimize_smallscreen?' centpercent':'').'">'.$nav.'</div>'; // We move this before the assign to components so, the default submit button is not the assign to.
|
||||||
// Filter on user
|
|
||||||
/* dol_fiche_head('');
|
|
||||||
print '<table class="border" width="100%"><tr><td width="25%">'.$langs->trans("User").'</td>';
|
|
||||||
print '<td>';
|
|
||||||
if ($mine) print $user->getLoginUrl(1);
|
|
||||||
print '</td>';
|
|
||||||
print '</tr></table>';
|
|
||||||
dol_fiche_end();
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Filter on user
|
|
||||||
/* dol_fiche_head('');
|
|
||||||
print '<table class="border" width="100%"><tr><td width="25%">'.$langs->trans("User").'</td>';
|
|
||||||
print '<td>';
|
|
||||||
if ($mine) print $user->getLoginUrl(1);
|
|
||||||
print '</td>';
|
|
||||||
print '</tr></table>';
|
|
||||||
dol_fiche_end();
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
// Add a new project/task
|
|
||||||
//print '<br>';
|
|
||||||
//print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
|
||||||
//print '<input type="hidden" name="action" value="assigntask">';
|
|
||||||
//print '<input type="hidden" name="mode" value="'.$mode.'">';
|
|
||||||
//print '<input type="hidden" name="year" value="'.$year.'">';
|
|
||||||
//print '<input type="hidden" name="month" value="'.$month.'">';
|
|
||||||
//print '<input type="hidden" name="day" value="'.$day.'">';
|
|
||||||
|
|
||||||
print '<div class="floatright right">'.$nav.'</div>'; // We move this before the assign to components so, the default submit button is not the assign to.
|
|
||||||
|
|
||||||
print '<div class="float valignmiddle">';
|
print '<div class="float valignmiddle">';
|
||||||
print $langs->trans("AssignTaskToMe").'<br>';
|
$titleassigntask = $langs->trans("AssignTaskToMe");
|
||||||
|
if ($usertoprocess->id != $user->id) $titleassigntask = $langs->trans("AssignTaskToUser", $usertoprocess->getFullName($langs));
|
||||||
|
print '<div class="taskiddiv inline-block">';
|
||||||
$formproject->selectTasks($socid?$socid:-1, $taskid, 'taskid', 32, 0, 1, 1);
|
$formproject->selectTasks($socid?$socid:-1, $taskid, 'taskid', 32, 0, 1, 1);
|
||||||
print $formcompany->selectTypeContact($object, '', 'type','internal','rowid', 0);
|
print '</div>';
|
||||||
print '<input type="submit" class="button valignmiddle" name="assigntask" value="'.$langs->trans("AssignTask").'">';
|
print ' ';
|
||||||
//print '</form>';
|
print $formcompany->selectTypeContact($object, '', 'type','internal','rowid', 0, 'maxwidth200');
|
||||||
|
print '<input type="submit" class="button valignmiddle" name="assigntask" value="'.dol_escape_htmltag($titleassigntask).'">';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print '<div class="clearboth" style="padding-bottom: 8px;"></div>';
|
print '<div class="clearboth" style="padding-bottom: 8px;"></div>';
|
||||||
@ -408,6 +395,11 @@ print '<div class="div-table-responsive">';
|
|||||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'" id="tablelines3">'."\n";
|
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'" id="tablelines3">'."\n";
|
||||||
|
|
||||||
print '<tr class="liste_titre_filter">';
|
print '<tr class="liste_titre_filter">';
|
||||||
|
print '<td class="liste_titre">';
|
||||||
|
$usersettoshow='hierarchyme';
|
||||||
|
if ($user->rights->projet->all->lire) $usersettoshow='';
|
||||||
|
print $form->select_dolusers($usertoprocess->id, 'search_usertoprocessid', 0, null, 0, $usersettoshow, 0, 0, 0, 1, '', 0, '', 'maxwidth150');
|
||||||
|
print '</td>';
|
||||||
print '<td class="liste_titre"><input type="text" size="4" name="search_task_ref" value="'.dol_escape_htmltag($search_task_ref).'"></td>';
|
print '<td class="liste_titre"><input type="text" size="4" name="search_task_ref" value="'.dol_escape_htmltag($search_task_ref).'"></td>';
|
||||||
print '<td class="liste_titre"><input type="text" size="4" name="search_task_label" value="'.dol_escape_htmltag($search_task_label).'"></td>';
|
print '<td class="liste_titre"><input type="text" size="4" name="search_task_label" value="'.dol_escape_htmltag($search_task_label).'"></td>';
|
||||||
print '<td class="liste_titre"><input type="text" size="4" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).'"></td>';
|
print '<td class="liste_titre"><input type="text" size="4" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).'"></td>';
|
||||||
@ -427,6 +419,7 @@ print '</td>';
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td>'.$langs->trans("User").'</td>';
|
||||||
print '<td>'.$langs->trans("RefTask").'</td>';
|
print '<td>'.$langs->trans("RefTask").'</td>';
|
||||||
print '<td>'.$langs->trans("LabelTask").'</td>';
|
print '<td>'.$langs->trans("LabelTask").'</td>';
|
||||||
print '<td>'.$langs->trans("ProjectRef").'</td>';
|
print '<td>'.$langs->trans("ProjectRef").'</td>';
|
||||||
@ -436,12 +429,15 @@ if (! empty($conf->global->PROJECT_LINES_PERDAY_SHOW_THIRDPARTY))
|
|||||||
}
|
}
|
||||||
print '<td align="right" class="maxwidth100">'.$langs->trans("PlannedWorkload").'</td>';
|
print '<td align="right" class="maxwidth100">'.$langs->trans("PlannedWorkload").'</td>';
|
||||||
print '<td align="right" class="maxwidth100">'.$langs->trans("ProgressDeclared").'</td>';
|
print '<td align="right" class="maxwidth100">'.$langs->trans("ProgressDeclared").'</td>';
|
||||||
print '<td align="right" class="maxwidth100">'.$langs->trans("TimeSpent").'</td>';
|
/*print '<td align="right" class="maxwidth100">'.$langs->trans("TimeSpent").'</td>';
|
||||||
if ($usertoprocess->id == $user->id) print '<td align="right" class="maxwidth100">'.$langs->trans("TimeSpentByYou").'</td>';
|
if ($usertoprocess->id == $user->id) print '<td align="right" class="maxwidth100">'.$langs->trans("TimeSpentByYou").'</td>';
|
||||||
else print '<td align="right" class="maxwidth100">'.$langs->trans("TimeSpentByUser").'</td>';
|
else print '<td align="right" class="maxwidth100">'.$langs->trans("TimeSpentByUser").'</td>';*/
|
||||||
|
print '<td align="right" class="maxwidth100">'.$langs->trans("TimeSpent").'<br>('.$langs->trans("Everybody").')</td>';
|
||||||
|
print '<td align="right" class="maxwidth100">'.$langs->trans("TimeSpent").'</td>';
|
||||||
print '<td align="center">'.$langs->trans("HourStart").'</td>';
|
print '<td align="center">'.$langs->trans("HourStart").'</td>';
|
||||||
print '<td align="center" colspan="2">'.$langs->trans("Duration").'</td>';
|
print '<td align="center">'.$langs->trans("Duration").'</td>';
|
||||||
print '<td align="right">'.$langs->trans("Note").'</td>';
|
print '<td align="right">'.$langs->trans("Note").'</td>';
|
||||||
|
print '<td align="center"></td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
|
||||||
@ -455,7 +451,7 @@ if (count($tasksarray) > 0)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<tr><td colspan="10">'.$langs->trans("NoTasks").'</td></tr>';
|
print '<tr><td colspan="14">'.$langs->trans("NoTasks").'</td></tr>';
|
||||||
}
|
}
|
||||||
print "</table>";
|
print "</table>";
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|||||||
@ -58,11 +58,14 @@ $nowtmp=dol_getdate($now);
|
|||||||
$nowday=$nowtmp['mday'];
|
$nowday=$nowtmp['mday'];
|
||||||
$nowmonth=$nowtmp['mon'];
|
$nowmonth=$nowtmp['mon'];
|
||||||
$nowyear=$nowtmp['year'];
|
$nowyear=$nowtmp['year'];
|
||||||
|
|
||||||
$year=GETPOST('reyear')?GETPOST('reyear','int'):(GETPOST("year")?GETPOST("year","int"):date("Y"));
|
$year=GETPOST('reyear')?GETPOST('reyear','int'):(GETPOST("year")?GETPOST("year","int"):date("Y"));
|
||||||
$month=GETPOST('remonth')?GETPOST('remonth','int'):(GETPOST("month")?GETPOST("month","int"):date("m"));
|
$month=GETPOST('remonth')?GETPOST('remonth','int'):(GETPOST("month")?GETPOST("month","int"):date("m"));
|
||||||
$day=GETPOST('reday')?GETPOST('reday','int'):(GETPOST("day")?GETPOST("day","int"):date("d"));
|
$day=GETPOST('reday')?GETPOST('reday','int'):(GETPOST("day")?GETPOST("day","int"):date("d"));
|
||||||
$day = (int) $day;
|
$day = (int) $day;
|
||||||
$week=GETPOST("week","int")?GETPOST("week","int"):date("W");
|
$week=GETPOST("week","int")?GETPOST("week","int"):date("W");
|
||||||
|
|
||||||
|
$search_usertoprocessid=GETPOST('search_usertoprocessid', 'int');
|
||||||
$search_task_ref=GETPOST('search_task_ref', 'alpha');
|
$search_task_ref=GETPOST('search_task_ref', 'alpha');
|
||||||
$search_task_label=GETPOST('search_task_label', 'alpha');
|
$search_task_label=GETPOST('search_task_label', 'alpha');
|
||||||
$search_project_ref=GETPOST('search_project_ref', 'alpha');
|
$search_project_ref=GETPOST('search_project_ref', 'alpha');
|
||||||
@ -88,7 +91,16 @@ $next_day = $next['day'];
|
|||||||
$firstdaytoshow=dol_mktime(0,0,0,$first_month,$first_day,$first_year);
|
$firstdaytoshow=dol_mktime(0,0,0,$first_month,$first_day,$first_year);
|
||||||
$lastdaytoshow=dol_time_plus_duree($firstdaytoshow, 7, 'd');
|
$lastdaytoshow=dol_time_plus_duree($firstdaytoshow, 7, 'd');
|
||||||
|
|
||||||
$usertoprocess=$user;
|
if (empty($search_usertoprocessid) || $search_usertoprocessid == $user->id)
|
||||||
|
{
|
||||||
|
$usertoprocess=$user;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$usertoprocess=new User($db);
|
||||||
|
$usertoprocess->fetch($search_usertoprocessid);
|
||||||
|
}
|
||||||
|
$search_usertoprocessid=$usertoprocess->id;
|
||||||
|
|
||||||
$object=new Task($db);
|
$object=new Task($db);
|
||||||
|
|
||||||
@ -98,9 +110,10 @@ $object=new Task($db);
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Purge criteria
|
// Purge criteria
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$action = '';
|
$action = '';
|
||||||
|
$search_usertoprocessid = '';
|
||||||
$search_task_ref = '';
|
$search_task_ref = '';
|
||||||
$search_task_label = '';
|
$search_task_label = '';
|
||||||
$search_project_ref = '';
|
$search_project_ref = '';
|
||||||
@ -140,10 +153,10 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('assigntask')
|
|||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$idfortaskuser=$user->id;
|
$idfortaskuser=$usertoprocess->id;
|
||||||
$result = $object->add_contact($idfortaskuser, GETPOST("type"), 'internal');
|
$result = $object->add_contact($idfortaskuser, GETPOST("type"), 'internal');
|
||||||
|
|
||||||
if (! $result || $result == -2) // Contact add ok or already contact of task
|
if ($result >= 0 || $result == -2) // Contact add ok or already contact of task
|
||||||
{
|
{
|
||||||
// Test if we are already contact of the project (should be rare but sometimes we can add as task contact without being contact of project, like when admin user has been removed from contact of project)
|
// Test if we are already contact of the project (should be rare but sometimes we can add as task contact without being contact of project, like when admin user has been removed from contact of project)
|
||||||
$sql='SELECT ec.rowid FROM '.MAIN_DB_PREFIX.'element_contact as ec, '.MAIN_DB_PREFIX.'c_type_contact as tc WHERE tc.rowid = ec.fk_c_type_contact';
|
$sql='SELECT ec.rowid FROM '.MAIN_DB_PREFIX.'element_contact as ec, '.MAIN_DB_PREFIX.'c_type_contact as tc WHERE tc.rowid = ec.fk_c_type_contact';
|
||||||
@ -190,6 +203,7 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('assigntask')
|
|||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
setEventMessages("TaskAssignedToEnterTime", null);
|
setEventMessages("TaskAssignedToEnterTime", null);
|
||||||
|
$taskid=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$action='';
|
$action='';
|
||||||
@ -262,7 +276,7 @@ if ($action == 'addtime' && $user->rights->projet->lire)
|
|||||||
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
|
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
|
||||||
|
|
||||||
// Redirect to avoid submit twice on back
|
// Redirect to avoid submit twice on back
|
||||||
header('Location: '.$_SERVER["PHP_SELF"].($projectid?'?id='.$projectid:'?').($mode?'&mode='.$mode:'').($day?'&day='.$day:'').($month?'&month='.$month:'').($year?'&year='.$year:''));
|
header('Location: '.$_SERVER["PHP_SELF"].'?'.($projectid?'id='.$projectid:'').($search_usertoprocessid?'&search_usertoprocessid='.$search_usertoprocessid:'').($mode?'&mode='.$mode:'').($day?'&day='.$day:'').($month?'&month='.$month:'').($year?'&year='.$year:''));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -312,14 +326,15 @@ llxHeader("",$title,"",'','','',array('/core/js/timesheet.js'));
|
|||||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num, '', 'title_project');
|
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num, '', 'title_project');
|
||||||
|
|
||||||
$param='';
|
$param='';
|
||||||
$param.=($mode?'&mode='.$mode:'');
|
$param.=($mode?'&mode='.$mode:'');
|
||||||
$param.=($search_project_ref?'&search_project_ref='.$search_project_ref:'');
|
$param.=($search_project_ref?'&search_project_ref='.$search_project_ref:'');
|
||||||
|
$param.=($search_usertoprocessid > 0?'&search_usertoprocessid='.$search_usertoprocessid:'');
|
||||||
|
|
||||||
// Show navigation bar
|
// Show navigation bar
|
||||||
$nav ='<a class="inline-block valignmiddle" href="?year='.$prev_year."&month=".$prev_month."&day=".$prev_day.$param.'">'.img_previous($langs->trans("Previous"))."</a>\n";
|
$nav ='<a class="inline-block valignmiddle" href="?year='.$prev_year."&month=".$prev_month."&day=".$prev_day.$param.'">'.img_previous($langs->trans("Previous"))."</a>\n";
|
||||||
$nav.=" <span id=\"month_name\">".dol_print_date(dol_mktime(0,0,0,$first_month,$first_day,$first_year),"%Y").", ".$langs->trans("WeekShort")." ".$week." </span>\n";
|
$nav.=" <span id=\"month_name\">".dol_print_date(dol_mktime(0,0,0,$first_month,$first_day,$first_year),"%Y").", ".$langs->trans("WeekShort")." ".$week." </span>\n";
|
||||||
$nav.='<a class="inline-block valignmiddle" href="?year='.$next_year."&month=".$next_month."&day=".$next_day.$param.'">'.img_next($langs->trans("Next"))."</a>\n";
|
$nav.='<a class="inline-block valignmiddle" href="?year='.$next_year."&month=".$next_month."&day=".$next_day.$param.'">'.img_next($langs->trans("Next"))."</a>\n";
|
||||||
$nav.=" (<a href=\"?year=".$nowyear."&month=".$nowmonth."&day=".$nowday.$param."\">".$langs->trans("Today")."</a>)";
|
$nav.=" (<a href=\"?year=".$nowyear."&month=".$nowmonth."&day=".$nowday.$param."\">".$langs->trans("Today")."</a>)";
|
||||||
$nav.='<br>'.$form->select_date(-1,'',0,0,2,"addtime",1,0,1).' ';
|
$nav.='<br>'.$form->select_date(-1,'',0,0,2,"addtime",1,0,1).' ';
|
||||||
$nav.=' <input type="submit" name="submitdateselect" class="button" value="'.$langs->trans("Refresh").'">';
|
$nav.=' <input type="submit" name="submitdateselect" class="button" value="'.$langs->trans("Refresh").'">';
|
||||||
|
|
||||||
@ -333,7 +348,7 @@ print '<input type="hidden" name="day" value="'.$day.'">';
|
|||||||
print '<input type="hidden" name="month" value="'.$month.'">';
|
print '<input type="hidden" name="month" value="'.$month.'">';
|
||||||
print '<input type="hidden" name="year" value="'.$year.'">';
|
print '<input type="hidden" name="year" value="'.$year.'">';
|
||||||
|
|
||||||
$head=project_timesheet_prepare_head($mode);
|
$head=project_timesheet_prepare_head($mode, $usertoprocess);
|
||||||
dol_fiche_head($head, 'inputperweek', '', -1, 'task');
|
dol_fiche_head($head, 'inputperweek', '', -1, 'task');
|
||||||
|
|
||||||
// Show description of content
|
// Show description of content
|
||||||
@ -356,44 +371,17 @@ print '</div>';
|
|||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
// Filter on user
|
print '<div class="floatright right'.($conf->dol_optimize_smallscreen?' centpercent':'').'">'.$nav.'</div>'; // We move this before the assign to components so, the default submit button is not the assign to.
|
||||||
/* dol_fiche_head('');
|
|
||||||
print '<table class="border" width="100%"><tr><td width="25%">'.$langs->trans("User").'</td>';
|
|
||||||
print '<td>';
|
|
||||||
if ($mine) print $user->getLoginUrl(1);
|
|
||||||
print '</td>';
|
|
||||||
print '</tr></table>';
|
|
||||||
dol_fiche_end();
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Filter on user
|
|
||||||
/* dol_fiche_head('');
|
|
||||||
print '<table class="border" width="100%"><tr><td width="25%">'.$langs->trans("User").'</td>';
|
|
||||||
print '<td>';
|
|
||||||
if ($mine) print $user->getLoginUrl(1);
|
|
||||||
print '</td>';
|
|
||||||
print '</tr></table>';
|
|
||||||
dol_fiche_end();
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
// Add a new project/task
|
|
||||||
//print '<br>';
|
|
||||||
//print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
|
||||||
//print '<input type="hidden" name="action" value="assigntask">';
|
|
||||||
//print '<input type="hidden" name="mode" value="'.$mode.'">';
|
|
||||||
//print '<input type="hidden" name="year" value="'.$year.'">';
|
|
||||||
//print '<input type="hidden" name="month" value="'.$month.'">';
|
|
||||||
//print '<input type="hidden" name="day" value="'.$day.'">';
|
|
||||||
|
|
||||||
print '<div class="floatright right">'.$nav.'</div>'; // We move this before the assign to components so, the default submit button is not the assign to.
|
|
||||||
|
|
||||||
print '<div class="float valignmiddle">';
|
print '<div class="float valignmiddle">';
|
||||||
print $langs->trans("AssignTaskToMe").'<br>';
|
$titleassigntask = $langs->trans("AssignTaskToMe");
|
||||||
|
if ($usertoprocess->id != $user->id) $titleassigntask = $langs->trans("AssignTaskToUser", $usertoprocess->getFullName($langs));
|
||||||
|
print '<div class="taskiddiv inline-block">';
|
||||||
$formproject->selectTasks($socid?$socid:-1, $taskid, 'taskid', 32, 0, 1, 1);
|
$formproject->selectTasks($socid?$socid:-1, $taskid, 'taskid', 32, 0, 1, 1);
|
||||||
print $formcompany->selectTypeContact($object, '', 'type','internal','rowid', 0);
|
print '</div>';
|
||||||
print '<input type="submit" class="button valignmiddle" name="assigntask" value="'.$langs->trans("AssignTask").'">';
|
print ' ';
|
||||||
//print '</form>';
|
print $formcompany->selectTypeContact($object, '', 'type','internal','rowid', 0, 'maxwidth200');
|
||||||
|
print '<input type="submit" class="button valignmiddle" name="assigntask" value="'.dol_escape_htmltag($titleassigntask).'">';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print '<div class="clearboth" style="padding-bottom: 8px;"></div>';
|
print '<div class="clearboth" style="padding-bottom: 8px;"></div>';
|
||||||
@ -403,6 +391,11 @@ print '<div class="div-table-responsive">';
|
|||||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'" id="tablelines3">'."\n";
|
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'" id="tablelines3">'."\n";
|
||||||
|
|
||||||
print '<tr class="liste_titre_filter">';
|
print '<tr class="liste_titre_filter">';
|
||||||
|
print '<td class="liste_titre">';
|
||||||
|
$usersettoshow='hierarchyme';
|
||||||
|
if ($user->rights->projet->all->lire) $usersettoshow='';
|
||||||
|
print $form->select_dolusers($usertoprocess->id, 'search_usertoprocessid', 0, null, 0, $usersettoshow, 0, 0, 0, 1, '', 0, '', 'maxwidth150');
|
||||||
|
print '</td>';
|
||||||
print '<td class="liste_titre"><input type="text" size="4" name="search_task_ref" value="'.dol_escape_htmltag($search_task_ref).'"></td>';
|
print '<td class="liste_titre"><input type="text" size="4" name="search_task_ref" value="'.dol_escape_htmltag($search_task_ref).'"></td>';
|
||||||
print '<td class="liste_titre"><input type="text" size="4" name="search_task_label" value="'.dol_escape_htmltag($search_task_label).'"></td>';
|
print '<td class="liste_titre"><input type="text" size="4" name="search_task_label" value="'.dol_escape_htmltag($search_task_label).'"></td>';
|
||||||
print '<td class="liste_titre"><input type="text" size="4" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).'"></td>';
|
print '<td class="liste_titre"><input type="text" size="4" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).'"></td>';
|
||||||
@ -423,6 +416,7 @@ print '</td>';
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td>'.$langs->trans("User").'</td>';
|
||||||
print '<td>'.$langs->trans("RefTask").'</td>';
|
print '<td>'.$langs->trans("RefTask").'</td>';
|
||||||
print '<td>'.$langs->trans("LabelTask").'</td>';
|
print '<td>'.$langs->trans("LabelTask").'</td>';
|
||||||
print '<td>'.$langs->trans("ProjectRef").'</td>';
|
print '<td>'.$langs->trans("ProjectRef").'</td>';
|
||||||
@ -432,9 +426,11 @@ if (! empty($conf->global->PROJECT_LINES_PERWEEK_SHOW_THIRDPARTY))
|
|||||||
}
|
}
|
||||||
print '<td align="right" class="maxwidth75">'.$langs->trans("PlannedWorkload").'</td>';
|
print '<td align="right" class="maxwidth75">'.$langs->trans("PlannedWorkload").'</td>';
|
||||||
print '<td align="right" class="maxwidth75">'.$langs->trans("ProgressDeclared").'</td>';
|
print '<td align="right" class="maxwidth75">'.$langs->trans("ProgressDeclared").'</td>';
|
||||||
|
/*print '<td align="right" class="maxwidth75">'.$langs->trans("TimeSpent").'</td>';
|
||||||
|
if ($usertoprocess->id == $user->id) print '<td align="right" class="maxwidth75">'.$langs->trans("TimeSpentByYou").'</td>';
|
||||||
|
else print '<td align="right" class="maxwidth75">'.$langs->trans("TimeSpentByUser").'</td>';*/
|
||||||
|
print '<td align="right" class="maxwidth75">'.$langs->trans("TimeSpent").'<br>('.$langs->trans("Everybody").')</td>';
|
||||||
print '<td align="right" class="maxwidth75">'.$langs->trans("TimeSpent").'</td>';
|
print '<td align="right" class="maxwidth75">'.$langs->trans("TimeSpent").'</td>';
|
||||||
if ($usertoprocess->id == $user->id) print '<td align="right" class="maxwidth75">'.$langs->trans("TimeSpentByYou").'</td>';
|
|
||||||
else print '<td align="right" class="maxwidth75">'.$langs->trans("TimeSpentByUser").'</td>';
|
|
||||||
|
|
||||||
$startday=dol_mktime(12, 0, 0, $startdayarray['first_month'], $startdayarray['first_day'], $startdayarray['first_year']);
|
$startday=dol_mktime(12, 0, 0, $startdayarray['first_month'], $startdayarray['first_day'], $startdayarray['first_year']);
|
||||||
|
|
||||||
@ -457,11 +453,11 @@ if (count($tasksarray) > 0)
|
|||||||
$level=0;
|
$level=0;
|
||||||
projectLinesPerWeek($j, $firstdaytoshow, $usertoprocess, 0, $tasksarray, $level, $projectsrole, $tasksrole, $mine, $restrictviewformytask);
|
projectLinesPerWeek($j, $firstdaytoshow, $usertoprocess, 0, $tasksarray, $level, $projectsrole, $tasksrole, $mine, $restrictviewformytask);
|
||||||
|
|
||||||
$colspan=7;
|
$colspan=8;
|
||||||
if (! empty($conf->global->PROJECT_LINES_PERWEEK_SHOW_THIRDPARTY)) $colspan++;
|
if (! empty($conf->global->PROJECT_LINES_PERWEEK_SHOW_THIRDPARTY)) $colspan++;
|
||||||
|
|
||||||
print '<tr class="liste_total">
|
print '<tr class="liste_total">
|
||||||
<td class="liste_total" colspan="'.$colspan.'" align="right">'.$langs->trans("Total").'</td>
|
<td class="liste_total" colspan="'.$colspan.'">'.$langs->trans("Total").'</td>
|
||||||
<td class="liste_total hide0" align="center"><div id="totalDay[0]"> </div></td>
|
<td class="liste_total hide0" align="center"><div id="totalDay[0]"> </div></td>
|
||||||
<td class="liste_total hide1" align="center"><div id="totalDay[1]"> </div></td>
|
<td class="liste_total hide1" align="center"><div id="totalDay[1]"> </div></td>
|
||||||
<td class="liste_total hide2" align="center"><div id="totalDay[2]"> </div></td>
|
<td class="liste_total hide2" align="center"><div id="totalDay[2]"> </div></td>
|
||||||
@ -474,7 +470,7 @@ if (count($tasksarray) > 0)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<tr><td colspan="11">'.$langs->trans("NoTasks").'</td></tr>';
|
print '<tr><td colspan="16">'.$langs->trans("NoTasks").'</td></tr>';
|
||||||
}
|
}
|
||||||
print "</table>";
|
print "</table>";
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|||||||
@ -51,6 +51,8 @@ $type='project';
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||||
|
|
||||||
if ($action == 'setmainoptions')
|
if ($action == 'setmainoptions')
|
||||||
{
|
{
|
||||||
if (GETPOST('PROJECT_USE_OPPORTUNITIES')) dolibarr_set_const($db, "PROJECT_USE_OPPORTUNITIES",GETPOST('PROJECT_USE_OPPORTUNITIES'),'chaine',0,'',$conf->entity);
|
if (GETPOST('PROJECT_USE_OPPORTUNITIES')) dolibarr_set_const($db, "PROJECT_USE_OPPORTUNITIES",GETPOST('PROJECT_USE_OPPORTUNITIES'),'chaine',0,'',$conf->entity);
|
||||||
@ -188,35 +190,6 @@ else if ($action == 'specimentask')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...)
|
|
||||||
if ($action == 'setModuleOptions')
|
|
||||||
{
|
|
||||||
$post_size=count($_POST);
|
|
||||||
|
|
||||||
$db->begin();
|
|
||||||
|
|
||||||
for($i=0;$i < $post_size;$i++)
|
|
||||||
{
|
|
||||||
if (array_key_exists('param'.$i,$_POST))
|
|
||||||
{
|
|
||||||
$param=GETPOST("param".$i,'alpha');
|
|
||||||
$value=GETPOST("value".$i,'alpha');
|
|
||||||
if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity);
|
|
||||||
if (! $res > 0) $error++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (! $error)
|
|
||||||
{
|
|
||||||
$db->commit();
|
|
||||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$db->rollback();
|
|
||||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Activate a model
|
// Activate a model
|
||||||
else if ($action == 'set')
|
else if ($action == 'set')
|
||||||
{
|
{
|
||||||
|
|||||||
@ -711,10 +711,11 @@ elseif ($object->id > 0)
|
|||||||
print '<input type="hidden" name="comefromclone" value="'.$comefromclone.'">';
|
print '<input type="hidden" name="comefromclone" value="'.$comefromclone.'">';
|
||||||
|
|
||||||
$head=project_prepare_head($object);
|
$head=project_prepare_head($object);
|
||||||
dol_fiche_head($head, 'project', $langs->trans("Project"), -1, ($object->public?'projectpub':'project'));
|
|
||||||
|
|
||||||
if ($action == 'edit' && $userWrite > 0)
|
if ($action == 'edit' && $userWrite > 0)
|
||||||
{
|
{
|
||||||
|
dol_fiche_head($head, 'project', $langs->trans("Project"), 0, ($object->public?'projectpub':'project'));
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
@ -835,6 +836,8 @@ elseif ($object->id > 0)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
dol_fiche_head($head, 'project', $langs->trans("Project"), -1, ($object->public?'projectpub':'project'));
|
||||||
|
|
||||||
// Project card
|
// Project card
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||||
@ -843,9 +846,10 @@ elseif ($object->id > 0)
|
|||||||
// Title
|
// Title
|
||||||
$morehtmlref.=$object->title;
|
$morehtmlref.=$object->title;
|
||||||
// Thirdparty
|
// Thirdparty
|
||||||
|
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ';
|
||||||
if ($object->thirdparty->id > 0)
|
if ($object->thirdparty->id > 0)
|
||||||
{
|
{
|
||||||
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1, 'project');
|
$morehtmlref .= $object->thirdparty->getNomUrl(1, 'project');
|
||||||
}
|
}
|
||||||
$morehtmlref.='</div>';
|
$morehtmlref.='</div>';
|
||||||
|
|
||||||
@ -954,6 +958,7 @@ elseif ($object->id > 0)
|
|||||||
// Change probability from status
|
// Change probability from status
|
||||||
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
|
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
|
||||||
{
|
{
|
||||||
|
// Default value to close or not when we set opp to 'WON'.
|
||||||
$defaultcheckedwhenoppclose=1;
|
$defaultcheckedwhenoppclose=1;
|
||||||
if (empty($conf->global->PROJECT_HIDE_TASKS)) $defaultcheckedwhenoppclose=0;
|
if (empty($conf->global->PROJECT_HIDE_TASKS)) $defaultcheckedwhenoppclose=0;
|
||||||
|
|
||||||
@ -969,12 +974,16 @@ elseif ($object->id > 0)
|
|||||||
var oldpercent = \''.dol_escape_js($object->opp_percent).'\';
|
var oldpercent = \''.dol_escape_js($object->opp_percent).'\';
|
||||||
|
|
||||||
console.log("We select "+elemcode);
|
console.log("We select "+elemcode);
|
||||||
if (elemcode == \'LOST\') defaultcloseproject = 1;
|
|
||||||
jQuery("#divtocloseproject").show();
|
/* Define if checkbox to close is checked or not */
|
||||||
if (defaultcloseproject) jQuery("#inputcloseproject").prop("checked", true);
|
var closeproject = 0;
|
||||||
|
if (elemcode == \'LOST\') closeproject = 1;
|
||||||
|
if (elemcode == \'WON\') closeproject = defaultcloseproject;
|
||||||
|
if (closeproject) jQuery("#inputcloseproject").prop("checked", true);
|
||||||
else jQuery("#inputcloseproject").prop("checked", false);
|
else jQuery("#inputcloseproject").prop("checked", false);
|
||||||
|
|
||||||
/* Make close project visible or not */
|
/* Make the close project checkbox visible or not */
|
||||||
|
console.log("closeproject="+closeproject);
|
||||||
if (elemcode == \'WON\' || elemcode == \'LOST\')
|
if (elemcode == \'WON\' || elemcode == \'LOST\')
|
||||||
{
|
{
|
||||||
jQuery("#divtocloseproject").show();
|
jQuery("#divtocloseproject").show();
|
||||||
|
|||||||
@ -538,6 +538,9 @@ class Projects extends DolibarrApi
|
|||||||
|
|
||||||
$object = parent::_cleanObjectDatas($object);
|
$object = parent::_cleanObjectDatas($object);
|
||||||
|
|
||||||
|
unset($object->titre);
|
||||||
|
unset($object->datec);
|
||||||
|
unset($object->datem);
|
||||||
unset($object->barcode_type);
|
unset($object->barcode_type);
|
||||||
unset($object->barcode_type_code);
|
unset($object->barcode_type_code);
|
||||||
unset($object->barcode_type_label);
|
unset($object->barcode_type_label);
|
||||||
|
|||||||
@ -41,7 +41,7 @@ class ProjectStats extends Stats
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return all leads grouped by status.
|
* Return all leads grouped by opportunity status.
|
||||||
* Warning: There is no filter on WON/LOST because we want this for statistics.
|
* Warning: There is no filter on WON/LOST because we want this for statistics.
|
||||||
*
|
*
|
||||||
* @param int $limit Limit results
|
* @param int $limit Limit results
|
||||||
@ -56,7 +56,10 @@ class ProjectStats extends Stats
|
|||||||
|
|
||||||
$sql = "SELECT";
|
$sql = "SELECT";
|
||||||
$sql .= " SUM(t.opp_amount), t.fk_opp_status, cls.code, cls.label";
|
$sql .= " SUM(t.opp_amount), t.fk_opp_status, cls.code, cls.label";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "projet as t, ".MAIN_DB_PREFIX."c_lead_status as cls";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "projet as t";
|
||||||
|
if (! $user->rights->societe->client->voir && ! $user->socid)
|
||||||
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=" . $user->id;
|
||||||
|
$sql .= ", ".MAIN_DB_PREFIX."c_lead_status as cls";
|
||||||
$sql .= $this->buildWhere();
|
$sql .= $this->buildWhere();
|
||||||
$sql .= " AND t.fk_opp_status = cls.rowid";
|
$sql .= " AND t.fk_opp_status = cls.rowid";
|
||||||
$sql .= " AND t.fk_statut <> 0"; // We want historic also, so all projects not draft
|
$sql .= " AND t.fk_statut <> 0"; // We want historic also, so all projects not draft
|
||||||
@ -116,7 +119,7 @@ class ProjectStats extends Stats
|
|||||||
$sql = "SELECT date_format(t.datec,'%Y') as year, COUNT(t.rowid) as nb, SUM(t.opp_amount) as total, AVG(t.opp_amount) as avg,";
|
$sql = "SELECT date_format(t.datec,'%Y') as year, COUNT(t.rowid) as nb, SUM(t.opp_amount) as total, AVG(t.opp_amount) as avg,";
|
||||||
$sql.= " SUM(t.opp_amount * ".$this->db->ifsql("t.opp_percent IS NULL".($wonlostfilter?" OR cls.code IN ('WON','LOST')":""), '0', 't.opp_percent')." / 100) as weighted";
|
$sql.= " SUM(t.opp_amount * ".$this->db->ifsql("t.opp_percent IS NULL".($wonlostfilter?" OR cls.code IN ('WON','LOST')":""), '0', 't.opp_percent')." / 100) as weighted";
|
||||||
$sql.= " FROM " . MAIN_DB_PREFIX . "projet as t LEFT JOIN ".MAIN_DB_PREFIX."c_lead_status as cls ON cls.rowid = t.fk_opp_status";
|
$sql.= " FROM " . MAIN_DB_PREFIX . "projet as t LEFT JOIN ".MAIN_DB_PREFIX."c_lead_status as cls ON cls.rowid = t.fk_opp_status";
|
||||||
if (! $user->rights->societe->client->voir && ! $user->societe_id)
|
if (! $user->rights->societe->client->voir && ! $user->soc_id)
|
||||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=" . $user->id;
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=" . $user->id;
|
||||||
$sql.= $this->buildWhere();
|
$sql.= $this->buildWhere();
|
||||||
$sql.= " GROUP BY year";
|
$sql.= " GROUP BY year";
|
||||||
@ -171,7 +174,7 @@ class ProjectStats extends Stats
|
|||||||
|
|
||||||
$sql = "SELECT date_format(t.datec,'%m') as dm, COUNT(*) as nb";
|
$sql = "SELECT date_format(t.datec,'%m') as dm, COUNT(*) as nb";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "projet as t";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "projet as t";
|
||||||
if (! $user->rights->societe->client->voir && ! $user->societe_id)
|
if (! $user->rights->societe->client->voir && ! $user->soc_id)
|
||||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=" . $user->id;
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=" . $user->id;
|
||||||
$sql .= $this->buildWhere();
|
$sql .= $this->buildWhere();
|
||||||
$sql .= " GROUP BY dm";
|
$sql .= " GROUP BY dm";
|
||||||
@ -198,7 +201,7 @@ class ProjectStats extends Stats
|
|||||||
|
|
||||||
$sql = "SELECT date_format(t.datec,'%m') as dm, SUM(t.opp_amount)";
|
$sql = "SELECT date_format(t.datec,'%m') as dm, SUM(t.opp_amount)";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "projet as t";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "projet as t";
|
||||||
if (! $user->rights->societe->client->voir && ! $user->societe_id)
|
if (! $user->rights->societe->client->voir && ! $user->soc_id)
|
||||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=" . $user->id;
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=" . $user->id;
|
||||||
$sql .= $this->buildWhere();
|
$sql .= $this->buildWhere();
|
||||||
$sql .= " GROUP BY dm";
|
$sql .= " GROUP BY dm";
|
||||||
@ -321,7 +324,7 @@ class ProjectStats extends Stats
|
|||||||
|
|
||||||
$sql = "SELECT date_format(t.datec,'%m') as dm, SUM(t.opp_amount * ".$this->db->ifsql("t.opp_percent IS NULL".($wonlostfilter?" OR cls.code IN ('WON','LOST')":""), '0', 't.opp_percent')." / 100)";
|
$sql = "SELECT date_format(t.datec,'%m') as dm, SUM(t.opp_amount * ".$this->db->ifsql("t.opp_percent IS NULL".($wonlostfilter?" OR cls.code IN ('WON','LOST')":""), '0', 't.opp_percent')." / 100)";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "projet as t LEFT JOIN ".MAIN_DB_PREFIX.'c_lead_status as cls ON t.fk_opp_status = cls.rowid';
|
$sql .= " FROM " . MAIN_DB_PREFIX . "projet as t LEFT JOIN ".MAIN_DB_PREFIX.'c_lead_status as cls ON t.fk_opp_status = cls.rowid';
|
||||||
if (! $user->rights->societe->client->voir && ! $user->societe_id)
|
if (! $user->rights->societe->client->voir && ! $user->soc_id)
|
||||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=" . $user->id;
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=" . $user->id;
|
||||||
$sql .= $this->buildWhere();
|
$sql .= $this->buildWhere();
|
||||||
$sql .= " GROUP BY dm";
|
$sql .= " GROUP BY dm";
|
||||||
@ -429,7 +432,7 @@ class ProjectStats extends Stats
|
|||||||
|
|
||||||
$sql = "SELECT date_format(t.datec,'%m') as dm, count(t.opp_amount)";
|
$sql = "SELECT date_format(t.datec,'%m') as dm, count(t.opp_amount)";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "projet as t";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "projet as t";
|
||||||
if (! $user->rights->societe->client->voir && ! $user->societe_id)
|
if (! $user->rights->societe->client->voir && ! $user->soc_id)
|
||||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=" . $user->id;
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=" . $user->id;
|
||||||
$sql .= $this->buildWhere();
|
$sql .= $this->buildWhere();
|
||||||
$sql .= " GROUP BY dm";
|
$sql .= " GROUP BY dm";
|
||||||
@ -441,7 +444,7 @@ class ProjectStats extends Stats
|
|||||||
|
|
||||||
$sql = "SELECT date_format(t.datec,'%m') as dm, count(t.opp_amount)";
|
$sql = "SELECT date_format(t.datec,'%m') as dm, count(t.opp_amount)";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "projet as t";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "projet as t";
|
||||||
if (! $user->rights->societe->client->voir && ! $user->societe_id)
|
if (! $user->rights->societe->client->voir && ! $user->soc_id)
|
||||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=" . $user->id;
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=" . $user->id;
|
||||||
$sql .= $this->buildWhere();
|
$sql .= $this->buildWhere();
|
||||||
$sql .= " GROUP BY dm";
|
$sql .= " GROUP BY dm";
|
||||||
|
|||||||
184
htdocs/projet/class/taskstats.class.php
Normal file
184
htdocs/projet/class/taskstats.class.php
Normal file
@ -0,0 +1,184 @@
|
|||||||
|
<?php
|
||||||
|
/* Lead
|
||||||
|
* Copyright (C) 2014-2015 Florian HENRY <florian.henry@open-concept.pro>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
include_once DOL_DOCUMENT_ROOT . '/core/class/stats.class.php';
|
||||||
|
include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class to manage statistics on project tasks
|
||||||
|
*/
|
||||||
|
class TaskStats extends Stats
|
||||||
|
{
|
||||||
|
private $project;
|
||||||
|
public $userid;
|
||||||
|
public $socid;
|
||||||
|
public $year;
|
||||||
|
|
||||||
|
function __construct($db)
|
||||||
|
{
|
||||||
|
global $conf, $user;
|
||||||
|
|
||||||
|
$this->db = $db;
|
||||||
|
|
||||||
|
require_once 'task.class.php';
|
||||||
|
$this->task = new Task($this->db);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return all tasks grouped by status.
|
||||||
|
*
|
||||||
|
* @param int $limit Limit results
|
||||||
|
* @return array|int Array with value or -1 if error
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
function getAllTaskByStatus($limit = 5)
|
||||||
|
{
|
||||||
|
global $conf, $user, $langs;
|
||||||
|
|
||||||
|
$datay = array();
|
||||||
|
|
||||||
|
$sql = "SELECT";
|
||||||
|
$sql .= " COUNT(t.rowid), t.priority";
|
||||||
|
$sql.= " FROM ". MAIN_DB_PREFIX . "projet_task as t INNER JOIN " . MAIN_DB_PREFIX . "projet as p ON p.rowid = t.fk_projet";
|
||||||
|
if (! $user->rights->societe->client->voir && ! $user->soc_id)
|
||||||
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=" . $user->id;
|
||||||
|
$sql .= $this->buildWhere();
|
||||||
|
//$sql .= " AND t.fk_statut <> 0"; // We want historic also, so all task not draft
|
||||||
|
$sql .= " GROUP BY t.priority";
|
||||||
|
|
||||||
|
$result = array ();
|
||||||
|
$res = array ();
|
||||||
|
|
||||||
|
dol_syslog(get_class($this) . '::' . __METHOD__ . "", LOG_DEBUG);
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if ($resql) {
|
||||||
|
$num = $this->db->num_rows($resql);
|
||||||
|
$i = 0;
|
||||||
|
$other = 0;
|
||||||
|
while ( $i < $num ) {
|
||||||
|
$row = $this->db->fetch_row($resql);
|
||||||
|
if ($i < $limit || $num == $limit)
|
||||||
|
{
|
||||||
|
$result[$i] = array(
|
||||||
|
$row[1],
|
||||||
|
$row[0]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$other += $row[1];
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
if ($num > $limit)
|
||||||
|
$result[$i] = array (
|
||||||
|
$langs->transnoentitiesnoconv("Other"),
|
||||||
|
$other
|
||||||
|
);
|
||||||
|
$this->db->free($resql);
|
||||||
|
} else {
|
||||||
|
$this->error = "Error " . $this->db->lasterror();
|
||||||
|
dol_syslog(get_class($this) . '::' . __METHOD__ . ' ' . $this->error, LOG_ERR);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return count, and sum of products
|
||||||
|
*
|
||||||
|
* @return array of values
|
||||||
|
*/
|
||||||
|
function getAllByYear()
|
||||||
|
{
|
||||||
|
global $conf, $user, $langs;
|
||||||
|
|
||||||
|
$datay = array ();
|
||||||
|
|
||||||
|
$wonlostfilter=0; // No filter on status WON/LOST
|
||||||
|
|
||||||
|
$sql = "SELECT date_format(t.datec,'%Y') as year, COUNT(t.rowid) as nb";
|
||||||
|
$sql.= " FROM ". MAIN_DB_PREFIX . "projet_task as t INNER JOIN " . MAIN_DB_PREFIX . "projet as p ON p.rowid = t.fk_projet";
|
||||||
|
if (! $user->rights->societe->client->voir && ! $user->soc_id)
|
||||||
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=" . $user->id;
|
||||||
|
$sql.= $this->buildWhere();
|
||||||
|
$sql.= " GROUP BY year";
|
||||||
|
$sql.= $this->db->order('year', 'DESC');
|
||||||
|
|
||||||
|
return $this->_getAllByYear($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build the where part
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function buildWhere()
|
||||||
|
{
|
||||||
|
$sqlwhere_str = '';
|
||||||
|
$sqlwhere = array();
|
||||||
|
|
||||||
|
$sqlwhere[] = ' t.entity IN (' . getEntity('project') . ')';
|
||||||
|
|
||||||
|
if (! empty($this->userid))
|
||||||
|
$sqlwhere[] = ' t.fk_user_resp=' . $this->userid;
|
||||||
|
if (! empty($this->socid))
|
||||||
|
$sqlwhere[] = ' t.fk_soc=' . $this->socid;
|
||||||
|
if (! empty($this->year) && empty($this->yearmonth))
|
||||||
|
$sqlwhere[] = " date_format(t.datec,'%Y')='" . $this->db->escape($this->year) . "'";
|
||||||
|
if (! empty($this->yearmonth))
|
||||||
|
$sqlwhere[] = " t.datec BETWEEN '" . $this->db->idate(dol_get_first_day($this->yearmonth)) . "' AND '" . $this->db->idate(dol_get_last_day($this->yearmonth)) . "'";
|
||||||
|
|
||||||
|
if (! empty($this->status))
|
||||||
|
$sqlwhere[] = " t.priority IN (" . $this->priority . ")";
|
||||||
|
|
||||||
|
if (count($sqlwhere) > 0) {
|
||||||
|
$sqlwhere_str = ' WHERE ' . implode(' AND ', $sqlwhere);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $sqlwhere_str;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return Task number by month for a year
|
||||||
|
*
|
||||||
|
* @param int $year scan
|
||||||
|
* @return array of values
|
||||||
|
*/
|
||||||
|
function getNbByMonth($year)
|
||||||
|
{
|
||||||
|
global $user;
|
||||||
|
|
||||||
|
$this->yearmonth = $year;
|
||||||
|
|
||||||
|
$sql = "SELECT date_format(t.datec,'%m') as dm, COUNT(t.rowid) as nb";
|
||||||
|
$sql.= " FROM ". MAIN_DB_PREFIX . "projet_task as t INNER JOIN " . MAIN_DB_PREFIX . "projet as p ON p.rowid = t.fk_projet";
|
||||||
|
if (! $user->rights->societe->client->voir && ! $user->soc_id)
|
||||||
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=" . $user->id;
|
||||||
|
$sql .= $this->buildWhere();
|
||||||
|
$sql .= " GROUP BY dm";
|
||||||
|
$sql .= $this->db->order('dm', 'DESC');
|
||||||
|
|
||||||
|
$this->yearmonth=0;
|
||||||
|
|
||||||
|
$res = $this->_getNbByMonth($year, $sql);
|
||||||
|
// var_dump($res);print '<br>';
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
}
|
||||||
218
htdocs/projet/tasks/stats/index.php
Normal file
218
htdocs/projet/tasks/stats/index.php
Normal file
@ -0,0 +1,218 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2014-2015 Florian HENRY <florian.henry@open-concept.pro>
|
||||||
|
* Copyright (C) 2015 Laurent Destailleur <ldestailleur@users.sourceforge.net>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/projet/tasks/stats/index.php
|
||||||
|
* \ingroup project
|
||||||
|
* \brief Page for tasks statistics
|
||||||
|
*/
|
||||||
|
|
||||||
|
require '../../../main.inc.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/projet/class/taskstats.class.php';
|
||||||
|
|
||||||
|
// Security check
|
||||||
|
if (! $user->rights->projet->lire)
|
||||||
|
accessforbidden();
|
||||||
|
|
||||||
|
|
||||||
|
$WIDTH=DolGraph::getDefaultGraphSizeForStats('width');
|
||||||
|
$HEIGHT=DolGraph::getDefaultGraphSizeForStats('height');
|
||||||
|
|
||||||
|
$userid=GETPOST('userid','int');
|
||||||
|
$socid=GETPOST('socid','int');
|
||||||
|
// Security check
|
||||||
|
if ($user->societe_id > 0)
|
||||||
|
{
|
||||||
|
$action = '';
|
||||||
|
$socid = $user->societe_id;
|
||||||
|
}
|
||||||
|
$nowyear=strftime("%Y", dol_now());
|
||||||
|
$year = GETPOST('year')>0?GETPOST('year'):$nowyear;
|
||||||
|
//$startyear=$year-2;
|
||||||
|
$startyear=$year-1;
|
||||||
|
$endyear=$year;
|
||||||
|
|
||||||
|
$langs->load('companies');
|
||||||
|
$langs->load('projects');
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
|
$form=new Form($db);
|
||||||
|
|
||||||
|
$includeuserlist=array();
|
||||||
|
|
||||||
|
|
||||||
|
llxHeader('', $langs->trans('Tasks'));
|
||||||
|
|
||||||
|
$title=$langs->trans("TasksStatistics");
|
||||||
|
$dir=$conf->projet->dir_output.'/temp';
|
||||||
|
|
||||||
|
print load_fiche_titre($title,'','title_project.png');
|
||||||
|
|
||||||
|
dol_mkdir($dir);
|
||||||
|
|
||||||
|
|
||||||
|
$stats_tasks= new TaskStats($db);
|
||||||
|
if (!empty($userid) && $userid!=-1) $stats_tasks->userid=$userid;
|
||||||
|
if (!empty($socid) && $socid!=-1) $stats_tasks->socid=$socid;
|
||||||
|
if (!empty($year)) $stats_tasks->year=$year;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Build graphic number of object
|
||||||
|
// $data = array(array('Lib',val1,val2,val3),...)
|
||||||
|
$data = $stats_tasks->getNbByMonthWithPrevYear($endyear,$startyear);
|
||||||
|
//var_dump($data);
|
||||||
|
|
||||||
|
$filenamenb = $conf->project->dir_output . "/stats/tasknbprevyear-".$year.".png";
|
||||||
|
$fileurlnb = DOL_URL_ROOT . '/viewimage.php?modulepart=taskstats&file=tasknbprevyear-'.$year.'.png';
|
||||||
|
|
||||||
|
$px1 = new DolGraph();
|
||||||
|
$mesg = $px1->isGraphKo();
|
||||||
|
if (! $mesg)
|
||||||
|
{
|
||||||
|
$px1->SetData($data);
|
||||||
|
$px1->SetPrecisionY(0);
|
||||||
|
$i=$startyear;$legend=array();
|
||||||
|
while ($i <= $endyear)
|
||||||
|
{
|
||||||
|
$legend[]=$i;
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
$px1->SetLegend($legend);
|
||||||
|
$px1->SetMaxValue($px1->GetCeilMaxValue());
|
||||||
|
$px1->SetWidth($WIDTH);
|
||||||
|
$px1->SetHeight($HEIGHT);
|
||||||
|
$px1->SetYLabel($langs->trans("ProjectNbTask"));
|
||||||
|
$px1->SetShading(3);
|
||||||
|
$px1->SetHorizTickIncrement(1);
|
||||||
|
$px1->SetPrecisionY(0);
|
||||||
|
$px1->mode='depth';
|
||||||
|
$px1->SetTitle($langs->trans("ProjectNbTaskByMonth"));
|
||||||
|
|
||||||
|
$px1->draw($filenamenb,$fileurlnb);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Show array
|
||||||
|
$stats_tasks->year=0;
|
||||||
|
$data_all_year = $stats_tasks->getAllByYear();
|
||||||
|
|
||||||
|
if (!empty($year)) $stats_tasks->year=$year;
|
||||||
|
$arrayyears=array();
|
||||||
|
foreach($data_all_year as $val) {
|
||||||
|
$arrayyears[$val['year']]=$val['year'];
|
||||||
|
}
|
||||||
|
if (! count($arrayyears)) $arrayyears[$nowyear]=$nowyear;
|
||||||
|
|
||||||
|
|
||||||
|
$h=0;
|
||||||
|
$head = array();
|
||||||
|
$head[$h][0] = DOL_URL_ROOT . '/projet/tasks/stats/index.php?mode='.$mode;
|
||||||
|
$head[$h][1] = $langs->trans("ByMonthYear");
|
||||||
|
$head[$h][2] = 'byyear';
|
||||||
|
$h++;
|
||||||
|
|
||||||
|
complete_head_from_modules($conf,$langs,null,$head,$h,$type);
|
||||||
|
|
||||||
|
dol_fiche_head($head,'byyear',$langs->trans("Statistics"), -1, '');
|
||||||
|
|
||||||
|
|
||||||
|
print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||||
|
|
||||||
|
print '<form name="stats" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
|
|
||||||
|
print '<table class="noborder" width="100%">';
|
||||||
|
print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
|
||||||
|
// Company
|
||||||
|
/*print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
|
||||||
|
if ($mode == 'customer') $filter='s.client in (1,2,3)';
|
||||||
|
if ($mode == 'supplier') $filter='s.fournisseur = 1';
|
||||||
|
print $form->select_company($socid,'socid',$filter,1,0,0,array(),0,'','style="width: 95%"');
|
||||||
|
print '</td></tr>';
|
||||||
|
*/
|
||||||
|
// User
|
||||||
|
/*print '<tr><td>'.$langs->trans("ProjectCommercial").'</td><td>';
|
||||||
|
print $form->select_dolusers($userid, 'userid', 1, array(),0,$includeuserlist);
|
||||||
|
print '</td></tr>';*/
|
||||||
|
// Year
|
||||||
|
print '<tr><td>'.$langs->trans("Year").'</td><td>';
|
||||||
|
if (! in_array($year,$arrayyears)) $arrayyears[$year]=$year;
|
||||||
|
if (! in_array($nowyear,$arrayyears)) $arrayyears[$nowyear]=$nowyear;
|
||||||
|
arsort($arrayyears);
|
||||||
|
print $form->selectarray('year',$arrayyears,$year,0);
|
||||||
|
print '</td></tr>';
|
||||||
|
print '<tr><td align="center" colspan="2"><input type="submit" name="submit" class="button" value="'.$langs->trans("Refresh").'"></td></tr>';
|
||||||
|
print '</table>';
|
||||||
|
print '</form>';
|
||||||
|
print '<br><br>';
|
||||||
|
|
||||||
|
print '<table class="noborder" width="100%">';
|
||||||
|
print '<tr class="liste_titre" height="24">';
|
||||||
|
print '<td align="center">'.$langs->trans("Year").'</td>';
|
||||||
|
print '<td align="right">'.$langs->trans("NbOfTasks").'</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
$oldyear=0;
|
||||||
|
$var=true;
|
||||||
|
foreach ($data_all_year as $val)
|
||||||
|
{
|
||||||
|
$year = $val['year'];
|
||||||
|
while ($year && $oldyear > $year+1)
|
||||||
|
{ // If we have empty year
|
||||||
|
$oldyear--;
|
||||||
|
|
||||||
|
print '<tr '.$bc[$var].' height="24">';
|
||||||
|
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$oldyear.'&mode='.$mode.($socid>0?'&socid='.$socid:'').($userid>0?'&userid='.$userid:'').'">'.$oldyear.'</a></td>';
|
||||||
|
print '<td align="right">0</td>';
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
print '<tr '.$bc[$var].' height="24">';
|
||||||
|
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&mode='.$mode.($socid>0?'&socid='.$socid:'').($userid>0?'&userid='.$userid:'').'">'.$year.'</a></td>';
|
||||||
|
print '<td align="right">'.$val['nb'].'</td>';
|
||||||
|
print '</tr>';
|
||||||
|
$oldyear=$year;
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
|
||||||
|
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
||||||
|
|
||||||
|
$stringtoshow.= '<table class="border" width="100%"><tr valign="top"><td align="center">';
|
||||||
|
if ($mesg) { print $mesg; }
|
||||||
|
else {
|
||||||
|
$stringtoshow.= $px1->show();
|
||||||
|
$stringtoshow.= "<br>\n";
|
||||||
|
}
|
||||||
|
$stringtoshow.= '</td></tr></table>';
|
||||||
|
|
||||||
|
print $stringtoshow;
|
||||||
|
|
||||||
|
|
||||||
|
print '</div></div></div>';
|
||||||
|
print '<div style="clear:both"></div>';
|
||||||
|
|
||||||
|
|
||||||
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
640
htdocs/public/onlinesign/newonlinesign.php
Normal file
640
htdocs/public/onlinesign/newonlinesign.php
Normal file
@ -0,0 +1,640 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
* Copyright (C) 2006-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* For paypal test: https://developer.paypal.com/
|
||||||
|
* For paybox test: ???
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/public/onlinesign/newsign.php
|
||||||
|
* \ingroup core
|
||||||
|
* \brief File to offer a way to make an online signature for a particular Dolibarr entity
|
||||||
|
*/
|
||||||
|
|
||||||
|
define("NOLOGIN",1); // This means this output page does not require to be logged.
|
||||||
|
define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
|
||||||
|
|
||||||
|
// For MultiCompany module.
|
||||||
|
// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
|
||||||
|
// TODO This should be useless. Because entity must be retreive from object ref and not from url.
|
||||||
|
$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
|
||||||
|
if (is_numeric($entity)) define("DOLENTITY", $entity);
|
||||||
|
|
||||||
|
require '../../main.inc.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||||
|
|
||||||
|
// Security check
|
||||||
|
// No check on module enabled. Done later according to $validpaymentmethod
|
||||||
|
|
||||||
|
$langs->load("main");
|
||||||
|
$langs->load("other");
|
||||||
|
$langs->load("dict");
|
||||||
|
$langs->load("bills");
|
||||||
|
$langs->load("companies");
|
||||||
|
$langs->load("errors");
|
||||||
|
$langs->load("paybox"); // File with generic data
|
||||||
|
|
||||||
|
$action=GETPOST('action','alpha');
|
||||||
|
|
||||||
|
// Input are:
|
||||||
|
// type ('invoice','order','contractline'),
|
||||||
|
// id (object id),
|
||||||
|
// amount (required if id is empty),
|
||||||
|
// tag (a free text, required if type is empty)
|
||||||
|
// currency (iso code)
|
||||||
|
|
||||||
|
$suffix=GETPOST("suffix",'alpha');
|
||||||
|
$SOURCE=GETPOST("source",'alpha');
|
||||||
|
$ref=$REF=GETPOST("ref",'alpha');
|
||||||
|
|
||||||
|
if (! $action)
|
||||||
|
{
|
||||||
|
if ($source && ! $ref)
|
||||||
|
{
|
||||||
|
dol_print_error('',$langs->trans('ErrorBadParameters')." - ref");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$paymentmethod='';
|
||||||
|
$validpaymentmethod=array();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Define $urlwithroot
|
||||||
|
//$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
|
||||||
|
//$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
||||||
|
$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current. For Paypal payment, we can use internal URL like localhost.
|
||||||
|
|
||||||
|
|
||||||
|
// Complete urls for post treatment
|
||||||
|
$SECUREKEY=GETPOST("securekey"); // Secure key
|
||||||
|
|
||||||
|
if (! empty($SOURCE))
|
||||||
|
{
|
||||||
|
$urlok.='source='.urlencode($SOURCE).'&';
|
||||||
|
$urlko.='source='.urlencode($SOURCE).'&';
|
||||||
|
}
|
||||||
|
if (! empty($REF))
|
||||||
|
{
|
||||||
|
$urlok.='ref='.urlencode($REF).'&';
|
||||||
|
$urlko.='ref='.urlencode($REF).'&';
|
||||||
|
}
|
||||||
|
if (! empty($SECUREKEY))
|
||||||
|
{
|
||||||
|
$urlok.='securekey='.urlencode($SECUREKEY).'&';
|
||||||
|
$urlko.='securekey='.urlencode($SECUREKEY).'&';
|
||||||
|
}
|
||||||
|
if (! empty($entity))
|
||||||
|
{
|
||||||
|
$urlok.='entity='.urlencode($entity).'&';
|
||||||
|
$urlko.='entity='.urlencode($entity).'&';
|
||||||
|
}
|
||||||
|
$urlok=preg_replace('/&$/','',$urlok); // Remove last &
|
||||||
|
$urlko=preg_replace('/&$/','',$urlko); // Remove last &
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Actions
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
if ($action == 'dosign')
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
|
$head='';
|
||||||
|
if (! empty($conf->global->MAIN_SIGN_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->MAIN_SIGN_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
||||||
|
|
||||||
|
$conf->dol_hide_topmenu=1;
|
||||||
|
$conf->dol_hide_leftmenu=1;
|
||||||
|
|
||||||
|
llxHeader($head, $langs->trans("OnlineSignature"), '', '', 0, 0, '', '', '', 'onlinepaymentbody');
|
||||||
|
|
||||||
|
// Check link validity
|
||||||
|
if (! empty($SOURCE) && in_array($ref, array('member_ref', 'contractline_ref', 'invoice_ref', 'order_ref', '')))
|
||||||
|
{
|
||||||
|
$langs->load("errors");
|
||||||
|
dol_print_error_email('BADREFINONLINESIGNFORM', $langs->trans("ErrorBadLinkSourceSetButBadValueForRef", $SOURCE, $ref));
|
||||||
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
print '<span id="dolpaymentspan"></span>'."\n";
|
||||||
|
print '<div class="center">'."\n";
|
||||||
|
print '<form id="dolpaymentform" class="center" name="paymentform" action="'.$_SERVER["PHP_SELF"].'" method="POST">'."\n";
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'."\n";
|
||||||
|
print '<input type="hidden" name="action" value="dosign">'."\n";
|
||||||
|
print '<input type="hidden" name="tag" value="'.GETPOST("tag",'alpha').'">'."\n";
|
||||||
|
print '<input type="hidden" name="suffix" value="'.GETPOST("suffix",'alpha').'">'."\n";
|
||||||
|
print '<input type="hidden" name="securekey" value="'.$SECUREKEY.'">'."\n";
|
||||||
|
print '<input type="hidden" name="entity" value="'.$entity.'" />';
|
||||||
|
print "\n";
|
||||||
|
print '<!-- Form to sign -->'."\n";
|
||||||
|
|
||||||
|
print '<table id="dolpaymenttable" summary="Payment form" class="center">'."\n";
|
||||||
|
|
||||||
|
// Show logo (search order: logo defined by PAYBOX_LOGO_suffix, then PAYBOX_LOGO, then small company logo, large company logo, theme logo, common logo)
|
||||||
|
$width=0;
|
||||||
|
// Define logo and logosmall
|
||||||
|
$logosmall=$mysoc->logo_small;
|
||||||
|
$logo=$mysoc->logo;
|
||||||
|
$paramlogo='ONLINE_SIGN_LOGO_'.$suffix;
|
||||||
|
if (! empty($conf->global->$paramlogo)) $logosmall=$conf->global->$paramlogo;
|
||||||
|
else if (! empty($conf->global->ONLINE_SIGN_LOGO)) $logosmall=$conf->global->ONLINE_SIGN_LOGO;
|
||||||
|
//print '<!-- Show logo (logosmall='.$logosmall.' logo='.$logo.') -->'."\n";
|
||||||
|
// Define urllogo
|
||||||
|
$urllogo='';
|
||||||
|
if (! empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall))
|
||||||
|
{
|
||||||
|
$urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('thumbs/'.$logosmall);
|
||||||
|
}
|
||||||
|
elseif (! empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo))
|
||||||
|
{
|
||||||
|
$urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode($logo);
|
||||||
|
$width=96;
|
||||||
|
}
|
||||||
|
// Output html code for logo
|
||||||
|
if ($urllogo)
|
||||||
|
{
|
||||||
|
print '<tr>';
|
||||||
|
print '<td align="center"><img id="dolpaymentlogo" title="'.$title.'" src="'.$urllogo.'"';
|
||||||
|
if ($width) print ' width="'.$width.'"';
|
||||||
|
print '></td>';
|
||||||
|
print '</tr>'."\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Output introduction text
|
||||||
|
$text='';
|
||||||
|
if (! empty($conf->global->ONLINE_SIGN_NEWFORM_TEXT))
|
||||||
|
{
|
||||||
|
$langs->load("members");
|
||||||
|
if (preg_match('/^\((.*)\)$/',$conf->global->ONLINE_SIGN_NEWFORM_TEXT,$reg)) $text.=$langs->trans($reg[1])."<br>\n";
|
||||||
|
else $text.=$conf->global->ONLINE_SIGN_NEWFORM_TEXT."<br>\n";
|
||||||
|
$text='<tr><td align="center"><br>'.$text.'<br></td></tr>'."\n";
|
||||||
|
}
|
||||||
|
if (empty($text))
|
||||||
|
{
|
||||||
|
$text.='<tr><td class="textpublicpayment"><br><strong>'.$langs->trans("WelcomeOnOnlineSignaturePage").'</strong><br></td></tr>'."\n";
|
||||||
|
$text.='<tr><td class="textpublicpayment"><br>'.$langs->trans("ThisScreenAllowsYouToSignDocFrom",$creditor).'<br><br></td></tr>'."\n";
|
||||||
|
}
|
||||||
|
print $text;
|
||||||
|
|
||||||
|
// Output payment summary form
|
||||||
|
print '<tr><td align="center">';
|
||||||
|
print '<table with="100%" id="tablepublicpayment">';
|
||||||
|
print '<tr class="liste_total"><td align="left" colspan="2">'.$langs->trans("ThisIsInformationOnDocumentToSign").' :</td></tr>'."\n";
|
||||||
|
|
||||||
|
$found=false;
|
||||||
|
$error=0;
|
||||||
|
$var=false;
|
||||||
|
|
||||||
|
// Free payment
|
||||||
|
if (! GETPOST("source"))
|
||||||
|
{
|
||||||
|
$found=true;
|
||||||
|
$tag=GETPOST("tag");
|
||||||
|
$fulltag=$tag;
|
||||||
|
|
||||||
|
// Creditor
|
||||||
|
|
||||||
|
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Creditor");
|
||||||
|
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$creditor.'</b>';
|
||||||
|
print '<input type="hidden" name="creditor" value="'.$creditor.'">';
|
||||||
|
print '</td></tr>'."\n";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// We do not add fields shipToName, shipToStreet, shipToCity, shipToState, shipToCountryCode, shipToZip, shipToStreet2, phoneNum
|
||||||
|
// as they don't exists (buyer is unknown, tag is free).
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Payment on customer order
|
||||||
|
if (GETPOST("source") == 'order')
|
||||||
|
{
|
||||||
|
$found=true;
|
||||||
|
$langs->load("orders");
|
||||||
|
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||||
|
|
||||||
|
$order=new Commande($db);
|
||||||
|
$result=$order->fetch('',$ref);
|
||||||
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
$mesg=$order->error;
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$result=$order->fetch_thirdparty($order->socid);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Creditor
|
||||||
|
|
||||||
|
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Creditor");
|
||||||
|
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$creditor.'</b>';
|
||||||
|
print '<input type="hidden" name="creditor" value="'.$creditor.'">';
|
||||||
|
print '</td></tr>'."\n";
|
||||||
|
|
||||||
|
// Debitor
|
||||||
|
|
||||||
|
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("ThirdParty");
|
||||||
|
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$order->thirdparty->name.'</b>';
|
||||||
|
|
||||||
|
// Object
|
||||||
|
|
||||||
|
$text='<b>'.$langs->trans("PaymentOrderRef",$order->ref).'</b>';
|
||||||
|
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Designation");
|
||||||
|
print '</td><td class="CTableRow'.($var?'1':'2').'">'.$text;
|
||||||
|
print '<input type="hidden" name="source" value="'.GETPOST("source",'alpha').'">';
|
||||||
|
print '<input type="hidden" name="ref" value="'.$order->ref.'">';
|
||||||
|
print '</td></tr>'."\n";
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Payment on customer invoice
|
||||||
|
if (GETPOST("source") == 'invoice')
|
||||||
|
{
|
||||||
|
$found=true;
|
||||||
|
$langs->load("bills");
|
||||||
|
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||||
|
|
||||||
|
$invoice=new Facture($db);
|
||||||
|
$result=$invoice->fetch('',$ref);
|
||||||
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
$mesg=$invoice->error;
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$result=$invoice->fetch_thirdparty($invoice->socid);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($action != 'dosign') // Do not change amount if we just click on first dosign
|
||||||
|
{
|
||||||
|
$amount=price2num($invoice->total_ttc - $invoice->getSommePaiement());
|
||||||
|
if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int');
|
||||||
|
$amount=price2num($amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Creditor
|
||||||
|
|
||||||
|
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Creditor");
|
||||||
|
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$creditor.'</b>';
|
||||||
|
print '<input type="hidden" name="creditor" value="'.$creditor.'">';
|
||||||
|
print '</td></tr>'."\n";
|
||||||
|
|
||||||
|
// Debitor
|
||||||
|
|
||||||
|
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("ThirdParty");
|
||||||
|
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$invoice->thirdparty->name.'</b>';
|
||||||
|
|
||||||
|
// Object
|
||||||
|
|
||||||
|
$text='<b>'.$langs->trans("PaymentInvoiceRef",$invoice->ref).'</b>';
|
||||||
|
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Designation");
|
||||||
|
print '</td><td class="CTableRow'.($var?'1':'2').'">'.$text;
|
||||||
|
print '<input type="hidden" name="source" value="'.GETPOST("source",'alpha').'">';
|
||||||
|
print '<input type="hidden" name="ref" value="'.$invoice->ref.'">';
|
||||||
|
print '</td></tr>'."\n";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Payment on contract line
|
||||||
|
if (GETPOST("source") == 'contractline')
|
||||||
|
{
|
||||||
|
$found=true;
|
||||||
|
$langs->load("contracts");
|
||||||
|
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
|
||||||
|
|
||||||
|
$contractline=new ContratLigne($db);
|
||||||
|
$result=$contractline->fetch('',$ref);
|
||||||
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
$mesg=$contractline->error;
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($contractline->fk_contrat > 0)
|
||||||
|
{
|
||||||
|
$contract=new Contrat($db);
|
||||||
|
$result=$contract->fetch($contractline->fk_contrat);
|
||||||
|
if ($result > 0)
|
||||||
|
{
|
||||||
|
$result=$contract->fetch_thirdparty($contract->socid);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$mesg=$contract->error;
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$mesg='ErrorRecordNotFound';
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($action != 'dosign') // Do not change amount if we just click on first dosign
|
||||||
|
{
|
||||||
|
$amount=$contractline->total_ttc;
|
||||||
|
if ($contractline->fk_product)
|
||||||
|
{
|
||||||
|
$product=new Product($db);
|
||||||
|
$result=$product->fetch($contractline->fk_product);
|
||||||
|
|
||||||
|
// We define price for product (TODO Put this in a method in product class)
|
||||||
|
if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
||||||
|
{
|
||||||
|
$pu_ht = $product->multiprices[$contract->thirdparty->price_level];
|
||||||
|
$pu_ttc = $product->multiprices_ttc[$contract->thirdparty->price_level];
|
||||||
|
$price_base_type = $product->multiprices_base_type[$contract->thirdparty->price_level];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$pu_ht = $product->price;
|
||||||
|
$pu_ttc = $product->price_ttc;
|
||||||
|
$price_base_type = $product->price_base_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
$amount=$pu_ttc;
|
||||||
|
if (empty($amount))
|
||||||
|
{
|
||||||
|
dol_print_error('','ErrorNoPriceDefinedForThisProduct');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int');
|
||||||
|
$amount=price2num($amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
$qty=1;
|
||||||
|
if (GETPOST('qty')) $qty=GETPOST('qty');
|
||||||
|
|
||||||
|
// Creditor
|
||||||
|
|
||||||
|
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Creditor");
|
||||||
|
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$creditor.'</b>';
|
||||||
|
print '<input type="hidden" name="creditor" value="'.$creditor.'">';
|
||||||
|
print '</td></tr>'."\n";
|
||||||
|
|
||||||
|
// Debitor
|
||||||
|
|
||||||
|
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("ThirdParty");
|
||||||
|
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$contract->thirdparty->name.'</b>';
|
||||||
|
|
||||||
|
// Object
|
||||||
|
|
||||||
|
$text='<b>'.$langs->trans("PaymentRenewContractId",$contract->ref,$contractline->ref).'</b>';
|
||||||
|
if ($contractline->fk_product)
|
||||||
|
{
|
||||||
|
$text.='<br>'.$product->ref.($product->label?' - '.$product->label:'');
|
||||||
|
}
|
||||||
|
if ($contractline->description) $text.='<br>'.dol_htmlentitiesbr($contractline->description);
|
||||||
|
//if ($contractline->date_fin_validite) {
|
||||||
|
// $text.='<br>'.$langs->trans("DateEndPlanned").': ';
|
||||||
|
// $text.=dol_print_date($contractline->date_fin_validite);
|
||||||
|
//}
|
||||||
|
if ($contractline->date_fin_validite)
|
||||||
|
{
|
||||||
|
$text.='<br>'.$langs->trans("ExpiredSince").': '.dol_print_date($contractline->date_fin_validite);
|
||||||
|
}
|
||||||
|
|
||||||
|
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Designation");
|
||||||
|
print '</td><td class="CTableRow'.($var?'1':'2').'">'.$text;
|
||||||
|
print '<input type="hidden" name="source" value="'.GETPOST("source",'alpha').'">';
|
||||||
|
print '<input type="hidden" name="ref" value="'.$contractline->ref.'">';
|
||||||
|
print '</td></tr>'."\n";
|
||||||
|
|
||||||
|
// Quantity
|
||||||
|
|
||||||
|
$label=$langs->trans("Quantity");
|
||||||
|
$qty=1;
|
||||||
|
$duration='';
|
||||||
|
if ($contractline->fk_product)
|
||||||
|
{
|
||||||
|
if ($product->isService() && $product->duration_value > 0)
|
||||||
|
{
|
||||||
|
$label=$langs->trans("Duration");
|
||||||
|
|
||||||
|
// TODO Put this in a global method
|
||||||
|
if ($product->duration_value > 1)
|
||||||
|
{
|
||||||
|
$dur=array("h"=>$langs->trans("Hours"),"d"=>$langs->trans("DurationDays"),"w"=>$langs->trans("DurationWeeks"),"m"=>$langs->trans("DurationMonths"),"y"=>$langs->trans("DurationYears"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$dur=array("h"=>$langs->trans("Hour"),"d"=>$langs->trans("DurationDay"),"w"=>$langs->trans("DurationWeek"),"m"=>$langs->trans("DurationMonth"),"y"=>$langs->trans("DurationYear"));
|
||||||
|
}
|
||||||
|
$duration=$product->duration_value.' '.$dur[$product->duration_unit];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$label.'</td>';
|
||||||
|
print '<td class="CTableRow'.($var?'1':'2').'"><b>'.($duration?$duration:$qty).'</b>';
|
||||||
|
print '<input type="hidden" name="newqty" value="'.dol_escape_htmltag($qty).'">';
|
||||||
|
print '</b></td></tr>'."\n";
|
||||||
|
|
||||||
|
// Amount
|
||||||
|
|
||||||
|
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Amount");
|
||||||
|
if (empty($amount)) print ' ('.$langs->trans("ToComplete").')';
|
||||||
|
print '</td><td class="CTableRow'.($var?'1':'2').'">';
|
||||||
|
if (empty($amount) || ! is_numeric($amount))
|
||||||
|
{
|
||||||
|
print '<input type="hidden" name="amount" value="'.GETPOST("amount",'int').'">';
|
||||||
|
print '<input class="flat" size=8 type="text" name="newamount" value="'.GETPOST("newamount","int").'">';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
print '<b>'.price($amount).'</b>';
|
||||||
|
print '<input type="hidden" name="amount" value="'.$amount.'">';
|
||||||
|
print '<input type="hidden" name="newamount" value="'.$amount.'">';
|
||||||
|
}
|
||||||
|
// Currency
|
||||||
|
print ' <b>'.$langs->trans("Currency".$currency).'</b>';
|
||||||
|
print '<input type="hidden" name="currency" value="'.$currency.'">';
|
||||||
|
print '</td></tr>'."\n";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Payment on member subscription
|
||||||
|
if (GETPOST("source") == 'membersubscription')
|
||||||
|
{
|
||||||
|
$found=true;
|
||||||
|
$langs->load("members");
|
||||||
|
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
|
||||||
|
|
||||||
|
$member=new Adherent($db);
|
||||||
|
$result=$member->fetch('',$ref);
|
||||||
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
$mesg=$member->error;
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$subscription=new Subscription($db);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($action != 'dosign') // Do not change amount if we just click on first dosign
|
||||||
|
{
|
||||||
|
$amount=$subscription->total_ttc;
|
||||||
|
if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int');
|
||||||
|
$amount=price2num($amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
$fulltag='MEM='.$member->id.'.DAT='.dol_print_date(dol_now(),'%Y%m%d%H%M');
|
||||||
|
if (! empty($TAG)) { $tag=$TAG; $fulltag.='.TAG='.$TAG; }
|
||||||
|
$fulltag=dol_string_unaccent($fulltag);
|
||||||
|
|
||||||
|
// Creditor
|
||||||
|
|
||||||
|
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Creditor");
|
||||||
|
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$creditor.'</b>';
|
||||||
|
print '<input type="hidden" name="creditor" value="'.$creditor.'">';
|
||||||
|
print '</td></tr>'."\n";
|
||||||
|
|
||||||
|
// Debitor
|
||||||
|
|
||||||
|
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Member");
|
||||||
|
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>';
|
||||||
|
if ($member->morphy == 'mor' && ! empty($member->societe)) print $member->societe;
|
||||||
|
else print $member->getFullName($langs);
|
||||||
|
print '</b>';
|
||||||
|
|
||||||
|
// Object
|
||||||
|
|
||||||
|
$text='<b>'.$langs->trans("PaymentSubscription").'</b>';
|
||||||
|
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Designation");
|
||||||
|
print '</td><td class="CTableRow'.($var?'1':'2').'">'.$text;
|
||||||
|
print '<input type="hidden" name="source" value="'.GETPOST("source",'alpha').'">';
|
||||||
|
print '<input type="hidden" name="ref" value="'.$member->ref.'">';
|
||||||
|
print '</td></tr>'."\n";
|
||||||
|
|
||||||
|
if ($member->last_subscription_date || $member->last_subscription_amount)
|
||||||
|
{
|
||||||
|
// Last subscription date
|
||||||
|
|
||||||
|
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("LastSubscriptionDate");
|
||||||
|
print '</td><td class="CTableRow'.($var?'1':'2').'">'.dol_print_date($member->last_subscription_date,'day');
|
||||||
|
print '</td></tr>'."\n";
|
||||||
|
|
||||||
|
// Last subscription amount
|
||||||
|
|
||||||
|
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("LastSubscriptionAmount");
|
||||||
|
print '</td><td class="CTableRow'.($var?'1':'2').'">'.price($member->last_subscription_amount);
|
||||||
|
print '</td></tr>'."\n";
|
||||||
|
|
||||||
|
if (empty($amount) && ! GETPOST('newamount')) $_GET['newamount']=$member->last_subscription_amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Amount
|
||||||
|
|
||||||
|
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Amount");
|
||||||
|
if (empty($amount))
|
||||||
|
{
|
||||||
|
print ' ('.$langs->trans("ToComplete");
|
||||||
|
if (! empty($conf->global->MEMBER_EXT_URL_SUBSCRIPTION_INFO)) print ' - <a href="'.$conf->global->MEMBER_EXT_URL_SUBSCRIPTION_INFO.'" rel="external" target="_blank">'.$langs->trans("SeeHere").'</a>';
|
||||||
|
print ')';
|
||||||
|
}
|
||||||
|
print '</td><td class="CTableRow'.($var?'1':'2').'">';
|
||||||
|
if (empty($amount) || ! is_numeric($amount))
|
||||||
|
{
|
||||||
|
$valtoshow=GETPOST("newamount",'int');
|
||||||
|
if (! empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow=max($conf->global->MEMBER_MIN_AMOUNT,$valtoshow);
|
||||||
|
print '<input type="hidden" name="amount" value="'.GETPOST("amount",'int').'">';
|
||||||
|
print '<input class="flat" size="8" type="text" name="newamount" value="'.$valtoshow.'">';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$valtoshow=$amount;
|
||||||
|
if (! empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow=max($conf->global->MEMBER_MIN_AMOUNT,$valtoshow);
|
||||||
|
print '<b>'.price($valtoshow).'</b>';
|
||||||
|
print '<input type="hidden" name="amount" value="'.$valtoshow.'">';
|
||||||
|
print '<input type="hidden" name="newamount" value="'.$valtoshow.'">';
|
||||||
|
}
|
||||||
|
// Currency
|
||||||
|
print ' <b>'.$langs->trans("Currency".$currency).'</b>';
|
||||||
|
print '<input type="hidden" name="currency" value="'.$currency.'">';
|
||||||
|
print '</td></tr>'."\n";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (! $found && ! $mesg) $mesg=$langs->trans("ErrorBadParameters");
|
||||||
|
|
||||||
|
if ($mesg) print '<tr><td align="center" colspan="2"><br><div class="warning">'.$mesg.'</div></td></tr>'."\n";
|
||||||
|
|
||||||
|
print '</table>'."\n";
|
||||||
|
print "\n";
|
||||||
|
|
||||||
|
if ($action != 'dosign')
|
||||||
|
{
|
||||||
|
if ($found && ! $error) // We are in a management option and no error
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error_email('ERRORNEWONLINESIGNPAYPAL');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Print
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</td></tr>'."\n";
|
||||||
|
|
||||||
|
print '</table>'."\n";
|
||||||
|
print '</form>'."\n";
|
||||||
|
print '</div>'."\n";
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
|
|
||||||
|
htmlPrintOnlinePaymentFooter($mysoc,$langs);
|
||||||
|
|
||||||
|
llxFooter('', 'public');
|
||||||
|
|
||||||
|
$db->close();
|
||||||
@ -169,13 +169,22 @@ $conf->dol_hide_leftmenu=1;
|
|||||||
|
|
||||||
llxHeader($head, $langs->trans("PaymentForm"), '', '', 0, 0, '', '', '', 'onlinepaymentbody');
|
llxHeader($head, $langs->trans("PaymentForm"), '', '', 0, 0, '', '', '', 'onlinepaymentbody');
|
||||||
|
|
||||||
|
|
||||||
// Common variables
|
// Common variables
|
||||||
$creditor=$mysoc->name;
|
$creditor=$mysoc->name;
|
||||||
$paramcreditor='PAYBOX_CREDITOR_'.$suffix;
|
$paramcreditor='PAYBOX_CREDITOR_'.$suffix;
|
||||||
if (! empty($conf->global->$paramcreditor)) $creditor=$conf->global->$paramcreditor;
|
if (! empty($conf->global->$paramcreditor)) $creditor=$conf->global->$paramcreditor;
|
||||||
else if (! empty($conf->global->PAYBOX_CREDITOR)) $creditor=$conf->global->PAYBOX_CREDITOR;
|
else if (! empty($conf->global->PAYBOX_CREDITOR)) $creditor=$conf->global->PAYBOX_CREDITOR;
|
||||||
|
|
||||||
|
// Check link validity
|
||||||
|
if (! empty($SOURCE) && in_array($ref, array('member_ref', 'contractline_ref', 'invoice_ref', 'order_ref', '')))
|
||||||
|
{
|
||||||
|
$langs->load("errors");
|
||||||
|
dol_print_error_email('BADREFINPAYMENTFORM', $langs->trans("ErrorBadLinkSourceSetButBadValueForRef", $SOURCE, $ref));
|
||||||
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
print '<span id="dolpaymentspan"></span>'."\n";
|
print '<span id="dolpaymentspan"></span>'."\n";
|
||||||
print '<div class="center">';
|
print '<div class="center">';
|
||||||
print '<form id="dolpaymentform" class="center" name="paymentform" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
print '<form id="dolpaymentform" class="center" name="paymentform" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||||
|
|||||||
@ -335,19 +335,28 @@ $conf->dol_hide_leftmenu=1;
|
|||||||
|
|
||||||
llxHeader($head, $langs->trans("PaymentForm"), '', '', 0, 0, '', '', '', 'onlinepaymentbody');
|
llxHeader($head, $langs->trans("PaymentForm"), '', '', 0, 0, '', '', '', 'onlinepaymentbody');
|
||||||
|
|
||||||
|
// Check link validity
|
||||||
|
if (! empty($SOURCE) && in_array($ref, array('member_ref', 'contractline_ref', 'invoice_ref', 'order_ref', '')))
|
||||||
|
{
|
||||||
|
$langs->load("errors");
|
||||||
|
dol_print_error_email('BADREFINPAYMENTFORM', $langs->trans("ErrorBadLinkSourceSetButBadValueForRef", $SOURCE, $ref));
|
||||||
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
if (! empty($conf->paypal->enabled))
|
if (! empty($conf->paypal->enabled))
|
||||||
{
|
{
|
||||||
if (! empty($PAYPAL_API_SANDBOX))
|
|
||||||
{
|
|
||||||
dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode'),'','warning');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Common variables
|
// Common variables
|
||||||
$creditor=$mysoc->name;
|
$creditor=$mysoc->name;
|
||||||
$paramcreditor='PAYPAL_CREDITOR_'.$suffix;
|
$paramcreditor='PAYPAL_CREDITOR_'.$suffix;
|
||||||
if (! empty($conf->global->$paramcreditor)) $creditor=$conf->global->$paramcreditor;
|
if (! empty($conf->global->$paramcreditor)) $creditor=$conf->global->$paramcreditor;
|
||||||
else if (! empty($conf->global->PAYPAL_CREDITOR)) $creditor=$conf->global->PAYPAL_CREDITOR;
|
else if (! empty($conf->global->PAYPAL_CREDITOR)) $creditor=$conf->global->PAYPAL_CREDITOR;
|
||||||
|
|
||||||
|
if (! empty($PAYPAL_API_SANDBOX))
|
||||||
|
{
|
||||||
|
dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode'),'','warning');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<span id="dolpaymentspan"></span>'."\n";
|
print '<span id="dolpaymentspan"></span>'."\n";
|
||||||
|
|||||||
@ -265,17 +265,27 @@ $conf->dol_hide_leftmenu=1;
|
|||||||
|
|
||||||
llxHeader($head, $langs->trans("PaymentForm"), '', '', 0, 0, '', '', '', 'onlinepaymentbody');
|
llxHeader($head, $langs->trans("PaymentForm"), '', '', 0, 0, '', '', '', 'onlinepaymentbody');
|
||||||
|
|
||||||
if (! empty($conf->global->PAYPAL_API_SANDBOX))
|
|
||||||
{
|
|
||||||
dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode'),'','warning');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Common variables
|
// Common variables
|
||||||
$creditor=$mysoc->name;
|
$creditor=$mysoc->name;
|
||||||
$paramcreditor='PAYPAL_CREDITOR_'.$suffix;
|
$paramcreditor='PAYPAL_CREDITOR_'.$suffix;
|
||||||
if (! empty($conf->global->$paramcreditor)) $creditor=$conf->global->$paramcreditor;
|
if (! empty($conf->global->$paramcreditor)) $creditor=$conf->global->$paramcreditor;
|
||||||
else if (! empty($conf->global->PAYPAL_CREDITOR)) $creditor=$conf->global->PAYPAL_CREDITOR;
|
else if (! empty($conf->global->PAYPAL_CREDITOR)) $creditor=$conf->global->PAYPAL_CREDITOR;
|
||||||
|
|
||||||
|
// Check link validity
|
||||||
|
if (! empty($SOURCE) && in_array($ref, array('member_ref', 'contractline_ref', 'invoice_ref', 'order_ref', '')))
|
||||||
|
{
|
||||||
|
$langs->load("errors");
|
||||||
|
dol_print_error_email('BADREFINPAYMENTFORM', $langs->trans("ErrorBadLinkSourceSetButBadValueForRef", $SOURCE, $ref));
|
||||||
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($conf->global->PAYPAL_API_SANDBOX))
|
||||||
|
{
|
||||||
|
dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode'),'','warning');
|
||||||
|
}
|
||||||
|
|
||||||
print '<span id="dopaymentspan"></span>'."\n";
|
print '<span id="dopaymentspan"></span>'."\n";
|
||||||
print '<div class="center">'."\n";
|
print '<div class="center">'."\n";
|
||||||
print '<form id="dolpaymentform" class="center" name="paymentform" action="'.$_SERVER["PHP_SELF"].'" method="POST">'."\n";
|
print '<form id="dolpaymentform" class="center" name="paymentform" action="'.$_SERVER["PHP_SELF"].'" method="POST">'."\n";
|
||||||
@ -824,6 +834,7 @@ if (GETPOST("source") == 'membersubscription')
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
|
||||||
|
|
||||||
|
|
||||||
$member=new Adherent($db);
|
$member=new Adherent($db);
|
||||||
$result=$member->fetch('',$ref);
|
$result=$member->fetch('',$ref);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
|
|||||||
@ -335,6 +335,16 @@ $conf->dol_hide_leftmenu=1;
|
|||||||
|
|
||||||
llxHeader($head, $langs->trans("PaymentForm"), '', '', 0, 0, '', '', '', 'onlinepaymentbody');
|
llxHeader($head, $langs->trans("PaymentForm"), '', '', 0, 0, '', '', '', 'onlinepaymentbody');
|
||||||
|
|
||||||
|
// Check link validity
|
||||||
|
if (! empty($SOURCE) && in_array($ref, array('member_ref', 'contractline_ref', 'invoice_ref', 'order_ref', '')))
|
||||||
|
{
|
||||||
|
$langs->load("errors");
|
||||||
|
dol_print_error_email('BADREFINPAYMENTFORM', $langs->trans("ErrorBadLinkSourceSetButBadValueForRef", $SOURCE, $ref));
|
||||||
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($conf->global->STRIPE_LIVE))
|
if (empty($conf->global->STRIPE_LIVE))
|
||||||
{
|
{
|
||||||
dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode'),'','warning');
|
dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode'),'','warning');
|
||||||
|
|||||||
@ -42,6 +42,9 @@ if (!$user->admin) accessforbidden();
|
|||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||||
|
|
||||||
if ($action == 'setcodeclient')
|
if ($action == 'setcodeclient')
|
||||||
{
|
{
|
||||||
if (dolibarr_set_const($db, "SOCIETE_CODECLIENT_ADDON",$value,'chaine',0,'',$conf->entity) > 0)
|
if (dolibarr_set_const($db, "SOCIETE_CODECLIENT_ADDON",$value,'chaine',0,'',$conf->entity) > 0)
|
||||||
@ -101,35 +104,6 @@ if ($action == 'updateoptions')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...)
|
|
||||||
if ($action == 'setModuleOptions')
|
|
||||||
{
|
|
||||||
$post_size=count($_POST);
|
|
||||||
|
|
||||||
$db->begin();
|
|
||||||
|
|
||||||
for($i=0;$i < $post_size;$i++)
|
|
||||||
{
|
|
||||||
if (array_key_exists('param'.$i,$_POST))
|
|
||||||
{
|
|
||||||
$param=GETPOST("param".$i,'alpha');
|
|
||||||
$value=GETPOST("value".$i,'alpha');
|
|
||||||
if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity);
|
|
||||||
if (! $res > 0) $error++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (! $error)
|
|
||||||
{
|
|
||||||
$db->commit();
|
|
||||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$db->rollback();
|
|
||||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Activate a document generator module
|
// Activate a document generator module
|
||||||
if ($action == 'set')
|
if ($action == 'set')
|
||||||
{
|
{
|
||||||
|
|||||||
@ -356,11 +356,13 @@ class SupplierProposal extends CommonObject
|
|||||||
* @param array $array_option extrafields array
|
* @param array $array_option extrafields array
|
||||||
* @param string $ref_fourn Supplier price reference
|
* @param string $ref_fourn Supplier price reference
|
||||||
* @param int $fk_unit Id of the unit to use.
|
* @param int $fk_unit Id of the unit to use.
|
||||||
|
* @param string $origin 'order', 'supplier_proposal', ...
|
||||||
|
* @param int $origin_id Id of origin line
|
||||||
* @return int >0 if OK, <0 if KO
|
* @return int >0 if OK, <0 if KO
|
||||||
*
|
*
|
||||||
* @see add_product
|
* @see add_product
|
||||||
*/
|
*/
|
||||||
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=0, $pa_ht=0, $label='',$array_option=0, $ref_fourn='', $fk_unit='')
|
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=0, $pa_ht=0, $label='',$array_option=0, $ref_fourn='', $fk_unit='', $origin='', $origin_id=0)
|
||||||
{
|
{
|
||||||
global $mysoc;
|
global $mysoc;
|
||||||
|
|
||||||
@ -462,7 +464,8 @@ class SupplierProposal extends CommonObject
|
|||||||
$this->line->special_code=$special_code;
|
$this->line->special_code=$special_code;
|
||||||
$this->line->fk_parent_line=$fk_parent_line;
|
$this->line->fk_parent_line=$fk_parent_line;
|
||||||
$this->line->fk_unit=$fk_unit;
|
$this->line->fk_unit=$fk_unit;
|
||||||
|
$this->line->origin=$origin;
|
||||||
|
$this->line->origin_id=$origin_id;
|
||||||
$this->line->ref_fourn = $this->db->escape($ref_fourn);
|
$this->line->ref_fourn = $this->db->escape($ref_fourn);
|
||||||
|
|
||||||
// infos marge
|
// infos marge
|
||||||
@ -880,7 +883,10 @@ class SupplierProposal extends CommonObject
|
|||||||
$this->lines[$i]->pa_ht,
|
$this->lines[$i]->pa_ht,
|
||||||
$this->lines[$i]->label,
|
$this->lines[$i]->label,
|
||||||
$this->lines[$i]->array_options,
|
$this->lines[$i]->array_options,
|
||||||
$this->lines[$i]->ref_fourn
|
$this->lines[$i]->ref_fourn,
|
||||||
|
$this->lines[$i]->fk_unit,
|
||||||
|
'supplier_proposal',
|
||||||
|
$this->lines[$i]->rowid
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
|
|||||||
@ -39,7 +39,7 @@ if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
|||||||
$colorbackhmenu1='80,90,120'; // topmenu
|
$colorbackhmenu1='80,90,120'; // topmenu
|
||||||
$colorbackvmenu1='255,255,255'; // vmenu
|
$colorbackvmenu1='255,255,255'; // vmenu
|
||||||
$colortopbordertitle1='120,120,120'; // top border of title
|
$colortopbordertitle1='120,120,120'; // top border of title
|
||||||
$colorbacktitle1='230,230,230'; // title of tables,list
|
$colorbacktitle1='230,230,233'; // title of tables,list
|
||||||
$colorbacktabcard1='255,255,255'; // card
|
$colorbacktabcard1='255,255,255'; // card
|
||||||
$colorbacktabactive='234,234,234';
|
$colorbacktabactive='234,234,234';
|
||||||
$colorbacklineimpair1='255,255,255'; // line impair
|
$colorbacklineimpair1='255,255,255'; // line impair
|
||||||
@ -340,9 +340,9 @@ input.buttongen {
|
|||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
span.timesheetalreadyrecorded input {
|
span.timesheetalreadyrecorded input {
|
||||||
/*font-size: smaller;*/
|
|
||||||
border: none;
|
border: none;
|
||||||
/*background: transparent;*/
|
border-bottom: solid 1px rgba(0,0,0,0.4);
|
||||||
|
margin-right: 1px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
select.flat, form.flat select {
|
select.flat, form.flat select {
|
||||||
@ -363,8 +363,10 @@ select.flat, form.flat select {
|
|||||||
.opacitytransp {
|
.opacitytransp {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
}
|
}
|
||||||
select:invalid { color: gray; }
|
select:invalid {
|
||||||
input:disabled {
|
color: gray;
|
||||||
|
}
|
||||||
|
input:disabled {
|
||||||
background:#ddd;
|
background:#ddd;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -712,6 +714,7 @@ div.fiche>form>div.div-table-responsive {
|
|||||||
align-self: flex-start;
|
align-self: flex-start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ============================================================================== */
|
/* ============================================================================== */
|
||||||
/* Styles to hide objects */
|
/* Styles to hide objects */
|
||||||
/* ============================================================================== */
|
/* ============================================================================== */
|
||||||
@ -987,7 +990,7 @@ div.fiche {
|
|||||||
|
|
||||||
div.fiche {
|
div.fiche {
|
||||||
margin-<?php print $left; ?>: <?php print (GETPOST('optioncss','aZ09') == 'print'?6:($dol_hide_leftmenu?'6':'26')); ?>px;
|
margin-<?php print $left; ?>: <?php print (GETPOST('optioncss','aZ09') == 'print'?6:($dol_hide_leftmenu?'6':'26')); ?>px;
|
||||||
margin-<?php print $right; ?>: <?php print (GETPOST('optioncss','aZ09') == 'print'?8:(empty($conf->dol_optimize_smallscreen)?'16':'6')); ?>px;
|
margin-<?php print $right; ?>: <?php print (GETPOST('optioncss','aZ09') == 'print'?8:(empty($conf->dol_optimize_smallscreen)?'16':'12')); ?>px;
|
||||||
<?php if (! empty($conf->dol_hide_leftmenu) && ! empty($conf->dol_hide_topmenu)) print 'margin-top: 4px;'."\n"; ?>
|
<?php if (! empty($conf->dol_hide_leftmenu) && ! empty($conf->dol_hide_topmenu)) print 'margin-top: 4px;'."\n"; ?>
|
||||||
<?php if (! empty($conf->dol_hide_leftmenu)) print 'margin-bottom: 12px;'."\n"; ?>
|
<?php if (! empty($conf->dol_hide_leftmenu)) print 'margin-bottom: 12px;'."\n"; ?>
|
||||||
}
|
}
|
||||||
@ -2682,7 +2685,7 @@ input.liste_titre {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.noborder tr.liste_total, .noborder tr.liste_total td, tr.liste_total, form.liste_total {
|
.noborder tr.liste_total, .noborder tr.liste_total td, tr.liste_total, form.liste_total {
|
||||||
/* background: #F0F0F0; */
|
height: 32px;
|
||||||
}
|
}
|
||||||
.noborder tr.liste_total td, tr.liste_total td, form.liste_total div {
|
.noborder tr.liste_total td, tr.liste_total td, form.liste_total div {
|
||||||
color: #552266;
|
color: #552266;
|
||||||
@ -2795,6 +2798,9 @@ div.tabBar .noborder {
|
|||||||
|
|
||||||
@media only screen and (max-width: 767px)
|
@media only screen and (max-width: 767px)
|
||||||
{
|
{
|
||||||
|
.thumbstat {
|
||||||
|
flex: 1 1 110px;
|
||||||
|
}
|
||||||
.thumbstat150 {
|
.thumbstat150 {
|
||||||
flex: 1 1 110px;
|
flex: 1 1 110px;
|
||||||
}
|
}
|
||||||
@ -2844,7 +2850,7 @@ span.dashboardlineko {
|
|||||||
padding: 1px 2px 1px 2px;
|
padding: 1px 2px 1px 2px;
|
||||||
border-radius: .25em;
|
border-radius: .25em;
|
||||||
|
|
||||||
background-color: #af4705;
|
background-color: #9f4705;
|
||||||
padding: 0px 5px 0px 5px;
|
padding: 0px 5px 0px 5px;
|
||||||
top: -26px;
|
top: -26px;
|
||||||
}
|
}
|
||||||
@ -4594,6 +4600,11 @@ div.tabsElem a.tab {
|
|||||||
background: #FFF;
|
background: #FFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.login_vertical_align {
|
||||||
|
padding-left: 20px;
|
||||||
|
padding-right: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
/* Reduce login top right info */
|
/* Reduce login top right info */
|
||||||
.help {
|
.help {
|
||||||
<?php if ($disableimages) { ?>
|
<?php if ($disableimages) { ?>
|
||||||
|
|||||||
@ -337,9 +337,9 @@ input.buttongen {
|
|||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
span.timesheetalreadyrecorded input {
|
span.timesheetalreadyrecorded input {
|
||||||
/*font-size: smaller;*/
|
|
||||||
border: none;
|
border: none;
|
||||||
/*background: transparent;*/
|
border-bottom: solid 1px rgba(0,0,0,0.1);
|
||||||
|
margin-right: 1px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
select.flat, form.flat select {
|
select.flat, form.flat select {
|
||||||
@ -1027,7 +1027,7 @@ div.fiche {
|
|||||||
|
|
||||||
div.fiche {
|
div.fiche {
|
||||||
margin-<?php print $left; ?>: <?php print (GETPOST('optioncss','aZ09') == 'print'?6:($dol_hide_leftmenu?'4':'20')); ?>px;
|
margin-<?php print $left; ?>: <?php print (GETPOST('optioncss','aZ09') == 'print'?6:($dol_hide_leftmenu?'4':'20')); ?>px;
|
||||||
margin-<?php print $right; ?>: <?php print (GETPOST('optioncss','aZ09') == 'print'?8:(empty($conf->dol_optimize_smallscreen)?'16':'4')); ?>px;
|
margin-<?php print $right; ?>: <?php print (GETPOST('optioncss','aZ09') == 'print'?8:(empty($conf->dol_optimize_smallscreen)?'16':'12')); ?>px;
|
||||||
<?php if (! empty($conf->dol_hide_leftmenu) && ! empty($conf->dol_hide_topmenu)) print 'margin-top: 4px;'; ?>
|
<?php if (! empty($conf->dol_hide_leftmenu) && ! empty($conf->dol_hide_topmenu)) print 'margin-top: 4px;'; ?>
|
||||||
margin-bottom: 15px;
|
margin-bottom: 15px;
|
||||||
}
|
}
|
||||||
@ -2769,7 +2769,7 @@ input.liste_titre {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.noborder tr.liste_total, .noborder tr.liste_total td, tr.liste_total, form.liste_total {
|
.noborder tr.liste_total, .noborder tr.liste_total td, tr.liste_total, form.liste_total {
|
||||||
/* background: #F0F0F0; */
|
height: 32px;
|
||||||
}
|
}
|
||||||
.noborder tr.liste_total td, tr.liste_total td, form.liste_total div {
|
.noborder tr.liste_total td, tr.liste_total td, form.liste_total div {
|
||||||
/* border-top: 1px solid #f4f4f4; */
|
/* border-top: 1px solid #f4f4f4; */
|
||||||
@ -2777,7 +2777,6 @@ input.liste_titre {
|
|||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
padding: 4px;
|
padding: 4px;
|
||||||
height: 20px;
|
|
||||||
}
|
}
|
||||||
tr.liste_sub_total, tr.liste_sub_total td {
|
tr.liste_sub_total, tr.liste_sub_total td {
|
||||||
border-bottom: 2px solid #aaa;
|
border-bottom: 2px solid #aaa;
|
||||||
@ -2882,6 +2881,9 @@ div .tdtop {
|
|||||||
}
|
}
|
||||||
@media only screen and (max-width: 767px)
|
@media only screen and (max-width: 767px)
|
||||||
{
|
{
|
||||||
|
.thumbstat {
|
||||||
|
flex: 1 1 110px;
|
||||||
|
}
|
||||||
.thumbstat150 {
|
.thumbstat150 {
|
||||||
flex: 1 1 110px;
|
flex: 1 1 110px;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -177,15 +177,19 @@ class CodingSqlTest extends PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
if (preg_match('/\.key\.sql$/',$file))
|
if (preg_match('/\.key\.sql$/',$file))
|
||||||
{
|
{
|
||||||
// Test for files key files only
|
// Test for key files only
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Test for files non key files only
|
// Test for non key files only
|
||||||
$result=(strpos($filecontent,'KEY ') && strpos($filecontent,'PRIMARY KEY ') == 0);
|
$result=(strpos($filecontent,'KEY ') && strpos($filecontent,'PRIMARY KEY ') == 0);
|
||||||
print __METHOD__." Result for checking we don't have ' KEY ' instead of a sql file to create index = ".$result."\n";
|
print __METHOD__." Result for checking we don't have ' KEY ' instead of a sql file to create index = ".$result."\n";
|
||||||
$this->assertTrue($result===false, 'Found KEY into '.$file.'. Bad.');
|
$this->assertTrue($result===false, 'Found KEY into '.$file.'. Bad.');
|
||||||
|
|
||||||
|
$result=stripos($filecontent,'ENGINE=innodb');
|
||||||
|
print __METHOD__." Result for checking we have the ENGINE=innodb string = ".$result."\n";
|
||||||
|
$this->assertGreaterThan(0, $result, 'The ENGINE=innodb was not found into '.$file.'. Add it or just fix syntax to match case.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -335,6 +335,11 @@ class DateLibTest extends PHPUnit_Framework_TestCase
|
|||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
$this->assertEquals('02/01/1970 00:00',$result);
|
$this->assertEquals('02/01/1970 00:00',$result);
|
||||||
|
|
||||||
|
// Check %a and %b format for fr_FR
|
||||||
|
$result=dol_print_date(0,'%a %b %B',true,$outputlangs);
|
||||||
|
print __METHOD__." result=".$result."\n";
|
||||||
|
$this->assertEquals('Jeu Jan. Janvier',$result);
|
||||||
|
|
||||||
// Check day format for en_US
|
// Check day format for en_US
|
||||||
$outputlangs=new Translate('',$conf);
|
$outputlangs=new Translate('',$conf);
|
||||||
$outputlangs->setDefaultLang('en_US');
|
$outputlangs->setDefaultLang('en_US');
|
||||||
@ -345,9 +350,9 @@ class DateLibTest extends PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals('01/02/1970',$result);
|
$this->assertEquals('01/02/1970',$result);
|
||||||
|
|
||||||
// Check %a and %b format for en_US
|
// Check %a and %b format for en_US
|
||||||
$result=dol_print_date(0,'%a %b',true,$outputlangs);
|
$result=dol_print_date(0,'%a %b %B',true,$outputlangs);
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
$this->assertEquals('Thu Jan',$result);
|
$this->assertEquals('Thu Jan January',$result);
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user