Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into develop

This commit is contained in:
Rui Strecht 2017-10-04 16:07:54 +01:00
commit 7b60d75579
39 changed files with 555 additions and 452 deletions

View File

@ -419,7 +419,7 @@ class AccountancyExport
/**
* Export format : Agiris
* Export format : Agiris Isacompta
*
* @param array $objectLines data
*
@ -433,30 +433,23 @@ class AccountancyExport
$date = dol_print_date($line->doc_date, '%d%m%Y');
print $line->id . $this->separator;
print '"'.dol_trunc($line->piece_num,15,'right','UTF-8',1).'"'.$this->separator;
print $line->piece_num . $this->separator;
print $line->label_operation . $this->separator;
print $date . $this->separator;
print '"'.dol_trunc($line->piece_num,15,'right','UTF-8',1).'"'.$this->separator;
print $line->label_operation . $this->separator;
if (empty($line->subledger_account)) {
print length_accountg($line->numero_compte) . $this->separator;
} else {
// FIXME Because the subledger_account is already an accounting account, does we really need
// to concat 4011 or 401 to it ?
if (substr($line->numero_compte, 0, 1) == 'C' || substr($line->numero_compte, 0, 1) == '9') {
print '411' . substr(str_replace(" ", "", $line->subledger_account), 0, 5) . $this->separator;
}
if (substr($line->numero_compte, 0, 1) == 'F' || substr($line->numero_compte, 0, 1) == '0') {
print '401' . substr(str_replace(" ", "", $line->subledger_account), 0, 5) . $this->separator;
}
print length_accounta($line->subledger_account) . $this->separator;
}
print length_accounta($line->subledger_account) . $this->separator;
print $line->doc_ref . $this->separator;
print price($line->debit) . $this->separator;
print price($line->credit) . $this->separator;
print price($line->montant).$this->separator;
print $line->sens.$this->separator;
print $line->code_journal . $this->separator;
print $line->code_journal;
print $this->end_line;
}
}

View File

@ -38,6 +38,28 @@ $langs->load("members");
$id = GETPOST('id','int')?GETPOST('id','int'):GETPOST('rowid','int');
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortfield) $sortfield='a.datep,a.id';
if (! $sortorder) $sortorder='DESC';
if (GETPOST('actioncode','array'))
{
$actioncode=GETPOST('actioncode','array',3);
if (! count($actioncode)) $actioncode='0';
}
else
{
$actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
}
$search_agenda_label=GETPOST('search_agenda_label');
// Security check
$result=restrictedArea($user,'adherent',$id);
@ -56,7 +78,26 @@ if ($result > 0)
* Actions
*/
// None
$parameters=array('id'=>$id, 'objcanvas'=>$objcanvas);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook))
{
// Cancel
if (GETPOST('cancel','alpha') && ! empty($backtopage))
{
header("Location: ".$backtopage);
exit;
}
// Purge search criteria
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
{
$actioncode='';
$search_agenda_label='';
}
}
@ -103,25 +144,33 @@ if ($object->id > 0)
dol_fiche_end();
/*
* Barre d'action
*/
//print '<div class="tabsAction">';
//print '</div>';
print '<div class="tabsAction">';
$morehtmlcenter = '';
if (! empty($conf->agenda->enabled))
{
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage=1&origin=member&originid='.$id.'">'.$langs->trans("AddAction").'</a></div>';
$morehtmlcenter.='<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage=1&origin=member&originid='.$id.'">'.$langs->trans("AddAction").'</a>';
}
print '</div>';
if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
{
print '<br>';
$out='';
$param='&id='.$id;
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
print load_fiche_titre($langs->trans("ActionsOnMember"),$out,'');
print_barre_liste($langs->trans("ActionsOnMember"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $morehtmlcenter, 0, -1, '', '', '', '', 0, 1, 1);
// List of actions
show_actions_done($conf,$langs,$db,$object,null,0,'','');
// List of all actions
$filters=array();
$filters['search_agenda_label']=$search_agenda_label;
// TODO Replace this with same code than into listactions.php
show_actions_done($conf,$langs,$db,$object,null,0,$actioncode, '', $filters, $sortfield, $sortorder);
}
}

View File

@ -1799,10 +1799,16 @@ else
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
$MAX = 10;
$morehtmlright = '<a href="'.DOL_URL_ROOT.'/adherents/agenda.php?id='.$object->id.'">';
$morehtmlright.= $langs->trans("SeeAll");
$morehtmlright.= '</a>';
// List of actions on element
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
$formactions = new FormActions($db);
$somethingshown = $formactions->showactions($object, 'member', $socid, 1, 'listactions', 10);
$somethingshown = $formactions->showactions($object, 'member', $socid, 1, 'listactions', $MAX, '', $morehtmlright);
print '</div></div></div>';
}

View File

@ -136,6 +136,9 @@ class DolibarrApi
unset($object->table_element_line);
unset($object->picto);
unset($object->skip_update_total);
unset($object->context);
// Remove the $oldcopy property because it is not supported by the JSON
// encoder. The following error is generated when trying to serialize
// it: "Error encoding/decoding JSON: Type is not supported"

View File

@ -357,7 +357,7 @@ if ($resql)
//$param='month='.$monthshown.'&year='.$year;
$hourminsec='100000';
$link = '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.sprintf("%04d%02d%02d",$tmpforcreatebutton['year'],$tmpforcreatebutton['mon'],$tmpforcreatebutton['mday']).$hourminsec.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam?'?'.$newparam:'')).'">';
$link.= $langs->trans("NewAction");
$link.= $langs->trans("AddAction");
$link.= '</a>';
}
@ -372,9 +372,9 @@ if ($resql)
print '<tr class="liste_titre_filter">';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"><input type="text" name="search_title" value="'.$search_title.'"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre" align="center">';
print '<td class="liste_titre" align="center">';
print $form->select_date($datestart, 'datestart', 0, 0, 1, '', 1, 0, 1);
print '</td>';
print '<td class="liste_titre" align="center">';
@ -396,9 +396,9 @@ if ($resql)
print '<tr class="liste_titre">';
print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"a.id",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("ActionsOwnedByShort",$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"a.label",$param,"","",$sortfield,$sortorder);
//if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"c.libelle",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"c.libelle",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"a.label",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("DateStart",$_SERVER["PHP_SELF"],"a.datep",$param,'','align="center"',$sortfield,$sortorder);
print_liste_field_titre("DateEnd",$_SERVER["PHP_SELF"],"a.datep2",$param,'','align="center"',$sortfield,$sortorder);
print_liste_field_titre("ThirdParty",$_SERVER["PHP_SELF"],"s.nom",$param,"","",$sortfield,$sortorder);
@ -452,11 +452,6 @@ if ($resql)
else print '&nbsp;';
print '</td>';
// Label
print '<td class="tdoverflowmax300">';
print $actionstatic->label;
print '</td>';
// Type
print '<td>';
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
@ -475,6 +470,11 @@ if ($resql)
print dol_trunc($labeltype,28);
print '</td>';
// Label
print '<td class="tdoverflowmax300">';
print $actionstatic->label;
print '</td>';
// Start date
print '<td align="center" class="nowrap">';
print dol_print_date($db->jdate($obj->dp),"dayhour");

View File

