Merge remote-tracking branch 'origin/3.7' into develop

Conflicts:
	htdocs/bookmarks/card.php
This commit is contained in:
Laurent Destailleur 2014-11-27 22:01:02 +01:00
commit 60e5369db2
21 changed files with 330 additions and 228 deletions

View File

@ -260,6 +260,12 @@ source_file = htdocs/langs/en_US/propal.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[dolibarr.resource]
file_filter = htdocs/langs/<lang>/resource.lang
source_file = htdocs/langs/en_US/resource.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[dolibarr.salaries]
file_filter = htdocs/langs/<lang>/salaries.lang
source_file = htdocs/langs/en_US/salaries.lang

View File

@ -136,9 +136,11 @@ if ($action == 'create')
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" enctype="multipart/form-data">'."\n";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="add">';
print_fiche_titre($langs->trans("NewBookmark"));
dol_fiche_head($head, $hselected, $langs->trans("Bookmark"),0,'bookmark');
print '<table class="border" width="100%">';
print '<tr><td width="25%" class="fieldrequired">'.$langs->trans("BookmarkTitle").'</td><td><input class="flat" name="title" size="30" value="'.$title.'"></td><td class="hideonsmartphone">'.$langs->trans("SetHereATitleForLink").'</td></tr>';
@ -159,8 +161,10 @@ if ($action == 'create')
print '<input class="flat" name="position" size="5" value="'.(isset($_POST["position"])?$_POST["position"]:$bookmark->position).'">';
print '</td><td class="hideonsmartphone">&nbsp;</td></tr>';
print '</table><br>';
print '</table>';
dol_fiche_end();
print '<div align="center">';
print '<input type="submit" class="button" value="'.$langs->trans("CreateBookmark").'" name="create"> &nbsp; ';
print '<input type="submit" class="button" value="'.$langs->trans("Cancel").'" name="cancel">';
@ -186,8 +190,6 @@ if ($id > 0 && ! preg_match('/^add/i',$action))
)
);
dol_fiche_head($head, 'card', $langs->trans("Bookmark"),0,'bookmark');
if ($action == 'edit')
{
print '<form name="edit" method="POST" action="'.$_SERVER["PHP_SELF"].'" enctype="multipart/form-data">';
@ -198,6 +200,8 @@ if ($id > 0 && ! preg_match('/^add/i',$action))
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
}
dol_fiche_head($head, $hselected, $langs->trans("Bookmark"),0,'bookmark');
print '<table class="border" width="100%">';
print '<tr><td width="25%">'.$langs->trans("Ref").'</td><td>'.$bookmark->ref.'</td></tr>';
@ -275,12 +279,14 @@ if ($id > 0 && ! preg_match('/^add/i',$action))
print '</table>';
if ($action == 'edit') print '<br><div align="center"><input class="button" type="submit" name="save" value="'.$langs->trans("Save").'"> &nbsp; &nbsp; <input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'"></div>';
if ($action == 'edit') print '</form>';
dol_fiche_end();
if ($action == 'edit')
{
print '<div align="center"><input class="button" type="submit" name="save" value="'.$langs->trans("Save").'"> &nbsp; &nbsp; <input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'"></div>';
print '</form>';
}
print "<div class=\"tabsAction\">\n";

View File

