Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
31396739f9
@ -7,7 +7,8 @@
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
*
|
||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.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
|
||||
@ -637,6 +638,7 @@ if ($mode == 'common')
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">'."\n";
|
||||
if (!empty($conf->global->MAIN_MODULES_SHOW_LINENUMBERS)) print '<td width="20px">'.++$linenum.'</td>';
|
||||
|
||||
// Picto + Name of module
|
||||
print ' <td width="200px">';
|
||||
@ -669,6 +671,17 @@ if ($mode == 'common')
|
||||
// Version
|
||||
print '<td class="center nowrap" width="120px">';
|
||||
print $versiontrans;
|
||||
if(!empty($conf->global->CHECKLASTVERSION_EXTERNALMODULE)){
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php');
|
||||
if (!empty($objMod->url_last_version)) {
|
||||
$newversion = getURLContent($objMod->url_last_version);
|
||||
if(isset($newversion['content'])){
|
||||
if (version_compare($newversion['content'], $versiontrans) > 0) {
|
||||
print " <span class='butAction' title='" . $langs->trans('LastStableVersion') . "'>".$newversion['content']."</span>";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
print "</td>\n";
|
||||
|
||||
// Activate/Disable and Setup (2 columns)
|
||||
|
||||
@ -80,6 +80,16 @@ if ($action == "set")
|
||||
$res = dolibarr_set_const($db, "PRELEVEMENT_USER", GETPOST("PRELEVEMENT_USER"),'chaine',0,'',$conf->entity);
|
||||
if (! $res > 0) $error++;
|
||||
}
|
||||
if (GETPOST("PRELEVEMENT_END_TO_END") || GETPOST("PRELEVEMENT_END_TO_END")=="")
|
||||
{
|
||||
$res = dolibarr_set_const($db, "END_TO_END", GETPOST("PRELEVEMENT_END_TO_END"),'chaine',0,'',$conf->entity);
|
||||
if (! $res > 0) $error++;
|
||||
}
|
||||
if (GETPOST("PRELEVEMENT_USTRD") || GETPOST("PRELEVEMENT_USTRD")=="")
|
||||
{
|
||||
$res = dolibarr_set_const($db, "USTRD", GETPOST("PRELEVEMENT_USTRD"),'chaine',0,'',$conf->entity);
|
||||
if (! $res > 0) $error++;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
@ -221,6 +231,18 @@ print $form->select_dolusers($conf->global->PRELEVEMENT_USER, 'PRELEVEMENT_USER'
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
//EntToEnd
|
||||
print '<tr class="pair"><td class="fieldrequired">'.$langs->trans("END_TO_END").'</td>';
|
||||
print '<td align="left">';
|
||||
print '<input type="text" name="PRELEVEMENT_END_TO_END" value="'.$conf->global->END_TO_END.'" size="15" ></td>';
|
||||
print '</td></tr>';
|
||||
|
||||
//USTRD
|
||||
print '<tr class="pair"><td class="fieldrequired">'.$langs->trans("USTRD").'</td>';
|
||||
print '<td align="left">';
|
||||
print '<input type="text" name="PRELEVEMENT_USTRD" value="'.$conf->global->USTRD.'" size="15" ></td>';
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
@ -1575,7 +1575,8 @@ class BonPrelevement extends CommonObject
|
||||
$XML_DEBITOR ='';
|
||||
$XML_DEBITOR .=' <DrctDbtTxInf>'.$CrLf;
|
||||
$XML_DEBITOR .=' <PmtId>'.$CrLf;
|
||||
$XML_DEBITOR .=' <EndToEndId>'.('AS-'.dol_trunc($row_facnumber,20).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
|
||||
// $XML_DEBITOR .=' <EndToEndId>'.('AS-'.dol_trunc($row_facnumber,20).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
|
||||
$XML_DEBITOR .=' <EndToEndId>'.(($conf->global->END_TO_END != "" ) ? $conf->global->END_TO_END : ('AS-'.dol_trunc($row_facnumber,20)).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
|
||||
$XML_DEBITOR .=' </PmtId>'.$CrLf;
|
||||
$XML_DEBITOR .=' <InstdAmt Ccy="EUR">'.round($row_somme, 2).'</InstdAmt>'.$CrLf;
|
||||
$XML_DEBITOR .=' <DrctDbtTx>'.$CrLf;
|
||||
@ -1607,7 +1608,8 @@ class BonPrelevement extends CommonObject
|
||||
$XML_DEBITOR .=' </DbtrAcct>'.$CrLf;
|
||||
$XML_DEBITOR .=' <RmtInf>'.$CrLf;
|
||||
// $XML_DEBITOR .=' <Ustrd>'.($row_facnumber.'/'.$Rowing.'/'.$Rum).'</Ustrd>'.$CrLf;
|
||||
$XML_DEBITOR .=' <Ustrd>'.dol_trunc($row_facnumber, 135).'</Ustrd>'.$CrLf; // 140 max
|
||||
// $XML_DEBITOR .=' <Ustrd>'.dol_trunc($row_facnumber, 135).'</Ustrd>'.$CrLf; // 140 max
|
||||
$XML_DEBITOR .=' <Ustrd>'.(($conf->global->USTRD != "" ) ? $conf->global->USTRD : dol_trunc($row_facnumber, 135) ).'</Ustrd>'.$CrLf; // 140 max
|
||||
$XML_DEBITOR .=' </RmtInf>'.$CrLf;
|
||||
$XML_DEBITOR .=' </DrctDbtTxInf>'.$CrLf;
|
||||
return $XML_DEBITOR;
|
||||
|
||||
@ -1001,9 +1001,10 @@ class Form
|
||||
* @param string $selected_input_value Value of preselected input text (for use with ajax)
|
||||
* @param int $hidelabel Hide label (0=no, 1=yes, 2=show search icon (before) and placeholder, 3 search icon after)
|
||||
* @param array $ajaxoptions Options for ajax_autocompleter
|
||||
* @param bool $multiple add [] in the name of element and add 'multiple' attribut (not working with ajax_autocompleter)
|
||||
* @return string HTML string with select box for thirdparty.
|
||||
*/
|
||||
function select_company($selected='', $htmlname='socid', $filter='', $showempty='', $showtype=0, $forcecombo=0, $events=array(), $limit=0, $morecss='minwidth100', $moreparam='', $selected_input_value='', $hidelabel=1, $ajaxoptions=array())
|
||||
function select_company($selected='', $htmlname='socid', $filter='', $showempty='', $showtype=0, $forcecombo=0, $events=array(), $limit=0, $morecss='minwidth100', $moreparam='', $selected_input_value='', $hidelabel=1, $ajaxoptions=array(), $multiple=false)
|
||||
{
|
||||
global $conf,$user,$langs;
|
||||
|
||||
@ -1040,7 +1041,7 @@ class Form
|
||||
else
|
||||
{
|
||||
// Immediate load of all database
|
||||
$out.=$this->select_thirdparty_list($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, '', 0, $limit, $morecss, $moreparam);
|
||||
$out.=$this->select_thirdparty_list($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, '', 0, $limit, $morecss, $moreparam, $multiple);
|
||||
}
|
||||
|
||||
return $out;
|
||||
@ -1062,16 +1063,20 @@ class Form
|
||||
* @param int $limit Limit number of answers
|
||||
* @param string $morecss Add more css styles to the SELECT component
|
||||
* @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container
|
||||
* @param bool $multiple add [] in the name of element and add 'multiple' attribut
|
||||
* @return string HTML string with
|
||||
*/
|
||||
function select_thirdparty_list($selected='',$htmlname='socid',$filter='',$showempty='', $showtype=0, $forcecombo=0, $events=array(), $filterkey='', $outputmode=0, $limit=0, $morecss='minwidth100', $moreparam='')
|
||||
function select_thirdparty_list($selected='',$htmlname='socid',$filter='',$showempty='', $showtype=0, $forcecombo=0, $events=array(), $filterkey='', $outputmode=0, $limit=0, $morecss='minwidth100', $moreparam='', $multiple=false)
|
||||
{
|
||||
global $conf,$user,$langs;
|
||||
|
||||
$out='';
|
||||
$num=0;
|
||||
$outarray=array();
|
||||
|
||||
|
||||
if ($selected === '') $selected = array();
|
||||
else if (!is_array($selected)) $selected = array($selected);
|
||||
|
||||
// Clean $filter that may contains sql conditions so sql code
|
||||
if (function_exists('test_sql_and_script_inject')) $filter = test_sql_and_script_inject($filter, 3);
|
||||
|
||||
@ -1120,7 +1125,7 @@ class Form
|
||||
}
|
||||
|
||||
// Construct $out and $outarray
|
||||
$out.= '<select id="'.$htmlname.'" class="flat'.($morecss?' '.$morecss:'').'"'.($moreparam?' '.$moreparam:'').' name="'.$htmlname.'">'."\n";
|
||||
$out.= '<select id="'.$htmlname.'" class="flat'.($morecss?' '.$morecss:'').'"'.($moreparam?' '.$moreparam:'').' name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').'>'."\n";
|
||||
|
||||
$textifempty='';
|
||||
// Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'.
|
||||
@ -1169,7 +1174,7 @@ class Form
|
||||
|
||||
if (empty($outputmode))
|
||||
{
|
||||
if ($selected > 0 && $selected == $obj->rowid)
|
||||
if (in_array($obj->rowid,$selected))
|
||||
{
|
||||
$out.= '<option value="'.$obj->rowid.'" selected>'.$label.'</option>';
|
||||
}
|
||||
@ -1320,15 +1325,19 @@ class Form
|
||||
* @param array $events Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
|
||||
* @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container
|
||||
* @param string $htmlid Html id to use instead of htmlname
|
||||
* @param bool $multiple add [] in the name of element and add 'multiple' attribut
|
||||
* @return int <0 if KO, Nb of contact in list if OK
|
||||
*/
|
||||
function selectcontacts($socid, $selected='', $htmlname='contactid', $showempty=0, $exclude='', $limitto='', $showfunction=0, $moreclass='', $options_only=false, $showsoc=0, $forcecombo=0, $events=array(), $moreparam='', $htmlid='')
|
||||
function selectcontacts($socid, $selected='', $htmlname='contactid', $showempty=0, $exclude='', $limitto='', $showfunction=0, $moreclass='', $options_only=false, $showsoc=0, $forcecombo=0, $events=array(), $moreparam='', $htmlid='', $multiple=false)
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
$langs->load('companies');
|
||||
|
||||
if (empty($htmlid)) $htmlid = $htmlname;
|
||||
|
||||
if ($selected === '') $selected = array();
|
||||
else if (!is_array($selected)) $selected = array($selected);
|
||||
$out='';
|
||||
|
||||
// On recherche les societes
|
||||
@ -1353,9 +1362,9 @@ class Form
|
||||
$out .= ajax_combobox($htmlid, $events, $conf->global->CONTACT_USE_SEARCH_TO_SELECT);
|
||||
}
|
||||
|
||||
if ($htmlname != 'none' || $options_only) $out.= '<select class="flat'.($moreclass?' '.$moreclass:'').'" id="'.$htmlid.'" name="'.$htmlname.'" '.(!empty($moreparam) ? $moreparam : '').'>';
|
||||
if ($showempty == 1) $out.= '<option value="0"'.($selected=='0'?' selected':'').'> </option>';
|
||||
if ($showempty == 2) $out.= '<option value="0"'.($selected=='0'?' selected':'').'>'.$langs->trans("Internal").'</option>';
|
||||
if ($htmlname != 'none' || $options_only) $out.= '<select class="flat'.($moreclass?' '.$moreclass:'').'" id="'.$htmlid.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.(!empty($moreparam) ? $moreparam : '').'>';
|
||||
if ($showempty == 1 && !$multiple) $out.= '<option value="0"'.(in_array(0,$selected)?' selected':'').'> </option>';
|
||||
if ($showempty == 2) $out.= '<option value="0"'.(in_array(0,$selected)?' selected':'').'>'.$langs->trans("Internal").'</option>';
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
if ($num)
|
||||
@ -1363,7 +1372,6 @@ class Form
|
||||
include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
$contactstatic=new Contact($this->db);
|
||||
|
||||
if (!is_array($selected)) $selected = array($selected);
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
@ -1413,7 +1421,7 @@ class Form
|
||||
}
|
||||
else
|
||||
{
|
||||
$out.= '<option value="-1"'.($showempty==2?'':' selected').' disabled>'.$langs->trans($socid?"NoContactDefinedForThirdParty":"NoContactDefined").'</option>';
|
||||
$out.= '<option value="-1"'.($showempty==2 || $multiple?'':' selected').' disabled>'.$langs->trans($socid?"NoContactDefinedForThirdParty":"NoContactDefined").'</option>';
|
||||
}
|
||||
if ($htmlname != 'none' || $options_only)
|
||||
{
|
||||
@ -1469,16 +1477,20 @@ class Form
|
||||
* @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 $outputmode 0=HTML select string, 1=Array
|
||||
* @param bool $multiple add [] in the name of element and add 'multiple' attribut
|
||||
* @return string HTML select string
|
||||
* @see select_dolgroups
|
||||
*/
|
||||
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, $outputmode=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, $outputmode=0, $multiple=false)
|
||||
{
|
||||
global $conf,$user,$langs;
|
||||
|
||||
|
||||
// If no preselected user defined, we take current user
|
||||
if ((is_numeric($selected) && ($selected < -2 || empty($selected))) && empty($conf->global->SOCIETE_DISABLE_DEFAULT_SALESREPRESENTATIVE)) $selected=$user->id;
|
||||
|
||||
if ($selected === '') $selected = array();
|
||||
else if (!is_array($selected)) $selected = array($selected);
|
||||
|
||||
$excludeUsers=null;
|
||||
$includeUsers=null;
|
||||
|
||||
@ -1551,12 +1563,12 @@ class Form
|
||||
$out .= ajax_combobox($htmlname);
|
||||
|
||||
// do not use maxwidthonsmartphone by default. Set it by caller so auto size to 100% will work when not defined
|
||||
$out.= '<select class="flat'.($morecss?' minwidth100 '.$morecss:' minwidth200').'" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled?' disabled':'').'>';
|
||||
if ($show_empty) $out.= '<option value="-1"'.((empty($selected) || $selected==-1)?' selected':'').'> </option>'."\n";
|
||||
if ($show_every) $out.= '<option value="-2"'.(($selected==-2)?' selected':'').'>-- '.$langs->trans("Everybody").' --</option>'."\n";
|
||||
$out.= '<select class="flat'.($morecss?' minwidth100 '.$morecss:' minwidth200').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled?' disabled':'').'>';
|
||||
if ($show_empty && !$multiple) $out.= '<option value="-1"'.((empty($selected) || in_array(-1,$selected))?' selected':'').'> </option>'."\n";
|
||||
if ($show_every) $out.= '<option value="-2"'.((in_array(-2,$selected))?' selected':'').'>-- '.$langs->trans("Everybody").' --</option>'."\n";
|
||||
|
||||
$userstatic=new User($this->db);
|
||||
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
@ -1568,7 +1580,7 @@ class Form
|
||||
$disableline='';
|
||||
if (is_array($enableonly) && count($enableonly) && ! in_array($obj->rowid,$enableonly)) $disableline=($enableonlytext?$enableonlytext:'1');
|
||||
|
||||
if ((is_object($selected) && $selected->id == $obj->rowid) || (! is_object($selected) && $selected == $obj->rowid))
|
||||
if ((is_object($selected) && $selected->id == $obj->rowid) || (! is_object($selected) && in_array($obj->rowid,$selected) ))
|
||||
{
|
||||
$out.= '<option value="'.$obj->rowid.'"';
|
||||
if ($disableline) $out.= ' disabled';
|
||||
@ -6727,10 +6739,11 @@ class Form
|
||||
* @param string $include Array list of groups id to include
|
||||
* @param int $enableonly Array list of groups id to be enabled. All other must be disabled
|
||||
* @param string $force_entity '0' or Ids of environment to force
|
||||
* @param bool $multiple add [] in the name of element and add 'multiple' attribut (not working with ajax_autocompleter)
|
||||
* @return string
|
||||
* @see select_dolusers
|
||||
*/
|
||||
function select_dolgroups($selected='', $htmlname='groupid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity='0')
|
||||
function select_dolgroups($selected='', $htmlname='groupid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity='0', $multiple=false)
|
||||
{
|
||||
global $conf,$user,$langs;
|
||||
|
||||
@ -6739,6 +6752,8 @@ class Form
|
||||
// Permettre l'inclusion de groupes
|
||||
if (is_array($include)) $includeGroups = implode("','",$include);
|
||||
|
||||
if (!is_array($selected)) $selected = array($selected);
|
||||
|
||||
$out='';
|
||||
|
||||
// On recherche les groupes
|
||||
@ -6770,13 +6785,13 @@ class Form
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||
$out .= ajax_combobox($htmlname);
|
||||
|
||||
$out.= '<select class="flat minwidth200" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled?' disabled':'').'>';
|
||||
$out.= '<select class="flat minwidth200" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled?' disabled':'').'>';
|
||||
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
if ($num)
|
||||
{
|
||||
if ($show_empty) $out.= '<option value="-1"'.($selected==-1?' selected':'').'> </option>'."\n";
|
||||
if ($show_empty && !$multiple) $out.= '<option value="-1"'.(in_array(-1,$selected)?' selected':'').'> </option>'."\n";
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
@ -6786,7 +6801,7 @@ class Form
|
||||
|
||||
$out.= '<option value="'.$obj->rowid.'"';
|
||||
if ($disableline) $out.= ' disabled';
|
||||
if ((is_object($selected) && $selected->id == $obj->rowid) || (! is_object($selected) && $selected == $obj->rowid))
|
||||
if ((is_object($selected[0]) && $selected[0]->id == $obj->rowid) || (! is_object($selected[0]) && in_array($obj->rowid,$selected) ))
|
||||
{
|
||||
$out.= ' selected';
|
||||
}
|
||||
@ -6804,7 +6819,7 @@ class Form
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($show_empty) $out.= '<option value="-1"'.($selected==-1?' selected':'').'></option>'."\n";
|
||||
if ($show_empty) $out.= '<option value="-1"'.(in_array(-1,$selected)?' selected':'').'></option>'."\n";
|
||||
$out.= '<option value="" disabled>'.$langs->trans("NoUserGroupDefined").'</option>';
|
||||
}
|
||||
$out.= '</select>';
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2012-2013 Charles-Fr BENKE <charles.fr@benke.fr>
|
||||
/* Copyright (C) 2012-2018 Charlene BENKE <charlie@patas-monkey.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -57,15 +57,25 @@ class FormContract
|
||||
global $db,$user,$conf,$langs;
|
||||
|
||||
$hideunselectables = false;
|
||||
if (! empty($conf->global->PROJECT_HIDE_UNSELECTABLES)) $hideunselectables = true;
|
||||
if (! empty($conf->global->CONTRACT_HIDE_UNSELECTABLES)) $hideunselectables = true;
|
||||
|
||||
// Search all contacts
|
||||
$sql = 'SELECT c.rowid, c.ref, c.fk_soc, c.statut';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX .'contrat as c';
|
||||
$sql.= " WHERE c.entity = ".$conf->entity;
|
||||
//if ($contratListId) $sql.= " AND c.rowid IN (".$contratListId.")";
|
||||
if ($socid > 0)
|
||||
{
|
||||
// CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY is 'all' or a list of ids separated by coma.
|
||||
if (empty($conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY))
|
||||
$sql.= " AND (c.fk_soc=".$socid." OR c.fk_soc IS NULL)";
|
||||
else if ($conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY != 'all')
|
||||
{
|
||||
$sql.= " AND (c.fk_soc IN (".$socid.", ".$conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY.") ";
|
||||
$sql.= " OR c.fk_soc IS NULL)";
|
||||
}
|
||||
}
|
||||
if ($socid == 0) $sql.= " AND (c.fk_soc = 0 OR c.fk_soc IS NULL)";
|
||||
if ($socid > 0) $sql.= " AND (c.fk_soc=".$socid." OR c.fk_soc IS NULL)";
|
||||
$sql.= " ORDER BY c.ref ";
|
||||
|
||||
dol_syslog(get_class($this)."::select_contract", LOG_DEBUG);
|
||||
@ -98,12 +108,12 @@ class FormContract
|
||||
else
|
||||
{
|
||||
$disabled=0;
|
||||
if (! $obj->statut > 0)
|
||||
if ( $obj->statut == 0)
|
||||
{
|
||||
$disabled=1;
|
||||
$labeltoshow.=' ('.$langs->trans("Draft").')';
|
||||
}
|
||||
if ($socid > 0 && (! empty($obj->fk_soc) && $obj->fk_soc != $socid))
|
||||
if ( empty($conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY) && $socid > 0 && (! empty($obj->fk_soc) && $obj->fk_soc != $socid))
|
||||
{
|
||||
$disabled=1;
|
||||
$labeltoshow.=' - '.$langs->trans("LinkedToAnotherCompany");
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (c) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -139,10 +140,10 @@ class FormProjets
|
||||
if (empty($htmlid)) $htmlid = $htmlname;
|
||||
|
||||
$out='';
|
||||
$outarray=array();
|
||||
$outarray=array();
|
||||
|
||||
$hideunselectables = false;
|
||||
if (! empty($conf->global->PROJECT_HIDE_UNSELECTABLES)) $hideunselectables = true;
|
||||
if (! empty($conf->global->CONTRACT_HIDE_UNSELECTABLES)) $hideunselectables = true;
|
||||
|
||||
$projectsListId = false;
|
||||
if (empty($user->rights->projet->all->lire))
|
||||
@ -317,7 +318,7 @@ class FormProjets
|
||||
$out='';
|
||||
|
||||
$hideunselectables = false;
|
||||
if (! empty($conf->global->PROJECT_HIDE_UNSELECTABLES)) $hideunselectables = true;
|
||||
if (! empty($conf->global->CONTRACT_HIDE_UNSELECTABLES)) $hideunselectables = true;
|
||||
|
||||
if (empty($projectsListId))
|
||||
{
|
||||
|
||||
@ -2,8 +2,9 @@
|
||||
/* Copyright (C) 2006-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2016 Gilles Poirier <glgpoirier@gmail.com>
|
||||
|
||||
* Copyright (C) 2016 Gilles Poirier <glgpoirier@gmail.com>
|
||||
* Copyright (C) 2018 charlene Benke <charlie@patas-monkey.com>
|
||||
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -162,4 +163,23 @@ function fichinter_admin_prepare_head()
|
||||
return $head;
|
||||
}
|
||||
|
||||
function fichinter_rec_prepare_head ($object)
|
||||
{
|
||||
global $langs, $conf; //, $user;
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fichinter/card-rec.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("CardFichinter");
|
||||
$head[$h][2] = 'card';
|
||||
$h++;
|
||||
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'intervention-rec');
|
||||
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $h,'intervention-rec','remove');
|
||||
|
||||
|
||||
return $head;
|
||||
}
|
||||
|
||||
|
||||
@ -1231,7 +1231,17 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl
|
||||
{
|
||||
if ($idprod)
|
||||
{
|
||||
if (empty($hidedesc)) $libelleproduitservice.=$desc;
|
||||
if (empty($hidedesc))
|
||||
{
|
||||
if (!empty($conf->global->MAIN_DOCUMENTS_DESCRIPTION_FIRST))
|
||||
{
|
||||
$libelleproduitservice=$desc."\n".$libelleproduitservice;
|
||||
}
|
||||
else
|
||||
{
|
||||
$libelleproduitservice.=$desc;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -785,7 +785,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
$newmenu->add("/fichinter/index.php?leftmenu=ficheinter", $langs->trans("Interventions"), 0, $user->rights->ficheinter->lire, '', $mainmenu, 'ficheinter', 2200);
|
||||
$newmenu->add("/fichinter/card.php?action=create&leftmenu=ficheinter", $langs->trans("NewIntervention"), 1, $user->rights->ficheinter->creer, '', '', '', 201);
|
||||
$newmenu->add("/fichinter/list.php?leftmenu=ficheinter", $langs->trans("List"), 1, $user->rights->ficheinter->lire, '', '', '', 202);
|
||||
|
||||
$newmenu->add("/fichinter/card-red.php?leftmenu=ficheinter", $langs->trans("ModelList"), 1, $user->rights->ficheinter->lire, '', '', '', 203);
|
||||
$newmenu->add("/fichinter/stats/index.php?leftmenu=ficheinter", $langs->trans("Statistics"), 1, $user->rights->fournisseur->commande->lire);
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourcefore.net>
|
||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.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
|
||||
@ -59,7 +60,7 @@ class modModuleBuilder extends DolibarrModules
|
||||
|
||||
// Config pages
|
||||
//-------------
|
||||
$this->config_page_url = array();
|
||||
$this->config_page_url = array('setup@modulebuilder');
|
||||
|
||||
// Dependancies
|
||||
//-------------
|
||||
|
||||
976
htdocs/fichinter/card-rec.php
Normal file
976
htdocs/fichinter/card-rec.php
Normal file
@ -0,0 +1,976 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2016-2018 Charlie Benke <charlie@patas-monkey.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* 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 fichinter/card-rec.php
|
||||
* \ingroup fichinter
|
||||
* \brief Page to show predefined fichinter
|
||||
*/
|
||||
|
||||
$res=0;
|
||||
if (! $res && file_exists("../../main.inc.php"))
|
||||
$res=@include("../../main.inc.php"); // For root directory
|
||||
if (! $res && file_exists("../../../main.inc.php"))
|
||||
$res=@include("../../../main.inc.php"); // For "custom" directory
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinterrec.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/fichinter.lib.php';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
if (! empty($conf->projet->enabled)) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
|
||||
}
|
||||
if (! empty($conf->contrat->enabled)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcontract.class.php';
|
||||
}
|
||||
|
||||
|
||||
$langs->load('bills');
|
||||
$langs->load('compta');
|
||||
$langs->load('admin');
|
||||
$langs->load("interventions");
|
||||
|
||||
// Security check
|
||||
$id=(GETPOST('fichinterid', 'int')?GETPOST('fichinterid', 'int'):GETPOST('id', 'int'));
|
||||
$action=GETPOST('action', 'alpha');
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$objecttype = 'fichinter_rec';
|
||||
if ($action == "create" || $action == "add") $objecttype = '';
|
||||
$result = restrictedArea($user, 'ficheinter', $id, $objecttype);
|
||||
|
||||
if ($page == -1)
|
||||
$page = 0 ;
|
||||
|
||||
$limit = GETPOST('limit')?GETPOST('limit', 'int'):$conf->liste_limit;
|
||||
$offset = $limit * $page ;
|
||||
|
||||
if ($sortorder == "")
|
||||
$sortorder="DESC";
|
||||
|
||||
if ($sortfield == "")
|
||||
$sortfield="f.datec";
|
||||
|
||||
$object = new FichinterRec($db);
|
||||
|
||||
|
||||
$arrayfields=array(
|
||||
'f.titre'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
|
||||
's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1),
|
||||
'f.fk_contrat'=>array('label'=>$langs->trans("Contract"), 'checked'=>1),
|
||||
'f.duree'=>array('label'=>$langs->trans("Duration"), 'checked'=>1),
|
||||
'f.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>1),
|
||||
'f.frequency'=>array('label'=>$langs->trans("RecurringInvoiceTemplate"), 'checked'=>1),
|
||||
'f.nb_gen_done'=>array('label'=>$langs->trans("NbOfGenerationDone"), 'checked'=>1),
|
||||
'f.date_last_gen'=>array('label'=>$langs->trans("DateLastGeneration"), 'checked'=>1),
|
||||
'f.date_when'=>array('label'=>$langs->trans("NextDateToExecution"), 'checked'=>1),
|
||||
'f.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
||||
'f.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
|
||||
);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
|
||||
// Create predefined intervention
|
||||
if ($action == 'add') {
|
||||
if (! GETPOST('titre')) {
|
||||
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->trans("Title")), null, 'errors');
|
||||
$action = "create";
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! GETPOST('socid')) {
|
||||
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->trans("Customer")), null, 'errors');
|
||||
$action = "create";
|
||||
$error++;
|
||||
}
|
||||
|
||||
// gestion des fréquences et des échéances
|
||||
$frequency=GETPOST('frequency', 'int');
|
||||
$reyear=GETPOST('reyear');
|
||||
$remonth=GETPOST('remonth');
|
||||
$reday=GETPOST('reday');
|
||||
$rehour=GETPOST('rehour');
|
||||
$remin=GETPOST('remin');
|
||||
$nb_gen_max = (GETPOST('nb_gen_max', 'int')?GETPOST('nb_gen_max', 'int'):0);
|
||||
if (GETPOST('frequency')) {
|
||||
if (empty($reyear) || empty($remonth) || empty($reday)) {
|
||||
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->trans("Date")), null, 'errors');
|
||||
$action = "create";
|
||||
$error++;
|
||||
}
|
||||
if ($nb_gen_max === '') {
|
||||
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->trans("MaxPeriodNumber")), null, 'errors');
|
||||
$action = "create";
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error) {
|
||||
$object->id_origin = $id;
|
||||
$object->titre = GETPOST('titre', 'alpha');
|
||||
$object->description = GETPOST('description', 'alpha');
|
||||
$object->socid = GETPOST('socid', 'alpha');
|
||||
$object->fk_project = GETPOST('projectid', 'int');
|
||||
$object->fk_contract = GETPOST('contractid', 'int');
|
||||
|
||||
$object->frequency = $frequency;
|
||||
$object->unit_frequency = GETPOST('unit_frequency', 'alpha');
|
||||
$object->nb_gen_max = $nb_gen_max;
|
||||
$object->auto_validate = GETPOST('auto_validate', 'int');
|
||||
|
||||
$date_next_execution = dol_mktime($rehour, $remin, 0, $remonth, $reday, $reyear);
|
||||
$object->date_when = $date_next_execution;
|
||||
|
||||
if ($object->create($user) > 0) {
|
||||
$id = $object->id;
|
||||
$action = '';
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action = "create";
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'createfrommodel') {
|
||||
$newinter = new fichinter($db);
|
||||
|
||||
// on récupère les enregistrements
|
||||
$object->fetch($id);
|
||||
|
||||
|
||||
// on transfert les données de l'un vers l'autre
|
||||
if ($object->socid > 0) {
|
||||
$newinter->socid=$object->socid;
|
||||
$newinter->fk_projet=$object->fk_projet;
|
||||
$newinter->fk_contrat=$object->fk_contrat;
|
||||
} else
|
||||
$newinter->socid=GETPOST("socid");
|
||||
|
||||
$newinter->entity=$object->entity;
|
||||
$newinter->duree=$object->duree;
|
||||
|
||||
$newinter->description=$object->description;
|
||||
$newinter->note_private=$object->note_private;
|
||||
$newinter->note_public=$object->note_public;
|
||||
|
||||
// on créer un nouvelle intervention
|
||||
$extrafields = new ExtraFields($db);
|
||||
$extralabels = $extrafields->fetch_name_optionals_label($newinter->table_element);
|
||||
$array_options = $extrafields->getOptionalsFromPost($extralabels);
|
||||
$newinter->array_options = $array_options;
|
||||
|
||||
$newfichinterid = $newinter->create($user);
|
||||
|
||||
if ($newfichinterid > 0) {
|
||||
// on ajoute les lignes de détail ensuite
|
||||
foreach ($object->lines as $ficheinterligne)
|
||||
$newinter->addline($user, $newfichinterid, $ficheinterligne->desc, "", $ficheinterligne->duree, '');
|
||||
|
||||
// on update le nombre d'inter crée à partir du modèle
|
||||
$object->updateNbGenDone();
|
||||
//on redirige vers la fiche d'intervention nouvellement crée
|
||||
header('Location: '.DOL_URL_ROOT.'/fichinter/card.php?id='.$newfichinterid);
|
||||
exit;
|
||||
} else {
|
||||
setEventMessages($newinter->error, $newinter->errors, 'errors');
|
||||
$action='';
|
||||
}
|
||||
} elseif ($action == 'delete' && $user->rights->ficheinter->supprimer) {
|
||||
// delete modele
|
||||
$object->fetch($id);
|
||||
$object->delete();
|
||||
$id = 0 ;
|
||||
header('Location: '.$_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
} elseif ($action == 'setfrequency' && $user->rights->ficheinter->creer) {
|
||||
// Set frequency and unit frequency
|
||||
$object->fetch($id);
|
||||
$object->setFrequencyAndUnit(GETPOST('frequency', 'int'), GETPOST('unit_frequency', 'alpha'));
|
||||
} elseif ($action == 'setdate_when' && $user->rights->ficheinter->creer) {
|
||||
// Set next date of execution
|
||||
$object->fetch($id);
|
||||
$date = dol_mktime(
|
||||
GETPOST('date_whenhour'), GETPOST('date_whenmin'), 0,
|
||||
GETPOST('date_whenmonth'), GETPOST('date_whenday'), GETPOST('date_whenyear')
|
||||
);
|
||||
if (!empty($date)) $object->setNextDate($date);
|
||||
} elseif ($action == 'setnb_gen_max' && $user->rights->ficheinter->creer) {
|
||||
// Set max period
|
||||
$object->fetch($id);
|
||||
$object->setMaxPeriod(GETPOST('nb_gen_max', 'int'));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('', $langs->trans("RepeatableInterventional"), 'ch-fichinter.html#s-fac-fichinter-rec');
|
||||
|
||||
$form = new Form($db);
|
||||
$companystatic = new Societe($db);
|
||||
if (! empty($conf->contrat->enabled))
|
||||
$contratstatic = new Contrat($db);
|
||||
if (! empty($conf->projet->enabled))
|
||||
$projectstatic = new Project($db);
|
||||
|
||||
$now = dol_now();
|
||||
$tmparray=dol_getdate($now);
|
||||
$today = dol_mktime(
|
||||
23, 59, 59,
|
||||
$tmparray['mon'], $tmparray['mday'], $tmparray['year']
|
||||
); // Today is last second of current day
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Create mode
|
||||
*/
|
||||
if ($action == 'create') {
|
||||
print load_fiche_titre($langs->trans("CreateRepeatableIntervention"), '', 'title_commercial.png');
|
||||
|
||||
$object = new Fichinter($db); // Source invoice
|
||||
//$object = new Managementfichinter($db); // Source invoice
|
||||
|
||||
if ($object->fetch($id, $ref) > 0) {
|
||||
print '<form action="fiche-rec.php" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<input type="hidden" name="fichinterid" value="'.$object->id.'">';
|
||||
|
||||
dol_fiche_head();
|
||||
|
||||
$rowspan=4;
|
||||
if (! empty($conf->projet->enabled) && $object->fk_project > 0) $rowspan++;
|
||||
if (! empty($conf->contrat->enabled) && $object->fk_contrat > 0) $rowspan++;
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
// Third party
|
||||
print '<tr><td>'.$langs->trans("Customer").'</td><td>';
|
||||
print $form->select_company($object->thirdparty->id, 'socid', '', 0, 1);
|
||||
|
||||
// .$object->thirdparty->getNomUrl(1,'customer').
|
||||
print '</td><td>';
|
||||
print $langs->trans("Comment");
|
||||
print '</td></tr>';
|
||||
|
||||
// Title
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Title").'</td><td>';
|
||||
print '<input class="flat" type="text" name="titre" size="24" value="'.$_POST["titre"].'">';
|
||||
print '</td>';
|
||||
|
||||
// Note
|
||||
print '<td rowspan="'.$rowspan.'" valign="top">';
|
||||
print '<textarea class="flat" name="description" wrap="soft" cols="60" rows="'.ROWS_4.'">';
|
||||
print $object->description.'</textarea>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Author
|
||||
print "<tr><td>".$langs->trans("Author")."</td><td>".$user->getFullName($langs)."</td></tr>";
|
||||
|
||||
if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) {
|
||||
// Duration
|
||||
print '<tr><td>'.$langs->trans("TotalDuration").'</td>';
|
||||
print '<td colspan="3">'.convertSecondToTime(
|
||||
$object->duration, 'all',
|
||||
$conf->global->MAIN_DURATION_OF_WORKDAY
|
||||
).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled)) {
|
||||
$formproject = new FormProjets($db);
|
||||
print "<tr><td>".$langs->trans("Project")."</td><td>";
|
||||
$projectid = GETPOST('projectid')?GETPOST('projectid'):$object->fk_project;
|
||||
|
||||
$numprojet = $formproject->select_projects(
|
||||
$object->thirdparty->id, $projectid, 'projectid',
|
||||
0, 0, 1, 0, 0, 0, 0, '', 0, 0, ''
|
||||
);
|
||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$object->thirdparty->id;
|
||||
print '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"]).'?action=create';
|
||||
print '&socid='.$object->thirdparty->id.(!empty($id)?'&id='.$id:'').'">';
|
||||
print $langs->trans("AddProject").'</a>';
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
// Contrat
|
||||
if (! empty($conf->contrat->enabled)) {
|
||||
$formcontract = new FormContract($db);
|
||||
print "<tr><td>".$langs->trans("Contract")."</td><td>";
|
||||
$contractid = GETPOST('contractid')?GETPOST('contractid'):$object->fk_contract;
|
||||
$numcontract = $formcontract->select_contract($object->thirdparty->id, $contractid, 'contracttid');
|
||||
print "</td></tr>";
|
||||
}
|
||||
print "</table>";
|
||||
|
||||
print '<br><br>';
|
||||
|
||||
/// frequency & duration
|
||||
// Autogeneration
|
||||
$title = $langs->trans("Recurrence");
|
||||
print load_fiche_titre($title, '', 'calendar');
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Frequency
|
||||
print '<tr><td class="titlefieldcreate">';
|
||||
print $form->textwithpicto($langs->trans("Frequency"), $langs->transnoentitiesnoconv('toolTipFrequency'));
|
||||
print "</td><td>";
|
||||
print "<input type='text' name='frequency' value='".GETPOST('frequency', 'int')."' size='4' /> ";
|
||||
print $form->selectarray(
|
||||
'unit_frequency',
|
||||
array('d'=>$langs->trans('Day'), 'm'=>$langs->trans('Month'), 'y'=>$langs->trans('Year')),
|
||||
(GETPOST('unit_frequency')?GETPOST('unit_frequency'):'m')
|
||||
);
|
||||
print "</td></tr>";
|
||||
|
||||
// First date of execution for cron
|
||||
print "<tr><td>".$langs->trans('NextDateToExecution')."</td><td>";
|
||||
if ($date_next_execution != "")
|
||||
$date_next_execution = (GETPOST('remonth') ? dol_mktime(
|
||||
12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')
|
||||
) : -1);
|
||||
print $form->select_date($date_next_execution, '', 1, 1, '', "add", 1, 1, 1);
|
||||
print "</td></tr>";
|
||||
|
||||
// Number max of generation
|
||||
print "<tr><td>".$langs->trans("MaxPeriodNumber")."</td><td>";
|
||||
print '<input type="text" name="nb_gen_max" value="'.GETPOST('nb_gen_max').'" size="5" />';
|
||||
print "</td></tr>";
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '<br>';
|
||||
|
||||
$title = $langs->trans("ProductsAndServices");
|
||||
if (empty($conf->service->enabled))
|
||||
$title = $langs->trans("Products");
|
||||
else if (empty($conf->product->enabled))
|
||||
$title = $langs->trans("Services");
|
||||
|
||||
print load_fiche_titre($title, '', '');
|
||||
|
||||
/*
|
||||
* Invoice lines
|
||||
*/
|
||||
print '<table class="notopnoleftnoright" width="100%">';
|
||||
print '<tr><td colspan="3">';
|
||||
|
||||
$sql = 'SELECT l.*';
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."fichinterdet as l";
|
||||
$sql.= " WHERE l.fk_fichinter= ".$object->id;
|
||||
$sql.= " AND l.fk_product is null ";
|
||||
$sql.= " ORDER BY l.rang";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0; $total = 0;
|
||||
|
||||
echo '<table class="noborder" width="100%">';
|
||||
if ($num) {
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td align="center">'.$langs->trans("Duration").'</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
$var=true;
|
||||
while ($i < $num) {
|
||||
$objp = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
// Show product and description
|
||||
|
||||
print '<td>';
|
||||
print '<a name="'.$objp->rowid.'"></a>'; // ancre pour retourner sur la ligne
|
||||
|
||||
$text = img_object($langs->trans('Service'), 'service');
|
||||
|
||||
print $text.' '.nl2br($objp->description);
|
||||
|
||||
// Qty
|
||||
print '<td align="center">'.convertSecondToTime($objp->duree).'</td>';
|
||||
print "</tr>";
|
||||
|
||||
$i++;
|
||||
}
|
||||
$db->free($result);
|
||||
|
||||
} else
|
||||
print $db->error();
|
||||
print "</table>";
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div align="center"><input type="submit" class="button" value="'.$langs->trans("Create").'">';
|
||||
print ' ';
|
||||
print '<input type="button" class="button" value="'.$langs->trans("Cancel").'" onClick="javascript:history.go(-1)">';
|
||||
print '</div>';
|
||||
print "</form>\n";
|
||||
}
|
||||
else
|
||||
dol_print_error('', "Error, no invoice ".$object->id);
|
||||
|
||||
} elseif ($action == 'selsocforcreatefrommodel') {
|
||||
print load_fiche_titre($langs->trans("CreateRepeatableIntervention"), '', 'title_commercial.png');
|
||||
dol_fiche_head('');
|
||||
|
||||
print '<form name="fichinter" action="'.$_SERVER['PHP_SELF'].'" method="POST">';
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("ThirdParty").'</td><td>';
|
||||
print $form->select_company('', 'socid', '', 1, 1);
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input type="hidden" name="action" value="createfrommodel">';
|
||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("CreateDraftIntervention").'">';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
} else {
|
||||
/*
|
||||
* View mode
|
||||
*
|
||||
*/
|
||||
if ($id > 0) {
|
||||
if ($object->fetch($id) > 0) {
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$author = new User($db);
|
||||
$author->fetch($object->user_author);
|
||||
|
||||
$head = fichinter_rec_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'card', $langs->trans("PredefinedInterventional"), 0, 'intervention');
|
||||
|
||||
// Intervention card
|
||||
$linkback = '<a href="card-rec.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
$morehtmlref='<div class="refidno">';
|
||||
// Thirdparty
|
||||
|
||||
$morehtmlref.=$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled)) {
|
||||
$formproject = new FormProjets($db);
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->ficheinter->creer) {
|
||||
if ($action != 'classify') {
|
||||
$morehtmlref.='<a href="'.$_SERVER['PHP_SELF'].'?action=classify&id='.$object->id.'">';
|
||||
$morehtmlref.=img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
|
||||
}
|
||||
if ($action == 'classify') {
|
||||
|
||||
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects(
|
||||
$object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1
|
||||
);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project(
|
||||
$_SERVER['PHP_SELF'].'?id='.$object->id,
|
||||
$object->socid, $object->fk_project,
|
||||
'none', 0, 0, 0, 1
|
||||
);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$object->fk_project.'"';
|
||||
$morehtmlref.='title="'.$langs->trans('ShowProject').'">';
|
||||
$morehtmlref.=$proj->ref;
|
||||
$morehtmlref.='</a>';
|
||||
} else {
|
||||
$morehtmlref.='';
|
||||
}
|
||||
}
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="fichehalfleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print "<tr><td>".$langs->trans("Author").'</td><td colspan="3">'.$author->getFullName($langs)."</td></tr>";
|
||||
|
||||
if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) {
|
||||
// Duration
|
||||
print '<tr><td class="titlefield">'.$langs->trans("TotalDuration").'</td>';
|
||||
print '<td colspan="3">';
|
||||
print convertSecondToTime($object->duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '<tr><td>'.$langs->trans("Description").'</td><td colspan="3">'.nl2br($object->description)."</td></tr>";
|
||||
|
||||
// Contrat
|
||||
if (! empty($conf->contrat->enabled)) {
|
||||
$langs->load('contrat');
|
||||
print '<tr>';
|
||||
print '<td>';
|
||||
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('Contract');
|
||||
print '</td>';
|
||||
if ($action != 'contrat') {
|
||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=contrat&id='.$object->id.'">';
|
||||
print img_edit($langs->trans('SetContract'), 1);
|
||||
print '</a></td>';
|
||||
}
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'contrat') {
|
||||
$formcontract= new Formcontract($db);
|
||||
$formcontract->formSelectContract(
|
||||
$_SERVER["PHP_SELF"].'?id='.$object->id, $object->socid,
|
||||
$object->fk_contrat, 'contratid', 0, 1
|
||||
);
|
||||
} else {
|
||||
if ($object->fk_contrat) {
|
||||
$contratstatic = new Contrat($db);
|
||||
$contratstatic->fetch($object->fk_contrat);
|
||||
print $contratstatic->getNomUrl(0, '', 1);
|
||||
} else
|
||||
print " ";
|
||||
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
}
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
print '<div class="fichehalfright">';
|
||||
print '<div class="ficheaddleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border centpercent">';
|
||||
|
||||
$title = $langs->trans("Recurrence");
|
||||
print load_fiche_titre($title, '', 'calendar');
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// if "frequency" is empty or = 0, the reccurence is disabled
|
||||
print '<tr><td style="width: 50%">';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('Frequency');
|
||||
print '</td>';
|
||||
if ($action != 'editfrequency' && $user->rights->ficheinter->creer) {
|
||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editfrequency&id='.$id.'">';
|
||||
print img_edit($langs->trans('Edit'), 1) . '</a></td>';
|
||||
}
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editfrequency') {
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"] . '?id=' . $object->id.'">';
|
||||
print '<input type="hidden" name="action" value="setfrequency">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
|
||||
print '<tr><td>';
|
||||
print "<input type='text' name='frequency' value='".$object->frequency."' size='5' /> ";
|
||||
print $form->selectarray(
|
||||
'unit_frequency',
|
||||
array('d'=>$langs->trans('Day'), 'm'=>$langs->trans('Month'), 'y'=>$langs->trans('Year')),
|
||||
($object->unit_frequency?$object->unit_frequency:'m')
|
||||
);
|
||||
print '</td>';
|
||||
print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
|
||||
print '</tr></table></form>';
|
||||
} else {
|
||||
if ($object->frequency > 0)
|
||||
print $langs->trans('FrequencyPer_'.$object->unit_frequency, $object->frequency);
|
||||
else
|
||||
print $langs->trans("NotARecurringInterventionalTemplate");
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Date when
|
||||
print '<tr><td>';
|
||||
if ( $user->rights->ficheinter->creer && ($action == 'date_when' || $object->frequency > 0)) {
|
||||
print $form->editfieldkey(
|
||||
$langs->trans("NextDateToExecution"), 'date_when', $object->date_when,
|
||||
$object, $user->rights->facture->creer, 'day'
|
||||
);
|
||||
} else {
|
||||
print $langs->trans("NextDateToExecution");
|
||||
}
|
||||
print '</td><td>';
|
||||
if ($action == 'date_when' || $object->frequency > 0) {
|
||||
print $form->editfieldval(
|
||||
$langs->trans("NextDateToExecution"), 'date_when', $object->date_when,
|
||||
$object, $user->rights->facture->creer, 'day'
|
||||
);
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Max period / Rest period
|
||||
print '<tr><td>';
|
||||
if ($user->rights->ficheinter->creer && ($action == 'nb_gen_max' || $object->frequency > 0)) {
|
||||
print $form->editfieldkey(
|
||||
$langs->trans("MaxPeriodNumber"), 'nb_gen_max', $object->nb_gen_max,
|
||||
$object, $user->rights->facture->creer
|
||||
);
|
||||
} else
|
||||
print $langs->trans("MaxPeriodNumber");
|
||||
|
||||
print '</td><td>';
|
||||
if ($action == 'nb_gen_max' || $object->frequency > 0) {
|
||||
print $form->editfieldval(
|
||||
$langs->trans("MaxPeriodNumber"), 'nb_gen_max', $object->nb_gen_max?$object->nb_gen_max:'',
|
||||
$object, $user->rights->facture->creer
|
||||
);
|
||||
}
|
||||
else
|
||||
print '';
|
||||
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
// Frequencry/Recurring section
|
||||
if ($object->frequency > 0) {
|
||||
print '<br>';
|
||||
if (empty($conf->cron->enabled)) {
|
||||
$txtinfoadmin=$langs->trans(
|
||||
"EnableAndSetupModuleCron",
|
||||
$langs->transnoentitiesnoconv("Module2300Name")
|
||||
);
|
||||
print info_admin($txtinfoadmin);
|
||||
}
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border centpercent">';
|
||||
|
||||
// Nb of generation already done
|
||||
print '<tr><td style="width: 50%">'.$langs->trans("NbOfGenerationDone").'</td>';
|
||||
print '<td>';
|
||||
print $object->nb_gen_done?$object->nb_gen_done:'0';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Date last
|
||||
print '<tr><td>';
|
||||
print $langs->trans("DateLastGeneration");
|
||||
print '</td><td>';
|
||||
print dol_print_date($object->date_last_gen, 'dayhour');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
|
||||
print '<div class="clearboth"></div><br>';
|
||||
|
||||
/*
|
||||
* Lines
|
||||
*/
|
||||
|
||||
$title = $langs->trans("ProductsAndServices");
|
||||
if (empty($conf->service->enabled))
|
||||
$title = $langs->trans("Products");
|
||||
else if (empty($conf->product->enabled))
|
||||
$title = $langs->trans("Services");
|
||||
|
||||
print load_fiche_titre($title);
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td align="center">'.$langs->trans("Duration").'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$num = count($object->lines);
|
||||
$i = 0;
|
||||
$var=true;
|
||||
while ($i < $num) {
|
||||
$var=!$var;
|
||||
|
||||
// Show product and description
|
||||
if (isset($object->lines[$i]->product_type))
|
||||
$type=$object->lines[$i]->product_type;
|
||||
else
|
||||
$object->lines[$i]->fk_product_type;
|
||||
// Try to enhance type detection using date_start and date_end for free lines when type
|
||||
// was not saved.
|
||||
if (! empty($objp->date_start)) $type=1;
|
||||
if (! empty($objp->date_end)) $type=1;
|
||||
|
||||
// Show line
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td>';
|
||||
$text = img_object($langs->trans('Service'), 'service');
|
||||
print $text.' '.nl2br($object->lines[$i]->desc);
|
||||
print '</td>';
|
||||
|
||||
print '<td align="center">'.convertSecondToTime($object->lines[$i]->duree).'</td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
/**
|
||||
* Barre d'actions
|
||||
*/
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($user->rights->ficheinter->creer) {
|
||||
print '<div class="inline-block divButAction">';
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=createfrommodel';
|
||||
print '&socid='.$object->thirdparty->id.'&id='.$object->id.'">';
|
||||
print $langs->trans("CreateFichInter").'</a></div>';
|
||||
}
|
||||
|
||||
if ($user->rights->ficheinter->supprimer) {
|
||||
print '<div class="inline-block divButAction">';
|
||||
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=delete&id='.$object->id.'">';
|
||||
print $langs->trans('Delete').'</a></div>';
|
||||
}
|
||||
print '</div>';
|
||||
} else
|
||||
print $langs->trans("ErrorRecordNotFound");
|
||||
|
||||
} else {
|
||||
/*
|
||||
* List mode
|
||||
*/
|
||||
$sql = "SELECT f.rowid as fich_rec, s.nom as name, s.rowid as socid, f.rowid as facid, f.titre, ";
|
||||
$sql.= " f.duree, f.fk_contrat, f.fk_projet, f.frequency, f.nb_gen_done, f.nb_gen_max,";
|
||||
$sql.= " f.date_last_gen, f.date_when, f.datec";
|
||||
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."fichinter_rec as f";
|
||||
$sql.= " , ".MAIN_DB_PREFIX."societe as s ";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) {
|
||||
$sql .= " , ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql.= " WHERE f.fk_soc = s.rowid";
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
if ($socid) $sql .= " AND s.rowid = ".$socid;
|
||||
if (! $user->rights->societe->client->voir && ! $socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
}
|
||||
if ($search_ref) $sql .= natural_search('f.titre', $search_ref);
|
||||
if ($search_societe) $sql .= natural_search('s.nom', $search_societe);
|
||||
if ($search_frequency == '1') $sql.= ' AND f.frequency > 0';
|
||||
if ($search_frequency == '0') $sql.= ' AND (f.frequency IS NULL or f.frequency = 0)';
|
||||
|
||||
|
||||
//$sql .= " ORDER BY $sortfield $sortorder, rowid DESC ";
|
||||
// $sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
print_barre_liste(
|
||||
$langs->trans("RepeatableInterventional"), $page,
|
||||
$_SERVER['PHP_SELF'], "&socid=$socid", $sortfield, $sortorder,
|
||||
'', $num, '', 'title_commercial.png'
|
||||
);
|
||||
|
||||
print $langs->trans("ToCreateAPredefinedInterventional").'<br><br>';
|
||||
|
||||
$i = 0;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre(
|
||||
$langs->trans("Ref"), $_SERVER['PHP_SELF'], "f.titre", "", "",
|
||||
'width="200px" align="left"', $sortfiled, $sortorder
|
||||
);
|
||||
|
||||
print_liste_field_titre(
|
||||
$langs->trans("Company"), $_SERVER['PHP_SELF'], "s.nom", "", "",
|
||||
'width="200px" align="left"', $sortfiled, $sortorder
|
||||
);
|
||||
if (! empty($conf->contrat->enabled))
|
||||
print_liste_field_titre(
|
||||
$langs->trans("Contract"), $_SERVER['PHP_SELF'],
|
||||
"f.fk_contrat", "", "",
|
||||
'width="100px" align="left"', $sortfiled, $sortorder
|
||||
);
|
||||
|
||||
if (! empty($conf->projet->enabled))
|
||||
print_liste_field_titre(
|
||||
$langs->trans("Project"), $_SERVER['PHP_SELF'],
|
||||
"f.fk_project", "", "",
|
||||
'width="100px" align="left"', $sortfiled, $sortorder
|
||||
);
|
||||
print_liste_field_titre(
|
||||
$langs->trans("Duration"), $_SERVER['PHP_SELF'],
|
||||
'f.duree', '', '',
|
||||
'width="50px" align="right"', $sortfiled, $sortorder
|
||||
);
|
||||
// Recurring or not
|
||||
print_liste_field_titre(
|
||||
$langs->trans("Frequency"), $_SERVER['PHP_SELF'],
|
||||
"f.frequency", "", "",
|
||||
'width="100px" align="center"', $sortfiled, $sortorder
|
||||
);
|
||||
print_liste_field_titre(
|
||||
$langs->trans("NbOfGenerationDone"), $_SERVER['PHP_SELF'],
|
||||
"f.nb_gen_done", "", "",
|
||||
'width="100px" align="center"', $sortfiled, $sortorder
|
||||
);
|
||||
|
||||
print_liste_field_titre(
|
||||
$langs->trans("DateLastGeneration"), $_SERVER['PHP_SELF'],
|
||||
"f.date_last_gen", "", "",
|
||||
'width="100px" align="center"', $sortfiled, $sortorder
|
||||
);
|
||||
print_liste_field_titre(
|
||||
$langs->trans("NextDateToIntervention"), $_SERVER['PHP_SELF'],
|
||||
"f.date_when", "", "",
|
||||
'width="100px" align="center"', $sortfiled, $sortorder
|
||||
);
|
||||
print '<th width="100px"></th>';
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
// les filtres à faire ensuite
|
||||
|
||||
if ($num > 0) {
|
||||
$var=true;
|
||||
while ($i < min($num, $limit)) {
|
||||
$objp = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td><a href="'.$_SERVER['PHP_SELF'].'?id='.$objp->fich_rec.'">';
|
||||
print img_object($langs->trans("ShowIntervention"), "intervention").' '.$objp->titre;
|
||||
print "</a></td>\n";
|
||||
if ($objp->socid) {
|
||||
$companystatic->id=$objp->socid;
|
||||
$companystatic->name=$objp->name;
|
||||
print '<td>'.$companystatic->getNomUrl(1, 'customer').'</td>';
|
||||
} else
|
||||
print '<td>'.$langs->trans("None").'</td>';
|
||||
|
||||
if (! empty($conf->contrat->enabled)) {
|
||||
print '<td>';
|
||||
if ($objp->fk_contrat >0) {
|
||||
$contratstatic->fetch($objp->fk_contrat);
|
||||
print $contratstatic->getNomUrl(1);
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($conf->projet->enabled)) {
|
||||
print '<td>';
|
||||
if ($objp->fk_project >0) {
|
||||
$projectstatic->fecth($objp->fk_projet);
|
||||
print $projectstatic->getNomUrl(1);
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print '<td align=right>'.convertSecondToTime($objp->duree).'</td>';
|
||||
|
||||
print '<td align="center">'.yn($objp->frequency?1:0).'</td>';
|
||||
|
||||
print '<td align="center">';
|
||||
if ($objp->frequency) {
|
||||
print $objp->nb_gen_done.($objp->nb_gen_max>0?' / '. $objp->nb_gen_max:'') ;
|
||||
print '</td>';
|
||||
|
||||
print '<td align="center">';
|
||||
print dol_print_date($db->jdate($objp->date_last_gen), 'day') ;
|
||||
print '</td>';
|
||||
|
||||
print '<td align="center">';
|
||||
print dol_print_date($db->jdate($objp->date_when), 'day');
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<span class="opacitymedium">'.$langs->trans('NA').'</span>';
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
print '<span class="opacitymedium">'.$langs->trans('NA').'</span>';
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
print '<span class="opacitymedium">'.$langs->trans('NA').'</span>';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
if ($user->rights->ficheinter->creer) {
|
||||
// Action column
|
||||
print '<td align="center">';
|
||||
if ($user->rights->ficheinter->creer) {
|
||||
if (empty($objp->frequency) || $db->jdate($objp->date_when) <= $today) {
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=createfrommodel';
|
||||
print '&socid='.$objp->socid.'&id='.$objp->fich_rec.'">';
|
||||
print $langs->trans("CreateFichInter").'</a>';
|
||||
} else
|
||||
print $langs->trans("DateIsNotEnough");
|
||||
} else
|
||||
print " ";
|
||||
|
||||
print "</td>";
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
} else
|
||||
print '<tr '.$bc[false].'><td colspan="6">'.$langs->trans("NoneF").'</td></tr>';
|
||||
|
||||
print "</table>";
|
||||
$db->free($resql);
|
||||
} else
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@ -5,7 +5,7 @@
|
||||
* Copyright (C) 2011-2017 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014-2018 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2014-2015 Charlie Benke <charlies@patas-monkey.com>
|
||||
* Copyright (C) 2014-2018 Charlene Benke <charlies@patas-monkey.com>
|
||||
* Copyright (C) 2015-2016 Abbes Bahfir <bafbes@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -1643,6 +1643,14 @@ else if ($id > 0 || ! empty($ref))
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#">'.$langs->trans('SendMail').'</a></div>';
|
||||
}
|
||||
|
||||
// create interventional model
|
||||
if ($object->statut == Fichinter::STATUS_DRAFT && $user->rights->ficheinter->creer && (count($object->lines) > 0)) {
|
||||
print '<div class="inline-block divButAction">';
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fichinter/', 1);
|
||||
print 'card-rec.php?id='.$object->id.'&action=create"';
|
||||
print '>'.$langs->trans("ChangeIntoRepeatableInterventional").'</a></div>';
|
||||
}
|
||||
|
||||
// Proposal
|
||||
if ($conf->service->enabled && ! empty($conf->propal->enabled) && $object->statut > Fichinter::STATUS_DRAFT)
|
||||
{
|
||||
|
||||
@ -492,7 +492,7 @@ if ($id > 0 || ! empty($ref)) {
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
$sql = "SELECT l.rowid, l.fk_product, l.subprice, l.remise_percent, SUM(l.qty) as qty,";
|
||||
$sql = "SELECT l.rowid, l.fk_product, l.subprice, l.remise_percent, l.ref AS sref, SUM(l.qty) as qty,";
|
||||
$sql .= " p.ref, p.label, p.tobatch, p.fk_default_warehouse";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "commande_fournisseurdet as l";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON l.fk_product=p.rowid";
|
||||
@ -514,6 +514,7 @@ if ($id > 0 || ! empty($ref)) {
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td align="right">' . $langs->trans("SupplierRef") . '</td>';
|
||||
print '<td align="right">' . $langs->trans("QtyOrdered") . '</td>';
|
||||
print '<td align="right">' . $langs->trans("QtyDispatchedShort") . '</td>';
|
||||
print '<td align="right">' . $langs->trans("QtyToDispatchShort") . '</td>';
|
||||
@ -590,6 +591,9 @@ if ($id > 0 || ! empty($ref)) {
|
||||
if (! empty($objp->remise_percent) && empty($conf->global->STOCK_EXCLUDE_DISCOUNT_FOR_PMP))
|
||||
$up_ht_disc = price2num($up_ht_disc * (100 - $objp->remise_percent) / 100, 'MU');
|
||||
|
||||
// Supplier ref
|
||||
print '<td align="right">'.$objp->sref.'</td>';
|
||||
|
||||
// Qty ordered
|
||||
print '<td align="right">' . $objp->qty . '</td>';
|
||||
|
||||
|
||||
30
htdocs/install/mysql/tables/llx_fichinter_rec.key.sql
Normal file
30
htdocs/install/mysql/tables/llx_fichinter_rec.key.sql
Normal file
@ -0,0 +1,30 @@
|
||||
-- ============================================================================
|
||||
-- Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
-- Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
-- Copyright (C) 2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
-- Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.com>
|
||||
--
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- 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/>.
|
||||
--
|
||||
-- ============================================================================
|
||||
|
||||
|
||||
ALTER TABLE llx_fichinter_rec ADD UNIQUE INDEX idx_fichinter_rec_uk_titre (titre, entity);
|
||||
|
||||
ALTER TABLE llx_fichinter_rec ADD INDEX idx_fichinter_rec_fk_soc (fk_soc);
|
||||
ALTER TABLE llx_fichinter_rec ADD INDEX idx_fichinter_rec_fk_user_author (fk_user_author);
|
||||
ALTER TABLE llx_fichinter_rec ADD INDEX idx_fichinter_rec_fk_projet (fk_projet);
|
||||
|
||||
ALTER TABLE llx_fichinter_rec ADD CONSTRAINT fk_fichinter_rec_fk_user_author FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid);
|
||||
ALTER TABLE llx_fichinter_rec ADD CONSTRAINT fk_fichinter_rec_fk_projet FOREIGN KEY (fk_projet) REFERENCES llx_projet (rowid);
|
||||
48
htdocs/install/mysql/tables/llx_fichinter_rec.sql
Normal file
48
htdocs/install/mysql/tables/llx_fichinter_rec.sql
Normal file
@ -0,0 +1,48 @@
|
||||
-- ===========================================================================
|
||||
-- Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
-- Copyright (C) 2012-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
-- Copyright (C) 2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
-- Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
-- Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.com>
|
||||
--
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- 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_fichinter_rec
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
titre varchar(50) NOT NULL,
|
||||
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||
fk_soc integer DEFAULT NULL,
|
||||
datec datetime, -- date de creation
|
||||
|
||||
fk_contrat integer DEFAULT 0, -- contrat auquel est rattache la fiche
|
||||
fk_user_author integer, -- createur
|
||||
fk_projet integer, -- projet auquel est associe la facture
|
||||
duree real, -- duree totale de l'intervention
|
||||
description text,
|
||||
modelpdf varchar(50),
|
||||
note_private text,
|
||||
note_public text,
|
||||
|
||||
frequency integer, -- frequency (for example: 3 for every 3 month)
|
||||
unit_frequency varchar(2) DEFAULT 'm', -- 'm' for month (date_when must be a day <= 28), 'y' for year, ...
|
||||
date_when datetime DEFAULT NULL, -- date for next gen (when an invoice is generated, this field must be updated with next date)
|
||||
date_last_gen datetime DEFAULT NULL, -- date for last gen (date with last successfull generation of invoice)
|
||||
nb_gen_done integer DEFAULT NULL, -- nb of generation done (when an invoice is generated, this field must incremented)
|
||||
nb_gen_max integer DEFAULT NULL, -- maximum number of generation
|
||||
auto_validate integer NULL DEFAULT NULL -- statut of the generated intervention
|
||||
|
||||
)ENGINE=innodb;
|
||||
63
htdocs/install/mysql/tables/llx_fichinterdet_rec.sql
Normal file
63
htdocs/install/mysql/tables/llx_fichinterdet_rec.sql
Normal file
@ -0,0 +1,63 @@
|
||||
-- ===================================================================
|
||||
-- Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
-- Copyright (C) 2009-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
-- Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
-- Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
-- Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
-- Copyright (C) 2016-2018 Charlene Benke <charlie@patas-monkey.com>
|
||||
--
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- 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_fichinterdet_rec
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
fk_fichinter integer NOT NULL,
|
||||
date datetime, -- date de la ligne d'intervention
|
||||
description text, -- description de la ligne d'intervention
|
||||
duree integer, -- duree de la ligne d'intervention
|
||||
rang integer DEFAULT 0, -- ordre affichage sur la fiche
|
||||
total_ht DOUBLE(24, 8) NULL DEFAULT NULL,
|
||||
subprice DOUBLE(24, 8) NULL DEFAULT NULL,
|
||||
fk_parent_line integer NULL DEFAULT NULL,
|
||||
fk_product integer NULL DEFAULT NULL,
|
||||
label varchar(255) NULL DEFAULT NULL,
|
||||
tva_tx DOUBLE(6, 3) NULL DEFAULT NULL,
|
||||
localtax1_tx DOUBLE(6, 3) NULL DEFAULT 0,
|
||||
localtax1_type VARCHAR(1) NULL DEFAULT NULL,
|
||||
localtax2_tx DOUBLE(6, 3) NULL DEFAULT 0,
|
||||
localtax2_type VARCHAR(1) NULL DEFAULT NULL,
|
||||
qty double NULL DEFAULT NULL,
|
||||
remise_percent double NULL DEFAULT 0,
|
||||
remise double NULL DEFAULT 0,
|
||||
fk_remise_except integer NULL DEFAULT NULL,
|
||||
price DOUBLE(24, 8) NULL DEFAULT NULL,
|
||||
total_tva DOUBLE(24, 8) NULL DEFAULT NULL,
|
||||
total_localtax1 DOUBLE(24, 8) NULL DEFAULT 0,
|
||||
total_localtax2 DOUBLE(24, 8) NULL DEFAULT 0,
|
||||
total_ttc DOUBLE(24, 8) NULL DEFAULT NULL,
|
||||
product_type INTEGER NULL DEFAULT 0,
|
||||
date_start datetime NULL DEFAULT NULL,
|
||||
date_end datetime NULL DEFAULT NULL,
|
||||
info_bits INTEGER NULL DEFAULT 0,
|
||||
buy_price_ht DOUBLE(24, 8) NULL DEFAULT 0,
|
||||
fk_product_fournisseur_price integer NULL DEFAULT NULL,
|
||||
fk_code_ventilation integer NOT NULL DEFAULT 0,
|
||||
fk_export_commpta integer NOT NULL DEFAULT 0,
|
||||
special_code integer UNSIGNED NULL DEFAULT 0,
|
||||
fk_unit integer NULL DEFAULT NULL,
|
||||
import_key varchar(14) NULL DEFAULT NULL
|
||||
|
||||
)ENGINE=innodb;
|
||||
@ -84,6 +84,7 @@ create table llx_user
|
||||
salary double(24,8), -- denormalized value coming from llx_user_employment
|
||||
salaryextra double(24,8), -- denormalized value coming from llx_user_employment
|
||||
dateemployment date, -- denormalized value coming from llx_user_employment
|
||||
dateemploymentend date, -- denormalized value coming from llx_user_employment
|
||||
weeklyhours double(16,8), -- denormalized value coming from llx_user_employment
|
||||
|
||||
import_key varchar(14), -- import key
|
||||
|
||||
@ -648,7 +648,6 @@ if ($ok && GETPOST('clean_orphelin_dir','alpha'))
|
||||
$object_instance=new ChargeSociales($db);
|
||||
}
|
||||
|
||||
$var=true;
|
||||
foreach($filearray as $key => $file)
|
||||
{
|
||||
if (!is_dir($file['name'])
|
||||
|
||||
@ -94,4 +94,7 @@ YouCanUseTranslationKey=You can use here a key that is the translation key found
|
||||
DropTableIfEmpty=(Delete table if empty)
|
||||
TableDoesNotExists=The table %s does not exists
|
||||
TableDropped=Table %s deleted
|
||||
InitStructureFromExistingTable=Build the structure array string of an existing table
|
||||
InitStructureFromExistingTable=Build the structure array string of an existing table
|
||||
UseAboutPage=Disallow the about page
|
||||
UseDocFolder=Disallow the documentation folder
|
||||
UseSpecificReadme=Use a specific ReadMe
|
||||
@ -604,11 +604,8 @@ else
|
||||
print '<td align="center">'.$langs->trans("QtyReceived").'</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
$var=true;
|
||||
while ($i < $num_prod)
|
||||
{
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
if ($object->lines[$i]->fk_product > 0)
|
||||
{
|
||||
|
||||
@ -104,7 +104,6 @@ if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
$var=true;
|
||||
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
|
||||
@ -167,7 +166,6 @@ if ($resql)
|
||||
$loan_static->ref = $obj->rowid;
|
||||
$loan_static->label = $obj->label;
|
||||
|
||||
$var = !$var;
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Ref
|
||||
|
||||
@ -129,11 +129,9 @@ print '<td colspan="2" align="center">'.$langs->trans("Value").'</td>'."\n";
|
||||
print '<td align="left">'.$langs->trans("Description").'</td>'."\n";
|
||||
print '</tr>';
|
||||
|
||||
$var=true;
|
||||
$form = new Form($db);
|
||||
|
||||
// GLOBAL DISCOUNT MANAGEMENT
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"typemarges\">";
|
||||
@ -165,7 +163,6 @@ print '</tr>';
|
||||
print '</form>';
|
||||
|
||||
// DISPLAY MARGIN RATES
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("DisplayMarginRates").'</td>';
|
||||
print '<td colspan="2" align="center">';
|
||||
@ -189,7 +186,6 @@ print '<td>'.$langs->trans('MarginRate').' = '.$langs->trans('Margin').' / '.$la
|
||||
print '</tr>';
|
||||
|
||||
// DISPLAY MARK RATES
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("DisplayMarkRates").'</td>';
|
||||
print '<td colspan="2" align="center">';
|
||||
@ -259,7 +255,6 @@ print '</tr>';
|
||||
print '</form>';
|
||||
|
||||
// INTERNAL CONTACT TYPE USED AS COMMERCIAL AGENT
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"contact\">";
|
||||
|
||||
@ -208,7 +208,6 @@ if ($result)
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
$var=true;
|
||||
|
||||
while ($i < $num /*&& $i < $conf->liste_limit*/)
|
||||
{
|
||||
@ -229,8 +228,6 @@ if ($result)
|
||||
$markRate = ($pv != 0)?(100 * $marge / $pv):'' ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
if ($agentid > 0) {
|
||||
$companystatic->id=$objp->socid;
|
||||
|
||||
159
htdocs/modulebuilder/admin/setup.php
Normal file
159
htdocs/modulebuilder/admin/setup.php
Normal file
@ -0,0 +1,159 @@
|
||||
<?php
|
||||
/* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.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/modulebuilder/admin/setup.php
|
||||
* \ingroup modulebuilder
|
||||
* \brief Page setup for modulebuilder module
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
|
||||
|
||||
global $conf,$langs,$user, $db;
|
||||
$langs->loadLangs(array("admin", "other", "modulebuilder"));
|
||||
|
||||
if (!$user->admin || empty($conf->modulebuilder->enabled))
|
||||
accessforbidden();
|
||||
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
if($action=="update"){
|
||||
$res1=dolibarr_set_const($db, 'MODULEBUILDER_SPECIFIC_README', GETPOST('MODULEBUILDER_SPECIFIC_README'), 'chaine', 0, '', $conf->entity);
|
||||
if ($res1 < 0)
|
||||
{
|
||||
setEventMessages('ErrorFailedToSaveDate', null, 'errors');
|
||||
$db->rollback();
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages('RecordModifiedSuccessfully', null, 'mesgs');
|
||||
$db->commit();
|
||||
}
|
||||
}
|
||||
|
||||
if (preg_match('/set_(.*)/', $action, $reg)) {
|
||||
$code = $reg[1];
|
||||
$values = GETPOST($code);
|
||||
if (is_array($values))
|
||||
$values = implode(',', $values);
|
||||
|
||||
if (dolibarr_set_const($db, $code, $values, 'chaine', 0, '', $conf->entity) > 0) {
|
||||
header("Location: " . $_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
if (preg_match('/del_(.*)/', $action, $reg)) {
|
||||
$code = $reg[1];
|
||||
if (dolibarr_del_const($db, $code, 0) > 0) {
|
||||
Header("Location: " . $_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
llxHeader('', $langs->trans("ModulebuilderSetup"));
|
||||
|
||||
$linkback = '';
|
||||
if (GETPOST('withtab', 'alpha')) {
|
||||
$linkback = '<a href="' . ($backtopage ? $backtopage : DOL_URL_ROOT . '/admin/modules.php') . '">' . $langs->trans("BackToModuleList") . '</a>';
|
||||
}
|
||||
|
||||
print load_fiche_titre($langs->trans("ModuleSetup") . ' ' . $langs->trans('Modulebuilder'), $linkback);
|
||||
|
||||
if (GETPOST('withtab', 'alpha')) {
|
||||
dol_fiche_head($head, 'modulebuilder', '', -1);
|
||||
}
|
||||
|
||||
|
||||
print '<span class="opacitymedium">' . $langs->trans("ModuleBuilderDesc") . "</span><br>\n";
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>' . $langs->trans("Key") . '</td>';
|
||||
print '<td>' . $langs->trans("Value") . '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>' . $langs->trans("UseAboutPage") . '</td>';
|
||||
print '<td align="center">';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('MODULEBUILDER_USE_ABOUT');
|
||||
} else {
|
||||
if (empty($conf->global->MODULEBUILDER_USE_ABOUT)) {
|
||||
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=set_MODULEBUILDER_USE_ABOUT">' . img_picto($langs->trans("Disabled"), 'off') . '</a>';
|
||||
} else {
|
||||
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=del_MODULEBUILDER_USE_ABOUT">' . img_picto($langs->trans("Enabled"), 'on') . '</a>';
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>' . $langs->trans("UseDocFolder") . '</td>';
|
||||
print '<td align="center">';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('MODULEBUILDER_USE_DOCFOLDER');
|
||||
} else {
|
||||
if (empty($conf->global->MODULEBUILDER_USE_DOCFOLDER)) {
|
||||
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=set_MODULEBUILDER_USE_DOCFOLDER">' . img_picto($langs->trans("Disabled"), 'off') . '</a>';
|
||||
} else {
|
||||
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=del_MODULEBUILDER_USE_DOCFOLDER">' . img_picto($langs->trans("Enabled"), 'on') . '</a>';
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>' . $langs->trans("UseSpecificReadme") . '</td>';
|
||||
print '<td align="center">';
|
||||
print '<textarea cols="100" rows="20" name="MODULEBUILDER_SPECIFIC_README">'.$conf->global->MODULEBUILDER_SPECIFIC_README.'</textarea>';
|
||||
print '</td></tr>';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td colspan="2"><center>';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Update").'" name="Button">';
|
||||
print '</center></td></tr>';
|
||||
print '</table>';
|
||||
|
||||
if (GETPOST('withtab', 'alpha')) {
|
||||
dol_fiche_end();
|
||||
}
|
||||
|
||||
print '<br><br>';
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@ -120,6 +120,13 @@ if ($dirins && $action == 'initmodule' && $modulename)
|
||||
setEventMessages($langs->trans("AllFilesDidAlreadyExist", $srcdir, $destdir), null, 'warnings');
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($conf->global->MODULEBUILDER_USE_ABOUT)){
|
||||
dol_delete_file($destdir.'/admin/about.php');
|
||||
}
|
||||
if(!empty($conf->global->MODULEBUILDER_USE_DOCFOLDER)){
|
||||
dol_delete_dir($destdir.'/doc/');
|
||||
}
|
||||
|
||||
// Delete some files
|
||||
dol_delete_file($destdir.'/myobject_card.php');
|
||||
@ -165,6 +172,11 @@ if ($dirins && $action == 'initmodule' && $modulename)
|
||||
setEventMessages($langs->trans("ErrorFailToMakeReplacementInto", $phpfileval['fullname']), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($conf->global->MODULEBUILDER_SPECIFIC_README)){
|
||||
dol_delete_file($destdir.'/README.md');
|
||||
file_put_contents($destdir.'/README.md', $conf->global->MODULEBUILDER_SPECIFIC_README);
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2018 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* Copyright (C) ---Put here your own copyright and developer email---
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -73,6 +74,9 @@ class modMyModule extends DolibarrModules
|
||||
|
||||
// Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'
|
||||
$this->version = '1.0';
|
||||
|
||||
//Url to the file with your last numberversion of this module
|
||||
$this->url_last_version = 'http://www.example.com/versionmodule.txt';
|
||||
// Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
|
||||
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
||||
// Name of image file used for this module.
|
||||
|
||||
@ -127,7 +127,6 @@ if ($mode == 'setup' && $user->admin)
|
||||
print $langs->trans("PrintingDriverDesc".$driver)."<br><br>\n";
|
||||
|
||||
print '<table class="noborder" width="100%">'."\n";
|
||||
$var=true;
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th>'.$langs->trans("Parameters").'</th>';
|
||||
print '<th>'.$langs->trans("Value").'</th>';
|
||||
@ -146,7 +145,6 @@ if ($mode == 'setup' && $user->admin)
|
||||
$submit_enabled=0;
|
||||
foreach ($printer->conf as $key)
|
||||
{
|
||||
|
||||
switch ($key['type']) {
|
||||
case "text":
|
||||
case "password":
|
||||
@ -248,7 +246,6 @@ if ($mode == 'config' && $user->admin)
|
||||
|
||||
print '<table class="noborder" width="100%">'."\n";
|
||||
|
||||
$var=true;
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th>'.$langs->trans("Description").'</th>';
|
||||
print '<th class="center">'.$langs->trans("Active").'</th>';
|
||||
@ -333,7 +330,6 @@ if ($mode == 'userconf' && $user->admin)
|
||||
print $langs->trans('PrintUserConfDesc'.$driver)."<br><br>\n";
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
$var=true;
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th>'.$langs->trans("User").'</th>';
|
||||
print '<th>'.$langs->trans("PrintModule").'</th>';
|
||||
|
||||
@ -401,7 +401,6 @@ print "</tr>\n";
|
||||
|
||||
clearstatcache();
|
||||
|
||||
$var=true;
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
foreach (array('','/doc') as $valdir)
|
||||
@ -438,7 +437,6 @@ foreach ($dirmodels as $reldir)
|
||||
|
||||
if ($modulequalified)
|
||||
{
|
||||
$var = !$var;
|
||||
print '<tr class="oddeven"><td width="100">';
|
||||
print (empty($module->name)?$name:$module->name);
|
||||
print "</td><td>\n";
|
||||
@ -524,12 +522,10 @@ print "<br>";
|
||||
print load_fiche_titre($langs->trans("ProductOtherConf"), '', '');
|
||||
|
||||
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="other">';
|
||||
|
||||
$var=true;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Parameters").'</td>'."\n";
|
||||
@ -569,7 +565,6 @@ print '</tr>';
|
||||
// multiprix nombre de prix a proposer
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES) || ! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES))
|
||||
{
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("MultiPricesNumPrices").'</td>';
|
||||
print '<td align="right"><input size="3" type="text" class="flat" name="value_PRODUIT_MULTIPRICES_LIMIT" value="'.$conf->global->PRODUIT_MULTIPRICES_LIMIT.'"></td>';
|
||||
@ -611,7 +606,6 @@ print '</tr>';
|
||||
|
||||
if (empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT))
|
||||
{
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("NumberOfProductShowInSelect").'</td>';
|
||||
print '<td align="right"><input size="3" type="text" class="flat" name="value_PRODUIT_LIMIT_SIZE" value="'.$conf->global->PRODUIT_LIMIT_SIZE.'"></td>';
|
||||
@ -619,7 +613,6 @@ if (empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT))
|
||||
}
|
||||
|
||||
// Visualiser description produit dans les formulaires activation/desactivation
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("ViewProductDescInFormAbility").'</td>';
|
||||
print '<td width="60" align="right">';
|
||||
@ -652,7 +645,6 @@ print '</tr>';
|
||||
// View product description in thirdparty language
|
||||
if (! empty($conf->global->MAIN_MULTILANGS))
|
||||
{
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("ViewProductDescInThirdpartyLanguageAbility").'</td>';
|
||||
print '<td width="60" align="right">';
|
||||
|
||||
@ -294,8 +294,6 @@ if (empty($mysoc->country_code))
|
||||
else
|
||||
{
|
||||
|
||||
$var=true;
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
|
||||
print '<input type="hidden" name="action" value="convert" />';
|
||||
|
||||
@ -89,10 +89,9 @@ if (empty($conf) || ! is_object($conf))
|
||||
<!-- FIELDS DATA -->
|
||||
|
||||
<?php
|
||||
$var=true;
|
||||
foreach($datas as $line) {
|
||||
?>
|
||||
<tr <?php echo $bc[$var]; ?>>
|
||||
<tr class="oddeven">
|
||||
<?php
|
||||
foreach($line as $key => $value) {
|
||||
foreach($fieldlist as $field) {
|
||||
|
||||
@ -551,7 +551,6 @@ if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i=0;
|
||||
$var=true;
|
||||
|
||||
if($num == 0) print '<tr><td colspan="4">'.$langs->trans("NoMatchFound").'</td></tr>';
|
||||
|
||||
@ -655,7 +654,6 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -759,12 +759,9 @@ SCRIPT;
|
||||
|
||||
if (is_array($product_fourn_list))
|
||||
{
|
||||
$var=true;
|
||||
|
||||
foreach($product_fourn_list as $productfourn)
|
||||
{
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Supplier
|
||||
|
||||
@ -457,8 +457,6 @@ function activitytrim($product_type)
|
||||
}
|
||||
$i = 0;
|
||||
|
||||
$var=true;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
@ -466,7 +464,6 @@ function activitytrim($product_type)
|
||||
{
|
||||
if ($trim1+$trim2+$trim3+$trim4 > 0)
|
||||
{
|
||||
|
||||
print '<tr class="oddeven"><td align=left>'.$tmpyear.'</td>';
|
||||
print '<td align=right>'.price($trim1).'</td>';
|
||||
print '<td align=right>'.price($trim2).'</td>';
|
||||
@ -500,7 +497,6 @@ function activitytrim($product_type)
|
||||
}
|
||||
if ($trim1+$trim2+$trim3+$trim4 > 0)
|
||||
{
|
||||
|
||||
print '<tr class="oddeven"><td align=left>'.$tmpyear.'</td>';
|
||||
print '<td align=right>'.price($trim1).'</td>';
|
||||
print '<td align=right>'.price($trim2).'</td>';
|
||||
|
||||
@ -334,8 +334,6 @@ $buttonrecordnoent=$langs->transnoentitiesnoconv("RecordMovement");
|
||||
print '<span class="opacitymedium">'.$langs->trans("SelectProductInAndOutWareHouse",$titletoaddnoent,$buttonrecordnoent).'</span><br>';
|
||||
print '<br>'."\n";
|
||||
|
||||
$var=true;
|
||||
|
||||
// Form to add a line
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formulaire">';
|
||||
print '<input type="hidden" name="token" value="' .$_SESSION['newtoken'] . '">';
|
||||
@ -402,8 +400,6 @@ print '</tr>';
|
||||
|
||||
foreach($listofdata as $key => $val)
|
||||
{
|
||||
|
||||
|
||||
$productstatic->fetch($val['id_product']);
|
||||
$warehousestatics->fetch($val['id_sw']);
|
||||
$warehousestatict->fetch($val['id_tw']);
|
||||
|
||||
@ -1027,7 +1027,15 @@ if ($resql)
|
||||
if (! empty($arrayfields['m.inventorycode']['checked']))
|
||||
{
|
||||
// Inventory code
|
||||
print '<td>'.$objp->inventorycode.'</td>';
|
||||
print '<td>'.'<a href="'
|
||||
.DOL_URL_ROOT.'/product/stock/mouvement.php'
|
||||
.'?id='.$objp->entrepot_id
|
||||
.'&search_inventorycode='.$objp->inventorycode
|
||||
.'&search_type_mouvement='.$objp->type_mouvement
|
||||
.'">'
|
||||
.$objp->inventorycode
|
||||
.'</a>'
|
||||
.'</td>';
|
||||
}
|
||||
if (! empty($arrayfields['m.label']['checked']))
|
||||
{
|
||||
|
||||
@ -396,14 +396,12 @@ if ($resql)
|
||||
$productlot = new Productlot($db);
|
||||
|
||||
$i=0;
|
||||
$var=true;
|
||||
$totalarray=array();
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj)
|
||||
{
|
||||
$var = !$var;
|
||||
|
||||
$productlot->id = $obj->rowid;
|
||||
$productlot->batch = $obj->batch;
|
||||
|
||||
@ -997,6 +997,179 @@ class Thirdparties extends DolibarrApi
|
||||
|
||||
return $result;
|
||||
}
|
||||
/**
|
||||
* Get CompanyBankAccount objects for thirdparty
|
||||
*
|
||||
* @param int $socid Thirdparty id
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function getCompanyBankAccount($socid){
|
||||
|
||||
global $db, $conf;
|
||||
|
||||
if(! DolibarrApiAccess::$user->rights->facture->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
if(empty($socid)) {
|
||||
throw new RestException(400, 'Thirdparty ID is mandatory');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('societe',$socid)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
/**
|
||||
* We select all the records that match the socid
|
||||
*/
|
||||
|
||||
$sql = "SELECT rowid, fk_soc, bank, number, code_banque, code_guichet, cle_rib, bic, iban_prefix as iban, domiciliation, proprio,";
|
||||
$sql.= " owner_address, default_rib, label, datec, tms as datem, rum, frstrecur";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe_rib";
|
||||
if ($socid) $sql.= " WHERE fk_soc = ".$socid." ";
|
||||
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
if($result->num_rows == 0 ){
|
||||
throw new RestException(404, 'Account not found');
|
||||
}
|
||||
|
||||
$i=0;
|
||||
|
||||
$accounts =[];
|
||||
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$account = new CompanyBankAccount($db);
|
||||
if($account->fetch($obj->rowid)) {
|
||||
$accounts[] = $account;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else{
|
||||
throw new RestException(404, 'Account not found');
|
||||
}
|
||||
|
||||
|
||||
$fields = ['socid', 'default_rib', 'frstrecur', '1000110000001', 'datec', 'datem', 'label', 'bank', 'bic', 'iban', 'id'];
|
||||
|
||||
$returnAccounts = [];
|
||||
|
||||
foreach($accounts as $account){
|
||||
$object= [];
|
||||
foreach($account as $key => $value)
|
||||
if(in_array($key, $fields)){
|
||||
$object[$key] = $value;
|
||||
|
||||
}
|
||||
$returnAccounts[] = $object;
|
||||
}
|
||||
|
||||
return $returnAccounts;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create CompanyBankAccount object for thirdparty
|
||||
* @param int $socid thirdparty id
|
||||
* @param array $request_data Request datas
|
||||
*
|
||||
* @return object ID of thirdparty
|
||||
*
|
||||
* @url POST {socid}/CompanyBankAccount
|
||||
*/
|
||||
function createCompanyBankAccount($socid, $request_data = null)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->societe->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$account = new CompanyBankAccount($this->db);
|
||||
|
||||
$account->socid = $socid;
|
||||
|
||||
foreach($request_data as $field => $value) {
|
||||
$account->$field = $value;
|
||||
}
|
||||
|
||||
if ($account->create(DolibarrApiAccess::$user) < 0)
|
||||
throw new RestException(500, 'Error creating Company Bank account');
|
||||
|
||||
|
||||
if ($account->update(DolibarrApiAccess::$user) < 0)
|
||||
throw new RestException(500, 'Error updating values');
|
||||
|
||||
return $account;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update CompanyBankAccount object for thirdparty
|
||||
*
|
||||
* @param int $socid Thirdparty id
|
||||
* @param int $id CompanyBankAccount's id
|
||||
* @param array $request_data Request datas
|
||||
*
|
||||
* @return object ID of thirdparty
|
||||
*
|
||||
* @url PUT {socid}/CompanyBankAccount/{id}
|
||||
*/
|
||||
function updateCompanyBankAccount($socid, $id, $request_data = null)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->societe->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$account = new CompanyBankAccount($this->db);
|
||||
|
||||
$account->fetchFromApi($id, $socid);
|
||||
|
||||
|
||||
|
||||
if($account->socid != $socid){
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
|
||||
foreach($request_data as $field => $value) {
|
||||
$account->$field = $value;
|
||||
}
|
||||
|
||||
if ($account->update(DolibarrApiAccess::$user) < 0)
|
||||
throw new RestException(500, 'Error updating values');
|
||||
|
||||
return $account;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id CompanyBankAccount's id
|
||||
* @param int $socid Thirdparty id
|
||||
*
|
||||
* @return int -1 if error 1 if correct deletion
|
||||
*
|
||||
* @url DELETE {socid}/CompanyBankAccount/{id}
|
||||
*/
|
||||
function deleteCompanyBankAccount($id, $socid){
|
||||
|
||||
if(! DolibarrApiAccess::$user->rights->societe->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$account = new CompanyBankAccount($this->db);
|
||||
|
||||
$account->fetch($id);
|
||||
|
||||
if(!$account->socid == $socid)
|
||||
throw new RestException(401);
|
||||
|
||||
return $account->delete(DolibarrApiAccess::$user);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -250,6 +250,63 @@ class CompanyBankAccount extends Account
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load record from database for the API
|
||||
*
|
||||
* @param int $id Id of record
|
||||
* @param int $socid Id of company. If this is filled, function will return the first default RIB of company
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetchFromApi($id, $socid=0)
|
||||
{
|
||||
if (empty($id) && empty($socid)) return -1;
|
||||
|
||||
$sql = "SELECT rowid, fk_soc, bank, number, code_banque, code_guichet, cle_rib, bic, iban_prefix as iban, domiciliation, proprio,";
|
||||
$sql.= " owner_address, default_rib, label, datec, tms as datem, rum, frstrecur";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe_rib";
|
||||
if ($id) $sql.= " WHERE rowid = ".$id;
|
||||
if ($socid) $sql.= " AND fk_soc = ".$socid;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($this->db->num_rows($resql))
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->ref = $obj->fk_soc.'-'.$obj->label; // Generate an artificial ref
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
$this->type = $obj->type;
|
||||
$this->socid = $obj->fk_soc;
|
||||
$this->bank = $obj->bank;
|
||||
$this->code_banque = $obj->code_banque;
|
||||
$this->code_guichet = $obj->code_guichet;
|
||||
$this->number = $obj->number;
|
||||
$this->cle_rib = $obj->cle_rib;
|
||||
$this->bic = $obj->bic;
|
||||
$this->iban = $obj->iban;
|
||||
$this->domiciliation = $obj->domiciliation;
|
||||
$this->proprio = $obj->proprio;
|
||||
$this->owner_address = $obj->owner_address;
|
||||
$this->label = $obj->label;
|
||||
$this->default_rib = $obj->default_rib;
|
||||
$this->datec = $this->db->jdate($obj->datec);
|
||||
$this->datem = $this->db->jdate($obj->datem);
|
||||
$this->rum = $obj->rum;
|
||||
$this->frstrecur = $obj->frstrecur;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a rib from database
|
||||
*
|
||||
|
||||
@ -36,12 +36,11 @@ $langs = $GLOBALS['langs'];
|
||||
$linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
|
||||
|
||||
$total=0; $ilink=0;
|
||||
$var=true;
|
||||
foreach($linkedObjectBlock as $key => $objectlink)
|
||||
{
|
||||
$ilink++;
|
||||
|
||||
$trclass=($var?'pair':'impair');
|
||||
$trclass='oddeven';
|
||||
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
|
||||
?>
|
||||
<tr class="<?php echo $trclass; ?>">
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2015-2017 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2015 Charlie Benke <charlie@patas-monkey.com>
|
||||
* Copyright (C) 2015-2018 Charlene Benke <charlie@patas-monkey.com>
|
||||
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -219,6 +219,9 @@ if (empty($reshook)) {
|
||||
$dateemployment = dol_mktime(0, 0, 0, GETPOST('dateemploymentmonth'), GETPOST('dateemploymentday'), GETPOST('dateemploymentyear'));
|
||||
$object->dateemployment = $dateemployment;
|
||||
|
||||
$dateemploymentend = dol_mktime(0, 0, 0, GETPOST('dateemploymentendmonth'), GETPOST('dateemploymentendday'), GETPOST('dateemploymentendyear'));
|
||||
$object->dateemploymentend = $dateemploymentend;
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost($extralabels, $object);
|
||||
if ($ret < 0) {
|
||||
@ -361,6 +364,8 @@ if (empty($reshook)) {
|
||||
$object->color = GETPOST("color",'alpha') != '' ? GETPOST("color",'alpha') : '';
|
||||
$dateemployment = dol_mktime(0, 0, 0, GETPOST('dateemploymentmonth','int'), GETPOST('dateemploymentday','int'), GETPOST('dateemploymentyear','int'));
|
||||
$object->dateemployment = $dateemployment;
|
||||
$dateemploymentend = dol_mktime(0, 0, 0, GETPOST('dateemploymentendmonth','int'), GETPOST('dateemploymentendday','int'), GETPOST('dateemploymentendyear','int'));
|
||||
$object->dateemploymentend = $dateemploymentend;
|
||||
|
||||
if (! empty($conf->multicompany->enabled))
|
||||
{
|
||||
@ -1156,6 +1161,13 @@ if ($action == 'create' || $action == 'adduserldap')
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Date employment END
|
||||
print '<tr><td>'.$langs->trans("DateEmploymentEnd").'</td>';
|
||||
print '<td>';
|
||||
echo $form->select_date(GETPOST('dateemploymentend'),'dateemploymentend',0,0,1,'form'.'dateemploymentend',1,0,1);
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Date birth
|
||||
print '<tr><td>'.$langs->trans("DateToBirth").'</td>';
|
||||
print '<td>';
|
||||
@ -1502,6 +1514,13 @@ else
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Date employment
|
||||
print '<tr><td>'.$langs->trans("DateEmploymentEnd").'</td>';
|
||||
print '<td>';
|
||||
print dol_print_date($object->dateemploymentend);
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Date of birth
|
||||
print '<tr><td>'.$langs->trans("DateToBirth").'</td>';
|
||||
print '<td>';
|
||||
@ -2432,6 +2451,14 @@ else
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Date employmentEnd
|
||||
print '<tr><td>'.$langs->trans("DateEmploymentEnd").'</td>';
|
||||
print '<td>';
|
||||
echo $form->select_date(GETPOST('dateemploymentend')?GETPOST('dateemploymentend'):$object->dateemploymentend,'dateemploymentend',0,0,1,'form'.'dateemploymentend',1,0,1);
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
// Date birth
|
||||
print '<tr><td>'.$langs->trans("DateToBirth").'</td>';
|
||||
print '<td>';
|
||||
|
||||
@ -10,7 +10,8 @@
|
||||
* Copyright (C) 2013-2014 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* Copyright (C) 2018 charlene Benke <charlie@patas-monkey.com>
|
||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.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
|
||||
@ -132,6 +133,7 @@ class User extends CommonObject
|
||||
public $color; // Define background color for user in agenda
|
||||
|
||||
public $dateemployment; // Define date of employment by company
|
||||
public $dateemploymentend; // Define date of employment end by company
|
||||
|
||||
public $default_c_exp_tax_cat;
|
||||
public $default_range;
|
||||
@ -208,7 +210,7 @@ class User extends CommonObject
|
||||
$sql.= " u.salaryextra,";
|
||||
$sql.= " u.weeklyhours,";
|
||||
$sql.= " u.color,";
|
||||
$sql.= " u.dateemployment,";
|
||||
$sql.= " u.dateemployment, u.dateemploymentend,";
|
||||
$sql.= " u.ref_int, u.ref_ext,";
|
||||
$sql.= " u.default_range, u.default_c_exp_tax_cat,"; // Expense report default mode
|
||||
$sql.= " c.code as country_code, c.label as country,";
|
||||
@ -311,6 +313,7 @@ class User extends CommonObject
|
||||
$this->weeklyhours = $obj->weeklyhours;
|
||||
$this->color = $obj->color;
|
||||
$this->dateemployment = $this->db->jdate($obj->dateemployment);
|
||||
$this->dateemploymentend = $this->db->jdate($obj->dateemploymentend);
|
||||
|
||||
$this->datec = $this->db->jdate($obj->datec);
|
||||
$this->datem = $this->db->jdate($obj->datem);
|
||||
@ -1383,6 +1386,7 @@ class User extends CommonObject
|
||||
$this->accountancy_code = trim($this->accountancy_code);
|
||||
$this->color = empty($this->color)?'':$this->color;
|
||||
$this->dateemployment = empty($this->dateemployment)?'':$this->dateemployment;
|
||||
$this->dateemploymentend = empty($this->dateemploymentend)?'':$this->dateemploymentend;
|
||||
|
||||
// Check parameters
|
||||
if (! empty($conf->global->USER_MAIL_REQUIRED) && ! isValidEMail($this->email))
|
||||
@ -1425,6 +1429,7 @@ class User extends CommonObject
|
||||
$sql.= ", accountancy_code = '".$this->db->escape($this->accountancy_code)."'";
|
||||
$sql.= ", color = '".$this->db->escape($this->color)."'";
|
||||
$sql.= ", dateemployment=".(strval($this->dateemployment)!='' ? "'".$this->db->idate($this->dateemployment)."'" : 'null');
|
||||
$sql.= ", dateemploymentend=".(strval($this->dateemploymentend)!='' ? "'".$this->db->idate($this->dateemploymentend)."'" : 'null');
|
||||
$sql.= ", note = '".$this->db->escape($this->note)."'";
|
||||
$sql.= ", photo = ".($this->photo?"'".$this->db->escape($this->photo)."'":"null");
|
||||
$sql.= ", openid = ".($this->openid?"'".$this->db->escape($this->openid)."'":"null");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user