Example #1
0
	{
		if (! empty($conf->multicompany->enabled))
		{
			if (empty($entity))
			{
				$entitystring=$langs->trans("AllEntities");
			}
			else
			{
				$mc->getInfo($entity);
				$entitystring=$mc->label;
			}
		}
	}

	$li=$userstatic->getNomUrl(-1,'',0,1);
	if (! empty($conf->multicompany->enabled) && $userstatic->admin && ! $userstatic->entity)
	{
		$li.=img_picto($langs->trans("SuperAdministrator"),'redstar');
	}
	else if ($userstatic->admin)
	{
		$li.=img_picto($langs->trans("Administrator"),'star');
	}
	$li.=' ('.$val['login'].($entitystring?' - '.$entitystring:'').')';
	
	$data[] = array(
		'rowid'=>$val['rowid'],
		'fk_menu'=>$val['fk_user'],
		'statut'=>$val['statut'],
		'entry'=>'<table class="nobordernopadding centpercent"><tr><td class="'.($val['statut']?'usertdenabled':'usertddisabled').'">'.$li.'</td><td align="right" class="'.($val['statut']?'usertdenabled':'usertddisabled').'">'.$userstatic->getLibStatut(3).'</td></tr></table>'
Example #2
0
         print '</a>';
     }
 }
 print '</td>';
 // Add third party column
 print '<td>';
 foreach ($links as $key => $val) {
     if ($links[$key]['type'] == 'company') {
         $societestatic->id = $links[$key]['url_id'];
         $societestatic->name = $links[$key]['label'];
         print $societestatic->getNomUrl(1, '', 16);
     } else {
         if ($links[$key]['type'] == 'user') {
             $userstatic->id = $links[$key]['url_id'];
             $userstatic->lastname = $links[$key]['label'];
             print $userstatic->getNomUrl(1, '');
         } else {
             if ($links[$key]['type'] == 'sc') {
                 // sc=old value
                 $chargestatic->id = $links[$key]['url_id'];
                 if (preg_match('/^\\((.*)\\)$/i', $links[$key]['label'], $reg)) {
                     if ($reg[1] == 'socialcontribution') {
                         $reg[1] = 'SocialContribution';
                     }
                     $chargestatic->lib = $langs->trans($reg[1]);
                 } else {
                     $chargestatic->lib = $links[$key]['label'];
                 }
                 $chargestatic->ref = $chargestatic->lib;
                 print $chargestatic->getNomUrl(1, 16);
             } else {
Example #3
0
 print '<th align="right">' . $langs->trans("ProgressDeclared") . '</td>';
 print '<th align="right">' . $langs->trans('TimeSpent') . '</th>';
 print '<th align="right">' . $langs->trans("ProgressCalculated") . '</td>';
 print '</tr>';
 while ($i < $num && $i < $max) {
     $obj = $db->fetch_object($resql);
     $var = !$var;
     $username = '';
     if ($obj->userid && $userstatic->id != $obj->userid) {
         $result = $userstatic->fetch($obj->userid);
         if (!$result) {
             $userstatic->id = 0;
         }
     }
     if ($userstatic->id) {
         $username = $userstatic->getNomUrl(0, 0);
     }
     print "<tr " . $bc[$var] . ">";
     //print '<td>'.$username.'</td>';
     print '<td>';
     $projectstatic->id = $obj->projectid;
     $projectstatic->ref = $obj->ref;
     $projectstatic->title = $obj->title;
     print $projectstatic->getNomUrl(1, '', 16);
     //print '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$obj->projectid.'">'.$obj->title.'</a>';
     print '</td>';
     print '<td>';
     if (!empty($obj->taskid)) {
         $tasktmp->id = $obj->taskid;
         $tasktmp->ref = $obj->label;
         print $tasktmp->getNomUrl(1, 'withproject');
Example #4
0
/* Barre d'action                                                             */
/*                                                                            */
/* ************************************************************************** */
if ($id) {
    $head = salaries_prepare_head($object);
    dol_fiche_head($head, 'card', $langs->trans("SalaryPayment"), 0, 'payment');
    print '<table class="border" width="100%">';
    print "<tr>";
    print '<td width="25%">' . $langs->trans("Ref") . '</td><td colspan="3">';
    print $object->ref;
    print '</td></tr>';
    // Person
    print '<tr><td>' . $langs->trans("Person") . '</td><td>';
    $usersal = new User($db);
    $usersal->fetch($object->fk_user);
    print $usersal->getNomUrl(1);
    print '</td></tr>';
    // Label
    print '<tr><td>' . $langs->trans("Label") . '</td><td>' . $object->label . '</td></tr>';
    print "<tr>";
    print '<td>' . $langs->trans("DateStartPeriod") . '</td><td colspan="3">';
    print dol_print_date($object->datesp, 'day');
    print '</td></tr>';
    print '<tr><td>' . $langs->trans("DateEndPeriod") . '</td><td colspan="3">';
    print dol_print_date($object->dateep, 'day');
    print '</td></tr>';
    print "<tr>";
    print '<td>' . $langs->trans("DatePayment") . '</td><td colspan="3">';
    print dol_print_date($object->datep, 'day');
    print '</td></tr>';
    print '<tr><td>' . $langs->trans("DateValue") . '</td><td colspan="3">';
Example #5
0
 print $form->select_dolusers_forevent('view', 'assignedtouser', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
 print '</div>';
 if (in_array($user->id, array_keys($listofuserid))) {
     print '<div class="myavailability">';
     print $langs->trans("MyAvailability") . ': ' . ($object->userassigned[$user->id]['transparency'] > 0 ? $langs->trans("Busy") : $langs->trans("Available"));
     // We show nothing if event is assigned to nobody
     print '</div>';
 }
 print '	</td></tr>';
 // Done by
 if ($conf->global->AGENDA_ENABLE_DONEBY) {
     print '<tr><td class="nowrap">' . $langs->trans("ActionDoneBy") . '</td><td colspan="3">';
     if ($object->userdoneid > 0) {
         $tmpuser = new User($db);
         $tmpuser->fetch($object->userdoneid);
         print $tmpuser->getNomUrl(1);
     }
     print '</td></tr>';
 }
 print '</table>';
 print '<br><br>';
 print '<table class="border" width="100%">';
 // Third party - Contact
 if ($conf->societe->enabled) {
     print '<tr><td width="30%">' . $langs->trans("ActionOnCompany") . '</td><td>' . ($object->thirdparty->id ? $object->thirdparty->getNomUrl(1) : $langs->trans("None"));
     if (is_object($object->thirdparty) && $object->thirdparty->id > 0 && $object->type_code == 'AC_TEL') {
         if ($object->thirdparty->fetch($object->thirdparty->id)) {
             print "<br>" . dol_print_phone($object->thirdparty->phone);
         }
     }
     print '</td>';
 /**
  *	Get the form to input an email
  *  this->withfile: 0=No attaches files, 1=Show attached files, 2=Can add new attached files
  *
  *	@param	string	$addfileaction		Name of action when posting file attachments
  *	@param	string	$removefileaction	Name of action when removing file attachments
  *	@return string						Form to show
  */
 function get_form($addfileaction = 'addfile', $removefileaction = 'removefile')
 {
     global $conf, $langs, $user, $hookmanager, $form;
     if (!is_object($form)) {
         $form = new Form($this->db);
     }
     $langs->load("other");
     $langs->load("mails");
     $hookmanager->initHooks(array('formmail'));
     $parameters = array('addfileaction' => $addfileaction, 'removefileaction' => $removefileaction);
     $reshook = $hookmanager->executeHooks('getFormMail', $parameters, $this);
     if (!empty($reshook)) {
         return $hookmanager->resPrint;
     } else {
         $out = '';
         // Define list of attached files
         $listofpaths = array();
         $listofnames = array();
         $listofmimes = array();
         if (!empty($_SESSION["listofpaths"])) {
             $listofpaths = explode(';', $_SESSION["listofpaths"]);
         }
         if (!empty($_SESSION["listofnames"])) {
             $listofnames = explode(';', $_SESSION["listofnames"]);
         }
         if (!empty($_SESSION["listofmimes"])) {
             $listofmimes = explode(';', $_SESSION["listofmimes"]);
         }
         $out .= "\n<!-- Debut form mail -->\n";
         if ($this->withform == 1) {
             $out .= '<form method="POST" name="mailform" enctype="multipart/form-data" action="' . $this->param["returnurl"] . '">' . "\n";
             $out .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '" />';
         }
         foreach ($this->param as $key => $value) {
             $out .= '<input type="hidden" id="' . $key . '" name="' . $key . '" value="' . $value . '" />' . "\n";
         }
         $out .= '<table class="border" width="100%">' . "\n";
         // Substitution array
         if (!empty($this->withsubstit)) {
             $out .= '<tr><td colspan="2">';
             $help = "";
             foreach ($this->substit as $key => $val) {
                 $help .= $key . ' -> ' . $langs->trans($val) . '<br>';
             }
             $out .= $form->textwithpicto($langs->trans("EMailTestSubstitutionReplacedByGenericValues"), $help);
             $out .= "</td></tr>\n";
         }
         // From
         if (!empty($this->withfrom)) {
             if (!empty($this->withfromreadonly)) {
                 $out .= '<input type="hidden" id="fromname" name="fromname" value="' . $this->fromname . '" />';
                 $out .= '<input type="hidden" id="frommail" name="frommail" value="' . $this->frommail . '" />';
                 $out .= '<tr><td width="180">' . $langs->trans("MailFrom") . '</td><td>';
                 if ($this->fromtype == 'user' && $this->fromid > 0) {
                     $langs->load("users");
                     $fuser = new User($this->db);
                     $fuser->fetch($this->fromid);
                     $out .= $fuser->getNomUrl(1);
                 } else {
                     $out .= $this->fromname;
                 }
                 if ($this->frommail) {
                     $out .= " &lt;" . $this->frommail . "&gt;";
                 } else {
                     if ($this->fromtype) {
                         $langs->load("errors");
                         $out .= '<font class="warning"> &lt;' . $langs->trans("ErrorNoMailDefinedForThisUser") . '&gt; </font>';
                     }
                 }
                 $out .= "</td></tr>\n";
                 $out .= "</td></tr>\n";
             } else {
                 $out .= "<tr><td>" . $langs->trans("MailFrom") . "</td><td>";
                 $out .= $langs->trans("Name") . ':<input type="text" id="fromname" name="fromname" size="32" value="' . $this->fromname . '" />';
                 $out .= '&nbsp; &nbsp; ';
                 $out .= $langs->trans("EMail") . ':&lt;<input type="text" id="frommail" name="frommail" size="32" value="' . $this->frommail . '" />&gt;';
                 $out .= "</td></tr>\n";
             }
         }
         // Replyto
         if (!empty($this->withreplyto)) {
             if ($this->withreplytoreadonly) {
                 $out .= '<input type="hidden" id="replyname" name="replyname" value="' . $this->replytoname . '" />';
                 $out .= '<input type="hidden" id="replymail" name="replymail" value="' . $this->replytomail . '" />';
                 $out .= "<tr><td>" . $langs->trans("MailReply") . "</td><td>" . $this->replytoname . ($this->replytomail ? " &lt;" . $this->replytomail . "&gt;" : "");
                 $out .= "</td></tr>\n";
             }
         }
         // Errorsto
         if (!empty($this->witherrorsto)) {
             //if (! $this->errorstomail) $this->errorstomail=$this->frommail;
             $errorstomail = !empty($conf->global->MAIN_MAIL_ERRORS_TO) ? $conf->global->MAIN_MAIL_ERRORS_TO : $this->errorstomail;
             if ($this->witherrorstoreadonly) {
                 $out .= '<input type="hidden" id="errorstomail" name="errorstomail" value="' . $errorstomail . '" />';
                 $out .= '<tr><td>' . $langs->trans("MailErrorsTo") . '</td><td>';
                 $out .= $errorstomail;
                 $out .= "</td></tr>\n";
             } else {
                 $out .= '<tr><td>' . $langs->trans("MailErrorsTo") . '</td><td>';
                 $out .= '<input size="30" id="errorstomail" name="errorstomail" value="' . $errorstomail . '" />';
                 $out .= "</td></tr>\n";
             }
         }
         // To
         if (!empty($this->withto) || is_array($this->withto)) {
             $out .= '<tr><td width="180">';
             if ($this->withtofree) {
                 $out .= $form->textwithpicto($langs->trans("MailTo"), $langs->trans("YouCanUseCommaSeparatorForSeveralRecipients"));
             } else {
                 $out .= $langs->trans("MailTo");
             }
             $out .= '</td><td>';
             if ($this->withtoreadonly) {
                 if (!empty($this->toname) && !empty($this->tomail)) {
                     $out .= '<input type="hidden" id="toname" name="toname" value="' . $this->toname . '" />';
                     $out .= '<input type="hidden" id="tomail" name="tomail" value="' . $this->tomail . '" />';
                     if ($this->totype == 'thirdparty') {
                         $soc = new Societe($this->db);
                         $soc->fetch($this->toid);
                         $out .= $soc->getNomUrl(1);
                     } else {
                         if ($this->totype == 'contact') {
                             $contact = new Contact($this->db);
                             $contact->fetch($this->toid);
                             $out .= $contact->getNomUrl(1);
                         } else {
                             $out .= $this->toname;
                         }
                     }
                     $out .= ' &lt;' . $this->tomail . '&gt;';
                     if ($this->withtofree) {
                         $out .= '<br>' . $langs->trans("or") . ' <input size="' . (is_array($this->withto) ? "30" : "60") . '" id="sendto" name="sendto" value="' . (!is_array($this->withto) && !is_numeric($this->withto) ? isset($_REQUEST["sendto"]) ? $_REQUEST["sendto"] : $this->withto : "") . '" />';
                     }
                 } else {
                     $out .= !is_array($this->withto) && !is_numeric($this->withto) ? $this->withto : "";
                 }
             } else {
                 if (!empty($this->withtofree)) {
                     $out .= '<input size="' . (is_array($this->withto) ? "30" : "60") . '" id="sendto" name="sendto" value="' . (!is_array($this->withto) && !is_numeric($this->withto) ? isset($_REQUEST["sendto"]) ? $_REQUEST["sendto"] : $this->withto : "") . '" />';
                 }
                 if (!empty($this->withto) && is_array($this->withto)) {
                     if (!empty($this->withtofree)) {
                         $out .= " " . $langs->trans("or") . " ";
                     }
                     $out .= $form->selectarray("receiver", $this->withto, GETPOST("receiver"), 1);
                 }
                 if (isset($this->withtosocid) && $this->withtosocid > 0) {
                     $liste = array();
                     $soc = new Societe($this->db);
                     $soc->fetch($this->withtosocid);
                     foreach ($soc->thirdparty_and_contact_email_array(1) as $key => $value) {
                         $liste[$key] = $value;
                     }
                     if ($this->withtofree) {
                         $out .= " " . $langs->trans("or") . " ";
                     }
                     $out .= $form->selectarray("receiver", $liste, GETPOST("receiver"), 1);
                 }
             }
             $out .= "</td></tr>\n";
         }
         // CC
         if (!empty($this->withtocc) || is_array($this->withtocc)) {
             $out .= '<tr><td width="180">';
             $out .= $form->textwithpicto($langs->trans("MailCC"), $langs->trans("YouCanUseCommaSeparatorForSeveralRecipients"));
             $out .= '</td><td>';
             if ($this->withtoccreadonly) {
                 $out .= !is_array($this->withtocc) && !is_numeric($this->withtocc) ? $this->withtocc : "";
             } else {
                 $out .= '<input size="' . (is_array($this->withtocc) ? "30" : "60") . '" id="sendtocc" name="sendtocc" value="' . (!is_array($this->withtocc) && !is_numeric($this->withtocc) ? isset($_POST["sendtocc"]) ? $_POST["sendtocc"] : $this->withtocc : (isset($_POST["sendtocc"]) ? $_POST["sendtocc"] : "")) . '" />';
                 if (!empty($this->withtocc) && is_array($this->withtocc)) {
                     $out .= " " . $langs->trans("or") . " ";
                     $out .= $form->selectarray("receivercc", $this->withtocc, GETPOST("receivercc"), 1);
                 }
             }
             $out .= "</td></tr>\n";
         }
         // CCC
         if (!empty($this->withtoccc) || is_array($this->withtoccc)) {
             $out .= '<tr><td width="180">';
             $out .= $form->textwithpicto($langs->trans("MailCCC"), $langs->trans("YouCanUseCommaSeparatorForSeveralRecipients"));
             $out .= '</td><td>';
             if (!empty($this->withtocccreadonly)) {
                 $out .= !is_array($this->withtoccc) && !is_numeric($this->withtoccc) ? $this->withtoccc : "";
             } else {
                 $out .= '<input size="' . (is_array($this->withtoccc) ? "30" : "60") . '" id="sendtoccc" name="sendtoccc" value="' . (!is_array($this->withtoccc) && !is_numeric($this->withtoccc) ? isset($_POST["sendtoccc"]) ? $_POST["sendtoccc"] : $this->withtoccc : (isset($_POST["sendtoccc"]) ? $_POST["sendtoccc"] : "")) . '" />';
                 if (!empty($this->withtoccc) && is_array($this->withtoccc)) {
                     $out .= " " . $langs->trans("or") . " ";
                     $out .= $form->selectarray("receiverccc", $this->withtoccc, GETPOST("receiverccc"), 1);
                 }
             }
             //if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)) print ' '.info_admin("+ ".$conf->global->MAIN_MAIL_AUTOCOPY_TO,1);
             $out .= "</td></tr>\n";
         }
         // Ask delivery receipt
         if (!empty($this->withdeliveryreceipt)) {
             $out .= '<tr><td width="180">' . $langs->trans("DeliveryReceipt") . '</td><td>';
             if (!empty($this->withdeliveryreceiptreadonly)) {
                 $out .= yn($this->withdeliveryreceipt);
             } else {
                 $out .= $form->selectyesno('deliveryreceipt', isset($_POST["deliveryreceipt"]) ? $_POST["deliveryreceipt"] : 0, 1);
             }
             $out .= "</td></tr>\n";
         }
         // Topic
         if (!empty($this->withtopic)) {
             $this->withtopic = make_substitutions($this->withtopic, $this->substit);
             $out .= '<tr>';
             $out .= '<td width="180">' . $langs->trans("MailTopic") . '</td>';
             $out .= '<td>';
             if ($this->withtopicreadonly) {
                 $out .= $this->withtopic;
                 $out .= '<input type="hidden" size="60" id="subject" name="subject" value="' . $this->withtopic . '" />';
             } else {
                 $out .= '<input type="text" size="60" id="subject" name="subject" value="' . (isset($_POST["subject"]) ? $_POST["subject"] : (is_numeric($this->withtopic) ? '' : $this->withtopic)) . '" />';
             }
             $out .= "</td></tr>\n";
         }
         // Attached files
         if (!empty($this->withfile)) {
             $out .= '<tr>';
             $out .= '<td width="180">' . $langs->trans("MailFile") . '</td>';
             $out .= '<td>';
             if (is_numeric($this->withfile)) {
                 // TODO Trick to have param removedfile containing nb of image to delete. But this does not works without javascript
                 $out .= '<input type="hidden" class="removedfilehidden" name="removedfile" value="">' . "\n";
                 $out .= '<script type="text/javascript" language="javascript">';
                 $out .= 'jQuery(document).ready(function () {';
                 $out .= '    jQuery(".removedfile").click(function() {';
                 $out .= '        jQuery(".removedfilehidden").val(jQuery(this).val());';
                 $out .= '    });';
                 $out .= '})';
                 $out .= '</script>' . "\n";
                 if (count($listofpaths)) {
                     foreach ($listofpaths as $key => $val) {
                         $out .= '<div id="attachfile_' . $key . '">';
                         $out .= img_mime($listofnames[$key]) . ' ' . $listofnames[$key];
                         if (!$this->withfilereadonly) {
                             $out .= ' <input type="image" style="border: 0px;" src="' . DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/delete.png" value="' . ($key + 1) . '" class="removedfile" id="removedfile_' . $key . '" name="removedfile_' . $key . '" />';
                             //$out.= ' <a href="'.$_SERVER["PHP_SELF"].'?removedfile='.($key+1).' id="removedfile_'.$key.'">'.img_delete($langs->trans("Delete").'</a>';
                         }
                         $out .= '<br></div>';
                     }
                 } else {
                     $out .= $langs->trans("NoAttachedFiles") . '<br>';
                 }
                 if ($this->withfile == 2) {
                     $out .= '<input type="file" class="flat" id="addedfile" name="addedfile" value="' . $langs->trans("Upload") . '" />';
                     $out .= ' ';
                     $out .= '<input type="submit" class="button" id="' . $addfileaction . '" name="' . $addfileaction . '" value="' . $langs->trans("MailingAddFile") . '" />';
                 }
             } else {
                 $out .= $this->withfile;
             }
             $out .= "</td></tr>\n";
         }
         // Message
         if (!empty($this->withbody)) {
             $defaultmessage = "";
             // TODO    A partir du type, proposer liste de messages dans table llx_c_email_template
             if ($this->param["models"] == 'facture_send') {
                 $defaultmessage = $langs->transnoentities("PredefinedMailContentSendInvoice");
             } elseif ($this->param["models"] == 'facture_relance') {
                 $defaultmessage = $langs->transnoentities("PredefinedMailContentSendInvoiceReminder");
             } elseif ($this->param["models"] == 'propal_send') {
                 $defaultmessage = $langs->transnoentities("PredefinedMailContentSendProposal");
             } elseif ($this->param["models"] == 'order_send') {
                 $defaultmessage = $langs->transnoentities("PredefinedMailContentSendOrder");
             } elseif ($this->param["models"] == 'order_supplier_send') {
                 $defaultmessage = $langs->transnoentities("PredefinedMailContentSendSupplierOrder");
             } elseif ($this->param["models"] == 'invoice_supplier_send') {
                 $defaultmessage = $langs->transnoentities("PredefinedMailContentSendSupplierInvoice");
             } elseif ($this->param["models"] == 'shipping_send') {
                 $defaultmessage = $langs->transnoentities("PredefinedMailContentSendShipping");
             } elseif ($this->param["models"] == 'fichinter_send') {
                 $defaultmessage = $langs->transnoentities("PredefinedMailContentSendFichInter");
             } elseif ($this->param["models"] == 'thirdparty') {
                 $defaultmessage = $langs->transnoentities("PredefinedMailContentThirdparty");
             } elseif (!is_numeric($this->withbody)) {
                 $defaultmessage = $this->withbody;
             }
             // Complete substitution array
             if (!empty($conf->paypal->enabled) && !empty($conf->global->PAYPAL_ADD_PAYMENT_URL)) {
                 require_once DOL_DOCUMENT_ROOT . '/paypal/lib/paypal.lib.php';
                 $langs->load('paypal');
                 if ($this->param["models"] == 'order_send') {
                     $url = getPaypalPaymentUrl(0, 'order', $this->substit['__ORDERREF__']);
                     $this->substit['__PERSONALIZED__'] = str_replace('\\n', "\n", $langs->transnoentitiesnoconv("PredefinedMailContentLink", $url));
                 }
                 if ($this->param["models"] == 'facture_send') {
                     $url = getPaypalPaymentUrl(0, 'invoice', $this->substit['__FACREF__']);
                     $this->substit['__PERSONALIZED__'] = str_replace('\\n', "\n", $langs->transnoentitiesnoconv("PredefinedMailContentLink", $url));
                 }
             }
             $defaultmessage = str_replace('\\n', "\n", $defaultmessage);
             // Deal with format differences between message and signature (text / HTML)
             if (dol_textishtml($defaultmessage) && !dol_textishtml($this->substit['__SIGNATURE__'])) {
                 $this->substit['__SIGNATURE__'] = dol_nl2br($this->substit['__SIGNATURE__']);
             } else {
                 if (!dol_textishtml($defaultmessage) && dol_textishtml($this->substit['__SIGNATURE__'])) {
                     $defaultmessage = dol_nl2br($defaultmessage);
                 }
             }
             if (isset($_POST["message"])) {
                 $defaultmessage = $_POST["message"];
             } else {
                 $defaultmessage = make_substitutions($defaultmessage, $this->substit);
                 // Clean first \n and br (to avoid empty line when CONTACTCIVNAME is empty)
                 $defaultmessage = preg_replace("/^(<br>)+/", "", $defaultmessage);
                 $defaultmessage = preg_replace("/^\n+/", "", $defaultmessage);
             }
             $out .= '<tr>';
             $out .= '<td width="180" valign="top">' . $langs->trans("MailText") . '</td>';
             $out .= '<td>';
             if ($this->withbodyreadonly) {
                 $out .= nl2br($defaultmessage);
                 $out .= '<input type="hidden" id="message" name="message" value="' . $defaultmessage . '" />';
             } else {
                 if (!isset($this->ckeditortoolbar)) {
                     $this->ckeditortoolbar = 'dolibarr_notes';
                 }
                 // Editor wysiwyg
                 require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
                 if ($this->withfckeditor == -1) {
                     if (!empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
                         $this->withfckeditor = 1;
                     } else {
                         $this->withfckeditor = 0;
                     }
                 }
                 $doleditor = new DolEditor('message', $defaultmessage, '', 280, $this->ckeditortoolbar, 'In', true, true, $this->withfckeditor, 8, 72);
                 $out .= $doleditor->Create(1);
             }
             $out .= "</td></tr>\n";
         }
         if ($this->withform == 1 || $this->withform == -1) {
             $out .= '<tr><td align="center" colspan="2"><center>';
             $out .= '<input class="button" type="submit" id="sendmail" name="sendmail" value="' . $langs->trans("SendMail") . '"';
             // Add a javascript test to avoid to forget to submit file before sending email
             if ($this->withfile == 2 && $conf->use_javascript_ajax) {
                 $out .= ' onClick="if (document.mailform.addedfile.value != \'\') { alert(\'' . dol_escape_js($langs->trans("FileWasNotUploaded")) . '\'); return false; } else { return true; }"';
             }
             $out .= ' />';
             if ($this->withcancel) {
                 $out .= ' &nbsp; &nbsp; ';
                 $out .= '<input class="button" type="submit" id="cancel" name="cancel" value="' . $langs->trans("Cancel") . '" />';
             }
             $out .= '</center></td></tr>' . "\n";
         }
         $out .= '</table>' . "\n";
         if ($this->withform == 1) {
             $out .= '</form>' . "\n";
         }
         $out .= "<!-- Fin form mail -->\n";
         return $out;
     }
 }
Example #7
0
		{
			$total_ttc = $totalam = $total = 0;

			$deplacementstatic=new Deplacement($db);
			$userstatic=new User($db);
			while ($i < $num && $i < $max)
			{
				$objp = $db->fetch_object($result);
				$deplacementstatic->ref=$objp->rowid;
				$deplacementstatic->id=$objp->rowid;
				$userstatic->id=$objp->uid;
				$userstatic->nom=$objp->name;
				$userstatic->prenom=$objp->firstname;
				print '<tr '.$bc[$var].'>';
                print '<td>'.$deplacementstatic->getNomUrl(1).'</td>';
				print '<td>'.$userstatic->getNomUrl(1).'</td>';
                print '<td align="right">'.$objp->km.'</td>';
				print '<td align="right">'.dol_print_date($db->jdate($objp->dm),'day').'</td>';
                print '<td>'.$deplacementstatic->LibStatut($objp->fk_statut,3).'</td>';
				print '</tr>';
				$var=!$var;
				$i++;
			}

		}
		else
		{
			print '<tr '.$bc[$var].'><td colspan="2">'.$langs->trans("None").'</td></tr>';
		}
		print '</table><br>';
	}
Example #8
0
print img_picto('','object_dir').' <a href="'.DOL_URL_ROOT.'/ecm/index.php">'.$langs->trans("ECMRoot").'</a> -> ';
print $s;
print '</td></tr>';
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>';
if ($_GET["action"] == 'edit')
{
	print '<textarea class="flat" name="description" cols="80">';
	print $ecmdir->description;
	print '</textarea>';
}
else print dol_nl2br($ecmdir->description);
print '</td></tr>';
print '<tr><td>'.$langs->trans("ECMCreationUser").'</td><td>';
$userecm=new User($db);
$userecm->fetch($ecmdir->fk_user_c);
print $userecm->getNomUrl(1);
print '</td></tr>';
print '<tr><td>'.$langs->trans("ECMCreationDate").'</td><td>';
print dol_print_date($ecmdir->date_c,'dayhour');
print '</td></tr>';
print '<tr><td>'.$langs->trans("ECMDirectoryForFiles").'</td><td>';
print '/ecm/'.$relativepath;
print '</td></tr>';
print '<tr><td>'.$langs->trans("ECMNbOfDocs").'</td><td>';
print sizeof($filearray);
print '</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td>';
print dol_print_size($totalsize);
print '</td></tr>';
if ($_GET["action"] == 'edit')
{
 }
 print '</tbody>';
 print '</table>' . "\n";
 print '<br><br>';
 // Info workflow
 print '<table class="border" width="50%">' . "\n";
 print '<tbody>';
 print '<tr class="liste_titre">';
 print '<td colspan="2">' . $langs->trans("InfosWorkflowCP") . '</td>';
 print '</tr>';
 if (!empty($cp->fk_user_create)) {
     $userCreate = new User($db);
     $userCreate->fetch($cp->fk_user_create);
     print '<tr>';
     print '<td>' . $langs->trans('RequestByCP') . '</td>';
     print '<td>' . $userCreate->getNomUrl(1) . '</td>';
     print '</tr>';
 }
 if (!$edit) {
     print '<tr>';
     print '<td width="50%">' . $langs->trans('ReviewedByCP') . '</td>';
     print '<td>' . $valideur->getNomUrl(1) . '</td>';
     print '</tr>';
 } else {
     print '<tr>';
     print '<td width="50%">' . $langs->trans('ReviewedByCP') . '</td>';
     // Liste des utiliseurs du groupes choisi dans la config
     $idGroupValid = $cp->getConfCP('userGroup');
     $validator = new UserGroup($db, $idGroupValid);
     $valideur = $validator->listUsersForGroup('', 1);
     print '<td>';
 /**
  * fetch_line_by_project
  *
  * @param   int     $projectid      Project id
  * @param   User    $user           User
  * @return  int                     <0 if KO, >0 if OK
  */
 function fetch_line_by_project($projectid, $user = '')
 {
     global $conf, $db, $langs;
     $langs->load('trips');
     if ($user->rights->expensereport->lire) {
         $sql = "SELECT de.fk_expensereport, de.date, de.comments, de.total_ht, de.total_ttc";
         $sql .= " FROM " . MAIN_DB_PREFIX . "expensereport_det as de";
         $sql .= " WHERE de.fk_projet = " . $projectid;
         dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG);
         $result = $db->query($sql);
         if ($result) {
             $num = $db->num_rows($result);
             $i = 0;
             $total_HT = 0;
             $total_TTC = 0;
             while ($i < $num) {
                 $objp = $db->fetch_object($result);
                 $sql2 = "SELECT d.rowid, d.fk_user_author, d.ref, d.fk_statut";
                 $sql2 .= " FROM " . MAIN_DB_PREFIX . "expensereport as d";
                 $sql2 .= " WHERE d.rowid = '" . $objp->fk_expensereport . "'";
                 $result2 = $db->query($sql2);
                 $obj = $db->fetch_object($result2);
                 $objp->fk_user_author = $obj->fk_user_author;
                 $objp->ref = $obj->ref;
                 $objp->fk_c_expensereport_status = $obj->fk_statut;
                 $objp->rowid = $obj->rowid;
                 $total_HT = $total_HT + $objp->total_ht;
                 $total_TTC = $total_TTC + $objp->total_ttc;
                 $author = new User($db);
                 $author->fetch($objp->fk_user_author);
                 print '<tr>';
                 print '<td><a href="' . DOL_URL_ROOT . '/expensereport/card.php?id=' . $objp->rowid . '">' . $objp->ref_num . '</a></td>';
                 print '<td align="center">' . dol_print_date($objp->date, 'day') . '</td>';
                 print '<td>' . $author->getNomUrl() . '</td>';
                 print '<td>' . $objp->comments . '</td>';
                 print '<td align="right">' . price($objp->total_ht) . '</td>';
                 print '<td align="right">' . price($objp->total_ttc) . '</td>';
                 print '<td align="right">';
                 switch ($objp->fk_c_expensereport_status) {
                     case 4:
                         print img_picto($langs->trans('StatusOrderCanceled'), 'statut5');
                         break;
                     case 1:
                         print $langs->trans('Draft') . ' ' . img_picto($langs->trans('Draft'), 'statut0');
                         break;
                     case 2:
                         print $langs->trans('TripForValid') . ' ' . img_picto($langs->trans('TripForValid'), 'statut3');
                         break;
                     case 5:
                         print $langs->trans('TripForPaid') . ' ' . img_picto($langs->trans('TripForPaid'), 'statut3');
                         break;
                     case 6:
                         print $langs->trans('TripPaid') . ' ' . img_picto($langs->trans('TripPaid'), 'statut4');
                         break;
                 }
                 /*
                  if ($status==4) return img_picto($langs->trans('StatusOrderCanceled'),'statut5');
                 if ($status==1) return img_picto($langs->trans('StatusOrderDraft'),'statut0');
                 if ($status==2) return img_picto($langs->trans('StatusOrderValidated'),'statut1');
                 if ($status==2) return img_picto($langs->trans('StatusOrderOnProcess'),'statut3');
                 if ($status==5) return img_picto($langs->trans('StatusOrderToBill'),'statut4');
                 if ($status==6) return img_picto($langs->trans('StatusOrderOnProcess'),'statut6');
                 */
                 print '</td>';
                 print '</tr>';
                 $i++;
             }
             print '<tr class="liste_total"><td colspan="4">' . $langs->trans("Number") . ': ' . $i . '</td>';
             print '<td align="right" width="100">' . $langs->trans("TotalHT") . ' : ' . price($total_HT) . '</td>';
             print '<td align="right" width="100">' . $langs->trans("TotalTTC") . ' : ' . price($total_TTC) . '</td>';
             print '<td>&nbsp;</td>';
             print '</tr>';
         } else {
             $this->error = $db->error();
             return -1;
         }
     }
 }
Example #11
0
print '<td class="liste_titre">' . $langs->trans('Type') . '</td>';
print '<td class="liste_titre" align="right">' . $langs->trans('PrevSoldeCP') . '</td>';
print '<td class="liste_titre" align="right">' . $langs->trans('NewSoldeCP') . '</td>';
print '</tr>';
$var = true;
foreach ($cp->logs as $logs_CP) {
    $var = !$var;
    $user_action = new User($db);
    $user_action->fetch($logs_CP['fk_user_action']);
    $user_update = new User($db);
    $user_update->fetch($logs_CP['fk_user_update']);
    print '<tr ' . $bc[$var] . '>';
    print '<td>' . $logs_CP['rowid'] . '</td>';
    print '<td style="text-align: center;">' . $logs_CP['date_action'] . '</td>';
    print '<td>' . $user_action->getNomUrl(1) . '</td>';
    print '<td>' . $user_update->getNomUrl(1) . '</td>';
    print '<td>' . $logs_CP['type_action'] . '</td>';
    print '<td>' . $logs_CP['fk_type'] . '</td>';
    print '<td style="text-align: right;">' . price2num($logs_CP['prev_solde'], 5) . ' ' . $langs->trans('days') . '</td>';
    print '<td style="text-align: right;">' . price2num($logs_CP['new_solde'], 5) . ' ' . $langs->trans('days') . '</td>';
    print '</tr>' . "\n";
}
if ($log_holiday == '2') {
    print '<tr>';
    print '<td colspan="8" ' . $bc[false] . '>' . $langs->trans('None') . '</td>';
    print '</tr>';
}
print '</tbody>' . "\n";
print '</table>' . "\n";
llxFooter();
$db->close();
Example #12
0
 } else {
     if ($links[$key]['type'] == 'payment_supplier') {
         $paymentsupplierstatic->id = $links[$key]['url_id'];
         $paymentsupplierstatic->ref = $links[$key]['url_id'];
         $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsupplierstatic->getNomUrl(2);
     } else {
         if ($links[$key]['type'] == 'company') {
             $societestatic->id = $links[$key]['url_id'];
             $societestatic->name = $links[$key]['label'];
             $tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30);
             $tabtp[$obj->rowid][$compta_soc] += $obj->amount;
         } else {
             if ($links[$key]['type'] == 'user') {
                 $userstatic->id = $links[$key]['url_id'];
                 $userstatic->name = $links[$key]['label'];
                 $tabpay[$obj->rowid]["soclib"] = $userstatic->getNomUrl(1, '', 30);
                 // $tabtp[$obj->rowid][$compta_user] += $obj->amount;
             } else {
                 if ($links[$key]['type'] == 'sc') {
                     $chargestatic->id = $links[$key]['url_id'];
                     $chargestatic->ref = $links[$key]['url_id'];
                     $tabpay[$obj->rowid]["lib"] .= ' ' . $chargestatic->getNomUrl(2);
                     if (preg_match('/^\\((.*)\\)$/i', $links[$key]['label'], $reg)) {
                         if ($reg[1] == 'socialcontribution') {
                             $reg[1] = 'SocialContribution';
                         }
                         $chargestatic->lib = $langs->trans($reg[1]);
                     } else {
                         $chargestatic->lib = $links[$key]['label'];
                     }
                     $chargestatic->ref = $chargestatic->lib;
Example #13
0
     if ($bookmark->target == 0) {
         print $langs->trans("ReplaceWindow");
     }
     if ($bookmark->target == 1) {
         print $langs->trans("OpenANewWindow");
     }
 }
 print '</td></tr>';
 print '<tr><td>' . $langs->trans("Owner") . '</td><td>';
 if ($action == 'edit' && $user->admin) {
     print $form->select_dolusers(isset($_POST['userid']) ? $_POST['userid'] : ($bookmark->fk_user ? $bookmark->fk_user : ''), 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
 } else {
     if ($bookmark->fk_user) {
         $fuser = new User($db);
         $fuser->fetch($bookmark->fk_user);
         print $fuser->getNomUrl(1);
     } else {
         print $langs->trans("Public");
     }
 }
 print '</td></tr>';
 // Position
 print '<tr><td>' . $langs->trans("Position") . '</td><td>';
 if ($action == 'edit') {
     print '<input class="flat" name="position" size="5" value="' . (isset($_POST["position"]) ? $_POST["position"] : $bookmark->position) . '">';
 } else {
     print $bookmark->position;
 }
 print '</td></tr>';
 // Date creation
 print '<tr><td>' . $langs->trans("DateCreation") . '</td><td>' . dol_print_date($bookmark->datec, 'dayhour') . '</td></tr>';
Example #14
0
                print '</td></tr>';
            }

            // Hierarchy
            print '<tr><td>'.$langs->trans("HierarchicalResponsible").'</td>';
            print '<td>';
            if ($caneditfield)
            {
            	print $form->select_dolusers($object->fk_user, 'fk_user', 1, array($object->id), 0, '', 0, $object->entity, 0, 0, '', 0, '', 'maxwidth300');
            }
            else
          {
          		print '<input type="hidden" name="fk_user" value="'.$object->fk_user.'">';
            	$huser=new User($db);
            	$huser->fetch($object->fk_user);
            	print $huser->getNomUrl(1);
            }
            print '</td>';
            print "</tr>\n";

            if (! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read))
            {
            	$langs->load("salaries");

            	// THM
			    print '<tr><td>';
			    $text=$langs->trans("THM");
			    print $form->textwithpicto($text, $langs->trans("THMDescription"), 1, 'help', 'classthm');
			    print '</td>';
			    print '<td>';
			    print '<input size="8" type="text" name="thm" value="'.price2num(GETPOST('thm')?GETPOST('thm'):$object->thm).'">';
Example #15
0
		print '<td>'.$langs->trans("PriceLevel").'</td>';
		print '<td align="right">'.$langs->trans("User").'</td>';
		print '</tr>';
		$i = 0 ;
		$num = $db->num_rows($resql);

		while ($i < $num )
		{
			$obj = $db->fetch_object($resql);
			$tag = !$tag;
			print '<tr '.$bc[$tag].'>';
			print '<td>'.dol_print_date($db->jdate($obj->dc),"dayhour").'</td>';
			print '<td>'.$obj->price_level.' </td>';
			$userstatic->id=$obj->uid;
			$userstatic->nom=$obj->login;
			print '<td align="right">'.$userstatic->getNomUrl(1).'</td>';
			print '</tr>';
			$i++;
		}
		$db->free($resql);
		print "</table>";
	}
	else
	{
		dol_print_error($db);
	}

}

$db->close();
 /**
  *  Show list of actions for element
  *
  *  @param	Object	$object			Object
  *  @param  string	$typeelement	'invoice','propal','order','invoice_supplier','order_supplier','fichinter'
  *	@param	int		$socid			socid of user
  *  @param	int		$forceshowtitle	Show title even if there is no actions to show
  *	@return	int						<0 if KO, >=0 if OK
  */
 function showactions($object, $typeelement, $socid = 0, $forceshowtitle = 0)
 {
     global $langs, $conf, $user;
     global $bc;
     require_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php';
     $listofactions = ActionComm::getActions($this->db, $socid, $object->id, $typeelement);
     if (!is_array($listofactions)) {
         dol_print_error($this->db, 'FailedToGetActions');
     }
     $num = count($listofactions);
     if ($num || $forceshowtitle) {
         if ($typeelement == 'invoice') {
             $title = $langs->trans('ActionsOnBill');
         } elseif ($typeelement == 'invoice_supplier' || $typeelement == 'supplier_invoice') {
             $title = $langs->trans('ActionsOnBill');
         } elseif ($typeelement == 'propal') {
             $title = $langs->trans('ActionsOnPropal');
         } elseif ($typeelement == 'order') {
             $title = $langs->trans('ActionsOnOrder');
         } elseif ($typeelement == 'order_supplier' || $typeelement == 'supplier_order') {
             $title = $langs->trans('ActionsOnOrder');
         } elseif ($typeelement == 'project') {
             $title = $langs->trans('ActionsOnProject');
         } elseif ($typeelement == 'shipping') {
             $title = $langs->trans('ActionsOnShipping');
         } elseif ($typeelement == 'fichinter') {
             $title = $langs->trans('ActionsOnFicheInter');
         } else {
             $title = $langs->trans("Actions");
         }
         print_titre($title);
         $total = 0;
         $var = true;
         print '<table class="noborder" width="100%">';
         print '<tr class="liste_titre">';
         print '<th class="liste_titre">' . $langs->trans('Ref') . '</th>';
         print '<th class="liste_titre">' . $langs->trans('Action') . '</th>';
         print '<th class="liste_titre">' . $langs->trans('Date') . '</th>';
         print '<th class="liste_titre">' . $langs->trans('By') . '</th>';
         print '</tr>';
         print "\n";
         $userstatic = new User($this->db);
         foreach ($listofactions as $action) {
             $savlabel = $action->label;
             $action->label = $action->ref;
             $ref = $action->getNomUrl(1);
             $action->label = $savlabel;
             $label = $action->getNomUrl(0, 38);
             $var = !$var;
             print '<tr ' . $bc[$var] . '>';
             print '<td>' . $ref . '</td>';
             print '<td>' . $label . '</td>';
             print '<td>' . dol_print_date($action->datep, 'day') . '</td>';
             print '<td>';
             if (!empty($action->author->id)) {
                 $userstatic->id = $action->author->id;
                 $userstatic->firstname = $action->author->firstname;
                 $userstatic->lastname = $action->author->lastname;
                 print $userstatic->getNomUrl(1);
             }
             print '</td>';
             print '</tr>';
         }
         print '</table>';
     }
     return $num;
 }
Example #17
0
     $socstatic->fetch($obj->socid);
     $listsalesrepresentatives = $socstatic->getSalesRepresentatives($user);
     $nbofsalesrepresentative = count($listsalesrepresentatives);
     if ($nbofsalesrepresentative > 3) {
         print '<a href="' . DOL_URL_ROOT . '/societe/commerciaux.php?socid=' . $socstatic->id . '">';
         print $nbofsalesrepresentative;
         print '</a>';
     } else {
         if ($nbofsalesrepresentative > 0) {
             $userstatic = new User($db);
             $j = 0;
             foreach ($listsalesrepresentatives as $val) {
                 $userstatic->id = $val['id'];
                 $userstatic->lastname = $val['lastname'];
                 $userstatic->firstname = $val['firstname'];
                 print '<div class="float">' . $userstatic->getNomUrl(1);
                 $j++;
                 if ($j < $nbofsalesrepresentative) {
                     print ', ';
                 }
                 print '</div>';
             }
         } else {
             print $langs->trans("NoSalesRepresentativeAffected");
         }
     }
 } else {
     print '&nbsp';
 }
 print '</td>';
 print '<td align="center">' . dol_print_date($db->jdate($obj->date_contrat)) . '</td>';
Example #18
0
 if (empty($obj->source_id) || empty($obj->source_type)) {
     print $obj->source_url;
     // For backward compatibility
 } else {
     if ($obj->source_type == 'member') {
         include_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
         $objectstatic = new Adherent($db);
         $objectstatic->fetch($obj->source_id);
         print $objectstatic->getNomUrl(2);
     } else {
         if ($obj->source_type == 'user') {
             include_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php';
             $objectstatic = new User($db);
             $objectstatic->fetch($obj->source_id);
             $objectstatic->id = $obj->source_id;
             print $objectstatic->getNomUrl(2);
         } else {
             if ($obj->source_type == 'thirdparty') {
                 include_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
                 $objectstatic = new Societe($db);
                 $objectstatic->fetch($obj->source_id);
                 print $objectstatic->getNomUrl(2);
             } else {
                 print $obj->source_url;
             }
         }
     }
 }
 print '</td>';
 // Statut pour l'email destinataire (Attentioon != statut du mailing)
 if ($obj->statut == 0) {
 /**
  *    Assign custom values for canvas (for example into this->tpl to be used by templates)
  *
  *    @param	string	$action    Type of action
  *    @param	string	$id			Id of object
  *    @param	string	$ref		Ref of object
  *    @return	void
  */
 function assign_values(&$action, $id = 0, $ref = '')
 {
     global $conf, $langs, $user, $mysoc, $canvas;
     global $form, $formadmin, $formcompany;
     if ($action == 'add' || $action == 'update') {
         $this->assign_post($action);
     }
     if ($_GET["type"] == 'f') {
         $this->object->fournisseur = 1;
     }
     if ($_GET["type"] == 'c') {
         $this->object->client = 1;
     }
     if ($_GET["type"] == 'p') {
         $this->object->client = 2;
     }
     if ($_GET["type"] == 'cp') {
         $this->object->client = 3;
     }
     if ($_REQUEST["private"] == 1) {
         $this->object->particulier = 1;
     }
     foreach ($this->object as $key => $value) {
         $this->tpl[$key] = $value;
     }
     $this->tpl['error'] = get_htmloutput_errors($this->object->error, $this->object->errors);
     if (is_array($GLOBALS['errors'])) {
         $this->tpl['error'] = get_htmloutput_mesg('', $GLOBALS['errors'], 'error');
     }
     if ($action == 'create') {
         if ($conf->use_javascript_ajax) {
             $this->tpl['ajax_selecttype'] = "\n" . '<script type="text/javascript" language="javascript">
	$(document).ready(function () {
             $("#radiocompany").click(function() {
                         document.formsoc.action.value="create";
                         document.formsoc.canvas.value="company";
                         document.formsoc.private.value=0;
                         document.formsoc.submit();
             });
              $("#radioprivate").click(function() {
                         document.formsoc.action.value="create";
                         document.formsoc.canvas.value="individual";
                         document.formsoc.private.value=1;
                         document.formsoc.submit();
                   });
         });
             </script>' . "\n";
         }
     }
     if ($action == 'create' || $action == 'edit') {
         if ($conf->use_javascript_ajax) {
             $this->tpl['ajax_selectcountry'] = "\n" . '<script type="text/javascript" language="javascript">
	$(document).ready(function () {
			$("#selectcountry_id").change(function() {
				document.formsoc.action.value="' . $action . '";
				document.formsoc.canvas.value="' . $canvas . '";
				document.formsoc.submit();
			});
		})
	</script>' . "\n";
         }
         // Load object modCodeClient
         $module = !empty($conf->global->SOCIETE_CODECLIENT_ADDON) ? $conf->global->SOCIETE_CODECLIENT_ADDON : 'mod_codeclient_leopard';
         if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') {
             $module = substr($module, 0, dol_strlen($module) - 4);
         }
         $dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']);
         foreach ($dirsociete as $dirroot) {
             $res = dol_include_once($dirroot . $module . '.php');
             if ($res) {
                 break;
             }
         }
         $modCodeClient = new $module($db);
         $this->tpl['auto_customercode'] = $modCodeClient->code_auto;
         // We verified if the tag prefix is used
         if ($modCodeClient->code_auto) {
             $this->tpl['prefix_customercode'] = $modCodeClient->verif_prefixIsUsed();
         }
         // TODO create a function
         $this->tpl['select_customertype'] = '<select class="flat" name="client">';
         $this->tpl['select_customertype'] .= '<option value="2"' . ($this->object->client == 2 ? ' selected="selected"' : '') . '>' . $langs->trans('Prospect') . '</option>';
         $this->tpl['select_customertype'] .= '<option value="3"' . ($this->object->client == 3 ? ' selected="selected"' : '') . '>' . $langs->trans('ProspectCustomer') . '</option>';
         $this->tpl['select_customertype'] .= '<option value="1"' . ($this->object->client == 1 ? ' selected="selected"' : '') . '>' . $langs->trans('Customer') . '</option>';
         $this->tpl['select_customertype'] .= '<option value="0"' . ($this->object->client == 0 ? ' selected="selected"' : '') . '>' . $langs->trans('NorProspectNorCustomer') . '</option>';
         $this->tpl['select_customertype'] .= '</select>';
         // Customer
         $this->tpl['customercode'] = $this->object->code_client;
         if ((!$this->object->code_client || $this->object->code_client == -1) && $modCodeClient->code_auto) {
             $this->tpl['customercode'] = $modCodeClient->getNextValue($this->object, 0);
         }
         $this->tpl['ismodifiable_customercode'] = $this->object->codeclient_modifiable();
         $s = $modCodeClient->getToolTip($langs, $this->object, 0);
         $this->tpl['help_customercode'] = $form->textwithpicto('', $s, 1);
         if (!empty($conf->fournisseur->enabled)) {
             $this->tpl['supplier_enabled'] = 1;
             // Load object modCodeFournisseur
             $module = $conf->global->SOCIETE_CODECLIENT_ADDON;
             if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') {
                 $module = substr($module, 0, dol_strlen($module) - 4);
             }
             $dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']);
             foreach ($dirsociete as $dirroot) {
                 $res = dol_include_once($dirroot . $module . '.php');
                 if ($res) {
                     break;
                 }
             }
             $modCodeFournisseur = new $module();
             $this->tpl['auto_suppliercode'] = $modCodeFournisseur->code_auto;
             // We verified if the tag prefix is used
             if ($modCodeFournisseur->code_auto) {
                 $this->tpl['prefix_suppliercode'] = $modCodeFournisseur->verif_prefixIsUsed();
             }
             // Supplier
             $this->tpl['yn_supplier'] = $form->selectyesno("fournisseur", $this->object->fournisseur, 1);
             $this->tpl['suppliercode'] = $this->object->code_fournisseur;
             if ((!$this->object->code_fournisseur || $this->object->code_fournisseur == -1) && $modCodeFournisseur->code_auto) {
                 $this->tpl['suppliercode'] = $modCodeFournisseur->getNextValue($this->object, 1);
             }
             $this->tpl['ismodifiable_suppliercode'] = $this->object->codefournisseur_modifiable();
             $s = $modCodeFournisseur->getToolTip($langs, $this->object, 1);
             $this->tpl['help_suppliercode'] = $form->textwithpicto('', $s, 1);
             $this->object->LoadSupplierCateg();
             $this->tpl['suppliercategory'] = $this->object->SupplierCategories;
         }
         // Zip
         $this->tpl['select_zip'] = $formcompany->select_ziptown($this->object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6);
         // Town
         $this->tpl['select_town'] = $formcompany->select_ziptown($this->object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id'));
         // Country
         $this->object->country_id = $this->object->country_id ? $this->object->country_id : $mysoc->country_id;
         $this->object->country_code = $this->object->country_code ? $this->object->country_code : $mysoc->country_code;
         $this->tpl['select_country'] = $form->select_country($this->object->country_id, 'country_id');
         $countrynotdefined = $langs->trans("ErrorSetACountryFirst") . ' (' . $langs->trans("SeeAbove") . ')';
         if ($user->admin) {
             $this->tpl['info_admin'] = info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
         }
         // State
         if ($this->object->country_id) {
             $this->tpl['select_state'] = $formcompany->select_state($this->object->state_id, $this->object->country_code);
         } else {
             $this->tpl['select_state'] = $countrynotdefined;
         }
         // Language
         if (!empty($conf->global->MAIN_MULTILANGS)) {
             $this->tpl['select_lang'] = $formadmin->select_language($this->object->default_lang ? $this->object->default_lang : $conf->global->MAIN_LANG_DEFAULT, 'default_lang', 0, 0, 1);
         }
         // VAT
         $this->tpl['yn_assujtva'] = $form->selectyesno('assujtva_value', $this->tpl['tva_assuj'], 1);
         // Assujeti par defaut en creation
         // Select users
         $this->tpl['select_users'] = $form->select_dolusers($this->object->commercial_id, 'commercial_id', 1);
         // Local Tax
         // TODO mettre dans une classe propre au pays
         if ($mysoc->country_code == 'ES') {
             $this->tpl['localtax'] = '';
             if ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj == "1") {
                 $this->tpl['localtax'] .= '<tr><td>' . $langs->trans("LocalTax1IsUsedES") . '</td><td>';
                 $this->tpl['localtax'] .= $form->selectyesno('localtax1assuj_value', $this->object->localtax1_assuj, 1);
                 $this->tpl['localtax'] .= '</td><td>' . $langs->trans("LocalTax2IsUsedES") . '</td><td>';
                 $this->tpl['localtax'] .= $form->selectyesno('localtax2assuj_value', $this->object->localtax1_assuj, 1);
                 $this->tpl['localtax'] .= '</td></tr>';
             } elseif ($mysoc->localtax1_assuj == "1") {
                 $this->tpl['localtax'] .= '<tr><td>' . $langs->trans("LocalTax1IsUsedES") . '</td><td colspan="3">';
                 $this->tpl['localtax'] .= $form->selectyesno('localtax1assuj_value', $this->object->localtax1_assuj, 1);
                 $this->tpl['localtax'] .= '</td><tr>';
             } elseif ($mysoc->localtax2_assuj == "1") {
                 $this->tpl['localtax'] .= '<tr><td>' . $langs->trans("LocalTax2IsUsedES") . '</td><td colspan="3">';
                 $this->tpl['localtax'] .= $form->selectyesno('localtax2assuj_value', $this->object->localtax1_assuj, 1);
                 $this->tpl['localtax'] .= '</td><tr>';
             }
         }
     } else {
         $head = societe_prepare_head($this->object);
         $this->tpl['showhead'] = dol_get_fiche_head($head, 'card', '', 0, 'company');
         $this->tpl['showend'] = dol_get_fiche_end();
         $this->tpl['showrefnav'] = $form->showrefnav($this->object, 'socid', '', $user->societe_id ? 0 : 1, 'rowid', 'nom');
         $this->tpl['checkcustomercode'] = $this->object->check_codeclient();
         $this->tpl['checksuppliercode'] = $this->object->check_codefournisseur();
         $this->tpl['address'] = dol_nl2br($this->object->address);
         $img = picto_from_langcode($this->object->country_code);
         if ($this->object->isInEEC()) {
             $this->tpl['country'] = $form->textwithpicto(($img ? $img . ' ' : '') . $this->object->country, $langs->trans("CountryIsInEEC"), 1, 0);
         }
         $this->tpl['country'] = ($img ? $img . ' ' : '') . $this->object->country;
         $this->tpl['phone'] = dol_print_phone($this->object->phone, $this->object->country_code, 0, $this->object->id, 'AC_TEL');
         $this->tpl['fax'] = dol_print_phone($this->object->fax, $this->object->country_code, 0, $this->object->id, 'AC_FAX');
         $this->tpl['email'] = dol_print_email($this->object->email, 0, $this->object->id, 'AC_EMAIL');
         $this->tpl['url'] = dol_print_url($this->object->url);
         $this->tpl['tva_assuj'] = yn($this->object->tva_assuj);
         // Third party type
         $arr = $formcompany->typent_array(1);
         $this->tpl['typent'] = $arr[$this->object->typent_code];
         if (!empty($conf->global->MAIN_MULTILANGS)) {
             require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
             //$s=picto_from_langcode($this->default_lang);
             //print ($s?$s.' ':'');
             $langs->load("languages");
             $this->tpl['default_lang'] = $this->default_lang ? $langs->trans('Language_' . $this->object->default_lang) : '';
         }
         $this->tpl['image_edit'] = img_edit();
         $this->tpl['display_rib'] = $this->object->display_rib();
         // Sales representatives
         $this->tpl['sales_representatives'] = '';
         $listsalesrepresentatives = $this->object->getSalesRepresentatives($user);
         $nbofsalesrepresentative = count($listsalesrepresentatives);
         if ($nbofsalesrepresentative > 3) {
             $this->tpl['sales_representatives'] .= '<a href="' . DOL_URL_ROOT . '/societe/commerciaux.php?socid=' . $this->object->id . '">';
             $this->tpl['sales_representatives'] .= $nbofsalesrepresentative;
             $this->tpl['sales_representatives'] .= '</a>';
         } else {
             if ($nbofsalesrepresentative > 0) {
                 $userstatic = new User($this->db);
                 $i = 0;
                 foreach ($listsalesrepresentatives as $val) {
                     $userstatic->id = $val['id'];
                     $userstatic->lastname = $val['name'];
                     $userstatic->firstname = $val['firstname'];
                     $this->tpl['sales_representatives'] .= $userstatic->getNomUrl(1);
                     $i++;
                     if ($i < $nbofsalesrepresentative) {
                         $this->tpl['sales_representatives'] .= ', ';
                     }
                 }
             } else {
                 $this->tpl['sales_representatives'] .= $langs->trans("NoSalesRepresentativeAffected");
             }
         }
         // Linked member
         if (!empty($conf->adherent->enabled)) {
             $langs->load("members");
             $adh = new Adherent($this->db);
             $result = $adh->fetch('', '', $this->object->id);
             if ($result > 0) {
                 $adh->ref = $adh->getFullName($langs);
                 $this->tpl['linked_member'] = $adh->getNomUrl(1);
             } else {
                 $this->tpl['linked_member'] = $langs->trans("ThirdpartyNotLinkedToMember");
             }
         }
         // Local Tax
         // TODO mettre dans une classe propre au pays
         if ($mysoc->country_code == 'ES') {
             $this->tpl['localtax'] = '';
             if ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj == "1") {
                 $this->tpl['localtax'] .= '<tr><td>' . $langs->trans("LocalTax1IsUsedES") . '</td>';
                 $this->tpl['localtax'] .= '<td>' . yn($this->object->localtax1_assuj) . '</td>';
                 $this->tpl['localtax'] .= '<td>' . $langs->trans("LocalTax2IsUsedES") . '</td>';
                 $this->tpl['localtax'] .= '<td>' . yn($this->object->localtax2_assuj) . '</td></tr>';
             } elseif ($mysoc->localtax1_assuj == "1") {
                 $this->tpl['localtax'] .= '<tr><td>' . $langs->trans("LocalTax1IsUsedES") . '</td>';
                 $this->tpl['localtax'] .= '<td colspan="3">' . yn($this->object->localtax1_assuj) . '</td></tr>';
             } elseif ($mysoc->localtax2_assuj == "1") {
                 $this->tpl['localtax'] .= '<tr><td>' . $langs->trans("LocalTax2IsUsedES") . '</td>';
                 $this->tpl['localtax'] .= '<td colspan="3">' . yn($this->object->localtax2_assuj) . '</td></tr>';
             }
         }
     }
 }
Example #20
0
    /**
     *	Show the form to input an sms
     */
    function show_form($width = '180px')
    {
        global $conf, $langs, $user;
        $langs->load("other");
        $langs->load("mails");
        $langs->load("sms");
        $form = new Form($this->db);
        $soc = new Societe($this->db);
        if (!empty($this->withtosocid) && $this->withtosocid > 0) {
            $soc->fetch($this->withtosocid);
        }
        print "\n<!-- Debut form SMS -->\n";
        print '
<script language="javascript">
function limitChars(textarea, limit, infodiv)
{
    var text = textarea.value;
    var textlength = text.length;
    var info = document.getElementById(infodiv);

    info.innerHTML = \'' . $langs->trans("SmsInfoCharRemain") . ': \' + (limit - textlength);
    return true;
}
</script>';
        print "<form method=\"POST\" name=\"smsform\" enctype=\"multipart/form-data\" action=\"" . $this->param["returnurl"] . "\">\n";
        print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
        foreach ($this->param as $key => $value) {
            print "<input type=\"hidden\" name=\"{$key}\" value=\"{$value}\">\n";
        }
        print "<table class=\"border\" width=\"100%\">\n";
        // Substitution array
        if ($this->withsubstit) {
            print "<tr><td colspan=\"2\">";
            $help = "";
            foreach ($this->substit as $key => $val) {
                $help .= $key . ' -> ' . $langs->trans($val) . '<br>';
            }
            print $form->textwithpicto($langs->trans("SmsTestSubstitutionReplacedByGenericValues"), $help);
            print "</td></tr>\n";
        }
        // From
        if ($this->withfrom) {
            if ($this->withfromreadonly) {
                print '<input type="hidden" name="fromsms" value="' . $this->fromsms . '">';
                print "<tr><td width=\"" . $width . "\">" . $langs->trans("SmsFrom") . "</td><td>";
                if ($this->fromtype == 'user') {
                    $langs->load("users");
                    $fuser = new User($this->db);
                    $fuser->fetch($this->fromid);
                    print $fuser->getNomUrl(1);
                    print ' &nbsp; ';
                }
                if ($this->fromsms) {
                    print $this->fromsms;
                } else {
                    if ($this->fromtype) {
                        $langs->load("errors");
                        print '<font class="warning"> &lt;' . $langs->trans("ErrorNoPhoneDefinedForThisUser") . '&gt; </font>';
                    }
                }
                print "</td></tr>\n";
                print "</td></tr>\n";
            } else {
                print "<tr><td width=\"" . $width . "\">" . $langs->trans("SmsFrom") . "</td><td>";
                //print '<input type="text" name="fromname" size="30" value="'.$this->fromsms.'">';
                if ($conf->global->MAIN_SMS_SENDMODE == 'ovh') {
                    dol_include_once('/ovh/class/ovhsms.class.php');
                    try {
                        $sms = new OvhSms($this->db);
                        if (empty($conf->global->OVHSMS_ACCOUNT)) {
                            $resultsender = 'ErrorOVHSMS_ACCOUNT not defined';
                        } else {
                            $resultsender = $sms->SmsSenderList($conf->global->OVHSMS_ACCOUNT);
                        }
                    } catch (Exception $e) {
                        dol_print_error('', 'Error to get list of senders: ' . $e->getMessage());
                    }
                } else {
                    dol_syslog("Warning: The SMS sending method has not been defined into MAIN_SMS_SENDMODE", LOG_WARNING);
                    $resultsender[0]->number = $this->fromsms;
                }
                if (is_array($resultsender) && count($resultsender) > 0) {
                    print '<select name="fromsms" id="valid" class="flat">';
                    foreach ($resultsender as $obj) {
                        print '<option value="' . $obj->number . '">' . $obj->number . '</option>';
                    }
                    print '</select>';
                } else {
                    print '<span class="error">' . $langs->trans("SmsNoPossibleRecipientFound") . '</span>';
                }
                print '</td>';
                print "</tr>\n";
            }
        }
        // To
        if ($this->withto || is_array($this->withto)) {
            print '<tr><td width="180">';
            //$moretext=$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients");
            $moretext = '';
            print $form->textwithpicto($langs->trans("SmsTo"), $moretext);
            print '</td><td>';
            if ($this->withtoreadonly) {
                print !is_array($this->withto) && !is_numeric($this->withto) ? $this->withto : "";
            } else {
                print "<input size=\"16\" id=\"sendto\" name=\"sendto\" value=\"" . (!is_array($this->withto) && $this->withto != '1' ? isset($_REQUEST["sendto"]) ? $_REQUEST["sendto"] : $this->withto : "+") . "\">";
                if (!empty($this->withtosocid) && $this->withtosocid > 0) {
                    $liste = array();
                    foreach ($soc->thirdparty_and_contact_phone_array() as $key => $value) {
                        $liste[$key] = $value;
                    }
                    print " " . $langs->trans("or") . " ";
                    //var_dump($_REQUEST);exit;
                    print $form->selectarray("receiver", $liste, GETPOST("receiver"), 1);
                }
                print ' ' . $langs->trans("SmsInfoNumero");
            }
            print "</td></tr>\n";
        }
        // Message
        if ($this->withbody) {
            $defaultmessage = '';
            if ($this->param["models"] == 'body') {
                $defaultmessage = $this->withbody;
            }
            $defaultmessage = make_substitutions($defaultmessage, $this->substit, $langs);
            if (isset($_POST["message"])) {
                $defaultmessage = $_POST["message"];
            }
            $defaultmessage = str_replace('\\n', "\n", $defaultmessage);
            print "<tr>";
            print "<td width=\"180\" valign=\"top\">" . $langs->trans("SmsText") . "</td>";
            print "<td>";
            if ($this->withbodyreadonly) {
                print nl2br($defaultmessage);
                print '<input type="hidden" name="message" value="' . $defaultmessage . '">';
            } else {
                print '<textarea cols="40" name="message" id="message" rows="4" onkeyup="limitChars(this, 160, \'charlimitinfo\')">' . $defaultmessage . '</textarea>';
                print '<div id="charlimitinfo">' . $langs->trans("SmsInfoCharRemain") . ': <span id="charlimitinfospan">' . (160 - dol_strlen($defaultmessage)) . '</span></div></td>';
            }
            print "</td></tr>\n";
        }
        print '
           <tr>
            <td>' . $langs->trans("DelayBeforeSending") . ':</td>
            <td> <input name="deferred" id="deferred" size="4" value="0"></td></tr>

           <tr><td>' . $langs->trans("Priority") . ' :</td><td>
           <select name="priority" id="valid" class="flat">
           <option value="0">0</option>
           <option value="1">1</option>
           <option value="2">2</option>
           <option value="3" selected="selected">3</option>
           </select></td></tr>

           <tr><td>' . $langs->trans("Type") . ' :</td><td>
           <select name="class" id="valid" class="flat">
           <option value="0">Flash</option>
           <option value="1" selected="selected">Standard</option>
           <option value="2">SIM</option>
           <option value="3">ToolKit</option>
           </select></td></tr>';
        print '<tr><td align="center" colspan="2"><center>';
        print "<input class=\"button\" type=\"submit\" name=\"sendmail\" value=\"" . $langs->trans("SendSms") . "\"";
        print ">";
        if ($this->withcancel) {
            print " &nbsp; &nbsp; ";
            print "<input class=\"button\" type=\"submit\" name=\"cancel\" value=\"" . $langs->trans("Cancel") . "\">";
        }
        print "</center></td></tr>\n";
        print "</table>\n";
        print "</form>\n";
        print "<!-- Fin form SMS -->\n";
    }
        $userstatic->lastname = $infos_CP['user_lastname'];
        $userstatic->firstname = $infos_CP['user_firstname'];
        // Valideur
        $approbatorstatic->id = $infos_CP['fk_validator'];
        $approbatorstatic->lastname = $infos_CP['validator_lastname'];
        $approbatorstatic->firstname = $infos_CP['validator_firstname'];
        $date = $infos_CP['date_create'];
        print '<tr ' . $bc[$var] . '>';
        print '<td>';
        $holidaystatic->id = $infos_CP['rowid'];
        $holidaystatic->ref = $infos_CP['rowid'];
        print $holidaystatic->getNomUrl(1);
        print '</td>';
        print '<td style="text-align: center;">' . dol_print_date($date, 'day') . '</td>';
        print '<td>' . $userstatic->getNomUrl('1') . '</td>';
        print '<td>' . $approbatorstatic->getNomUrl('1') . '</td>';
        print '<td align="center">' . dol_print_date($infos_CP['date_debut'], 'day') . '</td>';
        print '<td align="center">' . dol_print_date($infos_CP['date_fin'], 'day') . '</td>';
        print '<td align="right">';
        $nbopenedday = num_open_day($infos_CP['date_debut_gmt'], $infos_CP['date_fin_gmt'], 0, 1, $infos_CP['halfday']);
        print $nbopenedday . ' ' . $langs->trans('DurationDays');
        print '<td align="right" colspan="2">' . $holidaystatic->LibStatut($infos_CP['statut'], 5) . '</td>';
        print '</tr>' . "\n";
    }
}
// Si il n'y a pas d'enregistrement suite à une recherche
if ($holiday_payes == '2') {
    print '<tr>';
    print '<td colspan="9" class="pair" style="text-align: center; padding: 5px;">' . $langs->trans('None') . '</td>';
    print '</tr>';
}
    print '</tr>';
} else {
    $langs->load('users');
    while ($holiday = $db->fetch_array($result)) {
        $user = new User($db);
        $user->fetch($holiday['fk_user']);
        $var = !$var;
        $holidaystatic->id = $holiday['rowid'];
        $holidaystatic->ref = $holiday['rowid'];
        $start_date = $db->jdate($holiday['date_debut']);
        $end_date = $db->jdate($holiday['date_fin']);
        $start_date_gmt = $db->jdate($holiday['date_debut'], 1);
        $end_date_gmt = $db->jdate($holiday['date_fin'], 1);
        print '<tr ' . $bc[$var] . '>';
        print '<td>' . $holidaystatic->getNomUrl(1) . '</td>';
        print '<td>' . $user->getNomUrl(1) . '</td>';
        print '<td>' . dol_print_date($start_date, 'day');
        print '</td>';
        print '<td>' . dol_print_date($end_date, 'day');
        print '</td>';
        print '<td align="right">';
        $nbopenedday = num_open_day($start_date_gmt, $end_date_gmt, 0, 1, $holiday['halfday']);
        print $nbopenedday;
        print '</td>';
        print '</tr>';
    }
}
print '</table>';
print '</div>';
// Fin de page
llxFooter();
Example #23
0
 // Ref
 print '<tr><td width="25%">' . $langs->trans("Ref") . '</td><td>';
 print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'ref', '');
 print '</td></tr>';
 $form->load_cache_types_fees();
 // Type
 print '<tr><td>';
 print $form->editfieldkey("Type", 'type', $langs->trans($object->type), $object, $conf->global->MAIN_EDIT_ALSO_INLINE && $user->rights->deplacement->creer, 'select:types_fees');
 print '</td><td>';
 print $form->editfieldval("Type", 'type', $form->cache_types_fees[$object->type], $object, $conf->global->MAIN_EDIT_ALSO_INLINE && $user->rights->deplacement->creer, 'select:types_fees');
 print '</td></tr>';
 // Who
 print '<tr><td>' . $langs->trans("Person") . '</td><td>';
 $userfee = new User($db);
 $userfee->fetch($object->fk_user);
 print $userfee->getNomUrl(1);
 print '</td></tr>';
 // Date
 print '<tr><td>';
 print $form->editfieldkey("Date", 'dated', $object->date, $object, $conf->global->MAIN_EDIT_ALSO_INLINE && $user->rights->deplacement->creer, 'datepicker');
 print '</td><td>';
 print $form->editfieldval("Date", 'dated', $object->date, $object, $conf->global->MAIN_EDIT_ALSO_INLINE && $user->rights->deplacement->creer, 'datepicker');
 print '</td></tr>';
 // Km/Price
 print '<tr><td valign="top">';
 print $form->editfieldkey("FeesKilometersOrAmout", 'km', $object->km, $object, $conf->global->MAIN_EDIT_ALSO_INLINE && $user->rights->deplacement->creer, 'numeric:6');
 print '</td><td>';
 print $form->editfieldval("FeesKilometersOrAmout", 'km', $object->km, $object, $conf->global->MAIN_EDIT_ALSO_INLINE && $user->rights->deplacement->creer, 'numeric:6');
 print "</td></tr>";
 // Where
 print '<tr><td>' . $langs->trans("CompanyVisited") . '</td>';
Example #24
0
 // Amount
 print '<td class="liste_titre" align="right"><input name="search_amount" class="flat" type="text" size="8" value="' . $search_amount . '"></td>';
 print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
 print '<input type="image" class="liste_titre" name="button_removefilter" src="' . img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1) . '" value="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '" title="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '">';
 print "</td></tr>\n";
 while ($i < min($num, $limit)) {
     $obj = $db->fetch_object($result);
     $var = !$var;
     print "<tr " . $bc[$var] . ">";
     $userstatic->id = $obj->uid;
     $userstatic->lastname = $obj->lastname;
     $userstatic->firstname = $obj->firstname;
     $salstatic->id = $obj->rowid;
     $salstatic->ref = $obj->rowid;
     print "<td>" . $salstatic->getNomUrl(1) . "</td>\n";
     print "<td>" . $userstatic->getNomUrl(1) . "</td>\n";
     print "<td>" . dol_trunc($obj->label, 40) . "</td>\n";
     print '<td align="left">' . dol_print_date($db->jdate($obj->dm), 'day') . "</td>\n";
     // Type
     print '<td>' . $langs->trans("PaymentTypeShort" . $obj->payment_code) . ' ' . $obj->num_payment . '</td>';
     // Amount
     print "<td align=\"right\">" . price($obj->amount, 0, $outputlangs, 1, -1, -1, $conf->currency) . "</td>";
     print "<td>&nbsp;</td>";
     print "</tr>\n";
     $total = $total + $obj->amount;
     $i++;
 }
 print '<tr class="liste_total"><td colspan="5" class="liste_total">' . $langs->trans("Total") . '</td>';
 print '<td  class="liste_total" align="right">' . price($total, 0, $outputlangs, 1, -1, -1, $conf->currency) . "</td>";
 print "<td>&nbsp;</td></tr>";
 print "</table>";
