Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into develop
This commit is contained in:
commit
62ab67f403
15
build/README
15
build/README
@ -16,18 +16,20 @@ Note: Prerequisites to build tgz, debian, rpm package
|
||||
> apt-get install tar dpkg dpatch p7zip-full rpm zip
|
||||
|
||||
Note: Prerequisites to build autoexe DoliWamp package:
|
||||
> apt-get install wine q4wine
|
||||
> Launch "wine cmd" to check a drive Z: pointing to / exists.
|
||||
> Install InnoSetup
|
||||
For example by running isetup-5.3.9.exe (http://www.jrsoftware.org)
|
||||
> Install WampServer into "C:\Program Files\Wamp"
|
||||
For example by running wampserver2.2e-php5.4.3-httpd-2.4.2-mysql5.5.24-x64.exe (http://www.wampserver.com)
|
||||
> Install WampServer addon to have versions: Apache2.2.11, Mysql5.0.45, Php5.3.0
|
||||
For example by running WampServer2-APACHE2211.exe (http://www.wampserver.com)
|
||||
For example by running wampserver2.5-Apache-2.4.9-Mysql-5.6.17-php5.5.12-32b.exe (http://www.wampserver.com)
|
||||
> Install WampServer addon to have versions: Mysql5.0.45
|
||||
For example by running WampServer2-MYSQL5045.exe (http://www.wampserver.com)
|
||||
For example by running WampServer2-PHP530.exe (http://www.wampserver.com)
|
||||
> To build from Windows (running from makepack-dolibarr.pl script is however
|
||||
recommanded), open file build/exe/doliwamp.iss and click on button "Compile".
|
||||
The .exe file will be build into directory build.
|
||||
|
||||
> Add path to ISCC into PATH windows var:
|
||||
Launch wine cmd, then regedit and add entry int HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment\PATH
|
||||
|
||||
- To build a theme package, launch the script
|
||||
> perl makepack-dolibarrtheme.pl
|
||||
|
||||
@ -46,9 +48,6 @@ generated packages will not contains this "build" directory.
|
||||
|
||||
We can find in "build", following sub-directories:
|
||||
|
||||
* aps:
|
||||
To build APS package.
|
||||
|
||||
* debian:
|
||||
To build Debian package.
|
||||
|
||||
|
||||
@ -5,4 +5,4 @@ DOLIWAMP Package tools
|
||||
|
||||
This directory contains files used by makepack-dolibarr.pl
|
||||
script to build the all-in-on .EXE package DoliWamp, ready
|
||||
to be distributedt (for Windows).
|
||||
to be distributed (for Windows).
|
||||
@ -32,7 +32,7 @@ AppPublisherURL=https://www.nltechno.com
|
||||
AppSupportURL=https://www.dolibarr.org
|
||||
AppUpdatesURL=https://www.dolibarr.org
|
||||
AppComments=DoliWamp includes Dolibarr, Apache, PHP and Mysql softwares.
|
||||
AppCopyright=Copyright (C) 2008-2018 Laurent Destailleur (NLTechno), Fabian Rodriguez (Le Goût du Libre)
|
||||
AppCopyright=Copyright (C) 2008-2019 Laurent Destailleur (NLTechno), Fabian Rodriguez (Le Goût du Libre)
|
||||
DefaultDirName=c:\dolibarr
|
||||
DefaultGroupName=Dolibarr
|
||||
;LicenseFile=COPYING
|
||||
|
||||
@ -1058,7 +1058,7 @@ if ($nboftargetok) {
|
||||
$ret=`cat "$SOURCE/build/exe/doliwamp/doliwamp.iss" | sed -e 's/__FILENAMEEXEDOLIWAMP__/$FILENAMEEXEDOLIWAMP/g' > "$SOURCE/build/exe/doliwamp/doliwamp.tmp.iss"`;
|
||||
|
||||
print "Compil exe $FILENAMEEXEDOLIWAMP.exe file from iss file \"$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.tmp.iss\"\n";
|
||||
$cmd= "ISCC.exe \"Z:$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.tmp.iss\"";
|
||||
$cmd= "wine ISCC.exe \"Z:$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.tmp.iss\"";
|
||||
print "$cmd\n";
|
||||
$ret= `$cmd`;
|
||||
#print "$ret\n";
|
||||
|
||||
@ -1418,6 +1418,7 @@ class BookKeeping extends CommonObject
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
global $user;
|
||||
|
||||
$error = 0;
|
||||
$object = new BookKeeping($this->db);
|
||||
|
||||
@ -1432,6 +1433,7 @@ class BookKeeping extends CommonObject
|
||||
// ...
|
||||
|
||||
// Create clone
|
||||
$object->context['createfromclone'] = 'createfromclone';
|
||||
$result = $object->create($user);
|
||||
|
||||
// Other options
|
||||
@ -1441,6 +1443,8 @@ class BookKeeping extends CommonObject
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
}
|
||||
|
||||
unset($object->context['createfromclone']);
|
||||
|
||||
// End
|
||||
if (! $error) {
|
||||
$this->db->commit();
|
||||
@ -1449,7 +1453,7 @@ class BookKeeping extends CommonObject
|
||||
} else {
|
||||
$this->db->rollback();
|
||||
|
||||
return - 1;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -55,6 +55,7 @@ class Subscription extends CommonObject
|
||||
/**
|
||||
* @var int ID
|
||||
*/
|
||||
public $fk_type;
|
||||
public $fk_adherent;
|
||||
|
||||
public $amount;
|
||||
@ -102,8 +103,17 @@ class Subscription extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."subscription (fk_adherent, datec, dateadh, datef, subscription, note)";
|
||||
$sql.= " VALUES (".$this->fk_adherent.", '".$this->db->idate($this->datec)."',";
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."subscription (fk_adherent, fk_type, datec, dateadh, datef, subscription, note)";
|
||||
|
||||
if ($this->fk_type == null) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
|
||||
$member=new Adherent($this->db);
|
||||
$result=$member->fetch($this->fk_adherent);
|
||||
$type=$member->typeid;
|
||||
} else {
|
||||
$type=$this->fk_type;
|
||||
}
|
||||
$sql.= " VALUES (".$this->fk_adherent.", '".$type."', '".$this->db->idate($now)."',";
|
||||
$sql.= " '".$this->db->idate($this->dateh)."',";
|
||||
$sql.= " '".$this->db->idate($this->datef)."',";
|
||||
$sql.= " ".$this->amount.",";
|
||||
@ -147,7 +157,7 @@ class Subscription extends CommonObject
|
||||
*/
|
||||
function fetch($rowid)
|
||||
{
|
||||
$sql ="SELECT rowid, fk_adherent, datec,";
|
||||
$sql ="SELECT rowid, fk_type, fk_adherent, datec,";
|
||||
$sql.=" tms,";
|
||||
$sql.=" dateadh as dateh,";
|
||||
$sql.=" datef,";
|
||||
@ -166,6 +176,7 @@ class Subscription extends CommonObject
|
||||
$this->id = $obj->rowid;
|
||||
$this->ref = $obj->rowid;
|
||||
|
||||
$this->fk_type = $obj->fk_type;
|
||||
$this->fk_adherent = $obj->fk_adherent;
|
||||
$this->datec = $this->db->jdate($obj->datec);
|
||||
$this->datem = $this->db->jdate($obj->tms);
|
||||
@ -203,6 +214,7 @@ class Subscription extends CommonObject
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."subscription SET ";
|
||||
$sql .= " fk_type = ".$this->fk_type.",";
|
||||
$sql .= " fk_adherent = ".$this->fk_adherent.",";
|
||||
$sql .= " note=".($this->note ? "'".$this->db->escape($this->note)."'" : 'null').",";
|
||||
$sql .= " subscription = '".price2num($this->amount)."',";
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
|
||||
if (! empty($conf->banque->enabled)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
@ -34,6 +35,7 @@ if (! empty($conf->banque->enabled)) {
|
||||
$langs->loadLangs(array("companies","members","bills","users"));
|
||||
|
||||
$adh = new Adherent($db);
|
||||
$adht = new AdherentType($db);
|
||||
$object = new Subscription($db);
|
||||
$errmsg='';
|
||||
|
||||
@ -102,6 +104,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'update' && ! $canc
|
||||
// Modifie valeures
|
||||
$object->dateh=dol_mktime($_POST['datesubhour'], $_POST['datesubmin'], 0, $_POST['datesubmonth'], $_POST['datesubday'], $_POST['datesubyear']);
|
||||
$object->datef=dol_mktime($_POST['datesubendhour'], $_POST['datesubendmin'], 0, $_POST['datesubendmonth'], $_POST['datesubendday'], $_POST['datesubendyear']);
|
||||
$object->fk_type=$_POST["typeid"];
|
||||
$object->note=$_POST["note"];
|
||||
$object->amount=$_POST["amount"];
|
||||
//print 'datef='.$object->datef.' '.$_POST['datesubendday'];
|
||||
@ -202,6 +205,12 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit')
|
||||
print $form->showrefnav($object, 'rowid', $linkback, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Type
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("Type").'</td><td class="valeur" colspan="3">';
|
||||
print $form->selectarray("typeid", $adht->liste_array(), (isset($_POST["typeid"])?$_POST["typeid"]:$object->fk_type));
|
||||
print'</td></tr>';
|
||||
|
||||
// Member
|
||||
$adh->ref=$adh->getFullName($langs);
|
||||
print '<tr>';
|
||||
@ -299,6 +308,18 @@ if ($rowid && $action != 'edit')
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Type
|
||||
print '<tr>';
|
||||
print '<td class="titlefield">'.$langs->trans("Type").'</td>';
|
||||
print '<td class="valeur">';
|
||||
if ( ! empty($object->fk_type) ) {
|
||||
$adht->fetch($object->fk_type);
|
||||
print $adht->getNomUrl(1);
|
||||
} else {
|
||||
print $langs->trans("NoType");
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Member
|
||||
$adh->ref=$adh->getFullName($langs);
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
|
||||
@ -38,6 +39,7 @@ $toselect = GETPOST('toselect', 'array');
|
||||
$filter=GETPOST("filter","alpha");
|
||||
$statut=(GETPOSTISSET("statut")?GETPOST("statut","alpha"):1);
|
||||
$search_ref=GETPOST('search_ref','alpha');
|
||||
$search_type=GETPOST('search_type','alpha');
|
||||
$search_lastname=GETPOST('search_lastname','alpha');
|
||||
$search_firstname=GETPOST('search_firstname','alpha');
|
||||
$search_login=GETPOST('search_login','alpha');
|
||||
@ -74,10 +76,11 @@ $fieldstosearchall = array(
|
||||
);
|
||||
$arrayfields=array(
|
||||
'd.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
|
||||
'd.fk_type'=>array('label'=>$langs->trans("Type"), 'checked'=>1),
|
||||
'd.lastname'=>array('label'=>$langs->trans("Lastname"), 'checked'=>1),
|
||||
'd.firstname'=>array('label'=>$langs->trans("Firstname"), 'checked'=>1),
|
||||
'd.login'=>array('label'=>$langs->trans("Login"), 'checked'=>1),
|
||||
't.libelle'=>array('label'=>$langs->trans("Type"), 'checked'=>1),
|
||||
't.libelle'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
|
||||
'd.bank'=>array('label'=>$langs->trans("BankAccount"), 'checked'=>1, 'enabled'=>(! empty($conf->banque->enabled))),
|
||||
/*'d.note_public'=>array('label'=>$langs->trans("NotePublic"), 'checked'=>0),
|
||||
'd.note_private'=>array('label'=>$langs->trans("NotePrivate"), 'checked'=>0),*/
|
||||
@ -112,16 +115,17 @@ if (empty($reshook))
|
||||
// Purge search criteria
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search="";
|
||||
$search_ref="";
|
||||
$search_lastname="";
|
||||
$search_firstname="";
|
||||
$search_login="";
|
||||
$search_note="";
|
||||
$search_amount="";
|
||||
$search_account="";
|
||||
$toselect='';
|
||||
$search_array_options=array();
|
||||
$search="";
|
||||
$search_type="";
|
||||
$search_ref="";
|
||||
$search_lastname="";
|
||||
$search_firstname="";
|
||||
$search_login="";
|
||||
$search_note="";
|
||||
$search_amount="";
|
||||
$search_account="";
|
||||
$toselect='';
|
||||
$search_array_options=array();
|
||||
}
|
||||
}
|
||||
|
||||
@ -139,7 +143,7 @@ $now=dol_now();
|
||||
|
||||
// List of subscriptions
|
||||
$sql = "SELECT d.rowid, d.login, d.firstname, d.lastname, d.societe, d.photo,";
|
||||
$sql.= " c.rowid as crowid, c.subscription,";
|
||||
$sql.= " c.rowid as crowid, c.fk_type, c.subscription,";
|
||||
$sql.= " c.dateadh, c.datef, c.datec as date_creation, c.tms as date_update,";
|
||||
$sql.= " c.fk_bank as bank, c.note,";
|
||||
$sql.= " b.fk_account";
|
||||
@ -157,6 +161,7 @@ if ($search_ref)
|
||||
if (is_numeric($search_ref)) $sql.= " AND (c.rowid = ".$db->escape($search_ref).")";
|
||||
else $sql.=" AND 1 = 2"; // Always wrong
|
||||
}
|
||||
if ($search_type) $sql.= natural_search(array('c.fk_type'), $search_type);
|
||||
if ($search_lastname) $sql.= natural_search(array('d.lastname','d.societe'), $search_lastname);
|
||||
if ($search_firstname) $sql.= natural_search(array('d.firstname'), $search_firstname);
|
||||
if ($search_login) $sql.= natural_search('d.login', $search_login);
|
||||
@ -220,6 +225,7 @@ $param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
||||
if ($statut != '') $param.="&statut=".urlencode($statut);
|
||||
if ($search_type) $param.="&search_type=".urlencode($search_type);
|
||||
if ($date_select) $param.="&date_select=".urlencode($date_select);
|
||||
if ($search_lastname) $param.="&search_lastname=".urlencode($search_lastname);
|
||||
if ($search_login) $param.="&search_login=".urlencode($search_login);
|
||||
@ -297,6 +303,14 @@ if (! empty($arrayfields['d.ref']['checked']))
|
||||
print '<input class="flat" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'" size="4"></td>';
|
||||
}
|
||||
|
||||
// Type
|
||||
if (! empty($arrayfields['d.fk_type']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_type" value="'.dol_escape_htmltag($search_type).'" size="7">';
|
||||
print'</td>';
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['d.lastname']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
@ -379,6 +393,10 @@ if (! empty($arrayfields['d.ref']['checked']))
|
||||
{
|
||||
print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"c.rowid",$param,"","",$sortfield,$sortorder);
|
||||
}
|
||||
if (! empty($arrayfields['d.fk_type']['checked']))
|
||||
{
|
||||
print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"c.fk_type",$param,"","",$sortfield,$sortorder);
|
||||
}
|
||||
if (! empty($arrayfields['d.lastname']['checked']))
|
||||
{
|
||||
print_liste_field_titre("LastName",$_SERVER["PHP_SELF"],"d.lastname",$param,"","",$sortfield,$sortorder);
|
||||
@ -441,7 +459,9 @@ while ($i < min($num, $limit))
|
||||
$adherent->statut=$obj->statut;
|
||||
$adherent->login=$obj->login;
|
||||
$adherent->photo=$obj->photo;
|
||||
|
||||
|
||||
$adht = new AdherentType($db);
|
||||
$adht->fetch($obj->fk_type);
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
@ -451,6 +471,14 @@ while ($i < min($num, $limit))
|
||||
print '<td>'.$subscription->getNomUrl(1).'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Type
|
||||
if (! empty($arrayfields['d.fk_type']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
if ( ! empty($obj->fk_type) ) print $adht->getNomUrl(1);
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Lastname
|
||||
if (! empty($arrayfields['d.lastname']['checked']))
|
||||
@ -568,8 +596,8 @@ if (isset($totalarray['pos']))
|
||||
{
|
||||
if ($i == 1)
|
||||
{
|
||||
if ($num < $limit) print '<td class="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
}
|
||||
else print '<td></td>';
|
||||
}
|
||||
|
||||
@ -65,7 +65,7 @@ class Dolistore
|
||||
|
||||
$langtmp = explode('_', $langs->defaultlang);
|
||||
$lang = $langtmp[0];
|
||||
$lang_array = array('en'=>1, 'fr'=>2, 'es'=>3, 'it'=>4, 'de'=>5); // Into table ps_lang of Prestashop - 1
|
||||
$lang_array = array('en'=>0, 'fr'=>1, 'es'=>2, 'it'=>3, 'de'=>4); // Into table ps_lang of Prestashop - 1
|
||||
if (! in_array($lang, array_keys($lang_array))) $lang = 'en';
|
||||
$this->lang = $lang_array[$lang];
|
||||
}
|
||||
|
||||
@ -238,6 +238,8 @@ class Asset extends CommonObject
|
||||
$this->errors = $object->errors;
|
||||
}
|
||||
|
||||
unset($object->context['createfromclone']);
|
||||
|
||||
// End
|
||||
if (!$error) {
|
||||
$this->db->commit();
|
||||
|
||||
@ -215,8 +215,7 @@ class Facturation
|
||||
$total_localtax1 = 0;
|
||||
$total_localtax2 = 0;
|
||||
|
||||
$tab=array();
|
||||
$tab = $_SESSION['poscart'];
|
||||
$tab = (! empty($_SESSION['poscart'])?$_SESSION['poscart']:array());
|
||||
|
||||
$tab_size=count($tab);
|
||||
for($i=0;$i < $tab_size;$i++)
|
||||
|
||||
@ -41,6 +41,8 @@ if ( $_SESSION['uid'] > 0 )
|
||||
$usertxt=GETPOST('user','',1);
|
||||
$err=GETPOST("err");
|
||||
|
||||
// Instantiate hooks of thirdparty module only if not already define
|
||||
$hookmanager->initHooks(array('cashdeskloginpage'));
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -51,6 +53,15 @@ $formproduct=new FormProduct($db);
|
||||
|
||||
$arrayofcss=array('/cashdesk/css/style.css');
|
||||
top_htmlhead('','',0,0,'',$arrayofcss);
|
||||
|
||||
// Execute hook getLoginPageOptions (for table)
|
||||
$parameters=array('entity' => GETPOST('entity','int'));
|
||||
$reshook = $hookmanager->executeHooks('getLoginPageOptions',$parameters); // Note that $action and $object may have been modified by some hooks.
|
||||
if (is_array($hookmanager->resArray) && ! empty($hookmanager->resArray)) {
|
||||
$morelogincontent = $hookmanager->resArray; // (deprecated) For compatibility
|
||||
} else {
|
||||
$morelogincontent = $hookmanager->resPrint;
|
||||
}
|
||||
?>
|
||||
|
||||
<body>
|
||||
@ -92,6 +103,24 @@ else
|
||||
<td><input name="pwdPassword" class="texte_login" type="password" value="" /></td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
if (! empty($morelogincontent)) {
|
||||
if (is_array($morelogincontent)) {
|
||||
foreach ($morelogincontent as $format => $option)
|
||||
{
|
||||
if ($format == 'table') {
|
||||
echo '<!-- Option by hook -->';
|
||||
echo $option;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo '<!-- Option by hook -->';
|
||||
echo $morelogincontent;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
|
||||
|
||||
@ -45,8 +45,7 @@ $societe = new Societe($db);
|
||||
$societe->fetch($thirdpartyid);
|
||||
/** end add Ditto */
|
||||
|
||||
$tab=array();
|
||||
$tab = $_SESSION['poscart'];
|
||||
$tab = (! empty($_SESSION['poscart'])?$_SESSION['poscart']:array());
|
||||
|
||||
$tab_size=count($tab);
|
||||
if ($tab_size <= 0) print '<div class="center">'.$langs->trans("NoArticle").'</div><br>';
|
||||
|
||||
@ -490,8 +490,6 @@ class ActionComm extends CommonObject
|
||||
{
|
||||
global $db, $user, $langs, $conf, $hookmanager;
|
||||
|
||||
$this->context['createfromclone']='createfromclone';
|
||||
|
||||
$error=0;
|
||||
$now=dol_now();
|
||||
|
||||
@ -524,7 +522,8 @@ class ActionComm extends CommonObject
|
||||
}
|
||||
|
||||
// Create clone
|
||||
$result=$this->create($fuser);
|
||||
$this->context['createfromclone']='createfromclone';
|
||||
$result=$this->create($fuser);
|
||||
if ($result < 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
|
||||
@ -279,8 +279,6 @@ class Mailing extends CommonObject
|
||||
|
||||
$object=new Mailing($this->db);
|
||||
|
||||
$object->context['createfromclone']='createfromclone';
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Load source object
|
||||
@ -314,6 +312,7 @@ class Mailing extends CommonObject
|
||||
}
|
||||
|
||||
// Create clone
|
||||
$object->context['createfromclone']='createfromclone';
|
||||
$result=$object->create($user);
|
||||
|
||||
// Other options
|
||||
@ -345,7 +344,6 @@ class Mailing extends CommonObject
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."mailing_cibles ";
|
||||
$sql.= " WHERE fk_mailing = ".$fromid;
|
||||
|
||||
dol_syslog(get_class($this)."::createFromClone", LOG_DEBUG);
|
||||
$result=$this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
|
||||
@ -1222,31 +1222,30 @@ class Propal extends CommonObject
|
||||
|
||||
dol_include_once('/projet/class/project.class.php');
|
||||
|
||||
$this->context['createfromclone']='createfromclone';
|
||||
|
||||
$error=0;
|
||||
$now=dol_now();
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$object = new self($this->db);
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// get extrafields so they will be clone
|
||||
foreach($this->lines as $line)
|
||||
$line->fetch_optionals();
|
||||
|
||||
// Load dest object
|
||||
$clonedObj = clone $this;
|
||||
// Load source object
|
||||
$object->fetch($this->id);
|
||||
$object->fetch_lines();
|
||||
|
||||
$objsoc=new Societe($this->db);
|
||||
|
||||
// Change socid if needed
|
||||
if (! empty($socid) && $socid != $clonedObj->socid)
|
||||
if (! empty($socid) && $socid != $object->socid)
|
||||
{
|
||||
if ($objsoc->fetch($socid) > 0)
|
||||
{
|
||||
$clonedObj->socid = $objsoc->id;
|
||||
$clonedObj->cond_reglement_id = (! empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0);
|
||||
$clonedObj->mode_reglement_id = (! empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0);
|
||||
$clonedObj->fk_delivery_address = '';
|
||||
$object->socid = $objsoc->id;
|
||||
$object->cond_reglement_id = (! empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0);
|
||||
$object->mode_reglement_id = (! empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0);
|
||||
$object->fk_delivery_address = '';
|
||||
|
||||
/*if (!empty($conf->projet->enabled))
|
||||
{
|
||||
@ -1258,44 +1257,51 @@ class Propal extends CommonObject
|
||||
$clonedObj->fk_project = '';
|
||||
}
|
||||
}*/
|
||||
$clonedObj->fk_project = ''; // A cloned proposal is set by default to no project.
|
||||
$object->fk_project = ''; // A cloned proposal is set by default to no project.
|
||||
}
|
||||
|
||||
// reset ref_client
|
||||
$clonedObj->ref_client = '';
|
||||
$object->ref_client = '';
|
||||
|
||||
// TODO Change product price if multi-prices
|
||||
}
|
||||
else
|
||||
{
|
||||
$objsoc->fetch($clonedObj->socid);
|
||||
$objsoc->fetch($object->socid);
|
||||
}
|
||||
|
||||
$clonedObj->id=0;
|
||||
$clonedObj->ref='';
|
||||
$clonedObj->statut=self::STATUS_DRAFT;
|
||||
$object->id=0;
|
||||
$object->ref='';
|
||||
$object->statut=self::STATUS_DRAFT;
|
||||
|
||||
// Clear fields
|
||||
$clonedObj->user_author = $user->id;
|
||||
$clonedObj->user_valid = '';
|
||||
$clonedObj->date = $now;
|
||||
$clonedObj->datep = $now; // deprecated
|
||||
$clonedObj->fin_validite = $clonedObj->date + ($clonedObj->duree_validite * 24 * 3600);
|
||||
if (empty($conf->global->MAIN_KEEP_REF_CUSTOMER_ON_CLONING)) $clonedObj->ref_client = '';
|
||||
$object->user_author = $user->id;
|
||||
$object->user_valid = '';
|
||||
$object->date = $now;
|
||||
$object->datep = $now; // deprecated
|
||||
$object->fin_validite = $object->date + ($object->duree_validite * 24 * 3600);
|
||||
if (empty($conf->global->MAIN_KEEP_REF_CUSTOMER_ON_CLONING)) $object->ref_client = '';
|
||||
|
||||
// Create clone
|
||||
$result=$clonedObj->create($user);
|
||||
$object->context['createfromclone']='createfromclone';
|
||||
$result=$object->create($user);
|
||||
if ($result < 0) $error++;
|
||||
else
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
// copy internal contacts
|
||||
if ($clonedObj->copy_linked_contact($this, 'internal') < 0)
|
||||
if ($object->copy_linked_contact($this, 'internal') < 0)
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
// copy external contacts if same company
|
||||
elseif ($this->socid == $clonedObj->socid)
|
||||
if ($this->socid == $object->socid)
|
||||
{
|
||||
if ($clonedObj->copy_linked_contact($this, 'external') < 0)
|
||||
if ($object->copy_linked_contact($this, 'external') < 0)
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@ -1312,13 +1318,13 @@ class Propal extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
unset($this->context['createfromclone']);
|
||||
unset($object->context['createfromclone']);
|
||||
|
||||
// End
|
||||
if (! $error)
|
||||
{
|
||||
$this->db->commit();
|
||||
return $clonedObj->id;
|
||||
return $object->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -1066,8 +1066,6 @@ class Commande extends CommonOrder
|
||||
|
||||
$error=0;
|
||||
|
||||
$this->context['createfromclone'] = 'createfromclone';
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// get lines so they will be clone
|
||||
@ -1108,6 +1106,7 @@ class Commande extends CommonOrder
|
||||
$this->ref_client = '';
|
||||
|
||||
// Create clone
|
||||
$this->context['createfromclone'] = 'createfromclone';
|
||||
$result=$this->create($user);
|
||||
if ($result < 0) $error++;
|
||||
|
||||
|
||||
@ -1520,8 +1520,8 @@ if ($resql)
|
||||
$i++;
|
||||
if ($i == 1)
|
||||
{
|
||||
if ($num < $limit && empty($offset)) print '<td align="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
if ($num < $limit && empty($offset)) print '<td class="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
}
|
||||
elseif ($totalarray['totaldebfield'] == $i) print '<td align="right">'.price(-1 * $totalarray['totaldeb']).'</td>';
|
||||
elseif ($totalarray['totalcredfield'] == $i) print '<td align="right">'.price($totalarray['totalcred']).'</td>';
|
||||
|
||||
@ -280,8 +280,6 @@ class BankCateg // extends CommonObject
|
||||
|
||||
$object = new BankCateg($this->db);
|
||||
|
||||
$object->context['createfromclone'] = 'createfromclone';
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Load source object
|
||||
@ -290,6 +288,7 @@ class BankCateg // extends CommonObject
|
||||
$object->statut = 0;
|
||||
|
||||
// Create clone
|
||||
$object->context['createfromclone'] = 'createfromclone';
|
||||
$result = $object->create($user);
|
||||
|
||||
// Other options
|
||||
|
||||
@ -588,8 +588,8 @@ if (isset($totalarray['totalbalancefield']) && $lastcurrencycode != 'various') /
|
||||
$i++;
|
||||
if ($i == 1)
|
||||
{
|
||||
if ($num < $limit && empty($offset)) print '<td align="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
if ($num < $limit && empty($offset)) print '<td class="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
}
|
||||
elseif ($totalarray['totalbalancefield'] == $i) print '<td align="right">'.price($totalarray['totalbalance'], 0, $langs, 0, 0, -1, $lastcurrencycode).'</td>';
|
||||
else print '<td></td>';
|
||||
|
||||
@ -521,8 +521,8 @@ if (isset($totalarray['pos']))
|
||||
{
|
||||
if ($i == 1)
|
||||
{
|
||||
if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
if ($num < $limit) print '<td class="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
}
|
||||
else print '<td></td>';
|
||||
}
|
||||
|
||||
@ -240,8 +240,8 @@ if ($resql)
|
||||
$i++;
|
||||
if ($i == 1)
|
||||
{
|
||||
if ($num < $limit && empty($offset)) print '<td align="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
if ($num < $limit && empty($offset)) print '<td class="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
}
|
||||
elseif ($totalarray['totaldebfield'] == $i) print '<td align="right">'.price(-1 * $totalarray['totaldeb']).'</td>';
|
||||
elseif ($totalarray['totalcredfield'] == $i) print '<td align="right">'.price($totalarray['totalcred']).'</td>';
|
||||
|
||||
@ -294,7 +294,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td align="left">'.dol_print_date($db->jdate($obj->dm),'day').'</td>'."\n";
|
||||
print '<td class="left">'.dol_print_date($db->jdate($obj->dm),'day').'</td>'."\n";
|
||||
|
||||
print "<td>".$obj->label."</td>\n";
|
||||
|
||||
@ -303,7 +303,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
|
||||
// Ref payment
|
||||
$tva_static->id=$obj->rowid;
|
||||
$tva_static->ref=$obj->rowid;
|
||||
print '<td align="left">'.$tva_static->getNomUrl(1)."</td>\n";
|
||||
print '<td class="left">'.$tva_static->getNomUrl(1)."</td>\n";
|
||||
|
||||
// Date
|
||||
print '<td align="center">'.dol_print_date($db->jdate($obj->dm),'day')."</td>\n";
|
||||
@ -423,14 +423,14 @@ while($j<$numlt)
|
||||
$total = $total + $obj->amount;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td align="left">'.dol_print_date($db->jdate($obj->dm),'day').'</td>'."\n";
|
||||
print '<td class="left">'.dol_print_date($db->jdate($obj->dm),'day').'</td>'."\n";
|
||||
|
||||
print "<td>".$obj->label."</td>\n";
|
||||
|
||||
// Ref payment
|
||||
$tva_static->id=$obj->rowid;
|
||||
$tva_static->ref=$obj->rowid;
|
||||
print '<td align="left">'.$tva_static->getNomUrl(1)."</td>\n";
|
||||
print '<td class="left">'.$tva_static->getNomUrl(1)."</td>\n";
|
||||
|
||||
print '<td align="center">'.dol_print_date($db->jdate($obj->dp),'day')."</td>\n";
|
||||
print '<td align="right">'.price($obj->amount)."</td>";
|
||||
@ -508,14 +508,14 @@ if (! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read))
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
print '<td align="left">'.dol_print_date($db->jdate($obj->dateep),'day').'</td>'."\n";
|
||||
print '<td class="left">'.dol_print_date($db->jdate($obj->dateep),'day').'</td>'."\n";
|
||||
|
||||
print "<td>".$obj->label."</td>\n";
|
||||
|
||||
// Ref payment
|
||||
$sal_static->id=$obj->rowid;
|
||||
$sal_static->ref=$obj->rowid;
|
||||
print '<td align="left">'.$sal_static->getNomUrl(1)."</td>\n";
|
||||
print '<td class="left">'.$sal_static->getNomUrl(1)."</td>\n";
|
||||
|
||||
// Date
|
||||
print '<td align="center">'.dol_print_date($db->jdate($obj->datep),'day')."</td>\n";
|
||||
|
||||
@ -184,8 +184,8 @@ if ($resql)
|
||||
print $thirdpartystatic->getNomUrl(1,'compta');
|
||||
print '</td>';
|
||||
print '<td>'.$obj->town.' </td>';
|
||||
print '<td align="left">'.$obj->code_client.' </td>';
|
||||
print '<td align="left">'.$obj->code_compta.' </td>';
|
||||
print '<td class="left">'.$obj->code_client.' </td>';
|
||||
print '<td class="left">'.$obj->code_compta.' </td>';
|
||||
print '<td align="right">'.dol_print_date($db->jdate($obj->datec)).'</td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
|
||||
@ -951,8 +951,6 @@ class Facture extends CommonInvoice
|
||||
|
||||
$error=0;
|
||||
|
||||
$this->context['createfromclone'] = 'createfromclone';
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// get extrafields so they will be clone
|
||||
@ -962,8 +960,6 @@ class Facture extends CommonInvoice
|
||||
// Load source object
|
||||
$objFrom = clone $this;
|
||||
|
||||
|
||||
|
||||
// Change socid if needed
|
||||
if (! empty($socid) && $socid != $this->socid)
|
||||
{
|
||||
@ -1008,6 +1004,7 @@ class Facture extends CommonInvoice
|
||||
}
|
||||
|
||||
// Create clone
|
||||
$this->context['createfromclone'] = 'createfromclone';
|
||||
$result=$this->create($user);
|
||||
if ($result < 0) $error++;
|
||||
else {
|
||||
|
||||
@ -404,8 +404,6 @@ class PaymentTerm // extends CommonObject
|
||||
|
||||
$object=new PaymentTerm($this->db);
|
||||
|
||||
$object->context['createfromclone'] = 'createfromclone';
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Load source object
|
||||
@ -417,6 +415,7 @@ class PaymentTerm // extends CommonObject
|
||||
// ...
|
||||
|
||||
// Create clone
|
||||
$object->context['createfromclone'] = 'createfromclone';
|
||||
$result=$object->create($user);
|
||||
|
||||
// Other options
|
||||
@ -430,7 +429,7 @@ class PaymentTerm // extends CommonObject
|
||||
//{
|
||||
//}
|
||||
|
||||
unset($this->context['createfromclone']);
|
||||
unset($object->context['createfromclone']);
|
||||
|
||||
// End
|
||||
if (! $error)
|
||||
|
||||
@ -1476,7 +1476,7 @@ else
|
||||
print '<tr><td>';
|
||||
print "<input type='text' name='frequency' value='".$object->frequency."' size='5' /> ".$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 '<td class="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
|
||||
print '</tr></table></form>';
|
||||
}
|
||||
else
|
||||
|
||||
@ -688,8 +688,8 @@ if ($resql)
|
||||
{
|
||||
if ($i == 1)
|
||||
{
|
||||
if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
if ($num < $limit) print '<td class="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
}
|
||||
else print '<td></td>';
|
||||
}
|
||||
|
||||
@ -1202,8 +1202,8 @@ if ($resql)
|
||||
$i++;
|
||||
if ($i == 1)
|
||||
{
|
||||
if ($num < $limit && empty($offset)) print '<td align="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
if ($num < $limit && empty($offset)) print '<td class="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
}
|
||||
elseif ($totalarray['totalhtfield'] == $i) print '<td align="right">'.price($totalarray['totalht']).'</td>';
|
||||
elseif ($totalarray['totalvatfield'] == $i) print '<td align="right">'.price($totalarray['totalvat']).'</td>';
|
||||
|
||||
@ -575,7 +575,7 @@ if ($object->id > 0)
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td align="left">'.$langs->trans("DateRequest").'</td>';
|
||||
print '<td class="left">'.$langs->trans("DateRequest").'</td>';
|
||||
print '<td align="center">'.$langs->trans("User").'</td>';
|
||||
print '<td align="center">'.$langs->trans("Amount").'</td>';
|
||||
print '<td align="center">'.$langs->trans("WithdrawalReceipt").'</td>';
|
||||
@ -607,7 +607,7 @@ if ($object->id > 0)
|
||||
$obj = $db->fetch_object($result_sql);
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td align="left">'.dol_print_date($db->jdate($obj->date_demande),'day')."</td>\n";
|
||||
print '<td class="left">'.dol_print_date($db->jdate($obj->date_demande),'day')."</td>\n";
|
||||
print '<td align="center"><a href="'.DOL_URL_ROOT.'/user/card.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.'</a></td>';
|
||||
print '<td align="center">'.price($obj->amount).'</td>';
|
||||
print '<td align="center">-</td>';
|
||||
@ -657,7 +657,7 @@ if ($object->id > 0)
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
print '<td align="left">'.dol_print_date($db->jdate($obj->date_demande),'day')."</td>\n";
|
||||
print '<td class="left">'.dol_print_date($db->jdate($obj->date_demande),'day')."</td>\n";
|
||||
|
||||
print '<td align="center"><a href="'.DOL_URL_ROOT.'/user/card.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.'</a></td>';
|
||||
|
||||
|
||||
@ -255,7 +255,7 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||
print $form->select_dolusers($userid, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
|
||||
print '</td></tr>';
|
||||
// Status
|
||||
print '<tr><td align="left">'.$langs->trans("Status").'</td><td align="left">';
|
||||
print '<tr><td class="left">'.$langs->trans("Status").'</td><td class="left">';
|
||||
if ($mode == 'customer')
|
||||
{
|
||||
$liststatus=array('0'=>$langs->trans("BillStatusDraft"), '1'=>$langs->trans("BillStatusNotPaid"), '2'=>$langs->trans("BillStatusPaid"), '3'=>$langs->trans("BillStatusCanceled"));
|
||||
|
||||
@ -206,7 +206,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
$i++;
|
||||
}
|
||||
|
||||
print '<tr class="liste_total"><td align="left">'.$langs->trans("Total").'</td>';
|
||||
print '<tr class="liste_total"><td class="left">'.$langs->trans("Total").'</td>';
|
||||
print '<td colspan="2" align="right">'.price($tot_ttc).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
@ -293,7 +293,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
|
||||
$i++;
|
||||
}
|
||||
|
||||
print '<tr class="liste_total"><td align="left">'.$langs->trans("Total").'</td>';
|
||||
print '<tr class="liste_total"><td class="left">'.$langs->trans("Total").'</td>';
|
||||
print '<td colspan="2" align="right">'.price($tot_ttc).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
@ -406,7 +406,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '</td>';
|
||||
print '<td align="left">';
|
||||
print '<td class="left">';
|
||||
print $thirdpartystatic->getNomUrl(1,'customer',44);
|
||||
print '</td>';
|
||||
if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print '<td align="right">'.price($obj->total_ht).'</td>';
|
||||
@ -774,7 +774,7 @@ if (! empty($conf->facture->enabled) && ! empty($conf->commande->enabled) && $us
|
||||
|
||||
print '</td>';
|
||||
|
||||
print '<td align="left">';
|
||||
print '<td class="left">';
|
||||
print $societestatic->getNomUrl(1,'customer',44);
|
||||
print '</td>';
|
||||
if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print '<td align="right">'.price($obj->total_ht).'</td>';
|
||||
@ -898,7 +898,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '</td>';
|
||||
print '<td align="left">' ;
|
||||
print '<td class="left">' ;
|
||||
print $societestatic->getNomUrl(1,'customer',44);
|
||||
print '</td>';
|
||||
print '<td align="right">'.dol_print_date($db->jdate($obj->datelimite),'day').'</td>';
|
||||
|
||||
@ -159,8 +159,8 @@ if($calc ==0 || $calc == 2)
|
||||
{
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print '<td align="left">'.$langs->trans("Num")."</td>";
|
||||
print '<td align="left">'.$langs->trans("Customer")."</td>";
|
||||
print '<td class="left">'.$langs->trans("Num")."</td>";
|
||||
print '<td class="left">'.$langs->trans("Customer")."</td>";
|
||||
print "<td>".$langs->transcountry("ProfId1",$mysoc->country_code)."</td>";
|
||||
print "<td align=\"right\">".$langs->trans("TotalHT")."</td>";
|
||||
print "<td align=\"right\">".$vatcust."</td>";
|
||||
@ -240,8 +240,8 @@ if($calc ==0 || $calc == 2)
|
||||
if($calc ==0 || $calc == 1){
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print '<td align="left">'.$langs->trans("Num")."</td>";
|
||||
print '<td align="left">'.$langs->trans("Supplier")."</td>";
|
||||
print '<td class="left">'.$langs->trans("Num")."</td>";
|
||||
print '<td class="left">'.$langs->trans("Supplier")."</td>";
|
||||
print "<td>".$langs->transcountry("ProfId1",$mysoc->country_code)."</td>";
|
||||
print "<td align=\"right\">".$langs->trans("TotalHT")."</td>";
|
||||
print "<td align=\"right\">".$vatsup."</td>";
|
||||
|
||||
@ -83,8 +83,8 @@ if ($result)
|
||||
$localtax_static->ref=$obj->rowid;
|
||||
print "<td>".$localtax_static->getNomUrl(1)."</td>\n";
|
||||
print "<td>".dol_trunc($obj->label,40)."</td>\n";
|
||||
print '<td align="left">'.dol_print_date($db->jdate($obj->datev),'day')."</td>\n";
|
||||
print '<td align="left">'.dol_print_date($db->jdate($obj->datep),'day')."</td>\n";
|
||||
print '<td class="left">'.dol_print_date($db->jdate($obj->datev),'day')."</td>\n";
|
||||
print '<td class="left">'.dol_print_date($db->jdate($obj->datep),'day')."</td>\n";
|
||||
$total = $total + $obj->amount;
|
||||
|
||||
print "<td align=\"right\">".price($obj->amount)."</td>";
|
||||
|
||||
@ -318,8 +318,8 @@ else
|
||||
//{
|
||||
// Customers invoices
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td align="left">'.$elementcust.'</td>';
|
||||
print '<td align="left">'.$productcust.'</td>';
|
||||
print '<td class="left">'.$elementcust.'</td>';
|
||||
print '<td class="left">'.$productcust.'</td>';
|
||||
if ($modetax != 2) print '<td align="right">'.$amountcust.'</td>';
|
||||
if ($modetax != 1) print '<td align="right">'.$langs->trans("Payment").' ('.$langs->trans("PercentOfInvoice").')</td>';
|
||||
print '<td align="right">'.$langs->trans("BI").'</td>';
|
||||
@ -360,7 +360,7 @@ else
|
||||
print '<td class="nowrap" align="left">'.$fields['link'].'</td>';
|
||||
|
||||
// Description
|
||||
print '<td align="left">';
|
||||
print '<td class="left">';
|
||||
if ($fields['pid'])
|
||||
{
|
||||
$product_static->id=$fields['pid'];
|
||||
@ -481,8 +481,8 @@ else
|
||||
echo '<table class="noborder" width="100%">';
|
||||
//print table headers for this quadri - expenses now
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td align="left">'.$elementsup.'</td>';
|
||||
print '<td align="left">'.$productsup.'</td>';
|
||||
print '<td class="left">'.$elementsup.'</td>';
|
||||
print '<td class="left">'.$productsup.'</td>';
|
||||
if ($modetax != 1)
|
||||
{
|
||||
print '<td align="right">'.$amountsup.'</td>';
|
||||
@ -522,7 +522,7 @@ else
|
||||
print '<td class="nowrap" align="left">'.$fields['link'].'</td>';
|
||||
|
||||
// Description
|
||||
print '<td align="left">';
|
||||
print '<td class="left">';
|
||||
if ($fields['pid'])
|
||||
{
|
||||
$product_static->id=$fields['pid'];
|
||||
|
||||
@ -264,7 +264,7 @@ if ($action == 'create')
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
//print '<td>'.$langs->trans("SocialContribution").'</td>';
|
||||
print '<td align="left">'.$langs->trans("DateDue").'</td>';
|
||||
print '<td class="left">'.$langs->trans("DateDue").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Amount").'</td>';
|
||||
print '<td align="right">'.$langs->trans("AlreadyPaid").'</td>';
|
||||
print '<td align="right">'.$langs->trans("RemainderToPay").'</td>';
|
||||
|
||||
@ -369,6 +369,7 @@ class Cchargesociales
|
||||
// ...
|
||||
|
||||
// Create clone
|
||||
$this->context['createfromclone'] = 'createfromclone';
|
||||
$result = $object->create($user);
|
||||
|
||||
// Other options
|
||||
@ -378,6 +379,8 @@ class Cchargesociales
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
}
|
||||
|
||||
unset($this->context['createfromclone']);
|
||||
|
||||
// End
|
||||
if (!$error) {
|
||||
$this->db->commit();
|
||||
@ -386,7 +389,7 @@ class Cchargesociales
|
||||
} else {
|
||||
$this->db->rollback();
|
||||
|
||||
return - 1;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -459,8 +459,6 @@ class PaymentSocialContribution extends CommonObject
|
||||
|
||||
$object=new PaymentSocialContribution($this->db);
|
||||
|
||||
$object->context['createfromclone'] = 'createfromclone';
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Load source object
|
||||
@ -472,6 +470,7 @@ class PaymentSocialContribution extends CommonObject
|
||||
// ...
|
||||
|
||||
// Create clone
|
||||
$object->context['createfromclone'] = 'createfromclone';
|
||||
$result=$object->create($user);
|
||||
|
||||
// Other options
|
||||
@ -488,7 +487,7 @@ class PaymentSocialContribution extends CommonObject
|
||||
|
||||
}
|
||||
|
||||
unset($this->context['createfromclone']);
|
||||
unset($object->context['createfromclone']);
|
||||
|
||||
// End
|
||||
if (! $error)
|
||||
|
||||
@ -287,8 +287,8 @@ if ($resql)
|
||||
if (isset($totalarray['totalttcfield']))
|
||||
{
|
||||
print '<tr class="liste_total">';
|
||||
if ($num < $limit && empty($offset)) print '<td align="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
if ($num < $limit && empty($offset)) print '<td class="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
|
||||
@ -259,7 +259,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
|
||||
$total = $total + $obj->amount;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td align="left">'.dol_print_date($db->jdate($obj->dm),'day').'</td>'."\n";
|
||||
print '<td class="left">'.dol_print_date($db->jdate($obj->dm),'day').'</td>'."\n";
|
||||
|
||||
print "<td>".$obj->label."</td>\n";
|
||||
|
||||
@ -268,7 +268,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
|
||||
// Ref payment
|
||||
$tva_static->id=$obj->rowid;
|
||||
$tva_static->ref=$obj->rowid;
|
||||
print '<td align="left">'.$tva_static->getNomUrl(1)."</td>\n";
|
||||
print '<td class="left">'.$tva_static->getNomUrl(1)."</td>\n";
|
||||
|
||||
print '<td align="center">'.dol_print_date($db->jdate($obj->dm),'day')."</td>\n";
|
||||
print '<td align="right">'.price($obj->amount)."</td>";
|
||||
@ -360,7 +360,7 @@ while($j<$numlt)
|
||||
$total = $total + $obj->amount;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td align="left">'.dol_print_date($db->jdate($obj->dm),'day').'</td>'."\n";
|
||||
print '<td class="left">'.dol_print_date($db->jdate($obj->dm),'day').'</td>'."\n";
|
||||
|
||||
print "<td>".$obj->label."</td>\n";
|
||||
|
||||
@ -369,7 +369,7 @@ while($j<$numlt)
|
||||
// Ref payment
|
||||
$tva_static->id=$obj->rowid;
|
||||
$tva_static->ref=$obj->rowid;
|
||||
print '<td align="left">'.$tva_static->getNomUrl(1)."</td>\n";
|
||||
print '<td class="left">'.$tva_static->getNomUrl(1)."</td>\n";
|
||||
|
||||
print '<td align="center">'.dol_print_date($db->jdate($obj->dp),'day')."</td>\n";
|
||||
print '<td align="right">'.price($obj->amount)."</td>";
|
||||
@ -442,7 +442,7 @@ if (! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read))
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
print '<td align="left">'.dol_print_date($db->jdate($obj->dateep),'day').'</td>'."\n";
|
||||
print '<td class="left">'.dol_print_date($db->jdate($obj->dateep),'day').'</td>'."\n";
|
||||
|
||||
print "<td>".$obj->label."</td>\n";
|
||||
|
||||
@ -451,7 +451,7 @@ if (! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read))
|
||||
// Ref payment
|
||||
$sal_static->id=$obj->rowid;
|
||||
$sal_static->ref=$obj->rowid;
|
||||
print '<td align="left">'.$sal_static->getNomUrl(1)."</td>\n";
|
||||
print '<td class="left">'.$sal_static->getNomUrl(1)."</td>\n";
|
||||
|
||||
print '<td align="center">'.dol_print_date($db->jdate($obj->datep),'day')."</td>\n";
|
||||
print '<td align="right">'.price($obj->amount)."</td>";
|
||||
|
||||
@ -250,8 +250,8 @@ if ($modecompta == 'CREANCES-DETTES')
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="6%" class="right">' . $langs->trans("TurnoverbyVatrate") . '</td>';
|
||||
print '<td align="left">' . $langs->trans("ProductOrService") . '</td>';
|
||||
print '<td align="left">' . $langs->trans("Country") . '</td>';
|
||||
print '<td class="left">' . $langs->trans("ProductOrService") . '</td>';
|
||||
print '<td class="left">' . $langs->trans("Country") . '</td>';
|
||||
$i=0;
|
||||
while($i < 12)
|
||||
{
|
||||
@ -292,9 +292,9 @@ if ($resql) {
|
||||
while ( $obj = $db->fetch_object($resql)) {
|
||||
print '<tr class="oddeven"><td class="right">' . vatrate($obj->vatrate) . '</td>';
|
||||
if ($obj->product_type == 0) {
|
||||
print '<td align="left">'. $langs->trans("Product") . '</td>';
|
||||
print '<td class="left">'. $langs->trans("Product") . '</td>';
|
||||
} else {
|
||||
print '<td align="left">'. $langs->trans("Service") . '</td>';
|
||||
print '<td class="left">'. $langs->trans("Service") . '</td>';
|
||||
}
|
||||
print '<td>' .$obj->country . '</td>';
|
||||
for($i = 0; $i < 12; $i++) {
|
||||
@ -312,7 +312,7 @@ if ($resql) {
|
||||
|
||||
// Total
|
||||
print '<tr class="liste_total"><td class="right"></td>';
|
||||
print '<td align="left"></td>';
|
||||
print '<td class="left"></td>';
|
||||
print '<td></td>';
|
||||
for($i = 0; $i < 12; $i++) {
|
||||
$j = $i + (empty($conf->global->SOCIETE_FISCAL_MONTH_START)?1:$conf->global->SOCIETE_FISCAL_MONTH_START);
|
||||
@ -328,8 +328,8 @@ if ($resql) {
|
||||
|
||||
|
||||
print '<tr class="liste_titre"><td width="6%" class="right">' . $langs->trans("PurchasebyVatrate") . '</td>';
|
||||
print '<td align="left">' . $langs->trans("ProductOrService") . '</td>';
|
||||
print '<td align="left">' . $langs->trans("Country") . '</td>';
|
||||
print '<td class="left">' . $langs->trans("ProductOrService") . '</td>';
|
||||
print '<td class="left">' . $langs->trans("Country") . '</td>';
|
||||
$i=0;
|
||||
while($i < 12)
|
||||
{
|
||||
@ -371,9 +371,9 @@ if ($resql2) {
|
||||
while ( $obj = $db->fetch_object($resql2)) {
|
||||
print '<tr class="oddeven"><td class="right">' . vatrate($obj->vatrate) . '</td>';
|
||||
if ($obj->product_type == 0) {
|
||||
print '<td align="left">'. $langs->trans("Product") . '</td>';
|
||||
print '<td class="left">'. $langs->trans("Product") . '</td>';
|
||||
} else {
|
||||
print '<td align="left">'. $langs->trans("Service") . '</td>';
|
||||
print '<td class="left">'. $langs->trans("Service") . '</td>';
|
||||
}
|
||||
print '<td>' . $obj->country . '</td>';
|
||||
for($i = 0; $i < 12; $i++) {
|
||||
@ -391,7 +391,7 @@ if ($resql2) {
|
||||
|
||||
// Total
|
||||
print '<tr class="liste_total"><td class="right"></td>';
|
||||
print '<td align="left"></td>';
|
||||
print '<td class="left"></td>';
|
||||
print '<td></td>';
|
||||
for($i = 0; $i < 12; $i++) {
|
||||
$j = $i + (empty($conf->global->SOCIETE_FISCAL_MONTH_START)?1:$conf->global->SOCIETE_FISCAL_MONTH_START);
|
||||
|
||||
@ -347,12 +347,12 @@ if (! is_array($x_coll) || ! is_array($x_paye))
|
||||
|
||||
// Customers invoices
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td align="left">'.$elementcust.'</td>';
|
||||
print '<td align="left">'.$langs->trans("DateInvoice").'</td>';
|
||||
if ($conf->global->TAX_MODE_SELL_PRODUCT == 'payment' || $conf->global->TAX_MODE_SELL_SERVICE == 'payment') print '<td align="left">'.$langs->trans("DatePayment").'</td>';
|
||||
print '<td class="left">'.$elementcust.'</td>';
|
||||
print '<td class="left">'.$langs->trans("DateInvoice").'</td>';
|
||||
if ($conf->global->TAX_MODE_SELL_PRODUCT == 'payment' || $conf->global->TAX_MODE_SELL_SERVICE == 'payment') print '<td class="left">'.$langs->trans("DatePayment").'</td>';
|
||||
else print '<td></td>';
|
||||
print '<td align="right">'.$namerate.'</td>';
|
||||
print '<td align="left">'.$productcust.'</td>';
|
||||
print '<td class="left">'.$productcust.'</td>';
|
||||
if ($modetax != 1)
|
||||
{
|
||||
print '<td align="right">'.$amountcust.'</td>';
|
||||
@ -417,17 +417,17 @@ if (! is_array($x_coll) || ! is_array($x_paye))
|
||||
print '<td class="nowrap" align="left">'.$fields['link'].'</td>';
|
||||
|
||||
// Invoice date
|
||||
print '<td align="left">' . dol_print_date($fields['datef'], 'day') . '</td>';
|
||||
print '<td class="left">' . dol_print_date($fields['datef'], 'day') . '</td>';
|
||||
|
||||
// Payment date
|
||||
if ($conf->global->TAX_MODE_SELL_PRODUCT == 'payment' || $conf->global->TAX_MODE_SELL_SERVICE == 'payment') print '<td align="left">' . dol_print_date($fields['datep'], 'day') . '</td>';
|
||||
if ($conf->global->TAX_MODE_SELL_PRODUCT == 'payment' || $conf->global->TAX_MODE_SELL_SERVICE == 'payment') print '<td class="left">' . dol_print_date($fields['datep'], 'day') . '</td>';
|
||||
else print '<td></td>';
|
||||
|
||||
// Rate
|
||||
print '<td align="right">' . $fields['drate'] . '</td>';
|
||||
|
||||
// Description
|
||||
print '<td align="left">';
|
||||
print '<td class="left">';
|
||||
if ($fields['pid'])
|
||||
{
|
||||
$product_static->id=$fields['pid'];
|
||||
@ -553,12 +553,12 @@ if (! is_array($x_coll) || ! is_array($x_paye))
|
||||
|
||||
// Print table headers for this quadri - expenses now
|
||||
print '<tr class="liste_titre liste_titre_topborder">';
|
||||
print '<td align="left">'.$elementsup.'</td>';
|
||||
print '<td align="left">'.$langs->trans("DateInvoice").'</td>';
|
||||
if ($conf->global->TAX_MODE_BUY_PRODUCT == 'payment' || $conf->global->TAX_MODE_BUY_SERVICE == 'payment') print '<td align="left">'.$langs->trans("DatePayment").'</td>';
|
||||
print '<td class="left">'.$elementsup.'</td>';
|
||||
print '<td class="left">'.$langs->trans("DateInvoice").'</td>';
|
||||
if ($conf->global->TAX_MODE_BUY_PRODUCT == 'payment' || $conf->global->TAX_MODE_BUY_SERVICE == 'payment') print '<td class="left">'.$langs->trans("DatePayment").'</td>';
|
||||
else print '<td></td>';
|
||||
print '<td align="left">'.$namesup.'</td>';
|
||||
print '<td align="left">'.$productsup.'</td>';
|
||||
print '<td class="left">'.$namesup.'</td>';
|
||||
print '<td class="left">'.$productsup.'</td>';
|
||||
if ($modetax != 1) {
|
||||
print '<td align="right">'.$amountsup.'</td>';
|
||||
print '<td align="right">'.$langs->trans("Payment").' ('.$langs->trans("PercentOfInvoice").')</td>';
|
||||
@ -610,17 +610,17 @@ if (! is_array($x_coll) || ! is_array($x_paye))
|
||||
print '<td class="nowrap" align="left">'.$fields['link'].'</td>';
|
||||
|
||||
// Invoice date
|
||||
print '<td align="left">' . dol_print_date($fields['datef'], 'day') . '</td>';
|
||||
print '<td class="left">' . dol_print_date($fields['datef'], 'day') . '</td>';
|
||||
|
||||
// Payment date
|
||||
if ($conf->global->TAX_MODE_BUY_PRODUCT == 'payment' || $conf->global->TAX_MODE_BUY_SERVICE == 'payment') print '<td align="left">' . dol_print_date($fields['datep'], 'day') . '</td>';
|
||||
if ($conf->global->TAX_MODE_BUY_PRODUCT == 'payment' || $conf->global->TAX_MODE_BUY_SERVICE == 'payment') print '<td class="left">' . dol_print_date($fields['datep'], 'day') . '</td>';
|
||||
else print '<td></td>';
|
||||
|
||||
// Company name
|
||||
print '<td align="left">' . $fields['company_link'] . '</td>';
|
||||
print '<td class="left">' . $fields['company_link'] . '</td>';
|
||||
|
||||
// Description
|
||||
print '<td align="left">';
|
||||
print '<td class="left">';
|
||||
if ($fields['pid'])
|
||||
{
|
||||
$product_static->id=$fields['pid'];
|
||||
|
||||
@ -336,12 +336,12 @@ if (! is_array($x_coll) || ! is_array($x_paye))
|
||||
|
||||
// Customers invoices
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td align="left">'.$elementcust.'</td>';
|
||||
print '<td align="left">'.$langs->trans("DateInvoice").'</td>';
|
||||
if ($conf->global->TAX_MODE_SELL_PRODUCT == 'payment' || $conf->global->TAX_MODE_SELL_SERVICE == 'payment') print '<td align="left">'.$langs->trans("DatePayment").'</td>';
|
||||
print '<td class="left">'.$elementcust.'</td>';
|
||||
print '<td class="left">'.$langs->trans("DateInvoice").'</td>';
|
||||
if ($conf->global->TAX_MODE_SELL_PRODUCT == 'payment' || $conf->global->TAX_MODE_SELL_SERVICE == 'payment') print '<td class="left">'.$langs->trans("DatePayment").'</td>';
|
||||
else print '<td></td>';
|
||||
print '<td align="left">'.$namecust.'</td>';
|
||||
print '<td align="left">'.$productcust.'</td>';
|
||||
print '<td class="left">'.$namecust.'</td>';
|
||||
print '<td class="left">'.$productcust.'</td>';
|
||||
if ($modetax != 1)
|
||||
{
|
||||
print '<td align="right">'.$amountcust.'</td>';
|
||||
@ -393,17 +393,17 @@ if (! is_array($x_coll) || ! is_array($x_paye))
|
||||
print '<td class="nowrap" align="left">'.$fields['link'].'</td>';
|
||||
|
||||
// Invoice date
|
||||
print '<td align="left">' . dol_print_date($fields['datef'], 'day') . '</td>';
|
||||
print '<td class="left">' . dol_print_date($fields['datef'], 'day') . '</td>';
|
||||
|
||||
// Payment date
|
||||
if ($conf->global->TAX_MODE_SELL_PRODUCT == 'payment' || $conf->global->TAX_MODE_SELL_SERVICE == 'payment') print '<td align="left">' . dol_print_date($fields['datep'], 'day') . '</td>';
|
||||
if ($conf->global->TAX_MODE_SELL_PRODUCT == 'payment' || $conf->global->TAX_MODE_SELL_SERVICE == 'payment') print '<td class="left">' . dol_print_date($fields['datep'], 'day') . '</td>';
|
||||
else print '<td></td>';
|
||||
|
||||
// Company name
|
||||
print '<td align="left">' . $fields['company_link'] . '</td>';
|
||||
print '<td class="left">' . $fields['company_link'] . '</td>';
|
||||
|
||||
// Description
|
||||
print '<td align="left">';
|
||||
print '<td class="left">';
|
||||
if ($fields['pid'])
|
||||
{
|
||||
$product_static->id=$fields['pid'];
|
||||
@ -529,12 +529,12 @@ if (! is_array($x_coll) || ! is_array($x_paye))
|
||||
|
||||
// Print table headers for this quadri - expenses now
|
||||
print '<tr class="liste_titre liste_titre_topborder">';
|
||||
print '<td align="left">'.$elementsup.'</td>';
|
||||
print '<td align="left">'.$langs->trans("DateInvoice").'</td>';
|
||||
if ($conf->global->TAX_MODE_BUY_PRODUCT == 'payment' || $conf->global->TAX_MODE_BUY_SERVICE == 'payment') print '<td align="left">'.$langs->trans("DatePayment").'</td>';
|
||||
print '<td class="left">'.$elementsup.'</td>';
|
||||
print '<td class="left">'.$langs->trans("DateInvoice").'</td>';
|
||||
if ($conf->global->TAX_MODE_BUY_PRODUCT == 'payment' || $conf->global->TAX_MODE_BUY_SERVICE == 'payment') print '<td class="left">'.$langs->trans("DatePayment").'</td>';
|
||||
else print '<td></td>';
|
||||
print '<td align="left">'.$namesup.'</td>';
|
||||
print '<td align="left">'.$productsup.'</td>';
|
||||
print '<td class="left">'.$namesup.'</td>';
|
||||
print '<td class="left">'.$productsup.'</td>';
|
||||
if ($modetax != 1) {
|
||||
print '<td align="right">'.$amountsup.'</td>';
|
||||
print '<td align="right">'.$langs->trans("Payment").' ('.$langs->trans("PercentOfInvoice").')</td>';
|
||||
@ -574,17 +574,17 @@ if (! is_array($x_coll) || ! is_array($x_paye))
|
||||
print '<td class="nowrap" align="left">'.$fields['link'].'</td>';
|
||||
|
||||
// Invoice date
|
||||
print '<td align="left">' . dol_print_date($fields['datef'], 'day') . '</td>';
|
||||
print '<td class="left">' . dol_print_date($fields['datef'], 'day') . '</td>';
|
||||
|
||||
// Payment date
|
||||
if ($conf->global->TAX_MODE_BUY_PRODUCT == 'payment' || $conf->global->TAX_MODE_BUY_SERVICE == 'payment') print '<td align="left">' . dol_print_date($fields['datep'], 'day') . '</td>';
|
||||
if ($conf->global->TAX_MODE_BUY_PRODUCT == 'payment' || $conf->global->TAX_MODE_BUY_SERVICE == 'payment') print '<td class="left">' . dol_print_date($fields['datep'], 'day') . '</td>';
|
||||
else print '<td></td>';
|
||||
|
||||
// Company name
|
||||
print '<td align="left">' . $fields['company_link'] . '</td>';
|
||||
print '<td class="left">' . $fields['company_link'] . '</td>';
|
||||
|
||||
// Description
|
||||
print '<td align="left">';
|
||||
print '<td class="left">';
|
||||
if ($fields['pid'])
|
||||
{
|
||||
$product_static->id=$fields['pid'];
|
||||
|
||||
@ -2388,8 +2388,6 @@ class Contrat extends CommonObject
|
||||
|
||||
dol_include_once('/projet/class/project.class.php');
|
||||
|
||||
$this->context['createfromclone'] = 'createfromclone';
|
||||
|
||||
$error = 0;
|
||||
|
||||
$this->fetch($this->id);
|
||||
@ -2440,6 +2438,7 @@ class Contrat extends CommonObject
|
||||
}
|
||||
|
||||
// Create clone
|
||||
$clonedObj->context['createfromclone'] = 'createfromclone';
|
||||
$result = $clonedObj->create($user);
|
||||
if ($result < 0) {
|
||||
$error ++;
|
||||
@ -2479,7 +2478,7 @@ class Contrat extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
unset($this->context['createfromclone']);
|
||||
unset($clonedObj->context['createfromclone']);
|
||||
|
||||
// End
|
||||
if (! $error) {
|
||||
|
||||
@ -202,7 +202,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && ! empty($permissiontoadd)
|
||||
{
|
||||
if ($object->id > 0)
|
||||
{
|
||||
// Because createFromClone modifies the object, we must clone it so that we can restore it later
|
||||
// Because createFromClone modifies the object, we must clone it so that we can restore it later if error
|
||||
$orig = clone $object;
|
||||
|
||||
$result=$object->createFromClone($user, $object->id);
|
||||
|
||||
@ -427,6 +427,7 @@ class Ctyperesource
|
||||
// ...
|
||||
|
||||
// Create clone
|
||||
$object->context['createfromclone'] = 'createfromclone';
|
||||
$result = $object->create($user);
|
||||
|
||||
// Other options
|
||||
@ -436,6 +437,8 @@ class Ctyperesource
|
||||
dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
|
||||
}
|
||||
|
||||
unset($object->context['createfromclone']);
|
||||
|
||||
// End
|
||||
if (!$error) {
|
||||
$this->db->commit();
|
||||
@ -444,7 +447,7 @@ class Ctyperesource
|
||||
} else {
|
||||
$this->db->rollback();
|
||||
|
||||
return - 1;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -207,6 +207,8 @@ class EmailSenderProfile extends CommonObject
|
||||
$this->errors = $object->errors;
|
||||
}
|
||||
|
||||
unset($object->context['createfromclone']);
|
||||
|
||||
// End
|
||||
if (!$error) {
|
||||
$this->db->commit();
|
||||
|
||||
@ -384,16 +384,16 @@ abstract class Stats
|
||||
$row = $this->db->fetch_object($resql);
|
||||
$result[$i]['year'] = $row->year;
|
||||
$result[$i]['nb'] = $row->nb;
|
||||
if($i>0 && $row->nb) $result[$i-1]['nb_diff'] = ($result[$i-1]['nb'] - $row->nb) / $row->nb * 100;
|
||||
if($i>0 && $row->nb>0) $result[$i-1]['nb_diff'] = ($result[$i-1]['nb'] - $row->nb) / $row->nb * 100;
|
||||
$result[$i]['total'] = $row->total;
|
||||
if($i>0 && $row->total) $result[$i-1]['total_diff'] = ($result[$i-1]['total'] - $row->total) / $row->total * 100;
|
||||
if($i>0 && $row->total>0) $result[$i-1]['total_diff'] = ($result[$i-1]['total'] - $row->total) / $row->total * 100;
|
||||
$result[$i]['avg'] = $row->avg;
|
||||
if($i>0 && $row->avg) $result[$i-1]['avg_diff'] = ($result[$i-1]['avg'] - $row->avg) / $row->avg * 100;
|
||||
if($i>0 && $row->avg>0) $result[$i-1]['avg_diff'] = ($result[$i-1]['avg'] - $row->avg) / $row->avg * 100;
|
||||
// For some $sql only
|
||||
if (isset($row->weighted))
|
||||
{
|
||||
$result[$i]['weighted'] = $row->weighted;
|
||||
if($i>0 && $row->weighted) $result[$i-1]['avg_weighted'] = ($result[$i-1]['weighted'] - $row->weighted) / $row->weighted * 100;
|
||||
if($i>0 && $row->weighted>0) $result[$i-1]['avg_weighted'] = ($result[$i-1]['weighted'] - $row->weighted) / $row->weighted * 100;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -757,8 +757,6 @@ class Cronjob extends CommonObject
|
||||
|
||||
$object=new Cronjob($this->db);
|
||||
|
||||
$object->context['createfromclone'] = 'createfromclone';
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Load source object
|
||||
@ -770,6 +768,7 @@ class Cronjob extends CommonObject
|
||||
// ...
|
||||
|
||||
// Create clone
|
||||
$object->context['createfromclone'] = 'createfromclone';
|
||||
$result=$object->create($user);
|
||||
|
||||
// Other options
|
||||
@ -782,10 +781,9 @@ class Cronjob extends CommonObject
|
||||
//if (! $error)
|
||||
//{
|
||||
|
||||
|
||||
//}
|
||||
|
||||
unset($this->context['createfromclone']);
|
||||
unset($object->context['createfromclone']);
|
||||
|
||||
// End
|
||||
if (! $error)
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2013-2017 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2015-2017 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2015 Benoit Bruchard <benoitb21@gmail.com>
|
||||
* Copyright (C) 2019 Thibault FOUCART <support@ptibogxiv.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -153,6 +154,37 @@ if ($action == 'set_DONATION_MESSAGE')
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Action
|
||||
*/
|
||||
if (preg_match('/set_([a-z0-9_\-]+)/i',$action,$reg))
|
||||
{
|
||||
$code=$reg[1];
|
||||
if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0)
|
||||
{
|
||||
header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
if (preg_match('/del_([a-z0-9_\-]+)/i',$action,$reg))
|
||||
{
|
||||
$code=$reg[1];
|
||||
if (dolibarr_del_const($db, $code, $conf->entity) > 0)
|
||||
{
|
||||
header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@ -317,11 +349,24 @@ print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
|
||||
print '<input type="hidden" name="action" value="set_DONATION_ACCOUNTINGACCOUNT" />';
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td colspan="2">';
|
||||
print $form->textwithpicto($langs->trans("DonationUserThirdparties"), $langs->trans("DonationUserThirdpartiesDesc"));
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('DONATION_USE_THIRDPARTIES');
|
||||
} else {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("DONATION_USE_THIRDPARTIES", $arrval, $conf->global->DONATION_USE_THIRDPARTIES);
|
||||
}
|
||||
print "</td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>';
|
||||
$label = $langs->trans("AccountAccounting");
|
||||
print '<label for="DONATION_ACCOUNTINGACCOUNT">' . $label . '</label></td>';
|
||||
print '<td>';
|
||||
print '<td align="center">';
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
print $formaccounting->select_account($conf->global->DONATION_ACCOUNTINGACCOUNT, 'DONATION_ACCOUNTINGACCOUNT', 1, '', 1, 1);
|
||||
@ -330,7 +375,7 @@ else
|
||||
{
|
||||
print '<input type="text" size="10" id="DONATION_ACCOUNTINGACCOUNT" name="DONATION_ACCOUNTINGACCOUNT" value="' . $conf->global->DONATION_ACCOUNTINGACCOUNT . '">';
|
||||
}
|
||||
print '</td><td align="right">';
|
||||
print '</td><td align="center">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'" />';
|
||||
print "</td></tr>\n";
|
||||
print '</form>';
|
||||
@ -342,7 +387,7 @@ print '<input type="hidden" name="action" value="set_DONATION_MESSAGE" />';
|
||||
print '<tr class="oddeven"><td colspan="2">';
|
||||
print $langs->trans("FreeTextOnDonations").' '.img_info($langs->trans("AddCRIfTooLong")).'<br>';
|
||||
print '<textarea name="DONATION_MESSAGE" class="flat" cols="80">'.$conf->global->DONATION_MESSAGE.'</textarea>';
|
||||
print '</td><td align="right">';
|
||||
print '</td><td align="center">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'" />';
|
||||
print "</td></tr>\n";
|
||||
|
||||
|
||||
383
htdocs/don/class/api_donations.class.php
Normal file
383
htdocs/don/class/api_donations.class.php
Normal file
@ -0,0 +1,383 @@
|
||||
<?php
|
||||
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use Luracast\Restler\RestException;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
|
||||
|
||||
/**
|
||||
* API class for donations
|
||||
*
|
||||
* @access protected
|
||||
* @class DolibarrApiAccess {@requires user,external}
|
||||
*/
|
||||
class Donations extends DolibarrApi
|
||||
{
|
||||
|
||||
/**
|
||||
* @var array $FIELDS Mandatory fields, checked when create and update object
|
||||
*/
|
||||
static $FIELDS = array(
|
||||
'socid'
|
||||
);
|
||||
|
||||
/**
|
||||
* @var Don $don {@type Don}
|
||||
*/
|
||||
public $don;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
global $db, $conf;
|
||||
$this->db = $db;
|
||||
$this->don = new Don($this->db);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get properties of an donation object
|
||||
*
|
||||
* Return an array with donation informations
|
||||
*
|
||||
* @param int $id ID of order
|
||||
* @return array|mixed data without useless information
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
function get($id)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->don->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->don->fetch($id);
|
||||
if( ! $result ) {
|
||||
throw new RestException(404, 'Donation not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('commande',$this->don->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
// Add external contacts ids
|
||||
//$this->commande->contacts_ids = $this->don->liste_contact(-1,'external',1);
|
||||
//$this->commande->fetchObjectLinked();
|
||||
return $this->_cleanObjectDatas($this->don);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* List donations
|
||||
*
|
||||
* Get a list of orders
|
||||
*
|
||||
* @param string $sortfield Sort field
|
||||
* @param string $sortorder Sort order
|
||||
* @param int $limit Limit for list
|
||||
* @param int $page Page number
|
||||
* @param string $thirdparty_ids Thirdparty ids to filter orders of. {@example '1' or '1,2,3'} {@pattern /^[0-9,]*$/i}
|
||||
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
|
||||
* @return array Array of order objects
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '')
|
||||
{
|
||||
global $db, $conf;
|
||||
|
||||
$obj_ret = array();
|
||||
|
||||
// case of external user, $thirdparty_ids param is ignored and replaced by user's socid
|
||||
$socids = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $thirdparty_ids;
|
||||
|
||||
// If the internal user must only see his customers, force searching by him
|
||||
$search_sale = 0;
|
||||
if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) $search_sale = DolibarrApiAccess::$user->id;
|
||||
|
||||
$sql = "SELECT t.rowid";
|
||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."don as t";
|
||||
|
||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
||||
|
||||
$sql.= ' WHERE t.entity IN ('.getEntity('don').')';
|
||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc";
|
||||
if ($socids) $sql.= " AND t.fk_soc IN (".$socids.")";
|
||||
if ($search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
|
||||
// Insert sale filter
|
||||
if ($search_sale > 0)
|
||||
{
|
||||
$sql .= " AND sc.fk_user = ".$search_sale;
|
||||
}
|
||||
// Add sql filters
|
||||
if ($sqlfilters)
|
||||
{
|
||||
if (! DolibarrApi::_checkFilters($sqlfilters))
|
||||
{
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
}
|
||||
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
if ($limit) {
|
||||
if ($page < 0)
|
||||
{
|
||||
$page = 0;
|
||||
}
|
||||
$offset = $limit * $page;
|
||||
|
||||
$sql.= $db->plimit($limit + 1, $offset);
|
||||
}
|
||||
|
||||
dol_syslog("API Rest request");
|
||||
$result = $db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$min = min($num, ($limit <= 0 ? $num : $limit));
|
||||
$i=0;
|
||||
while ($i < $min)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$commande_static = new Commande($db);
|
||||
if($commande_static->fetch($obj->rowid)) {
|
||||
// Add external contacts ids
|
||||
$commande_static->contacts_ids = $commande_static->liste_contact(-1,'external',1);
|
||||
$obj_ret[] = $this->_cleanObjectDatas($commande_static);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw new RestException(503, 'Error when retrieve commande list : '.$db->lasterror());
|
||||
}
|
||||
if( ! count($obj_ret)) {
|
||||
throw new RestException(404, 'No order found');
|
||||
}
|
||||
return $obj_ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create donation object
|
||||
*
|
||||
* @param array $request_data Request data
|
||||
* @return int ID of order
|
||||
*/
|
||||
function post($request_data = null)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401, "Insuffisant rights");
|
||||
}
|
||||
// Check mandatory fields
|
||||
$result = $this->_validate($request_data);
|
||||
|
||||
foreach($request_data as $field => $value) {
|
||||
$this->commande->$field = $value;
|
||||
}
|
||||
/*if (isset($request_data["lines"])) {
|
||||
$lines = array();
|
||||
foreach ($request_data["lines"] as $line) {
|
||||
array_push($lines, (object) $line);
|
||||
}
|
||||
$this->commande->lines = $lines;
|
||||
}*/
|
||||
|
||||
if ($this->commande->create(DolibarrApiAccess::$user) < 0) {
|
||||
throw new RestException(500, "Error creating order", array_merge(array($this->commande->error), $this->commande->errors));
|
||||
}
|
||||
|
||||
return $this->commande->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update order general fields (won't touch lines of order)
|
||||
*
|
||||
* @param int $id Id of order to update
|
||||
* @param array $request_data Datas
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
function put($id, $request_data = null)
|
||||
{
|
||||
if (! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->commande->fetch($id);
|
||||
if (! $result) {
|
||||
throw new RestException(404, 'Order not found');
|
||||
}
|
||||
|
||||
if (! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
foreach($request_data as $field => $value) {
|
||||
if ($field == 'id') continue;
|
||||
$this->commande->$field = $value;
|
||||
}
|
||||
|
||||
// Update availability
|
||||
if (!empty($this->commande->availability_id)) {
|
||||
if ($this->commande->availability($this->commande->availability_id) < 0)
|
||||
throw new RestException(400, 'Error while updating availability');
|
||||
}
|
||||
|
||||
if ($this->commande->update(DolibarrApiAccess::$user) > 0)
|
||||
{
|
||||
return $this->get($id);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new RestException(500, $this->commande->error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete donation
|
||||
*
|
||||
* @param int $id Order ID
|
||||
* @return array
|
||||
*/
|
||||
function delete($id)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->don->supprimer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$result = $this->don->fetch($id);
|
||||
if( ! $result ) {
|
||||
throw new RestException(404, 'Donation not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('don',$this->don->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
if( ! $this->don->delete(DolibarrApiAccess::$user)) {
|
||||
throw new RestException(500, 'Error when delete donation : '.$this->don->error);
|
||||
}
|
||||
|
||||
return array(
|
||||
'success' => array(
|
||||
'code' => 200,
|
||||
'message' => 'Donation deleted'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate an donation
|
||||
*
|
||||
* If you get a bad value for param notrigger check, provide this in body
|
||||
* {
|
||||
* "idwarehouse": 0,
|
||||
* "notrigger": 0
|
||||
* }
|
||||
*
|
||||
* @param int $id Order ID
|
||||
* @param int $idwarehouse Warehouse ID
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||
*
|
||||
* @url POST {id}/validate
|
||||
*
|
||||
* @throws 304
|
||||
* @throws 401
|
||||
* @throws 404
|
||||
* @throws 500
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function validate($id, $idwarehouse=0, $notrigger=0)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$result = $this->commande->fetch($id);
|
||||
if( ! $result ) {
|
||||
throw new RestException(404, 'Donation not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('don',$this->don->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$result = $this->commande->valid(DolibarrApiAccess::$user, $idwarehouse, $notrigger);
|
||||
if ($result == 0) {
|
||||
throw new RestException(304, 'Error nothing done. May be object is already validated');
|
||||
}
|
||||
if ($result < 0) {
|
||||
throw new RestException(500, 'Error when validating Order: '.$this->commande->error);
|
||||
}
|
||||
$result = $this->commande->fetch($id);
|
||||
if( ! $result ) {
|
||||
throw new RestException(404, 'Order not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$this->commande->fetchObjectLinked();
|
||||
|
||||
return $this->_cleanObjectDatas($this->commande);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean sensible object datas
|
||||
*
|
||||
* @param object $object Object to clean
|
||||
* @return array Array of cleaned object properties
|
||||
*/
|
||||
function _cleanObjectDatas($object)
|
||||
{
|
||||
|
||||
$object = parent::_cleanObjectDatas($object);
|
||||
|
||||
unset($object->note);
|
||||
unset($object->address);
|
||||
unset($object->barcode_type);
|
||||
unset($object->barcode_type_code);
|
||||
unset($object->barcode_type_label);
|
||||
unset($object->barcode_type_coder);
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate fields before create or update object
|
||||
*
|
||||
* @param array $data Array with data to verify
|
||||
* @return array
|
||||
* @throws RestException
|
||||
*/
|
||||
function _validate($data)
|
||||
{
|
||||
$commande = array();
|
||||
foreach (Orders::$FIELDS as $field) {
|
||||
if (!isset($data[$field]))
|
||||
throw new RestException(400, $field ." field missing");
|
||||
$commande[$field] = $data[$field];
|
||||
}
|
||||
return $commande;
|
||||
}
|
||||
}
|
||||
@ -419,8 +419,6 @@ class PaymentDonation extends CommonObject
|
||||
|
||||
$object=new PaymentDonation($this->db);
|
||||
|
||||
$object->context['createfromclone'] = 'createfromclone';
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Load source object
|
||||
@ -432,6 +430,7 @@ class PaymentDonation extends CommonObject
|
||||
// ...
|
||||
|
||||
// Create clone
|
||||
$object->context['createfromclone'] = 'createfromclone';
|
||||
$result=$object->create($user);
|
||||
|
||||
// Other options
|
||||
@ -444,11 +443,9 @@ class PaymentDonation extends CommonObject
|
||||
if (! $error)
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
unset($this->context['createfromclone']);
|
||||
unset($object->context['createfromclone']);
|
||||
|
||||
// End
|
||||
if (! $error)
|
||||
|
||||
@ -732,6 +732,7 @@ class EcmFiles extends CommonObject
|
||||
// ...
|
||||
|
||||
// Create clone
|
||||
$object->context['createfromclone'] = 'createfromclone';
|
||||
$result = $object->create($user);
|
||||
|
||||
// Other options
|
||||
@ -741,6 +742,8 @@ class EcmFiles extends CommonObject
|
||||
dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
|
||||
}
|
||||
|
||||
unset($object->context['createfromclone']);
|
||||
|
||||
// End
|
||||
if (!$error) {
|
||||
$this->db->commit();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -247,6 +247,8 @@ class EmailCollectorAction extends CommonObject
|
||||
$this->errors = $object->errors;
|
||||
}
|
||||
|
||||
unset($object->context['createfromclone']);
|
||||
|
||||
// End
|
||||
if (!$error) {
|
||||
$this->db->commit();
|
||||
|
||||
@ -222,6 +222,8 @@ class EmailCollectorFilter extends CommonObject
|
||||
$this->errors = $object->errors;
|
||||
}
|
||||
|
||||
unset($object->context['createfromclone']);
|
||||
|
||||
// End
|
||||
if (!$error) {
|
||||
$this->db->commit();
|
||||
|
||||
@ -315,8 +315,6 @@ class ExpenseReport extends CommonObject
|
||||
|
||||
if (empty($fk_user_author)) $fk_user_author = $user->id;
|
||||
|
||||
$this->context['createfromclone'] = 'createfromclone';
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// get extrafields so they will be clone
|
||||
@ -339,6 +337,7 @@ class ExpenseReport extends CommonObject
|
||||
$this->date_validation = '';
|
||||
|
||||
// Create clone
|
||||
$this->context['createfromclone'] = 'createfromclone';
|
||||
$result=$this->create($user);
|
||||
if ($result < 0) $error++;
|
||||
|
||||
|
||||
@ -421,8 +421,6 @@ class PaymentExpenseReport extends CommonObject
|
||||
|
||||
$object=new PaymentExpenseReport($this->db);
|
||||
|
||||
$object->context['createfromclone'] = 'createfromclone';
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Load source object
|
||||
@ -434,6 +432,7 @@ class PaymentExpenseReport extends CommonObject
|
||||
// ...
|
||||
|
||||
// Create clone
|
||||
$object->context['createfromclone'] = 'createfromclone';
|
||||
$result=$object->create($user);
|
||||
|
||||
// Other options
|
||||
@ -446,11 +445,9 @@ class PaymentExpenseReport extends CommonObject
|
||||
if (! $error)
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
unset($this->context['createfromclone']);
|
||||
unset($object->context['createfromclone']);
|
||||
|
||||
// End
|
||||
if (! $error)
|
||||
|
||||
@ -1118,8 +1118,6 @@ class Fichinter extends CommonObject
|
||||
|
||||
$error=0;
|
||||
|
||||
$this->context['createfromclone'] = 'createfromclone';
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// get extrafields so they will be clone
|
||||
@ -1158,6 +1156,7 @@ class Fichinter extends CommonObject
|
||||
$this->ref_client = '';
|
||||
|
||||
// Create clone
|
||||
$this->context['createfromclone'] = 'createfromclone';
|
||||
$result=$this->create($user);
|
||||
if ($result < 0) $error++;
|
||||
|
||||
|
||||
@ -1417,8 +1417,6 @@ class CommandeFournisseur extends CommonOrder
|
||||
|
||||
$error=0;
|
||||
|
||||
$this->context['createfromclone'] = 'createfromclone';
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Load source object
|
||||
@ -1439,6 +1437,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
$this->date_approve2 = '';
|
||||
|
||||
// Create clone
|
||||
$this->context['createfromclone'] = 'createfromclone';
|
||||
$result=$this->create($user);
|
||||
if ($result < 0) $error++;
|
||||
|
||||
|
||||
@ -496,6 +496,7 @@ class CommandeFournisseurDispatch extends CommonObject
|
||||
// ...
|
||||
|
||||
// Create clone
|
||||
$object->context['createfromclone'] = 'createfromclone';
|
||||
$result=$object->create($user);
|
||||
|
||||
// Other options
|
||||
@ -508,9 +509,10 @@ class CommandeFournisseurDispatch extends CommonObject
|
||||
if (! $error)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
unset($object->context['createfromclone']);
|
||||
|
||||
// End
|
||||
if (! $error)
|
||||
{
|
||||
|
||||
@ -2489,8 +2489,6 @@ class FactureFournisseur extends CommonInvoice
|
||||
|
||||
$object=new FactureFournisseur($this->db);
|
||||
|
||||
$object->context['createfromclone'] = 'createfromclone';
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Load source object
|
||||
@ -2521,6 +2519,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
}
|
||||
|
||||
// Create clone
|
||||
$object->context['createfromclone'] = 'createfromclone';
|
||||
$result=$object->create($user);
|
||||
|
||||
// Other options
|
||||
@ -2533,8 +2532,6 @@ class FactureFournisseur extends CommonInvoice
|
||||
if (! $error)
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
unset($object->context['createfromclone']);
|
||||
|
||||
@ -80,6 +80,7 @@ create table llx_mailing_unsubscribe
|
||||
ALTER TABLE llx_mailing_unsubscribe ADD UNIQUE uk_mailing_unsubscribe(email, entity, unsubscribegroup);
|
||||
|
||||
ALTER TABLE llx_adherent ADD gender VARCHAR(10);
|
||||
ALTER TABLE llx_subscription ADD fk_type integer(11);
|
||||
|
||||
-- Add url_id into unique index of bank_url
|
||||
ALTER TABLE llx_bank_url DROP INDEX uk_bank_url;
|
||||
|
||||
@ -22,6 +22,7 @@ create table llx_subscription
|
||||
tms timestamp,
|
||||
datec datetime,
|
||||
fk_adherent integer,
|
||||
fk_type integer,
|
||||
dateadh datetime,
|
||||
datef date,
|
||||
subscription double(24,8),
|
||||
|
||||
@ -602,8 +602,6 @@ Module2700Desc=Use online Gravatar service (www.gravatar.com) to show photo of u
|
||||
Module2800Desc=FTP Client
|
||||
Module2900Name=GeoIPMaxmind
|
||||
Module2900Desc=GeoIP Maxmind conversions capabilities
|
||||
Module3100Name=Skype
|
||||
Module3100Desc=Add a Skype button to cards for users/third parties/contacts/members
|
||||
Module3200Name=Unalterable Archives
|
||||
Module3200Desc=Enable an unalterable log of business events. Events are archived in real-time. The log is a read-only table of chained events that can be exported. This module may be mandatory for some countries.
|
||||
Module4000Name=HRM
|
||||
|
||||
@ -28,6 +28,7 @@ AliasNames=Alias name (commercial, trademark, ...)
|
||||
AliasNameShort=Alias Name
|
||||
Companies=Companies
|
||||
CountryIsInEEC=Country is inside the European Economic Community
|
||||
PriceFormatInCurrentLanguage=Price format in current language
|
||||
ThirdPartyName=Third-Party Name
|
||||
ThirdPartyEmail=Third-party Email
|
||||
ThirdParty=Third Party
|
||||
|
||||
@ -121,11 +121,11 @@ SubscriptionReminderEmail=Rappel de cotisation
|
||||
YourMembershipWasCanceled=Votre adhésion a été annulée
|
||||
CardContent=Contenu de votre fiche adhérent
|
||||
# Text of email templates
|
||||
ThisIsContentOfYourMembershipRequestWasReceived=Nous vous informons que votre demande d'adhésion a bien été reçue. <br> <br>
|
||||
ThisIsContentOfYourMembershipRequestWasReceived=Nous vous informons que votre demande d'adhésion a bien été reçue.<br><br>
|
||||
ThisIsContentOfYourMembershipWasValidated=Nous vous informons que votre adhésion a été validé avec les informations suivantes:<br><br>
|
||||
ThisIsContentOfYourSubscriptionWasRecorded=Nous vous informons que votre nouvelle cotisation a été enregistrée.<br><br>
|
||||
ThisIsContentOfSubscriptionReminderEmail=Nous voulons vous informer que votre adhésion est sur le point d'expirer. Nous espérons que vous pourrez la renouveler, votre soutien nous ait précieux <br> <br>
|
||||
ThisIsContentOfYourCard=Ceci est un rappel des informations que nous avons vos concernant. N'hésitez pas à nous contacter en cas d'erreur.<br><br>
|
||||
ThisIsContentOfSubscriptionReminderEmail=Nous voulons vous informer que votre adhésion est sur le point d'expirer. Nous espérons que vous pourrez la renouveler, votre soutien nous ait précieux<br><br>
|
||||
ThisIsContentOfYourCard=Ceci est un rappel des informations que nous avons vous concernant. N'hésitez pas à nous contacter en cas d'erreur.<br><br>
|
||||
DescADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT=Sujet de l'email reçu en cas d'auto-inscription d'un invité
|
||||
DescADHERENT_AUTOREGISTER_NOTIF_MAIL=Email reçu en cas d'auto-inscription d'un invité
|
||||
DescADHERENT_EMAIL_TEMPLATE_AUTOREGISTER=Modèle Email à utiliser pour envoyer un email à un adhérent sur auto-adhésion de l'adhérent
|
||||
|
||||
@ -289,6 +289,8 @@ class MyObject extends CommonObject
|
||||
$this->errors = $object->errors;
|
||||
}
|
||||
|
||||
unset($object->context['createfromclone']);
|
||||
|
||||
// End
|
||||
if (!$error) {
|
||||
$this->db->commit();
|
||||
|
||||
@ -39,7 +39,7 @@
|
||||
//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT','auto'); // Force lang to a particular value
|
||||
//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE','aloginmodule'); // Force authentication handler
|
||||
//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN',1); // The main.inc.php does not make a redirect if not logged, instead show simple error message
|
||||
//if (! defined("XFRAMEOPTIONS_ALLOWALL")) define('XFRAMEOPTIONS_ALLOWALL',1); // Do not add the HTTP header X-Frame-Options: SAMEORIGIN but ALLOWALL
|
||||
//if (! defined("XFRAMEOPTIONS_ALLOWALL")) define('XFRAMEOPTIONS_ALLOWALL',1); // Do not add the HTTP header 'X-Frame-Options: SAMEORIGIN' but 'X-Frame-Options: ALLOWALL'
|
||||
|
||||
// Load Dolibarr environment
|
||||
$res=0;
|
||||
|
||||
@ -338,8 +338,6 @@ class Productbatch extends CommonObject
|
||||
|
||||
$object=new Productbatch($this->db);
|
||||
|
||||
$object->context['createfromclone']='createfromclone';
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Load source object
|
||||
@ -351,6 +349,7 @@ class Productbatch extends CommonObject
|
||||
// ...
|
||||
|
||||
// Create clone
|
||||
$object->context['createfromclone']='createfromclone';
|
||||
$result=$object->create($user);
|
||||
|
||||
// Other options
|
||||
@ -363,7 +362,6 @@ class Productbatch extends CommonObject
|
||||
if (! $error)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
unset($object->context['createfromclone']);
|
||||
|
||||
@ -907,8 +907,6 @@ class Productcustomerprice extends CommonObject
|
||||
|
||||
$object = new Productcustomerprice($this->db);
|
||||
|
||||
$object->context['createfromclone']='createfromclone';
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Load source object
|
||||
@ -920,6 +918,7 @@ class Productcustomerprice extends CommonObject
|
||||
// ...
|
||||
|
||||
// Create clone
|
||||
$object->context['createfromclone']='createfromclone';
|
||||
$result = $object->create($user);
|
||||
|
||||
// Other options
|
||||
@ -929,6 +928,7 @@ class Productcustomerprice extends CommonObject
|
||||
}
|
||||
|
||||
if (! $error) {
|
||||
|
||||
}
|
||||
|
||||
unset($object->context['createfromclone']);
|
||||
|
||||
@ -582,6 +582,7 @@ class Propalmergepdfproduct extends CommonObject
|
||||
// ...
|
||||
|
||||
// Create clone
|
||||
$object->context['createfromclone']='createfromclone';
|
||||
$result=$object->create($user);
|
||||
|
||||
// Other options
|
||||
@ -594,9 +595,10 @@ class Propalmergepdfproduct extends CommonObject
|
||||
if (! $error)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
unset($object->context['createfromclone']);
|
||||
|
||||
// End
|
||||
if (! $error)
|
||||
{
|
||||
|
||||
@ -247,6 +247,8 @@ class Inventory extends CommonObject
|
||||
$this->errors = $object->errors;
|
||||
}
|
||||
|
||||
unset($object->context['createfromclone']);
|
||||
|
||||
// End
|
||||
if (!$error) {
|
||||
$this->db->commit();
|
||||
|
||||
@ -454,6 +454,7 @@ class Productlot extends CommonObject
|
||||
// ...
|
||||
|
||||
// Create clone
|
||||
$object->context['createfromclone'] = 'createfromclone';
|
||||
$result = $object->create($user);
|
||||
|
||||
// Other options
|
||||
@ -463,6 +464,8 @@ class Productlot extends CommonObject
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
}
|
||||
|
||||
unset($object->context['createfromclone']);
|
||||
|
||||
// End
|
||||
if (!$error) {
|
||||
$this->db->commit();
|
||||
|
||||
@ -443,6 +443,7 @@ class ProductStockEntrepot extends CommonObject
|
||||
// ...
|
||||
|
||||
// Create clone
|
||||
$object->context['createfromclone'] = 'createfromclone';
|
||||
$result = $object->create($user);
|
||||
|
||||
// Other options
|
||||
@ -452,6 +453,8 @@ class ProductStockEntrepot extends CommonObject
|
||||
dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
|
||||
}
|
||||
|
||||
unset($object->context['createfromclone']);
|
||||
|
||||
// End
|
||||
if (!$error) {
|
||||
$this->db->commit();
|
||||
|
||||
@ -37,14 +37,19 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
||||
// Load translation files required by the page
|
||||
$langs->load('projects');
|
||||
|
||||
$id=GETPOST('id','int');
|
||||
$projectid=GETPOST('projectid','int');
|
||||
$ref=GETPOST('ref','alpha');
|
||||
$action=GETPOST('action','alpha');
|
||||
$confirm=GETPOST('confirm','alpha');
|
||||
$cancel=GETPOST('cancel','alpha');
|
||||
$withproject=GETPOST('withproject','int');
|
||||
$project_ref=GETPOST('project_ref','alpha');
|
||||
$action = GETPOST('action','alpha');
|
||||
$massaction = GETPOST('massaction','alpha'); // The bulk action (combo box choice into lists)
|
||||
$confirm = GETPOST('confirm','alpha');
|
||||
$cancel = GETPOST('cancel','alpha');
|
||||
$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
|
||||
$contextpage= GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'myobjectlist'; // To manage different context of search
|
||||
$backtopage = GETPOST('backtopage','alpha'); // Go back to a dedicated page
|
||||
|
||||
$id = GETPOST('id','int');
|
||||
$projectid = GETPOST('projectid','int');
|
||||
$ref = GETPOST('ref','alpha');
|
||||
$withproject= GETPOST('withproject','int');
|
||||
$project_ref= GETPOST('project_ref','alpha');
|
||||
|
||||
$search_day=GETPOST('search_day','int');
|
||||
$search_month=GETPOST('search_month','int');
|
||||
@ -57,6 +62,7 @@ $search_value=GETPOST('search_value','int');
|
||||
$search_task_ref=GETPOST('search_task_ref','alpha');
|
||||
$search_task_label=GETPOST('search_task_label','alpha');
|
||||
$search_user=GETPOST('search_user','int');
|
||||
$search_valuebilled=GETPOST('search_valuebilled', 'int');
|
||||
|
||||
// Security check
|
||||
$socid=0;
|
||||
@ -116,6 +122,7 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
|
||||
$search_task_ref='';
|
||||
$search_task_label='';
|
||||
$search_user=0;
|
||||
$search_valuebilled='';
|
||||
$toselect='';
|
||||
$search_array_options=array();
|
||||
$action='';
|
||||
@ -294,6 +301,8 @@ elseif (GETPOST('project_ref','alpha'))
|
||||
* View
|
||||
*/
|
||||
|
||||
$arrayofselected=is_array($toselect)?$toselect:array();
|
||||
|
||||
llxHeader("",$langs->trans("Task"));
|
||||
|
||||
$form = new Form($db);
|
||||
@ -567,7 +576,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
||||
print '<!-- List of time spent for task -->'."\n";
|
||||
|
||||
$title=$langs->trans("ListTaskTimeForTask");
|
||||
//print_barre_liste($title, 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $linktotasks, $num, $totalnboflines, 'title_generic.png', 0, '', '', 0, 1);
|
||||
//print_barre_liste($title, 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $linktotasks, $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', 0, 1);
|
||||
print load_fiche_titre($title, $linktocreatetime, 'title_generic.png');
|
||||
|
||||
/*
|
||||
@ -683,6 +692,52 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($withproject) && $projectstatic->bill_time)
|
||||
{
|
||||
$arrayofmassactions = array(
|
||||
'generateinvoice'=>$langs->trans("GenerateInvoice"),
|
||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
//if ($user->rights->projet->creer) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
||||
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
}
|
||||
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
||||
if ($search_month > 0) $param.= '&search_month='.urlencode($search_month);
|
||||
if ($search_year > 0) $param.= '&search_year='.urlencode($search_year);
|
||||
if ($search_user > 0) $param.= '&search_user='.urlencode($search_user);
|
||||
if ($search_task_ref != '') $param.= '&search_task_ref='.urlencode($search_task_ref);
|
||||
if ($search_task_label != '') $param.= '&search_task_label='.urlencode($search_task_label);
|
||||
if ($search_note != '') $param.= '&search_note='.urlencode($search_note);
|
||||
if ($search_duration != '') $param.= '&search_field2='.urlencode($search_duration);
|
||||
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
||||
/*
|
||||
// Add $param from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
*/
|
||||
if ($id) $param.='&id='.urlencode($id);
|
||||
if ($projectid) $param.='&projectid='.urlencode($projectid);
|
||||
if ($withproject) $param.='&withproject='.urlencode($withproject);
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
if ($action == 'editline') print '<input type="hidden" name="action" value="updateline">';
|
||||
elseif ($action == 'splitline') print '<input type="hidden" name="action" value="updatesplitline">';
|
||||
elseif ($action == 'createtime' && empty($id) && $user->rights->projet->lire) print '<input type="hidden" name="action" value="addtimespent">';
|
||||
else print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
|
||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||
print '<input type="hidden" name="projectid" value="'.$projectidforalltimes.'">';
|
||||
print '<input type="hidden" name="withproject" value="'.$withproject.'">';
|
||||
|
||||
/*
|
||||
* List of time spent
|
||||
*/
|
||||
@ -691,10 +746,11 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
||||
$sql = "SELECT t.rowid, t.fk_task, t.task_date, t.task_datehour, t.task_date_withhour, t.task_duration, t.fk_user, t.note, t.thm,";
|
||||
$sql .= " pt.ref, pt.label,";
|
||||
$sql .= " u.lastname, u.firstname, u.login, u.photo, u.statut as user_status,";
|
||||
$sql .= " il.fk_facture as invoice_id, il.total_ht";
|
||||
$sql .= " il.fk_facture as invoice_id, inv.fk_statut";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facturedet as il ON il.rowid = t.invoice_line_id";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."user as u";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as inv ON inv.rowid = il.fk_facture,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."user as u";
|
||||
$sql .= " WHERE t.fk_user = u.rowid AND t.fk_task = pt.rowid";
|
||||
if (empty($projectidforalltimes)) $sql .= " AND t.fk_task =".$object->id;
|
||||
else $sql.= " AND pt.fk_projet IN (".$projectidforalltimes.")";
|
||||
@ -703,6 +759,8 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
||||
if ($search_task_ref) $sql .= natural_search('pt.ref', $search_task_ref);
|
||||
if ($search_task_label) $sql .= natural_search('pt.label', $search_task_label);
|
||||
if ($search_user > 0) $sql .= natural_search('t.fk_user', $search_user);
|
||||
if ($search_valuebilled == '1') $sql .= ' AND t.invoice_id > 0';
|
||||
if ($search_valuebilled == '0') $sql .= ' AND (t.invoice_id = 0 OR t.invoice_id IS NULL)';
|
||||
if ($search_month > 0)
|
||||
{
|
||||
if ($search_year > 0 && empty($search_day))
|
||||
@ -716,23 +774,49 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
||||
{
|
||||
$sql.= " AND t.task_datehour BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'";
|
||||
}
|
||||
|
||||
//$sql .= ' GROUP BY t.rowid, t.fk_task, t.task_date, t.task_datehour, t.task_date_withhour, t.task_duration, t.fk_user, t.note, t.thm, pt.ref, pt.label, u.lastname, u.firstname, u.login, u.photo, u.statut, il.fk_facture';
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$totalnboflines=$num;
|
||||
$resql = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($resql);
|
||||
if (($page * $limit) > $nbtotalofrecords) // if total of record found is smaller than page * limit, goto and load page 0
|
||||
{
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
}
|
||||
}
|
||||
// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set.
|
||||
if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords)
|
||||
{
|
||||
$num = $nbtotalofrecords;
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql.= $db->plimit($limit+1, $offset);
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
}
|
||||
|
||||
if ($num >= 0)
|
||||
{
|
||||
if (! empty($projectidforalltimes))
|
||||
{
|
||||
print '<!-- List of time spent for project -->'."\n";
|
||||
|
||||
$title=$langs->trans("ListTaskTimeUserProject");
|
||||
//$linktotasks='<a href="'.DOL_URL_ROOT.'/projet/tasks.php?id='.$projectstatic->id.'">'.$langs->trans("GoToListOfTasks").'</a>';
|
||||
//print_barre_liste($title, 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $linktotasks, $num, $totalnboflines, 'title_generic.png', 0, '', '', 0, 1);
|
||||
print load_fiche_titre($title, $linktocreatetime, 'title_generic.png');
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic', 0, $linktocreatetime, '', $limit);
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
@ -749,18 +833,12 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Form to add time spent
|
||||
*/
|
||||
if ($action == 'createtime' && empty($id) && $user->rights->projet->lire)
|
||||
{
|
||||
print '<!-- form to add time spent -->'."\n";
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="addtimespent">';
|
||||
print '<input type="hidden" name="projectid" value="'.$projectstatic->id.'">';
|
||||
print '<input type="hidden" name="withproject" value="'.$withproject.'">';
|
||||
print '<!-- table to add time spent -->'."\n";
|
||||
|
||||
print '<table class="noborder nohover" width="100%">';
|
||||
|
||||
@ -827,7 +905,8 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
||||
// Invoiced
|
||||
if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_BILL_TIME_SPENT))
|
||||
{
|
||||
print '<td></td>';
|
||||
print '<td>';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print '<td align="center">';
|
||||
@ -836,58 +915,11 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
||||
print '<input type="submit" name="cancel" class="button" value="'.$langs->trans("Cancel").'">';
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table></form>';
|
||||
print '</table>';
|
||||
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
|
||||
$arrayofselected=is_array($toselect)?$toselect:array();
|
||||
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($search_month > 0) $param.= '&search_month='.urlencode($search_month);
|
||||
if ($search_year > 0) $param.= '&search_year='.urlencode($search_year);
|
||||
if ($search_user > 0) $param.= '&search_user='.urlencode($search_user);
|
||||
if ($search_task_ref != '') $param.= '&search_task_ref='.urlencode($search_task_ref);
|
||||
if ($search_task_label != '') $param.= '&search_task_label='.urlencode($search_task_label);
|
||||
if ($search_note != '') $param.= '&search_note='.urlencode($search_note);
|
||||
if ($search_duration != '') $param.= '&search_field2='.urlencode($search_duration);
|
||||
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
||||
/*
|
||||
// Add $param from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
*/
|
||||
if ($id) $param.='&id='.urlencode($id);
|
||||
if ($projectid) $param.='&projectid='.urlencode($projectid);
|
||||
if ($withproject) $param.='&withproject='.urlencode($withproject);
|
||||
|
||||
|
||||
$arrayofmassactions = array(
|
||||
//'presend'=>$langs->trans("SendByMail"),
|
||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
//if ($user->rights->projet->creer) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
||||
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$id.'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
if ($action == 'editline') print '<input type="hidden" name="action" value="updateline">';
|
||||
elseif ($action == 'splitline') print '<input type="hidden" name="action" value="updatesplitline">';
|
||||
else print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
|
||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||
print '<input type="hidden" name="projectid" value="'.$projectidforalltimes.'">';
|
||||
print '<input type="hidden" name="withproject" value="'.$withproject.'">';
|
||||
|
||||
$moreforfilter = '';
|
||||
|
||||
$parameters=array();
|
||||
@ -904,6 +936,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
||||
|
||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
$selectedfields.=(count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
@ -933,7 +966,8 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
||||
// Value in main currency
|
||||
if (! empty($arrayfields['value']['checked'])) print '<td class="liste_titre"></td>';
|
||||
// Value billed
|
||||
if (! empty($arrayfields['valuebilled']['checked'])) print '<td class="liste_titre"></td>';
|
||||
if (! empty($arrayfields['valuebilled']['checked'])) print '<td class="liste_titre center">'.$form->selectyesno('search_valuebilled', $search_valuebilled, 1, false, 1).'</td>';
|
||||
|
||||
/*
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
|
||||
@ -944,7 +978,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
||||
print $hookmanager->resPrint;
|
||||
// Action column
|
||||
print '<td class="liste_titre center">';
|
||||
$searchpicto=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1);
|
||||
$searchpicto=$form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print '</tr>'."\n";
|
||||
@ -960,7 +994,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
||||
if (! empty($arrayfields['t.note']['checked'])) print_liste_field_titre($arrayfields['t.note']['label'],$_SERVER['PHP_SELF'],'t.note','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['t.task_duration']['checked'])) print_liste_field_titre($arrayfields['t.task_duration']['label'],$_SERVER['PHP_SELF'],'t.task_duration','',$param,'align="right"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['value']['checked'])) print_liste_field_titre($arrayfields['value']['label'],$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['valuebilled']['checked'])) print_liste_field_titre($arrayfields['valuebilled']['label'],$_SERVER['PHP_SELF'],'il.total_ht','',$param,'align="right"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['valuebilled']['checked'])) print_liste_field_titre($arrayfields['valuebilled']['label'],$_SERVER['PHP_SELF'],'il.total_ht','',$param,'align="center"',$sortfield,$sortorder);
|
||||
/*
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||
@ -983,6 +1017,8 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
||||
$totalarray=array();
|
||||
foreach ($tasks as $task_time)
|
||||
{
|
||||
if ($i >= $limit) break;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
$date1=$db->jdate($task_time->task_date);
|
||||
@ -1117,10 +1153,10 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
||||
$totalarray['totalvalue'] += $value;
|
||||
}
|
||||
|
||||
// Value billed
|
||||
// Invoiced - Value billed
|
||||
if (! empty($arrayfields['valuebilled']['checked']))
|
||||
{
|
||||
print '<td align="right">'; // invoice_id and invoice_line_id
|
||||
print '<td align="center">'; // invoice_id and invoice_line_id
|
||||
if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_BILL_TIME_SPENT))
|
||||
{
|
||||
if ($projectstatic->bill_time)
|
||||
@ -1186,6 +1222,14 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$task_time->fk_task.'&action=deleteline&lineid='.$task_time->rowid.$param.'">';
|
||||
print img_delete();
|
||||
print '</a>';
|
||||
|
||||
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
{
|
||||
$selected=0;
|
||||
if (in_array($task_time->rowid, $arrayofselected)) $selected=1;
|
||||
print ' ';
|
||||
print '<input id="cb'.$task_time->rowid.'" class="flat checkforselect marginleftonly" type="checkbox" name="toselect[]" value="'.$task_time->rowid.'"'.($selected?' checked="checked"':'').'>';
|
||||
}
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
@ -1509,7 +1553,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
||||
}
|
||||
elseif ($totalarray['totaldurationfield'] == $i) print '<td align="right">'.convertSecondToTime($totalarray['totalduration'],'allhourmin').'</td>';
|
||||
elseif ($totalarray['totalvaluefield'] == $i) print '<td align="right">'.price($totalarray['totalvalue']).'</td>';
|
||||
elseif ($totalarray['totalvaluebilledfield'] == $i) print '<td align="right">'.price($totalarray['totalvaluebilled']).'</td>';
|
||||
//elseif ($totalarray['totalvaluebilledfield'] == $i) print '<td align="center">'.price($totalarray['totalvaluebilled']).'</td>';
|
||||
else print '<td></td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
@ -269,6 +269,8 @@ class CompanyPaymentMode extends CommonObject
|
||||
$this->errors = $object->errors;
|
||||
}
|
||||
|
||||
unset($object->context['createfromclone']);
|
||||
|
||||
// End
|
||||
if (!$error) {
|
||||
$this->db->commit();
|
||||
|
||||
@ -240,6 +240,8 @@ class SocieteAccount extends CommonObject
|
||||
$this->errors = $object->errors;
|
||||
}
|
||||
|
||||
unset($object->context['createfromclone']);
|
||||
|
||||
// End
|
||||
if (!$error) {
|
||||
$this->db->commit();
|
||||
|
||||
@ -1176,6 +1176,7 @@ class SupplierProposal extends CommonObject
|
||||
$this->ref = $modSupplierProposal->getNextValue($objsoc,$this);
|
||||
|
||||
// Create clone
|
||||
$this->context['createfromclone'] = 'createfromclone';
|
||||
$result=$this->create($user);
|
||||
if ($result < 0) $error++;
|
||||
|
||||
@ -1191,6 +1192,8 @@ class SupplierProposal extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
unset($this->context['createfromclone']);
|
||||
|
||||
// End
|
||||
if (! $error)
|
||||
{
|
||||
|
||||
@ -971,6 +971,7 @@ class Ticket extends CommonObject
|
||||
// Clear fields
|
||||
// ...
|
||||
// Create clone
|
||||
$object->context['createfromclone'] = 'createfromclone';
|
||||
$result = $object->create($user);
|
||||
|
||||
// Other options
|
||||
@ -982,6 +983,8 @@ class Ticket extends CommonObject
|
||||
if (!$error) {
|
||||
}
|
||||
|
||||
unset($object->context['createfromclone']);
|
||||
|
||||
// End
|
||||
if (!$error) {
|
||||
$this->db->commit();
|
||||
|
||||
@ -593,11 +593,11 @@ class Website extends CommonObject
|
||||
{
|
||||
// Delete old file
|
||||
$filetplold=$pathofwebsitenew.'/page'.$pageid.'.tpl.php';
|
||||
dol_syslog("We regenerate alias page new name=".$filealias.", old name=".$fileoldalias);
|
||||
dol_delete_file($filetplold);
|
||||
|
||||
// Create new file
|
||||
$objectpagenew = $objectpageold->createFromClone($user, $pageid, $objectpageold->pageurl, '', 0, $object->id, 1);
|
||||
|
||||
//print $pageid.' = '.$objectpageold->pageurl.' -> '.$objectpagenew->id.' = '.$objectpagenew->pageurl.'<br>';
|
||||
if (is_object($objectpagenew) && $objectpagenew->pageurl)
|
||||
{
|
||||
@ -632,7 +632,7 @@ class Website extends CommonObject
|
||||
if (! $res > 0)
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($objectpage->error, $objectpage->errors, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
@ -646,6 +646,8 @@ class Website extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
unset($object->context['createfromclone']);
|
||||
|
||||
// End
|
||||
if (!$error) {
|
||||
$this->db->commit();
|
||||
|
||||
@ -447,6 +447,8 @@ class WebsitePage extends CommonObject
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
}
|
||||
|
||||
unset($object->context['createfromclone']);
|
||||
|
||||
// End
|
||||
if (!$error) {
|
||||
$this->db->commit();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user