@ -3,7 +3,8 @@
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014 Frederic France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -22,14 +23,13 @@
/**
* \file htdocs/comm/propal/apercu.php
* \ingroup propal
* \brief Page de l'onglet apercu d'une propal
* \brief Preview tab of propal
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
$langs->load('propal');
$langs->load("bills");
@ -44,18 +44,11 @@ $result = restrictedArea($user, 'propal', $id);
/*
* View
* View Mode
*/
llxHeader();
$form = new Form($db);
/* *************************************************************************** */
/* */
/* Mode fiche */
/* */
/* *************************************************************************** */
if ($id > 0 || ! empty($ref))
{
@ -73,29 +66,30 @@ if ($id > 0 || ! empty($ref))
/*
* Propal
*/
print '<table class="border" width="100%">';
print '<table class="border" width="100%">';
// Ref
print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="5">'.$object->ref.'</td></tr>';
// Ref
print '<tr><td width="25%">'.$langs->trans('Ref').'</td>';
print '<td colspan="5">'.$object->ref.'</td>';
print '</tr>';
// Ref client
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td class="nowrap">';
print $langs->trans('RefCustomer').'</td><td align="left">';
print '</td>';
print '</tr></table>';
print '</td><td colspan="5">';
print $object->ref_client;
print '</td>';
print '</tr>';
// Ref client
print '<tr><td>'.$langs->trans('RefCustomer').'</td>';
print '<td colspan="5">'.$object->ref_client.'</td>';
print '</tr>';
$rowspan=2;
// Tiers
print '<tr><td>'.$langs->trans('Company').'</td><td colspan="5">'.$soc->getNomUrl(1).'</td>';
print '</tr>';
// Thirdparty
print '<tr><td>'.$langs->trans('Company').'</td>';
print '<td colspan="5">'.$soc->getNomUrl(1).'</td>';
print '</tr>';
// Ligne info remises tiers
// Status
print '<tr><td>'.$langs->trans("Status").'</td>';
print '<td colspan="5">'.$object->getLibStatut(4).'</td>';
print '</tr>';
// Discount
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="5">';
if ($soc->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_percent);
else print $langs->trans("CompanyHasNoRelativeDiscount");
@ -103,44 +97,43 @@ if ($id > 0 || ! empty($ref))
print '. ';
if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",$absolute_discount,$langs->trans("Currency".$conf->currency));
else print $langs->trans("CompanyHasNoAbsoluteDiscount");
print '.';
print '</td></tr>';
print '.</td>';
print '</tr>';
// ligne
// partie Gauche
print '<tr><td>'.$langs->trans('Date').'</td><td colspan="3">';
print dol_print_date($object->date,'daytext');
print '</td>';
// Date
print '<tr><td>'.$langs->trans('Date').'</td>';
print '<td>'.dol_print_date($object->date,'daytext').'</td>';
// partie Droite sur $rowspan lignes
print '<td colspan="2" rowspan="'.$rowspan.'" valign="top" width="50%">';
// Right part with $rowspan lines
$rowspan=4;
print '<td rowspan="'.$rowspan.'" valign="top" width="50%">';
/*
* Documents
*/
$objectref = dol_sanitizeFileName($object->ref);
$dir_output = $conf->propal->dir_output . "/";
$filepath = $dir_output . $objectref . "/";
$file = $filepath . $objectref . ".pdf";
$filedetail = $filepath . $objectref . "-detail.pdf";
/*
* Documents
*/
$objectref = dol_sanitizeFileName($object->ref);
$dir_output = $conf->propal->dir_output . "/";
$filepath = $dir_output . $objectref . "/";
$file = $filepath . $objectref . ".pdf";
$filedetail = $filepath . $objectref . "-detail.pdf";
$relativepath = $objectref.'/'.$objectref.'.pdf';
$relativepathdetail = $objectref.'/'.$objectref.'-detail.pdf';
// Define path to preview pdf file (preview precompiled "file.ext" are "file.ext_preview.png")
$fileimage = $file.'_preview.png'; // If PDF has 1 page
$fileimage = $file.'_preview.png'; // If PDF has 1 page
$fileimagebis = $file.'_preview-0.pdf.png'; // If PDF has more than one page
$relativepathimage = $relativepath.'_preview.png';
$var=true;
$var=true;
// Si fichier PDF existe
if (file_exists($file))
{
$encfile = urlencode($file);
print_titre($langs->trans("Documents"));
print '<table class="border" width="100%">';
print '<table class="nobordernopadding" width="100%">';
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Documents").'</td></tr>';
print "<tr ".$bc[$var]."><td>".$langs->trans("Propal")." PDF</td>";
print '<tr '.$bc[$var].'><td>'.$langs->trans("Proposal").' PDF</td>';
print '<td><a data-ajax="false" href="'.DOL_URL_ROOT . '/document.php?modulepart=propal&file='.urlencode($relativepath).'">'.$object->ref.'.pdf</a></td>';
@ -166,13 +159,25 @@ if ($id > 0 || ! empty($ref))
}
}
print "</td>";
print '</tr>';
print '</td>';
print '</tr>';
print '<tr><td height="10">'.$langs->trans('AmountHT').'</td>';
print '<td align="right" colspan="2"><b>'.price($object->price).'</b></td>';
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
print '</table>';
// Total HT - left part
print '<tr><td>'.$langs->trans('AmountHT').'</td>';
print '<td align="right" class="nowrap"><b>' . price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency) . '</b></td>';
print '</tr>';
// Total VAT - left part
print '<tr><td>'.$langs->trans('AmountVAT').'</td>';
print '<td align="right" class="nowrap"><b>' . price($object->total_tva, '', $langs, 0, - 1, - 1, $conf->currency) . '</b></td>';
print '</tr>';
// Total TTC - left part
print '<tr><td>'.$langs->trans('AmountTTC').'</td>';
print '<td align="right" class="nowrap"><b>' . price($object->total_ttc, '', $langs, 0, - 1, - 1, $conf->currency) . '</b></td>';
print '</tr>';
print '</table>';
dol_fiche_end();
}
@ -183,10 +188,13 @@ if ($id > 0 || ! empty($ref))
}
}
print '<table class="border" width="100%">';
print '<tr><td>';
print '<div class="photolist">';
// Si fichier png PDF d'1 page trouve
if (file_exists($fileimage))
{
print '<img style="background: #FFF" src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercupropal&file='.urlencode($relativepathimage).'">';
print '<img class="photo photowithmargin" src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercupropal&amp;file='.urlencode($relativepathimage).'">';
}
// Si fichier png PDF de plus d'1 page trouve
elseif (file_exists($fileimagebis))
@ -199,10 +207,13 @@ elseif (file_exists($fileimagebis))
if (file_exists($dir_output.$preview))
{
print '<img style="background: #FFF" src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercupropal&file='.urlencode($preview).'"><p>';
print '<img class="photo photowithmargin" src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercupropal&amp;file='.urlencode($preview).'"><p>';
}
}
}
print '</div>';
print '</td></tr>';
print '</table>';
llxFooter();

View File