@ -116,7 +116,7 @@ if ($resql)
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print_barre_liste($langs->trans("Actions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_agenda', 0, '', '', $limit);
print_barre_liste($langs->trans("EventReports"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_agenda', 0, '', '', $limit);
$moreforfilter='';

View File

@ -278,7 +278,7 @@ class Proposals extends DolibarrApi
$request_data->fk_unit,
$this->element,
$request_data->id,
$request_data->pu_ht_devise,
$request_data->multicurrency_subprice,
$request_data->fk_remise_except
);
@ -316,26 +316,27 @@ class Proposals extends DolibarrApi
$request_data = (object) $request_data;
$updateRes = $this->propal->updateline(
$lineid,
$request_data->desc,
$request_data->subprice,
$request_data->qty,
$request_data->remise_percent,
$request_data->tva_tx,
$request_data->localtax1_tx,
$request_data->localtax2_tx,
'HT',
$request_data->desc,
'HT',
$request_data->info_bits,
$request_data->date_start,
$request_data->date_end,
$request_data->product_type,
$request_data->fk_parent_line,
0,
$request_data->fk_fournprice,
$request_data->pa_ht,
$request_data->label,
$request_data->special_code,
$request_data->fk_parent_line,
0,
$request_data->fk_fournprice,
$request_data->pa_ht,
$request_data->label,
$request_data->product_type,
$request_data->date_start,
$request_data->date_end,
$request_data->array_options,
$request_data->fk_unit
$request_data->fk_unit,
$request_data->multicurrency_subprice
);
if ($updateRes > 0) {
@ -508,4 +509,23 @@ class Proposals extends DolibarrApi
}
return $propal;
}
/**
* Clean sensible object datas
*
* @param object $object Object to clean
* @return array Array of cleaned object properties
*/
function _cleanObjectDatas($object) {
$object = parent::_cleanObjectDatas($object);
unset($object->name);
unset($object->lastname);
unset($object->firstname);
unset($object->civility_id);
unset($object->address);
return $object;
}
}

View File

@ -639,6 +639,7 @@ class Propal extends CommonObject
$pa_ht=price2num($pa_ht);
if (empty($qty) && empty($special_code)) $special_code=3; // Set option tag
if (! empty($qty) && $special_code == 3) $special_code=0; // Remove option tag
if (empty($type)) $type=0;
if ($this->statut == self::STATUS_DRAFT)
{

View File

@ -213,7 +213,7 @@ if (empty($reshook))
// TODO Move this into mass action include
if ($massaction == 'confirm_createbills') {
$orders = GETPOST('toselect');
$orders = GETPOST('toselect','array');
$createbills_onebythird = GETPOST('createbills_onebythird', 'int');
$validate_invoices = GETPOST('valdate_invoices', 'int');
@ -224,13 +224,13 @@ if (empty($reshook))
$db->begin();
foreach($orders as $id_order) {
foreach($orders as $id_order)
{
$cmd = new Commande($db);
if($cmd->fetch($id_order) <= 0) continue;
if ($cmd->fetch($id_order) <= 0) continue;
$object = new Facture($db);
if(!empty($createbills_onebythird) && !empty($TFactThird[$cmd->socid])) $object = $TFactThird[$cmd->socid]; // If option "one bill per third" is set, we use already created order.
if (!empty($createbills_onebythird) && !empty($TFactThird[$cmd->socid])) $object = $TFactThird[$cmd->socid]; // If option "one bill per third" is set, we use already created order.
else {
$object->socid = $cmd->socid;
@ -252,12 +252,10 @@ if (empty($reshook))
$res = $object->create($user);
if($res > 0) $nb_bills_created++;
}
if($object->id > 0) {
$db->begin();
if ($object->id > 0)
{
$sql = "INSERT INTO ".MAIN_DB_PREFIX."element_element (";
$sql.= "fk_source";
$sql.= ", sourcetype";
@ -270,115 +268,113 @@ if (empty($reshook))
$sql.= ", '".$object->element."'";
$sql.= ")";
if ($db->query($sql))
if (! $db->query($sql))
{
$db->commit();
}
else
{
$db->rollback();
$error++;
}
$lines = $cmd->lines;
if (empty($lines) && method_exists($cmd, 'fetch_lines'))
if (! $error)
{
$cmd->fetch_lines();
$lines = $cmd->lines;
$lines = $cmd->lines;
if (empty($lines) && method_exists($cmd, 'fetch_lines'))
{
$cmd->fetch_lines();
$lines = $cmd->lines;
}
$fk_parent_line=0;
$num=count($lines);
for ($i=0;$i<$num;$i++)
{
$desc=($lines[$i]->desc?$lines[$i]->desc:$lines[$i]->libelle);
if ($lines[$i]->subprice < 0)
{
// Negative line, we create a discount line
$discount = new DiscountAbsolute($db);
$discount->fk_soc=$object->socid;
$discount->amount_ht=abs($lines[$i]->total_ht);
$discount->amount_tva=abs($lines[$i]->total_tva);
$discount->amount_ttc=abs($lines[$i]->total_ttc);
$discount->tva_tx=$lines[$i]->tva_tx;
$discount->fk_user=$user->id;
$discount->description=$desc;
$discountid=$discount->create($user);
if ($discountid > 0)
{
$result=$object->insert_discount($discountid);
//$result=$discount->link_to_invoice($lineid,$id);
}
else
{
setEventMessages($discount->error, $discount->errors, 'errors');
$error++;
break;
}
}
else
{
// Positive line
$product_type=($lines[$i]->product_type?$lines[$i]->product_type:0);
// Date start
$date_start=false;
if ($lines[$i]->date_debut_prevue) $date_start=$lines[$i]->date_debut_prevue;
if ($lines[$i]->date_debut_reel) $date_start=$lines[$i]->date_debut_reel;
if ($lines[$i]->date_start) $date_start=$lines[$i]->date_start;
//Date end
$date_end=false;
if ($lines[$i]->date_fin_prevue) $date_end=$lines[$i]->date_fin_prevue;
if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel;
if ($lines[$i]->date_end) $date_end=$lines[$i]->date_end;
// Reset fk_parent_line for no child products and special product
if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9)
{
$fk_parent_line = 0;
}
$result = $object->addline(
$desc,
$lines[$i]->subprice,
$lines[$i]->qty,
$lines[$i]->tva_tx,
$lines[$i]->localtax1_tx,
$lines[$i]->localtax2_tx,
$lines[$i]->fk_product,
$lines[$i]->remise_percent,
$date_start,
$date_end,
0,
$lines[$i]->info_bits,
$lines[$i]->fk_remise_except,
'HT',
0,
$product_type,
$ii,
$lines[$i]->special_code,
$object->origin,
$lines[$i]->rowid,
$fk_parent_line,
$lines[$i]->fk_fournprice,
$lines[$i]->pa_ht,
$lines[$i]->label
);
if ($result > 0)
{
$lineid=$result;
}
else
{
$lineid=0;
$error++;
break;
}
// Defined the new fk_parent_line
if ($result > 0 && $lines[$i]->product_type == 9)
{
$fk_parent_line = $result;
}
}
}
}
$fk_parent_line=0;
$num=count($lines);
for ($i=0;$i<$num;$i++)
{
$desc=($lines[$i]->desc?$lines[$i]->desc:$lines[$i]->libelle);
if ($lines[$i]->subprice < 0)
{
// Negative line, we create a discount line
$discount = new DiscountAbsolute($db);
$discount->fk_soc=$object->socid;
$discount->amount_ht=abs($lines[$i]->total_ht);
$discount->amount_tva=abs($lines[$i]->total_tva);
$discount->amount_ttc=abs($lines[$i]->total_ttc);
$discount->tva_tx=$lines[$i]->tva_tx;
$discount->fk_user=$user->id;
$discount->description=$desc;
$discountid=$discount->create($user);
if ($discountid > 0)
{
$result=$object->insert_discount($discountid);
//$result=$discount->link_to_invoice($lineid,$id);
}
else
{
setEventMessages($discount->error, $discount->errors, 'errors');
$error++;
break;
}
}
else
{
// Positive line
$product_type=($lines[$i]->product_type?$lines[$i]->product_type:0);
// Date start
$date_start=false;
if ($lines[$i]->date_debut_prevue) $date_start=$lines[$i]->date_debut_prevue;
if ($lines[$i]->date_debut_reel) $date_start=$lines[$i]->date_debut_reel;
if ($lines[$i]->date_start) $date_start=$lines[$i]->date_start;
//Date end
$date_end=false;
if ($lines[$i]->date_fin_prevue) $date_end=$lines[$i]->date_fin_prevue;
if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel;
if ($lines[$i]->date_end) $date_end=$lines[$i]->date_end;
// Reset fk_parent_line for no child products and special product
if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9)
{
$fk_parent_line = 0;
}
$result = $object->addline(
$desc,
$lines[$i]->subprice,
$lines[$i]->qty,
$lines[$i]->tva_tx,
$lines[$i]->localtax1_tx,
$lines[$i]->localtax2_tx,
$lines[$i]->fk_product,
$lines[$i]->remise_percent,
$date_start,
$date_end,
0,
$lines[$i]->info_bits,
$lines[$i]->fk_remise_except,
'HT',
0,
$product_type,
$ii,
$lines[$i]->special_code,
$object->origin,
$lines[$i]->rowid,
$fk_parent_line,
$lines[$i]->fk_fournprice,
$lines[$i]->pa_ht,
$lines[$i]->label
);
if ($result > 0)
{
$lineid=$result;
}
else
{
$lineid=0;
$error++;
break;
}
// Defined the new fk_parent_line
if ($result > 0 && $lines[$i]->product_type == 9)
{
$fk_parent_line = $result;
}
}
}
}
//$cmd->classifyBilled($user); // Disabled. This behavior must be set or not using the workflow module.
@ -391,27 +387,29 @@ if (empty($reshook))
$TAllFact = empty($createbills_onebythird) ? $TFact : $TFactThird;
$toselect = array();
if(!empty($validate_invoices)) {
if (! $error && $validate_invoices)
{
$massaction = $action = 'builddoc';
foreach($TAllFact as &$object)
{
$result = $object->validate($user);
if ($result <= 0)
{
$error++;
setEventMessages($object->error, $object->errors, 'errors');
break;
}
foreach($TAllFact as &$object) {
$object->validate($user);
$toselect[] = $object->id; // For builddoc action
$id = $object->id; // For builddoc action
// Fac builddoc
$donotredirect = 1;
$upload_dir = $conf->facture->dir_output;
$permissioncreate=$user->rights->facture->creer;
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
}
$objectclass='Facture';
$objectlabel='Invoice';
$permtoread = $user->rights->facture->lire;
$permtodelete = $user->rights->facture->supprimer;
$uploaddir = $conf->facture->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
$massaction = $action = 'confirm_createbills';
}
if (! $error)

View File

@ -2097,6 +2097,10 @@ class Facture extends CommonInvoice
$error=0;
dol_syslog(get_class($this).'::validate user='.$user->id.', force_number='.$force_number.', idwarehouse='.$idwarehouse);
// Force to have object complete for checks
$this->fetch_thirdparty();
$this->fetch_lines();
// Check parameters
if (! $this->brouillon)
{
@ -2119,9 +2123,6 @@ class Facture extends CommonInvoice
$this->db->begin();
$this->fetch_thirdparty();
$this->fetch_lines();
// Check parameters
if ($this->type == self::TYPE_REPLACEMENT) // si facture de remplacement
{

View File

@ -257,30 +257,33 @@ else
}
print '<div class="tabsAction">';
//print '<div class="tabsAction">';
//print '</div>';
$morehtmlcenter='';
if (! empty($conf->agenda->enabled))
{
if (! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create))
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'">'.$langs->trans("AddAction").'</a>';
$morehtmlcenter.= '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'">'.$langs->trans("AddAction").'</a>';
}
else
{
print '<a class="butActionRefused" href="#">'.$langs->trans("AddAction").'</a>';
$morehtmlcenter.= '<a class="butActionRefused" href="#">'.$langs->trans("AddAction").'</a>';
}
}
print '</div>';
if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
{
print '<br>';
$param='&id='.$id;
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
print load_fiche_titre($langs->trans("TasksHistoryForThisContact"),'','');
print_barre_liste($langs->trans("ActionsOnCompany"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $morehtmlcenter, 0, -1, '', '', '', '', 0, 1, 1);
// List of all actions
$filters=array();

View File

@ -91,10 +91,13 @@ if ($action == 'builddoc' && $permissioncreate)
}
else
{
setEventMessages($langs->trans("FileGenerated"), null);
if (empty($donotredirect)) // This is se when include is done by bulk action "Bill Orders"
{
setEventMessages($langs->trans("FileGenerated"), null);
header('Location: '.$_SERVER['REQUEST_URI'].'#builddoc');
exit;
header('Location: '.$_SERVER['REQUEST_URI'].'#builddoc');
exit;
}
}
}
}

View File

@ -35,13 +35,13 @@ $comment = new Comment($db);
if ($action == 'addcomment')
{
$description = GETPOST('comment_description');
$description = GETPOST('comment_description', 'none');
if (!empty($description))
{
$comment->description = $description;
$comment->datec = time();
$comment->fk_element = GETPOST('id');
$comment->element_type = GETPOST('comment_element_type');
$comment->fk_element = GETPOST('id','int');
$comment->element_type = GETPOST('comment_element_type','alpha');
$comment->fk_user_author = $user->id;
$comment->entity = $conf->entity;
if ($comment->create($user) > 0)

View File

@ -308,7 +308,7 @@ abstract class CommonObject
* @var CommonObjectLine[]
*/
public $lines;
/**
* @var mixed Contains comments
* @see fetchComments()
@ -4644,13 +4644,19 @@ abstract class CommonObject
{
$out .= '<tr '.$class.$csstyle.' class="'.$this->element.'_extras_'.$key.'">';
}
// Convert date into timestamp format
// Convert date into timestamp format (value in memory must be a timestamp)
if (in_array($extrafields->attribute_type[$key],array('date','datetime')))
{
$value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$this->db->jdate($this->array_options['options_'.$key]);
}
// Convert float submited string into real php numeric (value in memory must be a php numeric)
if (in_array($extrafields->attribute_type[$key],array('price','double')))
{
$value = isset($_POST["options_".$key])?price2num($_POST["options_".$key]):$this->array_options['options_'.$key];
}
$labeltoshow = $langs->trans($label);
if($extrafields->attribute_required[$key])
{
$labeltoshow = '<span'.($mode != 'view' ? ' class="fieldrequired"':'').'>'.$labeltoshow.'</span>';
@ -5294,7 +5300,7 @@ abstract class CommonObject
// TODO...
}
/**
* Load comments linked with current task
* @return boolean 1 if ok
@ -5302,12 +5308,12 @@ abstract class CommonObject
public function fetchComments()
{
require_once DOL_DOCUMENT_ROOT.'/core/class/comment.class.php';
$comment = new Comment($this->db);
$this->comments = Comment::fetchAllFor($this->element, $this->id);
return 1;
}
/**
* Return nb comments already posted
*

View File

@ -804,7 +804,7 @@ class ExtraFields
* Return HTML string to put an input field into a page
*
* @param string $key Key of attribute
* @param string $value Preselected value to show (for date type it must be in timestamp format)
* @param string $value Preselected value to show (for date type it must be in timestamp format, for amount or price it must be a php numeric value)
* @param string $moreparam To add more parametes on html input tag
* @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names)
* @param string $keysuffix Suffix string to add into name and id of field (can be used to avoid duplicate names)
@ -927,11 +927,14 @@ class ExtraFields
}
elseif ($type == 'price')
{
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" value="'.price2num($value).'" '.($moreparam?$moreparam:'').'> '.$langs->getCurrencySymbol($conf->currency);
if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format.
$value=price($value);
}
$out.='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'> '.$langs->getCurrencySymbol($conf->currency);
}
elseif ($type == 'double')
{
if (!empty($value)) {
if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format.
$value=price($value);
}
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'> ';

View File

@ -157,9 +157,10 @@ class FormActions
* @param string $morecss More css on table
* @param int $max Max number of record
* @param string $moreparambacktopage More param for the backtopage
* @param string $morehtmlright More html text on right of title line
* @return int <0 if KO, >=0 if OK
*/
function showactions($object, $typeelement, $socid=0, $forceshowtitle=0, $morecss='listactions', $max=0, $moreparambacktopage='')
function showactions($object, $typeelement, $socid=0, $forceshowtitle=0, $morecss='listactions', $max=0, $moreparambacktopage='', $morehtmlright='')
{
global $langs,$conf,$user;
global $bc;
@ -196,7 +197,7 @@ class FormActions
$buttontoaddnewevent.= '</a>';
print '<!-- formactions->showactions -->'."\n";
print load_fiche_titre($title, $buttontoaddnewevent, '');
print load_fiche_titre($title, $morehtmlright, '', 0, 0, '', $buttontoaddnewevent);
$page=0; $param='';
@ -206,10 +207,10 @@ class FormActions
print '<table class="noborder'.($morecss?' '.$morecss:'').'" width="100%">';
print '<tr class="liste_titre">';
print getTitleFieldOfList('Ref', 0, $_SERVER["PHP_SELF"], '', $page, $param, '', $sortfield, $sortorder, '', 1);
print getTitleFieldOfList('Action', 0, $_SERVER["PHP_SELF"], '', $page, $param, '', $sortfield, $sortorder, '', 1);
print getTitleFieldOfList('Type', 0, $_SERVER["PHP_SELF"], '', $page, $param, '', $sortfield, $sortorder, '', 1);
print getTitleFieldOfList('Date', 0, $_SERVER["PHP_SELF"], 'a.datep', $page, $param, 'align="center"', $sortfield, $sortorder, '', 1);
print getTitleFieldOfList('By', 0, $_SERVER["PHP_SELF"], '', $page, $param, '', $sortfield, $sortorder, '', 1);
print getTitleFieldOfList('Type', 0, $_SERVER["PHP_SELF"], '', $page, $param, '', $sortfield, $sortorder, '', 1);
print getTitleFieldOfList('Action', 0, $_SERVER["PHP_SELF"], '', $page, $param, '', $sortfield, $sortorder, '', 1);
print getTitleFieldOfList('Date', 0, $_SERVER["PHP_SELF"], 'a.datep', $page, $param, 'align="center"', $sortfield, $sortorder, '', 1);
print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], '', $page, $param, 'align="right"', $sortfield, $sortorder, '', 1);
print '</tr>';
print "\n";
@ -228,8 +229,14 @@ class FormActions
print '<tr class="oddeven">';
print '<td>'.$ref.'</td>';
print '<td>'.$label.'</td>';
print '<td>';
if (! empty($action->userownerid))
{
$userstatic->fetch($action->userownerid); // TODO Introduce a cache on users fetched
print $userstatic->getNomUrl(-1, '', 0, 0, 16, 0, '', '');
}
print '</td>';
print '<td>';
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
{
if ($action->type_picto) print img_picto('', $action->type_picto);
@ -242,6 +249,7 @@ class FormActions
}
print $action->type;
print '</td>';
print '<td>'.$label.'</td>';
print '<td align="center">'.dol_print_date($action->datep,'dayhour');
if ($action->datef)
{
@ -254,13 +262,6 @@ class FormActions
else print '-'.dol_print_date($action->datef,'dayhour');
}
print '</td>';
print '<td>';
if (! empty($action->userownerid))
{
$userstatic->fetch($action->userownerid); // TODO Introduce a cache on users fetched
print $userstatic->getNomUrl(-1, '', 0, 0, 16, 0, '', '');
}
print '</td>';
print '<td align="right">';
if (! empty($action->author->id))
{

View File

@ -1287,11 +1287,11 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
}
$out.='<td class="liste_titre"></td>';
$out.='<td class="liste_titre"></td>';
$out.='<td class="liste_titre maxwidth100onsmartphone"><input type="text" class="maxwidth100onsmartphone" name="search_agenda_label" value="'.$filters['search_agenda_label'].'"></td>';
$out.='<td class="liste_titre"></td>';
$out.='<td class="liste_titre">';
$out.=$formactions->select_type_actions($actioncode, "actioncode", '', empty($conf->global->AGENDA_USE_EVENT_TYPE)?1:-1, 0, 0, 1);
$out.='</td>';
$out.='<td class="liste_titre maxwidth100onsmartphone"><input type="text" class="maxwidth100onsmartphone" name="search_agenda_label" value="'.$filters['search_agenda_label'].'"></td>';
$out.='<td class="liste_titre"></td>';
$out.='<td class="liste_titre"></td>';
$out.='<td class="liste_titre"></td>';
$out.='<td class="liste_titre"></td>';
@ -1316,9 +1316,9 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
}
$out.=getTitleFieldOfList($langs->trans("Ref"), 0, $_SERVER["PHP_SELF"], 'a.id', '', $param, '', $sortfield, $sortorder);
$out.=getTitleFieldOfList($langs->trans("Owner"));
$out.=getTitleFieldOfList($langs->trans("Type"));
$out.=getTitleFieldOfList($langs->trans("Label"), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
$out.=getTitleFieldOfList($langs->trans("Date"), 0, $_SERVER["PHP_SELF"], 'a.datep,a.id', '', $param, 'align="center"', $sortfield, $sortorder);
$out.=getTitleFieldOfList($langs->trans("Type"));
$out.=getTitleFieldOfList('');
$out.=getTitleFieldOfList('');
$out.=getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], 'a.percent', '', $param, 'align="center"', $sortfield, $sortorder);
@ -1353,6 +1353,25 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
$out.=$userstatic->getNomUrl(-1);
$out.='</td>';
// Type
$out.='<td>';
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
{
if ($histo[$key]['apicto']) $out.=img_picto('', $histo[$key]['apicto']);
else {
if ($histo[$key]['acode'] == 'AC_TEL') $out.=img_picto('', 'object_phoning').' ';
if ($histo[$key]['acode'] == 'AC_FAX') $out.=img_picto('', 'object_phoning_fax').' ';
if ($histo[$key]['acode'] == 'AC_EMAIL') $out.=img_picto('', 'object_email').' ';
}
$out.=$actionstatic->type;
}
else {
$typelabel = $actionstatic->type;
if ($histo[$key]['acode'] != 'AC_OTH_AUTO') $typelabel = $langs->trans("ActionAC_MANUAL");
$out.=$typelabel;
}
$out.='</td>';
// Title
$out.='<td>';
if (isset($histo[$key]['type']) && $histo[$key]['type']=='action')
@ -1392,25 +1411,6 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
if ($late) $out.=img_warning($langs->trans("Late")).' ';
$out.="</td>\n";
// Type
$out.='<td>';
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
{
if ($histo[$key]['apicto']) $out.=img_picto('', $histo[$key]['apicto']);
else {
if ($histo[$key]['acode'] == 'AC_TEL') $out.=img_picto('', 'object_phoning').' ';
if ($histo[$key]['acode'] == 'AC_FAX') $out.=img_picto('', 'object_phoning_fax').' ';
if ($histo[$key]['acode'] == 'AC_EMAIL') $out.=img_picto('', 'object_email').' ';
}
$out.=$actionstatic->type;
}
else {
$typelabel = $actionstatic->type;
if ($histo[$key]['acode'] != 'AC_OTH_AUTO') $typelabel = $langs->trans("ActionAC_MANUAL");
$out.=$typelabel;
}
$out.='</td>';
// Title of event
//$out.='<td>'.dol_trunc($histo[$key]['note'], 40).'</td>';

View File

@ -3540,10 +3540,11 @@ function print_fiche_titre($title, $mesg='', $picto='title_generic.png', $pictoi
* @param int $pictoisfullpath 1=Icon name is a full absolute url of image
* @param int $id To force an id on html objects
* @param string $morecssontable More css on table
* @param string $morehtmlcenter Added message to show on center
* @return string
* @see print_barre_liste
*/
function load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png', $pictoisfullpath=0, $id=0, $morecssontable='')
function load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png', $pictoisfullpath=0, $id=0, $morecssontable='', $morehtmlcenter='')
{
global $conf;
@ -3558,6 +3559,10 @@ function load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png',
$return.= '<td class="nobordernopadding" valign="middle">';
$return.= '<div class="titre">'.$titre.'</div>';
$return.= '</td>';
if (dol_strlen($morehtmlcenter))
{
$return.= '<td class="nobordernopadding" align="center" valign="middle">'.$morehtmlcenter.'</td>';
}
if (dol_strlen($morehtmlright))
{
$return.= '<td class="nobordernopadding titre_right" align="right" valign="middle">'.$morehtmlright.'</td>';
@ -3585,9 +3590,10 @@ function load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png',
* @param string $morecss More css to the table
* @param int $limit Max number of lines (-1 = use default, 0 = no limit, > 0 = limit).
* @param int $hideselectlimit Force to hide select limit
* @param int $hidenavigation Force to hide all navigation tools
* @return void
*/
function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $center='', $num=-1, $totalnboflines='', $picto='title_generic.png', $pictoisfullpath=0, $morehtml='', $morecss='', $limit=-1, $hideselectlimit=0)
function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $center='', $num=-1, $totalnboflines='', $picto='title_generic.png', $pictoisfullpath=0, $morehtml='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0)
{
global $conf,$langs;
@ -3781,7 +3787,7 @@ function print_fleche_navigation($page, $file, $options='', $nextpage=0, $betwee
* @param string $rate Rate value to format ('19.6', '19,6', '19.6%', '19,6%', '19.6 (CODEX)', ...)
* @param boolean $addpercent Add a percent % sign in output
* @param int $info_bits Miscellaneous information on vat (0=Default, 1=French NPR vat)
* @param int $usestarfornpr 1=Use '*' for NPR vat rate intead of MAIN_LABEL_MENTION_NPR
* @param int $usestarfornpr -1=Never show, 0 or 1=Use '*' for NPR vat rates
* @return string String with formated amounts ('19,6' or '19,6%' or '8.5% (NPR)' or '8.5% *' or '19,6 (CODEX)')
*/
function vatrate($rate, $addpercent=false, $info_bits=0, $usestarfornpr=0)
@ -3811,7 +3817,7 @@ function vatrate($rate, $addpercent=false, $info_bits=0, $usestarfornpr=0)
// TODO Split on / and output with a price2num to have clean numbers without ton of 000.
$ret=$rate.($addpercent?'%':'');
}
if ($info_bits & 1) $ret.=' *';
if (($info_bits & 1) && $usestarfornpr >= 0) $ret.=' *';
$ret.=$morelabel;
return $ret;
}

View File

@ -1491,14 +1491,14 @@ function pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails=0)
{
$tmpresult='';
$tmpresult.=vatrate($object->lines[$i]->tva_tx, 1, $object->lines[$i]->info_bits, 1);
$tmpresult.=vatrate($object->lines[$i]->tva_tx, 0, $object->lines[$i]->info_bits, -1);
if (empty($conf->global->MAIN_PDF_MAIN_HIDE_SECOND_TAX))
{
if ($object->lines[$i]->total_localtax1 != 0)
{
if (preg_replace('/[\s0%]/','',$tmpresult)) $tmpresult.='/';
else $tmpresult='';
$tmpresult.=vatrate(abs($object->lines[$i]->localtax1_tx),1);
$tmpresult.=vatrate(abs($object->lines[$i]->localtax1_tx), 0);
}
}
if (empty($conf->global->MAIN_PDF_MAIN_HIDE_THIRD_TAX))
@ -1507,9 +1507,10 @@ function pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails=0)
{
if (preg_replace('/[\s0%]/','',$tmpresult)) $tmpresult.='/';
else $tmpresult='';
$tmpresult.=vatrate(abs($object->lines[$i]->localtax2_tx),1);
$tmpresult.=vatrate(abs($object->lines[$i]->localtax2_tx), 0);
}
}
$tmpresult.= '%';
$result.=$tmpresult;
}
@ -1820,6 +1821,8 @@ function pdf_getlineremisepercent($object,$i,$outputlangs,$hidedetails=0)
*/
function pdf_getlineprogress($object, $i, $outputlangs, $hidedetails = 0, $hookmanager = null)
{
if (empty($hookmanager)) global $hookmanager;
$reshook=0;
$result='';
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )

View File

@ -66,19 +66,8 @@ function project_prepare_head($object)
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'project');
// Manage discussion
if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT))
{
$nbComments = $object->getNbComments();
$head[$h][0] = DOL_URL_ROOT.'/projet/comment.php?id='.$object->id;
$head[$h][1] = $langs->trans("CommentLink");
if ($nbComments > 0) $head[$h][1].= ' <span class="badge">'.$nbComments.'</span>';
$head[$h][2] = 'project_comment';
$h++;
}
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
{
$nbNote = 0;
@ -122,6 +111,17 @@ function project_prepare_head($object)
$h++;
}
// Manage discussion
if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT))
{
$nbComments = $object->getNbComments();
$head[$h][0] = DOL_URL_ROOT.'/projet/comment.php?id='.$object->id;
$head[$h][1] = $langs->trans("CommentLink");
if ($nbComments > 0) $head[$h][1].= ' <span class="badge">'.$nbComments.'</span>';
$head[$h][2] = 'project_comment';
$h++;
}
$head[$h][0] = DOL_URL_ROOT.'/projet/info.php?id='.$object->id;
$head[$h][1].= $langs->trans("Events");
if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
@ -188,17 +188,6 @@ function task_prepare_head($object)
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'task');
// Manage discussion
if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK))
{
$nbComments = $object->getNbComments();
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/comment.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':'');
$head[$h][1] = $langs->trans("CommentLink");
if ($nbComments > 0) $head[$h][1].= ' <span class="badge">'.$nbComments.'</span>';
$head[$h][2] = 'task_comment';
$h++;
}
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
{
$nbNote = 0;
@ -222,6 +211,17 @@ function task_prepare_head($object)
$head[$h][2] = 'task_document';
$h++;
// Manage discussion
if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK))
{
$nbComments = $object->getNbComments();
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/comment.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':'');
$head[$h][1] = $langs->trans("CommentLink");
if ($nbComments > 0) $head[$h][1].= ' <span class="badge">'.$nbComments.'</span>';
$head[$h][2] = 'task_comment';
$h++;
}
complete_head_from_modules($conf,$langs,$object,$head,$h,'task','remove');
return $head;

