Editing principle contacts fixed

This commit is contained in:
Karl Cordes 2011-06-16 13:27:33 +10:00
parent 0b7c7eddb8
commit 751a194a83
9 changed files with 79 additions and 52 deletions

View file

@ -5,8 +5,9 @@ class UsersController extends AppController {
var $helpers = array('Html', 'Form', 'Javascript', 'Text');
var $components = array('Acl','Auth', 'Cookie');
var $paginate = array(
'Users' => array('order' => array('User.id' => 'desc'),
'limit' => 200
'limit' => 500,
'order' => 'User.id asc',
'Users' => array('order' => array('User.id' => 'asc'),
),
'Enquiry' => array('order' => array('Enquiry.id' => 'desc'), 'limit' => 250)
);
@ -238,16 +239,6 @@ class UsersController extends AppController {
}
}
function delete($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid id for User', true));
$this->redirect(array('action'=>'index'));
}
if ($this->User->del($id)) {
$this->Session->setFlash(__('User deleted', true));
$this->redirect(array('action'=>'index'));
}
}

30
vendors/pdfdoc.php vendored
View file

@ -122,7 +122,7 @@ ENDHTML;
$this->MultiCell($secondColWidth, $lineHeight*$heightNeeded, $companyName, 'LTR', 'L', 0, 0);
$this->MultiCell($thirdColWidth, $lineHeight*$heightNeeded, "FROM:", 'LT', 'L', 0, 0);
$this->MultiCell($fourthColWidth, $lineHeight*$heightNeeded, "<a href=\"mailto:$fromEmail\">$fromName</a>", 'TR', 'L', 0, 1, null,null, true,0,true); //Start a new line after this.
$this->MultiCell($fourthColWidth, $lineHeight*$heightNeeded, "<a href=\"mailto:$fromEmail\">$fromName</a>", 'TR', 'L', false, 1, null,null, true,0,true, false, 0, null, false); //Start a new line after this.
$this->MultiCell($firstColWidth, 0, "EMAIL TO:", 'LR', 'L', 0, 0);
@ -153,6 +153,32 @@ ENDHTML;
$this->writeHTMLCell(0, 0, null, null, '<br><hr>', 0, 1, false,true, 'C', false);
}
/**
* For Quotes and (hopefully) Invoices. Identifies who the document is for, date, reference number, etc.
*/
function DetailsBoxHTML($docTypeFullName, $companyName, $emailTo, $attention, $fromName, $fromEmail, $enquiryNumber, $your_reference, $issuedate) {
$table = <<<ENDTABLE
<table border="1" cellpadding="1">
<tr style="border:">
<td>QUOTATION TO:</td>
<td>{$companyName}</td>
<td>FROM:</td>
<td><a href="mailto:{$fromEmail}">{$fromName}</a></td>
</tr>
</table>
ENDTABLE;
$this->SetTextColor(0); //Black Text
$this->writeHTMLCell(0, 0, null, null, $table, null, 1, null, true, 'L', false);
}
function header() {
//$this->Image(K_PATH_IMAGES.'cmclogosmall.jpg', 10, 10, 15, 13.6, null, 'http://www.cmctechnologies.com.au', null, false, null, 'L');
@ -171,7 +197,7 @@ ENDHTML;
$this->MultiCell(0,13.6, "PAGE $pageNo OF {nb}", '', 'R', false, 0, 10,5);
//$this->MultiCell($w, $h, $txt, $border, $align, $fill, $ln, $x, $y, $reseth, $stretch, $ishtml)
//$this->Image($file, $x, $y, $w, $h, $type, $link, $align, $resize, $dpi)
}

View file

@ -195,5 +195,6 @@
</div>
<span id="userType">contact</span>
<? debug($jobs); ?>

View file

@ -37,8 +37,11 @@ foreach($document['DocPage'] as $page) {
$pdfdoc->DetailsBox($docTypeFullName, $companyName, $emailTo, $attention, $fromName,
$fromEmail, $enquiryNumber, $your_reference, $issue_date);
/* $pdfdoc->DetailsBoxHTML($docTypeFullName, $companyName, $emailTo, $attention, $fromName,
$fromEmail, $enquiryNumber, $your_reference, $issue_date);
*/
$firstPageDone = true;
}

View file