@ -220,7 +220,7 @@ class Account extends CommonObject
/**
* Add an entry into table ".MAIN_DB_PREFIX."bank
*
* @param timsestmap $date Date operation
* @param timestamp $date Date operation
* @param string $oper 1,2,3,4... (deprecated) or TYP,VIR,PRE,LIQ,VAD,CB,CHQ...
* @param string $label Descripton
* @param float $amount Amount

View File

@ -76,7 +76,7 @@ if ($action == 'update')
if (empty($amount))
{
$setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Amount")), 'errors');
setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Amount")), 'errors');
$action = "create";
$error++;
}

View File

@ -228,7 +228,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty"
print '</td><td class="nocellnopadd boxclose nowrap">';
// The image must have the class 'boxhandle' beause it's value used in DOM draggable objects to define the area used to catch the full object
print img_picto($langs->trans("MoveBox",$this->box_id),'grip_title','class="boxhandle hideonsmartphone" style="cursor:move;"');
print img_picto($langs->trans("Close",$this->box_id),'close_title','class="boxclose" rel="x:y" style="cursor:pointer;" id="imgclose'.$this->box_id.'"');
print img_picto($langs->trans("Close2",$this->box_id),'close_title','class="boxclose" rel="x:y" style="cursor:pointer;" id="imgclose'.$this->box_id.'"');
$label=$head['text'];
if (! empty($head['graph'])) $label.=' ('.$langs->trans("Graph").')';
print '<input type="hidden" id="boxlabelentry'.$this->box_id.'" value="'.dol_escape_htmltag($label).'">';

View File

@ -40,14 +40,14 @@ class InfoBox
/**
* Return array of boxes qualified for area and user
*
* @param DoliDB $db Database handler
* @param string $mode 'available' or 'activated'
* @param string $zone Name or area (-1 for all, 0 for Homepage, 1 for xxx, ...)
* @param User $user Object user to filter
* @param array $excludelist Array of box id (box.box_id = boxes_def.rowid) to exclude
* @return array Array of boxes
* @param DoliDB $db Database handler
* @param string $mode 'available' or 'activated'
* @param string $zone Name or area (-1 for all, 0 for Homepage, 1 for xxx, ...)
* @param User|null $user Object user to filter
* @param array $excludelist Array of box id (box.box_id = boxes_def.rowid) to exclude
* @return array Array of boxes
*/
static function listBoxes($db, $mode, $zone, $user, $excludelist=array())
static function listBoxes($db, $mode, $zone, $user=null, $excludelist=array())
{
global $conf;

View File

@ -32,7 +32,7 @@ if( (array) $linked_resources && count($linked_resources) > 0)
print '<div class="tagtd">'.$langs->trans('Resource').'</div>';
print '<div class="tagtd">'.$langs->trans('Busy').'</div>';
print '<div class="tagtd">'.$langs->trans('Mandatory').'</div>';
print '<div class="tagtd">'.$langs->trans('Edit').'</div>';
print '<div class="tagtd">'.$langs->trans('Action').'</div>';
print '</form>';
//print '</div>';
@ -86,8 +86,13 @@ if( (array) $linked_resources && count($linked_resources) > 0)
print '</div>';
print '<div class="tagtd">';
print '<a href="'.$_SERVER['PHP_SELF'].'?action=delete_resource&element='.$element.'&element_id='.$element_id.'&lineid='.$linked_resource['rowid'].'">'.$langs->trans('Delete').'</a>';
print '<a href="'.$_SERVER['PHP_SELF'].'?mode=edit&resource_type='.$linked_resource['resource_type'].'&element='.$element.'&element_id='.$element_id.'&lineid='.$linked_resource['rowid'].'">'.$langs->trans('Edit').'</a>';
print '<a href="'.$_SERVER['PHP_SELF'].'?mode=edit&resource_type='.$linked_resource['resource_type'].'&element='.$element.'&element_id='.$element_id.'&lineid='.$linked_resource['rowid'].'">';
print img_edit();
print '</a>';
print '&nbsp;';
print '<a href="'.$_SERVER['PHP_SELF'].'?action=delete_resource&element='.$element.'&element_id='.$element_id.'&lineid='.$linked_resource['rowid'].'">';
print img_delete();
print '</a>';
print '</div>';
print '</div>';
@ -105,4 +110,4 @@ else {
print '<div class="warning">'.$langs->trans('NoResourceLinked').'</div>';
}
// FIN DU TPL
// FIN DU TPL

View File

@ -107,7 +107,7 @@ if ($action == 'setnum_paiement' && ! empty($_POST['num_paiement']))
$res = $object->update_num($_POST['num_paiement']);
if ($res === 0)
{
$setEventMessage($langs->trans('PaymentNumberUpdateSucceeded'));
setEventMessage($langs->trans('PaymentNumberUpdateSucceeded'));
}
else
{

View File

@ -1810,13 +1810,13 @@ function printSearchForm($urlaction,$urlobject,$title,$htmlmodesearch,$htmlinput
$ret='';
$ret.='<form action="'.$urlaction.'" method="post">';
$ret.='<label for="'.$htmlinputname.'">';
$ret.='<div class="menu_titre menu_titre_search">';
$ret.='<label for="'.$htmlinputname.'">';
$ret.='<a class="vsmenu" href="'.$urlobject.'">';
$ret.=$title;
$ret.='</a>';
$ret.='</div>';
$ret.='</label>';
$ret.='</div>';
$ret.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$ret.='<input type="hidden" name="mode" value="search">';
$ret.='<input type="hidden" name="mode_search" value="'.$htmlmodesearch.'">';

View File

@ -1419,7 +1419,7 @@ else
// Status (to sell)
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Sell").')</td><td colspan="2">';
if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer) {
if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
print ajax_object_onoff($object, 'status', 'tosell', 'ProductStatusOnSell', 'ProductStatusNotOnSell');
} else {
print $object->getLibStatut(2,0);
@ -1428,7 +1428,7 @@ else
// Status (to buy)
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Buy").')</td><td colspan="2">';
if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer) {
if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
print ajax_object_onoff($object, 'status_buy', 'tobuy', 'ProductStatusOnBuy', 'ProductStatusNotOnBuy');
} else {
print $object->getLibStatut(2,1);
@ -1438,7 +1438,7 @@ else
// Batch number management (to batch)
if ($conf->productbatch->enabled) {
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Lot").')</td><td colspan="2">';
if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer) {
if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
print ajax_object_onoff($object, 'status_batch', 'tobatch', 'ProductStatusOnBatch', 'ProductStatusNotOnBatch');
} else {
print $object->getLibStatut(2,2);

View File

@ -511,7 +511,7 @@ else
$product_static->status = $objp->tosell;
// Status (to sell)
print '<td align="center" nowrap="nowrap">';
if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer) {
if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
print ajax_object_onoff($product_static, 'status', 'tosell', 'ProductStatusOnSell', 'ProductStatusNotOnSell');
} else {
print $product_static->LibStatut($objp->tosell,5,0);
@ -520,7 +520,7 @@ else
// Status (to buy)
print '<td align="center" nowrap="nowrap">';
if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer) {
if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
print ajax_object_onoff($product_static, 'status_buy', 'tobuy', 'ProductStatusOnBuy', 'ProductStatusNotOnBuy');
} else {
print $product_static->LibStatut($objp->tobuy,5,1);

View File

@ -279,7 +279,7 @@ if ($id > 0 || $ref)
// Status (to sell)
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Sell").')</td><td>';
if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer) {
if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
print ajax_object_onoff($product, 'status', 'tosell', 'ProductStatusOnSell', 'ProductStatusNotOnSell');
} else {
print $product->getLibStatut(2,0);
@ -288,7 +288,7 @@ if ($id > 0 || $ref)
// Status (to buy)
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Buy").')</td><td colspan="2">';
if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer) {
if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
print ajax_object_onoff($product, 'status_buy', 'tobuy', 'ProductStatusOnBuy', 'ProductStatusNotOnBuy');
} else {
print $product->getLibStatut(2,1);
@ -340,7 +340,7 @@ if ($id > 0 || $ref)
}
print '</td>';
print '</tr>';
print '<tr><td>';
$text_stock_options = '';
$text_stock_options.= (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)?$langs->trans("DeStockOnShipment").'<br>':'');

View File

@ -296,22 +296,22 @@ if ($id > 0 || ! empty($ref))
print '<tr><td>'.$langs->trans("DateStart").'</td><td colspan="3">';
print dol_print_date($object->date_start,'dayhour');
print '</td></tr>';
// Date end
print '<tr><td>'.$langs->trans("DateEnd").'</td><td colspan="3">';
print dol_print_date($object->date_end,'dayhour');
print '</td></tr>';
// Planned workload
print '<tr><td>'.$langs->trans("PlannedWorkload").'</td><td colspan="3">';
print convertSecondToTime($object->planned_workload,'allhourmin');
print '</td></tr>';
// Progress declared
print '<tr><td>'.$langs->trans("ProgressDeclared").'</td><td colspan="3">';
print $object->progress.' %';
print '</td></tr>';
// Progress calculated
print '<tr><td>'.$langs->trans("ProgressCalculated").'</td><td colspan="3">';
if ($object->planned_workload)
@ -322,7 +322,7 @@ if ($id > 0 || ! empty($ref))
}
else print '';
print '</td></tr>';
// Project
if (empty($withproject))
{
@ -400,11 +400,11 @@ if ($id > 0 || ! empty($ref))
// Contributor
print '<td class="nowrap">';
print img_object('','user');
print img_object('','user','class="hideonsmartphone"');
$contactsoftask=$object->getListContactId('internal');
if (count($contactsoftask)>0) {
$userid=$contactsoftask[0];
$form->select_users($userid,'userid',0,'',0,'',$contactsoftask);
print $form->select_dolusers($userid,'userid',0,'',0,'',$contactsoftask);
}else {
print img_error($langs->trans('FirstAddRessourceToAllocateTime')).$langs->trans('FirstAddRessourceToAllocateTime');
}
@ -506,7 +506,7 @@ if ($id > 0 || ! empty($ref))
$contactsoftask[]=$task_time->fk_user;
}
if (count($contactsoftask)>0) {
$form->select_users($task_time->fk_user,'userid_line',0,'',0,'',$contactsoftask);
print $form->select_dolusers($task_time->fk_user,'userid_line',0,'',0,'',$contactsoftask);
}else {
print img_error($langs->trans('FirstAddRessourceToAllocateTime')).$langs->trans('FirstAddRessourceToAllocateTime');
}

View File

@ -32,7 +32,7 @@ if (! $res) die("Include of main fails");
require_once 'class/resource.class.php';
require_once 'class/html.formresource.class.php';
// Load traductions files requiredby by page
// Load traductions files required by page
$langs->load("resource");
$langs->load("companies");
$langs->load("other");
@ -41,6 +41,7 @@ $langs->load("resource@resource");
// Get parameters
$id = GETPOST('id','int');
$action = GETPOST('action','alpha');
$cancel = GETPOST('cancel','alpha');
if (empty($sortorder)) $sortorder="DESC";
if (empty($sortfield)) $sortfield="t.rowid";
if (empty($arch)) $arch = 0;
@ -65,57 +66,64 @@ $object = new Resource($db);
if ($action == 'confirm_add_resource')
{
$error='';
$ref=GETPOST('ref','alpha');
$description=GETPOST('description','alpha');
$fk_code_type_resource=GETPOST('fk_code_type_resource','alpha');
if (empty($ref))
if (! $cancel)
{
$mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Ref"));
setEventMessage($mesg, 'errors');
$error++;
}
if (! $error)
{
$object=new Resource($db);
$object->ref=$ref;
$object->description=$description;
$object->fk_code_type_resource=$fk_code_type_resource;
$error='';
$result=$object->create($user);
if ($result > 0)
$ref=GETPOST('ref','alpha');
$description=GETPOST('description','alpha');
$fk_code_type_resource=GETPOST('fk_code_type_resource','alpha');
if (empty($ref))
{
// Creation OK
$db->commit();
setEventMessage($langs->trans('ResourceCreatedWithSuccess'));
Header("Location: card.php?id=" . $object->id);
return;
$mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Ref"));
setEventMessage($mesg, 'errors');
$error++;
}
if (! $error)
{
$object=new Resource($db);
$object->ref=$ref;
$object->description=$description;
$object->fk_code_type_resource=$fk_code_type_resource;
$result=$object->create($user);
if ($result > 0)
{
// Creation OK
$db->commit();
setEventMessage($langs->trans('ResourceCreatedWithSuccess'));
Header("Location: card.php?id=" . $object->id);
return;
}
else
{
// Creation KO
setEventMessage($object->error, 'errors');
$action = '';
}
}
else
{
// Creation KO
setEventMessage($object->error, 'errors');
$action = '';
}
}
else
{
$action = '';
Header("Location: list.php");
}
}
/***************************************************
* VIEW
*
****************************************************/
/*
* View
*
*/
$form=new Form($db);
$formresource = new FormResource($db);
if ( !$action )
if (! $action)
{
$pagetitle=$langs->trans('AddResource');
llxHeader('',$pagetitle,'');
@ -161,8 +169,10 @@ if ( !$action )
print '</table>';
echo '<div style="text-align: center">',
' <input type="submit" class="button" name="" value="'.$langs->trans('Save').'" />',
echo '<br><div align="center">',
'<input type="submit" class="button" name="add" value="'.$langs->trans('Save').'" />',
'&nbsp;',
'<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'" />',
'</div>';
print '</form>';

View File

@ -139,7 +139,7 @@ if ( $object->fetch($id) > 0 )
/*---------------------------------------
* Edit object
*/
*/
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update">';
@ -171,7 +171,7 @@ if ( $object->fetch($id) > 0 )
}
else
{
// Confirmation suppression resource line
// Confirm deleting resource line
if ($action == 'delete')
{
print $form->formconfirm("card.php?&id=".$id,$langs->trans("DeleteResource"),$langs->trans("ConfirmDeleteResource"),"confirm_delete_resource",'','',1);
@ -228,9 +228,9 @@ if ( $object->fetch($id) > 0 )
print '</div>';
}
}
if ($action != "delete" )
if ($action != "delete" && $action != "edit")
{
// Edit resource
// Delete resource
if($user->rights->resource->delete)
{
print '<div class="inline-block divButAction">';

View File

@ -1,6 +1,5 @@
<?php
/* Module to manage locations, buildings, floors and rooms into Dolibarr ERP/CRM
* Copyright (C) 2013 Jean-François Ferry <jfefe@aternatik.fr>
/* Copyright (C) 2013 Jean-François Ferry <jfefe@aternatik.fr>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -32,7 +31,7 @@ require 'class/resource.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
// Load traductions files requiredby by page
$langs->load("resource@resource");
$langs->load("resource");
$langs->load("other");
// Get parameters
@ -70,8 +69,9 @@ $resource_id = GETPOST('fk_resource','int');
$resource_type = GETPOST('resource_type','alpha');
$busy = GETPOST('busy','int');
$mandatory = GETPOST('mandatory','int');
$cancel = GETPOST('cancel','alpha');
if($action == 'add_element_resource' && !GETPOST('cancel'))
if($action == 'add_element_resource' && ! $cancel)
{
$objstat = fetchObjectByElement($element_id,$element);
$res = $objstat->add_element_resource($resource_id,$resource_type,$busy,$mandatory);
@ -251,9 +251,6 @@ else
foreach ($object->available_resources as $modresources => $resources)
{
$langs->load($resources);
//print '<h2>'.$modresources.'</h2>';
$resources=(array) $resources; // To be sure $resources is an array
foreach($resources as $resource_obj)
{
@ -301,7 +298,7 @@ else
{
print '<div class="tabsAction">';
print '<div class="inline-block divButAction">';
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?mode=add&resource_type='.$resource_obj.'&element='.$element.'&element_id='.$element_id.'">Add resource</a>';
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?mode=add&resource_type='.$resource_obj.'&element='.$element.'&element_id='.$element_id.'">'.$langs->trans('AddResource').'</a>';
print '</div>';
print '</div>';
}

View File

@ -1,6 +1,5 @@
<?php
/* Module to manage resources into Dolibarr ERP/CRM
* Copyright (C) 2013-2014 Jean-François Ferry <jfefe@aternatik.fr>
/* Copyright (C) 2013-2014 Jean-François Ferry <jfefe@aternatik.fr>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -116,7 +115,7 @@ else
print_liste_field_titre($langs->trans('Id'),$_SERVER['PHP_SELF'],'t.rowid','',$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Ref'),$_SERVER['PHP_SELF'],'t.ref','',$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('ResourceType'),$_SERVER['PHP_SELF'],'ty.code','',$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Edit'));
print_liste_field_titre($langs->trans('Action'),"","","","",'width="60" align="center"',"","");
print '</tr>';
foreach ($object->lines as $resource)
@ -128,7 +127,7 @@ else
$style='style="background: orange;"';
print '<tr '.$bc[$var].' '.$style.'><td>';
print $resource->id;
print '<a href="./card.php?id='.$resource->id.'">'.$resource->id.'</a>';
print '</td>';
print '<td>';
@ -139,9 +138,14 @@ else
print $resource->type_label;
print '</td>';
print '<td>';
print '<a href="card.php?id='.$resource->id.'">'.$langs->trans('View').'</a> ';
print '<a href="card.php?action=edit&id='.$resource->id.'">'.$langs->trans('Edit').'</a>';
print '<td align="center">';
print '<a href="./card.php?action=update&id='.$resource->id.'">';
print img_edit();
print '</a>';
print '&nbsp;';
print '<a href="./card.php?action=delete&id='.$resource->id.'">';
print img_delete();
print '</a>';
print '</td>';
print '</tr>';

View File

@ -1727,7 +1727,7 @@ else
// Status
print '<tr><td>'.$langs->trans("Status").'</td>';
print '<td colspan="'.(2+(($showlogo || $showbarcode)?0:1)).'">';
if (! empty($conf->use_javascript_ajax) && $user->rights->societe->creer) {
if (! empty($conf->use_javascript_ajax) && $user->rights->societe->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
print ajax_object_onoff($object, 'status', 'status', 'InActivity', 'ActivityCeased');
} else {
print $object->getLibStatut(2);

View File

@ -88,10 +88,11 @@ if ($id > 0 || ! empty($ref))
{
$result = $object->fetch($id, $ref);
$upload_dir = $conf->user->multidir_output[$object->entity] . "/" . $object->id ;
$entitytouseforuserdir = $object->entity;
if (empty($entitytouseforuserdir)) $entitytouseforuserdir=1;
$upload_dir = $conf->user->multidir_output[$entitytouseforuserdir] . "/" . $object->id ;
}
/*
* Actions
*/
@ -159,8 +160,8 @@ if ($object->id)
print '</div>';
$modulepart = 'societe';
$permission = $user->rights->societe->creer;
$modulepart = 'user';
$permission = $user->rights->user->user->creer;
$param = '&id=' . $object->id;
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
}

View File

@ -29,6 +29,7 @@ set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs');
require_once '../master.inc.php';
require_once NUSOAP_PATH.'/nusoap.php'; // Include SOAP
require_once DOL_DOCUMENT_ROOT.'/core/lib/ws.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
require_once(DOL_DOCUMENT_ROOT."/commande/class/commande.class.php");
@ -84,6 +85,52 @@ $server->wsdl->addComplexType(
)
);
$line_fields = array(
'id' => array('name'=>'id','type'=>'xsd:string'),
'type' => array('name'=>'type','type'=>'xsd:int'),
'fk_commande' => array('name'=>'fk_commande','type'=>'xsd:int'),
'fk_parent_line' => array('name'=>'fk_parent_line','type'=>'xsd:int'),
'desc' => array('name'=>'desc','type'=>'xsd:string'),
'qty' => array('name'=>'qty','type'=>'xsd:double'),
'price' => array('name'=>'price','type'=>'xsd:double'),
'unitprice' => array('name'=>'unitprice','type'=>'xsd:double'),
'vat_rate' => array('name'=>'vat_rate','type'=>'xsd:double'),
'remise' => array('name'=>'remise','type'=>'xsd:double'),
'remise_percent' => array('name'=>'remise_percent','type'=>'xsd:double'),
'total_net' => array('name'=>'total_net','type'=>'xsd:double'),
'total_vat' => array('name'=>'total_vat','type'=>'xsd:double'),
'total' => array('name'=>'total','type'=>'xsd:double'),
'date_start' => array('name'=>'date_start','type'=>'xsd:date'),
'date_end' => array('name'=>'date_end','type'=>'xsd:date'),
// From product
'product_id' => array('name'=>'product_id','type'=>'xsd:int'),
'product_ref' => array('name'=>'product_ref','type'=>'xsd:string'),
'product_label' => array('name'=>'product_label','type'=>'xsd:string'),
'product_desc' => array('name'=>'product_desc','type'=>'xsd:string')
);
//Retreive all extrafield for thirdsparty
// fetch optionals attributes and labels
$extrafields=new ExtraFields($db);
$extralabels=$extrafields->fetch_name_optionals_label('commandedet',true);
if (count($extrafields)>0) {
$extrafield_line_array = array();
}
foreach($extrafields->attribute_label as $key=>$label)
{
//$value=$object->array_options["options_".$key];
$type =$extrafields->attribute_type[$key];
if ($type=='date' || $type=='datetime') {$type='xsd:dateTime';}
else {$type='xsd:string';}
$extrafield_line_array['options_'.$key]=array('name'=>'options_'.$key,'type'=>$type);
}
$line_fields=array_merge($line_fields,$extrafield_line_array);
// Define other specific objects
$server->wsdl->addComplexType(
'line',
@ -91,33 +138,7 @@ $server->wsdl->addComplexType(
'struct',
'all',
'',
array(
'id' => array('name'=>'id','type'=>'xsd:string'),
'type' => array('name'=>'type','type'=>'xsd:int'),
'fk_commande' => array('name'=>'fk_commande','type'=>'xsd:int'),
'fk_parent_line' => array('name'=>'fk_parent_line','type'=>'xsd:int'),
'desc' => array('name'=>'desc','type'=>'xsd:string'),
'qty' => array('name'=>'qty','type'=>'xsd:double'),
'price' => array('name'=>'price','type'=>'xsd:double'),
'unitprice' => array('name'=>'unitprice','type'=>'xsd:double'),
'vat_rate' => array('name'=>'vat_rate','type'=>'xsd:double'),
'remise' => array('name'=>'remise','type'=>'xsd:double'),
'remise_percent' => array('name'=>'remise_percent','type'=>'xsd:double'),
'total_net' => array('name'=>'total_net','type'=>'xsd:double'),
'total_vat' => array('name'=>'total_vat','type'=>'xsd:double'),
'total' => array('name'=>'total','type'=>'xsd:double'),
'date_start' => array('name'=>'date_start','type'=>'xsd:date'),
'date_end' => array('name'=>'date_end','type'=>'xsd:date'),
// From product
'product_id' => array('name'=>'product_id','type'=>'xsd:int'),
'product_ref' => array('name'=>'product_ref','type'=>'xsd:string'),
'product_label' => array('name'=>'product_label','type'=>'xsd:string'),
'product_desc' => array('name'=>'product_desc','type'=>'xsd:string')
)
$line_fields
);
/*$server->wsdl->addComplexType(
@ -151,53 +172,73 @@ $server->wsdl->addComplexType(
)
);
$order_fields = array(
'id' => array('name'=>'id','type'=>'xsd:string'),
'ref' => array('name'=>'ref','type'=>'xsd:string'),
'ref_client' => array('name'=>'ref_client','type'=>'xsd:string'),
'ref_ext' => array('name'=>'ref_ext','type'=>'xsd:string'),
'ref_int' => array('name'=>'ref_int','type'=>'xsd:string'),
'thirdparty_id' => array('name'=>'thirdparty_id','type'=>'xsd:int'),
'status' => array('name'=>'status','type'=>'xsd:int'),
'facturee' => array('name'=>'facturee','type'=>'xsd:string'),
'total_net' => array('name'=>'total_net','type'=>'xsd:double'),
'total_vat' => array('name'=>'total_vat','type'=>'xsd:double'),
'total_localtax1' => array('name'=>'total_localtax1','type'=>'xsd:double'),
'total_localtax2' => array('name'=>'total_localtax2','type'=>'xsd:double'),
'total' => array('name'=>'total','type'=>'xsd:double'),
'date' => array('name'=>'date','type'=>'xsd:date'),
'date_creation' => array('name'=>'date_creation','type'=>'xsd:dateTime'),
'date_validation' => array('name'=>'date_validation','type'=>'xsd:dateTime'),
'date_modification' => array('name'=>'date_modification','type'=>'xsd:dateTime'),
'remise' => array('name'=>'remise','type'=>'xsd:string'),
'remise_percent' => array('name'=>'remise_percent','type'=>'xsd:string'),
'remise_absolue' => array('name'=>'remise_absolue','type'=>'xsd:string'),
'source' => array('name'=>'source','type'=>'xsd:string'),
'note_private' => array('name'=>'note_private','type'=>'xsd:string'),
'note_public' => array('name'=>'note_public','type'=>'xsd:string'),
'project_id' => array('name'=>'project_id','type'=>'xsd:string'),
'mode_reglement_id' => array('name'=>'mode_reglement_id','type'=>'xsd:string'),
'mode_reglement_code' => array('name'=>'mode_reglement_code','type'=>'xsd:string'),
'mode_reglement' => array('name'=>'mode_reglement','type'=>'xsd:string'),
'cond_reglement_id' => array('name'=>'cond_reglement_id','type'=>'xsd:string'),
'cond_reglement_code' => array('name'=>'cond_reglement_code','type'=>'xsd:string'),
'cond_reglement' => array('name'=>'cond_reglement','type'=>'xsd:string'),
'cond_reglement_doc' => array('name'=>'cond_reglement_doc','type'=>'xsd:string'),
'date_livraison' => array('name'=>'date_livraison','type'=>'xsd:date'),
'fk_delivery_address' => array('name'=>'fk_delivery_address','type'=>'xsd:int'),
'demand_reason_id' => array('name'=>'demand_reason_id','type'=>'xsd:string'),
'lines' => array('name'=>'lines','type'=>'tns:LinesArray2')
);
//Retreive all extrafield for thirdsparty
// fetch optionals attributes and labels
$extrafields=new ExtraFields($db);
$extralabels=$extrafields->fetch_name_optionals_label('commande',true);
if (count($extrafields)>0) {
$extrafield_array = array();
}
foreach($extrafields->attribute_label as $key=>$label)
{
//$value=$object->array_options["options_".$key];
$type =$extrafields->attribute_type[$key];
if ($type=='date' || $type=='datetime') {$type='xsd:dateTime';}
else {$type='xsd:string';}
$extrafield_array['options_'.$key]=array('name'=>'options_'.$key,'type'=>$type);
}
$order_fields=array_merge($order_fields,$extrafield_array);
$server->wsdl->addComplexType(
'order',
'complexType',
'struct',
'all',
'',
array(
'id' => array('name'=>'id','type'=>'xsd:string'),
'ref' => array('name'=>'ref','type'=>'xsd:string'),
'ref_client' => array('name'=>'ref_client','type'=>'xsd:string'),
'ref_ext' => array('name'=>'ref_ext','type'=>'xsd:string'),
'ref_int' => array('name'=>'ref_int','type'=>'xsd:string'),
'thirdparty_id' => array('name'=>'thirdparty_id','type'=>'xsd:int'),
'status' => array('name'=>'status','type'=>'xsd:int'),
'facturee' => array('name'=>'facturee','type'=>'xsd:string'),
'total_net' => array('name'=>'total_net','type'=>'xsd:double'),
'total_vat' => array('name'=>'total_vat','type'=>'xsd:double'),
'total_localtax1' => array('name'=>'total_localtax1','type'=>'xsd:double'),
'total_localtax2' => array('name'=>'total_localtax2','type'=>'xsd:double'),
'total' => array('name'=>'total','type'=>'xsd:double'),
'date' => array('name'=>'date','type'=>'xsd:date'),
'date_creation' => array('name'=>'date_creation','type'=>'xsd:dateTime'),
'date_validation' => array('name'=>'date_validation','type'=>'xsd:dateTime'),
'date_modification' => array('name'=>'date_modification','type'=>'xsd:dateTime'),
'remise' => array('name'=>'remise','type'=>'xsd:string'),
'remise_percent' => array('name'=>'remise_percent','type'=>'xsd:string'),
'remise_absolue' => array('name'=>'remise_absolue','type'=>'xsd:string'),
'source' => array('name'=>'source','type'=>'xsd:string'),
'note_private' => array('name'=>'note_private','type'=>'xsd:string'),
'note_public' => array('name'=>'note_public','type'=>'xsd:string'),
'project_id' => array('name'=>'project_id','type'=>'xsd:string'),
'mode_reglement_id' => array('name'=>'mode_reglement_id','type'=>'xsd:string'),
'mode_reglement_code' => array('name'=>'mode_reglement_code','type'=>'xsd:string'),
'mode_reglement' => array('name'=>'mode_reglement','type'=>'xsd:string'),
'cond_reglement_id' => array('name'=>'cond_reglement_id','type'=>'xsd:string'),
'cond_reglement_code' => array('name'=>'cond_reglement_code','type'=>'xsd:string'),
'cond_reglement' => array('name'=>'cond_reglement','type'=>'xsd:string'),
'cond_reglement_doc' => array('name'=>'cond_reglement_doc','type'=>'xsd:string'),
'date_livraison' => array('name'=>'date_livraison','type'=>'xsd:date'),
'fk_delivery_address' => array('name'=>'fk_delivery_address','type'=>'xsd:int'),
'demand_reason_id' => array('name'=>'demand_reason_id','type'=>'xsd:string'),
'lines' => array('name'=>'lines','type'=>'tns:LinesArray2')
)
$order_fields
);
/*
$server->wsdl->addComplexType(
'OrdersArray',
@ -643,6 +684,16 @@ function createOrder($authentication,$order)
$newobject->cond_reglement_id=$order['cond_reglement_id'];
$newobject->demand_reason_id=$order['demand_reason_id'];
$newobject->date_creation=$now;
// Retrieve all extrafield for order
// fetch optionals attributes and labels
$extrafields=new ExtraFields($db);
$extralabels=$extrafields->fetch_name_optionals_label('commandet',true);
foreach($extrafields->attribute_label as $key=>$label)
{
$key='options_'.$key;
$newobject->array_options[$key]=$order[$key];
}
// Trick because nusoap does not store data with same structure if there is one or several lines
$arrayoflines=array();
@ -666,6 +717,17 @@ function createOrder($authentication,$order)
$newline->total_ttc=$line['total'];
$newline->date_start=$line['date_start'];
$newline->date_end=$line['date_end'];
// Retrieve all extrafield for lines
// fetch optionals attributes and labels
$extrafields=new ExtraFields($db);
$extralabels=$extrafields->fetch_name_optionals_label('commandedet',true);
foreach($extrafields->attribute_label as $key=>$label)
{
$key='options_'.$key;
$newline->array_options[$key]=$line[$key];
}
$newobject->lines[]=$newline;
}