Example #25
0
 while ($i < $num && $i < $max) {
     $obj = $db->fetch_object($resql);
     $var = !$var;
     print "<tr " . $bc[$var] . ">";
     print '<td>';
     $fuserstatic->id = $obj->rowid;
     $fuserstatic->statut = $obj->statut;
     $fuserstatic->lastname = $obj->lastname;
     $fuserstatic->firstname = $obj->firstname;
     $fuserstatic->login = $obj->login;
     $fuserstatic->photo = $obj->photo;
     $fuserstatic->admin = $obj->admin;
     $fuserstatic->email = $obj->email;
     $fuserstatic->skype = $obj->skype;
     $fuserstatic->societe_id = $obj->fk_soc;
     print $fuserstatic->getNomUrl(1);
     if (!empty($conf->multicompany->enabled) && $obj->admin && !$obj->entity) {
         print img_picto($langs->trans("SuperAdministrator"), 'redstar');
     } else {
         if ($obj->admin) {
             print img_picto($langs->trans("Administrator"), 'star');
         }
     }
     print "</td>";
     print '<td align="left">' . $obj->login . '</td>';
     print "<td>";
     if ($obj->fk_soc) {
         $companystatic->id = $obj->fk_soc;
         $companystatic->name = $obj->name;
         $companystatic->code_client = $obj->code_client;
         $companystatic->canvas = $obj->canvas;
Example #26
0
/**
 *	Show informations on an object
 *  TODO Move this into html.formother
 *
 *	@param	Object	$object			Objet to show
 *	@return	void
 */
function dol_print_object_info($object)
{
    global $langs, $db;
    $langs->load("other");
    $langs->load("admin");
    include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
    $deltadateforserver = getServerTimeZoneInt('now');
    $deltadateforclient = (int) $_SESSION['dol_tz'] + (int) $_SESSION['dol_dst'];
    //$deltadateforcompany=((int) $_SESSION['dol_tz'] + (int) $_SESSION['dol_dst']);
    $deltadateforuser = round($deltadateforclient - $deltadateforserver);
    //print "x".$deltadateforserver." - ".$deltadateforclient." - ".$deltadateforuser;
    // Import key
    if (isset($object->import_key)) {
        print $langs->trans("ImportedWithSet") . " : " . $object->import_key . '<br>';
    }
    // User creation
    if (isset($object->user_creation)) {
        print $langs->trans("CreatedBy") . " : ";
        if (is_object($object->user_creation)) {
            print $object->user_creation->getNomUrl(1);
        } else {
            $userstatic = new User($db);
            $userstatic->fetch($object->user_creation);
            print $userstatic->getNomUrl(1);
        }
        print '<br>';
    }
    // Date creation
    if (isset($object->date_creation)) {
        print $langs->trans("DateCreation") . " : " . dol_print_date($object->date_creation, "dayhour");
        if ($deltadateforuser) {
            print ' ' . $langs->trans("CurrentHour") . ' &nbsp; / &nbsp; ' . dol_print_date($object->date_creation + $deltadateforuser * 3600, "dayhour") . ' &nbsp;' . $langs->trans("ClientHour");
        }
        print '<br>';
    }
    // User change
    if (isset($object->user_modification)) {
        print $langs->trans("ModifiedBy") . " : ";
        if (is_object($object->user_modification)) {
            print $object->user_modification->getNomUrl(1);
        } else {
            $userstatic = new User($db);
            $userstatic->fetch($object->user_modification);
            print $userstatic->getNomUrl(1);
        }
        print '<br>';
    }
    // Date change
    if (isset($object->date_modification)) {
        print $langs->trans("DateLastModification") . " : " . dol_print_date($object->date_modification, "dayhour");
        if ($deltadateforuser) {
            print ' ' . $langs->trans("CurrentHour") . ' &nbsp; / &nbsp; ' . dol_print_date($object->date_modification + $deltadateforuser * 3600, "dayhour") . ' &nbsp;' . $langs->trans("ClientHour");
        }
        print '<br>';
    }
    // User validation
    if (isset($object->user_validation)) {
        print $langs->trans("ValidatedBy") . " : ";
        if (is_object($object->user_validation)) {
            print $object->user_validation->getNomUrl(1);
        } else {
            $userstatic = new User($db);
            $userstatic->fetch($object->user_validation);
            print $userstatic->getNomUrl(1);
        }
        print '<br>';
    }
    // Date validation
    if (isset($object->date_validation)) {
        print $langs->trans("DateValidation") . " : " . dol_print_date($object->date_validation, "dayhour");
        if ($deltadateforuser) {
            print ' ' . $langs->trans("CurrentHour") . ' &nbsp; / &nbsp; ' . dol_print_date($object->date_validation + $deltadateforuser * 3600, "dayhour") . ' &nbsp;' . $langs->trans("ClientHour");
        }
        print '<br>';
    }
    // User approve
    if (isset($object->user_approve)) {
        print $langs->trans("ApprovedBy") . " : ";
        if (is_object($object->user_approve)) {
            print $object->user_approve->getNomUrl(1);
        } else {
            $userstatic = new User($db);
            $userstatic->fetch($object->user_approve);
            print $userstatic->getNomUrl(1);
        }
        print '<br>';
    }
    // Date approve
    if (isset($object->date_approve)) {
        print $langs->trans("DateApprove") . " : " . dol_print_date($object->date_approve, "dayhour");
        if ($deltadateforuser) {
            print ' ' . $langs->trans("CurrentHour") . ' &nbsp; / &nbsp; ' . dol_print_date($object->date_approve + $deltadateforuser * 3600, "dayhour") . ' &nbsp;' . $langs->trans("ClientHour");
        }
        print '<br>';
    }
    // User close
    if (isset($object->user_cloture)) {
        print $langs->trans("ClosedBy") . " : ";
        if (is_object($object->user_cloture)) {
            print $object->user_cloture->getNomUrl(1);
        } else {
            $userstatic = new User($db);
            $userstatic->fetch($object->user_cloture);
            print $userstatic->getNomUrl(1);
        }
        print '<br>';
    }
    // Date close
    if (isset($object->date_cloture)) {
        print $langs->trans("DateClosing") . " : " . dol_print_date($object->date_cloture, "dayhour");
        if ($deltadateforuser) {
            print ' ' . $langs->trans("CurrentHour") . ' &nbsp; / &nbsp; ' . dol_print_date($object->date_cloture + $deltadateforuser * 3600, "dayhour") . ' &nbsp;' . $langs->trans("ClientHour");
        }
        print '<br>';
    }
    // User conciliate
    if (isset($object->user_rappro)) {
        print $langs->trans("ConciliatedBy") . " : ";
        if (is_object($object->user_rappro)) {
            print $object->user_rappro->getNomUrl(1);
        } else {
            $userstatic = new User($db);
            $userstatic->fetch($object->user_rappro);
            print $userstatic->getNomUrl(1);
        }
        print '<br>';
    }
    // Date conciliate
    if (isset($object->date_rappro)) {
        print $langs->trans("DateConciliating") . " : " . dol_print_date($object->date_rappro, "dayhour");
        if ($deltadateforuser) {
            print ' ' . $langs->trans("CurrentHour") . ' &nbsp; / &nbsp; ' . dol_print_date($object->date_rappro + $deltadateforuser * 3600, "dayhour") . ' &nbsp;' . $langs->trans("ClientHour");
        }
        print '<br>';
    }
    // Date send
    if (isset($object->date_envoi)) {
        print $langs->trans("DateLastSend") . " : " . dol_print_date($object->date_envoi, "dayhour");
        if ($deltadateforuser) {
            print ' ' . $langs->trans("CurrentHour") . ' &nbsp; / &nbsp; ' . dol_print_date($object->date_envoi + $deltadateforuser * 3600, "dayhour") . ' &nbsp;' . $langs->trans("ClientHour");
        }
        print '<br>';
    }
}
         print $userstatic->getNomUrl(1);
         print "</td>\n";
         // Value
         print '<td align="right">';
         if ($objp->value > 0) {
             print '+';
         }
         print $objp->value . '</td>';
         print "</tr>\n";
     }
 } else {
     print "<tr " . $bc[$var] . ">";
     // Id movement
     //print '<td>'.$objp->mid.'</td>';  // This is primary not movement id
     // Date
     print '<td>' . dol_print_date($db->jdate($objp->datem), 'dayhour') . '</td>';
     // Checkpoint: checkbox
     print '<td>' . '<input class="check" type="checkbox" rel="' . $objp->mid . '" ';
     if ($objp->checked > 0) {
         print 'checked';
     }
     print '></td>';
     // Label of movement
     print '<td>' . $objp->label . '</td>';
     // Checkpoint: eliminar la columna de origen
     // Origin of movement
     // print '<td>'.$origin.'</td>';
     // Product ref
     print '<td>';
     $productstatic->id = $objp->rowid;
     $productstatic->ref = $objp->product_ref;
     $productstatic->type = $objp->type;
     print $productstatic->getNomUrl(1, '', 16);
     print "</td>\n";
     // Product label
     print '<td>';
     $productstatic->id = $objp->rowid;
     $productstatic->ref = $objp->produit;
     $productstatic->type = $objp->type;
     print $productstatic->getNomUrl(1, '', 16);
     print "</td>\n";
     // Warehouse
     print '<td>';
     if ($entrepot_origen != '') {
         $warehousestatic->id = $entrepot_id_origen;
         $warehousestatic->libelle = $entrepot_origen;
     } else {
         $warehousestatic->id = $objp->entrepot_id;
         $warehousestatic->libelle = $objp->stock;
     }
     print $warehousestatic->getNomUrl(1);
     print "</td>\n";
     // Checkpoint: Almacén Destino
     print '<td>';
     if ($entrepot_destino != '') {
         $warehousestatic->id = $entrepot_id_destino;
         $warehousestatic->libelle = $entrepot_destino;
     } else {
         $warehousestatic->id = $objp->entrepot_id;
         $warehousestatic->libelle = $objp->stock;
     }
     print $warehousestatic->getNomUrl(1);
     print "</td>\n";
     // Author
     print '<td>';
     $userstatic->id = $objp->fk_user_author;
     $userstatic->lastname = $objp->login;
     print $userstatic->getNomUrl(1);
Example #28
0
     // Nb of docs
     print '<table class="nobordernopadding"><tr><td>';
     print $val['cachenbofdoc'];
     print '</td>';
     print '<td align="left">';
     if ($nbofsubdir && $nboffilesinsubdir) {
         print '<font color="#AAAAAA">+' . $nboffilesinsubdir . '</font> ';
     }
     print '</td>';
     // Info
     print '<td align="center">';
     $userstatic->id = $val['fk_user_c'];
     $userstatic->lastname = $val['login_c'];
     $htmltooltip = '<b>' . $langs->trans("ECMSection") . '</b>: ' . $val['label'] . '<br>';
     $htmltooltip = '<b>' . $langs->trans("Type") . '</b>: ' . $langs->trans("ECMSectionManual") . '<br>';
     $htmltooltip .= '<b>' . $langs->trans("ECMCreationUser") . '</b>: ' . $userstatic->getNomUrl(1, '', false, 1) . '<br>';
     $htmltooltip .= '<b>' . $langs->trans("ECMCreationDate") . '</b>: ' . dol_print_date($val['date_c'], "dayhour") . '<br>';
     $htmltooltip .= '<b>' . $langs->trans("Description") . '</b>: ' . $val['description'] . '<br>';
     $htmltooltip .= '<b>' . $langs->trans("ECMNbOfFilesInDir") . '</b>: ' . $val['cachenbofdoc'] . '<br>';
     if ($nbofsubdir) {
         $htmltooltip .= '<b>' . $langs->trans("ECMNbOfFilesInSubDir") . '</b>: ' . $nboffilesinsubdir;
     } else {
         $htmltooltip .= '<b>' . $langs->trans("ECMNbOfSubDir") . '</b>: ' . $nbofsubdir . '<br>';
     }
     print $form->textwithpicto('', $htmltooltip, 1, 'info');
     print "</td>";
     print '</tr></table>';
     print '</div>';
     print "</li>\n";
 }
 $oldvallevel = $val['level'];