View File

@ -140,7 +140,7 @@ class pdf_einstein extends ModelePDFCommandes
}
else
{
$this->posxtva=112;
$this->posxtva=110;
$this->posxup=126;
$this->posxqty=145;
}
@ -431,8 +431,8 @@ class pdf_einstein extends ModelePDFCommandes
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) && empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN))
{
$vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails);
$pdf->SetXY($this->posxtva, $curY);
$pdf->MultiCell($this->posxup-$this->posxtva-0.8, 3, $vat_rate, 0, 'R');
$pdf->SetXY($this->posxtva-5, $curY);
$pdf->MultiCell($this->posxup-$this->posxtva+4, 3, $vat_rate, 0, 'R');
}
// Unit price before discount

View File

@ -125,7 +125,7 @@ class pdf_crabe extends ModelePDFFactures
}
else
{
$this->posxtva=112;
$this->posxtva=110;
$this->posxup=126;
$this->posxqty=145;
}
@ -496,8 +496,8 @@ class pdf_crabe extends ModelePDFFactures
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) && empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN))
{
$vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails);
$pdf->SetXY($this->posxtva, $curY);
$pdf->MultiCell($this->posxup-$this->posxtva-0.8, 3, $vat_rate, 0, 'R');
$pdf->SetXY($this->posxtva-5, $curY);
$pdf->MultiCell($this->posxup-$this->posxtva+4, 3, $vat_rate, 0, 'R');
}
// Unit price before discount

