Merge branch 'develop' of github.com:Dolibarr/dolibarr into develop
Conflicts: htdocs/langs/en_US/products.lang
This commit is contained in:
commit
b3fc8d2940
@ -8,14 +8,10 @@ charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
[*.php]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
indent_style = tab
|
||||
[*.js]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
indent_style = tab
|
||||
[*.css]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
indent_style = tab
|
||||
[*.xml]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
indent_style = tab
|
||||
|
||||
@ -164,7 +164,7 @@ print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<tr '.$bc[$var].' id="tramount"><td>';
|
||||
print $langs->trans("DefaultAmount");
|
||||
print '</td><td align="right">';
|
||||
print '<input type="text" id="MEMBER_NEWFORM_AMOUNT" name="MEMBER_NEWFORM_AMOUNT" size="5" value="'.(! empty($conf->global->MEMBER_NEWFORM_AMOUNT)?$conf->global->MEMBER_NEWFORM_AMOUNT:'').'">';;
|
||||
print '<input type="text" id="MEMBER_NEWFORM_AMOUNT" name="MEMBER_NEWFORM_AMOUNT" size="5" value="'.(! empty($conf->global->MEMBER_NEWFORM_AMOUNT)?$conf->global->MEMBER_NEWFORM_AMOUNT:'').'">';
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Can edit
|
||||
@ -197,7 +197,7 @@ if (! empty($conf->paybox->enabled) || ! empty($conf->paypal->enabled))
|
||||
print '<tr '.$bc[$var].' id="tremail"><td>';
|
||||
print $langs->trans("MEMBER_PAYONLINE_SENDEMAIL");
|
||||
print '</td><td align="right">';
|
||||
print '<input type="text" id="MEMBER_PAYONLINE_SENDEMAIL" name="MEMBER_PAYONLINE_SENDEMAIL" size="24" value="'.(! empty($conf->global->MEMBER_PAYONLINE_SENDEMAIL)?$conf->global->MEMBER_PAYONLINE_SENDEMAIL:'').'">';;
|
||||
print '<input type="text" id="MEMBER_PAYONLINE_SENDEMAIL" name="MEMBER_PAYONLINE_SENDEMAIL" size="24" value="'.(! empty($conf->global->MEMBER_PAYONLINE_SENDEMAIL)?$conf->global->MEMBER_PAYONLINE_SENDEMAIL:'').'">';
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
|
||||
|
||||
@ -249,7 +249,7 @@ if (empty($reshook))
|
||||
}
|
||||
$lastname=$_POST["lastname"];
|
||||
$firstname=$_POST["firstname"];
|
||||
$morphy=$morphy=$_POST["morphy"];;
|
||||
$morphy=$morphy=$_POST["morphy"];
|
||||
if ($morphy != 'mor' && empty($lastname)) {
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
|
||||
@ -913,7 +913,7 @@ if ($id)
|
||||
print "</tr>";
|
||||
|
||||
$colspan=count($fieldlist)+2;
|
||||
if ($id == 4) $colspan++;;
|
||||
if ($id == 4) $colspan++;
|
||||
|
||||
if (! empty($alabelisused)) // Si un des champs est un libelle
|
||||
{
|
||||
|
||||
@ -164,7 +164,7 @@ if (! empty($conf->service->enabled))
|
||||
$var=! $var;
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
print $langs->trans("CashdeskShowServices");
|
||||
print '<td colspan="2">';;
|
||||
print '<td colspan="2">';
|
||||
print $form->selectyesno("CASHDESK_SERVICES",$conf->global->CASHDESK_SERVICES,1);
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
|
||||
@ -1164,7 +1164,7 @@ class Categorie extends CommonObject
|
||||
{
|
||||
$cats = array();
|
||||
|
||||
$typeid=-1; $table='';;
|
||||
$typeid=-1; $table='';
|
||||
if ($type == '0' || $type == 'product') { $typeid=0; $table='product'; $type='product'; }
|
||||
else if ($type == '1' || $type == 'supplier') { $typeid=1; $table='societe'; $type='fournisseur'; }
|
||||
else if ($type == '2' || $type == 'customer') { $typeid=2; $table='societe'; $type='societe'; }
|
||||
|
||||
@ -155,7 +155,7 @@ if (empty($reshook))
|
||||
if ($action == 'setoutstanding_limit')
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->outstanding_limit=GETPOST('setoutstanding_limit');
|
||||
$object->outstanding_limit=GETPOST('outstanding_limit');
|
||||
$result=$object->set_OutstandingBill($user);
|
||||
if ($result < 0) setEventMessage($object->error,'errors');
|
||||
}
|
||||
@ -406,9 +406,15 @@ if ($id > 0)
|
||||
$limit_field_type = (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) ? 'numeric' : 'amount';
|
||||
print $form->editfieldval("OutstandingBill",'outstanding_limit',$object->outstanding_limit,$object,$user->rights->societe->creer,$limit_field_type,($object->outstanding_limit != '' ? price($object->outstanding_limit) : ''));
|
||||
// display amount and link to unpaid bill
|
||||
$outstandigBills = $object->get_OutstandingBill();
|
||||
if ($outstandigBills != 0)
|
||||
print " (".$langs->trans("CurrentOutstandingBill")." <a href='".DOL_URL_ROOT."/compta/facture/list.php?socid=".$object->id."&search_status=1'>".price($outstandigBills, '', $langs, 0, 0, -1, $conf->currency).'</a>)';
|
||||
$outstandingBills = $object->get_OutstandingBill();
|
||||
if ($outstandingBills != 0) {
|
||||
print ' ('.$langs->trans("CurrentOutstandingBill");
|
||||
print ' <a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->id.'&search_status=1">';
|
||||
print price($outstandingBills, '', $langs, 0, -1, -1, $conf->currency);
|
||||
print '</a>';
|
||||
if ($outstandingBills > $object->outstanding_limit) print img_warning($langs->trans("OutstandingBillReached"));
|
||||
print ')';
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@ -579,6 +579,103 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Opened Order
|
||||
*/
|
||||
if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
|
||||
{
|
||||
$langs->load("order");
|
||||
|
||||
$sql = "SELECT s.nom as name, s.rowid, c.rowid as commandeid, c.total as total_ttc, c.total_ht, c.tva as total_tva, c.ref, c.ref_client, c.fk_statut, c.date_valid as dv ";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."commande as c";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE c.fk_soc = s.rowid";
|
||||
$sql.= " AND c.entity = ".$conf->entity;
|
||||
$sql.= " AND c.fk_statut = 1";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||
$sql.= " ORDER BY c.rowid DESC";
|
||||
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$total = 0;
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
if ($num > 0)
|
||||
{
|
||||
$var=true;
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="5">'.$langs->trans("OrdersOpened").' <a href="'.DOL_URL_ROOT.'/commande/list.php?viewstatut=1"><span class="badge">'.$num.'</span></td></tr>';
|
||||
|
||||
$nbofloop=min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD)?500:$conf->global->MAIN_MAXLIST_OVERLOAD));
|
||||
while ($i < $nbofloop)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
|
||||
// Ref
|
||||
print '<td class="nowrap" width="140">';
|
||||
|
||||
$orderstatic->id=$obj->commandeid;
|
||||
$orderstatic->ref=$obj->ref;
|
||||
$orderstatic->ref_client=$obj->ref_client;
|
||||
$orderstatic->total_ht = $obj->total_ht;
|
||||
$orderstatic->total_tva = $obj->total_tva;
|
||||
$orderstatic->total_ttc = $obj->total_ttc;
|
||||
|
||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||
print '<td class="nobordernopadding nowrap">';
|
||||
print $orderstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
print '<td width="18" class="nobordernopadding nowrap">';
|
||||
//if ($db->jdate($obj->dfv) < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late"));
|
||||
print '</td>';
|
||||
print '<td width="16" align="center" class="nobordernopadding">';
|
||||
$filename=dol_sanitizeFileName($obj->ref);
|
||||
$filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref);
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->propalid;
|
||||
print $formfile->getDocumentsLink($orderstatic->element, $filename, $filedir);
|
||||
print '</td></tr></table>';
|
||||
|
||||
print "</td>";
|
||||
|
||||
print '<td class="nowrap">';
|
||||
$companystatic->id=$obj->rowid;
|
||||
$companystatic->name=$obj->name;
|
||||
$companystatic->client=$obj->client;
|
||||
$companystatic->canvas=$obj->canvas;
|
||||
print $companystatic->getNomUrl(1, 'company', 44);
|
||||
print '</td>';
|
||||
print '<td align="right">';
|
||||
print dol_print_date($db->jdate($obj->dp),'day').'</td>'."\n";
|
||||
print '<td align="right">'.price($obj->total_ttc).'</td>';
|
||||
print '<td align="center" width="14">'.$orderstatic->LibStatut($obj->fk_statut,3).'</td>'."\n";
|
||||
print '</tr>'."\n";
|
||||
$i++;
|
||||
$total += $obj->total_ttc;
|
||||
}
|
||||
if ($num > $nbofloop)
|
||||
{
|
||||
print '<tr class="liste_total"><td colspan="5">'.$langs->trans("XMoreLines", ($num - $nbofloop))."</td></tr>";
|
||||
}
|
||||
else if ($total>0)
|
||||
{
|
||||
print '<tr class="liste_total"><td colspan="3">'.$langs->trans("Total")."</td><td align=\"right\">".price($total)."</td><td> </td></tr>";
|
||||
}
|
||||
print "</table><br>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
print '</div></div></div>';
|
||||
|
||||
|
||||
@ -379,7 +379,7 @@ else
|
||||
elseif ($links[$key]['type']=='payment_supplier')
|
||||
{
|
||||
$paymentsupplierstatic->id=$links[$key]['url_id'];
|
||||
$paymentsupplierstatic->ref=$langs->trans("Payment");;
|
||||
$paymentsupplierstatic->ref=$langs->trans("Payment");
|
||||
print ' '.$paymentsupplierstatic->getNomUrl(1);
|
||||
$newline=0;
|
||||
}
|
||||
|
||||
@ -1966,12 +1966,12 @@ if ($action == 'create')
|
||||
print $soc->getNomUrl(1);
|
||||
print '<input type="hidden" name="socid" value="' . $soc->id . '">';
|
||||
// Outstanding Bill
|
||||
$outstandigBills = $soc->get_OutstandingBill();
|
||||
$outstandingBills = $soc->get_OutstandingBill();
|
||||
print ' (' . $langs->trans('CurrentOutstandingBill') . ': ';
|
||||
print price($outstandigBills, '', $langs, 0, 0, -1, $conf->currency);
|
||||
print price($outstandingBills, '', $langs, 0, 0, -1, $conf->currency);
|
||||
if ($soc->outstanding_limit != '')
|
||||
{
|
||||
if ($outstandigBills > $soc->outstanding_limit) print img_warning($langs->trans("OutstandingBillReached"));
|
||||
if ($outstandingBills > $soc->outstanding_limit) print img_warning($langs->trans("OutstandingBillReached"));
|
||||
print ' / ' . price($soc->outstanding_limit, '', $langs, 0, 0, -1, $conf->currency);
|
||||
}
|
||||
print ')';
|
||||
@ -2832,11 +2832,11 @@ if ($action == 'create')
|
||||
print ' ';
|
||||
print '(<a href="' . DOL_URL_ROOT . '/compta/facture/list.php?socid=' . $object->socid . '">' . $langs->trans('OtherBills') . '</a>';
|
||||
// Outstanding Bill
|
||||
$outstandigBills = $soc->get_OutstandingBill();
|
||||
$outstandingBills = $soc->get_OutstandingBill();
|
||||
print ' - ' . $langs->trans('CurrentOutstandingBill') . ': ';
|
||||
print price($outstandigBills, '', $langs, 0, 0, - 1, $conf->currency);
|
||||
print price($outstandingBills, '', $langs, 0, 0, - 1, $conf->currency);
|
||||
if ($soc->outstanding_limit != '') {
|
||||
if ($outstandigBills > $soc->outstanding_limit)
|
||||
if ($outstandingBills > $soc->outstanding_limit)
|
||||
print img_warning($langs->trans("OutstandingBillReached"));
|
||||
print ' / ' . price($soc->outstanding_limit);
|
||||
}
|
||||
|
||||
@ -298,7 +298,7 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++)
|
||||
if ($annee_decalage != $year_end) print '<td width="15"> </td>';
|
||||
}
|
||||
|
||||
$total_ht[$annee]+=!empty($cum_ht[$case]) ? $cum_ht[$case] : 0;;
|
||||
$total_ht[$annee]+=!empty($cum_ht[$case]) ? $cum_ht[$case] : 0;
|
||||
$total[$annee]+=$cum[$case];
|
||||
}
|
||||
|
||||
|
||||
@ -3350,25 +3350,26 @@ abstract class CommonObject
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."element_resources";
|
||||
$sql.= " WHERE rowid =".$rowid;
|
||||
$sql.= " WHERE rowid=".$rowid;
|
||||
|
||||
dol_syslog(get_class($this)."::delete_resource", LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
if (! $notrigger)
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! $notrigger)
|
||||
{
|
||||
$result=$this->call_trigger(strtoupper($element).'_DELETE_RESOURCE', $user);
|
||||
if ($result < 0) { $this->db->rollback(); return -1; }
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011-2015 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* 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
|
||||
@ -836,18 +836,18 @@ function monthArray($outputlangs,$short=0)
|
||||
if (! empty($short))
|
||||
{
|
||||
$montharray = array (
|
||||
1 => $outputlangs->trans("Jan"),
|
||||
2 => $outputlangs->trans("Feb"),
|
||||
3 => $outputlangs->trans("Mar"),
|
||||
4 => $outputlangs->trans("Apr"),
|
||||
5 => $outputlangs->trans("May"),
|
||||
6 => $outputlangs->trans("Jun"),
|
||||
7 => $outputlangs->trans("Jul"),
|
||||
8 => $outputlangs->trans("Aug"),
|
||||
9 => $outputlangs->trans("Sep"),
|
||||
10 => $outputlangs->trans("Oct"),
|
||||
11 => $outputlangs->trans("Nov"),
|
||||
12 => $outputlangs->trans("Dec")
|
||||
1 => $outputlangs->trans("JanuaryMin"),
|
||||
2 => $outputlangs->trans("FebruaryMin"),
|
||||
3 => $outputlangs->trans("MarchMin"),
|
||||
4 => $outputlangs->trans("AprilMin"),
|
||||
5 => $outputlangs->trans("MayMin"),
|
||||
6 => $outputlangs->trans("JuneMin"),
|
||||
7 => $outputlangs->trans("JulyMin"),
|
||||
8 => $outputlangs->trans("AugustMin"),
|
||||
9 => $outputlangs->trans("SeptemberMin"),
|
||||
10 => $outputlangs->trans("OctoberMin"),
|
||||
11 => $outputlangs->trans("NovemberMin"),
|
||||
12 => $outputlangs->trans("DecemberMin")
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -231,7 +231,7 @@ function dol_getshmop($memoryid)
|
||||
global $shmkeys,$shmoffset;
|
||||
|
||||
if (empty($shmkeys[$memoryid]) || ! function_exists("shmop_open")) return 0;
|
||||
$shmkey=dol_getshmopaddress($memoryid);;
|
||||
$shmkey=dol_getshmopaddress($memoryid);
|
||||
//print 'dol_getshmop memoryid='.$memoryid." shmkey=".$shmkey."<br>\n";
|
||||
$handle=@shmop_open($shmkey,'a',0,0);
|
||||
if ($handle)
|
||||
|
||||
@ -117,17 +117,17 @@ function task_prepare_head($object)
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/task.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':'');;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/task.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':'');
|
||||
$head[$h][1] = $langs->trans("Card");
|
||||
$head[$h][2] = 'task_task';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/contact.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':'');;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/contact.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':'');
|
||||
$head[$h][1] = $langs->trans("TaskRessourceLinks");
|
||||
$head[$h][2] = 'task_contact';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/time.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':'');;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/time.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':'');
|
||||
$head[$h][1] = $langs->trans("TimeSpent");
|
||||
$head[$h][2] = 'task_time';
|
||||
$h++;
|
||||
@ -143,14 +143,14 @@ function task_prepare_head($object)
|
||||
$nbNote = 0;
|
||||
if(!empty($object->note_private)) $nbNote++;
|
||||
if(!empty($object->note_public)) $nbNote++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/note.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':'');;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/note.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':'');
|
||||
$head[$h][1] = $langs->trans('Notes');
|
||||
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
|
||||
$head[$h][2] = 'task_notes';
|
||||
$h++;
|
||||
}
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/document.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':'');;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/document.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':'');
|
||||
$filesdir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->project->ref) . '/' .dol_sanitizeFileName($object->ref);
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
$listoffiles=dol_dir_list($filesdir,'files',1,'','thumbs');
|
||||
|
||||
@ -496,7 +496,7 @@ function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction,
|
||||
$sql.= " AND f.fk_statut in (1,2)"; // Paid (partially or completely)
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.type IN (0,1,2,5)";
|
||||
else $sql.= " AND f.type IN (0,1,2,3,5)";
|
||||
$sql.= " AND f.rowid = d.".$fk_facture;;
|
||||
$sql.= " AND f.rowid = d.".$fk_facture;
|
||||
$sql.= " AND pf.".$fk_facture2." = f.rowid";
|
||||
$sql.= " AND pa.rowid = pf.".$fk_payment;
|
||||
if ($y && $m)
|
||||
|
||||
@ -218,9 +218,9 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0)
|
||||
|
||||
|
||||
// Tools
|
||||
$tmpentry=array('enabled'=>(! empty($conf->barcode->enabled) || ! empty($conf->mailing->enabled) || ! empty($conf->export->enabled) || ! empty($conf->import->enabled) || ! empty($conf->opensurvey->enabled)),
|
||||
'perms'=>(! empty($conf->barcode->enabled) || ! empty($user->rights->mailing->lire) || ! empty($user->rights->export->lire) || ! empty($user->rights->import->run) || ! empty($user->rights->opensurvey->read)),
|
||||
'module'=>'mailing|export|import|opensurvey');
|
||||
$tmpentry=array('enabled'=>(! empty($conf->barcode->enabled) || ! empty($conf->mailing->enabled) || ! empty($conf->export->enabled) || ! empty($conf->import->enabled) || ! empty($conf->opensurvey->enabled) || ! empty($conf->resource->enabled)),
|
||||
'perms'=>(! empty($conf->barcode->enabled) || ! empty($user->rights->mailing->lire) || ! empty($user->rights->export->lire) || ! empty($user->rights->import->run) || ! empty($user->rights->opensurvey->read) || ! empty($user->rights->resource->read)),
|
||||
'module'=>'mailing|export|import|opensurvey|resource');
|
||||
$showmode=dol_eldy_showmenu($type_user, $tmpentry, $listofmodulesforexternal);
|
||||
if ($showmode)
|
||||
{
|
||||
|
||||
@ -376,7 +376,7 @@ class ImportCsv extends ModeleImports
|
||||
if ($obj) $tablewithentity_cache[$tablename]=1; // table contains entity field
|
||||
else $tablewithentity_cache[$tablename]=0; // table does not contains entity field
|
||||
}
|
||||
else dol_print_error($this->db);;
|
||||
else dol_print_error($this->db);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -61,7 +61,7 @@ class modResource extends DolibarrModules
|
||||
// (where XXX is value of numeric property 'numero' of module)
|
||||
$this->description = "Manage resources (printers, cars, room, ...) you can then share into events";
|
||||
// Possible values for version are: 'development', 'experimental' or version
|
||||
$this->version = 'development';
|
||||
$this->version = 'dolibarr';
|
||||
// Key used in llx_const table to save module status enabled/disabled
|
||||
// (where MYMODULE is value of property name of module in uppercase)
|
||||
$this->const_name = 'MAIN_MODULE_' . strtoupper($this->name);
|
||||
@ -114,8 +114,7 @@ class modResource extends DolibarrModules
|
||||
$this->requiredby = array('modPlace');
|
||||
// Minimum version of PHP required by module
|
||||
$this->phpmin = array(5, 3);
|
||||
// Minimum version of Dolibarr required by module
|
||||
$this->need_dolibarr_version = array(3, 5);
|
||||
|
||||
$this->langfiles = array("resource@resource"); // langfiles@resource
|
||||
// Constants
|
||||
// List of particular constants to add when module is enabled
|
||||
|
||||
@ -416,7 +416,7 @@ class doc_generic_task_odt extends ModelePDFTask
|
||||
$project= new Project($this->db);
|
||||
$project->fetch($object->fk_project);
|
||||
|
||||
$dir = $conf->projet->dir_output. "/" . $project->ref. "/";;
|
||||
$dir = $conf->projet->dir_output. "/" . $project->ref. "/";
|
||||
$objectref = dol_sanitizeFileName($object->ref);
|
||||
if (! preg_match('/specimen/i',$objectref)) $dir.= "/" . $objectref;
|
||||
$file = $dir . "/" . $objectref . ".odt";
|
||||
|
||||
@ -589,6 +589,57 @@ class pdf_azur extends ModelePDFPropales
|
||||
$this->_pagefoot($pdf,$object,$outputlangs);
|
||||
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
|
||||
|
||||
//If propal merge product PDF is active
|
||||
if (!empty($conf->global->PRODUIT_PDF_MERGE_PROPAL))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/propalmergepdfproduct.class.php';
|
||||
|
||||
$already_merged = array ();
|
||||
foreach ( $object->lines as $line ) {
|
||||
if (! empty($line->fk_product) && ! (in_array($line->fk_product, $already_merged))) {
|
||||
// Find the desire PDF
|
||||
$filetomerge = new Propalmergepdfproduct($this->db);
|
||||
|
||||
if ($conf->global->MAIN_MULTILANGS) {
|
||||
$filetomerge->fetch_by_product($line->fk_product, $outputlangs->defaultlang);
|
||||
} else {
|
||||
$filetomerge->fetch_by_product($line->fk_product);
|
||||
}
|
||||
|
||||
$already_merged[] = $line->fk_product;
|
||||
|
||||
// If PDF is selected and file is not empty
|
||||
if (count($filetomerge->lines) > 0) {
|
||||
foreach ( $filetomerge->lines as $linefile ) {
|
||||
if (! empty($linefile->id) && ! empty($linefile->file_name)) {
|
||||
if (! empty($conf->product->enabled))
|
||||
$filetomerge_dir = $conf->product->multidir_output[$conf->entity] . '/' . dol_sanitizeFileName($line->product_ref);
|
||||
elseif (! empty($conf->service->enabled))
|
||||
$filetomerge_dir = $conf->service->multidir_output[$conf->entity] . '/' . dol_sanitizeFileName($line->product_ref);
|
||||
|
||||
dol_syslog(get_class($this) . ':: upload_dir=' . $filetomerge_dir, LOG_DEBUG);
|
||||
|
||||
$infile = $filetomerge_dir . '/' . $linefile->file_name;
|
||||
if (is_file($infile)) {
|
||||
$pagecount = $pdf->setSourceFile($infile);
|
||||
for($i = 1; $i <= $pagecount; $i ++) {
|
||||
$tplidx = $pdf->ImportPage($i);
|
||||
$s = $pdf->getTemplatesize($tplidx);
|
||||
$pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L');
|
||||
$pdf->useTemplate($tplidx);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//exit;
|
||||
|
||||
|
||||
|
||||
$pdf->Close();
|
||||
|
||||
$pdf->Output($file,'F');
|
||||
|
||||
@ -56,7 +56,7 @@
|
||||
else if (type == 'boolean') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();}
|
||||
else if (type == 'price') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();}
|
||||
else if (type == 'select') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();}
|
||||
else if (type == 'link') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();;jQuery("#helpchkbxlst").hide();jQuery("#helplink").show();}
|
||||
else if (type == 'link') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").show();}
|
||||
else if (type == 'sellist') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").show();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();}
|
||||
else if (type == 'radio') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();}
|
||||
else if (type == 'checkbox') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();}
|
||||
|
||||
@ -129,7 +129,7 @@ if (empty($usemargins)) $usemargins=0;
|
||||
<?php } ?>
|
||||
<td align="right" class="nowrap"><?php $coldisplay++; ?><?php echo vatrate($line->tva_tx,'%',$line->info_bits); ?></td>
|
||||
|
||||
<td align="right" class="nowrap"><?php $coldisplay++; ?><?php echo price($line->pu_ht); ?></td>
|
||||
<td align="right" class="nowrap"><?php $coldisplay++; ?><?php echo price($line->subprice); ?></td>
|
||||
|
||||
<?php if ($inputalsopricewithtax) { ?>
|
||||
<td align="right" class="nowrap"><?php $coldisplay++; ?><?php echo (isset($line->pu_ttc)?price($line->pu_ttc):price($line->subprice)); ?></td>
|
||||
|
||||
@ -90,7 +90,7 @@ if( (array) $linked_resources && count($linked_resources) > 0)
|
||||
print img_edit();
|
||||
print '</a>';
|
||||
print ' ';
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=delete_resource&element='.$element.'&element_id='.$element_id.'&lineid='.$linked_resource['rowid'].'">';
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=delete_resource&id='.$linked_resource['resource_id'].'&element='.$element.'&element_id='.$element_id.'&lineid='.$linked_resource['rowid'].'">';
|
||||
print img_delete();
|
||||
print '</a>';
|
||||
print '</div>';
|
||||
|
||||
@ -623,7 +623,7 @@ class ExpenseReport extends CommonObject
|
||||
print $langs->trans('Draft').' '.img_picto($langs->trans('Draft'),'statut0');
|
||||
break;
|
||||
case 2:
|
||||
print $langs->trans('TripForValid').' '.img_picto($langs->trans('TripForValid'),'statut3');;
|
||||
print $langs->trans('TripForValid').' '.img_picto($langs->trans('TripForValid'),'statut3');
|
||||
break;
|
||||
case 5:
|
||||
print $langs->trans('TripForPaid').' '.img_picto($langs->trans('TripForPaid'),'statut3');
|
||||
|
||||
@ -424,7 +424,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
// Bouton Enregistrer
|
||||
if ($action != 'add_paiement')
|
||||
{
|
||||
print '<<br><div class="center"><input type="checkbox" checked="checked" name="closepaidinvoices"> '.$langs->trans("ClosePaidInvoicesAutomatically");
|
||||
print '<br><div class="center"><input type="checkbox" checked="checked" name="closepaidinvoices"> '.$langs->trans("ClosePaidInvoicesAutomatically");
|
||||
print '<br><input type="submit" class="button" value="'.$langs->trans('Save').'"></div>';
|
||||
}
|
||||
|
||||
|
||||
@ -520,3 +520,14 @@ create table llx_c_price_global_variable_updater
|
||||
ALTER TABLE llx_adherent CHANGE COLUMN note note_private text DEFAULT NULL;
|
||||
ALTER TABLE llx_adherent ADD COLUMN note_public text DEFAULT NULL after note_private;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS llx_propal_merge_pdf_product (
|
||||
rowid integer NOT NULL auto_increment PRIMARY KEY,
|
||||
fk_product integer NOT NULL,
|
||||
file_name varchar(200) NOT NULL,
|
||||
lang varchar(5) DEFAULT NULL,
|
||||
fk_user_author integer DEFAULT NULL,
|
||||
fk_user_mod integer NOT NULL,
|
||||
datec datetime NOT NULL,
|
||||
tms timestamp NOT NULL,
|
||||
import_key varchar(14) DEFAULT NULL
|
||||
) ENGINE=InnoDB;
|
||||
28
htdocs/install/mysql/tables/llx_propal_merge_pdf_product.sql
Normal file
28
htdocs/install/mysql/tables/llx_propal_merge_pdf_product.sql
Normal file
@ -0,0 +1,28 @@
|
||||
-- <Product - Quote - PDF>
|
||||
-- Copyright (C) 2013 Florian HENRY <florian.henry@open-concept.pro>
|
||||
--
|
||||
-- This program is free software: you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation, either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
CREATE TABLE IF NOT EXISTS llx_propal_merge_pdf_product (
|
||||
rowid integer NOT NULL auto_increment PRIMARY KEY,
|
||||
fk_product integer NOT NULL,
|
||||
file_name varchar(200) NOT NULL,
|
||||
lang varchar(5) DEFAULT NULL,
|
||||
fk_user_author integer DEFAULT NULL,
|
||||
fk_user_mod integer NOT NULL,
|
||||
datec datetime NOT NULL,
|
||||
tms timestamp NOT NULL,
|
||||
import_key varchar(14) DEFAULT NULL
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
@ -1384,6 +1384,7 @@ NumberOfProductShowInSelect=Max number of products in combos select lists (0=no
|
||||
ConfirmDeleteProductLineAbility=Confirmation when removing product lines in forms
|
||||
ModifyProductDescAbility=Personalization of product descriptions in forms
|
||||
ViewProductDescInFormAbility=Visualization of product descriptions in the forms (otherwise as popup tooltip)
|
||||
MergePropalProductCard=Activate in product/service Attached Files tab an option to merge product PDF document to proposal PDF azur if product/service is in the proposal
|
||||
ViewProductDescInThirdpartyLanguageAbility=Visualization of products descriptions in the thirdparty language
|
||||
UseSearchToSelectProductTooltip=Also if you have a large number of product (> 100 000), you can increase speed by setting constant PRODUCT_DONOTSEARCH_ANYWHERE to 1 in Setup->Other. Search will then be limited to start of string.
|
||||
UseSearchToSelectProduct=Use a search form to choose a product (rather than a drop-down list).
|
||||
|
||||
@ -267,3 +267,5 @@ GlobalVariableUpdaterHelpFormat1=format is {"URL": "http://example.com/urlofws",
|
||||
UpdateInterval=Update interval (minutes)
|
||||
LastUpdated=Last updated
|
||||
CorrectlyUpdated=Correctly updated
|
||||
PropalMergePdfProductActualFile=Files use to add into PDF Azur are/is
|
||||
PropalMergePdfProductChooseFile=Select PDF files
|
||||
|
||||
@ -394,7 +394,7 @@ if ($action == 'create')
|
||||
*/
|
||||
print '<td align="center">';
|
||||
$quantite_livree = $commande->livraisons[$line->id];
|
||||
print $quantite_livree;;
|
||||
print $quantite_livree;
|
||||
print '</td>';
|
||||
|
||||
$quantite_commandee = $line->qty;
|
||||
|
||||
@ -367,7 +367,7 @@ if ($comments) {
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("NoCommentYet").'<br>';;
|
||||
print $langs->trans("NoCommentYet").'<br>';
|
||||
}
|
||||
|
||||
print '<br>';
|
||||
|
||||
@ -159,6 +159,10 @@ else if ($action == 'viewProdTextsInThirdpartyLanguage')
|
||||
$view = GETPOST('activate_viewProdTextsInThirdpartyLanguage','alpha');
|
||||
$res = dolibarr_set_const($db, "PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE", $view,'chaine',0,'',$conf->entity);
|
||||
}
|
||||
elseif ($action == 'mergePropalProductCard') {
|
||||
$view = GETPOST('activate_mergePropalProductCard','alpha');
|
||||
$res = dolibarr_set_const($db, "PRODUIT_PDF_MERGE_PROPAL", $view,'chaine',0,'',$conf->entity);
|
||||
}
|
||||
else if ($action == 'usesearchtoselectproduct')
|
||||
{
|
||||
$usesearch = GETPOST('activate_usesearchtoselectproduct','alpha');
|
||||
@ -428,6 +432,21 @@ print '</td>';
|
||||
print '</tr>';
|
||||
print '</form>';
|
||||
|
||||
// Activate propal merge produt card
|
||||
$var=!$var;
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="mergePropalProductCard">';
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$langs->trans("MergePropalProductCard").'</td>';
|
||||
print '<td width="60" align="right">';
|
||||
print $form->selectyesno("activate_mergePropalProductCard",$conf->global->PRODUIT_PDF_MERGE_PROPAL,1);
|
||||
print '</td><td align="right">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '</form>';
|
||||
|
||||
// View product description in thirdparty language
|
||||
if (! empty($conf->global->MAIN_MULTILANGS))
|
||||
{
|
||||
|
||||
656
htdocs/product/class/propalmergepdfproduct.class.php
Normal file
656
htdocs/product/class/propalmergepdfproduct.class.php
Normal file
@ -0,0 +1,656 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2015 Florian HENRY <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/product/class/propalmergepdfproduct.class.php
|
||||
* \ingroup product
|
||||
* \brief This file is an CRUD class file (Create/Read/Update/Delete)
|
||||
*/
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php");
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Put here description of your class
|
||||
*/
|
||||
class Propalmergepdfproduct extends CommonObject
|
||||
{
|
||||
var $db; //!< To store db handler
|
||||
var $error; //!< To return error code (or message)
|
||||
var $errors=array(); //!< To return several error codes (or messages)
|
||||
var $element='propal_merge_pdf_product'; //!< Id that identify managed objects
|
||||
var $table_element='propal_merge_pdf_product'; //!< Name of table without prefix where object is stored
|
||||
|
||||
var $id;
|
||||
|
||||
var $fk_product;
|
||||
var $file_name;
|
||||
var $fk_user_author;
|
||||
var $fk_user_mod;
|
||||
var $datec='';
|
||||
var $tms='';
|
||||
var $import_key;
|
||||
var $lang;
|
||||
|
||||
var $lines=array();
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDb $db Database handler
|
||||
*/
|
||||
function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create object into database
|
||||
*
|
||||
* @param User $user User that creates
|
||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||
* @return int <0 if KO, Id of created object if OK
|
||||
*/
|
||||
function create($user, $notrigger=0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
$error=0;
|
||||
|
||||
// Clean parameters
|
||||
|
||||
if (isset($this->fk_product)) $this->fk_product=trim($this->fk_product);
|
||||
if (isset($this->file_name)) $this->file_name=trim($this->file_name);
|
||||
if (isset($this->fk_user_author)) $this->fk_user_author=trim($this->fk_user_author);
|
||||
if (isset($this->fk_user_mod)) $this->fk_user_mod=trim($this->fk_user_mod);
|
||||
if (isset($this->lang)) $this->lang=trim($this->lang);
|
||||
if (isset($this->import_key)) $this->import_key=trim($this->import_key);
|
||||
|
||||
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add control on parameters values
|
||||
|
||||
// Insert request
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."propal_merge_pdf_product(";
|
||||
|
||||
$sql.= "fk_product,";
|
||||
$sql.= "file_name,";
|
||||
if ($conf->global->MAIN_MULTILANGS) {
|
||||
$sql.= "lang,";
|
||||
}
|
||||
$sql.= "fk_user_author,";
|
||||
$sql.= "fk_user_mod,";
|
||||
$sql.= "datec";
|
||||
|
||||
|
||||
$sql.= ") VALUES (";
|
||||
|
||||
$sql.= " ".(! isset($this->fk_product)?'NULL':"'".$this->fk_product."'").",";
|
||||
$sql.= " ".(! isset($this->file_name)?'NULL':"'".$this->db->escape($this->file_name)."'").",";
|
||||
if ($conf->global->MAIN_MULTILANGS) {
|
||||
$sql.= " ".(! isset($this->lang)?'NULL':"'".$this->db->escape($this->lang)."'").",";
|
||||
}
|
||||
$sql.= " ".$user->id.",";
|
||||
$sql.= " ".$user->id.",";
|
||||
$sql.= " '".$this->db->idate(dol_now())."'";
|
||||
|
||||
|
||||
$sql.= ")";
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."propal_merge_pdf_product");
|
||||
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action calls a trigger.
|
||||
|
||||
//// Call triggers
|
||||
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
//$interface=new Interfaces($this->db);
|
||||
//$result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf);
|
||||
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
//// End call triggers
|
||||
}
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error)
|
||||
{
|
||||
foreach($this->errors as $errmsg)
|
||||
{
|
||||
dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR);
|
||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1*$error;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->commit();
|
||||
return $this->id;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load object in memory from the database
|
||||
*
|
||||
* @param int $id Id object
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetch($id)
|
||||
{
|
||||
global $langs,$conf;
|
||||
|
||||
$sql = "SELECT";
|
||||
$sql.= " t.rowid,";
|
||||
|
||||
$sql.= " t.fk_product,";
|
||||
$sql.= " t.file_name,";
|
||||
$sql.= " t.lang,";
|
||||
$sql.= " t.fk_user_author,";
|
||||
$sql.= " t.fk_user_mod,";
|
||||
$sql.= " t.datec,";
|
||||
$sql.= " t.tms,";
|
||||
$sql.= " t.import_key";
|
||||
|
||||
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."propal_merge_pdf_product as t";
|
||||
$sql.= " WHERE t.rowid = ".$id;
|
||||
|
||||
dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($this->db->num_rows($resql))
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
|
||||
$this->fk_product = $obj->fk_product;
|
||||
$this->file_name = $obj->file_name;
|
||||
if ($conf->global->MAIN_MULTILANGS) {
|
||||
$this->lang = $obj->lang;
|
||||
}
|
||||
$this->fk_user_author = $obj->fk_user_author;
|
||||
$this->fk_user_mod = $obj->fk_user_mod;
|
||||
$this->datec = $this->db->jdate($obj->datec);
|
||||
$this->tms = $this->db->jdate($obj->tms);
|
||||
$this->import_key = $obj->import_key;
|
||||
|
||||
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load object in memory from the database
|
||||
*
|
||||
* @param int $id Id object
|
||||
* @param string $lang lang string id
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetch_by_product($product_id, $lang='')
|
||||
{
|
||||
global $langs,$conf;
|
||||
|
||||
$sql = "SELECT";
|
||||
$sql.= " t.rowid,";
|
||||
|
||||
$sql.= " t.fk_product,";
|
||||
$sql.= " t.file_name,";
|
||||
$sql.= " t.lang,";
|
||||
$sql.= " t.fk_user_author,";
|
||||
$sql.= " t.fk_user_mod,";
|
||||
$sql.= " t.datec,";
|
||||
$sql.= " t.tms,";
|
||||
$sql.= " t.import_key";
|
||||
|
||||
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."propal_merge_pdf_product as t";
|
||||
$sql.= " WHERE t.fk_product = ".$product_id;
|
||||
if ($conf->global->MAIN_MULTILANGS && !empty($lang)) {
|
||||
$sql.= " AND t.lang = '".$lang."'";
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($this->db->num_rows($resql))
|
||||
{
|
||||
while($obj = $this->db->fetch_object($resql)) {
|
||||
|
||||
$line = new PropalmergepdfproductLine();
|
||||
|
||||
$line->id = $obj->rowid;
|
||||
|
||||
$line->fk_product = $obj->fk_product;
|
||||
$line->file_name = $obj->file_name;
|
||||
if ($conf->global->MAIN_MULTILANGS) {
|
||||
$line->lang = $obj->lang;
|
||||
}
|
||||
$line->fk_user_author = $obj->fk_user_author;
|
||||
$line->fk_user_mod = $obj->fk_user_mod;
|
||||
$line->datec = $this->db->jdate($obj->datec);
|
||||
$line->tms = $this->db->jdate($obj->tms);
|
||||
$line->import_key = $obj->import_key;
|
||||
|
||||
|
||||
if ($conf->global->MAIN_MULTILANGS) {
|
||||
$this->lines[$obj->file_name.'_'.$obj->lang]=$line;
|
||||
}else {
|
||||
$this->lines[$obj->file_name]=$line;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::fetch_by_product ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update object into database
|
||||
*
|
||||
* @param User $user User that modifies
|
||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function update($user=0, $notrigger=0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
$error=0;
|
||||
|
||||
// Clean parameters
|
||||
|
||||
if (isset($this->fk_product)) $this->fk_product=trim($this->fk_product);
|
||||
if (isset($this->file_name)) $this->file_name=trim($this->file_name);
|
||||
if (isset($this->fk_user_mod)) $this->fk_user_mod=trim($this->fk_user_mod);
|
||||
if (isset($this->lang)) $this->lang=trim($this->lang);
|
||||
|
||||
|
||||
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add a control on parameters values
|
||||
|
||||
// Update request
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."propal_merge_pdf_product SET";
|
||||
|
||||
$sql.= " fk_product=".(isset($this->fk_product)?$this->fk_product:"null").",";
|
||||
$sql.= " file_name=".(isset($this->file_name)?"'".$this->db->escape($this->file_name)."'":"null").",";
|
||||
if ($conf->global->MAIN_MULTILANGS) {
|
||||
$sql.= " lang=".(isset($this->lang)?"'".$this->db->escape($this->lang)."'":"null").",";
|
||||
}
|
||||
$sql.= " fk_user_mod=".$user->id;
|
||||
|
||||
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action calls a trigger.
|
||||
|
||||
//// Call triggers
|
||||
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
//$interface=new Interfaces($this->db);
|
||||
//$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf);
|
||||
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
//// End call triggers
|
||||
}
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error)
|
||||
{
|
||||
foreach($this->errors as $errmsg)
|
||||
{
|
||||
dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
|
||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1*$error;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete object in database
|
||||
*
|
||||
* @param User $user User that deletes
|
||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function delete($user, $notrigger=0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
$error=0;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action calls a trigger.
|
||||
|
||||
//// Call triggers
|
||||
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
//$interface=new Interfaces($this->db);
|
||||
//$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf);
|
||||
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
//// End call triggers
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."propal_merge_pdf_product";
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error)
|
||||
{
|
||||
foreach($this->errors as $errmsg)
|
||||
{
|
||||
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
|
||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1*$error;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete object in database
|
||||
*
|
||||
* @param User $user User that deletes
|
||||
* @param int $product_id product_id
|
||||
* @param string $lang_id language
|
||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function delete_by_product($user, $product_id, $lang_id='', $notrigger=0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
$error=0;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action calls a trigger.
|
||||
|
||||
//// Call triggers
|
||||
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
//$interface=new Interfaces($this->db);
|
||||
//$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf);
|
||||
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
//// End call triggers
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."propal_merge_pdf_product";
|
||||
$sql.= " WHERE fk_product=".$product_id;
|
||||
|
||||
if ($conf->global->MAIN_MULTILANGS && !empty($lang_id)) {
|
||||
$sql.= " AND lang='".$lang_id."'";
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error)
|
||||
{
|
||||
foreach($this->errors as $errmsg)
|
||||
{
|
||||
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
|
||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1*$error;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete object in database
|
||||
*
|
||||
* @param User $user User that deletes
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function delete_by_file($user)
|
||||
{
|
||||
global $conf, $langs;
|
||||
$error=0;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action calls a trigger.
|
||||
|
||||
//// Call triggers
|
||||
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
//$interface=new Interfaces($this->db);
|
||||
//$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf);
|
||||
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
//// End call triggers
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."propal_merge_pdf_product";
|
||||
$sql.= " WHERE fk_product=".$this->fk_product." AND file_name='".$this->db->escape($this->file_name)."'";
|
||||
|
||||
dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error)
|
||||
{
|
||||
foreach($this->errors as $errmsg)
|
||||
{
|
||||
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
|
||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1*$error;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Load an object from its id and create a new one in database
|
||||
*
|
||||
* @param int $fromid Id of object to clone
|
||||
* @return int New id of clone
|
||||
*/
|
||||
function createFromClone($fromid)
|
||||
{
|
||||
global $user,$langs;
|
||||
|
||||
$error=0;
|
||||
|
||||
$object=new Propalmergepdfproduct($this->db);
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Load source object
|
||||
$object->fetch($fromid);
|
||||
$object->id=0;
|
||||
$object->statut=0;
|
||||
|
||||
// Clear fields
|
||||
// ...
|
||||
|
||||
// Create clone
|
||||
$result=$object->create($user);
|
||||
|
||||
// Other options
|
||||
if ($result < 0)
|
||||
{
|
||||
$this->error=$object->error;
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
// End
|
||||
if (! $error)
|
||||
{
|
||||
$this->db->commit();
|
||||
return $object->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialise object with example values
|
||||
* Id must be 0 if object instance is a specimen
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function initAsSpecimen()
|
||||
{
|
||||
$this->id=0;
|
||||
|
||||
$this->fk_product='';
|
||||
$this->file_name='';
|
||||
$this->fk_user_author='';
|
||||
$this->fk_user_mod='';
|
||||
$this->datec='';
|
||||
$this->tms='';
|
||||
$this->import_key='';
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class PropalmergepdfproductLine{
|
||||
var $id;
|
||||
|
||||
var $fk_product;
|
||||
var $file_name;
|
||||
var $lang;
|
||||
var $fk_user_author;
|
||||
var $fk_user_mod;
|
||||
var $datec='';
|
||||
var $tms='';
|
||||
var $import_key;
|
||||
|
||||
function __construct() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
@ -268,7 +268,7 @@ if ($id > 0 || ! empty($ref))
|
||||
$productstatic->type=$value["fk_product_type"];
|
||||
$productstatic->ref=$value['label'];
|
||||
print '<tr>';
|
||||
print '<td>'.$productstatic->getNomUrl(1,'composition').'</td>';;
|
||||
print '<td>'.$productstatic->getNomUrl(1,'composition').'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
@ -33,6 +33,8 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
if (!empty($conf->global->PRODUIT_PDF_MERGE_PROPAL))
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/propalmergepdfproduct.class.php';
|
||||
|
||||
$langs->load("other");
|
||||
$langs->load("products");
|
||||
@ -84,8 +86,70 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
//Delete line if product propal merge is linked to a file
|
||||
if (!empty($conf->global->PRODUIT_PDF_MERGE_PROPAL)) {
|
||||
if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
||||
{
|
||||
print 'toto';
|
||||
//extract file name
|
||||
$urlfile = GETPOST('urlfile', 'alpha');
|
||||
$filename = basename($urlfile);
|
||||
$filetomerge = new Propalmergepdfproduct($db);
|
||||
$filetomerge->fk_product=$object->id;
|
||||
$filetomerge->file_name=$filename;
|
||||
$result=$filetomerge->delete_by_file($user);
|
||||
if ($result<0) {
|
||||
setEventMessage($filetomerge->error,'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Action sending file
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_pre_headers.tpl.php';
|
||||
|
||||
}
|
||||
|
||||
if ($action=='filemerge') {
|
||||
$is_refresh = GETPOST('refresh');
|
||||
if (empty($is_refresh)) {
|
||||
|
||||
$filetomerge_file_array = GETPOST('filetoadd');
|
||||
|
||||
$filetomerge_file_array = GETPOST('filetoadd');
|
||||
|
||||
if ($conf->global->MAIN_MULTILANGS) {
|
||||
$lang_id = GETPOST('lang_id');
|
||||
}
|
||||
|
||||
// Delete all file already associated
|
||||
$filetomerge = new Propalmergepdfproduct($db);
|
||||
|
||||
if ($conf->global->MAIN_MULTILANGS) {
|
||||
$result=$filetomerge->delete_by_product($user, $object->id, $lang_id);
|
||||
} else {
|
||||
$result=$filetomerge->delete_by_product($user, $object->id);
|
||||
}
|
||||
if ($result<0) {
|
||||
setEventMessage($filetomerge->error,'errors');
|
||||
}
|
||||
|
||||
// for each file checked add it to the product
|
||||
if (is_array($filetomerge_file_array)) {
|
||||
foreach ( $filetomerge_file_array as $filetomerge_file ) {
|
||||
$filetomerge->fk_product = $object->id;
|
||||
$filetomerge->file_name = $filetomerge_file;
|
||||
|
||||
if ($conf->global->MAIN_MULTILANGS) {
|
||||
$filetomerge->lang = $lang_id;
|
||||
}
|
||||
|
||||
$result=$filetomerge->create($user);
|
||||
if ($result<0) {
|
||||
setEventMessage($filetomerge->error,'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -142,13 +206,139 @@ if ($object->id)
|
||||
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
|
||||
print '</div>';
|
||||
|
||||
$modulepart = 'produit';
|
||||
$permission = (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->creer) || ($object->type == Product::TYPE_SERVICE && $user->rights->service->creer));
|
||||
$param = '&id=' . $object->id;
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
|
||||
|
||||
|
||||
//Merge propal PDF docuemnt PDF files
|
||||
if (!empty($conf->global->PRODUIT_PDF_MERGE_PROPAL))
|
||||
{
|
||||
$filetomerge = new Propalmergepdfproduct($db);
|
||||
|
||||
if ($conf->global->MAIN_MULTILANGS) {
|
||||
$lang_id = GETPOST('lang_id');
|
||||
$result = $filetomerge->fetch_by_product($object->id, $lang_id);
|
||||
} else {
|
||||
$result = $filetomerge->fetch_by_product($object->id);
|
||||
}
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$filearray = dol_dir_list($upload_dir, "files", 0, '', '\.meta$', 'name', SORT_ASC, 1);
|
||||
|
||||
// For each file build select list with PDF extention
|
||||
if (count($filearray) > 0) {
|
||||
print '<br>';
|
||||
// Actual file to merge is :
|
||||
if (count($filetomerge->lines) > 0) {
|
||||
print $langs->trans('PropalMergePdfProductActualFile');
|
||||
}
|
||||
|
||||
print '<form name="filemerge" action="' . DOL_URL_ROOT . '/product/document.php?id=' . $object->id . '" method="post">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||
print '<input type="hidden" name="action" value="filemerge">';
|
||||
if (count($filetomerge->lines) == 0) {
|
||||
print $langs->trans('PropalMergePdfProductChooseFile');
|
||||
}
|
||||
|
||||
print '<table class="noborder">';
|
||||
|
||||
// Get language
|
||||
if ($conf->global->MAIN_MULTILANGS) {
|
||||
|
||||
$langs->load("languages");
|
||||
|
||||
print '<tr class="liste_titre"><td>';
|
||||
|
||||
$delauft_lang = (empty($lang_id)) ? $langs->getDefaultLang() : $lang_id;
|
||||
|
||||
$langs_available = $langs->get_available_languages(DOL_DOCUMENT_ROOT, 12);
|
||||
|
||||
print '<select class="flat" id="lang_id" name="lang_id">';
|
||||
|
||||
asort($langs_available);
|
||||
|
||||
$uncompletelanguages = array (
|
||||
'da_DA',
|
||||
'fi_FI',
|
||||
'hu_HU',
|
||||
'is_IS',
|
||||
'pl_PL',
|
||||
'ro_RO',
|
||||
'ru_RU',
|
||||
'sv_SV',
|
||||
'tr_TR',
|
||||
'zh_CN'
|
||||
);
|
||||
foreach ( $langs_available as $key => $value ) {
|
||||
if ($showwarning && in_array($key, $uncompletelanguages)) {
|
||||
// $value.=' - '.$langs->trans("TranslationUncomplete",$key);
|
||||
}
|
||||
if ($filter && is_array($filter)) {
|
||||
if (! array_key_exists($key, $filter)) {
|
||||
print '<option value="' . $key . '">' . $value . '</option>';
|
||||
}
|
||||
} else if ($delauft_lang == $key) {
|
||||
print '<option value="' . $key . '" selected="selected">' . $value . '</option>';
|
||||
} else {
|
||||
print '<option value="' . $key . '">' . $value . '</option>';
|
||||
}
|
||||
}
|
||||
print '</select>';
|
||||
|
||||
if ($conf->global->MAIN_MULTILANGS) {
|
||||
print '<input type="submit" class="button" name="refresh" value="' . $langs->trans('Refresh') . '">';
|
||||
}
|
||||
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
$style = 'impair';
|
||||
foreach ( $filearray as $filetoadd ) {
|
||||
|
||||
if ($ext = pathinfo($filetoadd['name'], PATHINFO_EXTENSION) == 'pdf') {
|
||||
|
||||
if ($style == 'pair') {
|
||||
$style = 'impair';
|
||||
} else {
|
||||
$style = 'pair';
|
||||
}
|
||||
|
||||
$checked = '';
|
||||
$filename = $filetoadd['name'];
|
||||
|
||||
if ($conf->global->MAIN_MULTILANGS) {
|
||||
if (array_key_exists($filetoadd['name'] . '_' . $delauft_lang, $filetomerge->lines)) {
|
||||
$filename = $filetoadd['name'] . ' - ' . $langs->trans('Language_' . $delauft_lang);
|
||||
$checked = ' checked="checked" ';
|
||||
}
|
||||
} else {
|
||||
if (array_key_exists($filetoadd['name'], $filetomerge->lines)) {
|
||||
$checked = ' checked="checked" ';
|
||||
}
|
||||
}
|
||||
|
||||
print '<tr class="' . $style . '"><td>';
|
||||
|
||||
print '<input type="checkbox" ' . $checked . ' name="filetoadd[]" id="filetoadd" value="' . $filetoadd['name'] . '">' . $filename . '</input>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
print '<tr><td>';
|
||||
|
||||
print '<input type="submit" class="button" name="save" value="' . $langs->trans('Save') . '">';
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -157,4 +347,4 @@ else
|
||||
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
$db->close();
|
||||
@ -31,7 +31,7 @@ $langs->load("stocks");
|
||||
// Security check
|
||||
$result=restrictedArea($user,'stock');
|
||||
|
||||
$sref=GETPOST("sref");;
|
||||
$sref=GETPOST("sref");
|
||||
$snom=GETPOST("snom");
|
||||
$sall=GETPOST("sall");
|
||||
|
||||
|
||||
@ -129,7 +129,7 @@ if ($id > 0 || ! empty($ref))
|
||||
$colwidth=30;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
|
||||
|
||||
dol_fiche_end();;
|
||||
dol_fiche_end();
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
|
||||
@ -59,7 +59,7 @@ $hookmanager->initHooks(array('element_resource'));
|
||||
$object->available_resources = array('resource');
|
||||
|
||||
// Get parameters
|
||||
$id = GETPOST('id','int');
|
||||
$id = GETPOST('id','int');
|
||||
$action = GETPOST('action','alpha');
|
||||
$mode = GETPOST('mode','alpha');
|
||||
$lineid = GETPOST('lineid','int');
|
||||
@ -70,6 +70,7 @@ $resource_type = GETPOST('resource_type','alpha');
|
||||
$busy = GETPOST('busy','int');
|
||||
$mandatory = GETPOST('mandatory','int');
|
||||
$cancel = GETPOST('cancel','alpha');
|
||||
$confirm = GETPOST('confirm','alpha');
|
||||
|
||||
if($action == 'add_element_resource' && ! $cancel)
|
||||
{
|
||||
@ -113,22 +114,22 @@ if ($action == 'update_linked_resource' && $user->rights->resource->write && !GE
|
||||
}
|
||||
|
||||
// Delete a resource linked to an element
|
||||
if ($action == 'confirm_delete_linked_resource' && $user->rights->resource->delete && GETPOST('confirm') == 'yes')
|
||||
if ($action == 'confirm_delete_linked_resource' && $user->rights->resource->delete && $confirm === 'yes')
|
||||
{
|
||||
$res = $object->fetch(GETPOST('id'));
|
||||
if($res)
|
||||
$res = $object->fetch($id);
|
||||
if($res > 0)
|
||||
{
|
||||
$result = $object->delete_resource($lineid,$element);
|
||||
$result = $object->delete_resource($lineid,$element);
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
setEventMessage($langs->trans('RessourceLineSuccessfullyDeleted'));
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?element=".$element."&element_id=".$element_id);
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
setEventMessage($object->error,'errors');
|
||||
}
|
||||
if ($result >= 0)
|
||||
{
|
||||
setEventMessage($langs->trans('RessourceLineSuccessfullyDeleted'));
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?element=".$element."&element_id=".$element_id);
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
setEventMessage($object->error,'errors');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -173,7 +174,7 @@ else
|
||||
// Confirmation suppression resource line
|
||||
if ($action == 'delete_resource')
|
||||
{
|
||||
print $form->formconfirm("element_resource.php?element=".$element."&element_id=".$element_id."&lineid=".$lineid,$langs->trans("DeleteResource"),$langs->trans("ConfirmDeleteResourceElement"),"confirm_delete_linked_resource",'','',1);
|
||||
print $form->formconfirm("element_resource.php?element=".$element."&element_id=".$element_id."&id=".$id."&lineid=".$lineid,$langs->trans("DeleteResource"),$langs->trans("ConfirmDeleteResourceElement"),"confirm_delete_linked_resource",'','',1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -107,7 +107,7 @@ dol_fiche_head($head, 'card', $langs->trans("ThirdParty"),0,'company');
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans('EMail'); ?></td>
|
||||
<td><?php echo $this->control->tpl['email'];; ?></td>
|
||||
<td><?php echo $this->control->tpl['email']; ?></td>
|
||||
<td><?php echo $langs->trans('Web'); ?></td>
|
||||
<td><?php echo $this->control->tpl['url']; ?></td>
|
||||
</tr>
|
||||
|
||||
@ -106,7 +106,7 @@ dol_fiche_head($head, 'card', $langs->trans("ThirdParty"),0,'company');
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans('EMail'); ?></td>
|
||||
<td><?php echo $this->control->tpl['email'];; ?></td>
|
||||
<td><?php echo $this->control->tpl['email']; ?></td>
|
||||
<td><?php echo $langs->trans('Web'); ?></td>
|
||||
<td><?php echo $this->control->tpl['url']; ?></td>
|
||||
</tr>
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2012-2013 Philippe Berthet <berthet@systune.be>
|
||||
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013-2015 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* Version V1.1 Initial version of Philippe Berthet
|
||||
* Version V2 Change to be compatible with 3.4 and enhanced to be more generic
|
||||
@ -75,6 +75,7 @@ $langs->load("bills");
|
||||
$langs->load("orders");
|
||||
$langs->load("suppliers");
|
||||
$langs->load("propal");
|
||||
$langs->load("interventions");
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('consumptionthirdparty'));
|
||||
@ -98,7 +99,7 @@ $form = new Form($db);
|
||||
$formother = new FormOther($db);
|
||||
$productstatic=new Product($db);
|
||||
|
||||
$title = $langs->trans("Referer",$object->name);
|
||||
$title = $langs->trans("Referers",$object->name);
|
||||
if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title;
|
||||
$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
|
||||
llxHeader('',$title,$help_url);
|
||||
|
||||
@ -2164,7 +2164,7 @@ else
|
||||
print '</div>'."\n";
|
||||
|
||||
//Select mail models is same action as presend
|
||||
if (!empty(GETPOST('modelselected'))) {
|
||||
if (GETPOST('modelselected')) {
|
||||
$action = 'presend';
|
||||
}
|
||||
if ($action == 'presend')
|
||||
|
||||
@ -255,8 +255,9 @@ textarea.cke_source:focus
|
||||
|
||||
input, input.flat, textarea, textarea.flat, form.flat select, select.flat {
|
||||
font-size: <?php print $fontsize ?>px;
|
||||
font-family: <?php print $fontlist ?>;
|
||||
background: #FDFDFD;
|
||||
font-family: <?php print $fontlist ?>;
|
||||
background: #FDFDFD;
|
||||
color: #444;
|
||||
border: 1px solid #C0C0C0;
|
||||
/*padding: 1px 1px 1px 1px; */
|
||||
margin: 0px 0px 0px 0px;
|
||||
@ -1778,11 +1779,11 @@ table.noborder tr, div.noborder form {
|
||||
border-left-width: 1px;
|
||||
border-left-color: #BBBBBB;
|
||||
border-left-style: solid;
|
||||
height: 26px;
|
||||
min-height: 20px;
|
||||
}
|
||||
|
||||
table.noborder th, table.noborder td, div.noborder form, div.noborder form div {
|
||||
padding: 1px 2px 1px 3px; /* t r b l */
|
||||
padding: 5px 2px 5px 3px; /* t r b l */
|
||||
}
|
||||
|
||||
table.nobordernopadding {
|
||||
@ -1917,7 +1918,7 @@ table.liste td {
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
tr.pair td, tr.impair td {
|
||||
padding: 2px;
|
||||
padding: 5px 2px;
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
div.liste_titre .tagtd {
|
||||
|
||||
@ -160,6 +160,6 @@ echo '</pre>';
|
||||
echo '<h4>SOAP Message</h4>';
|
||||
echo '<pre>' . htmlspecialchars($soapclient->response, ENT_QUOTES) . '</pre>';
|
||||
|
||||
echo '</body>'."\n";;
|
||||
echo '</html>'."\n";;
|
||||
echo '</body>'."\n";
|
||||
echo '</html>'."\n";
|
||||
?>
|
||||
|
||||
@ -92,6 +92,6 @@ echo '<h4>SOAP Message</h4>';
|
||||
echo '<pre>' . htmlspecialchars($soapclient->response, ENT_QUOTES) . '</pre>';
|
||||
|
||||
|
||||
echo '</body>'."\n";;
|
||||
echo '</html>'."\n";;
|
||||
echo '</body>'."\n";
|
||||
echo '</html>'."\n";
|
||||
?>
|
||||
|
||||
@ -136,6 +136,6 @@ echo '</pre>';
|
||||
echo '<h4>SOAP Message</h4>';
|
||||
echo '<pre>' . htmlspecialchars($soapclient2->response, ENT_QUOTES) . '</pre>';
|
||||
|
||||
echo '</body>'."\n";;
|
||||
echo '</html>'."\n";;
|
||||
echo '</body>'."\n";
|
||||
echo '</html>'."\n";
|
||||
?>
|
||||
|
||||
@ -99,6 +99,6 @@ echo '</pre>';
|
||||
echo '<h4>SOAP Message</h4>';
|
||||
echo '<pre>' . htmlspecialchars($soapclient->response, ENT_QUOTES) . '</pre>';
|
||||
|
||||
echo '</body>'."\n";;
|
||||
echo '</html>'."\n";;
|
||||
echo '</body>'."\n";
|
||||
echo '</html>'."\n";
|
||||
?>
|
||||
|
||||
@ -177,6 +177,6 @@ echo '</pre>';
|
||||
echo '<h4>SOAP Message</h4>';
|
||||
echo '<pre>' . htmlspecialchars($soapclient3->response, ENT_QUOTES) . '</pre>';
|
||||
|
||||
echo '</body>'."\n";;
|
||||
echo '</html>'."\n";;
|
||||
echo '</body>'."\n";
|
||||
echo '</html>'."\n";
|
||||
?>
|
||||
|
||||
@ -223,6 +223,6 @@ echo '</pre>';
|
||||
echo '<h4>SOAP Message</h4>';
|
||||
echo '<pre>' . htmlspecialchars($soapclient->response, ENT_QUOTES) . '</pre>';
|
||||
|
||||
echo '</body>'."\n";;
|
||||
echo '</html>'."\n";;
|
||||
echo '</body>'."\n";
|
||||
echo '</html>'."\n";
|
||||
?>
|
||||
|
||||
@ -116,7 +116,7 @@ if ($resql)
|
||||
$oldemail = $obj->email;
|
||||
$olduid = $obj->uid;
|
||||
$oldlang = $obj->lang;
|
||||
$oldsalerepresentative=dolGetFirstLastname($obj->firstname, $obj->lastname);;
|
||||
$oldsalerepresentative=dolGetFirstLastname($obj->firstname, $obj->lastname);
|
||||
$message = '';
|
||||
$total = 0;
|
||||
$foundtoprocess = 0;
|
||||
|
||||
@ -120,7 +120,7 @@ if ($resql)
|
||||
$oldemail = $obj->email;
|
||||
$olduid = $obj->uid;
|
||||
$oldlang = $obj->lang;
|
||||
$oldsalerepresentative=dolGetFirstLastname($obj->firstname, $obj->lastname);;
|
||||
$oldsalerepresentative=dolGetFirstLastname($obj->firstname, $obj->lastname);
|
||||
$message = '';
|
||||
$total = 0;
|
||||
$foundtoprocess = 0;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user