Example #29
0
        if ($tab[$i]['socid'] < 0) {
            echo $conf->global->MAIN_INFO_SOCIETE_NOM;
        }
        if (!$tab[$i]['socid']) {
            echo '&nbsp;';
        }
        ?>
		</div>
		<div class="tagtd">
			<?php 
        $statusofcontact = $tab[$i]['status'];
        if ($tab[$i]['source'] == 'internal') {
            $userstatic->id = $tab[$i]['id'];
            $userstatic->lastname = $tab[$i]['lastname'];
            $userstatic->firstname = $tab[$i]['firstname'];
            echo $userstatic->getNomUrl(1);
        }
        if ($tab[$i]['source'] == 'external') {
            $contactstatic->id = $tab[$i]['id'];
            $contactstatic->lastname = $tab[$i]['lastname'];
            $contactstatic->firstname = $tab[$i]['firstname'];
            echo $contactstatic->getNomUrl(1);
        }
        ?>
		</div>
		<div class="tagtd"><?php 
        echo $tab[$i]['libelle'];
        ?>
</div>
		<div class="tagtd" align="center">
			<?php 
Example #30
0
		print '<tr><td>'.$langs->trans("Date").'</td><td colspan="2">';
		if ($commande->date_commande)
		{
			print dol_print_date($commande->date_commande,"dayhourtext")."\n";
		}
		print "</td></tr>";

		if ($commande->methode_commande)
		{
			print '<tr><td>'.$langs->trans("Method").'</td><td colspan="2">'.$commande->methode_commande.'</td></tr>';
		}
	}

	// Auteur
	print '<tr><td>'.$langs->trans("AuthorRequest").'</td>';
	print '<td colspan="2">'.$author->getNomUrl(1).'</td>';
	print '</tr>';

	print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.sizeof($filearray).'</td></tr>';
	print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
	print "</table>\n";

	print "</div>\n";

	if ($mesg) { print $mesg."<br>"; }


	// Affiche formulaire upload
	$formfile=new FormFile($db);
	$formfile->form_attach_new_file(DOL_URL_ROOT.'/fourn/commande/document.php?id='.$commande->id,'',0,0,$user->rights->fournisseur->commande->creer);