View File

@ -114,7 +114,7 @@ class pdf_azur extends ModelePDFPropales
}
else
{
$this->posxtva=112;
$this->posxtva=110;
$this->posxup=126;
$this->posxqty=145;
}
@ -505,8 +505,8 @@ class pdf_azur extends ModelePDFPropales
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) && empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN))
{
$vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails);
$pdf->SetXY($this->posxtva, $curY);
$pdf->MultiCell($this->posxup-$this->posxtva-0.8, 3, $vat_rate, 0, 'R');
$pdf->SetXY($this->posxtva-5, $curY);
$pdf->MultiCell($this->posxup-$this->posxtva+4, 3, $vat_rate, 0, 'R');
}
// Unit price before discount
@ -1312,6 +1312,7 @@ class pdf_azur extends ModelePDFPropales
$pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height);
if (empty($hidetop))
{
// Not do -3 and +3 instead of -1 -1 to have more space for text 'Sales tax'
$pdf->SetXY($this->posxtva-3, $tab_top+1);
$pdf->MultiCell($this->posxup-$this->posxtva+3,2, $outputlangs->transnoentities("VAT"),'','C');
}

View File

@ -29,10 +29,9 @@ print '<td width="25%"></td>';
print "</tr>\n";
print '<tr class="oddeven">';
print '<td></td>';
// Description
print '<td colspan="2">';
print '<td colspan="3">';
$desc = GETPOST('comment_description');
@ -47,13 +46,16 @@ print '</td></tr>';
print '</table></form>';
// List of comments
if(!empty($object->comments)) {
if (!empty($object->comments))
{
// Default color for current user
$TColors = array($user->id => array('bgcolor'=>'efefef','color'=>'555'));
$first = true;
foreach($object->comments as $comment) {
foreach($object->comments as $comment)
{
$fk_user = $comment->fk_user_author;
$userstatic->fetch($fk_user);
if(empty($TColors[$fk_user])) {
$bgcolor = random_color(180,240);
if(!empty($userstatic->color)) {
@ -63,10 +65,10 @@ if(!empty($object->comments)) {
$TColors[$fk_user] = array('bgcolor'=>$bgcolor,'color'=>$color);
}
print '<div class="width100p" style="color:#'.$TColors[$fk_user]['color'].'">';
if($fk_user == $user->id) {
if ($fk_user != $user->id) {
print '<div class="width25p float">&nbsp;</div>';
}
print '<div class="width75p float comment comment-table" style="background-color:#'.$TColors[$fk_user]['bgcolor'].'">';
print '<div class="comment-info comment-cell">';
if (! empty($user->photo))
@ -76,7 +78,7 @@ if(!empty($object->comments)) {
print $langs->trans('User').' : '.$userstatic->getNomUrl().'<br/>';
print $langs->trans('Date').' : '.dol_print_date($comment->datec,'dayhoursec');
print '</div>'; // End comment-info
print '<div class="comment-cell comment-right">';
print '<div class="comment-table width100p">';
print '<div class="comment-description comment-cell">';
@ -90,13 +92,13 @@ if(!empty($object->comments)) {
print '</div>'; // End comment-table
print '</div>'; // End comment-right
print '</div>'; // End comment
if($fk_user != $user->id) {
if($fk_user == $user->id) {
print '<div class="width25p float">&nbsp;</div>';
}
print '<div class="clearboth"></div>';
print '</div>'; // end 100p
$first = false;
}
}

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2017 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014-2015 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2014-2015 Charlie Benke <charlies@patas-monkey.com>
@ -743,7 +743,8 @@ if (empty($reshook))
$parameters=array('id'=>$object->id);
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook))
{ $result=$object->updateExtraField($_POST["attribute"]);
{
$result=$object->insertExtraFields();
if ($result < 0)
{
$error++;

View File

@ -1090,6 +1090,10 @@ class FactureFournisseur extends CommonInvoice
$error=0;
dol_syslog(get_class($this).'::validate user='.$user->id.', force_number='.$force_number.', idwarehouse='.$idwarehouse);
// Force to have object complete for checks
$this->fetch_thirdparty();
$this->fetch_lines();
// Check parameters
if ($this->statut > self::STATUS_DRAFT) // This is to avoid to validate twice (avoid errors on logs and stock management)
{
@ -2550,15 +2554,10 @@ class SupplierInvoiceLine extends CommonObjectLine
}
// Clean parameters
if (empty($this->tva_tx)) {
$this->tva_tx = 0;
}
if (empty($this->localtax1_tx)) {
$this->localtax1_tx = 0;
}
if (empty($this->localtax2_tx)) {
$this->localtax2_tx = 0;
}
if (empty($this->remise_percent)) $this->remise_percent = 0;
if (empty($this->tva_tx)) $this->tva_tx = 0;
if (empty($this->localtax1_tx)) $this->localtax1_tx = 0;
if (empty($this->localtax2_tx)) $this->localtax2_tx = 0;
$this->db->begin();

View File

@ -232,7 +232,7 @@ if (empty($reshook))
// TODO Move this into mass action include
if ($massaction == 'confirm_createbills')
{
$orders = GETPOST('toselect');
$orders = GETPOST('toselect','array');
$createbills_onebythird = GETPOST('createbills_onebythird', 'int');
$validate_invoices = GETPOST('valdate_invoices', 'int');
@ -274,9 +274,8 @@ if (empty($reshook))
}
if($object->id > 0) {
$db->begin();
if ($object->id > 0)
{
$sql = "INSERT INTO ".MAIN_DB_PREFIX."element_element (";
$sql.= "fk_source";
$sql.= ", sourcetype";
@ -289,118 +288,116 @@ if (empty($reshook))
$sql.= ", '".$object->element."'";
$sql.= ")";
if ($db->query($sql))
if (! $db->query($sql))
{
$db->commit();
}
else
{
$db->rollback();
$erorr++;
}
$lines = $cmd->lines;
if (empty($lines) && method_exists($cmd, 'fetch_lines'))
if (! $error)
{
$cmd->fetch_lines();
$lines = $cmd->lines;
$lines = $cmd->lines;
if (empty($lines) && method_exists($cmd, 'fetch_lines'))
{
$cmd->fetch_lines();
$lines = $cmd->lines;
}
$fk_parent_line=0;
$num=count($lines);
for ($i=0;$i<$num;$i++)
{
$desc=($lines[$i]->desc?$lines[$i]->desc:$lines[$i]->libelle);
if ($lines[$i]->subprice < 0)
{
// Negative line, we create a discount line
$discount = new DiscountAbsolute($db);
$discount->fk_soc=$object->socid;
$discount->amount_ht=abs($lines[$i]->total_ht);
$discount->amount_tva=abs($lines[$i]->total_tva);
$discount->amount_ttc=abs($lines[$i]->total_ttc);
$discount->tva_tx=$lines[$i]->tva_tx;
$discount->fk_user=$user->id;
$discount->description=$desc;
$discountid=$discount->create($user);
if ($discountid > 0)
{
$result=$object->insert_discount($discountid);
//$result=$discount->link_to_invoice($lineid,$id);
}
else
{
setEventMessages($discount->error, $discount->errors, 'errors');
$error++;
break;
}
}
else
{
// Positive line
$product_type=($lines[$i]->product_type?$lines[$i]->product_type:0);
// Date start
$date_start=false;
if ($lines[$i]->date_debut_prevue) $date_start=$lines[$i]->date_debut_prevue;
if ($lines[$i]->date_debut_reel) $date_start=$lines[$i]->date_debut_reel;
if ($lines[$i]->date_start) $date_start=$lines[$i]->date_start;
//Date end
$date_end=false;
if ($lines[$i]->date_fin_prevue) $date_end=$lines[$i]->date_fin_prevue;
if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel;
if ($lines[$i]->date_end) $date_end=$lines[$i]->date_end;
// Reset fk_parent_line for no child products and special product
if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9)
{
$fk_parent_line = 0;
}
$result = $object->addline(
$desc,
$lines[$i]->subprice,
$lines[$i]->qty,
$lines[$i]->tva_tx,
$lines[$i]->localtax1_tx,
$lines[$i]->localtax2_tx,
$lines[$i]->fk_product,
$lines[$i]->remise_percent,
$date_start,
$date_end,
0,
$lines[$i]->info_bits,
$lines[$i]->fk_remise_except,
'HT',
0,
$product_type,
$ii,
$lines[$i]->special_code,
$object->origin,
$lines[$i]->rowid,
$fk_parent_line,
$lines[$i]->fk_fournprice,
$lines[$i]->pa_ht,
$lines[$i]->label
);
if ($result > 0)
{
$lineid=$result;
}
else
{
$lineid=0;
$error++;
break;
}
// Defined the new fk_parent_line
if ($result > 0 && $lines[$i]->product_type == 9)
{
$fk_parent_line = $result;
}
}
}
}
$fk_parent_line=0;
$num=count($lines);
for ($i=0;$i<$num;$i++)
{
$desc=($lines[$i]->desc?$lines[$i]->desc:$lines[$i]->libelle);
if ($lines[$i]->subprice < 0)
{
// Negative line, we create a discount line
$discount = new DiscountAbsolute($db);
$discount->fk_soc=$object->socid;
$discount->amount_ht=abs($lines[$i]->total_ht);
$discount->amount_tva=abs($lines[$i]->total_tva);
$discount->amount_ttc=abs($lines[$i]->total_ttc);
$discount->tva_tx=$lines[$i]->tva_tx;
$discount->fk_user=$user->id;
$discount->description=$desc;
$discountid=$discount->create($user);
if ($discountid > 0)
{
$result=$object->insert_discount($discountid);
//$result=$discount->link_to_invoice($lineid,$id);
}
else
{
setEventMessages($discount->error, $discount->errors, 'errors');
$error++;
break;
}
}
else
{
// Positive line
$product_type=($lines[$i]->product_type?$lines[$i]->product_type:0);
// Date start
$date_start=false;
if ($lines[$i]->date_debut_prevue) $date_start=$lines[$i]->date_debut_prevue;
if ($lines[$i]->date_debut_reel) $date_start=$lines[$i]->date_debut_reel;
if ($lines[$i]->date_start) $date_start=$lines[$i]->date_start;
//Date end
$date_end=false;
if ($lines[$i]->date_fin_prevue) $date_end=$lines[$i]->date_fin_prevue;
if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel;
if ($lines[$i]->date_end) $date_end=$lines[$i]->date_end;
// Reset fk_parent_line for no child products and special product
if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9)
{
$fk_parent_line = 0;
}
$result = $object->addline(
$desc,
$lines[$i]->subprice,
$lines[$i]->qty,
$lines[$i]->tva_tx,
$lines[$i]->localtax1_tx,
$lines[$i]->localtax2_tx,
$lines[$i]->fk_product,
$lines[$i]->remise_percent,
$date_start,
$date_end,
0,
$lines[$i]->info_bits,
$lines[$i]->fk_remise_except,
'HT',
0,
$product_type,
$ii,
$lines[$i]->special_code,
$object->origin,
$lines[$i]->rowid,
$fk_parent_line,
$lines[$i]->fk_fournprice,
$lines[$i]->pa_ht,
$lines[$i]->label
);
if ($result > 0)
{
$lineid=$result;
}
else
{
$lineid=0;
$error++;
break;
}
// Defined the new fk_parent_line
if ($result > 0 && $lines[$i]->product_type == 9)
{
$fk_parent_line = $result;
}
}
}
}
$cmd->classifyBilled($user);
$cmd->classifyBilled($user); // TODO Move this in workflow like done for customer orders
if(!empty($createbills_onebythird) && empty($TFactThird[$cmd->socid])) $TFactThird[$cmd->socid] = $object;
else $TFact[$object->id] = $object;
@ -410,27 +407,30 @@ if (empty($reshook))
$TAllFact = empty($createbills_onebythird) ? $TFact : $TFactThird;
$toselect = array();
if(!empty($validate_invoices)) {
if (! $error && $validate_invoices) {
$massaction = $action = 'builddoc';
foreach($TAllFact as &$object) {
foreach($TAllFact as &$object)
{
$object->validate($user);
$toselect[] = $object->id; // For builddoc action
if ($result <= 0)
{
$error++;
setEventMessages($object->error, $object->errors, 'errors');
break;
}
$id = $object->id; // For builddoc action
// Fac builddoc
$donotredirect = 1;
$upload_dir = $conf->facture->dir_output;
$permissioncreate=$user->rights->facture->creer;
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
}
$objectclass='Facture';
$objectlabel='Invoice';
$permtoread = $user->rights->facture->lire;
$permtodelete = $user->rights->facture->supprimer;
$uploaddir = $conf->facture->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
$massaction = $action = 'confirm_createbills';
}
if (! $error)

View File

@ -584,7 +584,7 @@ Module3100Desc=Add a Skype button into users / third parties / contacts / member
Module3200Name=Non Reversible Logs
Module3200Desc=Activate log of some business events into a non reversible log. Events are archived in real-time. The log is a table of chained event that can be then read and exported. This module may be mandatory for some countries.
Module4000Name=HRM
Module4000Desc=Human resources management (mangement of department, employee contracts and feelings)
Module4000Desc=Human resources management (management of department, employee contracts and feelings)
Module5000Name=Multi-company
Module5000Desc=Allows you to manage multiple companies
Module6000Name=Workflow

View File

@ -12,6 +12,7 @@ Event=Event
Events=Events
EventsNb=Number of events
ListOfActions=List of events
EventReports=Event reports
Location=Location
ToUserOfGroup=To any user in group
EventOnFullDay=Event on all day(s)

View File

@ -597,6 +597,7 @@ Undo=Undo
Redo=Redo
ExpandAll=Expand all
UndoExpandAll=Undo expand
SeeAll=See all
Reason=Reason
FeatureNotYetSupported=Feature not yet supported
CloseWindow=Close window

View File

@ -115,7 +115,7 @@ if ($action == 'order' && isset($_POST['valid']))
$suppliers = array();
for ($i = 0; $i < $linecount; $i++)
{
if (GETPOST($i, 'alpha') === 'on' && GETPOST('fourn' . $i, 'int') > 0)
if (GETPOST('choose' . $i, 'alpha') === 'on' && GETPOST('fourn' . $i, 'int') > 0)
{
//one line
$box = $i;
@ -616,7 +616,7 @@ while ($i < ($limit ? min($num, $limit) : $num))
// Select field
//print '<td><input type="checkbox" class="check" name="' . $i . '"' . $disabled . '></td>';
print '<td><input type="checkbox" class="check" name="'.$i.'"></td>';
print '<td><input type="checkbox" class="check" name="choose'.$i.'"></td>';
print '<td class="nowrap">'.$prod->getNomUrl(1, '').'</td>';

View File

@ -1192,16 +1192,20 @@ elseif ($object->id > 0)
$genallowed=($user->rights->projet->lire && $userAccess > 0);
$delallowed=($user->rights->projet->creer && $userWrite > 0);
$var=true;
print $formfile->showdocuments('project',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf);
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
$MAX = 10;
$morehtmlright = '<a href="'.DOL_URL_ROOT.'/projet/info.php?id='.$object->id.'">';
$morehtmlright.= $langs->trans("SeeAll");
$morehtmlright.= '</a>';
// List of actions on element
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
$formactions = new FormActions($db);
$somethingshown = $formactions->showactions($object, 'project', $socid, 1, '', 10);
$somethingshown = $formactions->showactions($object, 'project', $socid, 1, '', $MAX, '', $morehtmlright);
print '</div></div></div>';
}

View File

@ -296,6 +296,7 @@ class Project extends CommonObject
$sql.= ", fk_user_close=" . ($this->fk_user_close > 0 ? $this->fk_user_close : "null");
$sql.= ", opp_amount = " . (strcmp($this->opp_amount, '') ? price2num($this->opp_amount) : "null");
$sql.= ", budget_amount = " . (strcmp($this->budget_amount, '') ? price2num($this->budget_amount) : "null");
$sql.= ", fk_user_modif = " . $user->id;
$sql.= " WHERE rowid = " . $this->id;
dol_syslog(get_class($this)."::update", LOG_DEBUG);
@ -390,7 +391,7 @@ class Project extends CommonObject
if (empty($id) && empty($ref)) return -1;
$sql = "SELECT rowid, ref, title, description, public, datec, opp_amount, budget_amount,";
$sql.= " tms, dateo, datee, date_close, fk_soc, fk_user_creat, fk_user_close, fk_statut, fk_opp_status, opp_percent, note_private, note_public, model_pdf";
$sql.= " tms, dateo, datee, date_close, fk_soc, fk_user_creat, fk_user_modif, fk_user_close, fk_statut, fk_opp_status, opp_percent, note_private, note_public, model_pdf";
$sql.= " FROM " . MAIN_DB_PREFIX . "projet";
if (! empty($id))
{
@ -428,6 +429,7 @@ class Project extends CommonObject
$this->note_public = $obj->note_public;
$this->socid = $obj->fk_soc;
$this->user_author_id = $obj->fk_user_creat;
$this->user_modification_id = $obj->fk_user_modif;
$this->user_close_id = $obj->fk_user_close;
$this->public = $obj->public;
$this->statut = $obj->fk_statut;

View File

@ -156,42 +156,32 @@ if ($permok)
}
print '<div class="tabsAction">';
//print '<div class="tabsAction">';
$morehtmlcenter='';
if (! empty($conf->agenda->enabled))
{
if (! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create))
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id).'">'.$langs->trans("AddAction").'</a>';
$morehtmlcenter.='<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id).'">'.$langs->trans("AddAction").'</a>';
}
else
{
print '<a class="butActionRefused" href="#">'.$langs->trans("AddAction").'</a>';
$morehtmlcenter.='<a class="butActionRefused" href="#">'.$langs->trans("AddAction").'</a>';
}
}
print '</div>';
//print '</div>';
if (!empty($object->id))
{
$param='&id='.$object->id;
print '<br>';
$param='&id='.$object->id;
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
print load_fiche_titre($langs->trans("ActionsOnProject"),'','');
// List of actions on element
/*include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
$formactions=new FormActions($db);
$somethingshown = $formactions->showactions($object,'project',0);*/
// List of todo actions
//show_actions_todo($conf,$langs,$db,$object,null,0,$actioncode);
// List of done actions
//show_actions_done($conf,$langs,$db,$object,null,0,$actioncode);
print_barre_liste($langs->trans("ActionsOnProject"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $morehtmlcenter, 0, -1, '', '', '', '', 0, 1, 1);
// List of all actions
$filters=array();
$filters['search_agenda_label']=$search_agenda_label;

View File

@ -366,7 +366,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third
print '</td></tr>';
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td>';
print '<input type="text" name="label" class="flat minwidth300" value="'.$label.'">';
print '<input type="text" name="label" autofocus class="flat minwidth300" value="'.$label.'">';
print '</td></tr>';
// List of projects

View File

@ -155,30 +155,32 @@ if ($socid > 0)
}
print '<div class="tabsAction">';
//print '<div class="tabsAction">';
//print '</div>';
$morehtmlcenter='';
if (! empty($conf->agenda->enabled))
{
if (! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create))
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'">'.$langs->trans("AddAction").'</a>';
$morehtmlcenter.='<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'">'.$langs->trans("AddAction").'</a>';
}
else
{
print '<a class="butActionRefused" href="#">'.$langs->trans("AddAction").'</a>';
$morehtmlcenter.='<a class="butActionRefused" href="#">'.$langs->trans("AddAction").'</a>';
}
}
print '</div>';
if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
{
print '<br>';
$param='&socid='.$socid;
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
print load_fiche_titre($langs->trans("ActionsOnCompany"),'','');
print_barre_liste($langs->trans("ActionsOnCompany"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $morehtmlcenter, 0, -1, '', '', '', '', 0, 1, 1);
// List of all actions
$filters=array();

View File

@ -2532,12 +2532,16 @@ else
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
$MAX = 5;
$MAX = 10;
$morehtmlright = '<a href="'.DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id.'">';
$morehtmlright.= $langs->trans("SeeAll");
$morehtmlright.= '</a>';
// List of actions on element
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
$formactions = new FormActions($db);
$somethingshown = $formactions->showactions($object, '', $socid, 1, '', $MAX); // Show all action for thirdparty
$somethingshown = $formactions->showactions($object, '', $socid, 1, '', $MAX, '', $morehtmlright); // Show all action for thirdparty
print '</div></div></div>';
}

View File

@ -269,7 +269,7 @@ input.select2-input {
.liste_titre input[name=monthvalid], .liste_titre input[name=search_ordermonth], .liste_titre input[name=search_deliverymonth],
.liste_titre input[name=search_smonth], .liste_titre input[name=search_month], .liste_titre input[name=search_emonth], .liste_titre input[name=smonth], .liste_titre input[name=month], .liste_titre select[name=month],
.liste_titre input[name=month_lim] {
.liste_titre input[name=month_lim], .liste_titre input[name=month_create] {
margin-right: 4px;
}
input[type=submit] {
@ -2063,7 +2063,7 @@ div.tabBar {
background: rgb(<?php echo $colorbacktabcard1; ?>);
}
div.tabBar div.titre {
padding-top: 10px;
padding-top: 20px;
}
div.tabBarWithBottom {

View File

@ -284,7 +284,7 @@ textarea.cke_source:focus
.liste_titre input[name=monthvalid], .liste_titre input[name=search_ordermonth], .liste_titre input[name=search_deliverymonth],
.liste_titre input[name=search_smonth], .liste_titre input[name=search_month], .liste_titre input[name=search_emonth], .liste_titre input[name=smonth], .liste_titre input[name=month],
.liste_titre input[name=month_lim] {
.liste_titre input[name=month_lim], .liste_titre input[name=month_create] {
margin-right: 4px;
}
input, input.flat, textarea, textarea.flat, form.flat select, select, select.flat, .dataTables_length label select {