@ -1,6 +1,6 @@
<table cellpadding="0" cellspacing="0">
<tr>
<tr>
<th><?php echo __('Name');?></th>
<th><?php echo __('Job Title');?></th>
<th><?php echo __('email');?></th>
@ -8,39 +8,40 @@
<th><?php echo __('fax');?></th>
<th><?php echo __('notes');?></th>
<th class="actions"><?php __('Actions');?></th>
</tr>
<?php
$i = 0;
foreach ($principleContacts as $principleContact):
</tr>
<?php
$i = 0;
foreach ($principleContacts as $principleContact):
$class = null;
if ($i++ % 2 == 0) {
$class = ' class="altrow"';
$class = ' class="altrow"';
}
?>
<tr<?php echo $class;?>>
<td>
<?php echo $principleContact['PrincipleContact']['first_name'].' '.$principleContact['PrincipleContact']['last_name']; ?>
</td>
<td>
<?php echo $principleContact['PrincipleContact']['job_title']; ?>
</td>
<td>
<?php echo $principleContact['PrincipleContact']['email']; ?>
</td>
<td>
<?php echo $principleContact['PrincipleContact']['phone']; ?>
</td>
<td>
<?php echo $principleContact['PrincipleContact']['fax']; ?>
</td>
<td>
<?php echo $principleContact['PrincipleContact']['notes']; ?>
</td>
<td class="actions">
<?php echo $html->link(__('View', true), array('controller' => 'users', 'action'=>'view', $principleContact['PrincipleContact']['id'])); ?>
<?php echo $html->link(__('Edit', true), array('controller' => 'users', 'action'=>'edit', $principleContact['PrincipleContact']['id'])); ?>
</td>
</tr>
<?php endforeach; ?>
?>
<tr<?php echo $class;?>>
<td>
<?php echo $principleContact['PrincipleContact']['first_name'].' '.$principleContact['PrincipleContact']['last_name']; ?>
</td>
<td>
<?php echo $principleContact['PrincipleContact']['job_title']; ?>
</td>
<td>
<?php echo $principleContact['PrincipleContact']['email']; ?>
</td>
<td>
<?php echo $principleContact['PrincipleContact']['phone']; ?>
</td>
<td>
<?php echo $principleContact['PrincipleContact']['fax']; ?>
</td>
<td>
<?php echo $principleContact['PrincipleContact']['notes']; ?>
</td>
<td class="actions">
<button id="<?=$principleContact['PrincipleContact']['id']?>" class="ViewEditButton">View/Edit</button>
</td>
</tr>
<?php endforeach; ?>
</table>
<span id="userType">principle</span>

View file

@ -1,3 +1,6 @@
<? echo $javascript->link('add_edit_user'); ?>
<div class="principles view">
<h2><?php __('Principle');?></h2>
<dl><?php $i = 0; $class = ' class="altrow"';?>
@ -118,7 +121,6 @@
</div>
</div>
<? echo $javascript->link('add_edit_user'); ?>
<div id="addUserDiv">

View file

@ -47,7 +47,6 @@ foreach ($users as $user):
<td class="actions">
<?php echo $html->link(__('View', true), array('action'=>'view', $user['User']['id'])); ?>
<?php echo $html->link(__('Edit', true), array('action'=>'edit', $user['User']['id'])); ?>
<?php echo $html->link(__('Delete', true), array('action'=>'delete', $user['User']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $user['User']['id'])); ?>
</td>
</tr>
<?php endforeach; ?>

View file

@ -1548,4 +1548,8 @@ table.lineItems tr td.price {
padding-left: 0.5em;
padding-right: 0.5em;
white-space: nowrap;
}
#userType {
display: none;
}

View file

@ -59,10 +59,10 @@ $(function() {
//Editing a Customer Contact
$('.ViewEditButton').click(function() {
var userType ='contact';
var userType = $('#userType').html();
var thisAction = 'edit';
var user_id = $(this).attr('id');
$("#addUserDiv").dialog( "option", "title", 'Edit Customer Contact' );
$("#addUserDiv").dialog( "option", "title", 'Edit Contact' );
$("#addUserDiv").load('/users/add_edit/action:'+thisAction+'/type:'+userType+'/user_id:'+user_id);
$("#addUserDiv").dialog('open');